@opencrvs/toolkit 1.9.12-rc.ea32f28 → 1.9.12-rc.f5ca5e6
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 +5 -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 +124 -0
- package/dist/commons/api/router.d.ts +3163 -2251
- package/dist/commons/application-config/index.d.ts +87 -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 +288 -1496
- package/dist/commons/events/AuditLog.d.ts +223 -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 +1345 -4495
- 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 +7 -91
- package/dist/commons/events/EventConfig.d.ts +35 -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 +208 -1014
- 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 +2671 -12896
- package/dist/commons/events/FieldType.d.ts +25 -4
- package/dist/commons/events/FieldTypeMapping.d.ts +289 -907
- package/dist/commons/events/FieldValue.d.ts +121 -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 +2008 -7597
- package/dist/commons/events/deduplication.d.ts +3 -3
- package/dist/commons/events/defineConfig.d.ts +2 -243
- 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 +33 -33
- 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 +413 -310
- package/dist/commons/notification/UserNotifications.d.ts +55 -636
- package/dist/conditionals/index.d.ts.map +1 -1
- package/dist/conditionals/index.js +587 -14
- package/dist/events/deduplication.d.ts +3 -3
- package/dist/events/index.js +2689 -1891
- package/dist/notification/index.d.ts.map +1 -1
- package/dist/notification/index.js +1987 -1553
- package/dist/scopes/index.d.ts +352 -302
- package/dist/scopes/index.d.ts.map +1 -1
- package/dist/scopes/index.js +444 -210
- package/opencrvs-toolkit-1.9.12-rc.f5ca5e6.tgz +0 -0
- package/package.json +11 -5
- package/tsconfig.json +9 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/commons/events/CreatedAtLocation.d.ts +0 -2
package/dist/scopes/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { SearchScopeAccessLevels } from './events';
|
|
1
|
+
import * as z from 'zod/v4';
|
|
3
2
|
export declare const SCOPES: {
|
|
4
3
|
readonly BYPASSRATELIMIT: "bypassratelimit";
|
|
5
4
|
readonly REGISTER: "register";
|
|
@@ -12,6 +11,7 @@ export declare const SCOPES: {
|
|
|
12
11
|
readonly RECORD_IMPORT: "record.import";
|
|
13
12
|
readonly RECORD_EXPORT: "record.export";
|
|
14
13
|
readonly RECORD_REINDEX: "record.reindex";
|
|
14
|
+
readonly INTEGRATION_CREATE: "integration.create";
|
|
15
15
|
readonly RECORD_DECLARE_BIRTH: "record.declare-birth";
|
|
16
16
|
readonly RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction";
|
|
17
17
|
readonly RECORD_DECLARE_DEATH: "record.declare-death";
|
|
@@ -61,325 +61,375 @@ export declare const SCOPES: {
|
|
|
61
61
|
readonly USER_UPDATE_MY_JURISDICTION: "user.update:my-jurisdiction";
|
|
62
62
|
readonly CONFIG_UPDATE_ALL: "config.update:all";
|
|
63
63
|
readonly USER_DATA_SEEDING: "user.data-seeding";
|
|
64
|
+
readonly ATTACHMENT_UPLOAD: "attachment.upload";
|
|
64
65
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}, {
|
|
76
|
-
event: string[];
|
|
77
|
-
access: ("my-jurisdiction" | "all")[];
|
|
78
|
-
}>;
|
|
79
|
-
}, "strip", z.ZodTypeAny, {
|
|
80
|
-
type: "search";
|
|
81
|
-
options: {
|
|
82
|
-
event: string[];
|
|
83
|
-
access: ("my-jurisdiction" | "all")[];
|
|
84
|
-
};
|
|
85
|
-
}, {
|
|
86
|
-
type: "search";
|
|
87
|
-
options: {
|
|
88
|
-
event: string[];
|
|
89
|
-
access: ("my-jurisdiction" | "all")[];
|
|
90
|
-
};
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated - will be removed in v2.1.
|
|
68
|
+
*/
|
|
69
|
+
export declare function parseLiteralScope(scope: string): {
|
|
70
|
+
type: "bypassratelimit" | "register" | "demo" | "config" | "webhook" | "nationalId" | "notification-api" | "recordsearch" | "record.import" | "record.reindex" | "integration.create" | "record.registration-print&issue-certified-copies" | "profile.electronic-signature" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "organisation.read-locations:all" | "organisation.read-locations:my-office" | "organisation.read-locations:my-jurisdiction" | "user.read:all" | "user.read:my-office" | "user.read:my-jurisdiction" | "user.read:only-my-audit" | "user.create:all" | "user.create:my-jurisdiction" | "user.update:all" | "user.update:my-jurisdiction" | "config.update:all" | "user.data-seeding" | "attachment.upload";
|
|
71
|
+
} | undefined;
|
|
72
|
+
export declare const JurisdictionFilter: z.ZodEnum<{
|
|
73
|
+
all: "all";
|
|
74
|
+
administrativeArea: "administrativeArea";
|
|
75
|
+
location: "location";
|
|
91
76
|
}>;
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
event: z.ZodArray<z.ZodString, "many">;
|
|
96
|
-
templates: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
97
|
-
}, "strip", z.ZodTypeAny, {
|
|
98
|
-
event: string[];
|
|
99
|
-
templates?: string[] | undefined;
|
|
100
|
-
}, {
|
|
101
|
-
event: string[];
|
|
102
|
-
templates?: string[] | undefined;
|
|
103
|
-
}>;
|
|
104
|
-
}, "strip", z.ZodTypeAny, {
|
|
105
|
-
type: "record.registered.print-certified-copies";
|
|
106
|
-
options: {
|
|
107
|
-
event: string[];
|
|
108
|
-
templates?: string[] | undefined;
|
|
109
|
-
};
|
|
110
|
-
}, {
|
|
111
|
-
type: "record.registered.print-certified-copies";
|
|
112
|
-
options: {
|
|
113
|
-
event: string[];
|
|
114
|
-
templates?: string[] | undefined;
|
|
115
|
-
};
|
|
77
|
+
export type JurisdictionFilter = z.infer<typeof JurisdictionFilter>;
|
|
78
|
+
export declare const UserFilter: z.ZodEnum<{
|
|
79
|
+
user: "user";
|
|
116
80
|
}>;
|
|
117
|
-
export type
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
81
|
+
export type UserFilter = z.infer<typeof UserFilter>;
|
|
82
|
+
/**
|
|
83
|
+
* The different types of scopes that can be used to control access to records. Each type has different options that can be used to further filter the records that the scope applies to.
|
|
84
|
+
* When adding new scope types, they should be added to the appropriate section based on the options they require.
|
|
85
|
+
*
|
|
86
|
+
* @see scopeOptionsPlaceEvent @see scopeOptionsDeclared @see scopeOptionsFull
|
|
87
|
+
*/
|
|
88
|
+
export declare const RecordScopeTypeV2: z.ZodEnum<{
|
|
89
|
+
"record.create": "record.create";
|
|
90
|
+
"record.read": "record.read";
|
|
91
|
+
"record.declare": "record.declare";
|
|
92
|
+
"record.notify": "record.notify";
|
|
93
|
+
"record.register": "record.register";
|
|
94
|
+
"record.unassign-others": "record.unassign-others";
|
|
95
|
+
"record.review-duplicates": "record.review-duplicates";
|
|
96
|
+
"record.search": "record.search";
|
|
97
|
+
"record.edit": "record.edit";
|
|
98
|
+
"record.reject": "record.reject";
|
|
99
|
+
"record.archive": "record.archive";
|
|
100
|
+
"record.print-certified-copies": "record.print-certified-copies";
|
|
101
|
+
"record.request-correction": "record.request-correction";
|
|
102
|
+
"record.correct": "record.correct";
|
|
103
|
+
"record.custom-action": "record.custom-action";
|
|
104
|
+
}>;
|
|
105
|
+
export type RecordScopeTypeV2 = z.infer<typeof RecordScopeTypeV2>;
|
|
106
|
+
declare const ScopeOptionsFull: z.ZodObject<{
|
|
107
|
+
event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
108
|
+
placeOfEvent: z.ZodOptional<z.ZodEnum<{
|
|
109
|
+
all: "all";
|
|
110
|
+
administrativeArea: "administrativeArea";
|
|
111
|
+
location: "location";
|
|
112
|
+
}>>;
|
|
113
|
+
declaredIn: z.ZodOptional<z.ZodEnum<{
|
|
114
|
+
all: "all";
|
|
115
|
+
administrativeArea: "administrativeArea";
|
|
116
|
+
location: "location";
|
|
117
|
+
}>>;
|
|
118
|
+
declaredBy: z.ZodOptional<z.ZodEnum<{
|
|
119
|
+
user: "user";
|
|
120
|
+
}>>;
|
|
121
|
+
registeredIn: z.ZodOptional<z.ZodEnum<{
|
|
122
|
+
all: "all";
|
|
123
|
+
administrativeArea: "administrativeArea";
|
|
124
|
+
location: "location";
|
|
125
|
+
}>>;
|
|
126
|
+
registeredBy: z.ZodOptional<z.ZodEnum<{
|
|
127
|
+
user: "user";
|
|
128
|
+
}>>;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
export type ScopeOptionsFull = z.infer<typeof ScopeOptionsFull>;
|
|
131
|
+
export declare const ScopeOptionKey: z.ZodEnum<{
|
|
132
|
+
event: "event";
|
|
133
|
+
placeOfEvent: "placeOfEvent";
|
|
134
|
+
declaredIn: "declaredIn";
|
|
135
|
+
declaredBy: "declaredBy";
|
|
136
|
+
registeredIn: "registeredIn";
|
|
137
|
+
registeredBy: "registeredBy";
|
|
138
|
+
}>;
|
|
139
|
+
export type ScopeOptionKey = z.infer<typeof ScopeOptionKey>;
|
|
140
|
+
export declare const ScopesWithPlaceEventOptions: z.ZodEnum<{
|
|
141
|
+
"record.create": "record.create";
|
|
142
|
+
"record.declare": "record.declare";
|
|
143
|
+
"record.notify": "record.notify";
|
|
140
144
|
}>;
|
|
141
|
-
export
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
145
|
+
export declare const ScopesWithDeclaredOptions: z.ZodEnum<{
|
|
146
|
+
"record.register": "record.register";
|
|
147
|
+
"record.review-duplicates": "record.review-duplicates";
|
|
148
|
+
"record.edit": "record.edit";
|
|
149
|
+
"record.reject": "record.reject";
|
|
150
|
+
"record.archive": "record.archive";
|
|
151
|
+
}>;
|
|
152
|
+
export declare const ScopesWithFullOptions: z.ZodEnum<{
|
|
153
|
+
"record.read": "record.read";
|
|
154
|
+
"record.unassign-others": "record.unassign-others";
|
|
155
|
+
"record.search": "record.search";
|
|
156
|
+
"record.request-correction": "record.request-correction";
|
|
157
|
+
"record.correct": "record.correct";
|
|
158
|
+
}>;
|
|
159
|
+
export declare const RecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
160
|
+
type: z.ZodEnum<{
|
|
161
|
+
"record.create": "record.create";
|
|
162
|
+
"record.declare": "record.declare";
|
|
163
|
+
"record.notify": "record.notify";
|
|
153
164
|
}>;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
event: z.ZodArray<z.ZodString, "many">;
|
|
170
|
-
templates: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
171
|
-
}, "strip", z.ZodTypeAny, {
|
|
172
|
-
event: string[];
|
|
173
|
-
templates?: string[] | undefined;
|
|
174
|
-
}, {
|
|
175
|
-
event: string[];
|
|
176
|
-
templates?: string[] | undefined;
|
|
165
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
166
|
+
event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
167
|
+
placeOfEvent: z.ZodOptional<z.ZodEnum<{
|
|
168
|
+
all: "all";
|
|
169
|
+
administrativeArea: "administrativeArea";
|
|
170
|
+
location: "location";
|
|
171
|
+
}>>;
|
|
172
|
+
}, z.core.$strip>>;
|
|
173
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
174
|
+
type: z.ZodEnum<{
|
|
175
|
+
"record.register": "record.register";
|
|
176
|
+
"record.review-duplicates": "record.review-duplicates";
|
|
177
|
+
"record.edit": "record.edit";
|
|
178
|
+
"record.reject": "record.reject";
|
|
179
|
+
"record.archive": "record.archive";
|
|
177
180
|
}>;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
181
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
182
|
+
event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
183
|
+
placeOfEvent: z.ZodOptional<z.ZodEnum<{
|
|
184
|
+
all: "all";
|
|
185
|
+
administrativeArea: "administrativeArea";
|
|
186
|
+
location: "location";
|
|
187
|
+
}>>;
|
|
188
|
+
declaredIn: z.ZodOptional<z.ZodEnum<{
|
|
189
|
+
all: "all";
|
|
190
|
+
administrativeArea: "administrativeArea";
|
|
191
|
+
location: "location";
|
|
192
|
+
}>>;
|
|
193
|
+
declaredBy: z.ZodOptional<z.ZodEnum<{
|
|
194
|
+
user: "user";
|
|
195
|
+
}>>;
|
|
196
|
+
}, z.core.$strip>>;
|
|
197
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
198
|
+
type: z.ZodEnum<{
|
|
199
|
+
"record.read": "record.read";
|
|
200
|
+
"record.unassign-others": "record.unassign-others";
|
|
201
|
+
"record.search": "record.search";
|
|
202
|
+
"record.request-correction": "record.request-correction";
|
|
203
|
+
"record.correct": "record.correct";
|
|
198
204
|
}>;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
205
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
206
|
+
event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
207
|
+
placeOfEvent: z.ZodOptional<z.ZodEnum<{
|
|
208
|
+
all: "all";
|
|
209
|
+
administrativeArea: "administrativeArea";
|
|
210
|
+
location: "location";
|
|
211
|
+
}>>;
|
|
212
|
+
declaredIn: z.ZodOptional<z.ZodEnum<{
|
|
213
|
+
all: "all";
|
|
214
|
+
administrativeArea: "administrativeArea";
|
|
215
|
+
location: "location";
|
|
216
|
+
}>>;
|
|
217
|
+
declaredBy: z.ZodOptional<z.ZodEnum<{
|
|
218
|
+
user: "user";
|
|
219
|
+
}>>;
|
|
220
|
+
registeredIn: z.ZodOptional<z.ZodEnum<{
|
|
221
|
+
all: "all";
|
|
222
|
+
administrativeArea: "administrativeArea";
|
|
223
|
+
location: "location";
|
|
224
|
+
}>>;
|
|
225
|
+
registeredBy: z.ZodOptional<z.ZodEnum<{
|
|
226
|
+
user: "user";
|
|
227
|
+
}>>;
|
|
228
|
+
}, z.core.$strip>>;
|
|
229
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
230
|
+
type: z.ZodLiteral<"record.custom-action">;
|
|
231
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
232
|
+
event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
233
|
+
placeOfEvent: z.ZodOptional<z.ZodEnum<{
|
|
234
|
+
all: "all";
|
|
235
|
+
administrativeArea: "administrativeArea";
|
|
236
|
+
location: "location";
|
|
237
|
+
}>>;
|
|
238
|
+
declaredIn: z.ZodOptional<z.ZodEnum<{
|
|
239
|
+
all: "all";
|
|
240
|
+
administrativeArea: "administrativeArea";
|
|
241
|
+
location: "location";
|
|
242
|
+
}>>;
|
|
243
|
+
declaredBy: z.ZodOptional<z.ZodEnum<{
|
|
244
|
+
user: "user";
|
|
245
|
+
}>>;
|
|
246
|
+
registeredIn: z.ZodOptional<z.ZodEnum<{
|
|
247
|
+
all: "all";
|
|
248
|
+
administrativeArea: "administrativeArea";
|
|
249
|
+
location: "location";
|
|
250
|
+
}>>;
|
|
251
|
+
registeredBy: z.ZodOptional<z.ZodEnum<{
|
|
252
|
+
user: "user";
|
|
253
|
+
}>>;
|
|
254
|
+
customActionTypes: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
255
|
+
}, z.core.$strip>>;
|
|
256
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
257
|
+
type: z.ZodLiteral<"record.print-certified-copies">;
|
|
258
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
259
|
+
event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
260
|
+
placeOfEvent: z.ZodOptional<z.ZodEnum<{
|
|
261
|
+
all: "all";
|
|
262
|
+
administrativeArea: "administrativeArea";
|
|
263
|
+
location: "location";
|
|
264
|
+
}>>;
|
|
265
|
+
declaredIn: z.ZodOptional<z.ZodEnum<{
|
|
266
|
+
all: "all";
|
|
267
|
+
administrativeArea: "administrativeArea";
|
|
268
|
+
location: "location";
|
|
269
|
+
}>>;
|
|
270
|
+
declaredBy: z.ZodOptional<z.ZodEnum<{
|
|
271
|
+
user: "user";
|
|
272
|
+
}>>;
|
|
273
|
+
registeredIn: z.ZodOptional<z.ZodEnum<{
|
|
274
|
+
all: "all";
|
|
275
|
+
administrativeArea: "administrativeArea";
|
|
276
|
+
location: "location";
|
|
277
|
+
}>>;
|
|
278
|
+
registeredBy: z.ZodOptional<z.ZodEnum<{
|
|
279
|
+
user: "user";
|
|
280
|
+
}>>;
|
|
281
|
+
templates: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
282
|
+
}, z.core.$strip>>;
|
|
283
|
+
}, z.core.$strip>], "type">;
|
|
284
|
+
export declare function scopeUsesDeclaredOptions(scope: RecordScopeV2): scope is Extract<RecordScopeV2, {
|
|
285
|
+
type: z.infer<typeof ScopesWithDeclaredOptions>;
|
|
286
|
+
}>;
|
|
287
|
+
export declare function scopeUsesFullOptions(scope: RecordScopeV2): scope is Extract<RecordScopeV2, {
|
|
288
|
+
type: z.infer<typeof ScopesWithFullOptions>;
|
|
289
|
+
}>;
|
|
290
|
+
export declare function scopeUsesPrintCertifiedCopiesOptions(scope: RecordScopeV2): scope is Extract<RecordScopeV2, {
|
|
291
|
+
type: 'record.print-certified-copies';
|
|
292
|
+
}>;
|
|
293
|
+
export declare function isCustomActionScope(scope: RecordScopeV2): scope is Extract<RecordScopeV2, {
|
|
294
|
+
type: 'record.custom-action';
|
|
295
|
+
}>;
|
|
296
|
+
export declare const ResolvedRecordScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
297
|
+
type: z.ZodEnum<{
|
|
298
|
+
"record.create": "record.create";
|
|
299
|
+
"record.declare": "record.declare";
|
|
300
|
+
"record.notify": "record.notify";
|
|
217
301
|
}>;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
type: z.ZodLiteral<"workqueue">;
|
|
230
|
-
options: z.ZodObject<{
|
|
231
|
-
id: z.ZodArray<z.ZodString, "many">;
|
|
232
|
-
}, "strip", z.ZodTypeAny, {
|
|
233
|
-
id: string[];
|
|
234
|
-
}, {
|
|
235
|
-
id: string[];
|
|
302
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
303
|
+
event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
304
|
+
placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
|
|
305
|
+
}, z.core.$strip>>;
|
|
306
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
307
|
+
type: z.ZodEnum<{
|
|
308
|
+
"record.register": "record.register";
|
|
309
|
+
"record.review-duplicates": "record.review-duplicates";
|
|
310
|
+
"record.edit": "record.edit";
|
|
311
|
+
"record.reject": "record.reject";
|
|
312
|
+
"record.archive": "record.archive";
|
|
236
313
|
}>;
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
},
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
event: z.ZodArray<z.ZodString, "many">;
|
|
251
|
-
}, "strip", z.ZodTypeAny, {
|
|
252
|
-
event: string[];
|
|
253
|
-
}, {
|
|
254
|
-
event: string[];
|
|
314
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
315
|
+
event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
316
|
+
placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
|
|
317
|
+
declaredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
|
|
318
|
+
declaredBy: z.ZodOptional<z.ZodString>;
|
|
319
|
+
}, z.core.$strip>>;
|
|
320
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
321
|
+
type: z.ZodEnum<{
|
|
322
|
+
"record.read": "record.read";
|
|
323
|
+
"record.unassign-others": "record.unassign-others";
|
|
324
|
+
"record.search": "record.search";
|
|
325
|
+
"record.request-correction": "record.request-correction";
|
|
326
|
+
"record.correct": "record.correct";
|
|
255
327
|
}>;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
}>
|
|
276
|
-
export
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
}
|
|
285
|
-
type: "user.create";
|
|
286
|
-
options: {
|
|
287
|
-
role: string[];
|
|
288
|
-
};
|
|
289
|
-
}, {
|
|
290
|
-
type: T;
|
|
291
|
-
}> | Extract<{
|
|
292
|
-
type: "user.edit";
|
|
293
|
-
options: {
|
|
294
|
-
role: string[];
|
|
295
|
-
};
|
|
296
|
-
}, {
|
|
297
|
-
type: T;
|
|
298
|
-
}> | Extract<{
|
|
299
|
-
type: "workqueue";
|
|
300
|
-
options: {
|
|
301
|
-
id: string[];
|
|
302
|
-
};
|
|
303
|
-
}, {
|
|
304
|
-
type: T;
|
|
305
|
-
}> | Extract<{
|
|
306
|
-
type: "record.unassign-others" | "record.register" | "record.read" | "record.create" | "record.declare" | "record.notify" | "record.declared.validate" | "record.declared.reject" | "record.declared.archive" | "record.declared.review-duplicates" | "record.registered.request-correction" | "record.registered.correct";
|
|
307
|
-
options: {
|
|
308
|
-
event: string[];
|
|
309
|
-
};
|
|
310
|
-
}, {
|
|
311
|
-
type: T;
|
|
312
|
-
}> | Extract<FlattenedSearchScope, {
|
|
313
|
-
type: T;
|
|
314
|
-
}> | undefined;
|
|
315
|
-
/**
|
|
316
|
-
* Parses a configurable scope string into a ConfigurableRawScopes object.
|
|
317
|
-
* @param {string} scope - The scope string to parse
|
|
318
|
-
* @returns {ConfigurableRawScopes | undefined} The parsed scope object if valid, undefined otherwise
|
|
319
|
-
* @example
|
|
320
|
-
* parseScope("user.create[role=field-agent|registration-agent]")
|
|
321
|
-
* // Returns: { type: "user.create", options: { role: ["field-agent", "registration-agent"] } }
|
|
322
|
-
*/
|
|
323
|
-
export declare function parseConfigurableScope(scope: string): {
|
|
324
|
-
type: "record.registered.print-certified-copies";
|
|
325
|
-
options: {
|
|
326
|
-
event: string[];
|
|
327
|
-
templates?: string[] | undefined;
|
|
328
|
-
};
|
|
329
|
-
} | {
|
|
330
|
-
type: "search";
|
|
331
|
-
options: {
|
|
332
|
-
event: string[];
|
|
333
|
-
access: ("my-jurisdiction" | "all")[];
|
|
334
|
-
};
|
|
328
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
329
|
+
event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
330
|
+
placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
|
|
331
|
+
declaredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
|
|
332
|
+
declaredBy: z.ZodOptional<z.ZodString>;
|
|
333
|
+
registeredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
|
|
334
|
+
registeredBy: z.ZodOptional<z.ZodString>;
|
|
335
|
+
}, z.core.$strip>>;
|
|
336
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
337
|
+
type: z.ZodLiteral<"record.print-certified-copies">;
|
|
338
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
339
|
+
event: z.ZodPipe<z.ZodTransform<({} | null)[] | undefined, unknown>, z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
340
|
+
placeOfEvent: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
|
|
341
|
+
declaredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
|
|
342
|
+
declaredBy: z.ZodOptional<z.ZodString>;
|
|
343
|
+
registeredIn: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID">>>;
|
|
344
|
+
registeredBy: z.ZodOptional<z.ZodString>;
|
|
345
|
+
templates: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
346
|
+
}, z.core.$strip>>;
|
|
347
|
+
}, z.core.$strip>], "type">;
|
|
348
|
+
export type RecordScopeV2 = z.infer<typeof RecordScopeV2>;
|
|
349
|
+
export type ResolvedRecordScopeV2 = z.infer<typeof ResolvedRecordScopeV2>;
|
|
350
|
+
export declare const encodeScope: (scope: RecordScopeV2) => string;
|
|
351
|
+
export declare const decodeScope: (query: string) => {
|
|
352
|
+
type: "record.create" | "record.declare" | "record.notify";
|
|
353
|
+
options?: {
|
|
354
|
+
event?: string[] | undefined;
|
|
355
|
+
placeOfEvent?: "all" | "administrativeArea" | "location" | undefined;
|
|
356
|
+
} | undefined;
|
|
335
357
|
} | {
|
|
336
|
-
type: "
|
|
337
|
-
options
|
|
338
|
-
|
|
339
|
-
|
|
358
|
+
type: "record.register" | "record.review-duplicates" | "record.edit" | "record.reject" | "record.archive";
|
|
359
|
+
options?: {
|
|
360
|
+
event?: string[] | undefined;
|
|
361
|
+
placeOfEvent?: "all" | "administrativeArea" | "location" | undefined;
|
|
362
|
+
declaredIn?: "all" | "administrativeArea" | "location" | undefined;
|
|
363
|
+
declaredBy?: "user" | undefined;
|
|
364
|
+
} | undefined;
|
|
340
365
|
} | {
|
|
341
|
-
type: "
|
|
342
|
-
options
|
|
343
|
-
|
|
344
|
-
|
|
366
|
+
type: "record.read" | "record.unassign-others" | "record.search" | "record.request-correction" | "record.correct";
|
|
367
|
+
options?: {
|
|
368
|
+
event?: string[] | undefined;
|
|
369
|
+
placeOfEvent?: "all" | "administrativeArea" | "location" | undefined;
|
|
370
|
+
declaredIn?: "all" | "administrativeArea" | "location" | undefined;
|
|
371
|
+
declaredBy?: "user" | undefined;
|
|
372
|
+
registeredIn?: "all" | "administrativeArea" | "location" | undefined;
|
|
373
|
+
registeredBy?: "user" | undefined;
|
|
374
|
+
} | undefined;
|
|
345
375
|
} | {
|
|
346
|
-
type: "
|
|
347
|
-
options
|
|
348
|
-
|
|
349
|
-
|
|
376
|
+
type: "record.custom-action";
|
|
377
|
+
options?: {
|
|
378
|
+
event?: string[] | undefined;
|
|
379
|
+
placeOfEvent?: "all" | "administrativeArea" | "location" | undefined;
|
|
380
|
+
declaredIn?: "all" | "administrativeArea" | "location" | undefined;
|
|
381
|
+
declaredBy?: "user" | undefined;
|
|
382
|
+
registeredIn?: "all" | "administrativeArea" | "location" | undefined;
|
|
383
|
+
registeredBy?: "user" | undefined;
|
|
384
|
+
customActionTypes?: string[] | undefined;
|
|
385
|
+
} | undefined;
|
|
350
386
|
} | {
|
|
351
|
-
type: "record.
|
|
352
|
-
options
|
|
353
|
-
event
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
387
|
+
type: "record.print-certified-copies";
|
|
388
|
+
options?: {
|
|
389
|
+
event?: string[] | undefined;
|
|
390
|
+
placeOfEvent?: "all" | "administrativeArea" | "location" | undefined;
|
|
391
|
+
declaredIn?: "all" | "administrativeArea" | "location" | undefined;
|
|
392
|
+
declaredBy?: "user" | undefined;
|
|
393
|
+
registeredIn?: "all" | "administrativeArea" | "location" | undefined;
|
|
394
|
+
registeredBy?: "user" | undefined;
|
|
395
|
+
templates?: string[] | undefined;
|
|
396
|
+
} | undefined;
|
|
358
397
|
} | undefined;
|
|
359
398
|
/**
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
* @
|
|
363
|
-
* @
|
|
364
|
-
*
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
*
|
|
399
|
+
* Function to get the value of a scope option (aka. scope attribute)
|
|
400
|
+
*
|
|
401
|
+
* @param scope - The scope to get the value of the option from.
|
|
402
|
+
* @param option - The option to get the value of.
|
|
403
|
+
* @returns The value of the scope option. Will return the default value if the option is not set.
|
|
404
|
+
*/
|
|
405
|
+
export declare function getScopeOptionValue<T extends ScopeOptionKey>(scope: RecordScopeV2, option: T): ScopeOptionsFull[T] | undefined;
|
|
406
|
+
/**
|
|
407
|
+
* Converts a V1 scope string to a V2 compatible scope string. Used to migrate between 1.9 and 2.0 scopes.
|
|
408
|
+
* @deprecated - This will be removed after migration to V2 scopes is complete. Do not use for new development.
|
|
409
|
+
*
|
|
410
|
+
* NOTE: We are casting intentionally broad with the input and output types to allow for flexibility during migration, without forcing loose types on the rest of the codebase.
|
|
411
|
+
*
|
|
412
|
+
* @param v1Scope e.g. 'record.declared.reject[event=birth|death|tennis-club-membership]',
|
|
413
|
+
* @returns corresponding V2 compatible scope string based on v1 input.
|
|
369
414
|
*/
|
|
370
|
-
export declare
|
|
415
|
+
export declare const v1ScopeToV2Scope: (v1Scope: string) => string;
|
|
416
|
+
export declare function getAcceptedScopesByType({ acceptedScopes, scopes }: {
|
|
417
|
+
acceptedScopes: RecordScopeTypeV2[];
|
|
418
|
+
scopes: string[];
|
|
419
|
+
}): RecordScopeV2[];
|
|
420
|
+
export declare function canUserCreateEvent(acceptedScopes: RecordScopeV2[], eventType: string): boolean;
|
|
371
421
|
/**
|
|
372
|
-
*
|
|
422
|
+
* Helper for defining scopes for user roles.
|
|
423
|
+
* @param scopes Array of scopes in object format.
|
|
373
424
|
*
|
|
374
|
-
* @
|
|
375
|
-
|
|
425
|
+
* @returns Array of scopes in string format, encoded for use in JWT tokens.
|
|
426
|
+
*/
|
|
427
|
+
export declare function defineScopes(scopes: RecordScopeV2[]): string[];
|
|
428
|
+
/**
|
|
429
|
+
* Helper for porting v1 scopes to v2. Intended to be used in the interim during migration, not for new development.
|
|
430
|
+
* @param scopes v1 scopes
|
|
431
|
+
* @returns array of v2 compatible scopes, filtering out the old ones not used anymore.
|
|
376
432
|
*/
|
|
377
|
-
export declare function
|
|
378
|
-
export declare const scopes: Scope[];
|
|
379
|
-
export type ParsedScopes = NonNullable<ReturnType<typeof parseConfigurableScope>>;
|
|
380
|
-
export type RawScopes = z.infer<typeof LiteralScopes> | (string & {});
|
|
381
|
-
export type Scope = RawScopes;
|
|
382
|
-
export declare const ActionScopes: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"record.declare-birth">, z.ZodLiteral<"record.declare-birth:my-jurisdiction">, z.ZodLiteral<"record.declare-death">, z.ZodLiteral<"record.declare-death:my-jurisdiction">, z.ZodLiteral<"record.declare-marriage">, z.ZodLiteral<"record.declare-marriage:my-jurisdiction">, z.ZodLiteral<"record.declaration-submit-incomplete">, z.ZodLiteral<"record.declaration-submit-for-review">]>, z.ZodUnion<[z.ZodLiteral<"record.declaration-submit-for-approval">, z.ZodLiteral<"record.declaration-submit-for-updates">, z.ZodLiteral<"record.declaration-edit">, z.ZodLiteral<"record.review-duplicates">, z.ZodLiteral<"record.declaration-archive">, z.ZodLiteral<"record.declaration-reinstate">]>, z.ZodLiteral<"record.register">, z.ZodLiteral<"record.registration-print&issue-certified-copies">, z.ZodUnion<[z.ZodLiteral<"record.registration-request-correction">, z.ZodLiteral<"record.registration-correct">, z.ZodLiteral<"record.confirm-registration">, z.ZodLiteral<"record.reject-registration">]>]>;
|
|
383
|
-
export type ActionScopes = z.infer<typeof ActionScopes>;
|
|
433
|
+
export declare function migrateV1ScopesToV2(scopes: string[]): string[];
|
|
384
434
|
export {};
|
|
385
435
|
//# sourceMappingURL=scopes.d.ts.map
|