@formspec/constraints 0.1.0-alpha.19 → 0.1.0-alpha.23

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.
@@ -1,10 +1,14 @@
1
1
  import type { FieldOptionConstraints, Severity, ValidationIssue } from "../types.js";
2
2
  /**
3
3
  * Known field options that can be validated.
4
+ *
5
+ * @beta
4
6
  */
5
7
  export type FieldOption = "label" | "placeholder" | "required" | "minValue" | "maxValue" | "minItems" | "maxItems";
6
8
  /**
7
9
  * Context for field option validation.
10
+ *
11
+ * @beta
8
12
  */
9
13
  export interface FieldOptionsContext {
10
14
  /** The field name */
@@ -20,6 +24,8 @@ export interface FieldOptionsContext {
20
24
  * @param context - Information about the field and its options
21
25
  * @param constraints - Field option constraints
22
26
  * @returns Array of validation issues (empty if valid)
27
+ *
28
+ * @beta
23
29
  */
24
30
  export declare function validateFieldOptions(context: FieldOptionsContext, constraints: FieldOptionConstraints): ValidationIssue[];
25
31
  /**
@@ -28,6 +34,8 @@ export declare function validateFieldOptions(context: FieldOptionsContext, const
28
34
  *
29
35
  * @param field - A field object with potential options
30
36
  * @returns Array of present option names
37
+ *
38
+ * @beta
31
39
  */
32
40
  export declare function extractFieldOptions(field: Record<string, unknown>): FieldOption[];
33
41
  /**
@@ -36,6 +44,8 @@ export declare function extractFieldOptions(field: Record<string, unknown>): Fie
36
44
  * @param option - The option to check
37
45
  * @param constraints - Field option constraints
38
46
  * @returns true if allowed, false if disallowed
47
+ *
48
+ * @beta
39
49
  */
40
50
  export declare function isFieldOptionAllowed(option: FieldOption, constraints: FieldOptionConstraints): boolean;
41
51
  /**
@@ -44,6 +54,8 @@ export declare function isFieldOptionAllowed(option: FieldOption, constraints: F
44
54
  * @param option - The option to check
45
55
  * @param constraints - Field option constraints
46
56
  * @returns Severity level, or "off" if not constrained
57
+ *
58
+ * @beta
47
59
  */
48
60
  export declare function getFieldOptionSeverity(option: FieldOption, constraints: FieldOptionConstraints): Severity;
49
61
  //# sourceMappingURL=field-options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"field-options.d.ts","sourceRoot":"","sources":["../../src/validators/field-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAErF;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,OAAO,GACP,aAAa,GACb,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,CAAC;AAEf;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,cAAc,EAAE,WAAW,EAAE,CAAC;IAC9B,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,mBAAmB,EAC5B,WAAW,EAAE,sBAAsB,GAClC,eAAe,EAAE,CAWnB;AAqBD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,EAAE,CAajF;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,WAAW,EACnB,WAAW,EAAE,sBAAsB,GAClC,OAAO,CAGT;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,WAAW,EACnB,WAAW,EAAE,sBAAsB,GAClC,QAAQ,CAEV"}
1
+ {"version":3,"file":"field-options.d.ts","sourceRoot":"","sources":["../../src/validators/field-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAErF;;;;GAIG;AACH,MAAM,MAAM,WAAW,GACnB,OAAO,GACP,aAAa,GACb,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,CAAC;AAEf;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,cAAc,EAAE,WAAW,EAAE,CAAC;IAC9B,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,mBAAmB,EAC5B,WAAW,EAAE,sBAAsB,GAClC,eAAe,EAAE,CAWnB;AAqBD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,WAAW,EAAE,CAajF;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,WAAW,EACnB,WAAW,EAAE,sBAAsB,GAClC,OAAO,CAGT;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,WAAW,EACnB,WAAW,EAAE,sBAAsB,GAClC,QAAQ,CAEV"}
@@ -1,6 +1,8 @@
1
1
  import type { FieldTypeConstraints, Severity, ValidationIssue } from "../types.js";
2
2
  /**
3
3
  * Context for field type validation.
4
+ *
5
+ * @beta
4
6
  */
5
7
  export interface FieldTypeContext {
6
8
  /** The _field discriminator value (e.g., "text", "number", "enum") */
@@ -16,6 +18,8 @@ export interface FieldTypeContext {
16
18
  * @param context - Information about the field being validated
17
19
  * @param constraints - Field type constraints
18
20
  * @returns Array of validation issues (empty if valid)
21
+ *
22
+ * @beta
19
23
  */
20
24
  export declare function validateFieldTypes(context: FieldTypeContext, constraints: FieldTypeConstraints): ValidationIssue[];
21
25
  /**
@@ -25,6 +29,8 @@ export declare function validateFieldTypes(context: FieldTypeContext, constraint
25
29
  * @param fieldType - The _field discriminator value
26
30
  * @param constraints - Field type constraints
27
31
  * @returns true if allowed, false if disallowed
32
+ *
33
+ * @beta
28
34
  */
29
35
  export declare function isFieldTypeAllowed(fieldType: string, constraints: FieldTypeConstraints): boolean;
30
36
  /**
@@ -33,6 +39,8 @@ export declare function isFieldTypeAllowed(fieldType: string, constraints: Field
33
39
  * @param fieldType - The _field discriminator value
34
40
  * @param constraints - Field type constraints
35
41
  * @returns Severity level, or "off" if not constrained
42
+ *
43
+ * @beta
36
44
  */
37
45
  export declare function getFieldTypeSeverity(fieldType: string, constraints: FieldTypeConstraints): Severity;
38
46
  //# sourceMappingURL=field-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"field-types.d.ts","sourceRoot":"","sources":["../../src/validators/field-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA8BnF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,gBAAgB,EACzB,WAAW,EAAE,oBAAoB,GAChC,eAAe,EAAE,CAgBnB;AAsBD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,oBAAoB,GAAG,OAAO,CAQhG;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,oBAAoB,GAChC,QAAQ,CAOV"}
1
+ {"version":3,"file":"field-types.d.ts","sourceRoot":"","sources":["../../src/validators/field-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA8BnF;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,gBAAgB,EACzB,WAAW,EAAE,oBAAoB,GAChC,eAAe,EAAE,CAgBnB;AAsBD;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,oBAAoB,GAAG,OAAO,CAQhG;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,oBAAoB,GAChC,QAAQ,CAOV"}
@@ -2,6 +2,8 @@ import type { FormElement, FormSpec } from "@formspec/core";
2
2
  import type { ConstraintConfig, ValidationResult } from "../types.js";
3
3
  /**
4
4
  * Options for validating FormSpec elements.
5
+ *
6
+ * @public
5
7
  */
6
8
  export interface FormSpecValidationOptions {
7
9
  /** Constraint configuration (will be merged with defaults) */
@@ -41,6 +43,8 @@ export interface FormSpecValidationOptions {
41
43
  * console.error('Validation failed:', result.issues);
42
44
  * }
43
45
  * ```
46
+ *
47
+ * @public
44
48
  */
45
49
  export declare function validateFormSpecElements(elements: readonly FormElement[], options?: FormSpecValidationOptions): ValidationResult;
46
50
  /**
@@ -49,6 +53,8 @@ export declare function validateFormSpecElements(elements: readonly FormElement[
49
53
  * @param formSpec - The FormSpec to validate
50
54
  * @param options - Validation options including constraints
51
55
  * @returns Validation result with all issues found
56
+ *
57
+ * @public
52
58
  */
53
59
  export declare function validateFormSpec(formSpec: FormSpec<readonly FormElement[]>, options?: FormSpecValidationOptions): ValidationResult;
54
60
  //# sourceMappingURL=formspec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"formspec.d.ts","sourceRoot":"","sources":["../../src/validators/formspec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAY,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EACV,gBAAgB,EAGhB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAMrB;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,8DAA8D;IAC9D,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,SAAS,WAAW,EAAE,EAChC,OAAO,GAAE,yBAA8B,GACtC,gBAAgB,CAWlB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,CAAC,SAAS,WAAW,EAAE,CAAC,EAC1C,OAAO,GAAE,yBAA8B,GACtC,gBAAgB,CAElB"}
1
+ {"version":3,"file":"formspec.d.ts","sourceRoot":"","sources":["../../src/validators/formspec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAY,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,EACV,gBAAgB,EAGhB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAMrB;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,8DAA8D;IAC9D,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,SAAS,WAAW,EAAE,EAChC,OAAO,GAAE,yBAA8B,GACtC,gBAAgB,CAWlB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,CAAC,SAAS,WAAW,EAAE,CAAC,EAC1C,OAAO,GAAE,yBAA8B,GACtC,gBAAgB,CAElB"}
@@ -1,6 +1,8 @@
1
1
  import type { LayoutConstraints, ValidationIssue } from "../types.js";
2
2
  /**
3
3
  * Context for layout validation.
4
+ *
5
+ * @beta
4
6
  */
5
7
  export interface LayoutContext {
6
8
  /** The type of layout element ("group" | "conditional") */
@@ -18,6 +20,8 @@ export interface LayoutContext {
18
20
  * @param context - Information about the layout element
19
21
  * @param constraints - Layout constraints
20
22
  * @returns Array of validation issues (empty if valid)
23
+ *
24
+ * @beta
21
25
  */
22
26
  export declare function validateLayout(context: LayoutContext, constraints: LayoutConstraints): ValidationIssue[];
23
27
  /**
@@ -26,6 +30,8 @@ export declare function validateLayout(context: LayoutContext, constraints: Layo
26
30
  * @param layoutType - The type of layout element
27
31
  * @param constraints - Layout constraints
28
32
  * @returns true if allowed, false if disallowed
33
+ *
34
+ * @beta
29
35
  */
30
36
  export declare function isLayoutTypeAllowed(layoutType: "group" | "conditional", constraints: LayoutConstraints): boolean;
31
37
  /**
@@ -34,6 +40,8 @@ export declare function isLayoutTypeAllowed(layoutType: "group" | "conditional",
34
40
  * @param depth - Current nesting depth
35
41
  * @param constraints - Layout constraints
36
42
  * @returns true if allowed, false if exceeds limit
43
+ *
44
+ * @beta
37
45
  */
38
46
  export declare function isNestingDepthAllowed(depth: number, constraints: LayoutConstraints): boolean;
39
47
  //# sourceMappingURL=layout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/validators/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAY,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,2DAA2D;IAC3D,UAAU,EAAE,OAAO,GAAG,aAAa,CAAC;IACpC,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,aAAa,EACtB,WAAW,EAAE,iBAAiB,GAC7B,eAAe,EAAE,CA0BnB;AAmDD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,OAAO,GAAG,aAAa,EACnC,WAAW,EAAE,iBAAiB,GAC7B,OAAO,CAST;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAM5F"}
1
+ {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/validators/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAY,eAAe,EAAE,MAAM,aAAa,CAAC;AAEhF;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,2DAA2D;IAC3D,UAAU,EAAE,OAAO,GAAG,aAAa,CAAC;IACpC,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,aAAa,EACtB,WAAW,EAAE,iBAAiB,GAC7B,eAAe,EAAE,CA0BnB;AAmDD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,OAAO,GAAG,aAAa,EACnC,WAAW,EAAE,iBAAiB,GAC7B,OAAO,CAST;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAM5F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formspec/constraints",
3
- "version": "0.1.0-alpha.19",
3
+ "version": "0.1.0-alpha.23",
4
4
  "description": "Constraint validation for FormSpec - restrict features based on target environment capabilities",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -26,12 +26,12 @@
26
26
  ],
27
27
  "dependencies": {
28
28
  "yaml": "^2.7.0",
29
- "@formspec/core": "0.1.0-alpha.19"
29
+ "@formspec/core": "0.1.0-alpha.23"
30
30
  },
31
31
  "devDependencies": {
32
32
  "tsd": "^0.31.0",
33
33
  "vitest": "^3.0.0",
34
- "@formspec/dsl": "0.1.0-alpha.19"
34
+ "@formspec/dsl": "0.1.0-alpha.23"
35
35
  },
36
36
  "tsd": {
37
37
  "directory": "src/__tests__"
@@ -48,13 +48,13 @@
48
48
  ],
49
49
  "license": "UNLICENSED",
50
50
  "scripts": {
51
- "build": "tsup && tsc --emitDeclarationOnly && api-extractor run --local",
51
+ "build": "tsup && tsc --emitDeclarationOnly && pnpm run api-extractor:local",
52
52
  "clean": "rm -rf dist temp",
53
53
  "typecheck": "tsc --noEmit",
54
54
  "test": "vitest run",
55
55
  "test:types": "tsd",
56
- "api-extractor": "api-extractor run",
57
- "api-extractor:local": "api-extractor run --local",
58
- "api-documenter": "api-documenter markdown -i temp -o docs"
56
+ "api-extractor": "api-extractor run && node ../../scripts/normalize-generated-markdown.mjs api-report",
57
+ "api-extractor:local": "api-extractor run --local && node ../../scripts/normalize-generated-markdown.mjs api-report",
58
+ "api-documenter": "api-documenter markdown -i temp -o docs && node ../../scripts/normalize-generated-markdown.mjs docs"
59
59
  }
60
60
  }