@opencrvs/toolkit 1.9.13-rc.72233cd → 1.9.13-rc.7491e0c

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 (121) hide show
  1. package/build.sh +0 -13
  2. package/dist/api/index.d.ts.map +1 -1
  3. package/dist/commons/api/router.d.ts +4561 -3370
  4. package/dist/commons/conditionals/conditionals.d.ts +3 -27
  5. package/dist/commons/conditionals/validate.d.ts +3 -13
  6. package/dist/commons/events/ActionConfig.d.ts +1555 -415
  7. package/dist/commons/events/ActionDocument.d.ts +1941 -888
  8. package/dist/commons/events/ActionInput.d.ts +1277 -277
  9. package/dist/commons/events/ActionType.d.ts +11 -91
  10. package/dist/commons/events/AdvancedSearchConfig.d.ts +1496 -294
  11. package/dist/commons/events/CompositeFieldValue.d.ts +190 -30
  12. package/dist/commons/events/Conditional.d.ts +38 -26
  13. package/dist/commons/events/Constants.d.ts +1 -1
  14. package/dist/commons/events/CountryConfigQueryInput.d.ts +4471 -1592
  15. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  16. package/dist/commons/events/DeduplicationConfig.d.ts +171 -15
  17. package/dist/commons/events/Draft.d.ts +113 -72
  18. package/dist/commons/events/DynamicFieldValue.d.ts +78 -12
  19. package/dist/commons/events/EventConfig.d.ts +2420 -35
  20. package/dist/commons/events/EventConfigInput.d.ts +3 -0
  21. package/dist/commons/events/EventDocument.d.ts +1366 -354
  22. package/dist/commons/events/EventIndex.d.ts +1010 -212
  23. package/dist/commons/events/EventInput.d.ts +8 -3
  24. package/dist/commons/events/EventMetadata.d.ts +357 -130
  25. package/dist/commons/events/FieldConfig.d.ts +12890 -2890
  26. package/dist/commons/events/FieldType.d.ts +4 -26
  27. package/dist/commons/events/FieldTypeMapping.d.ts +906 -314
  28. package/dist/commons/events/FieldValue.d.ts +527 -149
  29. package/dist/commons/events/FileUtils.d.ts +2 -2
  30. package/dist/commons/events/FormConfig.d.ts +721 -54
  31. package/dist/commons/events/PageConfig.d.ts +320 -58
  32. package/dist/commons/events/PlainDate.d.ts +1 -1
  33. package/dist/commons/events/SummaryConfig.d.ts +161 -14
  34. package/dist/commons/events/TemplateConfig.d.ts +3 -2
  35. package/dist/commons/events/TranslationConfig.d.ts +2 -2
  36. package/dist/commons/events/WorkqueueColumnConfig.d.ts +37 -74
  37. package/dist/commons/events/WorkqueueConfig.d.ts +7480 -2135
  38. package/dist/commons/events/deduplication.d.ts +3 -3
  39. package/dist/commons/events/defineConfig.d.ts +247 -2
  40. package/dist/commons/events/index.d.ts +0 -3
  41. package/dist/commons/events/locations.d.ts +20 -57
  42. package/dist/commons/events/scopes.d.ts +34 -35
  43. package/dist/commons/events/state/availableActions.d.ts +2 -7
  44. package/dist/commons/events/state/flags.d.ts +3 -21
  45. package/dist/commons/events/state/index.d.ts +27 -30
  46. package/dist/commons/events/state/utils.d.ts +172 -190
  47. package/dist/commons/events/test.utils.d.ts +11 -52
  48. package/dist/commons/events/transactions.d.ts +1 -1
  49. package/dist/commons/events/utils.d.ts +274 -374
  50. package/dist/commons/notification/UserNotifications.d.ts +637 -61
  51. package/dist/conditionals/index.d.ts.map +1 -1
  52. package/dist/conditionals/index.js +14 -302
  53. package/dist/events/deduplication.d.ts +3 -3
  54. package/dist/events/index.js +2113 -2847
  55. package/dist/notification/index.d.ts.map +1 -1
  56. package/dist/notification/index.js +1769 -2073
  57. package/dist/scopes/index.d.ts +353 -640
  58. package/dist/scopes/index.d.ts.map +1 -1
  59. package/dist/scopes/index.js +300 -340
  60. package/package.json +3 -13
  61. package/tsconfig.json +2 -12
  62. package/tsconfig.tsbuildinfo +1 -1
  63. package/dist/application-config/index.d.ts +0 -2
  64. package/dist/application-config/index.d.ts.map +0 -1
  65. package/dist/application-config/index.js +0 -2128
  66. package/dist/cli.d.ts +0 -2
  67. package/dist/cli.d.ts.map +0 -1
  68. package/dist/cli.js +0 -3237
  69. package/dist/commons/application-config/index.d.ts +0 -84
  70. package/dist/commons/events/AuditLog.d.ts +0 -405
  71. package/dist/commons/events/Flag.d.ts +0 -67
  72. package/dist/commons/events/eventConfigValidation.d.ts +0 -8
  73. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +0 -3
  74. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +0 -1
  75. package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +0 -405
  76. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +0 -2
  77. package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +0 -1
  78. package/dist/migrations/v2.0/convert-config-files-to-ts.js +0 -829
  79. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +0 -3
  80. package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +0 -1
  81. package/dist/migrations/v2.0/convert-paragraph-to-heading.js +0 -159
  82. package/dist/migrations/v2.0/index.d.ts +0 -7
  83. package/dist/migrations/v2.0/index.d.ts.map +0 -1
  84. package/dist/migrations/v2.0/index.js +0 -3176
  85. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +0 -3
  86. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +0 -1
  87. package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +0 -344
  88. package/dist/migrations/v2.0/migrate-scopes.d.ts +0 -3
  89. package/dist/migrations/v2.0/migrate-scopes.d.ts.map +0 -1
  90. package/dist/migrations/v2.0/migrate-scopes.js +0 -282
  91. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +0 -3
  92. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +0 -1
  93. package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +0 -268
  94. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +0 -3
  95. package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +0 -1
  96. package/dist/migrations/v2.0/migrate-workqueue-configs.js +0 -237
  97. package/dist/migrations/v2.0/remove-delete-actions.d.ts +0 -3
  98. package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +0 -1
  99. package/dist/migrations/v2.0/remove-delete-actions.js +0 -157
  100. package/dist/migrations/v2.0/remove-demo-scope.d.ts +0 -3
  101. package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +0 -1
  102. package/dist/migrations/v2.0/remove-demo-scope.js +0 -75
  103. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +0 -3
  104. package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +0 -1
  105. package/dist/migrations/v2.0/remove-deprecated-imports.js +0 -97
  106. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +0 -3
  107. package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +0 -1
  108. package/dist/migrations/v2.0/remove-hearth-migrations.js +0 -78
  109. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +0 -3
  110. package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +0 -1
  111. package/dist/migrations/v2.0/remove-pending-certification-flag.js +0 -110
  112. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +0 -3
  113. package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +0 -1
  114. package/dist/migrations/v2.0/remove-review-from-register-action.js +0 -164
  115. package/dist/migrations/v2.0/rename-api-paths.d.ts +0 -3
  116. package/dist/migrations/v2.0/rename-api-paths.d.ts.map +0 -1
  117. package/dist/migrations/v2.0/rename-api-paths.js +0 -188
  118. package/dist/migrations/v2.0/rename-location-parent-id.d.ts +0 -3
  119. package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +0 -1
  120. package/dist/migrations/v2.0/rename-location-parent-id.js +0 -181
  121. package/opencrvs-toolkit-1.9.13-rc.72233cd.tgz +0 -0
