@cratis/components 4.27.0 → 4.29.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.
Files changed (81) hide show
  1. package/compat-manifest.json +11 -11
  2. package/dist/esm/SchemaEditor/SchemaEditor.d.ts +4 -1
  3. package/dist/esm/SchemaEditor/SchemaEditor.d.ts.map +1 -1
  4. package/dist/esm/SchemaEditor/SchemaEditor.js +3 -1
  5. package/dist/esm/SchemaEditor/SchemaEditor.js.map +1 -1
  6. package/dist/esm/SchemaEditor/SchemaEditorLabels.d.ts +6 -0
  7. package/dist/esm/SchemaEditor/SchemaEditorLabels.d.ts.map +1 -1
  8. package/dist/esm/SchemaEditor/SchemaEditorLabels.js.map +1 -1
  9. package/dist/esm/SchemaEditor/Tree/GeneratedToggle.d.ts +11 -0
  10. package/dist/esm/SchemaEditor/Tree/GeneratedToggle.d.ts.map +1 -0
  11. package/dist/esm/SchemaEditor/Tree/GeneratedToggle.js +24 -0
  12. package/dist/esm/SchemaEditor/Tree/GeneratedToggle.js.map +1 -0
  13. package/dist/esm/SchemaEditor/Tree/KeywordFamily.d.ts +14 -0
  14. package/dist/esm/SchemaEditor/Tree/KeywordFamily.d.ts.map +1 -0
  15. package/dist/esm/SchemaEditor/Tree/KeywordFamily.js +11 -0
  16. package/dist/esm/SchemaEditor/Tree/KeywordFamily.js.map +1 -0
  17. package/dist/esm/SchemaEditor/Tree/Property.d.ts +14 -0
  18. package/dist/esm/SchemaEditor/Tree/Property.d.ts.map +1 -1
  19. package/dist/esm/SchemaEditor/Tree/Property.js.map +1 -1
  20. package/dist/esm/SchemaEditor/Tree/SchemaEditorContext.d.ts +2 -0
  21. package/dist/esm/SchemaEditor/Tree/SchemaEditorContext.d.ts.map +1 -1
  22. package/dist/esm/SchemaEditor/Tree/SchemaEditorContext.js.map +1 -1
  23. package/dist/esm/SchemaEditor/Tree/SchemaEditorParts.d.ts +2 -0
  24. package/dist/esm/SchemaEditor/Tree/SchemaEditorParts.d.ts.map +1 -1
  25. package/dist/esm/SchemaEditor/Tree/SchemaEditorParts.js.map +1 -1
  26. package/dist/esm/SchemaEditor/Tree/SchemaOrderedProperty.d.ts +19 -0
  27. package/dist/esm/SchemaEditor/Tree/SchemaOrderedProperty.d.ts.map +1 -0
  28. package/dist/esm/SchemaEditor/Tree/SchemaOrderedProperty.js +15 -0
  29. package/dist/esm/SchemaEditor/Tree/SchemaOrderedProperty.js.map +1 -0
  30. package/dist/esm/SchemaEditor/Tree/SchemaOriginalShape.d.ts +21 -0
  31. package/dist/esm/SchemaEditor/Tree/SchemaOriginalShape.d.ts.map +1 -0
  32. package/dist/esm/SchemaEditor/Tree/SchemaOriginalShape.js +4 -0
  33. package/dist/esm/SchemaEditor/Tree/SchemaOriginalShape.js.map +1 -0
  34. package/dist/esm/SchemaEditor/Tree/SchemaPropertyRow.d.ts.map +1 -1
  35. package/dist/esm/SchemaEditor/Tree/SchemaPropertyRow.js +2 -2
  36. package/dist/esm/SchemaEditor/Tree/SchemaPropertyRow.js.map +1 -1
  37. package/dist/esm/SchemaEditor/Tree/TreeSchemaEditor.d.ts +8 -1
  38. package/dist/esm/SchemaEditor/Tree/TreeSchemaEditor.d.ts.map +1 -1
  39. package/dist/esm/SchemaEditor/Tree/TreeSchemaEditor.js +15 -11
  40. package/dist/esm/SchemaEditor/Tree/TreeSchemaEditor.js.map +1 -1
  41. package/dist/esm/SchemaEditor/Tree/keywordApplicability.d.ts +41 -0
  42. package/dist/esm/SchemaEditor/Tree/keywordApplicability.d.ts.map +1 -0
  43. package/dist/esm/SchemaEditor/Tree/keywordApplicability.js +56 -0
  44. package/dist/esm/SchemaEditor/Tree/keywordApplicability.js.map +1 -0
  45. package/dist/esm/SchemaEditor/Tree/originalShape.d.ts +30 -0
  46. package/dist/esm/SchemaEditor/Tree/originalShape.d.ts.map +1 -0
  47. package/dist/esm/SchemaEditor/Tree/originalShape.js +70 -0
  48. package/dist/esm/SchemaEditor/Tree/originalShape.js.map +1 -0
  49. package/dist/esm/SchemaEditor/Tree/schemaConversion.d.ts +17 -3
  50. package/dist/esm/SchemaEditor/Tree/schemaConversion.d.ts.map +1 -1
  51. package/dist/esm/SchemaEditor/Tree/schemaConversion.js +111 -55
  52. package/dist/esm/SchemaEditor/Tree/schemaConversion.js.map +1 -1
  53. package/dist/esm/SchemaEditor/Tree/schemaInOriginalOrder.d.ts +5 -0
  54. package/dist/esm/SchemaEditor/Tree/schemaInOriginalOrder.d.ts.map +1 -0
  55. package/dist/esm/SchemaEditor/Tree/schemaInOriginalOrder.js +10 -0
  56. package/dist/esm/SchemaEditor/Tree/schemaInOriginalOrder.js.map +1 -0
  57. package/dist/esm/SchemaEditor/Tree/schemaPropertyType.d.ts +11 -0
  58. package/dist/esm/SchemaEditor/Tree/schemaPropertyType.d.ts.map +1 -0
  59. package/dist/esm/SchemaEditor/Tree/schemaPropertyType.js +31 -0
  60. package/dist/esm/SchemaEditor/Tree/schemaPropertyType.js.map +1 -0
  61. package/dist/esm/SchemaEditor/Tree/standardKeywords.d.ts +18 -0
  62. package/dist/esm/SchemaEditor/Tree/standardKeywords.d.ts.map +1 -0
  63. package/dist/esm/SchemaEditor/Tree/standardKeywords.js +22 -0
  64. package/dist/esm/SchemaEditor/Tree/standardKeywords.js.map +1 -0
  65. package/dist/esm/SchemaEditor/defaultSchemaEditorLabels.d.ts.map +1 -1
  66. package/dist/esm/SchemaEditor/defaultSchemaEditorLabels.js +3 -0
  67. package/dist/esm/SchemaEditor/defaultSchemaEditorLabels.js.map +1 -1
  68. package/dist/esm/SchemaEditor/index.d.ts +1 -1
  69. package/dist/esm/SchemaEditor/index.d.ts.map +1 -1
  70. package/dist/esm/SchemaEditor/index.js +1 -1
  71. package/dist/esm/SchemaEditor/schemaHelpers.d.ts +9 -0
  72. package/dist/esm/SchemaEditor/schemaHelpers.d.ts.map +1 -1
  73. package/dist/esm/SchemaEditor/schemaHelpers.js +20 -1
  74. package/dist/esm/SchemaEditor/schemaHelpers.js.map +1 -1
  75. package/dist/esm/styles.SchemaEditor.css +7 -10
  76. package/dist/esm/styles.css +7 -10
  77. package/dist/esm/types/parts.d.ts +2 -1
  78. package/dist/esm/types/parts.d.ts.map +1 -1
  79. package/dist/esm/types/parts.js +2 -1
  80. package/dist/esm/types/parts.js.map +1 -1
  81. package/package.json +1 -1
@@ -1,63 +1,82 @@
1
1
  import { PropertyType } from './PropertyType.js';
2
2
  import { uniquePropertyName, conceptPropertyName } from './propertyNaming.js';
3
3
  import { findPropertyById } from './propertyTree.js';
4
+ import { keywordsAfterTypeChange, propertyTypeFamily } from './keywordApplicability.js';
5
+ import { copySchemaKeywordOrder, schemaOriginalShape, schemaKeywordOrder, itemSchemaKeywordOrder, schemaRequiredOrder } from './SchemaOrderedProperty.js';
6
+ import { readOriginalShape, isNode, readRequiredOrder, restoreOriginalShape } from './originalShape.js';
7
+ import { schemaPropertyType } from './schemaPropertyType.js';
8
+ import { standardPropertyKeywords, standardItemKeywords } from './standardKeywords.js';
9
+ import { schemaInOriginalOrder, requiredInOriginalOrder } from './schemaInOriginalOrder.js';
4
10
 
5
11
  const CONCEPT_KEYWORD = 'x-concept';
6
12
  const KEY_KEYWORD = 'x-key';
13
+ const GENERATED_KEYWORD = 'x-generated';
7
14
  const isComplex = (type) => type === PropertyType.Object || type === PropertyType.ObjectArray;
8
15
  const identifier = () => Math.random().toString(36).slice(2, 10) + Math.random().toString(36).slice(2, 6);
