@extrahorizon/exh-cli 1.5.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 (93) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/LICENSE +21 -0
  3. package/README.md +66 -0
  4. package/build/commands/completion.d.ts +5 -0
  5. package/build/commands/completion.js +38 -0
  6. package/build/commands/data/schemas/delete.d.ts +10 -0
  7. package/build/commands/data/schemas/delete.js +29 -0
  8. package/build/commands/data/schemas/list.d.ts +8 -0
  9. package/build/commands/data/schemas/list.js +20 -0
  10. package/build/commands/data/schemas/sync/statusHelpers.d.ts +3 -0
  11. package/build/commands/data/schemas/sync/statusHelpers.js +49 -0
  12. package/build/commands/data/schemas/sync.d.ts +35 -0
  13. package/build/commands/data/schemas/sync.js +72 -0
  14. package/build/commands/data/schemas/util/listFilesInDir.d.ts +1 -0
  15. package/build/commands/data/schemas/util/listFilesInDir.js +25 -0
  16. package/build/commands/data/schemas/util/metaschema.json +455 -0
  17. package/build/commands/data/schemas/util/readJson.d.ts +1 -0
  18. package/build/commands/data/schemas/util/readJson.js +11 -0
  19. package/build/commands/data/schemas/util/schemaverify.d.ts +28 -0
  20. package/build/commands/data/schemas/util/schemaverify.js +202 -0
  21. package/build/commands/data/schemas/util/syncSchema.d.ts +20 -0
  22. package/build/commands/data/schemas/util/syncSchema.js +276 -0
  23. package/build/commands/data/schemas/util/tests/listFilesInDir.test.d.ts +1 -0
  24. package/build/commands/data/schemas/util/tests/listFilesInDir.test.js +40 -0
  25. package/build/commands/data/schemas/verify.d.ts +18 -0
  26. package/build/commands/data/schemas/verify.js +82 -0
  27. package/build/commands/data/schemas.d.ts +5 -0
  28. package/build/commands/data/schemas.js +10 -0
  29. package/build/commands/data.d.ts +5 -0
  30. package/build/commands/data.js +10 -0
  31. package/build/commands/dispatchers/sync.d.ts +21 -0
  32. package/build/commands/dispatchers/sync.js +24 -0
  33. package/build/commands/dispatchers.d.ts +5 -0
  34. package/build/commands/dispatchers.js +10 -0
  35. package/build/commands/login.d.ts +37 -0
  36. package/build/commands/login.js +59 -0
  37. package/build/commands/sync.d.ts +55 -0
  38. package/build/commands/sync.js +107 -0
  39. package/build/commands/tasks/createrepo.d.ts +22 -0
  40. package/build/commands/tasks/createrepo.js +70 -0
  41. package/build/commands/tasks/delete.d.ts +10 -0
  42. package/build/commands/tasks/delete.js +29 -0
  43. package/build/commands/tasks/list.d.ts +8 -0
  44. package/build/commands/tasks/list.js +27 -0
  45. package/build/commands/tasks/sync.d.ts +56 -0
  46. package/build/commands/tasks/sync.js +122 -0
  47. package/build/commands/tasks/taskConfig.d.ts +24 -0
  48. package/build/commands/tasks/taskConfig.js +169 -0
  49. package/build/commands/tasks/util.d.ts +1 -0
  50. package/build/commands/tasks/util.js +27 -0
  51. package/build/commands/tasks.d.ts +5 -0
  52. package/build/commands/tasks.js +10 -0
  53. package/build/commands/templates/delete.d.ts +19 -0
  54. package/build/commands/templates/delete.js +48 -0
  55. package/build/commands/templates/get.d.ts +19 -0
  56. package/build/commands/templates/get.js +37 -0
  57. package/build/commands/templates/list.d.ts +9 -0
  58. package/build/commands/templates/list.js +25 -0
  59. package/build/commands/templates/sync.d.ts +22 -0
  60. package/build/commands/templates/sync.js +65 -0
  61. package/build/commands/templates/util/buildTemplates.d.ts +2 -0
  62. package/build/commands/templates/util/buildTemplates.js +50 -0
  63. package/build/commands/templates/util/readTemplateFiles.d.ts +3 -0
  64. package/build/commands/templates/util/readTemplateFiles.js +52 -0
  65. package/build/commands/templates/util/templateService.d.ts +8 -0
  66. package/build/commands/templates/util/templateService.js +18 -0
  67. package/build/commands/templates/util/uploadTemplate.d.ts +2 -0
  68. package/build/commands/templates/util/uploadTemplate.js +20 -0
  69. package/build/commands/templates/util/utils.d.ts +4 -0
  70. package/build/commands/templates/util/utils.js +22 -0
  71. package/build/commands/templates.d.ts +5 -0
  72. package/build/commands/templates.js +10 -0
  73. package/build/constants.d.ts +13 -0
  74. package/build/constants.js +37 -0
  75. package/build/exh.d.ts +3 -0
  76. package/build/exh.js +65 -0
  77. package/build/helpers/error.d.ts +2 -0
  78. package/build/helpers/error.js +6 -0
  79. package/build/helpers/repoConfig.d.ts +2 -0
  80. package/build/helpers/repoConfig.js +60 -0
  81. package/build/helpers/util.d.ts +3 -0
  82. package/build/helpers/util.js +36 -0
  83. package/build/index.d.ts +2 -0
  84. package/build/index.js +33 -0
  85. package/build/repositories/dispatchers.d.ts +8 -0
  86. package/build/repositories/dispatchers.js +31 -0
  87. package/build/repositories/functions.d.ts +24 -0
  88. package/build/repositories/functions.js +28 -0
  89. package/build/repositories/schemas.d.ts +44 -0
  90. package/build/repositories/schemas.js +86 -0
  91. package/build/services/dispatchers.d.ts +3 -0
  92. package/build/services/dispatchers.js +132 -0
  93. package/package.json +53 -0
