@opencrvs/toolkit 2.0.0-rc.18d8164 → 2.0.0-rc.18f6ed6

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 (41) hide show
  1. package/dist/application-config/index.js +29 -29
  2. package/dist/cli.js +392 -128
  3. package/dist/commons/api/router.d.ts +3359 -239
  4. package/dist/commons/conditionals/validate.d.ts +1 -0
  5. package/dist/commons/events/ActionDocument.d.ts +6 -0
  6. package/dist/commons/events/ActionInput.d.ts +114 -0
  7. package/dist/commons/events/Draft.d.ts +3 -0
  8. package/dist/commons/events/EventDocument.d.ts +3 -0
  9. package/dist/commons/events/EventIndex.d.ts +0 -3
  10. package/dist/commons/events/EventMetadata.d.ts +0 -7
  11. package/dist/commons/events/WorkqueueConfig.d.ts +146 -146
  12. package/dist/commons/events/state/index.d.ts +0 -4
  13. package/dist/commons/events/state/utils.d.ts +3 -2
  14. package/dist/commons/events/utils.d.ts +4 -1
  15. package/dist/conditionals/index.js +3 -1
  16. package/dist/events/index.js +58 -78
  17. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  18. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  19. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -2
  20. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
  21. package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
  22. package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
  23. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
  24. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
  25. package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
  26. package/dist/migrations/v2.0/index.d.ts +5 -3
  27. package/dist/migrations/v2.0/index.d.ts.map +1 -1
  28. package/dist/migrations/v2.0/index.js +390 -126
  29. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
  30. package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
  31. package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
  32. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
  33. package/dist/migrations/v2.0/migrate-scopes.js +54 -30
  34. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
  35. package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
  36. package/dist/notification/index.js +45 -48
  37. package/dist/scopes/index.js +3 -1
  38. package/opencrvs-toolkit-2.0.0-rc.18f6ed6.tgz +0 -0
  39. package/package.json +1 -1
  40. package/tsconfig.tsbuildinfo +1 -1
  41. package/opencrvs-toolkit-2.0.0-rc.18d8164.tgz +0 -0
