@opencrvs/toolkit 2.0.0-rc.d2125d9 → 2.0.0-rc.d23bb0b

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 (169) hide show
  1. package/README.md +14 -0
  2. package/build.sh +3 -2
  3. package/create-countryconfig/index.js +103 -0
  4. package/create-countryconfig/package.json +21 -0
  5. package/dist/application-config/index.js +314 -131
  6. package/dist/cli.js +5110 -384
  7. package/dist/commons/api/router.d.ts +3414 -271
  8. package/dist/commons/application-config/index.d.ts +17 -4
  9. package/dist/commons/conditionals/conditionals.d.ts +360 -10
  10. package/dist/commons/conditionals/validate.d.ts +52 -2
  11. package/dist/commons/events/ActionConfig.d.ts +28 -2
  12. package/dist/commons/events/ActionDocument.d.ts +6 -0
  13. package/dist/commons/events/ActionInput.d.ts +114 -0
  14. package/dist/commons/events/AdvancedSearchConfig.d.ts +342 -0
  15. package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
  16. package/dist/commons/events/Draft.d.ts +4 -2
  17. package/dist/commons/events/EventDocument.d.ts +3 -0
  18. package/dist/commons/events/EventIndex.d.ts +14 -3
  19. package/dist/commons/events/EventMetadata.d.ts +0 -7
  20. package/dist/commons/events/FieldConfig.d.ts +388 -50
  21. package/dist/commons/events/FieldType.d.ts +1 -0
  22. package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
  23. package/dist/commons/events/FieldValue.d.ts +6 -0
  24. package/dist/commons/events/WorkqueueConfig.d.ts +189 -150
  25. package/dist/commons/events/field.d.ts +53 -1
  26. package/dist/commons/events/index.d.ts +2 -0
  27. package/dist/commons/events/locations.d.ts +38 -1
  28. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  29. package/dist/commons/events/scopes.d.ts +24 -1
  30. package/dist/commons/events/state/flags.d.ts +16 -0
  31. package/dist/commons/events/state/index.d.ts +0 -4
  32. package/dist/commons/events/state/utils.d.ts +12 -289
  33. package/dist/commons/events/utils.d.ts +13 -2
  34. package/dist/conditionals/index.js +92 -9
  35. package/dist/environment/custom-types.d.ts +33 -0
  36. package/dist/environment/custom-types.d.ts.map +1 -0
  37. package/dist/environment/custom-types.js +12 -0
  38. package/dist/environment/derived-variables.d.ts +134 -0
  39. package/dist/environment/derived-variables.d.ts.map +1 -0
  40. package/dist/environment/derived-variables.js +169 -0
  41. package/dist/environment/editor-questions.d.ts +4 -0
  42. package/dist/environment/editor-questions.d.ts.map +1 -0
  43. package/dist/environment/editor-questions.js +65 -0
  44. package/dist/environment/git.d.ts +5 -0
  45. package/dist/environment/git.d.ts.map +1 -0
  46. package/dist/environment/git.js +38 -0
  47. package/dist/environment/github.d.ts +26 -0
  48. package/dist/environment/github.d.ts.map +1 -0
  49. package/dist/environment/github.js +244 -0
  50. package/dist/environment/index.d.ts +5 -0
  51. package/dist/environment/index.d.ts.map +1 -0
  52. package/dist/environment/index.js +71 -0
  53. package/dist/environment/logger.d.ts +15 -0
  54. package/dist/environment/logger.d.ts.map +1 -0
  55. package/dist/environment/logger.js +25 -0
  56. package/dist/environment/manage-users.d.ts +11 -0
  57. package/dist/environment/manage-users.d.ts.map +1 -0
  58. package/dist/environment/manage-users.js +494 -0
  59. package/dist/environment/questions-helper.d.ts +15 -0
  60. package/dist/environment/questions-helper.d.ts.map +1 -0
  61. package/dist/environment/questions-helper.js +70 -0
  62. package/dist/environment/questions.d.ts +199 -0
  63. package/dist/environment/questions.d.ts.map +1 -0
  64. package/dist/environment/questions.js +412 -0
  65. package/dist/environment/setup-environment.d.ts +2 -0
  66. package/dist/environment/setup-environment.d.ts.map +1 -0
  67. package/dist/environment/setup-environment.js +773 -0
  68. package/dist/environment/ssh-keygen.d.ts +5 -0
  69. package/dist/environment/ssh-keygen.d.ts.map +1 -0
  70. package/dist/environment/ssh-keygen.js +18 -0
  71. package/dist/environment/swarm-to-k8s.d.ts +2 -0
  72. package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
  73. package/dist/environment/swarm-to-k8s.js +172 -0
  74. package/dist/environment/templates.d.ts +27 -0
  75. package/dist/environment/templates.d.ts.map +1 -0
  76. package/dist/environment/templates.js +159 -0
  77. package/dist/environment/update-workflows.d.ts +2 -0
  78. package/dist/environment/update-workflows.d.ts.map +1 -0
  79. package/dist/environment/update-workflows.js +168 -0
  80. package/dist/environment/users.d.ts +2 -0
  81. package/dist/environment/users.d.ts.map +1 -0
  82. package/dist/environment/users.js +110 -0
  83. package/dist/environment/utils.d.ts +18 -0
  84. package/dist/environment/utils.d.ts.map +1 -0
  85. package/dist/environment/utils.js +100 -0
  86. package/dist/events/index.js +1206 -291
  87. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  88. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +63 -39
  89. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +3 -0
  90. package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +1 -0
  91. package/dist/migrations/v2.0/add-resend-invite-notification.js +373 -0
  92. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +19 -0
  93. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  94. package/dist/migrations/v2.0/checkout-upstream-files.js +17 -14
  95. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -1
  96. package/dist/migrations/v2.0/convert-config-files-to-ts.js +4 -5
  97. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -1
  98. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +4 -5
  99. package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -1
  100. package/dist/migrations/v2.0/create-events-index.js +1 -2
  101. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +11 -0
  102. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -0
  103. package/dist/migrations/v2.0/delete-infrastructure-directory.js +123 -0
  104. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  105. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  106. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  107. package/dist/migrations/v2.0/index.d.ts +10 -4
  108. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  109. package/dist/migrations/v2.0/index.js +1929 -347
  110. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  111. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +95 -7
  112. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +13 -0
  113. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -0
  114. package/dist/migrations/v2.0/merge-infrastructure-directory.js +222 -0
  115. package/dist/migrations/v2.0/migrate-application-config-url.d.ts +3 -0
  116. package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +1 -0
  117. package/dist/migrations/v2.0/migrate-application-config-url.js +342 -0
  118. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  119. package/dist/migrations/v2.0/migrate-scopes.js +55 -32
  120. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -1
  121. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +3 -4
  122. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  123. package/dist/migrations/v2.0/migrate-workqueue-configs.js +143 -63
  124. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -1
  125. package/dist/migrations/v2.0/remove-delete-actions.js +3 -4
  126. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -1
  127. package/dist/migrations/v2.0/remove-demo-scope.js +2 -3
  128. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -1
  129. package/dist/migrations/v2.0/remove-deprecated-imports.js +3 -4
  130. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +3 -0
  131. package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +1 -0
  132. package/dist/migrations/v2.0/remove-fhir-url-helpers.js +163 -0
  133. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -1
  134. package/dist/migrations/v2.0/remove-hearth-migrations.js +1 -2
  135. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +3 -0
  136. package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +1 -0
  137. package/dist/migrations/v2.0/remove-old-statistics-service.js +356 -0
  138. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -1
  139. package/dist/migrations/v2.0/remove-pending-certification-flag.js +3 -4
  140. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -1
  141. package/dist/migrations/v2.0/remove-review-from-register-action.js +3 -4
  142. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +3 -0
  143. package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +1 -0
  144. package/dist/migrations/v2.0/remove-unused-environment-variables.js +186 -0
  145. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -1
  146. package/dist/migrations/v2.0/rename-api-paths.js +3 -4
  147. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -1
  148. package/dist/migrations/v2.0/rename-location-parent-id.js +3 -4
  149. package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -1
  150. package/dist/migrations/v2.0/simplify-analytics-precalculations.js +1 -2
  151. package/dist/migrations/v2.0/update-package-json.d.ts +3 -0
  152. package/dist/migrations/v2.0/update-package-json.d.ts.map +1 -0
  153. package/dist/migrations/v2.0/update-package-json.js +105 -0
  154. package/dist/notification/index.js +938 -163
  155. package/dist/scopes/index.d.ts +91 -16
  156. package/dist/scopes/index.js +55 -12
  157. package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
  158. package/dist/templates/charts-values/dependencies/values.yaml +82 -0
  159. package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  160. package/dist/templates/charts-values/opencrvs-services/values.yaml +79 -0
  161. package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
  162. package/dist/templates/charts-values/traefik/values.yaml +116 -0
  163. package/dist/templates/inventory/inventory.template.yml +100 -0
  164. package/dist/templates/inventory/production.example.yml +77 -0
  165. package/dist/templates/inventory/qa.example.yml +48 -0
  166. package/opencrvs-toolkit-2.0.0-rc.d23bb0b.tgz +0 -0
  167. package/package.json +20 -2
  168. package/tsconfig.tsbuildinfo +1 -1
  169. package/opencrvs-toolkit-2.0.0-rc.d2125d9.tgz +0 -0
