@extrahorizon/exh-cli 1.7.0-dev-49-9aacbf7 → 1.7.0-dev-51-504a36e
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 +3 -0
- package/build/commands/data/schemas/sync.js +0 -1
- package/build/commands/data/schemas/util/metaschema.json +37 -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 +4 -1
- package/build/commands/sync.js +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
### v1.7.0
|
|
4
4
|
* `exh data schemas sync` now allows schema `.json` files to contain a `$schema` property
|
|
5
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
|
|
8
|
+
* Fixed some output inconsistencies in the sync commands
|
|
6
9
|
|
|
7
10
|
### v1.6.1
|
|
8
11
|
* `exh data schemas sync` no longer logs the full schema definition json
|
|
@@ -62,7 +62,6 @@ async function syncTargetFile(sdk, targetFile, dry, ignoreVerificationErrors) {
|
|
|
62
62
|
}
|
|
63
63
|
exports.syncTargetFile = syncTargetFile;
|
|
64
64
|
async function syncTargetDir(sdk, targetDir, dry, ignoreVerificationErrors) {
|
|
65
|
-
await (0, verify_1.handler)({ dir: targetDir, file: null, ignoreVerificationErrors });
|
|
66
65
|
const targetFiles = (0, listFilesInDir_1.flatListFiles)(targetDir, '.json');
|
|
67
66
|
for (const filePath of targetFiles) {
|
|
68
67
|
await syncTargetFile(sdk, filePath, dry, ignoreVerificationErrors);
|
|
@@ -81,6 +81,9 @@
|
|
|
81
81
|
},
|
|
82
82
|
"type": {
|
|
83
83
|
"const": "manual"
|
|
84
|
+
},
|
|
85
|
+
"description": {
|
|
86
|
+
"type": "string"
|
|
84
87
|
}
|
|
85
88
|
},
|
|
86
89
|
"additionalProperties": false,
|
|
@@ -98,6 +101,9 @@
|
|
|
98
101
|
"name": {
|
|
99
102
|
"type": "string"
|
|
100
103
|
},
|
|
104
|
+
"description": {
|
|
105
|
+
"type": "string"
|
|
106
|
+
},
|
|
101
107
|
"type": {
|
|
102
108
|
"enum": [
|
|
103
109
|
"manual",
|
|
@@ -142,6 +148,9 @@
|
|
|
142
148
|
"name": {
|
|
143
149
|
"type": "string"
|
|
144
150
|
},
|
|
151
|
+
"description": {
|
|
152
|
+
"type": "string"
|
|
153
|
+
},
|
|
145
154
|
"fields": {
|
|
146
155
|
"type": "array",
|
|
147
156
|
"items": {
|
|
@@ -252,6 +261,9 @@
|
|
|
252
261
|
"type": "string",
|
|
253
262
|
"enum": ["input"]
|
|
254
263
|
},
|
|
264
|
+
"description": {
|
|
265
|
+
"type": "string"
|
|
266
|
+
},
|
|
255
267
|
"required": {
|
|
256
268
|
"type": "array",
|
|
257
269
|
"items": { "type": "string" }
|
|
@@ -264,7 +276,10 @@
|
|
|
264
276
|
"configuration": { "$ref": "#/definitions/configurations" },
|
|
265
277
|
"type": {
|
|
266
278
|
"type": "string",
|
|
267
|
-
"enum": ["
|
|
279
|
+
"enum": ["document"]
|
|
280
|
+
},
|
|
281
|
+
"description": {
|
|
282
|
+
"type": "string"
|
|
268
283
|
},
|
|
269
284
|
"required": {
|
|
270
285
|
"type": "array",
|
|
@@ -281,6 +296,9 @@
|
|
|
281
296
|
"initiatorHasRelationToUserInData"
|
|
282
297
|
]
|
|
283
298
|
},
|
|
299
|
+
"description": {
|
|
300
|
+
"type": "string"
|
|
301
|
+
},
|
|
284
302
|
"userIdField": {
|
|
285
303
|
"type": "string"
|
|
286
304
|
},
|
|
@@ -302,6 +320,9 @@
|
|
|
302
320
|
"initiatorHasRelationToGroupInData"
|
|
303
321
|
]
|
|
304
322
|
},
|
|
323
|
+
"description": {
|
|
324
|
+
"type": "string"
|
|
325
|
+
},
|
|
305
326
|
"groupIdField": {
|
|
306
327
|
"type": "string"
|
|
307
328
|
},
|
|
@@ -324,6 +345,9 @@
|
|
|
324
345
|
"type": "string",
|
|
325
346
|
"enum": ["object"]
|
|
326
347
|
},
|
|
348
|
+
"description": {
|
|
349
|
+
"type": "string"
|
|
350
|
+
},
|
|
327
351
|
"required": {
|
|
328
352
|
"type": "array",
|
|
329
353
|
"items": {
|
|
@@ -344,6 +368,9 @@
|
|
|
344
368
|
"type": "string",
|
|
345
369
|
"enum": ["array"]
|
|
346
370
|
},
|
|
371
|
+
"description": {
|
|
372
|
+
"type": "string"
|
|
373
|
+
},
|
|
347
374
|
"items": {
|
|
348
375
|
"type": "object"
|
|
349
376
|
},
|
|
@@ -368,6 +395,9 @@
|
|
|
368
395
|
"type": "string",
|
|
369
396
|
"enum": ["string"]
|
|
370
397
|
},
|
|
398
|
+
"description": {
|
|
399
|
+
"type": "string"
|
|
400
|
+
},
|
|
371
401
|
"minLength": {
|
|
372
402
|
"type": "number"
|
|
373
403
|
},
|
|
@@ -402,6 +432,9 @@
|
|
|
402
432
|
"type": "string",
|
|
403
433
|
"enum": ["string"]
|
|
404
434
|
},
|
|
435
|
+
"description": {
|
|
436
|
+
"type": "string"
|
|
437
|
+
},
|
|
405
438
|
"minimum": {
|
|
406
439
|
"type": "number"
|
|
407
440
|
},
|
|
@@ -429,6 +462,9 @@
|
|
|
429
462
|
"type": "string",
|
|
430
463
|
"enum": ["boolean"]
|
|
431
464
|
},
|
|
465
|
+
"description": {
|
|
466
|
+
"type": "string"
|
|
467
|
+
},
|
|
432
468
|
"enum": {
|
|
433
469
|
"type": "array",
|
|
434
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;
|
|
@@ -166,6 +167,7 @@ function reportRootAttributesChanges(cloudSchema, updatedValues) {
|
|
|
166
167
|
console.group(`Schema ${cloudSchema.name} - Root attributes`);
|
|
167
168
|
if (changedKeys.length < 1) {
|
|
168
169
|
console.log('No update required.');
|
|
170
|
+
console.groupEnd();
|
|
169
171
|
return;
|
|
170
172
|
}
|
|
171
173
|
changedKeys.forEach(key => {
|
|
@@ -178,6 +180,7 @@ function reportSchemaChanges(group, changes) {
|
|
|
178
180
|
console.group(group);
|
|
179
181
|
if (!toAdd.length && !toRemove.length && !toUpdate.length) {
|
|
180
182
|
console.log('No update required');
|
|
183
|
+
console.groupEnd();
|
|
181
184
|
return;
|
|
182
185
|
}
|
|
183
186
|
toAdd.forEach(key => console.log(`Will be added: ${chalk.green(getIdentifier(key))}`));
|
package/build/commands/sync.js
CHANGED
|
@@ -110,9 +110,10 @@ const handler = async ({ sdk, path, schemas, tasks, templates, dispatchers, clea
|
|
|
110
110
|
const dispatchersPath = ospath.join(targetPath, 'dispatchers.json');
|
|
111
111
|
const isValidPath = (0, fs_1.existsSync)(dispatchersPath);
|
|
112
112
|
if (isValidPath) {
|
|
113
|
+
console.log(chalk.green('\n ⚙️ Syncing dispatchers...'));
|
|
113
114
|
await (0, dispatchers_1.sync)(sdk, dispatchersPath, cleanDispatchers);
|
|
114
115
|
}
|
|
115
|
-
else {
|
|
116
|
+
else if (dispatchers) {
|
|
116
117
|
console.log(chalk.yellow('Warning: dispatchers.json not found'));
|
|
117
118
|
}
|
|
118
119
|
}
|