@@ -7,17 +7,17 @@ export declare function field(fieldId: string): {
7
7
  fieldId: string;
8
8
  type: "fuzzy";
9
9
  options: {
10
- fuzziness?: string | number | undefined;
11
10
  boost?: number | undefined;
12
11
  matchAgainst?: string | undefined;
12
+ fuzziness?: string | number | undefined;
13
13
  } | undefined;
14
14
  };
15
15
  strictMatches: (options?: StrictMatcherOptions) => {
16
16
  fieldId: string;
17
17
  type: "strict";
18
18
  options: {
19
- boost?: number | undefined;
20
19
  value?: string | undefined;
20
+ boost?: number | undefined;
21
21
  matchAgainst?: string | undefined;
22
22
  } | undefined;
23
23
  };
@@ -60,9 +60,9 @@ export declare function field(fieldId: string): {
60
60
  type: "dateRange";
61
61
  options: {
62
62
  days: number;
63
- pivot?: number | undefined;
64
63
  boost?: number | undefined;
65
64
  matchAgainst?: string | undefined;
65
+ pivot?: number | undefined;
66
66
  };
67
67
  };
68
68
  };
@@ -1,3 +1,248 @@
1
- import { EventConfig, EventConfigInput } from './EventConfig';
2
- export declare const defineConfig: (config: EventConfigInput) => EventConfig;
1
+ import { EventConfigInput } from './EventConfigInput';
2
+ /**
3
+ * Builds a validated configuration for an event
4
+ * @param config - Event specific configuration
5
+ */
6
+ export declare const defineConfig: (config: EventConfigInput) => {
7
+ id: string;
8
+ title: import("./TranslationConfig").TranslationConfig;
9
+ declaration: {
10
+ label: import("./TranslationConfig").TranslationConfig;
11
+ pages: {
12
+ type: "FORM";
13
+ id: string;
14
+ title: import("./TranslationConfig").TranslationConfig;
15
+ fields: import("./FieldConfig").FieldConfig[];
16
+ requireCompletionToContinue: boolean;
17
+ conditional?: import(".").JSONSchema | undefined;
18
+ }[];
19
+ };
20
+ actions: ({
21
+ type: "READ";
22
+ label: import("./TranslationConfig").TranslationConfig;
23
+ review: {
24
+ title: import("./TranslationConfig").TranslationConfig;
25
+ fields: import("./FieldConfig").FieldConfig[];
26
+ };
27
+ } | {
28
+ type: "DECLARE";
29
+ label: import("./TranslationConfig").TranslationConfig;
30
+ review: {
31
+ title: import("./TranslationConfig").TranslationConfig;
32
+ fields: import("./FieldConfig").FieldConfig[];
33
+ };
34
+ deduplication?: {
35
+ id: string;
36
+ query: import("./DeduplicationConfig").ClauseOutput;
37
+ label: import("./TranslationConfig").TranslationConfig;
38
+ } | undefined;
39
+ } | {
40
+ type: "VALIDATE";
41
+ label: import("./TranslationConfig").TranslationConfig;
42
+ review: {
43
+ title: import("./TranslationConfig").TranslationConfig;
44
+ fields: import("./FieldConfig").FieldConfig[];
45
+ };
46
+ deduplication?: {
47
+ id: string;
48
+ query: import("./DeduplicationConfig").ClauseOutput;
49
+ label: import("./TranslationConfig").TranslationConfig;
50
+ } | undefined;
51
+ } | {
52
+ type: "REJECT";
53
+ label: import("./TranslationConfig").TranslationConfig;
54
+ } | {
55
+ type: "ARCHIVE";
56
+ label: import("./TranslationConfig").TranslationConfig;
57
+ } | {
58
+ type: "REGISTER";
59
+ label: import("./TranslationConfig").TranslationConfig;
60
+ review: {
61
+ title: import("./TranslationConfig").TranslationConfig;
62
+ fields: import("./FieldConfig").FieldConfig[];
63
+ };
64
+ deduplication?: {
65
+ id: string;
66
+ query: import("./DeduplicationConfig").ClauseOutput;
67
+ label: import("./TranslationConfig").TranslationConfig;
68
+ } | undefined;
69
+ } | {
70
+ type: "DELETE";
71
+ label: import("./TranslationConfig").TranslationConfig;
72
+ } | {
73
+ type: "PRINT_CERTIFICATE";
74
+ label: import("./TranslationConfig").TranslationConfig;
75
+ printForm: {
76
+ label: import("./TranslationConfig").TranslationConfig;
77
+ pages: ({
78
+ type: "FORM";
79
+ id: string;
80
+ title: import("./TranslationConfig").TranslationConfig;
81
+ fields: import("./FieldConfig").FieldConfig[];
82
+ requireCompletionToContinue: boolean;
83
+ conditional?: import(".").JSONSchema | undefined;
84
+ } | {
85
+ type: "VERIFICATION";
86
+ id: string;
87
+ title: import("./TranslationConfig").TranslationConfig;
88
+ actions: {
89
+ cancel: {
90
+ label: import("./TranslationConfig").TranslationConfig;
91
+ confirmation: {
92
+ title: import("./TranslationConfig").TranslationConfig;
93
+ body: import("./TranslationConfig").TranslationConfig;
94
+ };
95
+ };
96
+ verify: {
97
+ label: import("./TranslationConfig").TranslationConfig;
98
+ };
99
+ };
100
+ fields: import("./FieldConfig").FieldConfig[];
101
+ requireCompletionToContinue: boolean;
102
+ conditional?: import(".").JSONSchema | undefined;
103
+ })[];
104
+ };
105
+ } | {
106
+ type: "REQUEST_CORRECTION";
107
+ label: import("./TranslationConfig").TranslationConfig;
108
+ correctionForm: {
109
+ label: import("./TranslationConfig").TranslationConfig;
110
+ pages: ({
111
+ type: "FORM";
112
+ id: string;
113
+ title: import("./TranslationConfig").TranslationConfig;
114
+ fields: import("./FieldConfig").FieldConfig[];
115
+ requireCompletionToContinue: boolean;
116
+ conditional?: import(".").JSONSchema | undefined;
117
+ } | {
118
+ type: "VERIFICATION";
119
+ id: string;
120
+ title: import("./TranslationConfig").TranslationConfig;
121
+ actions: {
122
+ cancel: {
123
+ label: import("./TranslationConfig").TranslationConfig;
124
+ confirmation: {
125
+ title: import("./TranslationConfig").TranslationConfig;
126
+ body: import("./TranslationConfig").TranslationConfig;
127
+ };
128
+ };
129
+ verify: {
130
+ label: import("./TranslationConfig").TranslationConfig;
131
+ };
132
+ };
133
+ fields: import("./FieldConfig").FieldConfig[];
134
+ requireCompletionToContinue: boolean;
135
+ conditional?: import(".").JSONSchema | undefined;
136
+ })[];
137
+ };
138
+ } | {
139
+ type: "REJECT_CORRECTION";
140
+ label: import("./TranslationConfig").TranslationConfig;
141
+ } | {
142
+ type: "APPROVE_CORRECTION";
143
+ label: import("./TranslationConfig").TranslationConfig;
144
+ })[];
145
+ label: import("./TranslationConfig").TranslationConfig;
146
+ summary: {
147
+ fields: ({
148
+ fieldId: string;
149
+ label?: import("./TranslationConfig").TranslationConfig | undefined;
150
+ conditionals?: {
151
+ type: "SHOW";
152
+ conditional: import(".").JSONSchema;
153
+ }[] | undefined;
154
+ emptyValueMessage?: import("./TranslationConfig").TranslationConfig | undefined;
155
+ } | {
156
+ id: string;
157
+ value: import("./TranslationConfig").TranslationConfig;
158
+ label: import("./TranslationConfig").TranslationConfig;
159
+ conditionals?: {
160
+ type: "SHOW";
161
+ conditional: import(".").JSONSchema;
162
+ }[] | undefined;
163
+ emptyValueMessage?: import("./TranslationConfig").TranslationConfig | undefined;
164
+ })[];
165
+ };
166
+ advancedSearch: {
167
+ title: import("./TranslationConfig").TranslationConfig;
168
+ fields: ({
169
+ config: {
170
+ type: "exact" | "fuzzy" | "range" | "within";
171
+ searchFields?: string[] | undefined;
172
+ };
173
+ fieldId: string;
174
+ fieldType: "field";
175
+ type?: "NAME" | "PHONE" | "ID" | "ADDRESS" | "TEXT" | "NUMBER" | "NUMBER_WITH_UNIT" | "TEXTAREA" | "EMAIL" | "DATE" | "AGE" | "DATE_RANGE" | "SELECT_DATE_RANGE" | "TIME" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FIELD_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA" | "BUTTON" | "SEARCH" | "ALPHA_PRINT_BUTTON" | "HTTP" | "LINK_BUTTON" | "VERIFICATION_STATUS" | "QUERY_PARAM_READER" | "QR_READER" | "ID_READER" | "LOADER" | undefined;
176
+ options?: {
177
+ value: string;
178
+ label: string | import("./TranslationConfig").TranslationConfig;
179
+ conditionals?: ({
180
+ type: "SHOW";
181
+ conditional: import(".").JSONSchema;
182
+ } | {
183
+ type: "ENABLE";
184
+ conditional: import(".").JSONSchema;
185
+ })[] | undefined;
186
+ }[] | undefined;
187
+ label?: import("./TranslationConfig").TranslationConfig | undefined;
188
+ conditionals?: ({
189
+ type: "SHOW";
190
+ conditional: import(".").JSONSchema;
191
+ } | {
192
+ type: "ENABLE";
193
+ conditional: import(".").JSONSchema;
194
+ } | {
195
+ type: "DISPLAY_ON_REVIEW";
196
+ conditional: import(".").JSONSchema;
197
+ })[] | undefined;
198
+ searchCriteriaLabelPrefix?: import("./TranslationConfig").TranslationConfig | undefined;
199
+ validations?: {
200
+ message: import("./TranslationConfig").TranslationConfig;
201
+ validator: import(".").JSONSchema;
202
+ }[] | undefined;
203
+ } | {
204
+ config: {
205
+ type: "exact" | "fuzzy" | "range" | "within";
206
+ searchFields?: string[] | undefined;
207
+ };
208
+ fieldId: "event.status" | "event.trackingId" | "event.updatedAt" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation" | "event.legalStatuses.REGISTERED.registrationNumber";
209
+ fieldType: "event";
210
+ type?: "NAME" | "PHONE" | "ID" | "ADDRESS" | "TEXT" | "NUMBER" | "NUMBER_WITH_UNIT" | "TEXTAREA" | "EMAIL" | "DATE" | "AGE" | "DATE_RANGE" | "SELECT_DATE_RANGE" | "TIME" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FIELD_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA" | "BUTTON" | "SEARCH" | "ALPHA_PRINT_BUTTON" | "HTTP" | "LINK_BUTTON" | "VERIFICATION_STATUS" | "QUERY_PARAM_READER" | "QR_READER" | "ID_READER" | "LOADER" | undefined;
211
+ options?: {
212
+ value: string;
213
+ label: string | import("./TranslationConfig").TranslationConfig;
214
+ conditionals?: ({
215
+ type: "SHOW";
216
+ conditional: import(".").JSONSchema;
217
+ } | {
218
+ type: "ENABLE";
219
+ conditional: import(".").JSONSchema;
220
+ })[] | undefined;
221
+ }[] | undefined;
222
+ label?: import("./TranslationConfig").TranslationConfig | undefined;
223
+ conditionals?: ({
224
+ type: "SHOW";
225
+ conditional: import(".").JSONSchema;
226
+ } | {
227
+ type: "ENABLE";
228
+ conditional: import(".").JSONSchema;
229
+ } | {
230
+ type: "DISPLAY_ON_REVIEW";
231
+ conditional: import(".").JSONSchema;
232
+ })[] | undefined;
233
+ searchCriteriaLabelPrefix?: import("./TranslationConfig").TranslationConfig | undefined;
234
+ validations?: {
235
+ message: import("./TranslationConfig").TranslationConfig;
236
+ validator: import(".").JSONSchema;
237
+ }[] | undefined;
238
+ })[];
239
+ }[];
240
+ dateOfEvent?: {
241
+ $$field: string;
242
+ $$subfield: string[];
243
+ } | {
244
+ $$event: "createdAt" | "updatedAt" | "legalStatuses.DECLARED.createdAt" | "legalStatuses.DECLARED.acceptedAt" | "legalStatuses.REGISTERED.createdAt" | "legalStatuses.REGISTERED.acceptedAt";
245
+ } | undefined;
246
+ fallbackTitle?: import("./TranslationConfig").TranslationConfig | undefined;
247
+ };
3
248
  //# sourceMappingURL=defineConfig.d.ts.map
