@extrahorizon/exh-cli 1.7.0-dev-51-504a36e → 1.7.0-dev-52-aa2da76

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 CHANGED
@@ -5,6 +5,11 @@
5
5
  * This allows you to specify a json-schema for the schema files themselves, providing hints and validation in your editor
6
6
  * `exh data schemas sync` now allows all components in a schema to have a `description` property
7
7
  * These descriptions are not synced, but allow you to provide inline documentation for the components in your schema
8
+ * Revamped the schema validation to use the more complete json-schema definition
9
+ * This affects `exh data schemas verify` as well as `exh data schemas sync` and more accurately reports errors in your schemas
10
+ * This also means that some errors that were previously not reported might now be reported
11
+ * We believe this is a good thing moving forward and we're happy to help you resolve any issues you might encounter
12
+ * The `--ignoreSchemaVerificationErrors` flag can always be used to sync while you might be working on a schema with errors
8
13
  * Fixed some output inconsistencies in the sync commands
9
14
 
10
15
  ### v1.6.1
@@ -4,7 +4,6 @@ export declare enum TestId {
4
4
  PROPERTY_VERIFY = 2,
5
5
  INPUT_CONDITIONS = 3,
6
6
  STATUS_CHECK = 4,
7
- CONDITION_TYPES = 5,
8
7
  TRANSITION_NAMES = 6
9
8
  }
10
9
  interface InternalTestResult {
@@ -4,7 +4,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
5
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
6
  };
7
- var _SchemaVerify_instances, _SchemaVerify_verifyMetaSchema, _SchemaVerify_verifyTransitionNames, _SchemaVerify_verifyProperties, _SchemaVerify_verifyStatuses, _SchemaVerify_verifyInputConditions, _SchemaVerify_verifyConditionTypes;
7
+ var _SchemaVerify_instances, _SchemaVerify_verifyMetaSchema, _SchemaVerify_verifyTransitionNames, _SchemaVerify_verifyProperties, _SchemaVerify_verifyStatuses, _SchemaVerify_verifyInputConditions;
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.SchemaVerify = exports.TestId = void 0;
10
10
  var TestId;
@@ -13,7 +13,6 @@ var TestId;
13
13
  TestId[TestId["PROPERTY_VERIFY"] = 2] = "PROPERTY_VERIFY";
14
14
  TestId[TestId["INPUT_CONDITIONS"] = 3] = "INPUT_CONDITIONS";
15
15
  TestId[TestId["STATUS_CHECK"] = 4] = "STATUS_CHECK";
16
- TestId[TestId["CONDITION_TYPES"] = 5] = "CONDITION_TYPES";
17
16
  TestId[TestId["TRANSITION_NAMES"] = 6] = "TRANSITION_NAMES";
18
17
  })(TestId = exports.TestId || (exports.TestId = {}));
