@extrahorizon/exh-cli 1.7.0-dev-48-62caf3f → 1.7.0-dev-50-125337b
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/CHANGELOG.md +4 -0
- package/build/commands/data/schemas/util/metaschema.json +40 -1
- package/build/commands/data/schemas/util/stripUnsupportedDescriptionFields.d.ts +22 -0
- package/build/commands/data/schemas/util/stripUnsupportedDescriptionFields.js +59 -0
- package/build/commands/data/schemas/util/syncSchema.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Extra Horizon CLI changelog
|
|
2
2
|
|
|
3
3
|
### v1.7.0
|
|
4
|
+
* `exh data schemas sync` now allows schema `.json` files to contain a `$schema` property
|
|
5
|
+
* This allows you to specify a json-schema for the schema files themselves, providing hints and validation in your editor
|
|
6
|
+
* `exh data schemas sync` now allows all components in a schema to have a `description` property
|
|
7
|
+
* These descriptions are not synced, but allow you to provide inline documentation for the components in your schema
|
|
4
8
|
|
|
5
9
|
### v1.6.1
|
|
6
10
|
* `exh data schemas sync` no longer logs the full schema definition json
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "object",
|
|
3
3
|
"properties": {
|
|
4
|
+
"$schema": {
|
|
5
|
+
"type": "string"
|
|
6
|
+
},
|
|
4
7
|
"name": {
|
|
5
8
|
"type": "string"
|
|
6
9
|
},
|
|
@@ -78,6 +81,9 @@
|
|
|
78
81
|
},
|
|
79
82
|
"type": {
|
|
80
83
|
"const": "manual"
|
|
84
|
+
},
|
|
85
|
+
"description": {
|
|
86
|
+
"type": "string"
|
|
81
87
|
}
|
|
82
88
|
},
|
|
83
89
|
"additionalProperties": false,
|
|
@@ -95,6 +101,9 @@
|
|
|
95
101
|
"name": {
|
|
96
102
|
"type": "string"
|
|
97
103
|
},
|
|
104
|
+
"description": {
|
|
105
|
+
"type": "string"
|
|
106
|
+
},
|
|
98
107
|
"type": {
|
|
99
108
|
"enum": [
|
|
100
109
|
"manual",
|
|
@@ -139,6 +148,9 @@
|
|
|
139
148
|
"name": {
|
|
140
149
|
"type": "string"
|
|
141
150
|
},
|
|
151
|
+
"description": {
|
|
152
|
+
"type": "string"
|
|
153
|
+
},
|
|
142
154
|
"fields": {
|
|
143
155
|
"type": "array",
|
|
144
156
|
"items": {
|
|
@@ -249,6 +261,9 @@
|
|
|
249
261
|
"type": "string",
|
|
250
262
|
"enum": ["input"]
|
|
251
263
|
},
|
|
264
|
+
"description": {
|
|
265
|
+
"type": "string"
|
|
266
|
+
},
|
|
252
267
|
"required": {
|
|
253
268
|
"type": "array",
|
|
254
269
|
"items": { "type": "string" }
|
|
@@ -261,7 +276,10 @@
|
|
|
261
276
|
"configuration": { "$ref": "#/definitions/configurations" },
|
|
262
277
|
"type": {
|
|
263
278
|
"type": "string",
|
|
264
|
-
"enum": ["
|
|
279
|
+
"enum": ["document"]
|
|
280
|
+
},
|
|
281
|
+
"description": {
|
|
282
|
+
"type": "string"
|
|
265
283
|
},
|
|
266
284
|
"required": {
|
|
267
285
|
"type": "array",
|
|
@@ -278,6 +296,9 @@
|
|
|
278
296
|
"initiatorHasRelationToUserInData"
|
|
279
297
|
]
|
|
280
298
|
},
|
|
299
|
+
"description": {
|
|
300
|
+
"type": "string"
|
|
301
|
+
},
|
|
281
302
|
"userIdField": {
|
|
282
303
|
"type": "string"
|
|
283
304
|
},
|
|
@@ -299,6 +320,9 @@
|
|
|
299
320
|
"initiatorHasRelationToGroupInData"
|
|
300
321
|
]
|
|
301
322
|
},
|
|
323
|
+
"description": {
|
|
324
|
+
"type": "string"
|
|
325
|
+
},
|
|
302
326
|
"groupIdField": {
|
|
303
327
|
"type": "string"
|
|
304
328
|
},
|
|
@@ -321,6 +345,9 @@
|
|
|
321
345
|
"type": "string",
|
|
322
346
|
"enum": ["object"]
|
|
323
347
|
},
|
|
348
|
+
"description": {
|
|
349
|
+
"type": "string"
|
|
350
|
+
},
|
|
324
351
|
"required": {
|
|
325
352
|
"type": "array",
|
|
326
353
|
"items": {
|
|
@@ -341,6 +368,9 @@
|
|
|
341
368
|
"type": "string",
|
|
342
369
|
"enum": ["array"]
|
|
343
370
|
},
|
|
371
|
+
"description": {
|
|
372
|
+
"type": "string"
|
|
373
|
+
},
|
|
344
374
|
"items": {
|
|
345
375
|
"type": "object"
|
|
346
376
|
},
|
|
@@ -365,6 +395,9 @@
|
|
|
365
395
|
"type": "string",
|
|
366
396
|
"enum": ["string"]
|
|
367
397
|
},
|
|
398
|
+
"description": {
|
|
399
|
+
"type": "string"
|
|
400
|
+
},
|
|
368
401
|
"minLength": {
|
|
369
402
|
"type": "number"
|
|
370
403
|
},
|
|
@@ -399,6 +432,9 @@
|
|
|
399
432
|
"type": "string",
|
|
400
433
|
"enum": ["string"]
|
|
401
434
|
},
|
|
435
|
+
"description": {
|
|
436
|
+
"type": "string"
|
|
437
|
+
},
|
|
402
438
|
"minimum": {
|
|
403
439
|
"type": "number"
|
|
404
440
|
},
|
|
@@ -426,6 +462,9 @@
|
|
|
426
462
|
"type": "string",
|
|
427
463
|
"enum": ["boolean"]
|
|
428
464
|
},
|
|
465
|
+
"description": {
|
|
466
|
+
"type": "string"
|
|
467
|
+
},
|
|
429
468
|
"enum": {
|
|
430
469
|
"type": "array",
|
|
431
470
|
"items": {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Schema, Transition } from '@extrahorizon/javascript-sdk';
|
|
2
|
+
export declare function stripUnsupportedDescriptionFields(schema: Schema): {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
properties: Record<string, any>;
|
|
7
|
+
indexes: import("@extrahorizon/javascript-sdk").Index[];
|
|
8
|
+
statuses: Record<string, Record<string, string>>;
|
|
9
|
+
creationTransition: import("@extrahorizon/javascript-sdk").CreationTransition;
|
|
10
|
+
transitions: Transition[];
|
|
11
|
+
createMode: import("@extrahorizon/javascript-sdk").CreateMode;
|
|
12
|
+
readMode: import("@extrahorizon/javascript-sdk").ReadMode;
|
|
13
|
+
updateMode: import("@extrahorizon/javascript-sdk").UpdateMode;
|
|
14
|
+
deleteMode: import("@extrahorizon/javascript-sdk").DeleteMode;
|
|
15
|
+
groupSyncMode: import("@extrahorizon/javascript-sdk").GroupSyncMode;
|
|
16
|
+
defaultLimit?: number;
|
|
17
|
+
maximumLimit?: number;
|
|
18
|
+
updateTimestamp: Date;
|
|
19
|
+
creationTimestamp: Date;
|
|
20
|
+
findTransitionIdByName?: (name: string) => string;
|
|
21
|
+
transitionsByName?: Record<string, Transition>;
|
|
22
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stripUnsupportedDescriptionFields = void 0;
|
|
4
|
+
const _ = require("lodash");
|
|
5
|
+
function stripUnsupportedDescriptionFields(schema) {
|
|
6
|
+
const newSchema = { ...schema };
|
|
7
|
+
if (schema.creationTransition) {
|
|
8
|
+
newSchema.creationTransition = _.omit(schema.creationTransition, 'description');
|
|
9
|
+
}
|
|
10
|
+
if (schema.transitions) {
|
|
11
|
+
newSchema.transitions = schema.transitions.map(stripDescriptionsFromTransition);
|
|
12
|
+
}
|
|
13
|
+
if (schema.properties) {
|
|
14
|
+
newSchema.properties = _.mapValues(schema.properties, stripDescriptionsFromTypeConfiguration);
|
|
15
|
+
}
|
|
16
|
+
if (schema.indexes) {
|
|
17
|
+
newSchema.indexes = schema.indexes.map(index => _.omit(index, 'description'));
|
|
18
|
+
}
|
|
19
|
+
return newSchema;
|
|
20
|
+
}
|
|
21
|
+
exports.stripUnsupportedDescriptionFields = stripUnsupportedDescriptionFields;
|
|
22
|
+
function stripDescriptionsFromTransition(transition) {
|
|
23
|
+
const newTransition = _.omit(transition, 'description');
|
|
24
|
+
if (newTransition.conditions) {
|
|
25
|
+
newTransition.conditions = newTransition.conditions.map(condition => {
|
|
26
|
+
const newCondition = _.omit(condition, 'description');
|
|
27
|
+
if (newCondition.type === 'input' || newCondition.type === 'document') {
|
|
28
|
+
if (newCondition.configuration) {
|
|
29
|
+
newCondition.configuration = stripDescriptionsFromTypeConfiguration(newCondition.configuration);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return newCondition;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
if (newTransition.actions) {
|
|
36
|
+
newTransition.actions = newTransition.actions.map(action => _.omit(action, 'description'));
|
|
37
|
+
}
|
|
38
|
+
return newTransition;
|
|
39
|
+
}
|
|
40
|
+
function stripDescriptionsFromTypeConfiguration(configuration) {
|
|
41
|
+
const newConfiguration = _.omit(configuration, 'description');
|
|
42
|
+
if (newConfiguration.type === 'object') {
|
|
43
|
+
if (newConfiguration.properties) {
|
|
44
|
+
newConfiguration.properties = _.mapValues(newConfiguration.properties, stripDescriptionsFromTypeConfiguration);
|
|
45
|
+
}
|
|
46
|
+
if (newConfiguration.additionalProperties) {
|
|
47
|
+
newConfiguration.additionalProperties = stripDescriptionsFromTypeConfiguration(newConfiguration.additionalProperties);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (newConfiguration.type === 'array') {
|
|
51
|
+
if (newConfiguration.items) {
|
|
52
|
+
newConfiguration.items = stripDescriptionsFromTypeConfiguration(newConfiguration.items);
|
|
53
|
+
}
|
|
54
|
+
if (newConfiguration.contains) {
|
|
55
|
+
newConfiguration.contains = stripDescriptionsFromTypeConfiguration(newConfiguration.contains);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return newConfiguration;
|
|
59
|
+
}
|
|
@@ -11,6 +11,7 @@ const chalk = require("chalk");
|
|
|
11
11
|
const _ = require("lodash");
|
|
12
12
|
const schemaRepository = require("../../../../repositories/schemas");
|
|
13
13
|
const statusHelpers_1 = require("../sync/statusHelpers");
|
|
14
|
+
const stripUnsupportedDescriptionFields_1 = require("./stripUnsupportedDescriptionFields");
|
|
14
15
|
class SyncSchema {
|
|
15
16
|
constructor(sdk, dry) {
|
|
16
17
|
_SyncSchema_instances.add(this);
|
|
@@ -23,7 +24,7 @@ class SyncSchema {
|
|
|
23
24
|
return new SyncSchema(sdk, dry);
|
|
24
25
|
}
|
|
25
26
|
async sync(target) {
|
|
26
|
-
this.localSchema = target;
|
|
27
|
+
this.localSchema = (0, stripUnsupportedDescriptionFields_1.stripUnsupportedDescriptionFields)(target);
|
|
27
28
|
if (!this.localSchema.name) {
|
|
28
29
|
console.log('No schema name defined, skipping this file');
|
|
29
30
|
return;
|