@opencrvs/toolkit 2.1.0-rc.ecb508d → 2.1.0-rc.f29a266
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 +1 -0
- package/create-countryconfig/index.js +114 -66
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +254 -197
- package/dist/cli.js +195 -73
- package/dist/commons/api/router.d.ts +672 -57
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +16 -5
- package/dist/commons/events/ActionDocument.d.ts +5 -11
- package/dist/commons/events/ActionInput.d.ts +4 -4
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +18 -0
- package/dist/commons/events/AuditLog.d.ts +147 -0
- package/dist/commons/events/EventConfig.d.ts +3 -0
- package/dist/commons/events/EventDocument.d.ts +2 -2
- package/dist/commons/events/EventIndex.d.ts +3 -26
- package/dist/commons/events/FieldConfig.d.ts +83 -53
- package/dist/commons/events/FieldTypeMapping.d.ts +19 -19
- package/dist/commons/events/FieldValue.d.ts +2 -2
- package/dist/commons/events/Flag.d.ts +42 -0
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +17 -14
- package/dist/commons/events/event.d.ts +12 -0
- 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 +163 -24
- package/dist/commons/events/mocks.test.utils.d.ts +30 -0
- package/dist/commons/events/test.utils.d.ts +8 -4
- package/dist/commons/events/utils.d.ts +2 -2
- package/dist/commons/notification/UserNotifications.d.ts +28 -0
- package/dist/conditionals/index.js +308 -55
- package/dist/environment/index.d.ts +1 -0
- package/dist/environment/index.d.ts.map +1 -1
- package/dist/environment/index.js +10 -0
- package/dist/environment/logger.d.ts +12 -3
- package/dist/environment/logger.d.ts.map +1 -1
- 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.d.ts.map +1 -1
- package/dist/environment/questions.js +20 -14
- package/dist/environment/setup-environment.js +3 -2
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +2 -1
- package/dist/environment/update-workflows.d.ts.map +1 -1
- package/dist/environment/update-workflows.js +17 -5
- 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.js +11 -13
- package/dist/events/index.js +3621 -3243
- 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/notification/index.js +1400 -1033
- package/dist/scopes/index.d.ts +253 -26
- package/dist/scopes/index.js +309 -55
- package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
- package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
- package/dist/templates/charts-values/traefik/values.yaml +23 -9
- package/dist/templates/inventory/inventory.template.yml +1 -3
- package/opencrvs-toolkit-2.1.0-rc.f29a266.tgz +0 -0
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/templates/inventory/production.example.yml +0 -77
- package/dist/templates/inventory/qa.example.yml +0 -48
- package/opencrvs-toolkit-2.1.0-rc.ecb508d.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,257 @@ 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
|
+
};
|
|
296
|
+
var actionFlagPattern;
|
|
297
|
+
function getActionFlagPattern() {
|
|
298
|
+
actionFlagPattern ??= new RegExp(
|
|
299
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
300
|
+
ActionStatus
|
|
301
|
+
).join("|").toLowerCase()})$`
|
|
302
|
+
);
|
|
303
|
+
return actionFlagPattern;
|
|
304
|
+
}
|
|
305
|
+
var ActionFlag = z6.string().refine((value) => getActionFlagPattern().test(value), {
|
|
306
|
+
message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
307
|
+
});
|
|
308
|
+
var CustomFlag = z6.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
309
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
310
|
+
InherentFlags
|
|
311
|
+
).join(", ")}`
|
|
312
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
313
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
314
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
315
|
+
var Flag = ActionFlag.or(z6.enum(InherentFlags)).or(CustomFlag);
|
|
316
|
+
var ContainsFlags = z6.object({
|
|
317
|
+
anyOf: z6.array(Flag).optional(),
|
|
318
|
+
noneOf: z6.array(Flag).optional(),
|
|
319
|
+
allOf: z6.array(Flag).optional()
|
|
320
|
+
}).meta({
|
|
321
|
+
id: "ContainsFlags"
|
|
322
|
+
});
|
|
323
|
+
var FlagConfig = z6.object({
|
|
324
|
+
id: CustomFlag,
|
|
325
|
+
requiresAction: z6.boolean().describe(
|
|
326
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
327
|
+
),
|
|
328
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
329
|
+
}).meta({
|
|
330
|
+
id: "FlagConfig",
|
|
331
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
332
|
+
});
|
|
333
|
+
var ActionFlagConfig = z6.object({
|
|
334
|
+
id: Flag,
|
|
335
|
+
operation: z6.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
336
|
+
conditional: Conditional.optional().describe(
|
|
337
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
338
|
+
)
|
|
339
|
+
}).meta({
|
|
340
|
+
id: "ActionFlagConfig",
|
|
341
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
342
|
+
});
|
|
343
|
+
|
|
99
344
|
// ../commons/src/scopes.ts
|
|
100
|
-
var JurisdictionFilter =
|
|
345
|
+
var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
|
|
101
346
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
102
347
|
);
|
|
103
|
-
var UserFilter =
|
|
104
|
-
var RecordScopeTypeV2 =
|
|
348
|
+
var UserFilter = z7.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
349
|
+
var RecordScopeTypeV2 = z7.enum([
|
|
105
350
|
"record.search",
|
|
106
351
|
"record.create",
|
|
107
352
|
"record.read",
|
|
@@ -119,14 +364,20 @@ var RecordScopeTypeV2 = z3.enum([
|
|
|
119
364
|
"record.unassign-others",
|
|
120
365
|
"record.custom-action"
|
|
121
366
|
]);
|
|
122
|
-
var PlainScopeType =
|
|
367
|
+
var PlainScopeType = z7.enum([
|
|
123
368
|
// Misc. system scopes
|
|
124
369
|
"bypassratelimit",
|
|
125
370
|
"record.reindex",
|
|
126
371
|
"user.data-seeding",
|
|
127
372
|
"integration.create",
|
|
373
|
+
// Reading an integration's audit log. Deliberately separate from
|
|
374
|
+
// 'integration.create' so read-only oversight can be granted on its own, and
|
|
375
|
+
// deliberately option-less: system clients have no office and no
|
|
376
|
+
// administrative area, so jurisdiction options would have nothing to bind to.
|
|
377
|
+
"integration.audit.read",
|
|
128
378
|
"record.import",
|
|
129
379
|
"config.update-all",
|
|
380
|
+
"location.edit",
|
|
130
381
|
"attachment.upload",
|
|
131
382
|
"profile.electronic-signature",
|
|
132
383
|
"user.read-only-my-audit",
|
|
@@ -138,15 +389,15 @@ var PlainScopeType = z3.enum([
|
|
|
138
389
|
"record.confirm-registration",
|
|
139
390
|
"record.reject-registration"
|
|
140
391
|
]);
|
|
141
|
-
var scopeByEvent =
|
|
392
|
+
var scopeByEvent = z7.preprocess(
|
|
142
393
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
143
|
-
|
|
394
|
+
z7.array(z7.string()).optional()
|
|
144
395
|
).describe("Event type, e.g. birth, death");
|
|
145
|
-
var userRole =
|
|
396
|
+
var userRole = z7.preprocess(
|
|
146
397
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
147
|
-
|
|
398
|
+
z7.array(z7.string()).optional()
|
|
148
399
|
).describe("User role, e.g. admin, field agent");
|
|
149
|
-
var scopeOptionsPlaceEvent =
|
|
400
|
+
var scopeOptionsPlaceEvent = z7.object({
|
|
150
401
|
event: scopeByEvent,
|
|
151
402
|
placeOfEvent: JurisdictionFilter.optional()
|
|
152
403
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -158,36 +409,37 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
158
409
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
159
410
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
160
411
|
registeredIn: JurisdictionFilter.optional(),
|
|
161
|
-
registeredBy: UserFilter.optional()
|
|
412
|
+
registeredBy: UserFilter.optional(),
|
|
413
|
+
flags: ContainsFlags.optional()
|
|
162
414
|
}).describe(
|
|
163
415
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
164
416
|
);
|
|
165
417
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
166
|
-
customActionTypes:
|
|
418
|
+
customActionTypes: z7.preprocess(
|
|
167
419
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
168
|
-
|
|
420
|
+
z7.array(z7.string()).optional()
|
|
169
421
|
).describe("Allowed custom action types")
|
|
170
422
|
});
|
|
171
|
-
var AccessLevelOptions =
|
|
423
|
+
var AccessLevelOptions = z7.object({
|
|
172
424
|
accessLevel: JurisdictionFilter.optional()
|
|
173
425
|
});
|
|
174
426
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
175
427
|
role: userRole.optional()
|
|
176
428
|
});
|
|
177
|
-
var WorkqueueOrDashboardOptions =
|
|
178
|
-
ids:
|
|
429
|
+
var WorkqueueOrDashboardOptions = z7.object({
|
|
430
|
+
ids: z7.preprocess(
|
|
179
431
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
180
|
-
|
|
432
|
+
z7.array(z7.string())
|
|
181
433
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
182
434
|
});
|
|
183
|
-
var AllScopeOptions =
|
|
435
|
+
var AllScopeOptions = z7.object({
|
|
184
436
|
...AllRecordScopeOptions.shape,
|
|
185
437
|
...AccessLevelOptions.shape,
|
|
186
438
|
...AllUserScopeOptions.shape,
|
|
187
439
|
...WorkqueueOrDashboardOptions.shape
|
|
188
440
|
});
|
|
189
441
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
190
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
442
|
+
var ResolvedScopeOptionsPlaceEvent = z7.object({
|
|
191
443
|
event: scopeByEvent,
|
|
192
444
|
placeOfEvent: UUID.nullish()
|
|
193
445
|
}).describe(
|
|
@@ -195,15 +447,16 @@ var ResolvedScopeOptionsPlaceEvent = z3.object({
|
|
|
195
447
|
);
|
|
196
448
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
197
449
|
notifiedIn: UUID.nullish(),
|
|
198
|
-
notifiedBy:
|
|
450
|
+
notifiedBy: z7.string().optional(),
|
|
199
451
|
declaredIn: UUID.nullish(),
|
|
200
|
-
declaredBy:
|
|
452
|
+
declaredBy: z7.string().optional()
|
|
201
453
|
}).describe(
|
|
202
454
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
203
455
|
);
|
|
204
456
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
205
457
|
registeredIn: UUID.nullish(),
|
|
206
|
-
registeredBy:
|
|
458
|
+
registeredBy: z7.string().optional(),
|
|
459
|
+
flags: ContainsFlags.optional()
|
|
207
460
|
}).describe(
|
|
208
461
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
209
462
|
);
|
|
@@ -228,38 +481,38 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
228
481
|
"record.unassign-others"
|
|
229
482
|
]);
|
|
230
483
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
231
|
-
templates:
|
|
484
|
+
templates: z7.preprocess(
|
|
232
485
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
233
|
-
|
|
486
|
+
z7.array(z7.string()).optional()
|
|
234
487
|
).describe(
|
|
235
488
|
"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."
|
|
236
489
|
)
|
|
237
490
|
});
|
|
238
|
-
var RecordScopeV2 =
|
|
239
|
-
|
|
491
|
+
var RecordScopeV2 = z7.discriminatedUnion("type", [
|
|
492
|
+
z7.object({
|
|
240
493
|
type: ScopesWithPlaceEventOptions,
|
|
241
494
|
options: scopeOptionsPlaceEvent.optional()
|
|
242
495
|
}),
|
|
243
|
-
|
|
496
|
+
z7.object({
|
|
244
497
|
type: ScopesWithDeclaredOptions,
|
|
245
498
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
246
499
|
}),
|
|
247
|
-
|
|
500
|
+
z7.object({
|
|
248
501
|
type: ScopesWithFullOptions,
|
|
249
502
|
options: AllRecordScopeOptions.optional()
|
|
250
503
|
}),
|
|
251
|
-
|
|
252
|
-
type:
|
|
504
|
+
z7.object({
|
|
505
|
+
type: z7.literal("record.custom-action"),
|
|
253
506
|
options: CustomActionScopeOptions.optional()
|
|
254
507
|
}),
|
|
255
|
-
|
|
256
|
-
type:
|
|
508
|
+
z7.object({
|
|
509
|
+
type: z7.literal("record.print-certified-copies"),
|
|
257
510
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
258
511
|
})
|
|
259
512
|
]).describe(
|
|
260
513
|
"Scopes used to check user's permission to perform actions on a record."
|
|
261
514
|
);
|
|
262
|
-
var SystemScopeType =
|
|
515
|
+
var SystemScopeType = z7.enum([
|
|
263
516
|
"organisation.read-locations",
|
|
264
517
|
"user.read",
|
|
265
518
|
"user.create",
|
|
@@ -273,12 +526,12 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
273
526
|
"user.search"
|
|
274
527
|
]);
|
|
275
528
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
276
|
-
var UserScopeV2 =
|
|
277
|
-
|
|
529
|
+
var UserScopeV2 = z7.discriminatedUnion("type", [
|
|
530
|
+
z7.object({
|
|
278
531
|
type: ScopesWithRoleOption,
|
|
279
532
|
options: AllUserScopeOptions.optional()
|
|
280
533
|
}),
|
|
281
|
-
|
|
534
|
+
z7.object({
|
|
282
535
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
283
536
|
options: AccessLevelOptions.optional()
|
|
284
537
|
})
|
|
@@ -298,44 +551,44 @@ function scopeUsesPrintCertifiedCopiesOptions(scope) {
|
|
|
298
551
|
function isCustomActionScope(scope) {
|
|
299
552
|
return scope.type === "record.custom-action";
|
|
300
553
|
}
|
|
301
|
-
var ResolvedRecordScopeV2 =
|
|
302
|
-
|
|
554
|
+
var ResolvedRecordScopeV2 = z7.discriminatedUnion("type", [
|
|
555
|
+
z7.object({
|
|
303
556
|
type: ScopesWithPlaceEventOptions,
|
|
304
557
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
305
558
|
}),
|
|
306
|
-
|
|
559
|
+
z7.object({
|
|
307
560
|
type: ScopesWithDeclaredOptions,
|
|
308
561
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
309
562
|
}),
|
|
310
|
-
|
|
563
|
+
z7.object({
|
|
311
564
|
type: ScopesWithFullOptions,
|
|
312
565
|
options: ResolvedScopeOptionsFull.optional()
|
|
313
566
|
}),
|
|
314
|
-
|
|
315
|
-
type:
|
|
567
|
+
z7.object({
|
|
568
|
+
type: z7.literal("record.print-certified-copies"),
|
|
316
569
|
options: ResolvedScopeOptionsFull.extend({
|
|
317
|
-
templates:
|
|
570
|
+
templates: z7.array(z7.string()).optional()
|
|
318
571
|
}).optional()
|
|
319
572
|
})
|
|
320
573
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
321
|
-
var Scope2 =
|
|
322
|
-
|
|
574
|
+
var Scope2 = z7.discriminatedUnion("type", [
|
|
575
|
+
z7.object({ type: PlainScopeType }),
|
|
323
576
|
...RecordScopeV2.options,
|
|
324
577
|
...UserScopeV2.options,
|
|
325
|
-
|
|
326
|
-
type:
|
|
578
|
+
z7.object({
|
|
579
|
+
type: z7.literal("organisation.read-locations"),
|
|
327
580
|
options: AccessLevelOptions.optional()
|
|
328
581
|
}),
|
|
329
|
-
|
|
330
|
-
type:
|
|
582
|
+
z7.object({
|
|
583
|
+
type: z7.literal("workqueue"),
|
|
331
584
|
options: WorkqueueOrDashboardOptions
|
|
332
585
|
}),
|
|
333
|
-
|
|
334
|
-
type:
|
|
586
|
+
z7.object({
|
|
587
|
+
type: z7.literal("dashboard.view"),
|
|
335
588
|
options: WorkqueueOrDashboardOptions
|
|
336
589
|
})
|
|
337
590
|
]);
|
|
338
|
-
var ScopeType2 =
|
|
591
|
+
var ScopeType2 = z7.enum([
|
|
339
592
|
...SystemScopeType.options,
|
|
340
593
|
...RecordScopeTypeV2.options,
|
|
341
594
|
...PlainScopeType.options,
|
|
@@ -350,11 +603,12 @@ var unflattenScope = (input) => {
|
|
|
350
603
|
const { type, ...options } = input;
|
|
351
604
|
return { type, options };
|
|
352
605
|
};
|
|
353
|
-
var EncodedScope2 =
|
|
606
|
+
var EncodedScope2 = z7.string().brand("EncodedScope");
|
|
354
607
|
var encodeScope = (scope) => {
|
|
355
608
|
const flattened = flattenScope(scope);
|
|
356
609
|
return qs.stringify(flattened, {
|
|
357
610
|
arrayFormat: "comma",
|
|
611
|
+
commaRoundTrip: true,
|
|
358
612
|
allowDots: true,
|
|
359
613
|
addQueryPrefix: false,
|
|
360
614
|
encode: false
|
|
@@ -436,4 +690,4 @@ function defineRoles(roles) {
|
|
|
436
690
|
}
|
|
437
691
|
|
|
438
692
|
// src/scopes/index.ts
|
|
439
|
-
|
|
693
|
+
z8.globalRegistry.clear();
|
|
@@ -21,12 +21,13 @@ hpa:
|
|
|
21
21
|
enabled: false
|
|
22
22
|
|
|
23
23
|
env:
|
|
24
|
-
APN_SERVICE_URL: "http://apm-server.opencrvs-deps-{{env}}.svc.cluster.local:8200"
|
|
25
24
|
MINIO_BUCKET: ocrvs
|
|
26
25
|
OPENCRVS_ENVIRONMENT: {{opencrvs_environment}}
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
otel:
|
|
28
|
+
enabled: true
|
|
29
|
+
deployment_environment: {{env}}
|
|
30
|
+
exporter_otlp_endpoint: "opentelemetry-collector.opencrvs-deps-{{env}}.svc.cluster.local:4317"
|
|
30
31
|
|
|
31
32
|
elasticsearch:
|
|
32
33
|
auth_mode: auto
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
mode: deployment
|
|
2
|
+
|
|
3
|
+
image:
|
|
4
|
+
repository: otel/opentelemetry-collector-k8s
|
|
5
|
+
|
|
6
|
+
resources:
|
|
7
|
+
requests:
|
|
8
|
+
cpu: 100m
|
|
9
|
+
memory: 128Mi
|
|
10
|
+
limits:
|
|
11
|
+
cpu: 500m
|
|
12
|
+
memory: 512Mi
|
|
13
|
+
|
|
14
|
+
ports:
|
|
15
|
+
jaeger-compact:
|
|
16
|
+
enabled: false
|
|
17
|
+
jaeger-thrift:
|
|
18
|
+
enabled: false
|
|
19
|
+
jaeger-grpc:
|
|
20
|
+
enabled: false
|
|
21
|
+
zipkin:
|
|
22
|
+
enabled: false
|
|
23
|
+
|
|
24
|
+
config:
|
|
25
|
+
receivers:
|
|
26
|
+
otlp:
|
|
27
|
+
protocols:
|
|
28
|
+
grpc:
|
|
29
|
+
endpoint: ${env:MY_POD_IP}:4317
|
|
30
|
+
http:
|
|
31
|
+
endpoint: ${env:MY_POD_IP}:4318
|
|
32
|
+
prometheus: null
|
|
33
|
+
jaeger: null
|
|
34
|
+
zipkin: null
|
|
35
|
+
|
|
36
|
+
exporters:
|
|
37
|
+
otlp/elastic:
|
|
38
|
+
endpoint: apm-server.opencrvs-deps-{{env}}.svc.cluster.local:8200
|
|
39
|
+
tls:
|
|
40
|
+
insecure: true
|
|
41
|
+
processors:
|
|
42
|
+
batch:
|
|
43
|
+
timeout: 15s
|
|
44
|
+
send_batch_size: 1024
|
|
45
|
+
|
|
46
|
+
memory_limiter:
|
|
47
|
+
check_interval: 5s
|
|
48
|
+
limit_percentage: 80
|
|
49
|
+
spike_limit_percentage: 25
|
|
50
|
+
|
|
51
|
+
transform/traces:
|
|
52
|
+
error_mode: ignore
|
|
53
|
+
trace_statements:
|
|
54
|
+
# Start with the raw path.
|
|
55
|
+
- set(span.attributes["http.route"], span.attributes["url.path"]) where resource.attributes["service.name"] == "traefik" and span.attributes["url.path"] != nil
|
|
56
|
+
|
|
57
|
+
# Match getTracePath(): collapse repeated slashes.
|
|
58
|
+
- replace_pattern(span.attributes["http.route"], "/+", "/") where resource.attributes["service.name"] == "traefik" and span.attributes["http.route"] != nil
|
|
59
|
+
|
|
60
|
+
# Match getTracePath(): replace dynamic-looking segments with "#".
|
|
61
|
+
- replace_pattern(span.attributes["http.route"], "/([^/]*\\.[^/]*|[0-9]+|[0-9a-fA-F]{24}|[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})(/|$)", "/#$$2") where resource.attributes["service.name"] == "traefik" and span.attributes["http.route"] != nil
|
|
62
|
+
|
|
63
|
+
# Concatenate Request method and normalized URL to conform same format as NodeJs.
|
|
64
|
+
- set(span.name, Concat([span.attributes["http.request.method"], span.attributes["http.route"]], " ")) where resource.attributes["service.name"] == "traefik" and span.attributes["http.request.method"] != nil and span.attributes["http.route"] != nil
|
|
65
|
+
|
|
66
|
+
# SDK language to avoid errors in Kibana on APM -> Service Inventory -> Traefik -> Metrics.
|
|
67
|
+
- delete_key(resource.attributes, "telemetry.sdk.language") where resource.attributes["service.name"] == "traefik"
|
|
68
|
+
|
|
69
|
+
# Nginx OTEL module uses older HTTP semantic convention names, so build the span name from http.method and http.route.
|
|
70
|
+
- set(span.name, Concat([span.attributes["http.method"], span.attributes["http.route"]], " ")) where (resource.attributes["service.name"] == "opencrvs_client" or resource.attributes["service.name"] == "opencrvs_login") and span.attributes["http.method"] != nil and span.attributes["http.route"] != nil
|
|
71
|
+
|
|
72
|
+
service:
|
|
73
|
+
telemetry:
|
|
74
|
+
metrics:
|
|
75
|
+
level: none
|
|
76
|
+
readers: null
|
|
77
|
+
pipelines:
|
|
78
|
+
logs: null
|
|
79
|
+
metrics:
|
|
80
|
+
receivers:
|
|
81
|
+
- otlp
|
|
82
|
+
processors:
|
|
83
|
+
- memory_limiter
|
|
84
|
+
- batch
|
|
85
|
+
exporters:
|
|
86
|
+
- otlp/elastic
|
|
87
|
+
traces:
|
|
88
|
+
receivers:
|
|
89
|
+
- otlp
|
|
90
|
+
processors:
|
|
91
|
+
- memory_limiter
|
|
92
|
+
- transform/traces
|
|
93
|
+
- batch
|
|
94
|
+
exporters:
|
|
95
|
+
- otlp/elastic
|
|
@@ -9,16 +9,28 @@
|
|
|
9
9
|
|
|
10
10
|
# Overwriting https://github.com/traefik/traefik-helm-chart/blob/master/traefik/values.yaml
|
|
11
11
|
namespaceOverride: "traefik"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
access
|
|
19
|
-
|
|
12
|
+
log:
|
|
13
|
+
# "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL", "PANIC"
|
|
14
|
+
level: "INFO"
|
|
15
|
+
# format: "common" # For local environment
|
|
16
|
+
format: "json" # For server environment
|
|
17
|
+
accessLog:
|
|
18
|
+
# -- To enable access logs
|
|
19
|
+
enabled: true
|
|
20
|
+
format: "json"
|
|
21
|
+
|
|
22
|
+
tracing:
|
|
23
|
+
serviceName: traefik
|
|
24
|
+
resourceAttributes:
|
|
25
|
+
deployment.environment.name: "{{env}}"
|
|
26
|
+
service.namespace: traefik
|
|
27
|
+
otlp:
|
|
20
28
|
enabled: true
|
|
21
|
-
|
|
29
|
+
grpc:
|
|
30
|
+
enabled: true
|
|
31
|
+
endpoint: "opentelemetry-collector.opencrvs-deps-{{env}}.svc.cluster.local:4317"
|
|
32
|
+
insecure: true
|
|
33
|
+
|
|
22
34
|
|
|
23
35
|
ingressRoute:
|
|
24
36
|
dashboard:
|
|
@@ -98,6 +110,8 @@ tlsStore:
|
|
|
98
110
|
|
|
99
111
|
deployment:
|
|
100
112
|
hostNetwork: true
|
|
113
|
+
podLabels:
|
|
114
|
+
service_name: traefik
|
|
101
115
|
{{#if static_ssl}}
|
|
102
116
|
kind: DaemonSet
|
|
103
117
|
{{/if}}
|