9
- function schemaPropertyType(value) {
10
- const items = value.items;
11
- switch (value.type) {
12
- case 'string':
13
- if (value.format === 'date')
14
- return PropertyType.Date;
15
- if (value.format === 'time')
16
- return PropertyType.Time;
17
- return PropertyType.String;
18
- case 'number':
19
- case 'integer':
20
- return PropertyType.Number;
21
- case 'boolean':
22
- return PropertyType.Boolean;
23
- case 'object':
24
- return PropertyType.Object;
25
- case 'array':
26
- if (items?.type === 'number' || items?.type === 'integer')
27
- return PropertyType.NumberArray;
28
- if (items?.type === 'object')
29
- return PropertyType.ObjectArray;
30
- return PropertyType.StringArray;
31
- default:
32
- return PropertyType.String;
33
- }
16
+ function vendorKeywords(node, isProperty) {
17
+ const entries = Object.entries(node).filter(([name, value]) => {
18
+ if (!name.startsWith('x-'))
19
+ return false;
20
+ if (!isProperty)
21
+ return true;
22
+ return name !== CONCEPT_KEYWORD && name !== KEY_KEYWORD && !(name === GENERATED_KEYWORD && value === true);
23
+ });
24
+ return entries.length > 0 ? Object.fromEntries(entries) : undefined;
25
+ }
26
+ function readItemKeywords(node, type) {
27
+ if (node.type !== 'array' || !isNode(node.items))
28
+ return {};
29
+ const items = node.items;
30
+ const keywords = vendorKeywords(items, false);
31
+ const standard = standardItemKeywords(items, type);
32
+ return {
33
+ [itemSchemaKeywordOrder]: Object.keys(items),
34
+ ...(keywords ? { itemVendorKeywords: keywords } : {}),
35
+ ...(standard ? { itemSchemaKeywords: standard } : {}),
36
+ };
37
+ }
38
+ function requiredOrder(node, type) {
39
+ const order = readRequiredOrder(node, type);
40
+ return order ? { [schemaRequiredOrder]: order } : {};
41
+ }
42
+ function readFlags(node, type, isRequired) {
43
+ const keywords = vendorKeywords(node, true);
44
+ const standard = standardPropertyKeywords(node, type);
45
+ return {
46
+ [schemaKeywordOrder]: Object.keys(node),
47
+ [schemaOriginalShape]: readOriginalShape(node, type),
48
+ ...requiredOrder(node, type),
49
+ ...readItemKeywords(node, type),
50
+ ...(keywords ? { vendorKeywords: keywords } : {}),
51
+ ...(standard ? { schemaKeywords: standard } : {}),
52
+ ...(node[GENERATED_KEYWORD] === true ? { isGenerated: true } : {}),
53
+ ...(isRequired ? { isRequired: true } : {}),
54
+ ...(node[KEY_KEYWORD] === true ? { isKey: true } : {}),
55
+ };
34
56
  }
35
57
  function schemaPropertyToProperty(name, value, required) {
36
58
  const node = value;
37
59
  const type = schemaPropertyType(node);
38
60
  const concept = node[CONCEPT_KEYWORD];
39
- const flags = {
40
- ...(required.has(name) ? { isRequired: true } : {}),
41
- ...(node[KEY_KEYWORD] === true ? { isKey: true } : {}),
42
- };
61
+ const flags = readFlags(node, type, required.has(name));
43
62
  const container = (type === PropertyType.Object ? node : type === PropertyType.ObjectArray ? node.items : undefined);
44
63
  if (container?.properties) {
45
64
  const childRequired = new Set(container.required ?? []);
46
- return {
65
+ return copySchemaKeywordOrder(flags, {
47
66
  id: identifier(),
48
67
  name,
49
68
  type,
50
69
  ...flags,
51
70
  children: Object.entries(container.properties).map(([childName, child]) => schemaPropertyToProperty(childName, child, childRequired)),
52
- };
71
+ });
53
72
  }
54
- return {
73
+ return copySchemaKeywordOrder(flags, {
55
74
  id: identifier(),
56
75
  name,
57
76
  type,
58
77
  ...flags,
59
78
  ...(typeof concept === 'string' && concept.length > 0 ? { concept } : {}),
60
- };
79
+ });
61
80
  }
62
81
  function jsonSchemaToProperties(schema) {
63
82
  if (!schema?.properties)
@@ -65,6 +84,9 @@ function jsonSchemaToProperties(schema) {
65
84
  const required = new Set(schema.required ?? []);
66
85
  return Object.entries(schema.properties).map(([name, value]) => schemaPropertyToProperty(name, value, required));
67
86
  }
87
+ function itemSchema(property, type, extra = {}) {
88
+ return { ...property.itemSchemaKeywords, type, ...extra, ...property.itemVendorKeywords };
89
+ }
68
90
  function primitiveSchema(property) {
69
91
  switch (property.type) {
70
92
  case PropertyType.Number:
@@ -76,34 +98,45 @@ function primitiveSchema(property) {
76
98
  case PropertyType.Time:
77
99
  return { type: 'string', format: 'time' };
78
100
  case PropertyType.Object:
79
- return { type: 'object', ...objectSchema(property.children ?? []) };
101
+ return { type: 'object', ...objectSchema(property.children ?? [], property[schemaRequiredOrder]) };
80
102
  case PropertyType.StringArray:
81
- return { type: 'array', items: { type: 'string' } };
103
+ return { type: 'array', items: itemSchema(property, 'string') };
82
104
  case PropertyType.NumberArray:
83
- return { type: 'array', items: { type: 'number' } };
105
+ return { type: 'array', items: itemSchema(property, 'number') };
84
106
  case PropertyType.ObjectArray:
85
- return { type: 'array', items: { type: 'object', ...objectSchema(property.children ?? []) } };
107
+ return { type: 'array', items: itemSchema(property, 'object', objectSchema(property.children ?? [], property[schemaRequiredOrder])) };
86
108
  default:
87
109
  return { type: 'string' };
88
110
  }
89
111
  }
90
- function propertySchema(property) {
112
+ function orderedPrimitiveSchema(property) {
113
+ const schema = restoreOriginalShape({ ...property.schemaKeywords, ...primitiveSchema(property) }, property);
114
+ if (isNode(schema.items))
115
+ schema.items = schemaInOriginalOrder(schema.items, property[itemSchemaKeywordOrder]);
116
+ return schema;
117
+ }
118
+ function propertyAnnotations(property) {
91
119
  return {
92
- ...primitiveSchema(property),
120
+ ...property.vendorKeywords,
121
+ ...(property.isGenerated === true ? { [GENERATED_KEYWORD]: true } : {}),
93
122
  ...(property.concept ? { [CONCEPT_KEYWORD]: property.concept } : {}),
94
123
  ...(property.isKey === true ? { [KEY_KEYWORD]: true } : {}),
95
124
  };
96
125
  }
97
- function objectSchema(properties) {
126
+ function propertySchema(property) {
127
+ return schemaInOriginalOrder({ ...orderedPrimitiveSchema(property), ...propertyAnnotations(property) }, property[schemaKeywordOrder]);
128
+ }
129
+ function objectSchema(properties, requiredOrder) {
98
130
  const schemaProperties = {};
99
131
  for (const property of properties) {
100
132
  schemaProperties[property.name] = propertySchema(property);
101
133
  }
102
- const required = properties.filter(property => property.isRequired === true).map(property => property.name);
134
+ const required = requiredInOriginalOrder(properties.filter(property => property.isRequired === true).map(property => property.name), requiredOrder);
103
135
  return { properties: schemaProperties, ...(required.length > 0 ? { required } : {}) };
104
136
  }
105
- function propertiesToJsonSchema(properties) {
106
- return { type: 'object', ...objectSchema(properties) };
137
+ function propertiesToJsonSchema(properties, base = {}) {
138
+ const root = Object.fromEntries(Object.entries(base).filter(([name]) => !['properties', 'required'].includes(name)));
139
+ return schemaInOriginalOrder({ ...root, type: 'object', ...objectSchema(properties, base.required) }, Object.keys(base));
107
140
  }
108
141
  function newProperty(siblings, type, existingCount, concept) {
109
142
  const base = isComplex(type) ? 'nested' : 'property';
@@ -124,48 +157,71 @@ function addChildProperty(properties, parentId, type, existingCount, concept) {
124
157
  const child = newProperty(siblings, type, existingCount, concept);
125
158
  const insert = (level) => level.map(property => {
126
159
  if (property.id === parentId)
127
- return { ...property, children: [...(property.children ?? []), child] };
128
- return property.children ? { ...property, children: insert(property.children) } : property;
160
+ return copySchemaKeywordOrder(property, { ...property, children: [...(property.children ?? []), child] });
161
+ return property.children ? copySchemaKeywordOrder(property, { ...property, children: insert(property.children) }) : property;
129
162
  });
130
163
  return insert(properties);
131
164
  }
132
165
  function removeProperty(properties, targetId) {
133
166
  return properties
134
167
  .filter(property => property.id !== targetId)
135
- .map(property => property.children ? { ...property, children: removeProperty(property.children, targetId) } : property);
168
+ .map(property => property.children ? copySchemaKeywordOrder(property, { ...property, children: removeProperty(property.children, targetId) }) : property);
136
169
  }
137
170
  function updateProperty(properties, targetId, update) {
138
171
  return properties.map(property => {
139
172
  if (property.id === targetId)
140
173
  return update(property);
141
- return property.children ? { ...property, children: updateProperty(property.children, targetId, update) } : property;
174
+ return property.children ? copySchemaKeywordOrder(property, { ...property, children: updateProperty(property.children, targetId, update) }) : property;
142
175
  });
143
176
  }
144
177
  function renameProperty(properties, targetId, newName) {
145
- return updateProperty(properties, targetId, property => ({ ...property, name: newName }));
178
+ return updateProperty(properties, targetId, property => copySchemaKeywordOrder(property, { ...property, name: newName }));
146
179
  }
147
- function changePropertyType(properties, targetId, newType, concept) {
148
- return updateProperty(properties, targetId, property => ({
180
+ function retypedProperty(property, newType, concept) {
181
+ const next = copySchemaKeywordOrder(property, {
149
182
  ...property,
150
183
  type: newType,
151
184
  concept,
152
185
  children: isComplex(newType) ? (property.children ?? []) : undefined,
153
- }));
186
+ });
187
+ if (property.type !== newType) {
188
+ const kept = keywordsAfterTypeChange(property.schemaKeywords ?? {}, propertyTypeFamily(property.type), propertyTypeFamily(newType));
189
+ delete next.schemaKeywords;
190
+ if (Object.keys(kept).length > 0)
191
+ next.schemaKeywords = kept;
192
+ delete next.itemVendorKeywords;
193
+ delete next.itemSchemaKeywords;
194
+ delete next[itemSchemaKeywordOrder];
195
+ delete next[schemaOriginalShape];
196
+ }
197
+ return next;
198
+ }
199
+ function changePropertyType(properties, targetId, newType, concept) {
200
+ return updateProperty(properties, targetId, property => retypedProperty(property, newType, concept));
154
201
  }
155
202
  function toggleRequiredProperty(properties, targetId) {
156
- return updateProperty(properties, targetId, property => ({ ...property, isRequired: !property.isRequired || undefined }));
203
+ return updateProperty(properties, targetId, property => copySchemaKeywordOrder(property, { ...property, isRequired: !property.isRequired || undefined }));
157
204
  }
158
205
  function setRequiredProperty(properties, targetId, isRequired) {
159
- return updateProperty(properties, targetId, property => ({ ...property, isRequired }));
206
+ return updateProperty(properties, targetId, property => copySchemaKeywordOrder(property, { ...property, isRequired }));
207
+ }
208
+ function setGeneratedProperty(properties, targetId, isGenerated) {
209
+ return updateProperty(properties, targetId, property => {
210
+ const keywords = Object.fromEntries(Object.entries(property.vendorKeywords ?? {}).filter(([name]) => name !== GENERATED_KEYWORD));
211
+ const next = { ...property };
212
+ delete next.isGenerated;
213
+ delete next.vendorKeywords;
214
+ return copySchemaKeywordOrder(property, { ...next, ...(isGenerated ? { isGenerated: true } : {}), ...(Object.keys(keywords).length > 0 ? { vendorKeywords: keywords } : {}) });
215
+ });
160
216
  }
161
217
  function setKeyProperty(properties, targetId) {
162
218
  const target = properties.find(property => property.id === targetId);
163
- return properties.map(property => ({
219
+ return properties.map(property => copySchemaKeywordOrder(property, {
164
220
  ...property,
165
221
  ...(target ? { isKey: property.id === targetId && target.isKey !== true ? true : undefined } : {}),
166
222
  ...(property.children ? { children: setKeyProperty(property.children, targetId) } : {}),
167
223
  }));
168
224
  }
169
225
 
170
- export { CONCEPT_KEYWORD, KEY_KEYWORD, addChildProperty, addProperty, changePropertyType, jsonSchemaToProperties, propertiesToJsonSchema, removeProperty, renameProperty, setKeyProperty, setRequiredProperty, toggleRequiredProperty };
226
+ export { CONCEPT_KEYWORD, GENERATED_KEYWORD, KEY_KEYWORD, addChildProperty, addProperty, changePropertyType, jsonSchemaToProperties, propertiesToJsonSchema, removeProperty, renameProperty, setGeneratedProperty, setKeyProperty, setRequiredProperty, toggleRequiredProperty };
171
227
  //# sourceMappingURL=schemaConversion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemaConversion.js","sources":["../../../../SchemaEditor/Tree/schemaConversion.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { JsonSchema, JsonSchemaProperty } from '../../types/JsonSchema';\nimport type { Property } from './Property';\nimport { PropertyType } from './PropertyType';\nimport { conceptPropertyName, uniquePropertyName } from './propertyNaming';\nimport { findPropertyById } from './propertyTree';\n\n/**\n * The JSON Schema keyword carrying the concept a property is typed as. It annotates the primitive node the\n * concept wraps rather than replacing it, so anything that does not know about concepts — code generation,\n * an export, another tool — still reads a valid schema of the underlying primitive.\n */\nexport const CONCEPT_KEYWORD = 'x-concept';\n\n/**\n * The JSON Schema keyword marking the property that identifies its parent object. Written as `true` on the\n * property; at most one property of an object carries it.\n */\nexport const KEY_KEYWORD = 'x-key';\n\ntype SchemaNode = Record<string, unknown>;\n\nconst isComplex = (type: PropertyType): boolean => type === PropertyType.Object || type === PropertyType.ObjectArray;\n\nconst identifier = (): string => Math.random().toString(36).slice(2, 10) + Math.random().toString(36).slice(2, 6);\n\n// ── JsonSchema → Property[] ─────────────────────────────────────────\n\nfunction schemaPropertyType(value: SchemaNode): PropertyType {\n const items = value.items as { type?: string } | undefined;\n\n switch (value.type) {\n case 'string':\n if (value.format === 'date') return PropertyType.Date;\n if (value.format === 'time') return PropertyType.Time;\n return PropertyType.String;\n case 'number':\n case 'integer':\n return PropertyType.Number;\n case 'boolean':\n return PropertyType.Boolean;\n case 'object':\n return PropertyType.Object;\n case 'array':\n if (items?.type === 'number' || items?.type === 'integer') return PropertyType.NumberArray;\n if (items?.type === 'object') return PropertyType.ObjectArray;\n return PropertyType.StringArray;\n default:\n return PropertyType.String;\n }\n}\n\nfunction schemaPropertyToProperty(name: string, value: JsonSchemaProperty, required: ReadonlySet<string>): Property {\n const node = value as unknown as SchemaNode;\n const type = schemaPropertyType(node);\n const concept = node[CONCEPT_KEYWORD];\n const flags = {\n ...(required.has(name) ? { isRequired: true } : {}),\n ...(node[KEY_KEYWORD] === true ? { isKey: true } : {}),\n };\n\n const container = (type === PropertyType.Object ? node : type === PropertyType.ObjectArray ? node.items : undefined) as\n | { properties?: Record<string, JsonSchemaProperty>; required?: string[] }\n | undefined;\n\n if (container?.properties) {\n const childRequired = new Set(container.required ?? []);\n return {\n id: identifier(),\n name,\n type,\n ...flags,\n children: Object.entries(container.properties).map(([childName, child]) =>\n schemaPropertyToProperty(childName, child, childRequired)),\n };\n }\n\n return {\n id: identifier(),\n name,\n type,\n ...flags,\n ...(typeof concept === 'string' && concept.length > 0 ? { concept } : {}),\n };\n}\n\n/**\n * Converts a JSON Schema object into a property tree. Generates a new id for every property.\n * @param schema The schema to read; `undefined` and schemas without properties give an empty tree.\n * @returns The root properties.\n */\nexport function jsonSchemaToProperties(schema: JsonSchema | undefined): Property[] {\n if (!schema?.properties) return [];\n const required = new Set(schema.required ?? []);\n return Object.entries(schema.properties).map(([name, value]) => schemaPropertyToProperty(name, value, required));\n}\n\n// ── Property[] → JsonSchema ─────────────────────────────────────────\n\nfunction primitiveSchema(property: Property): SchemaNode {\n switch (property.type) {\n case PropertyType.Number:\n return { type: 'number' };\n case PropertyType.Boolean:\n return { type: 'boolean' };\n case PropertyType.Date:\n return { type: 'string', format: 'date' };\n case PropertyType.Time:\n return { type: 'string', format: 'time' };\n case PropertyType.Object:\n return { type: 'object', ...objectSchema(property.children ?? []) };\n case PropertyType.StringArray:\n return { type: 'array', items: { type: 'string' } };\n case PropertyType.NumberArray:\n return { type: 'array', items: { type: 'number' } };\n case PropertyType.ObjectArray:\n return { type: 'array', items: { type: 'object', ...objectSchema(property.children ?? []) } };\n default:\n return { type: 'string' };\n }\n}\n\nfunction propertySchema(property: Property): JsonSchemaProperty {\n return {\n ...primitiveSchema(property),\n ...(property.concept ? { [CONCEPT_KEYWORD]: property.concept } : {}),\n ...(property.isKey === true ? { [KEY_KEYWORD]: true } : {}),\n } as unknown as JsonSchemaProperty;\n}\n\nfunction objectSchema(properties: Property[]): { properties: Record<string, JsonSchemaProperty>; required?: string[] } {\n const schemaProperties: Record<string, JsonSchemaProperty> = {};\n for (const property of properties) {\n schemaProperties[property.name] = propertySchema(property);\n }\n const required = properties.filter(property => property.isRequired === true).map(property => property.name);\n return { properties: schemaProperties, ...(required.length > 0 ? { required } : {}) };\n}\n\n/**\n * Converts a property tree into a JSON Schema object. Empty `required` lists are omitted, and a property\n * typed as a concept or marked as the key carries the `x-concept` and `x-key` keywords.\n * @param properties The root properties.\n * @returns The schema.\n */\nexport function propertiesToJsonSchema(properties: Property[]): JsonSchema {\n return { type: 'object', ...objectSchema(properties) } as JsonSchema;\n}\n\n// ── Pure tree edits ─────────────────────────────────────────────────\n\nfunction newProperty(siblings: Property[], type: PropertyType, existingCount: number, concept?: string): Property {\n const base = isComplex(type) ? 'nested' : 'property';\n const name = concept ? uniquePropertyName(siblings, conceptPropertyName(concept)) : `${base}${existingCount + 1}`;\n\n return {\n id: identifier(),\n name,\n type,\n ...(concept ? { concept } : {}),\n ...(isComplex(type) ? { children: [] } : {}),\n };\n}\n\n/**\n * Appends a property to the root.\n * @param properties The root properties.\n * @param type The type of the new property.\n * @param existingCount The number of properties already in the tree, used to generate the default name; see {@link totalPropertyCount}.\n * @param concept The concept the property is typed as. When given the property is named after it.\n * @returns The new tree.\n */\nexport function addProperty(properties: Property[], type: PropertyType, existingCount: number, concept?: string): Property[] {\n return [...properties, newProperty(properties, type, existingCount, concept)];\n}\n\n/**\n * Appends a property to a nested object or object list.\n * @param properties The root properties.\n * @param parentId The id of the parent property.\n * @param type The type of the new property.\n * @param existingCount The number of properties already in the tree, used to generate the default name.\n * @param concept The concept the property is typed as.\n * @returns The new tree.\n */\nexport function addChildProperty(\n properties: Property[],\n parentId: string,\n type: PropertyType,\n existingCount: number,\n concept?: string,\n): Property[] {\n const siblings = findPropertyById(properties, parentId)?.children ?? [];\n const child = newProperty(siblings, type, existingCount, concept);\n const insert = (level: Property[]): Property[] => level.map(property => {\n if (property.id === parentId) return { ...property, children: [...(property.children ?? []), child] };\n return property.children ? { ...property, children: insert(property.children) } : property;\n });\n return insert(properties);\n}\n\n/**\n * Removes a property, and everything nested under it.\n * @param properties The root properties.\n * @param targetId The id of the property to remove.\n * @returns The new tree.\n */\nexport function removeProperty(properties: Property[], targetId: string): Property[] {\n return properties\n .filter(property => property.id !== targetId)\n .map(property => property.children ? { ...property, children: removeProperty(property.children, targetId) } : property);\n}\n\nfunction updateProperty(properties: Property[], targetId: string, update: (property: Property) => Property): Property[] {\n return properties.map(property => {\n if (property.id === targetId) return update(property);\n return property.children ? { ...property, children: updateProperty(property.children, targetId, update) } : property;\n });\n}\n\n/**\n * Renames a property. Its requiredness travels with it, because both are stored against the property.\n * @param properties The root properties.\n * @param targetId The id of the property to rename.\n * @param newName The new name.\n * @returns The new tree.\n */\nexport function renameProperty(properties: Property[], targetId: string, newName: string): Property[] {\n return updateProperty(properties, targetId, property => ({ ...property, name: newName }));\n}\n\n/**\n * Changes the type of a property. Choosing a plain primitive drops the concept; choosing an object or\n * object list keeps the children, and any other type drops them.\n * @param properties The root properties.\n * @param targetId The id of the property.\n * @param newType The new type.\n * @param concept The concept the property is now typed as, if any.\n * @returns The new tree.\n */\nexport function changePropertyType(properties: Property[], targetId: string, newType: PropertyType, concept?: string): Property[] {\n return updateProperty(properties, targetId, property => ({\n ...property,\n type: newType,\n concept,\n children: isComplex(newType) ? (property.children ?? []) : undefined,\n }));\n}\n\n/**\n * Flips whether a property is required.\n * @param properties The root properties.\n * @param targetId The id of the property.\n * @returns The new tree.\n */\nexport function toggleRequiredProperty(properties: Property[], targetId: string): Property[] {\n return updateProperty(properties, targetId, property => ({ ...property, isRequired: !property.isRequired || undefined }));\n}\n\n/**\n * Sets whether a property is required. Requiring a nested property does not require its parent.\n * @param properties The root properties.\n * @param targetId The id of the property.\n * @param isRequired Whether the property must be present.\n * @returns The new tree.\n */\nexport function setRequiredProperty(properties: Property[], targetId: string, isRequired: boolean): Property[] {\n return updateProperty(properties, targetId, property => ({ ...property, isRequired }));\n}\n\n/**\n * Makes a property the key of its parent object, moving the key when a sibling held it. Choosing the\n * property that already is the key clears it, so an object can also have no key.\n * @param properties The root properties.\n * @param targetId The id of the property.\n * @returns The new tree.\n */\nexport function setKeyProperty(properties: Property[], targetId: string): Property[] {\n const target = properties.find(property => property.id === targetId);\n return properties.map(property => ({\n ...property,\n ...(target ? { isKey: property.id === targetId && target.isKey !== true ? true : undefined } : {}),\n ...(property.children ? { children: setKeyProperty(property.children, targetId) } : {}),\n }));\n}\n"],"names":[],"mappings":";;;;AAcO,MAAM,eAAe,GAAG;AAMxB,MAAM,WAAW,GAAG;AAI3B,MAAM,SAAS,GAAG,CAAC,IAAkB,KAAc,IAAI,KAAK,YAAY,CAAC,MAAM,IAAI,IAAI,KAAK,YAAY,CAAC,WAAW;AAEpH,MAAM,UAAU,GAAG,MAAc,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;AAIjH,SAAS,kBAAkB,CAAC,KAAiB,EAAA;AACzC,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,KAAsC;AAE1D,IAAA,QAAQ,KAAK,CAAC,IAAI;AACd,QAAA,KAAK,QAAQ;AACT,YAAA,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM;gBAAE,OAAO,YAAY,CAAC,IAAI;AACrD,YAAA,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM;gBAAE,OAAO,YAAY,CAAC,IAAI;YACrD,OAAO,YAAY,CAAC,MAAM;AAC9B,QAAA,KAA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AAK,QAAQ,CAAC;IACpE,OAAO,UAAU,CAAC,GAAG,CAAC,QAAQ,KAAK;AAC/B,QAAA,GAAG,QAAQ;AACX,QAAA,IAAI,MAAM,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,EAAE,CAAC;QAClG,IAAI,QAAQ,CAAC,QAAQ,GAAG,EAAE,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;AAC1F,KAAA,CAAC,CAAC;AACP;;"}
1
+ {"version":3,"file":"schemaConversion.js","sources":["../../../../SchemaEditor/Tree/schemaConversion.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { JsonSchema, JsonSchemaProperty } from '../../types/JsonSchema';\nimport type { Property } from './Property';\nimport { PropertyType } from './PropertyType';\nimport { conceptPropertyName, uniquePropertyName } from './propertyNaming';\nimport { findPropertyById } from './propertyTree';\nimport { keywordsAfterTypeChange, propertyTypeFamily } from './keywordApplicability';\nimport {\n copySchemaKeywordOrder,\n itemSchemaKeywordOrder,\n schemaKeywordOrder,\n schemaOriginalShape,\n schemaRequiredOrder,\n type SchemaOrderedProperty,\n} from './SchemaOrderedProperty';\nimport { isNode, readOriginalShape, readRequiredOrder, restoreOriginalShape } from './originalShape';\nimport { schemaPropertyType } from './schemaPropertyType';\nimport { standardItemKeywords, standardPropertyKeywords } from './standardKeywords';\nimport { requiredInOriginalOrder, schemaInOriginalOrder } from './schemaInOriginalOrder';\n\n/**\n * The JSON Schema keyword carrying the concept a property is typed as. It annotates the primitive node the\n * concept wraps rather than replacing it, so anything that does not know about concepts — code generation,\n * an export, another tool — still reads a valid schema of the underlying primitive.\n */\nexport const CONCEPT_KEYWORD = 'x-concept';\n\n/**\n * The JSON Schema keyword marking the property that identifies its parent object. Written as `true` on the\n * property; at most one property of an object carries it.\n */\nexport const KEY_KEYWORD = 'x-key';\n\n/** The JSON Schema keyword marking a value generated when the command runs rather than entered. */\nexport const GENERATED_KEYWORD = 'x-generated';\n\ntype SchemaNode = Record<string, unknown>;\n\nconst isComplex = (type: PropertyType): boolean => type === PropertyType.Object || type === PropertyType.ObjectArray;\n\nconst identifier = (): string => Math.random().toString(36).slice(2, 10) + Math.random().toString(36).slice(2, 6);\n\n// ── JsonSchema → Property[] ─────────────────────────────────────────\n\nfunction vendorKeywords(node: SchemaNode, isProperty: boolean): Readonly<Record<string, unknown>> | undefined {\n const entries = Object.entries(node).filter(([name, value]) => {\n if (!name.startsWith('x-')) return false;\n if (!isProperty) return true;\n return name !== CONCEPT_KEYWORD && name !== KEY_KEYWORD && !(name === GENERATED_KEYWORD && value === true);\n });\n return entries.length > 0 ? Object.fromEntries(entries) : undefined;\n}\n\nfunction readItemKeywords(node: SchemaNode, type: PropertyType): Partial<SchemaOrderedProperty> {\n if (node.type !== 'array' || !isNode(node.items)) return {};\n const items = node.items;\n const keywords = vendorKeywords(items, false);\n const standard = standardItemKeywords(items, type);\n return {\n [itemSchemaKeywordOrder]: Object.keys(items),\n ...(keywords ? { itemVendorKeywords: keywords } : {}),\n ...(standard ? { itemSchemaKeywords: standard } : {}),\n };\n}\n\nfunction requiredOrder(node: SchemaNode, type: PropertyType): Partial<SchemaOrderedProperty> {\n const order = readRequiredOrder(node, type);\n return order ? { [schemaRequiredOrder]: order } : {};\n}\n\nfunction readFlags(node: SchemaNode, type: PropertyType, isRequired: boolean): Partial<SchemaOrderedProperty> {\n const keywords = vendorKeywords(node, true);\n const standard = standardPropertyKeywords(node, type);\n return {\n [schemaKeywordOrder]: Object.keys(node),\n [schemaOriginalShape]: readOriginalShape(node, type),\n ...requiredOrder(node, type),\n ...readItemKeywords(node, type),\n ...(keywords ? { vendorKeywords: keywords } : {}),\n ...(standard ? { schemaKeywords: standard } : {}),\n ...(node[GENERATED_KEYWORD] === true ? { isGenerated: true } : {}),\n ...(isRequired ? { isRequired: true } : {}),\n ...(node[KEY_KEYWORD] === true ? { isKey: true } : {}),\n };\n}\n\nfunction schemaPropertyToProperty(name: string, value: JsonSchemaProperty, required: ReadonlySet<string>): Property {\n const node = value as unknown as SchemaNode;\n const type = schemaPropertyType(node);\n const concept = node[CONCEPT_KEYWORD];\n const flags = readFlags(node, type, required.has(name));\n\n const container = (type === PropertyType.Object ? node : type === PropertyType.ObjectArray ? node.items : undefined) as\n | { properties?: Record<string, JsonSchemaProperty>; required?: string[] }\n | undefined;\n\n if (container?.properties) {\n const childRequired = new Set(container.required ?? []);\n return copySchemaKeywordOrder(flags, {\n id: identifier(),\n name,\n type,\n ...flags,\n children: Object.entries(container.properties).map(([childName, child]) =>\n schemaPropertyToProperty(childName, child, childRequired)),\n });\n }\n\n return copySchemaKeywordOrder(flags, {\n id: identifier(),\n name,\n type,\n ...flags,\n ...(typeof concept === 'string' && concept.length > 0 ? { concept } : {}),\n });\n}\n\n/**\n * Converts a JSON Schema object into a property tree. Generates a new id for every property.\n * @param schema The schema to read; `undefined` and schemas without properties give an empty tree.\n * @returns The root properties.\n */\nexport function jsonSchemaToProperties(schema: JsonSchema | undefined): Property[] {\n if (!schema?.properties) return [];\n const required = new Set(schema.required ?? []);\n return Object.entries(schema.properties).map(([name, value]) => schemaPropertyToProperty(name, value, required));\n}\n\n// ── Property[] → JsonSchema ─────────────────────────────────────────\n\nfunction itemSchema(property: Property, type: string, extra: SchemaNode = {}): SchemaNode {\n return { ...property.itemSchemaKeywords, type, ...extra, ...property.itemVendorKeywords };\n}\n\nfunction primitiveSchema(property: Property): SchemaNode {\n switch (property.type) {\n case PropertyType.Number:\n return { type: 'number' };\n case PropertyType.Boolean:\n return { type: 'boolean' };\n case PropertyType.Date:\n return { type: 'string', format: 'date' };\n case PropertyType.Time:\n return { type: 'string', format: 'time' };\n case PropertyType.Object:\n return { type: 'object', ...objectSchema(property.children ?? [], (property as SchemaOrderedProperty)[schemaRequiredOrder]) };\n case PropertyType.StringArray:\n return { type: 'array', items: itemSchema(property, 'string') };\n case PropertyType.NumberArray:\n return { type: 'array', items: itemSchema(property, 'number') };\n case PropertyType.ObjectArray:\n return { type: 'array', items: itemSchema(property, 'object', objectSchema(property.children ?? [], (property as SchemaOrderedProperty)[schemaRequiredOrder])) };\n default:\n return { type: 'string' };\n }\n}\n\nfunction orderedPrimitiveSchema(property: SchemaOrderedProperty): SchemaNode {\n const schema = restoreOriginalShape({ ...property.schemaKeywords, ...primitiveSchema(property) }, property);\n if (isNode(schema.items)) schema.items = schemaInOriginalOrder(schema.items as SchemaNode, property[itemSchemaKeywordOrder]);\n return schema;\n}\n\nfunction propertyAnnotations(property: Property): SchemaNode {\n return {\n ...property.vendorKeywords,\n ...(property.isGenerated === true ? { [GENERATED_KEYWORD]: true } : {}),\n ...(property.concept ? { [CONCEPT_KEYWORD]: property.concept } : {}),\n ...(property.isKey === true ? { [KEY_KEYWORD]: true } : {}),\n };\n}\n\nfunction propertySchema(property: SchemaOrderedProperty): JsonSchemaProperty {\n return schemaInOriginalOrder({ ...orderedPrimitiveSchema(property), ...propertyAnnotations(property) }, property[schemaKeywordOrder]) as unknown as JsonSchemaProperty;\n}\n\nfunction objectSchema(properties: Property[], requiredOrder?: readonly string[]): { properties: Record<string, JsonSchemaProperty>; required?: string[] } {\n const schemaProperties: Record<string, JsonSchemaProperty> = {};\n for (const property of properties) {\n schemaProperties[property.name] = propertySchema(property);\n }\n const required = requiredInOriginalOrder(properties.filter(property => property.isRequired === true).map(property => property.name), requiredOrder);\n return { properties: schemaProperties, ...(required.length > 0 ? { required } : {}) };\n}\n\n/**\n * Converts a property tree into a JSON Schema object. Empty `required` lists are omitted, and a property\n * typed as a concept or marked as the key carries the `x-concept` and `x-key` keywords. Vendor keywords and the\n * standard keywords the editor does not model are preserved on properties and array items; generated values carry `x-generated: true`.\n * @param properties The root properties.\n * @param base The incoming schema. Root keys other than type, properties and required are preserved.\n * @returns The schema.\n */\nexport function propertiesToJsonSchema(properties: Property[], base: JsonSchema = {}): JsonSchema {\n const root = Object.fromEntries(Object.entries(base).filter(([name]) => !['properties', 'required'].includes(name)));\n return schemaInOriginalOrder({ ...root, type: 'object', ...objectSchema(properties, base.required) }, Object.keys(base)) as JsonSchema;\n}\n\n// ── Pure tree edits ─────────────────────────────────────────────────\n\nfunction newProperty(siblings: Property[], type: PropertyType, existingCount: number, concept?: string): Property {\n const base = isComplex(type) ? 'nested' : 'property';\n const name = concept ? uniquePropertyName(siblings, conceptPropertyName(concept)) : `${base}${existingCount + 1}`;\n\n return {\n id: identifier(),\n name,\n type,\n ...(concept ? { concept } : {}),\n ...(isComplex(type) ? { children: [] } : {}),\n };\n}\n\n/**\n * Appends a property to the root.\n * @param properties The root properties.\n * @param type The type of the new property.\n * @param existingCount The number of properties already in the tree, used to generate the default name; see {@link totalPropertyCount}.\n * @param concept The concept the property is typed as. When given the property is named after it.\n * @returns The new tree.\n */\nexport function addProperty(properties: Property[], type: PropertyType, existingCount: number, concept?: string): Property[] {\n return [...properties, newProperty(properties, type, existingCount, concept)];\n}\n\n/**\n * Appends a property to a nested object or object list.\n * @param properties The root properties.\n * @param parentId The id of the parent property.\n * @param type The type of the new property.\n * @param existingCount The number of properties already in the tree, used to generate the default name.\n * @param concept The concept the property is typed as.\n * @returns The new tree.\n */\nexport function addChildProperty(\n properties: Property[],\n parentId: string,\n type: PropertyType,\n existingCount: number,\n concept?: string,\n): Property[] {\n const siblings = findPropertyById(properties, parentId)?.children ?? [];\n const child = newProperty(siblings, type, existingCount, concept);\n const insert = (level: Property[]): Property[] => level.map(property => {\n if (property.id === parentId) return copySchemaKeywordOrder(property, { ...property, children: [...(property.children ?? []), child] });\n return property.children ? copySchemaKeywordOrder(property, { ...property, children: insert(property.children) }) : property;\n });\n return insert(properties);\n}\n\n/**\n * Removes a property, and everything nested under it.\n * @param properties The root properties.\n * @param targetId The id of the property to remove.\n * @returns The new tree.\n */\nexport function removeProperty(properties: Property[], targetId: string): Property[] {\n return properties\n .filter(property => property.id !== targetId)\n .map(property => property.children ? copySchemaKeywordOrder(property, { ...property, children: removeProperty(property.children, targetId) }) : property);\n}\n\nfunction updateProperty(properties: Property[], targetId: string, update: (property: Property) => Property): Property[] {\n return properties.map(property => {\n if (property.id === targetId) return update(property);\n return property.children ? copySchemaKeywordOrder(property, { ...property, children: updateProperty(property.children, targetId, update) }) : property;\n });\n}\n\n/**\n * Renames a property. Its requiredness travels with it, because both are stored against the property.\n * @param properties The root properties.\n * @param targetId The id of the property to rename.\n * @param newName The new name.\n * @returns The new tree.\n */\nexport function renameProperty(properties: Property[], targetId: string, newName: string): Property[] {\n return updateProperty(properties, targetId, property => copySchemaKeywordOrder(property, { ...property, name: newName }));\n}\n\nfunction retypedProperty(property: Property, newType: PropertyType, concept?: string): Property {\n const next: SchemaOrderedProperty = copySchemaKeywordOrder(property, {\n ...property,\n type: newType,\n concept,\n children: isComplex(newType) ? (property.children ?? []) : undefined,\n });\n if (property.type !== newType) {\n const kept = keywordsAfterTypeChange(property.schemaKeywords ?? {}, propertyTypeFamily(property.type), propertyTypeFamily(newType));\n delete next.schemaKeywords;\n if (Object.keys(kept).length > 0) next.schemaKeywords = kept;\n delete next.itemVendorKeywords;\n delete next.itemSchemaKeywords;\n delete next[itemSchemaKeywordOrder];\n delete next[schemaOriginalShape];\n }\n return next;\n}\n\n/**\n * Changes the type of a property. Choosing a plain primitive drops the concept; choosing an object or\n * object list keeps the children, and any other type drops them. A different type keeps the annotations and the\n * constraints of the same keyword family, and drops value keywords, the original type and format, item metadata\n * and every other standard keyword that no longer applies. The same type keeps everything.\n * @param properties The root properties.\n * @param targetId The id of the property.\n * @param newType The new type.\n * @param concept The concept the property is now typed as, if any.\n * @returns The new tree.\n */\nexport function changePropertyType(properties: Property[], targetId: string, newType: PropertyType, concept?: string): Property[] {\n return updateProperty(properties, targetId, property => retypedProperty(property, newType, concept));\n}\n\n/**\n * Flips whether a property is required.\n * @param properties The root properties.\n * @param targetId The id of the property.\n * @returns The new tree.\n */\nexport function toggleRequiredProperty(properties: Property[], targetId: string): Property[] {\n return updateProperty(properties, targetId, property => copySchemaKeywordOrder(property, { ...property, isRequired: !property.isRequired || undefined }));\n}\n\n/**\n * Sets whether a property is required. Requiring a nested property does not require its parent.\n * @param properties The root properties.\n * @param targetId The id of the property.\n * @param isRequired Whether the property must be present.\n * @returns The new tree.\n */\nexport function setRequiredProperty(properties: Property[], targetId: string, isRequired: boolean): Property[] {\n return updateProperty(properties, targetId, property => copySchemaKeywordOrder(property, { ...property, isRequired }));\n}\n\n/**\n * Sets whether a property's value is generated. An explicit edit replaces any non-true x-generated value.\n * @param properties The root properties.\n * @param targetId The id of the property.\n * @param isGenerated Whether the value is generated.\n * @returns The new tree.\n */\nexport function setGeneratedProperty(properties: Property[], targetId: string, isGenerated: boolean): Property[] {\n return updateProperty(properties, targetId, property => {\n const keywords = Object.fromEntries(Object.entries(property.vendorKeywords ?? {}).filter(([name]) => name !== GENERATED_KEYWORD));\n const next = { ...property };\n delete next.isGenerated;\n delete next.vendorKeywords;\n return copySchemaKeywordOrder(property, { ...next, ...(isGenerated ? { isGenerated: true } : {}), ...(Object.keys(keywords).length > 0 ? { vendorKeywords: keywords } : {}) });\n });\n}\n\n/**\n * Makes a property the key of its parent object, moving the key when a sibling held it. Choosing the\n * property that already is the key clears it, so an object can also have no key.\n * @param properties The root properties.\n * @param targetId The id of the property.\n * @returns The new tree.\n */\nexport function setKeyProperty(properties: Property[], targetId: string): Property[] {\n const target = properties.find(property => property.id === targetId);\n return properties.map(property => copySchemaKeywordOrder(property, {\n ...property,\n ...(target ? { isKey: property.id === targetId && target.isKey !== true ? true : undefined } : {}),\n ...(property.children ? { children: setKeyProperty(property.children, targetId) } : {}),\n }));\n}\n"],"names":[],"mappings":";;;;;;;;;;AA2BO,MAAM,eAAe,GAAG;AAMxB,MAAM,WAAW,GAAG;AAGpB,MAAM,iBAAiB,GAAG;AAIjC,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Q,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;AAClL,IAAA,CAAC,CAAC;AACN;AASM,SAAU,cAAc,CAAC,UAAsB,EAAE,QAAgB,EAAA;AACnE,IAAA,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC;IACpE,OAAO,UAAU,CAAC,GAAG,CAAC,QAAQ,IAAI,sBAAsB,CAAC,QAAQ,EAAE;AAC/D,QAAA,GAAG,QAAQ;AACX,QAAA,IAAI,MAAM,GAAG,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI,GAAG,IAAI,GAAG,SAAS,EAAE,GAAG,EAAE,CAAC;QAClG,IAAI,QAAQ,CAAC,QAAQ,GAAG,EAAE,QAAQ,EAAE,cAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;AAC1F,KAAA,CAAC,CAAC;AACP;;"}
@@ -0,0 +1,5 @@
1
+ /** Retains the positions of surviving schema keywords and appends new keywords. */
2
+ export declare function schemaInOriginalOrder(schema: Record<string, unknown>, order?: readonly string[]): Record<string, unknown>;
3
+ /** Lists the names that remain in the order they had, followed by new names in their given order. */
4
+ export declare function requiredInOriginalOrder(required: readonly string[], order?: readonly string[]): string[];
5
+ //# sourceMappingURL=schemaInOriginalOrder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaInOriginalOrder.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/schemaInOriginalOrder.ts"],"names":[],"mappings":"AAGA,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAG7H;AAED,qGAAqG;AACrG,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,EAAE,CAE5G"}
@@ -0,0 +1,10 @@
1
+ function schemaInOriginalOrder(schema, order = []) {
2
+ const names = new Set([...order, ...Object.keys(schema)]);
3
+ return Object.fromEntries([...names].filter(name => Object.hasOwn(schema, name)).map(name => [name, schema[name]]));
4
+ }
5
+ function requiredInOriginalOrder(required, order = []) {
6
+ return [...order.filter(name => required.includes(name)), ...required.filter(name => !order.includes(name))];
7
+ }
8
+
9
+ export { requiredInOriginalOrder, schemaInOriginalOrder };
10
+ //# sourceMappingURL=schemaInOriginalOrder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaInOriginalOrder.js","sources":["../../../../SchemaEditor/Tree/schemaInOriginalOrder.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/** Retains the positions of surviving schema keywords and appends new keywords. */\nexport function schemaInOriginalOrder(schema: Record<string, unknown>, order: readonly string[] = []): Record<string, unknown> {\n const names = new Set([...order, ...Object.keys(schema)]);\n return Object.fromEntries([...names].filter(name => Object.hasOwn(schema, name)).map(name => [name, schema[name]]));\n}\n\n/** Lists the names that remain in the order they had, followed by new names in their given order. */\nexport function requiredInOriginalOrder(required: readonly string[], order: readonly string[] = []): string[] {\n return [...order.filter(name => required.includes(name)), ...required.filter(name => !order.includes(name))];\n}\n"],"names":[],"mappings":"SAIgB,qBAAqB,CAAC,MAA+B,EAAE,QAA2B,EAAE,EAAA;AAChG,IAAA,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AACzD,IAAA,OAAO,MAAM,CAAC,WAAW,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACvH;SAGgB,uBAAuB,CAAC,QAA2B,EAAE,QAA2B,EAAE,EAAA;AAC9F,IAAA,OAAO,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAChH;;"}
@@ -0,0 +1,11 @@
1
+ import { PropertyType } from './PropertyType.js';
2
+ type SchemaNode = Record<string, unknown>;
3
+ /**
4
+ * The property type a schema node reads as. An unknown or missing `type` reads as text, and a list whose
5
+ * items are not numbers or objects reads as a list of text.
6
+ * @param value The property schema node.
7
+ * @returns The property type.
8
+ */
9
+ export declare function schemaPropertyType(value: SchemaNode): PropertyType;
10
+ export {};
11
+ //# sourceMappingURL=schemaPropertyType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaPropertyType.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/schemaPropertyType.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAgB,CAAC;AAE9C,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,YAAY,CAsBlE"}
@@ -0,0 +1,31 @@
1
+ import { PropertyType } from './PropertyType.js';
2
+
3
+ function schemaPropertyType(value) {
4
+ const items = value.items;
5
+ switch (value.type) {
6
+ case 'string':
7
+ if (value.format === 'date')
8
+ return PropertyType.Date;
9
+ if (value.format === 'time')
10
+ return PropertyType.Time;
11
+ return PropertyType.String;
12
+ case 'number':
13
+ case 'integer':
14
+ return PropertyType.Number;
15
+ case 'boolean':
16
+ return PropertyType.Boolean;
17
+ case 'object':
18
+ return PropertyType.Object;
19
+ case 'array':
20
+ if (items?.type === 'number' || items?.type === 'integer')
21
+ return PropertyType.NumberArray;
22
+ if (items?.type === 'object')
23
+ return PropertyType.ObjectArray;
24
+ return PropertyType.StringArray;
25
+ default:
26
+ return PropertyType.String;
27
+ }
28
+ }
29
+
30
+ export { schemaPropertyType };
31
+ //# sourceMappingURL=schemaPropertyType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemaPropertyType.js","sources":["../../../../SchemaEditor/Tree/schemaPropertyType.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PropertyType } from './PropertyType';\n\ntype SchemaNode = Record<string, unknown>;\n\n/**\n * The property type a schema node reads as. An unknown or missing `type` reads as text, and a list whose\n * items are not numbers or objects reads as a list of text.\n * @param value The property schema node.\n * @returns The property type.\n */\nexport function schemaPropertyType(value: SchemaNode): PropertyType {\n const items = value.items as { type?: string } | undefined;\n\n switch (value.type) {\n case 'string':\n if (value.format === 'date') return PropertyType.Date;\n if (value.format === 'time') return PropertyType.Time;\n return PropertyType.String;\n case 'number':\n case 'integer':\n return PropertyType.Number;\n case 'boolean':\n return PropertyType.Boolean;\n case 'object':\n return PropertyType.Object;\n case 'array':\n if (items?.type === 'number' || items?.type === 'integer') return PropertyType.NumberArray;\n if (items?.type === 'object') return PropertyType.ObjectArray;\n return PropertyType.StringArray;\n default:\n return PropertyType.String;\n }\n}\n"],"names":[],"mappings":";;AAaM,SAAU,kBAAkB,CAAC,KAAiB,EAAA;AAChD,IAAA,MAAM,KAAK,GAAG,KAAK,CAAC,KAAsC;AAE1D,IAAA,QAAQ,KAAK,CAAC,IAAI;AACd,QAAA,KAAK,QAAQ;AACT,YAAA,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM;gBAAE,OAAO,YAAY,CAAC,IAAI;AACrD,YAAA,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM;gBAAE,OAAO,YAAY,CAAC,IAAI;YACrD,OAAO,YAAY,CAAC,MAAM;AAC9B,QAAA,KAAK,QAAQ;AACb,QAAA,KAAK,SAAS;YACV,OAAO,YAAY,CAAC,MAAM;AAC9B,QAAA,KAAK,SAAS;YACV,OAAO,YAAY,CAAC,OAAO;AAC/B,QAAA,KAAK,QAAQ;YACT,OAAO,YAAY,CAAC,MAAM;AAC9B,QAAA,KAAK,OAAO;YACR,IAAI,KAAK,EAAE,IAAI,KAAK,QAAQ,IAAI,KAAK,EAAE,IAAI,KAAK,SAAS;gBAAE,OAAO,YAAY,CAAC,WAAW;AAC1F,YAAA,IAAI,KAAK,EAAE,IAAI,KAAK,QAAQ;gBAAE,OAAO,YAAY,CAAC,WAAW;YAC7D,OAAO,YAAY,CAAC,WAAW;AACnC,QAAA;YACI,OAAO,YAAY,CAAC,MAAM;;AAEtC;;"}
@@ -0,0 +1,18 @@
1
+ import { PropertyType } from './PropertyType.js';
2
+ type SchemaNode = Record<string, unknown>;
3
+ /**
4
+ * Reads the standard keywords of a property node that the editor does not model.
5
+ * @param node The property schema node.
6
+ * @param type The property type the node reads as.
7
+ * @returns The keywords, or undefined when there are none.
8
+ */
9
+ export declare function standardPropertyKeywords(node: SchemaNode, type: PropertyType): Readonly<Record<string, unknown>> | undefined;
10
+ /**
11
+ * Reads the standard keywords of an array's items node that the editor does not model.
12
+ * @param items The items schema node.
13
+ * @param type The property type of the array.
14
+ * @returns The keywords, or undefined when there are none.
15
+ */
16
+ export declare function standardItemKeywords(items: SchemaNode, type: PropertyType): Readonly<Record<string, unknown>> | undefined;
17
+ export {};
18
+ //# sourceMappingURL=standardKeywords.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standardKeywords.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/standardKeywords.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAgB,CAAC;AAE9C,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAS1C;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAO5H;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,CAEzH"}
@@ -0,0 +1,22 @@
1
+ import { isNode } from './originalShape.js';
2
+ import { PropertyType } from './PropertyType.js';
3
+
4
+ const arrayTypes = [PropertyType.StringArray, PropertyType.NumberArray, PropertyType.ObjectArray];
5
+ function unmodelled(node, modelled) {
6
+ const entries = Object.entries(node).filter(([name]) => !name.startsWith('x-') && !modelled.includes(name));
7
+ return entries.length > 0 ? Object.fromEntries(entries) : undefined;
8
+ }
9
+ function standardPropertyKeywords(node, type) {
10
+ return unmodelled(node, [
11
+ 'type',
12
+ 'format',
13
+ ...(arrayTypes.includes(type) && isNode(node.items) ? ['items'] : []),
14
+ ...(type === PropertyType.Object && isNode(node.properties) ? ['properties', 'required'] : []),
15
+ ]);
16
+ }
17
+ function standardItemKeywords(items, type) {
18
+ return unmodelled(items, ['type', 'format', ...(type === PropertyType.ObjectArray && isNode(items.properties) ? ['properties', 'required'] : [])]);
19
+ }
20
+
21
+ export { standardItemKeywords, standardPropertyKeywords };
22
+ //# sourceMappingURL=standardKeywords.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standardKeywords.js","sources":["../../../../SchemaEditor/Tree/standardKeywords.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { isNode } from './originalShape';\nimport { PropertyType } from './PropertyType';\n\ntype SchemaNode = Record<string, unknown>;\n\nconst arrayTypes: readonly PropertyType[] = [PropertyType.StringArray, PropertyType.NumberArray, PropertyType.ObjectArray];\n\nfunction unmodelled(node: SchemaNode, modelled: readonly string[]): Readonly<Record<string, unknown>> | undefined {\n const entries = Object.entries(node).filter(([name]) => !name.startsWith('x-') && !modelled.includes(name));\n return entries.length > 0 ? Object.fromEntries(entries) : undefined;\n}\n\n/**\n * Reads the standard keywords of a property node that the editor does not model.\n * @param node The property schema node.\n * @param type The property type the node reads as.\n * @returns The keywords, or undefined when there are none.\n */\nexport function standardPropertyKeywords(node: SchemaNode, type: PropertyType): Readonly<Record<string, unknown>> | undefined {\n return unmodelled(node, [\n 'type',\n 'format',\n ...(arrayTypes.includes(type) && isNode(node.items) ? ['items'] : []),\n ...(type === PropertyType.Object && isNode(node.properties) ? ['properties', 'required'] : []),\n ]);\n}\n\n/**\n * Reads the standard keywords of an array's items node that the editor does not model.\n * @param items The items schema node.\n * @param type The property type of the array.\n * @returns The keywords, or undefined when there are none.\n */\nexport function standardItemKeywords(items: SchemaNode, type: PropertyType): Readonly<Record<string, unknown>> | undefined {\n return unmodelled(items, ['type', 'format', ...(type === PropertyType.ObjectArray && isNode(items.properties) ? ['properties', 'required'] : [])]);\n}\n"],"names":[],"mappings":";;;AAQA,MAAM,UAAU,GAA4B,CAAC,YAAY,CAAC,WAAW,EAAE,YAAY,CAAC,WAAW,EAAE,YAAY,CAAC,WAAW,CAAC;AAE1H,SAAS,UAAU,CAAC,IAAgB,EAAE,QAA2B,EAAA;AAC7D,IAAA,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC3G,IAAA,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,SAAS;AACvE;AAQM,SAAU,wBAAwB,CAAC,IAAgB,EAAE,IAAkB,EAAA;IACzE,OAAO,UAAU,CAAC,IAAI,EAAE;QACpB,MAAM;QACN,QAAQ;QACR,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QACrE,IAAI,IAAI,KAAK,YAAY,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC;AACjG,KAAA,CAAC;AACN;AAQM,SAAU,oBAAoB,CAAC,KAAiB,EAAE,IAAkB,EAAA;AACtE,IAAA,OAAO,UAAU,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,IAAI,KAAK,YAAY,CAAC,WAAW,IAAI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AACtJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaultSchemaEditorLabels.d.ts","sourceRoot":"","sources":["../../../SchemaEditor/defaultSchemaEditorLabels.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAsB,CAAC;AAE/D,2FAA2F;AAC3F,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,kBAAkB,CA8CnE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,kBAA+C,CAAC"}
1
+ {"version":3,"file":"defaultSchemaEditorLabels.d.ts","sourceRoot":"","sources":["../../../SchemaEditor/defaultSchemaEditorLabels.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAsB,CAAC;AAE/D,2FAA2F;AAC3F,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,kBAAkB,CAiDnE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,EAAE,kBAA+C,CAAC"}
@@ -29,6 +29,9 @@ const completeSchemaEditorLabels = {
29
29
  keyProperty: (propertyName) => `Use ${propertyName} as the key property`,
30
30
  setAsKey: 'Use as the key that identifies the object',
31
31
  isKey: 'This is the key that identifies the object. Select it again to clear it.',
32
+ generatedProperty: (propertyName) => `Generated: ${propertyName}`,
33
+ setAsGenerated: 'Mark as generated: the value is created when the command runs, not entered',
34
+ isGenerated: 'The value is generated. Select it again to mark it as entered.',
32
35
  keyColumn: 'Key',
33
36
  requiredColumn: 'Required',
34
37
  protectedProperty: 'This property cannot be renamed or removed.',
@@ -1 +1 @@
1
- {"version":3,"file":"defaultSchemaEditorLabels.js","sources":["../../../SchemaEditor/defaultSchemaEditorLabels.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { SchemaEditorLabels } from './SchemaEditorLabels';\n\n/** Every label with its English default, so the editor never has to guard an unset one. */\nexport const completeSchemaEditorLabels: Required<SchemaEditorLabels> = {\n edit: 'Edit',\n save: 'Save',\n cancel: 'Cancel',\n addProperty: 'Add Property',\n actions: 'Actions',\n navigateBack: 'Navigate back',\n emptyMessage: 'No properties defined',\n navigateToItemDefinition: 'Navigate to item definition',\n navigateToProperties: 'Navigate to object properties',\n propertyName: 'Property name',\n propertyType: 'Property type',\n arrayItemType: 'Array item type',\n deleteProperty: 'Delete property',\n invalidJson: 'The schema must contain valid JSON before it can be edited.',\n schema: 'Schema properties',\n addPropertyTo: (propertyName) => `Add property to ${propertyName}`,\n nestedProperties: (propertyName) => `Properties of ${propertyName}`,\n propertyNameFor: (propertyName) => `Name of ${propertyName}`,\n renameHint: 'Double-click or press F2 to rename',\n deletePropertyFor: (propertyName) => `Delete ${propertyName}`,\n changeType: (propertyName, typeName) => `Change type of ${propertyName}, currently ${typeName}`,\n propertyTypes: 'Property types',\n concepts: 'Concepts',\n noConcepts: 'No concepts defined',\n required: 'Required',\n requiredProperty: (propertyName) => `Required in schema: ${propertyName}`,\n requiredHelp: 'The property must be present in the object. An empty value still counts as present.',\n keyProperty: (propertyName) => `Use ${propertyName} as the key property`,\n setAsKey: 'Use as the key that identifies the object',\n isKey: 'This is the key that identifies the object. Select it again to clear it.',\n keyColumn: 'Key',\n requiredColumn: 'Required',\n protectedProperty: 'This property cannot be renamed or removed.',\n nameRequired: 'Enter a name.',\n nameReserved: (name) => `${name} is reserved and cannot be used as a name.`,\n nameDuplicate: (name) => `Another property is already named ${name}.`,\n typeString: 'Text',\n typeNumber: 'Number',\n typeBoolean: 'Yes or no',\n typeDate: 'Date',\n typeTime: 'Time',\n typeStringArray: 'List of text',\n typeNumberArray: 'List of numbers',\n typeObject: 'Object',\n typeObjectArray: 'List of objects',\n};\n\n/**\n * English defaults for {@link SchemaEditorLabels}. The labels added for the tree layout and the capabilities are\n * optional on the type, and are present here with their English text.\n */\nexport const defaultSchemaEditorLabels: SchemaEditorLabels = completeSchemaEditorLabels;\n"],"names":[],"mappings":"AAMO,MAAM,0BAA0B,GAAiC;AACpE,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,WAAW,EAAE,cAAc;AAC3B,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,YAAY,EAAE,uBAAuB;AACrC,IAAA,wBAAwB,EAAE,6BAA6B;AACvD,IAAA,oBAAoB,EAAE,+BAA+B;AACrD,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,aAAa,EAAE,iBAAiB;AAChC,IAAA,cAAc,EAAE,iBAAiB;AACjC,IAAA,WAAW,EAAE,6DA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,WAAW,EAAE,WAAW;AACxB,IAAA,QAAQ,EAAE,MAAM;AAChB,IAAA,QAAQ,EAAE,MAAM;AAChB,IAAA,eAAe,EAAE,cAAc;AAC/B,IAAA,eAAe,EAAE,iBAAiB;AAClC,IAAA,UAAU,EAAE,QAAQ;AACpB,IAAA,eAAe,EAAE,iBAAiB;;AAO/B,MAAM,yBAAyB,GAAuB;;"}
1
+ {"version":3,"file":"defaultSchemaEditorLabels.js","sources":["../../../SchemaEditor/defaultSchemaEditorLabels.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { SchemaEditorLabels } from './SchemaEditorLabels';\n\n/** Every label with its English default, so the editor never has to guard an unset one. */\nexport const completeSchemaEditorLabels: Required<SchemaEditorLabels> = {\n edit: 'Edit',\n save: 'Save',\n cancel: 'Cancel',\n addProperty: 'Add Property',\n actions: 'Actions',\n navigateBack: 'Navigate back',\n emptyMessage: 'No properties defined',\n navigateToItemDefinition: 'Navigate to item definition',\n navigateToProperties: 'Navigate to object properties',\n propertyName: 'Property name',\n propertyType: 'Property type',\n arrayItemType: 'Array item type',\n deleteProperty: 'Delete property',\n invalidJson: 'The schema must contain valid JSON before it can be edited.',\n schema: 'Schema properties',\n addPropertyTo: (propertyName) => `Add property to ${propertyName}`,\n nestedProperties: (propertyName) => `Properties of ${propertyName}`,\n propertyNameFor: (propertyName) => `Name of ${propertyName}`,\n renameHint: 'Double-click or press F2 to rename',\n deletePropertyFor: (propertyName) => `Delete ${propertyName}`,\n changeType: (propertyName, typeName) => `Change type of ${propertyName}, currently ${typeName}`,\n propertyTypes: 'Property types',\n concepts: 'Concepts',\n noConcepts: 'No concepts defined',\n required: 'Required',\n requiredProperty: (propertyName) => `Required in schema: ${propertyName}`,\n requiredHelp: 'The property must be present in the object. An empty value still counts as present.',\n keyProperty: (propertyName) => `Use ${propertyName} as the key property`,\n setAsKey: 'Use as the key that identifies the object',\n isKey: 'This is the key that identifies the object. Select it again to clear it.',\n generatedProperty: (propertyName) => `Generated: ${propertyName}`,\n setAsGenerated: 'Mark as generated: the value is created when the command runs, not entered',\n isGenerated: 'The value is generated. Select it again to mark it as entered.',\n keyColumn: 'Key',\n requiredColumn: 'Required',\n protectedProperty: 'This property cannot be renamed or removed.',\n nameRequired: 'Enter a name.',\n nameReserved: (name) => `${name} is reserved and cannot be used as a name.`,\n nameDuplicate: (name) => `Another property is already named ${name}.`,\n typeString: 'Text',\n typeNumber: 'Number',\n typeBoolean: 'Yes or no',\n typeDate: 'Date',\n typeTime: 'Time',\n typeStringArray: 'List of text',\n typeNumberArray: 'List of numbers',\n typeObject: 'Object',\n typeObjectArray: 'List of objects',\n};\n\n/**\n * English defaults for {@link SchemaEditorLabels}. The labels added for the tree layout and the capabilities are\n * optional on the type, and are present here with their English text.\n */\nexport const defaultSchemaEditorLabels: SchemaEditorLabels = completeSchemaEditorLabels;\n"],"names":[],"mappings":"AAMO,MAAM,0BAA0B,GAAiC;AACpE,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,WAAW,EAAE,cAAc;AAC3B,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,YAAY,EAAE,uBAAuB;AACrC,IAAA,wBAAwB,EAAE,6BAA6B;AACvD,IAAA,oBAAoB,EAAE,+BAA+B;AACrD,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,aAAa,EAAE,iBAAiB;AAChC,IAAA,cAAc,EAAE,iBAAiB;AACjC,IAAA,WAAW,EAAE,6DAA6D;AAC1E,IAAA,MAAM,EAAE,mBAAmB;IAC3B,aAAa,EAAE,CAAC,YAAY,KAAK,CAAA,gBAAA,EAAmB,YAAY,CAAA,CAAE;IAClE,gBAAgB,EAAE,CAAC,YAAY,KAAK,CAAA,cAAA,EAAiB,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,QAAQ,EAAE,MAAM;AAChB,IAAA,QAAQ,EAAE,MAAM;AAChB,IAAA,eAAe,EAAE,cAAc;AAC/B,IAAA,eAAe,EAAE,iBAAiB;AAClC,IAAA,UAAU,EAAE,QAAQ;AACpB,IAAA,eAAe,EAAE,iBAAiB;;AAO/B,MAAM,yBAAyB,GAAuB;;"}
@@ -10,7 +10,7 @@ export { PropertyType } from './Tree/PropertyType.js';
10
10
  export type { PropertyConcept } from './Tree/PropertyConcept.js';
11
11
  export { PropertyNameProblem, conceptPropertyName, findPropertyNameProblem, uniquePropertyName, } from './Tree/propertyNaming.js';
12
12
  export { findPropertyById, findPropertyByName, findSiblingProperties, totalPropertyCount } from './Tree/propertyTree.js';
13
- export { CONCEPT_KEYWORD, KEY_KEYWORD, addChildProperty, addProperty, changePropertyType, jsonSchemaToProperties, propertiesToJsonSchema, removeProperty, renameProperty, setKeyProperty, setRequiredProperty, toggleRequiredProperty, } from './Tree/schemaConversion.js';
13
+ export { CONCEPT_KEYWORD, KEY_KEYWORD, GENERATED_KEYWORD, addChildProperty, addProperty, changePropertyType, jsonSchemaToProperties, propertiesToJsonSchema, removeProperty, renameProperty, setKeyProperty, setGeneratedProperty, setRequiredProperty, toggleRequiredProperty, } from './Tree/schemaConversion.js';
14
14
  export * from '../types/JsonSchema.js';
15
15
  export * from '../types/TypeFormat.js';
16
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../SchemaEditor/index.ts"],"names":[],"mappings":"AAGA,cAAc,mBAAgB,CAAC;AAC/B,YAAY,EAAE,kBAAkB,EAAE,MAAM,yBAAsB,CAAC;AAC/D,YAAY,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,8BAA8B,EAAE,MAAM,6BAA0B,CAAC;AAC9H,YAAY,EAAE,qBAAqB,EAAE,MAAM,iCAA8B,CAAC;AAC1E,YAAY,EAAE,sBAAsB,EAAE,MAAM,kCAA+B,CAAC;AAC5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ChD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAqB,CAAC;AACnD,YAAY,EAAE,eAAe,EAAE,MAAM,2BAAwB,CAAC;AAC9D,OAAO,EACH,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,kBAAkB,GACrB,MAAM,0BAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,wBAAqB,CAAC;AACtH,OAAO,EACH,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GACzB,MAAM,4BAAyB,CAAC;AACjC,cAAc,wBAAqB,CAAC;AACpC,cAAc,wBAAqB,CAAC"}
@@ -3,7 +3,7 @@ export { PropertyConceptsProvider, usePropertyConcepts } from './Tree/PropertyCo
3
3
  export { PropertyType } from './Tree/PropertyType.js';
4
4
  export { PropertyNameProblem, conceptPropertyName, findPropertyNameProblem, uniquePropertyName } from './Tree/propertyNaming.js';
5
5
  export { findPropertyById, findPropertyByName, findSiblingProperties, totalPropertyCount } from './Tree/propertyTree.js';
6
- export { CONCEPT_KEYWORD, KEY_KEYWORD, addChildProperty, addProperty, changePropertyType, jsonSchemaToProperties, propertiesToJsonSchema, removeProperty, renameProperty, setKeyProperty, setRequiredProperty, toggleRequiredProperty } from './Tree/schemaConversion.js';
6
+ export { CONCEPT_KEYWORD, GENERATED_KEYWORD, KEY_KEYWORD, addChildProperty, addProperty, changePropertyType, jsonSchemaToProperties, propertiesToJsonSchema, removeProperty, renameProperty, setGeneratedProperty, setKeyProperty, setRequiredProperty, toggleRequiredProperty } from './Tree/schemaConversion.js';
7
7
  export { DEFAULT_TYPE_FORMATS } from '../types/TypeFormat.js';
8
8
  export { defaultSchemaEditorLabels } from './defaultSchemaEditorLabels.js';
9
9
  //# sourceMappingURL=index.js.map