@opencrvs/toolkit 2.0.0-rc.087cdbb → 2.0.0-rc.0bd0043

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.
@@ -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
  });
@@ -1311,6 +1308,9 @@ var FlagConfig = z15.object({
1311
1308
  "Indicates if this flag expects an action to be performed to be cleared."
1312
1309
  ),
1313
1310
  label: TranslationConfig.describe("Human readable label of the flag.")
1311
+ }).meta({
1312
+ description: "Flag configuration",
1313
+ id: "FlagConfig"
1314
1314
  });
1315
1315
  var ActionFlagConfig = z15.object({
1316
1316
  id: Flag,
@@ -1318,6 +1318,9 @@ var ActionFlagConfig = z15.object({
1318
1318
  conditional: Conditional.optional().describe(
1319
1319
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1320
1320
  )
1321
+ }).meta({
1322
+ description: "Action flag configuration",
1323
+ id: "ActionFlagConfig"
1321
1324
  });
1322
1325
 
1323
1326
  // ../commons/src/events/EventMetadata.ts
@@ -1339,8 +1342,7 @@ var ActionCreationMetadata = z16.object({
1339
1342
  ),
1340
1343
  createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1341
1344
  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.")
1345
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1344
1346
  });
1345
1347
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1346
1348
  registrationNumber: z16.string().describe(
@@ -1368,9 +1370,6 @@ var EventMetadata = z16.object({
1368
1370
  createdAtLocation: UUID.nullish().describe(
1369
1371
  "Location of the user who created the event."
1370
1372
  ),
1371
- createdBySignature: DocumentPath.nullish().describe(
1372
- "Signature of the user who created the event."
1373
- ),
1374
1373
  updatedAtLocation: UUID.nullish().describe(
1375
1374
  "Location of the user who last changed the status."
1376
1375
  ),
@@ -2376,10 +2375,10 @@ var VerificationPageConfig = FormPageConfig.extend({
2376
2375
  type: z21.literal(PageTypes.enum.VERIFICATION),
2377
2376
  actions: VerificationActionConfig
2378
2377
  });
2379
- var PageConfig = z21.discriminatedUnion("type", [
2380
- FormPageConfig,
2381
- VerificationPageConfig
2382
- ]);
2378
+ var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2379
+ description: "Page configuration",
2380
+ id: "PageConfig"
2381
+ });
2383
2382
 
2384
2383
  // ../commons/src/events/FormConfig.ts
2385
2384
  var DeclarationFormConfig = z22.object({
@@ -4182,6 +4181,7 @@ var BaseActionInput = z38.object({
4182
4181
  keepAssignment: z38.boolean().optional(),
4183
4182
  keepAssignmentIfAccepted: z38.boolean().optional(),
4184
4183
  keepAssignmentIfRejected: z38.boolean().optional(),
4184
+ waitFor: z38.boolean().optional(),
4185
4185
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4186
4186
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
4187
4187
  createdAtLocation: UUID.nullish().describe(
@@ -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.087cdbb",
3
+ "version": "2.0.0-rc.0bd0043",
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"}