@opencrvs/toolkit 2.1.0-rc.69ab488 → 2.1.0-rc.6bae709

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/README.md +1 -0
  2. package/create-countryconfig/index.js +114 -66
  3. package/create-countryconfig/node_modules/.bin/degit +21 -0
  4. package/create-countryconfig/package.json +4 -1
  5. package/dist/application-config/index.js +230 -197
  6. package/dist/cli.js +174 -106
  7. package/dist/commons/api/router.d.ts +3608 -3367
  8. package/dist/commons/application-config/index.d.ts +6 -6
  9. package/dist/commons/conditionals/conditionals.d.ts +32 -323
  10. package/dist/commons/conditionals/validate.d.ts +11 -4
  11. package/dist/commons/events/ActionConfig.d.ts +112 -105
  12. package/dist/commons/events/ActionDocument.d.ts +117 -123
  13. package/dist/commons/events/ActionInput.d.ts +0 -6
  14. package/dist/commons/events/ActionStatus.d.ts +14 -0
  15. package/dist/commons/events/ActionType.d.ts +62 -62
  16. package/dist/commons/events/AdvancedSearchConfig.d.ts +519 -507
  17. package/dist/commons/events/AuditLog.d.ts +189 -42
  18. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  19. package/dist/commons/events/Conditional.d.ts +3 -3
  20. package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
  21. package/dist/commons/events/Draft.d.ts +37 -37
  22. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  23. package/dist/commons/events/EventConfig.d.ts +8 -5
  24. package/dist/commons/events/EventDocument.d.ts +48 -48
  25. package/dist/commons/events/EventIndex.d.ts +49 -72
  26. package/dist/commons/events/EventMetadata.d.ts +40 -40
  27. package/dist/commons/events/FieldConfig.d.ts +406 -389
  28. package/dist/commons/events/FieldType.d.ts +51 -51
  29. package/dist/commons/events/FieldTypeMapping.d.ts +90 -90
  30. package/dist/commons/events/FieldValue.d.ts +14 -14
  31. package/dist/commons/events/Flag.d.ts +57 -15
  32. package/dist/commons/events/PlainDate.d.ts +8 -0
  33. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  34. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  35. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  36. package/dist/commons/events/WorkqueueConfig.d.ts +817 -814
  37. package/dist/commons/events/deduplication.d.ts +1 -1
  38. package/dist/commons/events/event.d.ts +14 -2
  39. package/dist/commons/events/field.d.ts +69 -198
  40. package/dist/commons/events/index.d.ts +1 -0
  41. package/dist/commons/events/locationPayloads.d.ts +95 -0
  42. package/dist/commons/events/locations.d.ts +192 -12
  43. package/dist/commons/events/mocks.test.utils.d.ts +48 -4
  44. package/dist/commons/events/scopes.d.ts +4 -4
  45. package/dist/commons/events/state/index.d.ts +17 -17
  46. package/dist/commons/events/state/utils.d.ts +7 -7
  47. package/dist/commons/events/test.utils.d.ts +40 -43
  48. package/dist/commons/events/utils.d.ts +122 -114
  49. package/dist/commons/notification/UserNotifications.d.ts +10 -10
  50. package/dist/conditionals/index.js +303 -55
  51. package/dist/environment/derived-variables.d.ts +119 -131
  52. package/dist/environment/derived-variables.d.ts.map +1 -1
  53. package/dist/environment/derived-variables.js +0 -14
  54. package/dist/environment/index.d.ts +1 -0
  55. package/dist/environment/index.d.ts.map +1 -1
  56. package/dist/environment/index.js +10 -0
  57. package/dist/environment/logger.d.ts +3 -3
  58. package/dist/environment/manage-users.js +17 -7
  59. package/dist/environment/paths.d.ts +7 -0
  60. package/dist/environment/paths.d.ts.map +1 -0
  61. package/dist/environment/paths.js +72 -0
  62. package/dist/environment/questions.d.ts +75 -74
  63. package/dist/environment/questions.d.ts.map +1 -1
  64. package/dist/environment/setup-environment.js +10 -29
  65. package/dist/environment/swarm-to-k8s.js +17 -7
  66. package/dist/environment/templates.d.ts.map +1 -1
  67. package/dist/environment/templates.js +2 -1
  68. package/dist/environment/update-workflows.d.ts.map +1 -1
  69. package/dist/environment/update-workflows.js +34 -12
  70. package/dist/environment/upgrade.d.ts +2 -0
  71. package/dist/environment/upgrade.d.ts.map +1 -0
  72. package/dist/environment/upgrade.js +82 -0
  73. package/dist/environment/users.js +28 -20
  74. package/dist/environment/utils.d.ts +1 -1
  75. package/dist/environment/utils.js +17 -7
  76. package/dist/events/deduplication.d.ts +1 -1
  77. package/dist/events/index.js +3914 -3562
  78. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
  79. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  80. package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
  81. package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
  82. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  83. package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
  84. package/dist/notification/index.js +1937 -1112
  85. package/dist/scopes/index.d.ts +394 -169
  86. package/dist/scopes/index.js +304 -55
  87. package/dist/templates/charts-values/dependencies/values.yaml +0 -3
  88. package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -7
  89. package/dist/templates/charts-values/opentelemetry/values.yaml +73 -0
  90. package/opencrvs-toolkit-2.1.0-rc.6bae709.tgz +0 -0
  91. package/package.json +7 -7
  92. package/tsconfig.tsbuildinfo +1 -1
  93. package/opencrvs-toolkit-2.1.0-rc.69ab488.tgz +0 -0
