@formspec/build 0.1.0-alpha.10 → 0.1.0-alpha.11
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.
- package/dist/browser.cjs +549 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.ts +4 -2
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +498 -45
- package/dist/browser.js.map +1 -1
- package/dist/build.d.ts +343 -33
- package/dist/cli.cjs +2267 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.js +2204 -101
- package/dist/cli.js.map +1 -1
- package/dist/generators/class-schema.d.ts +5 -9
- package/dist/generators/class-schema.d.ts.map +1 -1
- package/dist/index.cjs +2093 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2024 -114
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +1345 -0
- package/dist/internals.cjs.map +1 -0
- package/dist/internals.d.ts +1 -0
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +1297 -21
- package/dist/internals.js.map +1 -1
- package/dist/json-schema/generator.d.ts.map +1 -1
- package/dist/json-schema/schema.d.ts +16 -0
- package/dist/json-schema/schema.d.ts.map +1 -0
- package/dist/ui-schema/generator.d.ts +15 -0
- package/dist/ui-schema/generator.d.ts.map +1 -1
- package/dist/ui-schema/schema.d.ts +357 -0
- package/dist/ui-schema/schema.d.ts.map +1 -0
- package/dist/ui-schema/types.d.ts +8 -73
- package/dist/ui-schema/types.d.ts.map +1 -1
- package/package.json +14 -9
- package/dist/__tests__/analyzer-edge-cases.test.js +0 -376
- package/dist/__tests__/analyzer-edge-cases.test.js.map +0 -1
- package/dist/__tests__/analyzer.test.js +0 -190
- package/dist/__tests__/analyzer.test.js.map +0 -1
- package/dist/__tests__/cli.test.js +0 -178
- package/dist/__tests__/cli.test.js.map +0 -1
- package/dist/__tests__/codegen.test.js +0 -506
- package/dist/__tests__/codegen.test.js.map +0 -1
- package/dist/__tests__/decorator-pipeline.test.js +0 -460
- package/dist/__tests__/decorator-pipeline.test.js.map +0 -1
- package/dist/__tests__/edge-cases.test.js +0 -215
- package/dist/__tests__/edge-cases.test.js.map +0 -1
- package/dist/__tests__/fixtures/edge-cases.js +0 -137
- package/dist/__tests__/fixtures/edge-cases.js.map +0 -1
- package/dist/__tests__/fixtures/example-a-builtins.js +0 -100
- package/dist/__tests__/fixtures/example-a-builtins.js.map +0 -1
- package/dist/__tests__/fixtures/example-b-decorators.js +0 -5
- package/dist/__tests__/fixtures/example-b-decorators.js.map +0 -1
- package/dist/__tests__/fixtures/example-b-extended.js +0 -60
- package/dist/__tests__/fixtures/example-b-extended.js.map +0 -1
- package/dist/__tests__/fixtures/example-c-custom.js +0 -61
- package/dist/__tests__/fixtures/example-c-custom.js.map +0 -1
- package/dist/__tests__/fixtures/example-c-decorators.js +0 -4
- package/dist/__tests__/fixtures/example-c-decorators.js.map +0 -1
- package/dist/__tests__/fixtures/example-d-mixed-decorators.js +0 -75
- package/dist/__tests__/fixtures/example-d-mixed-decorators.js.map +0 -1
- package/dist/__tests__/fixtures/example-e-decorators.js +0 -10
- package/dist/__tests__/fixtures/example-e-decorators.js.map +0 -1
- package/dist/__tests__/fixtures/example-e-no-namespace.js +0 -61
- package/dist/__tests__/fixtures/example-e-no-namespace.js.map +0 -1
- package/dist/__tests__/fixtures/example-interface-types.js +0 -8
- package/dist/__tests__/fixtures/example-interface-types.js.map +0 -1
- package/dist/__tests__/fixtures/example-jsdoc-constraints.js +0 -98
- package/dist/__tests__/fixtures/example-jsdoc-constraints.js.map +0 -1
- package/dist/__tests__/fixtures/example-nested-class.js +0 -248
- package/dist/__tests__/fixtures/example-nested-class.js.map +0 -1
- package/dist/__tests__/fixtures/sample-forms.js +0 -78
- package/dist/__tests__/fixtures/sample-forms.js.map +0 -1
- package/dist/__tests__/generator.test.js +0 -234
- package/dist/__tests__/generator.test.js.map +0 -1
- package/dist/__tests__/integration.test.js +0 -161
- package/dist/__tests__/integration.test.js.map +0 -1
- package/dist/__tests__/interface-types.test.js +0 -404
- package/dist/__tests__/interface-types.test.js.map +0 -1
- package/dist/__tests__/jsdoc-constraints.test.js +0 -465
- package/dist/__tests__/jsdoc-constraints.test.js.map +0 -1
- package/dist/__tests__/write-schemas.test.js +0 -198
- package/dist/__tests__/write-schemas.test.js.map +0 -1
- package/dist/analyzer/class-analyzer.js +0 -377
- package/dist/analyzer/class-analyzer.js.map +0 -1
- package/dist/analyzer/decorator-extractor.js +0 -336
- package/dist/analyzer/decorator-extractor.js.map +0 -1
- package/dist/analyzer/jsdoc-constraints.js +0 -153
- package/dist/analyzer/jsdoc-constraints.js.map +0 -1
- package/dist/analyzer/program.js +0 -114
- package/dist/analyzer/program.js.map +0 -1
- package/dist/analyzer/type-converter.js +0 -474
- package/dist/analyzer/type-converter.js.map +0 -1
- package/dist/codegen/index.js +0 -597
- package/dist/codegen/index.js.map +0 -1
- package/dist/generators/class-schema.js +0 -140
- package/dist/generators/class-schema.js.map +0 -1
- package/dist/generators/method-schema.js +0 -108
- package/dist/generators/method-schema.js.map +0 -1
- package/dist/json-schema/generator.js +0 -166
- package/dist/json-schema/generator.js.map +0 -1
- package/dist/json-schema/types.js +0 -33
- package/dist/json-schema/types.js.map +0 -1
- package/dist/ui-schema/generator.js +0 -148
- package/dist/ui-schema/generator.js.map +0 -1
- package/dist/ui-schema/types.js +0 -8
- package/dist/ui-schema/types.js.map +0 -1
package/dist/browser.cjs
ADDED
|
@@ -0,0 +1,549 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/browser.ts
|
|
21
|
+
var browser_exports = {};
|
|
22
|
+
__export(browser_exports, {
|
|
23
|
+
buildFormSchemas: () => buildFormSchemas,
|
|
24
|
+
categorizationSchema: () => categorizationSchema,
|
|
25
|
+
categorySchema: () => categorySchema,
|
|
26
|
+
controlSchema: () => controlSchema,
|
|
27
|
+
generateJsonSchema: () => generateJsonSchema,
|
|
28
|
+
generateUiSchema: () => generateUiSchema,
|
|
29
|
+
generateUiSchemaFromFields: () => generateUiSchemaFromFields,
|
|
30
|
+
getSchemaExtension: () => getSchemaExtension,
|
|
31
|
+
groupLayoutSchema: () => groupLayoutSchema,
|
|
32
|
+
horizontalLayoutSchema: () => horizontalLayoutSchema,
|
|
33
|
+
jsonSchema7Schema: () => jsonSchema7Schema,
|
|
34
|
+
jsonSchemaTypeSchema: () => jsonSchemaTypeSchema,
|
|
35
|
+
labelElementSchema: () => labelElementSchema,
|
|
36
|
+
ruleConditionSchema: () => ruleConditionSchema,
|
|
37
|
+
ruleEffectSchema: () => ruleEffectSchema,
|
|
38
|
+
ruleSchema: () => ruleSchema,
|
|
39
|
+
schemaBasedConditionSchema: () => schemaBasedConditionSchema,
|
|
40
|
+
setSchemaExtension: () => setSchemaExtension,
|
|
41
|
+
uiSchemaElementSchema: () => uiSchemaElementSchema,
|
|
42
|
+
uiSchemaElementTypeSchema: () => uiSchemaElementTypeSchema,
|
|
43
|
+
uiSchemaSchema: () => uiSchema,
|
|
44
|
+
verticalLayoutSchema: () => verticalLayoutSchema
|
|
45
|
+
});
|
|
46
|
+
module.exports = __toCommonJS(browser_exports);
|
|
47
|
+
|
|
48
|
+
// src/json-schema/schema.ts
|
|
49
|
+
var import_zod = require("zod");
|
|
50
|
+
var jsonSchemaTypeSchema = import_zod.z.enum([
|
|
51
|
+
"string",
|
|
52
|
+
"number",
|
|
53
|
+
"integer",
|
|
54
|
+
"boolean",
|
|
55
|
+
"object",
|
|
56
|
+
"array",
|
|
57
|
+
"null"
|
|
58
|
+
]);
|
|
59
|
+
var jsonSchema7Schema = import_zod.z.lazy(
|
|
60
|
+
() => import_zod.z.object({
|
|
61
|
+
$schema: import_zod.z.string().optional(),
|
|
62
|
+
$id: import_zod.z.string().optional(),
|
|
63
|
+
$ref: import_zod.z.string().optional(),
|
|
64
|
+
// Metadata
|
|
65
|
+
title: import_zod.z.string().optional(),
|
|
66
|
+
description: import_zod.z.string().optional(),
|
|
67
|
+
deprecated: import_zod.z.boolean().optional(),
|
|
68
|
+
// Type
|
|
69
|
+
type: import_zod.z.union([jsonSchemaTypeSchema, import_zod.z.array(jsonSchemaTypeSchema)]).optional(),
|
|
70
|
+
// String validation
|
|
71
|
+
minLength: import_zod.z.number().optional(),
|
|
72
|
+
maxLength: import_zod.z.number().optional(),
|
|
73
|
+
pattern: import_zod.z.string().optional(),
|
|
74
|
+
// Number validation
|
|
75
|
+
minimum: import_zod.z.number().optional(),
|
|
76
|
+
maximum: import_zod.z.number().optional(),
|
|
77
|
+
exclusiveMinimum: import_zod.z.number().optional(),
|
|
78
|
+
exclusiveMaximum: import_zod.z.number().optional(),
|
|
79
|
+
// Enum
|
|
80
|
+
enum: import_zod.z.array(import_zod.z.union([import_zod.z.string(), import_zod.z.number(), import_zod.z.boolean(), import_zod.z.null()])).readonly().optional(),
|
|
81
|
+
const: import_zod.z.union([import_zod.z.string(), import_zod.z.number(), import_zod.z.boolean(), import_zod.z.null()]).optional(),
|
|
82
|
+
// Object
|
|
83
|
+
properties: import_zod.z.record(import_zod.z.string(), jsonSchema7Schema).optional(),
|
|
84
|
+
required: import_zod.z.array(import_zod.z.string()).optional(),
|
|
85
|
+
additionalProperties: import_zod.z.union([import_zod.z.boolean(), jsonSchema7Schema]).optional(),
|
|
86
|
+
// Array
|
|
87
|
+
items: import_zod.z.union([jsonSchema7Schema, import_zod.z.array(jsonSchema7Schema)]).optional(),
|
|
88
|
+
minItems: import_zod.z.number().optional(),
|
|
89
|
+
maxItems: import_zod.z.number().optional(),
|
|
90
|
+
// Composition
|
|
91
|
+
allOf: import_zod.z.array(jsonSchema7Schema).optional(),
|
|
92
|
+
anyOf: import_zod.z.array(jsonSchema7Schema).optional(),
|
|
93
|
+
oneOf: import_zod.z.array(jsonSchema7Schema).optional(),
|
|
94
|
+
not: jsonSchema7Schema.optional(),
|
|
95
|
+
// Conditional
|
|
96
|
+
if: jsonSchema7Schema.optional(),
|
|
97
|
+
then: jsonSchema7Schema.optional(),
|
|
98
|
+
else: jsonSchema7Schema.optional(),
|
|
99
|
+
// Format
|
|
100
|
+
format: import_zod.z.string().optional(),
|
|
101
|
+
// Default
|
|
102
|
+
default: import_zod.z.unknown().optional(),
|
|
103
|
+
// FormSpec extensions
|
|
104
|
+
"x-formspec-source": import_zod.z.string().optional(),
|
|
105
|
+
"x-formspec-params": import_zod.z.array(import_zod.z.string()).readonly().optional(),
|
|
106
|
+
"x-formspec-schemaSource": import_zod.z.string().optional()
|
|
107
|
+
}).passthrough()
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
// src/json-schema/generator.ts
|
|
111
|
+
var import_zod2 = require("zod");
|
|
112
|
+
function parseOrThrow(schema, value, label) {
|
|
113
|
+
try {
|
|
114
|
+
return schema.parse(value);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
if (error instanceof import_zod2.z.ZodError) {
|
|
117
|
+
throw new Error(
|
|
118
|
+
`Generated ${label} failed validation:
|
|
119
|
+
${error.issues.map((i) => ` ${i.path.join(".")}: ${i.message}`).join("\n")}`
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function generateNestedSchema(elements) {
|
|
126
|
+
const properties = {};
|
|
127
|
+
const required = [];
|
|
128
|
+
collectFields(elements, properties, required);
|
|
129
|
+
const uniqueRequired = [...new Set(required)];
|
|
130
|
+
return {
|
|
131
|
+
type: "object",
|
|
132
|
+
properties,
|
|
133
|
+
...uniqueRequired.length > 0 && { required: uniqueRequired }
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function fieldToJsonSchema(field) {
|
|
137
|
+
const base = {};
|
|
138
|
+
if (field.label !== void 0) {
|
|
139
|
+
base.title = field.label;
|
|
140
|
+
}
|
|
141
|
+
switch (field._field) {
|
|
142
|
+
case "text":
|
|
143
|
+
return { ...base, type: "string" };
|
|
144
|
+
case "number":
|
|
145
|
+
return {
|
|
146
|
+
...base,
|
|
147
|
+
type: "number",
|
|
148
|
+
...field.min !== void 0 && { minimum: field.min },
|
|
149
|
+
...field.max !== void 0 && { maximum: field.max }
|
|
150
|
+
};
|
|
151
|
+
case "boolean":
|
|
152
|
+
return { ...base, type: "boolean" };
|
|
153
|
+
case "enum": {
|
|
154
|
+
const opts = field.options;
|
|
155
|
+
const isObjectOptions = opts.length > 0 && opts.every(
|
|
156
|
+
(opt) => typeof opt === "object" && "id" in opt && "label" in opt
|
|
157
|
+
);
|
|
158
|
+
if (isObjectOptions) {
|
|
159
|
+
return {
|
|
160
|
+
...base,
|
|
161
|
+
type: "string",
|
|
162
|
+
oneOf: opts.map((o) => ({
|
|
163
|
+
const: o.id,
|
|
164
|
+
title: o.label
|
|
165
|
+
}))
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return { ...base, type: "string", enum: opts };
|
|
169
|
+
}
|
|
170
|
+
case "dynamic_enum":
|
|
171
|
+
return {
|
|
172
|
+
...base,
|
|
173
|
+
type: "string",
|
|
174
|
+
"x-formspec-source": field.source,
|
|
175
|
+
...field.params !== void 0 && field.params.length > 0 && { "x-formspec-params": field.params }
|
|
176
|
+
};
|
|
177
|
+
case "dynamic_schema":
|
|
178
|
+
return {
|
|
179
|
+
...base,
|
|
180
|
+
type: "object",
|
|
181
|
+
additionalProperties: true,
|
|
182
|
+
"x-formspec-schemaSource": field.schemaSource
|
|
183
|
+
};
|
|
184
|
+
case "array": {
|
|
185
|
+
const arrayField = field;
|
|
186
|
+
return {
|
|
187
|
+
...base,
|
|
188
|
+
type: "array",
|
|
189
|
+
items: generateNestedSchema(arrayField.items),
|
|
190
|
+
...arrayField.minItems !== void 0 && { minItems: arrayField.minItems },
|
|
191
|
+
...arrayField.maxItems !== void 0 && { maxItems: arrayField.maxItems }
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
case "object": {
|
|
195
|
+
const objectField = field;
|
|
196
|
+
const nestedSchema = generateNestedSchema(objectField.properties);
|
|
197
|
+
return {
|
|
198
|
+
...base,
|
|
199
|
+
...nestedSchema
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
default: {
|
|
203
|
+
const _exhaustive = field;
|
|
204
|
+
return _exhaustive;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function collectFields(elements, properties, required) {
|
|
209
|
+
for (const element of elements) {
|
|
210
|
+
switch (element._type) {
|
|
211
|
+
case "field":
|
|
212
|
+
properties[element.name] = fieldToJsonSchema(element);
|
|
213
|
+
if (element.required === true) {
|
|
214
|
+
required.push(element.name);
|
|
215
|
+
}
|
|
216
|
+
break;
|
|
217
|
+
case "group":
|
|
218
|
+
collectFields(element.elements, properties, required);
|
|
219
|
+
break;
|
|
220
|
+
case "conditional":
|
|
221
|
+
collectFields(
|
|
222
|
+
element.elements,
|
|
223
|
+
properties,
|
|
224
|
+
required
|
|
225
|
+
);
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function generateJsonSchema(form) {
|
|
231
|
+
const properties = {};
|
|
232
|
+
const required = [];
|
|
233
|
+
collectFields(form.elements, properties, required);
|
|
234
|
+
const uniqueRequired = [...new Set(required)];
|
|
235
|
+
const result = {
|
|
236
|
+
$schema: "https://json-schema.org/draft-07/schema#",
|
|
237
|
+
type: "object",
|
|
238
|
+
properties,
|
|
239
|
+
...uniqueRequired.length > 0 && { required: uniqueRequired }
|
|
240
|
+
};
|
|
241
|
+
return parseOrThrow(jsonSchema7Schema, result, "JSON Schema");
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// src/ui-schema/schema.ts
|
|
245
|
+
var import_zod3 = require("zod");
|
|
246
|
+
var jsonPointerSchema = import_zod3.z.string();
|
|
247
|
+
var ruleEffectSchema = import_zod3.z.enum(["SHOW", "HIDE", "ENABLE", "DISABLE"]);
|
|
248
|
+
var uiSchemaElementTypeSchema = import_zod3.z.enum([
|
|
249
|
+
"Control",
|
|
250
|
+
"VerticalLayout",
|
|
251
|
+
"HorizontalLayout",
|
|
252
|
+
"Group",
|
|
253
|
+
"Categorization",
|
|
254
|
+
"Category",
|
|
255
|
+
"Label"
|
|
256
|
+
]);
|
|
257
|
+
var ruleConditionSchema = import_zod3.z.lazy(
|
|
258
|
+
() => import_zod3.z.object({
|
|
259
|
+
const: import_zod3.z.unknown().optional(),
|
|
260
|
+
enum: import_zod3.z.array(import_zod3.z.unknown()).readonly().optional(),
|
|
261
|
+
type: import_zod3.z.string().optional(),
|
|
262
|
+
not: ruleConditionSchema.optional(),
|
|
263
|
+
minimum: import_zod3.z.number().optional(),
|
|
264
|
+
maximum: import_zod3.z.number().optional(),
|
|
265
|
+
exclusiveMinimum: import_zod3.z.number().optional(),
|
|
266
|
+
exclusiveMaximum: import_zod3.z.number().optional(),
|
|
267
|
+
minLength: import_zod3.z.number().optional(),
|
|
268
|
+
properties: import_zod3.z.record(import_zod3.z.string(), ruleConditionSchema).optional(),
|
|
269
|
+
required: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
270
|
+
allOf: import_zod3.z.array(ruleConditionSchema).optional()
|
|
271
|
+
}).strict()
|
|
272
|
+
);
|
|
273
|
+
var schemaBasedConditionSchema = import_zod3.z.object({
|
|
274
|
+
scope: jsonPointerSchema,
|
|
275
|
+
schema: ruleConditionSchema
|
|
276
|
+
}).strict();
|
|
277
|
+
var ruleSchema = import_zod3.z.object({
|
|
278
|
+
effect: ruleEffectSchema,
|
|
279
|
+
condition: schemaBasedConditionSchema
|
|
280
|
+
}).strict();
|
|
281
|
+
var uiSchemaElementSchema = import_zod3.z.lazy(
|
|
282
|
+
() => import_zod3.z.union([
|
|
283
|
+
controlSchema,
|
|
284
|
+
verticalLayoutSchema,
|
|
285
|
+
horizontalLayoutSchema,
|
|
286
|
+
groupLayoutSchema,
|
|
287
|
+
categorizationSchema,
|
|
288
|
+
categorySchema,
|
|
289
|
+
labelElementSchema
|
|
290
|
+
])
|
|
291
|
+
);
|
|
292
|
+
var controlSchema = import_zod3.z.object({
|
|
293
|
+
type: import_zod3.z.literal("Control"),
|
|
294
|
+
scope: jsonPointerSchema,
|
|
295
|
+
label: import_zod3.z.union([import_zod3.z.string(), import_zod3.z.literal(false)]).optional(),
|
|
296
|
+
rule: ruleSchema.optional(),
|
|
297
|
+
options: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
|
|
298
|
+
}).passthrough();
|
|
299
|
+
var verticalLayoutSchema = import_zod3.z.lazy(
|
|
300
|
+
() => import_zod3.z.object({
|
|
301
|
+
type: import_zod3.z.literal("VerticalLayout"),
|
|
302
|
+
elements: import_zod3.z.array(uiSchemaElementSchema),
|
|
303
|
+
rule: ruleSchema.optional(),
|
|
304
|
+
options: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
|
|
305
|
+
}).passthrough()
|
|
306
|
+
);
|
|
307
|
+
var horizontalLayoutSchema = import_zod3.z.lazy(
|
|
308
|
+
() => import_zod3.z.object({
|
|
309
|
+
type: import_zod3.z.literal("HorizontalLayout"),
|
|
310
|
+
elements: import_zod3.z.array(uiSchemaElementSchema),
|
|
311
|
+
rule: ruleSchema.optional(),
|
|
312
|
+
options: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
|
|
313
|
+
}).passthrough()
|
|
314
|
+
);
|
|
315
|
+
var groupLayoutSchema = import_zod3.z.lazy(
|
|
316
|
+
() => import_zod3.z.object({
|
|
317
|
+
type: import_zod3.z.literal("Group"),
|
|
318
|
+
label: import_zod3.z.string(),
|
|
319
|
+
elements: import_zod3.z.array(uiSchemaElementSchema),
|
|
320
|
+
rule: ruleSchema.optional(),
|
|
321
|
+
options: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
|
|
322
|
+
}).passthrough()
|
|
323
|
+
);
|
|
324
|
+
var categorySchema = import_zod3.z.lazy(
|
|
325
|
+
() => import_zod3.z.object({
|
|
326
|
+
type: import_zod3.z.literal("Category"),
|
|
327
|
+
label: import_zod3.z.string(),
|
|
328
|
+
elements: import_zod3.z.array(uiSchemaElementSchema),
|
|
329
|
+
rule: ruleSchema.optional(),
|
|
330
|
+
options: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
|
|
331
|
+
}).passthrough()
|
|
332
|
+
);
|
|
333
|
+
var categorizationSchema = import_zod3.z.lazy(
|
|
334
|
+
() => import_zod3.z.object({
|
|
335
|
+
type: import_zod3.z.literal("Categorization"),
|
|
336
|
+
elements: import_zod3.z.array(categorySchema),
|
|
337
|
+
label: import_zod3.z.string().optional(),
|
|
338
|
+
rule: ruleSchema.optional(),
|
|
339
|
+
options: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
|
|
340
|
+
}).passthrough()
|
|
341
|
+
);
|
|
342
|
+
var labelElementSchema = import_zod3.z.object({
|
|
343
|
+
type: import_zod3.z.literal("Label"),
|
|
344
|
+
text: import_zod3.z.string(),
|
|
345
|
+
rule: ruleSchema.optional(),
|
|
346
|
+
options: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
|
|
347
|
+
}).passthrough();
|
|
348
|
+
var uiSchema = import_zod3.z.lazy(
|
|
349
|
+
() => import_zod3.z.union([verticalLayoutSchema, horizontalLayoutSchema, groupLayoutSchema, categorizationSchema])
|
|
350
|
+
);
|
|
351
|
+
|
|
352
|
+
// src/ui-schema/generator.ts
|
|
353
|
+
var import_zod4 = require("zod");
|
|
354
|
+
function parseOrThrow2(schema, value, label) {
|
|
355
|
+
try {
|
|
356
|
+
return schema.parse(value);
|
|
357
|
+
} catch (error) {
|
|
358
|
+
if (error instanceof import_zod4.z.ZodError) {
|
|
359
|
+
throw new Error(
|
|
360
|
+
`Generated ${label} failed validation:
|
|
361
|
+
${error.issues.map((i) => ` ${i.path.join(".")}: ${i.message}`).join("\n")}`
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
throw error;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
function fieldToScope(fieldName) {
|
|
368
|
+
return `#/properties/${fieldName}`;
|
|
369
|
+
}
|
|
370
|
+
function createShowRule(fieldName, value) {
|
|
371
|
+
return {
|
|
372
|
+
effect: "SHOW",
|
|
373
|
+
condition: {
|
|
374
|
+
scope: fieldToScope(fieldName),
|
|
375
|
+
schema: { const: value }
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
function combineRules(parentRule, childRule) {
|
|
380
|
+
const parentCondition = parentRule.condition;
|
|
381
|
+
const childCondition = childRule.condition;
|
|
382
|
+
return {
|
|
383
|
+
effect: "SHOW",
|
|
384
|
+
condition: {
|
|
385
|
+
scope: "#",
|
|
386
|
+
schema: {
|
|
387
|
+
allOf: [
|
|
388
|
+
{
|
|
389
|
+
properties: {
|
|
390
|
+
[parentCondition.scope.replace("#/properties/", "")]: parentCondition.schema
|
|
391
|
+
}
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
properties: {
|
|
395
|
+
[childCondition.scope.replace("#/properties/", "")]: childCondition.schema
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
function elementsToUiSchema(elements, parentRule) {
|
|
404
|
+
const result = [];
|
|
405
|
+
for (const element of elements) {
|
|
406
|
+
switch (element._type) {
|
|
407
|
+
case "field": {
|
|
408
|
+
const control = {
|
|
409
|
+
type: "Control",
|
|
410
|
+
scope: fieldToScope(element.name),
|
|
411
|
+
...element.label !== void 0 && { label: element.label },
|
|
412
|
+
...parentRule !== void 0 && { rule: parentRule }
|
|
413
|
+
};
|
|
414
|
+
result.push(control);
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
case "group": {
|
|
418
|
+
const groupElement = element;
|
|
419
|
+
const group = {
|
|
420
|
+
type: "Group",
|
|
421
|
+
label: groupElement.label,
|
|
422
|
+
elements: elementsToUiSchema(groupElement.elements, parentRule),
|
|
423
|
+
...parentRule !== void 0 && { rule: parentRule }
|
|
424
|
+
};
|
|
425
|
+
result.push(group);
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
case "conditional": {
|
|
429
|
+
const conditionalElement = element;
|
|
430
|
+
const newRule = createShowRule(conditionalElement.field, conditionalElement.value);
|
|
431
|
+
const combinedRule = parentRule !== void 0 ? combineRules(parentRule, newRule) : newRule;
|
|
432
|
+
const childElements = elementsToUiSchema(conditionalElement.elements, combinedRule);
|
|
433
|
+
result.push(...childElements);
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
return result;
|
|
439
|
+
}
|
|
440
|
+
function formSpecFieldToElement(field, scopePrefix = "#/properties") {
|
|
441
|
+
const control = {
|
|
442
|
+
type: "Control",
|
|
443
|
+
scope: `${scopePrefix}/${field.id}`
|
|
444
|
+
};
|
|
445
|
+
if (field.label !== void 0) {
|
|
446
|
+
control.label = field.label;
|
|
447
|
+
}
|
|
448
|
+
if (field.showWhen !== void 0 && typeof field.showWhen === "object" && "field" in field.showWhen && "value" in field.showWhen) {
|
|
449
|
+
const sw = field.showWhen;
|
|
450
|
+
control.rule = {
|
|
451
|
+
effect: "SHOW",
|
|
452
|
+
condition: {
|
|
453
|
+
scope: `#/properties/${sw.field}`,
|
|
454
|
+
schema: { const: sw.value }
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
return control;
|
|
459
|
+
}
|
|
460
|
+
function generateUiSchemaFromFields(fields) {
|
|
461
|
+
const groupMap = /* @__PURE__ */ new Map();
|
|
462
|
+
const orderedKeys = [];
|
|
463
|
+
const ungrouped = [];
|
|
464
|
+
for (const field of fields) {
|
|
465
|
+
const element = formSpecFieldToElement(field);
|
|
466
|
+
if (field.group !== void 0) {
|
|
467
|
+
if (!groupMap.has(field.group)) {
|
|
468
|
+
groupMap.set(field.group, []);
|
|
469
|
+
orderedKeys.push(field.group);
|
|
470
|
+
}
|
|
471
|
+
groupMap.get(field.group).push(element);
|
|
472
|
+
} else {
|
|
473
|
+
orderedKeys.push(null);
|
|
474
|
+
ungrouped.push(element);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
const elements = [];
|
|
478
|
+
let ungroupedIndex = 0;
|
|
479
|
+
for (const key of orderedKeys) {
|
|
480
|
+
if (key === null) {
|
|
481
|
+
const el = ungrouped[ungroupedIndex++];
|
|
482
|
+
if (el !== void 0) {
|
|
483
|
+
elements.push(el);
|
|
484
|
+
}
|
|
485
|
+
} else {
|
|
486
|
+
const groupElements = groupMap.get(key) ?? [];
|
|
487
|
+
const groupLayout = {
|
|
488
|
+
type: "Group",
|
|
489
|
+
label: key,
|
|
490
|
+
elements: groupElements
|
|
491
|
+
};
|
|
492
|
+
elements.push(groupLayout);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
const result = {
|
|
496
|
+
type: "VerticalLayout",
|
|
497
|
+
elements
|
|
498
|
+
};
|
|
499
|
+
return parseOrThrow2(uiSchema, result, "UI Schema");
|
|
500
|
+
}
|
|
501
|
+
function generateUiSchema(form) {
|
|
502
|
+
const result = {
|
|
503
|
+
type: "VerticalLayout",
|
|
504
|
+
elements: elementsToUiSchema(form.elements)
|
|
505
|
+
};
|
|
506
|
+
return parseOrThrow2(uiSchema, result, "UI Schema");
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// src/json-schema/types.ts
|
|
510
|
+
function setSchemaExtension(schema, key, value) {
|
|
511
|
+
schema[key] = value;
|
|
512
|
+
}
|
|
513
|
+
function getSchemaExtension(schema, key) {
|
|
514
|
+
return schema[key];
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
// src/browser.ts
|
|
518
|
+
function buildFormSchemas(form) {
|
|
519
|
+
return {
|
|
520
|
+
jsonSchema: generateJsonSchema(form),
|
|
521
|
+
uiSchema: generateUiSchema(form)
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
525
|
+
0 && (module.exports = {
|
|
526
|
+
buildFormSchemas,
|
|
527
|
+
categorizationSchema,
|
|
528
|
+
categorySchema,
|
|
529
|
+
controlSchema,
|
|
530
|
+
generateJsonSchema,
|
|
531
|
+
generateUiSchema,
|
|
532
|
+
generateUiSchemaFromFields,
|
|
533
|
+
getSchemaExtension,
|
|
534
|
+
groupLayoutSchema,
|
|
535
|
+
horizontalLayoutSchema,
|
|
536
|
+
jsonSchema7Schema,
|
|
537
|
+
jsonSchemaTypeSchema,
|
|
538
|
+
labelElementSchema,
|
|
539
|
+
ruleConditionSchema,
|
|
540
|
+
ruleEffectSchema,
|
|
541
|
+
ruleSchema,
|
|
542
|
+
schemaBasedConditionSchema,
|
|
543
|
+
setSchemaExtension,
|
|
544
|
+
uiSchemaElementSchema,
|
|
545
|
+
uiSchemaElementTypeSchema,
|
|
546
|
+
uiSchemaSchema,
|
|
547
|
+
verticalLayoutSchema
|
|
548
|
+
});
|
|
549
|
+
//# sourceMappingURL=browser.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/browser.ts","../src/json-schema/schema.ts","../src/json-schema/generator.ts","../src/ui-schema/schema.ts","../src/ui-schema/generator.ts","../src/json-schema/types.ts"],"sourcesContent":["/**\n * Browser-safe exports for `@formspec/build`.\n *\n * This entry point excludes Node.js-specific functions like `writeSchemas`\n * that use `node:fs` and `node:path`, making it suitable for browser environments.\n *\n * @example\n * ```typescript\n * // In browser code (e.g., playground)\n * import { buildFormSchemas, generateJsonSchema, generateUiSchema } from \"@formspec/build/browser\";\n *\n * const form = formspec(field.text(\"name\"));\n * const { jsonSchema, uiSchema } = buildFormSchemas(form);\n * ```\n *\n * @packageDocumentation\n */\n\nimport type { FormElement, FormSpec } from \"@formspec/core\";\nimport { generateJsonSchema } from \"./json-schema/generator.js\";\nimport { generateUiSchema } from \"./ui-schema/generator.js\";\n\n// Re-export types\nexport type {\n JSONSchema7,\n JSONSchemaType,\n ExtendedJSONSchema7,\n FormSpecSchemaExtensions,\n} from \"./json-schema/types.js\";\n\nexport { setSchemaExtension, getSchemaExtension } from \"./json-schema/types.js\";\n\nexport type {\n UISchema,\n UISchemaElement,\n UISchemaElementBase,\n UISchemaElementType,\n ControlElement,\n VerticalLayout,\n HorizontalLayout,\n GroupLayout,\n Categorization,\n Category,\n LabelElement,\n Rule,\n RuleEffect,\n RuleConditionSchema,\n SchemaBasedCondition,\n} from \"./ui-schema/types.js\";\n\n// Zod validation schemas\nexport {\n ruleEffectSchema,\n uiSchemaElementTypeSchema,\n ruleConditionSchema,\n schemaBasedConditionSchema,\n ruleSchema,\n controlSchema,\n verticalLayoutSchema,\n horizontalLayoutSchema,\n groupLayoutSchema,\n categorizationSchema,\n categorySchema,\n labelElementSchema,\n uiSchemaElementSchema,\n uiSchema as uiSchemaSchema,\n} from \"./ui-schema/schema.js\";\n\nexport { jsonSchemaTypeSchema, jsonSchema7Schema } from \"./json-schema/schema.js\";\n\n// Re-export individual generators\nexport { generateJsonSchema } from \"./json-schema/generator.js\";\nexport { generateUiSchema, generateUiSchemaFromFields } from \"./ui-schema/generator.js\";\n\n/**\n * Result of building form schemas.\n */\nexport interface BuildResult {\n /** JSON Schema for validation */\n readonly jsonSchema: ReturnType<typeof generateJsonSchema>;\n /** JSON Forms UI Schema for rendering */\n readonly uiSchema: ReturnType<typeof generateUiSchema>;\n}\n\n/**\n * Builds both JSON Schema and UI Schema from a FormSpec.\n *\n * This is a browser-safe version that does not include file system operations.\n *\n * @example\n * ```typescript\n * const form = formspec(\n * field.text(\"name\", { required: true }),\n * field.number(\"age\", { min: 0 }),\n * );\n *\n * const { jsonSchema, uiSchema } = buildFormSchemas(form);\n * ```\n *\n * @param form - The FormSpec to build schemas from\n * @returns Object containing both jsonSchema and uiSchema\n */\nexport function buildFormSchemas<E extends readonly FormElement[]>(form: FormSpec<E>): BuildResult {\n return {\n jsonSchema: generateJsonSchema(form),\n uiSchema: generateUiSchema(form),\n };\n}\n","/**\n * Zod schemas for JSON Schema draft-07 output validation.\n *\n * These schemas cover the subset of JSON Schema draft-07 that FormSpec generates,\n * plus the FormSpec-specific `x-formspec-*` extension properties.\n *\n * @see https://json-schema.org/draft-07/schema\n */\n\nimport { z } from \"zod\";\nimport type { JSONSchema7 } from \"./types.js\";\n\n// =============================================================================\n// JSON Schema type enum\n// =============================================================================\n\n/**\n * Zod schema for JSON Schema primitive type strings.\n */\nexport const jsonSchemaTypeSchema = z.enum([\n \"string\",\n \"number\",\n \"integer\",\n \"boolean\",\n \"object\",\n \"array\",\n \"null\",\n]);\n\n// =============================================================================\n// JSON Schema draft-07 schema (recursive)\n// =============================================================================\n\n// We annotate with z.ZodType<JSONSchema7> for the recursive self-reference.\n// The @ts-expect-error is required because exactOptionalPropertyTypes:true causes\n// Zod's inferred output type for optional fields (`T | undefined`) to be\n// incompatible with the JSONSchema7 interface's exact optional fields (`T?`).\n// The runtime behavior is correct: z.optional() will strip `undefined` values\n// during parsing and correctly handle absent keys.\n//\n// @ts-expect-error -- exactOptionalPropertyTypes: Zod optional infers `T | undefined`\n// but JSONSchema7 uses exact optional `?:` which disallows explicit undefined.\nexport const jsonSchema7Schema: z.ZodType<JSONSchema7> = z.lazy(() =>\n z\n .object({\n $schema: z.string().optional(),\n $id: z.string().optional(),\n $ref: z.string().optional(),\n\n // Metadata\n title: z.string().optional(),\n description: z.string().optional(),\n deprecated: z.boolean().optional(),\n\n // Type\n type: z.union([jsonSchemaTypeSchema, z.array(jsonSchemaTypeSchema)]).optional(),\n\n // String validation\n minLength: z.number().optional(),\n maxLength: z.number().optional(),\n pattern: z.string().optional(),\n\n // Number validation\n minimum: z.number().optional(),\n maximum: z.number().optional(),\n exclusiveMinimum: z.number().optional(),\n exclusiveMaximum: z.number().optional(),\n\n // Enum\n enum: z\n .array(z.union([z.string(), z.number(), z.boolean(), z.null()]))\n .readonly()\n .optional(),\n const: z.union([z.string(), z.number(), z.boolean(), z.null()]).optional(),\n\n // Object\n properties: z.record(z.string(), jsonSchema7Schema).optional(),\n required: z.array(z.string()).optional(),\n additionalProperties: z.union([z.boolean(), jsonSchema7Schema]).optional(),\n\n // Array\n items: z.union([jsonSchema7Schema, z.array(jsonSchema7Schema)]).optional(),\n minItems: z.number().optional(),\n maxItems: z.number().optional(),\n\n // Composition\n allOf: z.array(jsonSchema7Schema).optional(),\n anyOf: z.array(jsonSchema7Schema).optional(),\n oneOf: z.array(jsonSchema7Schema).optional(),\n not: jsonSchema7Schema.optional(),\n\n // Conditional\n if: jsonSchema7Schema.optional(),\n then: jsonSchema7Schema.optional(),\n else: jsonSchema7Schema.optional(),\n\n // Format\n format: z.string().optional(),\n\n // Default\n default: z.unknown().optional(),\n\n // FormSpec extensions\n \"x-formspec-source\": z.string().optional(),\n \"x-formspec-params\": z.array(z.string()).readonly().optional(),\n \"x-formspec-schemaSource\": z.string().optional(),\n })\n // passthrough preserves arbitrary x-formspec-* extension properties\n // added by custom decorators without causing validation failures\n .passthrough()\n);\n","/**\n * JSON Schema generator for FormSpec forms.\n */\n\nimport type {\n FormElement,\n FormSpec,\n AnyField,\n Group,\n Conditional,\n ArrayField,\n ObjectField,\n} from \"@formspec/core\";\nimport type { JSONSchema7 } from \"./types.js\";\nimport { jsonSchema7Schema } from \"./schema.js\";\nimport { z } from \"zod\";\n\n/**\n * Parses a value through a Zod schema, converting validation errors to a descriptive Error.\n */\nfunction parseOrThrow<T>(schema: z.ZodType<T>, value: unknown, label: string): T {\n try {\n return schema.parse(value);\n } catch (error) {\n if (error instanceof z.ZodError) {\n throw new Error(\n `Generated ${label} failed validation:\\n${error.issues.map((i) => ` ${i.path.join(\".\")}: ${i.message}`).join(\"\\n\")}`\n );\n }\n throw error;\n }\n}\n\n/**\n * Generates JSON Schema for nested elements (used for array items and object properties).\n */\nfunction generateNestedSchema(elements: readonly FormElement[]): JSONSchema7 {\n const properties: Record<string, JSONSchema7> = {};\n const required: string[] = [];\n\n collectFields(elements, properties, required);\n\n // Deduplicate required array (can have duplicates when the same field is defined\n // in multiple branches/containers, e.g., repeated in different conditional branches)\n const uniqueRequired = [...new Set(required)];\n\n return {\n type: \"object\",\n properties,\n ...(uniqueRequired.length > 0 && { required: uniqueRequired }),\n };\n}\n\n/**\n * Converts a single field to its JSON Schema representation.\n */\nfunction fieldToJsonSchema(field: AnyField): JSONSchema7 {\n const base: JSONSchema7 = {};\n\n if (field.label !== undefined) {\n base.title = field.label;\n }\n\n switch (field._field) {\n case \"text\":\n return { ...base, type: \"string\" };\n\n case \"number\":\n return {\n ...base,\n type: \"number\",\n ...(field.min !== undefined && { minimum: field.min }),\n ...(field.max !== undefined && { maximum: field.max }),\n };\n\n case \"boolean\":\n return { ...base, type: \"boolean\" };\n\n case \"enum\": {\n const opts = field.options;\n const isObjectOptions =\n opts.length > 0 &&\n opts.every(\n (opt): opt is { id: string; label: string } =>\n typeof opt === \"object\" && \"id\" in opt && \"label\" in opt\n );\n if (isObjectOptions) {\n // Object options with id/label: use oneOf with const/title\n return {\n ...base,\n type: \"string\",\n oneOf: opts.map((o) => ({\n const: o.id,\n title: o.label,\n })),\n };\n }\n return { ...base, type: \"string\", enum: opts as readonly string[] };\n }\n\n case \"dynamic_enum\":\n // Dynamic enums are strings at the schema level\n // The actual options are resolved at runtime\n // x-formspec-source indicates the data source key\n // x-formspec-params indicates dependent field names for fetching options\n return {\n ...base,\n type: \"string\",\n \"x-formspec-source\": field.source,\n ...(field.params !== undefined &&\n field.params.length > 0 && { \"x-formspec-params\": field.params }),\n };\n\n case \"dynamic_schema\":\n // Dynamic schemas are objects with unknown properties\n // x-formspec-schemaSource indicates where to load the schema from\n return {\n ...base,\n type: \"object\",\n additionalProperties: true,\n \"x-formspec-schemaSource\": field.schemaSource,\n };\n\n case \"array\": {\n const arrayField = field as ArrayField<string, readonly FormElement[]>;\n return {\n ...base,\n type: \"array\",\n items: generateNestedSchema(arrayField.items),\n ...(arrayField.minItems !== undefined && { minItems: arrayField.minItems }),\n ...(arrayField.maxItems !== undefined && { maxItems: arrayField.maxItems }),\n };\n }\n\n case \"object\": {\n const objectField = field as ObjectField<string, readonly FormElement[]>;\n const nestedSchema = generateNestedSchema(objectField.properties);\n return {\n ...base,\n ...nestedSchema,\n };\n }\n\n default: {\n // Exhaustiveness check\n const _exhaustive: never = field;\n return _exhaustive;\n }\n }\n}\n\n/**\n * Visits all elements in a form tree, collecting fields and required fields.\n */\nfunction collectFields(\n elements: readonly FormElement[],\n properties: Record<string, JSONSchema7>,\n required: string[]\n): void {\n for (const element of elements) {\n switch (element._type) {\n case \"field\":\n properties[element.name] = fieldToJsonSchema(element);\n if (element.required === true) {\n required.push(element.name);\n }\n break;\n\n case \"group\":\n // Groups don't affect schema structure, just collect their children\n collectFields((element as Group<readonly FormElement[]>).elements, properties, required);\n break;\n\n case \"conditional\":\n // Conditional fields are still part of the schema\n // They're just hidden/shown in the UI\n collectFields(\n (element as Conditional<string, unknown, readonly FormElement[]>).elements,\n properties,\n required\n );\n break;\n }\n }\n}\n\n/**\n * Generates a JSON Schema from a FormSpec.\n *\n * @example\n * ```typescript\n * const form = formspec(\n * field.text(\"name\", { label: \"Name\", required: true }),\n * field.number(\"age\", { min: 0 }),\n * );\n *\n * const schema = generateJsonSchema(form);\n * // {\n * // $schema: \"https://json-schema.org/draft-07/schema#\",\n * // type: \"object\",\n * // properties: {\n * // name: { type: \"string\", title: \"Name\" },\n * // age: { type: \"number\", minimum: 0 }\n * // },\n * // required: [\"name\"]\n * // }\n * ```\n *\n * @param form - The FormSpec to convert\n * @returns A JSON Schema object\n */\nexport function generateJsonSchema<E extends readonly FormElement[]>(\n form: FormSpec<E>\n): JSONSchema7 {\n const properties: Record<string, JSONSchema7> = {};\n const required: string[] = [];\n\n collectFields(form.elements, properties, required);\n\n // Deduplicate required array (can have duplicates when the same field is defined\n // in multiple branches/containers, e.g., repeated in different conditional branches)\n const uniqueRequired = [...new Set(required)];\n\n const result: JSONSchema7 = {\n $schema: \"https://json-schema.org/draft-07/schema#\",\n type: \"object\",\n properties,\n ...(uniqueRequired.length > 0 && { required: uniqueRequired }),\n };\n\n return parseOrThrow(jsonSchema7Schema, result, \"JSON Schema\");\n}\n","/**\n * Zod schemas for JSON Forms UI Schema.\n *\n * These schemas are the source of truth for UI Schema validation.\n * TypeScript types are derived from these schemas via `z.infer<>`.\n *\n * @see https://jsonforms.io/docs/uischema/\n */\n\nimport { z } from \"zod\";\n\n// =============================================================================\n// Primitive helpers\n// =============================================================================\n\n/** JSON Pointer string (e.g., \"#/properties/fieldName\") */\nconst jsonPointerSchema = z.string();\n\n// =============================================================================\n// Rule Effect and Element Type enums\n// =============================================================================\n\n/**\n * Zod schema for rule effect values.\n */\nexport const ruleEffectSchema = z.enum([\"SHOW\", \"HIDE\", \"ENABLE\", \"DISABLE\"]);\n\n/**\n * Rule effect types for conditional visibility.\n */\nexport type RuleEffect = z.infer<typeof ruleEffectSchema>;\n\n/**\n * Zod schema for UI Schema element type strings.\n */\nexport const uiSchemaElementTypeSchema = z.enum([\n \"Control\",\n \"VerticalLayout\",\n \"HorizontalLayout\",\n \"Group\",\n \"Categorization\",\n \"Category\",\n \"Label\",\n]);\n\n/**\n * UI Schema element types.\n */\nexport type UISchemaElementType = z.infer<typeof uiSchemaElementTypeSchema>;\n\n// =============================================================================\n// Rule Condition Schema (recursive)\n// =============================================================================\n\n// Forward-declare the recursive TypeScript type.\n// We use an interface here (rather than z.infer<>) because the recursive\n// z.lazy() type annotation requires us to pre-declare the shape.\n/**\n * JSON Schema subset used in rule conditions.\n */\nexport interface RuleConditionSchema {\n const?: unknown;\n enum?: readonly unknown[];\n type?: string;\n not?: RuleConditionSchema;\n minimum?: number;\n maximum?: number;\n exclusiveMinimum?: number;\n exclusiveMaximum?: number;\n minLength?: number;\n properties?: Record<string, RuleConditionSchema>;\n required?: string[];\n allOf?: RuleConditionSchema[];\n}\n\n// Build the Zod schema referencing the pre-declared interface.\n// We use z.ZodType<RuleConditionSchema> so the recursive reference works.\n// The interface uses `?` (exact optional), and z.ZodType checks output only,\n// so the optional fields (which Zod infers as `T | undefined`) are compatible\n// because `T | undefined` is assignable to the optional field slot.\n//\n// @ts-expect-error -- exactOptionalPropertyTypes: the Zod output type for optional\n// fields is `T | undefined`, but our interface uses `?` (exact optional, key may\n// be absent). This is a known mismatch when using z.ZodType<T> with\n// exactOptionalPropertyTypes:true; the runtime behavior is correct.\nexport const ruleConditionSchema: z.ZodType<RuleConditionSchema> = z.lazy(() =>\n z\n .object({\n const: z.unknown().optional(),\n enum: z.array(z.unknown()).readonly().optional(),\n type: z.string().optional(),\n not: ruleConditionSchema.optional(),\n minimum: z.number().optional(),\n maximum: z.number().optional(),\n exclusiveMinimum: z.number().optional(),\n exclusiveMaximum: z.number().optional(),\n minLength: z.number().optional(),\n properties: z.record(z.string(), ruleConditionSchema).optional(),\n required: z.array(z.string()).optional(),\n allOf: z.array(ruleConditionSchema).optional(),\n })\n .strict()\n);\n\n// =============================================================================\n// Schema-Based Condition and Rule\n// =============================================================================\n\n/**\n * Zod schema for a schema-based rule condition.\n */\nexport const schemaBasedConditionSchema = z\n .object({\n scope: jsonPointerSchema,\n schema: ruleConditionSchema,\n })\n .strict();\n\n/**\n * Condition for a rule.\n */\nexport type SchemaBasedCondition = z.infer<typeof schemaBasedConditionSchema>;\n\n/**\n * Zod schema for a UI Schema rule.\n */\nexport const ruleSchema = z\n .object({\n effect: ruleEffectSchema,\n condition: schemaBasedConditionSchema,\n })\n .strict();\n\n/**\n * Rule for conditional element visibility/enablement.\n */\nexport type Rule = z.infer<typeof ruleSchema>;\n\n// =============================================================================\n// UI Schema Element Schemas (recursive via z.lazy)\n// =============================================================================\n\n// Forward-declare UISchemaElement so layout schemas can reference it.\n// We declare the type up-front and wire the Zod schema below.\n/**\n * Union of all UI Schema element types.\n */\nexport type UISchemaElement =\n | ControlElement\n | VerticalLayout\n | HorizontalLayout\n | GroupLayout\n | Categorization\n | Category\n | LabelElement;\n\n// The Zod schema for UISchemaElement is defined as a const using z.lazy(),\n// which defers evaluation until first use. This allows all element schemas\n// below to be referenced even though they are declared after this line.\nexport const uiSchemaElementSchema: z.ZodType<UISchemaElement> = z.lazy(() =>\n z.union([\n controlSchema,\n verticalLayoutSchema,\n horizontalLayoutSchema,\n groupLayoutSchema,\n categorizationSchema,\n categorySchema,\n labelElementSchema,\n ])\n) as z.ZodType<UISchemaElement>;\n\n// -----------------------------------------------------------------------------\n// Control\n// -----------------------------------------------------------------------------\n\n/**\n * Zod schema for a Control element.\n */\nexport const controlSchema = z\n .object({\n type: z.literal(\"Control\"),\n scope: jsonPointerSchema,\n label: z.union([z.string(), z.literal(false)]).optional(),\n rule: ruleSchema.optional(),\n options: z.record(z.string(), z.unknown()).optional(),\n })\n .passthrough();\n\n/**\n * A Control element that binds to a JSON Schema property.\n */\nexport type ControlElement = z.infer<typeof controlSchema>;\n\n// -----------------------------------------------------------------------------\n// VerticalLayout\n// -----------------------------------------------------------------------------\n\n// Pre-declare the interface so the Zod schema can reference UISchemaElement.\n/**\n * A vertical layout element.\n */\nexport interface VerticalLayout {\n type: \"VerticalLayout\";\n elements: UISchemaElement[];\n rule?: Rule | undefined;\n options?: Record<string, unknown> | undefined;\n [k: string]: unknown;\n}\n\nexport const verticalLayoutSchema: z.ZodType<VerticalLayout> = z.lazy(() =>\n z\n .object({\n type: z.literal(\"VerticalLayout\"),\n elements: z.array(uiSchemaElementSchema),\n rule: ruleSchema.optional(),\n options: z.record(z.string(), z.unknown()).optional(),\n })\n .passthrough()\n);\n\n// -----------------------------------------------------------------------------\n// HorizontalLayout\n// -----------------------------------------------------------------------------\n\n/**\n * A horizontal layout element.\n */\nexport interface HorizontalLayout {\n type: \"HorizontalLayout\";\n elements: UISchemaElement[];\n rule?: Rule | undefined;\n options?: Record<string, unknown> | undefined;\n [k: string]: unknown;\n}\n\nexport const horizontalLayoutSchema: z.ZodType<HorizontalLayout> = z.lazy(() =>\n z\n .object({\n type: z.literal(\"HorizontalLayout\"),\n elements: z.array(uiSchemaElementSchema),\n rule: ruleSchema.optional(),\n options: z.record(z.string(), z.unknown()).optional(),\n })\n .passthrough()\n);\n\n// -----------------------------------------------------------------------------\n// GroupLayout\n// -----------------------------------------------------------------------------\n\n/**\n * A group element with a label.\n */\nexport interface GroupLayout {\n type: \"Group\";\n label: string;\n elements: UISchemaElement[];\n rule?: Rule | undefined;\n options?: Record<string, unknown> | undefined;\n [k: string]: unknown;\n}\n\nexport const groupLayoutSchema: z.ZodType<GroupLayout> = z.lazy(() =>\n z\n .object({\n type: z.literal(\"Group\"),\n label: z.string(),\n elements: z.array(uiSchemaElementSchema),\n rule: ruleSchema.optional(),\n options: z.record(z.string(), z.unknown()).optional(),\n })\n .passthrough()\n);\n\n// -----------------------------------------------------------------------------\n// Category\n// -----------------------------------------------------------------------------\n\n/**\n * A Category element, used inside a Categorization layout.\n */\nexport interface Category {\n type: \"Category\";\n label: string;\n elements: UISchemaElement[];\n rule?: Rule | undefined;\n options?: Record<string, unknown> | undefined;\n [k: string]: unknown;\n}\n\nexport const categorySchema: z.ZodType<Category> = z.lazy(() =>\n z\n .object({\n type: z.literal(\"Category\"),\n label: z.string(),\n elements: z.array(uiSchemaElementSchema),\n rule: ruleSchema.optional(),\n options: z.record(z.string(), z.unknown()).optional(),\n })\n .passthrough()\n);\n\n// -----------------------------------------------------------------------------\n// Categorization\n// -----------------------------------------------------------------------------\n\n/**\n * A Categorization element (tab-based layout).\n */\nexport interface Categorization {\n type: \"Categorization\";\n elements: Category[];\n label?: string | undefined;\n rule?: Rule | undefined;\n options?: Record<string, unknown> | undefined;\n [k: string]: unknown;\n}\n\nexport const categorizationSchema: z.ZodType<Categorization> = z.lazy(() =>\n z\n .object({\n type: z.literal(\"Categorization\"),\n elements: z.array(categorySchema),\n label: z.string().optional(),\n rule: ruleSchema.optional(),\n options: z.record(z.string(), z.unknown()).optional(),\n })\n .passthrough()\n);\n\n// -----------------------------------------------------------------------------\n// LabelElement\n// -----------------------------------------------------------------------------\n\n/**\n * Zod schema for a Label element.\n */\nexport const labelElementSchema = z\n .object({\n type: z.literal(\"Label\"),\n text: z.string(),\n rule: ruleSchema.optional(),\n options: z.record(z.string(), z.unknown()).optional(),\n })\n .passthrough();\n\n/**\n * A Label element for displaying static text.\n */\nexport type LabelElement = z.infer<typeof labelElementSchema>;\n\n// =============================================================================\n// Root UISchema\n// =============================================================================\n\n/**\n * Root UI Schema (always a layout — not a Control, Category, or Label).\n */\nexport type UISchema = VerticalLayout | HorizontalLayout | GroupLayout | Categorization;\n\n/**\n * Zod schema for the root UI Schema (layout types only).\n */\nexport const uiSchema: z.ZodType<UISchema> = z.lazy(() =>\n z.union([verticalLayoutSchema, horizontalLayoutSchema, groupLayoutSchema, categorizationSchema])\n) as z.ZodType<UISchema>;\n","/**\n * JSON Forms UI Schema generator for FormSpec forms.\n */\n\nimport type { FormElement, FormSpec, Group, Conditional } from \"@formspec/core\";\nimport type { UISchemaElement, UISchema, ControlElement, GroupLayout, Rule } from \"./types.js\";\nimport { uiSchema as uiSchemaValidator } from \"./schema.js\";\nimport type { FormSpecField } from \"../analyzer/type-converter.js\";\nimport { z } from \"zod\";\n\n/**\n * Parses a value through a Zod schema, converting validation errors to a descriptive Error.\n */\nfunction parseOrThrow<T>(schema: z.ZodType<T>, value: unknown, label: string): T {\n try {\n return schema.parse(value);\n } catch (error) {\n if (error instanceof z.ZodError) {\n throw new Error(\n `Generated ${label} failed validation:\\n${error.issues.map((i) => ` ${i.path.join(\".\")}: ${i.message}`).join(\"\\n\")}`\n );\n }\n throw error;\n }\n}\n\n/**\n * Converts a field name to a JSON Pointer scope.\n */\nfunction fieldToScope(fieldName: string): string {\n return `#/properties/${fieldName}`;\n}\n\n/**\n * Creates a rule for conditional visibility.\n */\nfunction createShowRule(fieldName: string, value: unknown): Rule {\n return {\n effect: \"SHOW\",\n condition: {\n scope: fieldToScope(fieldName),\n schema: { const: value },\n },\n };\n}\n\n/**\n * Combines two rules into one using allOf.\n *\n * When elements are nested inside multiple conditionals, all conditions\n * must be met for the element to be visible.\n */\nfunction combineRules(parentRule: Rule, childRule: Rule): Rule {\n // Both rules should have the same effect (SHOW)\n // Combine conditions using allOf\n const parentCondition = parentRule.condition;\n const childCondition = childRule.condition;\n\n return {\n effect: \"SHOW\",\n condition: {\n scope: \"#\",\n schema: {\n allOf: [\n {\n properties: {\n [parentCondition.scope.replace(\"#/properties/\", \"\")]: parentCondition.schema,\n },\n },\n {\n properties: {\n [childCondition.scope.replace(\"#/properties/\", \"\")]: childCondition.schema,\n },\n },\n ],\n },\n },\n };\n}\n\n/**\n * Converts form elements to UI Schema elements.\n *\n * @param elements - The form elements to convert\n * @param parentRule - Optional rule inherited from parent conditional\n * @returns Array of UI Schema elements\n */\nfunction elementsToUiSchema(\n elements: readonly FormElement[],\n parentRule?: Rule\n): UISchemaElement[] {\n const result: UISchemaElement[] = [];\n\n for (const element of elements) {\n switch (element._type) {\n case \"field\": {\n const control: ControlElement = {\n type: \"Control\",\n scope: fieldToScope(element.name),\n ...(element.label !== undefined && { label: element.label }),\n ...(parentRule !== undefined && { rule: parentRule }),\n };\n result.push(control);\n break;\n }\n\n case \"group\": {\n const groupElement = element as Group<readonly FormElement[]>;\n const group: GroupLayout = {\n type: \"Group\",\n label: groupElement.label,\n elements: elementsToUiSchema(groupElement.elements, parentRule),\n ...(parentRule !== undefined && { rule: parentRule }),\n };\n result.push(group);\n break;\n }\n\n case \"conditional\": {\n const conditionalElement = element as Conditional<string, unknown, readonly FormElement[]>;\n // Create a rule for this conditional\n const newRule = createShowRule(conditionalElement.field, conditionalElement.value);\n // Combine with parent rule if present (for nested conditionals)\n const combinedRule = parentRule !== undefined ? combineRules(parentRule, newRule) : newRule;\n // Apply the combined rule to all children\n const childElements = elementsToUiSchema(conditionalElement.elements, combinedRule);\n result.push(...childElements);\n break;\n }\n }\n }\n\n return result;\n}\n\n/**\n * Converts a single FormSpecField to a ControlElement, resolving showWhen into a rule.\n *\n * @param field - The FormSpecField to convert\n * @param scopePrefix - The JSON Pointer prefix for the field's scope\n * @returns A ControlElement\n */\nfunction formSpecFieldToElement(\n field: FormSpecField,\n scopePrefix = \"#/properties\"\n): ControlElement {\n const control: ControlElement = {\n type: \"Control\",\n scope: `${scopePrefix}/${field.id}`,\n };\n\n if (field.label !== undefined) {\n control.label = field.label;\n }\n\n if (\n field.showWhen !== undefined &&\n typeof field.showWhen === \"object\" &&\n \"field\" in field.showWhen &&\n \"value\" in field.showWhen\n ) {\n const sw = field.showWhen as { field: string; value: unknown };\n control.rule = {\n effect: \"SHOW\",\n condition: {\n scope: `#/properties/${sw.field}`,\n schema: { const: sw.value },\n },\n };\n }\n\n return control;\n}\n\n/**\n * Converts FormSpecField[] (from decorator/interface/type analysis) to a JSON Forms UISchema.\n *\n * Mapping:\n * - Each field → `{ type: \"Control\", scope: \"#/properties/{id}\", label? }`\n * - `showWhen: { field, value }` → rule with SHOW effect\n * - `group` property → Groups fields by group name, preserving insertion order\n * - `fields` (nested object) → single Control pointing to the object property\n * - Root wrapper → `{ type: \"VerticalLayout\", elements }`\n *\n * @param fields - The FormSpecField array to convert\n * @returns A JSON Forms UISchema\n */\nexport function generateUiSchemaFromFields(fields: FormSpecField[]): UISchema {\n // Collect elements, grouping by the `group` property.\n // Map preserves insertion order — first occurrence of a group name determines its position.\n const groupMap = new Map<string, ControlElement[]>();\n const orderedKeys: (string | null)[] = []; // null = ungrouped slot\n const ungrouped: ControlElement[] = [];\n\n for (const field of fields) {\n const element = formSpecFieldToElement(field);\n\n if (field.group !== undefined) {\n if (!groupMap.has(field.group)) {\n groupMap.set(field.group, []);\n orderedKeys.push(field.group);\n }\n // We know the key exists since we just set it above.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n groupMap.get(field.group)!.push(element);\n } else {\n // Track position for ungrouped fields relative to grouped fields.\n // Use a sentinel to mark the slot for ungrouped elements inline.\n orderedKeys.push(null);\n ungrouped.push(element);\n }\n }\n\n // Build the flat elements list respecting insertion order.\n const elements: UISchemaElement[] = [];\n let ungroupedIndex = 0;\n\n for (const key of orderedKeys) {\n if (key === null) {\n // Ungrouped field — emit directly.\n const el = ungrouped[ungroupedIndex++];\n if (el !== undefined) {\n elements.push(el);\n }\n } else {\n // Each group key appears in orderedKeys exactly once (guarded by\n // `!groupMap.has()` above), so we emit the Group element directly.\n const groupElements = groupMap.get(key) ?? [];\n const groupLayout: GroupLayout = {\n type: \"Group\",\n label: key,\n elements: groupElements,\n };\n elements.push(groupLayout);\n }\n }\n\n const result: UISchema = {\n type: \"VerticalLayout\",\n elements,\n };\n\n return parseOrThrow(uiSchemaValidator, result, \"UI Schema\");\n}\n\n/**\n * Generates a JSON Forms UI Schema from a FormSpec.\n *\n * @example\n * ```typescript\n * const form = formspec(\n * group(\"Customer\",\n * field.text(\"name\", { label: \"Name\" }),\n * ),\n * when(\"status\", \"draft\",\n * field.text(\"notes\", { label: \"Notes\" }),\n * ),\n * );\n *\n * const uiSchema = generateUiSchema(form);\n * // {\n * // type: \"VerticalLayout\",\n * // elements: [\n * // {\n * // type: \"Group\",\n * // label: \"Customer\",\n * // elements: [\n * // { type: \"Control\", scope: \"#/properties/name\", label: \"Name\" }\n * // ]\n * // },\n * // {\n * // type: \"Control\",\n * // scope: \"#/properties/notes\",\n * // label: \"Notes\",\n * // rule: {\n * // effect: \"SHOW\",\n * // condition: { scope: \"#/properties/status\", schema: { const: \"draft\" } }\n * // }\n * // }\n * // ]\n * // }\n * ```\n *\n * @param form - The FormSpec to convert\n * @returns A JSON Forms UI Schema\n */\nexport function generateUiSchema<E extends readonly FormElement[]>(form: FormSpec<E>): UISchema {\n const result: UISchema = {\n type: \"VerticalLayout\",\n elements: elementsToUiSchema(form.elements),\n };\n\n return parseOrThrow(uiSchemaValidator, result, \"UI Schema\");\n}\n","/**\n * JSON Schema Draft-07 type definitions.\n *\n * These types are a subset of JSON Schema sufficient for form generation.\n */\n\n/**\n * JSON Schema primitive types.\n */\nexport type JSONSchemaType =\n | \"string\"\n | \"number\"\n | \"integer\"\n | \"boolean\"\n | \"object\"\n | \"array\"\n | \"null\";\n\n/**\n * A JSON Schema definition (draft-07 subset).\n */\nexport interface JSONSchema7 {\n $schema?: string;\n $id?: string;\n $ref?: string;\n\n // Metadata\n title?: string;\n description?: string;\n deprecated?: boolean;\n\n // Type\n type?: JSONSchemaType | JSONSchemaType[];\n\n // String validation\n minLength?: number;\n maxLength?: number;\n pattern?: string;\n\n // Number validation\n minimum?: number;\n maximum?: number;\n exclusiveMinimum?: number;\n exclusiveMaximum?: number;\n\n // Enum\n enum?: readonly (string | number | boolean | null)[];\n const?: string | number | boolean | null;\n\n // Object\n properties?: Record<string, JSONSchema7>;\n required?: string[];\n additionalProperties?: boolean | JSONSchema7;\n\n // Array\n items?: JSONSchema7 | JSONSchema7[];\n minItems?: number;\n maxItems?: number;\n\n // Composition\n allOf?: JSONSchema7[];\n anyOf?: JSONSchema7[];\n oneOf?: JSONSchema7[];\n not?: JSONSchema7;\n\n // Conditional\n if?: JSONSchema7;\n then?: JSONSchema7;\n else?: JSONSchema7;\n\n // Format\n format?: string;\n\n // Default\n default?: unknown;\n\n // =============================================================================\n // FormSpec Extensions (x- prefixed)\n // =============================================================================\n\n /**\n * Data source key for dynamic enum fields.\n * Indicates that options should be fetched from a registered resolver.\n */\n \"x-formspec-source\"?: string;\n\n /**\n * Field names whose values are needed to fetch dynamic enum options.\n * Used for dependent/cascading dropdowns.\n */\n \"x-formspec-params\"?: readonly string[];\n\n /**\n * Schema source identifier for dynamic schema fields.\n * Indicates that the schema should be loaded dynamically at runtime.\n */\n \"x-formspec-schemaSource\"?: string;\n}\n\n/** Extension properties for custom FormSpec decorators. */\nexport type FormSpecSchemaExtensions = Record<`x-formspec-${string}`, unknown>;\n\n/** JSON Schema with FormSpec extension properties for arbitrary x-formspec-* keys. */\nexport type ExtendedJSONSchema7 = JSONSchema7 & FormSpecSchemaExtensions;\n\n/**\n * Sets a FormSpec extension property on a JSON Schema node.\n *\n * Use this to safely add `x-formspec-*` properties to any schema,\n * including nested schemas typed as `JSONSchema7` (which don't carry\n * the extension index signature).\n *\n * @param schema - Any JSON Schema node\n * @param key - Extension key (must start with `x-formspec-`)\n * @param value - Extension value\n */\nexport function setSchemaExtension(\n schema: JSONSchema7,\n key: `x-formspec-${string}`,\n value: unknown\n): void {\n (schema as ExtendedJSONSchema7)[key] = value;\n}\n\n/**\n * Reads a FormSpec extension property from a JSON Schema node.\n *\n * Use this to safely read `x-formspec-*` properties from any schema,\n * including nested schemas typed as `JSONSchema7`.\n *\n * @param schema - Any JSON Schema node\n * @param key - Extension key (must start with `x-formspec-`)\n * @returns The extension value, or `undefined` if not present\n */\nexport function getSchemaExtension(schema: JSONSchema7, key: `x-formspec-${string}`): unknown {\n return (schema as ExtendedJSONSchema7)[key];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;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