@opencrvs/toolkit 2.1.0-rc.1f4b4ad → 2.1.0-rc.1f688f9

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 (83) hide show
  1. package/README.md +1 -0
  2. package/build.sh +3 -0
  3. package/create-countryconfig/index.js +284 -62
  4. package/create-countryconfig/node_modules/.bin/degit +21 -0
  5. package/create-countryconfig/package.json +4 -1
  6. package/dist/application-config/index.js +340 -274
  7. package/dist/cli.js +1085 -101
  8. package/dist/commons/api/router.d.ts +600 -70
  9. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  10. package/dist/commons/conditionals/validate.d.ts +16 -5
  11. package/dist/commons/events/ActionDocument.d.ts +5 -11
  12. package/dist/commons/events/ActionInput.d.ts +4 -4
  13. package/dist/commons/events/ActionStatus.d.ts +14 -0
  14. package/dist/commons/events/AdvancedSearchConfig.d.ts +18 -0
  15. package/dist/commons/events/AuditLog.d.ts +110 -0
  16. package/dist/commons/events/EventConfig.d.ts +3 -0
  17. package/dist/commons/events/EventDocument.d.ts +470 -2
  18. package/dist/commons/events/EventIndex.d.ts +3 -26
  19. package/dist/commons/events/EventMetadata.d.ts +1 -11
  20. package/dist/commons/events/EventStatus.d.ts +19 -0
  21. package/dist/commons/events/FieldConfig.d.ts +83 -53
  22. package/dist/commons/events/FieldTypeMapping.d.ts +27 -27
  23. package/dist/commons/events/FieldValue.d.ts +2 -2
  24. package/dist/commons/events/Flag.d.ts +42 -0
  25. package/dist/commons/events/PlainDate.d.ts +8 -0
  26. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  27. package/dist/commons/events/WorkqueueConfig.d.ts +17 -14
  28. package/dist/commons/events/event.d.ts +12 -0
  29. package/dist/commons/events/locations.d.ts +158 -26
  30. package/dist/commons/events/mocks.test.utils.d.ts +30 -0
  31. package/dist/commons/events/test.utils.d.ts +8 -4
  32. package/dist/commons/events/utils.d.ts +2 -2
  33. package/dist/commons/notification/UserNotifications.d.ts +28 -13
  34. package/dist/commons/notification/dispatch.d.ts +15 -0
  35. package/dist/commons/notification/index.d.ts +1 -0
  36. package/dist/conditionals/index.js +327 -58
  37. package/dist/environment/index.d.ts +1 -0
  38. package/dist/environment/index.d.ts.map +1 -1
  39. package/dist/environment/index.js +10 -0
  40. package/dist/environment/logger.d.ts +12 -3
  41. package/dist/environment/logger.d.ts.map +1 -1
  42. package/dist/environment/paths.d.ts +7 -0
  43. package/dist/environment/paths.d.ts.map +1 -0
  44. package/dist/environment/paths.js +72 -0
  45. package/dist/environment/questions.d.ts.map +1 -1
  46. package/dist/environment/questions.js +20 -14
  47. package/dist/environment/setup-environment.js +3 -2
  48. package/dist/environment/templates.d.ts.map +1 -1
  49. package/dist/environment/templates.js +2 -1
  50. package/dist/environment/update-workflows.d.ts.map +1 -1
  51. package/dist/environment/update-workflows.js +17 -5
  52. package/dist/environment/upgrade.d.ts +2 -0
  53. package/dist/environment/upgrade.d.ts.map +1 -0
  54. package/dist/environment/upgrade.js +82 -0
  55. package/dist/environment/users.js +11 -13
  56. package/dist/events/index.js +3662 -3355
  57. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
  58. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  59. package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
  60. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
  61. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
  62. package/dist/migrations/v2.1/add-recovery-link-notifications.js +530 -0
  63. package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
  64. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
  65. package/dist/migrations/v2.1/enable-telemetry.js +438 -0
  66. package/dist/migrations/v2.1/index.d.ts.map +1 -1
  67. package/dist/migrations/v2.1/index.js +862 -0
  68. package/dist/notification/index.js +1794 -1461
  69. package/dist/scopes/index.d.ts +325 -32
  70. package/dist/scopes/index.js +328 -58
  71. package/dist/telemetry/index.d.ts +45 -0
  72. package/dist/telemetry/index.d.ts.map +1 -0
  73. package/dist/telemetry/index.js +39 -0
  74. package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
  75. package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
  76. package/dist/templates/charts-values/traefik/values.yaml +23 -9
  77. package/dist/templates/inventory/inventory.template.yml +1 -3
  78. package/opencrvs-toolkit-2.1.0-rc.1f688f9.tgz +0 -0
  79. package/package.json +6 -5
  80. package/tsconfig.tsbuildinfo +1 -1
  81. package/dist/templates/inventory/production.example.yml +0 -77
  82. package/dist/templates/inventory/qa.example.yml +0 -48
  83. package/opencrvs-toolkit-2.1.0-rc.1f4b4ad.tgz +0 -0
