@opencrvs/toolkit 1.9.12-rc.a6c95e7 → 1.9.12-rc.a9b25f0

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 (90) hide show
  1. package/build.sh +4 -0
  2. package/dist/application-config/index.js +2045 -41
  3. package/dist/cli.js +3177 -4
  4. package/dist/commons/api/router.d.ts +106 -75
  5. package/dist/commons/application-config/index.d.ts +13 -16
  6. package/dist/commons/conditionals/conditionals.d.ts +3 -3
  7. package/dist/commons/events/ActionDocument.d.ts +198 -198
  8. package/dist/commons/events/ActionInput.d.ts +113 -113
  9. package/dist/commons/events/ActionType.d.ts +3 -3
  10. package/dist/commons/events/AdvancedSearchConfig.d.ts +16 -10
  11. package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
  12. package/dist/commons/events/CountryConfigQueryInput.d.ts +443 -172
  13. package/dist/commons/events/Draft.d.ts +15 -15
  14. package/dist/commons/events/DynamicFieldValue.d.ts +37 -19
  15. package/dist/commons/events/EventConfig.d.ts +1 -1
  16. package/dist/commons/events/EventDocument.d.ts +81 -81
  17. package/dist/commons/events/EventIndex.d.ts +35 -27
  18. package/dist/commons/events/EventInput.d.ts +1 -1
  19. package/dist/commons/events/EventMetadata.d.ts +24 -24
  20. package/dist/commons/events/FieldConfig.d.ts +155 -44
  21. package/dist/commons/events/FieldType.d.ts +2 -1
  22. package/dist/commons/events/FieldTypeMapping.d.ts +98 -72
  23. package/dist/commons/events/FieldValue.d.ts +54 -26
  24. package/dist/commons/events/PlainDate.d.ts +1 -1
  25. package/dist/commons/events/WorkqueueColumnConfig.d.ts +16 -16
  26. package/dist/commons/events/WorkqueueConfig.d.ts +438 -194
  27. package/dist/commons/events/defineConfig.d.ts +0 -4
  28. package/dist/commons/events/locations.d.ts +4 -4
  29. package/dist/commons/events/scopes.d.ts +1 -1
  30. package/dist/commons/events/state/index.d.ts +2 -2
  31. package/dist/commons/events/state/utils.d.ts +3 -3
  32. package/dist/commons/events/utils.d.ts +5 -177
  33. package/dist/conditionals/index.js +13 -5
  34. package/dist/events/index.js +143 -34
  35. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +3 -0
  36. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -0
  37. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +405 -0
  38. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +2 -0
  39. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -0
  40. package/dist/migrations/v2.0/convert-config-files-to-ts.js +829 -0
  41. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +3 -0
  42. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -0
  43. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +159 -0
  44. package/dist/migrations/v2.0/index.d.ts +7 -0
  45. package/dist/migrations/v2.0/index.d.ts.map +1 -0
  46. package/dist/migrations/v2.0/index.js +3176 -0
  47. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +3 -0
  48. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -0
  49. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +344 -0
  50. package/dist/migrations/v2.0/migrate-scopes.d.ts +3 -0
  51. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -0
  52. package/dist/migrations/v2.0/migrate-scopes.js +282 -0
  53. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +3 -0
  54. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -0
  55. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +268 -0
  56. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +3 -0
  57. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -0
  58. package/dist/migrations/v2.0/migrate-workqueue-configs.js +237 -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-demo-scope.d.ts +3 -0
  63. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -0
  64. package/dist/migrations/v2.0/remove-demo-scope.js +75 -0
  65. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +3 -0
  66. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -0
  67. package/dist/migrations/v2.0/remove-deprecated-imports.js +97 -0
  68. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +3 -0
  69. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -0
  70. package/dist/migrations/v2.0/remove-hearth-migrations.js +78 -0
  71. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +3 -0
  72. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -0
  73. package/dist/migrations/v2.0/remove-pending-certification-flag.js +110 -0
  74. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +3 -0
  75. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -0
  76. package/dist/migrations/v2.0/remove-review-from-register-action.js +164 -0
  77. package/dist/migrations/v2.0/rename-api-paths.d.ts +3 -0
  78. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -0
  79. package/dist/migrations/v2.0/rename-api-paths.js +188 -0
  80. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +3 -0
  81. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -0
  82. package/dist/migrations/v2.0/rename-location-parent-id.js +181 -0
  83. package/dist/notification/index.js +74 -24
  84. package/dist/scopes/index.d.ts +31 -10
  85. package/dist/scopes/index.js +17 -5
  86. package/opencrvs-toolkit-1.9.12-rc.a9b25f0.tgz +0 -0
  87. package/package.json +8 -7
  88. package/tsconfig.json +3 -0
  89. package/tsconfig.tsbuildinfo +1 -1
  90. package/opencrvs-toolkit-1.9.12-rc.a6c95e7.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>;