@@ -59,10 +59,10 @@ __export(scopes_exports, {
59
59
  scopeUsesRoleOptions: () => scopeUsesRoleOptions
60
60
  });
61
61
  module.exports = __toCommonJS(scopes_exports);
62
- var z4 = __toESM(require("zod/v4"));
62
+ var z8 = __toESM(require("zod/v4"));
63
63
 
64
64
  // ../commons/src/scopes.ts
65
- var z3 = __toESM(require("zod/v4"));
65
+ var z7 = __toESM(require("zod/v4"));
66
66
  var qs = __toESM(require("qs"));
67
67
 
68
68
  // ../commons/src/uuid.ts
@@ -96,12 +96,257 @@ var getTokenPayload = (token) => {
96
96
  };
97
97
  var TokenWithBearer = z2.string().regex(/^Bearer\s/);
98
98
 
99
+ // ../commons/src/events/ActionType.ts
100
+ var z3 = __toESM(require("zod/v4"));
101
+ var ActionType = {
102
+ // Pre-declaration actions
103
+ DELETE: "DELETE",
104
+ CREATE: "CREATE",
105
+ NOTIFY: "NOTIFY",
106
+ // Declaration actions
107
+ DECLARE: "DECLARE",
108
+ REGISTER: "REGISTER",
109
+ EDIT: "EDIT",
110
+ // Declaration system actions. Non-configurable.
111
+ DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
112
+ REJECT: "REJECT",
113
+ // REJECT_DECLARATION
114
+ MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
115
+ MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
116
+ ARCHIVE: "ARCHIVE",
117
+ UNARCHIVE: "UNARCHIVE",
118
+ // Record actions
119
+ PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
120
+ REQUEST_CORRECTION: "REQUEST_CORRECTION",
121
+ REJECT_CORRECTION: "REJECT_CORRECTION",
122
+ APPROVE_CORRECTION: "APPROVE_CORRECTION",
123
+ // General actions
124
+ READ: "READ",
125
+ ASSIGN: "ASSIGN",
126
+ UNASSIGN: "UNASSIGN",
127
+ // Custom action
128
+ CUSTOM: "CUSTOM"
129
+ };
130
+ var ConfirmableActions = [
131
+ ActionType.NOTIFY,
132
+ ActionType.DECLARE,
133
+ ActionType.EDIT,
134
+ ActionType.REGISTER,
135
+ ActionType.REJECT,
136
+ ActionType.ARCHIVE,
137
+ ActionType.UNARCHIVE,
138
+ ActionType.PRINT_CERTIFICATE,
139
+ ActionType.REQUEST_CORRECTION,
140
+ ActionType.APPROVE_CORRECTION,
141
+ ActionType.REJECT_CORRECTION,
142
+ ActionType.CUSTOM
143
+ ];
144
+ var ActionTypes = z3.enum([
145
+ "DELETE",
146
+ "CREATE",
147
+ "NOTIFY",
148
+ "DECLARE",
149
+ "EDIT",
150
+ "REGISTER",
151
+ "DUPLICATE_DETECTED",
152
+ "REJECT",
153
+ "MARK_AS_DUPLICATE",
154
+ "MARK_AS_NOT_DUPLICATE",
155
+ "ARCHIVE",
156
+ "UNARCHIVE",
157
+ "PRINT_CERTIFICATE",
158
+ "REQUEST_CORRECTION",
159
+ "REJECT_CORRECTION",
160
+ "APPROVE_CORRECTION",
161
+ "READ",
162
+ "ASSIGN",
163
+ "UNASSIGN",
164
+ "CUSTOM"
165
+ ]);
166
+ var declarationActionValues = [
167
+ ActionTypes.enum.DECLARE,
168
+ ActionTypes.enum.EDIT,
169
+ ActionTypes.enum.REGISTER,
170
+ ActionTypes.enum.NOTIFY,
171
+ ActionTypes.enum.DUPLICATE_DETECTED
172
+ ];
173
+ var DeclarationActions = ActionTypes.extract(declarationActionValues);
174
+ var declarationUpdateActionValues = [
175
+ ...declarationActionValues,
176
+ ActionTypes.enum.REQUEST_CORRECTION
177
+ ];
178
+ var DeclarationUpdateActions = ActionTypes.extract(
179
+ declarationUpdateActionValues
180
+ );
181
+ var annotationActions = ActionTypes.exclude(declarationActionValues);
182
+ var writeActions = ActionTypes.exclude([
183
+ ActionType.CREATE,
184
+ ActionType.READ,
185
+ ActionType.ASSIGN,
186
+ ActionType.UNASSIGN
187
+ ]);
188
+ var WorkqueueActionType = ActionTypes.extract([
189
+ ActionType.READ,
190
+ ActionType.DELETE,
191
+ ActionType.DECLARE,
192
+ ActionType.REGISTER,
193
+ ActionType.EDIT,
194
+ ActionType.REJECT,
195
+ ActionType.MARK_AS_DUPLICATE,
196
+ ActionType.ARCHIVE,
197
+ ActionType.UNARCHIVE,
198
+ ActionType.PRINT_CERTIFICATE,
199
+ ActionType.REQUEST_CORRECTION
200
+ ]);
201
+ var META_ACTIONS = [
202
+ ActionType.ASSIGN,
203
+ ActionType.UNASSIGN,
204
+ ActionType.READ
205
+ ];
206
+
207
+ // ../commons/src/events/ActionStatus.ts
208
+ var ActionStatus = {
209
+ Requested: "Requested",
210
+ Accepted: "Accepted",
211
+ Rejected: "Rejected"
212
+ };
213
+
214
+ // ../commons/src/events/Flag.ts
215
+ var z6 = __toESM(require("zod/v4"));
216
+
217
+ // ../commons/src/events/TranslationConfig.ts
218
+ var z4 = __toESM(require("zod/v4"));
219
+ var TranslationConfig = z4.object({
220
+ id: z4.string().describe(
221
+ "The identifier of the translation referred in translation CSV files"
222
+ ),
223
+ defaultMessage: z4.string().describe("Default translation message"),
224
+ description: z4.string().describe(
225
+ "Describe the translation for a translator to be able to identify it."
226
+ )
227
+ }).meta({
228
+ description: "Translation configuration",
229
+ id: "TranslationConfig"
230
+ });
231
+
232
+ // ../commons/src/events/Conditional.ts
233
+ var z5 = __toESM(require("zod/v4"));
234
+ var Conditional = z5.any().describe("JSONSchema").meta({
235
+ description: "JSON schema conditional configuration",
236
+ id: "Conditional"
237
+ });
238
+ var ConditionalType = {
239
+ SHOW: "SHOW",
240
+ ENABLE: "ENABLE",
241
+ DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
242
+ };
243
+ var ShowConditional = z5.object({
244
+ type: z5.literal(ConditionalType.SHOW),
245
+ conditional: Conditional
246
+ }).describe(
247
+ "If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
248
+ );
249
+ var EnableConditional = z5.object({
250
+ type: z5.literal(ConditionalType.ENABLE),
251
+ conditional: Conditional
252
+ }).describe(
253
+ "If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
254
+ );
255
+ var ActionConditional = z5.discriminatedUnion("type", [
256
+ // Action can be shown / hidden
257
+ ShowConditional,
258
+ // Action can be shown to the user in the list but as disabled
259
+ EnableConditional
260
+ ]).meta({
261
+ id: "ActionConditional",
262
+ 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."
263
+ });
264
+ var DisplayOnReviewConditional = z5.object({
265
+ type: z5.literal(ConditionalType.DISPLAY_ON_REVIEW),
266
+ conditional: Conditional
267
+ }).describe(
268
+ "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."
269
+ );
270
+ var FieldConditional = z5.discriminatedUnion("type", [
271
+ // Field input can be shown / hidden
272
+ ShowConditional,
273
+ // Field input can be shown to the user but as disabled
274
+ EnableConditional,
275
+ // Field output can be shown / hidden on the review page
276
+ DisplayOnReviewConditional
277
+ ]).meta({
278
+ id: "FieldConditional",
279
+ 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."
280
+ });
281
+
282
+ // ../commons/src/events/Flag.ts
283
+ var InherentFlags = {
284
+ INCOMPLETE: "incomplete",
285
+ REJECTED: "rejected",
286
+ CORRECTION_REQUESTED: "correction-requested",
287
+ POTENTIAL_DUPLICATE: "potential-duplicate",
288
+ /**
289
+ * This flag is set by the Edit-action and removed after the declaration or registration.
290
+ * A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
291
+ *
292
+ * We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
293
+ */
294
+ EDIT_IN_PROGRESS: "edit-in-progress"
295
+ };
296
+ var actionFlagPattern;
297
+ function getActionFlagPattern() {
298
+ actionFlagPattern ??= new RegExp(
299
+ `^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
300
+ ActionStatus
301
+ ).join("|").toLowerCase()})$`
302
+ );
303
+ return actionFlagPattern;
304
+ }
305
+ var ActionFlag = z6.string().refine((value) => getActionFlagPattern().test(value), {
306
+ message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
307
+ });
308
+ var CustomFlag = z6.string().refine((val) => !Object.values(InherentFlags).includes(val), {
309
+ message: `Custom flag cannot be one of the inherent flags: ${Object.values(
310
+ InherentFlags
311
+ ).join(", ")}`
312
+ }).refine((val) => !ActionFlag.safeParse(val).success, {
313
+ message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
314
+ }).describe("Custom flag identifier defined by the country config.");
315
+ var Flag = ActionFlag.or(z6.enum(InherentFlags)).or(CustomFlag);
316
+ var ContainsFlags = z6.object({
317
+ anyOf: z6.array(Flag).optional(),
318
+ noneOf: z6.array(Flag).optional(),
319
+ allOf: z6.array(Flag).optional()
320
+ }).meta({
321
+ id: "ContainsFlags"
322
+ });
323
+ var FlagConfig = z6.object({
324
+ id: CustomFlag,
325
+ requiresAction: z6.boolean().describe(
326
+ "Indicates if this flag expects an action to be performed to be cleared."
327
+ ),
328
+ label: TranslationConfig.describe("Human readable label of the flag.")
329
+ }).meta({
330
+ id: "FlagConfig",
331
+ description: "Configuration for a custom flag that can be added to or removed from records by event actions."
332
+ });
333
+ var ActionFlagConfig = z6.object({
334
+ id: Flag,
335
+ operation: z6.enum(["add", "remove"]).describe("Operation to perform on the flag."),
336
+ conditional: Conditional.optional().describe(
337
+ "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
338
+ )
339
+ }).meta({
340
+ id: "ActionFlagConfig",
341
+ description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
342
+ });
343
+
99
344
  // ../commons/src/scopes.ts
