@opencrvs/toolkit 2.0.0-rc.2625051 → 2.0.0-rc.32c9d97
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/application-config/index.js +7 -35
- package/dist/cli.js +1390 -177
- package/dist/commons/api/router.d.ts +1 -2
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/FieldConfig.d.ts +0 -5
- package/dist/commons/events/locations.d.ts +1 -17
- package/dist/conditionals/index.js +7 -35
- package/dist/events/index.js +7 -73
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +3 -4
- 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 +19 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +17 -13
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -1
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +4 -5
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -1
- package/dist/migrations/v2.0/convert-paragraph-to-heading.js +4 -5
- package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -1
- package/dist/migrations/v2.0/create-events-index.js +1 -2
- 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 +8 -4
- package/dist/migrations/v2.0/index.d.ts.map +1 -1
- package/dist/migrations/v2.0/index.js +1358 -174
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +5 -6
- 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.map +1 -1
- package/dist/migrations/v2.0/migrate-scopes.js +6 -7
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +3 -4
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +3 -4
- package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-delete-actions.js +3 -4
- package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-demo-scope.js +2 -3
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-deprecated-imports.js +3 -4
- 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.map +1 -1
- package/dist/migrations/v2.0/remove-hearth-migrations.js +1 -2
- 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.map +1 -1
- package/dist/migrations/v2.0/remove-pending-certification-flag.js +3 -4
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -1
- package/dist/migrations/v2.0/remove-review-from-register-action.js +3 -4
- 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.map +1 -1
- package/dist/migrations/v2.0/rename-api-paths.js +3 -4
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -1
- package/dist/migrations/v2.0/rename-location-parent-id.js +3 -4
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -1
- package/dist/migrations/v2.0/simplify-analytics-precalculations.js +1 -2
- 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.js +7 -35
- package/dist/scopes/index.d.ts +10 -82
- package/dist/scopes/index.js +8 -41
- package/opencrvs-toolkit-2.0.0-rc.32c9d97.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.2625051.tgz +0 -0
|
@@ -4020,6 +4020,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4020
4020
|
email?: string | undefined;
|
|
4021
4021
|
mobile?: string | undefined;
|
|
4022
4022
|
username?: undefined;
|
|
4023
|
+
password?: undefined;
|
|
4023
4024
|
signature?: {
|
|
4024
4025
|
path: string;
|
|
4025
4026
|
originalFilename: string;
|
|
@@ -4069,8 +4070,6 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
|
|
|
4069
4070
|
type: string;
|
|
4070
4071
|
} | undefined;
|
|
4071
4072
|
status?: "active" | "deactivated" | undefined;
|
|
4072
|
-
} & {
|
|
4073
|
-
id: string;
|
|
4074
4073
|
};
|
|
4075
4074
|
output: {
|
|
4076
4075
|
id: string & import("zod").$brand<"UUID">;
|
|
@@ -87,16 +87,16 @@ export declare const user: typeof userSerializer & {
|
|
|
87
87
|
scope: (scope: import("../scopes").ScopeType) => {
|
|
88
88
|
attribute: (option: import("../scopes").ScopeOptionKey) => {
|
|
89
89
|
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
|
|
90
|
-
$option: "
|
|
90
|
+
$option: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
91
91
|
};
|
|
92
92
|
};
|
|
93
93
|
jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
|
|
94
94
|
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
|
|
95
|
-
$option: "
|
|
95
|
+
$option: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
96
96
|
}) => {
|
|
97
97
|
$jurisdiction: "administrativeArea" | "location" | "all" | {
|
|
98
98
|
$scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
|
|
99
|
-
$option: "
|
|
99
|
+
$option: "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
|
|
100
100
|
};
|
|
101
101
|
};
|
|
102
102
|
};
|
|
@@ -1727,7 +1727,6 @@ declare const AdministrativeAreaField: z.ZodObject<{
|
|
|
1727
1727
|
"dashboard.view": "dashboard.view";
|
|
1728
1728
|
}>;
|
|
1729
1729
|
$option: z.ZodEnum<{
|
|
1730
|
-
role: "role";
|
|
1731
1730
|
event: "event";
|
|
1732
1731
|
placeOfEvent: "placeOfEvent";
|
|
1733
1732
|
declaredIn: "declaredIn";
|
|
@@ -1846,7 +1845,6 @@ declare const LocationInput: z.ZodObject<{
|
|
|
1846
1845
|
"dashboard.view": "dashboard.view";
|
|
1847
1846
|
}>;
|
|
1848
1847
|
$option: z.ZodEnum<{
|
|
1849
|
-
role: "role";
|
|
1850
1848
|
event: "event";
|
|
1851
1849
|
placeOfEvent: "placeOfEvent";
|
|
1852
1850
|
declaredIn: "declaredIn";
|
|
@@ -2030,7 +2028,6 @@ declare const Facility: z.ZodObject<{
|
|
|
2030
2028
|
"dashboard.view": "dashboard.view";
|
|
2031
2029
|
}>;
|
|
2032
2030
|
$option: z.ZodEnum<{
|
|
2033
|
-
role: "role";
|
|
2034
2031
|
event: "event";
|
|
2035
2032
|
placeOfEvent: "placeOfEvent";
|
|
2036
2033
|
declaredIn: "declaredIn";
|
|
@@ -2135,7 +2132,6 @@ declare const Office: z.ZodObject<{
|
|
|
2135
2132
|
"dashboard.view": "dashboard.view";
|
|
2136
2133
|
}>;
|
|
2137
2134
|
$option: z.ZodEnum<{
|
|
2138
|
-
role: "role";
|
|
2139
2135
|
event: "event";
|
|
2140
2136
|
placeOfEvent: "placeOfEvent";
|
|
2141
2137
|
declaredIn: "declaredIn";
|
|
@@ -2327,7 +2323,6 @@ declare const Address: z.ZodObject<{
|
|
|
2327
2323
|
"dashboard.view": "dashboard.view";
|
|
2328
2324
|
}>;
|
|
2329
2325
|
$option: z.ZodEnum<{
|
|
2330
|
-
role: "role";
|
|
2331
2326
|
event: "event";
|
|
2332
2327
|
placeOfEvent: "placeOfEvent";
|
|
2333
2328
|
declaredIn: "declaredIn";
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { UUID } from '../uuid';
|
|
2
1
|
import * as z from 'zod/v4';
|
|
3
2
|
import { EventIndex } from './EventIndex';
|
|
4
3
|
import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
|
|
5
|
-
import { RecordScopeV2
|
|
4
|
+
import { RecordScopeV2 } from '../scopes';
|
|
6
5
|
import { SystemContext, UserContext } from '../users/User';
|
|
7
6
|
/** @deprecated Moving on, location types are arbitrary and defined by the country config. */
|
|
8
7
|
export declare const LocationTypeV1: z.ZodEnum<{
|
|
@@ -52,21 +51,6 @@ export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventInde
|
|
|
52
51
|
*
|
|
53
52
|
*/
|
|
54
53
|
export declare function canAccessEventWithScope(event: Partial<EventIndexWithAdministrativeHierarchy>, scope: RecordScopeV2, user: UserContext | SystemContext, customActionType?: string): boolean;
|
|
55
|
-
export type UserWithResolvedHierarchy = {
|
|
56
|
-
role: string;
|
|
57
|
-
administrativeHierarchy: UUID[];
|
|
58
|
-
primaryOfficeId: UUID;
|
|
59
|
-
};
|
|
60
|
-
export declare function canAccessUserWithScope({ userToAccess, scope, user }: {
|
|
61
|
-
userToAccess: UserWithResolvedHierarchy;
|
|
62
|
-
scope: UserScopeV2;
|
|
63
|
-
user: UserContext | SystemContext;
|
|
64
|
-
}): boolean;
|
|
65
|
-
export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, user }: {
|
|
66
|
-
scopes: UserScopeV2[];
|
|
67
|
-
userToAccess: UserWithResolvedHierarchy;
|
|
68
|
-
user: UserContext | SystemContext;
|
|
69
|
-
}): boolean;
|
|
70
54
|
/**
|
|
71
55
|
* Given indexed event and list of resolved scopes, determine if any of the scopes allow access to the event.
|
|
72
56
|
*
|
|
@@ -182,10 +182,6 @@ var scopeByEvent = z6.preprocess(
|
|
|
182
182
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
183
183
|
z6.array(z6.string()).optional()
|
|
184
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
185
|
var scopeOptionsPlaceEvent = z6.object({
|
|
190
186
|
event: scopeByEvent,
|
|
191
187
|
placeOfEvent: JurisdictionFilter.optional()
|
|
@@ -209,9 +205,6 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
209
205
|
var AccessLevelOptions = z6.object({
|
|
210
206
|
accessLevel: JurisdictionFilter.optional()
|
|
211
207
|
});
|
|
212
|
-
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
213
|
-
role: userRole.optional()
|
|
214
|
-
});
|
|
215
208
|
var WorkqueueOrDashboardOptions = z6.object({
|
|
216
209
|
ids: z6.preprocess(
|
|
217
210
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -221,7 +214,6 @@ var WorkqueueOrDashboardOptions = z6.object({
|
|
|
221
214
|
var AllScopeOptions = z6.object({
|
|
222
215
|
...AllRecordScopeOptions.shape,
|
|
223
216
|
...AccessLevelOptions.shape,
|
|
224
|
-
...AllUserScopeOptions.shape,
|
|
225
217
|
...WorkqueueOrDashboardOptions.shape
|
|
226
218
|
});
|
|
227
219
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
@@ -294,28 +286,6 @@ var RecordScopeV2 = z6.discriminatedUnion("type", [
|
|
|
294
286
|
]).describe(
|
|
295
287
|
"Scopes used to check user's permission to perform actions on a record."
|
|
296
288
|
);
|
|
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
289
|
var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
|
|
320
290
|
z6.object({
|
|
321
291
|
type: ScopesWithPlaceEventOptions,
|
|
@@ -336,14 +306,16 @@ var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
|
|
|
336
306
|
}).optional()
|
|
337
307
|
})
|
|
338
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
|
+
]);
|
|
339
315
|
var Scope2 = z6.discriminatedUnion("type", [
|
|
340
316
|
z6.object({ type: PlainScopeType }),
|
|
341
317
|
...RecordScopeV2.options,
|
|
342
|
-
|
|
343
|
-
z6.object({
|
|
344
|
-
type: z6.literal("organisation.read-locations"),
|
|
345
|
-
options: AccessLevelOptions.optional()
|
|
346
|
-
}),
|
|
318
|
+
z6.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
|
|
347
319
|
z6.object({
|
|
348
320
|
type: z6.literal("workqueue"),
|
|
349
321
|
options: WorkqueueOrDashboardOptions
|
package/dist/events/index.js
CHANGED
|
@@ -243,8 +243,6 @@ __export(events_exports, {
|
|
|
243
243
|
areConditionsMet: () => areConditionsMet,
|
|
244
244
|
buildFormState: () => buildFormState,
|
|
245
245
|
canAccessEventWithScope: () => canAccessEventWithScope,
|
|
246
|
-
canAccessOtherUserWithScopes: () => canAccessOtherUserWithScopes,
|
|
247
|
-
canAccessUserWithScope: () => canAccessUserWithScope,
|
|
248
246
|
compositeFieldTypes: () => compositeFieldTypes,
|
|
249
247
|
createEmptyDraft: () => createEmptyDraft,
|
|
250
248
|
createFieldConditionals: () => createFieldConditionals,
|
|
@@ -491,10 +489,6 @@ var scopeByEvent = z2.preprocess(
|
|
|
491
489
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
492
490
|
z2.array(z2.string()).optional()
|
|
493
491
|
).describe("Event type, e.g. birth, death");
|
|
494
|
-
var userRole = z2.preprocess(
|
|
495
|
-
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
496
|
-
z2.array(z2.string()).optional()
|
|
497
|
-
).describe("User role, e.g. admin, field agent");
|
|
498
492
|
var scopeOptionsPlaceEvent = z2.object({
|
|
499
493
|
event: scopeByEvent,
|
|
500
494
|
placeOfEvent: JurisdictionFilter.optional()
|
|
@@ -518,9 +512,6 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
518
512
|
var AccessLevelOptions = z2.object({
|
|
519
513
|
accessLevel: JurisdictionFilter.optional()
|
|
520
514
|
});
|
|
521
|
-
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
522
|
-
role: userRole.optional()
|
|
523
|
-
});
|
|
524
515
|
var WorkqueueOrDashboardOptions = z2.object({
|
|
525
516
|
ids: z2.preprocess(
|
|
526
517
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -530,7 +521,6 @@ var WorkqueueOrDashboardOptions = z2.object({
|
|
|
530
521
|
var AllScopeOptions = z2.object({
|
|
531
522
|
...AllRecordScopeOptions.shape,
|
|
532
523
|
...AccessLevelOptions.shape,
|
|
533
|
-
...AllUserScopeOptions.shape,
|
|
534
524
|
...WorkqueueOrDashboardOptions.shape
|
|
535
525
|
});
|
|
536
526
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
@@ -603,31 +593,6 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
603
593
|
]).describe(
|
|
604
594
|
"Scopes used to check user's permission to perform actions on a record."
|
|
605
595
|
);
|
|
606
|
-
var SystemScopeType = z2.enum([
|
|
607
|
-
"organisation.read-locations",
|
|
608
|
-
"user.read",
|
|
609
|
-
"user.create",
|
|
610
|
-
"user.edit"
|
|
611
|
-
]);
|
|
612
|
-
var UserScopeType = SystemScopeType.extract([
|
|
613
|
-
"user.read",
|
|
614
|
-
"user.create",
|
|
615
|
-
"user.edit"
|
|
616
|
-
]);
|
|
617
|
-
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
618
|
-
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
619
|
-
z2.object({
|
|
620
|
-
type: ScopesWithRoleOption,
|
|
621
|
-
options: AllUserScopeOptions.optional()
|
|
622
|
-
}),
|
|
623
|
-
z2.object({
|
|
624
|
-
type: UserScopeType.extract(["user.read"]),
|
|
625
|
-
options: AccessLevelOptions.optional()
|
|
626
|
-
})
|
|
627
|
-
]);
|
|
628
|
-
function scopeUsesRoleOptions(scope) {
|
|
629
|
-
return ScopesWithRoleOption?.options.some((opt) => opt === scope.type);
|
|
630
|
-
}
|
|
631
596
|
function scopeUsesDeclaredOptions(scope) {
|
|
632
597
|
return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
|
|
633
598
|
}
|
|
@@ -660,14 +625,16 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
660
625
|
}).optional()
|
|
661
626
|
})
|
|
662
627
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
628
|
+
var SystemScopeType = z2.enum([
|
|
629
|
+
"organisation.read-locations",
|
|
630
|
+
"user.read",
|
|
631
|
+
"user.create",
|
|
632
|
+
"user.edit"
|
|
633
|
+
]);
|
|
663
634
|
var Scope = z2.discriminatedUnion("type", [
|
|
664
635
|
z2.object({ type: PlainScopeType }),
|
|
665
636
|
...RecordScopeV2.options,
|
|
666
|
-
|
|
667
|
-
z2.object({
|
|
668
|
-
type: z2.literal("organisation.read-locations"),
|
|
669
|
-
options: AccessLevelOptions.optional()
|
|
670
|
-
}),
|
|
637
|
+
z2.object({ type: SystemScopeType, options: AccessLevelOptions.optional() }),
|
|
671
638
|
z2.object({
|
|
672
639
|
type: z2.literal("workqueue"),
|
|
673
640
|
options: WorkqueueOrDashboardOptions
|
|
@@ -9963,39 +9930,6 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
|
|
|
9963
9930
|
}
|
|
9964
9931
|
return true;
|
|
9965
9932
|
}
|
|
9966
|
-
function canAccessUserWithScope({
|
|
9967
|
-
userToAccess,
|
|
9968
|
-
scope,
|
|
9969
|
-
user: user2
|
|
9970
|
-
}) {
|
|
9971
|
-
const opts = scope.options;
|
|
9972
|
-
const hasSameOffice = user2.primaryOfficeId === userToAccess.primaryOfficeId;
|
|
9973
|
-
if (opts?.accessLevel === JurisdictionFilter.enum.location && !hasSameOffice) {
|
|
9974
|
-
return false;
|
|
9975
|
-
}
|
|
9976
|
-
const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
|
|
9977
|
-
(id) => user2.administrativeAreaId === id
|
|
9978
|
-
) || user2.administrativeAreaId === null;
|
|
9979
|
-
if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
|
|
9980
|
-
return false;
|
|
9981
|
-
}
|
|
9982
|
-
if (scopeUsesRoleOptions(scope)) {
|
|
9983
|
-
const { options } = scope;
|
|
9984
|
-
if (options?.role && !options.role.includes(userToAccess.role)) {
|
|
9985
|
-
return false;
|
|
9986
|
-
}
|
|
9987
|
-
}
|
|
9988
|
-
return true;
|
|
9989
|
-
}
|
|
9990
|
-
function canAccessOtherUserWithScopes({
|
|
9991
|
-
scopes,
|
|
9992
|
-
userToAccess,
|
|
9993
|
-
user: user2
|
|
9994
|
-
}) {
|
|
9995
|
-
return scopes.some(
|
|
9996
|
-
(scope) => canAccessUserWithScope({ userToAccess, scope, user: user2 })
|
|
9997
|
-
);
|
|
9998
|
-
}
|
|
9999
9933
|
function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
|
|
10000
9934
|
return scopes.some(
|
|
10001
9935
|
(scope) => canAccessEventWithScope(event2, scope, user2, customActionType)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-birth-certificate-issuance-flag.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/add-birth-certificate-issuance-flag.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-birth-certificate-issuance-flag.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/add-birth-certificate-issuance-flag.ts"],"names":[],"mappings":"AA2aA,iBAAe,IAAI,kBAiDlB;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -48,7 +48,6 @@ exports.main = main;
|
|
|
48
48
|
*/
|
|
49
49
|
const ts_morph_1 = require("ts-morph");
|
|
50
50
|
const path_1 = __importDefault(require("path"));
|
|
51
|
-
const _1 = require(".");
|
|
52
51
|
const DEFINE_CONFIG_NAME = 'defineConfig';
|
|
53
52
|
const DEFINE_WORKQUEUES_NAME = 'defineWorkqueues';
|
|
54
53
|
const ACTIONS_PROPERTY_NAME = 'actions';
|
|
@@ -318,7 +317,7 @@ function processFile(filePath, project) {
|
|
|
318
317
|
if (!sourceFile)
|
|
319
318
|
return 0;
|
|
320
319
|
let totalChanges = 0;
|
|
321
|
-
const relPath = path_1.default.relative(
|
|
320
|
+
const relPath = path_1.default.relative(process.cwd(), filePath);
|
|
322
321
|
const callExpressions = sourceFile.getDescendantsOfKind(ts_morph_1.SyntaxKind.CallExpression);
|
|
323
322
|
for (const call of callExpressions) {
|
|
324
323
|
const expression = call.getExpression();
|
|
@@ -369,7 +368,7 @@ function processFile(filePath, project) {
|
|
|
369
368
|
// ─── Entry point ─────────────────────────────────────────────────────────────
|
|
370
369
|
function main() {
|
|
371
370
|
return __awaiter(this, void 0, void 0, function* () {
|
|
372
|
-
const srcDir = path_1.default.join(
|
|
371
|
+
const srcDir = path_1.default.join(process.cwd(), 'src');
|
|
373
372
|
console.log(`Scanning for birth defineConfig and PRINT_CERTIFICATE workqueues in: ${srcDir}\n`);
|
|
374
373
|
const project = new ts_morph_1.Project({
|
|
375
374
|
tsConfigFilePath: path_1.default.resolve(srcDir, '../tsconfig.json'),
|
|
@@ -398,7 +397,7 @@ function main() {
|
|
|
398
397
|
for (const filePath of modifiedFiles) {
|
|
399
398
|
const sourceFile = project.getSourceFileOrThrow(filePath);
|
|
400
399
|
yield sourceFile.save();
|
|
401
|
-
console.log(` Saved: ${path_1.default.relative(
|
|
400
|
+
console.log(` Saved: ${path_1.default.relative(process.cwd(), filePath)}`);
|
|
402
401
|
}
|
|
403
402
|
console.log(`\nDone. Applied ${totalChanges} change(s) across ${modifiedFiles.length} file(s).`);
|
|
404
403
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-resend-invite-notification.d.ts","sourceRoot":"","sources":["../../../src/migrations/v2.0/add-resend-invite-notification.ts"],"names":[],"mappings":"AA8ZA,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAuCnC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA"}
|