@formspec/build 0.1.0-alpha.10 → 0.1.0-alpha.12
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 +51 -15
- package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts +2 -0
- package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts.map +1 -0
- package/dist/__tests__/constraint-validator.test.d.ts +2 -0
- package/dist/__tests__/constraint-validator.test.d.ts.map +1 -0
- package/dist/__tests__/extension-api.test.d.ts +2 -0
- package/dist/__tests__/extension-api.test.d.ts.map +1 -0
- package/dist/__tests__/fixtures/example-a-builtins.d.ts +18 -0
- package/dist/__tests__/fixtures/example-a-builtins.d.ts.map +1 -1
- package/dist/__tests__/ir-analyzer.test.d.ts +11 -0
- package/dist/__tests__/ir-analyzer.test.d.ts.map +1 -0
- package/dist/__tests__/ir-jsdoc-constraints.test.d.ts +12 -0
- package/dist/__tests__/ir-jsdoc-constraints.test.d.ts.map +1 -0
- package/dist/__tests__/ir-json-schema-generator.test.d.ts +11 -0
- package/dist/__tests__/ir-json-schema-generator.test.d.ts.map +1 -0
- package/dist/__tests__/ir-ui-schema-generator.test.d.ts +2 -0
- package/dist/__tests__/ir-ui-schema-generator.test.d.ts.map +1 -0
- package/dist/__tests__/jsdoc-constraints.test.d.ts +4 -4
- package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts +9 -0
- package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts +9 -0
- package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts +19 -0
- package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts +13 -0
- package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts +9 -0
- package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts +28 -0
- package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts +12 -0
- package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts +9 -0
- package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts +19 -0
- package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts.map +1 -0
- package/dist/__tests__/parity/parity.test.d.ts +14 -0
- package/dist/__tests__/parity/parity.test.d.ts.map +1 -0
- package/dist/__tests__/parity/utils.d.ts +139 -0
- package/dist/__tests__/parity/utils.d.ts.map +1 -0
- package/dist/analyzer/class-analyzer.d.ts +54 -99
- package/dist/analyzer/class-analyzer.d.ts.map +1 -1
- package/dist/analyzer/jsdoc-constraints.d.ts +78 -30
- package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -1
- package/dist/analyzer/tsdoc-parser.d.ts +61 -0
- package/dist/analyzer/tsdoc-parser.d.ts.map +1 -0
- package/dist/browser.cjs +1200 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.ts +12 -6
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +1147 -44
- package/dist/browser.js.map +1 -1
- package/dist/build.d.ts +385 -160
- package/dist/canonicalize/chain-dsl-canonicalizer.d.ts +18 -0
- package/dist/canonicalize/chain-dsl-canonicalizer.d.ts.map +1 -0
- package/dist/canonicalize/index.d.ts +8 -0
- package/dist/canonicalize/index.d.ts.map +1 -0
- package/dist/canonicalize/tsdoc-canonicalizer.d.ts +34 -0
- package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -0
- package/dist/cli.cjs +2028 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.js +1978 -101
- package/dist/cli.js.map +1 -1
- package/dist/extensions/index.d.ts +8 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/registry.d.ts +55 -0
- package/dist/extensions/registry.d.ts.map +1 -0
- package/dist/generators/class-schema.d.ts +28 -47
- package/dist/generators/class-schema.d.ts.map +1 -1
- package/dist/generators/method-schema.d.ts +6 -8
- package/dist/generators/method-schema.d.ts.map +1 -1
- package/dist/index.cjs +1832 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1779 -114
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +2125 -0
- package/dist/internals.cjs.map +1 -0
- package/dist/internals.d.ts +12 -2
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +2084 -21
- package/dist/internals.js.map +1 -1
- package/dist/json-schema/generator.d.ts +10 -5
- package/dist/json-schema/generator.d.ts.map +1 -1
- package/dist/json-schema/ir-generator.d.ts +84 -0
- package/dist/json-schema/ir-generator.d.ts.map +1 -0
- package/dist/json-schema/schema.d.ts +16 -0
- package/dist/json-schema/schema.d.ts.map +1 -0
- package/dist/json-schema/types.d.ts +5 -6
- package/dist/json-schema/types.d.ts.map +1 -1
- package/dist/ui-schema/generator.d.ts +5 -0
- package/dist/ui-schema/generator.d.ts.map +1 -1
- package/dist/ui-schema/ir-generator.d.ts +53 -0
- package/dist/ui-schema/ir-generator.d.ts.map +1 -0
- 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/dist/validate/constraint-validator.d.ts +66 -0
- package/dist/validate/constraint-validator.d.ts.map +1 -0
- package/dist/validate/index.d.ts +9 -0
- package/dist/validate/index.d.ts.map +1 -0
- package/package.json +15 -9
- package/dist/__tests__/analyzer-edge-cases.test.d.ts +0 -13
- package/dist/__tests__/analyzer-edge-cases.test.d.ts.map +0 -1
- 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.d.ts +0 -5
- package/dist/__tests__/analyzer.test.d.ts.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.d.ts +0 -5
- package/dist/__tests__/codegen.test.d.ts.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.d.ts +0 -11
- package/dist/__tests__/decorator-pipeline.test.d.ts.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.d.ts +0 -5
- package/dist/__tests__/fixtures/example-b-decorators.d.ts.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.d.ts +0 -5
- package/dist/__tests__/fixtures/example-b-extended.d.ts.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.d.ts +0 -5
- package/dist/__tests__/fixtures/example-c-custom.d.ts.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.d.ts +0 -5
- package/dist/__tests__/fixtures/example-c-decorators.d.ts.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.d.ts +0 -6
- package/dist/__tests__/fixtures/example-d-mixed-decorators.d.ts.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.d.ts +0 -11
- package/dist/__tests__/fixtures/example-e-decorators.d.ts.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.d.ts +0 -5
- package/dist/__tests__/fixtures/example-e-no-namespace.d.ts.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.d.ts +0 -16
- package/dist/__tests__/fixtures/example-jsdoc-constraints.d.ts.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.d.ts +0 -45
- package/dist/__tests__/fixtures/example-nested-class.d.ts.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.d.ts +0 -11
- package/dist/__tests__/interface-types.test.d.ts.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.d.ts +0 -78
- package/dist/analyzer/decorator-extractor.d.ts.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.d.ts +0 -75
- package/dist/analyzer/type-converter.d.ts.map +0 -1
- package/dist/analyzer/type-converter.js +0 -474
- package/dist/analyzer/type-converter.js.map +0 -1
- package/dist/codegen/index.d.ts +0 -75
- package/dist/codegen/index.d.ts.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
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Edge case and error handling tests.
|
|
3
|
-
*
|
|
4
|
-
* These tests verify correct behavior in unusual or boundary situations.
|
|
5
|
-
*/
|
|
6
|
-
import { describe, it, expect } from "vitest";
|
|
7
|
-
import { buildFormSchemas } from "../index.js";
|
|
8
|
-
import { formspec, field, group, when, is } from "@formspec/dsl";
|
|
9
|
-
describe("Edge cases: Empty and minimal forms", () => {
|
|
10
|
-
it("should handle form with no fields", () => {
|
|
11
|
-
const emptyForm = formspec();
|
|
12
|
-
const { jsonSchema, uiSchema } = buildFormSchemas(emptyForm);
|
|
13
|
-
expect(jsonSchema.type).toBe("object");
|
|
14
|
-
expect(jsonSchema.properties).toEqual({});
|
|
15
|
-
expect(jsonSchema.required).toBeUndefined();
|
|
16
|
-
expect(uiSchema.type).toBe("VerticalLayout");
|
|
17
|
-
expect(uiSchema.elements).toEqual([]);
|
|
18
|
-
});
|
|
19
|
-
it("should handle empty group", () => {
|
|
20
|
-
const form = formspec(group("Empty Group"));
|
|
21
|
-
const { jsonSchema, uiSchema } = buildFormSchemas(form);
|
|
22
|
-
expect(jsonSchema.properties).toEqual({});
|
|
23
|
-
expect(uiSchema.elements).toHaveLength(1);
|
|
24
|
-
expect(uiSchema.elements[0]).toMatchObject({
|
|
25
|
-
type: "Group",
|
|
26
|
-
label: "Empty Group",
|
|
27
|
-
elements: [],
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
it("should handle empty conditional", () => {
|
|
31
|
-
const form = formspec(field.enum("type", ["a", "b"]), when(is("type", "a")));
|
|
32
|
-
const { jsonSchema, uiSchema } = buildFormSchemas(form);
|
|
33
|
-
// Only the enum field should exist
|
|
34
|
-
expect(Object.keys(jsonSchema.properties ?? {})).toEqual(["type"]);
|
|
35
|
-
expect(uiSchema.elements).toHaveLength(1);
|
|
36
|
-
});
|
|
37
|
-
it("should handle empty array field", () => {
|
|
38
|
-
const form = formspec(field.array("items"));
|
|
39
|
-
const { jsonSchema } = buildFormSchemas(form);
|
|
40
|
-
expect(jsonSchema.properties?.["items"]).toMatchObject({
|
|
41
|
-
type: "array",
|
|
42
|
-
items: {
|
|
43
|
-
type: "object",
|
|
44
|
-
properties: {},
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
it("should handle empty object field", () => {
|
|
49
|
-
const form = formspec(field.object("data"));
|
|
50
|
-
const { jsonSchema } = buildFormSchemas(form);
|
|
51
|
-
expect(jsonSchema.properties?.["data"]).toMatchObject({
|
|
52
|
-
type: "object",
|
|
53
|
-
properties: {},
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
describe("Edge cases: Field names", () => {
|
|
58
|
-
it("should handle field names with special characters", () => {
|
|
59
|
-
const form = formspec(field.text("field_with_underscore"), field.text("field-with-dash"), field.text("field123"));
|
|
60
|
-
const { jsonSchema, uiSchema } = buildFormSchemas(form);
|
|
61
|
-
expect(jsonSchema.properties?.["field_with_underscore"]).toBeDefined();
|
|
62
|
-
expect(jsonSchema.properties?.["field-with-dash"]).toBeDefined();
|
|
63
|
-
expect(jsonSchema.properties?.["field123"]).toBeDefined();
|
|
64
|
-
// All scopes should be properly formed
|
|
65
|
-
expect(uiSchema.elements[0]).toMatchObject({
|
|
66
|
-
scope: "#/properties/field_with_underscore",
|
|
67
|
-
});
|
|
68
|
-
expect(uiSchema.elements[1]).toMatchObject({
|
|
69
|
-
scope: "#/properties/field-with-dash",
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
it("should handle single character field names", () => {
|
|
73
|
-
const form = formspec(field.text("a"), field.number("b"), field.boolean("c"));
|
|
74
|
-
const { jsonSchema } = buildFormSchemas(form);
|
|
75
|
-
expect(Object.keys(jsonSchema.properties ?? {})).toEqual(["a", "b", "c"]);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
describe("Edge cases: Number constraints", () => {
|
|
79
|
-
it("should handle zero as min/max", () => {
|
|
80
|
-
const form = formspec(field.number("zeroMin", { min: 0 }), field.number("zeroMax", { max: 0 }), field.number("zeroRange", { min: 0, max: 0 }));
|
|
81
|
-
const { jsonSchema } = buildFormSchemas(form);
|
|
82
|
-
expect(jsonSchema.properties?.["zeroMin"]).toMatchObject({
|
|
83
|
-
type: "number",
|
|
84
|
-
minimum: 0,
|
|
85
|
-
});
|
|
86
|
-
expect(jsonSchema.properties?.["zeroMax"]).toMatchObject({
|
|
87
|
-
type: "number",
|
|
88
|
-
maximum: 0,
|
|
89
|
-
});
|
|
90
|
-
expect(jsonSchema.properties?.["zeroRange"]).toMatchObject({
|
|
91
|
-
type: "number",
|
|
92
|
-
minimum: 0,
|
|
93
|
-
maximum: 0,
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
it("should handle negative min/max", () => {
|
|
97
|
-
const form = formspec(field.number("temperature", { min: -273, max: 1000000 }));
|
|
98
|
-
const { jsonSchema } = buildFormSchemas(form);
|
|
99
|
-
expect(jsonSchema.properties?.["temperature"]).toMatchObject({
|
|
100
|
-
type: "number",
|
|
101
|
-
minimum: -273,
|
|
102
|
-
maximum: 1000000,
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
describe("Edge cases: Enum options", () => {
|
|
107
|
-
it("should handle single option enum", () => {
|
|
108
|
-
const form = formspec(field.enum("singleOption", ["only"]));
|
|
109
|
-
const { jsonSchema } = buildFormSchemas(form);
|
|
110
|
-
expect(jsonSchema.properties?.["singleOption"]).toMatchObject({
|
|
111
|
-
type: "string",
|
|
112
|
-
enum: ["only"],
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
it("should handle single object option enum", () => {
|
|
116
|
-
const form = formspec(field.enum("singleObj", [{ id: "only", label: "Only Option" }]));
|
|
117
|
-
const { jsonSchema } = buildFormSchemas(form);
|
|
118
|
-
expect(jsonSchema.properties?.["singleObj"]).toMatchObject({
|
|
119
|
-
type: "string",
|
|
120
|
-
oneOf: [{ const: "only", title: "Only Option" }],
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
it("should handle enum with empty string option", () => {
|
|
124
|
-
const form = formspec(field.enum("withEmpty", ["", "value"]));
|
|
125
|
-
const { jsonSchema } = buildFormSchemas(form);
|
|
126
|
-
expect(jsonSchema.properties?.["withEmpty"]).toMatchObject({
|
|
127
|
-
type: "string",
|
|
128
|
-
enum: ["", "value"],
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
describe("Edge cases: Conditional values", () => {
|
|
133
|
-
it("should handle boolean conditional value", () => {
|
|
134
|
-
const form = formspec(field.boolean("enabled"), when(is("enabled", true), field.text("config")));
|
|
135
|
-
const { uiSchema } = buildFormSchemas(form);
|
|
136
|
-
const conditionalField = uiSchema.elements.find((el) => el.type === "Control" && "scope" in el && el.scope === "#/properties/config");
|
|
137
|
-
expect(conditionalField?.rule?.condition.schema).toMatchObject({
|
|
138
|
-
const: true,
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
it("should handle null conditional value", () => {
|
|
142
|
-
const form = formspec(field.text("optional"), when(is("optional", null), field.text("fallback")));
|
|
143
|
-
const { uiSchema } = buildFormSchemas(form);
|
|
144
|
-
const conditionalField = uiSchema.elements.find((el) => el.type === "Control" && "scope" in el && el.scope === "#/properties/fallback");
|
|
145
|
-
expect(conditionalField?.rule?.condition.schema).toMatchObject({
|
|
146
|
-
const: null,
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
it("should handle number conditional value", () => {
|
|
150
|
-
const form = formspec(field.number("quantity"), when(is("quantity", 0), field.text("zeroReason", { label: "Why zero?" })));
|
|
151
|
-
const { uiSchema } = buildFormSchemas(form);
|
|
152
|
-
const conditionalField = uiSchema.elements.find((el) => el.type === "Control" && "scope" in el && el.scope === "#/properties/zeroReason");
|
|
153
|
-
expect(conditionalField?.rule?.condition.schema).toMatchObject({
|
|
154
|
-
const: 0,
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
describe("Edge cases: Array min/max items", () => {
|
|
159
|
-
it("should handle minItems of 0", () => {
|
|
160
|
-
const form = formspec(field.arrayWithConfig("items", { minItems: 0 }, field.text("name")));
|
|
161
|
-
const { jsonSchema } = buildFormSchemas(form);
|
|
162
|
-
expect(jsonSchema.properties?.["items"]).toMatchObject({
|
|
163
|
-
type: "array",
|
|
164
|
-
minItems: 0,
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
it("should handle minItems equal to maxItems", () => {
|
|
168
|
-
const form = formspec(field.arrayWithConfig("exactFive", { minItems: 5, maxItems: 5 }, field.text("item")));
|
|
169
|
-
const { jsonSchema } = buildFormSchemas(form);
|
|
170
|
-
expect(jsonSchema.properties?.["exactFive"]).toMatchObject({
|
|
171
|
-
type: "array",
|
|
172
|
-
minItems: 5,
|
|
173
|
-
maxItems: 5,
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
describe("Edge cases: Deeply nested structures", () => {
|
|
178
|
-
it("should handle 3+ levels of nesting", () => {
|
|
179
|
-
const form = formspec(field.object("level1", field.object("level2", field.object("level3", field.text("deepValue")))));
|
|
180
|
-
const { jsonSchema } = buildFormSchemas(form);
|
|
181
|
-
expect(jsonSchema.properties?.["level1"]).toMatchObject({
|
|
182
|
-
type: "object",
|
|
183
|
-
properties: {
|
|
184
|
-
level2: {
|
|
185
|
-
type: "object",
|
|
186
|
-
properties: {
|
|
187
|
-
level3: {
|
|
188
|
-
type: "object",
|
|
189
|
-
properties: {
|
|
190
|
-
deepValue: { type: "string" },
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
});
|
|
197
|
-
});
|
|
198
|
-
it("should handle conditionals inside groups inside conditionals", () => {
|
|
199
|
-
const form = formspec(field.enum("outer", ["a", "b"]), when(is("outer", "a"), group("Inner Group", field.enum("inner", ["x", "y"]), when(is("inner", "x"), field.text("deepest")))));
|
|
200
|
-
const { jsonSchema, uiSchema } = buildFormSchemas(form);
|
|
201
|
-
// All fields should be in schema
|
|
202
|
-
expect(Object.keys(jsonSchema.properties ?? {})).toContain("outer");
|
|
203
|
-
expect(Object.keys(jsonSchema.properties ?? {})).toContain("inner");
|
|
204
|
-
expect(Object.keys(jsonSchema.properties ?? {})).toContain("deepest");
|
|
205
|
-
// Find the deepest field and verify it has combined rules
|
|
206
|
-
const deepestControl = uiSchema.elements.find((el) => {
|
|
207
|
-
if (el.type === "Group") {
|
|
208
|
-
return el.elements.some((inner) => inner.type === "Control" && "scope" in inner && inner.scope === "#/properties/deepest");
|
|
209
|
-
}
|
|
210
|
-
return false;
|
|
211
|
-
});
|
|
212
|
-
expect(deepestControl).toBeDefined();
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
//# sourceMappingURL=edge-cases.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edge-cases.test.js","sourceRoot":"","sources":["../../src/__tests__/edge-cases.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAEjE,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACnD,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,SAAS,GAAG,QAAQ,EAAE,CAAC;QAE7B,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAE7D,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,MAAM,CAAC,UAAU,CAAC,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AAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACpE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAEtE,0DAA0D;QAC1D,MAAM,cAAc,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE;YACnD,IAAI,EAAE,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;gBACxB,OAAO,EAAE,CAAC,QAAQ,CAAC,IAAI,CACrB,CAAC,KAAK,EAAE,EAAE,CACR,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK,sBAAsB,CACzF,CAAC;YACJ,CAAC;YACD,OAAO,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,cAAc,CAAC,CAAC,WAAW,EAAE,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Edge case fixtures for testing type converter and analyzer.
|
|
3
|
-
*
|
|
4
|
-
* These test various TypeScript type patterns that might cause issues.
|
|
5
|
-
*/
|
|
6
|
-
// ============================================================================
|
|
7
|
-
// Complex Union Types
|
|
8
|
-
// ============================================================================
|
|
9
|
-
/**
|
|
10
|
-
* Mixed type union (not just literals) - should produce oneOf.
|
|
11
|
-
*/
|
|
12
|
-
export class MixedUnionTypes {
|
|
13
|
-
// string | number - incompatible union
|
|
14
|
-
mixedPrimitive;
|
|
15
|
-
// Complex union with object and primitive
|
|
16
|
-
complexUnion;
|
|
17
|
-
// Union of different object shapes
|
|
18
|
-
objectUnion;
|
|
19
|
-
}
|
|
20
|
-
// ============================================================================
|
|
21
|
-
// Nullable and Optional Patterns
|
|
22
|
-
// ============================================================================
|
|
23
|
-
/**
|
|
24
|
-
* Various nullable patterns.
|
|
25
|
-
*/
|
|
26
|
-
export class NullablePatterns {
|
|
27
|
-
// Nullable string (T | null)
|
|
28
|
-
nullableString;
|
|
29
|
-
// Undefined union (T | undefined) - different from optional
|
|
30
|
-
undefinedString;
|
|
31
|
-
// Both nullable and optional
|
|
32
|
-
optionalNullable;
|
|
33
|
-
// Triple union (T | null | undefined)
|
|
34
|
-
tripleUnion;
|
|
35
|
-
// Nullable enum
|
|
36
|
-
nullableStatus;
|
|
37
|
-
}
|
|
38
|
-
// ============================================================================
|
|
39
|
-
// Array Edge Cases
|
|
40
|
-
// ============================================================================
|
|
41
|
-
/**
|
|
42
|
-
* Various array patterns.
|
|
43
|
-
*/
|
|
44
|
-
export class ArrayEdgeCases {
|
|
45
|
-
// Array of primitives
|
|
46
|
-
strings;
|
|
47
|
-
// Array of unions
|
|
48
|
-
mixedArray;
|
|
49
|
-
// Nullable array
|
|
50
|
-
nullableArray;
|
|
51
|
-
// Array of objects
|
|
52
|
-
objectArray;
|
|
53
|
-
// Empty array type (any[])
|
|
54
|
-
anyArray;
|
|
55
|
-
// Nested arrays
|
|
56
|
-
nestedArray;
|
|
57
|
-
}
|
|
58
|
-
// ============================================================================
|
|
59
|
-
// Object Edge Cases
|
|
60
|
-
// ============================================================================
|
|
61
|
-
/**
|
|
62
|
-
* Various object type patterns.
|
|
63
|
-
*/
|
|
64
|
-
export class ObjectEdgeCases {
|
|
65
|
-
// Empty object - Allow this as a test case for empty object type handling
|
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
67
|
-
emptyObject;
|
|
68
|
-
// Record type
|
|
69
|
-
stringRecord;
|
|
70
|
-
// Deeply nested object
|
|
71
|
-
deepNested;
|
|
72
|
-
// Object with optional properties
|
|
73
|
-
optionalProps;
|
|
74
|
-
}
|
|
75
|
-
// ============================================================================
|
|
76
|
-
// Special Types
|
|
77
|
-
// ============================================================================
|
|
78
|
-
/**
|
|
79
|
-
* Special TypeScript types.
|
|
80
|
-
*/
|
|
81
|
-
export class SpecialTypes {
|
|
82
|
-
// any type (should handle gracefully)
|
|
83
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
84
|
-
anyField;
|
|
85
|
-
// unknown type
|
|
86
|
-
unknownField;
|
|
87
|
-
// never type (edge case)
|
|
88
|
-
// Note: never is not typically used as a property type
|
|
89
|
-
// void type - Test case for void type handling, used in FormSpec codegen tests
|
|
90
|
-
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
91
|
-
voidField;
|
|
92
|
-
// Date (built-in object)
|
|
93
|
-
dateField;
|
|
94
|
-
}
|
|
95
|
-
// ============================================================================
|
|
96
|
-
// Enum Variations
|
|
97
|
-
// ============================================================================
|
|
98
|
-
/**
|
|
99
|
-
* Various enum patterns.
|
|
100
|
-
*/
|
|
101
|
-
export class EnumVariations {
|
|
102
|
-
// Single literal (degenerates to const)
|
|
103
|
-
singleLiteral;
|
|
104
|
-
// Number literal enum
|
|
105
|
-
numberEnum;
|
|
106
|
-
// Mixed literal types (should NOT be valid enum)
|
|
107
|
-
// Note: This is a union, not an enum
|
|
108
|
-
mixedLiterals;
|
|
109
|
-
// Large enum (many options)
|
|
110
|
-
largeEnum;
|
|
111
|
-
}
|
|
112
|
-
// ============================================================================
|
|
113
|
-
// Class without decorators (for testing analyzer handles undecorated classes)
|
|
114
|
-
// ============================================================================
|
|
115
|
-
/**
|
|
116
|
-
* Simple class with no decorators for testing analyzer edge cases.
|
|
117
|
-
*/
|
|
118
|
-
export class NoDecoratorsClass {
|
|
119
|
-
// Regular string field
|
|
120
|
-
name;
|
|
121
|
-
// Optional number field
|
|
122
|
-
count;
|
|
123
|
-
// Boolean field
|
|
124
|
-
active;
|
|
125
|
-
}
|
|
126
|
-
// ============================================================================
|
|
127
|
-
// Invalid FormSpec-like Objects (for testing isFormSpec)
|
|
128
|
-
// ============================================================================
|
|
129
|
-
export const notFormSpec1 = null;
|
|
130
|
-
export const notFormSpec2 = undefined;
|
|
131
|
-
export const notFormSpec3 = "string";
|
|
132
|
-
export const notFormSpec4 = 123;
|
|
133
|
-
export const notFormSpec5 = { notElements: [] };
|
|
134
|
-
export const notFormSpec6 = { elements: "not-array" };
|
|
135
|
-
export const notFormSpec7 = { elements: [{ missingType: true }] };
|
|
136
|
-
export const notFormSpec8 = { elements: [null] };
|
|
137
|
-
//# sourceMappingURL=edge-cases.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edge-cases.js","sourceRoot":"","sources":["../../../src/__tests__/fixtures/edge-cases.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,+EAA+E;AAC/E,sBAAsB;AACtB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,OAAO,eAAe;IAC1B,uCAAuC;IACvC,cAAc,CAAmB;IAEjC,0CAA0C;IAC1C,YAAY,CAAgC;IAE5C,mCAAmC;IACnC,WAAW,CAAiE;CAC7E;AAED,+EAA+E;AAC/E,iCAAiC;AACjC,+EAA+E;AAE/E;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAC3B,6BAA6B;IAC7B,cAAc,CAAiB;IAE/B,4DAA4D;IAC5D,eAAe,CAAsB;IAErC,6BAA6B;IAC7B,gBAAgB,CAAiB;IAEjC,sCAAsC;IACtC,WAAW,CAA6B;IAExC,gBAAgB;IAChB,cAAc,CAAgC;CAC/C;AAED,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,OAAO,cAAc;IACzB,sBAAsB;IACtB,OAAO,CAAY;IAEnB,kBAAkB;IAClB,UAAU,CAAuB;IAEjC,iBAAiB;IACjB,aAAa,CAAmB;IAEhC,mBAAmB;IACnB,WAAW,CAAkC;IAE7C,2BAA2B;IAC3B,QAAQ,CAAa;IAErB,gBAAgB;IAChB,WAAW,CAAc;CAC1B;AAED,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;GAEG;AACH,MAAM,OAAO,eAAe;IAC1B,0EAA0E;IAC1E,mEAAm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MAAM,YAAY,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAClE,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
-
var _, done = false;
|
|
7
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
-
var context = {};
|
|
9
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
-
if (kind === "accessor") {
|
|
14
|
-
if (result === void 0) continue;
|
|
15
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
-
}
|
|
20
|
-
else if (_ = accept(result)) {
|
|
21
|
-
if (kind === "field") initializers.unshift(_);
|
|
22
|
-
else descriptor[key] = _;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
-
done = true;
|
|
27
|
-
};
|
|
28
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
-
var useValue = arguments.length > 2;
|
|
30
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
-
}
|
|
33
|
-
return useValue ? value : void 0;
|
|
34
|
-
};
|
|
35
|
-
import { Field, Minimum, Maximum, ExclusiveMinimum, MinLength, MaxLength, Pattern, Group, ShowWhen, EnumOptions, } from "@formspec/decorators";
|
|
36
|
-
let ExampleAForm = (() => {
|
|
37
|
-
let _name_decorators;
|
|
38
|
-
let _name_initializers = [];
|
|
39
|
-
let _name_extraInitializers = [];
|
|
40
|
-
let _age_decorators;
|
|
41
|
-
let _age_initializers = [];
|
|
42
|
-
let _age_extraInitializers = [];
|
|
43
|
-
let _score_decorators;
|
|
44
|
-
let _score_initializers = [];
|
|
45
|
-
let _score_extraInitializers = [];
|
|
46
|
-
let _email_decorators;
|
|
47
|
-
let _email_initializers = [];
|
|
48
|
-
let _email_extraInitializers = [];
|
|
49
|
-
let _country_decorators;
|
|
50
|
-
let _country_initializers = [];
|
|
51
|
-
let _country_extraInitializers = [];
|
|
52
|
-
let _state_decorators;
|
|
53
|
-
let _state_initializers = [];
|
|
54
|
-
let _state_extraInitializers = [];
|
|
55
|
-
let _fax_decorators;
|
|
56
|
-
let _fax_initializers = [];
|
|
57
|
-
let _fax_extraInitializers = [];
|
|
58
|
-
let _role_decorators;
|
|
59
|
-
let _role_initializers = [];
|
|
60
|
-
let _role_extraInitializers = [];
|
|
61
|
-
return class ExampleAForm {
|
|
62
|
-
static {
|
|
63
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
64
|
-
_name_decorators = [Field({ displayName: "Full Name", description: "Your legal name" }), MinLength(2), MaxLength(100)];
|
|
65
|
-
_age_decorators = [Field({ displayName: "Age" }), Minimum(0), Maximum(150)];
|
|
66
|
-
_score_decorators = [Field({ displayName: "Score" }), ExclusiveMinimum(0)];
|
|
67
|
-
_email_decorators = [Field({ displayName: "Email" }), Pattern("^[^@]+@[^@]+$")];
|
|
68
|
-
_country_decorators = [Group("Preferences"), Field({ displayName: "Country" }), EnumOptions([
|
|
69
|
-
{ id: "us", label: "United States" },
|
|
70
|
-
{ id: "ca", label: "Canada" },
|
|
71
|
-
])];
|
|
72
|
-
_state_decorators = [ShowWhen({ field: "country", value: "us" }), Field({ displayName: "State" })];
|
|
73
|
-
_fax_decorators = [Field({ displayName: "Fax Number" })];
|
|
74
|
-
_role_decorators = [Field({ displayName: "Role" })];
|
|
75
|
-
__esDecorate(null, null, _name_decorators, { kind: "field", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
|
|
76
|
-
__esDecorate(null, null, _age_decorators, { kind: "field", name: "age", static: false, private: false, access: { has: obj => "age" in obj, get: obj => obj.age, set: (obj, value) => { obj.age = value; } }, metadata: _metadata }, _age_initializers, _age_extraInitializers);
|
|
77
|
-
__esDecorate(null, null, _score_decorators, { kind: "field", name: "score", static: false, private: false, access: { has: obj => "score" in obj, get: obj => obj.score, set: (obj, value) => { obj.score = value; } }, metadata: _metadata }, _score_initializers, _score_extraInitializers);
|
|
78
|
-
__esDecorate(null, null, _email_decorators, { kind: "field", name: "email", static: false, private: false, access: { has: obj => "email" in obj, get: obj => obj.email, set: (obj, value) => { obj.email = value; } }, metadata: _metadata }, _email_initializers, _email_extraInitializers);
|
|
79
|
-
__esDecorate(null, null, _country_decorators, { kind: "field", name: "country", static: false, private: false, access: { has: obj => "country" in obj, get: obj => obj.country, set: (obj, value) => { obj.country = value; } }, metadata: _metadata }, _country_initializers, _country_extraInitializers);
|
|
80
|
-
__esDecorate(null, null, _state_decorators, { kind: "field", name: "state", static: false, private: false, access: { has: obj => "state" in obj, get: obj => obj.state, set: (obj, value) => { obj.state = value; } }, metadata: _metadata }, _state_initializers, _state_extraInitializers);
|
|
81
|
-
__esDecorate(null, null, _fax_decorators, { kind: "field", name: "fax", static: false, private: false, access: { has: obj => "fax" in obj, get: obj => obj.fax, set: (obj, value) => { obj.fax = value; } }, metadata: _metadata }, _fax_initializers, _fax_extraInitializers);
|
|
82
|
-
__esDecorate(null, null, _role_decorators, { kind: "field", name: "role", static: false, private: false, access: { has: obj => "role" in obj, get: obj => obj.role, set: (obj, value) => { obj.role = value; } }, metadata: _metadata }, _role_initializers, _role_extraInitializers);
|
|
83
|
-
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
84
|
-
}
|
|
85
|
-
name = __runInitializers(this, _name_initializers, void 0);
|
|
86
|
-
age = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _age_initializers, void 0));
|
|
87
|
-
score = (__runInitializers(this, _age_extraInitializers), __runInitializers(this, _score_initializers, void 0));
|
|
88
|
-
email = (__runInitializers(this, _score_extraInitializers), __runInitializers(this, _email_initializers, void 0));
|
|
89
|
-
country = (__runInitializers(this, _email_extraInitializers), __runInitializers(this, _country_initializers, void 0));
|
|
90
|
-
state = (__runInitializers(this, _country_extraInitializers), __runInitializers(this, _state_initializers, void 0));
|
|
91
|
-
/** @deprecated Use email instead */
|
|
92
|
-
fax = (__runInitializers(this, _state_extraInitializers), __runInitializers(this, _fax_initializers, void 0));
|
|
93
|
-
role = (__runInitializers(this, _fax_extraInitializers), __runInitializers(this, _role_initializers, "user"));
|
|
94
|
-
constructor() {
|
|
95
|
-
__runInitializers(this, _role_extraInitializers);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
})();
|
|
99
|
-
export { ExampleAForm };
|
|
100
|
-
//# sourceMappingURL=example-a-builtins.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version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W,EAAE,MAAM,EAAE,CAAC;YA/B/B,8JAAA,IAAI,6BAAJ,IAAI,mFAAU;YAKd,2JAAA,GAAG,6BAAH,GAAG,iFAAU;YAIb,iKAAA,KAAK,6BAAL,KAAK,qFAAU;YAIf,iKAAA,KAAK,6BAAL,KAAK,qFAAU;YAQf,uKAAA,OAAO,6BAAP,OAAO,yFAAe;YAItB,iKAAA,KAAK,6BAAL,KAAK,qFAAU;YAIf,2JAAA,GAAG,6BAAH,GAAG,iFAAU;YAGb,8JAAA,IAAI,6BAAJ,IAAI,mFAA4B;;;QAhChC,IAAI,uDAAU;QAKd,GAAG,0GAAU;QAIb,KAAK,2GAAU;QAIf,KAAK,6GAAU;QAQf,OAAO,+GAAe;QAItB,KAAK,+GAAU;QAEf,oCAAoC;QAEpC,GAAG,2GAAU;QAGb,IAAI,iGAAqB,MAAM,GAAC;;;;;;SApCrB,YAAY"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { FieldOptions } from "@formspec/decorators";
|
|
2
|
-
export declare const CustomField: ((_args: FieldOptions) => (value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecExtendsBrand<"Field">;
|
|
3
|
-
export declare const Floor: ((_args: number) => (value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecExtendsBrand<"Minimum">;
|
|
4
|
-
export declare const Ceiling: ((_args: number) => (value: undefined, context: ClassFieldDecoratorContext) => void) & import("@formspec/decorators").FormSpecExtendsBrand<"Maximum">;
|
|
5
|
-
//# sourceMappingURL=example-b-decorators.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-b-decorators.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-b-decorators.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,eAAO,MAAM,WAAW,2JAA2D,CAAC;AACpF,eAAO,MAAM,KAAK,uJAAiD,CAAC;AACpE,eAAO,MAAM,OAAO,uJAAmD,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { extendDecorator } from "@formspec/decorators";
|
|
2
|
-
export const CustomField = extendDecorator("Field").as("CustomField");
|
|
3
|
-
export const Floor = extendDecorator("Minimum").as("Floor");
|
|
4
|
-
export const Ceiling = extendDecorator("Maximum").as("Ceiling");
|
|
5
|
-
//# sourceMappingURL=example-b-decorators.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-b-decorators.js","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-b-decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,MAAM,CAAC,MAAM,WAAW,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,EAAE,CAAe,aAAa,CAAC,CAAC;AACpF,MAAM,CAAC,MAAM,KAAK,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,EAAE,CAAS,OAAO,CAAC,CAAC;AACpE,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,EAAE,CAAS,SAAS,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-b-extended.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-b-extended.ts"],"names":[],"mappings":"AAEA,qBAAa,YAAY;IAIvB,MAAM,EAAG,MAAM,CAAC;IAGhB,KAAK,EAAG,MAAM,CAAC;CAChB"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
2
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
3
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
4
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
5
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
6
|
-
var _, done = false;
|
|
7
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8
|
-
var context = {};
|
|
9
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
10
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
11
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
12
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
13
|
-
if (kind === "accessor") {
|
|
14
|
-
if (result === void 0) continue;
|
|
15
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
16
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
17
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
18
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
19
|
-
}
|
|
20
|
-
else if (_ = accept(result)) {
|
|
21
|
-
if (kind === "field") initializers.unshift(_);
|
|
22
|
-
else descriptor[key] = _;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
26
|
-
done = true;
|
|
27
|
-
};
|
|
28
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
29
|
-
var useValue = arguments.length > 2;
|
|
30
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
31
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
32
|
-
}
|
|
33
|
-
return useValue ? value : void 0;
|
|
34
|
-
};
|
|
35
|
-
import { CustomField, Floor, Ceiling } from "./example-b-decorators.js";
|
|
36
|
-
let ExampleBForm = (() => {
|
|
37
|
-
let _amount_decorators;
|
|
38
|
-
let _amount_initializers = [];
|
|
39
|
-
let _amount_extraInitializers = [];
|
|
40
|
-
let _label_decorators;
|
|
41
|
-
let _label_initializers = [];
|
|
42
|
-
let _label_extraInitializers = [];
|
|
43
|
-
return class ExampleBForm {
|
|
44
|
-
static {
|
|
45
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
46
|
-
_amount_decorators = [CustomField({ displayName: "Amount", description: "Total amount in cents" }), Floor(0), Ceiling(1000000)];
|
|
47
|
-
_label_decorators = [CustomField({ displayName: "Label" })];
|
|
48
|
-
__esDecorate(null, null, _amount_decorators, { kind: "field", name: "amount", static: false, private: false, access: { has: obj => "amount" in obj, get: obj => obj.amount, set: (obj, value) => { obj.amount = value; } }, metadata: _metadata }, _amount_initializers, _amount_extraInitializers);
|
|
49
|
-
__esDecorate(null, null, _label_decorators, { kind: "field", name: "label", static: false, private: false, access: { has: obj => "label" in obj, get: obj => obj.label, set: (obj, value) => { obj.label = value; } }, metadata: _metadata }, _label_initializers, _label_extraInitializers);
|
|
50
|
-
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
51
|
-
}
|
|
52
|
-
amount = __runInitializers(this, _amount_initializers, void 0);
|
|
53
|
-
label = (__runInitializers(this, _amount_extraInitializers), __runInitializers(this, _label_initializers, void 0));
|
|
54
|
-
constructor() {
|
|
55
|
-
__runInitializers(this, _label_extraInitializers);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
})();
|
|
59
|
-
export { ExampleBForm };
|
|
60
|
-
//# sourceMappingURL=example-b-extended.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-b-extended.js","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-b-extended.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;IAE3D,YAAY;;;;;;;iBAAZ,YAAY;;;kCACtB,WAAW,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC,EAC5E,KAAK,CAAC,CAAC,CAAC,EACR,OAAO,CAAC,OAAO,CAAC;iCAGhB,WAAW,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;YAFtC,oKAAA,MAAM,6BAAN,MAAM,uFAAU;YAGhB,iKAAA,KAAK,6BAAL,KAAK,qFAAU;;;QAHf,MAAM,yDAAU;QAGhB,KAAK,8GAAU;;;;;;SAPJ,YAAY"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example-c-custom.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-c-custom.ts"],"names":[],"mappings":"AAGA,qBAAa,YAAY;IAGvB,OAAO,EAAG,MAAM,CAAC;IAKjB,OAAO,EAAG,MAAM,CAAC;CAClB"}
|