@@ -293,7 +293,9 @@ var ScopeType = z2.enum([
293
293
  var EncodedScope = z2.string().brand("EncodedScope");
294
294
  var DEFAULT_SCOPE_OPTIONS = {
295
295
  placeOfEvent: JurisdictionFilter.enum.all,
296
- accessLevel: JurisdictionFilter.enum.all
296
+ accessLevel: JurisdictionFilter.enum.all,
297
+ registeredIn: JurisdictionFilter.enum.all,
298
+ declaredIn: JurisdictionFilter.enum.all
297
299
  };
298
300
 
299
301
  // ../commons/src/authentication.ts
@@ -652,7 +654,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
652
654
  ShowConditional,
653
655
  // Action can be shown to the user in the list but as disabled
654
656
  EnableConditional
655
- ]);
657
+ ]).meta({
658
+ description: "Action conditional configuration",
659
+ id: "ActionConditional"
660
+ });
656
661
  var DisplayOnReviewConditional = z7.object({
657
662
  type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
658
663
  conditional: Conditional
@@ -980,28 +985,20 @@ function schemaPriority(schema) {
980
985
  return idx === -1 ? 9999 : idx;
981
986
  }
982
987
  function safeUnion(schemas) {
988
+ const sortedSchemas = [...schemas].sort(
989
+ (a, b) => schemaPriority(a) - schemaPriority(b)
990
+ );
983
991
  return z12.any().superRefine((val, ctx) => {
984
- const successful = schemas.filter((s) => s.safeParse(val).success);
985
- if (successful.length === 1) {
986
- return;
987
- }
988
- if (successful.length === 0) {
989
- ctx.addIssue({
990
- code: "invalid_type",
991
- expected: "custom",
992
- message: "Value does not match any schema"
993
- });
994
- return;
995
- }
996
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
997
- const best = successful[0];
998
- if (!best.safeParse(val).success) {
999
- ctx.addIssue({
1000
- expected: "custom",
1001
- code: "invalid_type",
1002
- message: "Value did not match the best schema"
1003
- });
992
+ for (const schema of sortedSchemas) {
993
+ if (schema.safeParse(val).success) {
994
+ return;
995
+ }
1004
996
  }
997
+ ctx.addIssue({
998
+ code: "invalid_type",
999
+ expected: "custom",
1000
+ message: "Value does not match any schema"
1001
+ });
1005
1002
  }).meta({
1006
1003
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
1007
1004
  });
@@ -1218,8 +1215,9 @@ var RequestedCorrectionAction = ActionBase.extend(
1218
1215
  var ApprovedCorrectionAction = ActionBase.extend(
1219
1216
  z14.object({
1220
1217
  type: z14.literal(ActionType.APPROVE_CORRECTION),
1221
- requestId: z14.string()
1218
+ requestId: z14.string(),
1222
1219
  // TODO move into 'content' property
1220
+ content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
1223
1221
  }).shape
1224
1222
  );
1225
1223
  var RejectedCorrectionAction = ActionBase.extend(
@@ -1311,6 +1309,9 @@ var FlagConfig = z15.object({
1311
1309
  "Indicates if this flag expects an action to be performed to be cleared."
1312
1310
  ),
1313
1311
  label: TranslationConfig.describe("Human readable label of the flag.")
1312
+ }).meta({
1313
+ description: "Flag configuration",
1314
+ id: "FlagConfig"
1314
1315
  });
1315
1316
  var ActionFlagConfig = z15.object({
1316
1317
  id: Flag,
@@ -1318,6 +1319,9 @@ var ActionFlagConfig = z15.object({
1318
1319
  conditional: Conditional.optional().describe(
1319
1320
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1320
1321
  )
1322
+ }).meta({
1323
+ description: "Action flag configuration",
1324
+ id: "ActionFlagConfig"
1321
1325
  });
1322
1326
 
1323
1327
  // ../commons/src/events/EventMetadata.ts
@@ -1339,8 +1343,7 @@ var ActionCreationMetadata = z16.object({
1339
1343
  ),
1340
1344
  createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1341
1345
  acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1342
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
1343
- createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
1346
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1344
1347
  });
1345
1348
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1346
1349
  registrationNumber: z16.string().describe(
@@ -1368,9 +1371,6 @@ var EventMetadata = z16.object({
1368
1371
  createdAtLocation: UUID.nullish().describe(
1369
1372
  "Location of the user who created the event."
1370
1373
  ),
1371
- createdBySignature: DocumentPath.nullish().describe(
1372
- "Signature of the user who created the event."
1373
- ),
1374
1374
  updatedAtLocation: UUID.nullish().describe(
1375
1375
  "Location of the user who last changed the status."
1376
1376
  ),
@@ -1663,7 +1663,7 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
1663
1663
  }
1664
1664
  }).describe("Unique identifier for the field");
1665
1665
  var FieldReference = import_v43.default.object({
1666
- $$field: FieldId,
1666
+ $$field: FieldId.describe("Id of the field to reference"),
1667
1667
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
1668
1668
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1669
1669
  )
@@ -2376,10 +2376,10 @@ var VerificationPageConfig = FormPageConfig.extend({
2376
2376
  type: z21.literal(PageTypes.enum.VERIFICATION),
2377
2377
  actions: VerificationActionConfig
2378
2378
  });
2379
- var PageConfig = z21.discriminatedUnion("type", [
2380
- FormPageConfig,
2381
- VerificationPageConfig
2382
- ]);
2379
+ var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2380
+ description: "Page configuration",
2381
+ id: "PageConfig"
2382
+ });
2383
2383
 
2384
2384
  // ../commons/src/events/FormConfig.ts
2385
2385
  var DeclarationFormConfig = z22.object({
@@ -3679,7 +3679,7 @@ var _EventConfigBase = z33.object({
3679
3679
  ),
3680
3680
  label: TranslationConfig.describe("Human-readable label for the event type."),
3681
3681
  actions: z33.array(ActionConfig).describe(
3682
- "Configuration of system-defined actions associated with the event."
3682
+ "Configuration of core and custom actions associated with the event."
3683
3683
  ),
3684
3684
  actionOrder: z33.array(z33.string()).optional().describe(
3685
3685
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
@@ -3691,7 +3691,7 @@ var _EventConfigBase = z33.object({
3691
3691
  "Configuration of fields available in the advanced search feature."
3692
3692
  ),
3693
3693
  flags: z33.array(FlagConfig).optional().default([]).describe(
3694
- "Configuration of flags associated with the actions of this event type."
3694
+ "Configuration of custom flags associated with the actions of this event type."
3695
3695
  ),
3696
3696
  analytics: z33.boolean().optional().default(true).describe(
3697
3697
  "Indicates whether the records of this event type are included in analytics"
@@ -4129,18 +4129,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
4129
4129
  query: true,
4130
4130
  columns: true
4131
4131
  });
4132
- var WorkqueueConfigInput = z37.object({
4133
- slug: z37.string().describe("Determines the url of the workqueue."),
4134
- name: TranslationConfig.describe(
4135
- "Title of the workflow (both in navigation and on the page)"
4136
- ),
4137
- query: CountryConfigQueryInputType,
4138
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
4139
- "Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
4140
- ),
4141
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
4142
- icon: AvailableIcons,
4143
- emptyMessage: TranslationConfig.optional()
4132
+ var WorkqueueConfigInput = WorkqueueConfig.extend({
4133
+ query: CountryConfigQueryInputType
4134
+ }).meta({
4135
+ description: "Workqueue configuration",
4136
+ id: "WorkqueueConfig"
4144
4137
  });
4145
4138
  var WorkqueueCountInput = z37.array(
4146
4139
  z37.object({ slug: z37.string(), query: QueryType })
@@ -4180,6 +4173,9 @@ var BaseActionInput = z38.object({
4180
4173
  originalActionId: UUID.optional(),
4181
4174
  // should not be part of base action.
4182
4175
  keepAssignment: z38.boolean().optional(),
4176
+ keepAssignmentIfAccepted: z38.boolean().optional(),
4177
+ keepAssignmentIfRejected: z38.boolean().optional(),
4178
+ waitFor: z38.boolean().optional(),
4183
4179
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4184
4180
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
4185
4181
  createdAtLocation: UUID.nullish().describe(
@@ -4297,7 +4293,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
4297
4293
  var ApproveCorrectionActionInput = BaseActionInput.extend(
4298
4294
  z38.object({
4299
4295
  requestId: z38.string(),
4300
- type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
4296
+ type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
4297
+ content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
4301
4298
  }).shape
4302
4299
  );
4303
4300
  var ReadActionInput = BaseActionInput.extend(
@@ -365,7 +365,9 @@ var decodeScope = (query) => {
365
365
  };
366
366
  var DEFAULT_SCOPE_OPTIONS = {
367
367
  placeOfEvent: JurisdictionFilter.enum.all,
368
- accessLevel: JurisdictionFilter.enum.all
368
+ accessLevel: JurisdictionFilter.enum.all,
369
+ registeredIn: JurisdictionFilter.enum.all,
370
+ declaredIn: JurisdictionFilter.enum.all
369
371
  };
370
372
  function getScopeOptionValue(scope, option) {
371
373
  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.18d8164",
3
+ "version": "2.0.0-rc.18f6ed6",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {
@@ -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"}