@@ -47,7 +47,7 @@ __export(conditionals_exports, {
47
47
  user: () => user
48
48
  });
49
49
  module.exports = __toCommonJS(conditionals_exports);
50
- var z8 = __toESM(require("zod/v4"));
50
+ var z13 = __toESM(require("zod/v4"));
51
51
 
52
52
  // ../commons/src/conditionals/conditionals.ts
53
53
  var objectHash = __toESM(require("object-hash"));
@@ -124,7 +124,7 @@ function todayDateTimeValueSerializer() {
124
124
  }
125
125
 
126
126
  // ../commons/src/scopes.ts
127
- var z6 = __toESM(require("zod/v4"));
127
+ var z11 = __toESM(require("zod/v4"));
128
128
  var qs = __toESM(require("qs"));
129
129
 
130
130
  // ../commons/src/uuid.ts
@@ -138,12 +138,267 @@ var z5 = __toESM(require("zod/v4"));
138
138
  var TokenUserType = z5.enum(["user", "system"]);
139
139
  var TokenWithBearer = z5.string().regex(/^Bearer\s/);
140
140
 
141
+ // ../commons/src/events/ActionType.ts
142
+ var z6 = __toESM(require("zod/v4"));
143
+ var ActionType = {
144
+ // Pre-declaration actions
145
+ DELETE: "DELETE",
146
+ CREATE: "CREATE",
147
+ NOTIFY: "NOTIFY",
148
+ // Declaration actions
149
+ DECLARE: "DECLARE",
150
+ REGISTER: "REGISTER",
151
+ EDIT: "EDIT",
152
+ // Declaration system actions. Non-configurable.
153
+ DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
154
+ REJECT: "REJECT",
155
+ // REJECT_DECLARATION
156
+ MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
157
+ MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
158
+ ARCHIVE: "ARCHIVE",
159
+ UNARCHIVE: "UNARCHIVE",
160
+ // Record actions
161
+ PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
162
+ REQUEST_CORRECTION: "REQUEST_CORRECTION",
163
+ REJECT_CORRECTION: "REJECT_CORRECTION",
164
+ APPROVE_CORRECTION: "APPROVE_CORRECTION",
165
+ // General actions
166
+ READ: "READ",
167
+ ASSIGN: "ASSIGN",
168
+ UNASSIGN: "UNASSIGN",
169
+ // Custom action
170
+ CUSTOM: "CUSTOM"
171
+ };
172
+ var ConfirmableActions = [
173
+ ActionType.NOTIFY,
174
+ ActionType.DECLARE,
175
+ ActionType.EDIT,
176
+ ActionType.REGISTER,
177
+ ActionType.REJECT,
178
+ ActionType.ARCHIVE,
179
+ ActionType.UNARCHIVE,
180
+ ActionType.PRINT_CERTIFICATE,
181
+ ActionType.REQUEST_CORRECTION,
182
+ ActionType.APPROVE_CORRECTION,
183
+ ActionType.REJECT_CORRECTION,
184
+ ActionType.CUSTOM
185
+ ];
186
+ var ActionTypes = z6.enum([
187
+ "DELETE",
188
+ "CREATE",
189
+ "NOTIFY",
190
+ "DECLARE",
191
+ "EDIT",
192
+ "REGISTER",
193
+ "DUPLICATE_DETECTED",
194
+ "REJECT",
195
+ "MARK_AS_DUPLICATE",
196
+ "MARK_AS_NOT_DUPLICATE",
197
+ "ARCHIVE",
198
+ "UNARCHIVE",
199
+ "PRINT_CERTIFICATE",
200
+ "REQUEST_CORRECTION",
201
+ "REJECT_CORRECTION",
202
+ "APPROVE_CORRECTION",
203
+ "READ",
204
+ "ASSIGN",
205
+ "UNASSIGN",
206
+ "CUSTOM"
207
+ ]);
208
+ var declarationActionValues = [
209
+ ActionTypes.enum.DECLARE,
210
+ ActionTypes.enum.EDIT,
211
+ ActionTypes.enum.REGISTER,
212
+ ActionTypes.enum.NOTIFY,
213
+ ActionTypes.enum.DUPLICATE_DETECTED
214
+ ];
215
+ var DeclarationActions = ActionTypes.extract(declarationActionValues);
216
+ var declarationUpdateActionValues = [
217
+ ...declarationActionValues,
218
+ ActionTypes.enum.REQUEST_CORRECTION
219
+ ];
220
+ var DeclarationUpdateActions = ActionTypes.extract(
221
+ declarationUpdateActionValues
222
+ );
223
+ var annotationActions = ActionTypes.exclude(declarationActionValues);
224
+ var writeActions = ActionTypes.exclude([
225
+ ActionType.CREATE,
226
+ ActionType.READ,
227
+ ActionType.ASSIGN,
228
+ ActionType.UNASSIGN
229
+ ]);
230
+ var WorkqueueActionType = ActionTypes.extract([
231
+ ActionType.READ,
232
+ ActionType.DELETE,
233
+ ActionType.DECLARE,
234
+ ActionType.REGISTER,
235
+ ActionType.EDIT,
236
+ ActionType.REJECT,
237
+ ActionType.MARK_AS_DUPLICATE,
238
+ ActionType.ARCHIVE,
239
+ ActionType.UNARCHIVE,
240
+ ActionType.PRINT_CERTIFICATE,
241
+ ActionType.REQUEST_CORRECTION
242
+ ]);
243
+ var META_ACTIONS = [
244
+ ActionType.ASSIGN,
245
+ ActionType.UNASSIGN,
246
+ ActionType.READ
247
+ ];
248
+
249
+ // ../commons/src/events/ActionStatus.ts
250
+ var ActionStatus = {
251
+ Requested: "Requested",
252
+ Accepted: "Accepted",
253
+ Rejected: "Rejected"
254
+ };
255
+
256
+ // ../commons/src/events/Flag.ts
257
+ var z9 = __toESM(require("zod/v4"));
258
+
259
+ // ../commons/src/events/TranslationConfig.ts
260
+ var z7 = __toESM(require("zod/v4"));
261
+ var TranslationConfig = z7.object({
262
+ id: z7.string().describe(
263
+ "The identifier of the translation referred in translation CSV files"
264
+ ),
265
+ defaultMessage: z7.string().describe("Default translation message"),
266
+ description: z7.string().describe(
267
+ "Describe the translation for a translator to be able to identify it."
268
+ )
269
+ }).meta({
270
+ description: "Translation configuration",
271
+ id: "TranslationConfig"
272
+ });
273
+
274
+ // ../commons/src/events/Conditional.ts
275
+ var z8 = __toESM(require("zod/v4"));
276
+ var Conditional = z8.any().describe("JSONSchema").meta({
277
+ description: "JSON schema conditional configuration",
278
+ id: "Conditional"
279
+ });
280
+ var ConditionalType = {
281
+ SHOW: "SHOW",
282
+ ENABLE: "ENABLE",
283
+ DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
284
+ };
285
+ var ShowConditional = z8.object({
286
+ type: z8.literal(ConditionalType.SHOW),
287
+ conditional: Conditional
288
+ }).describe(
289
+ "If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
290
+ );
291
+ var EnableConditional = z8.object({
292
+ type: z8.literal(ConditionalType.ENABLE),
293
+ conditional: Conditional
294
+ }).describe(
295
+ "If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
296
+ );
297
+ var ActionConditional = z8.discriminatedUnion("type", [
298
+ // Action can be shown / hidden
299
+ ShowConditional,
300
+ // Action can be shown to the user in the list but as disabled
301
+ EnableConditional
302
+ ]).meta({
303
+ id: "ActionConditional",
304
+ description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
305
+ });
306
+ var DisplayOnReviewConditional = z8.object({
307
+ type: z8.literal(ConditionalType.DISPLAY_ON_REVIEW),
308
+ conditional: Conditional
309
+ }).describe(
310
+ "If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
311
+ );
312
+ var FieldConditional = z8.discriminatedUnion("type", [
313
+ // Field input can be shown / hidden
314
+ ShowConditional,
315
+ // Field input can be shown to the user but as disabled
316
+ EnableConditional,
317
+ // Field output can be shown / hidden on the review page
318
+ DisplayOnReviewConditional
319
+ ]).meta({
320
+ id: "FieldConditional",
321
+ description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
322
+ });
323
+
324
+ // ../commons/src/events/Flag.ts
325
+ var InherentFlags = {
326
+ INCOMPLETE: "incomplete",
327
+ REJECTED: "rejected",
328
+ CORRECTION_REQUESTED: "correction-requested",
329
+ POTENTIAL_DUPLICATE: "potential-duplicate",
330
+ /**
331
+ * This flag is set by the Edit-action and removed after the declaration or registration.
332
+ * A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
333
+ *
334
+ * We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
335
+ */
336
+ EDIT_IN_PROGRESS: "edit-in-progress"
337
+ };
338
+ var actionFlagPattern;
339
+ function getActionFlagPattern() {
340
+ actionFlagPattern ??= new RegExp(
341
+ `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
342
+ ActionStatus
343
+ ).join("|").toLowerCase()})$`
344
+ );
345
+ return actionFlagPattern;
346
+ }
347
+ var ActionFlag = z9.string().refine((value) => getActionFlagPattern().test(value), {
348
+ message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
349
+ });
350
+ var CustomFlag = z9.string().refine((val) => !Object.values(InherentFlags).includes(val), {
351
+ message: `Custom flag cannot be one of the inherent flags: ${Object.values(
352
+ InherentFlags
353
+ ).join(", ")}`
354
+ }).refine((val) => !ActionFlag.safeParse(val).success, {
355
+ message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
356
+ }).describe("Custom flag identifier defined by the country config.");
357
+ var Flag = ActionFlag.or(z9.enum(InherentFlags)).or(CustomFlag);
358
+ var ContainsFlags = z9.object({
359
+ anyOf: z9.array(Flag).optional(),
360
+ noneOf: z9.array(Flag).optional(),
361
+ allOf: z9.array(Flag).optional()
362
+ }).meta({
363
+ id: "ContainsFlags"
364
+ });
365
+ var FlagConfig = z9.object({
366
+ id: CustomFlag,
367
+ requiresAction: z9.boolean().describe(
368
+ "Indicates if this flag expects an action to be performed to be cleared."
369
+ ),
370
+ label: TranslationConfig.describe("Human readable label of the flag.")
371
+ }).meta({
372
+ id: "FlagConfig",
373
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
374
+ });
375
+ var ActionFlagConfig = z9.object({
376
+ id: Flag,
377
+ operation: z9.enum(["add", "remove"]).describe("Operation to perform on the flag."),
378
+ conditional: Conditional.optional().describe(
379
+ "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
380
+ )
381
+ }).meta({
382
+ id: "ActionFlagConfig",
383
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
384
+ });
385
+
386
+ // ../commons/src/events/EventStatus.ts
387
+ var z10 = __toESM(require("zod/v4"));
388
+ var EventStatus = z10.enum([
389
+ "CREATED",
390
+ "NOTIFIED",
391
+ "DECLARED",
392
+ "REGISTERED",
393
+ "ARCHIVED"
394
+ ]);
395
+
141
396
  // ../commons/src/scopes.ts
