@opencrvs/toolkit 2.1.0-rc.d7bd264 → 2.1.0-rc.d987aec
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 +3 -12
- package/build.sh +9 -1
- package/create-countryconfig/index.js +412 -59
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +4 -1
- package/dist/application-config/index.js +266 -212
- 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 +1786 -120
- package/dist/commons/api/router.d.ts +691 -76
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/conditionals/validate.d.ts +15 -5
- package/dist/commons/events/ActionConfig.d.ts +0 -21
- package/dist/commons/events/ActionDocument.d.ts +4 -4
- package/dist/commons/events/ActionInput.d.ts +4 -4
- package/dist/commons/events/AdvancedSearchConfig.d.ts +18 -0
- package/dist/commons/events/AuditLog.d.ts +147 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -18
- package/dist/commons/events/EventConfig.d.ts +3 -0
- package/dist/commons/events/EventDocument.d.ts +470 -2
- package/dist/commons/events/EventIndex.d.ts +2 -6
- package/dist/commons/events/EventMetadata.d.ts +1 -12
- package/dist/commons/events/EventStatus.d.ts +19 -0
- package/dist/commons/events/FieldConfig.d.ts +84 -53
- package/dist/commons/events/FieldTypeMapping.d.ts +15 -15
- package/dist/commons/events/FieldValue.d.ts +2 -2
- package/dist/commons/events/Flag.d.ts +0 -6
- 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 +5 -17
- 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 +169 -26
- package/dist/commons/events/mocks.test.utils.d.ts +30 -0
- package/dist/commons/events/test.utils.d.ts +25 -4
- package/dist/commons/events/utils.d.ts +13 -2
- package/dist/commons/notification/UserNotifications.d.ts +28 -13
- package/dist/commons/notification/dispatch.d.ts +10 -0
- package/dist/commons/notification/index.d.ts +1 -0
- package/dist/conditionals/index.js +81 -59
- package/dist/csv.d.ts +25 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +120 -0
- 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 +15 -3
- package/dist/environment/logger.d.ts.map +1 -1
- package/dist/environment/manage-users.js +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 +28 -7
- package/dist/environment/templates.d.ts +0 -1
- package/dist/environment/templates.d.ts.map +1 -1
- package/dist/environment/templates.js +5 -9
- 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 +2905 -2463
- 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.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.map +1 -1
- package/dist/migrations/v2.1/index.js +1058 -0
- package/dist/notification/index.js +1317 -1475
- package/dist/scopes/index.d.ts +104 -59
- package/dist/scopes/index.js +81 -59
- 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.yaml +2 -0
- 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/dist/translations/check.d.ts +21 -0
- package/dist/translations/check.d.ts.map +1 -0
- package/dist/translations/check.js +132 -0
- package/dist/verify/endpoints.d.ts +2 -0
- package/dist/verify/endpoints.d.ts.map +1 -0
- package/dist/verify/endpoints.js +345 -0
- package/opencrvs-toolkit-2.1.0-rc.d987aec.tgz +0 -0
- package/package.json +12 -6
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- 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.d7bd264.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
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 z9 = __toESM(require("zod/v4"));
|
|
63
63
|
|
|
64
64
|
// ../commons/src/scopes.ts
|
|
65
|
-
var
|
|
65
|
+
var z8 = __toESM(require("zod/v4"));
|
|
66
66
|
var qs = __toESM(require("qs"));
|
|
67
67
|
|
|
68
68
|
// ../commons/src/uuid.ts
|
|
@@ -291,8 +291,7 @@ var InherentFlags = {
|
|
|
291
291
|
*
|
|
292
292
|
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
293
293
|
*/
|
|
294
|
-
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
295
|
-
SEALED: "sealed"
|
|
294
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
296
295
|
};
|
|
297
296
|
var actionFlagPattern;
|
|
298
297
|
function getActionFlagPattern() {
|
|
@@ -342,12 +341,22 @@ var ActionFlagConfig = z6.object({
|
|
|
342
341
|
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
343
342
|
});
|
|
344
343
|
|
|
344
|
+
// ../commons/src/events/EventStatus.ts
|
|
345
|
+
var z7 = __toESM(require("zod/v4"));
|
|
346
|
+
var EventStatus = z7.enum([
|
|
347
|
+
"CREATED",
|
|
348
|
+
"NOTIFIED",
|
|
349
|
+
"DECLARED",
|
|
350
|
+
"REGISTERED",
|
|
351
|
+
"ARCHIVED"
|
|
352
|
+
]);
|
|
353
|
+
|
|
345
354
|
// ../commons/src/scopes.ts
|
|
346
|
-
var JurisdictionFilter =
|
|
355
|
+
var JurisdictionFilter = z8.enum(["administrativeArea", "location", "all"]).describe(
|
|
347
356
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
348
357
|
);
|
|
349
|
-
var UserFilter =
|
|
350
|
-
var RecordScopeTypeV2 =
|
|
358
|
+
var UserFilter = z8.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
359
|
+
var RecordScopeTypeV2 = z8.enum([
|
|
351
360
|
"record.search",
|
|
352
361
|
"record.create",
|
|
353
362
|
"record.read",
|
|
@@ -365,14 +374,20 @@ var RecordScopeTypeV2 = z7.enum([
|
|
|
365
374
|
"record.unassign-others",
|
|
366
375
|
"record.custom-action"
|
|
367
376
|
]);
|
|
368
|
-
var PlainScopeType =
|
|
377
|
+
var PlainScopeType = z8.enum([
|
|
369
378
|
// Misc. system scopes
|
|
370
379
|
"bypassratelimit",
|
|
371
380
|
"record.reindex",
|
|
372
381
|
"user.data-seeding",
|
|
373
382
|
"integration.create",
|
|
383
|
+
// Reading an integration's audit log. Deliberately separate from
|
|
384
|
+
// 'integration.create' so read-only oversight can be granted on its own, and
|
|
385
|
+
// deliberately option-less: system clients have no office and no
|
|
386
|
+
// administrative area, so jurisdiction options would have nothing to bind to.
|
|
387
|
+
"integration.audit.read",
|
|
374
388
|
"record.import",
|
|
375
389
|
"config.update-all",
|
|
390
|
+
"location.edit",
|
|
376
391
|
"attachment.upload",
|
|
377
392
|
"profile.electronic-signature",
|
|
378
393
|
"user.read-only-my-audit",
|
|
@@ -384,15 +399,21 @@ var PlainScopeType = z7.enum([
|
|
|
384
399
|
"record.confirm-registration",
|
|
385
400
|
"record.reject-registration"
|
|
386
401
|
]);
|
|
387
|
-
var scopeByEvent =
|
|
402
|
+
var scopeByEvent = z8.preprocess(
|
|
388
403
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
389
|
-
|
|
404
|
+
z8.array(z8.string()).optional()
|
|
390
405
|
).describe("Event type, e.g. birth, death");
|
|
391
|
-
var
|
|
406
|
+
var scopeByStatus = z8.preprocess(
|
|
407
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
408
|
+
z8.array(EventStatus).optional()
|
|
409
|
+
).describe(
|
|
410
|
+
"Restricts the scope to records currently in one of these statuses."
|
|
411
|
+
);
|
|
412
|
+
var userRole = z8.preprocess(
|
|
392
413
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
393
|
-
|
|
414
|
+
z8.array(z8.string()).optional()
|
|
394
415
|
).describe("User role, e.g. admin, field agent");
|
|
395
|
-
var scopeOptionsPlaceEvent =
|
|
416
|
+
var scopeOptionsPlaceEvent = z8.object({
|
|
396
417
|
event: scopeByEvent,
|
|
397
418
|
placeOfEvent: JurisdictionFilter.optional()
|
|
398
419
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -400,7 +421,8 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
400
421
|
notifiedIn: JurisdictionFilter.optional(),
|
|
401
422
|
notifiedBy: UserFilter.optional(),
|
|
402
423
|
declaredIn: JurisdictionFilter.optional(),
|
|
403
|
-
declaredBy: UserFilter.optional()
|
|
424
|
+
declaredBy: UserFilter.optional(),
|
|
425
|
+
status: scopeByStatus
|
|
404
426
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
405
427
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
406
428
|
registeredIn: JurisdictionFilter.optional(),
|
|
@@ -410,31 +432,31 @@ var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
|
410
432
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
411
433
|
);
|
|
412
434
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
413
|
-
customActionTypes:
|
|
435
|
+
customActionTypes: z8.preprocess(
|
|
414
436
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
415
|
-
|
|
437
|
+
z8.array(z8.string()).optional()
|
|
416
438
|
).describe("Allowed custom action types")
|
|
417
439
|
});
|
|
418
|
-
var AccessLevelOptions =
|
|
440
|
+
var AccessLevelOptions = z8.object({
|
|
419
441
|
accessLevel: JurisdictionFilter.optional()
|
|
420
442
|
});
|
|
421
443
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
422
444
|
role: userRole.optional()
|
|
423
445
|
});
|
|
424
|
-
var WorkqueueOrDashboardOptions =
|
|
425
|
-
ids:
|
|
446
|
+
var WorkqueueOrDashboardOptions = z8.object({
|
|
447
|
+
ids: z8.preprocess(
|
|
426
448
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
427
|
-
|
|
449
|
+
z8.array(z8.string())
|
|
428
450
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
429
451
|
});
|
|
430
|
-
var AllScopeOptions =
|
|
452
|
+
var AllScopeOptions = z8.object({
|
|
431
453
|
...AllRecordScopeOptions.shape,
|
|
432
454
|
...AccessLevelOptions.shape,
|
|
433
455
|
...AllUserScopeOptions.shape,
|
|
434
456
|
...WorkqueueOrDashboardOptions.shape
|
|
435
457
|
});
|
|
436
458
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
437
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
459
|
+
var ResolvedScopeOptionsPlaceEvent = z8.object({
|
|
438
460
|
event: scopeByEvent,
|
|
439
461
|
placeOfEvent: UUID.nullish()
|
|
440
462
|
}).describe(
|
|
@@ -442,15 +464,15 @@ var ResolvedScopeOptionsPlaceEvent = z7.object({
|
|
|
442
464
|
);
|
|
443
465
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
444
466
|
notifiedIn: UUID.nullish(),
|
|
445
|
-
notifiedBy:
|
|
467
|
+
notifiedBy: z8.string().optional(),
|
|
446
468
|
declaredIn: UUID.nullish(),
|
|
447
|
-
declaredBy:
|
|
469
|
+
declaredBy: z8.string().optional()
|
|
448
470
|
}).describe(
|
|
449
471
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
450
472
|
);
|
|
451
473
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
452
474
|
registeredIn: UUID.nullish(),
|
|
453
|
-
registeredBy:
|
|
475
|
+
registeredBy: z8.string().optional(),
|
|
454
476
|
flags: ContainsFlags.optional()
|
|
455
477
|
}).describe(
|
|
456
478
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
@@ -465,7 +487,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
465
487
|
"record.reject",
|
|
466
488
|
"record.archive",
|
|
467
489
|
"record.unarchive",
|
|
468
|
-
"record.review-duplicates",
|
|
469
490
|
"record.register"
|
|
470
491
|
]);
|
|
471
492
|
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
@@ -473,41 +494,42 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
473
494
|
"record.read",
|
|
474
495
|
"record.request-correction",
|
|
475
496
|
"record.correct",
|
|
476
|
-
"record.unassign-others"
|
|
497
|
+
"record.unassign-others",
|
|
498
|
+
"record.review-duplicates"
|
|
477
499
|
]);
|
|
478
500
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
479
|
-
templates:
|
|
501
|
+
templates: z8.preprocess(
|
|
480
502
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
481
|
-
|
|
503
|
+
z8.array(z8.string()).optional()
|
|
482
504
|
).describe(
|
|
483
505
|
"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."
|
|
484
506
|
)
|
|
485
507
|
});
|
|
486
|
-
var RecordScopeV2 =
|
|
487
|
-
|
|
508
|
+
var RecordScopeV2 = z8.discriminatedUnion("type", [
|
|
509
|
+
z8.object({
|
|
488
510
|
type: ScopesWithPlaceEventOptions,
|
|
489
511
|
options: scopeOptionsPlaceEvent.optional()
|
|
490
512
|
}),
|
|
491
|
-
|
|
513
|
+
z8.object({
|
|
492
514
|
type: ScopesWithDeclaredOptions,
|
|
493
515
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
494
516
|
}),
|
|
495
|
-
|
|
517
|
+
z8.object({
|
|
496
518
|
type: ScopesWithFullOptions,
|
|
497
519
|
options: AllRecordScopeOptions.optional()
|
|
498
520
|
}),
|
|
499
|
-
|
|
500
|
-
type:
|
|
521
|
+
z8.object({
|
|
522
|
+
type: z8.literal("record.custom-action"),
|
|
501
523
|
options: CustomActionScopeOptions.optional()
|
|
502
524
|
}),
|
|
503
|
-
|
|
504
|
-
type:
|
|
525
|
+
z8.object({
|
|
526
|
+
type: z8.literal("record.print-certified-copies"),
|
|
505
527
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
506
528
|
})
|
|
507
529
|
]).describe(
|
|
508
530
|
"Scopes used to check user's permission to perform actions on a record."
|
|
509
531
|
);
|
|
510
|
-
var SystemScopeType =
|
|
532
|
+
var SystemScopeType = z8.enum([
|
|
511
533
|
"organisation.read-locations",
|
|
512
534
|
"user.read",
|
|
513
535
|
"user.create",
|
|
@@ -521,12 +543,12 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
521
543
|
"user.search"
|
|
522
544
|
]);
|
|
523
545
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
524
|
-
var UserScopeV2 =
|
|
525
|
-
|
|
546
|
+
var UserScopeV2 = z8.discriminatedUnion("type", [
|
|
547
|
+
z8.object({
|
|
526
548
|
type: ScopesWithRoleOption,
|
|
527
549
|
options: AllUserScopeOptions.optional()
|
|
528
550
|
}),
|
|
529
|
-
|
|
551
|
+
z8.object({
|
|
530
552
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
531
553
|
options: AccessLevelOptions.optional()
|
|
532
554
|
})
|
|
@@ -546,44 +568,44 @@ function scopeUsesPrintCertifiedCopiesOptions(scope) {
|
|
|
546
568
|
function isCustomActionScope(scope) {
|
|
547
569
|
return scope.type === "record.custom-action";
|
|
548
570
|
}
|
|
549
|
-
var ResolvedRecordScopeV2 =
|
|
550
|
-
|
|
571
|
+
var ResolvedRecordScopeV2 = z8.discriminatedUnion("type", [
|
|
572
|
+
z8.object({
|
|
551
573
|
type: ScopesWithPlaceEventOptions,
|
|
552
574
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
553
575
|
}),
|
|
554
|
-
|
|
576
|
+
z8.object({
|
|
555
577
|
type: ScopesWithDeclaredOptions,
|
|
556
578
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
557
579
|
}),
|
|
558
|
-
|
|
580
|
+
z8.object({
|
|
559
581
|
type: ScopesWithFullOptions,
|
|
560
582
|
options: ResolvedScopeOptionsFull.optional()
|
|
561
583
|
}),
|
|
562
|
-
|
|
563
|
-
type:
|
|
584
|
+
z8.object({
|
|
585
|
+
type: z8.literal("record.print-certified-copies"),
|
|
564
586
|
options: ResolvedScopeOptionsFull.extend({
|
|
565
|
-
templates:
|
|
587
|
+
templates: z8.array(z8.string()).optional()
|
|
566
588
|
}).optional()
|
|
567
589
|
})
|
|
568
590
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
569
|
-
var Scope2 =
|
|
570
|
-
|
|
591
|
+
var Scope2 = z8.discriminatedUnion("type", [
|
|
592
|
+
z8.object({ type: PlainScopeType }),
|
|
571
593
|
...RecordScopeV2.options,
|
|
572
594
|
...UserScopeV2.options,
|
|
573
|
-
|
|
574
|
-
type:
|
|
595
|
+
z8.object({
|
|
596
|
+
type: z8.literal("organisation.read-locations"),
|
|
575
597
|
options: AccessLevelOptions.optional()
|
|
576
598
|
}),
|
|
577
|
-
|
|
578
|
-
type:
|
|
599
|
+
z8.object({
|
|
600
|
+
type: z8.literal("workqueue"),
|
|
579
601
|
options: WorkqueueOrDashboardOptions
|
|
580
602
|
}),
|
|
581
|
-
|
|
582
|
-
type:
|
|
603
|
+
z8.object({
|
|
604
|
+
type: z8.literal("dashboard.view"),
|
|
583
605
|
options: WorkqueueOrDashboardOptions
|
|
584
606
|
})
|
|
585
607
|
]);
|
|
586
|
-
var ScopeType2 =
|
|
608
|
+
var ScopeType2 = z8.enum([
|
|
587
609
|
...SystemScopeType.options,
|
|
588
610
|
...RecordScopeTypeV2.options,
|
|
589
611
|
...PlainScopeType.options,
|
|
@@ -598,7 +620,7 @@ var unflattenScope = (input) => {
|
|
|
598
620
|
const { type, ...options } = input;
|
|
599
621
|
return { type, options };
|
|
600
622
|
};
|
|
601
|
-
var EncodedScope2 =
|
|
623
|
+
var EncodedScope2 = z8.string().brand("EncodedScope");
|
|
602
624
|
var encodeScope = (scope) => {
|
|
603
625
|
const flattened = flattenScope(scope);
|
|
604
626
|
return qs.stringify(flattened, {
|
|
@@ -685,4 +707,4 @@ function defineRoles(roles) {
|
|
|
685
707
|
}
|
|
686
708
|
|
|
687
709
|
// src/scopes/index.ts
|
|
688
|
-
|
|
710
|
+
z9.globalRegistry.clear();
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** A single telemetry metric value. */
|
|
2
|
+
export type TelemetryMetricValue = number | string | boolean;
|
|
3
|
+
/**
|
|
4
|
+
* The telemetry report a country configuration hands to {@link sendTelemetry}.
|
|
5
|
+
* `schema_version` is stamped by `sendTelemetry`, not by the caller.
|
|
6
|
+
*/
|
|
7
|
+
export interface TelemetryReport {
|
|
8
|
+
/** Client clock, ISO 8601. Kept stable across retries of the same report. */
|
|
9
|
+
reported_at: string;
|
|
10
|
+
/** ISO-style country code of the instance. */
|
|
11
|
+
country_code: string;
|
|
12
|
+
/** Organisation running the instance. Empty string when unset. */
|
|
13
|
+
organisation: string;
|
|
14
|
+
/** Public domain of the instance, or `null`. */
|
|
15
|
+
domain: string | null;
|
|
16
|
+
instance: {
|
|
17
|
+
application_name: string;
|
|
18
|
+
environment: string;
|
|
19
|
+
app_version?: string;
|
|
20
|
+
};
|
|
21
|
+
/** Flat map of dotted metric keys to primitive values. */
|
|
22
|
+
metrics: Record<string, TelemetryMetricValue>;
|
|
23
|
+
}
|
|
24
|
+
/** Outcome of a {@link sendTelemetry} call. */
|
|
25
|
+
export interface TelemetryResult {
|
|
26
|
+
/**
|
|
27
|
+
* How the send resolved:
|
|
28
|
+
* - `sent` — the status service accepted the report (2xx);
|
|
29
|
+
* - `rejected` — the status service returned a non-2xx response.
|
|
30
|
+
*/
|
|
31
|
+
outcome: 'sent' | 'rejected';
|
|
32
|
+
/** HTTP status of the request. */
|
|
33
|
+
status: number;
|
|
34
|
+
/** Response body for a `rejected` outcome. */
|
|
35
|
+
detail?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Sends a telemetry report to the OpenCRVS status service. The endpoint and the
|
|
39
|
+
* schema version are fixed by this version of the toolkit.
|
|
40
|
+
*
|
|
41
|
+
* This always attempts the send; deciding *whether* to report (e.g. only from
|
|
42
|
+
* production instances) is the caller's responsibility. Network errors reject.
|
|
43
|
+
*/
|
|
44
|
+
export declare function sendTelemetry(report: TelemetryReport): Promise<TelemetryResult>;
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/telemetry/index.ts"],"names":[],"mappings":"AAuBA,uCAAuC;AACvC,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAE5D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,6EAA6E;IAC7E,WAAW,EAAE,MAAM,CAAA;IACnB,8CAA8C;IAC9C,YAAY,EAAE,MAAM,CAAA;IACpB,kEAAkE;IAClE,YAAY,EAAE,MAAM,CAAA;IACpB,gDAAgD;IAChD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,QAAQ,EAAE;QACR,gBAAgB,EAAE,MAAM,CAAA;QACxB,WAAW,EAAE,MAAM,CAAA;QACnB,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAA;CAC9C;AAED,+CAA+C;AAC/C,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,OAAO,EAAE,MAAM,GAAG,UAAU,CAAA;IAC5B,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAA;IACd,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,eAAe,GACtB,OAAO,CAAC,eAAe,CAAC,CAa1B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/telemetry/index.ts
|
|
21
|
+
var telemetry_exports = {};
|
|
22
|
+
__export(telemetry_exports, {
|
|
23
|
+
sendTelemetry: () => sendTelemetry
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(telemetry_exports);
|
|
26
|
+
var TELEMETRY_URL = "https://status.opencrvs.org/v1/telemetry";
|
|
27
|
+
var SCHEMA_VERSION = "1.0";
|
|
28
|
+
async function sendTelemetry(report) {
|
|
29
|
+
const response = await fetch(TELEMETRY_URL, {
|
|
30
|
+
method: "POST",
|
|
31
|
+
headers: { "Content-Type": "application/json" },
|
|
32
|
+
body: JSON.stringify({ schema_version: SCHEMA_VERSION, ...report })
|
|
33
|
+
});
|
|
34
|
+
if (response.ok) {
|
|
35
|
+
return { outcome: "sent", status: response.status };
|
|
36
|
+
}
|
|
37
|
+
const detail = await response.text().catch(() => "");
|
|
38
|
+
return { outcome: "rejected", status: response.status, detail };
|
|
39
|
+
}
|
|
@@ -69,6 +69,7 @@ backup:
|
|
|
69
69
|
schedule: "0 1 * * *"
|
|
70
70
|
backup_server_secret: backup-server-ssh-credentials
|
|
71
71
|
backup_server_dir: /home/backup/{{env}}
|
|
72
|
+
host: {{backup_host}}
|
|
72
73
|
|
|
73
74
|
|
|
74
75
|
# Restore configuration
|
|
@@ -78,3 +79,4 @@ restore:
|
|
|
78
79
|
backup_server_secret: backup-server-ssh-credentials
|
|
79
80
|
backup_server_dir: /home/backup/{{restore_environment_name}}
|
|
80
81
|
backup_encryption_secret: restore-encryption-secret
|
|
82
|
+
host: {{restore_host}}
|
|
@@ -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}}
|
|
@@ -13,10 +13,8 @@ all:
|
|
|
13
13
|
# - If you are behind VPN, use private IP address
|
|
14
14
|
# - If your server is exposed (not recommeded), use public IP address
|
|
15
15
|
# - If you would like to run kubectl commands from the remote server, leave this field empty
|
|
16
|
-
#
|
|
17
|
-
|
|
16
|
+
# kube_api_host: ''
|
|
18
17
|
# IMPORTANT: If master VM has multiple ethernet interfaces, put private IP address at kube_api_host
|
|
19
|
-
# kube_api_host: 10.10.10.10
|
|
20
18
|
kube_api_host: {{kube_api_host}}
|
|
21
19
|
|
|
22
20
|
# Default ansible provision user, keep as is
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type Message = {
|
|
2
|
+
id: string;
|
|
3
|
+
defaultMessage: string;
|
|
4
|
+
description: string;
|
|
5
|
+
};
|
|
6
|
+
export type CheckResult = {
|
|
7
|
+
missing: Message[];
|
|
8
|
+
/** Rows in countryconfig.csv that nothing in the source declares. */
|
|
9
|
+
outdated: string[];
|
|
10
|
+
/** Files declaring a message whose id is assembled at runtime. */
|
|
11
|
+
dynamicIds: string[];
|
|
12
|
+
};
|
|
13
|
+
export declare function check(cwd: string): CheckResult;
|
|
14
|
+
/**
|
|
15
|
+
* Adds a row per missing message, filling in only English — the rest is copy
|
|
16
|
+
* somebody has to write. Returns the ids added.
|
|
17
|
+
*
|
|
18
|
+
* Creates countryconfig.csv if it doesn't exist yet.
|
|
19
|
+
*/
|
|
20
|
+
export declare function writeMissing(cwd: string, missing: Message[]): string[];
|
|
21
|
+
//# sourceMappingURL=check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/translations/check.ts"],"names":[],"mappings":"AAwCA,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,OAAO,EAAE,CAAA;IAClB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,kEAAkE;IAClE,UAAU,EAAE,MAAM,EAAE,CAAA;CACrB,CAAA;AAgED,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAyB9C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAwB3D"}
|