{"version":3,"file":"block_manifest.cjs","names":["z","WorkflowSchemaV1","ContentRelative","BlockPackMeta","ContentRelativeText","ContentRelativeBinary","CreateBlockPackDescriptionSchema"],"sources":["../../src/block_meta/block_manifest.ts"],"sourcesContent":["import { z } from \"zod\";\nimport type { BlockComponents } from \"./block_components\";\nimport { WorkflowSchemaV1 } from \"./block_components\";\nimport { ContentRelative, ContentRelativeBinary, ContentRelativeText } from \"./content_types\";\nimport { CreateBlockPackDescriptionSchema } from \"./block_description\";\nimport { BlockPackMeta } from \"./block_meta\";\nimport { toMerged } from \"es-toolkit\";\nimport type { BlockPackId } from \"./block_id\";\n\nexport type BlockComponentsManifest = BlockComponents<ContentRelative, ContentRelative>;\n\n/**\n * Block-components shape stored in a manifest. The consolidator always writes\n * the wrapped `{type: \"workflow-v1\", main: ...}` form, so the manifest schema\n * accepts the wrapped form only.\n */\nexport const BlockComponentsManifest = z.object({\n  workflow: WorkflowSchemaV1(ContentRelative),\n  model: ContentRelative,\n  ui: ContentRelative,\n}) satisfies z.ZodType<BlockComponentsManifest>;\n\nexport const BlockPackMetaManifest = BlockPackMeta(ContentRelativeText, ContentRelativeBinary);\nexport type BlockPackMetaManifest = z.infer<typeof BlockPackMetaManifest>;\n\n/** Block description to be used in block manifest */\nexport const BlockPackDescriptionManifest = CreateBlockPackDescriptionSchema(\n  BlockComponentsManifest,\n  BlockPackMetaManifest,\n);\nexport type BlockPackDescriptionManifest = z.infer<typeof BlockPackDescriptionManifest>;\n\nexport const Sha256Schema = z\n  .string()\n  .regex(/[0-9a-fA-F]/)\n  .toUpperCase()\n  .length(64); // 256 / 4 (bits per hex register);\n\nexport const ManifestFileInfo = z.object({\n  name: z.string(),\n  size: z.number().int(),\n  sha256: Sha256Schema,\n});\nexport type ManifestFileInfo = z.infer<typeof ManifestFileInfo>;\n\nexport const BlockPackManifest = z\n  .object({\n    schema: z.literal(\"v2\"),\n    description: BlockPackDescriptionManifest,\n    timestamp: z.number().optional(),\n    files: z.array(ManifestFileInfo),\n  })\n  .passthrough();\nexport type BlockPackManifest = z.infer<typeof BlockPackManifest>;\n\nexport const BlockPackManifestFile = \"manifest.json\";\n\nexport function overrideManifestVersion<T extends { description: { id: BlockPackId } }>(\n  manifest: T,\n  newVersion: string,\n): T {\n  return toMerged(manifest, { description: { id: { version: newVersion } } }) as T;\n}\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAa,0BAA0BA,IAAAA,EAAE,OAAO;CAC9C,UAAUC,yBAAAA,iBAAiBC,sBAAAA,eAAe;CAC1C,OAAOA,sBAAAA;CACP,IAAIA,sBAAAA;AACN,CAAC;AAED,MAAa,wBAAwBC,mBAAAA,cAAcC,sBAAAA,qBAAqBC,sBAAAA,qBAAqB;;AAI7F,MAAa,+BAA+BC,0BAAAA,iCAC1C,yBACA,qBACF;AAGA,MAAa,eAAeN,IAAAA,EACzB,OAAO,CAAC,CACR,MAAM,aAAa,CAAC,CACpB,YAAY,CAAC,CACb,OAAO,EAAE;AAEZ,MAAa,mBAAmBA,IAAAA,EAAE,OAAO;CACvC,MAAMA,IAAAA,EAAE,OAAO;CACf,MAAMA,IAAAA,EAAE,OAAO,CAAC,CAAC,IAAI;CACrB,QAAQ;AACV,CAAC;AAGD,MAAa,oBAAoBA,IAAAA,EAC9B,OAAO;CACN,QAAQA,IAAAA,EAAE,QAAQ,IAAI;CACtB,aAAa;CACb,WAAWA,IAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,OAAOA,IAAAA,EAAE,MAAM,gBAAgB;AACjC,CAAC,CAAC,CACD,YAAY;AAGf,MAAa,wBAAwB;AAErC,SAAgB,wBACd,UACA,YACG;CACH,QAAA,GAAA,WAAA,SAAA,CAAgB,UAAU,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,WAAW,EAAE,EAAE,CAAC;AAC5E"}