@opencrvs/toolkit 2.1.0-rc.d078d1a → 2.1.0-rc.d1b9774

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +1 -0
  2. package/build.sh +9 -1
  3. package/create-countryconfig/index.js +284 -62
  4. package/create-countryconfig/node_modules/.bin/degit +21 -0
  5. package/create-countryconfig/package.json +4 -1
  6. package/dist/application-config/index.js +265 -209
  7. package/dist/authentication/index.d.ts +67 -0
  8. package/dist/authentication/index.d.ts.map +1 -0
  9. package/dist/authentication/index.js +750 -0
  10. package/dist/cli.js +1744 -104
  11. package/dist/commons/api/router.d.ts +599 -69
  12. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  13. package/dist/commons/conditionals/validate.d.ts +13 -11
  14. package/dist/commons/events/ActionDocument.d.ts +4 -4
  15. package/dist/commons/events/ActionInput.d.ts +4 -4
  16. package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -0
  17. package/dist/commons/events/AuditLog.d.ts +110 -0
  18. package/dist/commons/events/EventDocument.d.ts +470 -2
  19. package/dist/commons/events/EventIndex.d.ts +2 -2
  20. package/dist/commons/events/EventMetadata.d.ts +1 -11
  21. package/dist/commons/events/EventStatus.d.ts +19 -0
  22. package/dist/commons/events/FieldConfig.d.ts +78 -53
  23. package/dist/commons/events/FieldTypeMapping.d.ts +12 -12
  24. package/dist/commons/events/FieldValue.d.ts +2 -2
  25. package/dist/commons/events/PlainDate.d.ts +8 -0
  26. package/dist/commons/events/SummaryConfig.d.ts +249 -0
  27. package/dist/commons/events/locations.d.ts +158 -26
  28. package/dist/commons/events/mocks.test.utils.d.ts +30 -0
  29. package/dist/commons/events/test.utils.d.ts +8 -4
  30. package/dist/commons/events/utils.d.ts +2 -2
  31. package/dist/commons/notification/UserNotifications.d.ts +28 -13
  32. package/dist/commons/notification/dispatch.d.ts +10 -0
  33. package/dist/commons/notification/index.d.ts +1 -0
  34. package/dist/conditionals/index.js +79 -57
  35. package/dist/csv.d.ts +25 -0
  36. package/dist/csv.d.ts.map +1 -0
  37. package/dist/csv.js +120 -0
  38. package/dist/environment/index.d.ts +1 -0
  39. package/dist/environment/index.d.ts.map +1 -1
  40. package/dist/environment/index.js +10 -0
  41. package/dist/environment/logger.d.ts +15 -3
  42. package/dist/environment/logger.d.ts.map +1 -1
  43. package/dist/environment/paths.d.ts +7 -0
  44. package/dist/environment/paths.d.ts.map +1 -0
  45. package/dist/environment/paths.js +72 -0
  46. package/dist/environment/questions.d.ts.map +1 -1
  47. package/dist/environment/questions.js +20 -14
  48. package/dist/environment/setup-environment.js +3 -2
  49. package/dist/environment/templates.d.ts.map +1 -1
  50. package/dist/environment/templates.js +2 -1
  51. package/dist/environment/update-workflows.d.ts.map +1 -1
  52. package/dist/environment/update-workflows.js +17 -5
  53. package/dist/environment/upgrade.d.ts +2 -0
  54. package/dist/environment/upgrade.d.ts.map +1 -0
  55. package/dist/environment/upgrade.js +82 -0
  56. package/dist/environment/users.js +11 -13
  57. package/dist/events/index.js +1079 -843
  58. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
  59. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  60. package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
  61. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
  62. package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
  63. package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
  64. package/dist/migrations/v2.1/add-translations.d.ts +9 -0
  65. package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
  66. package/dist/migrations/v2.1/add-translations.js +213 -0
  67. package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
  68. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
  69. package/dist/migrations/v2.1/enable-telemetry.js +438 -0
  70. package/dist/migrations/v2.1/index.d.ts.map +1 -1
  71. package/dist/migrations/v2.1/index.js +1058 -0
  72. package/dist/notification/index.js +1149 -1419
  73. package/dist/scopes/index.d.ts +102 -32
  74. package/dist/scopes/index.js +79 -57
  75. package/dist/telemetry/index.d.ts +45 -0
  76. package/dist/telemetry/index.d.ts.map +1 -0
  77. package/dist/telemetry/index.js +39 -0
  78. package/dist/templates/charts-values/opencrvs-services/values.yaml +4 -3
  79. package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
  80. package/dist/templates/charts-values/traefik/values.yaml +23 -9
  81. package/dist/templates/inventory/inventory.template.yml +1 -3
  82. package/dist/translations/check.d.ts +19 -0
  83. package/dist/translations/check.d.ts.map +1 -0
  84. package/dist/translations/check.js +127 -0
  85. package/dist/verify/endpoints.d.ts +2 -0
  86. package/dist/verify/endpoints.d.ts.map +1 -0
  87. package/dist/verify/endpoints.js +345 -0
  88. package/opencrvs-toolkit-2.1.0-rc.d1b9774.tgz +0 -0
  89. package/package.json +12 -7
  90. package/tsconfig.build.json +11 -0
  91. package/tsconfig.build.tsbuildinfo +1 -0
  92. package/tsconfig.json +3 -0
  93. package/dist/templates/inventory/production.example.yml +0 -77
  94. package/dist/templates/inventory/qa.example.yml +0 -48
  95. package/opencrvs-toolkit-2.1.0-rc.d078d1a.tgz +0 -0
  96. package/tsconfig.tsbuildinfo +0 -1
