@opencrvs/toolkit 2.1.0-rc.05a1257 → 2.1.0-rc.05b7761

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 (66) hide show
  1. package/README.md +2 -12
  2. package/build.sh +10 -3
  3. package/create-countryconfig/index.js +338 -4
  4. package/dist/application-config/index.js +17 -18
  5. package/dist/authentication/index.d.ts +67 -0
  6. package/dist/authentication/index.d.ts.map +1 -0
  7. package/dist/authentication/index.js +751 -0
  8. package/dist/cli.js +1090 -187
  9. package/dist/commons/api/router.d.ts +6 -42
  10. package/dist/commons/conditionals/conditionals.d.ts +6 -6
  11. package/dist/commons/conditionals/validate.d.ts +1 -1
  12. package/dist/commons/events/ActionConfig.d.ts +4 -0
  13. package/dist/commons/events/AdvancedSearchConfig.d.ts +12 -12
  14. package/dist/commons/events/FieldConfig.d.ts +16 -15
  15. package/dist/commons/events/FormConfig.d.ts +6 -0
  16. package/dist/commons/events/PageConfig.d.ts +4 -0
  17. package/dist/commons/events/locations.d.ts +4 -0
  18. package/dist/commons/events/test.utils.d.ts +18 -1
  19. package/dist/commons/events/utils.d.ts +15 -0
  20. package/dist/commons/notification/dispatch.d.ts +1 -6
  21. package/dist/conditionals/index.js +7 -6
  22. package/dist/csv.d.ts.map +1 -1
  23. package/dist/csv.js +7 -2
  24. package/dist/environment/logger.d.ts +3 -0
  25. package/dist/environment/logger.d.ts.map +1 -1
  26. package/dist/environment/manage-users.js +1 -1
  27. package/dist/environment/setup-environment.js +44 -26
  28. package/dist/environment/templates.d.ts +0 -1
  29. package/dist/environment/templates.d.ts.map +1 -1
  30. package/dist/environment/templates.js +3 -8
  31. package/dist/environment/update-workflows.d.ts.map +1 -1
  32. package/dist/environment/update-workflows.js +4 -0
  33. package/dist/environment/utils.d.ts +0 -12
  34. package/dist/environment/utils.d.ts.map +1 -1
  35. package/dist/environment/utils.js +1 -28
  36. package/dist/events/index.js +1901 -1792
  37. package/dist/migrations/v2.0/merge-infrastructure-directory.js +3 -3
  38. package/dist/migrations/v2.1/add-recovery-link-notifications.js +4 -4
  39. package/dist/migrations/v2.1/add-translations.d.ts.map +1 -1
  40. package/dist/migrations/v2.1/add-translations.js +42 -11
  41. package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
  42. package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
  43. package/dist/migrations/v2.1/enable-telemetry.js +455 -0
  44. package/dist/migrations/v2.1/index.d.ts.map +1 -1
  45. package/dist/migrations/v2.1/index.js +601 -19
  46. package/dist/migrations/v2.1/rename-trigger-paths.d.ts +3 -0
  47. package/dist/migrations/v2.1/rename-trigger-paths.d.ts.map +1 -0
  48. package/dist/migrations/v2.1/rename-trigger-paths.js +216 -0
  49. package/dist/notification/index.js +167 -155
  50. package/dist/scopes/index.d.ts +109 -5
  51. package/dist/scopes/index.js +7 -6
  52. package/dist/telemetry/index.d.ts +45 -0
  53. package/dist/telemetry/index.d.ts.map +1 -0
  54. package/dist/telemetry/index.js +43 -0
  55. package/dist/templates/charts-values/dependencies/values.yaml +2 -0
  56. package/dist/translations/check.d.ts +2 -4
  57. package/dist/translations/check.d.ts.map +1 -1
  58. package/dist/translations/check.js +14 -8
  59. package/dist/verify/endpoints.d.ts +2 -0
  60. package/dist/verify/endpoints.d.ts.map +1 -0
  61. package/dist/verify/endpoints.js +345 -0
  62. package/opencrvs-toolkit-2.1.0-rc.05b7761.tgz +0 -0
  63. package/package.json +5 -2
  64. package/tsconfig.build.tsbuildinfo +1 -1
  65. package/tsconfig.json +3 -0
  66. package/opencrvs-toolkit-2.1.0-rc.05a1257.tgz +0 -0