@@ -41,6 +41,7 @@ declare const AllScopeOptions: z.ZodObject<{
41
41
  location: "location";
42
42
  all: "all";
43
43
  }>>;
44
+ role: z.ZodOptional<z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>>;
44
45
  event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
45
46
  placeOfEvent: z.ZodOptional<z.ZodEnum<{
46
47
  administrativeArea: "administrativeArea";
@@ -66,6 +67,7 @@ declare const AllScopeOptions: z.ZodObject<{
66
67
  }, z.core.$strip>;
67
68
  type AllScopeOptions = z.infer<typeof AllScopeOptions>;
68
69
  export declare const ScopeOptionKey: z.ZodEnum<{
70
+ role: "role";
69
71
  event: "event";
70
72
  placeOfEvent: "placeOfEvent";
71
73
  declaredIn: "declaredIn";
@@ -220,6 +222,56 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
220
222
  templates: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
221
223
  }, z.core.$strip>>;
222
224
  }, z.core.$strip>], "type">;
225
+ declare const SystemScopeType: z.ZodEnum<{
226
+ "organisation.read-locations": "organisation.read-locations";
227
+ "user.read": "user.read";
228
+ "user.create": "user.create";
229
+ "user.edit": "user.edit";
230
+ "user.search": "user.search";
231
+ }>;
232
+ export type SystemScopeType = z.infer<typeof SystemScopeType>;
233
+ declare const UserScopeType: z.ZodEnum<{
234
+ "user.read": "user.read";
235
+ "user.create": "user.create";
236
+ "user.edit": "user.edit";
237
+ "user.search": "user.search";
238
+ }>;
239
+ export type UserScopeType = z.infer<typeof UserScopeType>;
240
+ declare const ScopesWithRoleOption: z.ZodEnum<{
241
+ "user.create": "user.create";
242
+ "user.edit": "user.edit";
243
+ }>;
244
+ export type ScopesWithRoleOption = z.infer<typeof ScopesWithRoleOption>;
245
+ export declare const UserScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
246
+ type: z.ZodEnum<{
247
+ "user.create": "user.create";
248
+ "user.edit": "user.edit";
249
+ }>;
250
+ options: z.ZodOptional<z.ZodObject<{
251
+ accessLevel: z.ZodOptional<z.ZodEnum<{
252
+ administrativeArea: "administrativeArea";
253
+ location: "location";
254
+ all: "all";
255
+ }>>;
256
+ role: z.ZodOptional<z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>>;
257
+ }, z.core.$strip>>;
258
+ }, z.core.$strip>, z.ZodObject<{
259
+ type: z.ZodEnum<{
260
+ "user.read": "user.read";
261
+ "user.search": "user.search";
262
+ }>;
263
+ options: z.ZodOptional<z.ZodObject<{
264
+ accessLevel: z.ZodOptional<z.ZodEnum<{
265
+ administrativeArea: "administrativeArea";
266
+ location: "location";
267
+ all: "all";
268
+ }>>;
269
+ }, z.core.$strip>>;
270
+ }, z.core.$strip>], "type">;
271
+ export type UserScopeV2 = z.infer<typeof UserScopeV2>;
272
+ export declare function scopeUsesRoleOptions(scope: UserScopeV2): scope is Extract<UserScopeV2, {
273
+ type: ScopesWithRoleOption;
274
+ }>;
223
275
  export declare function scopeUsesDeclaredOptions(scope: Scope): scope is Extract<Scope, {
224
276
  type: z.infer<typeof ScopesWithDeclaredOptions>;
225
277
  }>;
