@opencrvs/toolkit 2.0.0-rc.d846143 → 2.0.0-rc.da37d4e
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 +37 -7
- package/dist/cli.js +1420 -149
- package/dist/commons/api/router.d.ts +72 -79
- package/dist/commons/conditionals/conditionals.d.ts +6 -6
- package/dist/commons/events/FieldConfig.d.ts +10 -0
- package/dist/commons/events/locations.d.ts +17 -1
- package/dist/conditionals/index.js +37 -7
- package/dist/events/index.js +75 -7
- 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 +1388 -146
- 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 +37 -7
- package/dist/scopes/index.d.ts +87 -10
- package/dist/scopes/index.js +43 -8
- package/opencrvs-toolkit-2.0.0-rc.da37d4e.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.d846143.tgz +0 -0
|
@@ -1723,10 +1723,12 @@ declare const AdministrativeAreaField: z.ZodObject<{
|
|
|
1723
1723
|
"user.read": "user.read";
|
|
1724
1724
|
"user.create": "user.create";
|
|
1725
1725
|
"user.edit": "user.edit";
|
|
1726
|
+
"user.search": "user.search";
|
|
1726
1727
|
workqueue: "workqueue";
|
|
1727
1728
|
"dashboard.view": "dashboard.view";
|
|
1728
1729
|
}>;
|
|
1729
1730
|
$option: z.ZodEnum<{
|
|
1731
|
+
role: "role";
|
|
1730
1732
|
event: "event";
|
|
1731
1733
|
placeOfEvent: "placeOfEvent";
|
|
1732
1734
|
declaredIn: "declaredIn";
|
|
@@ -1841,10 +1843,12 @@ declare const LocationInput: z.ZodObject<{
|
|
|
1841
1843
|
"user.read": "user.read";
|
|
1842
1844
|
"user.create": "user.create";
|
|
1843
1845
|
"user.edit": "user.edit";
|
|
1846
|
+
"user.search": "user.search";
|
|
1844
1847
|
workqueue: "workqueue";
|
|
1845
1848
|
"dashboard.view": "dashboard.view";
|
|
1846
1849
|
}>;
|
|
1847
1850
|
$option: z.ZodEnum<{
|
|
1851
|
+
role: "role";
|
|
1848
1852
|
event: "event";
|
|
1849
1853
|
placeOfEvent: "placeOfEvent";
|
|
1850
1854
|
declaredIn: "declaredIn";
|
|
@@ -2024,10 +2028,12 @@ declare const Facility: z.ZodObject<{
|
|
|
2024
2028
|
"user.read": "user.read";
|
|
2025
2029
|
"user.create": "user.create";
|
|
2026
2030
|
"user.edit": "user.edit";
|
|
2031
|
+
"user.search": "user.search";
|
|
2027
2032
|
workqueue: "workqueue";
|
|
2028
2033
|
"dashboard.view": "dashboard.view";
|
|
2029
2034
|
}>;
|
|
2030
2035
|
$option: z.ZodEnum<{
|
|
2036
|
+
role: "role";
|
|
2031
2037
|
event: "event";
|
|
2032
2038
|
placeOfEvent: "placeOfEvent";
|
|
2033
2039
|
declaredIn: "declaredIn";
|
|
@@ -2128,10 +2134,12 @@ declare const Office: z.ZodObject<{
|
|
|
2128
2134
|
"user.read": "user.read";
|
|
2129
2135
|
"user.create": "user.create";
|
|
2130
2136
|
"user.edit": "user.edit";
|
|
2137
|
+
"user.search": "user.search";
|
|
2131
2138
|
workqueue: "workqueue";
|
|
2132
2139
|
"dashboard.view": "dashboard.view";
|
|
2133
2140
|
}>;
|
|
2134
2141
|
$option: z.ZodEnum<{
|
|
2142
|
+
role: "role";
|
|
2135
2143
|
event: "event";
|
|
2136
2144
|
placeOfEvent: "placeOfEvent";
|
|
2137
2145
|
declaredIn: "declaredIn";
|
|
@@ -2319,10 +2327,12 @@ declare const Address: z.ZodObject<{
|
|
|
2319
2327
|
"user.read": "user.read";
|
|
2320
2328
|
"user.create": "user.create";
|
|
2321
2329
|
"user.edit": "user.edit";
|
|
2330
|
+
"user.search": "user.search";
|
|
2322
2331
|
workqueue: "workqueue";
|
|
2323
2332
|
"dashboard.view": "dashboard.view";
|
|
2324
2333
|
}>;
|
|
2325
2334
|
$option: z.ZodEnum<{
|
|
2335
|
+
role: "role";
|
|
2326
2336
|
event: "event";
|
|
2327
2337
|
placeOfEvent: "placeOfEvent";
|
|
2328
2338
|
declaredIn: "declaredIn";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { UUID } from '../uuid';
|
|
1
2
|
import * as z from 'zod/v4';
|
|
2
3
|
import { EventIndex } from './EventIndex';
|
|
3
4
|
import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
|
|
4
|
-
import { RecordScopeV2 } from '../scopes';
|
|
5
|
+
import { RecordScopeV2, UserScopeV2 } from '../scopes';
|
|
5
6
|
import { SystemContext, UserContext } from '../users/User';
|
|
6
7
|
/** @deprecated Moving on, location types are arbitrary and defined by the country config. */
|
|
7
8
|
export declare const LocationTypeV1: z.ZodEnum<{
|
|
@@ -51,6 +52,21 @@ export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventInde
|
|
|
51
52
|
*
|
|
52
53
|
*/
|
|
53
54
|
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;
|
|
54
70
|
/**
|
|
55
71
|
* Given indexed event and list of resolved scopes, determine if any of the scopes allow access to the event.
|
|
56
72
|
*
|
|
@@ -182,6 +182,10 @@ 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");
|
|
185
189
|
var scopeOptionsPlaceEvent = z6.object({
|
|
186
190
|
event: scopeByEvent,
|
|
187
191
|
placeOfEvent: JurisdictionFilter.optional()
|
|
@@ -205,6 +209,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
205
209
|
var AccessLevelOptions = z6.object({
|
|
206
210
|
accessLevel: JurisdictionFilter.optional()
|
|
207
211
|
});
|
|
212
|
+
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
213
|
+
role: userRole.optional()
|
|
214
|
+
});
|
|
208
215
|
var WorkqueueOrDashboardOptions = z6.object({
|
|
209
216
|
ids: z6.preprocess(
|
|
210
217
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -214,6 +221,7 @@ var WorkqueueOrDashboardOptions = z6.object({
|
|
|
214
221
|
var AllScopeOptions = z6.object({
|
|
215
222
|
...AllRecordScopeOptions.shape,
|
|
216
223
|
...AccessLevelOptions.shape,
|
|
224
|
+
...AllUserScopeOptions.shape,
|
|
217
225
|
...WorkqueueOrDashboardOptions.shape
|
|
218
226
|
});
|
|
219
227
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
@@ -286,6 +294,30 @@ var RecordScopeV2 = z6.discriminatedUnion("type", [
|
|
|
286
294
|
]).describe(
|
|
287
295
|
"Scopes used to check user's permission to perform actions on a record."
|
|
288
296
|
);
|
|
297
|
+
var SystemScopeType = z6.enum([
|
|
298
|
+
"organisation.read-locations",
|
|
299
|
+
"user.read",
|
|
300
|
+
"user.create",
|
|
301
|
+
"user.edit",
|
|
302
|
+
"user.search"
|
|
303
|
+
]);
|
|
304
|
+
var UserScopeType = SystemScopeType.extract([
|
|
305
|
+
"user.read",
|
|
306
|
+
"user.create",
|
|
307
|
+
"user.edit",
|
|
308
|
+
"user.search"
|
|
309
|
+
]);
|
|
310
|
+
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
311
|
+
var UserScopeV2 = z6.discriminatedUnion("type", [
|
|
312
|
+
z6.object({
|
|
313
|
+
type: ScopesWithRoleOption,
|
|
314
|
+
options: AllUserScopeOptions.optional()
|
|
315
|
+
}),
|
|
316
|
+
z6.object({
|
|
317
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
318
|
+
options: AccessLevelOptions.optional()
|
|
319
|
+
})
|
|
320
|
+
]);
|
|
289
321
|
var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
|
|
290
322
|
z6.object({
|
|
291
323
|
type: ScopesWithPlaceEventOptions,
|
|
@@ -306,16 +338,14 @@ var ResolvedRecordScopeV2 = z6.discriminatedUnion("type", [
|
|
|
306
338
|
}).optional()
|
|
307
339
|
})
|
|
308
340
|
]).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
341
|
var Scope2 = z6.discriminatedUnion("type", [
|
|
316
342
|
z6.object({ type: PlainScopeType }),
|
|
317
343
|
...RecordScopeV2.options,
|
|
318
|
-
|
|
344
|
+
...UserScopeV2.options,
|
|
345
|
+
z6.object({
|
|
346
|
+
type: z6.literal("organisation.read-locations"),
|
|
347
|
+
options: AccessLevelOptions.optional()
|
|
348
|
+
}),
|
|
319
349
|
z6.object({
|
|
320
350
|
type: z6.literal("workqueue"),
|
|
321
351
|
options: WorkqueueOrDashboardOptions
|
package/dist/events/index.js
CHANGED
|
@@ -243,6 +243,8 @@ __export(events_exports, {
|
|
|
243
243
|
areConditionsMet: () => areConditionsMet,
|
|
244
244
|
buildFormState: () => buildFormState,
|
|
245
245
|
canAccessEventWithScope: () => canAccessEventWithScope,
|
|
246
|
+
canAccessOtherUserWithScopes: () => canAccessOtherUserWithScopes,
|
|
247
|
+
canAccessUserWithScope: () => canAccessUserWithScope,
|
|
246
248
|
compositeFieldTypes: () => compositeFieldTypes,
|
|
247
249
|
createEmptyDraft: () => createEmptyDraft,
|
|
248
250
|
createFieldConditionals: () => createFieldConditionals,
|
|
@@ -489,6 +491,10 @@ var scopeByEvent = z2.preprocess(
|
|
|
489
491
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
490
492
|
z2.array(z2.string()).optional()
|
|
491
493
|
).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");
|
|
492
498
|
var scopeOptionsPlaceEvent = z2.object({
|
|
493
499
|
event: scopeByEvent,
|
|
494
500
|
placeOfEvent: JurisdictionFilter.optional()
|
|
@@ -512,6 +518,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
512
518
|
var AccessLevelOptions = z2.object({
|
|
513
519
|
accessLevel: JurisdictionFilter.optional()
|
|
514
520
|
});
|
|
521
|
+
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
522
|
+
role: userRole.optional()
|
|
523
|
+
});
|
|
515
524
|
var WorkqueueOrDashboardOptions = z2.object({
|
|
516
525
|
ids: z2.preprocess(
|
|
517
526
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -521,6 +530,7 @@ var WorkqueueOrDashboardOptions = z2.object({
|
|
|
521
530
|
var AllScopeOptions = z2.object({
|
|
522
531
|
...AllRecordScopeOptions.shape,
|
|
523
532
|
...AccessLevelOptions.shape,
|
|
533
|
+
...AllUserScopeOptions.shape,
|
|
524
534
|
...WorkqueueOrDashboardOptions.shape
|
|
525
535
|
});
|
|
526
536
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
@@ -593,6 +603,33 @@ var RecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
593
603
|
]).describe(
|
|
594
604
|
"Scopes used to check user's permission to perform actions on a record."
|
|
595
605
|
);
|
|
606
|
+
var SystemScopeType = z2.enum([
|
|
607
|
+
"organisation.read-locations",
|
|
608
|
+
"user.read",
|
|
609
|
+
"user.create",
|
|
610
|
+
"user.edit",
|
|
611
|
+
"user.search"
|
|
612
|
+
]);
|
|
613
|
+
var UserScopeType = SystemScopeType.extract([
|
|
614
|
+
"user.read",
|
|
615
|
+
"user.create",
|
|
616
|
+
"user.edit",
|
|
617
|
+
"user.search"
|
|
618
|
+
]);
|
|
619
|
+
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
620
|
+
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
621
|
+
z2.object({
|
|
622
|
+
type: ScopesWithRoleOption,
|
|
623
|
+
options: AllUserScopeOptions.optional()
|
|
624
|
+
}),
|
|
625
|
+
z2.object({
|
|
626
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
627
|
+
options: AccessLevelOptions.optional()
|
|
628
|
+
})
|
|
629
|
+
]);
|
|
630
|
+
function scopeUsesRoleOptions(scope) {
|
|
631
|
+
return ScopesWithRoleOption?.options.some((opt) => opt === scope.type);
|
|
632
|
+
}
|
|
596
633
|
function scopeUsesDeclaredOptions(scope) {
|
|
597
634
|
return !ScopesWithPlaceEventOptions.options.some((opt) => opt === scope.type);
|
|
598
635
|
}
|
|
@@ -625,16 +662,14 @@ var ResolvedRecordScopeV2 = z2.discriminatedUnion("type", [
|
|
|
625
662
|
}).optional()
|
|
626
663
|
})
|
|
627
664
|
]).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
|
-
]);
|
|
634
665
|
var Scope = z2.discriminatedUnion("type", [
|
|
635
666
|
z2.object({ type: PlainScopeType }),
|
|
636
667
|
...RecordScopeV2.options,
|
|
637
|
-
|
|
668
|
+
...UserScopeV2.options,
|
|
669
|
+
z2.object({
|
|
670
|
+
type: z2.literal("organisation.read-locations"),
|
|
671
|
+
options: AccessLevelOptions.optional()
|
|
672
|
+
}),
|
|
638
673
|
z2.object({
|
|
639
674
|
type: z2.literal("workqueue"),
|
|
640
675
|
options: WorkqueueOrDashboardOptions
|
|
@@ -9930,6 +9965,39 @@ function canAccessEventWithScope(event2, scope, user2, customActionType) {
|
|
|
9930
9965
|
}
|
|
9931
9966
|
return true;
|
|
9932
9967
|
}
|
|
9968
|
+
function canAccessUserWithScope({
|
|
9969
|
+
userToAccess,
|
|
9970
|
+
scope,
|
|
9971
|
+
user: user2
|
|
9972
|
+
}) {
|
|
9973
|
+
const opts = scope.options;
|
|
9974
|
+
const hasSameOffice = user2.primaryOfficeId === userToAccess.primaryOfficeId;
|
|
9975
|
+
if (opts?.accessLevel === JurisdictionFilter.enum.location && !hasSameOffice) {
|
|
9976
|
+
return false;
|
|
9977
|
+
}
|
|
9978
|
+
const hasAdministrativeAreaInHierarchy = userToAccess.administrativeHierarchy.some(
|
|
9979
|
+
(id) => user2.administrativeAreaId === id
|
|
9980
|
+
) || user2.administrativeAreaId === null;
|
|
9981
|
+
if (opts?.accessLevel === JurisdictionFilter.enum.administrativeArea && !hasAdministrativeAreaInHierarchy) {
|
|
9982
|
+
return false;
|
|
9983
|
+
}
|
|
9984
|
+
if (scopeUsesRoleOptions(scope)) {
|
|
9985
|
+
const { options } = scope;
|
|
9986
|
+
if (options?.role && !options.role.includes(userToAccess.role)) {
|
|
9987
|
+
return false;
|
|
9988
|
+
}
|
|
9989
|
+
}
|
|
9990
|
+
return true;
|
|
9991
|
+
}
|
|
9992
|
+
function canAccessOtherUserWithScopes({
|
|
9993
|
+
scopes,
|
|
9994
|
+
userToAccess,
|
|
9995
|
+
user: user2
|
|
9996
|
+
}) {
|
|
9997
|
+
return scopes.some(
|
|
9998
|
+
(scope) => canAccessUserWithScope({ userToAccess, scope, user: user2 })
|
|
9999
|
+
);
|
|
10000
|
+
}
|
|
9933
10001
|
function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
|
|
9934
10002
|
return scopes.some(
|
|
9935
10003
|
(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"}
|