@opencrvs/toolkit 1.9.13-rc.f1fdcea → 2.0.0-rc.0146adf
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/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 +2156 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +4972 -0
- package/dist/commons/api/router.d.ts +3497 -2348
- package/dist/commons/application-config/index.d.ts +96 -0
- package/dist/commons/conditionals/conditionals.d.ts +27 -3
- package/dist/commons/conditionals/validate.d.ts +13 -2
- package/dist/commons/events/ActionConfig.d.ts +415 -1555
- package/dist/commons/events/ActionDocument.d.ts +888 -1941
- package/dist/commons/events/ActionInput.d.ts +277 -1073
- package/dist/commons/events/ActionType.d.ts +91 -11
- package/dist/commons/events/AdvancedSearchConfig.d.ts +294 -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 -107
- package/dist/commons/events/DynamicFieldValue.d.ts +12 -78
- package/dist/commons/events/EventConfig.d.ts +37 -2420
- package/dist/commons/events/EventConfigInput.d.ts +0 -3
- package/dist/commons/events/EventDocument.d.ts +354 -1366
- package/dist/commons/events/EventIndex.d.ts +212 -1010
- package/dist/commons/events/EventInput.d.ts +3 -8
- package/dist/commons/events/EventMetadata.d.ts +130 -357
- package/dist/commons/events/FieldConfig.d.ts +2897 -12901
- 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 +149 -527
- 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 +2208 -7553
- package/dist/commons/events/deduplication.d.ts +3 -3
- package/dist/commons/events/defineConfig.d.ts +2 -247
- package/dist/commons/events/eventConfigValidation.d.ts +8 -0
- package/dist/commons/events/index.d.ts +3 -0
- package/dist/commons/events/locations.d.ts +73 -20
- package/dist/commons/events/scopes.d.ts +36 -35
- package/dist/commons/events/state/availableActions.d.ts +7 -2
- package/dist/commons/events/state/flags.d.ts +21 -3
- package/dist/commons/events/state/index.d.ts +30 -27
- package/dist/commons/events/state/utils.d.ts +190 -172
- 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 +374 -443
- package/dist/commons/notification/UserNotifications.d.ts +76 -637
- package/dist/conditionals/index.d.ts.map +1 -1
- package/dist/conditionals/index.js +330 -14
- package/dist/events/deduplication.d.ts +3 -3
- package/dist/events/index.js +2923 -2112
- 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 +147 -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 +3 -0
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -0
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +77 -0
- package/dist/migrations/v2.0/index.d.ts +11 -0
- package/dist/migrations/v2.0/index.d.ts.map +1 -0
- package/dist/migrations/v2.0/index.js +4882 -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 +3 -0
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -0
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +221 -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 +281 -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 +236 -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 +2110 -1770
- package/dist/scopes/index.d.ts +711 -352
- package/dist/scopes/index.d.ts.map +1 -1
- package/dist/scopes/index.js +372 -299
- package/opencrvs-toolkit-2.0.0-rc.0146adf.tgz +0 -0
- package/package.json +18 -8
- 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"}
|
|
@@ -35,23 +35,26 @@ __export(conditionals_exports, {
|
|
|
35
35
|
createFieldConditionals: () => createFieldConditionals,
|
|
36
36
|
defineConditional: () => defineConditional,
|
|
37
37
|
defineFormConditional: () => defineFormConditional,
|
|
38
|
+
flag: () => flag,
|
|
38
39
|
isEventFieldReference: () => isEventFieldReference,
|
|
39
40
|
isFieldReference: () => isFieldReference,
|
|
40
41
|
never: () => never,
|
|
41
42
|
not: () => not,
|
|
42
43
|
now: () => now,
|
|
43
44
|
or: () => or,
|
|
45
|
+
status: () => status,
|
|
44
46
|
user: () => user
|
|
45
47
|
});
|
|
46
48
|
module.exports = __toCommonJS(conditionals_exports);
|
|
49
|
+
var z8 = __toESM(require("zod/v4"));
|
|
47
50
|
|
|
48
51
|
// ../commons/src/conditionals/conditionals.ts
|
|
49
52
|
var objectHash = __toESM(require("object-hash"));
|
|
50
53
|
|
|
51
54
|
// ../commons/src/events/serializers/user/serializer.ts
|
|
52
|
-
var
|
|
53
|
-
var SerializedUserField =
|
|
54
|
-
$userField:
|
|
55
|
+
var z = __toESM(require("zod/v4"));
|
|
56
|
+
var SerializedUserField = z.object({
|
|
57
|
+
$userField: z.enum([
|
|
55
58
|
"id",
|
|
56
59
|
"name",
|
|
57
60
|
"role",
|
|
@@ -60,11 +63,12 @@ var SerializedUserField = import_zod.z.object({
|
|
|
60
63
|
"firstname",
|
|
61
64
|
"middlename",
|
|
62
65
|
"surname",
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"primaryOfficeId"
|
|
66
|
+
"signature",
|
|
67
|
+
"avatar",
|
|
68
|
+
"primaryOfficeId",
|
|
69
|
+
"administrativeAreaId"
|
|
66
70
|
]),
|
|
67
|
-
$location:
|
|
71
|
+
$location: z.string().optional()
|
|
68
72
|
});
|
|
69
73
|
function userSerializer(userField) {
|
|
70
74
|
return {
|
|
@@ -84,7 +88,7 @@ function userSerializer(userField) {
|
|
|
84
88
|
}
|
|
85
89
|
|
|
86
90
|
// ../commons/src/utils.ts
|
|
87
|
-
var z2 = __toESM(require("zod"));
|
|
91
|
+
var z2 = __toESM(require("zod/v4"));
|
|
88
92
|
var _ = __toESM(require("lodash"));
|
|
89
93
|
var FullNameV1 = z2.array(
|
|
90
94
|
z2.object({
|
|
@@ -110,14 +114,297 @@ function omitKeyDeep(obj, keyToRemove) {
|
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
// ../commons/src/events/serializers/date/serializer.ts
|
|
113
|
-
var
|
|
114
|
-
var SerializedNowDateTime =
|
|
115
|
-
$$now:
|
|
117
|
+
var import_zod = require("zod");
|
|
118
|
+
var SerializedNowDateTime = import_zod.z.object({
|
|
119
|
+
$$now: import_zod.z.literal(true)
|
|
116
120
|
});
|
|
117
121
|
function todayDateTimeValueSerializer() {
|
|
118
122
|
return { $$now: true };
|
|
119
123
|
}
|
|
120
124
|
|
|
125
|
+
// ../commons/src/scopes.ts
|
|
126
|
+
var z6 = __toESM(require("zod/v4"));
|
|
127
|
+
var qs = __toESM(require("qs"));
|
|
128
|
+
|
|
129
|
+
// ../commons/src/uuid.ts
|
|
130
|
+
var import_uuid = require("uuid");
|
|
131
|
+
var z4 = __toESM(require("zod/v4"));
|
|
132
|
+
var UUID = z4.uuid().brand("UUID");
|
|
133
|
+
|
|
134
|
+
// ../commons/src/authentication.ts
|
|
135
|
+
var import_jwt_decode = __toESM(require("jwt-decode"));
|
|
136
|
+
var z5 = __toESM(require("zod/v4"));
|
|
137
|
+
var TokenUserType = z5.enum(["user", "system"]);
|
|
138
|
+
var TokenWithBearer = z5.string().regex(/^Bearer\s/);
|
|
139
|
+
|
|
140
|
+
// ../commons/src/scopes.ts
|
|
141
|
+
var JurisdictionFilter = z6.enum(["administrativeArea", "location", "all"]).describe(
|
|
142
|
+
"Filters based on user jurisdiction relative to their office location in hierarchy."
|
|
143
|
+
);
|
|
144
|
+
var UserFilter = z6.enum(["user"]).describe("Filters based on the user. Limits to self.");
|
|
145
|
+
var RecordScopeTypeV2 = z6.enum([
|
|
146
|
+
"record.search",
|
|
147
|
+
"record.create",
|
|
148
|
+
"record.read",
|
|
149
|
+
"record.declare",
|
|
150
|
+
"record.notify",
|
|
151
|
+
"record.edit",
|
|
152
|
+
"record.reject",
|
|
153
|
+
"record.archive",
|
|
154
|
+
"record.review-duplicates",
|
|
155
|
+
"record.register",
|
|
156
|
+
"record.print-certified-copies",
|
|
157
|
+
"record.request-correction",
|
|
158
|
+
"record.correct",
|
|
159
|
+
"record.unassign-others",
|
|
160
|
+
"record.custom-action"
|
|
161
|
+
]);
|
|
162
|
+
var PlainScopeType = z6.enum([
|
|
163
|
+
// Misc. system scopes
|
|
164
|
+
"bypassratelimit",
|
|
165
|
+
"record.reindex",
|
|
166
|
+
"user.data-seeding",
|
|
167
|
+
"integration.create",
|
|
168
|
+
"record.import",
|
|
169
|
+
"config.update-all",
|
|
170
|
+
"attachment.upload",
|
|
171
|
+
"profile.electronic-signature",
|
|
172
|
+
"user.read-only-my-audit",
|
|
173
|
+
// Performance dashboard
|
|
174
|
+
"performance.read",
|
|
175
|
+
"performance.read-dashboards",
|
|
176
|
+
"performance.vital-statistics-export",
|
|
177
|
+
// Scopes used exclusively by countryconfig integration token
|
|
178
|
+
"record.confirm-registration",
|
|
179
|
+
"record.reject-registration"
|
|
180
|
+
]);
|
|
181
|
+
var scopeByEvent = z6.preprocess(
|
|
182
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
183
|
+
z6.array(z6.string()).optional()
|
|
184
|
+
).describe("Event type, e.g. birth, death");
|
|
185
|
+
var userRole = z6.preprocess(
|
|
186
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
187
|
+
z6.array(z6.string()).optional()
|
|
188
|
+
).describe("User role, e.g. admin, field agent");
|
|
189
|
+
var scopeOptionsPlaceEvent = z6.object({
|
|
190
|
+
event: scopeByEvent,
|
|
191
|
+
placeOfEvent: JurisdictionFilter.optional()
|
|
192
|
+
}).describe("Options applicable to all record scopes.");
|
|
193
|
+
var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
|
|
194
|
+
declaredIn: JurisdictionFilter.optional(),
|
|
195
|
+
declaredBy: UserFilter.optional()
|
|
196
|
+
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
197
|
+
var AllRecordScopeOptions = scopeOptionsDeclared.extend({
|
|
198
|
+
registeredIn: JurisdictionFilter.optional(),
|
|
199
|
+
registeredBy: UserFilter.optional()
|
|
200
|
+
}).describe(
|
|
201
|
+
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
202
|
+
);
|
|
203
|
+
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
204
|
+
customActionTypes: z6.preprocess(
|
|
205
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
206
|
+
z6.array(z6.string()).optional()
|
|
207
|
+
).describe("Allowed custom action types")
|
|
208
|
+
});
|
|
209
|
+
var AccessLevelOptions = z6.object({
|
|
210
|
+
accessLevel: JurisdictionFilter.optional()
|
|
211
|
+
});
|
|
212
|
+
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
213
|
+
role: userRole.optional()
|
|
214
|
+
});
|
|
215
|
+
var WorkqueueOrDashboardOptions = z6.object({
|
|
216
|
+
ids: z6.preprocess(
|
|
217
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
218
|
+
z6.array(z6.string())
|
|
219
|
+
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
220
|
+
});
|
|
221
|
+
var AllScopeOptions = z6.object({
|
|
222
|
+
...AllRecordScopeOptions.shape,
|
|
223
|
+
...AccessLevelOptions.shape,
|
|
224
|
+
...AllUserScopeOptions.shape,
|
|
225
|
+
...WorkqueueOrDashboardOptions.shape
|
|
226
|
+
});
|
|
227
|
+
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
228
|
+
var ResolvedScopeOptionsPlaceEvent = z6.object({
|
|
229
|
+
event: scopeByEvent,
|
|
230
|
+
placeOfEvent: UUID.nullish()
|
|
231
|
+
}).describe(
|
|
232
|
+
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
233
|
+
);
|
|
234
|
+
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
235
|
+
declaredIn: UUID.nullish(),
|
|
236
|
+
declaredBy: z6.string().optional()
|
|
237
|
+
}).describe(
|
|
238
|
+
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
239
|
+
);
|
|
240
|
+
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
241
|
+
registeredIn: UUID.nullish(),
|
|
242
|
+
registeredBy: z6.string().optional()
|
|
243
|
+
}).describe(
|
|
244
|
+
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
245
|
+
);
|
|
246
|
+
var ScopesWithPlaceEventOptions = RecordScopeTypeV2.extract([
|
|
247
|
+
"record.create",
|
|
248
|
+
"record.declare",
|
|
249
|
+
"record.notify"
|
|
250
|
+
]);
|
|
251
|
+
var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
252
|
+
"record.edit",
|
|
253
|
+
"record.reject",
|
|
254
|
+
"record.archive",
|
|
255
|
+
"record.review-duplicates",
|
|
256
|
+
"record.register"
|
|
257
|
+
]);
|
|
258
|
+
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
259
|
+
"record.search",
|
|
260
|
+
"record.read",
|
|
261
|
+
"record.request-correction",
|
|
262
|
+
"record.correct",
|
|
263
|
+
"record.unassign-others"
|
|
264
|
+
]);
|
|
265
|
+
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
266
|
+
templates: z6.preprocess(
|
|
267
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
268
|
+
z6.array(z6.string()).optional()
|
|
269
|
+
).describe(
|
|
270
|
+
"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."
|
|
271
|
+
)
|
|
272
|
+
});
|
|
273
|
+
var RecordScopeV2 = z6.discriminatedUnion("type", [
|
|
274
|
+
z6.object({
|
|
275
|
+
type: ScopesWithPlaceEventOptions,
|
|
276
|
+
options: scopeOptionsPlaceEvent.optional()
|
|
277
|
+
}),
|
|
278
|
+
z6.object({
|
|
279
|
+
type: ScopesWithDeclaredOptions,
|
|
280
|
+
options: scopeOptionsDeclared.optional()
|
|
281
|
+
}),
|
|
282
|
+
z6.object({
|
|
283
|
+
type: ScopesWithFullOptions,
|
|
284
|
+
options: AllRecordScopeOptions.optional()
|
|
285
|
+
}),
|
|
286
|
+
z6.object({
|
|
287
|
+
type: z6.literal("record.custom-action"),
|
|
288
|
+
options: CustomActionScopeOptions.optional()
|
|
289
|
+
}),
|
|
290
|
+
z6.object({
|
|
291
|
+
type: z6.literal("record.print-certified-copies"),
|
|
292
|
+
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
293
|
+
})
|
|
294
|
+
]).describe(
|
|
295
|
+
"Scopes used to check user's permission to perform actions on a record."
|
|
296
|
+
);
|
|
297
|
+
var SystemScopeType = z6.enum([
|
|
298
|
+
"organisation.read-locations",
|
|
299
|
+
"user.read",
|
|
300
|
+
"user.create",
|
|
301
|
+
"user.edit"
|
|
302
|
+
]);
|
|
303
|
+
var UserScopeType = SystemScopeType.extract([
|
|
304
|
+
"user.read",
|
|
305
|
+
"user.create",
|
|
306
|
+
"user.edit"
|
|
307
|
+
]);
|
|
308
|
+
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
309
|
+
var UserScopeV2 = z6.discriminatedUnion("type", [
|
|
310
|
+
z6.object({
|
|
311
|
+
type: ScopesWithRoleOption,
|
|
312
|
+
options: AllUserScopeOptions.optional()
|
|
313
|
+
}),
|
|
314
|
+
z6.object({
|
|
315
|
+
type: UserScopeType.extract(["user.read"]),
|
|
316
|
+
options: AccessLevelOptions.optional()
|
|
317
|
+
})
|
|
318
|
+
]);
|
|
319
|
+
var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
|
|
320
|
+
z6.object({
|
|
321
|
+
type: ScopesWithPlaceEventOptions,
|
|
322
|
+
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
323
|
+
}),
|
|
324
|
+
z6.object({
|
|
325
|
+
type: ScopesWithDeclaredOptions,
|
|
326
|
+
options: ResolvedScopeOptionsDeclared.optional()
|
|
327
|
+
}),
|
|
328
|
+
z6.object({
|
|
329
|
+
type: ScopesWithFullOptions,
|
|
330
|
+
options: ResolvedScopeOptionsFull.optional()
|
|
331
|
+
}),
|
|
332
|
+
z6.object({
|
|
333
|
+
type: z6.literal("record.print-certified-copies"),
|
|
334
|
+
options: ResolvedScopeOptionsFull.extend({
|
|
335
|
+
templates: z6.array(z6.string()).optional()
|
|
336
|
+
}).optional()
|
|
337
|
+
})
|
|
338
|
+
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
339
|
+
var Scope2 = z6.discriminatedUnion("type", [
|
|
340
|
+
z6.object({ type: PlainScopeType }),
|
|
341
|
+
...RecordScopeV2.options,
|
|
342
|
+
...UserScopeV2.options,
|
|
343
|
+
z6.object({
|
|
344
|
+
type: z6.literal("organisation.read-locations"),
|
|
345
|
+
options: AccessLevelOptions.optional()
|
|
346
|
+
}),
|
|
347
|
+
z6.object({
|
|
348
|
+
type: z6.literal("workqueue"),
|
|
349
|
+
options: WorkqueueOrDashboardOptions
|
|
350
|
+
}),
|
|
351
|
+
z6.object({
|
|
352
|
+
type: z6.literal("dashboard.view"),
|
|
353
|
+
options: WorkqueueOrDashboardOptions
|
|
354
|
+
})
|
|
355
|
+
]);
|
|
356
|
+
var ScopeType2 = z6.enum([
|
|
357
|
+
...SystemScopeType.options,
|
|
358
|
+
...RecordScopeTypeV2.options,
|
|
359
|
+
...PlainScopeType.options,
|
|
360
|
+
"workqueue",
|
|
361
|
+
"dashboard.view"
|
|
362
|
+
]);
|
|
363
|
+
var EncodedScope2 = z6.string().brand("EncodedScope");
|
|
364
|
+
var DEFAULT_SCOPE_OPTIONS = {
|
|
365
|
+
placeOfEvent: JurisdictionFilter.enum.all,
|
|
366
|
+
accessLevel: JurisdictionFilter.enum.all
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
// ../commons/src/users/userReferences.ts
|
|
370
|
+
var import_v4 = __toESM(require("zod/v4"));
|
|
371
|
+
var ScopeOptionReference = import_v4.default.object({
|
|
372
|
+
$scope: ScopeType2,
|
|
373
|
+
$option: ScopeOptionKey
|
|
374
|
+
});
|
|
375
|
+
var JurisdictionReference = import_v4.default.object({
|
|
376
|
+
$jurisdiction: JurisdictionFilter.or(ScopeOptionReference)
|
|
377
|
+
});
|
|
378
|
+
var userReferenceFunctions = {
|
|
379
|
+
scope: (scope) => ({
|
|
380
|
+
/**
|
|
381
|
+
* user.scope().attribute() is used to create a scope option reference.
|
|
382
|
+
*
|
|
383
|
+
* E.g.: user.scope('record.create').attribute('placeOfEvent')
|
|
384
|
+
*
|
|
385
|
+
* @param option - The option to create a reference for.
|
|
386
|
+
* @returns A scope option reference.
|
|
387
|
+
*/
|
|
388
|
+
attribute: (option) => ({
|
|
389
|
+
$scope: scope,
|
|
390
|
+
$option: option
|
|
391
|
+
})
|
|
392
|
+
}),
|
|
393
|
+
/**
|
|
394
|
+
* user.jurisdicton() accepts two different kinds of parameters, either:
|
|
395
|
+
*
|
|
396
|
+
* 1. a plain jurisdiction filter: user.jurisdiction('administrativeArea')
|
|
397
|
+
* 2. a scope option reference: user.jurisdiction(user.scope('record.create').attribute('placeOfEvent'))
|
|
398
|
+
*
|
|
399
|
+
* These will be resolved during runtime.
|
|
400
|
+
*
|
|
401
|
+
* @param jurisdiction - The jurisdiction to resolve.
|
|
402
|
+
*/
|
|
403
|
+
jurisdiction: (jurisdiction) => ({
|
|
404
|
+
$jurisdiction: jurisdiction
|
|
405
|
+
})
|
|
406
|
+
};
|
|
407
|
+
|
|
121
408
|
// ../commons/src/conditionals/conditionals.ts
|
|
122
409
|
function defineConditional(schema) {
|
|
123
410
|
const schemaWithooutIDRef = omitKeyDeep(schema, "$id");
|
|
@@ -193,6 +480,7 @@ function wrapToPathOptional(condition, path) {
|
|
|
193
480
|
}
|
|
194
481
|
var now = Object.assign(todayDateTimeValueSerializer, {});
|
|
195
482
|
var user = Object.assign(userSerializer, {
|
|
483
|
+
...userReferenceFunctions,
|
|
196
484
|
hasScope: (scope) => defineConditional({
|
|
197
485
|
type: "object",
|
|
198
486
|
properties: {
|
|
@@ -239,9 +527,7 @@ var user = Object.assign(userSerializer, {
|
|
|
239
527
|
required: ["$online"]
|
|
240
528
|
}),
|
|
241
529
|
locationLevel: (adminLevelId) => ({
|
|
242
|
-
$user: {
|
|
243
|
-
$location: adminLevelId
|
|
244
|
-
}
|
|
530
|
+
$user: { $location: adminLevelId }
|
|
245
531
|
})
|
|
246
532
|
});
|
|
247
533
|
function isFieldReference(value) {
|
|
@@ -334,6 +620,33 @@ function defineComparison(field, value, keyword) {
|
|
|
334
620
|
required: [field.$$field]
|
|
335
621
|
});
|
|
336
622
|
}
|
|
623
|
+
function flag(flagvalue) {
|
|
624
|
+
return defineConditional({
|
|
625
|
+
type: "object",
|
|
626
|
+
properties: {
|
|
627
|
+
$flags: {
|
|
628
|
+
type: "array",
|
|
629
|
+
contains: {
|
|
630
|
+
type: "string",
|
|
631
|
+
const: flagvalue
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
},
|
|
635
|
+
required: ["$flags"]
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
function status(statusValue) {
|
|
639
|
+
return defineConditional({
|
|
640
|
+
type: "object",
|
|
641
|
+
properties: {
|
|
642
|
+
$status: {
|
|
643
|
+
type: "string",
|
|
644
|
+
const: statusValue
|
|
645
|
+
}
|
|
646
|
+
},
|
|
647
|
+
required: ["$status"]
|
|
648
|
+
});
|
|
649
|
+
}
|
|
337
650
|
function createFieldConditionals(fieldId) {
|
|
338
651
|
const getDayRange = (field, days, clause, referenceDate) => ({
|
|
339
652
|
type: "object",
|
|
@@ -687,3 +1000,6 @@ function createFieldConditionals(fieldId) {
|
|
|
687
1000
|
})
|
|
688
1001
|
};
|
|
689
1002
|
}
|
|
1003
|
+
|
|
1004
|
+
// src/conditionals/index.ts
|
|
1005
|
+
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
|
};
|