@opencrvs/toolkit 2.2.0-rc.3af310b → 2.2.0-rc.5bf5dfc

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 (82) hide show
  1. package/build.sh +7 -2
  2. package/dist/application-config/index.js +9 -9
  3. package/dist/authentication/index.d.ts +2 -1
  4. package/dist/authentication/index.js +20 -12
  5. package/dist/cli.js +633 -333
  6. package/dist/commons/api/router.d.ts +249 -249
  7. package/dist/commons/application-config/index.d.ts +2 -2
  8. package/dist/commons/conditionals/conditionals.d.ts +4 -4
  9. package/dist/commons/conditionals/index.d.ts +1 -0
  10. package/dist/commons/conditionals/validate.d.ts +6 -1
  11. package/dist/commons/events/ActionConfig.d.ts +2 -2
  12. package/dist/commons/events/ActionDocument.d.ts +1 -0
  13. package/dist/commons/events/ActionInput.d.ts +4 -4
  14. package/dist/commons/events/ActionStatus.d.ts +2 -2
  15. package/dist/commons/events/ActionType.d.ts +2 -0
  16. package/dist/commons/events/AdvancedSearchConfig.d.ts +3 -0
  17. package/dist/commons/events/CompositeFieldValue.d.ts +5 -1
  18. package/dist/commons/events/Draft.d.ts +34 -1
  19. package/dist/commons/events/EventConfig.d.ts +1 -10
  20. package/dist/commons/events/EventIndex.d.ts +2 -2
  21. package/dist/commons/events/FieldConfig.d.ts +1 -1
  22. package/dist/commons/events/FieldTypeMapping.d.ts +17 -17
  23. package/dist/commons/events/Flag.d.ts +1 -1
  24. package/dist/commons/events/PlainDate.d.ts +1 -0
  25. package/dist/commons/events/eventConfigValidation.d.ts +1 -1
  26. package/dist/commons/events/field.d.ts +5 -0
  27. package/dist/commons/events/index.d.ts +3 -0
  28. package/dist/commons/events/locations.d.ts +1 -1
  29. package/dist/commons/events/scopes.d.ts +2 -1
  30. package/dist/commons/events/test.utils.d.ts +5 -6
  31. package/dist/commons/events/toNotificationForm.d.ts +17 -0
  32. package/dist/commons/events/utils.d.ts +26 -5
  33. package/dist/commons/users/Role.d.ts +23 -0
  34. package/dist/commons/users/User.d.ts +263 -0
  35. package/dist/commons/users/authentication.d.ts +67 -0
  36. package/dist/commons/users/index.d.ts +5 -0
  37. package/dist/commons/users/roleValidations.d.ts +15 -0
  38. package/dist/commons/users/scopes.d.ts +1402 -0
  39. package/dist/commons/users/userReferences.d.ts +176 -0
  40. package/dist/conditionals/index.js +5 -5
  41. package/dist/environment/custom-types.d.ts +1 -0
  42. package/dist/environment/custom-types.d.ts.map +1 -1
  43. package/dist/environment/derived-variables.d.ts +6 -4
  44. package/dist/environment/derived-variables.d.ts.map +1 -1
  45. package/dist/environment/derived-variables.js +6 -4
  46. package/dist/environment/questions.d.ts +42 -9
  47. package/dist/environment/questions.d.ts.map +1 -1
  48. package/dist/environment/questions.js +70 -47
  49. package/dist/environment/registry.d.ts +15 -0
  50. package/dist/environment/registry.d.ts.map +1 -0
  51. package/dist/environment/registry.js +112 -0
  52. package/dist/environment/setup-environment.d.ts.map +1 -1
  53. package/dist/environment/setup-environment.js +85 -29
  54. package/dist/events/index.js +214 -152
  55. package/dist/migrations/add-notify-config.d.ts +40 -0
  56. package/dist/migrations/add-notify-config.d.ts.map +1 -0
  57. package/dist/migrations/add-notify-config.js +249 -0
  58. package/dist/migrations/index.d.ts.map +1 -1
  59. package/dist/migrations/index.js +345 -143
  60. package/dist/migrations/move-declaration-to-declare-action.d.ts.map +1 -1
  61. package/dist/migrations/move-declaration-to-declare-action.js +27 -144
  62. package/dist/migrations/read-declaration-through-helper.d.ts.map +1 -1
  63. package/dist/migrations/read-declaration-through-helper.js +3 -61
  64. package/dist/migrations/utils.d.ts +61 -0
  65. package/dist/migrations/utils.d.ts.map +1 -0
  66. package/dist/migrations/utils.js +218 -0
  67. package/dist/notification/index.js +282 -90
  68. package/dist/roles/index.d.ts +2 -0
  69. package/dist/roles/index.d.ts.map +1 -0
  70. package/dist/roles/index.js +719 -0
  71. package/dist/scopes/index.d.ts +54 -61
  72. package/dist/scopes/index.js +15 -11
  73. package/dist/templates/charts-values/opencrvs-services/values.yaml +3 -4
  74. package/opencrvs-toolkit-2.2.0-rc.5bf5dfc.tgz +0 -0
  75. package/package.json +5 -3
  76. package/tsconfig.build.tsbuildinfo +1 -1
  77. package/tsconfig.json +3 -5
  78. package/dist/commons/events/notificationFormFallback.d.ts +0 -10
  79. package/dist/environment/dockerhub.d.ts +0 -15
  80. package/dist/environment/dockerhub.d.ts.map +0 -1
  81. package/dist/environment/dockerhub.js +0 -104
  82. package/opencrvs-toolkit-2.2.0-rc.3af310b.tgz +0 -0