19
18
  function transformAjvErrors(offsetPath, errors) {
@@ -39,7 +38,6 @@ class SchemaVerify {
39
38
  yield { id: TestId.PROPERTY_VERIFY, test: 'Check if the properties object is valid JSON schema', ...__classPrivateFieldGet(this, _SchemaVerify_instances, "m", _SchemaVerify_verifyProperties).call(this) };
40
39
  yield { id: TestId.INPUT_CONDITIONS, test: 'Check if all input conditions of transitions are valid JSON schema', ...__classPrivateFieldGet(this, _SchemaVerify_instances, "m", _SchemaVerify_verifyInputConditions).call(this) };
41
40
  yield { id: TestId.STATUS_CHECK, test: 'Check if all statuses are accounted for', ...__classPrivateFieldGet(this, _SchemaVerify_instances, "m", _SchemaVerify_verifyStatuses).call(this) };
42
- yield { id: TestId.CONDITION_TYPES, test: 'Check if all condition types are used in the correct transitions', ...__classPrivateFieldGet(this, _SchemaVerify_instances, "m", _SchemaVerify_verifyConditionTypes).call(this) };
43
41
  yield { id: TestId.TRANSITION_NAMES, test: 'Check if all transition names are unique', ...__classPrivateFieldGet(this, _SchemaVerify_instances, "m", _SchemaVerify_verifyTransitionNames).call(this) };
44
42
  }
45
43
  validateTransition(transition, name) {
@@ -103,14 +101,6 @@ _SchemaVerify_instances = new WeakSet(), _SchemaVerify_verifyMetaSchema = functi
103
101
  return { ok: nonUniqueNames.size === 0, errors: [...nonUniqueNames].map(name => `Transition name '${name}' is not unique`) };
104
102
  }, _SchemaVerify_verifyProperties = function _SchemaVerify_verifyProperties() {
105
103
  if (this.schema.properties) {
106
- const tmpSchema = {
107
- $schema: 'http://json-schema.org/draft-07/schema#',
108
- type: 'object',
109
- properties: this.schema.properties,
110
- };
111
- if (!this.ajv.validateSchema(tmpSchema)) {
112
- return { ok: false, errors: transformAjvErrors('', this.ajv.errors) };
113
- }
114
104
  const errors = getIdInObjectArrayErrors(this.schema);
115
105
  if (errors.length > 0) {
116
106
  return { ok: false, errors: errors.map(path => `The following id property is not allowed: ${path}`) };
@@ -161,23 +151,6 @@ _SchemaVerify_instances = new WeakSet(), _SchemaVerify_verifyMetaSchema = functi
161
151
  ok = false;
162
152
  }
163
153
  return { ok, errors };
164
- }, _SchemaVerify_verifyConditionTypes = function _SchemaVerify_verifyConditionTypes() {
165
- let ok = true;
166
- const errors = [];
167
- if (this.schema.transitions) {
168
- for (const [tIndex, transition] of this.schema.transitions.entries()) {
169
- if (transition.type === 'manual' || !transition.conditions) {
170
- continue;
171
- }
172
- for (const [cIndex, condition] of transition.conditions.entries()) {
173
- if (['input', 'initiator'].includes(condition.type)) {
174
- ok = false;
175
- errors.push(`/transitions[${tIndex}]/conditions[${cIndex}] type cannot be ${condition.type} in a non-manual transition`);
176
- }
177
- }
178
- }
179
- }
180
- return { ok, errors };
181
154
  };
182
155
  function getIdInObjectArrayErrors(configuration, pathPrefix = '') {
183
156
  if (!configuration) {
@@ -5,10 +5,10 @@ const fs = require("fs");
5
5
  const path = require("path");
6
6
  const ajv_1 = require("ajv");
7
7
  const chalk = require("chalk");
8
+ const metaschema = require("../../../config-json-schemas/Schema.json");
8
9
  const error_1 = require("../../../helpers/error");
9
10
  const util_1 = require("../../../helpers/util");
10
11
  const listFilesInDir_1 = require("./util/listFilesInDir");
11
- const metaschema = require("./util/metaschema.json");
12
12
  const schemaverify_1 = require("./util/schemaverify");
13
13
  exports.command = 'verify';
14
14
  exports.desc = 'Syntactically verify a local schema';
@@ -0,0 +1,602 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "$schema": { "type": "string" },
6
+ "name": { "type": "string" },
7
+ "description": { "type": "string" },
8
+ "createMode": {
9
+ "type": "string",
10
+ "enum": [
11
+ "default",
12
+ "permissionRequired"
13
+ ]
14
+ },
15
+ "deleteMode": {
16
+ "type": "string",
17
+ "enum": [
18
+ "permissionRequired",
19
+ "linkedUsersOnly"
20
+ ]
21
+ },
22
+ "readMode": {
23
+ "type": "string",
24
+ "enum": [
25
+ "default",
26
+ "allUsers",
27
+ "enlistedInLinkedGroups"
28
+ ]
29
+ },
30
+ "updateMode": {
31
+ "type": "string",
32
+ "enum": [
33
+ "default",
34
+ "creatorOnly",
35
+ "disabled",
36
+ "linkedGroupsStaffOnly"
37
+ ]
38
+ },
39
+ "groupSyncMode": {
40
+ "type": "string",
41
+ "enum": [
42
+ "disabled",
43
+ "creatorPatientEnlistments",
44
+ "linkedUsersPatientEnlistments"
45
+ ]
46
+ },
47
+ "defaultLimit": { "type": "integer" },
48
+ "maximumLimit": { "type": "integer" },
49
+ "statuses": {
50
+ "type": "object",
51
+ "patternProperties": {
52
+ "^[A-Za-z][A-Za-z0-9_-]{0,49}$": {
53
+ "type": "object",
54
+ "patternProperties": {
55
+ "^[A-Za-z][A-Za-z0-9_-]{0,49}$": { "type": "string" }
56
+ },
57
+ "additionalProperties": false
58
+ }
59
+ },
60
+ "additionalProperties": false
61
+ },
62
+ "creationTransition": { "$ref": "#/definitions/CreationTransition" },
63
+ "transitions": {
64
+ "type": "array",
65
+ "items": {
66
+ "anyOf": [
67
+ { "$ref": "#/definitions/ManualTransition" },
68
+ { "$ref": "#/definitions/AutomaticTransition" }
69
+ ]
70
+ }
71
+ },
72
+ "indexes": {
73
+ "type": "array",
74
+ "items": { "$ref": "#/definitions/Index" }
75
+ },
76
+ "properties": {
77
+ "type": "object",
78
+ "additionalProperties": { "$ref": "#/definitions/TypeConfiguration" }
79
+ }
80
+ },
81
+ "required": [
82
+ "name",
83
+ "description",
84
+ "statuses",
85
+ "creationTransition",
86
+ "properties"
87
+ ],
88
+ "additionalProperties": false,
89
+ "definitions": {
90
+ "CreationTransition": {
91
+ "type": "object",
92
+ "properties": {
93
+ "type": { "const": "manual" },
94
+ "description": { "type": "string" },
95
+ "toStatus": {
96
+ "type": "string",
97
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,49}$"
98
+ },
99
+ "conditions": {
100
+ "type": "array",
101
+ "items": {
102
+ "anyOf": [
103
+ { "$ref": "#/definitions/InputCondition" },
104
+ { "$ref": "#/definitions/InitiatorHasRelationToUserInDataCondition" },
105
+ { "$ref": "#/definitions/InitiatorHasRelationToGroupInDataCondition" }
106
+ ]
107
+ }
108
+ },
109
+ "actions": {
110
+ "type": "array",
111
+ "items": { "$ref": "#/definitions/Action" }
112
+ },
113
+ "afterActions": { "type": "array" }
114
+ },
115
+ "required": [
116
+ "type",
117
+ "toStatus"
118
+ ],
119
+ "additionalProperties": false
120
+ },
121
+ "ManualTransition": {
122
+ "type": "object",
123
+ "properties": {
124
+ "type": { "const": "manual" },
125
+ "name": { "type": "string" },
126
+ "description": { "type": "string" },
127
+ "fromStatuses": {
128
+ "type": "array",
129
+ "items": {
130
+ "type": "string",
131
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,49}$"
132
+ },
133
+ "minItems": 1
134
+ },
135
+ "toStatus": {
136
+ "type": "string",
137
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,49}$"
138
+ },
139
+ "conditions": {
140
+ "type": "array",
141
+ "items": {
142
+ "anyOf": [
143
+ { "$ref": "#/definitions/InputCondition" },
144
+ { "$ref": "#/definitions/DocumentCondition" },
145
+ { "$ref": "#/definitions/InitiatorHasRelationToUserInDataCondition" },
146
+ { "$ref": "#/definitions/InitiatorHasRelationToGroupInDataCondition" }
147
+ ]
148
+ }
149
+ },
150
+ "actions": {
151
+ "type": "array",
152
+ "items": { "$ref": "#/definitions/Action" }
153
+ },
154
+ "afterActions": { "type": "array" }
155
+ },
156
+ "required": [
157
+ "type",
158
+ "name",
159
+ "fromStatuses",
160
+ "toStatus"
161
+ ],
162
+ "additionalProperties": false
163
+ },
164
+ "AutomaticTransition": {
165
+ "type": "object",
166
+ "properties": {
167
+ "type": { "const": "automatic" },
168
+ "name": { "type": "string" },
169
+ "description": { "type": "string" },
170
+ "fromStatuses": {
171
+ "type": "array",
172
+ "items": {
173
+ "type": "string",
174
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,49}$"
175
+ },
176
+ "minItems": 1
177
+ },
178
+ "toStatus": {
179
+ "type": "string",
180
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,49}$"
181
+ },
182
+ "conditions": {
183
+ "type": "array",
184
+ "items": {
185
+ "anyOf": [
186
+ { "$ref": "#/definitions/DocumentCondition" }
187
+ ]
188
+ }
189
+ },
190
+ "actions": {
191
+ "type": "array",
192
+ "items": { "$ref": "#/definitions/Action" }
193
+ },
194
+ "afterActions": { "type": "array" }
195
+ },
196
+ "required": [
197
+ "type",
198
+ "name",
199
+ "fromStatuses",
200
+ "toStatus"
201
+ ],
202
+ "additionalProperties": false
203
+ },
204
+ "Action": {
205
+ "type": "object",
206
+ "properties": {
207
+ "type": {
208
+ "type": "string",
209
+ "enum": [
210
+ "task",
211
+ "set",
212
+ "unset",
213
+ "addItems",
214
+ "removeItems",
215
+ "linkCreator",
216
+ "linkUserFromData",
217
+ "linkEnlistedGroups",
218
+ "linkGroupFromData",
219
+ "measurementReviewedNotification"
220
+ ]
221
+ }
222
+ },
223
+ "anyOf": [
224
+ { "$ref": "#/definitions/TaskAction" },
225
+ { "$ref": "#/definitions/SetAction" },
226
+ { "$ref": "#/definitions/UnsetAction" },
227
+ { "$ref": "#/definitions/AddItemsAction" },
228
+ { "$ref": "#/definitions/RemoveItemsAction" },
229
+ { "$ref": "#/definitions/LinkCreatorAction" },
230
+ { "$ref": "#/definitions/LinkUserFromDataAction" },
231
+ { "$ref": "#/definitions/LinkEnlistedGroupsAction" },
232
+ { "$ref": "#/definitions/LinkGroupFromDataAction" },
233
+ { "$ref": "#/definitions/MeasurementReviewedNotificationAction" }
234
+ ]
235
+ },
236
+ "TaskAction": {
237
+ "type": "object",
238
+ "properties": {
239
+ "type": { "const": "task" },
240
+ "description": { "type": "string" },
241
+ "functionName": { "type": "string" },
242
+ "data": {
243
+ "type": "object",
244
+ "additionalProperties": true
245
+ }
246
+ },
247
+ "required": [
248
+ "type",
249
+ "functionName"
250
+ ],
251
+ "additionalProperties": false
252
+ },
253
+ "SetAction": {
254
+ "type": "object",
255
+ "properties": {
256
+ "type": { "const": "set" },
257
+ "description": { "type": "string" },
258
+ "field": { "type": "string" },
259
+ "value": { "$ref": "#/definitions/Any" }
260
+ },
261
+ "required": [
262
+ "type",
263
+ "field",
264
+ "value"
265
+ ],
266
+ "additionalProperties": false
267
+ },
268
+ "UnsetAction": {
269
+ "type": "object",
270
+ "properties": {
271
+ "type": { "const": "unset" },
272
+ "description": { "type": "string" },
273
+ "fields": {
274
+ "type": "array",
275
+ "items": {
276
+ "type": "string"
277
+ }
278
+ }
279
+ },
280
+ "required": [
281
+ "type",
282
+ "fields"
283
+ ],
284
+ "additionalProperties": false
285
+ },
286
+ "AddItemsAction": {
287
+ "type": "object",
288
+ "properties": {
289
+ "type": { "const": "addItems" },
290
+ "description": { "type": "string" },
291
+ "field": { "type": "string" },
292
+ "values": {
293
+ "type": "array",
294
+ "items": { "$ref": "#/definitions/Any" }
295
+ }
296
+ },
297
+ "required": [
298
+ "type",
299
+ "field",
300
+ "values"
301
+ ],
302
+ "additionalProperties": false
303
+ },
304
+ "RemoveItemsAction": {
305
+ "type": "object",
306
+ "properties": {
307
+ "type": { "const": "removeItems" },
308
+ "description": { "type": "string" },
309
+ "field": { "type": "string" },
310
+ "values": {
311
+ "type": "array",
312
+ "items": { "$ref": "#/definitions/Any" }
313
+ }
314
+ },
315
+ "required": [
316
+ "type",
317
+ "field",
318
+ "values"
319
+ ],
320
+ "additionalProperties": false
321
+ },
322
+ "LinkCreatorAction": {
323
+ "type": "object",
324
+ "properties": {
325
+ "type": { "const": "linkCreator" },
326
+ "description": { "type": "string" }
327
+ },
328
+ "required": ["type"],
329
+ "additionalProperties": false
330
+ },
331
+ "LinkUserFromDataAction": {
332
+ "type": "object",
333
+ "properties": {
334
+ "type": { "const": "linkUserFromData" },
335
+ "description": { "type": "string" },
336
+ "userIdField": { "type": "string" }
337
+ },
338
+ "required": [
339
+ "type",
340
+ "userIdField"
341
+ ],
342
+ "additionalProperties": false
343
+ },
344
+ "LinkEnlistedGroupsAction": {
345
+ "type": "object",
346
+ "properties": {
347
+ "type": { "const": "linkEnlistedGroups" },
348
+ "description": { "type": "string" },
349
+ "onlyActive": { "type": "boolean" }
350
+ },
351
+ "required": ["type"],
352
+ "additionalProperties": false
353
+ },
354
+ "LinkGroupFromDataAction": {
355
+ "type": "object",
356
+ "properties": {
357
+ "type": { "const": "linkGroupFromData" },
358
+ "description": { "type": "string" },
359
+ "groupIdField": { "type": "string" }
360
+ },
361
+ "required": [
362
+ "type",
363
+ "groupIdField"
364
+ ],
365
+ "additionalProperties": false
366
+ },
367
+ "MeasurementReviewedNotificationAction": {
368
+ "type": "object",
369
+ "description": "Deprecated! The measurementReviewedNotification action is deprecated and should not be used.",
370
+ "properties": {
371
+ "type": {
372
+ "const": "measurementReviewedNotification",
373
+ "description": "Deprecated! The measurementReviewedNotification action is deprecated and should not be used."
374
+ },
375
+ "description": { "type": "string" }
376
+ },
377
+ "required": ["type"],
378
+ "additionalProperties": false
379
+ },
380
+ "InputCondition": {
381
+ "type": "object",
382
+ "properties": {
383
+ "type": { "const": "input" },
384
+ "configuration": { "$ref": "#/definitions/TypeConfiguration" },
385
+ "description": { "type": "string" }
386
+ },
387
+ "required": [
388
+ "type",
389
+ "configuration"
390
+ ],
391
+ "additionalProperties": false
392
+ },
393
+ "DocumentCondition": {
394
+ "type": "object",
395
+ "properties": {
396
+ "type": { "const": "document" },
397
+ "configuration": { "$ref": "#/definitions/TypeConfiguration" },
398
+ "description": { "type": "string" }
399
+ },
400
+ "required": [
401
+ "type",
402
+ "configuration"
403
+ ],
404
+ "additionalProperties": false
405
+ },
406
+ "InitiatorHasRelationToUserInDataCondition": {
407
+ "type": "object",
408
+ "properties": {
409
+ "type": { "const": "initiatorHasRelationToUserInData" },
410
+ "description": { "type": "string" },
411
+ "userIdField": { "type": "string" },
412
+ "relation": {
413
+ "type": "string",
414
+ "enum": [
415
+ "isStaffOfTargetPatient"
416
+ ]
417
+ }
418
+ },
419
+ "required": [
420
+ "type",
421
+ "userIdField",
422
+ "relation"
423
+ ],
424
+ "additionalProperties": false
425
+ },
426
+ "InitiatorHasRelationToGroupInDataCondition": {
427
+ "type": "object",
428
+ "properties": {
429
+ "type": { "const": "initiatorHasRelationToGroupInData" },
430
+ "description": { "type": "string" },
431
+ "groupIdField": { "type": "string" },
432
+ "relation": {
433
+ "type": "string",
434
+ "enum": [
435
+ "staff",
436
+ "patient"
437
+ ]
438
+ },
439
+ "requiredPermission": { "type": "string" }
440
+ },
441
+ "required": [
442
+ "type",
443
+ "groupIdField",
444
+ "relation"
445
+ ],
446
+ "additionalProperties": false
447
+ },
448
+ "TypeConfiguration": {
449
+ "anyOf": [
450
+ { "$ref": "#/definitions/ObjectConfiguration" },
451
+ { "$ref": "#/definitions/ArrayConfiguration" },
452
+ { "$ref": "#/definitions/StringConfiguration" },
453
+ { "$ref": "#/definitions/NumberConfiguration" },
454
+ { "$ref": "#/definitions/BooleanConfiguration" }
455
+ ]
456
+ },
457
+ "ObjectConfiguration": {
458
+ "type": "object",
459
+ "properties": {
460
+ "type": { "const": "object" },
461
+ "description": { "type": "string" },
462
+ "properties": {
463
+ "type": "object",
464
+ "additionalProperties": { "$ref": "#/definitions/TypeConfiguration" }
465
+ },
466
+ "additionalProperties": { "$ref": "#/definitions/TypeConfiguration" },
467
+ "required": {
468
+ "type": "array",
469
+ "items": { "type": "string" }
470
+ },
471
+ "queryable": { "type": "boolean" }
472
+ },
473
+ "required": ["type"],
474
+ "additionalProperties": false
475
+ },
476
+ "ArrayConfiguration": {
477
+ "type": "object",
478
+ "properties": {
479
+ "type": { "const": "array" },
480
+ "description": { "type": "string" },
481
+ "items": { "$ref": "#/definitions/TypeConfiguration" },
482
+ "minItems": { "type": "number" },
483
+ "maxItems": { "type": "number" },
484
+ "contains": { "$ref": "#/definitions/TypeConfiguration" },
485
+ "queryable": { "type": "boolean" }
486
+ },
487
+ "required": ["type"],
488
+ "additionalProperties": false
489
+ },
490
+ "StringConfiguration": {
491
+ "type": "object",
492
+ "properties": {
493
+ "type": { "const": "string" },
494
+ "description": { "type": "string" },
495
+ "minLength": { "type": "number" },
496
+ "maxLength": { "type": "number" },
497
+ "enum": {
498
+ "type": "array",
499
+ "items": { "type": "string" }
500
+ },
501
+ "const": { "type": "string" },
502
+ "pattern": { "type": "string" },
503
+ "format": {
504
+ "type": "string",
505
+ "enum": ["date-time"]
506
+ },
507
+ "queryable": { "type": "boolean" }
508
+ },
509
+ "required": ["type"],
510
+ "additionalProperties": false
511
+ },
512
+ "NumberConfiguration": {
513
+ "type": "object",
514
+ "properties": {
515
+ "type": { "const": "number" },
516
+ "description": { "type": "string" },
517
+ "minimum": { "type": "number" },
518
+ "maximum": { "type": "number" },
519
+ "enum": {
520
+ "type": "array",
521
+ "items": { "type": "number" }
522
+ },
523
+ "const": { "type": "number" },
524
+ "queryable": { "type": "boolean" }
525
+ },
526
+ "required": ["type"],
527
+ "additionalProperties": false
528
+ },
529
+ "BooleanConfiguration": {
530
+ "type": "object",
531
+ "properties": {
532
+ "type": { "const": "boolean" },
533
+ "description": { "type": "string" },
534
+ "enum": {
535
+ "type": "array",
536
+ "items": { "type": "boolean" }
537
+ },
538
+ "const": { "type": "boolean" },
539
+ "queryable": { "type": "boolean" }
540
+ },
541
+ "required": ["type"],
542
+ "additionalProperties": false
543
+ },
544
+ "Index": {
545
+ "type": "object",
546
+ "properties": {
547
+ "name": { "type": "string" },
548
+ "description": { "type": "string" },
549
+ "fields": {
550
+ "type": "array",
551
+ "items": {
552
+ "type": "object",
553
+ "properties": {
554
+ "name": { "type": "string" },
555
+ "type": {
556
+ "type": "string",
557
+ "enum": [
558
+ "asc",
559
+ "desc",
560
+ "text"
561
+ ]
562
+ }
563
+ },
564
+ "required": [
565
+ "name",
566
+ "type"
567
+ ],
568
+ "additionalProperties": false
569
+ }
570
+ },
571
+ "options": {
572
+ "type": "object",
573
+ "properties": {
574
+ "unique": { "type": "boolean" },
575
+ "sparse": { "type": "boolean" }
576
+ },
577
+ "additionalProperties": false
578
+ }
579
+ },
580
+ "additionalProperties": false,
581
+ "required": [
582
+ "name",
583
+ "fields"
584
+ ]
585
+ },
586
+ "Any": {
587
+ "anyOf": [
588
+ {
589
+ "type": "object",
590
+ "additionalProperties": true
591
+ },
592
+ {
593
+ "type": "array",
594
+ "items": true
595
+ },
596
+ { "type": "string" },
597
+ { "type": "number" },
598
+ { "type": "boolean" }
599
+ ]
600
+ }
601
+ }
602
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@extrahorizon/exh-cli",
3
- "version": "1.7.0-dev-51-504a36e",
3
+ "version": "1.7.0-dev-52-aa2da76",
4
4
  "main": "build/index.js",
