@asterdoc/schemas 0.0.0-stage → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +76 -2
  3. package/dist/index.d.ts +3040 -0
  4. package/dist/index.js +2096 -0
  5. package/package.json +82 -3
  6. package/schemas/2026-10-28/address.json +53 -0
  7. package/schemas/2026-10-28/attachment.json +31 -0
  8. package/schemas/2026-10-28/bbox.json +22 -0
  9. package/schemas/2026-10-28/bundle-content-item.json +122 -0
  10. package/schemas/2026-10-28/bundle.json +267 -0
  11. package/schemas/2026-10-28/checklist-item.json +113 -0
  12. package/schemas/2026-10-28/checklist.json +300 -0
  13. package/schemas/2026-10-28/cond-expr.json +18 -0
  14. package/schemas/2026-10-28/content-ref.json +76 -0
  15. package/schemas/2026-10-28/coordinate.json +26 -0
  16. package/schemas/2026-10-28/defs-section.json +862 -0
  17. package/schemas/2026-10-28/document.json +292 -0
  18. package/schemas/2026-10-28/duration.json +8 -0
  19. package/schemas/2026-10-28/fieldset-field.json +49 -0
  20. package/schemas/2026-10-28/form-annex.json +33 -0
  21. package/schemas/2026-10-28/form-field.json +1037 -0
  22. package/schemas/2026-10-28/form-party.json +150 -0
  23. package/schemas/2026-10-28/form.json +369 -0
  24. package/schemas/2026-10-28/identification.json +44 -0
  25. package/schemas/2026-10-28/layer.json +556 -0
  26. package/schemas/2026-10-28/list-field.json +51 -0
  27. package/schemas/2026-10-28/metadata.json +35 -0
  28. package/schemas/2026-10-28/money.json +25 -0
  29. package/schemas/2026-10-28/organization.json +49 -0
  30. package/schemas/2026-10-28/person.json +49 -0
  31. package/schemas/2026-10-28/phone.json +32 -0
  32. package/schemas/2026-10-28/rule-severity.json +11 -0
  33. package/schemas/2026-10-28/rules-section.json +46 -0
  34. package/schemas/2026-10-28/signature.json +68 -0
  35. package/schemas/2026-10-28/validation-rule.json +34 -0
  36. package/schemas/2026-10-28.json +4636 -0
  37. package/schemas/config.json +174 -0
  38. package/schemas/lock.json +151 -0
  39. package/schemas/manifest.json +184 -0
  40. package/schemas/registry-item.json +488 -0
  41. package/schemas/registry.json +281 -0
  42. package/schemas/schema.json +4636 -0
