@opencrvs/toolkit 1.9.4-rc.0e695b2 → 1.9.4-rc.469f912
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 +2440 -28495
- package/dist/commons/conditionals/conditionals.d.ts +1 -10
- package/dist/commons/conditionals/validate.d.ts +4 -11
- package/dist/commons/events/ActionConfig.d.ts +1552 -23416
- package/dist/commons/events/ActionDocument.d.ts +1856 -803
- 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 +176 -27
- 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 +4169 -931
- package/dist/commons/events/CreatedAtLocation.d.ts +1 -1
- package/dist/commons/events/DeduplicationConfig.d.ts +150 -15
- package/dist/commons/events/Draft.d.ts +105 -70
- package/dist/commons/events/DynamicFieldValue.d.ts +91 -7
- package/dist/commons/events/EventConfig.d.ts +2120 -18663
- package/dist/commons/events/EventConfigInput.d.ts +1 -1
- package/dist/commons/events/EventDocument.d.ts +1332 -320
- package/dist/commons/events/EventIndex.d.ts +967 -197
- package/dist/commons/events/EventInput.d.ts +8 -2
- package/dist/commons/events/EventMetadata.d.ts +346 -106
- package/dist/commons/events/FieldConfig.d.ts +11774 -4259
- package/dist/commons/events/FieldType.d.ts +4 -20
- package/dist/commons/events/FieldTypeMapping.d.ts +813 -181
- package/dist/commons/events/FieldValue.d.ts +356 -83
- package/dist/commons/events/FormConfig.d.ts +721 -13140
- package/dist/commons/events/PageConfig.d.ts +319 -8780
- package/dist/commons/events/SummaryConfig.d.ts +161 -14
- package/dist/commons/events/TemplateConfig.d.ts +3 -3
- 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 +7080 -1615
- package/dist/commons/events/deduplication.d.ts +3 -3
- package/dist/commons/events/defineConfig.d.ts +163 -25639
- package/dist/commons/events/event.d.ts +4 -4
- package/dist/commons/events/index.d.ts +0 -1
- package/dist/commons/events/locations.d.ts +19 -15
- package/dist/commons/events/scopes.d.ts +4 -5
- package/dist/commons/events/state/availableActions.d.ts +1 -2
- package/dist/commons/events/state/flags.d.ts +3 -21
- package/dist/commons/events/state/index.d.ts +19 -23
- package/dist/commons/events/state/utils.d.ts +112 -130
- package/dist/commons/events/test.utils.d.ts +8 -17
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +373 -51350
- package/dist/commons/notification/UserNotifications.d.ts +636 -55
- package/dist/conditionals/index.d.ts.map +1 -1
- package/dist/conditionals/index.js +5 -38
- package/dist/events/deduplication.d.ts +3 -3
- package/dist/events/index.js +1545 -1805
- package/dist/notification/index.d.ts.map +1 -1
- package/dist/notification/index.js +1412 -1430
- package/dist/scopes/index.d.ts +132 -167
- package/dist/scopes/index.d.ts.map +1 -1
- package/dist/scopes/index.js +94 -133
- package/package.json +5 -5
- package/dist/commons/events/Flag.d.ts +0 -70
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",
|
|
@@ -128,91 +114,91 @@ var SCOPES = {
|
|
|
128
114
|
// data seeding
|
|
129
115
|
USER_DATA_SEEDING: "user.data-seeding"
|
|
130
116
|
};
|
|
131
|
-
var LegacyScopes = z.union([
|
|
132
|
-
z.literal(SCOPES.BYPASSRATELIMIT),
|
|
133
|
-
z.literal(SCOPES.REGISTER),
|
|
134
|
-
z.literal(SCOPES.DEMO),
|
|
135
|
-
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)
|
|
136
122
|
]);
|
|
137
|
-
var IntegrationScopes = z.union([
|
|
138
|
-
z.literal(SCOPES.WEBHOOK),
|
|
139
|
-
z.literal(SCOPES.NATIONALID),
|
|
140
|
-
z.literal(SCOPES.NOTIFICATION_API),
|
|
141
|
-
z.literal(SCOPES.RECORDSEARCH)
|
|
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)
|
|
142
128
|
]);
|
|
143
|
-
var InternalOperationsScopes = z.union([
|
|
144
|
-
z.literal(SCOPES.RECORD_REINDEX),
|
|
145
|
-
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)
|
|
146
132
|
]);
|
|
147
|
-
var DeclareScopes = z.union([
|
|
148
|
-
z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
|
149
|
-
z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
|
150
|
-
z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
|
151
|
-
z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
|
152
|
-
z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
|
153
|
-
z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
|
154
|
-
z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
|
155
|
-
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)
|
|
156
142
|
]);
|
|
157
|
-
var UnassignScope = z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
|
|
158
|
-
var ValidateScopes = z.union([
|
|
159
|
-
z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
|
160
|
-
z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
|
161
|
-
z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
|
162
|
-
z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
|
163
|
-
z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
|
164
|
-
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)
|
|
165
151
|
]);
|
|
166
|
-
var RegisterScope = z.literal(SCOPES.RECORD_REGISTER);
|
|
167
|
-
var CorrectionScopes = z.union([
|
|
168
|
-
z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
|
169
|
-
z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
|
170
|
-
z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
|
171
|
-
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)
|
|
172
158
|
]);
|
|
173
|
-
var SearchScopes = z.union([
|
|
174
|
-
z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
|
175
|
-
z.literal(SCOPES.SEARCH_BIRTH),
|
|
176
|
-
z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
|
177
|
-
z.literal(SCOPES.SEARCH_DEATH),
|
|
178
|
-
z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
|
179
|
-
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)
|
|
180
166
|
]);
|
|
181
|
-
var AuditScopes = z.literal(SCOPES.RECORD_READ);
|
|
182
|
-
var PerformanceScopes = z.union([
|
|
183
|
-
z.literal(SCOPES.PERFORMANCE_READ),
|
|
184
|
-
z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
|
185
|
-
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)
|
|
186
172
|
]);
|
|
187
|
-
var OrganisationScopes = z.union([
|
|
188
|
-
z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
|
189
|
-
z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
|
190
|
-
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)
|
|
191
177
|
]);
|
|
192
|
-
var UserScopes = z.union([
|
|
193
|
-
z.literal(SCOPES.USER_READ),
|
|
194
|
-
z.literal(SCOPES.USER_READ_MY_OFFICE),
|
|
195
|
-
z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
|
196
|
-
z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
|
197
|
-
z.literal(SCOPES.USER_CREATE),
|
|
198
|
-
z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
|
199
|
-
z.literal(SCOPES.USER_UPDATE),
|
|
200
|
-
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)
|
|
201
187
|
]);
|
|
202
|
-
var ConfigScope = z.literal(SCOPES.CONFIG_UPDATE_ALL);
|
|
203
|
-
var DataSeedingScope = z.literal(SCOPES.USER_DATA_SEEDING);
|
|
204
|
-
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([
|
|
205
191
|
LegacyScopes,
|
|
206
192
|
IntegrationScopes,
|
|
207
193
|
UnassignScope,
|
|
208
194
|
DeclareScopes,
|
|
209
195
|
ValidateScopes,
|
|
210
196
|
RegisterScope,
|
|
211
|
-
z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
|
197
|
+
import_zod.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
|
212
198
|
CorrectionScopes,
|
|
213
199
|
SearchScopes,
|
|
214
200
|
AuditScopes,
|
|
215
|
-
z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
|
|
201
|
+
import_zod.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
|
|
216
202
|
PerformanceScopes,
|
|
217
203
|
OrganisationScopes,
|
|
218
204
|
UserScopes,
|
|
@@ -221,38 +207,38 @@ var LiteralScopes = z.union([
|
|
|
221
207
|
InternalOperationsScopes
|
|
222
208
|
]);
|
|
223
209
|
var rawConfigurableScopeRegex = /^([a-zA-Z][a-zA-Z0-9.-]*(?:\.[a-zA-Z0-9.-]+)*)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
|
224
|
-
var rawConfigurableScope = z.string().regex(rawConfigurableScopeRegex);
|
|
225
|
-
var CreateUserScope = z.object({
|
|
226
|
-
type: z.literal("user.create"),
|
|
227
|
-
options: z.object({
|
|
228
|
-
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())
|
|
229
215
|
})
|
|
230
216
|
});
|
|
231
|
-
var EditUserScope = z.object({
|
|
232
|
-
type: z.literal("user.edit"),
|
|
233
|
-
options: z.object({
|
|
234
|
-
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())
|
|
235
221
|
})
|
|
236
222
|
});
|
|
237
|
-
var WorkqueueScope = z.object({
|
|
238
|
-
type: z.literal("workqueue"),
|
|
239
|
-
options: z.object({
|
|
240
|
-
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())
|
|
241
227
|
})
|
|
242
228
|
});
|
|
243
|
-
var SearchScope = z.object({
|
|
244
|
-
type: z.literal("search"),
|
|
245
|
-
options: z.object({
|
|
246
|
-
event: z.array(z.string()).length(1),
|
|
247
|
-
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)
|
|
248
234
|
})
|
|
249
235
|
});
|
|
250
|
-
var RecordScopeType = z.enum([
|
|
236
|
+
var RecordScopeType = import_zod.z.enum([
|
|
251
237
|
"record.create",
|
|
252
238
|
"record.read",
|
|
253
239
|
"record.declare",
|
|
254
240
|
"record.notify",
|
|
255
|
-
"record.declared.
|
|
241
|
+
"record.declared.validate",
|
|
256
242
|
"record.declared.reject",
|
|
257
243
|
"record.declared.archive",
|
|
258
244
|
"record.declared.review-duplicates",
|
|
@@ -262,33 +248,20 @@ var RecordScopeType = z.enum([
|
|
|
262
248
|
"record.registered.correct",
|
|
263
249
|
"record.unassign-others"
|
|
264
250
|
]);
|
|
265
|
-
var RecordScope = z.object({
|
|
251
|
+
var RecordScope = import_zod.z.object({
|
|
266
252
|
type: RecordScopeType,
|
|
267
|
-
options: z.object({
|
|
268
|
-
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")
|
|
269
255
|
})
|
|
270
256
|
}).describe(
|
|
271
257
|
"Scopes used to check user's permission to perform actions on a record."
|
|
272
258
|
);
|
|
273
|
-
var
|
|
274
|
-
type: z.literal("record.custom-action"),
|
|
275
|
-
options: z.object({
|
|
276
|
-
event: z.array(z.string()).describe("Allowed event type, e.g. birth, death"),
|
|
277
|
-
customActionType: z.array(z.string()).describe("Allowed custom action types")
|
|
278
|
-
})
|
|
279
|
-
});
|
|
280
|
-
var ConfigurableRawScopes = z.discriminatedUnion("type", [
|
|
259
|
+
var ConfigurableRawScopes = import_zod.z.discriminatedUnion("type", [
|
|
281
260
|
SearchScope,
|
|
282
261
|
CreateUserScope,
|
|
283
262
|
EditUserScope,
|
|
284
263
|
WorkqueueScope,
|
|
285
|
-
RecordScope
|
|
286
|
-
CustomActionScope
|
|
287
|
-
]);
|
|
288
|
-
var ConfigurableActionScopes = z.discriminatedUnion("type", [
|
|
289
|
-
// @TODO - Record scope holds non-action scopes as well e.g., `record.read`
|
|
290
|
-
RecordScope,
|
|
291
|
-
CustomActionScope
|
|
264
|
+
RecordScope
|
|
292
265
|
]);
|
|
293
266
|
function flattenAndMergeScopes(scopes2) {
|
|
294
267
|
if (scopes2.length === 0) return null;
|
|
@@ -314,15 +287,6 @@ function findScope(scopes2, scopeType) {
|
|
|
314
287
|
(scope) => scope?.type === scopeType
|
|
315
288
|
);
|
|
316
289
|
}
|
|
317
|
-
function findScopes(scopes2, scopeType) {
|
|
318
|
-
const parsedScopes = scopes2.map(parseConfigurableScope);
|
|
319
|
-
const searchScopes = parsedScopes.filter((scope) => scope?.type === "search");
|
|
320
|
-
const otherScopes = parsedScopes.filter((scope) => scope?.type !== "search");
|
|
321
|
-
const mergedSearchScope = flattenAndMergeScopes(searchScopes);
|
|
322
|
-
return [...otherScopes, mergedSearchScope].filter(
|
|
323
|
-
(scope) => scope?.type === scopeType
|
|
324
|
-
);
|
|
325
|
-
}
|
|
326
290
|
function getScopeOptions(rawOptions) {
|
|
327
291
|
return rawOptions.split(",").reduce((acc, option) => {
|
|
328
292
|
const [key, value] = option.split("=");
|
|
@@ -367,13 +331,10 @@ function getAuthorizedEventsFromScopes(scopes2) {
|
|
|
367
331
|
}).filter((event) => event !== void 0).filter((event, index, self) => self.indexOf(event) === index);
|
|
368
332
|
}
|
|
369
333
|
var scopes = Object.values(SCOPES);
|
|
370
|
-
var ActionScopes = z.union([
|
|
334
|
+
var ActionScopes = import_zod.z.union([
|
|
371
335
|
DeclareScopes,
|
|
372
336
|
ValidateScopes,
|
|
373
337
|
RegisterScope,
|
|
374
|
-
z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
|
338
|
+
import_zod.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
|
375
339
|
CorrectionScopes
|
|
376
340
|
]);
|
|
377
|
-
|
|
378
|
-
// src/scopes/index.ts
|
|
379
|
-
z2.globalRegistry.clear();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencrvs/toolkit",
|
|
3
|
-
"version": "1.9.4-rc.
|
|
3
|
+
"version": "1.9.4-rc.469f912",
|
|
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,70 +0,0 @@
|
|
|
1
|
-
import * as z from 'zod/v4';
|
|
2
|
-
export declare const InherentFlags: {
|
|
3
|
-
readonly PENDING_CERTIFICATION: "pending-certification";
|
|
4
|
-
readonly INCOMPLETE: "incomplete";
|
|
5
|
-
readonly REJECTED: "rejected";
|
|
6
|
-
readonly CORRECTION_REQUESTED: "correction-requested";
|
|
7
|
-
readonly POTENTIAL_DUPLICATE: "potential-duplicate";
|
|
8
|
-
/**
|
|
9
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
10
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
11
|
-
*
|
|
12
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
13
|
-
*/
|
|
14
|
-
readonly EDIT_IN_PROGRESS: "edit-in-progress";
|
|
15
|
-
};
|
|
16
|
-
export type InherentFlags = (typeof InherentFlags)[keyof typeof InherentFlags];
|
|
17
|
-
export declare const ActionFlag: z.ZodString;
|
|
18
|
-
export type ActionFlag = z.infer<typeof ActionFlag>;
|
|
19
|
-
/** Custom flag identifier defined by the country config. These may not match any InherentFlags or ActionFlag patterns. */
|
|
20
|
-
export declare const CustomFlag: z.ZodString;
|
|
21
|
-
export type CustomFlag = z.infer<typeof CustomFlag>;
|
|
22
|
-
export declare const Flag: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
|
|
23
|
-
readonly PENDING_CERTIFICATION: "pending-certification";
|
|
24
|
-
readonly INCOMPLETE: "incomplete";
|
|
25
|
-
readonly REJECTED: "rejected";
|
|
26
|
-
readonly CORRECTION_REQUESTED: "correction-requested";
|
|
27
|
-
readonly POTENTIAL_DUPLICATE: "potential-duplicate";
|
|
28
|
-
/**
|
|
29
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
30
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
31
|
-
*
|
|
32
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
33
|
-
*/
|
|
34
|
-
readonly EDIT_IN_PROGRESS: "edit-in-progress";
|
|
35
|
-
}>]>, z.ZodString]>;
|
|
36
|
-
export type Flag = z.infer<typeof Flag>;
|
|
37
|
-
/**
|
|
38
|
-
* Configuration of a custom flag that can be associated with a certain event type.
|
|
39
|
-
*/
|
|
40
|
-
export declare const FlagConfig: z.ZodObject<{
|
|
41
|
-
id: z.ZodString;
|
|
42
|
-
requiresAction: z.ZodBoolean;
|
|
43
|
-
label: z.ZodObject<import("./TranslationConfig").MessageDescriptorZod, z.core.$strip>;
|
|
44
|
-
}, z.core.$strip>;
|
|
45
|
-
export type FlagConfig = z.infer<typeof FlagConfig>;
|
|
46
|
-
/**
|
|
47
|
-
* Configuration for a flag action, which is executed when the action is performed.
|
|
48
|
-
*/
|
|
49
|
-
export declare const ActionFlagConfig: z.ZodObject<{
|
|
50
|
-
id: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodEnum<{
|
|
51
|
-
readonly PENDING_CERTIFICATION: "pending-certification";
|
|
52
|
-
readonly INCOMPLETE: "incomplete";
|
|
53
|
-
readonly REJECTED: "rejected";
|
|
54
|
-
readonly CORRECTION_REQUESTED: "correction-requested";
|
|
55
|
-
readonly POTENTIAL_DUPLICATE: "potential-duplicate";
|
|
56
|
-
/**
|
|
57
|
-
* This flag is set by the Edit-action and removed after the declaration or registration.
|
|
58
|
-
* A record should never stay with the EDIT_IN_PROGRESS flag, since it should always be declared or registered right after.
|
|
59
|
-
*
|
|
60
|
-
* We only use this flag to determine that a NOTIFY, DECLARE or REGISTER action is allowed next.
|
|
61
|
-
*/
|
|
62
|
-
readonly EDIT_IN_PROGRESS: "edit-in-progress";
|
|
63
|
-
}>]>, z.ZodString]>;
|
|
64
|
-
operation: z.ZodEnum<{
|
|
65
|
-
add: "add";
|
|
66
|
-
remove: "remove";
|
|
67
|
-
}>;
|
|
68
|
-
conditional: z.ZodOptional<z.ZodAny>;
|
|
69
|
-
}, z.core.$strip>;
|
|
70
|
-
//# sourceMappingURL=Flag.d.ts.map
|