@@ -1,4 +1,3 @@
1
- export * from './AuditLog';
2
1
  export * from './Constants';
3
2
  export * from './ActionConfig';
4
3
  export * from './offline';
@@ -40,9 +39,7 @@ export * from './FileUtils';
40
39
  export * from '../conditionals/conditionals';
41
40
  export * from '../conditionals/validate';
42
41
  export * from './field';
43
- export * from './Flag';
44
42
  export * from './event';
45
43
  export * from './locations';
46
44
  export { UUID } from '../uuid';
47
- export { DocumentPath } from '../documents';
48
45
  //# sourceMappingURL=index.d.ts.map
@@ -1,61 +1,24 @@
1
- import * as z from 'zod/v4';
2
- import { EventIndex } from './EventIndex';
3
- import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
4
- import { RecordScopeV2 } from '../scopes';
5
- import { SystemContext, UserContext } from '../users/User';
6
- /** @deprecated Moving on, location types are arbitrary and defined by the country config. */
7
- export declare const LocationTypeV1: z.ZodEnum<{
8
- ADMIN_STRUCTURE: "ADMIN_STRUCTURE";
9
- HEALTH_FACILITY: "HEALTH_FACILITY";
10
- CRVS_OFFICE: "CRVS_OFFICE";
11
- }>;
12
- export type LocationTypeV1 = z.infer<typeof LocationTypeV1>;
13
- export declare const AdministrativeArea: z.ZodObject<{
14
- id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
15
- name: z.ZodString;
16
- externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
17
- parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
18
- validUntil: z.ZodNullable<z.ZodISODateTime>;
19
- }, z.core.$strip>;
20
- export type AdministrativeArea = z.infer<typeof AdministrativeArea>;
1
+ import { z } from 'zod';
2
+ export declare const LocationType: z.ZodEnum<["ADMIN_STRUCTURE", "CRVS_OFFICE", "HEALTH_FACILITY"]>;
3
+ export type LocationType = z.infer<typeof LocationType>;
21
4
  export declare const Location: z.ZodObject<{
22
- id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
5
+ id: z.ZodBranded<z.ZodString, "UUID">;
23
6
  name: z.ZodString;
24
- externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
- administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
26
- validUntil: z.ZodNullable<z.ZodISODateTime>;
27
- locationType: z.ZodNullable<z.ZodString>;
28
- }, z.core.$strip>;
7
+ parentId: z.ZodNullable<z.ZodBranded<z.ZodString, "UUID">>;
8
+ validUntil: z.ZodNullable<z.ZodString>;
9
+ locationType: z.ZodNullable<z.ZodEnum<["ADMIN_STRUCTURE", "CRVS_OFFICE", "HEALTH_FACILITY"]>>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ id: string & z.BRAND<"UUID">;
12
+ name: string;
13
+ parentId: (string & z.BRAND<"UUID">) | null;
14
+ validUntil: string | null;
15
+ locationType: "ADMIN_STRUCTURE" | "HEALTH_FACILITY" | "CRVS_OFFICE" | null;
16
+ }, {
17
+ id: string;
18
+ name: string;
19
+ parentId: string | null;
20
+ validUntil: string | null;
21
+ locationType: "ADMIN_STRUCTURE" | "HEALTH_FACILITY" | "CRVS_OFFICE" | null;
22
+ }>;
29
23
  export type Location = z.infer<typeof Location>;