@@ -9,7 +9,7 @@ export declare const ACTION_SCOPE_MAP: {
9
9
  NOTIFY: "record.notify"[];
10
10
  DECLARE: ("record.declare" | "record.register")[];
11
11
  EDIT: "record.edit"[];
12
- DELETE: "record.declare"[];
12
+ DELETE: ("record.declare" | "record.notify")[];
13
13
  REGISTER: "record.register"[];
14
14
  PRINT_CERTIFICATE: "record.print-certified-copies"[];
15
15
  REQUEST_CORRECTION: ("record.request-correction" | "record.correct")[];
@@ -7,7 +7,7 @@ import { Draft } from '../Draft';
7
7
  import { EventConfig } from '../EventConfig';
8
8
  import { UUID } from '../../uuid';
9
9
  import { DocumentPath } from '../../documents';
10
- export declare function getStatusFromActions(actions: Array<Action>): "ARCHIVED" | "DECLARED" | "REGISTERED" | "CREATED" | "NOTIFIED";
10
+ export declare function getStatusFromActions(actions: Array<Action>): "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "ARCHIVED";
11
11
  export declare function getAssignedUserFromActions(actions: Array<ActionDocument>): string | null;
12
12
  export declare function getAssignedUserSignatureFromActions(actions: Array<ActionDocument>): string | null;
13
13
  type NonNullableDeep<T> = T extends [unknown, ...unknown[]] ? {
@@ -64,7 +64,7 @@ export declare function applyDeclarationToEventIndex(eventIndex: EventIndex, dec
64
64
  export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Draft, eventConfiguration: EventConfig): {
65
65
  id: string & import("zod").$brand<"UUID">;
66
66
  type: string;
67
- status: "ARCHIVED" | "DECLARED" | "REGISTERED" | "CREATED" | "NOTIFIED";
67
+ status: "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "ARCHIVED";
68
68
  legalStatuses: {
69
69
  DECLARED?: {
70
70
  createdAt: string;
@@ -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;
293
292
  transactionId: string;
294
293
  createdByUserType: "user" | "system";
294
+ createdAt: string;
295
295
  createdBy: string;
296
- type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
296
+ type: "CUSTOM" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
297
297
  status: "Rejected";
298
- createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
299
298
  createdByRole?: string | undefined;
300
299
  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
  /**
@@ -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">;
609
- createdAt: string;
610
437
  transactionId: string;
611
438
  createdByUserType: "user" | "system";
439
+ createdAt: string;
612
440
  createdBy: string;
613
- type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
441
+ type: "CUSTOM" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
614
442
  status: "Rejected";
615
- createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
616
443
  createdByRole?: string | undefined;
617
444
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
445
+ createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
618
446
  originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
619
447
  } | undefined;
620
448
  /**
@@ -205,16 +205,16 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
205
205
  var AccessLevelOptions = z6.object({
206
206
  accessLevel: JurisdictionFilter.optional()
207
207
  });
208
- var WorkqueueOptions = z6.object({
208
+ var WorkqueueOrDashboardOptions = z6.object({
209
209
  ids: z6.preprocess(
210
210
  (val) => val === void 0 ? void 0 : [val].flat(),
211
211
  z6.array(z6.string())
212
- ).describe("Must contain a list of workqueue ids.")
212
+ ).describe("Must contain a list of workqueue or dashboard ids.")
213
213
  });
214
214
  var AllScopeOptions = z6.object({
215
215
  ...AllRecordScopeOptions.shape,
216
216
  ...AccessLevelOptions.shape,
217
- ...WorkqueueOptions.shape
217
+ ...WorkqueueOrDashboardOptions.shape
218
218
  });
219
219
  var ScopeOptionKey = AllScopeOptions.keyof();
220
220
  var ResolvedScopeOptionsPlaceEvent = z6.object({
@@ -316,13 +316,21 @@ var Scope2 = z6.discriminatedUnion("type", [
316
316
  z6.object({ type: PlainScopeType }),
317
317
  ...RecordScopeV2.options,
318
318
  z6.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
319
- z6.object({ type: z6.literal("workqueue"), options: WorkqueueOptions })
319
+ z6.object({
320
+ type: z6.literal("workqueue"),
321
+ options: WorkqueueOrDashboardOptions
322
+ }),
323
+ z6.object({
324
+ type: z6.literal("dashboard.view"),
325
+ options: WorkqueueOrDashboardOptions
326
+ })
320
327
  ]);
321
328
  var ScopeType2 = z6.enum([
322
329
  ...SystemScopeType.options,
323
330
  ...RecordScopeTypeV2.options,
324
331
  ...PlainScopeType.options,
325
- "workqueue"
332
+ "workqueue",
333
+ "dashboard.view"
326
334
  ]);
327
335
  var EncodedScope2 = z6.string().brand("EncodedScope");
328
336
  var DEFAULT_SCOPE_OPTIONS = {