@opencrvs/toolkit 1.9.13-rc.fc5374d → 2.0.0-rc.e0918cb
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 +2128 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +3633 -0
- package/dist/commons/api/router.d.ts +3438 -2300
- package/dist/commons/application-config/index.d.ts +84 -0
- package/dist/commons/conditionals/conditionals.d.ts +27 -3
- package/dist/commons/conditionals/validate.d.ts +13 -3
- 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 +405 -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 +2892 -12892
- 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 +57 -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 +373 -273
- package/dist/commons/notification/UserNotifications.d.ts +61 -637
- package/dist/conditionals/index.d.ts.map +1 -1
- package/dist/conditionals/index.js +302 -14
- package/dist/events/deduplication.d.ts +3 -3
- package/dist/events/index.js +2860 -2115
- 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 +405 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +3 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -0
- package/dist/migrations/v2.0/checkout-upstream-files.js +143 -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 +829 -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 +159 -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 +326 -0
- package/dist/migrations/v2.0/index.d.ts +7 -0
- package/dist/migrations/v2.0/index.d.ts.map +1 -0
- package/dist/migrations/v2.0/index.js +3572 -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 +344 -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 +282 -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 +268 -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 +237 -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 +157 -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 +75 -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 +97 -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 +78 -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 +110 -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 +164 -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 +188 -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 +181 -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 +196 -0
- package/dist/notification/index.d.ts.map +1 -1
- package/dist/notification/index.js +2076 -1767
- package/dist/scopes/index.d.ts +640 -353
- package/dist/scopes/index.d.ts.map +1 -1
- package/dist/scopes/index.js +340 -300
- package/opencrvs-toolkit-2.0.0-rc.e0918cb.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,269 @@ 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 scopeOptionsPlaceEvent = z6.object({
|
|
186
|
+
event: scopeByEvent,
|
|
187
|
+
placeOfEvent: JurisdictionFilter.optional()
|
|
188
|
+
}).describe("Options applicable to all record scopes.");
|
|
189
|
+
var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
|
|
190
|
+
declaredIn: JurisdictionFilter.optional(),
|
|
191
|
+
declaredBy: UserFilter.optional()
|
|
192
|
+
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
193
|
+
var AllRecordScopeOptions = scopeOptionsDeclared.extend({
|
|
194
|
+
registeredIn: JurisdictionFilter.optional(),
|
|
195
|
+
registeredBy: UserFilter.optional()
|
|
196
|
+
}).describe(
|
|
197
|
+
"Options applicable to actions that may take place after REGISTER, with full filtering capabilities."
|
|
198
|
+
);
|
|
199
|
+
var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
200
|
+
customActionTypes: z6.preprocess(
|
|
201
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
202
|
+
z6.array(z6.string()).optional()
|
|
203
|
+
).describe("Allowed custom action types")
|
|
204
|
+
});
|
|
205
|
+
var AccessLevelOptions = z6.object({
|
|
206
|
+
accessLevel: JurisdictionFilter.optional()
|
|
207
|
+
});
|
|
208
|
+
var WorkqueueOrDashboardOptions = z6.object({
|
|
209
|
+
ids: z6.preprocess(
|
|
210
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
211
|
+
z6.array(z6.string())
|
|
212
|
+
).describe("Must contain a list of workqueue or dashboard ids.")
|
|
213
|
+
});
|
|
214
|
+
var AllScopeOptions = z6.object({
|
|
215
|
+
...AllRecordScopeOptions.shape,
|
|
216
|
+
...AccessLevelOptions.shape,
|
|
217
|
+
...WorkqueueOrDashboardOptions.shape
|
|
218
|
+
});
|
|
219
|
+
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
220
|
+
var ResolvedScopeOptionsPlaceEvent = z6.object({
|
|
221
|
+
event: scopeByEvent,
|
|
222
|
+
placeOfEvent: UUID.nullish()
|
|
223
|
+
}).describe(
|
|
224
|
+
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
225
|
+
);
|
|
226
|
+
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
227
|
+
declaredIn: UUID.nullish(),
|
|
228
|
+
declaredBy: z6.string().optional()
|
|
229
|
+
}).describe(
|
|
230
|
+
"Resolved options applicable to actions that may take place after DECLARE, with location ID and user ID instead of filters."
|
|
231
|
+
);
|
|
232
|
+
var ResolvedScopeOptionsFull = ResolvedScopeOptionsDeclared.extend({
|
|
233
|
+
registeredIn: UUID.nullish(),
|
|
234
|
+
registeredBy: z6.string().optional()
|
|
235
|
+
}).describe(
|
|
236
|
+
"Resolved options applicable to actions that may take place after REGISTER, with full filtering capabilities and location/user IDs instead of filters."
|
|
237
|
+
);
|
|
238
|
+
var ScopesWithPlaceEventOptions = RecordScopeTypeV2.extract([
|
|
239
|
+
"record.create",
|
|
240
|
+
"record.declare",
|
|
241
|
+
"record.notify"
|
|
242
|
+
]);
|
|
243
|
+
var ScopesWithDeclaredOptions = RecordScopeTypeV2.extract([
|
|
244
|
+
"record.edit",
|
|
245
|
+
"record.reject",
|
|
246
|
+
"record.archive",
|
|
247
|
+
"record.review-duplicates",
|
|
248
|
+
"record.register"
|
|
249
|
+
]);
|
|
250
|
+
var ScopesWithFullOptions = RecordScopeTypeV2.extract([
|
|
251
|
+
"record.search",
|
|
252
|
+
"record.read",
|
|
253
|
+
"record.request-correction",
|
|
254
|
+
"record.correct",
|
|
255
|
+
"record.unassign-others"
|
|
256
|
+
]);
|
|
257
|
+
var ScopeOptionsPrintCertifiedCopies = AllRecordScopeOptions.extend({
|
|
258
|
+
templates: z6.preprocess(
|
|
259
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
260
|
+
z6.array(z6.string()).optional()
|
|
261
|
+
).describe(
|
|
262
|
+
"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."
|
|
263
|
+
)
|
|
264
|
+
});
|
|
265
|
+
var RecordScopeV2 = z6.discriminatedUnion("type", [
|
|
266
|
+
z6.object({
|
|
267
|
+
type: ScopesWithPlaceEventOptions,
|
|
268
|
+
options: scopeOptionsPlaceEvent.optional()
|
|
269
|
+
}),
|
|
270
|
+
z6.object({
|
|
271
|
+
type: ScopesWithDeclaredOptions,
|
|
272
|
+
options: scopeOptionsDeclared.optional()
|
|
273
|
+
}),
|
|
274
|
+
z6.object({
|
|
275
|
+
type: ScopesWithFullOptions,
|
|
276
|
+
options: AllRecordScopeOptions.optional()
|
|
277
|
+
}),
|
|
278
|
+
z6.object({
|
|
279
|
+
type: z6.literal("record.custom-action"),
|
|
280
|
+
options: CustomActionScopeOptions.optional()
|
|
281
|
+
}),
|
|
282
|
+
z6.object({
|
|
283
|
+
type: z6.literal("record.print-certified-copies"),
|
|
284
|
+
options: ScopeOptionsPrintCertifiedCopies.optional()
|
|
285
|
+
})
|
|
286
|
+
]).describe(
|
|
287
|
+
"Scopes used to check user's permission to perform actions on a record."
|
|
288
|
+
);
|
|
289
|
+
var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
|
|
290
|
+
z6.object({
|
|
291
|
+
type: ScopesWithPlaceEventOptions,
|
|
292
|
+
options: ResolvedScopeOptionsPlaceEvent.optional()
|
|
293
|
+
}),
|
|
294
|
+
z6.object({
|
|
295
|
+
type: ScopesWithDeclaredOptions,
|
|
296
|
+
options: ResolvedScopeOptionsDeclared.optional()
|
|
297
|
+
}),
|
|
298
|
+
z6.object({
|
|
299
|
+
type: ScopesWithFullOptions,
|
|
300
|
+
options: ResolvedScopeOptionsFull.optional()
|
|
301
|
+
}),
|
|
302
|
+
z6.object({
|
|
303
|
+
type: z6.literal("record.print-certified-copies"),
|
|
304
|
+
options: ResolvedScopeOptionsFull.extend({
|
|
305
|
+
templates: z6.array(z6.string()).optional()
|
|
306
|
+
}).optional()
|
|
307
|
+
})
|
|
308
|
+
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
309
|
+
var SystemScopeType = z6.enum([
|
|
310
|
+
"organisation.read-locations",
|
|
311
|
+
"user.read",
|
|
312
|
+
"user.create",
|
|
313
|
+
"user.edit"
|
|
314
|
+
]);
|
|
315
|
+
var Scope2 = z6.discriminatedUnion("type", [
|
|
316
|
+
z6.object({ type: PlainScopeType }),
|
|
317
|
+
...RecordScopeV2.options,
|
|
318
|
+
z6.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
|
|
319
|
+
z6.object({
|
|
320
|
+
type: z6.literal("workqueue"),
|
|
321
|
+
options: WorkqueueOrDashboardOptions
|
|
322
|
+
}),
|
|
323
|
+
z6.object({
|
|
324
|
+
type: z6.literal("dashboard.view"),
|
|
325
|
+
options: WorkqueueOrDashboardOptions
|
|
326
|
+
})
|
|
327
|
+
]);
|
|
328
|
+
var ScopeType2 = z6.enum([
|
|
329
|
+
...SystemScopeType.options,
|
|
330
|
+
...RecordScopeTypeV2.options,
|
|
331
|
+
...PlainScopeType.options,
|
|
332
|
+
"workqueue",
|
|
333
|
+
"dashboard.view"
|
|
334
|
+
]);
|
|
335
|
+
var EncodedScope2 = z6.string().brand("EncodedScope");
|
|
336
|
+
var DEFAULT_SCOPE_OPTIONS = {
|
|
337
|
+
placeOfEvent: JurisdictionFilter.enum.all,
|
|
338
|
+
accessLevel: JurisdictionFilter.enum.all
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
// ../commons/src/users/userReferences.ts
|
|
342
|
+
var import_v4 = __toESM(require("zod/v4"));
|
|
343
|
+
var ScopeOptionReference = import_v4.default.object({
|
|
344
|
+
$scope: ScopeType2,
|
|
345
|
+
$option: ScopeOptionKey
|
|
346
|
+
});
|
|
347
|
+
var JurisdictionReference = import_v4.default.object({
|
|
348
|
+
$jurisdiction: JurisdictionFilter.or(ScopeOptionReference)
|
|
349
|
+
});
|
|
350
|
+
var userReferenceFunctions = {
|
|
351
|
+
scope: (scope) => ({
|
|
352
|
+
/**
|
|
353
|
+
* user.scope().attribute() is used to create a scope option reference.
|
|
354
|
+
*
|
|
355
|
+
* E.g.: user.scope('record.create').attribute('placeOfEvent')
|
|
356
|
+
*
|
|
357
|
+
* @param option - The option to create a reference for.
|
|
358
|
+
* @returns A scope option reference.
|
|
359
|
+
*/
|
|
360
|
+
attribute: (option) => ({
|
|
361
|
+
$scope: scope,
|
|
362
|
+
$option: option
|
|
363
|
+
})
|
|
364
|
+
}),
|
|
365
|
+
/**
|
|
366
|
+
* user.jurisdicton() accepts two different kinds of parameters, either:
|
|
367
|
+
*
|
|
368
|
+
* 1. a plain jurisdiction filter: user.jurisdiction('administrativeArea')
|
|
369
|
+
* 2. a scope option reference: user.jurisdiction(user.scope('record.create').attribute('placeOfEvent'))
|
|
370
|
+
*
|
|
371
|
+
* These will be resolved during runtime.
|
|
372
|
+
*
|
|
373
|
+
* @param jurisdiction - The jurisdiction to resolve.
|
|
374
|
+
*/
|
|
375
|
+
jurisdiction: (jurisdiction) => ({
|
|
376
|
+
$jurisdiction: jurisdiction
|
|
377
|
+
})
|
|
378
|
+
};
|
|
379
|
+
|
|
121
380
|
// ../commons/src/conditionals/conditionals.ts
|
|
122
381
|
function defineConditional(schema) {
|
|
123
382
|
const schemaWithooutIDRef = omitKeyDeep(schema, "$id");
|
|
@@ -193,6 +452,7 @@ function wrapToPathOptional(condition, path) {
|
|
|
193
452
|
}
|
|
194
453
|
var now = Object.assign(todayDateTimeValueSerializer, {});
|
|
195
454
|
var user = Object.assign(userSerializer, {
|
|
455
|
+
...userReferenceFunctions,
|
|
196
456
|
hasScope: (scope) => defineConditional({
|
|
197
457
|
type: "object",
|
|
198
458
|
properties: {
|
|
@@ -239,9 +499,7 @@ var user = Object.assign(userSerializer, {
|
|
|
239
499
|
required: ["$online"]
|
|
240
500
|
}),
|
|
241
501
|
locationLevel: (adminLevelId) => ({
|
|
242
|
-
$user: {
|
|
243
|
-
$location: adminLevelId
|
|
244
|
-
}
|
|
502
|
+
$user: { $location: adminLevelId }
|
|
245
503
|
})
|
|
246
504
|
});
|
|
247
505
|
function isFieldReference(value) {
|
|
@@ -334,6 +592,33 @@ function defineComparison(field, value, keyword) {
|
|
|
334
592
|
required: [field.$$field]
|
|
335
593
|
});
|
|
336
594
|
}
|
|
595
|
+
function flag(flagvalue) {
|
|
596
|
+
return defineConditional({
|
|
597
|
+
type: "object",
|
|
598
|
+
properties: {
|
|
599
|
+
$flags: {
|
|
600
|
+
type: "array",
|
|
601
|
+
contains: {
|
|
602
|
+
type: "string",
|
|
603
|
+
const: flagvalue
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
},
|
|
607
|
+
required: ["$flags"]
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
function status(statusValue) {
|
|
611
|
+
return defineConditional({
|
|
612
|
+
type: "object",
|
|
613
|
+
properties: {
|
|
614
|
+
$status: {
|
|
615
|
+
type: "string",
|
|
616
|
+
const: statusValue
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
required: ["$status"]
|
|
620
|
+
});
|
|
621
|
+
}
|
|
337
622
|
function createFieldConditionals(fieldId) {
|
|
338
623
|
const getDayRange = (field, days, clause, referenceDate) => ({
|
|
339
624
|
type: "object",
|
|
@@ -687,3 +972,6 @@ function createFieldConditionals(fieldId) {
|
|
|
687
972
|
})
|
|
688
973
|
};
|
|
689
974
|
}
|
|
975
|
+
|
|
976
|
+
// src/conditionals/index.ts
|
|
977
|
+
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
|
};
|