{"version":3,"file":"block_meta.cjs","names":["z","DescriptionContentText","DescriptionContentBinary","ContentExplicitBase64","ContentExplicitBytes"],"sources":["../../src/block_meta/block_meta.ts"],"sourcesContent":["import { z } from \"zod\";\nimport {\n  ContentExplicitBase64,\n  ContentExplicitBytes,\n  DescriptionContentBinary,\n  DescriptionContentText,\n} from \"./content_types\";\n\nexport const BlockPlatform = z.enum([\n  \"windows-x64\",\n  \"windows-aarch64\",\n  \"macosx-x64\",\n  \"macosx-aarch64\",\n  \"linux-x64\",\n  \"linux-aarch64\",\n]);\nexport type BlockPlatform = z.infer<typeof BlockPlatform>;\n\n/**\n * Static metadata a block author ships: title, descriptions, logos, social\n * links, and capability requirements. Parameterized by the carriers used for\n * long-string fields (`LongString`) and binary fields (`Binary`); the same\n * shape carries `package.json` form (loose strings), manifest form (relative\n * paths), and embedded form (inlined base64 or bytes).\n *\n * Forward-compatibility: the boundary zod schemas (`BlockPackMeta(...)` and\n * `organization`) use `.passthrough()` so that unknown sibling fields survive\n * parse/round-trip verbatim. A registry mutator that predates a new meta\n * field must not silently strip it (otherwise mark-stable / refresh-overview\n * / restore-overview would quietly undo publishes). Code consuming these\n * objects sees only the known fields listed below; the schemas guard the\n * round-trip behavior. Combined with the `require-latest @platforma-sdk/block-tools`\n * CI gate, this future-proofs every subsequent field addition.\n */\nexport type BlockPackMeta<LongString, Binary> = {\n  title: string;\n  description: string;\n  longDescription?: LongString;\n  changelog?: LongString;\n  logo?: Binary;\n  url?: string;\n  docs?: string;\n  support?: string;\n  tags?: string[];\n  organization: {\n    name: string;\n    url: string;\n    logo?: Binary;\n  };\n  marketplaceRanking?: number;\n  deprecated?: boolean;\n  termsOfServiceUrl?: string;\n  supportedPlatforms?: BlockPlatform[];\n  requiredCapabilities?: string[];\n};\n\nexport function BlockPackMeta<\n  const LongStringType extends z.ZodTypeAny,\n  const BinaryType extends z.ZodTypeAny,\n>(longString: LongStringType, binary: BinaryType) {\n  return z\n    .object({\n      title: z.string(),\n      description: z.string(),\n      longDescription: longString.optional(),\n      changelog: longString.optional(),\n      logo: binary.optional(),\n      url: z.string().url().optional(),\n      docs: z.string().url().optional(),\n      support: z.union([z.string().url(), z.string().email()]).optional(),\n      tags: z.array(z.string()).optional(),\n      organization: z\n        .object({\n          name: z.string(),\n          url: z.string().url(),\n          logo: binary.optional(),\n        })\n        .passthrough(),\n      /**\n       * The order of blocks on the \"marketplace\" (higher values push block higher to the top of the list).\n       * `undefined` value or absent field is treated exactly the same as number `0`.\n       */\n      marketplaceRanking: z.number().optional(),\n      /**\n       * If true, the block is deprecated and should not be used.\n       */\n      deprecated: z.boolean().optional(),\n      /**\n       * The URL to the Terms of Service for the block. If provided checkbox with link to this URL should be shown in order to add block.\n       */\n      termsOfServiceUrl: z.string().url().optional(),\n      /**\n       * Supported operating systems.\n       * If not provided, the block is supported on all operating systems.\n       */\n      supportedPlatforms: z.array(BlockPlatform).optional(),\n      /**\n       * Runtime capabilities the block needs from the backend (e.g.\n       * \"wasm:v1\"). Desktop refuses to install if any listed token is\n       * missing from the backend's `serverInfo.capabilities`.\n       *\n       * Tokens follow the backend's `<feature>:<version>` format defined in\n       * `core/pl/platform/api/plapiserver/server_capabilities.go`. The\n       * schema itself accepts loose strings (not an enum) so future\n       * capabilities don't break Desktops that ship before each token is\n       * added — the same forward-compat property `BlockPackMeta` itself\n       * enjoys at the field level, applied recursively at the token level.\n       */\n      requiredCapabilities: z.array(z.string()).optional(),\n    })\n    .passthrough();\n  // `.passthrough()` is intentional — see forward-compat note on\n  // `BlockPackMeta` type above.\n}\n\nexport const BlockPackMetaDescriptionRaw = BlockPackMeta(\n  DescriptionContentText,\n  DescriptionContentBinary,\n);\nexport type BlockPackMetaDescriptionRaw = z.infer<typeof BlockPackMetaDescriptionRaw>;\n\nexport const BlockPackMetaEmbeddedBase64 = BlockPackMeta(z.string(), ContentExplicitBase64);\nexport type BlockPackMetaEmbeddedBase64 = z.infer<typeof BlockPackMetaEmbeddedBase64>;\n\nexport const BlockPackMeta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