@opencrvs/toolkit 2.1.0-rc.b0003b1 → 2.1.0-rc.b263ac1

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 (95) hide show
  1. package/README.md +1 -0
  2. package/build.sh +2 -2
  3. package/dist/application-config/index.js +244 -197
  4. package/dist/cli.js +347 -5220
  5. package/dist/commons/api/router.d.ts +3730 -2896
  6. package/dist/commons/application-config/index.d.ts +6 -6
  7. package/dist/commons/conditionals/conditionals.d.ts +32 -323
  8. package/dist/commons/conditionals/validate.d.ts +11 -4
  9. package/dist/commons/events/ActionConfig.d.ts +279 -70
  10. package/dist/commons/events/ActionDocument.d.ts +153 -115
  11. package/dist/commons/events/ActionInput.d.ts +26 -6
  12. package/dist/commons/events/ActionStatus.d.ts +14 -0
  13. package/dist/commons/events/ActionType.d.ts +63 -58
  14. package/dist/commons/events/AdvancedSearchConfig.d.ts +525 -501
  15. package/dist/commons/events/AuditLog.d.ts +189 -40
  16. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  17. package/dist/commons/events/Conditional.d.ts +3 -3
  18. package/dist/commons/events/CountryConfigQueryInput.d.ts +590 -590
  19. package/dist/commons/events/Draft.d.ts +37 -35
  20. package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
  21. package/dist/commons/events/EventConfig.d.ts +8 -5
  22. package/dist/commons/events/EventDocument.d.ts +66 -44
  23. package/dist/commons/events/EventIndex.d.ts +49 -72
  24. package/dist/commons/events/EventMetadata.d.ts +40 -40
  25. package/dist/commons/events/FieldConfig.d.ts +411 -384
  26. package/dist/commons/events/FieldType.d.ts +51 -51
  27. package/dist/commons/events/FieldTypeMapping.d.ts +90 -90
  28. package/dist/commons/events/FieldValue.d.ts +14 -14
  29. package/dist/commons/events/Flag.d.ts +57 -15
  30. package/dist/commons/events/PlainDate.d.ts +8 -0
  31. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  32. package/dist/commons/events/TemplateConfig.d.ts +1 -1
  33. package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
  34. package/dist/commons/events/WorkqueueConfig.d.ts +822 -816
  35. package/dist/commons/events/deduplication.d.ts +1 -1
  36. package/dist/commons/events/event.d.ts +14 -2
  37. package/dist/commons/events/field.d.ts +69 -198
  38. package/dist/commons/events/index.d.ts +1 -0
  39. package/dist/commons/events/locationPayloads.d.ts +95 -0
  40. package/dist/commons/events/locations.d.ts +192 -12
  41. package/dist/commons/events/mocks.test.utils.d.ts +48 -4
  42. package/dist/commons/events/scopes.d.ts +5 -4
  43. package/dist/commons/events/state/index.d.ts +17 -17
  44. package/dist/commons/events/state/utils.d.ts +7 -7
  45. package/dist/commons/events/test.utils.d.ts +44 -39
  46. package/dist/commons/events/utils.d.ts +127 -105
  47. package/dist/commons/notification/UserNotifications.d.ts +10 -10
  48. package/dist/conditionals/index.js +309 -57
  49. package/dist/environment/derived-variables.d.ts +119 -131
  50. package/dist/environment/derived-variables.d.ts.map +1 -1
  51. package/dist/environment/derived-variables.js +0 -14
  52. package/dist/environment/index.d.ts +1 -0
  53. package/dist/environment/index.d.ts.map +1 -1
  54. package/dist/environment/index.js +10 -0
  55. package/dist/environment/logger.d.ts +3 -3
  56. package/dist/environment/manage-users.js +17 -7
  57. package/dist/environment/paths.d.ts +7 -0
  58. package/dist/environment/paths.d.ts.map +1 -0
  59. package/dist/environment/paths.js +72 -0
  60. package/dist/environment/questions.d.ts +75 -74
  61. package/dist/environment/questions.d.ts.map +1 -1
  62. package/dist/environment/setup-environment.js +10 -29
  63. package/dist/environment/swarm-to-k8s.js +17 -7
  64. package/dist/environment/templates.d.ts.map +1 -1
  65. package/dist/environment/templates.js +2 -1
  66. package/dist/environment/update-workflows.d.ts.map +1 -1
  67. package/dist/environment/update-workflows.js +34 -12
  68. package/dist/environment/upgrade.d.ts +2 -0
  69. package/dist/environment/upgrade.d.ts.map +1 -0
  70. package/dist/environment/upgrade.js +82 -0
  71. package/dist/environment/users.js +28 -20
  72. package/dist/environment/utils.d.ts +1 -1
  73. package/dist/environment/utils.js +17 -7
  74. package/dist/events/deduplication.d.ts +1 -1
  75. package/dist/events/index.js +3650 -3145
  76. package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
  77. package/dist/migrations/v2.0/index.js +88 -5144
  78. package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
  79. package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
  80. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
  81. package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
  82. package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
  83. package/dist/migrations/v2.1/index.d.ts +6 -0
  84. package/dist/migrations/v2.1/index.d.ts.map +1 -0
  85. package/dist/migrations/v2.1/index.js +218 -0
  86. package/dist/notification/index.js +2019 -1072
  87. package/dist/scopes/index.d.ts +437 -163
  88. package/dist/scopes/index.js +310 -57
  89. package/dist/templates/charts-values/dependencies/values.yaml +0 -3
  90. package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -7
  91. package/dist/templates/charts-values/opentelemetry/values.yaml +73 -0
  92. package/opencrvs-toolkit-2.1.0-rc.b263ac1.tgz +0 -0
  93. package/package.json +7 -7
  94. package/tsconfig.tsbuildinfo +1 -1
  95. package/opencrvs-toolkit-2.1.0-rc.b0003b1.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",