@@ -23,7 +23,7 @@ export declare const ApplicationConfig: z.ZodObject<{
23
23
  id: z.ZodString;
24
24
  label: z.ZodObject<import("./events/TranslationConfig").MessageDescriptorZod, z.core.$strip>;
25
25
  }, z.core.$strip>>;
26
- PHONE_NUMBER_PATTERN: z.ZodUnion<[z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
26
+ PHONE_NUMBER_PATTERN: z.ZodUnion<[z.ZodString, z.ZodInstanceOf<RegExp>]>;
27
27
  USER_NOTIFICATION_DELIVERY_METHOD: z.ZodEnum<{
28
28
  email: "email";
29
29
  sms: "sms";
@@ -60,7 +60,7 @@ export declare const LoginConfig: z.ZodObject<{
60
60
  email: "email";
61
61
  sms: "sms";
62
62
  }>;
63
- PHONE_NUMBER_PATTERN: z.ZodUnion<[z.ZodString, z.ZodCustom<RegExp, RegExp>]>;
63
+ PHONE_NUMBER_PATTERN: z.ZodUnion<[z.ZodString, z.ZodInstanceOf<RegExp>]>;
64
64
  LOGIN_BACKGROUND: z.ZodObject<{
65
65
  backgroundColor: z.ZodOptional<z.ZodString>;
66
66
  backgroundImage: z.ZodOptional<z.ZodString>;
@@ -1,6 +1,6 @@
1
1
  import { EventDocument } from '../events/EventDocument';
2
2
  import { ActionUpdate, EventState } from '../events/ActionDocument';
3
- import { ITokenPayload as TokenPayload } from '../authentication';
3
+ import { ITokenPayload as TokenPayload } from '../users/authentication';
4
4
  import { PartialSchema as AjvJSONSchemaType } from 'ajv/dist/types/json-schema';
5
5
  import { userSerializer } from '../events/serializers/user/serializer';
6
6
  import { UUID } from '../uuid';
@@ -83,13 +83,13 @@ export declare const now: typeof todayDateTimeValueSerializer;
83
83
  * Generate conditional rules for user.
84
84
  */
85
85
  export declare const user: typeof userSerializer & {
86
- scope: (scope: import("../scopes").ScopeType) => {
87
- attribute: (option: import("../scopes").ScopeOptionKey) => {
86
+ scope: (scope: import("../users/scopes").ScopeType) => {
87
+ attribute: (option: import("../users/scopes").ScopeOptionKey) => {
88
88
  $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.audit.read" | "integration.create" | "location.edit" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.action.accept" | "record.action.reject" | "record.archive" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reinstate-registration" | "record.reject" | "record.request-correction" | "record.review-duplicates" | "record.revoke-registration" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
89
89
  $option: "accessLevel" | "createdBy" | "createdIn" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role" | "status";
90
90
  };
91
91
  };
92
- jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
92
+ jurisdiction: (jurisdiction: import("../users/scopes").JurisdictionFilter | {
93
93
  $scope: "attachment.upload" | "bypassratelimit" | "config.update-all" | "dashboard.view" | "integration.audit.read" | "integration.create" | "location.edit" | "organisation.read-locations" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.action.accept" | "record.action.reject" | "record.archive" | "record.correct" | "record.create" | "record.custom-action" | "record.declare" | "record.edit" | "record.import" | "record.notify" | "record.print-certified-copies" | "record.read" | "record.register" | "record.reindex" | "record.reinstate-registration" | "record.reject" | "record.request-correction" | "record.review-duplicates" | "record.revoke-registration" | "record.search" | "record.unarchive" | "record.unassign-others" | "user.create" | "user.data-seeding" | "user.edit" | "user.read" | "user.read-only-my-audit" | "user.search" | "workqueue";
94
94
  $option: "accessLevel" | "createdBy" | "createdIn" | "declaredBy" | "declaredIn" | "event" | "flags" | "ids" | "notifiedBy" | "notifiedIn" | "placeOfEvent" | "registeredBy" | "registeredIn" | "role" | "status";
95
95
  }) => {
@@ -1,2 +1,3 @@
1
+ import 'zod/compile';
1
2
  export * from './conditionals';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -4,7 +4,7 @@ import { FieldConditional } from '../events/Conditional';
4
4
  import { FieldConfig } from '../events/FieldConfig';
5
5
  import { PlainDate, FieldUpdateValue, FieldValue } from '../events/FieldValue';
6
6
  import { TranslationConfig } from '../events/TranslationConfig';
7
- import { EncodedScope, TokenUserType } from '../authentication';
7
+ import { EncodedScope, TokenUserType } from '../users/authentication';
8
8
  import { UUID } from '../uuid';
9
9
  import { FormState } from '../events/utils';
10
10
  import { ActionConfig } from '../events/ActionConfig';
@@ -141,6 +141,11 @@ export declare const errorMessages: {
141
141
  description: string;
142
142
  id: string;
143
143
  };
144
+ notInNotifyForm: {
145
+ defaultMessage: string;
146
+ description: string;
147
+ id: string;
148
+ };
144
149
  correctionNotAllowed: {
145
150
  defaultMessage: string;
146
151
  description: string;
@@ -199,7 +199,7 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
199
199
  conditional: z.ZodAny;
200
200
  }, z.core.$strip>], "type">>>;
201
201
  type: z.ZodLiteral<"NOTIFY">;
202
- notificationForm: z.ZodOptional<z.ZodObject<{
202
+ notificationForm: z.ZodObject<{
203
203
  label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
204
204
  pages: z.ZodArray<z.ZodObject<{
205
205
  id: z.ZodString;
@@ -210,7 +210,7 @@ export declare const ActionConfig: z.ZodDiscriminatedUnion<[z.ZodObject<{
210
210
  conditional: z.ZodOptional<z.ZodAny>;
211
211
  type: z.ZodDefault<z.ZodLiteral<"FORM">>;
212
212
  }, z.core.$strip>>;
213
- }, z.core.$strip>>;
213
+ }, z.core.$strip>;
214
214
  review: z.ZodObject<{
215
215
  title: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
216
216
  fields: z.ZodArray<z.ZodType<FieldConfig, import("./FieldConfig").FieldConfigInput, z.core.$ZodTypeInternals<FieldConfig, import("./FieldConfig").FieldConfigInput>>>;
@@ -743,6 +743,7 @@ export declare const ActionDocument: z.ZodDiscriminatedUnion<[z.ZodObject<{
743
743
  customActionType: z.ZodString;
744
744
  }, z.core.$strip>], "type">;
745
745
  export type ActionDocument = z.infer<typeof ActionDocument>;
746
+ export declare const isActionDocument: (a: unknown) => a is ActionDocument;
746
747
  export declare const AsyncRejectActionDocument: z.ZodObject<{
747
748
  id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
748
749
  transactionId: z.ZodString;
@@ -29,14 +29,14 @@ export type RegisterActionInput = z.infer<typeof RegisterActionInput>;
29
29
  export declare const NotifyActionInput: z.ZodObject<{
30
30
  eventId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
31
31
  transactionId: z.ZodString;
32
- declaration: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
33
- annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
34
32
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
35
33
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
36
34
  keepAssignmentIfAccepted: z.ZodOptional<z.ZodBoolean>;
37
35
  keepAssignmentIfRejected: z.ZodOptional<z.ZodBoolean>;
38
36
  waitFor: z.ZodDefault<z.ZodBoolean>;
39
37
  type: z.ZodDefault<z.ZodLiteral<"NOTIFY">>;
38
+ declaration: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
39
+ annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
40
40
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
41
41
  }, z.core.$strip>;
42
42
  export type NotifyActionInput = z.infer<typeof NotifyActionInput>;
@@ -359,14 +359,14 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
359
359
  }, z.core.$strip>, z.ZodObject<{
360
360
  eventId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
361
361
  transactionId: z.ZodString;
362
- declaration: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
363
- annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
364
362
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
365
363
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
366
364
  keepAssignmentIfAccepted: z.ZodOptional<z.ZodBoolean>;
367
365
  keepAssignmentIfRejected: z.ZodOptional<z.ZodBoolean>;
368
366
  waitFor: z.ZodDefault<z.ZodBoolean>;
369
367
  type: z.ZodDefault<z.ZodLiteral<"NOTIFY">>;
368
+ declaration: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
369
+ annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
370
370
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
371
371
  }, z.core.$strip>, z.ZodObject<{
372
372
  eventId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Deliberately dependency-free (aside from language builtins) so that files
3
3
  * like Flag.ts can depend on ActionStatus without being pulled into the
4
- * commons/scopes.ts <-> commons/authentication.ts import cycle that
4
+ * commons/users/scopes.ts <-> commons/users/authentication.ts import cycle that
5
5
  * ActionDocument.ts participates in (it imports TokenUserType from
6
- * '../authentication').
6
+ * '../users/authentication').
7
7
  */
8
8
  export declare const ActionStatus: {
9
9
  readonly Requested: 'Requested';
@@ -59,6 +59,8 @@ export type ActionTypes = z.infer<typeof ActionTypes>;
59
59
  */
60
60
  export declare const ClientSpecificAction: {
61
61
  readonly REVIEW_CORRECTION_REQUEST: 'REVIEW_CORRECTION_REQUEST';
62
+ /** Opens the user's declare or notify draft of the event in its own flow */
63
+ readonly CONTINUE_DRAFT: 'CONTINUE_DRAFT';
62
64
  };
63
65
  export type ClientSpecificAction = (typeof ClientSpecificAction)[keyof typeof ClientSpecificAction];
64
66
  /** Actions which change event data (declaration) before registration / during declaration. */
@@ -161,6 +161,7 @@ export declare const FieldConfigSchema: z.ZodObject<{
161
161
  }, z.core.$strip>>;
162
162
  fieldId: z.ZodString;
163
163
  fieldType: z.ZodLiteral<"field">;
164
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
164
165
  }, z.core.$strip>;
165
166
  /**
166
167
  * The event fields that are available for advanced search, date of event, summary. These are the values
@@ -513,6 +514,7 @@ export declare const AdvancedSearchField: z.ZodDiscriminatedUnion<[z.ZodObject<{
513
514
  }, z.core.$strip>>;
514
515
  fieldId: z.ZodString;
515
516
  fieldType: z.ZodLiteral<"field">;
517
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
516
518
  }, z.core.$strip>, z.ZodObject<{
517
519
  config: z.ZodObject<{
518
520
  type: z.ZodEnum<{
@@ -836,6 +838,7 @@ export declare const AdvancedSearchConfig: z.ZodObject<{
836
838
  }, z.core.$strip>>;
837
839
  fieldId: z.ZodString;
838
840
  fieldType: z.ZodLiteral<"field">;
841
+ defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodNumber]>>;
839
842
  }, z.core.$strip>, z.ZodObject<{
840
843
  config: z.ZodObject<{
841
844
  type: z.ZodEnum<{
@@ -1,4 +1,4 @@
1
- import * as z from 'zod/v4';
1
+ import * as z from 'zod';
2
2
  /**
3
3
  * Composite field value consists of multiple field values.
4
4
  */
@@ -16,6 +16,7 @@ export declare const FileFieldValue: z.ZodObject<{
16
16
  type: z.ZodString;
17
17
  }, z.core.$strip>;
18
18
  export type FileFieldValue = z.infer<typeof FileFieldValue>;
19
+ export declare function isFileFieldValue(value: unknown): value is FileFieldValue;
19
20
  export declare const NameFieldValue: z.ZodObject<{
20
21
  firstname: z.ZodString;
21
22
  surname: z.ZodString;
@@ -36,6 +37,7 @@ export declare const DomesticAddressFieldValue: z.ZodObject<{
36
37
  administrativeArea: z.ZodString;
37
38
  }, z.core.$strip>;
38
39
  export type DomesticAddressFieldValue = z.infer<typeof DomesticAddressFieldValue>;
40
+ export declare function isDomesticAddressFieldValue(value: unknown): value is DomesticAddressFieldValue;
39
41
  export declare const AddressFieldValue: z.ZodDiscriminatedUnion<[z.ZodObject<{
40
42
  country: z.ZodString;
41
43
  streetLevelDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
@@ -46,6 +48,7 @@ export declare const AddressFieldValue: z.ZodDiscriminatedUnion<[z.ZodObject<{
46
48
  streetLevelDetails: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
47
49
  addressType: z.ZodLiteral<"INTERNATIONAL">;
48
50
  }, z.core.$strip>], "addressType">;
51
+ export declare function isAddressFieldValue(value: unknown): value is AddressFieldValue;
49
52
  export type AddressFieldValue = z.infer<typeof AddressFieldValue>;
50
53
  export declare const AddressFieldUpdateValue: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
51
54
  country: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -72,6 +75,7 @@ export declare const FileFieldWithOptionValue: z.ZodArray<z.ZodObject<{
72
75
  option: z.ZodString;
73
76
  }, z.core.$strip>>;
74
77
  export type FileFieldWithOptionValue = z.infer<typeof FileFieldWithOptionValue>;
78
+ export declare function isFileFieldWithOptionValue(value: unknown): value is FileFieldWithOptionValue;
75
79
  export declare const HttpFieldValue: z.ZodObject<{
76
80
  loading: z.ZodBoolean;
77
81
  error: z.ZodOptional<z.ZodNullable<z.ZodObject<{
@@ -57,13 +57,46 @@ export declare const DraftInput: z.ZodObject<{
57
57
  keepAssignmentIfAccepted: z.ZodOptional<z.ZodBoolean>;
58
58
  keepAssignmentIfRejected: z.ZodOptional<z.ZodBoolean>;
59
59
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
60
- type: z.ZodLiteral<"DECLARE">;
60
+ type: z.ZodEnum<{
61
+ DECLARE: "DECLARE";
62
+ NOTIFY: "NOTIFY";
63
+ }>;
61
64
  status: z.ZodEnum<{
62
65
  Accepted: "Accepted";
63
66
  Rejected: "Rejected";
64
67
  Requested: "Requested";
65
68
  }>;
66
69
  }, z.core.$strip>;
70
+ export declare const RemoteDraft: z.ZodObject<{
71
+ id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
72
+ eventId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
73
+ transactionId: z.ZodString;
74
+ createdAt: z.ZodString;
75
+ action: z.ZodObject<{
76
+ transactionId: z.ZodString;
77
+ createdByUserType: z.ZodEnum<{
78
+ system: "system";
79
+ user: "user";
80
+ }>;
81
+ createdAt: z.ZodString;
82
+ createdBy: z.ZodString;
83
+ createdByRole: z.ZodOptional<z.ZodString>;
84
+ createdBySignature: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">>>;
85
+ declaration: z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>;
86
+ annotation: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>>;
87
+ status: z.ZodEnum<{
88
+ Accepted: "Accepted";
89
+ Rejected: "Rejected";
90
+ Requested: "Requested";
91
+ }>;
92
+ originalActionId: z.ZodNullable<z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
93
+ type: z.ZodEnum<{
94
+ DECLARE: "DECLARE";
95
+ NOTIFY: "NOTIFY";
96
+ }>;
97
+ }, z.core.$strip>;
98
+ }, z.core.$strip>;
67
99
  export type Draft = z.infer<typeof Draft>;
68
100
  export type DraftInput = z.infer<typeof DraftInput>;
101
+ export type RemoteDraft = z.infer<typeof RemoteDraft>;
69
102
  //# sourceMappingURL=Draft.d.ts.map
@@ -40,9 +40,6 @@ type ActionConfigInput = z.input<typeof ActionConfig>;
40
40
  type DeclareActionConfigInput = Extract<ActionConfigInput, {
41
41
  type: typeof ActionType.DECLARE;
42
42
  }>;
43
- type NotifyActionConfigInput = Extract<ActionConfigInput, {
44
- type: typeof ActionType.NOTIFY;
45
- }>;
46
43
  /**
47
44
  * Input accepted by `EventConfig.parse`. `declaration` lives only on the DECLARE action,
48
45
  * and NOTIFY carries its `notificationForm` and `review`.
@@ -60,18 +57,12 @@ type EventConfigSchemaInput = Omit<EventConfig, 'advancedSearch' | 'flags' | 'ac
60
57
  * `declaration` may be given at the top level (kept for backwards compatibility)
61
58
  * or on the DECLARE action.
62
59
  * `defineConfig` checks at runtime that it is given in exactly one of these places.
63
- *
64
- * The NOTIFY action, and its `notificationForm` and `review`, are optional.
65
- * `defineConfig` generates whatever is missing from the DECLARE action.
66
60
  */
67
61
  export type EventConfigInput = Omit<EventConfigSchemaInput, 'actions'> & {
68
62
  /** @deprecated Define `declaration` on the DECLARE action instead. */
69
63
  declaration?: DeclarationFormConfigInput;
70
- actions: Array<Exclude<ActionConfigInput, DeclareActionConfigInput | NotifyActionConfigInput> | (Omit<DeclareActionConfigInput, 'declaration'> & {
64
+ actions: Array<Exclude<ActionConfigInput, DeclareActionConfigInput> | (Omit<DeclareActionConfigInput, 'declaration'> & {
71
65
  declaration?: DeclarationFormConfigInput;
72
- }) | (Omit<NotifyActionConfigInput, 'notificationForm' | 'review'> & {
73
- notificationForm?: NotifyActionConfigInput['notificationForm'];
74
- review?: NotifyActionConfigInput['review'];
75
66
  })>;
76
67
  };
77
68
  export declare const EventConfig: z.ZodType<EventConfig, EventConfigSchemaInput>;
@@ -355,7 +355,7 @@ export type QueryTypeShape = {
355
355
  };
356
356
  export declare const QueryType: z.ZodType<QueryTypeShape>;
357
357
  export declare const SearchQuery: z.ZodObject<{
358
- query: z.ZodPreprocess<ZodType<QueryTypeShape, unknown, z.core.$ZodTypeInternals<QueryTypeShape, unknown>>>;
358
+ query: z.ZodPreprocess<ZodType<QueryTypeShape, unknown, z.core.$ZodTypeInternals<QueryTypeShape, unknown>>, unknown>;
359
359
  limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
360
360
  offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
361
361
  sort: z.ZodOptional<z.ZodPreprocess<z.ZodArray<z.ZodObject<{
@@ -364,7 +364,7 @@ export declare const SearchQuery: z.ZodObject<{
364
364
  asc: "asc";
365
365
  desc: "desc";
366
366
  }>>;
367
- }, z.core.$strip>>>>;
367
+ }, z.core.$strip>>, unknown>>;
368
368
  }, z.core.$strip>;
369
369
  export type SearchQuery = z.infer<typeof SearchQuery>;
370
370
  export type QueryType = z.infer<typeof QueryType>;
@@ -3101,7 +3101,7 @@ declare const SearchField: z.ZodObject<{
3101
3101
  }, z.core.$strip>]>>;
3102
3102
  type: z.ZodLiteral<"SEARCH">;
3103
3103
  configuration: z.ZodObject<{
3104
- query: z.ZodPreprocess<z.ZodType<import("./EventIndex").QueryTypeShape, unknown, z.core.$ZodTypeInternals<import("./EventIndex").QueryTypeShape, unknown>>>;
3104
+ query: z.ZodPreprocess<z.ZodType<import("./EventIndex").QueryTypeShape, unknown, z.core.$ZodTypeInternals<import("./EventIndex").QueryTypeShape, unknown>>, unknown>;
3105
3105
  limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
3106
3106
  offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
3107
3107
  validation: z.ZodObject<{
@@ -31,6 +31,9 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
31
31
  }>, z.core.$strip> | z.ZodObject<{
32
32
  age: z.ZodNumber;
33
33
  asOfDateRef: z.ZodString;
34
+ }, z.core.$strip> | z.ZodObject<{
35
+ numericValue: z.ZodOptional<z.ZodNumber>;
36
+ unit: z.ZodOptional<z.ZodString>;
34
37
  }, z.core.$strip> | z.ZodObject<{
35
38
  path: z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">;
36
39
  originalFilename: z.ZodString;
@@ -40,9 +43,6 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
40
43
  }, z.core.$strip> | z.ZodObject<{
41
44
  numericValue: z.ZodNumber;
42
45
  unit: z.ZodString;
43
- }, z.core.$strip> | z.ZodObject<{
44
- numericValue: z.ZodOptional<z.ZodNumber>;
45
- unit: z.ZodOptional<z.ZodString>;
46
46
  }, z.core.$strip> | z.ZodObject<{
47
47
  label: z.ZodString;
48
48
  value: z.ZodString;
@@ -67,6 +67,9 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
67
67
  }>, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
68
68
  age: z.ZodNumber;
69
69
  asOfDateRef: z.ZodString;
70
+ }, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
71
+ numericValue: z.ZodOptional<z.ZodNumber>;
72
+ unit: z.ZodOptional<z.ZodString>;
70
73
  }, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
71
74
  path: z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">;
72
75
  originalFilename: z.ZodString;
@@ -76,9 +79,6 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
76
79
  }, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
77
80
  numericValue: z.ZodNumber;
78
81
  unit: z.ZodString;
79
- }, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
80
- numericValue: z.ZodOptional<z.ZodNumber>;
81
- unit: z.ZodOptional<z.ZodString>;
82
82
  }, z.core.$strip>>> | z.ZodOptional<z.ZodNullable<z.ZodObject<{
83
83
  label: z.ZodString;
84
84
  value: z.ZodString;
@@ -243,15 +243,6 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
243
243
  }, z.core.$strip>>>;
244
244
  data: z.ZodOptional<z.ZodNullable<z.ZodAny>>;
245
245
  }, z.core.$strip>, z.ZodNull]>, z.ZodUndefined]>>> | z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUnknown, "CustomFieldValue", "out">>> | z.ZodString | z.ZodType<{
246
- country: string;
247
- streetLevelDetails?: Record<string, string> | undefined;
248
- addressType: "DOMESTIC";
249
- administrativeArea: string;
250
- } | {
251
- country: string;
252
- streetLevelDetails?: Record<string, string> | undefined;
253
- addressType: "INTERNATIONAL";
254
- } | {
255
246
  country?: string | null | undefined;
256
247
  streetLevelDetails?: Record<string, string | null> | null | undefined;
257
248
  addressType: "DOMESTIC";
@@ -260,7 +251,7 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
260
251
  country?: string | null | undefined;
261
252
  streetLevelDetails?: Record<string, string | null> | null | undefined;
262
253
  addressType: "INTERNATIONAL";
263
- } | null | undefined, unknown, z.core.$ZodTypeInternals<{
254
+ } | {
264
255
  country: string;
265
256
  streetLevelDetails?: Record<string, string> | undefined;
266
257
  addressType: "DOMESTIC";
@@ -269,7 +260,7 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
269
260
  country: string;
270
261
  streetLevelDetails?: Record<string, string> | undefined;
271
262
  addressType: "INTERNATIONAL";
272
- } | {
263
+ } | null | undefined, unknown, z.core.$ZodTypeInternals<{
273
264
  country?: string | null | undefined;
274
265
  streetLevelDetails?: Record<string, string | null> | null | undefined;
275
266
  addressType: "DOMESTIC";
@@ -278,6 +269,15 @@ export declare function mapFieldTypeToZod(field: FieldConfig, actionType?: Actio
278
269
  country?: string | null | undefined;
279
270
  streetLevelDetails?: Record<string, string | null> | null | undefined;
280
271
  addressType: "INTERNATIONAL";
272
+ } | {
273
+ country: string;
274
+ streetLevelDetails?: Record<string, string> | undefined;
275
+ addressType: "DOMESTIC";
276
+ administrativeArea: string;
277
+ } | {
278
+ country: string;
279
+ streetLevelDetails?: Record<string, string> | undefined;
280
+ addressType: "INTERNATIONAL";
281
281
  } | null | undefined, unknown>> | z.ZodUnion<[z.ZodObject<{
282
282
  start: z.core.$ZodBranded<z.ZodString, "PlainDate", "out">;
283
283
  end: z.core.$ZodBranded<z.ZodString, "PlainDate", "out">;
@@ -1,4 +1,4 @@
1
- import * as z from 'zod/v4';
1
+ import * as z from 'zod';
2
2
  export declare const InherentFlags: {
3
3
  readonly REJECTED: 'rejected';
4
4
  readonly CORRECTION_REQUESTED: 'correction-requested';
@@ -9,6 +9,7 @@ import { z } from 'zod';
9
9
  */
10
10
  export declare const PlainDate: z.core.$ZodBranded<z.ZodString, "PlainDate", "out">;
11
11
  export type PlainDate = z.infer<typeof PlainDate>;
12
+ export declare const isPlainDate: (date: unknown) => date is PlainDate;
12
13
  /**
13
14
  * Extracts the plain calendar date from an ISO 8601 datetime (or passes an
14
15
  * already-plain YYYY-MM-DD through) as a {@link PlainDate}. This is the single
@@ -22,7 +22,7 @@ export declare function validateExactlyOneDeclareAction<T extends {
22
22
  */
23
23
  export declare function validateDeclarationGivenExactlyOnce(config: EventConfigInput, ctx: z.RefinementCtx<EventConfigInput>): void;
24
24
  /**
25
- * Validation which ensures that *if* a NOTIFY notificationForm is configured, it:
25
+ * Validation which ensures that a NOTIFY notificationForm:
26
26
  * - only includes fields with ids that are also in the declaration form
27
27
  * - the field types match the ones on the declaration form
28
28
  *
@@ -37,6 +37,7 @@ export declare function field(fieldId: string, options?: {
37
37
  validations?: ValidationConfig[];
38
38
  searchCriteriaLabelPrefix?: TranslationConfig;
39
39
  allowedLocations?: JurisdictionReference;
40
+ defaultValue?: boolean | string | number;
40
41
  }): {
41
42
  $$field: string;
42
43
  $$subfield: string[];
@@ -387,6 +388,7 @@ export declare function field(fieldId: string, options?: {
387
388
  validations?: ValidationConfig[];
388
389
  searchCriteriaLabelPrefix?: TranslationConfig;
389
390
  allowedLocations?: JurisdictionReference;
391
+ defaultValue?: boolean | string | number;
390
392
  fieldId: string;
391
393
  fieldType: 'field';
392
394
  } & {
@@ -400,6 +402,7 @@ export declare function field(fieldId: string, options?: {
400
402
  validations?: ValidationConfig[];
401
403
  searchCriteriaLabelPrefix?: TranslationConfig;
402
404
  allowedLocations?: JurisdictionReference;
405
+ defaultValue?: boolean | string | number;
403
406
  fieldId: string;
404
407
  fieldType: 'field';
405
408
  } & {
@@ -413,6 +416,7 @@ export declare function field(fieldId: string, options?: {
413
416
  validations?: ValidationConfig[];
414
417
  searchCriteriaLabelPrefix?: TranslationConfig;
415
418
  allowedLocations?: JurisdictionReference;
419
+ defaultValue?: boolean | string | number;
416
420
  fieldId: string;
417
421
  fieldType: 'field';
418
422
  } & {
@@ -426,6 +430,7 @@ export declare function field(fieldId: string, options?: {
426
430
  validations?: ValidationConfig[];
427
431
  searchCriteriaLabelPrefix?: TranslationConfig;
428
432
  allowedLocations?: JurisdictionReference;
433
+ defaultValue?: boolean | string | number;
429
434
  fieldId: string;
430
435
  fieldType: 'field';
431
436
  } & {
@@ -1,3 +1,4 @@
1
+ import 'zod/compile';
1
2
  export * from './AuditLog';
2
3
  export * from './Constants';
3
4
  export * from './ActionConfig';
@@ -25,6 +26,7 @@ export * from './state';
25
26
  export * from './state/flags';
26
27
  export * from './utils';
27
28
  export * from './defineConfig';
29
+ export * from './toNotificationForm';
28
30
  export * from './DeduplicationConfig';
29
31
  export * from './transactions';
30
32
  export * from './FieldType';
@@ -46,6 +48,7 @@ export * from './Flag';
46
48
  export * from './event';
47
49
  export * from './locations';
48
50
  export * from './locationPayloads';
51
+ export * from './PlainDate';
49
52
  export { UUID } from '../uuid';
50
53
  export { DocumentPath } from '../documents';
51
54
  //# sourceMappingURL=index.d.ts.map
@@ -3,7 +3,7 @@ import * as z from 'zod/v4';
3
3
  import { PlainDate } from './PlainDate';
4
4
  import { EventIndex } from './EventIndex';
5
5
  import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
6
- import { RecordScopeV2, UserScopeV2 } from '../scopes';
6
+ import { RecordScopeV2, UserScopeV2 } from '../users/scopes';
7
7
  import { SystemContext, UserContext } from '../users/User';
8
8
  /** @deprecated Moving on, location types are arbitrary and defined by the country config. */
9
9
  export declare const LocationTypeV1: z.ZodEnum<{
@@ -1,5 +1,5 @@
1
1
  import { DisplayableAction } from './ActionType';
2
- import { EncodedScope, RecordScopeTypeV2, ScopeType, UserScopeV2 } from '../scopes';
2
+ import { EncodedScope, RecordScopeTypeV2, ScopeType, UserScopeV2 } from '../users/scopes';
3
3
  import { EventIndexWithAdministrativeHierarchy } from './locations';
4
4
  import { UserContext } from '../users/User';
5
5
  import { EventIndex } from './EventIndex';
@@ -15,6 +15,7 @@ export declare const ACTION_SCOPE_MAP: {
15
15
  PRINT_CERTIFICATE: "record.print-certified-copies"[];
16
16
  REQUEST_CORRECTION: ("record.correct" | "record.request-correction")[];
17
17
  REVIEW_CORRECTION_REQUEST: "record.correct"[];
18
+ CONTINUE_DRAFT: never[];
18
19
  REJECT_CORRECTION: "record.correct"[];
19
20
  APPROVE_CORRECTION: "record.correct"[];
20
21
  REVOKE_REGISTRATION: "record.revoke-registration"[];
@@ -3,7 +3,7 @@ import { ActionDocument, ActionUpdate } from './ActionDocument';
3
3
  import { ValidatorContext } from '../conditionals/validate';
4
4
  import { ApproveCorrectionActionInput, ArchiveActionInput, AssignActionInput, DeclareActionInput, EditActionInput, MarkAsDuplicateActionInput, MarkNotDuplicateActionInput, NotifyActionInput, RegisterActionInput, RejectCorrectionActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnarchiveActionInput, UnassignActionInput, RevokeRegistrationActionInput, ReinstateRegistrationActionInput } from './ActionInput';
5
5
  import { ActionType } from './ActionType';
6
- import { Draft } from './Draft';
6
+ import { Draft, DraftInput, RemoteDraft } from './Draft';
7
7
  import { EventConfig, EventConfigInput } from './EventConfig';
8
8
  import { EventDocument } from './EventDocument';
9
9
  import { EventIndex } from './EventIndex';
@@ -310,11 +310,11 @@ export declare function generateEventDocument({ configuration, actions, rng, def
310
310
  }): EventDocument;
311
311
  export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
312
312
  eventId: UUID;
313
- actionType: ActionType;
313
+ actionType: DraftInput['type'];
314
314
  rng?: () => number;
315
315
  declaration?: ActionUpdate;
316
316
  annotation?: ActionUpdate;
317
- }): Draft;
317
+ }): RemoteDraft;
318
318
  /**
319
319
  * Useful for testing when we need deterministic outcome.
320
320
  * @param seed - Seed value for the pseudo-random number generator
@@ -352,10 +352,9 @@ export declare const generateEventConfig: ({ id, fields, placeOfEventId, dateOfE
352
352
  actions?: EventConfigInput['actions'];
353
353
  }) => EventConfig;
354
354
  /**
355
- * The notification form is dropped, since it may refer to fields of the replaced declaration.
356
- * `getNotificationForm` then derives it from the new declaration.
355
+ * The notification form is replaced too, since it may refer to fields of the replaced declaration.
357
356
  *
358
- * @returns a copy of the configuration with the DECLARE action's declaration replaced.
357
+ * @returns a copy of the configuration with the DECLARE action's declaration replaced, and the NOTIFY action's notification form made from it.
359
358
  */
360
359
  export declare function withDeclaration(configuration: EventConfig, declaration: DeclarationFormConfig): EventConfig;
361
360
  /**
@@ -0,0 +1,17 @@
1
+ import * as z from 'zod/v4';
2
+ import { DeclarationFormConfig, DeclarationFormConfigInput } from './FormConfig';
3
+ import { DeclarationReviewConfig } from './ActionConfig';
4
+ type DeclarationReviewConfigInput = z.input<typeof DeclarationReviewConfig>;
5
+ type DeclarationReviewConfigOutput = z.infer<typeof DeclarationReviewConfig>;
6
+ /**
7
+ * NOTIFY submits incomplete records, and its notification form is validated like any form.
8
+ *
9
+ * @returns a copy of the declaration form with every field optional and without validations, to use as the NOTIFY `notificationForm`.
10
+ */
11
+ export declare function toNotificationForm<F extends DeclarationFormConfig | DeclarationFormConfigInput>(declaration: F): F;
12
+ /**
13
+ * @returns a copy of the DECLARE review with every field optional and without validations, to use as the NOTIFY `review`.
14
+ */
15
+ export declare function toNotificationReview<R extends DeclarationReviewConfigOutput | DeclarationReviewConfigInput>(review: R): R;
16
+ export {};
17
+ //# sourceMappingURL=toNotificationForm.d.ts.map
@@ -47,14 +47,35 @@ export declare function getDeclarationPages(configuration: EventConfig): {
47
47
  }[];
48
48
  export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
49
49
  /**
50
- * @returns the notification form of the event: the one configured on the NOTIFY action,
51
- * or the declaration with every field optional when none is configured.
52
- *
53
- * The fallback is derived here rather than in `defineConfig`, so that it is not part of the
54
- * served event configuration.
50
+ * @returns the notification form configured on the NOTIFY action.
51
+ * @throws when the event has no NOTIFY action.
55
52
  */
56
53
  export declare function getNotificationForm(configuration: EventConfig): DeclarationFormConfig;
57
54
  export declare function getNotificationFields(configuration: EventConfig): FieldConfig[];
55
+ /**
56
+ * Form a user fills in to submit the given action:
57
+ * the notification form for NOTIFY, the declaration form for DECLARE.
58
+ */
59
+ export declare function getActionForm(configuration: EventConfig, actionType: typeof ActionType.NOTIFY | typeof ActionType.DECLARE): {
60
+ label: {
61
+ id: string;
62
+ defaultMessage: string;
63
+ description: string;
64
+ };
65
+ pages: {
66
+ id: string;
67
+ title: {
68
+ id: string;
69
+ defaultMessage: string;
70
+ description: string;
71
+ };
72
+ requireCompletionToContinue: boolean;
73
+ showClearButton?: boolean | undefined;
74
+ fields: FieldConfig[];
75
+ conditional?: any;
76
+ type: "FORM";
77
+ }[];
78
+ };
58
79
  export declare function isActionConfigType(type: ActionType): type is ActionConfigTypes;
59
80
  export declare function getActionConfig({ eventConfiguration, actionType, customActionType }: {
60
81
  eventConfiguration: EventConfig;