@opencrvs/toolkit 2.0.1 → 2.1.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/build.sh +14 -5
- package/create-countryconfig/index.js +293 -103
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +5 -2
- package/dist/application-config/index.js +369 -282
- 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 +4343 -4788
- package/dist/commons/api/router.d.ts +4120 -2946
- package/dist/commons/application-config/index.d.ts +6 -6
- package/dist/commons/conditionals/conditionals.d.ts +32 -323
- package/dist/commons/conditionals/validate.d.ts +16 -5
- package/dist/commons/events/ActionConfig.d.ts +302 -71
- package/dist/commons/events/ActionDocument.d.ts +159 -121
- package/dist/commons/events/ActionInput.d.ts +30 -10
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/ActionType.d.ts +63 -58
- package/dist/commons/events/AdvancedSearchConfig.d.ts +531 -501
- package/dist/commons/events/AuditLog.d.ts +189 -40
- package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
- package/dist/commons/events/Conditional.d.ts +3 -3
- package/dist/commons/events/CountryConfigQueryInput.d.ts +603 -561
- package/dist/commons/events/Draft.d.ts +38 -36
- package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
- package/dist/commons/events/EventConfig.d.ts +8 -3
- package/dist/commons/events/EventDocument.d.ts +537 -47
- package/dist/commons/events/EventIndex.d.ts +61 -59
- package/dist/commons/events/EventMetadata.d.ts +59 -43
- package/dist/commons/events/EventStatus.d.ts +19 -0
- package/dist/commons/events/FieldConfig.d.ts +424 -384
- package/dist/commons/events/FieldType.d.ts +51 -51
- package/dist/commons/events/FieldTypeMapping.d.ts +86 -86
- package/dist/commons/events/FieldValue.d.ts +14 -14
- package/dist/commons/events/Flag.d.ts +57 -15
- package/dist/commons/events/FormConfig.d.ts +0 -6
- package/dist/commons/events/PageConfig.d.ts +0 -4
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/TemplateConfig.d.ts +1 -1
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
- package/dist/commons/events/WorkqueueConfig.d.ts +835 -790
- package/dist/commons/events/deduplication.d.ts +1 -1
- package/dist/commons/events/event.d.ts +14 -2
- package/dist/commons/events/field.d.ts +69 -198
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locationPayloads.d.ts +95 -0
- package/dist/commons/events/locations.d.ts +248 -14
- package/dist/commons/events/mocks.test.utils.d.ts +48 -4
- package/dist/commons/events/scopes.d.ts +5 -4
- package/dist/commons/events/state/index.d.ts +23 -15
- package/dist/commons/events/state/utils.d.ts +15 -6
- package/dist/commons/events/test.utils.d.ts +68 -42
- package/dist/commons/events/utils.d.ts +139 -110
- package/dist/commons/notification/UserNotifications.d.ts +38 -18
- package/dist/commons/notification/dispatch.d.ts +10 -0
- package/dist/commons/notification/index.d.ts +1 -0
- package/dist/conditionals/index.js +341 -68
- package/dist/csv.d.ts +25 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +120 -0
- package/dist/environment/custom-types.d.ts +33 -0
- package/dist/environment/custom-types.d.ts.map +1 -0
- package/dist/environment/custom-types.js +12 -0
- package/dist/environment/derived-variables.d.ts +122 -0
- package/dist/environment/derived-variables.d.ts.map +1 -0
- package/dist/environment/derived-variables.js +155 -0
- package/dist/environment/editor-questions.d.ts +4 -0
- package/dist/environment/editor-questions.d.ts.map +1 -0
- package/dist/environment/editor-questions.js +67 -0
- package/dist/environment/git.d.ts +5 -0
- package/dist/environment/git.d.ts.map +1 -0
- package/dist/environment/git.js +38 -0
- package/dist/environment/github.d.ts +26 -0
- package/dist/environment/github.d.ts.map +1 -0
- package/dist/environment/github.js +247 -0
- package/dist/environment/index.d.ts +6 -0
- package/dist/environment/index.d.ts.map +1 -0
- package/dist/environment/index.js +81 -0
- package/dist/environment/logger.d.ts +18 -0
- package/dist/environment/logger.d.ts.map +1 -0
- package/dist/environment/logger.js +25 -0
- package/dist/environment/manage-users.d.ts +11 -0
- package/dist/environment/manage-users.d.ts.map +1 -0
- package/dist/environment/manage-users.js +507 -0
- package/dist/environment/paths.d.ts +7 -0
- package/dist/environment/paths.d.ts.map +1 -0
- package/dist/environment/paths.js +72 -0
- package/dist/environment/questions-helper.d.ts +15 -0
- package/dist/environment/questions-helper.d.ts.map +1 -0
- package/dist/environment/questions-helper.js +70 -0
- package/dist/environment/questions.d.ts +200 -0
- package/dist/environment/questions.d.ts.map +1 -0
- package/dist/environment/questions.js +418 -0
- package/dist/environment/setup-environment.d.ts +2 -0
- package/dist/environment/setup-environment.d.ts.map +1 -0
- package/dist/environment/setup-environment.js +795 -0
- package/dist/environment/ssh-keygen.d.ts +5 -0
- package/dist/environment/ssh-keygen.d.ts.map +1 -0
- package/dist/environment/ssh-keygen.js +21 -0
- package/dist/environment/swarm-to-k8s.d.ts +2 -0
- package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
- package/dist/environment/swarm-to-k8s.js +183 -0
- package/dist/environment/templates.d.ts +27 -0
- package/dist/environment/templates.d.ts.map +1 -0
- package/dist/environment/templates.js +164 -0
- package/dist/environment/update-workflows.d.ts +2 -0
- package/dist/environment/update-workflows.d.ts.map +1 -0
- package/dist/environment/update-workflows.js +191 -0
- package/dist/environment/upgrade.d.ts +2 -0
- package/dist/environment/upgrade.d.ts.map +1 -0
- package/dist/environment/upgrade.js +82 -0
- package/dist/environment/users.d.ts +2 -0
- package/dist/environment/users.d.ts.map +1 -0
- package/dist/environment/users.js +120 -0
- package/dist/environment/utils.d.ts +18 -0
- package/dist/environment/utils.d.ts.map +1 -0
- package/dist/environment/utils.js +110 -0
- package/dist/events/deduplication.d.ts +1 -1
- package/dist/events/index.js +8104 -7408
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
- package/dist/migrations/v2.0/index.js +88 -5143
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +3 -3
- package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
- package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
- 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 +6 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -0
- package/dist/migrations/v2.1/index.js +1276 -0
- package/dist/notification/index.js +2010 -1451
- package/dist/scopes/index.d.ts +512 -231
- package/dist/scopes/index.js +342 -68
- package/dist/telemetry/index.d.ts +45 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +39 -0
- package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
- package/dist/templates/charts-values/dependencies/values.yaml +82 -0
- package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +78 -0
- package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
- package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
- package/dist/templates/charts-values/traefik/values.yaml +129 -0
- package/dist/templates/inventory/inventory.template.yml +98 -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.map +1 -1
- package/dist/verify/endpoints.js +25 -25
- package/opencrvs-toolkit-2.1.0-beta.tgz +0 -0
- package/package.json +25 -6
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/opencrvs-toolkit-2.0.1.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
package/dist/scopes/index.js
CHANGED
|
@@ -59,10 +59,10 @@ __export(scopes_exports, {
|
|
|
59
59
|
scopeUsesRoleOptions: () => scopeUsesRoleOptions
|
|
60
60
|
});
|
|
61
61
|
module.exports = __toCommonJS(scopes_exports);
|
|
62
|
-
var
|
|
62
|
+
var z9 = __toESM(require("zod/v4"));
|
|
63
63
|
|
|
64
64
|
// ../commons/src/scopes.ts
|
|
65
|
-
var
|
|
65
|
+
var z8 = __toESM(require("zod/v4"));
|
|
66
66
|
var qs = __toESM(require("qs"));
|
|
67
67
|
|
|
68
68
|
// ../commons/src/uuid.ts
|
|
@@ -96,12 +96,267 @@ var getTokenPayload = (token) => {
|
|
|
96
96
|
};
|
|
97
97
|
var TokenWithBearer = z2.string().regex(/^Bearer\s/);
|
|
98
98
|
|
|
99
|
+
// ../commons/src/events/ActionType.ts
|
|
100
|
+
var z3 = __toESM(require("zod/v4"));
|
|
101
|
+
var ActionType = {
|
|
102
|
+
// Pre-declaration actions
|
|
103
|
+
DELETE: "DELETE",
|
|
104
|
+
CREATE: "CREATE",
|
|
105
|
+
NOTIFY: "NOTIFY",
|
|
106
|
+
// Declaration actions
|
|
107
|
+
DECLARE: "DECLARE",
|
|
108
|
+
REGISTER: "REGISTER",
|
|
109
|
+
EDIT: "EDIT",
|
|
110
|
+
// Declaration system actions. Non-configurable.
|
|
111
|
+
DUPLICATE_DETECTED: "DUPLICATE_DETECTED",
|
|
112
|
+
REJECT: "REJECT",
|
|
113
|
+
// REJECT_DECLARATION
|
|
114
|
+
MARK_AS_DUPLICATE: "MARK_AS_DUPLICATE",
|
|
115
|
+
MARK_AS_NOT_DUPLICATE: "MARK_AS_NOT_DUPLICATE",
|
|
116
|
+
ARCHIVE: "ARCHIVE",
|
|
117
|
+
UNARCHIVE: "UNARCHIVE",
|
|
118
|
+
// Record actions
|
|
119
|
+
PRINT_CERTIFICATE: "PRINT_CERTIFICATE",
|
|
120
|
+
REQUEST_CORRECTION: "REQUEST_CORRECTION",
|
|
121
|
+
REJECT_CORRECTION: "REJECT_CORRECTION",
|
|
122
|
+
APPROVE_CORRECTION: "APPROVE_CORRECTION",
|
|
123
|
+
// General actions
|
|
124
|
+
READ: "READ",
|
|
125
|
+
ASSIGN: "ASSIGN",
|
|
126
|
+
UNASSIGN: "UNASSIGN",
|
|
127
|
+
// Custom action
|
|
128
|
+
CUSTOM: "CUSTOM"
|
|
129
|
+
};
|
|
130
|
+
var ConfirmableActions = [
|
|
131
|
+
ActionType.NOTIFY,
|
|
132
|
+
ActionType.DECLARE,
|
|
133
|
+
ActionType.EDIT,
|
|
134
|
+
ActionType.REGISTER,
|
|
135
|
+
ActionType.REJECT,
|
|
136
|
+
ActionType.ARCHIVE,
|
|
137
|
+
ActionType.UNARCHIVE,
|
|
138
|
+
ActionType.PRINT_CERTIFICATE,
|
|
139
|
+
ActionType.REQUEST_CORRECTION,
|
|
140
|
+
ActionType.APPROVE_CORRECTION,
|
|
141
|
+
ActionType.REJECT_CORRECTION,
|
|
142
|
+
ActionType.CUSTOM
|
|
143
|
+
];
|
|
144
|
+
var ActionTypes = z3.enum([
|
|
145
|
+
"DELETE",
|
|
146
|
+
"CREATE",
|
|
147
|
+
"NOTIFY",
|
|
148
|
+
"DECLARE",
|
|
149
|
+
"EDIT",
|
|
150
|
+
"REGISTER",
|
|
151
|
+
"DUPLICATE_DETECTED",
|
|
152
|
+
"REJECT",
|
|
153
|
+
"MARK_AS_DUPLICATE",
|
|
154
|
+
"MARK_AS_NOT_DUPLICATE",
|
|
155
|
+
"ARCHIVE",
|
|
156
|
+
"UNARCHIVE",
|
|
157
|
+
"PRINT_CERTIFICATE",
|
|
158
|
+
"REQUEST_CORRECTION",
|
|
159
|
+
"REJECT_CORRECTION",
|
|
160
|
+
"APPROVE_CORRECTION",
|
|
161
|
+
"READ",
|
|
162
|
+
"ASSIGN",
|
|
163
|
+
"UNASSIGN",
|
|
164
|
+
"CUSTOM"
|
|
165
|
+
]);
|
|
166
|
+
var declarationActionValues = [
|
|
167
|
+
ActionTypes.enum.DECLARE,
|
|
168
|
+
ActionTypes.enum.EDIT,
|
|
169
|
+
ActionTypes.enum.REGISTER,
|
|
170
|
+
ActionTypes.enum.NOTIFY,
|
|
171
|
+
ActionTypes.enum.DUPLICATE_DETECTED
|
|
172
|
+
];
|
|
173
|
+
var DeclarationActions = ActionTypes.extract(declarationActionValues);
|
|
174
|
+
var declarationUpdateActionValues = [
|
|
175
|
+
...declarationActionValues,
|
|
176
|
+
ActionTypes.enum.REQUEST_CORRECTION
|
|
177
|
+
];
|
|
178
|
+
var DeclarationUpdateActions = ActionTypes.extract(
|
|
179
|
+
declarationUpdateActionValues
|
|
180
|
+
);
|
|
181
|
+
var annotationActions = ActionTypes.exclude(declarationActionValues);
|
|
182
|
+
var writeActions = ActionTypes.exclude([
|
|
183
|
+
ActionType.CREATE,
|
|
184
|
+
ActionType.READ,
|
|
185
|
+
ActionType.ASSIGN,
|
|
186
|
+
ActionType.UNASSIGN
|
|
187
|
+
]);
|
|
188
|
+
var WorkqueueActionType = ActionTypes.extract([
|
|
189
|
+
ActionType.READ,
|
|
190
|
+
ActionType.DELETE,
|
|
191
|
+
ActionType.DECLARE,
|
|
192
|
+
ActionType.REGISTER,
|
|
193
|
+
ActionType.EDIT,
|
|
194
|
+
ActionType.REJECT,
|
|
195
|
+
ActionType.MARK_AS_DUPLICATE,
|
|
196
|
+
ActionType.ARCHIVE,
|
|
197
|
+
ActionType.UNARCHIVE,
|
|
198
|
+
ActionType.PRINT_CERTIFICATE,
|
|
199
|
+
ActionType.REQUEST_CORRECTION
|
|
200
|
+
]);
|
|
201
|
+
var META_ACTIONS = [
|
|
202
|
+
ActionType.ASSIGN,
|
|
203
|
+
ActionType.UNASSIGN,
|
|
204
|
+
ActionType.READ
|
|
205
|
+
];
|
|
206
|
+
|
|
207
|
+
// ../commons/src/events/ActionStatus.ts
|
|
208
|
+
var ActionStatus = {
|
|
209
|
+
Requested: "Requested",
|
|
210
|
+
Accepted: "Accepted",
|
|
211
|
+
Rejected: "Rejected"
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
// ../commons/src/events/Flag.ts
|
|
215
|
+
var z6 = __toESM(require("zod/v4"));
|
|
216
|
+
|
|
217
|
+
// ../commons/src/events/TranslationConfig.ts
|
|
218
|
+
var z4 = __toESM(require("zod/v4"));
|
|
219
|
+
var TranslationConfig = z4.object({
|
|
220
|
+
id: z4.string().describe(
|
|
221
|
+
"The identifier of the translation referred in translation CSV files"
|
|
222
|
+
),
|
|
223
|
+
defaultMessage: z4.string().describe("Default translation message"),
|
|
224
|
+
description: z4.string().describe(
|
|
225
|
+
"Describe the translation for a translator to be able to identify it."
|
|
226
|
+
)
|
|
227
|
+
}).meta({
|
|
228
|
+
description: "Translation configuration",
|
|
229
|
+
id: "TranslationConfig"
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
// ../commons/src/events/Conditional.ts
|
|
233
|
+
var z5 = __toESM(require("zod/v4"));
|
|
234
|
+
var Conditional = z5.any().describe("JSONSchema").meta({
|
|
235
|
+
description: "JSON schema conditional configuration",
|
|
236
|
+
id: "Conditional"
|
|
237
|
+
});
|
|
238
|
+
var ConditionalType = {
|
|
239
|
+
SHOW: "SHOW",
|
|
240
|
+
ENABLE: "ENABLE",
|
|
241
|
+
DISPLAY_ON_REVIEW: "DISPLAY_ON_REVIEW"
|
|
242
|
+
};
|
|
243
|
+
var ShowConditional = z5.object({
|
|
244
|
+
type: z5.literal(ConditionalType.SHOW),
|
|
245
|
+
conditional: Conditional
|
|
246
|
+
}).describe(
|
|
247
|
+
"If 'SHOW' conditional is defined, the component is shown to the user only if the condition is met"
|
|
248
|
+
);
|
|
249
|
+
var EnableConditional = z5.object({
|
|
250
|
+
type: z5.literal(ConditionalType.ENABLE),
|
|
251
|
+
conditional: Conditional
|
|
252
|
+
}).describe(
|
|
253
|
+
"If 'ENABLE' conditional is defined, the component is enabled only if the condition is met"
|
|
254
|
+
);
|
|
255
|
+
var ActionConditional = z5.discriminatedUnion("type", [
|
|
256
|
+
// Action can be shown / hidden
|
|
257
|
+
ShowConditional,
|
|
258
|
+
// Action can be shown to the user in the list but as disabled
|
|
259
|
+
EnableConditional
|
|
260
|
+
]).meta({
|
|
261
|
+
id: "ActionConditional",
|
|
262
|
+
description: "Conditional gating whether an action is shown (SHOW) or enabled (ENABLE). When omitted from an action, the action is shown and enabled for everyone."
|
|
263
|
+
});
|
|
264
|
+
var DisplayOnReviewConditional = z5.object({
|
|
265
|
+
type: z5.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
266
|
+
conditional: Conditional
|
|
267
|
+
}).describe(
|
|
268
|
+
"If 'DISPLAY_ON_REVIEW' conditional is defined, the component is shown on the review page only if both the 'DISPLAY_ON_REVIEW' and 'SHOW' conditions are met. This should only be used for fields within declaration forms, as they are the only ones with review pages."
|
|
269
|
+
);
|
|
270
|
+
var FieldConditional = z5.discriminatedUnion("type", [
|
|
271
|
+
// Field input can be shown / hidden
|
|
272
|
+
ShowConditional,
|
|
273
|
+
// Field input can be shown to the user but as disabled
|
|
274
|
+
EnableConditional,
|
|
275
|
+
// Field output can be shown / hidden on the review page
|
|
276
|
+
DisplayOnReviewConditional
|
|
277
|
+
]).meta({
|
|
278
|
+
id: "FieldConditional",
|
|
279
|
+
description: "Conditional gating whether a form field is shown (SHOW), enabled (ENABLE), or displayed on the review page (DISPLAY_ON_REVIEW). When omitted, the field is shown and enabled for everyone, and is displayed on review whenever it has a value."
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// ../commons/src/events/Flag.ts
|
|
283
|
+
var InherentFlags = {
|
|
284
|
+
INCOMPLETE: "incomplete",
|
|
285
|
+
REJECTED: "rejected",
|
|
286
|
+
CORRECTION_REQUESTED: "correction-requested",
|
|
287
|
+
POTENTIAL_DUPLICATE: "potential-duplicate",
|
|
288
|
+
/**
|
|
289
|
+
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
290
|
+
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
291
|
+
*
|
|
292
|
+
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
293
|
+
*/
|
|
294
|
+
EDIT_IN_PROGRESS: "edit-in-progress"
|
|
295
|
+
};
|
|
296
|
+
var actionFlagPattern;
|
|
297
|
+
function getActionFlagPattern() {
|
|
298
|
+
actionFlagPattern ??= new RegExp(
|
|
299
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
|
300
|
+
ActionStatus
|
|
301
|
+
).join("|").toLowerCase()})$`
|
|
302
|
+
);
|
|
303
|
+
return actionFlagPattern;
|
|
304
|
+
}
|
|
305
|
+
var ActionFlag = z6.string().refine((value) => getActionFlagPattern().test(value), {
|
|
306
|
+
message: "Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
|
307
|
+
});
|
|
308
|
+
var CustomFlag = z6.string().refine((val) => !Object.values(InherentFlags).includes(val), {
|
|
309
|
+
message: `Custom flag cannot be one of the inherent flags: ${Object.values(
|
|
310
|
+
InherentFlags
|
|
311
|
+
).join(", ")}`
|
|
312
|
+
}).refine((val) => !ActionFlag.safeParse(val).success, {
|
|
313
|
+
message: "Custom flag cannot match the ActionFlag pattern (ActionType:ActionStatus)."
|
|
314
|
+
}).describe("Custom flag identifier defined by the country config.");
|
|
315
|
+
var Flag = ActionFlag.or(z6.enum(InherentFlags)).or(CustomFlag);
|
|
316
|
+
var ContainsFlags = z6.object({
|
|
317
|
+
anyOf: z6.array(Flag).optional(),
|
|
318
|
+
noneOf: z6.array(Flag).optional(),
|
|
319
|
+
allOf: z6.array(Flag).optional()
|
|
320
|
+
}).meta({
|
|
321
|
+
id: "ContainsFlags"
|
|
322
|
+
});
|
|
323
|
+
var FlagConfig = z6.object({
|
|
324
|
+
id: CustomFlag,
|
|
325
|
+
requiresAction: z6.boolean().describe(
|
|
326
|
+
"Indicates if this flag expects an action to be performed to be cleared."
|
|
327
|
+
),
|
|
328
|
+
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
329
|
+
}).meta({
|
|
330
|
+
id: "FlagConfig",
|
|
331
|
+
description: "Configuration for a custom flag that can be added to or removed from records by event actions."
|
|
332
|
+
});
|
|
333
|
+
var ActionFlagConfig = z6.object({
|
|
334
|
+
id: Flag,
|
|
335
|
+
operation: z6.enum(["add", "remove"]).describe("Operation to perform on the flag."),
|
|
336
|
+
conditional: Conditional.optional().describe(
|
|
337
|
+
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
338
|
+
)
|
|
339
|
+
}).meta({
|
|
340
|
+
id: "ActionFlagConfig",
|
|
341
|
+
description: "Add or remove operation applied to a flag when the parent action is accepted. Optionally gated by a conditional."
|
|
342
|
+
});
|
|
343
|
+
|
|
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
|
+
|
|
99
354
|
// ../commons/src/scopes.ts
|
|
100
|
-
var JurisdictionFilter =
|
|
355
|
+
var JurisdictionFilter = z8.enum(["administrativeArea", "location", "all"]).describe(
|
|
101
356
|
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
102
357
|
);
|
|
103
|
-
var UserFilter =
|
|
104
|
-
var RecordScopeTypeV2 =
|
|
358
|
+
var UserFilter = z8.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
359
|
+
var RecordScopeTypeV2 = z8.enum([
|
|
105
360
|
"record.search",
|
|
106
361
|
"record.create",
|
|
107
362
|
"record.read",
|
|
@@ -110,6 +365,7 @@ var RecordScopeTypeV2 = z3.enum([
|
|
|
110
365
|
"record.edit",
|
|
111
366
|
"record.reject",
|
|
112
367
|
"record.archive",
|
|
368
|
+
"record.unarchive",
|
|
113
369
|
"record.review-duplicates",
|
|
114
370
|
"record.register",
|
|
115
371
|
"record.print-certified-copies",
|
|
@@ -118,14 +374,20 @@ var RecordScopeTypeV2 = z3.enum([
|
|
|
118
374
|
"record.unassign-others",
|
|
119
375
|
"record.custom-action"
|
|
120
376
|
]);
|
|
121
|
-
var PlainScopeType =
|
|
377
|
+
var PlainScopeType = z8.enum([
|
|
122
378
|
// Misc. system scopes
|
|
123
379
|
"bypassratelimit",
|
|
124
380
|
"record.reindex",
|
|
125
381
|
"user.data-seeding",
|
|
126
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",
|
|
127
388
|
"record.import",
|
|
128
389
|
"config.update-all",
|
|
390
|
+
"location.edit",
|
|
129
391
|
"attachment.upload",
|
|
130
392
|
"profile.electronic-signature",
|
|
131
393
|
"user.read-only-my-audit",
|
|
@@ -137,72 +399,81 @@ var PlainScopeType = z3.enum([
|
|
|
137
399
|
"record.confirm-registration",
|
|
138
400
|
"record.reject-registration"
|
|
139
401
|
]);
|
|
140
|
-
var scopeByEvent =
|
|
402
|
+
var scopeByEvent = z8.preprocess(
|
|
141
403
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
142
|
-
|
|
404
|
+
z8.array(z8.string()).optional()
|
|
143
405
|
).describe("Event type, e.g. birth, death");
|
|
144
|
-
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(
|
|
145
413
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
146
|
-
|
|
414
|
+
z8.array(z8.string()).optional()
|
|
147
415
|
).describe("User role, e.g. admin, field agent");
|
|
148
|
-
var scopeOptionsPlaceEvent =
|
|
416
|
+
var scopeOptionsPlaceEvent = z8.object({
|
|
149
417
|
event: scopeByEvent,
|
|
150
|
-
placeOfEvent: JurisdictionFilter.optional()
|
|
151
|
-
createdBy: UserFilter.optional(),
|
|
152
|
-
createdIn: JurisdictionFilter.optional()
|
|
418
|
+
placeOfEvent: JurisdictionFilter.optional()
|
|
153
419
|
}).describe("Options applicable to all record scopes.");
|
|
154
|
-
var
|
|
420
|
+
var scopeOptionsDeclaredOrNotified = scopeOptionsPlaceEvent.extend({
|
|
421
|
+
notifiedIn: JurisdictionFilter.optional(),
|
|
422
|
+
notifiedBy: UserFilter.optional(),
|
|
155
423
|
declaredIn: JurisdictionFilter.optional(),
|
|
156
|
-
declaredBy: UserFilter.optional()
|
|
424
|
+
declaredBy: UserFilter.optional(),
|
|
425
|
+
status: scopeByStatus
|
|
157
426
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
158
|
-
var AllRecordScopeOptions =
|
|
427
|
+
var AllRecordScopeOptions = scopeOptionsDeclaredOrNotified.extend({
|
|
159
428
|
registeredIn: JurisdictionFilter.optional(),
|
|
160
|
-
registeredBy: UserFilter.optional()
|
|
429
|
+
registeredBy: UserFilter.optional(),
|
|
430
|
+
flags: ContainsFlags.optional()
|
|
161
431
|
}).describe(
|
|
162
432
|
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
163
433
|
);
|
|
164
434
|
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
165
|
-
customActionTypes:
|
|
435
|
+
customActionTypes: z8.preprocess(
|
|
166
436
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
167
|
-
|
|
437
|
+
z8.array(z8.string()).optional()
|
|
168
438
|
).describe("Allowed custom action types")
|
|
169
439
|
});
|
|
170
|
-
var AccessLevelOptions =
|
|
440
|
+
var AccessLevelOptions = z8.object({
|
|
171
441
|
accessLevel: JurisdictionFilter.optional()
|
|
172
442
|
});
|
|
173
443
|
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
174
444
|
role: userRole.optional()
|
|
175
445
|
});
|
|
176
|
-
var WorkqueueOrDashboardOptions =
|
|
177
|
-
ids:
|
|
446
|
+
var WorkqueueOrDashboardOptions = z8.object({
|
|
447
|
+
ids: z8.preprocess(
|
|
178
448
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
179
|
-
|
|
449
|
+
z8.array(z8.string())
|
|
180
450
|
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
181
451
|
});
|
|
182
|
-
var AllScopeOptions =
|
|
452
|
+
var AllScopeOptions = z8.object({
|
|
183
453
|
...AllRecordScopeOptions.shape,
|
|
184
454
|
...AccessLevelOptions.shape,
|
|
185
455
|
...AllUserScopeOptions.shape,
|
|
186
456
|
...WorkqueueOrDashboardOptions.shape
|
|
187
457
|
});
|
|
188
458
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
189
|
-
var ResolvedScopeOptionsPlaceEvent =
|
|
459
|
+
var ResolvedScopeOptionsPlaceEvent = z8.object({
|
|
190
460
|
event: scopeByEvent,
|
|
191
|
-
placeOfEvent: UUID.nullish()
|
|
192
|
-
createdBy: z3.string().optional(),
|
|
193
|
-
createdIn: UUID.nullish()
|
|
461
|
+
placeOfEvent: UUID.nullish()
|
|
194
462
|
}).describe(
|
|
195
463
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
196
464
|
);
|
|
197
465
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
466
|
+
notifiedIn: UUID.nullish(),
|
|
467
|
+
notifiedBy: z8.string().optional(),
|
|
198
468
|
declaredIn: UUID.nullish(),
|
|
199
|
-
declaredBy:
|
|
469
|
+
declaredBy: z8.string().optional()
|
|
200
470
|
}).describe(
|
|
201
471
|
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
202
472
|
);
|
|
203
473
|
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
204
474
|
registeredIn: UUID.nullish(),
|
|
205
|
-
registeredBy:
|
|
475
|
+
registeredBy: z8.string().optional(),
|
|
476
|
+
flags: ContainsFlags.optional()
|
|
206
477
|
}).describe(
|
|
207
478
|
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
208
479
|
);
|
|
@@ -215,7 +486,7 @@ var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
|
215
486
|
"record.edit",
|
|
216
487
|
"record.reject",
|
|
217
488
|
"record.archive",
|
|
218
|
-
"record.
|
|
489
|
+
"record.unarchive",
|
|
219
490
|
"record.register"
|
|
220
491
|
]);
|
|
221
492
|
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
@@ -223,41 +494,42 @@ var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
|
223
494
|
"record.read",
|
|
224
495
|
"record.request-correction",
|
|
225
496
|
"record.correct",
|
|
226
|
-
"record.unassign-others"
|
|
497
|
+
"record.unassign-others",
|
|
498
|
+
"record.review-duplicates"
|
|
227
499
|
]);
|
|
228
500
|
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
229
|
-
templates:
|
|
501
|
+
templates: z8.preprocess(
|
|
230
502
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
231
|
-
|
|
503
|
+
z8.array(z8.string()).optional()
|
|
232
504
|
).describe(
|
|
233
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."
|
|
234
506
|
)
|
|
235
507
|
});
|
|
236
|
-
var RecordScopeV2 =
|
|
237
|
-
|
|
508
|
+
var RecordScopeV2 = z8.discriminatedUnion("type", [
|
|
509
|
+
z8.object({
|
|
238
510
|
type: ScopesWithPlaceEventOptions,
|
|
239
511
|
options: scopeOptionsPlaceEvent.optional()
|
|
240
512
|
}),
|
|
241
|
-
|
|
513
|
+
z8.object({
|
|
242
514
|
type: ScopesWithDeclaredOptions,
|
|
243
|
-
options:
|
|
515
|
+
options: scopeOptionsDeclaredOrNotified.optional()
|
|
244
516
|
}),
|
|
245
|
-
|
|
517
|
+
z8.object({
|
|
246
518
|
type: ScopesWithFullOptions,
|
|
247
519
|
options: AllRecordScopeOptions.optional()
|
|
248
520
|
}),
|
|
249
|
-
|
|
250
|
-
type:
|
|
521
|
+
z8.object({
|
|
522
|
+
type: z8.literal("record.custom-action"),
|
|
251
523
|
options: CustomActionScopeOptions.optional()
|
|
252
524
|
}),
|
|
253
|
-
|
|
254
|
-
type:
|
|
525
|
+
z8.object({
|
|
526
|
+
type: z8.literal("record.print-certified-copies"),
|
|
255
527
|
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
256
528
|
})
|
|
257
529
|
]).describe(
|
|
258
530
|
"Scopes used to check user's permission to perform actions on a record."
|
|
259
531
|
);
|
|
260
|
-
var SystemScopeType =
|
|
532
|
+
var SystemScopeType = z8.enum([
|
|
261
533
|
"organisation.read-locations",
|
|
262
534
|
"user.read",
|
|
263
535
|
"user.create",
|
|
@@ -271,12 +543,12 @@ var UserScopeType = SystemScopeType.extract([
|
|
|
271
543
|
"user.search"
|
|
272
544
|
]);
|
|
273
545
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
274
|
-
var UserScopeV2 =
|
|
275
|
-
|
|
546
|
+
var UserScopeV2 = z8.discriminatedUnion("type", [
|
|
547
|
+
z8.object({
|
|
276
548
|
type: ScopesWithRoleOption,
|
|
277
549
|
options: AllUserScopeOptions.optional()
|
|
278
550
|
}),
|
|
279
|
-
|
|
551
|
+
z8.object({
|
|
280
552
|
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
281
553
|
options: AccessLevelOptions.optional()
|
|
282
554
|
})
|
|
@@ -296,44 +568,44 @@ function scopeUsesPrintCertifiedCopiesOptions(scope) {
|
|
|
296
568
|
function isCustomActionScope(scope) {
|
|
297
569
|
return scope.type === "record.custom-action";
|
|
298
570
|
}
|
|
299
|
-
var ResolvedRecordScopeV2 =
|
|
300
|
-
|
|
571
|
+
var ResolvedRecordScopeV2 = z8.discriminatedUnion("type", [
|
|
572
|
+
z8.object({
|
|
301
573
|
type: ScopesWithPlaceEventOptions,
|
|
302
574
|
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
303
575
|
}),
|
|
304
|
-
|
|
576
|
+
z8.object({
|
|
305
577
|
type: ScopesWithDeclaredOptions,
|
|
306
578
|
options: ResolvedScopeOptionsDeclared.optional()
|
|
307
579
|
}),
|
|
308
|
-
|
|
580
|
+
z8.object({
|
|
309
581
|
type: ScopesWithFullOptions,
|
|
310
582
|
options: ResolvedScopeOptionsFull.optional()
|
|
311
583
|
}),
|
|
312
|
-
|
|
313
|
-
type:
|
|
584
|
+
z8.object({
|
|
585
|
+
type: z8.literal("record.print-certified-copies"),
|
|
314
586
|
options: ResolvedScopeOptionsFull.extend({
|
|
315
|
-
templates:
|
|
587
|
+
templates: z8.array(z8.string()).optional()
|
|
316
588
|
}).optional()
|
|
317
589
|
})
|
|
318
590
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
319
|
-
var Scope2 =
|
|
320
|
-
|
|
591
|
+
var Scope2 = z8.discriminatedUnion("type", [
|
|
592
|
+
z8.object({ type: PlainScopeType }),
|
|
321
593
|
...RecordScopeV2.options,
|
|
322
594
|
...UserScopeV2.options,
|
|
323
|
-
|
|
324
|
-
type:
|
|
595
|
+
z8.object({
|
|
596
|
+
type: z8.literal("organisation.read-locations"),
|
|
325
597
|
options: AccessLevelOptions.optional()
|
|
326
598
|
}),
|
|
327
|
-
|
|
328
|
-
type:
|
|
599
|
+
z8.object({
|
|
600
|
+
type: z8.literal("workqueue"),
|
|
329
601
|
options: WorkqueueOrDashboardOptions
|
|
330
602
|
}),
|
|
331
|
-
|
|
332
|
-
type:
|
|
603
|
+
z8.object({
|
|
604
|
+
type: z8.literal("dashboard.view"),
|
|
333
605
|
options: WorkqueueOrDashboardOptions
|
|
334
606
|
})
|
|
335
607
|
]);
|
|
336
|
-
var ScopeType2 =
|
|
608
|
+
var ScopeType2 = z8.enum([
|
|
337
609
|
...SystemScopeType.options,
|
|
338
610
|
...RecordScopeTypeV2.options,
|
|
339
611
|
...PlainScopeType.options,
|
|
@@ -348,11 +620,12 @@ var unflattenScope = (input) => {
|
|
|
348
620
|
const { type, ...options } = input;
|
|
349
621
|
return { type, options };
|
|
350
622
|
};
|
|
351
|
-
var EncodedScope2 =
|
|
623
|
+
var EncodedScope2 = z8.string().brand("EncodedScope");
|
|
352
624
|
var encodeScope = (scope) => {
|
|
353
625
|
const flattened = flattenScope(scope);
|
|
354
626
|
return qs.stringify(flattened, {
|
|
355
627
|
arrayFormat: "comma",
|
|
628
|
+
commaRoundTrip: true,
|
|
356
629
|
allowDots: true,
|
|
357
630
|
addQueryPrefix: false,
|
|
358
631
|
encode: false
|
|
@@ -376,8 +649,9 @@ var decodeScope = (encodedScope) => {
|
|
|
376
649
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
377
650
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
378
651
|
accessLevel: JurisdictionFilter.enum.all,
|
|
379
|
-
|
|
380
|
-
declaredIn: JurisdictionFilter.enum.all
|
|
652
|
+
notifiedIn: JurisdictionFilter.enum.all,
|
|
653
|
+
declaredIn: JurisdictionFilter.enum.all,
|
|
654
|
+
registeredIn: JurisdictionFilter.enum.all
|
|
381
655
|
};
|
|
382
656
|
function getScopeOptionValue(scope, option) {
|
|
383
657
|
const options = "options" in scope ? scope.options : void 0;
|
|
@@ -433,4 +707,4 @@ function defineRoles(roles) {
|
|
|
433
707
|
}
|
|
434
708
|
|
|
435
709
|
// src/scopes/index.ts
|
|
436
|
-
|
|
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
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
##################################################################################
|
|
2
|
+
# Use this file to customize helm chart behavior
|
|
3
|
+
# Please make sure your custom changes doesn't conflict with values.yaml
|
|
4
|
+
##################################################################################
|