@formspec/dsl 0.1.0-alpha.2 → 0.1.0-alpha.5
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/README.md +332 -0
- package/dist/__tests__/builders.test.js +36 -0
- package/dist/__tests__/builders.test.js.map +1 -1
- package/dist/__tests__/validation.test.js +16 -14
- package/dist/__tests__/validation.test.js.map +1 -1
- package/dist/dsl.d.ts +517 -0
- package/dist/field.d.ts +13 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +44 -8
- package/dist/field.js.map +1 -1
- package/dist/predicate.d.ts +1 -0
- package/dist/predicate.d.ts.map +1 -1
- package/dist/predicate.js +1 -0
- package/dist/predicate.js.map +1 -1
- package/dist/validation.js +2 -2
- package/dist/validation.js.map +1 -1
- package/package.json +5 -4
package/README.md
ADDED
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
# @formspec/dsl
|
|
2
|
+
|
|
3
|
+
Type-safe form definition using a fluent builder API. This is the recommended approach for defining forms programmatically, especially when you need runtime form construction or dynamic forms.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @formspec/dsl @formspec/build
|
|
9
|
+
# Or use the umbrella package:
|
|
10
|
+
npm install formspec
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
This package is ESM-only and requires:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
// package.json
|
|
19
|
+
{
|
|
20
|
+
"type": "module"
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
// tsconfig.json
|
|
26
|
+
{
|
|
27
|
+
"compilerOptions": {
|
|
28
|
+
"module": "NodeNext",
|
|
29
|
+
"moduleResolution": "NodeNext"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { formspec, field, group, when, is, type InferFormSchema } from "@formspec/dsl";
|
|
38
|
+
import { buildFormSchemas } from "@formspec/build";
|
|
39
|
+
|
|
40
|
+
// Define a form with full type safety
|
|
41
|
+
const ContactForm = formspec(
|
|
42
|
+
field.text("name", { label: "Name", required: true }),
|
|
43
|
+
field.text("email", { label: "Email", required: true }),
|
|
44
|
+
field.enum("subject", ["general", "support", "sales"] as const, {
|
|
45
|
+
label: "Subject",
|
|
46
|
+
required: true
|
|
47
|
+
}),
|
|
48
|
+
field.text("message", { label: "Message", required: true }),
|
|
49
|
+
field.boolean("subscribe", { label: "Subscribe to newsletter" })
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
// Infer TypeScript types from the form definition
|
|
53
|
+
type ContactData = InferFormSchema<typeof ContactForm>;
|
|
54
|
+
// Result: { name: string; email: string; subject: "general" | "support" | "sales"; message: string; subscribe: boolean }
|
|
55
|
+
|
|
56
|
+
// Generate JSON Schema and UI Schema
|
|
57
|
+
const { jsonSchema, uiSchema } = buildFormSchemas(ContactForm);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Field Types
|
|
61
|
+
|
|
62
|
+
### Text Field
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
field.text("fieldName", {
|
|
66
|
+
label: "Display Label",
|
|
67
|
+
description: "Help text",
|
|
68
|
+
required: true,
|
|
69
|
+
minLength: 1,
|
|
70
|
+
maxLength: 100,
|
|
71
|
+
pattern: "^[a-zA-Z]+$" // Regex pattern
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Number Field
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
field.number("age", {
|
|
79
|
+
label: "Age",
|
|
80
|
+
required: true,
|
|
81
|
+
min: 0,
|
|
82
|
+
max: 120
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Boolean Field
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
field.boolean("acceptTerms", {
|
|
90
|
+
label: "I accept the terms and conditions",
|
|
91
|
+
required: true
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Enum Field (Dropdown/Select)
|
|
96
|
+
|
|
97
|
+
Use `as const` to preserve literal types for type inference:
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
// Simple string options
|
|
101
|
+
field.enum("status", ["draft", "published", "archived"] as const, {
|
|
102
|
+
label: "Status",
|
|
103
|
+
required: true
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// Options with separate IDs and labels
|
|
107
|
+
field.enum("country", [
|
|
108
|
+
{ id: "us", label: "United States" },
|
|
109
|
+
{ id: "ca", label: "Canada" },
|
|
110
|
+
{ id: "uk", label: "United Kingdom" }
|
|
111
|
+
] as const, {
|
|
112
|
+
label: "Country"
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Note:** Use `as const` when passing enum options from a variable. For inline array literals, the `const` type parameter preserves literal types automatically.
|
|
117
|
+
|
|
118
|
+
### Dynamic Enum Field
|
|
119
|
+
|
|
120
|
+
For dropdowns populated at runtime from an API:
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
field.dynamicEnum("customerId", "fetch_customers", {
|
|
124
|
+
label: "Customer",
|
|
125
|
+
required: true
|
|
126
|
+
});
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The second argument is a source identifier used with `@formspec/runtime` resolvers.
|
|
130
|
+
|
|
131
|
+
### Array Field
|
|
132
|
+
|
|
133
|
+
For repeatable field groups:
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
field.array("lineItems",
|
|
137
|
+
field.text("description", { label: "Description", required: true }),
|
|
138
|
+
field.number("quantity", { label: "Quantity", min: 1 }),
|
|
139
|
+
field.number("price", { label: "Unit Price", min: 0 })
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
// With configuration
|
|
143
|
+
field.arrayWithConfig("contacts",
|
|
144
|
+
{ label: "Contact List", minItems: 1, maxItems: 5 },
|
|
145
|
+
field.text("name", { label: "Name" }),
|
|
146
|
+
field.text("phone", { label: "Phone" })
|
|
147
|
+
);
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Object Field
|
|
151
|
+
|
|
152
|
+
For nested field groups:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
field.object("address",
|
|
156
|
+
field.text("street", { label: "Street", required: true }),
|
|
157
|
+
field.text("city", { label: "City", required: true }),
|
|
158
|
+
field.text("zipCode", { label: "ZIP Code", required: true })
|
|
159
|
+
);
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Grouping
|
|
163
|
+
|
|
164
|
+
Use `group()` to visually organize fields:
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
const UserForm = formspec(
|
|
168
|
+
group("Personal Information",
|
|
169
|
+
field.text("firstName", { label: "First Name", required: true }),
|
|
170
|
+
field.text("lastName", { label: "Last Name", required: true }),
|
|
171
|
+
field.text("email", { label: "Email", required: true })
|
|
172
|
+
),
|
|
173
|
+
group("Preferences",
|
|
174
|
+
field.enum("theme", ["light", "dark", "system"] as const, { label: "Theme" }),
|
|
175
|
+
field.boolean("notifications", { label: "Enable notifications" })
|
|
176
|
+
)
|
|
177
|
+
);
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Conditional Fields
|
|
181
|
+
|
|
182
|
+
Use `when()` and `is()` to show/hide fields based on other field values:
|
|
183
|
+
|
|
184
|
+
```typescript
|
|
185
|
+
const OrderForm = formspec(
|
|
186
|
+
field.enum("shippingMethod", ["standard", "express", "pickup"] as const, {
|
|
187
|
+
label: "Shipping Method",
|
|
188
|
+
required: true
|
|
189
|
+
}),
|
|
190
|
+
|
|
191
|
+
// Only show address fields when shipping method is not "pickup"
|
|
192
|
+
when(is("shippingMethod", "standard"),
|
|
193
|
+
field.text("address", { label: "Shipping Address", required: true }),
|
|
194
|
+
field.text("city", { label: "City", required: true })
|
|
195
|
+
),
|
|
196
|
+
when(is("shippingMethod", "express"),
|
|
197
|
+
field.text("address", { label: "Shipping Address", required: true }),
|
|
198
|
+
field.text("city", { label: "City", required: true }),
|
|
199
|
+
field.text("phone", { label: "Phone for courier", required: true })
|
|
200
|
+
)
|
|
201
|
+
);
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Type Inference
|
|
205
|
+
|
|
206
|
+
The library provides powerful type inference utilities:
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
import { type InferFormSchema, type InferFieldValue } from "@formspec/dsl";
|
|
210
|
+
|
|
211
|
+
const MyForm = formspec(
|
|
212
|
+
field.text("name"),
|
|
213
|
+
field.number("age"),
|
|
214
|
+
field.enum("role", ["admin", "user", "guest"] as const)
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
// Infer the complete form data type
|
|
218
|
+
type FormData = InferFormSchema<typeof MyForm>;
|
|
219
|
+
// { name: string; age: number; role: "admin" | "user" | "guest" }
|
|
220
|
+
|
|
221
|
+
// Access form elements at runtime
|
|
222
|
+
for (const element of MyForm.elements) {
|
|
223
|
+
if (element._type === "field") {
|
|
224
|
+
console.log(element.name, element._field);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Validation
|
|
230
|
+
|
|
231
|
+
Validate form definitions at runtime:
|
|
232
|
+
|
|
233
|
+
```typescript
|
|
234
|
+
import { formspec, field, validateForm, logValidationIssues } from "@formspec/dsl";
|
|
235
|
+
|
|
236
|
+
const form = formspec(
|
|
237
|
+
field.text("email"),
|
|
238
|
+
field.text("email") // Duplicate field name!
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
const result = validateForm(form.elements);
|
|
242
|
+
if (!result.valid) {
|
|
243
|
+
logValidationIssues(result, "MyForm");
|
|
244
|
+
// Logs: [MyForm] ERROR at email: Duplicate field name "email"
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Or use formspecWithValidation for automatic checking
|
|
248
|
+
import { formspecWithValidation } from "@formspec/dsl";
|
|
249
|
+
|
|
250
|
+
const validatedForm = formspecWithValidation(
|
|
251
|
+
{ name: "MyForm", validate: "throw" },
|
|
252
|
+
field.text("email"),
|
|
253
|
+
field.text("email") // Throws error!
|
|
254
|
+
);
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Schema Generation
|
|
258
|
+
|
|
259
|
+
Use `@formspec/build` to generate JSON Schema and UI Schema:
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
import { buildFormSchemas, writeSchemas } from "@formspec/build";
|
|
263
|
+
|
|
264
|
+
// Get schema objects
|
|
265
|
+
const { jsonSchema, uiSchema } = buildFormSchemas(MyForm);
|
|
266
|
+
|
|
267
|
+
// Or write to files
|
|
268
|
+
writeSchemas(MyForm, {
|
|
269
|
+
outDir: "./generated",
|
|
270
|
+
name: "MyForm"
|
|
271
|
+
});
|
|
272
|
+
// Creates:
|
|
273
|
+
// ./generated/MyForm-schema.json
|
|
274
|
+
// ./generated/MyForm-uischema.json
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## When to Use This Package
|
|
278
|
+
|
|
279
|
+
Use `@formspec/dsl` when:
|
|
280
|
+
|
|
281
|
+
- **Forms are defined programmatically** - Building forms from configuration or code
|
|
282
|
+
- **Runtime form construction** - Creating forms dynamically based on user input or API data
|
|
283
|
+
- **Full type inference needed** - Deriving TypeScript types from form definitions
|
|
284
|
+
- **No build step preferred** - Works directly at runtime without CLI codegen
|
|
285
|
+
|
|
286
|
+
Consider `@formspec/decorators` when:
|
|
287
|
+
|
|
288
|
+
- **Class-based forms preferred** - Using TypeScript classes with property decorators
|
|
289
|
+
- **Type inference from existing types** - Leveraging existing TypeScript class types
|
|
290
|
+
- **Static analysis available** - Using the CLI for build-time schema generation
|
|
291
|
+
|
|
292
|
+
## API Reference
|
|
293
|
+
|
|
294
|
+
### Functions
|
|
295
|
+
|
|
296
|
+
| Function | Description |
|
|
297
|
+
|----------|-------------|
|
|
298
|
+
| `formspec(...elements)` | Create a form specification |
|
|
299
|
+
| `formspecWithValidation(options, ...elements)` | Create a form with validation |
|
|
300
|
+
| `group(label, ...elements)` | Create a visual field group |
|
|
301
|
+
| `when(predicate, ...elements)` | Create conditional fields |
|
|
302
|
+
| `is(fieldName, value)` | Create an equality predicate |
|
|
303
|
+
| `validateForm(elements)` | Validate form elements |
|
|
304
|
+
| `logValidationIssues(result)` | Log validation issues to console |
|
|
305
|
+
|
|
306
|
+
### Field Builders
|
|
307
|
+
|
|
308
|
+
| Builder | Description |
|
|
309
|
+
|---------|-------------|
|
|
310
|
+
| `field.text(name, config?)` | Text input field |
|
|
311
|
+
| `field.number(name, config?)` | Numeric input field |
|
|
312
|
+
| `field.boolean(name, config?)` | Checkbox/toggle field |
|
|
313
|
+
| `field.enum(name, options, config?)` | Dropdown/select field |
|
|
314
|
+
| `field.dynamicEnum(name, source, config?)` | API-populated dropdown |
|
|
315
|
+
| `field.dynamicSchema(name, source, config?)` | Dynamic nested schema |
|
|
316
|
+
| `field.array(name, ...items)` | Repeatable field array |
|
|
317
|
+
| `field.arrayWithConfig(name, config, ...items)` | Array with configuration |
|
|
318
|
+
| `field.object(name, ...properties)` | Nested object field |
|
|
319
|
+
| `field.objectWithConfig(name, config, ...properties)` | Object with configuration |
|
|
320
|
+
|
|
321
|
+
### Type Utilities
|
|
322
|
+
|
|
323
|
+
| Type | Description |
|
|
324
|
+
|------|-------------|
|
|
325
|
+
| `InferFormSchema<F>` | Infer data type from FormSpec |
|
|
326
|
+
| `InferSchema<Elements>` | Infer data type from element array |
|
|
327
|
+
| `InferFieldValue<F>` | Infer value type from a single field |
|
|
328
|
+
| `ExtractFields<E>` | Extract all fields from an element |
|
|
329
|
+
|
|
330
|
+
## License
|
|
331
|
+
|
|
332
|
+
UNLICENSED
|
|
@@ -82,6 +82,42 @@ describe("field builders", () => {
|
|
|
82
82
|
expect(f.label).toBe("Priority");
|
|
83
83
|
expect(f.required).toBe(true);
|
|
84
84
|
});
|
|
85
|
+
it("should handle empty options array", () => {
|
|
86
|
+
const f = field.enum("empty", []);
|
|
87
|
+
expect(f._field).toBe("enum");
|
|
88
|
+
expect(f.options).toEqual([]);
|
|
89
|
+
});
|
|
90
|
+
it("should throw error for mixed string and object options", () => {
|
|
91
|
+
expect(() => {
|
|
92
|
+
// Using 'as any' to bypass type checking for runtime validation test
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
|
+
field.enum("mixed", ["string", { id: "obj", label: "Object" }]);
|
|
95
|
+
}).toThrow(/options must be all strings or all objects/);
|
|
96
|
+
});
|
|
97
|
+
it("should throw error for object options missing id", () => {
|
|
98
|
+
expect(() => {
|
|
99
|
+
// @ts-expect-error - intentionally testing invalid object
|
|
100
|
+
field.enum("invalid", [{ label: "No ID" }]);
|
|
101
|
+
}).toThrow(/object options must have string "id" and "label"/);
|
|
102
|
+
});
|
|
103
|
+
it("should throw error for object options missing label", () => {
|
|
104
|
+
expect(() => {
|
|
105
|
+
// @ts-expect-error - intentionally testing invalid object
|
|
106
|
+
field.enum("invalid", [{ id: "missing-label" }]);
|
|
107
|
+
}).toThrow(/object options must have string "id" and "label"/);
|
|
108
|
+
});
|
|
109
|
+
it("should throw error for object options with non-string id", () => {
|
|
110
|
+
expect(() => {
|
|
111
|
+
// @ts-expect-error - intentionally testing invalid object
|
|
112
|
+
field.enum("invalid", [{ id: 123, label: "Number ID" }]);
|
|
113
|
+
}).toThrow(/object options must have string "id" and "label"/);
|
|
114
|
+
});
|
|
115
|
+
it("should throw error for object options with non-string label", () => {
|
|
116
|
+
expect(() => {
|
|
117
|
+
// @ts-expect-error - intentionally testing invalid object
|
|
118
|
+
field.enum("invalid", [{ id: "valid", label: 456 }]);
|
|
119
|
+
}).toThrow(/object options must have string "id" and "label"/);
|
|
120
|
+
});
|
|
85
121
|
});
|
|
86
122
|
describe("field.dynamicEnum", () => {
|
|
87
123
|
it("should create a dynamic enum field with source", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.test.js","sourceRoot":"","sources":["../../src/__tests__/builders.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE/D,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;YAC7D,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAE7B,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC9B,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC9B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;YACnD,MAAM,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;gBAC3B,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,iBAAiB;gBAC9B,QAAQ,EAAE,IAAI;aACf,CAAC,CAAC;YAEH,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAClC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAC9C,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC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C1C,IAAI,aAAa,CAAC,KAAK,KAAK,OAAO,EAAE,CAAC;YACpC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAC/C,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxD,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -9,9 +9,9 @@ describe("validateForm", () => {
|
|
|
9
9
|
field.text("name"), // duplicate
|
|
10
10
|
];
|
|
11
11
|
const result = validateForm(elements);
|
|
12
|
-
expect(result.valid).toBe(
|
|
12
|
+
expect(result.valid).toBe(false); // duplicates are errors
|
|
13
13
|
expect(result.issues).toHaveLength(1);
|
|
14
|
-
expect(result.issues[0].severity).toBe("
|
|
14
|
+
expect(result.issues[0].severity).toBe("error");
|
|
15
15
|
expect(result.issues[0].message).toContain('Duplicate field name "name"');
|
|
16
16
|
expect(result.issues[0].message).toContain("2 times");
|
|
17
17
|
});
|
|
@@ -21,8 +21,9 @@ describe("validateForm", () => {
|
|
|
21
21
|
group("Business", field.text("name")),
|
|
22
22
|
];
|
|
23
23
|
const result = validateForm(elements);
|
|
24
|
+
expect(result.valid).toBe(false);
|
|
24
25
|
expect(result.issues).toHaveLength(1);
|
|
25
|
-
expect(result.issues[0].severity).toBe("
|
|
26
|
+
expect(result.issues[0].severity).toBe("error");
|
|
26
27
|
expect(result.issues[0].message).toContain('Duplicate field name "name"');
|
|
27
28
|
});
|
|
28
29
|
it("should detect duplicate field names inside conditionals", () => {
|
|
@@ -32,8 +33,9 @@ describe("validateForm", () => {
|
|
|
32
33
|
when(is("type", "a"), field.text("value")),
|
|
33
34
|
];
|
|
34
35
|
const result = validateForm(elements);
|
|
36
|
+
expect(result.valid).toBe(false);
|
|
35
37
|
expect(result.issues).toHaveLength(1);
|
|
36
|
-
expect(result.issues[0].severity).toBe("
|
|
38
|
+
expect(result.issues[0].severity).toBe("error");
|
|
37
39
|
});
|
|
38
40
|
it("should allow same field names inside different array items (separate scope)", () => {
|
|
39
41
|
// Fields inside arrays are in a different scope - this is valid
|
|
@@ -101,15 +103,15 @@ describe("validateForm", () => {
|
|
|
101
103
|
it("should report multiple issues", () => {
|
|
102
104
|
const elements = [
|
|
103
105
|
field.text("name"),
|
|
104
|
-
field.text("name"), // duplicate
|
|
106
|
+
field.text("name"), // duplicate - now an error
|
|
105
107
|
when(is("nonExistent", "value"), // reference error
|
|
106
108
|
field.text("extra")),
|
|
107
109
|
];
|
|
108
110
|
const result = validateForm(elements);
|
|
109
111
|
expect(result.valid).toBe(false);
|
|
110
112
|
expect(result.issues).toHaveLength(2);
|
|
111
|
-
expect(result.issues.filter((i) => i.severity === "warning")).toHaveLength(
|
|
112
|
-
expect(result.issues.filter((i) => i.severity === "error")).toHaveLength(
|
|
113
|
+
expect(result.issues.filter((i) => i.severity === "warning")).toHaveLength(0);
|
|
114
|
+
expect(result.issues.filter((i) => i.severity === "error")).toHaveLength(2);
|
|
113
115
|
});
|
|
114
116
|
});
|
|
115
117
|
});
|
|
@@ -129,9 +131,9 @@ describe("formspecWithValidation", () => {
|
|
|
129
131
|
expect(consoleWarnSpy).not.toHaveBeenCalled();
|
|
130
132
|
expect(consoleErrorSpy).not.toHaveBeenCalled();
|
|
131
133
|
});
|
|
132
|
-
it("should log
|
|
134
|
+
it("should log errors when validate=true with duplicates", () => {
|
|
133
135
|
formspecWithValidation({ validate: true }, field.text("name"), field.text("name"));
|
|
134
|
-
expect(
|
|
136
|
+
expect(consoleErrorSpy).toHaveBeenCalled();
|
|
135
137
|
});
|
|
136
138
|
it("should log errors when validate=true and there are errors", () => {
|
|
137
139
|
formspecWithValidation({ validate: true }, field.text("name"), when(is("nonExistent", "value"), field.text("notes")));
|
|
@@ -139,17 +141,17 @@ describe("formspecWithValidation", () => {
|
|
|
139
141
|
});
|
|
140
142
|
it("should include form name in validation messages", () => {
|
|
141
143
|
formspecWithValidation({ validate: true, name: "TestForm" }, field.text("name"), field.text("name"));
|
|
142
|
-
expect(
|
|
144
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith(expect.stringContaining("TestForm"));
|
|
143
145
|
});
|
|
144
146
|
it("should throw when validate='throw' and there are errors", () => {
|
|
145
147
|
expect(() => formspecWithValidation({ validate: "throw" }, field.text("name"), when(is("nonExistent", "value"), field.text("notes")))).toThrow("Form validation failed");
|
|
146
148
|
});
|
|
147
|
-
it("should
|
|
148
|
-
expect(() => formspecWithValidation({ validate: "throw" }, field.text("name"), field.text("name"))).
|
|
149
|
+
it("should throw when validate='throw' and there are duplicate fields", () => {
|
|
150
|
+
expect(() => formspecWithValidation({ validate: "throw" }, field.text("name"), field.text("name"))).toThrow("Form validation failed");
|
|
149
151
|
});
|
|
150
|
-
it("should
|
|
152
|
+
it("should log errors with validate='warn' for duplicates", () => {
|
|
151
153
|
formspecWithValidation({ validate: "warn" }, field.text("name"), field.text("name"));
|
|
152
|
-
expect(
|
|
154
|
+
expect(consoleErrorSpy).toHaveBeenCalled();
|
|
153
155
|
});
|
|
154
156
|
it("should return correct form structure regardless of validation", () => {
|
|
155
157
|
const form = formspecWithValidation({ validate: true, name: "Test" }, field.text("name"), field.number("age"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.test.js","sourceRoot":"","sources":["../../src/__tests__/validation.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3F,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACzC,EAAE,CAAC,mD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AG;YACf,KAAK,CACH,OAAO,EACP,KAAK,CACH,OAAO,EACP,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,CAAU,CAAC,EACvC,IAAI,CACF,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,EACf,KAAK,CAAC,MAAM,CACV,SAAS,EACT,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAClB,IAAI,CACF,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,iBAAiB;YACzC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CACpB,CACF,CACF,CACF,CACF;SACO,CAAC;QAEX,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEtC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/dsl.d.ts
ADDED
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@formspec/dsl` - DSL functions for defining FormSpec forms
|
|
3
|
+
*
|
|
4
|
+
* This package provides the builder functions for creating form specifications:
|
|
5
|
+
* - `field.*` - Field builders (text, number, boolean, enum, dynamicEnum)
|
|
6
|
+
* - `group()` - Visual grouping
|
|
7
|
+
* - `when()` + `is()` - Conditional visibility
|
|
8
|
+
* - `formspec()` - Top-level form definition
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { formspec, field, group, when, is } from "@formspec/dsl";
|
|
13
|
+
*
|
|
14
|
+
* const InvoiceForm = formspec(
|
|
15
|
+
* group("Customer",
|
|
16
|
+
* field.text("customerName", { label: "Customer Name" }),
|
|
17
|
+
* field.dynamicEnum("country", "fetch_countries", { label: "Country" }),
|
|
18
|
+
* ),
|
|
19
|
+
* group("Invoice Details",
|
|
20
|
+
* field.number("amount", { label: "Amount", min: 0 }),
|
|
21
|
+
* field.enum("status", ["draft", "sent", "paid"] as const),
|
|
22
|
+
* when(is("status", "draft"),
|
|
23
|
+
* field.text("internalNotes", { label: "Internal Notes" }),
|
|
24
|
+
* ),
|
|
25
|
+
* ),
|
|
26
|
+
* );
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* @packageDocumentation
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
import type { AnyField } from '@formspec/core';
|
|
33
|
+
import type { ArrayField } from '@formspec/core';
|
|
34
|
+
import type { BooleanField } from '@formspec/core';
|
|
35
|
+
import type { Conditional } from '@formspec/core';
|
|
36
|
+
import type { DataSourceValueType } from '@formspec/core';
|
|
37
|
+
import type { DynamicEnumField } from '@formspec/core';
|
|
38
|
+
import type { DynamicSchemaField } from '@formspec/core';
|
|
39
|
+
import { EnumOption } from '@formspec/core';
|
|
40
|
+
import { EnumOptionValue } from '@formspec/core';
|
|
41
|
+
import type { EqualsPredicate } from '@formspec/core';
|
|
42
|
+
import type { FormElement } from '@formspec/core';
|
|
43
|
+
import type { FormSpec } from '@formspec/core';
|
|
44
|
+
import type { Group } from '@formspec/core';
|
|
45
|
+
import type { NumberField } from '@formspec/core';
|
|
46
|
+
import type { ObjectField } from '@formspec/core';
|
|
47
|
+
import type { Predicate } from '@formspec/core';
|
|
48
|
+
import type { StaticEnumField } from '@formspec/core';
|
|
49
|
+
import type { TextField } from '@formspec/core';
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Builds a schema type from extracted fields.
|
|
53
|
+
*
|
|
54
|
+
* Maps field names to their inferred value types.
|
|
55
|
+
*/
|
|
56
|
+
export declare type BuildSchema<Fields> = {
|
|
57
|
+
[F in Fields as F extends {
|
|
58
|
+
name: infer N extends string;
|
|
59
|
+
} ? N : never]: F extends AnyField ? InferFieldValue<F> : never;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { EnumOption }
|
|
63
|
+
|
|
64
|
+
export { EnumOptionValue }
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Extracts all fields from a single element (recursively).
|
|
68
|
+
*
|
|
69
|
+
* - Field elements return themselves
|
|
70
|
+
* - Groups extract fields from all child elements
|
|
71
|
+
* - Conditionals extract fields from all child elements
|
|
72
|
+
*/
|
|
73
|
+
export declare type ExtractFields<E> = E extends AnyField ? E : E extends Group<infer Elements> ? ExtractFieldsFromArray<Elements> : E extends Conditional<string, unknown, infer Elements> ? ExtractFieldsFromArray<Elements> : never;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Extracts fields from an array of elements.
|
|
77
|
+
*
|
|
78
|
+
* Recursively processes each element and unions the results.
|
|
79
|
+
*/
|
|
80
|
+
export declare type ExtractFieldsFromArray<Elements> = Elements extends readonly [
|
|
81
|
+
infer First,
|
|
82
|
+
...infer Rest
|
|
83
|
+
] ? ExtractFields<First> | ExtractFieldsFromArray<Rest> : never;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Field builder namespace containing functions to create each field type.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* import { field } from "@formspec/dsl";
|
|
91
|
+
*
|
|
92
|
+
* field.text("name", { label: "Full Name" });
|
|
93
|
+
* field.number("age", { min: 0, max: 150 });
|
|
94
|
+
* field.enum("status", ["draft", "sent", "paid"]);
|
|
95
|
+
* field.dynamicEnum("country", "countries", { label: "Country" });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare const field: {
|
|
99
|
+
/**
|
|
100
|
+
* Creates a text input field.
|
|
101
|
+
*
|
|
102
|
+
* @param name - The field name (used as the schema key)
|
|
103
|
+
* @param config - Optional configuration for label, placeholder, etc.
|
|
104
|
+
* @returns A TextField descriptor
|
|
105
|
+
*/
|
|
106
|
+
text: <const N extends string>(name: N, config?: Omit<TextField<N>, "_type" | "_field" | "name">) => TextField<N>;
|
|
107
|
+
/**
|
|
108
|
+
* Creates a numeric input field.
|
|
109
|
+
*
|
|
110
|
+
* @param name - The field name (used as the schema key)
|
|
111
|
+
* @param config - Optional configuration for label, min, max, etc.
|
|
112
|
+
* @returns A NumberField descriptor
|
|
113
|
+
*/
|
|
114
|
+
number: <const N extends string>(name: N, config?: Omit<NumberField<N>, "_type" | "_field" | "name">) => NumberField<N>;
|
|
115
|
+
/**
|
|
116
|
+
* Creates a boolean checkbox field.
|
|
117
|
+
*
|
|
118
|
+
* @param name - The field name (used as the schema key)
|
|
119
|
+
* @param config - Optional configuration for label, etc.
|
|
120
|
+
* @returns A BooleanField descriptor
|
|
121
|
+
*/
|
|
122
|
+
boolean: <const N extends string>(name: N, config?: Omit<BooleanField<N>, "_type" | "_field" | "name">) => BooleanField<N>;
|
|
123
|
+
/**
|
|
124
|
+
* Creates a field with static enum options (known at compile time).
|
|
125
|
+
*
|
|
126
|
+
* Literal types are automatically inferred - no `as const` needed:
|
|
127
|
+
* ```typescript
|
|
128
|
+
* field.enum("status", ["draft", "sent", "paid"])
|
|
129
|
+
* // Schema type: "draft" | "sent" | "paid"
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* Options can be strings or objects with `id` and `label`:
|
|
133
|
+
* ```typescript
|
|
134
|
+
* field.enum("priority", [
|
|
135
|
+
* { id: "low", label: "Low Priority" },
|
|
136
|
+
* { id: "high", label: "High Priority" },
|
|
137
|
+
* ])
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* **Note:** All options must be of the same type (all strings OR all objects).
|
|
141
|
+
* Mixing strings and objects will throw a runtime error.
|
|
142
|
+
*
|
|
143
|
+
* @param name - The field name (used as the schema key)
|
|
144
|
+
* @param options - Array of allowed string values or {id, label} objects
|
|
145
|
+
* @param config - Optional configuration for label, etc.
|
|
146
|
+
* @returns A StaticEnumField descriptor
|
|
147
|
+
* @throws Error if options array contains mixed types (strings and objects)
|
|
148
|
+
*/
|
|
149
|
+
enum: <const N extends string, const O extends readonly EnumOptionValue[]>(name: N, options: O, config?: Omit<StaticEnumField<N, O>, "_type" | "_field" | "name" | "options">) => StaticEnumField<N, O>;
|
|
150
|
+
/**
|
|
151
|
+
* Creates a field with dynamic enum options (fetched from a data source at runtime).
|
|
152
|
+
*
|
|
153
|
+
* The data source must be registered in DataSourceRegistry via module augmentation:
|
|
154
|
+
* ```typescript
|
|
155
|
+
* declare module "@formspec/core" {
|
|
156
|
+
* interface DataSourceRegistry {
|
|
157
|
+
* countries: { id: string; code: string; name: string };
|
|
158
|
+
* }
|
|
159
|
+
* }
|
|
160
|
+
*
|
|
161
|
+
* field.dynamicEnum("country", "countries", { label: "Country" })
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* @param name - The field name (used as the schema key)
|
|
165
|
+
* @param source - The data source key (must be in DataSourceRegistry)
|
|
166
|
+
* @param config - Optional configuration for label, params, etc.
|
|
167
|
+
* @returns A DynamicEnumField descriptor
|
|
168
|
+
*/
|
|
169
|
+
dynamicEnum: <const N extends string, const Source extends string>(name: N, source: Source, config?: Omit<DynamicEnumField<N, Source>, "_type" | "_field" | "name" | "source">) => DynamicEnumField<N, Source>;
|
|
170
|
+
/**
|
|
171
|
+
* Creates a field that loads its schema dynamically (e.g., from an extension).
|
|
172
|
+
*
|
|
173
|
+
* @param name - The field name (used as the schema key)
|
|
174
|
+
* @param schemaSource - Identifier for the schema source
|
|
175
|
+
* @param config - Optional configuration for label, etc.
|
|
176
|
+
* @returns A DynamicSchemaField descriptor
|
|
177
|
+
*/
|
|
178
|
+
dynamicSchema: <const N extends string>(name: N, schemaSource: string, config?: Omit<DynamicSchemaField<N>, "_type" | "_field" | "name" | "schemaSource">) => DynamicSchemaField<N>;
|
|
179
|
+
/**
|
|
180
|
+
* Creates an array field containing repeating items.
|
|
181
|
+
*
|
|
182
|
+
* Use this for lists of values (e.g., multiple addresses, line items).
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```typescript
|
|
186
|
+
* field.array("addresses",
|
|
187
|
+
* field.text("street", { label: "Street" }),
|
|
188
|
+
* field.text("city", { label: "City" }),
|
|
189
|
+
* field.text("zip", { label: "ZIP Code" }),
|
|
190
|
+
* )
|
|
191
|
+
* ```
|
|
192
|
+
*
|
|
193
|
+
* @param name - The field name (used as the schema key)
|
|
194
|
+
* @param items - The form elements that define each array item
|
|
195
|
+
* @returns An ArrayField descriptor
|
|
196
|
+
*/
|
|
197
|
+
array: <const N extends string, const Items extends readonly FormElement[]>(name: N, ...items: Items) => ArrayField<N, Items>;
|
|
198
|
+
/**
|
|
199
|
+
* Creates an array field with additional configuration options.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* field.arrayWithConfig("lineItems", {
|
|
204
|
+
* label: "Line Items",
|
|
205
|
+
* minItems: 1,
|
|
206
|
+
* maxItems: 10,
|
|
207
|
+
* },
|
|
208
|
+
* field.text("description"),
|
|
209
|
+
* field.number("quantity"),
|
|
210
|
+
* )
|
|
211
|
+
* ```
|
|
212
|
+
*
|
|
213
|
+
* @param name - The field name (used as the schema key)
|
|
214
|
+
* @param config - Configuration for label, minItems, maxItems, etc.
|
|
215
|
+
* @param items - The form elements that define each array item
|
|
216
|
+
* @returns An ArrayField descriptor
|
|
217
|
+
*/
|
|
218
|
+
arrayWithConfig: <const N extends string, const Items extends readonly FormElement[]>(name: N, config: Omit<ArrayField<N, Items>, "_type" | "_field" | "name" | "items">, ...items: Items) => ArrayField<N, Items>;
|
|
219
|
+
/**
|
|
220
|
+
* Creates an object field containing nested properties.
|
|
221
|
+
*
|
|
222
|
+
* Use this for grouping related fields under a single key in the schema.
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* field.object("address",
|
|
227
|
+
* field.text("street", { label: "Street" }),
|
|
228
|
+
* field.text("city", { label: "City" }),
|
|
229
|
+
* field.text("zip", { label: "ZIP Code" }),
|
|
230
|
+
* )
|
|
231
|
+
* ```
|
|
232
|
+
*
|
|
233
|
+
* @param name - The field name (used as the schema key)
|
|
234
|
+
* @param properties - The form elements that define the object's properties
|
|
235
|
+
* @returns An ObjectField descriptor
|
|
236
|
+
*/
|
|
237
|
+
object: <const N extends string, const Properties extends readonly FormElement[]>(name: N, ...properties: Properties) => ObjectField<N, Properties>;
|
|
238
|
+
/**
|
|
239
|
+
* Creates an object field with additional configuration options.
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```typescript
|
|
243
|
+
* field.objectWithConfig("billingAddress", { label: "Billing Address", required: true },
|
|
244
|
+
* field.text("street"),
|
|
245
|
+
* field.text("city"),
|
|
246
|
+
* )
|
|
247
|
+
* ```
|
|
248
|
+
*
|
|
249
|
+
* @param name - The field name (used as the schema key)
|
|
250
|
+
* @param config - Configuration for label, required, etc.
|
|
251
|
+
* @param properties - The form elements that define the object's properties
|
|
252
|
+
* @returns An ObjectField descriptor
|
|
253
|
+
*/
|
|
254
|
+
objectWithConfig: <const N extends string, const Properties extends readonly FormElement[]>(name: N, config: Omit<ObjectField<N, Properties>, "_type" | "_field" | "name" | "properties">, ...properties: Properties) => ObjectField<N, Properties>;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Creates a complete form specification.
|
|
259
|
+
*
|
|
260
|
+
* The structure IS the definition:
|
|
261
|
+
* - Nesting with `group()` defines visual layout
|
|
262
|
+
* - Nesting with `when()` defines conditional visibility
|
|
263
|
+
* - Field type implies control type (text field → text input)
|
|
264
|
+
* - Array position implies field ordering
|
|
265
|
+
*
|
|
266
|
+
* Schema is automatically inferred from all fields in the structure.
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```typescript
|
|
270
|
+
* const InvoiceForm = formspec(
|
|
271
|
+
* group("Customer",
|
|
272
|
+
* field.text("customerName", { label: "Customer Name" }),
|
|
273
|
+
* field.dynamicEnum("country", "fetch_countries", { label: "Country" }),
|
|
274
|
+
* ),
|
|
275
|
+
* group("Invoice Details",
|
|
276
|
+
* field.number("amount", { label: "Amount", min: 0 }),
|
|
277
|
+
* field.enum("status", ["draft", "sent", "paid"] as const),
|
|
278
|
+
* when(is("status", "draft"),
|
|
279
|
+
* field.text("internalNotes", { label: "Internal Notes" }),
|
|
280
|
+
* ),
|
|
281
|
+
* ),
|
|
282
|
+
* );
|
|
283
|
+
* ```
|
|
284
|
+
*
|
|
285
|
+
* @param elements - The top-level form elements
|
|
286
|
+
* @returns A FormSpec descriptor
|
|
287
|
+
*/
|
|
288
|
+
export declare function formspec<const Elements extends readonly FormElement[]>(...elements: Elements): FormSpec<Elements>;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Options for creating a form specification.
|
|
292
|
+
*/
|
|
293
|
+
export declare interface FormSpecOptions {
|
|
294
|
+
/**
|
|
295
|
+
* Whether to validate the form structure.
|
|
296
|
+
* - `true` or `"warn"`: Validate and log warnings/errors to console
|
|
297
|
+
* - `"throw"`: Validate and throw an error if validation fails
|
|
298
|
+
* - `false`: Skip validation (default in production for performance)
|
|
299
|
+
*
|
|
300
|
+
* @defaultValue false
|
|
301
|
+
*/
|
|
302
|
+
validate?: boolean | "warn" | "throw";
|
|
303
|
+
/**
|
|
304
|
+
* Optional name for the form (used in validation messages).
|
|
305
|
+
*/
|
|
306
|
+
name?: string;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Creates a complete form specification with validation options.
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```typescript
|
|
314
|
+
* const form = formspecWithValidation(
|
|
315
|
+
* { validate: true, name: "MyForm" },
|
|
316
|
+
* field.text("name"),
|
|
317
|
+
* field.enum("status", ["draft", "sent"] as const),
|
|
318
|
+
* when(is("status", "draft"),
|
|
319
|
+
* field.text("notes"),
|
|
320
|
+
* ),
|
|
321
|
+
* );
|
|
322
|
+
* ```
|
|
323
|
+
*
|
|
324
|
+
* @param options - Validation options
|
|
325
|
+
* @param elements - The top-level form elements
|
|
326
|
+
* @returns A FormSpec descriptor
|
|
327
|
+
*/
|
|
328
|
+
export declare function formspecWithValidation<const Elements extends readonly FormElement[]>(options: FormSpecOptions, ...elements: Elements): FormSpec<Elements>;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Creates a visual group of form elements.
|
|
332
|
+
*
|
|
333
|
+
* Groups provide visual organization and can be rendered as fieldsets or sections.
|
|
334
|
+
* The nesting of groups defines the visual hierarchy of the form.
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* ```typescript
|
|
338
|
+
* group("Customer Information",
|
|
339
|
+
* field.text("name", { label: "Name" }),
|
|
340
|
+
* field.text("email", { label: "Email" }),
|
|
341
|
+
* )
|
|
342
|
+
* ```
|
|
343
|
+
*
|
|
344
|
+
* @param label - The group's display label
|
|
345
|
+
* @param elements - The form elements contained in this group
|
|
346
|
+
* @returns A Group descriptor
|
|
347
|
+
*/
|
|
348
|
+
export declare function group<const Elements extends readonly FormElement[]>(label: string, ...elements: Elements): Group<Elements>;
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Infers the value type from a single field.
|
|
352
|
+
*
|
|
353
|
+
* - TextField returns string
|
|
354
|
+
* - NumberField returns number
|
|
355
|
+
* - BooleanField returns boolean
|
|
356
|
+
* - StaticEnumField returns union of option literals
|
|
357
|
+
* - DynamicEnumField returns DataSourceValueType (usually string)
|
|
358
|
+
* - DynamicSchemaField returns Record of string to unknown
|
|
359
|
+
* - ArrayField returns array of inferred item schema
|
|
360
|
+
* - ObjectField returns object of inferred property schema
|
|
361
|
+
*
|
|
362
|
+
* @example
|
|
363
|
+
* ```typescript
|
|
364
|
+
* // Simple fields
|
|
365
|
+
* type T1 = InferFieldValue<TextField<"name">>; // string
|
|
366
|
+
* type T2 = InferFieldValue<NumberField<"age">>; // number
|
|
367
|
+
*
|
|
368
|
+
* // Enum fields
|
|
369
|
+
* type T3 = InferFieldValue<StaticEnumField<"status", ["draft", "sent"]>>; // "draft" | "sent"
|
|
370
|
+
*
|
|
371
|
+
* // Nested fields
|
|
372
|
+
* type T4 = InferFieldValue<ArrayField<"items", [TextField<"name">]>>; // { name: string }[]
|
|
373
|
+
* type T5 = InferFieldValue<ObjectField<"address", [TextField<"city">]>>; // { city: string }
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
export declare type InferFieldValue<F> = F extends TextField<string> ? string : F extends NumberField<string> ? number : F extends BooleanField<string> ? boolean : F extends StaticEnumField<string, infer O extends readonly EnumOptionValue[]> ? O extends readonly EnumOption[] ? O[number]["id"] : O extends readonly string[] ? O[number] : never : F extends DynamicEnumField<string, infer Source> ? DataSourceValueType<Source> : F extends DynamicSchemaField<string> ? Record<string, unknown> : F extends ArrayField<string, infer Items extends readonly FormElement[]> ? InferSchema<Items>[] : F extends ObjectField<string, infer Properties extends readonly FormElement[]> ? InferSchema<Properties> : never;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* Infers the schema type from a FormSpec.
|
|
380
|
+
*
|
|
381
|
+
* Convenience type that extracts elements and infers the schema.
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* ```typescript
|
|
385
|
+
* const form = formspec(...);
|
|
386
|
+
* type Schema = InferFormSchema<typeof form>;
|
|
387
|
+
* ```
|
|
388
|
+
*/
|
|
389
|
+
export declare type InferFormSchema<F extends FormSpec<readonly FormElement[]>> = F extends FormSpec<infer Elements> ? InferSchema<Elements> : never;
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Infers the complete schema type from a form's elements.
|
|
393
|
+
*
|
|
394
|
+
* This is the main inference type that converts a form structure
|
|
395
|
+
* into its corresponding TypeScript schema type.
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* ```typescript
|
|
399
|
+
* const form = formspec(
|
|
400
|
+
* field.text("name"),
|
|
401
|
+
* field.number("age"),
|
|
402
|
+
* field.enum("status", ["active", "inactive"] as const),
|
|
403
|
+
* );
|
|
404
|
+
*
|
|
405
|
+
* type Schema = InferSchema<typeof form.elements>;
|
|
406
|
+
* // { name: string; age: number; status: "active" | "inactive" }
|
|
407
|
+
* ```
|
|
408
|
+
*/
|
|
409
|
+
export declare type InferSchema<Elements extends readonly FormElement[]> = BuildSchema<ExtractFieldsFromArray<Elements>>;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Creates an equality predicate that checks if a field equals a specific value.
|
|
413
|
+
*
|
|
414
|
+
* Use this with `when()` to create readable conditional expressions:
|
|
415
|
+
*
|
|
416
|
+
* @example
|
|
417
|
+
* ```typescript
|
|
418
|
+
* // Show cardNumber field when paymentMethod is "card"
|
|
419
|
+
* when(is("paymentMethod", "card"),
|
|
420
|
+
* field.text("cardNumber", { label: "Card Number" }),
|
|
421
|
+
* )
|
|
422
|
+
* ```
|
|
423
|
+
*
|
|
424
|
+
* @typeParam K - The field name (inferred as string literal)
|
|
425
|
+
* @typeParam V - The value type (inferred as literal)
|
|
426
|
+
* @param field - The name of the field to check
|
|
427
|
+
* @param value - The value the field must equal
|
|
428
|
+
* @returns An EqualsPredicate for use with `when()`
|
|
429
|
+
* @public
|
|
430
|
+
*/
|
|
431
|
+
export declare function is<const K extends string, const V>(field: K, value: V): EqualsPredicate<K, V>;
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Logs validation issues to the console.
|
|
435
|
+
*
|
|
436
|
+
* @param result - The validation result to log
|
|
437
|
+
* @param formName - Optional name for the form (for better error messages)
|
|
438
|
+
*/
|
|
439
|
+
export declare function logValidationIssues(result: ValidationResult, formName?: string): void;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Validates a form specification for common issues.
|
|
443
|
+
*
|
|
444
|
+
* Checks for:
|
|
445
|
+
* - Duplicate field names at the root level (warning)
|
|
446
|
+
* - References to non-existent fields in conditionals (error)
|
|
447
|
+
*
|
|
448
|
+
* @example
|
|
449
|
+
* ```typescript
|
|
450
|
+
* const form = formspec(
|
|
451
|
+
* field.text("name"),
|
|
452
|
+
* field.text("name"), // Duplicate!
|
|
453
|
+
* when("nonExistent", "value", // Reference to non-existent field!
|
|
454
|
+
* field.text("extra"),
|
|
455
|
+
* ),
|
|
456
|
+
* );
|
|
457
|
+
*
|
|
458
|
+
* const result = validateForm(form.elements);
|
|
459
|
+
* // result.valid === false
|
|
460
|
+
* // result.issues contains duplicate and reference errors
|
|
461
|
+
* ```
|
|
462
|
+
*
|
|
463
|
+
* @param elements - The form elements to validate
|
|
464
|
+
* @returns Validation result with any issues found
|
|
465
|
+
*/
|
|
466
|
+
export declare function validateForm(elements: readonly FormElement[]): ValidationResult;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* A validation issue found in a form specification.
|
|
470
|
+
*/
|
|
471
|
+
export declare interface ValidationIssue {
|
|
472
|
+
/** Severity of the issue */
|
|
473
|
+
severity: ValidationSeverity;
|
|
474
|
+
/** Human-readable message describing the issue */
|
|
475
|
+
message: string;
|
|
476
|
+
/** Path to the element with the issue (e.g., "group.fieldName") */
|
|
477
|
+
path: string;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Result of validating a form specification.
|
|
482
|
+
*/
|
|
483
|
+
export declare interface ValidationResult {
|
|
484
|
+
/** Whether the form is valid (no errors, warnings are ok) */
|
|
485
|
+
valid: boolean;
|
|
486
|
+
/** List of validation issues found */
|
|
487
|
+
issues: ValidationIssue[];
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Validation issue severity levels.
|
|
492
|
+
*/
|
|
493
|
+
export declare type ValidationSeverity = "error" | "warning";
|
|
494
|
+
|
|
495
|
+
/**
|
|
496
|
+
* Creates a conditional wrapper that shows elements based on a predicate.
|
|
497
|
+
*
|
|
498
|
+
* When the predicate evaluates to true, the contained elements are shown.
|
|
499
|
+
* Otherwise, they are hidden (but still part of the schema).
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* ```typescript
|
|
503
|
+
* import { is } from "@formspec/dsl";
|
|
504
|
+
*
|
|
505
|
+
* field.enum("status", ["draft", "sent", "paid"] as const),
|
|
506
|
+
* when(is("status", "draft"),
|
|
507
|
+
* field.text("internalNotes", { label: "Internal Notes" }),
|
|
508
|
+
* )
|
|
509
|
+
* ```
|
|
510
|
+
*
|
|
511
|
+
* @param predicate - The condition to evaluate (use `is()` to create)
|
|
512
|
+
* @param elements - The form elements to show when condition is met
|
|
513
|
+
* @returns A Conditional descriptor
|
|
514
|
+
*/
|
|
515
|
+
export declare function when<const K extends string, const V, const Elements extends readonly FormElement[]>(predicate: Predicate<K, V>, ...elements: Elements): Conditional<K, V, Elements>;
|
|
516
|
+
|
|
517
|
+
export { }
|
package/dist/field.d.ts
CHANGED
|
@@ -52,10 +52,22 @@ export declare const field: {
|
|
|
52
52
|
* // Schema type: "draft" | "sent" | "paid"
|
|
53
53
|
* ```
|
|
54
54
|
*
|
|
55
|
+
* Options can be strings or objects with `id` and `label`:
|
|
56
|
+
* ```typescript
|
|
57
|
+
* field.enum("priority", [
|
|
58
|
+
* { id: "low", label: "Low Priority" },
|
|
59
|
+
* { id: "high", label: "High Priority" },
|
|
60
|
+
* ])
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* **Note:** All options must be of the same type (all strings OR all objects).
|
|
64
|
+
* Mixing strings and objects will throw a runtime error.
|
|
65
|
+
*
|
|
55
66
|
* @param name - The field name (used as the schema key)
|
|
56
|
-
* @param options - Array of allowed string values
|
|
67
|
+
* @param options - Array of allowed string values or {id, label} objects
|
|
57
68
|
* @param config - Optional configuration for label, etc.
|
|
58
69
|
* @returns A StaticEnumField descriptor
|
|
70
|
+
* @throws Error if options array contains mixed types (strings and objects)
|
|
59
71
|
*/
|
|
60
72
|
enum: <const N extends string, const O extends readonly EnumOptionValue[]>(name: N, options: O, config?: Omit<StaticEnumField<N, O>, "_type" | "_field" | "name" | "options">) => StaticEnumField<N, O>;
|
|
61
73
|
/**
|
package/dist/field.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../src/field.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK;IAChB;;;;;;OAMG;iBACU,CAAC,SAAS,MAAM,QACrB,CAAC,WACE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC,KACvD,SAAS,CAAC,CAAC,CAAC;IAOf;;;;;;OAMG;mBACY,CAAC,SAAS,MAAM,QACvB,CAAC,WACE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC,KACzD,WAAW,CAAC,CAAC,CAAC;IAOjB;;;;;;OAMG;oBACa,CAAC,SAAS,MAAM,QACxB,CAAC,WACE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC,KAC1D,YAAY,CAAC,CAAC,CAAC;IAOlB
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../src/field.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;;;;GAYG;AACH,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Ac,CAAC,KACjF,kBAAkB,CAAC,CAAC,CAAC;IAQxB;;;;;;;;;;;;;;;;;OAiBG;kBACW,CAAC,SAAS,MAAM,QAAQ,KAAK,SAAS,SAAS,WAAW,EAAE,QAClE,CAAC,YACG,KAAK,KACd,UAAU,CAAC,CAAC,EAAE,KAAK,CAAC;IAOvB;;;;;;;;;;;;;;;;;;;OAmBG;4BACqB,CAAC,SAAS,MAAM,QAAQ,KAAK,SAAS,SAAS,WAAW,EAAE,QAC5E,CAAC,UACC,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC,YAC/D,KAAK,KACd,UAAU,CAAC,CAAC,EAAE,KAAK,CAAC;IAQvB;;;;;;;;;;;;;;;;;OAiBG;mBACY,CAAC,SAAS,MAAM,QAAQ,UAAU,SAAS,SAAS,WAAW,EAAE,QACxE,CAAC,iBACQ,UAAU,KACxB,WAAW,CAAC,CAAC,EAAE,UAAU,CAAC;IAO7B;;;;;;;;;;;;;;;OAeG;6BACsB,CAAC,SAAS,MAAM,QAAQ,UAAU,SAAS,SAAS,WAAW,EAAE,QAClF,CAAC,UACC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,YAAY,CAAC,iBACrE,UAAU,KACxB,WAAW,CAAC,CAAC,EAAE,UAAU,CAAC;CAO9B,CAAC"}
|
package/dist/field.js
CHANGED
|
@@ -66,18 +66,54 @@ export const field = {
|
|
|
66
66
|
* // Schema type: "draft" | "sent" | "paid"
|
|
67
67
|
* ```
|
|
68
68
|
*
|
|
69
|
+
* Options can be strings or objects with `id` and `label`:
|
|
70
|
+
* ```typescript
|
|
71
|
+
* field.enum("priority", [
|
|
72
|
+
* { id: "low", label: "Low Priority" },
|
|
73
|
+
* { id: "high", label: "High Priority" },
|
|
74
|
+
* ])
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* **Note:** All options must be of the same type (all strings OR all objects).
|
|
78
|
+
* Mixing strings and objects will throw a runtime error.
|
|
79
|
+
*
|
|
69
80
|
* @param name - The field name (used as the schema key)
|
|
70
|
-
* @param options - Array of allowed string values
|
|
81
|
+
* @param options - Array of allowed string values or {id, label} objects
|
|
71
82
|
* @param config - Optional configuration for label, etc.
|
|
72
83
|
* @returns A StaticEnumField descriptor
|
|
84
|
+
* @throws Error if options array contains mixed types (strings and objects)
|
|
73
85
|
*/
|
|
74
|
-
enum: (name, options, config) =>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
enum: (name, options, config) => {
|
|
87
|
+
// Validate that all options are of the same type (all strings or all objects)
|
|
88
|
+
if (options.length > 0) {
|
|
89
|
+
const firstIsObject = typeof options[0] === "object" && options[0] !== null;
|
|
90
|
+
const allSameType = options.every((opt) => {
|
|
91
|
+
const isObject = typeof opt === "object" && opt !== null;
|
|
92
|
+
return isObject === firstIsObject;
|
|
93
|
+
});
|
|
94
|
+
if (!allSameType) {
|
|
95
|
+
throw new Error(`field.enum("${name}"): options must be all strings or all objects with {id, label}, not mixed. ` +
|
|
96
|
+
`Received mixed types in options array.`);
|
|
97
|
+
}
|
|
98
|
+
// Validate object options have required properties
|
|
99
|
+
if (firstIsObject) {
|
|
100
|
+
for (const opt of options) {
|
|
101
|
+
const obj = opt;
|
|
102
|
+
if (typeof obj.id !== "string" || typeof obj.label !== "string") {
|
|
103
|
+
throw new Error(`field.enum("${name}"): object options must have string "id" and "label" properties. ` +
|
|
104
|
+
`Received: ${JSON.stringify(opt)}`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
_type: "field",
|
|
111
|
+
_field: "enum",
|
|
112
|
+
name,
|
|
113
|
+
options,
|
|
114
|
+
...config,
|
|
115
|
+
};
|
|
116
|
+
},
|
|
81
117
|
/**
|
|
82
118
|
* Creates a field with dynamic enum options (fetched from a data source at runtime).
|
|
83
119
|
*
|
package/dist/field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.js","sourceRoot":"","sources":["../src/field.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB;;;;;;OAMG;IACH,IAAI,EAAE,CACJ,IAAO,EACP,MAAwD,EAC1C,EAAE,CAAC,CAAC;QAClB,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,MAAM;QACd,IAAI;QACJ,GAAG,MAAM;KACV,CAAC;IAEF;;;;;;OAMG;IACH,MAAM,EAAE,CACN,IAAO,EACP,MAA0D,EAC1C,EAAE,CAAC,CAAC;QACpB,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,QAAQ;QAChB,IAAI;QACJ,GAAG,MAAM;KACV,CAAC;IAEF;;;;;;OAMG;IACH,OAAO,EAAE,CACP,IAAO,EACP,MAA2D,EAC1C,EAAE,CAAC,CAAC;QACrB,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,SAAS;QACjB,IAAI;QACJ,GAAG,MAAM;KACV,CAAC;IAEF
|
|
1
|
+
{"version":3,"file":"field.js","sourceRoot":"","sources":["../src/field.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB;;;;;;OAMG;IACH,IAAI,EAAE,CACJ,IAAO,EACP,MAAwD,EAC1C,EAAE,CAAC,CAAC;QAClB,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,MAAM;QACd,IAAI;QACJ,GAAG,MAAM;KACV,CAAC;IAEF;;;;;;OAMG;IACH,MAAM,EAAE,CACN,IAAO,EACP,MAA0D,EAC1C,EAAE,CAAC,CAAC;QACpB,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,QAAQ;QA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AC;QAChC,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,QAAQ;QAChB,IAAI;QACJ,UAAU;QACV,GAAG,MAAM;KACV,CAAC;CACH,CAAC"}
|
package/dist/predicate.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ import type { EqualsPredicate } from "@formspec/core";
|
|
|
30
30
|
* @param field - The name of the field to check
|
|
31
31
|
* @param value - The value the field must equal
|
|
32
32
|
* @returns An EqualsPredicate for use with `when()`
|
|
33
|
+
* @public
|
|
33
34
|
*/
|
|
34
35
|
export declare function is<const K extends string, const V>(field: K, value: V): EqualsPredicate<K, V>;
|
|
35
36
|
//# sourceMappingURL=predicate.d.ts.map
|
package/dist/predicate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../src/predicate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../src/predicate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,EAAE,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,CAAC,CAAC,EAChD,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,CAAC,GACP,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAMvB"}
|
package/dist/predicate.js
CHANGED
package/dist/predicate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predicate.js","sourceRoot":"","sources":["../src/predicate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH
|
|
1
|
+
{"version":3,"file":"predicate.js","sourceRoot":"","sources":["../src/predicate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,EAAE,CAChB,KAAQ,EACR,KAAQ;IAER,OAAO;QACL,UAAU,EAAE,QAAQ;QACpB,KAAK;QACL,KAAK;KACN,CAAC;AACJ,CAAC"}
|
package/dist/validation.js
CHANGED
|
@@ -134,11 +134,11 @@ export function validateForm(elements) {
|
|
|
134
134
|
const issues = [];
|
|
135
135
|
// Collect all field names
|
|
136
136
|
const fieldNames = collectFieldNames(elements);
|
|
137
|
-
// Check for duplicates at root level
|
|
137
|
+
// Check for duplicates at root level - duplicates are errors because they cause data loss
|
|
138
138
|
for (const [name, info] of fieldNames) {
|
|
139
139
|
if (info.count > 1 && info.paths[0] !== undefined) {
|
|
140
140
|
issues.push({
|
|
141
|
-
severity: "
|
|
141
|
+
severity: "error",
|
|
142
142
|
message: `Duplicate field name "${name}" found ${info.count} times at: ${info.paths.join(", ")}`,
|
|
143
143
|
path: info.paths[0],
|
|
144
144
|
});
|
package/dist/validation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsCH;;;GAGG;AACH,SAAS,iBAAiB,CACxB,QAAgC,EAChC,OAAe,EAAE;IAEjB,MAAM,UAAU,GAAG,IAAI,GAAG,EAA8C,CAAC;IAEzE,SAAS,KAAK,CAAC,QAAgC,EAAE,WAAmB;QAClE,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,QAAQ,OAAO,CAAC,KAAK,EAAE,CAAC;gBACtB,KAAK,OAAO,CAAC,CAAC,CAAC;oBACb,MAAM,KAAK,GAAG,OAAmB,CAAC;oBAClC,MAAM,SAAS,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IA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M,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,aAAa,QAAQ,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC;IAEhE,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClC,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,MAAM,OAAO,GAAG,GAAG,MAAM,KAAK,KAAK,CAAC,OAAO,GAAG,QAAQ,EAAE,CAAC;QAEzD,IAAI,KAAK,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YAC/B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formspec/dsl",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.5",
|
|
4
4
|
"description": "DSL functions for defining FormSpec forms",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
-
"dist"
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
16
17
|
],
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@formspec/core": "0.1.0-alpha.
|
|
19
|
+
"@formspec/core": "0.1.0-alpha.4"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
22
|
"tsd": "^0.31.0",
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"keywords": [],
|
|
31
32
|
"license": "UNLICENSED",
|
|
32
33
|
"scripts": {
|
|
33
|
-
"build": "tsc",
|
|
34
|
+
"build": "tsc && api-extractor run --local",
|
|
34
35
|
"clean": "rm -rf dist temp",
|
|
35
36
|
"typecheck": "tsc --noEmit",
|
|
36
37
|
"test": "vitest run",
|