@opencrvs/toolkit 1.9.7-rc.47e0d0f → 1.9.7-rc.480775d
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/dist/commons/api/router.d.ts +2579 -29665
- package/dist/commons/conditionals/conditionals.d.ts +1 -10
- package/dist/commons/conditionals/validate.d.ts +18 -15
- package/dist/commons/events/ActionConfig.d.ts +1552 -25043
- package/dist/commons/events/ActionDocument.d.ts +1899 -846
- package/dist/commons/events/ActionInput.d.ts +1073 -277
- package/dist/commons/events/ActionType.d.ts +9 -86
- package/dist/commons/events/AdvancedSearchConfig.d.ts +1238 -228
- package/dist/commons/events/CompositeFieldValue.d.ts +190 -29
- package/dist/commons/events/Conditional.d.ts +38 -26
- package/dist/commons/events/Constants.d.ts +1 -1
- package/dist/commons/events/CountryConfigQueryInput.d.ts +4223 -1195
- package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
- package/dist/commons/events/DeduplicationConfig.d.ts +171 -15
- package/dist/commons/events/Draft.d.ts +106 -71
- package/dist/commons/events/DynamicFieldValue.d.ts +91 -7
- package/dist/commons/events/EventConfig.d.ts +2120 -19988
- package/dist/commons/events/EventConfigInput.d.ts +1 -1
- package/dist/commons/events/EventDocument.d.ts +1349 -337
- package/dist/commons/events/EventIndex.d.ts +983 -196
- package/dist/commons/events/EventInput.d.ts +8 -3
- package/dist/commons/events/EventMetadata.d.ts +354 -113
- package/dist/commons/events/FieldConfig.d.ts +12826 -4536
- package/dist/commons/events/FieldType.d.ts +4 -20
- package/dist/commons/events/FieldTypeMapping.d.ts +896 -192
- package/dist/commons/events/FieldValue.d.ts +396 -87
- package/dist/commons/events/FormConfig.d.ts +721 -14022
- package/dist/commons/events/PageConfig.d.ts +319 -9368
- package/dist/commons/events/SummaryConfig.d.ts +161 -14
- package/dist/commons/events/TemplateConfig.d.ts +3 -2
- package/dist/commons/events/TranslationConfig.d.ts +2 -2
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +37 -74
- package/dist/commons/events/WorkqueueConfig.d.ts +7131 -1819
- package/dist/commons/events/deduplication.d.ts +3 -3
- package/dist/commons/events/defineConfig.d.ts +162 -26586
- package/dist/commons/events/index.d.ts +0 -1
- package/dist/commons/events/locations.d.ts +19 -26
- package/dist/commons/events/scopes.d.ts +4 -5
- package/dist/commons/events/state/availableActions.d.ts +2 -0
- package/dist/commons/events/state/flags.d.ts +3 -21
- package/dist/commons/events/state/index.d.ts +21 -24
- package/dist/commons/events/state/utils.d.ts +132 -150
- package/dist/commons/events/test.utils.d.ts +8 -31
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +381 -53194
- package/dist/commons/notification/UserNotifications.d.ts +636 -55
- package/dist/conditionals/index.d.ts.map +1 -1
- package/dist/conditionals/index.js +11 -45
- package/dist/events/deduplication.d.ts +3 -3
- package/dist/events/index.js +1824 -2058
- package/dist/notification/index.d.ts.map +1 -1
- package/dist/notification/index.js +1547 -1600
- package/dist/scopes/index.d.ts +133 -169
- package/dist/scopes/index.d.ts.map +1 -1
- package/dist/scopes/index.js +94 -135
- package/package.json +5 -5
- package/dist/commons/events/Flag.d.ts +0 -67
- package/dist/commons/events/eventConfigValidation.d.ts +0 -8
package/dist/scopes/index.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,28 +15,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/scopes/index.ts
|
|
31
21
|
var scopes_exports = {};
|
|
32
22
|
__export(scopes_exports, {
|
|
33
23
|
ActionScopes: () => ActionScopes,
|
|
34
|
-
ConfigurableActionScopes: () => ConfigurableActionScopes,
|
|
35
|
-
CustomActionScope: () => CustomActionScope,
|
|
36
24
|
RecordScope: () => RecordScope,
|
|
37
25
|
RecordScopeType: () => RecordScopeType,
|
|
38
26
|
SCOPES: () => SCOPES,
|
|
39
27
|
SearchScopes: () => SearchScopes,
|
|
40
28
|
findScope: () => findScope,
|
|
41
|
-
findScopes: () => findScopes,
|
|
42
29
|
getAuthorizedEventsFromScopes: () => getAuthorizedEventsFromScopes,
|
|
43
30
|
parseConfigurableScope: () => parseConfigurableScope,
|
|
44
31
|
parseLiteralScope: () => parseLiteralScope,
|
|
@@ -46,10 +33,9 @@ __export(scopes_exports, {
|
|
|
46
33
|
stringifyScope: () => stringifyScope
|
|
47
34
|
});
|
|
48
35
|
module.exports = __toCommonJS(scopes_exports);
|
|
49
|
-
var z2 = __toESM(require("zod/v4"));
|
|
50
36
|
|
|
51
37
|
// ../commons/src/scopes.ts
|
|
52
|
-
var
|
|
38
|
+
var import_zod = require("zod");
|
|
53
39
|
var SCOPES = {
|
|
54
40
|
// TODO v1.8 legacy scopes
|
|
55
41
|
BYPASSRATELIMIT: "bypassratelimit",
|
|
@@ -64,7 +50,6 @@ var SCOPES = {
|
|
|
64
50
|
RECORD_IMPORT: "record.import",
|
|
65
51
|
RECORD_EXPORT: "record.export",
|
|
66
52
|
RECORD_REINDEX: "record.reindex",
|
|
67
|
-
INTEGRATION_CREATE: "integration.create",
|
|
68
53
|
// declare
|
|
69
54
|
RECORD_DECLARE_BIRTH: "record.declare-birth",
|
|
70
55
|
RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
|
|
@@ -129,92 +114,91 @@ var SCOPES = {
|
|
|
129
114
|
// data seeding
|
|
130
115
|
USER_DATA_SEEDING: "user.data-seeding"
|
|
131
116
|
};
|
|
132
|
-
var LegacyScopes = z.union([
|
|
133
|
-
z.literal(SCOPES.BYPASSRATELIMIT),
|
|
134
|
-
z.literal(SCOPES.REGISTER),
|
|
135
|
-
z.literal(SCOPES.DEMO),
|
|
136
|
-
z.literal(SCOPES.CONFIG)
|
|
117
|
+
var LegacyScopes = import_zod.z.union([
|
|
118
|
+
import_zod.z.literal(SCOPES.BYPASSRATELIMIT),
|
|
119
|
+
import_zod.z.literal(SCOPES.REGISTER),
|
|
120
|
+
import_zod.z.literal(SCOPES.DEMO),
|
|
121
|
+
import_zod.z.literal(SCOPES.CONFIG)
|
|
137
122
|
]);
|
|
138
|
-
var IntegrationScopes = z.union([
|
|
139
|
-
z.literal(SCOPES.WEBHOOK),
|
|
140
|
-
z.literal(SCOPES.NATIONALID),
|
|
141
|
-
z.literal(SCOPES.NOTIFICATION_API),
|
|
142
|
-
z.literal(SCOPES.RECORDSEARCH)
|
|
143
|
-
z.literal(SCOPES.INTEGRATION_CREATE)
|
|
123
|
+
var IntegrationScopes = import_zod.z.union([
|
|
124
|
+
import_zod.z.literal(SCOPES.WEBHOOK),
|
|
125
|
+
import_zod.z.literal(SCOPES.NATIONALID),
|
|
126
|
+
import_zod.z.literal(SCOPES.NOTIFICATION_API),
|
|
127
|
+
import_zod.z.literal(SCOPES.RECORDSEARCH)
|
|
144
128
|
]);
|
|
145
|
-
var InternalOperationsScopes = z.union([
|
|
146
|
-
z.literal(SCOPES.RECORD_REINDEX),
|
|
147
|
-
z.literal(SCOPES.RECORD_IMPORT)
|
|
129
|
+
var InternalOperationsScopes = import_zod.z.union([
|
|
130
|
+
import_zod.z.literal(SCOPES.RECORD_REINDEX),
|
|
131
|
+
import_zod.z.literal(SCOPES.RECORD_IMPORT)
|
|
148
132
|
]);
|
|
149
|
-
var DeclareScopes = z.union([
|
|
150
|
-
z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
|
151
|
-
z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
|
152
|
-
z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
|
153
|
-
z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
|
154
|
-
z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
|
155
|
-
z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
|
156
|
-
z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
|
157
|
-
z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
|
|
133
|
+
var DeclareScopes = import_zod.z.union([
|
|
134
|
+
import_zod.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
|
135
|
+
import_zod.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
|
136
|
+
import_zod.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
|
137
|
+
import_zod.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
|
138
|
+
import_zod.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
|
139
|
+
import_zod.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
|
140
|
+
import_zod.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
|
141
|
+
import_zod.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
|
|
158
142
|
]);
|
|
159
|
-
var UnassignScope = z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
|
|
160
|
-
var ValidateScopes = z.union([
|
|
161
|
-
z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
|
162
|
-
z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
|
163
|
-
z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
|
164
|
-
z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
|
165
|
-
z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
|
166
|
-
z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
|
|
143
|
+
var UnassignScope = import_zod.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
|
|
144
|
+
var ValidateScopes = import_zod.z.union([
|
|
145
|
+
import_zod.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
|
146
|
+
import_zod.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
|
147
|
+
import_zod.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
|
148
|
+
import_zod.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
|
149
|
+
import_zod.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
|
150
|
+
import_zod.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
|
|
167
151
|
]);
|
|
168
|
-
var RegisterScope = z.literal(SCOPES.RECORD_REGISTER);
|
|
169
|
-
var CorrectionScopes = z.union([
|
|
170
|
-
z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
|
171
|
-
z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
|
172
|
-
z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
|
173
|
-
z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
|
|
152
|
+
var RegisterScope = import_zod.z.literal(SCOPES.RECORD_REGISTER);
|
|
153
|
+
var CorrectionScopes = import_zod.z.union([
|
|
154
|
+
import_zod.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
|
155
|
+
import_zod.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
|
156
|
+
import_zod.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
|
157
|
+
import_zod.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
|
|
174
158
|
]);
|
|
175
|
-
var SearchScopes = z.union([
|
|
176
|
-
z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
|
177
|
-
z.literal(SCOPES.SEARCH_BIRTH),
|
|
178
|
-
z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
|
179
|
-
z.literal(SCOPES.SEARCH_DEATH),
|
|
180
|
-
z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
|
181
|
-
z.literal(SCOPES.SEARCH_MARRIAGE)
|
|
159
|
+
var SearchScopes = import_zod.z.union([
|
|
160
|
+
import_zod.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
|
161
|
+
import_zod.z.literal(SCOPES.SEARCH_BIRTH),
|
|
162
|
+
import_zod.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
|
163
|
+
import_zod.z.literal(SCOPES.SEARCH_DEATH),
|
|
164
|
+
import_zod.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
|
165
|
+
import_zod.z.literal(SCOPES.SEARCH_MARRIAGE)
|
|
182
166
|
]);
|
|
183
|
-
var AuditScopes = z.literal(SCOPES.RECORD_READ);
|
|
184
|
-
var PerformanceScopes = z.union([
|
|
185
|
-
z.literal(SCOPES.PERFORMANCE_READ),
|
|
186
|
-
z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
|
187
|
-
z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
|
|
167
|
+
var AuditScopes = import_zod.z.literal(SCOPES.RECORD_READ);
|
|
168
|
+
var PerformanceScopes = import_zod.z.union([
|
|
169
|
+
import_zod.z.literal(SCOPES.PERFORMANCE_READ),
|
|
170
|
+
import_zod.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
|
171
|
+
import_zod.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
|
|
188
172
|
]);
|
|
189
|
-
var OrganisationScopes = z.union([
|
|
190
|
-
z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
|
191
|
-
z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
|
192
|
-
z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
|
|
173
|
+
var OrganisationScopes = import_zod.z.union([
|
|
174
|
+
import_zod.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
|
175
|
+
import_zod.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
|
176
|
+
import_zod.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
|
|
193
177
|
]);
|
|
194
|
-
var UserScopes = z.union([
|
|
195
|
-
z.literal(SCOPES.USER_READ),
|
|
196
|
-
z.literal(SCOPES.USER_READ_MY_OFFICE),
|
|
197
|
-
z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
|
198
|
-
z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
|
199
|
-
z.literal(SCOPES.USER_CREATE),
|
|
200
|
-
z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
|
201
|
-
z.literal(SCOPES.USER_UPDATE),
|
|
202
|
-
z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
|
|
178
|
+
var UserScopes = import_zod.z.union([
|
|
179
|
+
import_zod.z.literal(SCOPES.USER_READ),
|
|
180
|
+
import_zod.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
|
181
|
+
import_zod.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
|
182
|
+
import_zod.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
|
183
|
+
import_zod.z.literal(SCOPES.USER_CREATE),
|
|
184
|
+
import_zod.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
|
185
|
+
import_zod.z.literal(SCOPES.USER_UPDATE),
|
|
186
|
+
import_zod.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
|
|
203
187
|
]);
|
|
204
|
-
var ConfigScope = z.literal(SCOPES.CONFIG_UPDATE_ALL);
|
|
205
|
-
var DataSeedingScope = z.literal(SCOPES.USER_DATA_SEEDING);
|
|
206
|
-
var LiteralScopes = z.union([
|
|
188
|
+
var ConfigScope = import_zod.z.literal(SCOPES.CONFIG_UPDATE_ALL);
|
|
189
|
+
var DataSeedingScope = import_zod.z.literal(SCOPES.USER_DATA_SEEDING);
|
|
190
|
+
var LiteralScopes = import_zod.z.union([
|
|
207
191
|
LegacyScopes,
|
|
208
192
|
IntegrationScopes,
|
|
209
193
|
UnassignScope,
|
|
210
194
|
DeclareScopes,
|
|
211
195
|
ValidateScopes,
|
|
212
196
|
RegisterScope,
|
|
213
|
-
z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
|
197
|
+
import_zod.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
|
214
198
|
CorrectionScopes,
|
|
215
199
|
SearchScopes,
|
|
216
200
|
AuditScopes,
|
|
217
|
-
z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
|
|
201
|
+
import_zod.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
|
|
218
202
|
PerformanceScopes,
|
|
219
203
|
OrganisationScopes,
|
|
220
204
|
UserScopes,
|
|
@@ -223,38 +207,38 @@ var LiteralScopes = z.union([
|
|
|
223
207
|
InternalOperationsScopes
|
|
224
208
|
]);
|
|
225
209
|
var rawConfigurableScopeRegex = /^([a-zA-Z][a-zA-Z0-9.-]*(?:\.[a-zA-Z0-9.-]+)*)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
|
226
|
-
var rawConfigurableScope = z.string().regex(rawConfigurableScopeRegex);
|
|
227
|
-
var CreateUserScope = z.object({
|
|
228
|
-
type: z.literal("user.create"),
|
|
229
|
-
options: z.object({
|
|
230
|
-
role: z.array(z.string())
|
|
210
|
+
var rawConfigurableScope = import_zod.z.string().regex(rawConfigurableScopeRegex);
|
|
211
|
+
var CreateUserScope = import_zod.z.object({
|
|
212
|
+
type: import_zod.z.literal("user.create"),
|
|
213
|
+
options: import_zod.z.object({
|
|
214
|
+
role: import_zod.z.array(import_zod.z.string())
|
|
231
215
|
})
|
|
232
216
|
});
|
|
233
|
-
var EditUserScope = z.object({
|
|
234
|
-
type: z.literal("user.edit"),
|
|
235
|
-
options: z.object({
|
|
236
|
-
role: z.array(z.string())
|
|
217
|
+
var EditUserScope = import_zod.z.object({
|
|
218
|
+
type: import_zod.z.literal("user.edit"),
|
|
219
|
+
options: import_zod.z.object({
|
|
220
|
+
role: import_zod.z.array(import_zod.z.string())
|
|
237
221
|
})
|
|
238
222
|
});
|
|
239
|
-
var WorkqueueScope = z.object({
|
|
240
|
-
type: z.literal("workqueue"),
|
|
241
|
-
options: z.object({
|
|
242
|
-
id: z.array(z.string())
|
|
223
|
+
var WorkqueueScope = import_zod.z.object({
|
|
224
|
+
type: import_zod.z.literal("workqueue"),
|
|
225
|
+
options: import_zod.z.object({
|
|
226
|
+
id: import_zod.z.array(import_zod.z.string())
|
|
243
227
|
})
|
|
244
228
|
});
|
|
245
|
-
var SearchScope = z.object({
|
|
246
|
-
type: z.literal("search"),
|
|
247
|
-
options: z.object({
|
|
248
|
-
event: z.array(z.string()).length(1),
|
|
249
|
-
access: z.array(z.enum(["my-jurisdiction", "all"])).length(1)
|
|
229
|
+
var SearchScope = import_zod.z.object({
|
|
230
|
+
type: import_zod.z.literal("search"),
|
|
231
|
+
options: import_zod.z.object({
|
|
232
|
+
event: import_zod.z.array(import_zod.z.string()).length(1),
|
|
233
|
+
access: import_zod.z.array(import_zod.z.enum(["my-jurisdiction", "all"])).length(1)
|
|
250
234
|
})
|
|
251
235
|
});
|
|
252
|
-
var RecordScopeType = z.enum([
|
|
236
|
+
var RecordScopeType = import_zod.z.enum([
|
|
253
237
|
"record.create",
|
|
254
238
|
"record.read",
|
|
255
239
|
"record.declare",
|
|
256
240
|
"record.notify",
|
|
257
|
-
"record.declared.
|
|
241
|
+
"record.declared.validate",
|
|
258
242
|
"record.declared.reject",
|
|
259
243
|
"record.declared.archive",
|
|
260
244
|
"record.declared.review-duplicates",
|
|
@@ -264,33 +248,20 @@ var RecordScopeType = z.enum([
|
|
|
264
248
|
"record.registered.correct",
|
|
265
249
|
"record.unassign-others"
|
|
266
250
|
]);
|
|
267
|
-
var RecordScope = z.object({
|
|
251
|
+
var RecordScope = import_zod.z.object({
|
|
268
252
|
type: RecordScopeType,
|
|
269
|
-
options: z.object({
|
|
270
|
-
event: z.array(z.string()).describe("Event type, e.g. birth, death")
|
|
253
|
+
options: import_zod.z.object({
|
|
254
|
+
event: import_zod.z.array(import_zod.z.string()).describe("Event type, e.g. birth, death")
|
|
271
255
|
})
|
|
272
256
|
}).describe(
|
|
273
257
|
"Scopes used to check user's permission to perform actions on a record."
|
|
274
258
|
);
|
|
275
|
-
var
|
|
276
|
-
type: z.literal("record.custom-action"),
|
|
277
|
-
options: z.object({
|
|
278
|
-
event: z.array(z.string()).describe("Allowed event type, e.g. birth, death"),
|
|
279
|
-
customActionType: z.array(z.string()).describe("Allowed custom action types")
|
|
280
|
-
})
|
|
281
|
-
});
|
|
282
|
-
var ConfigurableRawScopes = z.discriminatedUnion("type", [
|
|
259
|
+
var ConfigurableRawScopes = import_zod.z.discriminatedUnion("type", [
|
|
283
260
|
SearchScope,
|
|
284
261
|
CreateUserScope,
|
|
285
262
|
EditUserScope,
|
|
286
263
|
WorkqueueScope,
|
|
287
|
-
RecordScope
|
|
288
|
-
CustomActionScope
|
|
289
|
-
]);
|
|
290
|
-
var ConfigurableActionScopes = z.discriminatedUnion("type", [
|
|
291
|
-
// @TODO - Record scope holds non-action scopes as well e.g., `record.read`
|
|
292
|
-
RecordScope,
|
|
293
|
-
CustomActionScope
|
|
264
|
+
RecordScope
|
|
294
265
|
]);
|
|
295
266
|
function flattenAndMergeScopes(scopes2) {
|
|
296
267
|
if (scopes2.length === 0) return null;
|
|
@@ -316,15 +287,6 @@ function findScope(scopes2, scopeType) {
|
|
|
316
287
|
(scope) => scope?.type === scopeType
|
|
317
288
|
);
|
|
318
289
|
}
|
|
319
|
-
function findScopes(scopes2, scopeType) {
|
|
320
|
-
const parsedScopes = scopes2.map(parseConfigurableScope);
|
|
321
|
-
const searchScopes = parsedScopes.filter((scope) => scope?.type === "search");
|
|
322
|
-
const otherScopes = parsedScopes.filter((scope) => scope?.type !== "search");
|
|
323
|
-
const mergedSearchScope = flattenAndMergeScopes(searchScopes);
|
|
324
|
-
return [...otherScopes, mergedSearchScope].filter(
|
|
325
|
-
(scope) => scope?.type === scopeType
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
290
|
function getScopeOptions(rawOptions) {
|
|
329
291
|
return rawOptions.split(",").reduce((acc, option) => {
|
|
330
292
|
const [key, value] = option.split("=");
|
|
@@ -369,13 +331,10 @@ function getAuthorizedEventsFromScopes(scopes2) {
|
|
|
369
331
|
}).filter((event) => event !== void 0).filter((event, index, self) => self.indexOf(event) === index);
|
|
370
332
|
}
|
|
371
333
|
var scopes = Object.values(SCOPES);
|
|
372
|
-
var ActionScopes = z.union([
|
|
334
|
+
var ActionScopes = import_zod.z.union([
|
|
373
335
|
DeclareScopes,
|
|
374
336
|
ValidateScopes,
|
|
375
337
|
RegisterScope,
|
|
376
|
-
z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
|
338
|
+
import_zod.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
|
377
339
|
CorrectionScopes
|
|
378
340
|
]);
|
|
379
|
-
|
|
380
|
-
// src/scopes/index.ts
|
|
381
|
-
z2.globalRegistry.clear();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencrvs/toolkit",
|
|
3
|
-
"version": "1.9.7-rc.
|
|
3
|
+
"version": "1.9.7-rc.480775d",
|
|
4
4
|
"description": "OpenCRVS toolkit for building country configurations",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"exports": {
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
"build:all": "lerna run build --include-dependencies --scope @opencrvs/toolkit && ./build.sh"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"
|
|
21
|
-
"@trpc/server": "11.4.3",
|
|
20
|
+
"uuid": "^9.0.0",
|
|
22
21
|
"ajv": "^8.17.1",
|
|
23
22
|
"ajv-formats": "^3.0.1",
|
|
24
23
|
"object-hash": "^3.0.0",
|
|
25
24
|
"superjson": "1.9.0-0",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
25
|
+
"@trpc/client": "11.4.3",
|
|
26
|
+
"@trpc/server": "11.4.3",
|
|
27
|
+
"zod-openapi": "^4.2.4"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/uuid": "^9.0.3",
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod/v4';
|
|
2
|
-
export declare const InherentFlags: {
|
|
3
|
-
readonly INCOMPLETE: "incomplete";
|
|
4
|
-
readonly REJECTED: "rejected";
|
|
5
|
-
readonly CORRECTION_REQUESTED: "correction-requested";
|
|
6
|
-
readonly POTENTIAL_DUPLICATE: "potential-duplicate";
|
|
7
|
-
/**
|
|
8
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
9
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
10
|
-
*
|
|
11
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
12
|
-
*/
|
|
13
|
-
readonly EDIT_IN_PROGRESS: "edit-in-progress";
|
|
14
|
-
};
|
|
15
|
-
export type InherentFlags = (typeof InherentFlags)[keyof typeof InherentFlags];
|
|
16
|
-
export declare const ActionFlag: z.ZodString;
|
|
17
|
-
export type ActionFlag = z.infer<typeof ActionFlag>;
|
|
18
|
-
/** Custom flag identifier defined by the country config. These may not match any InherentFlags or ActionFlag patterns. */
|
|
19
|
-
export declare const CustomFlag: z.ZodString;
|
|
20
|
-
export type CustomFlag = z.infer<typeof CustomFlag>;
|
|
21
|
-
export declare const Flag: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
|
|
22
|
-
readonly INCOMPLETE: "incomplete";
|
|
23
|
-
readonly REJECTED: "rejected";
|
|
24
|
-
readonly CORRECTION_REQUESTED: "correction-requested";
|
|
25
|
-
readonly POTENTIAL_DUPLICATE: "potential-duplicate";
|
|
26
|
-
/**
|
|
27
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
28
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
29
|
-
*
|
|
30
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
31
|
-
*/
|
|
32
|
-
readonly EDIT_IN_PROGRESS: "edit-in-progress";
|
|
33
|
-
}>]>, z.ZodString]>;
|
|
34
|
-
export type Flag = z.infer<typeof Flag>;
|
|
35
|
-
/**
|
|
36
|
-
* Configuration of a custom flag that can be associated with a certain event type.
|
|
37
|
-
*/
|
|
38
|
-
export declare const FlagConfig: z.ZodObject<{
|
|
39
|
-
id: z.ZodString;
|
|
40
|
-
requiresAction: z.ZodBoolean;
|
|
41
|
-
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
42
|
-
}, z.core.$strip>;
|
|
43
|
-
export type FlagConfig = z.infer<typeof FlagConfig>;
|
|
44
|
-
/**
|
|
45
|
-
* Configuration for a flag action, which is executed when the action is performed.
|
|
46
|
-
*/
|
|
47
|
-
export declare const ActionFlagConfig: z.ZodObject<{
|
|
48
|
-
id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
|
|
49
|
-
readonly INCOMPLETE: "incomplete";
|
|
50
|
-
readonly REJECTED: "rejected";
|
|
51
|
-
readonly CORRECTION_REQUESTED: "correction-requested";
|
|
52
|
-
readonly POTENTIAL_DUPLICATE: "potential-duplicate";
|
|
53
|
-
/**
|
|
54
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
55
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
56
|
-
*
|
|
57
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
58
|
-
*/
|
|
59
|
-
readonly EDIT_IN_PROGRESS: "edit-in-progress";
|
|
60
|
-
}>]>, z.ZodString]>;
|
|
61
|
-
operation: z.ZodEnum<{
|
|
62
|
-
add: "add";
|
|
63
|
-
remove: "remove";
|
|
64
|
-
}>;
|
|
65
|
-
conditional: z.ZodOptional<z.ZodAny>;
|
|
66
|
-
}, z.core.$strip>;
|
|
67
|
-
//# sourceMappingURL=Flag.d.ts.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod/v4';
|
|
2
|
-
import { EventConfig } from './EventConfig';
|
|
3
|
-
export declare function validateAdvancedSearchConfig(event: EventConfig, ctx: z.RefinementCtx<EventConfig>): void;
|
|
4
|
-
export declare function validateDateOfEvent(event: EventConfig, ctx: z.RefinementCtx<EventConfig>): void;
|
|
5
|
-
export declare function validatePlaceOfEvent(event: EventConfig, ctx: z.RefinementCtx<EventConfig>): void;
|
|
6
|
-
export declare function validateActionFlags(event: EventConfig, ctx: z.RefinementCtx<EventConfig>): void;
|
|
7
|
-
export declare function validateActionOrder(event: EventConfig, ctx: z.RefinementCtx<EventConfig>): void;
|
|
8
|
-
//# sourceMappingURL=eventConfigValidation.d.ts.map
|