@opencrvs/toolkit 2.1.0-rc.f29a266 → 2.1.0-rc.f5ea803
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.sh +9 -1
- package/create-countryconfig/index.js +176 -2
- package/dist/application-config/index.js +211 -201
- 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 +1587 -69
- package/dist/commons/api/router.d.ts +4 -4
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/AdvancedSearchConfig.d.ts +6 -0
- package/dist/commons/events/EventDocument.d.ts +468 -0
- package/dist/commons/events/EventMetadata.d.ts +1 -11
- package/dist/commons/events/EventStatus.d.ts +19 -0
- package/dist/commons/events/FieldConfig.d.ts +5 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +15 -15
- package/dist/commons/events/locations.d.ts +2 -2
- package/dist/commons/notification/UserNotifications.d.ts +0 -13
- package/dist/commons/notification/dispatch.d.ts +10 -0
- package/dist/commons/notification/index.d.ts +1 -0
- package/dist/conditionals/index.js +74 -57
- package/dist/csv.d.ts +25 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +120 -0
- package/dist/events/index.js +760 -743
- 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 +855 -815
- package/dist/scopes/index.d.ts +74 -6
- package/dist/scopes/index.js +74 -57
- 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/translations/check.d.ts +19 -0
- package/dist/translations/check.d.ts.map +1 -0
- package/dist/translations/check.js +127 -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.f5ea803.tgz +0 -0
- package/package.json +8 -3
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/opencrvs-toolkit-2.1.0-rc.f29a266.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
package/dist/scopes/index.d.ts
CHANGED
|
@@ -58,6 +58,13 @@ declare const AllScopeOptions: z.ZodObject<{
|
|
|
58
58
|
declaredBy: z.ZodOptional<z.ZodEnum<{
|
|
59
59
|
user: "user";
|
|
60
60
|
}>>;
|
|
61
|
+
status: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
62
|
+
ARCHIVED: "ARCHIVED";
|
|
63
|
+
CREATED: "CREATED";
|
|
64
|
+
DECLARED: "DECLARED";
|
|
65
|
+
NOTIFIED: "NOTIFIED";
|
|
66
|
+
REGISTERED: "REGISTERED";
|
|
67
|
+
}>>>>;
|
|
61
68
|
registeredIn: z.ZodOptional<z.ZodEnum<{
|
|
62
69
|
administrativeArea: "administrativeArea";
|
|
63
70
|
all: "all";
|
|
@@ -111,6 +118,7 @@ export declare const ScopeOptionKey: z.ZodEnum<{
|
|
|
111
118
|
registeredBy: "registeredBy";
|
|
112
119
|
registeredIn: "registeredIn";
|
|
113
120
|
role: "role";
|
|
121
|
+
status: "status";
|
|
114
122
|
}>;
|
|
115
123
|
export type ScopeOptionKey = z.infer<typeof ScopeOptionKey>;
|
|
116
124
|
export declare const ScopesWithPlaceEventOptions: z.ZodEnum<{
|
|
@@ -123,13 +131,13 @@ export declare const ScopesWithDeclaredOptions: z.ZodEnum<{
|
|
|
123
131
|
"record.edit": "record.edit";
|
|
124
132
|
"record.register": "record.register";
|
|
125
133
|
"record.reject": "record.reject";
|
|
126
|
-
"record.review-duplicates": "record.review-duplicates";
|
|
127
134
|
"record.unarchive": "record.unarchive";
|
|
128
135
|
}>;
|
|
129
136
|
export declare const ScopesWithFullOptions: z.ZodEnum<{
|
|
130
137
|
"record.correct": "record.correct";
|
|
131
138
|
"record.read": "record.read";
|
|
132
139
|
"record.request-correction": "record.request-correction";
|
|
140
|
+
"record.review-duplicates": "record.review-duplicates";
|
|
133
141
|
"record.search": "record.search";
|
|
134
142
|
"record.unassign-others": "record.unassign-others";
|
|
135
143
|
}>;
|
|
@@ -153,7 +161,6 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
153
161
|
"record.edit": "record.edit";
|
|
154
162
|
"record.register": "record.register";
|
|
155
163
|
"record.reject": "record.reject";
|
|
156
|
-
"record.review-duplicates": "record.review-duplicates";
|
|
157
164
|
"record.unarchive": "record.unarchive";
|
|
158
165
|
}>;
|
|
159
166
|
options: z.ZodOptional<z.ZodObject<{
|
|
@@ -179,12 +186,20 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
179
186
|
declaredBy: z.ZodOptional<z.ZodEnum<{
|
|
180
187
|
user: "user";
|
|
181
188
|
}>>;
|
|
189
|
+
status: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
190
|
+
ARCHIVED: "ARCHIVED";
|
|
191
|
+
CREATED: "CREATED";
|
|
192
|
+
DECLARED: "DECLARED";
|
|
193
|
+
NOTIFIED: "NOTIFIED";
|
|
194
|
+
REGISTERED: "REGISTERED";
|
|
195
|
+
}>>>>;
|
|
182
196
|
}, z.core.$strip>>;
|
|
183
197
|
}, z.core.$strip>, z.ZodObject<{
|
|
184
198
|
type: z.ZodEnum<{
|
|
185
199
|
"record.correct": "record.correct";
|
|
186
200
|
"record.read": "record.read";
|
|
187
201
|
"record.request-correction": "record.request-correction";
|
|
202
|
+
"record.review-duplicates": "record.review-duplicates";
|
|
188
203
|
"record.search": "record.search";
|
|
189
204
|
"record.unassign-others": "record.unassign-others";
|
|
190
205
|
}>;
|
|
@@ -211,6 +226,13 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
211
226
|
declaredBy: z.ZodOptional<z.ZodEnum<{
|
|
212
227
|
user: "user";
|
|
213
228
|
}>>;
|
|
229
|
+
status: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
230
|
+
ARCHIVED: "ARCHIVED";
|
|
231
|
+
CREATED: "CREATED";
|
|
232
|
+
DECLARED: "DECLARED";
|
|
233
|
+
NOTIFIED: "NOTIFIED";
|
|
234
|
+
REGISTERED: "REGISTERED";
|
|
235
|
+
}>>>>;
|
|
214
236
|
registeredIn: z.ZodOptional<z.ZodEnum<{
|
|
215
237
|
administrativeArea: "administrativeArea";
|
|
216
238
|
all: "all";
|
|
@@ -268,6 +290,13 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
268
290
|
declaredBy: z.ZodOptional<z.ZodEnum<{
|
|
269
291
|
user: "user";
|
|
270
292
|
}>>;
|
|
293
|
+
status: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
294
|
+
ARCHIVED: "ARCHIVED";
|
|
295
|
+
CREATED: "CREATED";
|
|
296
|
+
DECLARED: "DECLARED";
|
|
297
|
+
NOTIFIED: "NOTIFIED";
|
|
298
|
+
REGISTERED: "REGISTERED";
|
|
299
|
+
}>>>>;
|
|
271
300
|
registeredIn: z.ZodOptional<z.ZodEnum<{
|
|
272
301
|
administrativeArea: "administrativeArea";
|
|
273
302
|
all: "all";
|
|
@@ -326,6 +355,13 @@ export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
326
355
|
declaredBy: z.ZodOptional<z.ZodEnum<{
|
|
327
356
|
user: "user";
|
|
328
357
|
}>>;
|
|
358
|
+
status: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
359
|
+
ARCHIVED: "ARCHIVED";
|
|
360
|
+
CREATED: "CREATED";
|
|
361
|
+
DECLARED: "DECLARED";
|
|
362
|
+
NOTIFIED: "NOTIFIED";
|
|
363
|
+
REGISTERED: "REGISTERED";
|
|
364
|
+
}>>>>;
|
|
329
365
|
registeredIn: z.ZodOptional<z.ZodEnum<{
|
|
330
366
|
administrativeArea: "administrativeArea";
|
|
331
367
|
all: "all";
|
|
@@ -438,7 +474,6 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
438
474
|
"record.edit": "record.edit";
|
|
439
475
|
"record.register": "record.register";
|
|
440
476
|
"record.reject": "record.reject";
|
|
441
|
-
"record.review-duplicates": "record.review-duplicates";
|
|
442
477
|
"record.unarchive": "record.unarchive";
|
|
443
478
|
}>;
|
|
444
479
|
options: z.ZodOptional<z.ZodObject<{
|
|
@@ -454,6 +489,7 @@ export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
454
489
|
"record.correct": "record.correct";
|
|
455
490
|
"record.read": "record.read";
|
|
456
491
|
"record.request-correction": "record.request-correction";
|
|
492
|
+
"record.review-duplicates": "record.review-duplicates";
|
|
457
493
|
"record.search": "record.search";
|
|
458
494
|
"record.unassign-others": "record.unassign-others";
|
|
459
495
|
}>;
|
|
@@ -569,7 +605,6 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
569
605
|
"record.edit": "record.edit";
|
|
570
606
|
"record.register": "record.register";
|
|
571
607
|
"record.reject": "record.reject";
|
|
572
|
-
"record.review-duplicates": "record.review-duplicates";
|
|
573
608
|
"record.unarchive": "record.unarchive";
|
|
574
609
|
}>;
|
|
575
610
|
options: z.ZodOptional<z.ZodObject<{
|
|
@@ -595,12 +630,20 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
595
630
|
declaredBy: z.ZodOptional<z.ZodEnum<{
|
|
596
631
|
user: "user";
|
|
597
632
|
}>>;
|
|
633
|
+
status: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
634
|
+
ARCHIVED: "ARCHIVED";
|
|
635
|
+
CREATED: "CREATED";
|
|
636
|
+
DECLARED: "DECLARED";
|
|
637
|
+
NOTIFIED: "NOTIFIED";
|
|
638
|
+
REGISTERED: "REGISTERED";
|
|
639
|
+
}>>>>;
|
|
598
640
|
}, z.core.$strip>>;
|
|
599
641
|
}, z.core.$strip>, z.ZodObject<{
|
|
600
642
|
type: z.ZodEnum<{
|
|
601
643
|
"record.correct": "record.correct";
|
|
602
644
|
"record.read": "record.read";
|
|
603
645
|
"record.request-correction": "record.request-correction";
|
|
646
|
+
"record.review-duplicates": "record.review-duplicates";
|
|
604
647
|
"record.search": "record.search";
|
|
605
648
|
"record.unassign-others": "record.unassign-others";
|
|
606
649
|
}>;
|
|
@@ -627,6 +670,13 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
627
670
|
declaredBy: z.ZodOptional<z.ZodEnum<{
|
|
628
671
|
user: "user";
|
|
629
672
|
}>>;
|
|
673
|
+
status: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
674
|
+
ARCHIVED: "ARCHIVED";
|
|
675
|
+
CREATED: "CREATED";
|
|
676
|
+
DECLARED: "DECLARED";
|
|
677
|
+
NOTIFIED: "NOTIFIED";
|
|
678
|
+
REGISTERED: "REGISTERED";
|
|
679
|
+
}>>>>;
|
|
630
680
|
registeredIn: z.ZodOptional<z.ZodEnum<{
|
|
631
681
|
administrativeArea: "administrativeArea";
|
|
632
682
|
all: "all";
|
|
@@ -684,6 +734,13 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
684
734
|
declaredBy: z.ZodOptional<z.ZodEnum<{
|
|
685
735
|
user: "user";
|
|
686
736
|
}>>;
|
|
737
|
+
status: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
738
|
+
ARCHIVED: "ARCHIVED";
|
|
739
|
+
CREATED: "CREATED";
|
|
740
|
+
DECLARED: "DECLARED";
|
|
741
|
+
NOTIFIED: "NOTIFIED";
|
|
742
|
+
REGISTERED: "REGISTERED";
|
|
743
|
+
}>>>>;
|
|
687
744
|
registeredIn: z.ZodOptional<z.ZodEnum<{
|
|
688
745
|
administrativeArea: "administrativeArea";
|
|
689
746
|
all: "all";
|
|
@@ -742,6 +799,13 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
742
799
|
declaredBy: z.ZodOptional<z.ZodEnum<{
|
|
743
800
|
user: "user";
|
|
744
801
|
}>>;
|
|
802
|
+
status: z.ZodPreprocess<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
803
|
+
ARCHIVED: "ARCHIVED";
|
|
804
|
+
CREATED: "CREATED";
|
|
805
|
+
DECLARED: "DECLARED";
|
|
806
|
+
NOTIFIED: "NOTIFIED";
|
|
807
|
+
REGISTERED: "REGISTERED";
|
|
808
|
+
}>>>>;
|
|
745
809
|
registeredIn: z.ZodOptional<z.ZodEnum<{
|
|
746
810
|
administrativeArea: "administrativeArea";
|
|
747
811
|
all: "all";
|
|
@@ -890,7 +954,7 @@ export declare const decodeScope: (encodedScope: EncodedScope) => {
|
|
|
890
954
|
placeOfEvent?: "administrativeArea" | "all" | "location" | undefined;
|
|
891
955
|
} | undefined;
|
|
892
956
|
} | {
|
|
893
|
-
type: "record.archive" | "record.edit" | "record.register" | "record.reject" | "record.
|
|
957
|
+
type: "record.archive" | "record.edit" | "record.register" | "record.reject" | "record.unarchive";
|
|
894
958
|
options?: {
|
|
895
959
|
event?: string[] | undefined;
|
|
896
960
|
placeOfEvent?: "administrativeArea" | "all" | "location" | undefined;
|
|
@@ -898,9 +962,10 @@ export declare const decodeScope: (encodedScope: EncodedScope) => {
|
|
|
898
962
|
notifiedBy?: "user" | undefined;
|
|
899
963
|
declaredIn?: "administrativeArea" | "all" | "location" | undefined;
|
|
900
964
|
declaredBy?: "user" | undefined;
|
|
965
|
+
status?: ("ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED")[] | undefined;
|
|
901
966
|
} | undefined;
|
|
902
967
|
} | {
|
|
903
|
-
type: "record.correct" | "record.read" | "record.request-correction" | "record.search" | "record.unassign-others";
|
|
968
|
+
type: "record.correct" | "record.read" | "record.request-correction" | "record.review-duplicates" | "record.search" | "record.unassign-others";
|
|
904
969
|
options?: {
|
|
905
970
|
event?: string[] | undefined;
|
|
906
971
|
placeOfEvent?: "administrativeArea" | "all" | "location" | undefined;
|
|
@@ -908,6 +973,7 @@ export declare const decodeScope: (encodedScope: EncodedScope) => {
|
|
|
908
973
|
notifiedBy?: "user" | undefined;
|
|
909
974
|
declaredIn?: "administrativeArea" | "all" | "location" | undefined;
|
|
910
975
|
declaredBy?: "user" | undefined;
|
|
976
|
+
status?: ("ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED")[] | undefined;
|
|
911
977
|
registeredIn?: "administrativeArea" | "all" | "location" | undefined;
|
|
912
978
|
registeredBy?: "user" | undefined;
|
|
913
979
|
flags?: {
|
|
@@ -925,6 +991,7 @@ export declare const decodeScope: (encodedScope: EncodedScope) => {
|
|
|
925
991
|
notifiedBy?: "user" | undefined;
|
|
926
992
|
declaredIn?: "administrativeArea" | "all" | "location" | undefined;
|
|
927
993
|
declaredBy?: "user" | undefined;
|
|
994
|
+
status?: ("ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED")[] | undefined;
|
|
928
995
|
registeredIn?: "administrativeArea" | "all" | "location" | undefined;
|
|
929
996
|
registeredBy?: "user" | undefined;
|
|
930
997
|
flags?: {
|
|
@@ -943,6 +1010,7 @@ export declare const decodeScope: (encodedScope: EncodedScope) => {
|
|
|
943
1010
|
notifiedBy?: "user" | undefined;
|
|
944
1011
|
declaredIn?: "administrativeArea" | "all" | "location" | undefined;
|
|
945
1012
|
declaredBy?: "user" | undefined;
|
|
1013
|
+
status?: ("ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED")[] | undefined;
|
|
946
1014
|
registeredIn?: "administrativeArea" | "all" | "location" | undefined;
|
|
947
1015
|
registeredBy?: "user" | undefined;
|
|
948
1016
|
flags?: {
|
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
|
|
@@ -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 =
|
|
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 =
|
|
349
|
-
var RecordScopeTypeV2 =
|
|
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,7 +374,7 @@ var RecordScopeTypeV2 = z7.enum([
|
|
|
364
374
|
"record.unassign-others",
|
|
365
375
|
"record.custom-action"
|
|
366
376
|
]);
|
|
367
|
-
var PlainScopeType =
|
|
377
|
+
var PlainScopeType = z8.enum([
|
|
368
378
|
// Misc. system scopes
|
|
369
379
|
"bypassratelimit",
|
|
370
380
|
"record.reindex",
|
|
@@ -389,15 +399,21 @@ var PlainScopeType = z7.enum([
|
|
|
389
399
|
"record.confirm-registration",
|
|
390
400
|
"record.reject-registration"
|
|
391
401
|
]);
|
|
392
|
-
var scopeByEvent =
|
|
402
|
+
var scopeByEvent = z8.preprocess(
|
|
393
403
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
394
|
-
|
|
404
|
+
z8.array(z8.string()).optional()
|
|
395
405
|
).describe("Event type, e.g. birth, death");
|
|
396
|
-
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(
|
|
397
413
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
398
|
-
|
|
414
|
+
z8.array(z8.string()).optional()
|
|
399
415
|
).describe("User role, e.g. admin, field agent");
|
|
400
|
-
var scopeOptionsPlaceEvent =
|
|
416
|
+
var scopeOptionsPlaceEvent = z8.object({
|
|
401
417
|
event: scopeByEvent,
|
|
402
418
|
placeOfEvent: JurisdictionFilter.optional()
|
|
403
419
|
}).describe("Options applicable to all record scopes.");
|
|
@@ -405,7 +421,8 @@ var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
|
405
421
|
notifiedIn: JurisdictionFilter.optional(),
|
|
406
422
|
notifiedBy: UserFilter.optional(),
|
|
407
423
|
declaredIn: JurisdictionFilter.optional(),
|
|
408
|
-
declaredBy: UserFilter.optional()
|
|
424
|
+
declaredBy: UserFilter.optional(),
|
|
425
|
+
status: scopeByStatus
|
|
409
426
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
410
427
|
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
411
428
|
registeredIn: JurisdictionFilter.optional(),
|
|
@@ -415,31 +432,31 @@ var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
|
415
432
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
416
433
|
);
|
|
417
434
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
418
|
-
customActionTypes:
|
|
435
|
+
customActionTypes: z8.preprocess(
|
|
419
436
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
420
|
-
|
|
437
|
+
z8.array(z8.string()).optional()
|
|
421
438
|
).describe("Allowed custom action types")
|
|
422
439
|
});
|
|
423
|
-
var AccessLevelOptions =
|
|
440
|
+
var AccessLevelOptions = z8.object({
|
|
424
441
|
accessLevel: JurisdictionFilter.optional()
|
|
425
442
|
});
|
|
426
443
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
427
444
|
role: userRole.optional()
|
|
428
445
|
});
|
|
429
|
-
var WorkqueueOrDashboardOptions =
|
|
430
|
-
ids:
|
|
446
|
+
var WorkqueueOrDashboardOptions = z8.object({
|
|
447
|
+
ids: z8.preprocess(
|
|
431
448
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
432
|
-
|
|
449
|
+
z8.array(z8.string())
|
|
433
450
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
434
451
|
});
|
|
435
|
-
var AllScopeOptions =
|
|
452
|
+
var AllScopeOptions = z8.object({
|
|
436
453
|
...AllRecordScopeOptions.shape,
|
|
437
454
|
...AccessLevelOptions.shape,
|
|
438
455
|
...AllUserScopeOptions.shape,
|
|
439
456
|
...WorkqueueOrDashboardOptions.shape
|
|
440
457
|
});
|
|
441
458
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
442
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
459
|
+
var ResolvedScopeOptionsPlaceEvent = z8.object({
|
|
443
460
|
event: scopeByEvent,
|
|
444
461
|
placeOfEvent: UUID.nullish()
|
|
445
462
|
}).describe(
|
|
@@ -447,15 +464,15 @@ var ResolvedScopeOptionsPlaceEvent = z7.object({
|
|
|
447
464
|
);
|
|
448
465
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
449
466
|
notifiedIn: UUID.nullish(),
|
|
450
|
-
notifiedBy:
|
|
467
|
+
notifiedBy: z8.string().optional(),
|
|
451
468
|
declaredIn: UUID.nullish(),
|
|
452
|
-
declaredBy:
|
|
469
|
+
declaredBy: z8.string().optional()
|
|
453
470
|
}).describe(
|
|
454
471
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
455
472
|
);
|
|
456
473
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
457
474
|
registeredIn: UUID.nullish(),
|
|
458
|
-
registeredBy:
|
|
475
|
+
registeredBy: z8.string().optional(),
|
|
459
476
|
flags: ContainsFlags.optional()
|
|
460
477
|
}).describe(
|
|
461
478
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
@@ -470,7 +487,6 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
470
487
|
"record.reject",
|
|
471
488
|
"record.archive",
|
|
472
489
|
"record.unarchive",
|
|
473
|
-
"record.review-duplicates",
|
|
474
490
|
"record.register"
|
|
475
491
|
]);
|
|
476
492
|
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
@@ -478,41 +494,42 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
478
494
|
"record.read",
|
|
479
495
|
"record.request-correction",
|
|
480
496
|
"record.correct",
|
|
481
|
-
"record.unassign-others"
|
|
497
|
+
"record.unassign-others",
|
|
498
|
+
"record.review-duplicates"
|
|
482
499
|
]);
|
|
483
500
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
484
|
-
templates:
|
|
501
|
+
templates: z8.preprocess(
|
|
485
502
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
486
|
-
|
|
503
|
+
z8.array(z8.string()).optional()
|
|
487
504
|
).describe(
|
|
488
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."
|
|
489
506
|
)
|
|
490
507
|
});
|
|
491
|
-
var RecordScopeV2 =
|
|
492
|
-
|
|
508
|
+
var RecordScopeV2 = z8.discriminatedUnion("type", [
|
|
509
|
+
z8.object({
|
|
493
510
|
type: ScopesWithPlaceEventOptions,
|
|
494
511
|
options: scopeOptionsPlaceEvent.optional()
|
|
495
512
|
}),
|
|
496
|
-
|
|
513
|
+
z8.object({
|
|
497
514
|
type: ScopesWithDeclaredOptions,
|
|
498
515
|
options: scopeOptionsDeclaredOrNotified.optional()
|
|
499
516
|
}),
|
|
500
|
-
|
|
517
|
+
z8.object({
|
|
501
518
|
type: ScopesWithFullOptions,
|
|
502
519
|
options: AllRecordScopeOptions.optional()
|
|
503
520
|
}),
|
|
504
|
-
|
|
505
|
-
type:
|
|
521
|
+
z8.object({
|
|
522
|
+
type: z8.literal("record.custom-action"),
|
|
506
523
|
options: CustomActionScopeOptions.optional()
|
|
507
524
|
}),
|
|
508
|
-
|
|
509
|
-
type:
|
|
525
|
+
z8.object({
|
|
526
|
+
type: z8.literal("record.print-certified-copies"),
|
|
510
527
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
511
528
|
})
|
|
512
529
|
]).describe(
|
|
513
530
|
"Scopes used to check user's permission to perform actions on a record."
|
|
514
531
|
);
|
|
515
|
-
var SystemScopeType =
|
|
532
|
+
var SystemScopeType = z8.enum([
|
|
516
533
|
"organisation.read-locations",
|
|
517
534
|
"user.read",
|
|
518
535
|
"user.create",
|
|
@@ -526,12 +543,12 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
526
543
|
"user.search"
|
|
527
544
|
]);
|
|
528
545
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
529
|
-
var UserScopeV2 =
|
|
530
|
-
|
|
546
|
+
var UserScopeV2 = z8.discriminatedUnion("type", [
|
|
547
|
+
z8.object({
|
|
531
548
|
type: ScopesWithRoleOption,
|
|
532
549
|
options: AllUserScopeOptions.optional()
|
|
533
550
|
}),
|
|
534
|
-
|
|
551
|
+
z8.object({
|
|
535
552
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
536
553
|
options: AccessLevelOptions.optional()
|
|
537
554
|
})
|
|
@@ -551,44 +568,44 @@ function scopeUsesPrintCertifiedCopiesOptions(scope) {
|
|
|
551
568
|
function isCustomActionScope(scope) {
|
|
552
569
|
return scope.type === "record.custom-action";
|
|
553
570
|
}
|
|
554
|
-
var ResolvedRecordScopeV2 =
|
|
555
|
-
|
|
571
|
+
var ResolvedRecordScopeV2 = z8.discriminatedUnion("type", [
|
|
572
|
+
z8.object({
|
|
556
573
|
type: ScopesWithPlaceEventOptions,
|
|
557
574
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
558
575
|
}),
|
|
559
|
-
|
|
576
|
+
z8.object({
|
|
560
577
|
type: ScopesWithDeclaredOptions,
|
|
561
578
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
562
579
|
}),
|
|
563
|
-
|
|
580
|
+
z8.object({
|
|
564
581
|
type: ScopesWithFullOptions,
|
|
565
582
|
options: ResolvedScopeOptionsFull.optional()
|
|
566
583
|
}),
|
|
567
|
-
|
|
568
|
-
type:
|
|
584
|
+
z8.object({
|
|
585
|
+
type: z8.literal("record.print-certified-copies"),
|
|
569
586
|
options: ResolvedScopeOptionsFull.extend({
|
|
570
|
-
templates:
|
|
587
|
+
templates: z8.array(z8.string()).optional()
|
|
571
588
|
}).optional()
|
|
572
589
|
})
|
|
573
590
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
574
|
-
var Scope2 =
|
|
575
|
-
|
|
591
|
+
var Scope2 = z8.discriminatedUnion("type", [
|
|
592
|
+
z8.object({ type: PlainScopeType }),
|
|
576
593
|
...RecordScopeV2.options,
|
|
577
594
|
...UserScopeV2.options,
|
|
578
|
-
|
|
579
|
-
type:
|
|
595
|
+
z8.object({
|
|
596
|
+
type: z8.literal("organisation.read-locations"),
|
|
580
597
|
options: AccessLevelOptions.optional()
|
|
581
598
|
}),
|
|
582
|
-
|
|
583
|
-
type:
|
|
599
|
+
z8.object({
|
|
600
|
+
type: z8.literal("workqueue"),
|
|
584
601
|
options: WorkqueueOrDashboardOptions
|
|
585
602
|
}),
|
|
586
|
-
|
|
587
|
-
type:
|
|
603
|
+
z8.object({
|
|
604
|
+
type: z8.literal("dashboard.view"),
|
|
588
605
|
options: WorkqueueOrDashboardOptions
|
|
589
606
|
})
|
|
590
607
|
]);
|
|
591
|
-
var ScopeType2 =
|
|
608
|
+
var ScopeType2 = z8.enum([
|
|
592
609
|
...SystemScopeType.options,
|
|
593
610
|
...RecordScopeTypeV2.options,
|
|
594
611
|
...PlainScopeType.options,
|
|
@@ -603,7 +620,7 @@ var unflattenScope = (input) => {
|
|
|
603
620
|
const { type, ...options } = input;
|
|
604
621
|
return { type, options };
|
|
605
622
|
};
|
|
606
|
-
var EncodedScope2 =
|
|
623
|
+
var EncodedScope2 = z8.string().brand("EncodedScope");
|
|
607
624
|
var encodeScope = (scope) => {
|
|
608
625
|
const flattened = flattenScope(scope);
|
|
609
626
|
return qs.stringify(flattened, {
|
|
@@ -690,4 +707,4 @@ function defineRoles(roles) {
|
|
|
690
707
|
}
|
|
691
708
|
|
|
692
709
|
// src/scopes/index.ts
|
|
693
|
-
|
|
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.dev/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
|
+
}
|
|
@@ -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"}
|