30
- type WrapArrayPreserveNullish<V> = V extends readonly any[] ? V : NonNullable<V>[] | Extract<V, null | undefined>;
31
- /**
32
- * For type T, convert fields K to arrays. If field is string, convert to string[].
33
- */
34
- type ToArrayFields<T, K extends PropertyKey> = T extends unknown ? T extends object ? {
35
- [P in keyof T]: P extends K ? WrapArrayPreserveNullish<T[P]> : T[P];
36
- } : T : never;
37
- /**
38
- * Event index type where all location fields are arrays representing full location hierarchy.
39
- */
40
- export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventIndex, 'createdAtLocation' | 'updatedAtLocation' | 'placeOfEvent'>, 'legalStatuses'> & {
41
- legalStatuses: {
42
- DECLARED: ToArrayFields<ActionCreationMetadata, 'createdAtLocation'> | undefined;
43
- REGISTERED: ToArrayFields<RegistrationCreationMetadata, 'createdAtLocation'> | undefined;
44
- };
45
- };
46
- /**
47
- * Given indexed event and resolved scope, determine if the scope allows access to the event.
48
- *
49
- * All of the options within the scope must be satisfied for access to be granted.
50
- * Return false early to break out of checks as soon as possible - if any option is not satisfied, the scope does not allow access to the event, so no need to check further options.
51
- *
52
- */
53
- export declare function canAccessEventWithScope(event: Partial<EventIndexWithAdministrativeHierarchy>, scope: RecordScopeV2, user: UserContext | SystemContext, customActionType?: string): boolean;
54
- /**
55
- * Given indexed event and list of resolved scopes, determine if any of the scopes allow access to the event.
56
- *
57
- * One of the scopes must allow access for the event to be accessible.
58
- */
59
- export declare function userCanAccessEventWithScopes(event: Partial<EventIndexWithAdministrativeHierarchy>, scopes: RecordScopeV2[], user: UserContext | SystemContext, customActionType?: string): boolean;
60
- export {};
61
24
  //# sourceMappingURL=locations.d.ts.map