@@ -110,6 +355,7 @@ var RecordScopeTypeV2 = z3.enum([
110
355
  "record.edit",
111
356
  "record.reject",
112
357
  "record.archive",
358
+ "record.unarchive",
113
359
  "record.review-duplicates",
114
360
  "record.register",
115
361
  "record.print-certified-copies",
@@ -118,7 +364,7 @@ var RecordScopeTypeV2 = z3.enum([
118
364
  "record.unassign-others",
119
365
  "record.custom-action"
120
366
  ]);
121
- var PlainScopeType = z3.enum([
367
+ var PlainScopeType = z7.enum([
122
368
  // Misc. system scopes
123
369
  "bypassratelimit",
124
370
  "record.reindex",
@@ -126,6 +372,7 @@ var PlainScopeType = z3.enum([
126
372
  "integration.create",
127
373
  "record.import",
128
374
  "config.update-all",
375
+ "location.edit",
129
376
  "attachment.upload",
130
377
  "profile.electronic-signature",
131
378
  "user.read-only-my-audit",
@@ -137,17 +384,18 @@ var PlainScopeType = z3.enum([
137
384
  "record.confirm-registration",
138
385
  "record.reject-registration"
139
386
  ]);
140
- var scopeByEvent = z3.preprocess(
387
+ var scopeByEvent = z7.preprocess(
141
388
  (val) => val === void 0 ? void 0 : [val].flat(),
142
- z3.array(z3.string()).optional()
389
+ z7.array(z7.string()).optional()
143
390
  ).describe("Event type, e.g. birth, death");
144
- var userRole = z3.preprocess(
391
+ var userRole = z7.preprocess(
145
392
  (val) => val === void 0 ? void 0 : [val].flat(),
146
- z3.array(z3.string()).optional()
393
+ z7.array(z7.string()).optional()
147
394
  ).describe("User role, e.g. admin, field agent");
148
- var scopeOptionsPlaceEvent = z3.object({
395
+ var scopeOptionsPlaceEvent = z7.object({
149
396
  event: scopeByEvent,
150
- placeOfEvent: JurisdictionFilter.optional()
397
+ placeOfEvent: JurisdictionFilter.optional(),
398
+ createdBy: UserFilter.optional()
151
399
  }).describe("Options applicable to all record scopes.");
152
400
  var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
153
401
  notifiedIn: JurisdictionFilter.optional(),
@@ -157,52 +405,55 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
157
405
  }).describe("Options applicable to actions that may take place after DECLARE");
158
406
  var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
159
407
  registeredIn: JurisdictionFilter.optional(),
160
- registeredBy: UserFilter.optional()
408
+ registeredBy: UserFilter.optional(),
409
+ flags: ContainsFlags.optional()
161
410
  }).describe(
162
411
  "Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
163
412
  );
164
413
  var CustomActionScopeOptions = AllRecordScopeOptions.extend({
165
- customActionTypes: z3.preprocess(
414
+ customActionTypes: z7.preprocess(
166
415
  (val) => val === void 0 ? void 0 : [val].flat(),
167
- z3.array(z3.string()).optional()
416
+ z7.array(z7.string()).optional()
168
417
  ).describe("Allowed custom action types")
169
418
  });
170
- var AccessLevelOptions = z3.object({
419
+ var AccessLevelOptions = z7.object({
171
420
  accessLevel: JurisdictionFilter.optional()
172
421
  });
173
422
  var AllUserScopeOptions = AccessLevelOptions.extend({
174
423
  role: userRole.optional()
175
424
  });
176
- var WorkqueueOrDashboardOptions = z3.object({
177
- ids: z3.preprocess(
425
+ var WorkqueueOrDashboardOptions = z7.object({
426
+ ids: z7.preprocess(
178
427
  (val) => val === void 0 ? void 0 : [val].flat(),
179
- z3.array(z3.string())
428
+ z7.array(z7.string())
180
429
  ).describe("Must contain a list of workqueue or dashboard ids.")
181
430
  });
182
- var AllScopeOptions = z3.object({
431
+ var AllScopeOptions = z7.object({
183
432
  ...AllRecordScopeOptions.shape,
184
433
  ...AccessLevelOptions.shape,
185
434
  ...AllUserScopeOptions.shape,
186
435
  ...WorkqueueOrDashboardOptions.shape
187
436
  });
188
437
  var ScopeOptionKey = AllScopeOptions.keyof();
189
- var ResolvedScopeOptionsPlaceEvent = z3.object({
438
+ var ResolvedScopeOptionsPlaceEvent = z7.object({
190
439
  event: scopeByEvent,
191
- placeOfEvent: UUID.nullish()
440
+ placeOfEvent: UUID.nullish(),
441
+ createdBy: z7.string().optional()
192
442
  }).describe(
193
443
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
194
444
  );
195
445
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
196
446
  notifiedIn: UUID.nullish(),
197
- notifiedBy: z3.string().optional(),
447
+ notifiedBy: z7.string().optional(),
198
448
  declaredIn: UUID.nullish(),
199
- declaredBy: z3.string().optional()
449
+ declaredBy: z7.string().optional()
200
450
  }).describe(
201
451
  "Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
202
452
  );
203
453
  var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
204
454
  registeredIn: UUID.nullish(),
205
- registeredBy: z3.string().optional()
455
+ registeredBy: z7.string().optional(),
456
+ flags: ContainsFlags.optional()
206
457
  }).describe(
207
458
  "Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
208
459
  );
@@ -215,6 +466,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
215
466
  "record.edit",
216
467
  "record.reject",
217
468
  "record.archive",
469
+ "record.unarchive",
218
470
  "record.review-duplicates",
219
471
  "record.register"
220
472
  ]);
@@ -226,38 +478,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
226
478
  "record.unassign-others"
227
479
  ]);
228
480
  var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
229
- templates: z3.preprocess(
481
+ templates: z7.preprocess(
230
482
  (val) => val === void 0 ? void 0 : [val].flat(),
231
- z3.array(z3.string()).optional()
483
+ z7.array(z7.string()).optional()
232
484
  ).describe(
233
485
  "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."
234
486
  )
235
487
  });
236
- var RecordScopeV2 = z3.discriminatedUnion("type", [
237
- z3.object({
488
+ var RecordScopeV2 = z7.discriminatedUnion("type", [
489
+ z7.object({
238
490
  type: ScopesWithPlaceEventOptions,
239
491
  options: scopeOptionsPlaceEvent.optional()
240
492
  }),
241
- z3.object({
493
+ z7.object({
242
494
  type: ScopesWithDeclaredOptions,
243
495
  options: scopeOptionsDeclaredOrNotified.optional()
244
496
  }),
245
- z3.object({
497
+ z7.object({
246
498
  type: ScopesWithFullOptions,
247
499
  options: AllRecordScopeOptions.optional()
248
500
  }),
249
- z3.object({
250
- type: z3.literal("record.custom-action"),
501
+ z7.object({
502
+ type: z7.literal("record.custom-action"),
251
503
  options: CustomActionScopeOptions.optional()
252
504
  }),
253
- z3.object({
254
- type: z3.literal("record.print-certified-copies"),
505
+ z7.object({
506
+ type: z7.literal("record.print-certified-copies"),
255
507
  options: ScopeOptionsPrintCertifiedCopies.optional()
256
508
  })
257
509
  ]).describe(
258
510
  "Scopes used to check user's permission to perform actions on a record."
259
511
  );
260
- var SystemScopeType = z3.enum([
512
+ var SystemScopeType = z7.enum([
261
513
  "organisation.read-locations",
262
514
  "user.read",
263
515
  "user.create",
@@ -271,12 +523,12 @@ var UserScopeType = SystemScopeType.extract([
271
523
  "user.search"
272
524
  ]);
273
525
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
274
- var UserScopeV2 = z3.discriminatedUnion("type", [
275
- z3.object({
526
+ var UserScopeV2 = z7.discriminatedUnion("type", [
527
+ z7.object({
276
528
  type: ScopesWithRoleOption,
277
529
  options: AllUserScopeOptions.optional()
278
530
  }),
279
- z3.object({
531
+ z7.object({
280
532
  type: UserScopeType.extract(["user.read", "user.search"]),
281
533
  options: AccessLevelOptions.optional()
282
534
  })
@@ -296,44 +548,44 @@ function scopeUsesPrintCertifiedCopiesOptions(scope) {
296
548
  function isCustomActionScope(scope) {
297
549
  return scope.type === "record.custom-action";
298
550
  }
299
- var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
300
- z3.object({
551
+ var ResolvedRecordScopeV2 = z7.discriminatedUnion("type", [
552
+ z7.object({
301
553
  type: ScopesWithPlaceEventOptions,
302
554
  options: ResolvedScopeOptionsPlaceEvent.optional()
303
555
  }),
304
- z3.object({
556
+ z7.object({
305
557
  type: ScopesWithDeclaredOptions,
306
558
  options: ResolvedScopeOptionsDeclared.optional()
307
559
  }),
308
- z3.object({
560
+ z7.object({
309
561
  type: ScopesWithFullOptions,
310
562
  options: ResolvedScopeOptionsFull.optional()
311
563
  }),
312
- z3.object({
313
- type: z3.literal("record.print-certified-copies"),
564
+ z7.object({
565
+ type: z7.literal("record.print-certified-copies"),
314
566
  options: ResolvedScopeOptionsFull.extend({
315
- templates: z3.array(z3.string()).optional()
567
+ templates: z7.array(z7.string()).optional()
316
568
  }).optional()
317
569
  })
318
570
  ]).describe("Resolved scope with location/user IDs instead of filters.");
319
- var Scope2 = z3.discriminatedUnion("type", [
320
- z3.object({ type: PlainScopeType }),
571
+ var Scope2 = z7.discriminatedUnion("type", [
572
+ z7.object({ type: PlainScopeType }),
321
573
  ...RecordScopeV2.options,
322
574
  ...UserScopeV2.options,
323
- z3.object({
324
- type: z3.literal("organisation.read-locations"),
575
+ z7.object({
576
+ type: z7.literal("organisation.read-locations"),
325
577
  options: AccessLevelOptions.optional()
326
578
  }),
327
- z3.object({
328
- type: z3.literal("workqueue"),
579
+ z7.object({
580
+ type: z7.literal("workqueue"),
329
581
  options: WorkqueueOrDashboardOptions
330
582
  }),
331
- z3.object({
332
- type: z3.literal("dashboard.view"),
583
+ z7.object({
584
+ type: z7.literal("dashboard.view"),
333
585
  options: WorkqueueOrDashboardOptions
334
586
  })
335
587
  ]);
336
- var ScopeType2 = z3.enum([
588
+ var ScopeType2 = z7.enum([
337
589
  ...SystemScopeType.options,
338
590
  ...RecordScopeTypeV2.options,
339
591
  ...PlainScopeType.options,
@@ -348,11 +600,12 @@ var unflattenScope = (input) => {
348
600
  const { type, ...options } = input;
349
601
  return { type, options };
350
602
  };
351
- var EncodedScope2 = z3.string().brand("EncodedScope");
603
+ var EncodedScope2 = z7.string().brand("EncodedScope");
352
604
  var encodeScope = (scope) => {
353
605
  const flattened = flattenScope(scope);
354
606
  return qs.stringify(flattened, {
355
607
  arrayFormat: "comma",
608
+ commaRoundTrip: true,
356
609
  allowDots: true,
357
610
  addQueryPrefix: false,
358
611
  encode: false
@@ -434,4 +687,4 @@ function defineRoles(roles) {
434
687
  }
435
688
 
436
689
  // src/scopes/index.ts
437
- z4.globalRegistry.clear();
690
+ 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