@opencrvs/toolkit 1.9.15-rc.fc1c0fb → 2.0.0-rc.0096e47
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 +13 -0
- package/create-countryconfig/index.js +103 -0
- package/create-countryconfig/package.json +21 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/application-config/index.d.ts +2 -0
- package/dist/application-config/index.d.ts.map +1 -0
- package/dist/application-config/index.js +2304 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +5244 -0
- package/dist/commons/api/router.d.ts +5630 -3673
- package/dist/commons/application-config/index.d.ts +97 -0
- package/dist/commons/conditionals/conditionals.d.ts +33 -3
- package/dist/commons/conditionals/validate.d.ts +20 -1
- package/dist/commons/events/ActionConfig.d.ts +415 -1555
- package/dist/commons/events/ActionDocument.d.ts +894 -1941
- package/dist/commons/events/ActionInput.d.ts +326 -1212
- package/dist/commons/events/ActionType.d.ts +91 -11
- package/dist/commons/events/AdvancedSearchConfig.d.ts +636 -1496
- package/dist/commons/events/AuditLog.d.ts +407 -0
- package/dist/commons/events/CompositeFieldValue.d.ts +30 -190
- package/dist/commons/events/Conditional.d.ts +26 -38
- package/dist/commons/events/Constants.d.ts +1 -1
- package/dist/commons/events/CountryConfigQueryInput.d.ts +1592 -4471
- package/dist/commons/events/DeduplicationConfig.d.ts +15 -171
- package/dist/commons/events/Draft.d.ts +72 -111
- package/dist/commons/events/DynamicFieldValue.d.ts +12 -78
- package/dist/commons/events/EventConfig.d.ts +37 -2427
- package/dist/commons/events/EventConfigInput.d.ts +0 -3
- package/dist/commons/events/EventDocument.d.ts +357 -1366
- package/dist/commons/events/EventIndex.d.ts +211 -1012
- package/dist/commons/events/EventInput.d.ts +3 -8
- package/dist/commons/events/EventMetadata.d.ts +129 -363
- package/dist/commons/events/FieldConfig.d.ts +3147 -14211
- package/dist/commons/events/FieldType.d.ts +26 -4
- package/dist/commons/events/FieldTypeMapping.d.ts +314 -906
- package/dist/commons/events/FieldValue.d.ts +154 -526
- package/dist/commons/events/FileUtils.d.ts +2 -2
- package/dist/commons/events/Flag.d.ts +67 -0
- package/dist/commons/events/FormConfig.d.ts +54 -721
- package/dist/commons/events/PageConfig.d.ts +58 -320
- package/dist/commons/events/PlainDate.d.ts +1 -1
- package/dist/commons/events/SummaryConfig.d.ts +14 -161
- package/dist/commons/events/TemplateConfig.d.ts +2 -3
- package/dist/commons/events/TranslationConfig.d.ts +2 -2
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +74 -37
- package/dist/commons/events/WorkqueueConfig.d.ts +2232 -7577
- package/dist/commons/events/deduplication.d.ts +3 -3
- package/dist/commons/events/defineConfig.d.ts +2 -248
- package/dist/commons/events/eventConfigValidation.d.ts +8 -0
- package/dist/commons/events/field.d.ts +6 -0
- package/dist/commons/events/index.d.ts +5 -0
- package/dist/commons/events/locations.d.ts +93 -19
- package/dist/commons/events/mocks.test.utils.d.ts +19 -0
- package/dist/commons/events/scopes.d.ts +56 -32
- package/dist/commons/events/state/availableActions.d.ts +7 -2
- package/dist/commons/events/state/flags.d.ts +37 -3
- package/dist/commons/events/state/index.d.ts +29 -30
- package/dist/commons/events/state/utils.d.ts +25 -284
- package/dist/commons/events/test.utils.d.ts +52 -11
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +383 -273
- package/dist/commons/notification/UserNotifications.d.ts +76 -637
- package/dist/conditionals/index.d.ts.map +1 -1
- package/dist/conditionals/index.js +338 -14
- package/dist/events/deduplication.d.ts +3 -3
- package/dist/events/index.js +3699 -2235
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +3 -0
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +429 -0
- package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +3 -0
- package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +1 -0
- package/dist/migrations/v2.0/add-resend-invite-notification.js +373 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +22 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -0
- package/dist/migrations/v2.0/checkout-upstream-files.js +146 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +2 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +828 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +3 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.js +158 -0
- package/dist/migrations/v2.0/create-events-index.d.ts +3 -0
- package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -0
- package/dist/migrations/v2.0/create-events-index.js +325 -0
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +11 -0
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -0
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +123 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
- package/dist/migrations/v2.0/index.d.ts +13 -0
- package/dist/migrations/v2.0/index.d.ts.map +1 -0
- package/dist/migrations/v2.0/index.js +5154 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +3 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +432 -0
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +13 -0
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -0
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +222 -0
- package/dist/migrations/v2.0/migrate-application-config-url.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-application-config-url.js +342 -0
- package/dist/migrations/v2.0/migrate-scopes.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-scopes.js +305 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +267 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +317 -0
- package/dist/migrations/v2.0/remove-delete-actions.d.ts +3 -0
- package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-delete-actions.js +156 -0
- package/dist/migrations/v2.0/remove-demo-scope.d.ts +3 -0
- package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-demo-scope.js +74 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +3 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.js +96 -0
- package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +3 -0
- package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-fhir-url-helpers.js +163 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +3 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.js +77 -0
- package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +3 -0
- package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-old-statistics-service.js +356 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +3 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.js +109 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +3 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.js +163 -0
- package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +3 -0
- package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-unused-environment-variables.js +186 -0
- package/dist/migrations/v2.0/rename-api-paths.d.ts +3 -0
- package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -0
- package/dist/migrations/v2.0/rename-api-paths.js +187 -0
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts +3 -0
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -0
- package/dist/migrations/v2.0/rename-location-parent-id.js +180 -0
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +3 -0
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -0
- package/dist/migrations/v2.0/simplify-analytics-precalculations.js +195 -0
- package/dist/migrations/v2.0/update-package-json.d.ts +3 -0
- package/dist/migrations/v2.0/update-package-json.d.ts.map +1 -0
- package/dist/migrations/v2.0/update-package-json.js +105 -0
- package/dist/notification/index.d.ts.map +1 -1
- package/dist/notification/index.js +2730 -1848
- package/dist/scopes/index.d.ts +714 -352
- package/dist/scopes/index.d.ts.map +1 -1
- package/dist/scopes/index.js +381 -298
- package/opencrvs-toolkit-2.0.0-rc.0096e47.tgz +0 -0
- package/package.json +14 -4
- package/tsconfig.json +12 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/commons/events/CreatedAtLocation.d.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conditionals/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conditionals/index.ts"],"names":[],"mappings":"AAaA,cAAc,gCAAgC,CAAA"}
|
|
@@ -30,28 +30,32 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/conditionals/index.ts
|
|
31
31
|
var conditionals_exports = {};
|
|
32
32
|
__export(conditionals_exports, {
|
|
33
|
+
always: () => always,
|
|
33
34
|
alwaysTrue: () => alwaysTrue,
|
|
34
35
|
and: () => and,
|
|
35
36
|
createFieldConditionals: () => createFieldConditionals,
|
|
36
37
|
defineConditional: () => defineConditional,
|
|
37
38
|
defineFormConditional: () => defineFormConditional,
|
|
39
|
+
flag: () => flag,
|
|
38
40
|
isEventFieldReference: () => isEventFieldReference,
|
|
39
41
|
isFieldReference: () => isFieldReference,
|
|
40
42
|
never: () => never,
|
|
41
43
|
not: () => not,
|
|
42
44
|
now: () => now,
|
|
43
45
|
or: () => or,
|
|
46
|
+
status: () => status,
|
|
44
47
|
user: () => user
|
|
45
48
|
});
|
|
46
49
|
module.exports = __toCommonJS(conditionals_exports);
|
|
50
|
+
var z8 = __toESM(require("zod/v4"));
|
|
47
51
|
|
|
48
52
|
// ../commons/src/conditionals/conditionals.ts
|
|
49
53
|
var objectHash = __toESM(require("object-hash"));
|
|
50
54
|
|
|
51
55
|
// ../commons/src/events/serializers/user/serializer.ts
|
|
52
|
-
var
|
|
53
|
-
var SerializedUserField =
|
|
54
|
-
$userField:
|
|
56
|
+
var z = __toESM(require("zod/v4"));
|
|
57
|
+
var SerializedUserField = z.object({
|
|
58
|
+
$userField: z.enum([
|
|
55
59
|
"id",
|
|
56
60
|
"name",
|
|
57
61
|
"role",
|
|
@@ -60,11 +64,12 @@ var SerializedUserField = import_zod.z.object({
|
|
|
60
64
|
"firstname",
|
|
61
65
|
"middlename",
|
|
62
66
|
"surname",
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"primaryOfficeId"
|
|
67
|
+
"signature",
|
|
68
|
+
"avatar",
|
|
69
|
+
"primaryOfficeId",
|
|
70
|
+
"administrativeAreaId"
|
|
66
71
|
]),
|
|
67
|
-
$location:
|
|
72
|
+
$location: z.string().optional()
|
|
68
73
|
});
|
|
69
74
|
function userSerializer(userField) {
|
|
70
75
|
return {
|
|
@@ -84,7 +89,7 @@ function userSerializer(userField) {
|
|
|
84
89
|
}
|
|
85
90
|
|
|
86
91
|
// ../commons/src/utils.ts
|
|
87
|
-
var z2 = __toESM(require("zod"));
|
|
92
|
+
var z2 = __toESM(require("zod/v4"));
|
|
88
93
|
var _ = __toESM(require("lodash"));
|
|
89
94
|
var FullNameV1 = z2.array(
|
|
90
95
|
z2.object({
|
|
@@ -110,14 +115,301 @@ function omitKeyDeep(obj, keyToRemove) {
|
|
|
110
115
|
}
|
|
111
116
|
|
|
112
117
|
// ../commons/src/events/serializers/date/serializer.ts
|
|
113
|
-
var
|
|
114
|
-
var SerializedNowDateTime =
|
|
115
|
-
$$now:
|
|
118
|
+
var import_zod = require("zod");
|
|
119
|
+
var SerializedNowDateTime = import_zod.z.object({
|
|
120
|
+
$$now: import_zod.z.literal(true)
|
|
116
121
|
});
|
|
117
122
|
function todayDateTimeValueSerializer() {
|
|
118
123
|
return { $$now: true };
|
|
119
124
|
}
|
|
120
125
|
|
|
126
|
+
// ../commons/src/scopes.ts
|
|
127
|
+
var z6 = __toESM(require("zod/v4"));
|
|
128
|
+
var qs = __toESM(require("qs"));
|
|
129
|
+
|
|
130
|
+
// ../commons/src/uuid.ts
|
|
131
|
+
var import_uuid = require("uuid");
|
|
132
|
+
var z4 = __toESM(require("zod/v4"));
|
|
133
|
+
var UUID = z4.uuid().brand("UUID");
|
|
134
|
+
|
|
135
|
+
// ../commons/src/authentication.ts
|
|
136
|
+
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
137
|
+
var z5 = __toESM(require("zod/v4"));
|
|
138
|
+
var TokenUserType = z5.enum(["user", "system"]);
|
|
139
|
+
var TokenWithBearer = z5.string().regex(/^Bearer\s/);
|
|
140
|
+
|
|
141
|
+
// ../commons/src/scopes.ts
|
|
142
|
+
var JurisdictionFilter = z6.enum(["administrativeArea", "location", "all"]).describe(
|
|
143
|
+
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
144
|
+
);
|
|
145
|
+
var UserFilter = z6.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
146
|
+
var RecordScopeTypeV2 = z6.enum([
|
|
147
|
+
"record.search",
|
|
148
|
+
"record.create",
|
|
149
|
+
"record.read",
|
|
150
|
+
"record.declare",
|
|
151
|
+
"record.notify",
|
|
152
|
+
"record.edit",
|
|
153
|
+
"record.reject",
|
|
154
|
+
"record.archive",
|
|
155
|
+
"record.review-duplicates",
|
|
156
|
+
"record.register",
|
|
157
|
+
"record.print-certified-copies",
|
|
158
|
+
"record.request-correction",
|
|
159
|
+
"record.correct",
|
|
160
|
+
"record.unassign-others",
|
|
161
|
+
"record.custom-action"
|
|
162
|
+
]);
|
|
163
|
+
var PlainScopeType = z6.enum([
|
|
164
|
+
// Misc. system scopes
|
|
165
|
+
"bypassratelimit",
|
|
166
|
+
"record.reindex",
|
|
167
|
+
"user.data-seeding",
|
|
168
|
+
"integration.create",
|
|
169
|
+
"record.import",
|
|
170
|
+
"config.update-all",
|
|
171
|
+
"attachment.upload",
|
|
172
|
+
"profile.electronic-signature",
|
|
173
|
+
"user.read-only-my-audit",
|
|
174
|
+
// Performance dashboard
|
|
175
|
+
"performance.read",
|
|
176
|
+
"performance.read-dashboards",
|
|
177
|
+
"performance.vital-statistics-export",
|
|
178
|
+
// Scopes used exclusively by countryconfig integration token
|
|
179
|
+
"record.confirm-registration",
|
|
180
|
+
"record.reject-registration"
|
|
181
|
+
]);
|
|
182
|
+
var scopeByEvent = z6.preprocess(
|
|
183
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
184
|
+
z6.array(z6.string()).optional()
|
|
185
|
+
).describe("Event type, e.g. birth, death");
|
|
186
|
+
var userRole = z6.preprocess(
|
|
187
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
188
|
+
z6.array(z6.string()).optional()
|
|
189
|
+
).describe("User role, e.g. admin, field agent");
|
|
190
|
+
var scopeOptionsPlaceEvent = z6.object({
|
|
191
|
+
event: scopeByEvent,
|
|
192
|
+
placeOfEvent: JurisdictionFilter.optional()
|
|
193
|
+
}).describe("Options applicable to all record scopes.");
|
|
194
|
+
var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
|
|
195
|
+
declaredIn: JurisdictionFilter.optional(),
|
|
196
|
+
declaredBy: UserFilter.optional()
|
|
197
|
+
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
198
|
+
var AllRecordScopeOptions = scopeOptionsDeclared.extend({
|
|
199
|
+
registeredIn: JurisdictionFilter.optional(),
|
|
200
|
+
registeredBy: UserFilter.optional()
|
|
201
|
+
}).describe(
|
|
202
|
+
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
203
|
+
);
|
|
204
|
+
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
205
|
+
customActionTypes: z6.preprocess(
|
|
206
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
207
|
+
z6.array(z6.string()).optional()
|
|
208
|
+
).describe("Allowed custom action types")
|
|
209
|
+
});
|
|
210
|
+
var AccessLevelOptions = z6.object({
|
|
211
|
+
accessLevel: JurisdictionFilter.optional()
|
|
212
|
+
});
|
|
213
|
+
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
214
|
+
role: userRole.optional()
|
|
215
|
+
});
|
|
216
|
+
var WorkqueueOrDashboardOptions = z6.object({
|
|
217
|
+
ids: z6.preprocess(
|
|
218
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
219
|
+
z6.array(z6.string())
|
|
220
|
+
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
221
|
+
});
|
|
222
|
+
var AllScopeOptions = z6.object({
|
|
223
|
+
...AllRecordScopeOptions.shape,
|
|
224
|
+
...AccessLevelOptions.shape,
|
|
225
|
+
...AllUserScopeOptions.shape,
|
|
226
|
+
...WorkqueueOrDashboardOptions.shape
|
|
227
|
+
});
|
|
228
|
+
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
229
|
+
var ResolvedScopeOptionsPlaceEvent = z6.object({
|
|
230
|
+
event: scopeByEvent,
|
|
231
|
+
placeOfEvent: UUID.nullish()
|
|
232
|
+
}).describe(
|
|
233
|
+
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
234
|
+
);
|
|
235
|
+
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
236
|
+
declaredIn: UUID.nullish(),
|
|
237
|
+
declaredBy: z6.string().optional()
|
|
238
|
+
}).describe(
|
|
239
|
+
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
240
|
+
);
|
|
241
|
+
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
242
|
+
registeredIn: UUID.nullish(),
|
|
243
|
+
registeredBy: z6.string().optional()
|
|
244
|
+
}).describe(
|
|
245
|
+
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
246
|
+
);
|
|
247
|
+
var ScopesWithPlaceEventOptions = RecordScopeTypeV2.extract([
|
|
248
|
+
"record.create",
|
|
249
|
+
"record.declare",
|
|
250
|
+
"record.notify"
|
|
251
|
+
]);
|
|
252
|
+
var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
253
|
+
"record.edit",
|
|
254
|
+
"record.reject",
|
|
255
|
+
"record.archive",
|
|
256
|
+
"record.review-duplicates",
|
|
257
|
+
"record.register"
|
|
258
|
+
]);
|
|
259
|
+
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
260
|
+
"record.search",
|
|
261
|
+
"record.read",
|
|
262
|
+
"record.request-correction",
|
|
263
|
+
"record.correct",
|
|
264
|
+
"record.unassign-others"
|
|
265
|
+
]);
|
|
266
|
+
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
267
|
+
templates: z6.preprocess(
|
|
268
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
269
|
+
z6.array(z6.string()).optional()
|
|
270
|
+
).describe(
|
|
271
|
+
"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."
|
|
272
|
+
)
|
|
273
|
+
});
|
|
274
|
+
var RecordScopeV2 = z6.discriminatedUnion("type", [
|
|
275
|
+
z6.object({
|
|
276
|
+
type: ScopesWithPlaceEventOptions,
|
|
277
|
+
options: scopeOptionsPlaceEvent.optional()
|
|
278
|
+
}),
|
|
279
|
+
z6.object({
|
|
280
|
+
type: ScopesWithDeclaredOptions,
|
|
281
|
+
options: scopeOptionsDeclared.optional()
|
|
282
|
+
}),
|
|
283
|
+
z6.object({
|
|
284
|
+
type: ScopesWithFullOptions,
|
|
285
|
+
options: AllRecordScopeOptions.optional()
|
|
286
|
+
}),
|
|
287
|
+
z6.object({
|
|
288
|
+
type: z6.literal("record.custom-action"),
|
|
289
|
+
options: CustomActionScopeOptions.optional()
|
|
290
|
+
}),
|
|
291
|
+
z6.object({
|
|
292
|
+
type: z6.literal("record.print-certified-copies"),
|
|
293
|
+
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
294
|
+
})
|
|
295
|
+
]).describe(
|
|
296
|
+
"Scopes used to check user's permission to perform actions on a record."
|
|
297
|
+
);
|
|
298
|
+
var SystemScopeType = z6.enum([
|
|
299
|
+
"organisation.read-locations",
|
|
300
|
+
"user.read",
|
|
301
|
+
"user.create",
|
|
302
|
+
"user.edit",
|
|
303
|
+
"user.search"
|
|
304
|
+
]);
|
|
305
|
+
var UserScopeType = SystemScopeType.extract([
|
|
306
|
+
"user.read",
|
|
307
|
+
"user.create",
|
|
308
|
+
"user.edit",
|
|
309
|
+
"user.search"
|
|
310
|
+
]);
|
|
311
|
+
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
312
|
+
var UserScopeV2 = z6.discriminatedUnion("type", [
|
|
313
|
+
z6.object({
|
|
314
|
+
type: ScopesWithRoleOption,
|
|
315
|
+
options: AllUserScopeOptions.optional()
|
|
316
|
+
}),
|
|
317
|
+
z6.object({
|
|
318
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
319
|
+
options: AccessLevelOptions.optional()
|
|
320
|
+
})
|
|
321
|
+
]);
|
|
322
|
+
var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
|
|
323
|
+
z6.object({
|
|
324
|
+
type: ScopesWithPlaceEventOptions,
|
|
325
|
+
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
326
|
+
}),
|
|
327
|
+
z6.object({
|
|
328
|
+
type: ScopesWithDeclaredOptions,
|
|
329
|
+
options: ResolvedScopeOptionsDeclared.optional()
|
|
330
|
+
}),
|
|
331
|
+
z6.object({
|
|
332
|
+
type: ScopesWithFullOptions,
|
|
333
|
+
options: ResolvedScopeOptionsFull.optional()
|
|
334
|
+
}),
|
|
335
|
+
z6.object({
|
|
336
|
+
type: z6.literal("record.print-certified-copies"),
|
|
337
|
+
options: ResolvedScopeOptionsFull.extend({
|
|
338
|
+
templates: z6.array(z6.string()).optional()
|
|
339
|
+
}).optional()
|
|
340
|
+
})
|
|
341
|
+
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
342
|
+
var Scope2 = z6.discriminatedUnion("type", [
|
|
343
|
+
z6.object({ type: PlainScopeType }),
|
|
344
|
+
...RecordScopeV2.options,
|
|
345
|
+
...UserScopeV2.options,
|
|
346
|
+
z6.object({
|
|
347
|
+
type: z6.literal("organisation.read-locations"),
|
|
348
|
+
options: AccessLevelOptions.optional()
|
|
349
|
+
}),
|
|
350
|
+
z6.object({
|
|
351
|
+
type: z6.literal("workqueue"),
|
|
352
|
+
options: WorkqueueOrDashboardOptions
|
|
353
|
+
}),
|
|
354
|
+
z6.object({
|
|
355
|
+
type: z6.literal("dashboard.view"),
|
|
356
|
+
options: WorkqueueOrDashboardOptions
|
|
357
|
+
})
|
|
358
|
+
]);
|
|
359
|
+
var ScopeType2 = z6.enum([
|
|
360
|
+
...SystemScopeType.options,
|
|
361
|
+
...RecordScopeTypeV2.options,
|
|
362
|
+
...PlainScopeType.options,
|
|
363
|
+
"workqueue",
|
|
364
|
+
"dashboard.view"
|
|
365
|
+
]);
|
|
366
|
+
var EncodedScope2 = z6.string().brand("EncodedScope");
|
|
367
|
+
var DEFAULT_SCOPE_OPTIONS = {
|
|
368
|
+
placeOfEvent: JurisdictionFilter.enum.all,
|
|
369
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
370
|
+
registeredIn: JurisdictionFilter.enum.all,
|
|
371
|
+
declaredIn: JurisdictionFilter.enum.all
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
// ../commons/src/users/userReferences.ts
|
|
375
|
+
var import_v4 = __toESM(require("zod/v4"));
|
|
376
|
+
var ScopeOptionReference = import_v4.default.object({
|
|
377
|
+
$scope: ScopeType2,
|
|
378
|
+
$option: ScopeOptionKey
|
|
379
|
+
});
|
|
380
|
+
var JurisdictionReference = import_v4.default.object({
|
|
381
|
+
$jurisdiction: JurisdictionFilter.or(ScopeOptionReference)
|
|
382
|
+
});
|
|
383
|
+
var userReferenceFunctions = {
|
|
384
|
+
scope: (scope) => ({
|
|
385
|
+
/**
|
|
386
|
+
* user.scope().attribute() is used to create a scope option reference.
|
|
387
|
+
*
|
|
388
|
+
* E.g.: user.scope('record.create').attribute('placeOfEvent')
|
|
389
|
+
*
|
|
390
|
+
* @param option - The option to create a reference for.
|
|
391
|
+
* @returns A scope option reference.
|
|
392
|
+
*/
|
|
393
|
+
attribute: (option) => ({
|
|
394
|
+
$scope: scope,
|
|
395
|
+
$option: option
|
|
396
|
+
})
|
|
397
|
+
}),
|
|
398
|
+
/**
|
|
399
|
+
* user.jurisdicton() accepts two different kinds of parameters, either:
|
|
400
|
+
*
|
|
401
|
+
* 1. a plain jurisdiction filter: user.jurisdiction('administrativeArea')
|
|
402
|
+
* 2. a scope option reference: user.jurisdiction(user.scope('record.create').attribute('placeOfEvent'))
|
|
403
|
+
*
|
|
404
|
+
* These will be resolved during runtime.
|
|
405
|
+
*
|
|
406
|
+
* @param jurisdiction - The jurisdiction to resolve.
|
|
407
|
+
*/
|
|
408
|
+
jurisdiction: (jurisdiction) => ({
|
|
409
|
+
$jurisdiction: jurisdiction
|
|
410
|
+
})
|
|
411
|
+
};
|
|
412
|
+
|
|
121
413
|
// ../commons/src/conditionals/conditionals.ts
|
|
122
414
|
function defineConditional(schema) {
|
|
123
415
|
const schemaWithooutIDRef = omitKeyDeep(schema, "$id");
|
|
@@ -163,6 +455,9 @@ function not(condition) {
|
|
|
163
455
|
function never() {
|
|
164
456
|
return not(alwaysTrue());
|
|
165
457
|
}
|
|
458
|
+
function always() {
|
|
459
|
+
return defineConditional(alwaysTrue());
|
|
460
|
+
}
|
|
166
461
|
function jsonFieldPath(field) {
|
|
167
462
|
return [field.$$field, ...field.$$subfield].join("/");
|
|
168
463
|
}
|
|
@@ -193,6 +488,7 @@ function wrapToPathOptional(condition, path) {
|
|
|
193
488
|
}
|
|
194
489
|
var now = Object.assign(todayDateTimeValueSerializer, {});
|
|
195
490
|
var user = Object.assign(userSerializer, {
|
|
491
|
+
...userReferenceFunctions,
|
|
196
492
|
hasScope: (scope) => defineConditional({
|
|
197
493
|
type: "object",
|
|
198
494
|
properties: {
|
|
@@ -239,9 +535,7 @@ var user = Object.assign(userSerializer, {
|
|
|
239
535
|
required: ["$online"]
|
|
240
536
|
}),
|
|
241
537
|
locationLevel: (adminLevelId) => ({
|
|
242
|
-
$user: {
|
|
243
|
-
$location: adminLevelId
|
|
244
|
-
}
|
|
538
|
+
$user: { $location: adminLevelId }
|
|
245
539
|
})
|
|
246
540
|
});
|
|
247
541
|
function isFieldReference(value) {
|
|
@@ -334,6 +628,33 @@ function defineComparison(field, value, keyword) {
|
|
|
334
628
|
required: [field.$$field]
|
|
335
629
|
});
|
|
336
630
|
}
|
|
631
|
+
function flag(flagvalue) {
|
|
632
|
+
return defineConditional({
|
|
633
|
+
type: "object",
|
|
634
|
+
properties: {
|
|
635
|
+
$flags: {
|
|
636
|
+
type: "array",
|
|
637
|
+
contains: {
|
|
638
|
+
type: "string",
|
|
639
|
+
const: flagvalue
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
},
|
|
643
|
+
required: ["$flags"]
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
function status(statusValue) {
|
|
647
|
+
return defineConditional({
|
|
648
|
+
type: "object",
|
|
649
|
+
properties: {
|
|
650
|
+
$status: {
|
|
651
|
+
type: "string",
|
|
652
|
+
const: statusValue
|
|
653
|
+
}
|
|
654
|
+
},
|
|
655
|
+
required: ["$status"]
|
|
656
|
+
});
|
|
657
|
+
}
|
|
337
658
|
function createFieldConditionals(fieldId) {
|
|
338
659
|
const getDayRange = (field, days, clause, referenceDate) => ({
|
|
339
660
|
type: "object",
|
|
@@ -734,3 +1055,6 @@ function createFieldConditionals(fieldId) {
|
|
|
734
1055
|
}
|
|
735
1056
|
};
|
|
736
1057
|
}
|
|
1058
|
+
|
|
1059
|
+
// src/conditionals/index.ts
|
|
1060
|
+
z8.globalRegistry.clear();
|
|
@@ -7,17 +7,17 @@ export declare function field(fieldId: string): {
|
|
|
7
7
|
fieldId: string;
|
|
8
8
|
type: "fuzzy";
|
|
9
9
|
options: {
|
|
10
|
+
fuzziness?: string | number | undefined;
|
|
10
11
|
boost?: number | undefined;
|
|
11
12
|
matchAgainst?: string | undefined;
|
|
12
|
-
fuzziness?: string | number | undefined;
|
|
13
13
|
} | undefined;
|
|
14
14
|
};
|
|
15
15
|
strictMatches: (options?: StrictMatcherOptions) => {
|
|
16
16
|
fieldId: string;
|
|
17
17
|
type: "strict";
|
|
18
18
|
options: {
|
|
19
|
-
value?: string | undefined;
|
|
20
19
|
boost?: number | undefined;
|
|
20
|
+
value?: string | undefined;
|
|
21
21
|
matchAgainst?: string | undefined;
|
|
22
22
|
} | undefined;
|
|
23
23
|
};
|
|
@@ -60,9 +60,9 @@ export declare function field(fieldId: string): {
|
|
|
60
60
|
type: "dateRange";
|
|
61
61
|
options: {
|
|
62
62
|
days: number;
|
|
63
|
+
pivot?: number | undefined;
|
|
63
64
|
boost?: number | undefined;
|
|
64
65
|
matchAgainst?: string | undefined;
|
|
65
|
-
pivot?: number | undefined;
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
68
|
};
|