5
5
  "exports": "./build/index.js",
6
6
  "license": "MIT",
@@ -1,494 +0,0 @@
1
- {
2
- "type": "object",
3
- "properties": {
4
- "$schema": {
5
- "type": "string"
6
- },
7
- "name": {
8
- "type": "string"
9
- },
10
- "description": {
11
- "type": "string"
12
- },
13
- "createMode": {
14
- "enum": [
15
- "default",
16
- "permissionRequired"
17
- ],
18
- "type": "string"
19
- },
20
- "deleteMode": {
21
- "enum": [
22
- "permissionRequired",
23
- "linkedUsersOnly"
24
- ],
25
- "type": "string"
26
- },
27
- "readMode": {
28
- "enum": [
29
- "default",
30
- "allUsers",
31
- "enlistedInLinkedGroups"
32
- ],
33
- "type": "string"
34
- },
35
- "updateMode": {
36
- "enum": [
37
- "default",
38
- "creatorOnly",
39
- "disabled",
40
- "linkedGroupsStaffOnly"
41
- ],
42
- "type": "string"
43
- },
44
- "groupSyncMode": {
45
- "type": "string",
46
- "enum": [
47
- "disabled",
48
- "creatorPatientEnlistments",
49
- "linkedUsersPatientEnlistments"
50
- ]
51
- },
52
- "defaultLimit": {
53
- "type": "integer"
54
- },
55
- "maximumLimit": {
56
- "type": "integer"
57
- },
58
- "statuses": {
59
- "patternProperties": {
60
- "^[A-Za-z][A-Za-z0-9_-]{0,49}$": {
61
- "type": "object"
62
- }
63
- },
64
- "type": "object",
65
- "additionalProperties": false
66
- },
67
- "creationTransition": {
68
- "properties": {
69
- "actions": {
70
- "$ref": "#/definitions/actions"
71
- },
72
- "afterActions": {
73
- "$ref": "#/definitions/afterActions"
74
- },
75
- "conditions": {
76
- "$ref": "#/definitions/conditions"
77
- },
78
- "toStatus": {
79
- "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,49}$",
80
- "type": "string"
81
- },
82
- "type": {
83
- "const": "manual"
84
- },
85
- "description": {
86
- "type": "string"
87
- }
88
- },
89
- "additionalProperties": false,
90
- "required": [
91
- "type",
92
- "toStatus"
93
- ],
94
- "type": "object"
95
- },
96
- "transitions": {
97
- "type": "array",
98
- "items": {
99
- "type": "object",
100
- "properties": {
101
- "name": {
102
- "type": "string"
103
- },
104
- "description": {
105
- "type": "string"
106
- },
107
- "type": {
108
- "enum": [
109
- "manual",
110
- "automatic"
111
- ],
112
- "type": "string"
113
- },
114
- "fromStatuses": {
115
- "minLength": 1,
116
- "items": {
117
- "type": "string"
118
- },
119
- "type": "array"
120
- },
121
- "toStatus": {
122
- "type": "string"
123
- },
124
- "actions": {
125
- "$ref": "#/definitions/actions"
126
- },
127
- "afterActions": {
128
- "$ref": "#/definitions/afterActions"
129
- },
130
- "conditions": {
131
- "$ref": "#/definitions/conditions"
132
- }
133
- },
134
- "additionalProperties": false,
135
- "required": [
136
- "name",
137
- "type",
138
- "fromStatuses",
139
- "toStatus"
140
- ]
141
- }
142
- },
143
- "indexes": {
144
- "type": "array",
145
- "items": {
146
- "type": "object",
147
- "properties": {
148
- "name": {
149
- "type": "string"
150
- },
151
- "description": {
152
- "type": "string"
153
- },
154
- "fields": {
155
- "type": "array",
156
- "items": {
157
- "type": "object",
158
- "properties": {
159
- "name": {
160
- "type": "string"
161
- },
162
- "type": {
163
- "type": "string",
164
- "enum": [
165
- "asc",
166
- "desc",
167
- "text"
168
- ]
169
- }
170
- }
171
- }
172
- },
173
- "options": {
174
- "type": "object",
175
- "properties": {
176
- "unique": {
177
- "type": "boolean"
178
- },
179
- "sparse": {
180
- "type": "boolean"
181
- }
182
- },
183
- "additionalProperties": false
184
- }
185
- },
186
- "additionalProperties": false,
187
- "required": [
188
- "name",
189
- "fields"
190
- ]
191
- }
192
- },
193
- "properties": {
194
- "type": "object"
195
- }
196
- },
197
- "required": [
198
- "name",
199
- "description",
200
- "statuses",
201
- "creationTransition",
202
- "properties"
203
- ],
204
- "additionalProperties": false,
205
- "definitions": {
206
- "afterActions": {
207
- "type": "array",
208
- "items": {
209
- "type": "object",
210
- "properties": {
211
- "type": {
212
- "type": "string"
213
- }
214
- }
215
- }
216
- },
217
- "actions": {
218
- "items": {
219
- "type": "object",
220
- "properties": {
221
- "type": {
222
- "type": "string",
223
- "enum": [
224
- "task",
225
- "set",
226
- "unset",
227
- "addItems",
228
- "removeItems",
229
- "linkCreator",
230
- "linkUserFromData",
231
- "linkEnlistedGroups",
232
- "linkGroupFromData",
233
- "measurementReviewedNotification",
234
- "notifyAlgoQueueManager"
235
- ]
236
- }
237
- },
238
- "required": [
239
- "type"
240
- ]
241
- },
242
- "type": "array"
243
- },
244
- "conditions": {
245
- "type": "array",
246
- "items": {
247
- "type": "object",
248
- "anyOf": [
249
- { "$ref": "#/definitions/inputCondition" },
250
- { "$ref": "#/definitions/documentCondition" },
251
- { "$ref": "#/definitions/initiatorHasRelationToUserInDataCondition" },
252
- { "$ref": "#/definitions/initiatorHasRelationToGroupInData" }
253
- ]
254
- }
255
- },
256
- "inputCondition": {
257
- "type": "object",
258
- "properties": {
259
- "configuration": { "$ref": "#/definitions/configurations" },
260
- "type": {
261
- "type": "string",
262
- "enum": ["input"]
263
- },
264
- "description": {
265
- "type": "string"
266
- },
267
- "required": {
268
- "type": "array",
269
- "items": { "type": "string" }
270
- }
271
- }
272
- },
273
- "documentCondition": {
274
- "type": "object",
275
- "properties": {
276
- "configuration": { "$ref": "#/definitions/configurations" },
277
- "type": {
278
- "type": "string",
279
- "enum": ["document"]
280
- },
281
- "description": {
282
- "type": "string"
283
- },
284
- "required": {
285
- "type": "array",
286
- "items": { "type": "string" }
287
- }
288
- }
289
- },
290
- "initiatorHasRelationToUserInDataCondition": {
291
- "type": "object",
292
- "properties": {
293
- "type": {
294
- "type": "string",
295
- "enum": [
296
- "initiatorHasRelationToUserInData"
297
- ]
298
- },
299
- "description": {
300
- "type": "string"
301
- },
302
- "userIdField": {
303
- "type": "string"
304
- },
305
- "relation": {
306
- "type": "string",
307
- "enum": ["isStaffOfTargetPatient"]
308
- }
309
- },
310
- "required": [
311
- "type"
312
- ]
313
- },
314
- "initiatorHasRelationToGroupInData": {
315
- "type": "object",
316
- "properties": {
317
- "type": {
318
- "type": "string",
319
- "enum": [
320
- "initiatorHasRelationToGroupInData"
321
- ]
322
- },
323
- "description": {
324
- "type": "string"
325
- },
326
- "groupIdField": {
327
- "type": "string"
328
- },
329
- "relation": {
330
- "type": "string",
331
- "enum": ["staff", "patient"]
332
- },
333
- "requiredPermission": {
334
- "type": "string"
335
- }
336
- },
337
- "required": [
338
- "type"
339
- ]
340
- },
341
- "objectConfiguration": {
342
- "type": "object",
343
- "properties": {
344
- "type": {
345
- "type": "string",
346
- "enum": ["object"]
347
- },
348
- "description": {
349
- "type": "string"
350
- },
351
- "required": {
352
- "type": "array",
353
- "items": {
354
- "type": "string"
355
- }
356
- },
357
- "queryable": {
358
- "type": "boolean"
359
- }
360
- },
361
- "additionalProperties": true,
362
- "required": ["type"]
363
- },
364
- "arrayConfiguration": {
365
- "type": "object",
366
- "properties": {
367
- "type": {
368
- "type": "string",
369
- "enum": ["array"]
370
- },
371
- "description": {
372
- "type": "string"
373
- },
374
- "items": {
375
- "type": "object"
376
- },
377
- "minItems": {
378
- "type": "number"
379
- },
380
- "maxItems": {
381
- "type": "number"
382
- },
383
- "contains": {
384
- "type": "object"
385
- },
386
- "queryable": {
387
- "type": "boolean"
388
- }
389
- }
390
- },
391
- "stringConfigurations": {
392
- "type": "object",
393
- "properties": {
394
- "type": {
395
- "type": "string",
396
- "enum": ["string"]
397
- },
398
- "description": {
399
- "type": "string"
400
- },
401
- "minLength": {
402
- "type": "number"
403
- },
404
- "maxLength": {
405
- "type": "number"
406
- },
407
- "enum": {
408
- "type": "array",
409
- "items": {
410
- "type": "string"
411
- }
412
- },
413
- "const": {
414
- "type": "string"
415
- },
416
- "pattern": {
417
- "type": "string"
418
- },
419
- "format": {
420
- "type": "string",
421
- "enum": ["date-time"]
422
- },
423
- "queryable": {
424
- "type": "boolean"
425
- }
426
- }
427
- },
428
- "numberConfigurations": {
429
- "type": "object",
430
- "properties": {
431
- "type": {
432
- "type": "string",
433
- "enum": ["string"]
434
- },
435
- "description": {
436
- "type": "string"
437
- },
438
- "minimum": {
439
- "type": "number"
440
- },
441
- "maximum": {
442
- "type": "number"
443
- },
444
- "enum": {
445
- "type": "array",
446
- "items": {
447
- "type": "number"
448
- }
449
- },
450
- "const": {
451
- "type": "number"
452
- },
453
- "queryable": {
454
- "type": "boolean"
455
- }
456
- }
457
- },
458
- "booleanConfigurations": {
459
- "type": "object",
460
- "properties": {
461
- "type": {
462
- "type": "string",
463
- "enum": ["boolean"]
464
- },
465
- "description": {
466
- "type": "string"
467
- },
468
- "enum": {
469
- "type": "array",
470
- "items": {
471
- "type": "boolean"
472
- }
473
- },
474
- "const": {
475
- "type": "boolean"
476
- },
477
- "queryable": {
478
- "type": "boolean"
479
- }
480
- },
481
- "required": ["type"]
482
- },
483
- "configurations": {
484
- "type": "object",
485
- "anyOf": [
486
- { "$ref": "#/definitions/objectConfiguration" },
487
- { "$ref": "#/definitions/arrayConfiguration" },
488
- { "$ref": "#/definitions/stringConfigurations" },
489
- { "$ref": "#/definitions/numberConfigurations" },
490
- { "$ref": "#/definitions/booleanConfigurations" }
491
- ]
492
- }
493
- }
494
- }