142
- var JurisdictionFilter = z6.enum(["administrativeArea", "location", "all"]).describe(
397
+ var JurisdictionFilter = z11.enum(["administrativeArea", "location", "all"]).describe(
143
398
  "Filters based on user jurisdiction relative to their office location in hierarchy."
144
399
  );
145
- var UserFilter = z6.enum(["user"]).describe("Filters based on the user. Limits to self.");
146
- var RecordScopeTypeV2 = z6.enum([
400
+ var UserFilter = z11.enum(["user"]).describe("Filters based on the user. Limits to self.");
401
+ var RecordScopeTypeV2 = z11.enum([
147
402
  "record.search",
148
403
  "record.create",
149
404
  "record.read",
@@ -161,12 +416,17 @@ var RecordScopeTypeV2 = z6.enum([
161
416
  "record.unassign-others",
162
417
  "record.custom-action"
163
418
  ]);
164
- var PlainScopeType = z6.enum([
419
+ var PlainScopeType = z11.enum([
165
420
  // Misc. system scopes
166
421
  "bypassratelimit",
167
422
  "record.reindex",
168
423
  "user.data-seeding",
169
424
  "integration.create",
425
+ // Reading an integration's audit log. Deliberately separate from
426
+ // 'integration.create' so read-only oversight can be granted on its own, and
427
+ // deliberately option-less: system clients have no office and no
428
+ // administrative area, so jurisdiction options would have nothing to bind to.
429
+ "integration.audit.read",
170
430
  "record.import",
171
431
  "config.update-all",
172
432
  "location.edit",
@@ -181,15 +441,21 @@ var PlainScopeType = z6.enum([
181
441
  "record.confirm-registration",
182
442
  "record.reject-registration"
183
443
  ]);
184
- var scopeByEvent = z6.preprocess(
444
+ var scopeByEvent = z11.preprocess(
185
445
  (val) => val === void 0 ? void 0 : [val].flat(),
186
- z6.array(z6.string()).optional()
446
+ z11.array(z11.string()).optional()
187
447
  ).describe("Event type, e.g. birth, death");
188
- var userRole = z6.preprocess(
448
+ var scopeByStatus = z11.preprocess(
449
+ (val) => val === void 0 ? void 0 : [val].flat(),
450
+ z11.array(EventStatus).optional()
451
+ ).describe(
452
+ "Restricts the scope to records currently in one of these statuses."
453
+ );
454
+ var userRole = z11.preprocess(
189
455
  (val) => val === void 0 ? void 0 : [val].flat(),
190
- z6.array(z6.string()).optional()
456
+ z11.array(z11.string()).optional()
191
457
  ).describe("User role, e.g. admin, field agent");
192
- var scopeOptionsPlaceEvent = z6.object({
458
+ var scopeOptionsPlaceEvent = z11.object({
193
459
  event: scopeByEvent,
194
460
  placeOfEvent: JurisdictionFilter.optional()
195
461
  }).describe("Options applicable to all record scopes.");
@@ -197,40 +463,42 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
197
463
  notifiedIn: JurisdictionFilter.optional(),
198
464
  notifiedBy: UserFilter.optional(),
199
465
  declaredIn: JurisdictionFilter.optional(),
200
- declaredBy: UserFilter.optional()
466
+ declaredBy: UserFilter.optional(),
467
+ status: scopeByStatus
201
468
  }).describe("Options applicable to actions that may take place after DECLARE");
202
469
  var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
203
470
  registeredIn: JurisdictionFilter.optional(),
204
- registeredBy: UserFilter.optional()
471
+ registeredBy: UserFilter.optional(),
472
+ flags: ContainsFlags.optional()
205
473
  }).describe(
206
474
  "Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
207
475
  );
208
476
  var CustomActionScopeOptions = AllRecordScopeOptions.extend({
209
- customActionTypes: z6.preprocess(
477
+ customActionTypes: z11.preprocess(
210
478
  (val) => val === void 0 ? void 0 : [val].flat(),
211
- z6.array(z6.string()).optional()
479
+ z11.array(z11.string()).optional()
212
480
  ).describe("Allowed custom action types")
213
481
  });
214
- var AccessLevelOptions = z6.object({
482
+ var AccessLevelOptions = z11.object({
215
483
  accessLevel: JurisdictionFilter.optional()
216
484
  });
217
485
  var AllUserScopeOptions = AccessLevelOptions.extend({
218
486
  role: userRole.optional()
219
487
  });
220
- var WorkqueueOrDashboardOptions = z6.object({
221
- ids: z6.preprocess(
488
+ var WorkqueueOrDashboardOptions = z11.object({
489
+ ids: z11.preprocess(
222
490
  (val) => val === void 0 ? void 0 : [val].flat(),
223
- z6.array(z6.string())
491
+ z11.array(z11.string())
224
492
  ).describe("Must contain a list of workqueue or dashboard ids.")
225
493
  });
226
- var AllScopeOptions = z6.object({
494
+ var AllScopeOptions = z11.object({
227
495
  ...AllRecordScopeOptions.shape,
228
496
  ...AccessLevelOptions.shape,
229
497
  ...AllUserScopeOptions.shape,
230
498
  ...WorkqueueOrDashboardOptions.shape
231
499
  });
232
500
  var ScopeOptionKey = AllScopeOptions.keyof();
233
- var ResolvedScopeOptionsPlaceEvent = z6.object({
501
+ var ResolvedScopeOptionsPlaceEvent = z11.object({
234
502
  event: scopeByEvent,
235
503
  placeOfEvent: UUID.nullish()
236
504
  }).describe(
@@ -238,15 +506,16 @@ var ResolvedScopeOptionsPlaceEvent = z6.object({
238
506
  );
239
507
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
240
508
  notifiedIn: UUID.nullish(),
241
- notifiedBy: z6.string().optional(),
509
+ notifiedBy: z11.string().optional(),
242
510
  declaredIn: UUID.nullish(),
243
- declaredBy: z6.string().optional()
511
+ declaredBy: z11.string().optional()
244
512
  }).describe(
245
513
  "Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
246
514
  );
247
515
  var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
248
516
  registeredIn: UUID.nullish(),
249
- registeredBy: z6.string().optional()
517
+ registeredBy: z11.string().optional(),
518
+ flags: ContainsFlags.optional()
250
519
  }).describe(
251
520
  "Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
252
521
  );
@@ -260,7 +529,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
260
529
  "record.reject",
261
530
  "record.archive",
262
531
  "record.unarchive",
263
- "record.review-duplicates",
264
532
  "record.register"
265
533
  ]);
266
534
  var ScopesWithFullOptions = RecordScopeTypeV2.extract([
@@ -268,41 +536,42 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
268
536
  "record.read",
269
537
  "record.request-correction",
270
538
  "record.correct",
271
- "record.unassign-others"
539
+ "record.unassign-others",
540
+ "record.review-duplicates"
272
541
  ]);
273
542
  var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
274
- templates: z6.preprocess(
543
+ templates: z11.preprocess(
275
544
  (val) => val === void 0 ? void 0 : [val].flat(),
276
- z6.array(z6.string()).optional()
545
+ z11.array(z11.string()).optional()
277
546
  ).describe(
278
547
  "Template IDs for certified copies. Controls which certificate templates are returned to the client via the config service. Certificate printing is a client-side operation \u2014 this option is not validated when the printCertificate action is submitted."
279
548
  )
280
549
  });
281
- var RecordScopeV2 = z6.discriminatedUnion("type", [
282
- z6.object({
550
+ var RecordScopeV2 = z11.discriminatedUnion("type", [
551
+ z11.object({
283
552
  type: ScopesWithPlaceEventOptions,
284
553
  options: scopeOptionsPlaceEvent.optional()
285
554
  }),
286
- z6.object({
555
+ z11.object({
287
556
  type: ScopesWithDeclaredOptions,
288
557
  options: scopeOptionsDeclaredOrNotified.optional()
289
558
  }),
290
- z6.object({
559
+ z11.object({
291
560
  type: ScopesWithFullOptions,
292
561
  options: AllRecordScopeOptions.optional()
293
562
  }),
294
- z6.object({
295
- type: z6.literal("record.custom-action"),
563
+ z11.object({
564
+ type: z11.literal("record.custom-action"),
296
565
  options: CustomActionScopeOptions.optional()
297
566
  }),
298
- z6.object({
299
- type: z6.literal("record.print-certified-copies"),
567
+ z11.object({
568
+ type: z11.literal("record.print-certified-copies"),
300
569
  options: ScopeOptionsPrintCertifiedCopies.optional()
301
570
  })
302
571
  ]).describe(
303
572
  "Scopes used to check user's permission to perform actions on a record."
304
573
  );
305
- var SystemScopeType = z6.enum([
574
+ var SystemScopeType = z11.enum([
306
575
  "organisation.read-locations",
307
576
  "user.read",
308
577
  "user.create",
@@ -316,61 +585,61 @@ var UserScopeType = SystemScopeType.extract([
316
585
  "user.search"
317
586
  ]);
318
587
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
319
- var UserScopeV2 = z6.discriminatedUnion("type", [
320
- z6.object({
588
+ var UserScopeV2 = z11.discriminatedUnion("type", [
589
+ z11.object({
321
590
  type: ScopesWithRoleOption,
322
591
  options: AllUserScopeOptions.optional()
323
592
  }),
324
- z6.object({
593
+ z11.object({
325
594
  type: UserScopeType.extract(["user.read", "user.search"]),
326
595
  options: AccessLevelOptions.optional()
327
596
  })
328
597
  ]);
329
- var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
330
- z6.object({
598
+ var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
599
+ z11.object({
331
600
  type: ScopesWithPlaceEventOptions,
332
601
  options: ResolvedScopeOptionsPlaceEvent.optional()
333
602
  }),
334
- z6.object({
603
+ z11.object({
335
604
  type: ScopesWithDeclaredOptions,
336
605
  options: ResolvedScopeOptionsDeclared.optional()
337
606
  }),
338
- z6.object({
607
+ z11.object({
339
608
  type: ScopesWithFullOptions,
340
609
  options: ResolvedScopeOptionsFull.optional()
341
610
  }),
342
- z6.object({
343
- type: z6.literal("record.print-certified-copies"),
611
+ z11.object({
612
+ type: z11.literal("record.print-certified-copies"),
344
613
  options: ResolvedScopeOptionsFull.extend({
345
- templates: z6.array(z6.string()).optional()
614
+ templates: z11.array(z11.string()).optional()
346
615
  }).optional()
347
616
  })
348
617
  ]).describe("Resolved scope with location/user IDs instead of filters.");
349
- var Scope2 = z6.discriminatedUnion("type", [
350
- z6.object({ type: PlainScopeType }),
618
+ var Scope2 = z11.discriminatedUnion("type", [
619
+ z11.object({ type: PlainScopeType }),
351
620
  ...RecordScopeV2.options,
352
621
  ...UserScopeV2.options,
353
- z6.object({
354
- type: z6.literal("organisation.read-locations"),
622
+ z11.object({
623
+ type: z11.literal("organisation.read-locations"),
355
624
  options: AccessLevelOptions.optional()
356
625
  }),
357
- z6.object({
358
- type: z6.literal("workqueue"),
626
+ z11.object({
627
+ type: z11.literal("workqueue"),
359
628
  options: WorkqueueOrDashboardOptions
360
629
  }),
361
- z6.object({
362
- type: z6.literal("dashboard.view"),
630
+ z11.object({
631
+ type: z11.literal("dashboard.view"),
363
632
  options: WorkqueueOrDashboardOptions
364
633
  })
365
634
  ]);
366
- var ScopeType2 = z6.enum([
635
+ var ScopeType2 = z11.enum([
367
636
  ...SystemScopeType.options,
368
637
  ...RecordScopeTypeV2.options,
369
638
  ...PlainScopeType.options,
370
639
  "workqueue",
371
640
  "dashboard.view"
372
641
  ]);
373
- var EncodedScope2 = z6.string().brand("EncodedScope");
642
+ var EncodedScope2 = z11.string().brand("EncodedScope");
374
643
  var DEFAULT_SCOPE_OPTIONS = {
375
644
  placeOfEvent: JurisdictionFilter.enum.all,
376
645
  accessLevel: JurisdictionFilter.enum.all,
@@ -1065,4 +1334,4 @@ function createFieldConditionals(fieldId) {
1065
1334
  }
1066
1335
 
1067
1336
  // src/conditionals/index.ts
1068
- z8.globalRegistry.clear();
1337
+ z13.globalRegistry.clear();
@@ -1,4 +1,5 @@
1
1
  export declare function runEnvironmentInit(): Promise<void>;
2
+ export declare function runEnvironmentUpgrade(): Promise<void>;
2
3
  export declare function runEnvironmentUpdateWorkflows(): Promise<void>;
3
4
  export declare function runEnvironmentUsers(): Promise<void>;
4
5
  export declare function runEnvironmentSwarmToK8s(): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/environment/index.ts"],"names":[],"mappings":"AAwCA,wBAAsB,kBAAkB,kBAGvC;AAED,wBAAsB,6BAA6B,kBAIlD;AAED,wBAAsB,mBAAmB,kBAIxC;AAED,wBAAsB,wBAAwB,kBAG7C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/environment/index.ts"],"names":[],"mappings":"AAyCA,wBAAsB,kBAAkB,kBAIvC;AAED,wBAAsB,qBAAqB,kBAI1C;AAED,wBAAsB,6BAA6B,kBAIlD;AAED,wBAAsB,mBAAmB,kBAIxC;AAED,wBAAsB,wBAAwB,kBAG7C"}
@@ -20,11 +20,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.runEnvironmentInit = runEnvironmentInit;
23
+ exports.runEnvironmentUpgrade = runEnvironmentUpgrade;
23
24
  exports.runEnvironmentUpdateWorkflows = runEnvironmentUpdateWorkflows;
24
25
  exports.runEnvironmentUsers = runEnvironmentUsers;
25
26
  exports.runEnvironmentSwarmToK8s = runEnvironmentSwarmToK8s;
26
27
  const fs_1 = require("fs");
27
28
  const path_1 = require("path");
29
+ const paths_1 = require("./paths");
28
30
  const REQUIRED_REPOSITORY_DIRECTORIES = [
29
31
  '.github/workflows',
30
32
  'environments',
@@ -46,9 +48,17 @@ function validateRepositoryStructure(repositoryRoot = process.cwd()) {
46
48
  function runEnvironmentInit() {
47
49
  return __awaiter(this, void 0, void 0, function* () {
48
50
  validateRepositoryStructure();
51
+ (0, paths_1.assertNoOldInventoryLayout)();
49
52
  yield import('./setup-environment.js');
50
53
  });
51
54
  }
55
+ function runEnvironmentUpgrade() {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ validateRepositoryStructure();
58
+ const { upgradeEnvironmentLayout } = yield import('./upgrade.js');
59
+ yield upgradeEnvironmentLayout();
60
+ });
61
+ }
52
62
  function runEnvironmentUpdateWorkflows() {
53
63
  return __awaiter(this, void 0, void 0, function* () {
54
64
  validateRepositoryStructure();
@@ -1,6 +1,15 @@
1
- export declare const log: (message?: any, ...optionalParams: any[]) => void;
2
- export declare const warn: (message?: any, ...optionalParams: any[]) => void;
1
+ export declare const log: {
2
+ (message?: any, ...optionalParams: any[]): void;
3
+ (message?: any, ...optionalParams: any[]): void;
4
+ };
5
+ export declare const warn: {
6
+ (message?: any, ...optionalParams: any[]): void;
7
+ (message?: any, ...optionalParams: any[]): void;
8
+ };
3
9
  export declare const success: (...args: any[]) => void;
4
- export declare const info: (message?: any, ...optionalParams: any[]) => void;
10
+ export declare const info: {
11
+ (message?: any, ...optionalParams: any[]): void;
12
+ (message?: any, ...optionalParams: any[]): void;
13
+ };
5
14
  export declare const error: (...args: any[]) => void;
6
15
  //# sourceMappingURL=logger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/environment/logger.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,GAAG,mDAAc,CAAA;AAC9B,eAAO,MAAM,IAAI,mDAAe,CAAA;AAChC,eAAO,MAAM,OAAO,YAAa,GAAG,EAAE,SACI,CAAA;AAC1C,eAAO,MAAM,IAAI,mDAAe,CAAA;AAChC,eAAO,MAAM,KAAK,YAAa,GAAG,EAAE,SAA2C,CAAA"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/environment/logger.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,GAAG;;;CAAc,CAAA;AAC9B,eAAO,MAAM,IAAI;;;CAAe,CAAA;AAChC,eAAO,MAAM,OAAO,YAAa,GAAG,EAAE,SACI,CAAA;AAC1C,eAAO,MAAM,IAAI;;;CAAe,CAAA;AAChC,eAAO,MAAM,KAAK,YAAa,GAAG,EAAE,SAA2C,CAAA"}
@@ -0,0 +1,7 @@
1
+ export declare const OLD_INVENTORY_DIR: string;
2
+ export declare const INVENTORY_FILE_NAME = "inventory.yml";
3
+ export declare function getEnvironmentInventoryPath(environment: string): string;
4
+ export declare function findOldInventoryFiles(): string[];
5
+ export declare function getEnvironmentNameFromOldInventoryPath(filePath: string): string;
6
+ export declare function assertNoOldInventoryLayout(): void;
7
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/environment/paths.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,iBAAiB,QAI7B,CAAA;AAED,eAAO,MAAM,mBAAmB,kBAAkB,CAAA;AAElD,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,MAAM,UAE9D;AAED,wBAAgB,qBAAqB,aAEpC;AAED,wBAAgB,sCAAsC,CAAC,QAAQ,EAAE,MAAM,UAEtE;AAED,wBAAgB,0BAA0B,SAWzC"}