@@ -1,56 +1,55 @@
1
+ import { ConfigurableScopeType, Scope } from '../scopes';
1
2
  import { DisplayableAction } from './ActionType';
2
- import { EncodedScope } from '../scopes';
3
- import { EventIndexWithAdministrativeHierarchy } from './locations';
4
- import { UserContext } from '../users/User';
5
3
  import { EventIndex } from './EventIndex';
6
4
  export declare const ACTION_SCOPE_MAP: {
7
5
  READ: "record.read"[];
8
6
  CREATE: "record.create"[];
9
7
  NOTIFY: "record.notify"[];
10
- DECLARE: ("record.declare" | "record.register")[];
11
- EDIT: "record.edit"[];
8
+ DECLARE: ("record.register" | "record.declare" | "record.declared.validate")[];
12
9
  DELETE: "record.declare"[];
10
+ VALIDATE: ("record.register" | "record.declared.validate")[];
13
11
  REGISTER: "record.register"[];
14
- PRINT_CERTIFICATE: "record.print-certified-copies"[];
15
- REQUEST_CORRECTION: ("record.request-correction" | "record.correct")[];
16
- REVIEW_CORRECTION_REQUEST: "record.correct"[];
17
- REJECT_CORRECTION: "record.correct"[];
18
- APPROVE_CORRECTION: "record.correct"[];
19
- MARK_AS_DUPLICATE: "record.review-duplicates"[];
20
- MARK_AS_NOT_DUPLICATE: "record.review-duplicates"[];
21
- ARCHIVE: "record.archive"[];
22
- REJECT: "record.reject"[];
12
+ PRINT_CERTIFICATE: "record.registered.print-certified-copies"[];
13
+ REQUEST_CORRECTION: ("record.registered.request-correction" | "record.registered.correct")[];
14
+ REVIEW_CORRECTION_REQUEST: "record.registered.correct"[];
15
+ REJECT_CORRECTION: "record.registered.correct"[];
16
+ APPROVE_CORRECTION: "record.registered.correct"[];
17
+ MARK_AS_DUPLICATE: "record.declared.review-duplicates"[];
18
+ MARK_AS_NOT_DUPLICATE: "record.declared.review-duplicates"[];
19
+ ARCHIVE: "record.declared.archive"[];
20
+ REJECT: "record.declared.reject"[];
23
21
  ASSIGN: null;
24
22
  UNASSIGN: null;
25
23
  DUPLICATE_DETECTED: never[];
26
- CUSTOM: never[];
27
24
  };