100
- var JurisdictionFilter = z3.enum(["administrativeArea", "location", "all"]).describe(
345
+ var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
101
346
  "Filters based on user jurisdiction relative to their office location in hierarchy."
102
347
  );
103
- var UserFilter = z3.enum(["user"]).describe("Filters based on the user. Limits to self.");
104
- var RecordScopeTypeV2 = z3.enum([
348
+ var UserFilter = z7.enum(["user"]).describe("Filters based on the user. Limits to self.");
349
+ var RecordScopeTypeV2 = z7.enum([
105
350
  "record.search",
106
351
  "record.create",
107
352
  "record.read",
@@ -119,7 +364,7 @@ var RecordScopeTypeV2 = z3.enum([
119
364
  "record.unassign-others",
120
365
  "record.custom-action"
121
366
  ]);
122
- var PlainScopeType = z3.enum([
367
+ var PlainScopeType = z7.enum([
123
368
  // Misc. system scopes
124
369
  "bypassratelimit",
125
370
  "record.reindex",
@@ -127,6 +372,7 @@ var PlainScopeType = z3.enum([
127
372
  "integration.create",
128
373
  "record.import",
129
374
  "config.update-all",
375
+ "location.edit",
130
376
  "attachment.upload",
131
377
  "profile.electronic-signature",
132
378
  "user.read-only-my-audit",
@@ -138,15 +384,15 @@ var PlainScopeType = z3.enum([
138
384
  "record.confirm-registration",
139
385
  "record.reject-registration"
140
386
  ]);
141
- var scopeByEvent = z3.preprocess(
387
+ var scopeByEvent = z7.preprocess(
142
388
  (val) => val === void 0 ? void 0 : [val].flat(),
143
- z3.array(z3.string()).optional()
389
+ z7.array(z7.string()).optional()
144
390
  ).describe("Event type, e.g. birth, death");
145
- var userRole = z3.preprocess(
391
+ var userRole = z7.preprocess(
146
392
  (val) => val === void 0 ? void 0 : [val].flat(),
147
- z3.array(z3.string()).optional()
393
+ z7.array(z7.string()).optional()
148
394
  ).describe("User role, e.g. admin, field agent");
149
- var scopeOptionsPlaceEvent = z3.object({
395
+ var scopeOptionsPlaceEvent = z7.object({
150
396
  event: scopeByEvent,
151
397
  placeOfEvent: JurisdictionFilter.optional()
152
398
  }).describe("Options applicable to all record scopes.");
@@ -158,36 +404,37 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
158
404
  }).describe("Options applicable to actions that may take place after DECLARE");
159
405
  var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
160
406
  registeredIn: JurisdictionFilter.optional(),
161
- registeredBy: UserFilter.optional()
407
+ registeredBy: UserFilter.optional(),
408
+ flags: ContainsFlags.optional()
162
409
  }).describe(
163
410
  "Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
164
411
  );
165
412
  var CustomActionScopeOptions = AllRecordScopeOptions.extend({
166
- customActionTypes: z3.preprocess(
413
+ customActionTypes: z7.preprocess(
167
414
  (val) => val === void 0 ? void 0 : [val].flat(),
168
- z3.array(z3.string()).optional()
415
+ z7.array(z7.string()).optional()
169
416
  ).describe("Allowed custom action types")
170
417
  });
171
- var AccessLevelOptions = z3.object({
418
+ var AccessLevelOptions = z7.object({
172
419
  accessLevel: JurisdictionFilter.optional()
173
420
  });
174
421
  var AllUserScopeOptions = AccessLevelOptions.extend({
175
422
  role: userRole.optional()
176
423
  });
177
- var WorkqueueOrDashboardOptions = z3.object({
178
- ids: z3.preprocess(
424
+ var WorkqueueOrDashboardOptions = z7.object({
425
+ ids: z7.preprocess(
179
426
  (val) => val === void 0 ? void 0 : [val].flat(),
180
- z3.array(z3.string())
427
+ z7.array(z7.string())
181
428
  ).describe("Must contain a list of workqueue or dashboard ids.")
182
429
  });
183
- var AllScopeOptions = z3.object({
430
+ var AllScopeOptions = z7.object({
184
431
  ...AllRecordScopeOptions.shape,
185
432
  ...AccessLevelOptions.shape,
186
433
  ...AllUserScopeOptions.shape,
187
434
  ...WorkqueueOrDashboardOptions.shape
188
435
  });
189
436
  var ScopeOptionKey = AllScopeOptions.keyof();
190
- var ResolvedScopeOptionsPlaceEvent = z3.object({
437
+ var ResolvedScopeOptionsPlaceEvent = z7.object({
191
438
  event: scopeByEvent,
192
439
  placeOfEvent: UUID.nullish()
193
440
  }).describe(
@@ -195,15 +442,16 @@ var ResolvedScopeOptionsPlaceEvent = z3.object({
195
442
  );
196
443
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
197
444
  notifiedIn: UUID.nullish(),
198
- notifiedBy: z3.string().optional(),
445
+ notifiedBy: z7.string().optional(),
199
446
  declaredIn: UUID.nullish(),
200
- declaredBy: z3.string().optional()
447
+ declaredBy: z7.string().optional()
201
448
  }).describe(
202
449
  "Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
203
450
  );
204
451
  var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
205
452
  registeredIn: UUID.nullish(),
206
- registeredBy: z3.string().optional()
453
+ registeredBy: z7.string().optional(),
454
+ flags: ContainsFlags.optional()
207
455
  }).describe(
208
456
  "Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
209
457
  );
@@ -228,38 +476,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
228
476
  "record.unassign-others"
229
477
  ]);
230
478
  var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
231
- templates: z3.preprocess(
479
+ templates: z7.preprocess(
232
480
  (val) => val === void 0 ? void 0 : [val].flat(),
233
- z3.array(z3.string()).optional()
481
+ z7.array(z7.string()).optional()
234
482
  ).describe(
235
483
  "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."
236
484
  )
237
485
  });
238
- var RecordScopeV2 = z3.discriminatedUnion("type", [
239
- z3.object({
486
+ var RecordScopeV2 = z7.discriminatedUnion("type", [
487
+ z7.object({
240
488
  type: ScopesWithPlaceEventOptions,
241
489
  options: scopeOptionsPlaceEvent.optional()
242
490
  }),
243
- z3.object({
491
+ z7.object({
244
492
  type: ScopesWithDeclaredOptions,
245
493
  options: scopeOptionsDeclaredOrNotified.optional()
246
494
  }),
247
- z3.object({
495
+ z7.object({
248
496
  type: ScopesWithFullOptions,
249
497
  options: AllRecordScopeOptions.optional()
250
498
  }),
251
- z3.object({
252
- type: z3.literal("record.custom-action"),
499
+ z7.object({
500
+ type: z7.literal("record.custom-action"),
253
501
  options: CustomActionScopeOptions.optional()
254
502
  }),
255
- z3.object({
256
- type: z3.literal("record.print-certified-copies"),
503
+ z7.object({
504
+ type: z7.literal("record.print-certified-copies"),
257
505
  options: ScopeOptionsPrintCertifiedCopies.optional()
258
506
  })
259
507
  ]).describe(
260
508
  "Scopes used to check user's permission to perform actions on a record."
261
509
  );
262
- var SystemScopeType = z3.enum([
510
+ var SystemScopeType = z7.enum([
263
511
  "organisation.read-locations",
264
512
  "user.read",
265
513
  "user.create",
@@ -273,12 +521,12 @@ var UserScopeType = SystemScopeType.extract([
273
521
  "user.search"
274
522
  ]);
275
523
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
276
- var UserScopeV2 = z3.discriminatedUnion("type", [
277
- z3.object({
524
+ var UserScopeV2 = z7.discriminatedUnion("type", [
525
+ z7.object({
278
526
  type: ScopesWithRoleOption,
279
527
  options: AllUserScopeOptions.optional()
280
528
  }),
281
- z3.object({
529
+ z7.object({
282
530
  type: UserScopeType.extract(["user.read", "user.search"]),
283
531
  options: AccessLevelOptions.optional()
284
532
  })
@@ -298,44 +546,44 @@ function scopeUsesPrintCertifiedCopiesOptions(scope) {
298
546
  function isCustomActionScope(scope) {
299
547
  return scope.type === "record.custom-action";
300
548
  }
301
- var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
302
- z3.object({
549
+ var ResolvedRecordScopeV2 = z7.discriminatedUnion("type", [
550
+ z7.object({
303
551
  type: ScopesWithPlaceEventOptions,
304
552
  options: ResolvedScopeOptionsPlaceEvent.optional()
305
553
  }),
306
- z3.object({
554
+ z7.object({
307
555
  type: ScopesWithDeclaredOptions,
308
556
  options: ResolvedScopeOptionsDeclared.optional()
309
557
  }),
310
- z3.object({
558
+ z7.object({
311
559
  type: ScopesWithFullOptions,
312
560
  options: ResolvedScopeOptionsFull.optional()
313
561
  }),
314
- z3.object({
315
- type: z3.literal("record.print-certified-copies"),
562
+ z7.object({
563
+ type: z7.literal("record.print-certified-copies"),
316
564
  options: ResolvedScopeOptionsFull.extend({
317
- templates: z3.array(z3.string()).optional()
565
+ templates: z7.array(z7.string()).optional()
318
566
  }).optional()
319
567
  })
320
568
  ]).describe("Resolved scope with location/user IDs instead of filters.");
321
- var Scope2 = z3.discriminatedUnion("type", [
322
- z3.object({ type: PlainScopeType }),
569
+ var Scope2 = z7.discriminatedUnion("type", [
570
+ z7.object({ type: PlainScopeType }),
323
571
  ...RecordScopeV2.options,
324
572
  ...UserScopeV2.options,
325
- z3.object({
326
- type: z3.literal("organisation.read-locations"),
573
+ z7.object({
574
+ type: z7.literal("organisation.read-locations"),
327
575
  options: AccessLevelOptions.optional()
328
576
  }),
329
- z3.object({
330
- type: z3.literal("workqueue"),
577
+ z7.object({
578
+ type: z7.literal("workqueue"),
331
579
  options: WorkqueueOrDashboardOptions
332
580
  }),
333
- z3.object({
334
- type: z3.literal("dashboard.view"),
581
+ z7.object({
582
+ type: z7.literal("dashboard.view"),
335
583
  options: WorkqueueOrDashboardOptions
336
584
  })
337
585
  ]);
338
- var ScopeType2 = z3.enum([
586
+ var ScopeType2 = z7.enum([
339
587
  ...SystemScopeType.options,
340
588
  ...RecordScopeTypeV2.options,
341
589
  ...PlainScopeType.options,
@@ -350,11 +598,12 @@ var unflattenScope = (input) => {
350
598
  const { type, ...options } = input;
351
599
  return { type, options };
352
600
  };
353
- var EncodedScope2 = z3.string().brand("EncodedScope");
601
+ var EncodedScope2 = z7.string().brand("EncodedScope");
354
602
  var encodeScope = (scope) => {
355
603
  const flattened = flattenScope(scope);
356
604
  return qs.stringify(flattened, {
357
605
  arrayFormat: "comma",
606
+ commaRoundTrip: true,
358
607
  allowDots: true,
359
608
  addQueryPrefix: false,
360
609
  encode: false
@@ -436,4 +685,4 @@ function defineRoles(roles) {
436
685
  }
437
686
 
438
687
  // src/scopes/index.ts
439
- z4.globalRegistry.clear();
688
+ z8.globalRegistry.clear();
@@ -33,9 +33,6 @@ minio:
33
33
  elasticsearch:
34
34
  use_default_credentials: false
35
35
 
36
- mongodb:
37
- use_default_credentials: false
38
-
39
36
  postgres:
40
37
  use_default_credentials: false
41
38
  {{#if restore_enabled}}
@@ -21,12 +21,13 @@ hpa:
21
21
  enabled: false
22
22
 
23
23
  env:
24
- APN_SERVICE_URL: "http://apm-server.opencrvs-deps-{{env}}.svc.cluster.local:8200"
25
24
  MINIO_BUCKET: ocrvs
26
25
  OPENCRVS_ENVIRONMENT: {{opencrvs_environment}}
27
26
 
28
- influxdb:
29
- host: influxdb-0.influxdb.opencrvs-deps-{{env}}.svc.cluster.local
27
+ otel:
28
+ enabled: true
29
+ deployment_environment: {{env}}
30
+ exporter_otlp_endpoint: "http://opentelemetry-collector.opencrvs-deps-{{env}}.svc.cluster.local:4318"
30
31
 
31
32
  elasticsearch:
32
33
  auth_mode: auto
@@ -36,10 +37,6 @@ minio:
36
37
  auth_mode: use_secret
37
38
  host: minio-0.minio.opencrvs-deps-{{env}}.svc.cluster.local
38
39
 
39
- mongodb:
40
- auth_mode: auto
41
- host: mongodb-0.mongodb.opencrvs-deps-{{env}}.svc.cluster.local
42
-
43
40
  redis:
44
41
  auth_mode: use_secret
45
42
  host: redis-0.redis.opencrvs-deps-{{env}}.svc.cluster.local
@@ -0,0 +1,73 @@
1
+ mode: deployment
2
+
3
+ image:
4
+ repository: otel/opentelemetry-collector-k8s
5
+
6
+ resources:
7
+ requests:
8
+ cpu: 100m
9
+ memory: 128Mi
10
+ limits:
11
+ cpu: 500m
12
+ memory: 512Mi
13
+
14
+ ports:
15
+ jaeger-compact:
16
+ enabled: false
17
+ jaeger-thrift:
18
+ enabled: false
19
+ jaeger-grpc:
20
+ enabled: false
21
+ zipkin:
22
+ enabled: false
23
+
24
+ config:
25
+ receivers:
26
+ otlp:
27
+ protocols:
28
+ grpc:
29
+ endpoint: ${env:MY_POD_IP}:4317
30
+ http:
31
+ endpoint: ${env:MY_POD_IP}:4318
32
+ prometheus: null
33
+ jaeger: null
34
+ zipkin: null
35
+
36
+ exporters:
37
+ otlp/elastic:
38
+ endpoint: apm-server.opencrvs-deps-{{env}}.svc.cluster.local:8200
39
+ tls:
40
+ insecure: true
41
+ processors:
42
+ batch:
43
+ timeout: 15s
44
+ send_batch_size: 1024
45
+
46
+ memory_limiter:
47
+ check_interval: 5s
48
+ limit_percentage: 80
49
+ spike_limit_percentage: 25
50
+
51
+ service:
52
+ telemetry:
53
+ metrics:
54
+ level: none
55
+ readers: null
56
+ pipelines:
57
+ logs: null
58
+ metrics:
59
+ receivers:
60
+ - otlp
61
+ processors:
62
+ - memory_limiter
63
+ - batch
64
+ exporters:
65
+ - otlp/elastic
66
+ traces:
67
+ receivers:
68
+ - otlp
69
+ processors:
70
+ - memory_limiter
71
+ - batch
72
+ exporters:
73
+ - otlp/elastic
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.1.0-rc.69ab488",
3
+ "version": "2.1.0-rc.6bae709",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "scripts": {
20
20
  "build": "./build.sh",
21
- "build:all": "lerna run build --include-dependencies --scope @opencrvs/toolkit && ./build.sh"
21
+ "build:all": "pnpm -w exec lerna run build --include-dependencies --scope @opencrvs/toolkit"
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",
@@ -28,12 +28,12 @@
28
28
  "@inquirer/prompts": "^8.3.0",
29
29
  "@octokit/core": "4.2.1",
30
30
  "@trpc/client": "11.4.3",
31
- "@trpc/server": "^11.8.0",
31
+ "@trpc/server": "11.8.0",
32
32
  "ajv": "^8.17.1",
33
33
  "ajv-formats": "^3.0.1",
34
34
  "date-fns": "^2.28.0",
35
35
  "dotenv": "^16.4.5",
36
- "glob": "11.0.3",
36
+ "glob": "11.1.0",
37
37
  "handlebars": "^4.7.8",
38
38
  "js-yaml": "4.1.0",
39
39
  "jwt-decode": "^3.0.0",
@@ -51,15 +51,15 @@
51
51
  "zod-openapi": "^5.4.6"
52
52
  },
53
53
  "devDependencies": {
54
- "@opencrvs/events": "^2.0.0",
54
+ "@opencrvs/commons": "workspace:*",
55
+ "@opencrvs/events": "workspace:*",
55
56
  "@types/js-yaml": "4.0.9",
56
57
  "@types/libsodium-wrappers": "^0.7.10",
57
58
  "@types/object-hash": "^3.0.6",
58
59
  "@types/prompts": "^2.4.9",
59
60
  "@types/ssh2": "^1.15.5",
60
61
  "@types/uuid": "^9.0.3",
61
- "esbuild": "^0.24.0",
62
- "typescript": "^5.6.3"
62
+ "esbuild": "^0.24.0"
63
63
  },
64
64
  "moduleNameMapper": {
65
65
  "@opencrvs/commons/events": "@opencrvs/commons/build/dist/common/events/index.js",