@opencrvs/toolkit 1.9.12-rc.f5ca5e6 → 1.9.12-rc.f82cfcf

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 (83) hide show
  1. package/build.sh +8 -0
  2. package/dist/application-config/index.js +47 -36
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +2422 -0
  6. package/dist/commons/api/router.d.ts +320 -108
  7. package/dist/commons/application-config/index.d.ts +7 -12
  8. package/dist/commons/conditionals/conditionals.d.ts +8 -8
  9. package/dist/commons/events/ActionDocument.d.ts +196 -196
  10. package/dist/commons/events/ActionInput.d.ts +113 -113
  11. package/dist/commons/events/AdvancedSearchConfig.d.ts +16 -10
  12. package/dist/commons/events/AuditLog.d.ts +345 -163
  13. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  14. package/dist/commons/events/CountryConfigQueryInput.d.ts +331 -60
  15. package/dist/commons/events/Draft.d.ts +13 -13
  16. package/dist/commons/events/DynamicFieldValue.d.ts +37 -19
  17. package/dist/commons/events/EventConfig.d.ts +1 -1
  18. package/dist/commons/events/EventDocument.d.ts +80 -80
  19. package/dist/commons/events/EventIndex.d.ts +20 -12
  20. package/dist/commons/events/EventInput.d.ts +1 -1
  21. package/dist/commons/events/EventMetadata.d.ts +18 -18
  22. package/dist/commons/events/FieldConfig.d.ts +267 -47
  23. package/dist/commons/events/FieldType.d.ts +2 -1
  24. package/dist/commons/events/FieldTypeMapping.d.ts +96 -70
  25. package/dist/commons/events/FieldValue.d.ts +54 -26
  26. package/dist/commons/events/PlainDate.d.ts +1 -1
  27. package/dist/commons/events/WorkqueueColumnConfig.d.ts +16 -16
  28. package/dist/commons/events/WorkqueueConfig.d.ts +340 -96
  29. package/dist/commons/events/defineConfig.d.ts +0 -4
  30. package/dist/commons/events/locations.d.ts +4 -4
  31. package/dist/commons/events/scopes.d.ts +3 -2
  32. package/dist/commons/events/state/utils.d.ts +2 -2
  33. package/dist/commons/events/test.utils.d.ts +2 -2
  34. package/dist/commons/events/utils.d.ts +4 -176
  35. package/dist/commons/notification/UserNotifications.d.ts +6 -1
  36. package/dist/conditionals/index.js +74 -359
  37. package/dist/events/index.js +1197 -1260
  38. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +3 -0
  39. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -0
  40. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +405 -0
  41. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +2 -0
  42. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -0
  43. package/dist/migrations/v2.0/convert-config-files-to-ts.js +753 -0
  44. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +3 -0
  45. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -0
  46. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +159 -0
  47. package/dist/migrations/v2.0/index.d.ts +7 -0
  48. package/dist/migrations/v2.0/index.d.ts.map +1 -0
  49. package/dist/migrations/v2.0/index.js +2361 -0
  50. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +3 -0
  51. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -0
  52. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +344 -0
  53. package/dist/migrations/v2.0/migrate-scopes.d.ts +3 -0
  54. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -0
  55. package/dist/migrations/v2.0/migrate-scopes.js +281 -0
  56. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +3 -0
  57. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -0
  58. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +268 -0
  59. package/dist/migrations/v2.0/remove-delete-actions.d.ts +3 -0
  60. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -0
  61. package/dist/migrations/v2.0/remove-delete-actions.js +157 -0
  62. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +3 -0
  63. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -0
  64. package/dist/migrations/v2.0/remove-deprecated-imports.js +97 -0
  65. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +3 -0
  66. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -0
  67. package/dist/migrations/v2.0/remove-pending-certification-flag.js +110 -0
  68. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +3 -0
  69. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -0
  70. package/dist/migrations/v2.0/remove-review-from-register-action.js +164 -0
  71. package/dist/migrations/v2.0/rename-api-paths.d.ts +3 -0
  72. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -0
  73. package/dist/migrations/v2.0/rename-api-paths.js +188 -0
  74. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +3 -0
  75. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -0
  76. package/dist/migrations/v2.0/rename-location-parent-id.js +181 -0
  77. package/dist/notification/index.js +1001 -1128
  78. package/dist/scopes/index.d.ts +389 -152
  79. package/dist/scopes/index.js +128 -322
  80. package/opencrvs-toolkit-1.9.12-rc.f82cfcf.tgz +0 -0
  81. package/package.json +11 -7
  82. package/tsconfig.tsbuildinfo +1 -1
  83. package/opencrvs-toolkit-1.9.12-rc.f5ca5e6.tgz +0 -0
