@opencrvs/toolkit 2.0.0-rc.e12607f → 2.0.0-rc.e173b37

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 (59) hide show
  1. package/create-countryconfig/index.js +103 -0
  2. package/create-countryconfig/package.json +21 -0
  3. package/dist/application-config/index.js +274 -126
  4. package/dist/cli.js +516 -174
  5. package/dist/commons/api/router.d.ts +3379 -239
  6. package/dist/commons/application-config/index.d.ts +17 -4
  7. package/dist/commons/conditionals/conditionals.d.ts +357 -7
  8. package/dist/commons/conditionals/validate.d.ts +52 -2
  9. package/dist/commons/events/ActionDocument.d.ts +6 -0
  10. package/dist/commons/events/ActionInput.d.ts +114 -0
  11. package/dist/commons/events/AdvancedSearchConfig.d.ts +342 -0
  12. package/dist/commons/events/Draft.d.ts +4 -2
  13. package/dist/commons/events/EventDocument.d.ts +3 -0
  14. package/dist/commons/events/EventIndex.d.ts +0 -3
  15. package/dist/commons/events/EventMetadata.d.ts +0 -7
  16. package/dist/commons/events/FieldConfig.d.ts +382 -50
  17. package/dist/commons/events/FieldValue.d.ts +6 -0
  18. package/dist/commons/events/WorkqueueConfig.d.ts +150 -150
  19. package/dist/commons/events/field.d.ts +53 -1
  20. package/dist/commons/events/index.d.ts +2 -0
  21. package/dist/commons/events/locations.d.ts +21 -0
  22. package/dist/commons/events/mocks.test.utils.d.ts +19 -0
  23. package/dist/commons/events/scopes.d.ts +24 -1
  24. package/dist/commons/events/state/flags.d.ts +16 -0
  25. package/dist/commons/events/state/index.d.ts +0 -4
  26. package/dist/commons/events/state/utils.d.ts +12 -289
  27. package/dist/commons/events/utils.d.ts +13 -2
  28. package/dist/conditionals/index.js +60 -5
  29. package/dist/events/index.js +1015 -258
  30. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
  31. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +60 -35
  32. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  33. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  34. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  35. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  36. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  37. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  38. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  39. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  40. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  41. package/dist/migrations/v2.0/index.d.ts +5 -3
  42. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  43. package/dist/migrations/v2.0/index.js +514 -172
  44. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
  45. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +90 -1
  46. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  47. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  48. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  49. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  50. package/dist/migrations/v2.0/migrate-scopes.js +54 -30
  51. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  52. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  53. package/dist/notification/index.js +810 -157
  54. package/dist/scopes/index.d.ts +10 -7
  55. package/dist/scopes/index.js +17 -7
  56. package/opencrvs-toolkit-2.0.0-rc.e173b37.tgz +0 -0
  57. package/package.json +6 -2
  58. package/tsconfig.tsbuildinfo +1 -1
  59. package/opencrvs-toolkit-2.0.0-rc.e12607f.tgz +0 -0
@@ -227,12 +227,14 @@ declare const SystemScopeType: z.ZodEnum<{
227
227
  "user.read": "user.read";
228
228
  "user.create": "user.create";
229
229
  "user.edit": "user.edit";
230
+ "user.search": "user.search";
230
231
  }>;
231
232
  export type SystemScopeType = z.infer<typeof SystemScopeType>;
232
233
  declare const UserScopeType: z.ZodEnum<{
233
234
  "user.read": "user.read";
234
235
  "user.create": "user.create";
235
236
  "user.edit": "user.edit";
237
+ "user.search": "user.search";
236
238
  }>;
237
239
  export type UserScopeType = z.infer<typeof UserScopeType>;
