@opencrvs/toolkit 2.0.1 → 2.1.0-beta
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.
- package/README.md +16 -0
- package/build.sh +14 -5
- package/create-countryconfig/index.js +293 -103
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +5 -2
- package/dist/application-config/index.js +369 -282
- package/dist/authentication/index.d.ts +67 -0
- package/dist/authentication/index.d.ts.map +1 -0
- package/dist/authentication/index.js +750 -0
- package/dist/cli.js +4343 -4788
- package/dist/commons/api/router.d.ts +4120 -2946
- package/dist/commons/application-config/index.d.ts +6 -6
- package/dist/commons/conditionals/conditionals.d.ts +32 -323
- package/dist/commons/conditionals/validate.d.ts +16 -5
- package/dist/commons/events/ActionConfig.d.ts +302 -71
- package/dist/commons/events/ActionDocument.d.ts +159 -121
- package/dist/commons/events/ActionInput.d.ts +30 -10
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/ActionType.d.ts +63 -58
- package/dist/commons/events/AdvancedSearchConfig.d.ts +531 -501
- package/dist/commons/events/AuditLog.d.ts +189 -40
- package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
- package/dist/commons/events/Conditional.d.ts +3 -3
- package/dist/commons/events/CountryConfigQueryInput.d.ts +603 -561
- package/dist/commons/events/Draft.d.ts +38 -36
- package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
- package/dist/commons/events/EventConfig.d.ts +8 -3
- package/dist/commons/events/EventDocument.d.ts +537 -47
- package/dist/commons/events/EventIndex.d.ts +61 -59
- package/dist/commons/events/EventMetadata.d.ts +59 -43
- package/dist/commons/events/EventStatus.d.ts +19 -0
- package/dist/commons/events/FieldConfig.d.ts +424 -384
- package/dist/commons/events/FieldType.d.ts +51 -51
- package/dist/commons/events/FieldTypeMapping.d.ts +86 -86
- package/dist/commons/events/FieldValue.d.ts +14 -14
- package/dist/commons/events/Flag.d.ts +57 -15
- package/dist/commons/events/FormConfig.d.ts +0 -6
- package/dist/commons/events/PageConfig.d.ts +0 -4
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/TemplateConfig.d.ts +1 -1
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
- package/dist/commons/events/WorkqueueConfig.d.ts +835 -790
- package/dist/commons/events/deduplication.d.ts +1 -1
- package/dist/commons/events/event.d.ts +14 -2
- package/dist/commons/events/field.d.ts +69 -198
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locationPayloads.d.ts +95 -0
- package/dist/commons/events/locations.d.ts +248 -14
- package/dist/commons/events/mocks.test.utils.d.ts +48 -4
- package/dist/commons/events/scopes.d.ts +5 -4
- package/dist/commons/events/state/index.d.ts +23 -15
- package/dist/commons/events/state/utils.d.ts +15 -6
- package/dist/commons/events/test.utils.d.ts +68 -42
- package/dist/commons/events/utils.d.ts +139 -110
- package/dist/commons/notification/UserNotifications.d.ts +38 -18
- package/dist/commons/notification/dispatch.d.ts +10 -0
- package/dist/commons/notification/index.d.ts +1 -0
- package/dist/conditionals/index.js +341 -68
- package/dist/csv.d.ts +25 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +120 -0
- package/dist/environment/custom-types.d.ts +33 -0
- package/dist/environment/custom-types.d.ts.map +1 -0
- package/dist/environment/custom-types.js +12 -0
- package/dist/environment/derived-variables.d.ts +122 -0
- package/dist/environment/derived-variables.d.ts.map +1 -0
- package/dist/environment/derived-variables.js +155 -0
- package/dist/environment/editor-questions.d.ts +4 -0
- package/dist/environment/editor-questions.d.ts.map +1 -0
- package/dist/environment/editor-questions.js +67 -0
- package/dist/environment/git.d.ts +5 -0
- package/dist/environment/git.d.ts.map +1 -0
- package/dist/environment/git.js +38 -0
- package/dist/environment/github.d.ts +26 -0
- package/dist/environment/github.d.ts.map +1 -0
- package/dist/environment/github.js +247 -0
- package/dist/environment/index.d.ts +6 -0
- package/dist/environment/index.d.ts.map +1 -0
- package/dist/environment/index.js +81 -0
- package/dist/environment/logger.d.ts +18 -0
- package/dist/environment/logger.d.ts.map +1 -0
- package/dist/environment/logger.js +25 -0
- package/dist/environment/manage-users.d.ts +11 -0
- package/dist/environment/manage-users.d.ts.map +1 -0
- package/dist/environment/manage-users.js +507 -0
- package/dist/environment/paths.d.ts +7 -0
- package/dist/environment/paths.d.ts.map +1 -0
- package/dist/environment/paths.js +72 -0
- package/dist/environment/questions-helper.d.ts +15 -0
- package/dist/environment/questions-helper.d.ts.map +1 -0
- package/dist/environment/questions-helper.js +70 -0
- package/dist/environment/questions.d.ts +200 -0
- package/dist/environment/questions.d.ts.map +1 -0
- package/dist/environment/questions.js +418 -0
- package/dist/environment/setup-environment.d.ts +2 -0
- package/dist/environment/setup-environment.d.ts.map +1 -0
- package/dist/environment/setup-environment.js +795 -0
- package/dist/environment/ssh-keygen.d.ts +5 -0
- package/dist/environment/ssh-keygen.d.ts.map +1 -0
- package/dist/environment/ssh-keygen.js +21 -0
- package/dist/environment/swarm-to-k8s.d.ts +2 -0
- package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
- package/dist/environment/swarm-to-k8s.js +183 -0
- package/dist/environment/templates.d.ts +27 -0
- package/dist/environment/templates.d.ts.map +1 -0
- package/dist/environment/templates.js +164 -0
- package/dist/environment/update-workflows.d.ts +2 -0
- package/dist/environment/update-workflows.d.ts.map +1 -0
- package/dist/environment/update-workflows.js +191 -0
- package/dist/environment/upgrade.d.ts +2 -0
- package/dist/environment/upgrade.d.ts.map +1 -0
- package/dist/environment/upgrade.js +82 -0
- package/dist/environment/users.d.ts +2 -0
- package/dist/environment/users.d.ts.map +1 -0
- package/dist/environment/users.js +120 -0
- package/dist/environment/utils.d.ts +18 -0
- package/dist/environment/utils.d.ts.map +1 -0
- package/dist/environment/utils.js +110 -0
- package/dist/events/deduplication.d.ts +1 -1
- package/dist/events/index.js +8104 -7408
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
- package/dist/migrations/v2.0/index.js +88 -5143
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +3 -3
- package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
- package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
- package/dist/migrations/v2.1/add-translations.d.ts +9 -0
- package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-translations.js +213 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
- package/dist/migrations/v2.1/enable-telemetry.js +438 -0
- package/dist/migrations/v2.1/index.d.ts +6 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -0
- package/dist/migrations/v2.1/index.js +1276 -0
- package/dist/notification/index.js +2010 -1451
- package/dist/scopes/index.d.ts +512 -231
- package/dist/scopes/index.js +342 -68
- package/dist/telemetry/index.d.ts +45 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +39 -0
- package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
- package/dist/templates/charts-values/dependencies/values.yaml +82 -0
- package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +78 -0
- package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
- package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
- package/dist/templates/charts-values/traefik/values.yaml +129 -0
- package/dist/templates/inventory/inventory.template.yml +98 -0
- package/dist/translations/check.d.ts +19 -0
- package/dist/translations/check.d.ts.map +1 -0
- package/dist/translations/check.js +127 -0
- package/dist/verify/endpoints.d.ts.map +1 -1
- package/dist/verify/endpoints.js +25 -25
- package/opencrvs-toolkit-2.1.0-beta.tgz +0 -0
- package/package.json +25 -6
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/opencrvs-toolkit-2.0.1.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -47,7 +47,7 @@ __export(conditionals_exports, {
|
|
|
47
47
|
user: () => user
|
|
48
48
|
});
|
|
49
49
|
module.exports = __toCommonJS(conditionals_exports);
|
|
50
|
-
var
|
|
50
|
+
var z13 = __toESM(require("zod/v4"));
|
|
51
51
|
|
|
52
52
|
// ../commons/src/conditionals/conditionals.ts
|
|
53
53
|
var objectHash = __toESM(require("object-hash"));
|
|
@@ -124,7 +124,7 @@ function todayDateTimeValueSerializer() {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// ../commons/src/scopes.ts
|
|
127
|
-
var
|
|
127
|
+
var z11 = __toESM(require("zod/v4"));
|
|
128
128
|
var qs = __toESM(require("qs"));
|
|
129
129
|
|
|
130
130
|
// ../commons/src/uuid.ts
|
|
@@ -138,12 +138,267 @@ var z5 = __toESM(require("zod/v4"));
|
|
|
138
138
|
var TokenUserType = z5.enum(["user", "system"]);
|
|
139
139
|
var TokenWithBearer = z5.string().regex(/^Bearer\s/);
|
|
140
140
|
|
|
141
|
+
// ../commons/src/events/ActionType.ts
|
|
142
|
+
var z6 = __toESM(require("zod/v4"));
|
|
143
|
+
var ActionType = {
|
|
144
|
+
// Pre-declaration actions
|
|
145
|
+
DELETE: "DELETE",
|
|
146
|
+
CREATE: "CREATE",
|
|
147
|
+
NOTIFY: "NOTIFY",
|
|
148
|
+
// Declaration actions
|
|
149
|
+
DECLARE: "DECLARE",
|
|
150
|
+
REGISTER: "REGISTER",
|
|
151
|
+
EDIT: "EDIT",
|
|
152
|
+
// Declaration system actions. Non-configurable.
|
|
153
|
+
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
154
|
+
REJECT: "REJECT",
|
|
155
|
+
// REJECT_DECLARATION
|
|
156
|
+
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
157
|
+
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
158
|
+
ARCHIVE: "ARCHIVE",
|
|
159
|
+
UNARCHIVE: "UNARCHIVE",
|
|
160
|
+
// Record actions
|
|
161
|
+
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
162
|
+
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
163
|
+
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
164
|
+
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
165
|
+
// General actions
|
|
166
|
+
READ: "READ",
|
|
167
|
+
ASSIGN: "ASSIGN",
|
|
168
|
+
UNASSIGN: "UNASSIGN",
|
|
169
|
+
// Custom action
|
|
170
|
+
CUSTOM: "CUSTOM"
|
|
171
|
+
};
|
|
172
|
+
var ConfirmableActions = [
|
|
173
|
+
ActionType.NOTIFY,
|
|
174
|
+
ActionType.DECLARE,
|
|
175
|
+
ActionType.EDIT,
|
|
176
|
+
ActionType.REGISTER,
|
|
177
|
+
ActionType.REJECT,
|
|
178
|
+
ActionType.ARCHIVE,
|
|
179
|
+
ActionType.UNARCHIVE,
|
|
180
|
+
ActionType.PRINT_CERTIFICATE,
|
|
181
|
+
ActionType.REQUEST_CORRECTION,
|
|
182
|
+
ActionType.APPROVE_CORRECTION,
|
|
183
|
+
ActionType.REJECT_CORRECTION,
|
|
184
|
+
ActionType.CUSTOM
|
|
185
|
+
];
|
|
186
|
+
var ActionTypes = z6.enum([
|
|
187
|
+
"DELETE",
|
|
188
|
+
"CREATE",
|
|
189
|
+
"NOTIFY",
|
|
190
|
+
"DECLARE",
|
|
191
|
+
"EDIT",
|
|
192
|
+
"REGISTER",
|
|
193
|
+
"DUPLICATE_DETECTED",
|
|
194
|
+
"REJECT",
|
|
195
|
+
"MARK_AS_DUPLICATE",
|
|
196
|
+
"MARK_AS_NOT_DUPLICATE",
|
|
197
|
+
"ARCHIVE",
|
|
198
|
+
"UNARCHIVE",
|
|
199
|
+
"PRINT_CERTIFICATE",
|
|
200
|
+
"REQUEST_CORRECTION",
|
|
201
|
+
"REJECT_CORRECTION",
|
|
202
|
+
"APPROVE_CORRECTION",
|
|
203
|
+
"READ",
|
|
204
|
+
"ASSIGN",
|
|
205
|
+
"UNASSIGN",
|
|
206
|
+
"CUSTOM"
|
|
207
|
+
]);
|
|
208
|
+
var declarationActionValues = [
|
|
209
|
+
ActionTypes.enum.DECLARE,
|
|
210
|
+
ActionTypes.enum.EDIT,
|
|
211
|
+
ActionTypes.enum.REGISTER,
|
|
212
|
+
ActionTypes.enum.NOTIFY,
|
|
213
|
+
ActionTypes.enum.DUPLICATE_DETECTED
|
|
214
|
+
];
|
|
215
|
+
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
216
|
+
var declarationUpdateActionValues = [
|
|
217
|
+
...declarationActionValues,
|
|
218
|
+
ActionTypes.enum.REQUEST_CORRECTION
|
|
219
|
+
];
|
|
220
|
+
var DeclarationUpdateActions = ActionTypes.extract(
|
|
221
|
+
declarationUpdateActionValues
|
|
222
|
+
);
|
|
223
|
+
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
224
|
+
var writeActions = ActionTypes.exclude([
|
|
225
|
+
ActionType.CREATE,
|
|
226
|
+
ActionType.READ,
|
|
227
|
+
ActionType.ASSIGN,
|
|
228
|
+
ActionType.UNASSIGN
|
|
229
|
+
]);
|
|
230
|
+
var WorkqueueActionType = ActionTypes.extract([
|
|
231
|
+
ActionType.READ,
|
|
232
|
+
ActionType.DELETE,
|
|
233
|
+
ActionType.DECLARE,
|
|
234
|
+
ActionType.REGISTER,
|
|
235
|
+
ActionType.EDIT,
|
|
236
|
+
ActionType.REJECT,
|
|
237
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
238
|
+
ActionType.ARCHIVE,
|
|
239
|
+
ActionType.UNARCHIVE,
|
|
240
|
+
ActionType.PRINT_CERTIFICATE,
|
|
241
|
+
ActionType.REQUEST_CORRECTION
|
|
242
|
+
]);
|
|
243
|
+
var META_ACTIONS = [
|
|
244
|
+
ActionType.ASSIGN,
|
|
245
|
+
ActionType.UNASSIGN,
|
|
246
|
+
ActionType.READ
|
|
247
|
+
];
|
|
248
|
+
|
|
249
|
+
// ../commons/src/events/ActionStatus.ts
|
|
250
|
+
var ActionStatus = {
|
|
251
|
+
Requested: "Requested",
|
|
252
|
+
Accepted: "Accepted",
|
|
253
|
+
Rejected: "Rejected"
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
// ../commons/src/events/Flag.ts
|
|
257
|
+
var z9 = __toESM(require("zod/v4"));
|
|
258
|
+
|
|
259
|
+
// ../commons/src/events/TranslationConfig.ts
|
|
260
|
+
var z7 = __toESM(require("zod/v4"));
|
|
261
|
+
var TranslationConfig = z7.object({
|
|
262
|
+
id: z7.string().describe(
|
|
263
|
+
"The identifier of the translation referred in translation CSV files"
|
|
264
|
+
),
|
|
265
|
+
defaultMessage: z7.string().describe("Default translation message"),
|
|
266
|
+
description: z7.string().describe(
|
|
267
|
+
"Describe the translation for a translator to be able to identify it."
|
|
268
|
+
)
|
|
269
|
+
}).meta({
|
|
270
|
+
description: "Translation configuration",
|
|
271
|
+
id: "TranslationConfig"
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
// ../commons/src/events/Conditional.ts
|
|
275
|
+
var z8 = __toESM(require("zod/v4"));
|
|
276
|
+
var Conditional = z8.any().describe("JSONSchema").meta({
|
|
277
|
+
description: "JSON schema conditional configuration",
|
|
278
|
+
id: "Conditional"
|
|
279
|
+
});
|
|
280
|
+
var ConditionalType = {
|
|
281
|
+
SHOW: "SHOW",
|
|
282
|
+
ENABLE: "ENABLE",
|
|
283
|
+
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
284
|
+
};
|
|
285
|
+
var ShowConditional = z8.object({
|
|
286
|
+
type: z8.literal(ConditionalType.SHOW),
|
|
287
|
+
conditional: Conditional
|
|
288
|
+
}).describe(
|
|
289
|
+
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
290
|
+
);
|
|
291
|
+
var EnableConditional = z8.object({
|
|
292
|
+
type: z8.literal(ConditionalType.ENABLE),
|
|
293
|
+
conditional: Conditional
|
|
294
|
+
}).describe(
|
|
295
|
+
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
296
|
+
);
|
|
297
|
+
var ActionConditional = z8.discriminatedUnion("type", [
|
|
298
|
+
// Action can be shown / hidden
|
|
299
|
+
ShowConditional,
|
|
300
|
+
// Action can be shown to the user in the list but as disabled
|
|
301
|
+
EnableConditional
|
|
302
|
+
]).meta({
|
|
303
|
+
id: "ActionConditional",
|
|
304
|
+
description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
|
|
305
|
+
});
|
|
306
|
+
var DisplayOnReviewConditional = z8.object({
|
|
307
|
+
type: z8.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
308
|
+
conditional: Conditional
|
|
309
|
+
}).describe(
|
|
310
|
+
"If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
|
|
311
|
+
);
|
|
312
|
+
var FieldConditional = z8.discriminatedUnion("type", [
|
|
313
|
+
// Field input can be shown / hidden
|
|
314
|
+
ShowConditional,
|
|
315
|
+
// Field input can be shown to the user but as disabled
|
|
316
|
+
EnableConditional,
|
|
317
|
+
// Field output can be shown / hidden on the review page
|
|
318
|
+
DisplayOnReviewConditional
|
|
319
|
+
]).meta({
|
|
320
|
+
id: "FieldConditional",
|
|
321
|
+
description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
// ../commons/src/events/Flag.ts
|
|
325
|
+
var InherentFlags = {
|
|
326
|
+
INCOMPLETE: "incomplete",
|
|
327
|
+
REJECTED: "rejected",
|
|
328
|
+
CORRECTION_REQUESTED: "correction-requested",
|
|
329
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
330
|
+
/**
|
|
331
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
332
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
333
|
+
*
|
|
334
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
335
|
+
*/
|
|
336
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
337
|
+
};
|
|
338
|
+
var actionFlagPattern;
|
|
339
|
+
function getActionFlagPattern() {
|
|
340
|
+
actionFlagPattern ??= new RegExp(
|
|
341
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
342
|
+
ActionStatus
|
|
343
|
+
).join("|").toLowerCase()})$`
|
|
344
|
+
);
|
|
345
|
+
return actionFlagPattern;
|
|
346
|
+
}
|
|
347
|
+
var ActionFlag = z9.string().refine((value) => getActionFlagPattern().test(value), {
|
|
348
|
+
message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
349
|
+
});
|
|
350
|
+
var CustomFlag = z9.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
351
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
352
|
+
InherentFlags
|
|
353
|
+
).join(", ")}`
|
|
354
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
355
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
356
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
357
|
+
var Flag = ActionFlag.or(z9.enum(InherentFlags)).or(CustomFlag);
|
|
358
|
+
var ContainsFlags = z9.object({
|
|
359
|
+
anyOf: z9.array(Flag).optional(),
|
|
360
|
+
noneOf: z9.array(Flag).optional(),
|
|
361
|
+
allOf: z9.array(Flag).optional()
|
|
362
|
+
}).meta({
|
|
363
|
+
id: "ContainsFlags"
|
|
364
|
+
});
|
|
365
|
+
var FlagConfig = z9.object({
|
|
366
|
+
id: CustomFlag,
|
|
367
|
+
requiresAction: z9.boolean().describe(
|
|
368
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
369
|
+
),
|
|
370
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
371
|
+
}).meta({
|
|
372
|
+
id: "FlagConfig",
|
|
373
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
374
|
+
});
|
|
375
|
+
var ActionFlagConfig = z9.object({
|
|
376
|
+
id: Flag,
|
|
377
|
+
operation: z9.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
378
|
+
conditional: Conditional.optional().describe(
|
|
379
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
380
|
+
)
|
|
381
|
+
}).meta({
|
|
382
|
+
id: "ActionFlagConfig",
|
|
383
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
// ../commons/src/events/EventStatus.ts
|
|
387
|
+
var z10 = __toESM(require("zod/v4"));
|
|
388
|
+
var EventStatus = z10.enum([
|
|
389
|
+
"CREATED",
|
|
390
|
+
"NOTIFIED",
|
|
391
|
+
"DECLARED",
|
|
392
|
+
"REGISTERED",
|
|
393
|
+
"ARCHIVED"
|
|
394
|
+
]);
|
|
395
|
+
|
|
141
396
|
// ../commons/src/scopes.ts
|
|
142
|
-
var JurisdictionFilter =
|
|
397
|
+
var JurisdictionFilter = z11.enum(["administrativeArea", "location", "all"]).describe(
|
|
143
398
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
144
399
|
);
|
|
145
|
-
var UserFilter =
|
|
146
|
-
var RecordScopeTypeV2 =
|
|
400
|
+
var UserFilter = z11.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
401
|
+
var RecordScopeTypeV2 = z11.enum([
|
|
147
402
|
"record.search",
|
|
148
403
|
"record.create",
|
|
149
404
|
"record.read",
|
|
@@ -152,6 +407,7 @@ var RecordScopeTypeV2 = z6.enum([
|
|
|
152
407
|
"record.edit",
|
|
153
408
|
"record.reject",
|
|
154
409
|
"record.archive",
|
|
410
|
+
"record.unarchive",
|
|
155
411
|
"record.review-duplicates",
|
|
156
412
|
"record.register",
|
|
157
413
|
"record.print-certified-copies",
|
|
@@ -160,14 +416,20 @@ var RecordScopeTypeV2 = z6.enum([
|
|
|
160
416
|
"record.unassign-others",
|
|
161
417
|
"record.custom-action"
|
|
162
418
|
]);
|
|
163
|
-
var PlainScopeType =
|
|
419
|
+
var PlainScopeType = z11.enum([
|
|
164
420
|
// Misc. system scopes
|
|
165
421
|
"bypassratelimit",
|
|
166
422
|
"record.reindex",
|
|
167
423
|
"user.data-seeding",
|
|
168
424
|
"integration.create",
|
|
425
|
+
// Reading an integration's audit log. Deliberately separate from
|
|
426
|
+
// 'integration.create' so read-only oversight can be granted on its own, and
|
|
427
|
+
// deliberately option-less: system clients have no office and no
|
|
428
|
+
// administrative area, so jurisdiction options would have nothing to bind to.
|
|
429
|
+
"integration.audit.read",
|
|
169
430
|
"record.import",
|
|
170
431
|
"config.update-all",
|
|
432
|
+
"location.edit",
|
|
171
433
|
"attachment.upload",
|
|
172
434
|
"profile.electronic-signature",
|
|
173
435
|
"user.read-only-my-audit",
|
|
@@ -179,72 +441,81 @@ var PlainScopeType = z6.enum([
|
|
|
179
441
|
"record.confirm-registration",
|
|
180
442
|
"record.reject-registration"
|
|
181
443
|
]);
|
|
182
|
-
var scopeByEvent =
|
|
444
|
+
var scopeByEvent = z11.preprocess(
|
|
183
445
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
184
|
-
|
|
446
|
+
z11.array(z11.string()).optional()
|
|
185
447
|
).describe("Event type, e.g. birth, death");
|
|
186
|
-
var
|
|
448
|
+
var scopeByStatus = z11.preprocess(
|
|
449
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
450
|
+
z11.array(EventStatus).optional()
|
|
451
|
+
).describe(
|
|
452
|
+
"Restricts the scope to records currently in one of these statuses."
|
|
453
|
+
);
|
|
454
|
+
var userRole = z11.preprocess(
|
|
187
455
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
188
|
-
|
|
456
|
+
z11.array(z11.string()).optional()
|
|
189
457
|
).describe("User role, e.g. admin, field agent");
|
|
190
|
-
var scopeOptionsPlaceEvent =
|
|
458
|
+
var scopeOptionsPlaceEvent = z11.object({
|
|
191
459
|
event: scopeByEvent,
|
|
192
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
193
|
-
createdBy: UserFilter.optional(),
|
|
194
|
-
createdIn: JurisdictionFilter.optional()
|
|
460
|
+
placeOfEvent: JurisdictionFilter.optional()
|
|
195
461
|
}).describe("Options applicable to all record scopes.");
|
|
196
|
-
var
|
|
462
|
+
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
463
|
+
notifiedIn: JurisdictionFilter.optional(),
|
|
464
|
+
notifiedBy: UserFilter.optional(),
|
|
197
465
|
declaredIn: JurisdictionFilter.optional(),
|
|
198
|
-
declaredBy: UserFilter.optional()
|
|
466
|
+
declaredBy: UserFilter.optional(),
|
|
467
|
+
status: scopeByStatus
|
|
199
468
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
200
|
-
var AllRecordScopeOptions =
|
|
469
|
+
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
201
470
|
registeredIn: JurisdictionFilter.optional(),
|
|
202
|
-
registeredBy: UserFilter.optional()
|
|
471
|
+
registeredBy: UserFilter.optional(),
|
|
472
|
+
flags: ContainsFlags.optional()
|
|
203
473
|
}).describe(
|
|
204
474
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
205
475
|
);
|
|
206
476
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
207
|
-
customActionTypes:
|
|
477
|
+
customActionTypes: z11.preprocess(
|
|
208
478
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
209
|
-
|
|
479
|
+
z11.array(z11.string()).optional()
|
|
210
480
|
).describe("Allowed custom action types")
|
|
211
481
|
});
|
|
212
|
-
var AccessLevelOptions =
|
|
482
|
+
var AccessLevelOptions = z11.object({
|
|
213
483
|
accessLevel: JurisdictionFilter.optional()
|
|
214
484
|
});
|
|
215
485
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
216
486
|
role: userRole.optional()
|
|
217
487
|
});
|
|
218
|
-
var WorkqueueOrDashboardOptions =
|
|
219
|
-
ids:
|
|
488
|
+
var WorkqueueOrDashboardOptions = z11.object({
|
|
489
|
+
ids: z11.preprocess(
|
|
220
490
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
221
|
-
|
|
491
|
+
z11.array(z11.string())
|
|
222
492
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
223
493
|
});
|
|
224
|
-
var AllScopeOptions =
|
|
494
|
+
var AllScopeOptions = z11.object({
|
|
225
495
|
...AllRecordScopeOptions.shape,
|
|
226
496
|
...AccessLevelOptions.shape,
|
|
227
497
|
...AllUserScopeOptions.shape,
|
|
228
498
|
...WorkqueueOrDashboardOptions.shape
|
|
229
499
|
});
|
|
230
500
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
231
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
501
|
+
var ResolvedScopeOptionsPlaceEvent = z11.object({
|
|
232
502
|
event: scopeByEvent,
|
|
233
|
-
placeOfEvent: UUID.nullish()
|
|
234
|
-
createdBy: z6.string().optional(),
|
|
235
|
-
createdIn: UUID.nullish()
|
|
503
|
+
placeOfEvent: UUID.nullish()
|
|
236
504
|
}).describe(
|
|
237
505
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
238
506
|
);
|
|
239
507
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
508
|
+
notifiedIn: UUID.nullish(),
|
|
509
|
+
notifiedBy: z11.string().optional(),
|
|
240
510
|
declaredIn: UUID.nullish(),
|
|
241
|
-
declaredBy:
|
|
511
|
+
declaredBy: z11.string().optional()
|
|
242
512
|
}).describe(
|
|
243
513
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
244
514
|
);
|
|
245
515
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
246
516
|
registeredIn: UUID.nullish(),
|
|
247
|
-
registeredBy:
|
|
517
|
+
registeredBy: z11.string().optional(),
|
|
518
|
+
flags: ContainsFlags.optional()
|
|
248
519
|
}).describe(
|
|
249
520
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
250
521
|
);
|
|
@@ -257,7 +528,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
257
528
|
"record.edit",
|
|
258
529
|
"record.reject",
|
|
259
530
|
"record.archive",
|
|
260
|
-
"record.
|
|
531
|
+
"record.unarchive",
|
|
261
532
|
"record.register"
|
|
262
533
|
]);
|
|
263
534
|
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
@@ -265,41 +536,42 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
265
536
|
"record.read",
|
|
266
537
|
"record.request-correction",
|
|
267
538
|
"record.correct",
|
|
268
|
-
"record.unassign-others"
|
|
539
|
+
"record.unassign-others",
|
|
540
|
+
"record.review-duplicates"
|
|
269
541
|
]);
|
|
270
542
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
271
|
-
templates:
|
|
543
|
+
templates: z11.preprocess(
|
|
272
544
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
273
|
-
|
|
545
|
+
z11.array(z11.string()).optional()
|
|
274
546
|
).describe(
|
|
275
547
|
"Template IDs for certified copies. Controls which certificate templates are returned to the client via the config service. Certificate printing is a client-side operation \u2014 this option is not validated when the printCertificate action is submitted."
|
|
276
548
|
)
|
|
277
549
|
});
|
|
278
|
-
var RecordScopeV2 =
|
|
279
|
-
|
|
550
|
+
var RecordScopeV2 = z11.discriminatedUnion("type", [
|
|
551
|
+
z11.object({
|
|
280
552
|
type: ScopesWithPlaceEventOptions,
|
|
281
553
|
options: scopeOptionsPlaceEvent.optional()
|
|
282
554
|
}),
|
|
283
|
-
|
|
555
|
+
z11.object({
|
|
284
556
|
type: ScopesWithDeclaredOptions,
|
|
285
|
-
options:
|
|
557
|
+
options: scopeOptionsDeclaredOrNotified.optional()
|
|
286
558
|
}),
|
|
287
|
-
|
|
559
|
+
z11.object({
|
|
288
560
|
type: ScopesWithFullOptions,
|
|
289
561
|
options: AllRecordScopeOptions.optional()
|
|
290
562
|
}),
|
|
291
|
-
|
|
292
|
-
type:
|
|
563
|
+
z11.object({
|
|
564
|
+
type: z11.literal("record.custom-action"),
|
|
293
565
|
options: CustomActionScopeOptions.optional()
|
|
294
566
|
}),
|
|
295
|
-
|
|
296
|
-
type:
|
|
567
|
+
z11.object({
|
|
568
|
+
type: z11.literal("record.print-certified-copies"),
|
|
297
569
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
298
570
|
})
|
|
299
571
|
]).describe(
|
|
300
572
|
"Scopes used to check user's permission to perform actions on a record."
|
|
301
573
|
);
|
|
302
|
-
var SystemScopeType =
|
|
574
|
+
var SystemScopeType = z11.enum([
|
|
303
575
|
"organisation.read-locations",
|
|
304
576
|
"user.read",
|
|
305
577
|
"user.create",
|
|
@@ -313,66 +585,67 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
313
585
|
"user.search"
|
|
314
586
|
]);
|
|
315
587
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
316
|
-
var UserScopeV2 =
|
|
317
|
-
|
|
588
|
+
var UserScopeV2 = z11.discriminatedUnion("type", [
|
|
589
|
+
z11.object({
|
|
318
590
|
type: ScopesWithRoleOption,
|
|
319
591
|
options: AllUserScopeOptions.optional()
|
|
320
592
|
}),
|
|
321
|
-
|
|
593
|
+
z11.object({
|
|
322
594
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
323
595
|
options: AccessLevelOptions.optional()
|
|
324
596
|
})
|
|
325
597
|
]);
|
|
326
|
-
var ResolvedRecordScopeV2 =
|
|
327
|
-
|
|
598
|
+
var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
|
|
599
|
+
z11.object({
|
|
328
600
|
type: ScopesWithPlaceEventOptions,
|
|
329
601
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
330
602
|
}),
|
|
331
|
-
|
|
603
|
+
z11.object({
|
|
332
604
|
type: ScopesWithDeclaredOptions,
|
|
333
605
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
334
606
|
}),
|
|
335
|
-
|
|
607
|
+
z11.object({
|
|
336
608
|
type: ScopesWithFullOptions,
|
|
337
609
|
options: ResolvedScopeOptionsFull.optional()
|
|
338
610
|
}),
|
|
339
|
-
|
|
340
|
-
type:
|
|
611
|
+
z11.object({
|
|
612
|
+
type: z11.literal("record.print-certified-copies"),
|
|
341
613
|
options: ResolvedScopeOptionsFull.extend({
|
|
342
|
-
templates:
|
|
614
|
+
templates: z11.array(z11.string()).optional()
|
|
343
615
|
}).optional()
|
|
344
616
|
})
|
|
345
617
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
346
|
-
var Scope2 =
|
|
347
|
-
|
|
618
|
+
var Scope2 = z11.discriminatedUnion("type", [
|
|
619
|
+
z11.object({ type: PlainScopeType }),
|
|
348
620
|
...RecordScopeV2.options,
|
|
349
621
|
...UserScopeV2.options,
|
|
350
|
-
|
|
351
|
-
type:
|
|
622
|
+
z11.object({
|
|
623
|
+
type: z11.literal("organisation.read-locations"),
|
|
352
624
|
options: AccessLevelOptions.optional()
|
|
353
625
|
}),
|
|
354
|
-
|
|
355
|
-
type:
|
|
626
|
+
z11.object({
|
|
627
|
+
type: z11.literal("workqueue"),
|
|
356
628
|
options: WorkqueueOrDashboardOptions
|
|
357
629
|
}),
|
|
358
|
-
|
|
359
|
-
type:
|
|
630
|
+
z11.object({
|
|
631
|
+
type: z11.literal("dashboard.view"),
|
|
360
632
|
options: WorkqueueOrDashboardOptions
|
|
361
633
|
})
|
|
362
634
|
]);
|
|
363
|
-
var ScopeType2 =
|
|
635
|
+
var ScopeType2 = z11.enum([
|
|
364
636
|
...SystemScopeType.options,
|
|
365
637
|
...RecordScopeTypeV2.options,
|
|
366
638
|
...PlainScopeType.options,
|
|
367
639
|
"workqueue",
|
|
368
640
|
"dashboard.view"
|
|
369
641
|
]);
|
|
370
|
-
var EncodedScope2 =
|
|
642
|
+
var EncodedScope2 = z11.string().brand("EncodedScope");
|
|
371
643
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
372
644
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
373
645
|
accessLevel: JurisdictionFilter.enum.all,
|
|
374
|
-
|
|
375
|
-
declaredIn: JurisdictionFilter.enum.all
|
|
646
|
+
notifiedIn: JurisdictionFilter.enum.all,
|
|
647
|
+
declaredIn: JurisdictionFilter.enum.all,
|
|
648
|
+
registeredIn: JurisdictionFilter.enum.all
|
|
376
649
|
};
|
|
377
650
|
|
|
378
651
|
// ../commons/src/users/userReferences.ts
|
|
@@ -1061,4 +1334,4 @@ function createFieldConditionals(fieldId) {
|
|
|
1061
1334
|
}
|
|
1062
1335
|
|
|
1063
1336
|
// src/conditionals/index.ts
|
|
1064
|
-
|
|
1337
|
+
z13.globalRegistry.clear();
|
package/dist/csv.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type CsvFile = {
|
|
2
|
+
header: string;
|
|
3
|
+
body: string[];
|
|
4
|
+
/** Preserved so a file written on Windows stays written on Windows. */
|
|
5
|
+
newline: string;
|
|
6
|
+
trailingNewline: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare function parseCsvLine(line: string): string[];
|
|
9
|
+
export declare function toCsvLine(values: string[]): string;
|
|
10
|
+
/**
|
|
11
|
+
* The id of a row, which is its first column. Translation ids never contain a
|
|
12
|
+
* comma or a quote, so this does not need the parser.
|
|
13
|
+
*/
|
|
14
|
+
export declare function idOf(line: string): string;
|
|
15
|
+
export declare function readCsvFile(path: string): CsvFile | undefined;
|
|
16
|
+
export declare function writeCsvFile(path: string, file: CsvFile): void;
|
|
17
|
+
/**
|
|
18
|
+
* Adds the rows the file does not already have an id for, in place. Rows go in
|
|
19
|
+
* sorted position when the file is sorted by id, and at the end when it is not,
|
|
20
|
+
* so a country config that keeps its own order keeps it.
|
|
21
|
+
*
|
|
22
|
+
* Returns the ids that were added.
|
|
23
|
+
*/
|
|
24
|
+
export declare function addRows(file: CsvFile, rows: string[]): string[];
|
|
25
|
+
//# sourceMappingURL=csv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"csv.d.ts","sourceRoot":"","sources":["../src/csv.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,OAAO,CAAA;CACzB,CAAA;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAiCnD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAMlD;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKzC;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAe7D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAM9D;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CA4B/D"}
|