@@ -286,13 +338,6 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
286
338
  }, z.core.$strip>], "type">;
287
339
  export type RecordScopeV2 = z.infer<typeof RecordScopeV2>;
288
340
  export type ResolvedRecordScopeV2 = z.infer<typeof ResolvedRecordScopeV2>;
289
- declare const SystemScopeType: z.ZodEnum<{
290
- "organisation.read-locations": "organisation.read-locations";
291
- "user.read": "user.read";
292
- "user.create": "user.create";
293
- "user.edit": "user.edit";
294
- }>;
295
- export type SystemScopeType = z.infer<typeof SystemScopeType>;
296
341
  /** The primary scope schema which gathers all scope types together. All scopes are discriminated by type and options are determined according to the type. */
297
342
  export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
298
343
  type: z.ZodEnum<{
@@ -437,11 +482,31 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
437
482
  }, z.core.$strip>>;
438
483
  }, z.core.$strip>, z.ZodObject<{
439
484
  type: z.ZodEnum<{
440
- "organisation.read-locations": "organisation.read-locations";
441
- "user.read": "user.read";
442
485
  "user.create": "user.create";
443
486
  "user.edit": "user.edit";
444
487
  }>;
488
+ options: z.ZodOptional<z.ZodObject<{
489
+ accessLevel: z.ZodOptional<z.ZodEnum<{
490
+ administrativeArea: "administrativeArea";
491
+ location: "location";
492
+ all: "all";
493
+ }>>;
494
+ role: z.ZodOptional<z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>>;
495
+ }, z.core.$strip>>;
496
+ }, z.core.$strip>, z.ZodObject<{
497
+ type: z.ZodEnum<{
498
+ "user.read": "user.read";
499
+ "user.search": "user.search";
500
+ }>;
501
+ options: z.ZodOptional<z.ZodObject<{
502
+ accessLevel: z.ZodOptional<z.ZodEnum<{
503
+ administrativeArea: "administrativeArea";
504
+ location: "location";
505
+ all: "all";
506
+ }>>;
507
+ }, z.core.$strip>>;
508
+ }, z.core.$strip>, z.ZodObject<{
509
+ type: z.ZodLiteral<"organisation.read-locations">;
445
510
  options: z.ZodOptional<z.ZodObject<{
446
511
  accessLevel: z.ZodOptional<z.ZodEnum<{
447
512
  administrativeArea: "administrativeArea";
@@ -495,6 +560,7 @@ export declare const ScopeType: z.ZodEnum<{
495
560
  "user.read": "user.read";
496
561
  "user.create": "user.create";
497
562
  "user.edit": "user.edit";
563
+ "user.search": "user.search";
498
564
  workqueue: "workqueue";
499
565
  "dashboard.view": "dashboard.view";
500
566
  }>;
@@ -514,14 +580,12 @@ export type EncodedScope = z.infer<typeof EncodedScope>;
514
580
  */
515
581
  export declare const encodeScope: (scope: Scope) => EncodedScope;
516
582
  /**
517
- * Converts a scope object into an encoded query string representation.
583
+ * Converts an encoded scope string into a scope object.
518
584
  *
519
- * @TODO scope param could be defined as EncodedScope instead of string.
520
- *
521
- * @param scope - The scope object to encode.
522
- * @returns The encoded scope as a branded string (`EncodedScope`).
585
+ * @param scope - The encoded scope string to decode.
586
+ * @returns The decoded scope object.
523
587
  */
524
- export declare const decodeScope: (query: EncodedScope) => {
588
+ export declare const decodeScope: (encodedScope: EncodedScope) => {
525
589
  type: "record.create" | "record.declare" | "record.notify";
526
590
  options?: {
527
591
  event?: string[] | undefined;
@@ -567,10 +631,21 @@ export declare const decodeScope: (query: EncodedScope) => {
567
631
  registeredBy?: "user" | undefined;
568
632
  templates?: string[] | undefined;
569
633
  } | undefined;
634
+ } | {
635
+ type: "user.create" | "user.edit";
636
+ options?: {
637
+ accessLevel?: "administrativeArea" | "location" | "all" | undefined;
638
+ role?: string[] | undefined;
639
+ } | undefined;
640
+ } | {
641
+ type: "user.read" | "user.search";
642
+ options?: {
643
+ accessLevel?: "administrativeArea" | "location" | "all" | undefined;
644
+ } | undefined;
570
645
  } | {
571
646
  type: "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration";
572
647
  } | {
573
- type: "organisation.read-locations" | "user.read" | "user.create" | "user.edit";
648
+ type: "organisation.read-locations";
574
649
  options?: {
575
650
  accessLevel?: "administrativeArea" | "location" | "all" | undefined;
576
651
  } | undefined;
@@ -42,6 +42,7 @@ __export(scopes_exports, {
42
42
  ScopesWithFullOptions: () => ScopesWithFullOptions,
43
43
  ScopesWithPlaceEventOptions: () => ScopesWithPlaceEventOptions,
44
44
  UserFilter: () => UserFilter,
45
+ UserScopeV2: () => UserScopeV2,
45
46
  canUserCreateEvent: () => canUserCreateEvent,
46
47
  decodeScope: () => decodeScope,
47
48
  defineRoles: () => defineRoles,
@@ -54,7 +55,8 @@ __export(scopes_exports, {
54
55
  isCustomActionScope: () => isCustomActionScope,
55
56
  scopeUsesDeclaredOptions: () => scopeUsesDeclaredOptions,
56
57
  scopeUsesFullOptions: () => scopeUsesFullOptions,
57
- scopeUsesPrintCertifiedCopiesOptions: () => scopeUsesPrintCertifiedCopiesOptions
58
+ scopeUsesPrintCertifiedCopiesOptions: () => scopeUsesPrintCertifiedCopiesOptions,
59
+ scopeUsesRoleOptions: () => scopeUsesRoleOptions
58
60
  });
59
61
  module.exports = __toCommonJS(scopes_exports);
60
62
  var z4 = __toESM(require("zod/v4"));
@@ -139,6 +141,10 @@ var scopeByEvent = z3.preprocess(
139
141
  (val) => val === void 0 ? void 0 : [val].flat(),
140
142
  z3.array(z3.string()).optional()
141
143
  ).describe("Event type, e.g. birth, death");
144
+ var userRole = z3.preprocess(
145
+ (val) => val === void 0 ? void 0 : [val].flat(),
146
+ z3.array(z3.string()).optional()
147
+ ).describe("User role, e.g. admin, field agent");
142
148
  var scopeOptionsPlaceEvent = z3.object({
143
149
  event: scopeByEvent,
144
150
  placeOfEvent: JurisdictionFilter.optional()
@@ -162,6 +168,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
162
168
  var AccessLevelOptions = z3.object({
163
169
  accessLevel: JurisdictionFilter.optional()
164
170
  });
171
+ var AllUserScopeOptions = AccessLevelOptions.extend({
172
+ role: userRole.optional()
173
+ });
165
174
  var WorkqueueOrDashboardOptions = z3.object({
166
175
  ids: z3.preprocess(
167
176
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -171,6 +180,7 @@ var WorkqueueOrDashboardOptions = z3.object({
171
180
  var AllScopeOptions = z3.object({
172
181
  ...AllRecordScopeOptions.shape,
173
182
  ...AccessLevelOptions.shape,
183
+ ...AllUserScopeOptions.shape,
174
184
  ...WorkqueueOrDashboardOptions.shape
175
185
  });
176
186
  var ScopeOptionKey = AllScopeOptions.keyof();
@@ -243,6 +253,33 @@ var RecordScopeV2 = z3.discriminatedUnion("type", [
243
253
  ]).describe(
244
254
  "Scopes used to check user's permission to perform actions on a record."
245
255
  );
256
+ var SystemScopeType = z3.enum([
257
+ "organisation.read-locations",
258
+ "user.read",
259
+ "user.create",
260
+ "user.edit",
261
+ "user.search"
262
+ ]);
263
+ var UserScopeType = SystemScopeType.extract([
264
+ "user.read",
265
+ "user.create",
266
+ "user.edit",
267
+ "user.search"
268
+ ]);
269
+ var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
270
+ var UserScopeV2 = z3.discriminatedUnion("type", [
271
+ z3.object({
272
+ type: ScopesWithRoleOption,
273
+ options: AllUserScopeOptions.optional()
274
+ }),
275
+ z3.object({
276
+ type: UserScopeType.extract(["user.read", "user.search"]),
277
+ options: AccessLevelOptions.optional()
278
+ })
279
+ ]);
280
+ function scopeUsesRoleOptions(scope) {
281
+ return ScopesWithRoleOption?.options.some((opt) => opt === scope.type);
282
+ }
246
283
  function scopeUsesDeclaredOptions(scope) {
247
284
  return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
248
285
  }
@@ -275,16 +312,14 @@ var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
275
312
  }).optional()
276
313
  })
277
314
  ]).describe("Resolved scope with location/user IDs instead of filters.");
278
- var SystemScopeType = z3.enum([
279
- "organisation.read-locations",
280
- "user.read",
281
- "user.create",
282
- "user.edit"
283
- ]);
284
315
  var Scope2 = z3.discriminatedUnion("type", [
285
316
  z3.object({ type: PlainScopeType }),
286
317
  ...RecordScopeV2.options,
287
- z3.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
318
+ ...UserScopeV2.options,
319
+ z3.object({
320
+ type: z3.literal("organisation.read-locations"),
321
+ options: AccessLevelOptions.optional()
322
+ }),
288
323
  z3.object({
289
324
  type: z3.literal("workqueue"),
290
325
  options: WorkqueueOrDashboardOptions
@@ -319,18 +354,26 @@ var encodeScope = (scope) => {
319
354
  encode: false
320
355
  });
321
356
  };
322
- var decodeScope = (query) => {
323
- const scope = qs.parse(query, {
357
+ var decodedScopeCache = /* @__PURE__ */ new Map();
358
+ var decodeScope = (encodedScope) => {
359
+ if (decodedScopeCache.has(encodedScope)) {
360
+ return decodedScopeCache.get(encodedScope);
361
+ }
362
+ const scope = qs.parse(encodedScope, {
324
363
  ignoreQueryPrefix: true,
325
364
  comma: true,
326
365
  allowDots: true
327
366
  });
328
367
  const unflattenedScope = unflattenScope(scope);
329
- return Scope2.safeParse(unflattenedScope)?.data;
368
+ const result = Scope2.safeParse(unflattenedScope)?.data;
369
+ decodedScopeCache.set(encodedScope, result);
370
+ return result;
330
371
  };
331
372
  var DEFAULT_SCOPE_OPTIONS = {
332
373
  placeOfEvent: JurisdictionFilter.enum.all,
333
- accessLevel: JurisdictionFilter.enum.all
374
+ accessLevel: JurisdictionFilter.enum.all,
375
+ registeredIn: JurisdictionFilter.enum.all,
376
+ declaredIn: JurisdictionFilter.enum.all
334
377
  };
335
378
  function getScopeOptionValue(scope, option) {
336
379
  const options = "options" in scope ? scope.options : void 0;
@@ -0,0 +1,4 @@
1
+ ##################################################################################
2
+ # Use this file to customize helm chart behavior
3
+ # Please make sure your custom changes doesn't conflict with values.yaml
4
+ ##################################################################################
@@ -0,0 +1,82 @@
1
+ ##################################################################################
2
+ # DON'T MODIFY THIS FILE
3
+ # File was generated by "yarn environment:init"
4
+ # File will be overwritten on next run of this script
5
+ # Please use values.override.yaml to modify helm chart behavior
6
+ # make sure your custom changes doesn't conflict with values.yaml
7
+ ##################################################################################
8
+
9
+ # Default: storage_type: host_path
10
+ # host_path option is backward compatible with Docker Swarm,
11
+ # configured to use sub-directories within /data folder
12
+ # For new installations feel free to remove storage_type
13
+ storage_type: host_path
14
+
15
+ # All datastores are placed on first node (master1) for backward compatibility
16
+ # with Docker Swarm.
17
+ # For new installations feel free to remove node_selector
18
+ node_selector:
19
+ role: data1
20
+
21
+ minio:
22
+ use_default_credentials: false
23
+ {{#if restore_enabled}}
24
+ restore:
25
+ type: {{restore_type}}
26
+ {{/if}}
27
+ {{#if backup_enabled}}
28
+ backup:
29
+ type: {{backup_type}}
30
+ {{/if}}
31
+
32
+ elasticsearch:
33
+ use_default_credentials: false
34
+
35
+ mongodb:
36
+ use_default_credentials: false
37
+
38
+ postgres:
39
+ use_default_credentials: false
40
+ {{#if restore_enabled}}
41
+ restore:
42
+ type: {{restore_type}}
43
+ {{/if}}
44
+ {{#if backup_enabled}}
45
+ backup:
46
+ type: {{backup_type}}
47
+ {{/if}}
48
+
49
+ redis:
50
+ auth_mode: acl
51
+
52
+ monitoring:
53
+ enabled: true
54
+
55
+ elastalert:
56
+ env:
57
+ NOTIFICATION_TYPE: email
58
+ secrets:
59
+ smtp-config:
60
+ - ALERT_EMAIL
61
+ - SENDER_EMAIL_ADDRESS
62
+ - SMTP_HOST
63
+ - SMTP_PASSWORD
64
+ - SMTP_PORT
65
+ - SMTP_SECURE
66
+ - SMTP_USERNAME
67
+
68
+ # Backup configuration
69
+ backup:
70
+ enabled: {{backup_enabled}}
71
+ schedule: "0 1 * * *"
72
+ backup_server_secret: backup-server-ssh-credentials
73
+ backup_server_dir: /home/backup/{{env}}
74
+
75
+
76
+ # Restore configuration
77
+ restore:
78
+ enabled: {{restore_enabled}}
79
+ schedule: "0 0 * * *"
80
+ backup_server_secret: backup-server-ssh-credentials
81
+ backup_server_dir: /home/backup/{{restore_environment_name}}
82
+ backup_encryption_secret: restore-encryption-secret
@@ -0,0 +1,4 @@
1
+ ##################################################################################
2
+ # Use this file to customize helm chart behavior
3
+ # Please make sure your custom changes doesn't conflict with values.yaml
4
+ ##################################################################################
@@ -0,0 +1,79 @@
1
+ ##################################################################################
2
+ # DON'T MODIFY THIS FILE
3
+ # File was generated by "yarn environment:init"
4
+ # File will be overwritten on next run of this script
5
+ # Please use values.override.yaml to modify helm chart behavior
6
+ # make sure your custom changes doesn't conflict with values.yaml
7
+ ##################################################################################
8
+
9
+ ########################################################################################
10
+ # Initial configuration file for OpenCRVS installation
11
+ ########################################################################################
12
+ # Some properties are not defined in this file and should be provided as key/value at
13
+ # installation time:
14
+ # - hostname: valid DNS name for opencrvs
15
+ # - countryconfig.image.name: Countryconfig image repository
16
+ # - countryconfig.image.tag: Countryconfig image tag
17
+ environment_type: {{environment_type}}
18
+
19
+ hpa:
20
+ enabled: false
21
+
22
+ env:
23
+ APN_SERVICE_URL: "http://apm-server.opencrvs-deps-{{env}}.svc.cluster.local:8200"
24
+ MINIO_BUCKET: ocrvs
25
+
26
+ influxdb:
27
+ host: influxdb-0.influxdb.opencrvs-deps-{{env}}.svc.cluster.local
28
+
29
+ elasticsearch:
30
+ auth_mode: auto
31
+ host: elasticsearch.opencrvs-deps-{{env}}.svc.cluster.local
32
+
33
+ minio:
34
+ auth_mode: use_secret
35
+ host: minio-0.minio.opencrvs-deps-{{env}}.svc.cluster.local
36
+
37
+ mongodb:
38
+ auth_mode: auto
39
+ host: mongodb-0.mongodb.opencrvs-deps-{{env}}.svc.cluster.local
40
+
41
+ redis:
42
+ auth_mode: use_secret
43
+ host: redis-0.redis.opencrvs-deps-{{env}}.svc.cluster.local
44
+
45
+ postgres:
46
+ auth_mode: auto
47
+ host: postgres-0.postgres.opencrvs-deps-{{env}}.svc.cluster.local
48
+
49
+ platform:
50
+ imagePullSecrets:
51
+ # Default value for credentials created while yarn environment:init
52
+ - name: dockerhub-credentials
53
+
54
+
55
+ auth:
56
+ env:
57
+ TWO_FA_ENABLED: {{two_fa_enabled}}
58
+
59
+ events:
60
+ env:
61
+ TWO_FA_ENABLED: {{two_fa_enabled}}
62
+
63
+ countryconfig:
64
+ secrets:
65
+ smtp-config:
66
+ - ALERT_EMAIL
67
+ - SENDER_EMAIL_ADDRESS
68
+ - SMTP_HOST
69
+ - SMTP_PASSWORD
70
+ - SMTP_PORT
71
+ - SMTP_SECURE
72
+ - SMTP_USERNAME
73
+
74
+ dashboards:
75
+ use_default_credentials: false
76
+ enabled: true
77
+
78
+ on_restore_cronjob:
79
+ enabled: {{restore_enabled}}
@@ -0,0 +1,4 @@
1
+ ##################################################################################
2
+ # Use this file to customize helm chart behavior
3
+ # Please make sure your custom changes doesn't conflict with values.yaml
4
+ ##################################################################################
@@ -0,0 +1,116 @@
1
+ ##################################################################################
2
+ # DON'T MODIFY THIS FILE
3
+ # File was generated by "yarn environment:init"
4
+ # File will be overwritten on next run of this script
5
+ # Please use values.override.yaml to modify helm chart behavior
6
+ # make sure your custom changes doesn't conflict with values.yaml
7
+ ##################################################################################
8
+
9
+ # Overwriting https://github.com/traefik/traefik-helm-chart/blob/master/traefik/values.yaml
10
+ namespaceOverride: "traefik"
11
+ logs:
12
+ general:
13
+ # "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL", "PANIC"
14
+ level: "INFO"
15
+ # format: "common" # For local environment
16
+ format: "json" # For server environment
17
+ access:
18
+ # -- To enable access logs
19
+ enabled: true
20
+ format: "json"
21
+
22
+ ingressRoute:
23
+ dashboard:
24
+ enabled: false
25
+
26
+ # Be explicit that we only use CRDs, not ingress/gw support
27
+ providers:
28
+ kubernetesCRD:
29
+ enabled: true
30
+ kubernetesIngress:
31
+ enabled: false
32
+ kubernetesGateway:
33
+ enabled: false
34
+
35
+ service:
36
+ enabled: true
37
+ single: false
38
+ type: NodePort
39
+
40
+ ports:
41
+ web:
42
+ port: 8000
43
+ hostPort: 80
44
+ protocol: TCP
45
+ nodePort: 30080
46
+ http:
47
+ redirections:
48
+ entryPoint:
49
+ to: websecure
50
+ scheme: https
51
+ permanent: true
52
+
53
+ websecure:
54
+ port: 8443
55
+ hostPort: 443
56
+ protocol: TCP
57
+ nodePort: 30443
58
+ {{#if lets_encrypt}}
59
+ http:
60
+ tls:
61
+ enabled: true
62
+ certResolver: letsencrypt
63
+ {{/if}}
64
+
65
+
66
+ {{#if lets_encrypt}}
67
+ # 👇 Adjust this section if needed
68
+ certificatesResolvers:
69
+ letsencrypt:
70
+ acme:
71
+ tlsChallenge: false
72
+ httpChallenge:
73
+ entryPoint: web
74
+ # 👇 Provide admin email address
75
+ email: admin@opencrvs.org
76
+ # Storage for certificates:
77
+ storage: /certificates/acme.json
78
+ # NOTE: Sometimes Let's Encrypt hit production SSL certificate issuing limits
79
+ # If you are having issues, switch to staging
80
+ # Staging server
81
+ # caServer: https://acme-staging-v02.api.letsencrypt.org/directory
82
+ # Production server
83
+ caServer: https://acme-v02.api.letsencrypt.org/directory
84
+
85
+ additionalVolumeMounts:
86
+ - name: acme
87
+ mountPath: /certificates
88
+ {{/if}}
89
+ {{#if static_ssl}}
90
+ certificatesResolvers: {}
91
+
92
+ # 👇 Custom TLS configuration
93
+ tlsStore:
94
+ default:
95
+ defaultCertificate:
96
+ # Check documentation how to create secret with static SSL certificate
97
+ secretName: traefik-cert
98
+ {{/if}}
99
+
100
+ deployment:
101
+ hostNetwork: true
102
+ {{#if static_ssl}}
103
+ kind: DaemonSet
104
+ {{/if}}
105
+ {{#if lets_encrypt}}
106
+ additionalVolumes:
107
+ - name: acme
108
+ hostPath:
109
+ path: /data/traefik
110
+ {{/if}}
111
+
112
+ # If you need to run traefik on all cluster nodes
113
+ # Add this line to traefik/values.override.yaml
114
+ # nodeSelector: {}
115
+ nodeSelector:
116
+ traefik-role: ingress