@@ -1,7 +1,3 @@
1
1
  import { EventConfig, EventConfigInput } from './EventConfig';
2
- /**
3
- * Builds a validated configuration for an event
4
- * @param config - Event specific configuration
5
- */
6
2
  export declare const defineConfig: (config: EventConfigInput) => EventConfig;
7
3
  //# sourceMappingURL=defineConfig.d.ts.map
@@ -11,18 +11,18 @@ export declare const LocationTypeV1: z.ZodEnum<{
11
11
  }>;
12
12
  export type LocationTypeV1 = z.infer<typeof LocationTypeV1>;
13
13
  export declare const AdministrativeArea: z.ZodObject<{
14
- id: z.core.$ZodBranded<z.ZodUUID, "UUID">;
14
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
15
15
  name: z.ZodString;
16
16
  externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
- parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>;
17
+ parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
18
18
  validUntil: z.ZodNullable<z.ZodISODateTime>;
19
19
  }, z.core.$strip>;
20
20
  export type AdministrativeArea = z.infer<typeof AdministrativeArea>;
21
21
  export declare const Location: z.ZodObject<{
22
- id: z.core.$ZodBranded<z.ZodUUID, "UUID">;
22
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
23
23
  name: z.ZodString;
24
24
  externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
- administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>;
25
+ administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
26
26
  validUntil: z.ZodNullable<z.ZodISODateTime>;
27
27
  locationType: z.ZodNullable<z.ZodString>;
28
28
  }, z.core.$strip>;
@@ -1,4 +1,5 @@
1
1
  import { DisplayableAction } from './ActionType';
2
+ import { EncodedScope } from '../scopes';
2
3
  import { EventIndexWithAdministrativeHierarchy } from './locations';
3
4
  import { UserContext } from '../users/User';
4
5
  import { EventIndex } from './EventIndex';