@@ -0,0 +1,455 @@
1
+ {
2
+ "type": "object",
3
+ "properties": {
4
+ "name": {
5
+ "type": "string"
6
+ },
7
+ "description": {
8
+ "type": "string"
9
+ },
10
+ "createMode": {
11
+ "enum": [
12
+ "default",
13
+ "permissionRequired"
14
+ ],
15
+ "type": "string"
16
+ },
17
+ "deleteMode": {
18
+ "enum": [
19
+ "permissionRequired",
20
+ "linkedUsersOnly"
21
+ ],
22
+ "type": "string"
23
+ },
24
+ "readMode": {
25
+ "enum": [
26
+ "default",
27
+ "allUsers",
28
+ "enlistedInLinkedGroups"
29
+ ],
30
+ "type": "string"
31
+ },
32
+ "updateMode": {
33
+ "enum": [
34
+ "default",
35
+ "creatorOnly",
36
+ "disabled",
37
+ "linkedGroupsStaffOnly"
38
+ ],
39
+ "type": "string"
40
+ },
41
+ "groupSyncMode": {
42
+ "type": "string",
43
+ "enum": [
44
+ "disabled",
45
+ "creatorPatientEnlistments",
46
+ "linkedUsersPatientEnlistments"
47
+ ]
48
+ },
49
+ "defaultLimit": {
50
+ "type": "integer"
51
+ },
52
+ "maximumLimit": {
53
+ "type": "integer"
54
+ },
55
+ "statuses": {
56
+ "patternProperties": {
57
+ "^[A-Za-z][A-Za-z0-9_-]{0,49}$": {
58
+ "type": "object"
59
+ }
60
+ },
61
+ "type": "object",
62
+ "additionalProperties": false
63
+ },
64
+ "creationTransition": {
65
+ "properties": {
66
+ "actions": {
67
+ "$ref": "#/definitions/actions"
68
+ },
69
+ "afterActions": {
70
+ "$ref": "#/definitions/afterActions"
71
+ },
72
+ "conditions": {
73
+ "$ref": "#/definitions/conditions"
74
+ },
75
+ "toStatus": {
76
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]{0,49}$",
77
+ "type": "string"
78
+ },
79
+ "type": {
80
+ "const": "manual"
81
+ }
82
+ },
83
+ "additionalProperties": false,
84
+ "required": [
85
+ "type",
86
+ "toStatus"
87
+ ],
88
+ "type": "object"
89
+ },
90
+ "transitions": {
91
+ "type": "array",
92
+ "items": {
93
+ "type": "object",
94
+ "properties": {
95
+ "name": {
96
+ "type": "string"
97
+ },
98
+ "type": {
99
+ "enum": [
100
+ "manual",
101
+ "automatic"
102
+ ],
103
+ "type": "string"
104
+ },
105
+ "fromStatuses": {
106
+ "minLength": 1,
107
+ "items": {
108
+ "type": "string"
109
+ },
110
+ "type": "array"
111
+ },
112
+ "toStatus": {
113
+ "type": "string"
114
+ },
115
+ "actions": {
116
+ "$ref": "#/definitions/actions"
117
+ },
118
+ "afterActions": {
119
+ "$ref": "#/definitions/afterActions"
120
+ },
121
+ "conditions": {
122
+ "$ref": "#/definitions/conditions"
123
+ }
124
+ },
125
+ "additionalProperties": false,
126
+ "required": [
127
+ "name",
128
+ "type",
129
+ "fromStatuses",
130
+ "toStatus"
131
+ ]
132
+ }
133
+ },
134
+ "indexes": {
135
+ "type": "array",
136
+ "items": {
137
+ "type": "object",
138
+ "properties": {
139
+ "name": {
140
+ "type": "string"
141
+ },
142
+ "fields": {
143
+ "type": "array",
144
+ "items": {
145
+ "type": "object",
146
+ "properties": {
147
+ "name": {
148
+ "type": "string"
149
+ },
150
+ "type": {
151
+ "type": "string",
152
+ "enum": [
153
+ "asc",
154
+ "desc",
155
+ "text"
156
+ ]
157
+ }
158
+ }
159
+ }
160
+ },
161
+ "options": {
162
+ "type": "object",
163
+ "properties": {
164
+ "unique": {
165
+ "type": "boolean"
166
+ },
167
+ "sparse": {
168
+ "type": "boolean"
169
+ }
170
+ },
171
+ "additionalProperties": false
172
+ }
173
+ },
174
+ "additionalProperties": false,
175
+ "required": [
176
+ "name",
177
+ "fields"
178
+ ]
179
+ }
180
+ },
181
+ "properties": {
182
+ "type": "object"
183
+ }
184
+ },
185
+ "required": [
186
+ "name",
187
+ "description",
188
+ "statuses",
189
+ "creationTransition",
190
+ "properties"
191
+ ],
192
+ "additionalProperties": false,
193
+ "definitions": {
194
+ "afterActions": {
195
+ "type": "array",
196
+ "items": {
197
+ "type": "object",
198
+ "properties": {
199
+ "type": {
200
+ "type": "string"
201
+ }
202
+ }
203
+ }
204
+ },
205
+ "actions": {
206
+ "items": {
207
+ "type": "object",
208
+ "properties": {
209
+ "type": {
210
+ "type": "string",
211
+ "enum": [
212
+ "task",
213
+ "set",
214
+ "unset",
215
+ "addItems",
216
+ "removeItems",
217
+ "linkCreator",
218
+ "linkUserFromData",
219
+ "linkEnlistedGroups",
220
+ "linkGroupFromData",
221
+ "measurementReviewedNotification",
222
+ "notifyAlgoQueueManager"
223
+ ]
224
+ }
225
+ },
226
+ "required": [
227
+ "type"
228
+ ]
229
+ },
230
+ "type": "array"
231
+ },
232
+ "conditions": {
233
+ "type": "array",
234
+ "items": {
235
+ "type": "object",
236
+ "anyOf": [
237
+ { "$ref": "#/definitions/inputCondition" },
238
+ { "$ref": "#/definitions/documentCondition" },
239
+ { "$ref": "#/definitions/initiatorHasRelationToUserInDataCondition" },
240
+ { "$ref": "#/definitions/initiatorHasRelationToGroupInData" }
241
+ ]
242
+ }
243
+ },
244
+ "inputCondition": {
245
+ "type": "object",
246
+ "properties": {
247
+ "configuration": { "$ref": "#/definitions/configurations" },
248
+ "type": {
249
+ "type": "string",
250
+ "enum": ["input"]
251
+ },
252
+ "required": {
253
+ "type": "array",
254
+ "items": { "type": "string" }
255
+ }
256
+ }
257
+ },
258
+ "documentCondition": {
259
+ "type": "object",
260
+ "properties": {
261
+ "configuration": { "$ref": "#/definitions/configurations" },
262
+ "type": {
263
+ "type": "string",
264
+ "enum": ["input"]
265
+ },
266
+ "required": {
267
+ "type": "array",
268
+ "items": { "type": "string" }
269
+ }
270
+ }
271
+ },
272
+ "initiatorHasRelationToUserInDataCondition": {
273
+ "type": "object",
274
+ "properties": {
275
+ "type": {
276
+ "type": "string",
277
+ "enum": [
278
+ "initiatorHasRelationToUserInData"
279
+ ]
280
+ },
281
+ "userIdField": {
282
+ "type": "string"
283
+ },
284
+ "relation": {
285
+ "type": "string",
286
+ "enum": ["isStaffOfTargetPatient"]
287
+ }
288
+ },
289
+ "required": [
290
+ "type"
291
+ ]
292
+ },
293
+ "initiatorHasRelationToGroupInData": {
294
+ "type": "object",
295
+ "properties": {
296
+ "type": {
297
+ "type": "string",
298
+ "enum": [
299
+ "initiatorHasRelationToGroupInData"
300
+ ]
301
+ },
302
+ "groupIdField": {
303
+ "type": "string"
304
+ },
305
+ "relation": {
306
+ "type": "string",
307
+ "enum": ["staff", "patient"]
308
+ },
309
+ "requiredPermission": {
310
+ "type": "string"
311
+ }
312
+ },
313
+ "required": [
314
+ "type"
315
+ ]
316
+ },
317
+ "objectConfiguration": {
318
+ "type": "object",
319
+ "properties": {
320
+ "type": {
321
+ "type": "string",
322
+ "enum": ["object"]
323
+ },
324
+ "required": {
325
+ "type": "array",
326
+ "items": {
327
+ "type": "string"
328
+ }
329
+ },
330
+ "queryable": {
331
+ "type": "boolean"
332
+ }
333
+ },
334
+ "additionalProperties": true,
335
+ "required": ["type"]
336
+ },
337
+ "arrayConfiguration": {
338
+ "type": "object",
339
+ "properties": {
340
+ "type": {
341
+ "type": "string",
342
+ "enum": ["array"]
343
+ },
344
+ "items": {
345
+ "type": "object"
346
+ },
347
+ "minItems": {
348
+ "type": "number"
349
+ },
350
+ "maxItems": {
351
+ "type": "number"
352
+ },
353
+ "contains": {
354
+ "type": "object"
355
+ },
356
+ "queryable": {
357
+ "type": "boolean"
358
+ }
359
+ }
360
+ },
361
+ "stringConfigurations": {
362
+ "type": "object",
363
+ "properties": {
364
+ "type": {
365
+ "type": "string",
366
+ "enum": ["string"]
367
+ },
368
+ "minLength": {
369
+ "type": "number"
370
+ },
371
+ "maxLength": {
372
+ "type": "number"
373
+ },
374
+ "enum": {
375
+ "type": "array",
376
+ "items": {
377
+ "type": "string"
378
+ }
379
+ },
380
+ "const": {
381
+ "type": "string"
382
+ },
383
+ "pattern": {
384
+ "type": "string"
385
+ },
386
+ "format": {
387
+ "type": "string",
388
+ "enum": ["date-time"]
389
+ },
390
+ "queryable": {
391
+ "type": "boolean"
392
+ }
393
+ }
394
+ },
395
+ "numberConfigurations": {
396
+ "type": "object",
397
+ "properties": {
398
+ "type": {
399
+ "type": "string",
400
+ "enum": ["string"]
401
+ },
402
+ "minimum": {
403
+ "type": "number"
404
+ },
405
+ "maximum": {
406
+ "type": "number"
407
+ },
408
+ "enum": {
409
+ "type": "array",
410
+ "items": {
411
+ "type": "number"
412
+ }
413
+ },
414
+ "const": {
415
+ "type": "number"
416
+ },
417
+ "queryable": {
418
+ "type": "boolean"
419
+ }
420
+ }
421
+ },
422
+ "booleanConfigurations": {
423
+ "type": "object",
424
+ "properties": {
425
+ "type": {
426
+ "type": "string",
427
+ "enum": ["boolean"]
428
+ },
429
+ "enum": {
430
+ "type": "array",
431
+ "items": {
432
+ "type": "boolean"
433
+ }
434
+ },
435
+ "const": {
436
+ "type": "boolean"
437
+ },
438
+ "queryable": {
439
+ "type": "boolean"
440
+ }
441
+ },
442
+ "required": ["type"]
443
+ },
444
+ "configurations": {
445
+ "type": "object",
446
+ "anyOf": [
447
+ { "$ref": "#/definitions/objectConfiguration" },
448
+ { "$ref": "#/definitions/arrayConfiguration" },
449
+ { "$ref": "#/definitions/stringConfigurations" },
450
+ { "$ref": "#/definitions/numberConfigurations" },
451
+ { "$ref": "#/definitions/booleanConfigurations" }
452
+ ]
453
+ }
454
+ }
455
+ }
@@ -0,0 +1 @@
1
+ export declare function readJsonFile(filePath: string): Promise<any>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readJsonFile = void 0;
4
+ const fs = require("fs");
5
+ const util_1 = require("util");
6
+ const readFile = (0, util_1.promisify)(fs.readFile);
7
+ async function readJsonFile(filePath) {
8
+ const file = await readFile(filePath);
9
+ return JSON.parse(file.toString());
10
+ }
11
+ exports.readJsonFile = readJsonFile;
@@ -0,0 +1,28 @@
1
+ import Ajv from 'ajv';
2
+ export declare enum TestId {
3
+ META_SCHEMA = 1,
4
+ PROPERTY_VERIFY = 2,
5
+ INPUT_CONDITIONS = 3,
6
+ STATUS_CHECK = 4,
7
+ CONDITION_TYPES = 5,
8
+ TRANSITION_NAMES = 6
9
+ }
10
+ interface InternalTestResult {
11
+ ok: boolean;
12
+ errors: any[];
13
+ }
14
+ export interface TestResult extends InternalTestResult {
15
+ id: TestId;
16
+ test: string;
17
+ }
18
+ export declare class SchemaVerify {
19
+ #private;
20
+ private ajv;
21
+ private schema;
22
+ private metaSchema;
23
+ constructor(ajv: Ajv, schema: any, metaSchema: any);
24
+ RunChecks(): Generator<TestResult>;
25
+ validateTransition(transition: any, name: string): any[];
26
+ validateConditionPropertiesAgainstSchemaProperties(conditionProperties: any, schemaProperties: any, path: string): Set<any>;
27
+ }
28
+ export {};