28
- export declare function hasAnyOfScopes(a: string[], b: string[]): boolean;
29
- export declare const AssignmentStatus: {
30
- readonly ASSIGNED_TO_SELF: "ASSIGNED_TO_SELF";
31
- readonly ASSIGNED_TO_OTHERS: "ASSIGNED_TO_OTHERS";
32
- readonly UNASSIGNED: "UNASSIGNED";
33
- };
34
- export type AssignmentStatus = (typeof AssignmentStatus)[keyof typeof AssignmentStatus];
35
- export declare function getAssignmentStatus(eventState: EventIndex | EventIndexWithAdministrativeHierarchy, userId: string): AssignmentStatus;
25
+ export declare function hasAnyOfScopes(a: Scope[], b: Scope[]): boolean;
26
+ export declare function configurableEventScopeAllowed(scopes: Scope[], allowedConfigurableScopes: ConfigurableScopeType[], eventType: string): boolean;
36
27
  /**
37
- * Checks if a given action is allowed for the provided scopes, event, and user context.
28
+ * Checks if a given action is allowed for the provided scopes and event type.
38
29
  *
39
30
  * This function determines whether the user, with the given set of scopes, is authorized
40
- * to perform the specified action on the given event. It checks both legacy V1 scopes
41
- * (hardcoded, non-configurable) and V2 scopes, which validate event type, jurisdiction,
42
- * and user context via {@link userCanAccessEventWithScopes}.
31
+ * to perform the specified action on an event of the given type. It checks both "plain" scopes
32
+ * (hardcoded, non-configurable) and "configurable" scopes (which may be tied to specific event types).
43
33
  *
44
- * @param {EncodedScope[]} scopes - The raw encoded scope strings the user possesses (from JWT).
34
+ * @param {Scope[]} scopes - The list of scopes the user possesses.
45
35
  * @param {DisplayableAction} action - The action to check authorization for.
46
- * @param {EventIndexWithAdministrativeHierarchy} event - The event with resolved administrative hierarchy.
47
- * @param {UserContext} currentUser - The current user's context used for V2 scope validation.
36
+ * @param {string} eventType - The type of event for which the action is being checked.
48
37
  * @returns {boolean} True if the action is in scope for the user, otherwise false.
49
38
  */