@@ -40,14 +41,14 @@ export declare function getAssignmentStatus(eventState: EventIndex | EventIndexW
40
41
  * (hardcoded, non-configurable) and V2 scopes, which validate event type, jurisdiction,
41
42
  * and user context via {@link userCanAccessEventWithScopes}.
42
43
  *
43
- * @param {string[]} scopes - The raw encoded scope strings the user possesses (from JWT).
44
+ * @param {EncodedScope[]} scopes - The raw encoded scope strings the user possesses (from JWT).
44
45
  * @param {DisplayableAction} action - The action to check authorization for.
45
46
  * @param {EventIndexWithAdministrativeHierarchy} event - The event with resolved administrative hierarchy.
46
47
  * @param {UserContext} currentUser - The current user's context used for V2 scope validation.
47
48
  * @returns {boolean} True if the action is in scope for the user, otherwise false.
48
49
  */
49
50
  export declare function isActionInScope({ scopes, action, event, currentUser }: {
50
- scopes: string[];
51
+ scopes: EncodedScope[];
51
52
  action: DisplayableAction;
52
53
  event: EventIndexWithAdministrativeHierarchy;
53
54
  currentUser: UserContext;
@@ -289,15 +289,15 @@ export declare function getActionUpdateMetadata(actions: Action[]): Partial<{
289
289
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
290
290
  } | {
291
291
  id: string & import("zod").$brand<"UUID">;
292
+ createdAt: string;
292
293
  transactionId: string;
293
294
  createdByUserType: "user" | "system";
294
- createdAt: string;
295
295
  createdBy: string;
296
296
  type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
297
297
  status: "Rejected";
298
+ createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
298
299
  createdByRole?: string | undefined;
299
300
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
300
- createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
301
301
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
302
302
  }>;
303
303
  /**
@@ -24,11 +24,11 @@ export declare const TEST_SYSTEM_IANA_TIMEZONE = "Asia/Dhaka";
24
24
  */
25
25
  export declare const TestUserRole: z.ZodEnum<{
26
26
  FIELD_AGENT: "FIELD_AGENT";
27
- REGISTRATION_AGENT: "REGISTRATION_AGENT";
28
27
  LOCAL_REGISTRAR: "LOCAL_REGISTRAR";
29
28
  LOCAL_SYSTEM_ADMIN: "LOCAL_SYSTEM_ADMIN";
30
- NATIONAL_SYSTEM_ADMIN: "NATIONAL_SYSTEM_ADMIN";
31
29
  NATIONAL_REGISTRAR: "NATIONAL_REGISTRAR";
30
+ REGISTRATION_AGENT: "REGISTRATION_AGENT";
31
+ NATIONAL_SYSTEM_ADMIN: "NATIONAL_SYSTEM_ADMIN";
32
32
  SOCIAL_WORKER: "SOCIAL_WORKER";
33
33
  COMMUNITY_LEADER: "COMMUNITY_LEADER";
34
34
  PROVINCIAL_REGISTRAR: "PROVINCIAL_REGISTRAR";
@@ -131,7 +131,7 @@ export declare function isPageVisible(page: PageConfig, formValues: ActionUpdate
131
131
  * * @param validatorContext - custom validation context
132
132
  * @returns {Partial<T>} A new object containing only the values for visible fields
133
133
  */
134
- export declare function omitHiddenFields<T extends EventState | ActionUpdate>(fields: FieldConfig[], formValues: T, validatorContext: ValidatorContext, includeHiddenFieldsWithNullValues?: boolean): Partial<T>;
134
+ export declare function omitHiddenFields<T extends EventState | ActionUpdate>(fields: FieldConfig[], formValues: T, validatorContext: ValidatorContext, includeHiddenFieldsWithNullValues?: boolean, declarationContext?: EventState): Partial<T>;
135
135
  export declare function omitHiddenPaginatedFields<T extends EventState | ActionUpdate>(formConfig: FormConfig, values: T, validatorContext: ValidatorContext, includeHiddenFieldsWithNullValues?: boolean): Partial<Partial<T>>;
136
136
  /**
137
137
  *
@@ -141,179 +141,7 @@ export declare function findActiveDraftForEvent(event: EventDocument, draft: Dra
141
141
  export declare function createEmptyDraft(eventId: UUID, draftId: UUID, actionType: Exclude<ActionType, 'DELETE'>): Draft;
142
142
  export declare function isVerificationPage(page: PageConfig): page is VerificationPageConfig;
143
143
  export declare function getVisibleVerificationPageIds(pages: PageConfig[], annotation: ActionUpdate, context: ValidatorContext): string[];
144
- export declare function omitHiddenAnnotationFields(actionConfig: ActionConfig, declaration: EventState, annotation: ActionUpdate, context: ValidatorContext): Partial<{
145
- [x: string]: string | number | boolean | {
146
- path: string & import("zod").$brand<"DocumentPath">;
147
- originalFilename: string;
148
- type: string;
149
- } | {
150
- firstname: string;
151
- surname: string;
152
- middlename?: string | undefined;
153
- } | {
154
- firstname?: string | null | undefined;
155
- surname?: string | null | undefined;
156
- middlename?: string | null | undefined;
157
- } | {
158
- country: string;
159
- addressType: "DOMESTIC";
160
- administrativeArea: string;
161
- streetLevelDetails?: Record<string, string> | undefined;
162
- } | {
163
- country: string;
164
- addressType: "INTERNATIONAL";
165
- streetLevelDetails?: Record<string, string> | undefined;
166
- } | {
167
- addressType: "DOMESTIC";
168
- country?: string | null | undefined;
169
- streetLevelDetails?: Record<string, string | null> | null | undefined;
170
- administrativeArea?: string | null | undefined;
171
- } | {
172
- addressType: "INTERNATIONAL";
173
- country?: string | null | undefined;
174
- streetLevelDetails?: Record<string, string | null> | null | undefined;
175
- } | {
176
- path: string & import("zod").$brand<"DocumentPath">;
177
- originalFilename: string;
178
- type: string;
179
- option: string;
180
- }[] | {
181
- loading: boolean;
182
- data: any;
183
- error?: {
184
- statusCode: number;
185
- message: string;
186
- } | null | undefined;
187
- } | {
188
- data: Record<string, string>;
189
- updatedAt: string;
190
- } | {
191
- data: any;
192
- } | {
193
- numericValue: number;
194
- unit: string;
195
- } | {
196
- numericValue?: number | undefined;
197
- unit?: string | undefined;
198
- } | import("zod").$brand<"CustomFieldValue"> | (string & import("zod").$brand<"PlainDate">) | {
199
- age: number;
200
- asOfDateRef: string;
201
- } | {
202
- start: string & import("zod").$brand<"PlainDate">;
203
- end: string & import("zod").$brand<"PlainDate">;
204
- } | Record<string, string | number | boolean | {
205
- path: string & import("zod").$brand<"DocumentPath">;
206
- originalFilename: string;
207
- type: string;
208
- } | {
209
- firstname: string;
210
- surname: string;
211
- middlename?: string | undefined;
212
- } | {
213
- firstname?: string | null | undefined;
214
- surname?: string | null | undefined;
215
- middlename?: string | null | undefined;
216
- } | {
217
- country: string;
218
- addressType: "DOMESTIC";
219
- administrativeArea: string;
220
- streetLevelDetails?: Record<string, string> | undefined;
221
- } | {
222
- country: string;
223
- addressType: "INTERNATIONAL";
224
- streetLevelDetails?: Record<string, string> | undefined;
225
- } | {
226
- path: string & import("zod").$brand<"DocumentPath">;
227
- originalFilename: string;
228
- type: string;
229
- option: string;
230
- }[] | {
231
- loading: boolean;
232
- data: any;
233
- error?: {
234
- statusCode: number;
235
- message: string;
236
- } | null | undefined;
237
- } | {
238
- data: Record<string, string>;
239
- updatedAt: string;
240
- } | {
241
- data: any;
242
- } | {
243
- numericValue: number;
244
- unit: string;
245
- } | {
246
- numericValue?: number | undefined;
247
- unit?: string | undefined;
248
- } | import("zod").$brand<"CustomFieldValue"> | (string & import("zod").$brand<"PlainDate">) | {
249
- age: number;
250
- asOfDateRef: string;
251
- } | {
252
- start: string & import("zod").$brand<"PlainDate">;
253
- end: string & import("zod").$brand<"PlainDate">;
254
- } | null | undefined> | {
255
- data: Record<string, string | number | boolean | {
256
- path: string & import("zod").$brand<"DocumentPath">;
257
- originalFilename: string;
258
- type: string;
259
- } | {
260
- firstname: string;
261
- surname: string;
262
- middlename?: string | undefined;
263
- } | {
264
- firstname?: string | null | undefined;
265
- surname?: string | null | undefined;
266
- middlename?: string | null | undefined;
267
- } | {
268
- country: string;
269
- addressType: "DOMESTIC";
270
- administrativeArea: string;
271
- streetLevelDetails?: Record<string, string> | undefined;
272
- } | {
273
- country: string;
274
- addressType: "INTERNATIONAL";
275
- streetLevelDetails?: Record<string, string> | undefined;
276
- } | {
277
- path: string & import("zod").$brand<"DocumentPath">;
278
- originalFilename: string;
279
- type: string;
280
- option: string;
281
- }[] | {
282
- loading: boolean;
283
- data: any;
284
- error?: {
285
- statusCode: number;
286
- message: string;
287
- } | null | undefined;
288
- } | {
289
- data: Record<string, string>;
290
- updatedAt: string;
291
- } | {
292
- data: any;
293
- } | {
294
- numericValue: number;
295
- unit: string;
296
- } | {
297
- numericValue?: number | undefined;
298
- unit?: string | undefined;
299
- } | import("zod").$brand<"CustomFieldValue"> | (string & import("zod").$brand<"PlainDate">) | {
300
- age: number;
301
- asOfDateRef: string;
302
- } | {
303
- start: string & import("zod").$brand<"PlainDate">;
304
- end: string & import("zod").$brand<"PlainDate">;
305
- } | null | undefined>;
306
- } | {
307
- loading?: boolean | null | undefined;
308
- error?: {
309
- statusCode: number;
310
- message: string;
311
- } | null | undefined;
312
- data?: any;
313
- } | {
314
- data: Record<string, string>;
315
- } | null | undefined;
316
- }>;
144
+ export declare function omitHiddenAnnotationFields(actionConfig: ActionConfig, declaration: EventState, annotation: ActionUpdate, context: ValidatorContext): Partial<Record<string, import("./FieldValue").FieldUpdateValue>>;
317
145
  /**
318
146
  * Merges two documents together.
319
147
  *
@@ -606,15 +434,15 @@ export declare function findLastAssignmentAction(actions: Action[]): {
606
434
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
607
435
  } | {
608
436
  id: string & import("zod").$brand<"UUID">;
437
+ createdAt: string;
609
438
  transactionId: string;
610
439
  createdByUserType: "user" | "system";
611
- createdAt: string;
612
440
  createdBy: string;
613
441
  type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
614
442
  status: "Rejected";
443
+ createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
615
444
  createdByRole?: string | undefined;
616
445
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
617
- createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
618
446
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
619
447
  } | undefined;
620
448
  /**
@@ -169,7 +169,12 @@ export declare const TriggerPayload: {
169
169
  export type TriggerPayload = {
170
170
  [K in TriggerEvent]: z.infer<(typeof TriggerPayload)[K]>;
171
171
  };
172
- export declare function triggerUserEventNotification<T extends TriggerEvent>({ event, payload, countryConfigUrl, authHeader }: {
172
+ export declare function triggerUserEventNotification(args: {
173
+ event: typeof TriggerEvent.ALL_USER_NOTIFICATION;
174
+ payload: TriggerPayload[typeof TriggerEvent.ALL_USER_NOTIFICATION];
175
+ countryConfigUrl: string;
176
+ }): Promise<Response>;
177
+ export declare function triggerUserEventNotification<T extends Exclude<TriggerEvent, typeof TriggerEvent.ALL_USER_NOTIFICATION>>(args: {
173
178
  event: T;
174
179
  payload: TriggerPayload[T];
175
180
  countryConfigUrl: string;