@opencrvs/toolkit 2.1.0-rc.b0003b1 → 2.1.0-rc.b061691
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/build.sh +2 -2
- package/dist/application-config/index.js +212 -188
- package/dist/cli.js +165 -5154
- package/dist/commons/api/router.d.ts +758 -201
- package/dist/commons/conditionals/conditionals.d.ts +1592 -40
- package/dist/commons/conditionals/validate.d.ts +2 -1
- package/dist/commons/events/ActionConfig.d.ts +230 -0
- package/dist/commons/events/ActionDocument.d.ts +51 -13
- package/dist/commons/events/ActionInput.d.ts +26 -6
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/ActionType.d.ts +6 -1
- package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
- package/dist/commons/events/AuditLog.d.ts +2 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +18 -0
- package/dist/commons/events/Draft.d.ts +2 -0
- package/dist/commons/events/EventDocument.d.ts +24 -2
- package/dist/commons/events/EventIndex.d.ts +5 -24
- package/dist/commons/events/EventMetadata.d.ts +2 -1
- package/dist/commons/events/FieldConfig.d.ts +10 -0
- package/dist/commons/events/Flag.d.ts +48 -0
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +4 -4
- package/dist/commons/events/WorkqueueConfig.d.ts +25 -7
- package/dist/commons/events/field.d.ts +722 -34
- package/dist/commons/events/scopes.d.ts +1 -0
- package/dist/commons/events/test.utils.d.ts +9 -4
- package/dist/commons/events/utils.d.ts +26 -4
- package/dist/conditionals/index.js +305 -55
- package/dist/environment/derived-variables.d.ts +0 -12
- package/dist/environment/derived-variables.d.ts.map +1 -1
- package/dist/environment/derived-variables.js +0 -14
- package/dist/environment/logger.d.ts +3 -12
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/manage-users.js +17 -7
- package/dist/environment/setup-environment.js +0 -14
- package/dist/environment/swarm-to-k8s.js +17 -7
- package/dist/environment/update-workflows.js +17 -7
- package/dist/environment/users.js +17 -7
- package/dist/environment/utils.js +17 -7
- package/dist/events/index.js +3330 -3128
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
- package/dist/migrations/v2.0/index.js +88 -5144
- 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/index.d.ts +6 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -0
- package/dist/migrations/v2.1/index.js +218 -0
- package/dist/notification/index.js +1557 -872
- package/dist/scopes/index.d.ts +257 -1
- package/dist/scopes/index.js +306 -55
- package/dist/templates/charts-values/dependencies/values.yaml +0 -3
- package/dist/templates/charts-values/opencrvs-services/values.yaml +0 -4
- package/opencrvs-toolkit-2.1.0-rc.b061691.tgz +0 -0
- package/package.json +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.b0003b1.tgz +0 -0
package/dist/scopes/index.js
CHANGED
|
@@ -59,10 +59,10 @@ __export(scopes_exports, {
|
|
|
59
59
|
scopeUsesRoleOptions: () => scopeUsesRoleOptions
|
|
60
60
|
});
|
|
61
61
|
module.exports = __toCommonJS(scopes_exports);
|
|
62
|
-
var
|
|
62
|
+
var z8 = __toESM(require("zod/v4"));
|
|
63
63
|
|
|
64
64
|
// ../commons/src/scopes.ts
|
|
65
|
-
var
|
|
65
|
+
var z7 = __toESM(require("zod/v4"));
|
|
66
66
|
var qs = __toESM(require("qs"));
|
|
67
67
|
|
|
68
68
|
// ../commons/src/uuid.ts
|
|
@@ -96,12 +96,258 @@ var getTokenPayload = (token) => {
|
|
|
96
96
|
};
|
|
97
97
|
var TokenWithBearer = z2.string().regex(/^Bearer\s/);
|
|
98
98
|
|
|
99
|
+
// ../commons/src/events/ActionType.ts
|
|
100
|
+
var z3 = __toESM(require("zod/v4"));
|
|
101
|
+
var ActionType = {
|
|
102
|
+
// Pre-declaration actions
|
|
103
|
+
DELETE: "DELETE",
|
|
104
|
+
CREATE: "CREATE",
|
|
105
|
+
NOTIFY: "NOTIFY",
|
|
106
|
+
// Declaration actions
|
|
107
|
+
DECLARE: "DECLARE",
|
|
108
|
+
REGISTER: "REGISTER",
|
|
109
|
+
EDIT: "EDIT",
|
|
110
|
+
// Declaration system actions. Non-configurable.
|
|
111
|
+
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
112
|
+
REJECT: "REJECT",
|
|
113
|
+
// REJECT_DECLARATION
|
|
114
|
+
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
115
|
+
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
116
|
+
ARCHIVE: "ARCHIVE",
|
|
117
|
+
UNARCHIVE: "UNARCHIVE",
|
|
118
|
+
// Record actions
|
|
119
|
+
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
120
|
+
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
121
|
+
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
122
|
+
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
123
|
+
// General actions
|
|
124
|
+
READ: "READ",
|
|
125
|
+
ASSIGN: "ASSIGN",
|
|
126
|
+
UNASSIGN: "UNASSIGN",
|
|
127
|
+
// Custom action
|
|
128
|
+
CUSTOM: "CUSTOM"
|
|
129
|
+
};
|
|
130
|
+
var ConfirmableActions = [
|
|
131
|
+
ActionType.NOTIFY,
|
|
132
|
+
ActionType.DECLARE,
|
|
133
|
+
ActionType.EDIT,
|
|
134
|
+
ActionType.REGISTER,
|
|
135
|
+
ActionType.REJECT,
|
|
136
|
+
ActionType.ARCHIVE,
|
|
137
|
+
ActionType.UNARCHIVE,
|
|
138
|
+
ActionType.PRINT_CERTIFICATE,
|
|
139
|
+
ActionType.REQUEST_CORRECTION,
|
|
140
|
+
ActionType.APPROVE_CORRECTION,
|
|
141
|
+
ActionType.REJECT_CORRECTION,
|
|
142
|
+
ActionType.CUSTOM
|
|
143
|
+
];
|
|
144
|
+
var ActionTypes = z3.enum([
|
|
145
|
+
"DELETE",
|
|
146
|
+
"CREATE",
|
|
147
|
+
"NOTIFY",
|
|
148
|
+
"DECLARE",
|
|
149
|
+
"EDIT",
|
|
150
|
+
"REGISTER",
|
|
151
|
+
"DUPLICATE_DETECTED",
|
|
152
|
+
"REJECT",
|
|
153
|
+
"MARK_AS_DUPLICATE",
|
|
154
|
+
"MARK_AS_NOT_DUPLICATE",
|
|
155
|
+
"ARCHIVE",
|
|
156
|
+
"UNARCHIVE",
|
|
157
|
+
"PRINT_CERTIFICATE",
|
|
158
|
+
"REQUEST_CORRECTION",
|
|
159
|
+
"REJECT_CORRECTION",
|
|
160
|
+
"APPROVE_CORRECTION",
|
|
161
|
+
"READ",
|
|
162
|
+
"ASSIGN",
|
|
163
|
+
"UNASSIGN",
|
|
164
|
+
"CUSTOM"
|
|
165
|
+
]);
|
|
166
|
+
var declarationActionValues = [
|
|
167
|
+
ActionTypes.enum.DECLARE,
|
|
168
|
+
ActionTypes.enum.EDIT,
|
|
169
|
+
ActionTypes.enum.REGISTER,
|
|
170
|
+
ActionTypes.enum.NOTIFY,
|
|
171
|
+
ActionTypes.enum.DUPLICATE_DETECTED
|
|
172
|
+
];
|
|
173
|
+
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
174
|
+
var declarationUpdateActionValues = [
|
|
175
|
+
...declarationActionValues,
|
|
176
|
+
ActionTypes.enum.REQUEST_CORRECTION
|
|
177
|
+
];
|
|
178
|
+
var DeclarationUpdateActions = ActionTypes.extract(
|
|
179
|
+
declarationUpdateActionValues
|
|
180
|
+
);
|
|
181
|
+
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
182
|
+
var writeActions = ActionTypes.exclude([
|
|
183
|
+
ActionType.CREATE,
|
|
184
|
+
ActionType.READ,
|
|
185
|
+
ActionType.ASSIGN,
|
|
186
|
+
ActionType.UNASSIGN
|
|
187
|
+
]);
|
|
188
|
+
var WorkqueueActionType = ActionTypes.extract([
|
|
189
|
+
ActionType.READ,
|
|
190
|
+
ActionType.DELETE,
|
|
191
|
+
ActionType.DECLARE,
|
|
192
|
+
ActionType.REGISTER,
|
|
193
|
+
ActionType.EDIT,
|
|
194
|
+
ActionType.REJECT,
|
|
195
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
196
|
+
ActionType.ARCHIVE,
|
|
197
|
+
ActionType.UNARCHIVE,
|
|
198
|
+
ActionType.PRINT_CERTIFICATE,
|
|
199
|
+
ActionType.REQUEST_CORRECTION
|
|
200
|
+
]);
|
|
201
|
+
var META_ACTIONS = [
|
|
202
|
+
ActionType.ASSIGN,
|
|
203
|
+
ActionType.UNASSIGN,
|
|
204
|
+
ActionType.READ
|
|
205
|
+
];
|
|
206
|
+
|
|
207
|
+
// ../commons/src/events/ActionStatus.ts
|
|
208
|
+
var ActionStatus = {
|
|
209
|
+
Requested: "Requested",
|
|
210
|
+
Accepted: "Accepted",
|
|
211
|
+
Rejected: "Rejected"
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// ../commons/src/events/Flag.ts
|
|
215
|
+
var z6 = __toESM(require("zod/v4"));
|
|
216
|
+
|
|
217
|
+
// ../commons/src/events/TranslationConfig.ts
|
|
218
|
+
var z4 = __toESM(require("zod/v4"));
|
|
219
|
+
var TranslationConfig = z4.object({
|
|
220
|
+
id: z4.string().describe(
|
|
221
|
+
"The identifier of the translation referred in translation CSV files"
|
|
222
|
+
),
|
|
223
|
+
defaultMessage: z4.string().describe("Default translation message"),
|
|
224
|
+
description: z4.string().describe(
|
|
225
|
+
"Describe the translation for a translator to be able to identify it."
|
|
226
|
+
)
|
|
227
|
+
}).meta({
|
|
228
|
+
description: "Translation configuration",
|
|
229
|
+
id: "TranslationConfig"
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
// ../commons/src/events/Conditional.ts
|
|
233
|
+
var z5 = __toESM(require("zod/v4"));
|
|
234
|
+
var Conditional = z5.any().describe("JSONSchema").meta({
|
|
235
|
+
description: "JSON schema conditional configuration",
|
|
236
|
+
id: "Conditional"
|
|
237
|
+
});
|
|
238
|
+
var ConditionalType = {
|
|
239
|
+
SHOW: "SHOW",
|
|
240
|
+
ENABLE: "ENABLE",
|
|
241
|
+
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
242
|
+
};
|
|
243
|
+
var ShowConditional = z5.object({
|
|
244
|
+
type: z5.literal(ConditionalType.SHOW),
|
|
245
|
+
conditional: Conditional
|
|
246
|
+
}).describe(
|
|
247
|
+
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
248
|
+
);
|
|
249
|
+
var EnableConditional = z5.object({
|
|
250
|
+
type: z5.literal(ConditionalType.ENABLE),
|
|
251
|
+
conditional: Conditional
|
|
252
|
+
}).describe(
|
|
253
|
+
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
254
|
+
);
|
|
255
|
+
var ActionConditional = z5.discriminatedUnion("type", [
|
|
256
|
+
// Action can be shown / hidden
|
|
257
|
+
ShowConditional,
|
|
258
|
+
// Action can be shown to the user in the list but as disabled
|
|
259
|
+
EnableConditional
|
|
260
|
+
]).meta({
|
|
261
|
+
id: "ActionConditional",
|
|
262
|
+
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."
|
|
263
|
+
});
|
|
264
|
+
var DisplayOnReviewConditional = z5.object({
|
|
265
|
+
type: z5.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
266
|
+
conditional: Conditional
|
|
267
|
+
}).describe(
|
|
268
|
+
"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."
|
|
269
|
+
);
|
|
270
|
+
var FieldConditional = z5.discriminatedUnion("type", [
|
|
271
|
+
// Field input can be shown / hidden
|
|
272
|
+
ShowConditional,
|
|
273
|
+
// Field input can be shown to the user but as disabled
|
|
274
|
+
EnableConditional,
|
|
275
|
+
// Field output can be shown / hidden on the review page
|
|
276
|
+
DisplayOnReviewConditional
|
|
277
|
+
]).meta({
|
|
278
|
+
id: "FieldConditional",
|
|
279
|
+
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."
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// ../commons/src/events/Flag.ts
|
|
283
|
+
var InherentFlags = {
|
|
284
|
+
INCOMPLETE: "incomplete",
|
|
285
|
+
REJECTED: "rejected",
|
|
286
|
+
CORRECTION_REQUESTED: "correction-requested",
|
|
287
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
288
|
+
/**
|
|
289
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
290
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
291
|
+
*
|
|
292
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
293
|
+
*/
|
|
294
|
+
EDIT_IN_PROGRESS: "edit-in-progress",
|
|
295
|
+
SEALED: "sealed"
|
|
296
|
+
};
|
|
297
|
+
var actionFlagPattern;
|
|
298
|
+
function getActionFlagPattern() {
|
|
299
|
+
actionFlagPattern ??= new RegExp(
|
|
300
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
301
|
+
ActionStatus
|
|
302
|
+
).join("|").toLowerCase()})$`
|
|
303
|
+
);
|
|
304
|
+
return actionFlagPattern;
|
|
305
|
+
}
|
|
306
|
+
var ActionFlag = z6.string().refine((value) => getActionFlagPattern().test(value), {
|
|
307
|
+
message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
308
|
+
});
|
|
309
|
+
var CustomFlag = z6.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
310
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
311
|
+
InherentFlags
|
|
312
|
+
).join(", ")}`
|
|
313
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
314
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
315
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
316
|
+
var Flag = ActionFlag.or(z6.enum(InherentFlags)).or(CustomFlag);
|
|
317
|
+
var ContainsFlags = z6.object({
|
|
318
|
+
anyOf: z6.array(Flag).optional(),
|
|
319
|
+
noneOf: z6.array(Flag).optional(),
|
|
320
|
+
allOf: z6.array(Flag).optional()
|
|
321
|
+
}).meta({
|
|
322
|
+
id: "ContainsFlags"
|
|
323
|
+
});
|
|
324
|
+
var FlagConfig = z6.object({
|
|
325
|
+
id: CustomFlag,
|
|
326
|
+
requiresAction: z6.boolean().describe(
|
|
327
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
328
|
+
),
|
|
329
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
330
|
+
}).meta({
|
|
331
|
+
id: "FlagConfig",
|
|
332
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
333
|
+
});
|
|
334
|
+
var ActionFlagConfig = z6.object({
|
|
335
|
+
id: Flag,
|
|
336
|
+
operation: z6.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
337
|
+
conditional: Conditional.optional().describe(
|
|
338
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
339
|
+
)
|
|
340
|
+
}).meta({
|
|
341
|
+
id: "ActionFlagConfig",
|
|
342
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
343
|
+
});
|
|
344
|
+
|
|
99
345
|
// ../commons/src/scopes.ts
|
|
100
|
-
var JurisdictionFilter =
|
|
346
|
+
var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
|
|
101
347
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
102
348
|
);
|
|
103
|
-
var UserFilter =
|
|
104
|
-
var RecordScopeTypeV2 =
|
|
349
|
+
var UserFilter = z7.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
350
|
+
var RecordScopeTypeV2 = z7.enum([
|
|
105
351
|
"record.search",
|
|
106
352
|
"record.create",
|
|
107
353
|
"record.read",
|
|
@@ -110,6 +356,7 @@ var RecordScopeTypeV2 = z3.enum([
|
|
|
110
356
|
"record.edit",
|
|
111
357
|
"record.reject",
|
|
112
358
|
"record.archive",
|
|
359
|
+
"record.unarchive",
|
|
113
360
|
"record.review-duplicates",
|
|
114
361
|
"record.register",
|
|
115
362
|
"record.print-certified-copies",
|
|
@@ -118,7 +365,7 @@ var RecordScopeTypeV2 = z3.enum([
|
|
|
118
365
|
"record.unassign-others",
|
|
119
366
|
"record.custom-action"
|
|
120
367
|
]);
|
|
121
|
-
var PlainScopeType =
|
|
368
|
+
var PlainScopeType = z7.enum([
|
|
122
369
|
// Misc. system scopes
|
|
123
370
|
"bypassratelimit",
|
|
124
371
|
"record.reindex",
|
|
@@ -137,15 +384,15 @@ var PlainScopeType = z3.enum([
|
|
|
137
384
|
"record.confirm-registration",
|
|
138
385
|
"record.reject-registration"
|
|
139
386
|
]);
|
|
140
|
-
var scopeByEvent =
|
|
387
|
+
var scopeByEvent = z7.preprocess(
|
|
141
388
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
142
|
-
|
|
389
|
+
z7.array(z7.string()).optional()
|
|
143
390
|
).describe("Event type, e.g. birth, death");
|
|
144
|
-
var userRole =
|
|
391
|
+
var userRole = z7.preprocess(
|
|
145
392
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
146
|
-
|
|
393
|
+
z7.array(z7.string()).optional()
|
|
147
394
|
).describe("User role, e.g. admin, field agent");
|
|
148
|
-
var scopeOptionsPlaceEvent =
|
|
395
|
+
var scopeOptionsPlaceEvent = z7.object({
|
|
149
396
|
event: scopeByEvent,
|
|
150
397
|
placeOfEvent: JurisdictionFilter.optional()
|
|
151
398
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -157,36 +404,37 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
157
404
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
158
405
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
159
406
|
registeredIn: JurisdictionFilter.optional(),
|
|
160
|
-
registeredBy: UserFilter.optional()
|
|
407
|
+
registeredBy: UserFilter.optional(),
|
|
408
|
+
flags: ContainsFlags.optional()
|
|
161
409
|
}).describe(
|
|
162
410
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
163
411
|
);
|
|
164
412
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
165
|
-
customActionTypes:
|
|
413
|
+
customActionTypes: z7.preprocess(
|
|
166
414
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
167
|
-
|
|
415
|
+
z7.array(z7.string()).optional()
|
|
168
416
|
).describe("Allowed custom action types")
|
|
169
417
|
});
|
|
170
|
-
var AccessLevelOptions =
|
|
418
|
+
var AccessLevelOptions = z7.object({
|
|
171
419
|
accessLevel: JurisdictionFilter.optional()
|
|
172
420
|
});
|
|
173
421
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
174
422
|
role: userRole.optional()
|
|
175
423
|
});
|
|
176
|
-
var WorkqueueOrDashboardOptions =
|
|
177
|
-
ids:
|
|
424
|
+
var WorkqueueOrDashboardOptions = z7.object({
|
|
425
|
+
ids: z7.preprocess(
|
|
178
426
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
179
|
-
|
|
427
|
+
z7.array(z7.string())
|
|
180
428
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
181
429
|
});
|
|
182
|
-
var AllScopeOptions =
|
|
430
|
+
var AllScopeOptions = z7.object({
|
|
183
431
|
...AllRecordScopeOptions.shape,
|
|
184
432
|
...AccessLevelOptions.shape,
|
|
185
433
|
...AllUserScopeOptions.shape,
|
|
186
434
|
...WorkqueueOrDashboardOptions.shape
|
|
187
435
|
});
|
|
188
436
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
189
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
437
|
+
var ResolvedScopeOptionsPlaceEvent = z7.object({
|
|
190
438
|
event: scopeByEvent,
|
|
191
439
|
placeOfEvent: UUID.nullish()
|
|
192
440
|
}).describe(
|
|
@@ -194,15 +442,16 @@ var ResolvedScopeOptionsPlaceEvent = z3.object({
|
|
|
194
442
|
);
|
|
195
443
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
196
444
|
notifiedIn: UUID.nullish(),
|
|
197
|
-
notifiedBy:
|
|
445
|
+
notifiedBy: z7.string().optional(),
|
|
198
446
|
declaredIn: UUID.nullish(),
|
|
199
|
-
declaredBy:
|
|
447
|
+
declaredBy: z7.string().optional()
|
|
200
448
|
}).describe(
|
|
201
449
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
202
450
|
);
|
|
203
451
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
204
452
|
registeredIn: UUID.nullish(),
|
|
205
|
-
registeredBy:
|
|
453
|
+
registeredBy: z7.string().optional(),
|
|
454
|
+
flags: ContainsFlags.optional()
|
|
206
455
|
}).describe(
|
|
207
456
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
208
457
|
);
|
|
@@ -215,6 +464,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
215
464
|
"record.edit",
|
|
216
465
|
"record.reject",
|
|
217
466
|
"record.archive",
|
|
467
|
+
"record.unarchive",
|
|
218
468
|
"record.review-duplicates",
|
|
219
469
|
"record.register"
|
|
220
470
|
]);
|
|
@@ -226,38 +476,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
226
476
|
"record.unassign-others"
|
|
227
477
|
]);
|
|
228
478
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
229
|
-
templates:
|
|
479
|
+
templates: z7.preprocess(
|
|
230
480
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
231
|
-
|
|
481
|
+
z7.array(z7.string()).optional()
|
|
232
482
|
).describe(
|
|
233
483
|
"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."
|
|
234
484
|
)
|
|
235
485
|
});
|
|
236
|
-
var RecordScopeV2 =
|
|
237
|
-
|
|
486
|
+
var RecordScopeV2 = z7.discriminatedUnion("type", [
|
|
487
|
+
z7.object({
|
|
238
488
|
type: ScopesWithPlaceEventOptions,
|
|
239
489
|
options: scopeOptionsPlaceEvent.optional()
|
|
240
490
|
}),
|
|
241
|
-
|
|
491
|
+
z7.object({
|
|
242
492
|
type: ScopesWithDeclaredOptions,
|
|
243
493
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
244
494
|
}),
|
|
245
|
-
|
|
495
|
+
z7.object({
|
|
246
496
|
type: ScopesWithFullOptions,
|
|
247
497
|
options: AllRecordScopeOptions.optional()
|
|
248
498
|
}),
|
|
249
|
-
|
|
250
|
-
type:
|
|
499
|
+
z7.object({
|
|
500
|
+
type: z7.literal("record.custom-action"),
|
|
251
501
|
options: CustomActionScopeOptions.optional()
|
|
252
502
|
}),
|
|
253
|
-
|
|
254
|
-
type:
|
|
503
|
+
z7.object({
|
|
504
|
+
type: z7.literal("record.print-certified-copies"),
|
|
255
505
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
256
506
|
})
|
|
257
507
|
]).describe(
|
|
258
508
|
"Scopes used to check user's permission to perform actions on a record."
|
|
259
509
|
);
|
|
260
|
-
var SystemScopeType =
|
|
510
|
+
var SystemScopeType = z7.enum([
|
|
261
511
|
"organisation.read-locations",
|
|
262
512
|
"user.read",
|
|
263
513
|
"user.create",
|
|
@@ -271,12 +521,12 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
271
521
|
"user.search"
|
|
272
522
|
]);
|
|
273
523
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
274
|
-
var UserScopeV2 =
|
|
275
|
-
|
|
524
|
+
var UserScopeV2 = z7.discriminatedUnion("type", [
|
|
525
|
+
z7.object({
|
|
276
526
|
type: ScopesWithRoleOption,
|
|
277
527
|
options: AllUserScopeOptions.optional()
|
|
278
528
|
}),
|
|
279
|
-
|
|
529
|
+
z7.object({
|
|
280
530
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
281
531
|
options: AccessLevelOptions.optional()
|
|
282
532
|
})
|
|
@@ -296,44 +546,44 @@ function scopeUsesPrintCertifiedCopiesOptions(scope) {
|
|
|
296
546
|
function isCustomActionScope(scope) {
|
|
297
547
|
return scope.type === "record.custom-action";
|
|
298
548
|
}
|
|
299
|
-
var ResolvedRecordScopeV2 =
|
|
300
|
-
|
|
549
|
+
var ResolvedRecordScopeV2 = z7.discriminatedUnion("type", [
|
|
550
|
+
z7.object({
|
|
301
551
|
type: ScopesWithPlaceEventOptions,
|
|
302
552
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
303
553
|
}),
|
|
304
|
-
|
|
554
|
+
z7.object({
|
|
305
555
|
type: ScopesWithDeclaredOptions,
|
|
306
556
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
307
557
|
}),
|
|
308
|
-
|
|
558
|
+
z7.object({
|
|
309
559
|
type: ScopesWithFullOptions,
|
|
310
560
|
options: ResolvedScopeOptionsFull.optional()
|
|
311
561
|
}),
|
|
312
|
-
|
|
313
|
-
type:
|
|
562
|
+
z7.object({
|
|
563
|
+
type: z7.literal("record.print-certified-copies"),
|
|
314
564
|
options: ResolvedScopeOptionsFull.extend({
|
|
315
|
-
templates:
|
|
565
|
+
templates: z7.array(z7.string()).optional()
|
|
316
566
|
}).optional()
|
|
317
567
|
})
|
|
318
568
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
319
|
-
var Scope2 =
|
|
320
|
-
|
|
569
|
+
var Scope2 = z7.discriminatedUnion("type", [
|
|
570
|
+
z7.object({ type: PlainScopeType }),
|
|
321
571
|
...RecordScopeV2.options,
|
|
322
572
|
...UserScopeV2.options,
|
|
323
|
-
|
|
324
|
-
type:
|
|
573
|
+
z7.object({
|
|
574
|
+
type: z7.literal("organisation.read-locations"),
|
|
325
575
|
options: AccessLevelOptions.optional()
|
|
326
576
|
}),
|
|
327
|
-
|
|
328
|
-
type:
|
|
577
|
+
z7.object({
|
|
578
|
+
type: z7.literal("workqueue"),
|
|
329
579
|
options: WorkqueueOrDashboardOptions
|
|
330
580
|
}),
|
|
331
|
-
|
|
332
|
-
type:
|
|
581
|
+
z7.object({
|
|
582
|
+
type: z7.literal("dashboard.view"),
|
|
333
583
|
options: WorkqueueOrDashboardOptions
|
|
334
584
|
})
|
|
335
585
|
]);
|
|
336
|
-
var ScopeType2 =
|
|
586
|
+
var ScopeType2 = z7.enum([
|
|
337
587
|
...SystemScopeType.options,
|
|
338
588
|
...RecordScopeTypeV2.options,
|
|
339
589
|
...PlainScopeType.options,
|
|
@@ -348,11 +598,12 @@ var unflattenScope = (input) => {
|
|
|
348
598
|
const { type, ...options } = input;
|
|
349
599
|
return { type, options };
|
|
350
600
|
};
|
|
351
|
-
var EncodedScope2 =
|
|
601
|
+
var EncodedScope2 = z7.string().brand("EncodedScope");
|
|
352
602
|
var encodeScope = (scope) => {
|
|
353
603
|
const flattened = flattenScope(scope);
|
|
354
604
|
return qs.stringify(flattened, {
|
|
355
605
|
arrayFormat: "comma",
|
|
606
|
+
commaRoundTrip: true,
|
|
356
607
|
allowDots: true,
|
|
357
608
|
addQueryPrefix: false,
|
|
358
609
|
encode: false
|
|
@@ -434,4 +685,4 @@ function defineRoles(roles) {
|
|
|
434
685
|
}
|
|
435
686
|
|
|
436
687
|
// src/scopes/index.ts
|
|
437
|
-
|
|
688
|
+
z8.globalRegistry.clear();
|
|
@@ -36,10 +36,6 @@ minio:
|
|
|
36
36
|
auth_mode: use_secret
|
|
37
37
|
host: minio-0.minio.opencrvs-deps-{{env}}.svc.cluster.local
|
|
38
38
|
|
|
39
|
-
mongodb:
|
|
40
|
-
auth_mode: auto
|
|
41
|
-
host: mongodb-0.mongodb.opencrvs-deps-{{env}}.svc.cluster.local
|
|
42
|
-
|
|
43
39
|
redis:
|
|
44
40
|
auth_mode: use_secret
|
|
45
41
|
host: redis-0.redis.opencrvs-deps-{{env}}.svc.cluster.local
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencrvs/toolkit",
|
|
3
|
-
"version": "2.1.0-rc.
|
|
3
|
+
"version": "2.1.0-rc.b061691",
|
|
4
4
|
"description": "OpenCRVS toolkit for building country configurations",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"bin": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"ajv-formats": "^3.0.1",
|
|
34
34
|
"date-fns": "^2.28.0",
|
|
35
35
|
"dotenv": "^16.4.5",
|
|
36
|
-
"glob": "11.0
|
|
36
|
+
"glob": "11.1.0",
|
|
37
37
|
"handlebars": "^4.7.8",
|
|
38
38
|
"js-yaml": "4.1.0",
|
|
39
39
|
"jwt-decode": "^3.0.0",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@types/ssh2": "^1.15.5",
|
|
60
60
|
"@types/uuid": "^9.0.3",
|
|
61
61
|
"esbuild": "^0.24.0",
|
|
62
|
-
"typescript": "
|
|
62
|
+
"typescript": "6.0.3"
|
|
63
63
|
},
|
|
64
64
|
"moduleNameMapper": {
|
|
65
65
|
"@opencrvs/commons/events": "@opencrvs/commons/build/dist/common/events/index.js",
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/environment/custom-types.ts","./src/environment/derived-variables.ts","./src/environment/editor-questions.ts","./src/environment/git.ts","./src/environment/github.ts","./src/environment/index.ts","./src/environment/logger.ts","./src/environment/manage-users.ts","./src/environment/questions-helper.ts","./src/environment/questions.ts","./src/environment/setup-environment.ts","./src/environment/ssh-keygen.ts","./src/environment/swarm-to-k8s.ts","./src/environment/templates.ts","./src/environment/update-workflows.ts","./src/environment/users.ts","./src/environment/utils.ts","./src/events/deduplication.ts","./src/events/index.ts","./src/migrations/v2.0/add-birth-certificate-issuance-flag.ts","./src/migrations/v2.0/add-resend-invite-notification.ts","./src/migrations/v2.0/checkout-upstream-files.ts","./src/migrations/v2.0/convert-config-files-to-ts.ts","./src/migrations/v2.0/convert-paragraph-to-heading.ts","./src/migrations/v2.0/create-events-index.ts","./src/migrations/v2.0/delete-infrastructure-directory.ts","./src/migrations/v2.0/fix-accept-requested-registration-function-type.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/merge-infrastructure-directory.ts","./src/migrations/v2.0/migrate-application-config-url.ts","./src/migrations/v2.0/migrate-scopes.ts","./src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts","./src/migrations/v2.0/migrate-workqueue-configs.ts","./src/migrations/v2.0/remove-delete-actions.ts","./src/migrations/v2.0/remove-demo-scope.ts","./src/migrations/v2.0/remove-deprecated-imports.ts","./src/migrations/v2.0/remove-fhir-url-helpers.ts","./src/migrations/v2.0/remove-hearth-migrations.ts","./src/migrations/v2.0/remove-old-statistics-service.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/remove-unused-environment-variables.ts","./src/migrations/v2.0/rename-api-paths.ts","./src/migrations/v2.0/rename-location-parent-id.ts","./src/migrations/v2.0/simplify-analytics-precalculations.ts","./src/migrations/v2.0/update-package-json.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"
|
|
1
|
+
{"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/environment/custom-types.ts","./src/environment/derived-variables.ts","./src/environment/editor-questions.ts","./src/environment/git.ts","./src/environment/github.ts","./src/environment/index.ts","./src/environment/logger.ts","./src/environment/manage-users.ts","./src/environment/questions-helper.ts","./src/environment/questions.ts","./src/environment/setup-environment.ts","./src/environment/ssh-keygen.ts","./src/environment/swarm-to-k8s.ts","./src/environment/templates.ts","./src/environment/update-workflows.ts","./src/environment/users.ts","./src/environment/utils.ts","./src/events/deduplication.ts","./src/events/index.ts","./src/migrations/v2.0/add-birth-certificate-issuance-flag.ts","./src/migrations/v2.0/add-resend-invite-notification.ts","./src/migrations/v2.0/checkout-upstream-files.ts","./src/migrations/v2.0/convert-config-files-to-ts.ts","./src/migrations/v2.0/convert-paragraph-to-heading.ts","./src/migrations/v2.0/create-events-index.ts","./src/migrations/v2.0/delete-infrastructure-directory.ts","./src/migrations/v2.0/fix-accept-requested-registration-function-type.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/merge-infrastructure-directory.ts","./src/migrations/v2.0/migrate-application-config-url.ts","./src/migrations/v2.0/migrate-scopes.ts","./src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts","./src/migrations/v2.0/migrate-workqueue-configs.ts","./src/migrations/v2.0/remove-delete-actions.ts","./src/migrations/v2.0/remove-demo-scope.ts","./src/migrations/v2.0/remove-deprecated-imports.ts","./src/migrations/v2.0/remove-fhir-url-helpers.ts","./src/migrations/v2.0/remove-hearth-migrations.ts","./src/migrations/v2.0/remove-old-statistics-service.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/remove-unused-environment-variables.ts","./src/migrations/v2.0/rename-api-paths.ts","./src/migrations/v2.0/rename-location-parent-id.ts","./src/migrations/v2.0/simplify-analytics-precalculations.ts","./src/migrations/v2.0/update-package-json.ts","./src/migrations/v2.1/add-explicit-correction-flags.ts","./src/migrations/v2.1/index.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"6.0.3"}
|
|
Binary file
|