@@ -59,10 +59,10 @@ __export(scopes_exports, {
59
59
  scopeUsesRoleOptions: () => scopeUsesRoleOptions
60
60
  });
61
61
  module.exports = __toCommonJS(scopes_exports);
62
- var z8 = __toESM(require("zod/v4"));
62
+ var z9 = __toESM(require("zod/v4"));
63
63
 
64
64
  // ../commons/src/scopes.ts
65
- var z7 = __toESM(require("zod/v4"));
65
+ var z8 = __toESM(require("zod/v4"));
66
66
  var qs = __toESM(require("qs"));
67
67
 
68
68
  // ../commons/src/uuid.ts
@@ -341,12 +341,22 @@ var ActionFlagConfig = z6.object({
341
341
  description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
342
342
  });
343
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
+
344
354
  // ../commons/src/scopes.ts
345
- var JurisdictionFilter = z7.enum(["administrativeArea", "location", "all"]).describe(
355
+ var JurisdictionFilter = z8.enum(["administrativeArea", "location", "all"]).describe(
346
356
  "Filters based on user jurisdiction relative to their office location in hierarchy."
347
357
  );
348
- var UserFilter = z7.enum(["user"]).describe("Filters based on the user. Limits to self.");
349
- var RecordScopeTypeV2 = z7.enum([
358
+ var UserFilter = z8.enum(["user"]).describe("Filters based on the user. Limits to self.");
359
+ var RecordScopeTypeV2 = z8.enum([
350
360
  "record.search",
351
361
  "record.create",
352
362
  "record.read",
@@ -364,12 +374,17 @@ var RecordScopeTypeV2 = z7.enum([
364
374
  "record.unassign-others",
365
375
  "record.custom-action"
366
376
  ]);
367
- var PlainScopeType = z7.enum([
377
+ var PlainScopeType = z8.enum([
368
378
  // Misc. system scopes
369
379
  "bypassratelimit",
370
380
  "record.reindex",
371
381
  "user.data-seeding",
372
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",
373
388
  "record.import",
374
389
  "config.update-all",
375
390
  "location.edit",
@@ -384,15 +399,21 @@ var PlainScopeType = z7.enum([
384
399
  "record.confirm-registration",
385
400
  "record.reject-registration"
386
401
  ]);
387
- var scopeByEvent = z7.preprocess(
402
+ var scopeByEvent = z8.preprocess(
388
403
  (val) => val === void 0 ? void 0 : [val].flat(),
389
- z7.array(z7.string()).optional()
404
+ z8.array(z8.string()).optional()
390
405
  ).describe("Event type, e.g. birth, death");
391
- var userRole = z7.preprocess(
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
- z7.array(z7.string()).optional()
414
+ z8.array(z8.string()).optional()
394
415
  ).describe("User role, e.g. admin, field agent");
395
- var scopeOptionsPlaceEvent = z7.object({
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: z7.preprocess(
435
+ customActionTypes: z8.preprocess(
414
436
  (val) => val === void 0 ? void 0 : [val].flat(),
415
- z7.array(z7.string()).optional()
437
+ z8.array(z8.string()).optional()
416
438
  ).describe("Allowed custom action types")
417
439
  });
418
- var AccessLevelOptions = z7.object({
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 = z7.object({
425
- ids: z7.preprocess(
446
+ var WorkqueueOrDashboardOptions = z8.object({
447
+ ids: z8.preprocess(
426
448
  (val) => val === void 0 ? void 0 : [val].flat(),
427
- z7.array(z7.string())
449
+ z8.array(z8.string())
428
450
  ).describe("Must contain a list of workqueue or dashboard ids.")
429
451
  });
430
- var AllScopeOptions = z7.object({
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 = z7.object({
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: z7.string().optional(),
467
+ notifiedBy: z8.string().optional(),
446
468
  declaredIn: UUID.nullish(),
447
- declaredBy: z7.string().optional()
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: z7.string().optional(),
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: z7.preprocess(
501
+ templates: z8.preprocess(
480
502
  (val) => val === void 0 ? void 0 : [val].flat(),
481
- z7.array(z7.string()).optional()
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 = z7.discriminatedUnion("type", [
487
- z7.object({
508
+ var RecordScopeV2 = z8.discriminatedUnion("type", [
509
+ z8.object({
488
510
  type: ScopesWithPlaceEventOptions,
489
511
  options: scopeOptionsPlaceEvent.optional()
490
512
  }),
491
- z7.object({
513
+ z8.object({
492
514
  type: ScopesWithDeclaredOptions,
493
515
  options: scopeOptionsDeclaredOrNotified.optional()
494
516
  }),
495
- z7.object({
517
+ z8.object({
496
518
  type: ScopesWithFullOptions,
497
519
  options: AllRecordScopeOptions.optional()
498
520
  }),
499
- z7.object({
500
- type: z7.literal("record.custom-action"),
521
+ z8.object({
522
+ type: z8.literal("record.custom-action"),
501
523
  options: CustomActionScopeOptions.optional()
502
524
  }),
503
- z7.object({
504
- type: z7.literal("record.print-certified-copies"),
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 = z7.enum([
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 = z7.discriminatedUnion("type", [
525
- z7.object({
546
+ var UserScopeV2 = z8.discriminatedUnion("type", [
547
+ z8.object({
526
548
  type: ScopesWithRoleOption,
527
549
  options: AllUserScopeOptions.optional()
528
550
  }),
529
- z7.object({
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 = z7.discriminatedUnion("type", [
550
- z7.object({
571
+ var ResolvedRecordScopeV2 = z8.discriminatedUnion("type", [
572
+ z8.object({
551
573
  type: ScopesWithPlaceEventOptions,
552
574
  options: ResolvedScopeOptionsPlaceEvent.optional()
553
575
  }),
554
- z7.object({
576
+ z8.object({
555
577
  type: ScopesWithDeclaredOptions,
556
578
  options: ResolvedScopeOptionsDeclared.optional()
557
579
  }),
558
- z7.object({
580
+ z8.object({
559
581
  type: ScopesWithFullOptions,
560
582
  options: ResolvedScopeOptionsFull.optional()
561
583
  }),
562
- z7.object({
563
- type: z7.literal("record.print-certified-copies"),
584
+ z8.object({
585
+ type: z8.literal("record.print-certified-copies"),
564
586
  options: ResolvedScopeOptionsFull.extend({
565
- templates: z7.array(z7.string()).optional()
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 = z7.discriminatedUnion("type", [
570
- z7.object({ type: PlainScopeType }),
591
+ var Scope2 = z8.discriminatedUnion("type", [
592
+ z8.object({ type: PlainScopeType }),
571
593
  ...RecordScopeV2.options,
572
594
  ...UserScopeV2.options,
573
- z7.object({
574
- type: z7.literal("organisation.read-locations"),
595
+ z8.object({
596
+ type: z8.literal("organisation.read-locations"),
575
597
  options: AccessLevelOptions.optional()
576
598
  }),
577
- z7.object({
578
- type: z7.literal("workqueue"),
599
+ z8.object({
600
+ type: z8.literal("workqueue"),
579
601
  options: WorkqueueOrDashboardOptions
580
602
  }),
581
- z7.object({
582
- type: z7.literal("dashboard.view"),
603
+ z8.object({
604
+ type: z8.literal("dashboard.view"),
583
605
  options: WorkqueueOrDashboardOptions
584
606
  })
585
607
  ]);
586
- var ScopeType2 = z7.enum([
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 = z7.string().brand("EncodedScope");
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
- z8.globalRegistry.clear();
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
+ }
@@ -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
- influxdb:
29
- host: influxdb-0.influxdb.opencrvs-deps-{{env}}.svc.cluster.local
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
- logs:
13
- general:
14
- # "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL", "PANIC"
15
- level: "INFO"
16
- # format: "common" # For local environment
17
- format: "json" # For server environment
18
- access:
19
- # -- To enable access logs
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
- format: "json"
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
- # kube_api_endpoint: ''
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,19 @@
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
+ export declare function writeMissing(cwd: string, missing: Message[]): string[];
19
+ //# 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;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAuB3D"}