@opencrvs/toolkit 2.0.0-rc.18f0568 → 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.
@@ -306,7 +306,6 @@ __export(events_exports, {
306
306
  getAllUniqueFields: () => getAllUniqueFields,
307
307
  getAnnotationFromDrafts: () => getAnnotationFromDrafts,
308
308
  getAssignedUserFromActions: () => getAssignedUserFromActions,
309
- getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
310
309
  getAssignmentStatus: () => getAssignmentStatus,
311
310
  getAvailableActionsForEvent: () => getAvailableActionsForEvent,
312
311
  getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
@@ -705,7 +704,9 @@ var decodeScope = (query) => {
705
704
  };
706
705
  var DEFAULT_SCOPE_OPTIONS = {
707
706
  placeOfEvent: JurisdictionFilter.enum.all,
708
- accessLevel: JurisdictionFilter.enum.all
707
+ accessLevel: JurisdictionFilter.enum.all,
708
+ registeredIn: JurisdictionFilter.enum.all,
709
+ declaredIn: JurisdictionFilter.enum.all
709
710
  };
710
711
  function getAcceptedScopesByType({
711
712
  acceptedScopes,
@@ -1078,7 +1079,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
1078
1079
  ShowConditional,
1079
1080
  // Action can be shown to the user in the list but as disabled
1080
1081
  EnableConditional
1081
- ]);
1082
+ ]).meta({
1083
+ description: "Action conditional configuration",
1084
+ id: "ActionConditional"
1085
+ });
1082
1086
  var DisplayOnReviewConditional = z7.object({
1083
1087
  type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
1084
1088
  conditional: Conditional
@@ -1644,8 +1648,9 @@ var RequestedCorrectionAction = ActionBase.extend(
1644
1648
  var ApprovedCorrectionAction = ActionBase.extend(
1645
1649
  z14.object({
1646
1650
  type: z14.literal(ActionType.APPROVE_CORRECTION),
1647
- requestId: z14.string()
1651
+ requestId: z14.string(),
1648
1652
  // TODO move into 'content' property
1653
+ content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
1649
1654
  }).shape
1650
1655
  );
1651
1656
  var RejectedCorrectionAction = ActionBase.extend(
@@ -1737,6 +1742,9 @@ var FlagConfig = z15.object({
1737
1742
  "Indicates if this flag expects an action to be performed to be cleared."
1738
1743
  ),
1739
1744
  label: TranslationConfig.describe("Human readable label of the flag.")
1745
+ }).meta({
1746
+ description: "Flag configuration",
1747
+ id: "FlagConfig"
1740
1748
  });
1741
1749
  var ActionFlagConfig = z15.object({
1742
1750
  id: Flag,
@@ -1744,6 +1752,9 @@ var ActionFlagConfig = z15.object({
1744
1752
  conditional: Conditional.optional().describe(
1745
1753
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1746
1754
  )
1755
+ }).meta({
1756
+ description: "Action flag configuration",
1757
+ id: "ActionFlagConfig"
1747
1758
  });
1748
1759
 
1749
1760
  // ../commons/src/events/EventMetadata.ts
@@ -1765,8 +1776,7 @@ var ActionCreationMetadata = z16.object({
1765
1776
  ),
1766
1777
  createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1767
1778
  acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1768
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
1769
- createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
1779
+ createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
1770
1780
  });
1771
1781
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1772
1782
  registrationNumber: z16.string().describe(
@@ -1794,9 +1804,6 @@ var EventMetadata = z16.object({
1794
1804
  createdAtLocation: UUID.nullish().describe(
1795
1805
  "Location of the user who created the event."
1796
1806
  ),
1797
- createdBySignature: DocumentPath.nullish().describe(
1798
- "Signature of the user who created the event."
1799
- ),
1800
1807
  updatedAtLocation: UUID.nullish().describe(
1801
1808
  "Location of the user who last changed the status."
1802
1809
  ),
@@ -2171,7 +2178,7 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
2171
2178
  }
2172
2179
  }).describe("Unique identifier for the field");
2173
2180
  var FieldReference = import_v43.default.object({
2174
- $$field: FieldId,
2181
+ $$field: FieldId.describe("Id of the field to reference"),
2175
2182
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
2176
2183
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
2177
2184
  )
@@ -2884,10 +2891,10 @@ var VerificationPageConfig = FormPageConfig.extend({
2884
2891
  type: z21.literal(PageTypes.enum.VERIFICATION),
2885
2892
  actions: VerificationActionConfig
2886
2893
  });
2887
- var PageConfig = z21.discriminatedUnion("type", [
2888
- FormPageConfig,
2889
- VerificationPageConfig
2890
- ]);
2894
+ var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2895
+ description: "Page configuration",
2896
+ id: "PageConfig"
2897
+ });
2891
2898
 
2892
2899
  // ../commons/src/events/FormConfig.ts
2893
2900
  var DeclarationFormConfig = z22.object({
@@ -5368,7 +5375,7 @@ var _EventConfigBase = z33.object({
5368
5375
  ),
5369
5376
  label: TranslationConfig.describe("Human-readable label for the event type."),
5370
5377
  actions: z33.array(ActionConfig).describe(
5371
- "Configuration of system-defined actions associated with the event."
5378
+ "Configuration of core and custom actions associated with the event."
5372
5379
  ),
5373
5380
  actionOrder: z33.array(z33.string()).optional().describe(
5374
5381
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
@@ -5380,7 +5387,7 @@ var _EventConfigBase = z33.object({
5380
5387
  "Configuration of fields available in the advanced search feature."
5381
5388
  ),
5382
5389
  flags: z33.array(FlagConfig).optional().default([]).describe(
5383
- "Configuration of flags associated with the actions of this event type."
5390
+ "Configuration of custom flags associated with the actions of this event type."
5384
5391
  ),
5385
5392
  analytics: z33.boolean().optional().default(true).describe(
5386
5393
  "Indicates whether the records of this event type are included in analytics"
@@ -5819,18 +5826,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
5819
5826
  query: true,
5820
5827
  columns: true
5821
5828
  });
5822
- var WorkqueueConfigInput = z37.object({
5823
- slug: z37.string().describe("Determines the url of the workqueue."),
5824
- name: TranslationConfig.describe(
5825
- "Title of the workflow (both in navigation and on the page)"
5826
- ),
5827
- query: CountryConfigQueryInputType,
5828
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
5829
- "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."
5830
- ),
5831
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
5832
- icon: AvailableIcons,
5833
- emptyMessage: TranslationConfig.optional()
5829
+ var WorkqueueConfigInput = WorkqueueConfig.extend({
5830
+ query: CountryConfigQueryInputType
5831
+ }).meta({
5832
+ description: "Workqueue configuration",
5833
+ id: "WorkqueueConfig"
5834
5834
  });
5835
5835
  function defineWorkqueue(workqueueInput) {
5836
5836
  const queryInput = workqueueInput.query;
@@ -6011,7 +6011,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
6011
6011
  var ApproveCorrectionActionInput = BaseActionInput.extend(
6012
6012
  z38.object({
6013
6013
  requestId: z38.string(),
6014
- type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
6014
+ type: z38.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION),
6015
+ content: z38.object({ immediateCorrection: z38.boolean().optional() }).optional()
6015
6016
  }).shape
6016
6017
  );
6017
6018
  var ReadActionInput = BaseActionInput.extend(
@@ -6147,7 +6148,6 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
6147
6148
  createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
6148
6149
  acceptedAt: acceptAction.createdAt,
6149
6150
  createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
6150
- createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
6151
6151
  registrationNumber
6152
6152
  };
6153
6153
  }
@@ -6361,17 +6361,6 @@ function getAssignedUserFromActions(actions) {
6361
6361
  return user2;
6362
6362
  }, null);
6363
6363
  }
6364
- function getAssignedUserSignatureFromActions(actions) {
6365
- return actions.reduce((signature, action) => {
6366
- if (action.type === ActionType.ASSIGN) {
6367
- return action.createdBySignature || null;
6368
- }
6369
- if (action.type === ActionType.UNASSIGN) {
6370
- return null;
6371
- }
6372
- return signature;
6373
- }, null);
6374
- }
6375
6364
  function deepDropNulls(obj) {
6376
6365
  if (Array.isArray(obj)) {
6377
6366
  return obj.map(deepDropNulls);
@@ -6467,10 +6456,8 @@ function getCurrentEventState(event2, config) {
6467
6456
  createdBy: creationAction.createdBy,
6468
6457
  createdByUserType: creationAction.createdByUserType,
6469
6458
  createdAtLocation: creationAction.createdAtLocation,
6470
- createdBySignature: creationAction.createdBySignature,
6471
6459
  updatedAt: acceptedActionMetadata.createdAt,
6472
6460
  assignedTo: getAssignedUserFromActions(acceptedActions),
6473
- assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
6474
6461
  updatedBy: requestActionMetadata.createdBy,
6475
6462
  updatedAtLocation: requestActionMetadata.createdAtLocation,
6476
6463
  declaration,
@@ -9729,7 +9716,6 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
9729
9716
  createdBy: overrides.createdBy ?? generateUuid(rng),
9730
9717
  createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
9731
9718
  updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
9732
- createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
9733
9719
  updatedAt: overrides.updatedAt ?? (0, import_date_fns4.addDays)(new Date(createdAt), 1).toISOString(),
9734
9720
  assignedTo: overrides.assignedTo ?? null,
9735
9721
  updatedBy: overrides.updatedBy ?? generateUuid(rng),
@@ -2405,7 +2405,9 @@ var decodeScope = (query) => {
2405
2405
  };
2406
2406
  var DEFAULT_SCOPE_OPTIONS = {
2407
2407
  placeOfEvent: JurisdictionFilter.enum.all,
2408
- accessLevel: JurisdictionFilter.enum.all
2408
+ accessLevel: JurisdictionFilter.enum.all,
2409
+ registeredIn: JurisdictionFilter.enum.all,
2410
+ declaredIn: JurisdictionFilter.enum.all
2409
2411
  };
2410
2412
 
2411
2413
  // ../commons/src/scopes.deprecated.do-not-use.ts
@@ -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
@@ -1210,8 +1215,9 @@ var RequestedCorrectionAction = ActionBase.extend(
1210
1215
  var ApprovedCorrectionAction = ActionBase.extend(
1211
1216
  z14.object({
1212
1217
  type: z14.literal(ActionType.APPROVE_CORRECTION),
1213
- requestId: z14.string()
1218
+ requestId: z14.string(),
1214
1219
  // TODO move into 'content' property
1220
+ content: z14.object({ immediateCorrection: z14.boolean().optional() }).optional()
1215
1221
  }).shape
1216
1222
  );
1217
1223
  var RejectedCorrectionAction = ActionBase.extend(
@@ -1303,6 +1309,9 @@ var FlagConfig = z15.object({
1303
1309
  "Indicates if this flag expects an action to be performed to be cleared."
1304
1310
  ),
1305
1311
  label: TranslationConfig.describe("Human readable label of the flag.")
1312
+ }).meta({
1313
+ description: "Flag configuration",
1314
+ id: "FlagConfig"
1306
1315
  });
1307
1316
  var ActionFlagConfig = z15.object({
1308
1317
  id: Flag,
@@ -1310,6 +1319,9 @@ var ActionFlagConfig = z15.object({
1310
1319
  conditional: Conditional.optional().describe(
1311
1320
  "When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
1312
1321
  )
1322
+ }).meta({
1323
+ description: "Action flag configuration",
1324
+ id: "ActionFlagConfig"
1313
1325
  });
1314
1326
 
1315
1327
  // ../commons/src/events/EventMetadata.ts
@@ -1331,8 +1343,7 @@ var ActionCreationMetadata = z16.object({
1331
1343
  ),
1332
1344
  createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
1333
1345
  acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
1334
- createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation."),
1335
- 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.")
1336
1347
  });
1337
1348
  var RegistrationCreationMetadata = ActionCreationMetadata.extend({
1338
1349
  registrationNumber: z16.string().describe(
@@ -1360,9 +1371,6 @@ var EventMetadata = z16.object({
1360
1371
  createdAtLocation: UUID.nullish().describe(
1361
1372
  "Location of the user who created the event."
1362
1373
  ),
1363
- createdBySignature: DocumentPath.nullish().describe(
1364
- "Signature of the user who created the event."
1365
- ),
1366
1374
  updatedAtLocation: UUID.nullish().describe(
1367
1375
  "Location of the user who last changed the status."
1368
1376
  ),
@@ -1655,7 +1663,7 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
1655
1663
  }
1656
1664
  }).describe("Unique identifier for the field");
1657
1665
  var FieldReference = import_v43.default.object({
1658
- $$field: FieldId,
1666
+ $$field: FieldId.describe("Id of the field to reference"),
1659
1667
  $$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
1660
1668
  'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
1661
1669
  )
@@ -2368,10 +2376,10 @@ var VerificationPageConfig = FormPageConfig.extend({
2368
2376
  type: z21.literal(PageTypes.enum.VERIFICATION),
2369
2377
  actions: VerificationActionConfig
2370
2378
  });
2371
- var PageConfig = z21.discriminatedUnion("type", [
2372
- FormPageConfig,
2373
- VerificationPageConfig
2374
- ]);
2379
+ var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
2380
+ description: "Page configuration",
2381
+ id: "PageConfig"
2382
+ });
2375
2383
 
2376
2384
  // ../commons/src/events/FormConfig.ts
2377
2385
  var DeclarationFormConfig = z22.object({
@@ -3671,7 +3679,7 @@ var _EventConfigBase = z33.object({
3671
3679
  ),
3672
3680
  label: TranslationConfig.describe("Human-readable label for the event type."),
3673
3681
  actions: z33.array(ActionConfig).describe(
3674
- "Configuration of system-defined actions associated with the event."
3682
+ "Configuration of core and custom actions associated with the event."
3675
3683
  ),
3676
3684
  actionOrder: z33.array(z33.string()).optional().describe(
3677
3685
  "Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
@@ -3683,7 +3691,7 @@ var _EventConfigBase = z33.object({
3683
3691
  "Configuration of fields available in the advanced search feature."
3684
3692
  ),
3685
3693
  flags: z33.array(FlagConfig).optional().default([]).describe(
3686
- "Configuration of flags associated with the actions of this event type."
3694
+ "Configuration of custom flags associated with the actions of this event type."
3687
3695
  ),
3688
3696
  analytics: z33.boolean().optional().default(true).describe(
3689
3697
  "Indicates whether the records of this event type are included in analytics"
@@ -4121,18 +4129,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
4121
4129
  query: true,
4122
4130
  columns: true
4123
4131
  });
4124
- var WorkqueueConfigInput = z37.object({
4125
- slug: z37.string().describe("Determines the url of the workqueue."),
4126
- name: TranslationConfig.describe(
4127
- "Title of the workflow (both in navigation and on the page)"
4128
- ),
4129
- query: CountryConfigQueryInputType,
4130
- action: z37.object({ type: WorkqueueActionType }).optional().describe(
4131
- "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."
4132
- ),
4133
- columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
4134
- icon: AvailableIcons,
4135
- emptyMessage: TranslationConfig.optional()
4132
+ var WorkqueueConfigInput = WorkqueueConfig.extend({
4133
+ query: CountryConfigQueryInputType
4134
+ }).meta({
4135
+ description: "Workqueue configuration",
4136
+ id: "WorkqueueConfig"
4136
4137
  });
4137
4138
  var WorkqueueCountInput = z37.array(
4138
4139
  z37.object({ slug: z37.string(), query: QueryType })
@@ -4292,7 +4293,8 @@ var RejectCorrectionActionInput = BaseActionInput.extend(
4292
4293
  var ApproveCorrectionActionInput = BaseActionInput.extend(
4293
4294
  z38.object({
4294
4295
  requestId: z38.string(),
4295
- 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()
4296
4298
  }).shape
4297
4299
  );
4298
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.18f0568",
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": {