50
- export declare function isActionInScope({ scopes, action, event, currentUser }: {
51
- scopes: EncodedScope[];
52
- action: DisplayableAction;
53
- event: EventIndexWithAdministrativeHierarchy;
54
- currentUser: UserContext;
39
+ export declare function isActionInScope(scopes: Scope[], action: DisplayableAction, eventType: string): boolean;
40
+ /**
41
+ * A shared utility to check if the user can read a record.
42
+ * This will be removed in 1.10 and implemented by scopes.
43
+ *
44
+ * In order for us to limit the usage of 'record.read' scope, we allow users to view records they have created on system-level.
45
+ *
46
+ * @deprecated - Will be removed in 1.10
47
+ */
48
+ export declare function canUserReadEvent(event: EventIndex | {
49
+ createdBy: string;
50
+ type: string;
51
+ }, { userId, scopes }: {
52
+ userId: string;
53
+ scopes: string[];
55
54
  }): boolean;
56
55
  //# sourceMappingURL=scopes.d.ts.map
@@ -1,11 +1,6 @@
1
1
  import { DisplayableAction } from '../ActionType';
2
2
  import { EventIndex } from '../EventIndex';
3
- import { Flag } from '../Flag';
4
- /**
5
- * Filters actions based on flags
6
- * Some actions can be performed only if certain flags are
7
- * present and others only if certain flags are absent
8
- */
9
- export declare function filterActionsByFlags(actions: DisplayableAction[], flags: Flag[]): DisplayableAction[];
3
+ import { EventStatus, Flag } from '../EventMetadata';
4
+ export declare function getAvailableActions(status: EventStatus, flags: Flag[]): DisplayableAction[];
10
5
  export declare function getAvailableActionsForEvent(event: EventIndex): DisplayableAction[];
11
6
  //# sourceMappingURL=availableActions.d.ts.map
@@ -1,22 +1,4 @@
1
- import { Flag, CustomFlag } from '../Flag';
2
- import { EventConfig } from '../EventConfig';
3
- import { EventDocument } from '../EventDocument';
4
- /**
5
- * This function resolves custom flags for an event based on its actions.
6
- * Flags are not stored to the event state or any database directly, instead they are always computed/evaluated from the event actions.
7
- *
8
- * Processes accepted actions in chronological order, evaluating flag conditions
9
- * at each action step. Flags can be added or removed based on action configurations
10
- * and conditional logic. Duplicate flags are filtered out.
11
- *
12
- * @param event - The event document containing actions and metadata
13
- * @param eventConfiguration - The configuration object for the event type defining action rules and flag behaviors
14
- * @returns An array of unique custom flag IDs that apply to the event after processing all non-meta actions
15
- *
16
- * @example
17
- * const flags = resolveEventCustomFlags(eventDoc, config);
18
- * // Returns: ['flag-1', 'flag-3']
19
- */
20
- export declare function resolveEventCustomFlags(event: EventDocument, eventConfiguration: EventConfig): CustomFlag[];
21
- export declare function getEventFlags(event: EventDocument, config: EventConfig): Flag[];
1
+ import { Action } from '../ActionDocument';
2
+ import { Flag } from '../EventMetadata';
3
+ export declare function getFlagsFromActions(actions: Action[]): Flag[];
22
4
  //# sourceMappingURL=flags.d.ts.map
@@ -6,13 +6,13 @@ import { EventStatus } from '../EventMetadata';
6
6
  import { Draft } from '../Draft';
7
7
  import { EventConfig } from '../EventConfig';
8
8
  import { UUID } from '../../uuid';
9
- import { DocumentPath } from '../../documents';
10
- export declare function getStatusFromActions(actions: Array<Action>): "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "ARCHIVED";
9
+ import { DocumentPath, FullDocumentPath, FullDocumentUrl } from '../../documents';
10
+ export declare function getStatusFromActions(actions: Array<Action>): "ARCHIVED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED";
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[]] ? {
14
14
  [K in keyof T]: NonNullableDeep<NonNullable<T[K]>>;
15
- } : T extends UUID ? T : T extends DocumentPath ? T : T extends string ? NonNullable<T> : T extends (infer U)[] ? NonNullableDeep<U>[] : T extends object ? {
15
+ } : T extends UUID ? T : T extends FullDocumentPath ? T : T extends DocumentPath ? T : T extends FullDocumentUrl ? T : T extends (infer U)[] ? NonNullableDeep<U>[] : T extends object ? {
16
16
  [K in keyof T]: NonNullableDeep<NonNullable<T[K]>>;
17
17
  } : NonNullable<T>;
18
18
  /**
@@ -26,10 +26,6 @@ export declare function deepDropNulls<T>(obj: T): NonNullableDeep<T>;
26
26
  export declare function isUndeclaredDraft(status: EventStatus): boolean;
27
27
  export declare const DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
28
28
  export declare function resolveDateOfEvent(eventIndex: EventIndex, declaration: EventState, config: EventConfig): string | undefined;
29
- export declare const DEFAULT_PLACE_OF_EVENT_PROPERTY = "createdAtLocation";
30
- export declare function resolvePlaceOfEvent(eventMetadata: {
31
- createdAtLocation?: UUID | undefined | null;
32
- }, declaration: EventState, config: EventConfig): UUID | undefined | null;
33
29
  export declare function extractPotentialDuplicatesFromActions(actions: Action[]): PotentialDuplicate[];
34
30
  /**
35
31
  * NOTE: This function should not run field validations. It should return the state based on the actions, without considering context (users, roles, permissions, etc).
@@ -40,7 +36,9 @@ export declare function extractPotentialDuplicatesFromActions(actions: Action[])
40
36
  * @returns Calculates a snapshot summary of the event based on the actions taken on it.
41
37
  * @see EventIndex for the description of the returned object.
42
38
  */
43
- export declare function getCurrentEventState(event: EventDocument, config: EventConfig): EventIndex;
39
+ export declare function getCurrentEventState(event: EventDocument,
40
+ /** @TODO: remove config parameter, it is only used by resolveDateOfEvent. See if it can be achieved in some other way. */
41
+ config: EventConfig): EventIndex;
44
42
  /**
45
43
  * @returns the future state of the event with drafts applied to all fields.
46
44
  *
@@ -62,48 +60,47 @@ export declare function applyDeclarationToEventIndex(eventIndex: EventIndex, dec
62
60
  *
63
61
  */
64
62
  export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Draft, eventConfiguration: EventConfig): {
65
- id: string & import("zod").$brand<"UUID">;
66
63
  type: string;
67
- status: "CREATED" | "NOTIFIED" | "DECLARED" | "REGISTERED" | "ARCHIVED";
64
+ id: string & import("zod").BRAND<"UUID">;
65
+ status: "ARCHIVED" | "DECLARED" | "REGISTERED" | "VALIDATED" | "CREATED" | "NOTIFIED";
66
+ createdAt: string;
67
+ createdBy: string;
68
+ declaration: Record<string, import("..").FieldValue>;
69
+ trackingId: string;
70
+ updatedAt: string;
68
71
  legalStatuses: {
69
72
  DECLARED?: {
70
73
  createdAt: string;
71
74
  createdBy: string;
75
+ createdByRole: string;
72
76
  acceptedAt: string;
73
- createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
74
- createdByUserType?: "user" | "system" | null | undefined;
75
- createdByRole?: string | undefined;
77
+ createdByUserType?: "system" | "user" | null | undefined;
76
78
  createdBySignature?: string | null | undefined;
79
+ createdAtLocation?: (string & import("zod").BRAND<"UUID">) | null | undefined;
77
80
  } | null | undefined;
78
81
  REGISTERED?: {
79
82
  createdAt: string;
80
83
  createdBy: string;
81
- acceptedAt: string;
84
+ createdByRole: string;
82
85
  registrationNumber: string;
83
- createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
84
- createdByUserType?: "user" | "system" | null | undefined;
85
- createdByRole?: string | undefined;
86
+ acceptedAt: string;
87
+ createdByUserType?: "system" | "user" | null | undefined;
86
88
  createdBySignature?: string | null | undefined;
89
+ createdAtLocation?: (string & import("zod").BRAND<"UUID">) | null | undefined;
87
90
  } | null | undefined;
88
91
  };
89
- createdAt: string;
90
- createdBy: string;
91
- updatedAt: string;
92
- trackingId: string;
92
+ updatedByUserRole: string;
93
93
  potentialDuplicates: {
94
- id: string & import("zod").$brand<"UUID">;
94
+ id: string & import("zod").BRAND<"UUID">;
95
95
  trackingId: string;
96
96
  }[];
97
97
  flags: string[];
98
- declaration: Record<string, import("..").FieldValue>;
99
- dateOfEvent?: string | null | undefined;
100
- placeOfEvent?: (string & import("zod").$brand<"UUID">) | null | undefined;
101
- createdByUserType?: "user" | "system" | null | undefined;
102
- updatedByUserRole?: string | null | undefined;
103
- createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
104
- createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
105
- updatedAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
98
+ createdByUserType?: "system" | "user" | null | undefined;
99
+ createdBySignature?: string | null | undefined;
100
+ createdAtLocation?: (string & import("zod").BRAND<"UUID">) | null | undefined;
106
101
  assignedTo?: string | null | undefined;
102
+ dateOfEvent?: string | null | undefined;
103
+ updatedAtLocation?: (string & import("zod").BRAND<"UUID">) | null | undefined;
107
104
  updatedBy?: string | null | undefined;
108
105
  };
109
106
  /**