@opencrvs/toolkit 2.0.0-rc.3edb4f4 → 2.0.0-rc.4ac5bfa
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 +35 -7
- package/dist/cli.js +35 -7
- package/dist/commons/api/router.d.ts +119 -109
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/events/AuditLog.d.ts +2 -0
- package/dist/commons/events/FieldConfig.d.ts +5 -0
- package/dist/commons/events/locations.d.ts +17 -1
- package/dist/commons/notification/UserNotifications.d.ts +15 -0
- package/dist/conditionals/index.js +35 -7
- package/dist/events/index.js +74 -7
- package/dist/migrations/v2.0/index.js +35 -7
- package/dist/notification/index.js +41 -7
- package/dist/scopes/index.d.ts +82 -10
- package/dist/scopes/index.js +41 -8
- package/opencrvs-toolkit-2.0.0-rc.4ac5bfa.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.3edb4f4.tgz +0 -0
|
@@ -656,6 +656,10 @@ var scopeByEvent = z11.preprocess(
|
|
|
656
656
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
657
657
|
z11.array(z11.string()).optional()
|
|
658
658
|
).describe("Event type, e.g. birth, death");
|
|
659
|
+
var userRole = z11.preprocess(
|
|
660
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
661
|
+
z11.array(z11.string()).optional()
|
|
662
|
+
).describe("User role, e.g. admin, field agent");
|
|
659
663
|
var scopeOptionsPlaceEvent = z11.object({
|
|
660
664
|
event: scopeByEvent,
|
|
661
665
|
placeOfEvent: JurisdictionFilter.optional()
|
|
@@ -679,6 +683,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
679
683
|
var AccessLevelOptions = z11.object({
|
|
680
684
|
accessLevel: JurisdictionFilter.optional()
|
|
681
685
|
});
|
|
686
|
+
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
687
|
+
role: userRole.optional()
|
|
688
|
+
});
|
|
682
689
|
var WorkqueueOrDashboardOptions = z11.object({
|
|
683
690
|
ids: z11.preprocess(
|
|
684
691
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -688,6 +695,7 @@ var WorkqueueOrDashboardOptions = z11.object({
|
|
|
688
695
|
var AllScopeOptions = z11.object({
|
|
689
696
|
...AllRecordScopeOptions.shape,
|
|
690
697
|
...AccessLevelOptions.shape,
|
|
698
|
+
...AllUserScopeOptions.shape,
|
|
691
699
|
...WorkqueueOrDashboardOptions.shape
|
|
692
700
|
});
|
|
693
701
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
@@ -760,6 +768,28 @@ var RecordScopeV2 = z11.discriminatedUnion("type", [
|
|
|
760
768
|
]).describe(
|
|
761
769
|
"Scopes used to check user's permission to perform actions on a record."
|
|
762
770
|
);
|
|
771
|
+
var SystemScopeType = z11.enum([
|
|
772
|
+
"organisation.read-locations",
|
|
773
|
+
"user.read",
|
|
774
|
+
"user.create",
|
|
775
|
+
"user.edit"
|
|
776
|
+
]);
|
|
777
|
+
var UserScopeType = SystemScopeType.extract([
|
|
778
|
+
"user.read",
|
|
779
|
+
"user.create",
|
|
780
|
+
"user.edit"
|
|
781
|
+
]);
|
|
782
|
+
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
783
|
+
var UserScopeV2 = z11.discriminatedUnion("type", [
|
|
784
|
+
z11.object({
|
|
785
|
+
type: ScopesWithRoleOption,
|
|
786
|
+
options: AllUserScopeOptions.optional()
|
|
787
|
+
}),
|
|
788
|
+
z11.object({
|
|
789
|
+
type: UserScopeType.extract(["user.read"]),
|
|
790
|
+
options: AccessLevelOptions.optional()
|
|
791
|
+
})
|
|
792
|
+
]);
|
|
763
793
|
var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
|
|
764
794
|
z11.object({
|
|
765
795
|
type: ScopesWithPlaceEventOptions,
|
|
@@ -780,16 +810,14 @@ var ResolvedRecordScopeV2 = z11.discriminatedUnion("type", [
|
|
|
780
810
|
}).optional()
|
|
781
811
|
})
|
|
782
812
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
783
|
-
var SystemScopeType = z11.enum([
|
|
784
|
-
"organisation.read-locations",
|
|
785
|
-
"user.read",
|
|
786
|
-
"user.create",
|
|
787
|
-
"user.edit"
|
|
788
|
-
]);
|
|
789
813
|
var Scope = z11.discriminatedUnion("type", [
|
|
790
814
|
z11.object({ type: PlainScopeType }),
|
|
791
815
|
...RecordScopeV2.options,
|
|
792
|
-
|
|
816
|
+
...UserScopeV2.options,
|
|
817
|
+
z11.object({
|
|
818
|
+
type: z11.literal("organisation.read-locations"),
|
|
819
|
+
options: AccessLevelOptions.optional()
|
|
820
|
+
}),
|
|
793
821
|
z11.object({
|
|
794
822
|
type: z11.literal("workqueue"),
|
|
795
823
|
options: WorkqueueOrDashboardOptions
|
package/dist/cli.js
CHANGED
|
@@ -2110,6 +2110,10 @@ var scopeByEvent = z3.preprocess(
|
|
|
2110
2110
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
2111
2111
|
z3.array(z3.string()).optional()
|
|
2112
2112
|
).describe("Event type, e.g. birth, death");
|
|
2113
|
+
var userRole = z3.preprocess(
|
|
2114
|
+
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
2115
|
+
z3.array(z3.string()).optional()
|
|
2116
|
+
).describe("User role, e.g. admin, field agent");
|
|
2113
2117
|
var scopeOptionsPlaceEvent = z3.object({
|
|
2114
2118
|
event: scopeByEvent,
|
|
2115
2119
|
placeOfEvent: JurisdictionFilter.optional()
|
|
@@ -2133,6 +2137,9 @@ var CustomActionScopeOptions = AllRecordScopeOptions.extend({
|
|
|
2133
2137
|
var AccessLevelOptions = z3.object({
|
|
2134
2138
|
accessLevel: JurisdictionFilter.optional()
|
|
2135
2139
|
});
|
|
2140
|
+
var AllUserScopeOptions = AccessLevelOptions.extend({
|
|
2141
|
+
role: userRole.optional()
|
|
2142
|
+
});
|
|
2136
2143
|
var WorkqueueOrDashboardOptions = z3.object({
|
|
2137
2144
|
ids: z3.preprocess(
|
|
2138
2145
|
(val) => val === void 0 ? void 0 : [val].flat(),
|
|
@@ -2142,6 +2149,7 @@ var WorkqueueOrDashboardOptions = z3.object({
|
|
|
2142
2149
|
var AllScopeOptions = z3.object({
|
|
2143
2150
|
...AllRecordScopeOptions.shape,
|
|
2144
2151
|
...AccessLevelOptions.shape,
|
|
2152
|
+
...AllUserScopeOptions.shape,
|
|
2145
2153
|
...WorkqueueOrDashboardOptions.shape
|
|
2146
2154
|
});
|
|
2147
2155
|
var ScopeOptionKey = AllScopeOptions.keyof();
|
|
@@ -2214,6 +2222,28 @@ var RecordScopeV2 = z3.discriminatedUnion("type", [
|
|
|
2214
2222
|
]).describe(
|
|
2215
2223
|
"Scopes used to check user's permission to perform actions on a record."
|
|
2216
2224
|
);
|
|
2225
|
+
var SystemScopeType = z3.enum([
|
|
2226
|
+
"organisation.read-locations",
|
|
2227
|
+
"user.read",
|
|
2228
|
+
"user.create",
|
|
2229
|
+
"user.edit"
|
|
2230
|
+
]);
|
|
2231
|
+
var UserScopeType = SystemScopeType.extract([
|
|
2232
|
+
"user.read",
|
|
2233
|
+
"user.create",
|
|
2234
|
+
"user.edit"
|
|
2235
|
+
]);
|
|
2236
|
+
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
2237
|
+
var UserScopeV2 = z3.discriminatedUnion("type", [
|
|
2238
|
+
z3.object({
|
|
2239
|
+
type: ScopesWithRoleOption,
|
|
2240
|
+
options: AllUserScopeOptions.optional()
|
|
2241
|
+
}),
|
|
2242
|
+
z3.object({
|
|
2243
|
+
type: UserScopeType.extract(["user.read"]),
|
|
2244
|
+
options: AccessLevelOptions.optional()
|
|
2245
|
+
})
|
|
2246
|
+
]);
|
|
2217
2247
|
var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
|
|
2218
2248
|
z3.object({
|
|
2219
2249
|
type: ScopesWithPlaceEventOptions,
|
|
@@ -2234,16 +2264,14 @@ var ResolvedRecordScopeV2 = z3.discriminatedUnion("type", [
|
|
|
2234
2264
|
}).optional()
|
|
2235
2265
|
})
|
|
2236
2266
|
]).describe("Resolved scope with location/user IDs instead of filters.");
|
|
2237
|
-
var SystemScopeType = z3.enum([
|
|
2238
|
-
"organisation.read-locations",
|
|
2239
|
-
"user.read",
|
|
2240
|
-
"user.create",
|
|
2241
|
-
"user.edit"
|
|
2242
|
-
]);
|
|
2243
2267
|
var Scope2 = z3.discriminatedUnion("type", [
|
|
2244
2268
|
z3.object({ type: PlainScopeType }),
|
|
2245
2269
|
...RecordScopeV2.options,
|
|
2246
|
-
|
|
2270
|
+
...UserScopeV2.options,
|
|
2271
|
+
z3.object({
|
|
2272
|
+
type: z3.literal("organisation.read-locations"),
|
|
2273
|
+
options: AccessLevelOptions.optional()
|
|
2274
|
+
}),
|
|
2247
2275
|
z3.object({
|
|
2248
2276
|
type: z3.literal("workqueue"),
|
|
2249
2277
|
options: WorkqueueOrDashboardOptions
|