@@ -42,6 +42,14 @@ declare const AllScopeOptions: z.ZodObject<{
42
42
  all: "all";
43
43
  location: "location";
44
44
  }>>;
45
+ createdBy: z.ZodOptional<z.ZodEnum<{
46
+ user: "user";
47
+ }>>;
48
+ createdIn: z.ZodOptional<z.ZodEnum<{
49
+ administrativeArea: "administrativeArea";
50
+ all: "all";
51
+ location: "location";
52
+ }>>;
45
53
  notifiedIn: z.ZodOptional<z.ZodEnum<{
46
54
  administrativeArea: "administrativeArea";
47
55
  all: "all";
@@ -107,6 +115,8 @@ declare const AllScopeOptions: z.ZodObject<{
107
115
  type AllScopeOptions = z.infer<typeof AllScopeOptions>;
108
116
  export declare const ScopeOptionKey: z.ZodEnum<{
109
117
  accessLevel: "accessLevel";
118
+ createdBy: "createdBy";
119
+ createdIn: "createdIn";
110
120
  declaredBy: "declaredBy";
111
121
  declaredIn: "declaredIn";
112
122
  event: "event";
@@ -154,6 +164,14 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
154
164
  all: "all";
155
165
  location: "location";
156
166
  }>>;
167
+ createdBy: z.ZodOptional<z.ZodEnum<{
168
+ user: "user";
169
+ }>>;
170
+ createdIn: z.ZodOptional<z.ZodEnum<{
171
+ administrativeArea: "administrativeArea";
172
+ all: "all";
173
+ location: "location";
174
+ }>>;
157
175
  }, z.core.$strip>>;
158
176
  }, z.core.$strip>, z.ZodObject<{
159
177
  type: z.ZodEnum<{
@@ -170,6 +188,14 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
170
188
  all: "all";
171
189
  location: "location";
172
190
  }>>;
191
+ createdBy: z.ZodOptional<z.ZodEnum<{
192
+ user: "user";
193
+ }>>;
194
+ createdIn: z.ZodOptional<z.ZodEnum<{
195
+ administrativeArea: "administrativeArea";
196
+ all: "all";
197
+ location: "location";
198
+ }>>;
173
199
  notifiedIn: z.ZodOptional<z.ZodEnum<{
174
200
  administrativeArea: "administrativeArea";
175
201
  all: "all";
@@ -210,6 +236,14 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
210
236
  all: "all";
211
237
  location: "location";
212
238
  }>>;
239
+ createdBy: z.ZodOptional<z.ZodEnum<{
240
+ user: "user";
241
+ }>>;
242
+ createdIn: z.ZodOptional<z.ZodEnum<{
243
+ administrativeArea: "administrativeArea";
244
+ all: "all";
245
+ location: "location";
246
+ }>>;
213
247
  notifiedIn: z.ZodOptional<z.ZodEnum<{
214
248
  administrativeArea: "administrativeArea";
215
249
  all: "all";
@@ -274,6 +308,14 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
274
308
  all: "all";
275
309
  location: "location";
276
310
  }>>;
311
+ createdBy: z.ZodOptional<z.ZodEnum<{
312
+ user: "user";
313
+ }>>;
314
+ createdIn: z.ZodOptional<z.ZodEnum<{
315
+ administrativeArea: "administrativeArea";
316
+ all: "all";
317
+ location: "location";
318
+ }>>;
277
319
  notifiedIn: z.ZodOptional<z.ZodEnum<{
278
320
  administrativeArea: "administrativeArea";
279
321
  all: "all";
@@ -339,6 +381,14 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
339
381
  all: "all";
340
382
  location: "location";
341
383
  }>>;
384
+ createdBy: z.ZodOptional<z.ZodEnum<{
385
+ user: "user";
386
+ }>>;
387
+ createdIn: z.ZodOptional<z.ZodEnum<{
388
+ administrativeArea: "administrativeArea";
389
+ all: "all";
390
+ location: "location";
391
+ }>>;
342
392
  notifiedIn: z.ZodOptional<z.ZodEnum<{
343
393
  administrativeArea: "administrativeArea";
344
394
  all: "all";
@@ -467,6 +517,8 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
467
517
  options: z.ZodOptional<z.ZodObject<{
468
518
  event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
469
519
  placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
520
+ createdBy: z.ZodOptional<z.ZodString>;
521
+ createdIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
470
522
  }, z.core.$strip>>;
471
523
  }, z.core.$strip>, z.ZodObject<{
472
524
  type: z.ZodEnum<{
@@ -479,6 +531,8 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
479
531
  options: z.ZodOptional<z.ZodObject<{
480
532
  event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
481
533
  placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
534
+ createdBy: z.ZodOptional<z.ZodString>;
535
+ createdIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
482
536
  notifiedIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
483
537
  notifiedBy: z.ZodOptional<z.ZodString>;
484
538
  declaredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
@@ -496,6 +550,8 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
496
550
  options: z.ZodOptional<z.ZodObject<{
497
551
  event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
498
552
  placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
553
+ createdBy: z.ZodOptional<z.ZodString>;
554
+ createdIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
499
555
  notifiedIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
500
556
  notifiedBy: z.ZodOptional<z.ZodString>;
501
557
  declaredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
@@ -531,6 +587,8 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
531
587
  options: z.ZodOptional<z.ZodObject<{
532
588
  event: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodString>>>;
533
589
  placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
590
+ createdBy: z.ZodOptional<z.ZodString>;
591
+ createdIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
534
592
  notifiedIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
535
593
  notifiedBy: z.ZodOptional<z.ZodString>;
536
594
  declaredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
@@ -578,10 +636,8 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
578
636
  "performance.read-dashboards": "performance.read-dashboards";
579
637
  "performance.vital-statistics-export": "performance.vital-statistics-export";
580
638
  "profile.electronic-signature": "profile.electronic-signature";
581
- "record.confirm-registration": "record.confirm-registration";
582
639
  "record.import": "record.import";
583
640
  "record.reindex": "record.reindex";
584
- "record.reject-registration": "record.reject-registration";
585
641
  "user.data-seeding": "user.data-seeding";
586
642
  "user.read-only-my-audit": "user.read-only-my-audit";
587
643
  }>;
@@ -598,6 +654,14 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
598
654
  all: "all";
599
655
  location: "location";
600
656
  }>>;
657
+ createdBy: z.ZodOptional<z.ZodEnum<{
658
+ user: "user";
659
+ }>>;
660
+ createdIn: z.ZodOptional<z.ZodEnum<{
661
+ administrativeArea: "administrativeArea";
662
+ all: "all";
663
+ location: "location";
664
+ }>>;
601
665
  }, z.core.$strip>>;
602
666
  }, z.core.$strip>, z.ZodObject<{
603
667
  type: z.ZodEnum<{
@@ -614,6 +678,14 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
614
678
  all: "all";
615
679
  location: "location";
616
680
  }>>;
681
+ createdBy: z.ZodOptional<z.ZodEnum<{
682
+ user: "user";
683
+ }>>;
684
+ createdIn: z.ZodOptional<z.ZodEnum<{
685
+ administrativeArea: "administrativeArea";
686
+ all: "all";
687
+ location: "location";
688
+ }>>;
617
689
  notifiedIn: z.ZodOptional<z.ZodEnum<{
618
690
  administrativeArea: "administrativeArea";
619
691
  all: "all";
@@ -654,6 +726,14 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
654
726
  all: "all";
655
727
  location: "location";
656
728
  }>>;
729
+ createdBy: z.ZodOptional<z.ZodEnum<{
730
+ user: "user";
731
+ }>>;
732
+ createdIn: z.ZodOptional<z.ZodEnum<{
733
+ administrativeArea: "administrativeArea";
734
+ all: "all";
735
+ location: "location";
736
+ }>>;
657
737
  notifiedIn: z.ZodOptional<z.ZodEnum<{
658
738
  administrativeArea: "administrativeArea";
659
739
  all: "all";
@@ -718,6 +798,14 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
718
798
  all: "all";
719
799
  location: "location";
720
800
  }>>;
801
+ createdBy: z.ZodOptional<z.ZodEnum<{
802
+ user: "user";
803
+ }>>;
804
+ createdIn: z.ZodOptional<z.ZodEnum<{
805
+ administrativeArea: "administrativeArea";
806
+ all: "all";
807
+ location: "location";
808
+ }>>;
721
809
  notifiedIn: z.ZodOptional<z.ZodEnum<{
722
810
  administrativeArea: "administrativeArea";
723
811
  all: "all";
@@ -783,6 +871,14 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
783
871
  all: "all";
784
872
  location: "location";
785
873
  }>>;
874
+ createdBy: z.ZodOptional<z.ZodEnum<{
875
+ user: "user";
876
+ }>>;
877
+ createdIn: z.ZodOptional<z.ZodEnum<{
878
+ administrativeArea: "administrativeArea";
879
+ all: "all";
880
+ location: "location";
881
+ }>>;
786
882
  notifiedIn: z.ZodOptional<z.ZodEnum<{
787
883
  administrativeArea: "administrativeArea";
788
884
  all: "all";
@@ -899,7 +995,6 @@ export declare const ScopeType: z.ZodEnum<{
899
995
  "performance.vital-statistics-export": "performance.vital-statistics-export";
900
996
  "profile.electronic-signature": "profile.electronic-signature";
901
997
  "record.archive": "record.archive";
902
- "record.confirm-registration": "record.confirm-registration";
903
998
  "record.correct": "record.correct";
904
999
  "record.create": "record.create";
905
1000
  "record.custom-action": "record.custom-action";
@@ -912,7 +1007,6 @@ export declare const ScopeType: z.ZodEnum<{
912
1007
  "record.register": "record.register";
913
1008
  "record.reindex": "record.reindex";
914
1009
  "record.reject": "record.reject";
915
- "record.reject-registration": "record.reject-registration";
916
1010
  "record.request-correction": "record.request-correction";
917
1011
  "record.review-duplicates": "record.review-duplicates";
918
1012
  "record.search": "record.search";
@@ -952,12 +1046,16 @@ export declare const decodeScope: (encodedScope: EncodedScope) => {
952
1046
  options?: {
953
1047
  event?: string[] | undefined;
954
1048
  placeOfEvent?: "administrativeArea" | "all" | "location" | undefined;
1049
+ createdBy?: "user" | undefined;
1050
+ createdIn?: "administrativeArea" | "all" | "location" | undefined;
955
1051
  } | undefined;
956
1052
  } | {
957
1053
  type: "record.archive" | "record.edit" | "record.register" | "record.reject" | "record.unarchive";
958
1054
  options?: {
959
1055
  event?: string[] | undefined;
960
1056
  placeOfEvent?: "administrativeArea" | "all" | "location" | undefined;
1057
+ createdBy?: "user" | undefined;
1058
+ createdIn?: "administrativeArea" | "all" | "location" | undefined;
961
1059
  notifiedIn?: "administrativeArea" | "all" | "location" | undefined;
962
1060
  notifiedBy?: "user" | undefined;
963
1061
  declaredIn?: "administrativeArea" | "all" | "location" | undefined;
@@ -969,6 +1067,8 @@ export declare const decodeScope: (encodedScope: EncodedScope) => {
969
1067
  options?: {
970
1068
  event?: string[] | undefined;
971
1069
  placeOfEvent?: "administrativeArea" | "all" | "location" | undefined;
1070
+ createdBy?: "user" | undefined;
1071
+ createdIn?: "administrativeArea" | "all" | "location" | undefined;
972
1072
  notifiedIn?: "administrativeArea" | "all" | "location" | undefined;
973
1073
  notifiedBy?: "user" | undefined;
974
1074
  declaredIn?: "administrativeArea" | "all" | "location" | undefined;
@@ -987,6 +1087,8 @@ export declare const decodeScope: (encodedScope: EncodedScope) => {
987
1087
  options?: {
988
1088
  event?: string[] | undefined;
989
1089
  placeOfEvent?: "administrativeArea" | "all" | "location" | undefined;
1090
+ createdBy?: "user" | undefined;
1091
+ createdIn?: "administrativeArea" | "all" | "location" | undefined;
990
1092
  notifiedIn?: "administrativeArea" | "all" | "location" | undefined;
991
1093
  notifiedBy?: "user" | undefined;
992
1094
  declaredIn?: "administrativeArea" | "all" | "location" | undefined;
@@ -1006,6 +1108,8 @@ export declare const decodeScope: (encodedScope: EncodedScope) => {
1006
1108
  options?: {
1007
1109
  event?: string[] | undefined;
1008
1110
  placeOfEvent?: "administrativeArea" | "all" | "location" | undefined;
1111
+ createdBy?: "user" | undefined;
1112
+ createdIn?: "administrativeArea" | "all" | "location" | undefined;
1009
1113
  notifiedIn?: "administrativeArea" | "all" | "location" | undefined;
1010
1114
  notifiedBy?: "user" | undefined;
1011
1115
  declaredIn?: "administrativeArea" | "all" | "location" | undefined;
@@ -1032,7 +1136,7 @@ export declare const decodeScope: (encodedScope: EncodedScope) => {
1032
1136
  accessLevel?: "administrativeArea" | "all" | "location" | undefined;
1033
1137
  } | undefined;
1034
1138
  } | {
1035
- type: "attachment.upload" | "bypassratelimit" | "config.update-all" | "integration.audit.read" | "integration.create" | "location.edit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.confirm-registration" | "record.import" | "record.reindex" | "record.reject-registration" | "user.data-seeding" | "user.read-only-my-audit";
1139
+ type: "attachment.upload" | "bypassratelimit" | "config.update-all" | "integration.audit.read" | "integration.create" | "location.edit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.import" | "record.reindex" | "user.data-seeding" | "user.read-only-my-audit";
1036
1140
  } | {
1037
1141
  type: "organisation.read-locations";
1038
1142
  options?: {
@@ -394,10 +394,7 @@ var PlainScopeType = z8.enum([
394
394
  // Performance dashboard
395
395
  "performance.read",
396
396
  "performance.read-dashboards",
397
- "performance.vital-statistics-export",
398
- // Scopes used exclusively by countryconfig integration token
399
- "record.confirm-registration",
400
- "record.reject-registration"
397
+ "performance.vital-statistics-export"
401
398
  ]);
402
399
  var scopeByEvent = z8.preprocess(
403
400
  (val) => val === void 0 ? void 0 : [val].flat(),
@@ -415,7 +412,9 @@ var userRole = z8.preprocess(
415
412
  ).describe("User role, e.g. admin, field agent");
416
413
  var scopeOptionsPlaceEvent = z8.object({
417
414
  event: scopeByEvent,
418
- placeOfEvent: JurisdictionFilter.optional()
415
+ placeOfEvent: JurisdictionFilter.optional(),
416
+ createdBy: UserFilter.optional(),
417
+ createdIn: JurisdictionFilter.optional()
419
418
  }).describe("Options applicable to all record scopes.");
420
419
  var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
421
420
  notifiedIn: JurisdictionFilter.optional(),
@@ -458,7 +457,9 @@ var AllScopeOptions = z8.object({
458
457
  var ScopeOptionKey = AllScopeOptions.keyof();
459
458
  var ResolvedScopeOptionsPlaceEvent = z8.object({
460
459
  event: scopeByEvent,
461
- placeOfEvent: UUID.nullish()
460
+ placeOfEvent: UUID.nullish(),
461
+ createdBy: z8.string().optional(),
462
+ createdIn: UUID.nullish()
462
463
  }).describe(
463
464
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
464
465
  );
@@ -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,43 @@
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
+ }
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ sendTelemetry
43
+ });
@@ -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}}
@@ -10,14 +10,12 @@ export type CheckResult = {
10
10
  /** Files declaring a message whose id is assembled at runtime. */
11
11
  dynamicIds: string[];
12
12
  };
13
- export declare function messagesDeclaredIn(cwd: string): {
14
- messages: Message[];
15
- dynamicIds: string[];
16
- };
17
13
  export declare function check(cwd: string): CheckResult;
18
14
  /**
19
15
  * Adds a row per missing message, filling in only English — the rest is copy
20
16
  * somebody has to write. Returns the ids added.
17
+ *
18
+ * Creates countryconfig.csv if it doesn't exist yet.
21
19
  */
22
20
  export declare function writeMissing(cwd: string, missing: Message[]): string[];
23
21
  //# sourceMappingURL=check.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/translations/check.ts"],"names":[],"mappings":"AAiCA,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;AAsBD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM;;;EAsC7C;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAyB9C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,YAuB3D"}
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"}
@@ -13,7 +13,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
13
13
  return (mod && mod.__esModule) ? mod : { "default": mod };
14
14
  };
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.messagesDeclaredIn = messagesDeclaredIn;
17
16
  exports.check = check;
18
17
  exports.writeMissing = writeMissing;
19
18
  /**
@@ -57,7 +56,9 @@ function messagesDeclaredIn(cwd) {
57
56
  path_1.default.join(cwd, 'src/**/*.ts'),
58
57
  path_1.default.join(cwd, 'src/**/*.tsx'),
59
58
  `!${path_1.default.join(cwd, 'src/**/*.test.ts')}`,
60
- `!${path_1.default.join(cwd, 'src/**/*.test.tsx')}`
59
+ `!${path_1.default.join(cwd, 'src/**/*.test.tsx')}`,
60
+ `!${path_1.default.join(cwd, 'src/**/*.stories.ts')}`,
61
+ `!${path_1.default.join(cwd, 'src/**/*.stories.tsx')}`
61
62
  ]);
62
63
  const messages = [];
63
64
  const dynamicIds = [];
@@ -90,7 +91,7 @@ function check(cwd) {
90
91
  const own = (0, csv_1.readCsvFile)(path_1.default.join(cwd, OWN_FILE));
91
92
  const covered = new Set([own, ...CORE_FILES.map((file) => (0, csv_1.readCsvFile)(path_1.default.join(cwd, file)))]
92
93
  .flatMap((csv) => { var _a; return (_a = csv === null || csv === void 0 ? void 0 : csv.body) !== null && _a !== void 0 ? _a : []; })
93
- .map((line) => line.slice(0, line.indexOf(','))));
94
+ .map(csv_1.idOf));
94
95
  // The same message is often declared in more than one place.
95
96
  const missing = [
96
97
  ...new Map(messages
@@ -99,19 +100,24 @@ function check(cwd) {
99
100
  ].sort((a, b) => (a.id < b.id ? -1 : 1));
100
101
  const declared = new Set(messages.map(({ id }) => id));
101
102
  const outdated = ((_a = own === null || own === void 0 ? void 0 : own.body) !== null && _a !== void 0 ? _a : [])
102
- .map((line) => line.slice(0, line.indexOf(',')))
103
+ .map(csv_1.idOf)
103
104
  .filter((id) => !declared.has(id));
104
105
  return { missing, outdated, dynamicIds };
105
106
  }
106
107
  /**
107
108
  * Adds a row per missing message, filling in only English — the rest is copy
108
109
  * somebody has to write. Returns the ids added.
110
+ *
111
+ * Creates countryconfig.csv if it doesn't exist yet.
109
112
  */
110
113
  function writeMissing(cwd, missing) {
111
- const file = (0, csv_1.readCsvFile)(path_1.default.join(cwd, OWN_FILE));
112
- if (!file) {
113
- throw new Error(`${OWN_FILE} not found in ${cwd}`);
114
- }
114
+ var _a;
115
+ const file = (_a = (0, csv_1.readCsvFile)(path_1.default.join(cwd, OWN_FILE))) !== null && _a !== void 0 ? _a : {
116
+ header: 'id,description,en',
117
+ body: [],
118
+ newline: '\n',
119
+ trailingNewline: true
120
+ };
115
121
  const columns = file.header.split(',');
116
122
  const rows = missing.map((message) => (0, csv_1.toCsvLine)(columns.map((column) => {
117
123
  if (column === 'id')
@@ -0,0 +1,2 @@
1
+ export declare function runVerifyEndpoints(target?: string): Promise<void>;
2
+ //# sourceMappingURL=endpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../src/verify/endpoints.ts"],"names":[],"mappings":"AA2QA,wBAAsB,kBAAkB,CACtC,MAAM,GAAE,MAA2B,GAClC,OAAO,CAAC,IAAI,CAAC,CAkIf"}