@form-os/schema 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Adam Beleko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.cjs ADDED
@@ -0,0 +1,178 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ schema: () => form_config_schema_default
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+
27
+ // src/form-config.schema.json
28
+ var form_config_schema_default = {
29
+ $schema: "http://json-schema.org/draft-07/schema#",
30
+ $id: "https://form-os.dev/form-config.schema.json",
31
+ title: "Form OS Form Config",
32
+ description: "Schema for a Form OS form configuration.",
33
+ type: "object",
34
+ required: [
35
+ "fields"
36
+ ],
37
+ properties: {
38
+ id: {
39
+ type: "string"
40
+ },
41
+ title: {
42
+ type: "string"
43
+ },
44
+ submitLabel: {
45
+ type: "string"
46
+ },
47
+ fields: {
48
+ type: "array",
49
+ items: {
50
+ $ref: "#/$defs/FieldConfig"
51
+ }
52
+ }
53
+ },
54
+ $defs: {
55
+ Choice: {
56
+ type: "object",
57
+ required: [
58
+ "label",
59
+ "value"
60
+ ],
61
+ properties: {
62
+ label: {
63
+ type: "string"
64
+ },
65
+ value: {
66
+ type: "string"
67
+ }
68
+ },
69
+ additionalProperties: false
70
+ },
71
+ Dependency: {
72
+ type: "object",
73
+ required: [
74
+ "name",
75
+ "value",
76
+ "type"
77
+ ],
78
+ properties: {
79
+ name: {
80
+ type: "string"
81
+ },
82
+ value: {},
83
+ type: {
84
+ enum: [
85
+ "hidden",
86
+ "show",
87
+ "required",
88
+ "disabled",
89
+ "readonly"
90
+ ]
91
+ }
92
+ },
93
+ additionalProperties: false
94
+ },
95
+ ValidationRules: {
96
+ type: "object",
97
+ properties: {
98
+ required: {
99
+ type: [
100
+ "boolean",
101
+ "string"
102
+ ]
103
+ },
104
+ min: {
105
+ type: "number"
106
+ },
107
+ max: {
108
+ type: "number"
109
+ },
110
+ minLength: {
111
+ type: "number"
112
+ },
113
+ maxLength: {
114
+ type: "number"
115
+ },
116
+ pattern: {
117
+ type: "string"
118
+ },
119
+ disabled: {
120
+ type: "boolean"
121
+ },
122
+ readonly: {
123
+ type: "boolean"
124
+ }
125
+ },
126
+ additionalProperties: false
127
+ },
128
+ FieldConfig: {
129
+ type: "object",
130
+ required: [
131
+ "name",
132
+ "type"
133
+ ],
134
+ properties: {
135
+ name: {
136
+ type: "string"
137
+ },
138
+ type: {
139
+ type: "string"
140
+ },
141
+ label: {
142
+ type: "string"
143
+ },
144
+ description: {
145
+ type: "string"
146
+ },
147
+ placeholder: {
148
+ type: "string"
149
+ },
150
+ defaultValue: {},
151
+ dependencies: {
152
+ type: "array",
153
+ items: {
154
+ $ref: "#/$defs/Dependency"
155
+ }
156
+ },
157
+ rules: {
158
+ $ref: "#/$defs/ValidationRules"
159
+ },
160
+ options: {
161
+ type: "array",
162
+ items: {
163
+ $ref: "#/$defs/Choice"
164
+ }
165
+ },
166
+ props: {
167
+ type: "object"
168
+ }
169
+ },
170
+ additionalProperties: false
171
+ }
172
+ }
173
+ };
174
+ // Annotate the CommonJS export names for ESM import in node:
175
+ 0 && (module.exports = {
176
+ schema
177
+ });
178
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/form-config.schema.json"],"sourcesContent":["import schema from './form-config.schema.json';\n\nexport { schema };\nexport * from './types';\n","{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": \"https://form-os.dev/form-config.schema.json\",\n \"title\": \"Form OS Form Config\",\n \"description\": \"Schema for a Form OS form configuration.\",\n \"type\": \"object\",\n \"required\": [\n \"fields\"\n ],\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"submitLabel\": {\n \"type\": \"string\"\n },\n \"fields\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/FieldConfig\"\n }\n }\n },\n \"$defs\": {\n \"Choice\": {\n \"type\": \"object\",\n \"required\": [\n \"label\",\n \"value\"\n ],\n \"properties\": {\n \"label\": {\n \"type\": \"string\"\n },\n \"value\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false\n },\n \"Dependency\": {\n \"type\": \"object\",\n \"required\": [\n \"name\",\n \"value\",\n \"type\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"value\": {},\n \"type\": {\n \"enum\": [\n \"hidden\",\n \"show\",\n \"required\",\n \"disabled\",\n \"readonly\"\n ]\n }\n },\n \"additionalProperties\": false\n },\n \"ValidationRules\": {\n \"type\": \"object\",\n \"properties\": {\n \"required\": {\n \"type\": [\n \"boolean\",\n \"string\"\n ]\n },\n \"min\": {\n \"type\": \"number\"\n },\n \"max\": {\n \"type\": \"number\"\n },\n \"minLength\": {\n \"type\": \"number\"\n },\n \"maxLength\": {\n \"type\": \"number\"\n },\n \"pattern\": {\n \"type\": \"string\"\n },\n \"disabled\": {\n \"type\": \"boolean\"\n },\n \"readonly\": {\n \"type\": \"boolean\"\n }\n },\n \"additionalProperties\": false\n },\n \"FieldConfig\": {\n \"type\": \"object\",\n \"required\": [\n \"name\",\n \"type\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"placeholder\": {\n \"type\": \"string\"\n },\n \"defaultValue\": {},\n \"dependencies\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Dependency\"\n }\n },\n \"rules\": {\n \"$ref\": \"#/$defs/ValidationRules\"\n },\n \"options\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Choice\"\n }\n },\n \"props\": {\n \"type\": \"object\"\n }\n },\n \"additionalProperties\": false\n }\n }\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAA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;AAAA,QACV;AAAA,QACA,WAAa;AAAA,UACX,MAAQ;AAAA,QACV;AAAA,QACA,SAAW;AAAA,UACT,MAAQ;AAAA,QACV;AAAA,QACA,UAAY;AAAA,UACV,MAAQ;AAAA,QACV;AAAA,QACA,UAAY;AAAA,UACV,MAAQ;AAAA,QACV;AAAA,MACF;AAAA,MACA,sBAAwB;AAAA,IAC1B;AAAA,IACA,aAAe;AAAA,MACb,MAAQ;AAAA,MACR,UAAY;AAAA,QACV;AAAA,QACA;AAAA,MACF;AAAA,MACA,YAAc;AAAA,QACZ,MAAQ;AAAA,UACN,MAAQ;AAAA,QACV;AAAA,QACA,MAAQ;AAAA,UACN,MAAQ;AAAA,QACV;AAAA,QACA,OAAS;AAAA,UACP,MAAQ;AAAA,QACV;AAAA,QACA,aAAe;AAAA,UACb,MAAQ;AAAA,QACV;AAAA,QACA,aAAe;AAAA,UACb,MAAQ;AAAA,QACV;AAAA,QACA,cAAgB,CAAC;AAAA,QACjB,cAAgB;AAAA,UACd,MAAQ;AAAA,UACR,OAAS;AAAA,YACP,MAAQ;AAAA,UACV;AAAA,QACF;AAAA,QACA,OAAS;AAAA,UACP,MAAQ;AAAA,QACV;AAAA,QACA,SAAW;AAAA,UACT,MAAQ;AAAA,UACR,OAAS;AAAA,YACP,MAAQ;AAAA,UACV;AAAA,QACF;AAAA,QACA,OAAS;AAAA,UACP,MAAQ;AAAA,QACV;AAAA,MACF;AAAA,MACA,sBAAwB;AAAA,IAC1B;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,195 @@
1
+ var $schema = "http://json-schema.org/draft-07/schema#";
2
+ var $id = "https://form-os.dev/form-config.schema.json";
3
+ var title = "Form OS Form Config";
4
+ var description = "Schema for a Form OS form configuration.";
5
+ var type = "object";
6
+ var required = [
7
+ "fields"
8
+ ];
9
+ var properties = {
10
+ id: {
11
+ type: "string"
12
+ },
13
+ title: {
14
+ type: "string"
15
+ },
16
+ submitLabel: {
17
+ type: "string"
18
+ },
19
+ fields: {
20
+ type: "array",
21
+ items: {
22
+ $ref: "#/$defs/FieldConfig"
23
+ }
24
+ }
25
+ };
26
+ var $defs = {
27
+ Choice: {
28
+ type: "object",
29
+ required: [
30
+ "label",
31
+ "value"
32
+ ],
33
+ properties: {
34
+ label: {
35
+ type: "string"
36
+ },
37
+ value: {
38
+ type: "string"
39
+ }
40
+ },
41
+ additionalProperties: false
42
+ },
43
+ Dependency: {
44
+ type: "object",
45
+ required: [
46
+ "name",
47
+ "value",
48
+ "type"
49
+ ],
50
+ properties: {
51
+ name: {
52
+ type: "string"
53
+ },
54
+ value: {
55
+ },
56
+ type: {
57
+ "enum": [
58
+ "hidden",
59
+ "show",
60
+ "required",
61
+ "disabled",
62
+ "readonly"
63
+ ]
64
+ }
65
+ },
66
+ additionalProperties: false
67
+ },
68
+ ValidationRules: {
69
+ type: "object",
70
+ properties: {
71
+ required: {
72
+ type: [
73
+ "boolean",
74
+ "string"
75
+ ]
76
+ },
77
+ min: {
78
+ type: "number"
79
+ },
80
+ max: {
81
+ type: "number"
82
+ },
83
+ minLength: {
84
+ type: "number"
85
+ },
86
+ maxLength: {
87
+ type: "number"
88
+ },
89
+ pattern: {
90
+ type: "string"
91
+ },
92
+ disabled: {
93
+ type: "boolean"
94
+ },
95
+ readonly: {
96
+ type: "boolean"
97
+ }
98
+ },
99
+ additionalProperties: false
100
+ },
101
+ FieldConfig: {
102
+ type: "object",
103
+ required: [
104
+ "name",
105
+ "type"
106
+ ],
107
+ properties: {
108
+ name: {
109
+ type: "string"
110
+ },
111
+ type: {
112
+ type: "string"
113
+ },
114
+ label: {
115
+ type: "string"
116
+ },
117
+ description: {
118
+ type: "string"
119
+ },
120
+ placeholder: {
121
+ type: "string"
122
+ },
123
+ defaultValue: {
124
+ },
125
+ dependencies: {
126
+ type: "array",
127
+ items: {
128
+ $ref: "#/$defs/Dependency"
129
+ }
130
+ },
131
+ rules: {
132
+ $ref: "#/$defs/ValidationRules"
133
+ },
134
+ options: {
135
+ type: "array",
136
+ items: {
137
+ $ref: "#/$defs/Choice"
138
+ }
139
+ },
140
+ props: {
141
+ type: "object"
142
+ }
143
+ },
144
+ additionalProperties: false
145
+ }
146
+ };
147
+ var formConfig_schema = {
148
+ $schema: $schema,
149
+ $id: $id,
150
+ title: title,
151
+ description: description,
152
+ type: type,
153
+ required: required,
154
+ properties: properties,
155
+ $defs: $defs
156
+ };
157
+
158
+ interface Choice {
159
+ label: string;
160
+ value: string;
161
+ }
162
+ type DependencyType = 'hidden' | 'show' | 'required' | 'disabled';
163
+ interface Dependency {
164
+ name: string;
165
+ value: any;
166
+ type: DependencyType;
167
+ }
168
+ interface ValidationRules {
169
+ required?: boolean;
170
+ min?: number;
171
+ max?: number;
172
+ minLength?: number;
173
+ maxLength?: number;
174
+ pattern?: string | RegExp;
175
+ }
176
+ interface FieldConfig {
177
+ name: string;
178
+ type: string;
179
+ label?: string;
180
+ description?: string;
181
+ placeholder?: string;
182
+ defaultValue?: any;
183
+ dependencies?: Dependency[];
184
+ rules?: ValidationRules;
185
+ options?: Choice[];
186
+ props?: Record<string, any>;
187
+ }
188
+ interface FormConfig {
189
+ id?: string;
190
+ title?: string;
191
+ submitLabel?: string;
192
+ fields: FieldConfig[];
193
+ }
194
+
195
+ export { type Choice, type Dependency, type DependencyType, type FieldConfig, type FormConfig, type ValidationRules, formConfig_schema as schema };
@@ -0,0 +1,195 @@
1
+ var $schema = "http://json-schema.org/draft-07/schema#";
2
+ var $id = "https://form-os.dev/form-config.schema.json";
3
+ var title = "Form OS Form Config";
4
+ var description = "Schema for a Form OS form configuration.";
5
+ var type = "object";
6
+ var required = [
7
+ "fields"
8
+ ];
9
+ var properties = {
10
+ id: {
11
+ type: "string"
12
+ },
13
+ title: {
14
+ type: "string"
15
+ },
16
+ submitLabel: {
17
+ type: "string"
18
+ },
19
+ fields: {
20
+ type: "array",
21
+ items: {
22
+ $ref: "#/$defs/FieldConfig"
23
+ }
24
+ }
25
+ };
26
+ var $defs = {
27
+ Choice: {
28
+ type: "object",
29
+ required: [
30
+ "label",
31
+ "value"
32
+ ],
33
+ properties: {
34
+ label: {
35
+ type: "string"
36
+ },
37
+ value: {
38
+ type: "string"
39
+ }
40
+ },
41
+ additionalProperties: false
42
+ },
43
+ Dependency: {
44
+ type: "object",
45
+ required: [
46
+ "name",
47
+ "value",
48
+ "type"
49
+ ],
50
+ properties: {
51
+ name: {
52
+ type: "string"
53
+ },
54
+ value: {
55
+ },
56
+ type: {
57
+ "enum": [
58
+ "hidden",
59
+ "show",
60
+ "required",
61
+ "disabled",
62
+ "readonly"
63
+ ]
64
+ }
65
+ },
66
+ additionalProperties: false
67
+ },
68
+ ValidationRules: {
69
+ type: "object",
70
+ properties: {
71
+ required: {
72
+ type: [
73
+ "boolean",
74
+ "string"
75
+ ]
76
+ },
77
+ min: {
78
+ type: "number"
79
+ },
80
+ max: {
81
+ type: "number"
82
+ },
83
+ minLength: {
84
+ type: "number"
85
+ },
86
+ maxLength: {
87
+ type: "number"
88
+ },
89
+ pattern: {
90
+ type: "string"
91
+ },
92
+ disabled: {
93
+ type: "boolean"
94
+ },
95
+ readonly: {
96
+ type: "boolean"
97
+ }
98
+ },
99
+ additionalProperties: false
100
+ },
101
+ FieldConfig: {
102
+ type: "object",
103
+ required: [
104
+ "name",
105
+ "type"
106
+ ],
107
+ properties: {
108
+ name: {
109
+ type: "string"
110
+ },
111
+ type: {
112
+ type: "string"
113
+ },
114
+ label: {
115
+ type: "string"
116
+ },
117
+ description: {
118
+ type: "string"
119
+ },
120
+ placeholder: {
121
+ type: "string"
122
+ },
123
+ defaultValue: {
124
+ },
125
+ dependencies: {
126
+ type: "array",
127
+ items: {
128
+ $ref: "#/$defs/Dependency"
129
+ }
130
+ },
131
+ rules: {
132
+ $ref: "#/$defs/ValidationRules"
133
+ },
134
+ options: {
135
+ type: "array",
136
+ items: {
137
+ $ref: "#/$defs/Choice"
138
+ }
139
+ },
140
+ props: {
141
+ type: "object"
142
+ }
143
+ },
144
+ additionalProperties: false
145
+ }
146
+ };
147
+ var formConfig_schema = {
148
+ $schema: $schema,
149
+ $id: $id,
150
+ title: title,
151
+ description: description,
152
+ type: type,
153
+ required: required,
154
+ properties: properties,
155
+ $defs: $defs
156
+ };
157
+
158
+ interface Choice {
159
+ label: string;
160
+ value: string;
161
+ }
162
+ type DependencyType = 'hidden' | 'show' | 'required' | 'disabled';
163
+ interface Dependency {
164
+ name: string;
165
+ value: any;
166
+ type: DependencyType;
167
+ }
168
+ interface ValidationRules {
169
+ required?: boolean;
170
+ min?: number;
171
+ max?: number;
172
+ minLength?: number;
173
+ maxLength?: number;
174
+ pattern?: string | RegExp;
175
+ }
176
+ interface FieldConfig {
177
+ name: string;
178
+ type: string;
179
+ label?: string;
180
+ description?: string;
181
+ placeholder?: string;
182
+ defaultValue?: any;
183
+ dependencies?: Dependency[];
184
+ rules?: ValidationRules;
185
+ options?: Choice[];
186
+ props?: Record<string, any>;
187
+ }
188
+ interface FormConfig {
189
+ id?: string;
190
+ title?: string;
191
+ submitLabel?: string;
192
+ fields: FieldConfig[];
193
+ }
194
+
195
+ export { type Choice, type Dependency, type DependencyType, type FieldConfig, type FormConfig, type ValidationRules, formConfig_schema as schema };
package/dist/index.js ADDED
@@ -0,0 +1,151 @@
1
+ // src/form-config.schema.json
2
+ var form_config_schema_default = {
3
+ $schema: "http://json-schema.org/draft-07/schema#",
4
+ $id: "https://form-os.dev/form-config.schema.json",
5
+ title: "Form OS Form Config",
6
+ description: "Schema for a Form OS form configuration.",
7
+ type: "object",
8
+ required: [
9
+ "fields"
10
+ ],
11
+ properties: {
12
+ id: {
13
+ type: "string"
14
+ },
15
+ title: {
16
+ type: "string"
17
+ },
18
+ submitLabel: {
19
+ type: "string"
20
+ },
21
+ fields: {
22
+ type: "array",
23
+ items: {
24
+ $ref: "#/$defs/FieldConfig"
25
+ }
26
+ }
27
+ },
28
+ $defs: {
29
+ Choice: {
30
+ type: "object",
31
+ required: [
32
+ "label",
33
+ "value"
34
+ ],
35
+ properties: {
36
+ label: {
37
+ type: "string"
38
+ },
39
+ value: {
40
+ type: "string"
41
+ }
42
+ },
43
+ additionalProperties: false
44
+ },
45
+ Dependency: {
46
+ type: "object",
47
+ required: [
48
+ "name",
49
+ "value",
50
+ "type"
51
+ ],
52
+ properties: {
53
+ name: {
54
+ type: "string"
55
+ },
56
+ value: {},
57
+ type: {
58
+ enum: [
59
+ "hidden",
60
+ "show",
61
+ "required",
62
+ "disabled",
63
+ "readonly"
64
+ ]
65
+ }
66
+ },
67
+ additionalProperties: false
68
+ },
69
+ ValidationRules: {
70
+ type: "object",
71
+ properties: {
72
+ required: {
73
+ type: [
74
+ "boolean",
75
+ "string"
76
+ ]
77
+ },
78
+ min: {
79
+ type: "number"
80
+ },
81
+ max: {
82
+ type: "number"
83
+ },
84
+ minLength: {
85
+ type: "number"
86
+ },
87
+ maxLength: {
88
+ type: "number"
89
+ },
90
+ pattern: {
91
+ type: "string"
92
+ },
93
+ disabled: {
94
+ type: "boolean"
95
+ },
96
+ readonly: {
97
+ type: "boolean"
98
+ }
99
+ },
100
+ additionalProperties: false
101
+ },
102
+ FieldConfig: {
103
+ type: "object",
104
+ required: [
105
+ "name",
106
+ "type"
107
+ ],
108
+ properties: {
109
+ name: {
110
+ type: "string"
111
+ },
112
+ type: {
113
+ type: "string"
114
+ },
115
+ label: {
116
+ type: "string"
117
+ },
118
+ description: {
119
+ type: "string"
120
+ },
121
+ placeholder: {
122
+ type: "string"
123
+ },
124
+ defaultValue: {},
125
+ dependencies: {
126
+ type: "array",
127
+ items: {
128
+ $ref: "#/$defs/Dependency"
129
+ }
130
+ },
131
+ rules: {
132
+ $ref: "#/$defs/ValidationRules"
133
+ },
134
+ options: {
135
+ type: "array",
136
+ items: {
137
+ $ref: "#/$defs/Choice"
138
+ }
139
+ },
140
+ props: {
141
+ type: "object"
142
+ }
143
+ },
144
+ additionalProperties: false
145
+ }
146
+ }
147
+ };
148
+ export {
149
+ form_config_schema_default as schema
150
+ };
151
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/form-config.schema.json"],"sourcesContent":["{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"$id\": \"https://form-os.dev/form-config.schema.json\",\n \"title\": \"Form OS Form Config\",\n \"description\": \"Schema for a Form OS form configuration.\",\n \"type\": \"object\",\n \"required\": [\n \"fields\"\n ],\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"submitLabel\": {\n \"type\": \"string\"\n },\n \"fields\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/FieldConfig\"\n }\n }\n },\n \"$defs\": {\n \"Choice\": {\n \"type\": \"object\",\n \"required\": [\n \"label\",\n \"value\"\n ],\n \"properties\": {\n \"label\": {\n \"type\": \"string\"\n },\n \"value\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false\n },\n \"Dependency\": {\n \"type\": \"object\",\n \"required\": [\n \"name\",\n \"value\",\n \"type\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"value\": {},\n \"type\": {\n \"enum\": [\n \"hidden\",\n \"show\",\n \"required\",\n \"disabled\",\n \"readonly\"\n ]\n }\n },\n \"additionalProperties\": false\n },\n \"ValidationRules\": {\n \"type\": \"object\",\n \"properties\": {\n \"required\": {\n \"type\": [\n \"boolean\",\n \"string\"\n ]\n },\n \"min\": {\n \"type\": \"number\"\n },\n \"max\": {\n \"type\": \"number\"\n },\n \"minLength\": {\n \"type\": \"number\"\n },\n \"maxLength\": {\n \"type\": \"number\"\n },\n \"pattern\": {\n \"type\": \"string\"\n },\n \"disabled\": {\n \"type\": \"boolean\"\n },\n \"readonly\": {\n \"type\": \"boolean\"\n }\n },\n \"additionalProperties\": false\n },\n \"FieldConfig\": {\n \"type\": \"object\",\n \"required\": [\n \"name\",\n \"type\"\n ],\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"type\": {\n \"type\": \"string\"\n },\n \"label\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"placeholder\": {\n \"type\": \"string\"\n },\n \"defaultValue\": {},\n \"dependencies\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Dependency\"\n }\n },\n \"rules\": {\n \"$ref\": \"#/$defs/ValidationRules\"\n },\n \"options\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/$defs/Choice\"\n }\n },\n \"props\": {\n \"type\": \"object\"\n }\n },\n \"additionalProperties\": false\n }\n }\n}"],"mappings":";AAAA;AAAA,EACE,SAAW;AAAA,EACX,KAAO;AAAA,EACP,OAAS;AAAA,EACT,aAAe;AAAA,EACf,MAAQ;AAAA,EACR,UAAY;AAAA,IACV;AAAA,EACF;AAAA,EACA,YAAc;AAAA,IACZ,IAAM;AAAA,MACJ,MAAQ;AAAA,IACV;AAAA,IACA,OAAS;AAAA,MACP,MAAQ;AAAA,IACV;AAAA,IACA,aAAe;AAAA,MACb,MAAQ;AAAA,IACV;AAAA,IACA,QAAU;AAAA,MACR,MAAQ;AAAA,MACR,OAAS;AAAA,QACP,MAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF;AAAA,EACA,OAAS;AAAA,IACP,QAAU;AAAA,MACR,MAAQ;AAAA,MACR,UAAY;AAAA,QACV;AAAA,QACA;AAAA,MACF;AAAA,MACA,YAAc;AAAA,QACZ,OAAS;AAAA,UACP,MAAQ;AAAA,QACV;AAAA,QACA,OAAS;AAAA,UACP,MAAQ;AAAA,QACV;AAAA,MACF;AAAA,MACA,sBAAwB;AAAA,IAC1B;AAAA,IACA,YAAc;AAAA,MACZ,MAAQ;AAAA,MACR,UAAY;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,YAAc;AAAA,QACZ,MAAQ;AAAA,UACN,MAAQ;AAAA,QACV;AAAA,QACA,OAAS,CAAC;AAAA,QACV,MAAQ;AAAA,UACN,MAAQ;AAAA,YACN;AAAA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ACV;AAAA,MACF;AAAA,MACA,sBAAwB;AAAA,IAC1B;AAAA,EACF;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@form-os/schema",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "sideEffects": false,
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ },
15
+ "./form-config.schema.json": {
16
+ "default": "./src/form-config.schema.json"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "src/form-config.schema.json"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "devDependencies": {
27
+ "tsup": "^8.0.2",
28
+ "typescript": "^5.4.5"
29
+ },
30
+ "scripts": {
31
+ "build": "tsup"
32
+ }
33
+ }
@@ -0,0 +1,146 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://form-os.dev/form-config.schema.json",
4
+ "title": "Form OS Form Config",
5
+ "description": "Schema for a Form OS form configuration.",
6
+ "type": "object",
7
+ "required": [
8
+ "fields"
9
+ ],
10
+ "properties": {
11
+ "id": {
12
+ "type": "string"
13
+ },
14
+ "title": {
15
+ "type": "string"
16
+ },
17
+ "submitLabel": {
18
+ "type": "string"
19
+ },
20
+ "fields": {
21
+ "type": "array",
22
+ "items": {
23
+ "$ref": "#/$defs/FieldConfig"
24
+ }
25
+ }
26
+ },
27
+ "$defs": {
28
+ "Choice": {
29
+ "type": "object",
30
+ "required": [
31
+ "label",
32
+ "value"
33
+ ],
34
+ "properties": {
35
+ "label": {
36
+ "type": "string"
37
+ },
38
+ "value": {
39
+ "type": "string"
40
+ }
41
+ },
42
+ "additionalProperties": false
43
+ },
44
+ "Dependency": {
45
+ "type": "object",
46
+ "required": [
47
+ "name",
48
+ "value",
49
+ "type"
50
+ ],
51
+ "properties": {
52
+ "name": {
53
+ "type": "string"
54
+ },
55
+ "value": {},
56
+ "type": {
57
+ "enum": [
58
+ "hidden",
59
+ "show",
60
+ "required",
61
+ "disabled",
62
+ "readonly"
63
+ ]
64
+ }
65
+ },
66
+ "additionalProperties": false
67
+ },
68
+ "ValidationRules": {
69
+ "type": "object",
70
+ "properties": {
71
+ "required": {
72
+ "type": [
73
+ "boolean",
74
+ "string"
75
+ ]
76
+ },
77
+ "min": {
78
+ "type": "number"
79
+ },
80
+ "max": {
81
+ "type": "number"
82
+ },
83
+ "minLength": {
84
+ "type": "number"
85
+ },
86
+ "maxLength": {
87
+ "type": "number"
88
+ },
89
+ "pattern": {
90
+ "type": "string"
91
+ },
92
+ "disabled": {
93
+ "type": "boolean"
94
+ },
95
+ "readonly": {
96
+ "type": "boolean"
97
+ }
98
+ },
99
+ "additionalProperties": false
100
+ },
101
+ "FieldConfig": {
102
+ "type": "object",
103
+ "required": [
104
+ "name",
105
+ "type"
106
+ ],
107
+ "properties": {
108
+ "name": {
109
+ "type": "string"
110
+ },
111
+ "type": {
112
+ "type": "string"
113
+ },
114
+ "label": {
115
+ "type": "string"
116
+ },
117
+ "description": {
118
+ "type": "string"
119
+ },
120
+ "placeholder": {
121
+ "type": "string"
122
+ },
123
+ "defaultValue": {},
124
+ "dependencies": {
125
+ "type": "array",
126
+ "items": {
127
+ "$ref": "#/$defs/Dependency"
128
+ }
129
+ },
130
+ "rules": {
131
+ "$ref": "#/$defs/ValidationRules"
132
+ },
133
+ "options": {
134
+ "type": "array",
135
+ "items": {
136
+ "$ref": "#/$defs/Choice"
137
+ }
138
+ },
139
+ "props": {
140
+ "type": "object"
141
+ }
142
+ },
143
+ "additionalProperties": false
144
+ }
145
+ }
146
+ }