swoop-common 2.0.33 → 2.0.34

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,5 +1,4 @@
1
1
  import { JsonSchema } from "@jsonforms/core";
2
- import { FormBuilderSchema } from "../template/type";
3
2
  import { JsonSchemaWithXType } from "../../types/jsonSchema";
4
3
  export interface TemplateField {
5
4
  name: string;
@@ -8,4 +7,110 @@ export interface TemplateField {
8
7
  optionsRequired: boolean;
9
8
  schema: JsonSchemaWithXType;
10
9
  }
11
- export declare const FORM_BUILDER_JSON_SCHEMA: FormBuilderSchema;
10
+ export declare const FORM_BUILDER_JSON_SCHEMA: {
11
+ $schema: string;
12
+ type: string;
13
+ properties: {
14
+ name: {
15
+ type: string;
16
+ minLength: number;
17
+ description: string;
18
+ };
19
+ fields: {
20
+ type: string;
21
+ items: {
22
+ allOf: ({
23
+ $ref: string;
24
+ required?: undefined;
25
+ } | {
26
+ required: string[];
27
+ $ref?: undefined;
28
+ })[];
29
+ };
30
+ };
31
+ };
32
+ required: string[];
33
+ $defs: {
34
+ fieldDefinition: {
35
+ type: string;
36
+ properties: {
37
+ fieldType: {
38
+ oneOf: {
39
+ const: string;
40
+ title: string;
41
+ }[];
42
+ };
43
+ name: {
44
+ type: string;
45
+ minLength: number;
46
+ description: string;
47
+ };
48
+ description: {
49
+ type: string;
50
+ };
51
+ required: {
52
+ type: string;
53
+ default: boolean;
54
+ };
55
+ existsFrom: {
56
+ type: string;
57
+ oneOf: {
58
+ title: string;
59
+ const: string;
60
+ }[];
61
+ };
62
+ editableIn: {
63
+ type: string;
64
+ uniqueItems: boolean;
65
+ minItems: number;
66
+ items: {
67
+ type: string;
68
+ oneOf: {
69
+ title: string;
70
+ const: string;
71
+ }[];
72
+ };
73
+ };
74
+ };
75
+ required: string[];
76
+ dependencies: {
77
+ fieldType: {
78
+ oneOf: {
79
+ "x-type": string;
80
+ properties: {
81
+ required?: string[] | undefined;
82
+ fieldType: {
83
+ const: string;
84
+ };
85
+ };
86
+ }[];
87
+ };
88
+ };
89
+ };
90
+ arrayItemDefinition: {
91
+ type: string;
92
+ properties: {
93
+ fieldType: {
94
+ oneOf: {
95
+ const: string;
96
+ title: string;
97
+ }[];
98
+ };
99
+ };
100
+ required: string[];
101
+ dependencies: {
102
+ fieldType: {
103
+ oneOf: {
104
+ "x-type": string;
105
+ properties: {
106
+ required?: string[] | undefined;
107
+ fieldType: {
108
+ const: string;
109
+ };
110
+ };
111
+ }[];
112
+ };
113
+ };
114
+ };
115
+ };
116
+ };
@@ -23,7 +23,12 @@ export const FORM_BUILDER_JSON_SCHEMA = {
23
23
  },
24
24
  fields: {
25
25
  type: "array",
26
- items: { $ref: "#/$defs/fieldDefinition" },
26
+ items: {
27
+ allOf: [
28
+ { $ref: "#/$defs/fieldDefinition" },
29
+ { required: ["existsFrom", "editableIn"] } // Only top-level fields require these
30
+ ]
31
+ }
27
32
  },
28
33
  },
29
34
  required: ["name", "fields"],
@@ -37,21 +42,22 @@ export const FORM_BUILDER_JSON_SCHEMA = {
37
42
  minLength: 1,
38
43
  description: "Field name (used for both label and ID generation)",
39
44
  }, description: { type: "string" }, required: { type: "boolean", default: false }, existsFrom: {
40
- "type": "string",
41
- "oneOf": Object.keys(Stage).filter((k) => isNaN(+k)).map(s => ({ title: s, const: Stage[s] + "" }))
45
+ type: "string",
46
+ oneOf: Object.keys(Stage)
47
+ .filter((k) => isNaN(+k))
48
+ .map(s => ({ title: s, const: Stage[s] + "" }))
42
49
  }, editableIn: {
43
50
  type: "array",
44
51
  uniqueItems: true,
45
52
  minItems: 1,
46
53
  items: {
47
54
  type: "string",
48
- oneOf: Object.keys(Stage).filter((k) => isNaN(+k)).map(s => ({
49
- title: s,
50
- const: Stage[s] + ""
51
- }))
55
+ oneOf: Object.keys(Stage)
56
+ .filter((k) => isNaN(+k))
57
+ .map(s => ({ title: s, const: Stage[s] + "" }))
52
58
  }
53
59
  } }, fieldsToOptionsRecord),
54
- required: ["fieldType", "name", "existsFrom", "editableIn"],
60
+ required: ["fieldType", "name"], // removed existsFrom and editableIn
55
61
  dependencies: {
56
62
  fieldType: {
57
63
  oneOf: fieldsToTypeDef
@@ -63,7 +69,7 @@ export const FORM_BUILDER_JSON_SCHEMA = {
63
69
  properties: Object.assign({ fieldType: {
64
70
  oneOf: fieldsToConst
65
71
  } }, fieldsToOptionsRecord),
66
- required: ["fieldType"],
72
+ required: ["fieldType"], // only fieldType required
67
73
  dependencies: {
68
74
  fieldType: {
69
75
  oneOf: fieldsToTypeDef
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swoop-common",
3
- "version": "2.0.33",
3
+ "version": "2.0.34",
4
4
  "main": "dist/api/index.js",
5
5
  "types": "dist/api/index.d.ts",
6
6
  "exports": {