package/dist/index.js ADDED
@@ -0,0 +1,2096 @@
1
+ // src/zod/config.ts
2
+ var SCHEMA_VERSIONS = ["2026-10-28"];
3
+ var SCHEMA_VERSION = "2026-10-28";
4
+ var SCHEMA_BASE = "https://schema.asterdoc.com";
5
+ var MANIFEST_SCHEMA_ID = `${SCHEMA_BASE}/manifest.json`;
6
+ var CONFIG_SCHEMA_ID = `${SCHEMA_BASE}/config.json`;
7
+ var LOCK_SCHEMA_ID = `${SCHEMA_BASE}/lock.json`;
8
+ var REGISTRY_SCHEMA_ID = `${SCHEMA_BASE}/registry.json`;
9
+ var REGISTRY_ITEM_SCHEMA_ID = `${SCHEMA_BASE}/registry-item.json`;
10
+ var SCHEMA_ROOT_ID = `${SCHEMA_BASE}/schema.json`;
11
+ var SCHEMA_VERSIONED_ID = `${SCHEMA_BASE}/${SCHEMA_VERSION}.json`;
12
+ var schemaId = (name) => `${SCHEMA_BASE}/${SCHEMA_VERSION}/${name}.json`;
13
+ function schemaVersionUrl(version) {
14
+ return `${SCHEMA_BASE}/${version}.json`;
15
+ }
16
+ function isSchemaVersion(value) {
17
+ return SCHEMA_VERSIONS.includes(value);
18
+ }
19
+ var DATED_ADDRESS = /^([0-9]{4}-[0-9]{2}-[0-9]{2})(?:\.json|\/[a-z][a-z0-9-]*\.json)$/;
20
+ function readSchemaAddress(address) {
21
+ const prefix = `${SCHEMA_BASE}/`;
22
+ if (!address.startsWith(prefix)) return { kind: "foreign" };
23
+ const rest = address.slice(prefix.length);
24
+ const match = DATED_ADDRESS.exec(rest);
25
+ if (!match) return { kind: "undated" };
26
+ const version = match[1];
27
+ return isSchemaVersion(version) ? { kind: "known", version } : { kind: "unknown-version", version };
28
+ }
29
+
30
+ // src/zod/module.ts
31
+ import { z as z35 } from "zod";
32
+
33
+ // src/zod/artifacts/form/index.ts
34
+ import { z as z30 } from "zod";
35
+
36
+ // src/zod/primitives/name.ts
37
+ var ARTIFACT_NAME_PATTERN = /^[A-Za-z0-9]([A-Za-z0-9]|-[A-Za-z0-9])*$/;
38
+ var IDENTIFIER_PATTERN = /^[a-z][a-zA-Z0-9_]*$/;
39
+ var REGISTRY_NAMESPACE_PATTERN = /^@[a-zA-Z0-9][a-zA-Z0-9-_]*$/;
40
+ var HOSTNAME_NAMESPACE_SOURCE = "@[a-z0-9-]+(?:\\.[a-z0-9-]+)+";
41
+ var unanchored = (pattern) => pattern.source.slice(1, -1);
42
+ var ARTIFACT_REFERENCE_PATTERN = new RegExp(
43
+ `^(?:${unanchored(REGISTRY_NAMESPACE_PATTERN)}|${HOSTNAME_NAMESPACE_SOURCE})/${unanchored(ARTIFACT_NAME_PATTERN)}$`
44
+ );
45
+
46
+ // src/zod/artifacts/shared/base.ts
47
+ import { z as z6 } from "zod";
48
+
49
+ // src/zod/primitives/metadata.ts
50
+ import { z } from "zod";
51
+ var MetadataSchema = z.record(
52
+ z.string().min(1).max(100).regex(/^[A-Za-z0-9]([A-Za-z0-9]|-[A-Za-z0-9])*$/).describe("Metadata key identifier. Must start with alphanumeric character and can contain alphanumeric characters and hyphens"),
53
+ z.union([
54
+ z.string().max(500).describe("Metadata value as a string (max 500 characters)"),
55
+ z.number().describe("Metadata value as a number"),
56
+ z.boolean().describe("Metadata value as a boolean"),
57
+ z.null().describe("Metadata value as null")
58
+ ])
59
+ ).meta({
60
+ title: "Metadata",
61
+ description: "Custom key-value pairs for storing domain-specific or organizational metadata. Keys must be alphanumeric with hyphens, values can be strings, numbers, booleans, or null"
62
+ });
63
+
64
+ // src/zod/primitives/version.ts
65
+ var CORE_AND_PRERELEASE_SOURCE = "(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?";
66
+ var BUILD_METADATA_SOURCE = "(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?";
67
+ var ARTIFACT_VERSION_PATTERN = new RegExp(`^${CORE_AND_PRERELEASE_SOURCE}${BUILD_METADATA_SOURCE}$`);
68
+ var REGISTRY_VERSION_PATTERN = new RegExp(`^${CORE_AND_PRERELEASE_SOURCE}$`);
69
+ function parseVersion(version) {
70
+ const match = ARTIFACT_VERSION_PATTERN.exec(version);
71
+ if (!match) return void 0;
72
+ const prerelease = match[4];
73
+ return {
74
+ core: [match[1], match[2], match[3]],
75
+ prerelease: prerelease === void 0 ? [] : prerelease.split(".")
76
+ };
77
+ }
78
+ var NUMERIC_IDENTIFIER = /^\d+$/;
79
+ function compareNumeric(a, b) {
80
+ if (a.length !== b.length) return a.length < b.length ? -1 : 1;
81
+ return compareText(a, b);
82
+ }
83
+ function compareText(a, b) {
84
+ if (a === b) return 0;
85
+ return a < b ? -1 : 1;
86
+ }
87
+ function comparePrerelease(a, b) {
88
+ if (a.length === 0 || b.length === 0) return b.length - a.length;
89
+ for (let i = 0; i < Math.min(a.length, b.length); i += 1) {
90
+ const left = a[i];
91
+ const right = b[i];
92
+ const leftNumeric = NUMERIC_IDENTIFIER.test(left);
93
+ const rightNumeric = NUMERIC_IDENTIFIER.test(right);
94
+ if (leftNumeric !== rightNumeric) return leftNumeric ? -1 : 1;
95
+ const order = leftNumeric ? compareNumeric(left, right) : compareText(left, right);
96
+ if (order !== 0) return order;
97
+ }
98
+ return a.length - b.length;
99
+ }
100
+ function compareArtifactVersions(a, b) {
101
+ const left = parseVersion(a);
102
+ const right = parseVersion(b);
103
+ if (!left || !right) {
104
+ if (!left && !right) return compareText(a, b);
105
+ return left ? 1 : -1;
106
+ }
107
+ for (let i = 0; i < 3; i += 1) {
108
+ const order = compareNumeric(left.core[i], right.core[i]);
109
+ if (order !== 0) return order;
110
+ }
111
+ return Math.sign(comparePrerelease(left.prerelease, right.prerelease));
112
+ }
113
+
114
+ // src/zod/artifacts/shared/content-ref.ts
115
+ import { z as z3 } from "zod";
116
+
117
+ // src/zod/primitives/checksum.ts
118
+ import { z as z2 } from "zod";
119
+ var ChecksumSchema = z2.string().regex(/^sha256:[a-f0-9]{64}$/).describe("SHA-256 checksum for integrity verification");
120
+
121
+ // src/zod/artifacts/shared/content-ref.ts
122
+ var InlineContentRefSchema = z3.object({
123
+ kind: z3.literal("inline"),
124
+ text: z3.string().min(1).max(1e6).describe("Inline text content")
125
+ }).strict().meta({
126
+ title: "InlineContentRef",
127
+ description: "Inline content reference with embedded text"
128
+ });
129
+ var FileContentRefSchema = z3.object({
130
+ kind: z3.literal("file"),
131
+ path: z3.string().min(1).max(1e3).describe("Path to the content file"),
132
+ mimeType: z3.string().min(1).max(100).describe("MIME type of the file content"),
133
+ title: z3.string().min(1).max(200).describe("Human-readable title").optional(),
134
+ description: z3.string().min(1).max(2e3).describe("Description of the content").optional(),
135
+ checksum: ChecksumSchema.optional()
136
+ }).strict().meta({
137
+ title: "FileContentRef",
138
+ description: "File content reference with path and metadata"
139
+ });
140
+ var ContentRefSchema = z3.discriminatedUnion("kind", [
141
+ InlineContentRefSchema,
142
+ FileContentRefSchema
143
+ ]).meta({
144
+ title: "ContentRef",
145
+ description: "Content reference \u2014 inline text or file reference"
146
+ });
147
+
148
+ // src/zod/artifacts/shared/edition.ts
149
+ import { z as z5 } from "zod";
150
+
151
+ // src/zod/primitives/artifact-selectors.ts
152
+ import { z as z4 } from "zod";
153
+
154
+ // src/zod/primitives/artifact-coordinate.ts
155
+ var SEGMENT_SOURCE = "[a-z0-9](?:[a-z0-9]|-[a-z0-9])*";
156
+ var COORDINATE_SEGMENT_PATTERN = new RegExp(`^${SEGMENT_SOURCE}$`);
157
+ var CURRENT_EDITION = "current";
158
+ var LATEST_VERSION = "latest";
159
+ var RESERVED_EDITION_KEYS = ["current", "latest", "editions", "tags", "diff"];
160
+ function isReservedEditionKey(value) {
161
+ return RESERVED_EDITION_KEYS.includes(value);
162
+ }
163
+ var EDITION_KEY_PATTERN = /^[a-z0-9]([a-z0-9]|-[a-z0-9])*$/;
164
+ var EDITION_KEY_MAX_LENGTH = 64;
165
+ var EDITION_KEY_SCHEMA_PATTERN = new RegExp(
166
+ `^(?!(?:${RESERVED_EDITION_KEYS.join("|")})$)${EDITION_KEY_PATTERN.source.slice(1)}`
167
+ );
168
+ var unanchored2 = (pattern) => pattern.source.slice(1, -1);
169
+ var ADDRESS_SOURCE = `@?${SEGMENT_SOURCE}/${SEGMENT_SOURCE}/${SEGMENT_SOURCE}`;
170
+ var VERSION_SOURCE = `${LATEST_VERSION}|${unanchored2(ARTIFACT_VERSION_PATTERN)}`;
171
+ var EDITION_SOURCE = [
172
+ `(?!(?:${RESERVED_EDITION_KEYS.filter((key) => key !== CURRENT_EDITION).join("|")})(?:@|$))`,
173
+ `(?=[a-z0-9-]{1,${EDITION_KEY_MAX_LENGTH}}(?:@|$))`,
174
+ unanchored2(EDITION_KEY_PATTERN)
175
+ ].join("");
176
+ var ARTIFACT_ADDRESS_PATTERN = new RegExp(`^${ADDRESS_SOURCE}$`);
177
+ var ARTIFACT_COORDINATE_PATTERN = new RegExp(
178
+ `^${ADDRESS_SOURCE}(?:/(?:${EDITION_SOURCE}))?(?:@(?:${VERSION_SOURCE}))?$`
179
+ );
180
+ var COORDINATE_PARTS = new RegExp(
181
+ `^@?(?<org>${SEGMENT_SOURCE})/(?<repo>${SEGMENT_SOURCE})/(?<name>${SEGMENT_SOURCE})(?:/(?<edition>${EDITION_SOURCE}))?(?:@(?<version>${VERSION_SOURCE}))?$`
182
+ );
183
+ function parseArtifactCoordinate(value) {
184
+ const match = COORDINATE_PARTS.exec(value);
185
+ if (!match) return void 0;
186
+ const { org, repo, name, edition, version } = match.groups;
187
+ if (edition !== void 0 && edition !== CURRENT_EDITION && isReservedEditionKey(edition)) return void 0;
188
+ if (edition !== void 0 && edition.length > EDITION_KEY_MAX_LENGTH) return void 0;
189
+ return {
190
+ org,
191
+ repo,
192
+ name,
193
+ ...edition !== void 0 && edition !== CURRENT_EDITION && { edition },
194
+ ...version !== void 0 && version !== LATEST_VERSION && { version }
195
+ };
196
+ }
197
+ function formatArtifactCoordinate(coordinate) {
198
+ const edition = coordinate.edition === void 0 ? "" : `/${coordinate.edition}`;
199
+ const version = coordinate.version === void 0 ? "" : `@${coordinate.version}`;
200
+ return `@${coordinate.org}/${coordinate.repo}/${coordinate.name}${edition}${version}`;
201
+ }
202
+ function isEditionSelector(value) {
203
+ return value === CURRENT_EDITION || value.length <= EDITION_KEY_MAX_LENGTH && EDITION_KEY_PATTERN.test(value) && !isReservedEditionKey(value);
204
+ }
205
+ function isVersionSelector(value) {
206
+ return value === LATEST_VERSION || ARTIFACT_VERSION_PATTERN.test(value);
207
+ }
208
+
209
+ // src/zod/primitives/artifact-selectors.ts
210
+ var EditionKeySchema = z4.string().min(1).max(EDITION_KEY_MAX_LENGTH).regex(
211
+ EDITION_KEY_SCHEMA_PATTERN,
212
+ `Expected an edition key: lowercase letters and digits with single hyphens, such as 2024-03, and not one of ${RESERVED_EDITION_KEYS.join(", ")}`
213
+ );
214
+ var EditionSelectorSchema = z4.string().max(EDITION_KEY_MAX_LENGTH).refine(isEditionSelector, "Expected an edition key, such as 2024-03, or 'current'");
215
+ var VersionSelectorSchema = z4.string().max(200).refine(isVersionSelector, "Expected a version, such as 1.2.0, or 'latest'");
216
+ var ArtifactCoordinateSchema = z4.string().regex(
217
+ ARTIFACT_COORDINATE_PATTERN,
218
+ "Expected a registry coordinate such as @org/repo/name, @org/repo/name/2024-03 or @org/repo/name/2024-03@1.0.0"
219
+ );
220
+
221
+ // src/zod/artifacts/shared/edition.ts
222
+ var EDITION_DATE_PATTERN = new RegExp(
223
+ `^(?:\\d{4}(?:-(?:0[1-9]|1[0-2]))?|${z5.regexes.date.source.slice(1, -1)})$`
224
+ );
225
+ var editionFactsShape = {
226
+ label: z5.string().min(1).max(200).describe(`The issuer's edition text exactly as printed, such as "Rev. March 2024". For display only.`),
227
+ date: z5.string().regex(EDITION_DATE_PATTERN, "Expected an edition date as YYYY, YYYY-MM or YYYY-MM-DD that names a real day").describe("When the issuer released the edition, at the precision the issuer gives: YYYY, YYYY-MM or YYYY-MM-DD.").optional(),
228
+ effectiveFrom: z5.iso.date().describe("The date the edition takes effect. Only when the issuer prints one.").optional()
229
+ };
230
+ var ArtifactEditionSchema = z5.object({
231
+ key: EditionKeySchema.describe("Stable edition identifier, unique among the editions of one artifact (for example 2024-03 or 3b). Lowercase letters and digits with single hyphens, and not current, latest, editions, tags or diff. It is the edition segment of a coordinate such as @org/repo/w-9/2024-03 and never changes once published."),
232
+ ...editionFactsShape
233
+ }).strict().meta({
234
+ title: "ArtifactEdition",
235
+ description: "One edition of an issued artifact, as printed by its issuer. Facts the issuer decides later, such as which edition is current, are not part of it."
236
+ });
237
+
238
+ // src/zod/artifacts/shared/base.ts
239
+ var ArtifactSchema = z6.object({
240
+ $schema: z6.url().describe("JSON Schema URI for this artifact instance.").optional(),
241
+ name: z6.string().min(1).max(128).regex(ARTIFACT_NAME_PATTERN).describe("Artifact identifier. Must start with a letter or digit, can contain letters, numbers, and hyphens (no leading/trailing/consecutive hyphens). Every edition of one artifact shares the same name."),
242
+ version: z6.string().min(1).max(200).regex(ARTIFACT_VERSION_PATTERN).describe("Artifact version (SemVer 2.0.0, such as 1.2.3 or 1.3.0-beta.1). It counts the publisher's own changes, never the issuer's edition; each edition has its own version line. Required for publishing to registry.").optional(),
243
+ title: z6.string().min(1).max(200).describe("Human-readable title. Recommended for published/shared artifacts and directory browsing.").optional(),
244
+ description: z6.string().min(0).max(2e3).describe("Detailed description or context for the artifact.").optional(),
245
+ code: z6.string().min(1).max(200).describe("The form number as printed by its issuer, such as W-9 or ACORD 25, or a self-issued form's own number.").optional(),
246
+ issuer: z6.string().min(1).max(200).describe("The organization that issues the form, such as U.S. Internal Revenue Service.").optional(),
247
+ edition: ArtifactEditionSchema.describe("The issuer's edition this artifact encodes. Omitted for artifacts that are not issued in editions.").optional(),
248
+ language: z6.string().min(2).max(35).regex(/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/).describe("BCP 47-style source language tag for this artifact. Defaults to en when omitted.").optional(),
249
+ metadata: MetadataSchema.describe("Custom key-value pairs for storing domain-specific or organizational metadata").optional(),
250
+ instructions: ContentRefSchema.describe("Domain or compliance reference content (e.g., IRS instructions, regulatory guidance)").optional(),
251
+ agentInstructions: ContentRefSchema.describe("LLM/agent prompts for field ordering, grouping, tone, and presentation guidance").optional()
252
+ }).meta({
253
+ title: "Artifact",
254
+ description: "Root schema for all Asterdoc artifacts (containers and documents)."
255
+ });
256
+
257
+ // src/zod/artifacts/shared/layer.ts
258
+ import { z as z7 } from "zod";
259
+ var SignatureSlotTypeSchema = z7.enum(["signature", "initials", "date_signed", "capacity", "printed_name"]).describe("Type of signing field: signature/initials (glyph), date_signed, capacity (signer role/title), or printed_name");
260
+ var AbsolutePlacementSchema = z7.object({
261
+ page: z7.number().int().min(1).describe("1-based page number"),
262
+ x: z7.number().min(0).describe("X in points from the left page edge"),
263
+ y: z7.number().min(0).describe("Y in points from the top page edge"),
264
+ width: z7.number().min(1).describe("Width in points"),
265
+ height: z7.number().min(1).describe("Height in points")
266
+ }).strict().meta({ title: "AbsolutePlacement" });
267
+ var AnchorPlacementSchema = z7.object({
268
+ anchor: z7.object({
269
+ text: z7.string().min(1).max(500).describe("Literal document text to find; must be unique unless occurrence is set"),
270
+ offsetX: z7.number().describe("Horizontal offset in points from the left of the found text").optional(),
271
+ offsetY: z7.number().describe("Vertical offset in points from the top of the found text").optional(),
272
+ occurrence: z7.number().int().min(1).describe("1-based match index in reading order when the text repeats").optional()
273
+ }).strict(),
274
+ width: z7.number().min(1).describe("Width in points"),
275
+ height: z7.number().min(1).describe("Height in points")
276
+ }).strict().meta({ title: "AnchorPlacement" });
277
+ var SignatureSlotSchema = z7.object({
278
+ party: z7.object({
279
+ role: z7.string().min(1).max(100).describe("Party role this slot binds to"),
280
+ index: z7.number().int().min(0).describe("0-based index for multi-party roles; defaults to 0").optional()
281
+ }).strict(),
282
+ type: SignatureSlotTypeSchema,
283
+ required: z7.boolean().describe("Whether this slot must be signed. Defaults to true").optional(),
284
+ label: z7.string().min(1).max(200).describe("Human-readable label").optional(),
285
+ placement: z7.union([
286
+ z7.literal("flow").describe("In-flow: the field sits where the template content places it; located after conversion via an injected marker"),
287
+ AbsolutePlacementSchema,
288
+ AnchorPlacementSchema
289
+ ]).describe("Placement: 'flow', absolute coordinates, or a text anchor")
290
+ }).strict().meta({
291
+ title: "SignatureSlot",
292
+ description: "Signature slot binding a party to a placement on this layer"
293
+ });
294
+ var REACT_LAYER_MIME_TYPES = ["text/tsx", "text/jsx"];
295
+ function isReactLayerMimeType(mimeType) {
296
+ return mimeType !== void 0 && REACT_LAYER_MIME_TYPES.includes(mimeType.toLowerCase());
297
+ }
298
+ var REACT_LAYER_RULE = `React layers must be file layers: ${REACT_LAYER_MIME_TYPES.join(" and ")} name a composition module by path, so an inline layer cannot declare one`;
299
+ function caseInsensitiveAlternative(value) {
300
+ return [...value].map(
301
+ (character) => /[a-z]/i.test(character) ? `[${character.toLowerCase()}${character.toUpperCase()}]` : character.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
302
+ ).join("");
303
+ }
304
+ var REACT_LAYER_MIME_PATTERN = `^(?:${REACT_LAYER_MIME_TYPES.map(caseInsensitiveAlternative).join("|")})$`;
305
+ var LayerBaseSchema = z7.object({
306
+ mimeType: z7.string().min(1).max(100).describe("MIME type of the layer content (e.g., text/markdown, application/pdf)"),
307
+ title: z7.string().min(1).max(200).describe("Human-readable title for this layer").optional(),
308
+ description: z7.string().min(1).max(2e3).describe("Description of what this layer represents").optional(),
309
+ signatures: z7.record(
310
+ z7.string().min(1).max(100).describe("Slot ID"),
311
+ SignatureSlotSchema
312
+ ).describe("Signature slots keyed by slot id").optional()
313
+ });
314
+ var InlineLayerSchema = LayerBaseSchema.extend({
315
+ kind: z7.literal("inline"),
316
+ // The exclusion is stated to JSON Schema as well as to Zod: a refinement
317
+ // alone would validate at runtime and vanish from the published schema.
318
+ mimeType: z7.string().min(1).max(100).refine((value) => !isReactLayerMimeType(value), { error: REACT_LAYER_RULE }).describe("MIME type of the layer content (e.g., text/markdown). Never a React composition type").meta({ not: { pattern: REACT_LAYER_MIME_PATTERN } }),
319
+ text: z7.string().min(1).max(1e6).describe("Layer content with interpolation placeholders (e.g., {{fields.fieldName}})")
320
+ }).strict().meta({
321
+ title: "InlineLayer",
322
+ description: "Inline layer with embedded content"
323
+ });
324
+ var LAYER_FONT_RULE = "Only PDF layers (application/pdf) can declare a font";
325
+ var LAYER_BINDINGS_RULE = "Only PDF layers (application/pdf) can declare bindings; other templates name values as {{fields.fieldName}}";
326
+ var PDF_MIME_PATTERN = `^${caseInsensitiveAlternative("application/pdf")}$`;
327
+ function isPdfMimeType(mimeType) {
328
+ return mimeType.toLowerCase() === "application/pdf";
329
+ }
330
+ var DOCX_MIME_TYPE = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
331
+ function isDocxMimeType(mimeType) {
332
+ return mimeType.toLowerCase() === DOCX_MIME_TYPE;
333
+ }
334
+ var TEXT_TEMPLATE_MIME_TYPES = ["text/plain", "text/markdown", "text/html"];
335
+ function isTextTemplateMimeType(mimeType) {
336
+ return TEXT_TEMPLATE_MIME_TYPES.includes(mimeType.toLowerCase());
337
+ }
338
+ var PdfBindingsSchema = z7.record(
339
+ z7.string().min(1).max(500).describe("AcroForm field name in the PDF template, fully qualified (e.g., topmostSubform[0].Page1[0].f1_01[0])"),
340
+ z7.string().min(1).max(500).describe("Asterdoc path whose value fills the field (e.g., fields.name, parties.buyer.name)")
341
+ ).describe("PDF layers only. Maps each AcroForm field name (key) to the Asterdoc path (value) that fills it");
342
+ var PdfBindingsFromSchema = z7.string().min(1).max(128).describe("PDF layers only. Key of a sibling PDF layer whose bindings this layer reuses");
343
+ function pdfOnlyLayerKeysJsonSchema(keys) {
344
+ return keys.map((key) => ({
345
+ if: { required: [key] },
346
+ then: { properties: { mimeType: { pattern: PDF_MIME_PATTERN } } }
347
+ }));
348
+ }
349
+ var LayerFontSchema = z7.object({
350
+ path: z7.string().min(1).max(1e3).describe("Logical resolver path of a TrueType-outline font program (.ttf), resolved like the layer path"),
351
+ checksum: ChecksumSchema.optional()
352
+ }).strict().meta({
353
+ title: "LayerFont",
354
+ description: "Font a PDF layer draws filled values and overlay text with"
355
+ });
356
+ var LAYER_FORMAT_RULE = "Only PDF layers (application/pdf) can declare a format";
357
+ var LayerMoneyFormatSchema = z7.object({
358
+ currencyDisplay: z7.literal("none").describe("`none` prints the amount without a currency symbol or code, for a template that pre-prints the symbol beside each money box")
359
+ }).strict().meta({
360
+ title: "LayerMoneyFormat",
361
+ description: "How a PDF layer presents money values"
362
+ });
363
+ var LayerFormatSchema = z7.object({
364
+ money: LayerMoneyFormatSchema.optional()
365
+ }).strict().meta({
366
+ title: "LayerFormat",
367
+ description: "Presentation a PDF layer's template requires of filled values, applied over the caller's formatter"
368
+ });
369
+ var FileLayerObjectSchema = LayerBaseSchema.extend({
370
+ kind: z7.literal("file"),
371
+ path: z7.string().min(1).max(1e3).describe("Logical resolver path; the CLI resolves file-backed artifacts from their directory and stdin artifacts from cwd"),
372
+ checksum: ChecksumSchema.optional(),
373
+ font: LayerFontSchema.describe("Font for filled values and overlay text; PDF layers only. It is tried after a font supplied at render time and before the form's own fonts").optional(),
374
+ format: LayerFormatSchema.describe("Presentation the template requires of filled values; PDF layers only. It applies to this layer alone, not to a layer that reuses its bindings").optional(),
375
+ bindings: PdfBindingsSchema.optional(),
376
+ bindingsFrom: PdfBindingsFromSchema.optional()
377
+ }).strict();
378
+ var PDF_ONLY_FILE_LAYER_KEYS = ["font", "format", "bindings", "bindingsFrom"];
379
+ function withPdfOnlyFileLayerRules(schema) {
380
+ return schema.refine(
381
+ (layer) => layer.font === void 0 || isPdfMimeType(layer.mimeType),
382
+ { error: LAYER_FONT_RULE, path: ["font"] }
383
+ ).refine(
384
+ (layer) => layer.format === void 0 || isPdfMimeType(layer.mimeType),
385
+ { error: LAYER_FORMAT_RULE, path: ["format"] }
386
+ ).refine(
387
+ (layer) => layer.bindings === void 0 || isPdfMimeType(layer.mimeType),
388
+ { error: LAYER_BINDINGS_RULE, path: ["bindings"] }
389
+ ).refine(
390
+ (layer) => layer.bindingsFrom === void 0 || isPdfMimeType(layer.mimeType),
391
+ { error: LAYER_BINDINGS_RULE, path: ["bindingsFrom"] }
392
+ );
393
+ }
394
+ var FileLayerSchema = withPdfOnlyFileLayerRules(FileLayerObjectSchema.meta({
395
+ title: "FileLayer",
396
+ description: "File-backed layer with path reference"
397
+ }));
398
+ var LayerSchema = z7.discriminatedUnion("kind", [
399
+ InlineLayerSchema,
400
+ FileLayerSchema
401
+ ]).meta({
402
+ title: "Layer",
403
+ description: "Layer specification \u2014 inline content or file reference",
404
+ // The file layer's font, format and bindings refinements.
405
+ allOf: pdfOnlyLayerKeysJsonSchema(PDF_ONLY_FILE_LAYER_KEYS)
406
+ });
407
+ var REACT_LAYER_FORM_ONLY_RULE = `Only a form can declare a React layer: a composition renders a form and its data, so a document or checklist layer cannot be ${REACT_LAYER_MIME_TYPES.join(" or ")}`;
408
+ function withoutReactLayers(layers) {
409
+ return layers.superRefine((value, ctx) => {
410
+ for (const [key, layer] of Object.entries(value)) {
411
+ if (isReactLayerMimeType(layer.mimeType)) {
412
+ ctx.addIssue({ code: "custom", path: [key, "mimeType"], message: REACT_LAYER_FORM_ONLY_RULE });
413
+ }
414
+ }
415
+ }).meta({
416
+ allOf: [{
417
+ additionalProperties: {
418
+ not: { properties: { mimeType: { pattern: REACT_LAYER_MIME_PATTERN } }, required: ["mimeType"] }
419
+ }
420
+ }]
421
+ });
422
+ }
423
+
424
+ // src/zod/artifacts/expressions/defs-section.ts
425
+ import { z as z9 } from "zod";
426
+
427
+ // src/zod/artifacts/expressions/expression.ts
428
+ import { z as z8 } from "zod";
429
+ var BaseExpressionSchema = z8.object({
430
+ label: z8.string().min(1).max(200).describe("Display label for the computed value").optional(),
431
+ description: z8.string().min(1).max(1e3).describe("Description or documentation of the computed value").optional()
432
+ }).strict();
433
+ var ExpressionString = z8.string().min(1).max(2e3).describe("Expression string to evaluate");
434
+ var OptionalExpressionString = ExpressionString.optional();
435
+ var BooleanExpressionSchema = BaseExpressionSchema.extend({
436
+ type: z8.literal("boolean"),
437
+ value: z8.string().min(1).max(2e3).describe("Expression that evaluates to a boolean")
438
+ });
439
+ var StringExpressionSchema = BaseExpressionSchema.extend({
440
+ type: z8.literal("string"),
441
+ value: z8.string().min(1).max(2e3).describe("Expression that evaluates to a string")
442
+ });
443
+ var NumberExpressionSchema = BaseExpressionSchema.extend({
444
+ type: z8.literal("number"),
445
+ value: z8.string().min(1).max(2e3).describe("Expression that evaluates to a number")
446
+ });
447
+ var IntegerExpressionSchema = BaseExpressionSchema.extend({
448
+ type: z8.literal("integer"),
449
+ value: z8.string().min(1).max(2e3).describe("Expression that evaluates to an integer")
450
+ });
451
+ var PercentageExpressionSchema = BaseExpressionSchema.extend({
452
+ type: z8.literal("percentage"),
453
+ value: z8.string().min(1).max(2e3).describe("Expression that evaluates to a percentage (0-100)")
454
+ });
455
+ var RatingExpressionSchema = BaseExpressionSchema.extend({
456
+ type: z8.literal("rating"),
457
+ value: z8.string().min(1).max(2e3).describe("Expression that evaluates to a rating value")
458
+ });
459
+ var DateExpressionSchema = BaseExpressionSchema.extend({
460
+ type: z8.literal("date"),
461
+ value: z8.string().min(1).max(2e3).describe("Expression that evaluates to an ISO 8601 date (YYYY-MM-DD)")
462
+ });
463
+ var TimeExpressionSchema = BaseExpressionSchema.extend({
464
+ type: z8.literal("time"),
465
+ value: z8.string().min(1).max(2e3).describe("Expression that evaluates to a time (HH:MM:SS)")
466
+ });
467
+ var DatetimeExpressionSchema = BaseExpressionSchema.extend({
468
+ type: z8.literal("datetime"),
469
+ value: z8.string().min(1).max(2e3).describe("Expression that evaluates to an ISO 8601 datetime")
470
+ });
471
+ var DurationExpressionSchema = BaseExpressionSchema.extend({
472
+ type: z8.literal("duration"),
473
+ value: z8.string().min(1).max(2e3).describe("Expression that evaluates to an ISO 8601 duration string")
474
+ });
475
+ var MoneyExpressionSchema = BaseExpressionSchema.extend({
476
+ type: z8.literal("money"),
477
+ value: z8.object({
478
+ amount: ExpressionString,
479
+ currency: ExpressionString
480
+ }).strict().describe("Money object with amount and currency expressions")
481
+ });
482
+ var AddressExpressionSchema = BaseExpressionSchema.extend({
483
+ type: z8.literal("address"),
484
+ value: z8.object({
485
+ line1: ExpressionString,
486
+ line2: OptionalExpressionString,
487
+ locality: ExpressionString,
488
+ region: ExpressionString,
489
+ postalCode: ExpressionString,
490
+ country: ExpressionString
491
+ }).strict().describe("Address object with component expressions")
492
+ });
493
+ var PhoneExpressionSchema = BaseExpressionSchema.extend({
494
+ type: z8.literal("phone"),
495
+ value: z8.object({
496
+ number: ExpressionString,
497
+ type: OptionalExpressionString,
498
+ extension: OptionalExpressionString
499
+ }).strict().describe("Phone object with number and optional type/extension expressions")
500
+ });
501
+ var CoordinateExpressionValueSchema = z8.object({
502
+ lat: ExpressionString,
503
+ lon: ExpressionString
504
+ }).strict();
505
+ var CoordinateExpressionSchema = BaseExpressionSchema.extend({
506
+ type: z8.literal("coordinate"),
507
+ value: CoordinateExpressionValueSchema.describe("Coordinate object with latitude and longitude expressions")
508
+ });
509
+ var BboxExpressionSchema = BaseExpressionSchema.extend({
510
+ type: z8.literal("bbox"),
511
+ value: z8.object({
512
+ southWest: CoordinateExpressionValueSchema.describe("Southwest (minimum) corner expressions"),
513
+ northEast: CoordinateExpressionValueSchema.describe("Northeast (maximum) corner expressions")
514
+ }).strict().describe("Bounding box with southwest and northeast corner expressions")
515
+ });
516
+ var PersonExpressionSchema = BaseExpressionSchema.extend({
517
+ type: z8.literal("person"),
518
+ value: z8.object({
519
+ name: ExpressionString,
520
+ title: OptionalExpressionString,
521
+ firstName: OptionalExpressionString,
522
+ middleName: OptionalExpressionString,
523
+ lastName: OptionalExpressionString,
524
+ suffix: OptionalExpressionString
525
+ }).strict().describe("Person object with name component expressions")
526
+ });
527
+ var OrganizationExpressionSchema = BaseExpressionSchema.extend({
528
+ type: z8.literal("organization"),
529
+ value: z8.object({
530
+ name: ExpressionString,
531
+ legalName: OptionalExpressionString,
532
+ domicile: OptionalExpressionString,
533
+ entityType: OptionalExpressionString,
534
+ entityId: OptionalExpressionString,
535
+ taxId: OptionalExpressionString
536
+ }).strict().describe("Organization object with component expressions")
537
+ });
538
+ var IdentificationExpressionSchema = BaseExpressionSchema.extend({
539
+ type: z8.literal("identification"),
540
+ value: z8.object({
541
+ type: ExpressionString,
542
+ number: ExpressionString,
543
+ issuer: OptionalExpressionString,
544
+ issueDate: OptionalExpressionString,
545
+ expiryDate: OptionalExpressionString
546
+ }).strict().describe("Identification object with type, number, and optional issuer/date expressions")
547
+ });
548
+ var SCALAR_EXPRESSION_SCHEMAS = [
549
+ BooleanExpressionSchema,
550
+ StringExpressionSchema,
551
+ NumberExpressionSchema,
552
+ IntegerExpressionSchema,
553
+ PercentageExpressionSchema,
554
+ RatingExpressionSchema,
555
+ DateExpressionSchema,
556
+ TimeExpressionSchema,
557
+ DatetimeExpressionSchema,
558
+ DurationExpressionSchema
559
+ ];
560
+ var OBJECT_EXPRESSION_SCHEMAS = [
561
+ MoneyExpressionSchema,
562
+ AddressExpressionSchema,
563
+ PhoneExpressionSchema,
564
+ CoordinateExpressionSchema,
565
+ BboxExpressionSchema,
566
+ PersonExpressionSchema,
567
+ OrganizationExpressionSchema,
568
+ IdentificationExpressionSchema
569
+ ];
570
+ var ExpressionSchema = z8.discriminatedUnion("type", [
571
+ ...SCALAR_EXPRESSION_SCHEMAS,
572
+ ...OBJECT_EXPRESSION_SCHEMAS
573
+ ]).meta({
574
+ title: "Expression",
575
+ description: "A typed computed value with optional metadata (label, description). The type property determines the expected result type and value schema."
576
+ });
577
+ var SCALAR_EXPRESSION_TYPES = SCALAR_EXPRESSION_SCHEMAS.map((schema) => schema.shape.type.value);
578
+ var OBJECT_EXPRESSION_TYPES = OBJECT_EXPRESSION_SCHEMAS.map((schema) => schema.shape.type.value);
579
+ var ALL_EXPRESSION_TYPES = [...SCALAR_EXPRESSION_TYPES, ...OBJECT_EXPRESSION_TYPES];
580
+
581
+ // src/zod/artifacts/expressions/defs-section.ts
582
+ var DefsSectionSchema = z9.record(
583
+ z9.string().min(1).max(100).regex(IDENTIFIER_PATTERN).describe("Definition identifier (camelCase, starts with lowercase letter)"),
584
+ ExpressionSchema
585
+ ).meta({
586
+ title: "DefsSection",
587
+ description: "Named computed values with type information that can be referenced in conditional expressions"
588
+ });
589
+
590
+ // src/zod/artifacts/rules/rules-section.ts
591
+ import { z as z11 } from "zod";
592
+
593
+ // src/zod/artifacts/rules/validation-rule.ts
594
+ import { z as z10 } from "zod";
595
+ var RuleSeveritySchema = z10.enum(["error", "warning"]).describe("Severity level: error blocks submission, warning allows but warns");
596
+ var ValidationRuleSchema = z10.object({
597
+ expr: z10.string().min(1).max(2e3).describe('Boolean expression that must evaluate to true for the form to be valid. Has access to field values directly (e.g., "ssn or ein") and defs section values.'),
598
+ message: z10.string().min(1).max(500).describe("Error message displayed when the rule fails (expression evaluates to false)"),
599
+ severity: RuleSeveritySchema.describe("Severity level: error (default) blocks submission, warning allows but warns").optional()
600
+ }).strict().meta({
601
+ title: "ValidationRule",
602
+ description: "A form-level validation rule with a boolean expression and error message"
603
+ });
604
+
605
+ // src/zod/artifacts/rules/rules-section.ts
606
+ var RulesSectionSchema = z11.record(
607
+ z11.string().min(1).max(100).regex(IDENTIFIER_PATTERN).describe("Validation rule identifier (camelCase, starts with lowercase letter)"),
608
+ ValidationRuleSchema
609
+ ).meta({
610
+ title: "RulesSection",
611
+ description: "Form-level validation rules keyed by rule identifier. Rules use expressions to validate cross-field constraints."
612
+ });
613
+
614
+ // src/zod/artifacts/form/field.ts
615
+ import { z as z24 } from "zod";
616
+
617
+ // src/zod/artifacts/form/base-field.ts
618
+ import { z as z13 } from "zod";
619
+
620
+ // src/zod/artifacts/expressions/cond-expr.ts
621
+ import { z as z12 } from "zod";
622
+ var CondExprSchema = z12.union([
623
+ z12.boolean().describe("Literal boolean value"),
624
+ z12.string().min(1).max(2e3).describe("Expression string - either inline expression or reference to a defs key")
625
+ ]).meta({
626
+ title: "CondExpr",
627
+ description: "Conditional expression: boolean literal or expression string"
628
+ });
629
+
630
+ // src/zod/artifacts/form/base-field.ts
631
+ var BaseFieldSchema = z13.object({
632
+ label: z13.string().min(1).max(200).describe("Display label for the field").optional(),
633
+ description: z13.string().min(1).max(1e3).describe("Description or help text for the field").optional(),
634
+ required: CondExprSchema.optional(),
635
+ visible: CondExprSchema.optional()
636
+ }).strict();
637
+
638
+ // src/zod/primitives/coordinate.ts
639
+ import { z as z14 } from "zod";
640
+ var CoordinateSchema = z14.object({
641
+ lat: z14.number().min(-90).max(90).describe("Latitude in decimal degrees (WGS84), range -90 (South Pole) to 90 (North Pole)"),
642
+ lon: z14.number().min(-180).max(180).describe("Longitude in decimal degrees (WGS84), range -180 (west) to 180 (east)")
643
+ }).strict().meta({
644
+ title: "Coordinate",
645
+ description: "Geographic coordinate (WGS84) with latitude and longitude in decimal degrees"
646
+ });
647
+
648
+ // src/zod/primitives/bbox.ts
649
+ import { z as z15 } from "zod";
650
+ var BboxSchema = z15.object({
651
+ southWest: CoordinateSchema.describe("Southwest corner coordinate (minimum latitude and longitude)"),
652
+ northEast: CoordinateSchema.describe("Northeast corner coordinate (maximum latitude and longitude)")
653
+ }).strict().meta({
654
+ title: "Bbox",
655
+ description: "Geographic bounding box defined by southwest (minimum) and northeast (maximum) corner coordinates"
656
+ });
657
+
658
+ // src/zod/primitives/money.ts
659
+ import { z as z16 } from "zod";
660
+ var CurrencyCodeSchema = z16.string().min(3).max(3).regex(/^[A-Z]{3}$/);
661
+ var MoneySchema = z16.object({
662
+ amount: z16.number().describe("Monetary amount expressed in decimal form (e.g., 99.99 for USD). Negative values allowed for debts/credits"),
663
+ currency: CurrencyCodeSchema.describe("ISO 4217 alpha-3 currency code (e.g., USD, EUR, GBP)")
664
+ }).strict().meta({
665
+ title: "Money",
666
+ description: "Monetary value with currency code. Represents an amount in a specific currency, supporting both positive and negative values"
667
+ });
668
+
669
+ // src/zod/primitives/address.ts
670
+ import { z as z17 } from "zod";
671
+ var AddressSchema = z17.object({
672
+ line1: z17.string().min(1).max(200).describe("Primary address line"),
673
+ line2: z17.string().max(200).describe("Secondary address line").optional(),
674
+ locality: z17.string().min(1).max(200).describe("City or locality name"),
675
+ region: z17.string().min(1).max(100).describe("State, province, or region name"),
676
+ postalCode: z17.string().min(3).max(20).regex(/^[A-Z0-9\s-]+$/).describe("Postal or ZIP code"),
677
+ country: z17.string().min(2).max(100).describe('ISO 3166-1 country code (e.g., "US", "GB", "FRA") or full country name')
678
+ }).strict().meta({
679
+ title: "Address",
680
+ description: "Physical address with street, locality, region, postal code, and country"
681
+ });
682
+
683
+ // src/zod/primitives/phone.ts
684
+ import { z as z18 } from "zod";
685
+ var PhoneSchema = z18.object({
686
+ number: z18.string().min(8).max(16).regex(/^\+[1-9]\d{1,14}$/).describe("Phone number in E.164 international format (e.g., +14155552671)"),
687
+ type: z18.string().min(1).max(50).describe("Type or category of phone number (e.g., mobile, work, home)").optional(),
688
+ extension: z18.string().min(1).max(20).describe("Phone extension or extension number").optional()
689
+ }).strict().meta({
690
+ title: "Phone",
691
+ description: "Phone number in E.164 international format with optional type and extension"
692
+ });
693
+
694
+ // src/zod/primitives/duration.ts
695
+ import { z as z19 } from "zod";
696
+ var ISO_8601_DURATION_PATTERN = String.raw`^P(?=\d|T\d)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(?:T(?=\d)(\d+H)?(\d+M)?(\d+(?:\.\d+)?S)?)?$`;
697
+ var ISO_8601_DURATION_REGEX = new RegExp(ISO_8601_DURATION_PATTERN);
698
+ var DurationSchema = z19.string().regex(ISO_8601_DURATION_REGEX).meta({
699
+ title: "Duration",
700
+ description: "ISO 8601 duration string representing a time period. Format: P[n]Y[n]M[n]W[n]DT[n]H[n]M[n]S where P indicates period, T separates date and time components. Examples: P1Y (1 year), P3M (3 months), P2W (2 weeks), P1DT12H (1 day 12 hours), PT30M (30 minutes), PT5S (5 seconds)"
701
+ });
702
+
703
+ // src/zod/primitives/person.ts
704
+ import { z as z20 } from "zod";
705
+ var PersonSchema = z20.object({
706
+ name: z20.string().min(1).max(200).describe("Person's full name (complete name as a single string)"),
707
+ title: z20.string().min(1).max(50).describe("Name prefix or title (e.g., Mr., Mrs., Dr., Prof.)").optional(),
708
+ firstName: z20.string().min(1).max(100).describe("Person's first or given name").optional(),
709
+ middleName: z20.string().min(1).max(100).describe("Person's middle name or initial").optional(),
710
+ lastName: z20.string().min(1).max(100).describe("Person's last name or surname").optional(),
711
+ suffix: z20.string().min(1).max(50).describe("Name suffix (e.g., Jr., Sr., III, Esq.)").optional()
712
+ }).strict().meta({
713
+ title: "Person",
714
+ description: "Person with name (required) and optional name components (title, first name, middle name, last name, suffix)"
715
+ });
716
+
717
+ // src/zod/primitives/organization.ts
718
+ import { z as z21 } from "zod";
719
+ var OrganizationSchema = z21.object({
720
+ name: z21.string().min(1).max(200).describe("Organization name"),
721
+ legalName: z21.string().min(1).max(200).describe("Legal or registered name of the organization").optional(),
722
+ domicile: z21.string().min(1).max(100).describe("Domicile").optional(),
723
+ entityType: z21.string().min(1).max(100).describe("Legal entity type of the organization").optional(),
724
+ entityId: z21.string().min(1).max(100).describe("Business identification number").optional(),
725
+ taxId: z21.string().min(1).max(100).describe("Tax identification number").optional()
726
+ }).strict().meta({
727
+ title: "Organization",
728
+ description: "Organization with legal details and identification"
729
+ });
730
+
731
+ // src/zod/primitives/identification.ts
732
+ import { z as z22 } from "zod";
733
+ var IdentificationSchema = z22.object({
734
+ type: z22.string().min(1).max(50).describe("Type of identification document (e.g., ssn, passport, license, ein)"),
735
+ number: z22.string().min(1).max(100).describe("Identification number or identifier"),
736
+ issuer: z22.string().min(1).max(100).describe("Issuing authority, country, or state (e.g., US, CA, DMV)").optional(),
737
+ issueDate: z22.iso.date().describe("Issue date in ISO 8601 format (YYYY-MM-DD)").optional(),
738
+ expiryDate: z22.iso.date().describe("Expiry date in ISO 8601 format (YYYY-MM-DD)").optional()
739
+ }).strict().meta({
740
+ title: "Identification",
741
+ description: "Identification document with type, number, issuer, and optional issue and expiry dates"
742
+ });
743
+
744
+ // src/zod/artifacts/form/pattern.ts
745
+ import { z as z23 } from "zod";
746
+ import safeRegex from "safe-regex";
747
+ var MAX_PATTERN_LENGTH = 500;
748
+ function findPatternProblem(pattern) {
749
+ if (pattern.length > MAX_PATTERN_LENGTH) return "too_long";
750
+ try {
751
+ new RegExp(pattern);
752
+ } catch {
753
+ return "invalid";
754
+ }
755
+ if (!safeRegex(pattern)) return "redos";
756
+ return void 0;
757
+ }
758
+ var PATTERN_PROBLEM_PHRASES = {
759
+ too_long: `exceeds the maximum length of ${MAX_PATTERN_LENGTH} characters`,
760
+ invalid: "has invalid regular expression syntax",
761
+ redos: "is potentially unsafe (ReDoS vulnerability detected)"
762
+ };
763
+ function describePatternProblem(problem, subject = "Pattern") {
764
+ return `${subject} ${PATTERN_PROBLEM_PHRASES[problem]}`;
765
+ }
766
+ var FieldPatternSchema = z23.string().min(1).max(MAX_PATTERN_LENGTH).superRefine((pattern, ctx) => {
767
+ const problem = findPatternProblem(pattern);
768
+ if (problem) ctx.addIssue({ code: "custom", message: describePatternProblem(problem) });
769
+ }).describe("Regular expression pattern for validation");
770
+
771
+ // src/zod/artifacts/form/ordered-bounds.ts
772
+ function getOrderedBoundsIssue(min, max, minField, maxField, isOrdered) {
773
+ if (min === void 0 || max === void 0 || isOrdered(min, max)) {
774
+ return void 0;
775
+ }
776
+ return {
777
+ path: [maxField],
778
+ message: `${maxField} must be greater than or equal to ${minField}`
779
+ };
780
+ }
781
+ function compareTemporalBounds(min, max) {
782
+ const minTime = Date.parse(min);
783
+ const maxTime = Date.parse(max);
784
+ if (Number.isFinite(minTime) && Number.isFinite(maxTime)) {
785
+ return minTime <= maxTime;
786
+ }
787
+ return min <= max;
788
+ }
789
+ function parseClockTimeSeconds(value) {
790
+ const match = /^(\d{2}):(\d{2})(?::(\d{2}(?:\.\d+)?))?$/.exec(value);
791
+ if (!match) return void 0;
792
+ const hours = Number(match[1]);
793
+ const minutes = Number(match[2]);
794
+ const seconds = match[3] !== void 0 ? Number(match[3]) : 0;
795
+ if (![hours, minutes, seconds].every(Number.isFinite)) return void 0;
796
+ return hours * 3600 + minutes * 60 + seconds;
797
+ }
798
+ function compareClockTimeBounds(min, max) {
799
+ const minSeconds = parseClockTimeSeconds(min);
800
+ const maxSeconds = parseClockTimeSeconds(max);
801
+ if (minSeconds !== void 0 && maxSeconds !== void 0) {
802
+ return minSeconds <= maxSeconds;
803
+ }
804
+ return min <= max;
805
+ }
806
+
807
+ // src/zod/artifacts/form/field.ts
808
+ var EnumOptionValueSchema = z24.union([z24.string(), z24.number()]);
809
+ var EnumOptionSchema = z24.object({
810
+ value: EnumOptionValueSchema.describe("Internal option value"),
811
+ label: z24.string().min(1).max(200).describe("Human-readable label for the option in the artifact source language").optional()
812
+ }).strict();
813
+ var CountSchema = z24.number().int().min(0);
814
+ var EnumOptionsSchema = z24.array(EnumOptionSchema).min(1).superRefine((options, ctx) => {
815
+ const seen = /* @__PURE__ */ new Set();
816
+ options.forEach((option, index) => {
817
+ if (seen.has(option.value)) {
818
+ ctx.addIssue({
819
+ code: "custom",
820
+ path: [index, "value"],
821
+ message: `Duplicate option value ${JSON.stringify(option.value)}`
822
+ });
823
+ }
824
+ seen.add(option.value);
825
+ });
826
+ });
827
+ var TextFieldSchema = BaseFieldSchema.extend({
828
+ type: z24.literal("text"),
829
+ minLength: CountSchema.describe("Minimum length").optional(),
830
+ maxLength: CountSchema.describe("Maximum length").optional(),
831
+ pattern: FieldPatternSchema.optional(),
832
+ default: z24.string().describe("Default value").optional()
833
+ }).superRefine((field, ctx) => {
834
+ const issue = getOrderedBoundsIssue(
835
+ field.minLength,
836
+ field.maxLength,
837
+ "minLength",
838
+ "maxLength",
839
+ (min, max) => min <= max
840
+ );
841
+ if (issue) ctx.addIssue({ code: "custom", ...issue });
842
+ });
843
+ var BooleanFieldSchema = BaseFieldSchema.extend({
844
+ type: z24.literal("boolean"),
845
+ default: z24.boolean().describe("Default value").optional()
846
+ });
847
+ var NumberFieldSchema = BaseFieldSchema.extend({
848
+ type: z24.literal("number"),
849
+ min: z24.number().describe("Minimum value").optional(),
850
+ max: z24.number().describe("Maximum value").optional(),
851
+ step: z24.number().positive().describe("Allowed increment: a value must be a multiple of step (e.g., 0.01 for cents)").optional(),
852
+ default: z24.number().describe("Default value").optional()
853
+ }).superRefine((field, ctx) => {
854
+ const issue = getOrderedBoundsIssue(field.min, field.max, "min", "max", (min, max) => min <= max);
855
+ if (issue) ctx.addIssue({ code: "custom", ...issue });
856
+ });
857
+ var CoordinateFieldSchema = BaseFieldSchema.extend({
858
+ type: z24.literal("coordinate"),
859
+ default: CoordinateSchema.optional()
860
+ });
861
+ var BboxFieldSchema = BaseFieldSchema.extend({
862
+ type: z24.literal("bbox"),
863
+ default: BboxSchema.optional()
864
+ });
865
+ var MoneyFieldSchema = BaseFieldSchema.extend({
866
+ type: z24.literal("money"),
867
+ min: z24.number().describe("Minimum amount").optional(),
868
+ max: z24.number().describe("Maximum amount").optional(),
869
+ currency: CurrencyCodeSchema.describe("ISO 4217 alpha-3 currency code a value must use (e.g., USD). Omit to accept any currency").optional(),
870
+ default: MoneySchema.optional()
871
+ }).superRefine((field, ctx) => {
872
+ const issue = getOrderedBoundsIssue(field.min, field.max, "min", "max", (min, max) => min <= max);
873
+ if (issue) ctx.addIssue({ code: "custom", ...issue });
874
+ });
875
+ var AddressFieldSchema = BaseFieldSchema.extend({
876
+ type: z24.literal("address"),
877
+ default: AddressSchema.optional()
878
+ });
879
+ var PhoneFieldSchema = BaseFieldSchema.extend({
880
+ type: z24.literal("phone"),
881
+ default: PhoneSchema.optional()
882
+ });
883
+ var DurationFieldSchema = BaseFieldSchema.extend({
884
+ type: z24.literal("duration"),
885
+ default: DurationSchema.optional()
886
+ });
887
+ var EmailFieldSchema = BaseFieldSchema.extend({
888
+ type: z24.literal("email"),
889
+ minLength: CountSchema.describe("Minimum length").optional(),
890
+ maxLength: CountSchema.describe("Maximum length").optional(),
891
+ default: z24.string().describe("Default value").optional()
892
+ }).superRefine((field, ctx) => {
893
+ const issue = getOrderedBoundsIssue(
894
+ field.minLength,
895
+ field.maxLength,
896
+ "minLength",
897
+ "maxLength",
898
+ (min, max) => min <= max
899
+ );
900
+ if (issue) ctx.addIssue({ code: "custom", ...issue });
901
+ });
902
+ var UuidFieldSchema = BaseFieldSchema.extend({
903
+ type: z24.literal("uuid"),
904
+ minLength: CountSchema.describe("Minimum length").optional(),
905
+ maxLength: CountSchema.describe("Maximum length").optional(),
906
+ pattern: FieldPatternSchema.optional(),
907
+ default: z24.string().describe("Default value").optional()
908
+ }).superRefine((field, ctx) => {
909
+ const issue = getOrderedBoundsIssue(
910
+ field.minLength,
911
+ field.maxLength,
912
+ "minLength",
913
+ "maxLength",
914
+ (min, max) => min <= max
915
+ );
916
+ if (issue) ctx.addIssue({ code: "custom", ...issue });
917
+ });
918
+ var UriFieldSchema = BaseFieldSchema.extend({
919
+ type: z24.literal("uri"),
920
+ minLength: CountSchema.describe("Minimum length").optional(),
921
+ maxLength: CountSchema.describe("Maximum length").optional(),
922
+ pattern: FieldPatternSchema.optional(),
923
+ default: z24.string().describe("Default value").optional()
924
+ }).superRefine((field, ctx) => {
925
+ const issue = getOrderedBoundsIssue(
926
+ field.minLength,
927
+ field.maxLength,
928
+ "minLength",
929
+ "maxLength",
930
+ (min, max) => min <= max
931
+ );
932
+ if (issue) ctx.addIssue({ code: "custom", ...issue });
933
+ });
934
+ var EnumFieldSchema = BaseFieldSchema.extend({
935
+ type: z24.literal("enum"),
936
+ enum: EnumOptionsSchema.describe("Array of allowed options for the enum field"),
937
+ default: EnumOptionValueSchema.describe("Default value").optional()
938
+ }).superRefine((field, ctx) => {
939
+ if (field.default !== void 0 && !field.enum.some((option) => option.value === field.default)) {
940
+ ctx.addIssue({
941
+ code: "custom",
942
+ path: ["default"],
943
+ message: "Default value must match one of the enum option values"
944
+ });
945
+ }
946
+ });
947
+ var DateFieldSchema = BaseFieldSchema.extend({
948
+ type: z24.literal("date"),
949
+ min: z24.iso.date().describe("Minimum date (ISO 8601: YYYY-MM-DD)").optional(),
950
+ max: z24.iso.date().describe("Maximum date (ISO 8601: YYYY-MM-DD)").optional(),
951
+ default: z24.iso.date().describe("Default value").optional()
952
+ }).superRefine((field, ctx) => {
953
+ const issue = getOrderedBoundsIssue(field.min, field.max, "min", "max", compareTemporalBounds);
954
+ if (issue) ctx.addIssue({ code: "custom", ...issue });
955
+ });
956
+ var DatetimeValueSchema = z24.iso.datetime({ offset: true }).regex(
957
+ /^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])T(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/
958
+ );
959
+ var DatetimeFieldSchema = BaseFieldSchema.extend({
960
+ type: z24.literal("datetime"),
961
+ min: DatetimeValueSchema.describe("Minimum datetime (ISO 8601 with Z or \xB1HH:MM timezone)").optional(),
962
+ max: DatetimeValueSchema.describe("Maximum datetime (ISO 8601 with Z or \xB1HH:MM timezone)").optional(),
963
+ default: DatetimeValueSchema.describe("Default value").optional()
964
+ }).superRefine((field, ctx) => {
965
+ const issue = getOrderedBoundsIssue(field.min, field.max, "min", "max", compareTemporalBounds);
966
+ if (issue) ctx.addIssue({ code: "custom", ...issue });
967
+ });
968
+ var TimeValueSchema = z24.string().regex(/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?$/);
969
+ var TimeFieldSchema = BaseFieldSchema.extend({
970
+ type: z24.literal("time"),
971
+ min: TimeValueSchema.describe("Minimum time (HH:MM:SS[.fff])").optional(),
972
+ max: TimeValueSchema.describe("Maximum time (HH:MM:SS[.fff])").optional(),
973
+ default: TimeValueSchema.describe("Default value").optional()
974
+ }).superRefine((field, ctx) => {
975
+ const issue = getOrderedBoundsIssue(field.min, field.max, "min", "max", compareClockTimeBounds);
976
+ if (issue) ctx.addIssue({ code: "custom", ...issue });
977
+ });
978
+ var PersonFieldSchema = BaseFieldSchema.extend({
979
+ type: z24.literal("person"),
980
+ default: PersonSchema.optional()
981
+ });
982
+ var OrganizationFieldSchema = BaseFieldSchema.extend({
983
+ type: z24.literal("organization"),
984
+ default: OrganizationSchema.optional()
985
+ });
986
+ var IdentificationFieldSchema = BaseFieldSchema.extend({
987
+ type: z24.literal("identification"),
988
+ allowedTypes: z24.array(z24.string()).describe("Allowed ID types (e.g., passport, drivers_license)").optional(),
989
+ default: IdentificationSchema.optional()
990
+ });
991
+ var MultiselectFieldSchema = BaseFieldSchema.extend({
992
+ type: z24.literal("multiselect"),
993
+ enum: EnumOptionsSchema.describe("Available options"),
994
+ min: CountSchema.describe("Minimum selections required").optional(),
995
+ max: CountSchema.describe("Maximum selections allowed").optional(),
996
+ default: z24.array(EnumOptionValueSchema).describe("Default selected values").optional()
997
+ }).superRefine((field, ctx) => {
998
+ const issue = getOrderedBoundsIssue(field.min, field.max, "min", "max", (min, max) => min <= max);
999
+ if (issue) ctx.addIssue({ code: "custom", ...issue });
1000
+ field.default?.forEach((value, index) => {
1001
+ if (!field.enum.some((option) => option.value === value)) {
1002
+ ctx.addIssue({
1003
+ code: "custom",
1004
+ path: ["default", index],
1005
+ message: "Default value must match one of the multiselect option values"
1006
+ });
1007
+ }
1008
+ });
1009
+ });
1010
+ var PercentageFieldSchema = BaseFieldSchema.extend({
1011
+ type: z24.literal("percentage"),
1012
+ min: z24.number().describe("Minimum value (default: 0)").optional(),
1013
+ max: z24.number().describe("Maximum value (default: 100)").optional(),
1014
+ precision: CountSchema.describe("Decimal places (default: 2)").optional(),
1015
+ default: z24.number().describe("Default value").optional()
1016
+ }).superRefine((field, ctx) => {
1017
+ const issue = getOrderedBoundsIssue(field.min, field.max, "min", "max", (min, max) => min <= max);
1018
+ if (issue) ctx.addIssue({ code: "custom", ...issue });
1019
+ });
1020
+ var RatingFieldSchema = BaseFieldSchema.extend({
1021
+ type: z24.literal("rating"),
1022
+ min: z24.number().describe("Minimum value (default: 1)").optional(),
1023
+ max: z24.number().describe("Maximum value (default: 5)").optional(),
1024
+ step: z24.number().positive().describe("Increment step (e.g., 0.5 for half stars, default: 1)").optional(),
1025
+ default: z24.number().describe("Default value").optional()
1026
+ }).superRefine((field, ctx) => {
1027
+ const issue = getOrderedBoundsIssue(field.min, field.max, "min", "max", (min, max) => min <= max);
1028
+ if (issue) ctx.addIssue({ code: "custom", ...issue });
1029
+ });
1030
+ var FieldsetFieldObjectSchema = BaseFieldSchema.extend({
1031
+ type: z24.literal("fieldset"),
1032
+ fields: z24.lazy(() => z24.record(
1033
+ z24.string().min(1).max(100).regex(IDENTIFIER_PATTERN).describe("Nested field identifier (camelCase, starts with lowercase letter)"),
1034
+ FormFieldSchema
1035
+ ))
1036
+ }).meta({
1037
+ id: "FieldsetField",
1038
+ title: "FieldsetField",
1039
+ description: "Field that groups nested fields under one key"
1040
+ });
1041
+ var FieldsetFieldSchema = FieldsetFieldObjectSchema;
1042
+ var ListFieldObjectSchema = BaseFieldSchema.extend({
1043
+ type: z24.literal("list"),
1044
+ item: z24.lazy(() => FormFieldSchema),
1045
+ minItems: z24.number().int().min(0).describe("Minimum number of items").optional(),
1046
+ maxItems: z24.number().int().min(0).describe("Maximum number of items").optional()
1047
+ }).superRefine((field, ctx) => {
1048
+ const issue = getOrderedBoundsIssue(
1049
+ field.minItems,
1050
+ field.maxItems,
1051
+ "minItems",
1052
+ "maxItems",
1053
+ (min, max) => min <= max
1054
+ );
1055
+ if (issue) ctx.addIssue({ code: "custom", ...issue });
1056
+ }).meta({
1057
+ id: "ListField",
1058
+ title: "ListField",
1059
+ description: "Field that holds a list of items, each shaped by the item field"
1060
+ });
1061
+ var ListFieldSchema = ListFieldObjectSchema;
1062
+ var FIELD_SCHEMAS = [
1063
+ TextFieldSchema,
1064
+ BooleanFieldSchema,
1065
+ NumberFieldSchema,
1066
+ CoordinateFieldSchema,
1067
+ BboxFieldSchema,
1068
+ MoneyFieldSchema,
1069
+ AddressFieldSchema,
1070
+ PhoneFieldSchema,
1071
+ DurationFieldSchema,
1072
+ EmailFieldSchema,
1073
+ UuidFieldSchema,
1074
+ UriFieldSchema,
1075
+ EnumFieldSchema,
1076
+ DateFieldSchema,
1077
+ DatetimeFieldSchema,
1078
+ TimeFieldSchema,
1079
+ PersonFieldSchema,
1080
+ OrganizationFieldSchema,
1081
+ IdentificationFieldSchema,
1082
+ MultiselectFieldSchema,
1083
+ PercentageFieldSchema,
1084
+ RatingFieldSchema,
1085
+ FieldsetFieldObjectSchema,
1086
+ ListFieldObjectSchema
1087
+ ];
1088
+ var FormFieldSchema = z24.lazy(() => z24.discriminatedUnion("type", FIELD_SCHEMAS)).meta({
1089
+ title: "FormField",
1090
+ description: "Single input/data element, nested fieldset, or recursive list"
1091
+ });
1092
+ var FORM_FIELD_TYPES = FIELD_SCHEMAS.map((schema) => schema.shape.type.value);
1093
+
1094
+ // src/zod/artifacts/form/annex.ts
1095
+ import { z as z25 } from "zod";
1096
+ var FormAnnexSchema = z25.object({
1097
+ title: z25.string().min(1).max(200).describe("Title or heading for the annex slot").optional(),
1098
+ description: z25.string().min(1).max(1e3).describe("Description of what document should be attached").optional(),
1099
+ required: CondExprSchema.optional(),
1100
+ visible: CondExprSchema.optional(),
1101
+ order: z25.number().min(0).describe("Display order for rendering").optional()
1102
+ }).strict().meta({
1103
+ title: "FormAnnex",
1104
+ description: "Defines an annex slot where a document must or may be attached at runtime"
1105
+ });
1106
+
1107
+ // src/zod/artifacts/form/party.ts
1108
+ import { z as z29 } from "zod";
1109
+
1110
+ // src/zod/primitives/attachment.ts
1111
+ import { z as z26 } from "zod";
1112
+ var AttachmentSchema = z26.object({
1113
+ name: z26.string().min(1).max(255).describe("Original file name"),
1114
+ mimeType: z26.string().min(1).max(100).describe("MIME type of the attached file"),
1115
+ checksum: ChecksumSchema.optional()
1116
+ }).strict().meta({
1117
+ title: "Attachment",
1118
+ description: "Attachment data representing an attached document. The key in the record is the annex identifier (the key from form.annexes)."
1119
+ });
1120
+
1121
+ // src/zod/primitives/runtime-party.ts
1122
+ import { z as z27 } from "zod";
1123
+ var PartyIdSchema = z27.string().min(1).describe("Identifier of this party in the fill, such as tenant-0");
1124
+ var RuntimePersonSchema = PersonSchema.extend({
1125
+ id: PartyIdSchema
1126
+ });
1127
+ var RuntimeOrganizationSchema = OrganizationSchema.extend({
1128
+ id: PartyIdSchema
1129
+ });
1130
+
1131
+ // src/zod/primitives/signature.ts
1132
+ import { z as z28 } from "zod";
1133
+ var SignatureSchema = z28.object({
1134
+ image: z28.string().min(1).describe("Base64-encoded signature image or data URI").optional(),
1135
+ timestamp: z28.iso.datetime().describe("ISO 8601 date-time when the signature was captured"),
1136
+ method: z28.union([
1137
+ z28.literal("drawn"),
1138
+ z28.literal("typed"),
1139
+ z28.literal("uploaded"),
1140
+ z28.literal("certificate")
1141
+ ]).describe("Method used to capture the signature"),
1142
+ type: z28.union([
1143
+ z28.literal("signature"),
1144
+ z28.literal("initials")
1145
+ ]).default("signature").describe("Whether this is a full signature or initials").optional(),
1146
+ metadata: z28.record(z28.string(), z28.unknown()).describe("Additional metadata (IP address, device info, etc.)").optional()
1147
+ }).strict().meta({
1148
+ title: "Signature",
1149
+ description: "Captured signature data containing the signature image, timestamp, capture method, and optional metadata."
1150
+ });
1151
+
1152
+ // src/zod/primitives/registry-reference.ts
1153
+ var NAMESPACE_SOURCE = REGISTRY_NAMESPACE_PATTERN.source.slice(1, -1);
1154
+ var REGISTRY_ITEM_NAME_MAX_LENGTH = 128;
1155
+ var NAME_SOURCE = `(?=[a-z0-9-]{1,${REGISTRY_ITEM_NAME_MAX_LENGTH}}(?:[/@]|$))${SEGMENT_SOURCE}`;
1156
+ var REGISTRY_REFERENCE_PATTERN = new RegExp(
1157
+ `^${NAMESPACE_SOURCE}/${NAME_SOURCE}(?:/(?:${EDITION_SOURCE}))?(?:@(?:${VERSION_SOURCE}))?$`
1158
+ );
1159
+ var REFERENCE_PARTS = new RegExp(
1160
+ `^(?<namespace>${NAMESPACE_SOURCE})/(?<name>${NAME_SOURCE})(?:/(?<edition>${EDITION_SOURCE}))?(?:@(?<version>${VERSION_SOURCE}))?$`
1161
+ );
1162
+ function parseRegistryReference(value) {
1163
+ const match = REFERENCE_PARTS.exec(value);
1164
+ if (!match) return void 0;
1165
+ const { namespace, name, edition, version } = match.groups;
1166
+ return {
1167
+ namespace,
1168
+ name,
1169
+ ...edition !== void 0 && edition !== CURRENT_EDITION && { edition },
1170
+ ...version !== void 0 && version !== LATEST_VERSION && { version }
1171
+ };
1172
+ }
1173
+ function formatRegistryReference(reference) {
1174
+ const edition = reference.edition === void 0 ? "" : `/${reference.edition}`;
1175
+ const version = reference.version === void 0 ? "" : `@${reference.version}`;
1176
+ return `${reference.namespace}/${reference.name}${edition}${version}`;
1177
+ }
1178
+
1179
+ // src/zod/artifacts/form/party.ts
1180
+ var FormSignatureSchema = z29.object({
1181
+ required: z29.boolean().describe("Whether signature is required for this role (default: false)").optional(),
1182
+ witnesses: z29.number().int().min(0).describe("Number of caller-declared witness attestations required for this signature (default: 0)").optional(),
1183
+ notarized: z29.boolean().describe("Whether at least one caller-declared attesting witness must have notary status (default: false)").optional()
1184
+ }).strict().meta({
1185
+ title: "FormSignature",
1186
+ description: "Design-time signature requirements for a party role"
1187
+ });
1188
+ var FormPaymentSchema = z29.object({
1189
+ required: z29.boolean().describe("Whether payment is required for this role (default: false)").optional(),
1190
+ amount: z29.union([
1191
+ MoneySchema,
1192
+ MoneyExpressionSchema
1193
+ ]).describe("Amount owed: a fixed Money value, or a MoneyExpression resolved from filled data at request time")
1194
+ }).strict().meta({
1195
+ title: "FormPayment",
1196
+ description: "Design-time payment requirement for a party role"
1197
+ });
1198
+ var FormPartySchema = z29.object({
1199
+ label: z29.string().min(1).max(100).describe("Display name for this role"),
1200
+ description: z29.string().max(500).describe("Description of this role").optional(),
1201
+ partyType: z29.union([
1202
+ z29.literal("person"),
1203
+ z29.literal("organization"),
1204
+ z29.literal("any")
1205
+ ]).describe("Constraint on party type (default: any)").optional(),
1206
+ min: z29.number().int().min(0).describe("Minimum parties required (default: 1)").optional(),
1207
+ max: z29.number().int().min(1).describe("Maximum parties allowed (default: 1)").optional(),
1208
+ required: CondExprSchema.optional(),
1209
+ signature: FormSignatureSchema.optional(),
1210
+ payment: FormPaymentSchema.optional()
1211
+ }).strict().superRefine((party, ctx) => {
1212
+ const min = party.min ?? 1;
1213
+ const max = party.max ?? 1;
1214
+ if (min > max) {
1215
+ ctx.addIssue({
1216
+ code: "custom",
1217
+ path: ["max"],
1218
+ message: "max must be greater than or equal to min"
1219
+ });
1220
+ }
1221
+ }).meta({
1222
+ title: "FormParty",
1223
+ description: "Design-time party role definition. Defines what roles exist and what constraints apply when filling a form."
1224
+ });
1225
+
1226
+ // src/zod/artifacts/form/index.ts
1227
+ var FormSchema = ArtifactSchema.extend({
1228
+ kind: z30.literal("form"),
1229
+ defs: DefsSectionSchema.optional(),
1230
+ rules: RulesSectionSchema.describe("Form-level validation rules for cross-field constraints. Rules use expressions with direct access to field values and defs section values.").optional(),
1231
+ fields: z30.record(
1232
+ z30.string().min(1).max(100).regex(IDENTIFIER_PATTERN).describe("Field identifier (camelCase, starts with lowercase letter)"),
1233
+ FormFieldSchema
1234
+ ).describe("Form field definitions keyed by field identifier. Fields define the input structure and validation rules for the form").optional(),
1235
+ layers: z30.record(
1236
+ z30.string().min(1).max(100).regex(IDENTIFIER_PATTERN).describe("Layer identifier (camelCase, starts with lowercase letter)"),
1237
+ LayerSchema
1238
+ ).describe("Named layers for rendering this form into different formats. Keys are user-defined identifiers (e.g., markdown, pdf, html)").optional(),
1239
+ defaultLayer: z30.string().min(1).max(100).describe("Key of the default layer to use when none specified at render time").optional(),
1240
+ allowAdditionalAnnexes: z30.boolean().describe("Whether additional ad-hoc annexes can be attached beyond those defined in the annexes record (default: false)").optional(),
1241
+ annexes: z30.record(
1242
+ z30.string().min(1).max(100).regex(IDENTIFIER_PATTERN).describe("Annex identifier (camelCase, starts with lowercase letter)"),
1243
+ FormAnnexSchema
1244
+ ).describe("Predefined annex slots keyed by identifier. Each slot can be marked as required (must be filled at runtime) or optional").optional(),
1245
+ parties: z30.record(
1246
+ z30.string().min(1).max(50).regex(IDENTIFIER_PATTERN).describe("Party role identifier (e.g., buyer, seller, landlord, buyerRepresentative)"),
1247
+ FormPartySchema
1248
+ ).describe("Party role definitions keyed by role identifier. Each role specifies constraints on who can fill it (person/organization) and signature requirements.").optional()
1249
+ }).strict().meta({
1250
+ title: "Form",
1251
+ description: "A form artifact that defines a data contract with field definitions, optional layers for rendering, and optional annexes. Forms are the primary artifact type for structured data collection and document generation."
1252
+ });
1253
+
1254
+ // src/zod/artifacts/document/index.ts
1255
+ import { z as z31 } from "zod";
1256
+ var DocumentSchema = ArtifactSchema.extend({
1257
+ kind: z31.literal("document"),
1258
+ layers: withoutReactLayers(z31.record(
1259
+ z31.string().min(1).max(100).regex(IDENTIFIER_PATTERN).describe("Layer identifier (camelCase, starts with lowercase letter)"),
1260
+ LayerSchema
1261
+ ).describe("Named layers for rendering this document into different formats. Keys are user-defined identifiers (e.g., markdown, pdf, html)")).optional(),
1262
+ defaultLayer: z31.string().min(1).max(100).describe("Key of the default layer to use when none specified at render time").optional()
1263
+ }).strict().meta({
1264
+ title: "Document",
1265
+ description: "A document artifact representing static content with no inputs. Documents can have multiple layers for rendering to different output formats (e.g., PDF, Markdown, HTML)."
1266
+ });
1267
+
1268
+ // src/zod/artifacts/bundle/item.ts
1269
+ import { z as z34 } from "zod";
1270
+
1271
+ // src/zod/artifacts/checklist/index.ts
1272
+ import { z as z33 } from "zod";
1273
+
1274
+ // src/zod/artifacts/shared/unique.ts
1275
+ function addDuplicateIdentityIssues(members, identityOf, options, addIssue) {
1276
+ const firstIndexByIdentity = /* @__PURE__ */ new Map();
1277
+ for (const [index, member] of members.entries()) {
1278
+ const identity = identityOf(member);
1279
+ const firstIndex = firstIndexByIdentity.get(identity);
1280
+ if (firstIndex === void 0) {
1281
+ firstIndexByIdentity.set(identity, index);
1282
+ continue;
1283
+ }
1284
+ const firstPath = `${options.collection}.${firstIndex}.${options.property}`;
1285
+ const message = `Duplicate ${options.label} "${identity}". First declared at ${firstPath}.`;
1286
+ addIssue([firstIndex, options.property], message);
1287
+ addIssue([index, options.property], message);
1288
+ }
1289
+ }
1290
+
1291
+ // src/zod/artifacts/checklist/item.ts
1292
+ import { z as z32 } from "zod";
1293
+ var BooleanStatusSpecSchema = z32.object({
1294
+ kind: z32.literal("boolean"),
1295
+ default: z32.boolean().describe("Default status value (true/false) for new instances").optional()
1296
+ }).strict().meta({
1297
+ title: "BooleanStatusSpec",
1298
+ description: "Boolean status (e.g., incomplete/complete) with an optional default value."
1299
+ });
1300
+ var EnumStatusOptionSchema = z32.object({
1301
+ value: z32.string().min(1).max(64).describe('Internal status value (e.g., "todo", "in-progress", "done")'),
1302
+ label: z32.string().min(1).max(256).describe("Human-readable label for the status option"),
1303
+ description: z32.string().min(1).max(2e3).describe("Optional description or help text for this status option").optional()
1304
+ }).strict().meta({
1305
+ title: "EnumStatusOption"
1306
+ });
1307
+ var EnumStatusSpecSchema = z32.object({
1308
+ kind: z32.literal("enum"),
1309
+ options: z32.array(EnumStatusOptionSchema).min(1).describe("Allowed status options"),
1310
+ default: z32.string().min(1).max(64).describe("Default status value for new instances (must match one of the option values)").optional()
1311
+ }).strict().meta({
1312
+ title: "EnumStatusSpec",
1313
+ description: "Enum-based status with a set of allowed options and an optional default."
1314
+ }).superRefine((status, ctx) => {
1315
+ if (status.default !== void 0 && !status.options.some((option) => option.value === status.default)) {
1316
+ ctx.addIssue({
1317
+ code: "custom",
1318
+ path: ["default"],
1319
+ message: "Default status value must match one of the option values"
1320
+ });
1321
+ }
1322
+ });
1323
+ var StatusSpecSchema = z32.discriminatedUnion("kind", [
1324
+ BooleanStatusSpecSchema,
1325
+ EnumStatusSpecSchema
1326
+ ]).meta({
1327
+ title: "StatusSpec",
1328
+ description: "Specification for how checklist item status should be represented (boolean or enum)."
1329
+ });
1330
+ var ChecklistItemSchema = z32.object({
1331
+ id: z32.string().min(1).max(128).describe('Unique identifier for the checklist item (e.g., "task-1", "step-a"). Used to link to runtime status.'),
1332
+ title: z32.string().min(1).max(500).describe("Title or label for the checklist item"),
1333
+ description: z32.string().min(1).max(2e3).describe("Detailed description or instructions for the item").optional(),
1334
+ status: StatusSpecSchema.optional()
1335
+ }).strict().meta({
1336
+ title: "ChecklistItem",
1337
+ description: "A single item in a checklist artifact. Each item has an ID, title, optional description, and an optional status specification (boolean or enum). If status is omitted, a default boolean status may be assumed (implementation-defined)."
1338
+ });
1339
+
1340
+ // src/zod/artifacts/checklist/index.ts
1341
+ var ChecklistSchema = ArtifactSchema.extend({
1342
+ kind: z33.literal("checklist"),
1343
+ items: z33.array(ChecklistItemSchema).superRefine((items, ctx) => {
1344
+ addDuplicateIdentityIssues(
1345
+ items,
1346
+ (item) => item.id,
1347
+ { collection: "items", property: "id", label: "checklist item ID" },
1348
+ (path, message) => ctx.addIssue({ code: "custom", path, message })
1349
+ );
1350
+ }).describe("Array of checklist items. Each item represents a task, step, or requirement."),
1351
+ layers: withoutReactLayers(z33.record(
1352
+ z33.string().min(1).max(100).regex(IDENTIFIER_PATTERN).describe("Layer identifier (camelCase, starts with lowercase letter)"),
1353
+ LayerSchema
1354
+ ).describe("Named layers for rendering this checklist into different formats. Keys are user-defined identifiers (e.g., markdown, pdf, html)")).optional(),
1355
+ defaultLayer: z33.string().min(1).max(100).describe("Key of the default layer to use when none specified at render time").optional()
1356
+ }).strict().meta({
1357
+ title: "Checklist",
1358
+ description: "A checklist artifact containing an ordered list of items to track. Each item may define how its status should be represented at runtime (boolean or enum)."
1359
+ });
1360
+
1361
+ // src/zod/artifacts/bundle/item.ts
1362
+ var ContentItemBaseSchema = z34.object({
1363
+ key: z34.string().min(1).max(100).regex(/^[a-zA-Z][a-zA-Z0-9_-]*$/).describe("Unique identifier for this content item, used to reference it in defs expressions"),
1364
+ include: CondExprSchema.optional()
1365
+ });
1366
+ var InlineContentItemSchema = ContentItemBaseSchema.extend({
1367
+ type: z34.literal("inline"),
1368
+ artifact: z34.lazy(() => z34.union([
1369
+ DocumentSchema,
1370
+ FormSchema,
1371
+ ChecklistSchema,
1372
+ BundleSchema
1373
+ ])).describe("Inline artifact definition (document, form, checklist, or nested bundle)")
1374
+ }).strict();
1375
+ var PathContentItemSchema = ContentItemBaseSchema.extend({
1376
+ type: z34.literal("path"),
1377
+ path: z34.string().min(1).describe("Path to the artifact file, relative to the bundle file's directory")
1378
+ }).strict();
1379
+ var RegistryContentItemSchema = ContentItemBaseSchema.extend({
1380
+ type: z34.literal("registry"),
1381
+ slug: z34.string().regex(ARTIFACT_ADDRESS_PATTERN, "Expected an artifact address such as @org/repo/name, with no edition or version").describe("Artifact address @org/repo/name, with no edition or version"),
1382
+ edition: EditionKeySchema.describe("Edition key. When omitted, the registry's current edition is used.").optional(),
1383
+ version: z34.string().regex(ARTIFACT_VERSION_PATTERN, "Expected an exact SemVer version such as 1.2.0").describe("Exact version. When omitted, the latest version of the edition is used.").optional()
1384
+ }).strict();
1385
+ var BundleObjectSchema = ArtifactSchema.extend({
1386
+ kind: z34.literal("bundle"),
1387
+ defs: DefsSectionSchema.optional(),
1388
+ contents: z34.array(z34.lazy(() => BundleContentItemSchema)).superRefine((contents, ctx) => {
1389
+ addDuplicateIdentityIssues(
1390
+ contents,
1391
+ (content) => content.key,
1392
+ { collection: "contents", property: "key", label: "bundle content key" },
1393
+ (path, message) => ctx.addIssue({ code: "custom", path, message })
1394
+ );
1395
+ }).describe("Ordered bundle contents. Each item has a key and is either an inline artifact, path reference, or registry reference.")
1396
+ }).strict().meta({
1397
+ title: "Bundle",
1398
+ description: "A bundle artifact that groups together related artifacts into a single distributable unit. Bundles can contain documents, forms, checklists, and other bundles."
1399
+ });
1400
+ var BundleSchema = BundleObjectSchema;
1401
+ var BundleContentItemSchema = z34.discriminatedUnion("type", [
1402
+ InlineContentItemSchema,
1403
+ PathContentItemSchema,
1404
+ RegistryContentItemSchema
1405
+ ]).meta({
1406
+ title: "BundleContentItem",
1407
+ description: "Bundle content item: an inline artifact, path reference, or registry reference with optional include condition"
1408
+ });
1409
+
1410
+ // src/zod/module.ts
1411
+ var AsterdocRegistry = z35.globalRegistry;
1412
+ function register(schema, id) {
1413
+ AsterdocRegistry.add(schema, { ...schema.meta(), id });
1414
+ }
1415
+ register(FormSchema, "Form");
1416
+ register(DocumentSchema, "Document");
1417
+ register(BundleSchema, "Bundle");
1418
+ register(ChecklistSchema, "Checklist");
1419
+ register(BundleContentItemSchema, "BundleContentItem");
1420
+ register(ChecklistItemSchema, "ChecklistItem");
1421
+ register(FormFieldSchema, "FormField");
1422
+ register(FormAnnexSchema, "FormAnnex");
1423
+ register(FormPartySchema, "FormParty");
1424
+ register(LayerSchema, "Layer");
1425
+ register(AddressSchema, "Address");
1426
+ register(AttachmentSchema, "Attachment");
1427
+ register(BboxSchema, "Bbox");
1428
+ register(CoordinateSchema, "Coordinate");
1429
+ register(DurationSchema, "Duration");
1430
+ register(IdentificationSchema, "Identification");
1431
+ register(MoneySchema, "Money");
1432
+ register(MetadataSchema, "Metadata");
1433
+ register(OrganizationSchema, "Organization");
1434
+ register(PersonSchema, "Person");
1435
+ register(PhoneSchema, "Phone");
1436
+ register(SignatureSchema, "Signature");
1437
+ register(CondExprSchema, "CondExpr");
1438
+ register(DefsSectionSchema, "DefsSection");
1439
+ var AsterdocSchema = z35.union([
1440
+ FormSchema,
1441
+ DocumentSchema,
1442
+ ChecklistSchema,
1443
+ BundleSchema
1444
+ ]).meta({
1445
+ title: "Asterdoc",
1446
+ description: "Root schema for any Asterdoc artifact document"
1447
+ });
1448
+ register(AsterdocSchema, "Asterdoc");
1449
+
1450
+ // src/zod/registry/registry-entry.ts
1451
+ import { z as z36 } from "zod";
1452
+ var RegistryCacheConfigSchema = z36.strictObject({
1453
+ ttl: z36.number().int().min(0).describe("Cache TTL in seconds. 0 disables caching for this registry.").optional()
1454
+ }).meta({
1455
+ title: "RegistryCacheConfig",
1456
+ description: "Per-registry cache configuration"
1457
+ });
1458
+ var RegistryEntryObjectSchema = z36.strictObject({
1459
+ url: z36.url().describe("Registry base URL"),
1460
+ headers: z36.record(z36.string(), z36.string()).describe("HTTP headers for authentication (supports ${ENV_VAR} expansion)").optional(),
1461
+ cache: RegistryCacheConfigSchema.describe("Per-registry cache settings").optional()
1462
+ }).meta({
1463
+ title: "RegistryEntryObject",
1464
+ description: "Registry configuration with authentication options"
1465
+ });
1466
+ var RegistryEntrySchema = z36.union([
1467
+ z36.url().describe("Simple registry URL"),
1468
+ RegistryEntryObjectSchema
1469
+ ]).meta({
1470
+ title: "RegistryEntry",
1471
+ description: "Registry configuration - URL string or object with authentication"
1472
+ });
1473
+ var ArtifactOutputFormatSchema = z36.union([
1474
+ z36.literal("json"),
1475
+ z36.literal("yaml"),
1476
+ z36.literal("typed"),
1477
+ z36.literal("ts")
1478
+ ]).meta({
1479
+ title: "ArtifactOutputFormat",
1480
+ description: "Output format for installed artifacts"
1481
+ });
1482
+
1483
+ // src/zod/registry/global-config.ts
1484
+ import { z as z37 } from "zod";
1485
+ var CacheConfigSchema = z37.strictObject({
1486
+ ttl: z37.number().int().min(0).default(3600).describe("Default cache TTL in seconds. 0 disables caching. Default: 3600 (1 hour)").optional(),
1487
+ directory: z37.string().describe("Custom cache directory. A leading ~ uses the home directory; relative paths use the config file directory. Default: ~/.asterdoc/cache").optional()
1488
+ }).meta({
1489
+ title: "CacheConfig",
1490
+ description: "Cache configuration for registry data"
1491
+ });
1492
+ var GlobalDefaultsSchema = z37.strictObject({
1493
+ output: ArtifactOutputFormatSchema.default("json").describe("Default output format for artifacts: json, yaml, typed (json + .d.ts), or ts (TypeScript module)").optional(),
1494
+ artifactsDir: z37.string().default("artifacts").describe("Default directory for installed artifacts").optional()
1495
+ }).meta({
1496
+ title: "GlobalDefaults",
1497
+ description: "Default settings for CLI operations"
1498
+ });
1499
+ var TelemetryConfigSchema = z37.strictObject({
1500
+ enabled: z37.boolean().describe("Send anonymous CLI usage telemetry. Set to false to opt out. Default: true").optional()
1501
+ }).meta({
1502
+ title: "TelemetryConfig",
1503
+ description: "Telemetry preferences for the CLI"
1504
+ });
1505
+ var SecurityConfigSchema = z37.strictObject({
1506
+ allowedContentTypes: z37.array(z37.string()).describe("Content types permitted for layer downloads, added to the built-in defaults. Blocked types are never allowed.").optional()
1507
+ }).meta({
1508
+ title: "SecurityConfig",
1509
+ description: "Security settings for layer downloads"
1510
+ });
1511
+ var GlobalConfigSchema = z37.object({
1512
+ $schema: z37.url().describe("JSON Schema URI for validation").optional(),
1513
+ registries: z37.record(
1514
+ z37.string().regex(REGISTRY_NAMESPACE_PATTERN).describe("Registry namespace (must start with @)"),
1515
+ RegistryEntrySchema
1516
+ ).describe("Configured registries by namespace").optional(),
1517
+ defaults: GlobalDefaultsSchema.optional(),
1518
+ cache: CacheConfigSchema.describe("Global cache configuration for registry data").optional(),
1519
+ security: SecurityConfigSchema.describe("Security settings for layer downloads").optional(),
1520
+ telemetry: TelemetryConfigSchema.describe("Telemetry preferences").optional(),
1521
+ anonymousId: z37.uuid().describe("Anonymous telemetry identifier. The CLI generates it once and keeps it across resets.").optional()
1522
+ }).strict().meta({
1523
+ title: "Asterdoc Global Config",
1524
+ description: "Schema for ~/.asterdoc/config.json global configuration file"
1525
+ });
1526
+
1527
+ // src/zod/registry/lock.ts
1528
+ import { z as z38 } from "zod";
1529
+ var LockIntegritySchema = z38.string().regex(/^sha256-[A-Za-z0-9+/]{43}=$/);
1530
+ var LockedLayerSchema = z38.object({
1531
+ integrity: LockIntegritySchema.describe("SHA-256 integrity of the layer file (sha256-<base64>)"),
1532
+ path: z38.string().describe("Relative path to the layer file from project root")
1533
+ }).meta({
1534
+ title: "LockedLayer",
1535
+ description: "Information about an installed layer file"
1536
+ });
1537
+ var LockedArtifactSchema = z38.object({
1538
+ kind: z38.enum(["form", "document", "checklist", "bundle"]).describe("Artifact kind"),
1539
+ edition: EditionKeySchema.describe("Key of the installed edition, as the registry manifest lists it. Omitted for an artifact that has no editions.").optional(),
1540
+ version: z38.string().describe("Installed artifact version"),
1541
+ resolved: z38.url().describe("Full URL used to fetch the artifact"),
1542
+ integrity: LockIntegritySchema.describe("SHA-256 integrity of the artifact file as written (sha256-<base64>)"),
1543
+ installedAt: z38.iso.datetime().describe("ISO 8601 timestamp when artifact was installed"),
1544
+ output: ArtifactOutputFormatSchema.describe("Output format the artifact was written in"),
1545
+ path: z38.string().describe("Relative path to the artifact file from project root"),
1546
+ layers: z38.record(
1547
+ z38.string().describe("Layer key"),
1548
+ LockedLayerSchema
1549
+ ).describe("Installed layers and their metadata")
1550
+ }).meta({
1551
+ title: "LockedArtifact",
1552
+ description: "Information about an installed artifact"
1553
+ });
1554
+ var LockFileSchema = z38.object({
1555
+ $schema: z38.url().describe("JSON Schema URI for validation").optional(),
1556
+ version: z38.number().default(1).describe("Lock file format version"),
1557
+ artifacts: z38.record(
1558
+ z38.string().regex(ARTIFACT_REFERENCE_PATTERN).describe("Artifact reference (@namespace/name)"),
1559
+ LockedArtifactSchema
1560
+ ).describe("Installed artifacts by reference")
1561
+ }).strict().meta({
1562
+ title: "Asterdoc Lock File",
1563
+ description: "Schema for .asterdoc/lock.json lock file"
1564
+ });
1565
+
1566
+ // src/zod/registry/registry-index.ts
1567
+ import { z as z39 } from "zod";
1568
+ var RegistryItemNameSchema = z39.string().min(1).max(REGISTRY_ITEM_NAME_MAX_LENGTH).regex(
1569
+ COORDINATE_SEGMENT_PATTERN,
1570
+ "Expected an artifact name: lowercase letters and digits with single hyphens, such as w-9"
1571
+ );
1572
+ var RegistryVersionKeySchema = z39.string().max(200).regex(
1573
+ REGISTRY_VERSION_PATTERN,
1574
+ "Expected a SemVer version with no build metadata, such as 1.2.0 or 1.3.0-beta.1"
1575
+ );
1576
+ var REGISTRY_ARTIFACT_PATH_MAX_LENGTH = 500;
1577
+ var REGISTRY_ARTIFACT_PATH_PATTERN = /^(?:(?!\.{1,2}\/)[A-Za-z0-9._-]+\/)*[A-Za-z0-9._-]+\.(?:json|yaml|yml)$/;
1578
+ var RegistryVersionEntrySchema = z39.strictObject({
1579
+ path: z39.string().max(REGISTRY_ARTIFACT_PATH_MAX_LENGTH).regex(
1580
+ REGISTRY_ARTIFACT_PATH_PATTERN,
1581
+ "Expected a path relative to the registry base address, such as w-9/2024-03/1.0.0/w-9.json: forward slashes, no leading slash, no . or .. segment, ending in .json, .yaml or .yml"
1582
+ ).describe("Path to the artifact file, relative to the registry base address (the address of the folder that holds registry.json), such as w-9/2024-03/1.0.0/w-9.json. Forward slashes only, no leading slash, no . or .. segment, ending in .json, .yaml or .yml. No two versions in one manifest have the same path."),
1583
+ sha256: z39.string().regex(/^[a-f0-9]{64}$/, "Expected a SHA-256 digest as 64 lowercase hex digits").describe("SHA-256 digest of the bytes of the artifact file at path, as 64 lowercase hex digits. A reader refuses a file whose digest is different.")
1584
+ }).meta({
1585
+ title: "RegistryVersionEntry",
1586
+ description: "One version of an artifact in a registry: the path of its file and the checksum of that file. The version itself is the key of this entry."
1587
+ });
1588
+ var REGISTRY_VERSIONS_EMPTY_RULE = "Expected at least one version";
1589
+ var REGISTRY_EDITIONS_EMPTY_RULE = "Expected at least one edition";
1590
+ var isNotEmpty = (value) => Object.keys(value).length > 0;
1591
+ var isOwnKey = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
1592
+ var listKeys = (value) => Object.keys(value).join(", ");
1593
+ var namesEntry = (entries, key) => !isNotEmpty(entries) || isOwnKey(entries, key);
1594
+ var keyRuleError = (issue) => issue.code === "invalid_key" ? `${issue.issues?.[0]?.message ?? "Invalid key"}; got "${String(issue.input)}"` : void 0;
1595
+ var RegistryVersionsSchema = z39.record(RegistryVersionKeySchema, RegistryVersionEntrySchema, { error: keyRuleError }).refine(isNotEmpty, REGISTRY_VERSIONS_EMPTY_RULE).meta({
1596
+ title: "RegistryVersions",
1597
+ description: "Versions keyed by version. Each key is a SemVer 2.0.0 version with no build metadata, such as 1.2.0 or 1.3.0-beta.1, and never latest or current. At least one version. The order of the keys has no meaning.",
1598
+ minProperties: 1
1599
+ });
1600
+ var LATEST_VERSION_DESCRIPTION = "The version to use when a request names none. It is the publisher's statement and must be a key of versions. It is normally the highest stable version; a pre-release is the default only when the publisher points at it. A reader uses this value and never compares version numbers.";
1601
+ var RegistryEditionEntrySchema = z39.strictObject({
1602
+ ...editionFactsShape,
1603
+ latestVersion: RegistryVersionKeySchema.describe(LATEST_VERSION_DESCRIPTION),
1604
+ versions: RegistryVersionsSchema
1605
+ }).superRefine((edition, ctx) => {
1606
+ if (!namesEntry(edition.versions, edition.latestVersion)) {
1607
+ ctx.addIssue({
1608
+ code: "custom",
1609
+ path: ["latestVersion"],
1610
+ message: `latestVersion "${edition.latestVersion}" is not a key of versions (${listKeys(edition.versions)})`
1611
+ });
1612
+ }
1613
+ }).meta({
1614
+ title: "RegistryEditionEntry",
1615
+ description: "One edition of an issued artifact, as printed by its issuer, and the publisher's versions of it. The edition key is the key of this entry."
1616
+ });
1617
+ var RegistryEditionsSchema = z39.record(EditionKeySchema, RegistryEditionEntrySchema, { error: keyRuleError }).refine(isNotEmpty, REGISTRY_EDITIONS_EMPTY_RULE).meta({
1618
+ title: "RegistryEditions",
1619
+ description: "Editions keyed by edition key. Each key is lowercase letters and digits with single hyphens, such as 2024-03 or 3b, and never current, latest, editions, tags or diff. At least one edition. The order of the keys has no meaning.",
1620
+ minProperties: 1
1621
+ });
1622
+ var REGISTRY_ITEM_RELEASES_RULE = "Expected either currentEdition with editions (an artifact that has editions), or latestVersion with versions (an artifact that has none)";
1623
+ var REGISTRY_ITEM_EDITIONS_ONLY_RULE = "An artifact that has editions states latestVersion and versions inside each edition, never on the item";
1624
+ var editionsOrVersionsJsonSchema = [
1625
+ {
1626
+ required: ["currentEdition", "editions"],
1627
+ not: { anyOf: [{ required: ["latestVersion"] }, { required: ["versions"] }] }
1628
+ },
1629
+ {
1630
+ required: ["latestVersion", "versions"],
1631
+ not: { anyOf: [{ required: ["currentEdition"] }, { required: ["editions"] }] }
1632
+ }
1633
+ ];
1634
+ var RegistryItemObjectSchema = z39.strictObject({
1635
+ name: RegistryItemNameSchema.describe("Artifact name, unique within the registry. Lowercase letters and digits with single hyphens. It is the name segment of a reference such as @acme/w-9, and every edition and version of the artifact shares it."),
1636
+ kind: z39.union([
1637
+ z39.literal("form"),
1638
+ z39.literal("document"),
1639
+ z39.literal("checklist"),
1640
+ z39.literal("bundle")
1641
+ ]).describe("Artifact kind"),
1642
+ title: z39.string().min(1).max(200).describe("Human-readable title").optional(),
1643
+ description: z39.string().max(2e3).describe("Brief description of the artifact").optional(),
1644
+ currentEdition: EditionKeySchema.describe("The edition to use when a request names none. It is the publisher's statement and must be a key of editions. It is not the newest edition by date: a publisher may list an edition that takes effect in the future. A reader uses this value and never compares dates. Present only with editions.").optional(),
1645
+ editions: RegistryEditionsSchema.describe("The issuer's editions of this artifact, keyed by edition key. Present only on an artifact that is issued in editions; then latestVersion and versions are inside each edition and absent on the item.").optional(),
1646
+ latestVersion: RegistryVersionKeySchema.describe(`${LATEST_VERSION_DESCRIPTION} Present only with versions, on an artifact that has no editions.`).optional(),
1647
+ versions: RegistryVersionsSchema.describe("The versions of an artifact that has no editions, keyed by version. Present only when editions is absent.").optional(),
1648
+ layers: z39.array(z39.string().describe("Layer key")).describe("Available layer keys").optional(),
1649
+ tags: z39.array(
1650
+ z39.string().min(1).max(50).describe("Tag for categorization")
1651
+ ).describe("Tags for search and filtering").optional()
1652
+ }).superRefine((item, ctx) => {
1653
+ const hasEditions = item.currentEdition !== void 0 || item.editions !== void 0;
1654
+ const hasVersions = item.latestVersion !== void 0 || item.versions !== void 0;
1655
+ if (!hasEditions && !hasVersions) {
1656
+ ctx.addIssue({ code: "custom", path: [], message: REGISTRY_ITEM_RELEASES_RULE });
1657
+ return;
1658
+ }
1659
+ if (hasEditions) {
1660
+ for (const key of ["latestVersion", "versions"]) {
1661
+ if (item[key] !== void 0) {
1662
+ ctx.addIssue({ code: "custom", path: [key], message: REGISTRY_ITEM_EDITIONS_ONLY_RULE });
1663
+ }
1664
+ }
1665
+ if (item.currentEdition === void 0) {
1666
+ ctx.addIssue({ code: "custom", path: ["currentEdition"], message: "Required with editions: name the edition to use by default" });
1667
+ } else if (item.editions === void 0) {
1668
+ ctx.addIssue({ code: "custom", path: ["editions"], message: "Required with currentEdition: list the editions" });
1669
+ } else if (!namesEntry(item.editions, item.currentEdition)) {
1670
+ ctx.addIssue({
1671
+ code: "custom",
1672
+ path: ["currentEdition"],
1673
+ message: `currentEdition "${item.currentEdition}" is not a key of editions (${listKeys(item.editions)})`
1674
+ });
1675
+ }
1676
+ return;
1677
+ }
1678
+ if (item.latestVersion === void 0) {
1679
+ ctx.addIssue({ code: "custom", path: ["latestVersion"], message: "Required with versions: name the version to use by default" });
1680
+ } else if (item.versions === void 0) {
1681
+ ctx.addIssue({ code: "custom", path: ["versions"], message: "Required with latestVersion: list the versions" });
1682
+ } else if (!namesEntry(item.versions, item.latestVersion)) {
1683
+ ctx.addIssue({
1684
+ code: "custom",
1685
+ path: ["latestVersion"],
1686
+ message: `latestVersion "${item.latestVersion}" is not a key of versions (${listKeys(item.versions)})`
1687
+ });
1688
+ }
1689
+ }).meta({
1690
+ title: "RegistryItemSummary",
1691
+ description: "One artifact in the registry, with every release of it. An artifact that is issued in editions has currentEdition and editions; an artifact that is not has latestVersion and versions. Never both, and never neither.",
1692
+ oneOf: editionsOrVersionsJsonSchema
1693
+ });
1694
+ var RegistryItemSummarySchema = RegistryItemObjectSchema;
1695
+ function listVersionEntries(item) {
1696
+ const inEditions = Object.entries(item.editions ?? {}).flatMap(
1697
+ ([editionKey, edition]) => Object.entries(edition.versions).map(([version, entry]) => ({
1698
+ path: ["editions", editionKey, "versions", version],
1699
+ entry
1700
+ }))
1701
+ );
1702
+ const onItem = Object.entries(item.versions ?? {}).map(([version, entry]) => ({ path: ["versions", version], entry }));
1703
+ return [...inEditions, ...onItem];
1704
+ }
1705
+ var formatLocation = (path) => path.map((part) => typeof part === "number" ? `[${part}]` : `.${String(part)}`).join("").replace(/^\./, "");
1706
+ var RegistryIndexSchema = z39.object({
1707
+ $schema: z39.url().describe("JSON Schema URI for validation").optional(),
1708
+ name: z39.string().min(1).max(100).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/).describe("Registry name/identifier (lowercase slug, used for data attributes and metadata)"),
1709
+ homepage: z39.url().describe("Homepage URL for the registry").optional(),
1710
+ description: z39.string().max(2e3).describe("Description of the registry").optional(),
1711
+ enableTelemetry: z39.boolean().default(true).describe("Enable anonymous usage telemetry for artifact installs. Defaults to true.").optional(),
1712
+ enableDirectory: z39.boolean().default(true).describe("Allow this registry to appear in the Asterdoc Hub directory. Defaults to true.").optional(),
1713
+ items: z39.array(RegistryItemSummarySchema).describe("Every artifact in the registry, one item for each artifact name. No two items have the same name, and no two versions in the manifest have the same path.")
1714
+ }).strict().superRefine((manifest, ctx) => {
1715
+ const names = /* @__PURE__ */ new Map();
1716
+ const paths = /* @__PURE__ */ new Map();
1717
+ manifest.items.forEach((item, index) => {
1718
+ const firstIndex = names.get(item.name);
1719
+ if (firstIndex === void 0) {
1720
+ names.set(item.name, index);
1721
+ } else {
1722
+ ctx.addIssue({
1723
+ code: "custom",
1724
+ path: ["items", index, "name"],
1725
+ message: `Duplicate item name "${item.name}": items[${firstIndex}] already has it`
1726
+ });
1727
+ }
1728
+ for (const { path, entry } of listVersionEntries(item)) {
1729
+ const location = ["items", index, ...path];
1730
+ const firstLocation = paths.get(entry.path);
1731
+ if (firstLocation === void 0) {
1732
+ paths.set(entry.path, formatLocation(location));
1733
+ } else {
1734
+ ctx.addIssue({
1735
+ code: "custom",
1736
+ path: [...location, "path"],
1737
+ message: `Duplicate path "${entry.path}": ${firstLocation} already has it`
1738
+ });
1739
+ }
1740
+ }
1741
+ });
1742
+ }).meta({
1743
+ title: "Asterdoc Registry Manifest",
1744
+ description: "Schema for registry.json, the manifest of a file registry. It lists every artifact the registry serves, with every edition and version of each. Every path is relative to the registry base address: the address of the folder that holds registry.json."
1745
+ });
1746
+
1747
+ // src/zod/registry/release.ts
1748
+ var isOwnKey2 = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
1749
+ function orderKeys(keys, first, compare) {
1750
+ return [...keys].sort((a, b) => {
1751
+ if (a === first || b === first) return a === b ? 0 : a === first ? -1 : 1;
1752
+ return compare(b, a);
1753
+ });
1754
+ }
1755
+ var compareKeys = (a, b) => a === b ? 0 : a < b ? -1 : 1;
1756
+ var orderVersions = (versions, latestVersion) => orderKeys(Object.keys(versions), latestVersion, compareArtifactVersions);
1757
+ function releaseEdition(key, entry) {
1758
+ return {
1759
+ key,
1760
+ label: entry.label,
1761
+ ...entry.date !== void 0 && { date: entry.date },
1762
+ ...entry.effectiveFrom !== void 0 && { effectiveFrom: entry.effectiveFrom }
1763
+ };
1764
+ }
1765
+ function resolveRegistryRelease(item, request = {}) {
1766
+ const requestedEdition = request.edition === CURRENT_EDITION ? void 0 : request.edition;
1767
+ const requestedVersion = request.version === LATEST_VERSION ? void 0 : request.version;
1768
+ let edition = null;
1769
+ let versions;
1770
+ let latestVersion;
1771
+ if (item.editions === void 0) {
1772
+ if (requestedEdition !== void 0) {
1773
+ return {
1774
+ ok: false,
1775
+ failure: {
1776
+ code: "no-editions",
1777
+ name: item.name,
1778
+ edition: requestedEdition,
1779
+ versions: orderVersions(item.versions, item.latestVersion)
1780
+ }
1781
+ };
1782
+ }
1783
+ versions = item.versions;
1784
+ latestVersion = item.latestVersion;
1785
+ } else {
1786
+ const key = requestedEdition ?? item.currentEdition;
1787
+ const entry2 = isOwnKey2(item.editions, key) ? item.editions[key] : void 0;
1788
+ if (entry2 === void 0) {
1789
+ return {
1790
+ ok: false,
1791
+ failure: {
1792
+ code: "unknown-edition",
1793
+ name: item.name,
1794
+ edition: key,
1795
+ currentEdition: item.currentEdition,
1796
+ editions: orderKeys(Object.keys(item.editions), item.currentEdition, compareKeys)
1797
+ }
1798
+ };
1799
+ }
1800
+ edition = releaseEdition(key, entry2);
1801
+ versions = entry2.versions;
1802
+ latestVersion = entry2.latestVersion;
1803
+ }
1804
+ const version = requestedVersion ?? latestVersion;
1805
+ const entry = isOwnKey2(versions, version) ? versions[version] : void 0;
1806
+ if (entry === void 0) {
1807
+ return {
1808
+ ok: false,
1809
+ failure: {
1810
+ code: "unknown-version",
1811
+ name: item.name,
1812
+ edition: edition === null ? null : edition.key,
1813
+ version,
1814
+ latestVersion,
1815
+ versions: orderVersions(versions, latestVersion)
1816
+ }
1817
+ };
1818
+ }
1819
+ return { ok: true, release: { edition, version, path: entry.path, sha256: entry.sha256 } };
1820
+ }
1821
+ function describeRegistryReleaseFailure(failure) {
1822
+ switch (failure.code) {
1823
+ case "no-editions":
1824
+ return `${failure.name} has no editions, so it has no edition ${failure.edition}. Its versions: ${failure.versions.join(", ")}.`;
1825
+ case "unknown-edition":
1826
+ return `${failure.name} has no edition ${failure.edition}. Its editions: ${failure.editions.join(", ")} (current: ${failure.currentEdition}).`;
1827
+ case "unknown-version": {
1828
+ const owner = failure.edition === null ? failure.name : `Edition ${failure.edition} of ${failure.name}`;
1829
+ return `${owner} has no version ${failure.version}. Its versions: ${failure.versions.join(", ")} (latest: ${failure.latestVersion}).`;
1830
+ }
1831
+ }
1832
+ }
1833
+ function listVersions(versions, latestVersion) {
1834
+ return orderVersions(versions, latestVersion).flatMap((version) => {
1835
+ const entry = versions[version];
1836
+ return entry === void 0 ? [] : [{ version, path: entry.path, sha256: entry.sha256, isLatest: version === latestVersion }];
1837
+ });
1838
+ }
1839
+ function listRegistryReleases(item) {
1840
+ if (item.editions === void 0) {
1841
+ return [{
1842
+ edition: null,
1843
+ isCurrent: true,
1844
+ latestVersion: item.latestVersion,
1845
+ versions: listVersions(item.versions, item.latestVersion)
1846
+ }];
1847
+ }
1848
+ const editions = item.editions;
1849
+ return orderKeys(Object.keys(editions), item.currentEdition, compareKeys).flatMap((key) => {
1850
+ const entry = editions[key];
1851
+ if (entry === void 0) return [];
1852
+ return [{
1853
+ edition: releaseEdition(key, entry),
1854
+ isCurrent: key === item.currentEdition,
1855
+ latestVersion: entry.latestVersion,
1856
+ versions: listVersions(entry.versions, entry.latestVersion)
1857
+ }];
1858
+ });
1859
+ }
1860
+
1861
+ // src/zod/registry/registry-item.ts
1862
+ import { z as z40 } from "zod";
1863
+ var RegistryLayerBaseSchema = z40.object({
1864
+ mimeType: z40.string().min(1).max(100).describe("MIME type of the layer content"),
1865
+ title: z40.string().min(1).max(200).describe("Human-readable title for this layer").optional(),
1866
+ description: z40.string().min(1).max(2e3).describe("Description of what this layer represents").optional(),
1867
+ checksum: ChecksumSchema.optional()
1868
+ });
1869
+ var RegistryInlineLayerSchema = RegistryLayerBaseSchema.extend({
1870
+ kind: z40.literal("inline"),
1871
+ text: z40.string().min(1).max(1e6).describe("Layer content with interpolation placeholders (e.g., {{fields.fieldName}})"),
1872
+ // Registry layers strip undeclared keys, so the PDF-only keys are refused
1873
+ // by name rather than dropped without an error.
1874
+ bindings: z40.never({ error: LAYER_BINDINGS_RULE }).optional(),
1875
+ bindingsFrom: z40.never({ error: LAYER_BINDINGS_RULE }).optional()
1876
+ }).meta({
1877
+ title: "RegistryInlineLayer",
1878
+ description: "Inline layer with embedded content"
1879
+ });
1880
+ var RegistryFileLayerSchema = withPdfOnlyFileLayerRules(FileLayerObjectSchema.extend({
1881
+ url: z40.url().describe("Optional URL to download the layer file from; clients otherwise resolve path relative to the registry item").optional()
1882
+ }).meta({
1883
+ title: "RegistryFileLayer",
1884
+ description: "File-backed layer with download URL"
1885
+ }));
1886
+ var RegistryLayerSchema = z40.discriminatedUnion("kind", [
1887
+ RegistryInlineLayerSchema,
1888
+ RegistryFileLayerSchema
1889
+ ]).meta({
1890
+ title: "RegistryLayer",
1891
+ description: "Layer in a registry item - inline or file with URL",
1892
+ // The file layer's PDF-only refinements, stated to JSON Schema as well.
1893
+ allOf: pdfOnlyLayerKeysJsonSchema(PDF_ONLY_FILE_LAYER_KEYS)
1894
+ });
1895
+ var RegistryItemSchema = z40.looseObject({
1896
+ $schema: z40.url().describe("JSON Schema URI for validation").optional(),
1897
+ kind: z40.union([
1898
+ z40.literal("form"),
1899
+ z40.literal("document"),
1900
+ z40.literal("checklist"),
1901
+ z40.literal("bundle")
1902
+ ]).describe("Artifact kind"),
1903
+ name: z40.string().min(1).max(128).regex(ARTIFACT_NAME_PATTERN).describe("Artifact name"),
1904
+ version: z40.string().regex(ARTIFACT_VERSION_PATTERN).describe("Semantic version"),
1905
+ title: z40.string().min(1).max(200).describe("Human-readable title").optional(),
1906
+ description: z40.string().max(2e3).describe("Artifact description").optional(),
1907
+ // Layers with registry-specific URL field
1908
+ layers: z40.record(
1909
+ z40.string().describe("Layer key"),
1910
+ RegistryLayerSchema
1911
+ ).describe("Available layers").optional(),
1912
+ defaultLayer: z40.string().describe("Default layer key").optional()
1913
+ // Additional properties carry the artifact-specific keys (fields, items, etc.)
1914
+ }).meta({
1915
+ title: "Asterdoc Registry Item",
1916
+ description: "Schema for registry item files (r/{name}.json)"
1917
+ });
1918
+
1919
+ // src/zod/manifest.ts
1920
+ import { z as z41 } from "zod";
1921
+ var ManifestCacheConfigSchema = z41.strictObject({
1922
+ ttl: z41.number().int().min(0).default(3600).describe("Default cache TTL in seconds. 0 disables caching. Default: 3600 (1 hour)").optional(),
1923
+ directory: z41.string().describe("Custom cache directory. A leading ~ uses the home directory; relative paths use the project root").optional()
1924
+ }).meta({
1925
+ title: "ManifestCacheConfig",
1926
+ description: "Project-level cache configuration for registry data"
1927
+ });
1928
+ var ManifestArtifactConfigSchema = z41.strictObject({
1929
+ dir: z41.string().min(1).max(256).default("artifacts").describe('Directory for installed artifacts (default: "artifacts")').optional(),
1930
+ output: ArtifactOutputFormatSchema.default("json").describe("Default output format for artifacts: json, yaml, typed (json + .d.ts), or ts (TypeScript module)").optional()
1931
+ }).meta({
1932
+ title: "ManifestArtifactConfig",
1933
+ description: "Configuration for artifact management"
1934
+ });
1935
+ var ManifestSchema = z41.object({
1936
+ $schema: z41.url().describe("JSON Schema URI for validation").optional(),
1937
+ name: z41.string().regex(/^@[a-z0-9-]+\/[a-z0-9-]+$/).min(3).max(214).describe("Scoped package name (@org/repo-name)"),
1938
+ title: z41.string().min(1).max(200).describe("Human-readable project title"),
1939
+ description: z41.string().max(1e3).describe("Project description").optional(),
1940
+ visibility: z41.union([z41.literal("public"), z41.literal("private")]).default("private").describe("Project visibility"),
1941
+ registries: z41.record(
1942
+ z41.string().regex(REGISTRY_NAMESPACE_PATTERN).describe("Registry namespace (must start with @)"),
1943
+ RegistryEntrySchema
1944
+ ).describe("Custom registries for this project (overrides global config)").optional(),
1945
+ artifacts: ManifestArtifactConfigSchema.optional(),
1946
+ cache: ManifestCacheConfigSchema.describe("Project-level cache configuration (overrides global config)").optional(),
1947
+ security: SecurityConfigSchema.describe("Security settings for layer downloads (overrides global config)").optional()
1948
+ }).strict().meta({
1949
+ title: "Asterdoc Project Manifest",
1950
+ description: "Schema for asterdoc.json project manifest files"
1951
+ });
1952
+ var ManifestSchemaRegistry = z41.registry();
1953
+ ManifestSchemaRegistry.add(ManifestSchema, { ...ManifestSchema.meta(), id: "Manifest" });
1954
+
1955
+ // src/index.ts
1956
+ var ASTERDOC_SCHEMA_URL = SCHEMA_VERSIONED_ID;
1957
+ export {
1958
+ ALL_EXPRESSION_TYPES,
1959
+ ARTIFACT_ADDRESS_PATTERN,
1960
+ ARTIFACT_COORDINATE_PATTERN,
1961
+ ARTIFACT_NAME_PATTERN,
1962
+ ARTIFACT_REFERENCE_PATTERN,
1963
+ ARTIFACT_VERSION_PATTERN,
1964
+ ASTERDOC_SCHEMA_URL,
1965
+ AddressSchema,
1966
+ ArtifactCoordinateSchema,
1967
+ ArtifactEditionSchema,
1968
+ ArtifactOutputFormatSchema,
1969
+ ArtifactSchema,
1970
+ AsterdocRegistry,
1971
+ AsterdocSchema,
1972
+ AttachmentSchema,
1973
+ BboxSchema,
1974
+ BundleContentItemSchema,
1975
+ BundleSchema,
1976
+ CONFIG_SCHEMA_ID,
1977
+ COORDINATE_SEGMENT_PATTERN,
1978
+ CURRENT_EDITION,
1979
+ ChecklistItemSchema,
1980
+ ChecklistSchema,
1981
+ ChecksumSchema,
1982
+ CondExprSchema,
1983
+ ContentRefSchema,
1984
+ CoordinateSchema,
1985
+ CurrencyCodeSchema,
1986
+ DOCX_MIME_TYPE,
1987
+ DefsSectionSchema,
1988
+ DocumentSchema,
1989
+ DurationSchema,
1990
+ EDITION_DATE_PATTERN,
1991
+ EDITION_KEY_MAX_LENGTH,
1992
+ EDITION_KEY_PATTERN,
1993
+ EDITION_KEY_SCHEMA_PATTERN,
1994
+ EditionKeySchema,
1995
+ EditionSelectorSchema,
1996
+ ExpressionSchema,
1997
+ FORM_FIELD_TYPES,
1998
+ FieldPatternSchema,
1999
+ FieldsetFieldSchema,
2000
+ FormAnnexSchema,
2001
+ FormFieldSchema,
2002
+ FormPartySchema,
2003
+ FormSchema,
2004
+ GlobalConfigSchema,
2005
+ GlobalDefaultsSchema,
2006
+ IDENTIFIER_PATTERN,
2007
+ ISO_8601_DURATION_PATTERN,
2008
+ ISO_8601_DURATION_REGEX,
2009
+ IdentificationSchema,
2010
+ LATEST_VERSION,
2011
+ LAYER_BINDINGS_RULE,
2012
+ LOCK_SCHEMA_ID,
2013
+ LayerSchema,
2014
+ ListFieldSchema,
2015
+ LockFileSchema,
2016
+ LockedArtifactSchema,
2017
+ LockedLayerSchema,
2018
+ MANIFEST_SCHEMA_ID,
2019
+ MAX_PATTERN_LENGTH,
2020
+ ManifestSchema,
2021
+ MetadataSchema,
2022
+ MoneySchema,
2023
+ OBJECT_EXPRESSION_TYPES,
2024
+ OrganizationSchema,
2025
+ PersonSchema,
2026
+ PhoneSchema,
2027
+ REACT_LAYER_FORM_ONLY_RULE,
2028
+ REACT_LAYER_MIME_PATTERN,
2029
+ REACT_LAYER_MIME_TYPES,
2030
+ REACT_LAYER_RULE,
2031
+ REGISTRY_ARTIFACT_PATH_MAX_LENGTH,
2032
+ REGISTRY_ARTIFACT_PATH_PATTERN,
2033
+ REGISTRY_EDITIONS_EMPTY_RULE,
2034
+ REGISTRY_ITEM_EDITIONS_ONLY_RULE,
2035
+ REGISTRY_ITEM_NAME_MAX_LENGTH,
2036
+ REGISTRY_ITEM_RELEASES_RULE,
2037
+ REGISTRY_ITEM_SCHEMA_ID,
2038
+ REGISTRY_NAMESPACE_PATTERN,
2039
+ REGISTRY_REFERENCE_PATTERN,
2040
+ REGISTRY_SCHEMA_ID,
2041
+ REGISTRY_VERSIONS_EMPTY_RULE,
2042
+ REGISTRY_VERSION_PATTERN,
2043
+ RESERVED_EDITION_KEYS,
2044
+ RegistryCacheConfigSchema,
2045
+ RegistryEditionEntrySchema,
2046
+ RegistryEditionsSchema,
2047
+ RegistryEntryObjectSchema,
2048
+ RegistryEntrySchema,
2049
+ RegistryFileLayerSchema,
2050
+ RegistryIndexSchema,
2051
+ RegistryInlineLayerSchema,
2052
+ RegistryItemNameSchema,
2053
+ RegistryItemSchema,
2054
+ RegistryItemSummarySchema,
2055
+ RegistryLayerSchema,
2056
+ RegistryVersionEntrySchema,
2057
+ RegistryVersionKeySchema,
2058
+ RegistryVersionsSchema,
2059
+ RuleSeveritySchema,
2060
+ RulesSectionSchema,
2061
+ RuntimeOrganizationSchema,
2062
+ RuntimePersonSchema,
2063
+ SCALAR_EXPRESSION_TYPES,
2064
+ SCHEMA_BASE,
2065
+ SCHEMA_ROOT_ID,
2066
+ SCHEMA_VERSION,
2067
+ SCHEMA_VERSIONED_ID,
2068
+ SCHEMA_VERSIONS,
2069
+ SignatureSchema,
2070
+ SignatureSlotSchema,
2071
+ SignatureSlotTypeSchema,
2072
+ TEXT_TEMPLATE_MIME_TYPES,
2073
+ ValidationRuleSchema,
2074
+ VersionSelectorSchema,
2075
+ compareArtifactVersions,
2076
+ describePatternProblem,
2077
+ describeRegistryReleaseFailure,
2078
+ findPatternProblem,
2079
+ formatArtifactCoordinate,
2080
+ formatRegistryReference,
2081
+ isDocxMimeType,
2082
+ isEditionSelector,
2083
+ isPdfMimeType,
2084
+ isReactLayerMimeType,
2085
+ isReservedEditionKey,
2086
+ isSchemaVersion,
2087
+ isTextTemplateMimeType,
2088
+ isVersionSelector,
2089
+ listRegistryReleases,
2090
+ parseArtifactCoordinate,
2091
+ parseRegistryReference,
2092
+ readSchemaAddress,
2093
+ resolveRegistryRelease,
2094
+ schemaId,
2095
+ schemaVersionUrl
2096
+ };