238
240
  declare const ScopesWithRoleOption: z.ZodEnum<{
@@ -256,6 +258,7 @@ export declare const UserScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
256
258
  }, z.core.$strip>, z.ZodObject<{
257
259
  type: z.ZodEnum<{
258
260
  "user.read": "user.read";
261
+ "user.search": "user.search";
259
262
  }>;
260
263
  options: z.ZodOptional<z.ZodObject<{
261
264
  accessLevel: z.ZodOptional<z.ZodEnum<{
@@ -493,6 +496,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
493
496
  }, z.core.$strip>, z.ZodObject<{
494
497
  type: z.ZodEnum<{
495
498
  "user.read": "user.read";
499
+ "user.search": "user.search";
496
500
  }>;
497
501
  options: z.ZodOptional<z.ZodObject<{
498
502
  accessLevel: z.ZodOptional<z.ZodEnum<{
@@ -556,6 +560,7 @@ export declare const ScopeType: z.ZodEnum<{
556
560
  "user.read": "user.read";
557
561
  "user.create": "user.create";
558
562
  "user.edit": "user.edit";
563
+ "user.search": "user.search";
559
564
  workqueue: "workqueue";
560
565
  "dashboard.view": "dashboard.view";
561
566
  }>;
@@ -575,14 +580,12 @@ export type EncodedScope = z.infer<typeof EncodedScope>;
575
580
  */
576
581
  export declare const encodeScope: (scope: Scope) => EncodedScope;
577
582
  /**
578
- * Converts a scope object into an encoded query string representation.
583
+ * Converts an encoded scope string into a scope object.
579
584
  *
580
- * @TODO scope param could be defined as EncodedScope instead of string.
581
- *
582
- * @param scope - The scope object to encode.
583
- * @returns The encoded scope as a branded string (`EncodedScope`).
585
+ * @param scope - The encoded scope string to decode.
586
+ * @returns The decoded scope object.
584
587
  */
585
- export declare const decodeScope: (query: EncodedScope) => {
588
+ export declare const decodeScope: (encodedScope: EncodedScope) => {
586
589
  type: "record.create" | "record.declare" | "record.notify";
587
590
  options?: {
588
591
  event?: string[] | undefined;
@@ -635,7 +638,7 @@ export declare const decodeScope: (query: EncodedScope) => {
635
638
  role?: string[] | undefined;
636
639
  } | undefined;
637
640
  } | {
638
- type: "user.read";
641
+ type: "user.read" | "user.search";
639
642
  options?: {
640
643
  accessLevel?: "administrativeArea" | "location" | "all" | undefined;
641
644
  } | undefined;
@@ -257,12 +257,14 @@ var SystemScopeType = z3.enum([
257
257
  "organisation.read-locations",
258
258
  "user.read",
259
259
  "user.create",
260
- "user.edit"
260
+ "user.edit",
261
+ "user.search"
261
262
  ]);
262
263
  var UserScopeType = SystemScopeType.extract([
263
264
  "user.read",
264
265
  "user.create",
265
- "user.edit"
266
+ "user.edit",
267
+ "user.search"
266
268
  ]);
267
269
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
268
270
  var UserScopeV2 = z3.discriminatedUnion("type", [
@@ -271,7 +273,7 @@ var UserScopeV2 = z3.discriminatedUnion("type", [
271
273
  options: AllUserScopeOptions.optional()
272
274
  }),
273
275
  z3.object({
274
- type: UserScopeType.extract(["user.read"]),
276
+ type: UserScopeType.extract(["user.read", "user.search"]),
275
277
  options: AccessLevelOptions.optional()
276
278
  })
277
279
  ]);
@@ -352,18 +354,26 @@ var encodeScope = (scope) => {
352
354
  encode: false
353
355
  });
354
356
  };
355
- var decodeScope = (query) => {
356
- 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, {
357
363
  ignoreQueryPrefix: true,
358
364
  comma: true,
359
365
  allowDots: true
360
366
  });
361
367
  const unflattenedScope = unflattenScope(scope);
362
- return Scope2.safeParse(unflattenedScope)?.data;
368
+ const result = Scope2.safeParse(unflattenedScope)?.data;
369
+ decodedScopeCache.set(encodedScope, result);
370
+ return result;
363
371
  };
364
372
  var DEFAULT_SCOPE_OPTIONS = {
365
373
  placeOfEvent: JurisdictionFilter.enum.all,
366
- accessLevel: JurisdictionFilter.enum.all
374
+ accessLevel: JurisdictionFilter.enum.all,
375
+ registeredIn: JurisdictionFilter.enum.all,
376
+ declaredIn: JurisdictionFilter.enum.all
367
377
  };
368
378
  function getScopeOptionValue(scope, option) {
369
379
  const options = "options" in scope ? scope.options : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.e12607f",
3
+ "version": "2.0.0-rc.e173b37",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {
@@ -20,6 +20,10 @@
20
20
  "build": "./build.sh",
21
21
  "build:all": "lerna run build --include-dependencies --scope @opencrvs/toolkit && ./build.sh"
22
22
  },
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/opencrvs/opencrvs-core.git"
26
+ },
23
27
  "dependencies": {
24
28
  "@trpc/client": "11.4.3",
25
29
  "@trpc/server": "^11.8.0",
@@ -29,7 +33,7 @@
29
33
  "jwt-decode": "^3.0.0",
30
34
  "lodash": "^4.17.10",
31
35
  "object-hash": "^3.0.0",
32
- "qs": "6.14.0",
36
+ "qs": "6.15.2",
33
37
  "superjson": "1.9.0-0",
34
38
  "ts-morph": "^27.0.2",
35
39
  "uuid": "^9.0.0",
@@ -1 +1 @@
1
- {"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/events/deduplication.ts","./src/events/index.ts","./src/migrations/v2.0/add-birth-certificate-issuance-flag.ts","./src/migrations/v2.0/add-resend-invite-notification.ts","./src/migrations/v2.0/checkout-upstream-files.ts","./src/migrations/v2.0/convert-config-files-to-ts.ts","./src/migrations/v2.0/convert-paragraph-to-heading.ts","./src/migrations/v2.0/create-events-index.ts","./src/migrations/v2.0/delete-infrastructure-directory.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/merge-infrastructure-directory.ts","./src/migrations/v2.0/migrate-application-config-url.ts","./src/migrations/v2.0/migrate-scopes.ts","./src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts","./src/migrations/v2.0/migrate-workqueue-configs.ts","./src/migrations/v2.0/remove-delete-actions.ts","./src/migrations/v2.0/remove-demo-scope.ts","./src/migrations/v2.0/remove-deprecated-imports.ts","./src/migrations/v2.0/remove-fhir-url-helpers.ts","./src/migrations/v2.0/remove-hearth-migrations.ts","./src/migrations/v2.0/remove-old-statistics-service.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/remove-unused-environment-variables.ts","./src/migrations/v2.0/rename-api-paths.ts","./src/migrations/v2.0/rename-location-parent-id.ts","./src/migrations/v2.0/simplify-analytics-precalculations.ts","./src/migrations/v2.0/update-package-json.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"5.6.3"}
1
+ {"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/events/deduplication.ts","./src/events/index.ts","./src/migrations/v2.0/add-birth-certificate-issuance-flag.ts","./src/migrations/v2.0/add-resend-invite-notification.ts","./src/migrations/v2.0/checkout-upstream-files.ts","./src/migrations/v2.0/convert-config-files-to-ts.ts","./src/migrations/v2.0/convert-paragraph-to-heading.ts","./src/migrations/v2.0/create-events-index.ts","./src/migrations/v2.0/delete-infrastructure-directory.ts","./src/migrations/v2.0/fix-accept-requested-registration-function-type.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/merge-infrastructure-directory.ts","./src/migrations/v2.0/migrate-application-config-url.ts","./src/migrations/v2.0/migrate-scopes.ts","./src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts","./src/migrations/v2.0/migrate-workqueue-configs.ts","./src/migrations/v2.0/remove-delete-actions.ts","./src/migrations/v2.0/remove-demo-scope.ts","./src/migrations/v2.0/remove-deprecated-imports.ts","./src/migrations/v2.0/remove-fhir-url-helpers.ts","./src/migrations/v2.0/remove-hearth-migrations.ts","./src/migrations/v2.0/remove-old-statistics-service.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/remove-unused-environment-variables.ts","./src/migrations/v2.0/rename-api-paths.ts","./src/migrations/v2.0/rename-location-parent-id.ts","./src/migrations/v2.0/simplify-analytics-precalculations.ts","./src/migrations/v2.0/update-package-json.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"5.6.3"}