@opencrvs/toolkit 1.8.0-rc.f7aaf07 → 1.8.0-rc.f7bcb31

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.
Files changed (41) hide show
  1. package/dist/commons/api/router.d.ts +447 -14391
  2. package/dist/commons/conditionals/conditionals.d.ts +6 -14
  3. package/dist/commons/conditionals/validate.d.ts +6 -10
  4. package/dist/commons/events/ActionConfig.d.ts +1726 -117415
  5. package/dist/commons/events/ActionDocument.d.ts +383 -2410
  6. package/dist/commons/events/ActionInput.d.ts +303 -1583
  7. package/dist/commons/events/ActionType.d.ts +0 -6
  8. package/dist/commons/events/AdvancedSearchConfig.d.ts +22 -1233
  9. package/dist/commons/events/CompositeFieldValue.d.ts +0 -31
  10. package/dist/commons/events/Draft.d.ts +29 -148
  11. package/dist/commons/events/EventConfig.d.ts +1362 -56509
  12. package/dist/commons/events/EventDocument.d.ts +264 -1508
  13. package/dist/commons/events/EventIndex.d.ts +25 -2026
  14. package/dist/commons/events/EventMetadata.d.ts +43 -332
  15. package/dist/commons/events/FieldConfig.d.ts +1059 -5476
  16. package/dist/commons/events/FieldType.d.ts +3 -6
  17. package/dist/commons/events/FieldTypeMapping.d.ts +54 -103
  18. package/dist/commons/events/FieldValue.d.ts +8 -49
  19. package/dist/commons/events/FormConfig.d.ts +524 -49166
  20. package/dist/commons/events/PageConfig.d.ts +208 -12210
  21. package/dist/commons/events/SummaryConfig.d.ts +42 -93
  22. package/dist/commons/events/User.d.ts +2 -31
  23. package/dist/commons/events/WorkqueueConfig.d.ts +20 -6290
  24. package/dist/commons/events/defineConfig.d.ts +75 -9018
  25. package/dist/commons/events/index.d.ts +0 -8
  26. package/dist/commons/events/test.utils.d.ts +78 -160
  27. package/dist/commons/events/utils.d.ts +68 -13361
  28. package/dist/conditionals/index.js +36 -76
  29. package/dist/events/index.js +1500 -4070
  30. package/dist/scopes/index.d.ts +6 -97
  31. package/dist/scopes/index.js +38 -109
  32. package/package.json +2 -3
  33. package/dist/commons/events/Constants.d.ts +0 -3
  34. package/dist/commons/events/CountryConfigQueryInput.d.ts +0 -3068
  35. package/dist/commons/events/CreatedAtLocation.d.ts +0 -3
  36. package/dist/commons/events/WorkqueueColumnConfig.d.ts +0 -53
  37. package/dist/commons/events/event.d.ts +0 -54
  38. package/dist/commons/events/field.d.ts +0 -82
  39. package/dist/commons/events/scopes.d.ts +0 -44
  40. package/dist/commons/events/serializer.d.ts +0 -2
  41. package/dist/commons/events/workqueueDefaultColumns.d.ts +0 -3
@@ -19,7 +19,6 @@ export declare const SCOPES: {
19
19
  * @TODO This is a temporary scope to be used for V2 Events custom events declaration
20
20
  */
21
21
  readonly RECORD_DECLARE: "record.declare-birth";
22
- readonly RECORD_IMPORT: "record.import";
23
22
  readonly RECORD_DECLARE_BIRTH: "record.declare-birth";
24
23
  readonly RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction";
25
24
  readonly RECORD_DECLARE_DEATH: "record.declare-death";
@@ -85,8 +84,7 @@ export declare const SCOPES: {
85
84
  readonly CONFIG_UPDATE_ALL: "config.update:all";
86
85
  readonly USER_DATA_SEEDING: "user.data-seeding";
87
86
  };
88
- export declare const SearchScopes: z.ZodUnion<[z.ZodLiteral<"search.birth:my-jurisdiction">, z.ZodLiteral<"search.birth">, z.ZodLiteral<"search.death:my-jurisdiction">, z.ZodLiteral<"search.death">, z.ZodLiteral<"search.marriage:my-jurisdiction">, z.ZodLiteral<"search.marriage">]>;
89
- declare const LiteralScopes: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"natlsysadmin">, z.ZodLiteral<"bypassratelimit">, z.ZodLiteral<"declare">, z.ZodLiteral<"register">, z.ZodLiteral<"validate">, z.ZodLiteral<"demo">, z.ZodLiteral<"certify">, z.ZodLiteral<"performance">, z.ZodLiteral<"sysadmin">, z.ZodLiteral<"teams">, z.ZodLiteral<"config">]>, z.ZodUnion<[z.ZodLiteral<"webhook">, z.ZodLiteral<"nationalId">, z.ZodLiteral<"notification-api">, z.ZodLiteral<"recordsearch">]>, z.ZodLiteral<"record.unassign-others">, z.ZodUnion<[z.ZodLiteral<"record.declare-birth">, z.ZodLiteral<"record.import">, 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.ZodUnion<[z.ZodLiteral<"record.export-records">, z.ZodLiteral<"record.declaration-print">, z.ZodLiteral<"record.declaration-print-supporting-documents">, z.ZodLiteral<"record.registration-print">, z.ZodLiteral<"record.registration-print&issue-certified-copies">, z.ZodLiteral<"record.registration-print-certified-copies">, z.ZodLiteral<"record.registration-bulk-print-certified-copies">, z.ZodLiteral<"record.registration-verify-certified-copies">]>, z.ZodUnion<[z.ZodLiteral<"record.registration-request-correction">, z.ZodLiteral<"record.registration-correct">, z.ZodLiteral<"record.registration-request-revocation">, z.ZodLiteral<"record.registration-revoke">, z.ZodLiteral<"record.registration-request-reinstatement">, z.ZodLiteral<"record.registration-reinstate">, z.ZodLiteral<"record.confirm-registration">, z.ZodLiteral<"record.reject-registration">]>, z.ZodUnion<[z.ZodLiteral<"search.birth:my-jurisdiction">, z.ZodLiteral<"search.birth">, z.ZodLiteral<"search.death:my-jurisdiction">, z.ZodLiteral<"search.death">, z.ZodLiteral<"search.marriage:my-jurisdiction">, z.ZodLiteral<"search.marriage">]>, z.ZodUnion<[z.ZodLiteral<"record.read">, z.ZodLiteral<"record.read-audit">, z.ZodLiteral<"record.read-comments">, z.ZodLiteral<"record.create-comments">]>, z.ZodUnion<[z.ZodLiteral<"profile.update">, z.ZodLiteral<"profile.electronic-signature">]>, z.ZodUnion<[z.ZodLiteral<"performance.read">, z.ZodLiteral<"performance.read-dashboards">, z.ZodLiteral<"performance.vital-statistics-export">]>, z.ZodUnion<[z.ZodLiteral<"organisation.read-locations:all">, z.ZodLiteral<"organisation.read-locations:my-office">, z.ZodLiteral<"organisation.read-locations:my-jurisdiction">]>, z.ZodUnion<[z.ZodLiteral<"user.read:all">, z.ZodLiteral<"user.read:my-office">, z.ZodLiteral<"user.read:my-jurisdiction">, z.ZodLiteral<"user.read:only-my-audit">, z.ZodLiteral<"user.create:all">, z.ZodLiteral<"user.create:my-jurisdiction">, z.ZodLiteral<"user.update:all">, z.ZodLiteral<"user.update:my-jurisdiction">]>, z.ZodLiteral<"config.update:all">, z.ZodLiteral<"user.data-seeding">]>;
87
+ declare const LiteralScopes: z.ZodUnion<[z.ZodLiteral<"natlsysadmin">, z.ZodLiteral<"bypassratelimit">, z.ZodLiteral<"declare">, z.ZodLiteral<"register">, z.ZodLiteral<"validate">, z.ZodLiteral<"demo">, z.ZodLiteral<"certify">, z.ZodLiteral<"performance">, z.ZodLiteral<"sysadmin">, z.ZodLiteral<"teams">, z.ZodLiteral<"config">, z.ZodLiteral<"webhook">, z.ZodLiteral<"nationalId">, z.ZodLiteral<"notification-api">, z.ZodLiteral<"recordsearch">, 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.ZodLiteral<"record.unassign-others">, 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.export-records">, z.ZodLiteral<"record.declaration-print">, z.ZodLiteral<"record.declaration-print-supporting-documents">, z.ZodLiteral<"record.registration-print">, z.ZodLiteral<"record.registration-print&issue-certified-copies">, z.ZodLiteral<"record.registration-print-certified-copies">, z.ZodLiteral<"record.registration-bulk-print-certified-copies">, z.ZodLiteral<"record.registration-verify-certified-copies">, z.ZodLiteral<"record.registration-request-correction">, z.ZodLiteral<"record.registration-correct">, z.ZodLiteral<"record.registration-request-revocation">, z.ZodLiteral<"record.registration-revoke">, z.ZodLiteral<"record.registration-request-reinstatement">, z.ZodLiteral<"record.registration-reinstate">, z.ZodLiteral<"record.confirm-registration">, z.ZodLiteral<"record.reject-registration">, z.ZodLiteral<"search.birth:my-jurisdiction">, z.ZodLiteral<"search.birth">, z.ZodLiteral<"search.death:my-jurisdiction">, z.ZodLiteral<"search.death">, z.ZodLiteral<"search.marriage:my-jurisdiction">, z.ZodLiteral<"search.marriage">, z.ZodLiteral<"record.read">, z.ZodLiteral<"record.read-audit">, z.ZodLiteral<"record.read-comments">, z.ZodLiteral<"record.create-comments">, z.ZodLiteral<"profile.update">, z.ZodLiteral<"profile.electronic-signature">, z.ZodLiteral<"performance.read">, z.ZodLiteral<"performance.read-dashboards">, z.ZodLiteral<"performance.vital-statistics-export">, z.ZodLiteral<"organisation.read-locations:all">, z.ZodLiteral<"organisation.read-locations:my-office">, z.ZodLiteral<"organisation.read-locations:my-jurisdiction">, z.ZodLiteral<"user.read:all">, z.ZodLiteral<"user.read:my-office">, z.ZodLiteral<"user.read:my-jurisdiction">, z.ZodLiteral<"user.read:only-my-audit">, z.ZodLiteral<"user.create:all">, z.ZodLiteral<"user.create:my-jurisdiction">, z.ZodLiteral<"user.update:all">, z.ZodLiteral<"user.update:my-jurisdiction">, z.ZodLiteral<"config.update:all">, z.ZodLiteral<"user.data-seeding">]>;
90
88
  declare const ConfigurableScopes: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
91
89
  type: z.ZodLiteral<"user.create">;
92
90
  options: z.ZodObject<{
@@ -125,84 +123,19 @@ declare const ConfigurableScopes: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
125
123
  options: {
126
124
  role: string[];
127
125
  };
128
- }>, z.ZodObject<{
129
- type: z.ZodLiteral<"workqueue">;
130
- options: z.ZodObject<{
131
- id: z.ZodArray<z.ZodString, "many">;
132
- }, "strip", z.ZodTypeAny, {
133
- id: string[];
134
- }, {
135
- id: string[];
136
- }>;
137
- }, "strip", z.ZodTypeAny, {
138
- type: "workqueue";
139
- options: {
140
- id: string[];
141
- };
142
- }, {
143
- type: "workqueue";
144
- options: {
145
- id: string[];
146
- };
147
- }>, z.ZodObject<{
148
- type: z.ZodLiteral<"record.notify">;
149
- options: z.ZodObject<{
150
- event: z.ZodArray<z.ZodString, "many">;
151
- }, "strip", z.ZodTypeAny, {
152
- event: string[];
153
- }, {
154
- event: string[];
155
- }>;
156
- }, "strip", z.ZodTypeAny, {
157
- type: "record.notify";
158
- options: {
159
- event: string[];
160
- };
161
- }, {
162
- type: "record.notify";
163
- options: {
164
- event: string[];
165
- };
166
126
  }>]>;
167
- export type ConfigurableScopeType = ConfigurableScopes['type'];
168
- export type ConfigurableScopes = z.infer<typeof ConfigurableScopes>;
169
- export declare function findScope<T extends ConfigurableScopeType>(scopes: string[], scopeType: T): Extract<{
127
+ type ConfigurableScopes = z.infer<typeof ConfigurableScopes>;
128
+ export declare function findScope(scopes: string[], scopeType: ConfigurableScopes['type']): {
170
129
  type: "user.create";
171
130
  options: {
172
131
  role: string[];
173
132
  };
174
- }, {
175
- type: T;
176
- }> | Extract<{
133
+ } | {
177
134
  type: "user.edit";
178
135
  options: {
179
136
  role: string[];
180
137
  };
181
- }, {
182
- type: T;
183
- }> | Extract<{
184
- type: "workqueue";
185
- options: {
186
- id: string[];
187
- };
188
- }, {
189
- type: T;
190
- }> | Extract<{
191
- type: "record.notify";
192
- options: {
193
- event: string[];
194
- };
195
- }, {
196
- type: T;
197
- }> | undefined;
198
- /**
199
- * Parses a configurable scope string into a ConfigurableScopes object.
200
- * @param {string} scope - The scope string to parse
201
- * @returns {ConfigurableScopes | undefined} The parsed scope object if valid, undefined otherwise
202
- * @example
203
- * parseScope("user.create[role=field-agent|registration-agent]")
204
- * // Returns: { type: "user.create", options: { role: ["field-agent", "registration-agent"] } }
205
- */
138
+ } | undefined;
206
139
  export declare function parseScope(scope: string): {
207
140
  type: "user.create";
208
141
  options: {
@@ -214,35 +147,11 @@ export declare function parseScope(scope: string): {
214
147
  role: string[];
215
148
  };
216
149
  } | {
217
- type: "workqueue";
218
- options: {
219
- id: string[];
220
- };
221
- } | {
222
- type: "record.notify";
223
- options: {
224
- event: string[];
225
- };
226
- } | {
227
- type: "natlsysadmin" | "bypassratelimit" | "declare" | "register" | "validate" | "demo" | "certify" | "performance" | "sysadmin" | "teams" | "config" | "webhook" | "nationalId" | "notification-api" | "recordsearch" | "record.declare-birth" | "record.import" | "record.declare-birth:my-jurisdiction" | "record.declare-death" | "record.declare-death:my-jurisdiction" | "record.declare-marriage" | "record.declare-marriage:my-jurisdiction" | "record.declaration-submit-incomplete" | "record.declaration-submit-for-review" | "record.unassign-others" | "record.declaration-submit-for-approval" | "record.declaration-submit-for-updates" | "record.declaration-edit" | "record.review-duplicates" | "record.declaration-archive" | "record.declaration-reinstate" | "record.register" | "record.export-records" | "record.declaration-print" | "record.declaration-print-supporting-documents" | "record.registration-print" | "record.registration-print&issue-certified-copies" | "record.registration-print-certified-copies" | "record.registration-bulk-print-certified-copies" | "record.registration-verify-certified-copies" | "record.registration-request-correction" | "record.registration-correct" | "record.registration-request-revocation" | "record.registration-revoke" | "record.registration-request-reinstatement" | "record.registration-reinstate" | "record.confirm-registration" | "record.reject-registration" | "search.birth:my-jurisdiction" | "search.birth" | "search.death:my-jurisdiction" | "search.death" | "search.marriage:my-jurisdiction" | "search.marriage" | "record.read" | "record.read-audit" | "record.read-comments" | "record.create-comments" | "profile.update" | "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";
150
+ type: "natlsysadmin" | "bypassratelimit" | "declare" | "register" | "validate" | "demo" | "certify" | "performance" | "sysadmin" | "teams" | "config" | "webhook" | "nationalId" | "notification-api" | "recordsearch" | "record.declare-birth" | "record.declare-birth:my-jurisdiction" | "record.declare-death" | "record.declare-death:my-jurisdiction" | "record.declare-marriage" | "record.declare-marriage:my-jurisdiction" | "record.declaration-submit-incomplete" | "record.declaration-submit-for-review" | "record.unassign-others" | "record.declaration-submit-for-approval" | "record.declaration-submit-for-updates" | "record.declaration-edit" | "record.review-duplicates" | "record.declaration-archive" | "record.declaration-reinstate" | "record.register" | "record.export-records" | "record.declaration-print" | "record.declaration-print-supporting-documents" | "record.registration-print" | "record.registration-print&issue-certified-copies" | "record.registration-print-certified-copies" | "record.registration-bulk-print-certified-copies" | "record.registration-verify-certified-copies" | "record.registration-request-correction" | "record.registration-correct" | "record.registration-request-revocation" | "record.registration-revoke" | "record.registration-request-reinstatement" | "record.registration-reinstate" | "record.confirm-registration" | "record.reject-registration" | "search.birth:my-jurisdiction" | "search.birth" | "search.death:my-jurisdiction" | "search.death" | "search.marriage:my-jurisdiction" | "search.marriage" | "record.read" | "record.read-audit" | "record.read-comments" | "record.create-comments" | "profile.update" | "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";
228
151
  } | undefined;
229
- /**
230
- * Stringifies a ConfigurableScopes object into a scope string.
231
- * @param {ConfigurableScopes} scope - The scope object to stringify
232
- * @returns {string} The stringified scope in format "type[key1=value1|value2,key2=value3|value4]"
233
- * @example
234
- * stringifyScope({
235
- * type: "record.notify",
236
- * options: { event: ["v2.birth", "tennis-club-membership"] }
237
- * })
238
- * // Returns: "record.notify[event=v2.birth|tennis-club-membership]"
239
- */
240
- export declare function stringifyScope(scope: ConfigurableScopes): string;
241
152
  export declare const scopes: Scope[];
242
153
  export type ParsedScopes = NonNullable<ReturnType<typeof parseScope>>;
243
154
  export type RawScopes = z.infer<typeof LiteralScopes> | (string & {});
244
155
  export type Scope = RawScopes;
245
- export declare const ActionScopes: z.ZodUnion<[z.ZodUnion<[z.ZodLiteral<"record.declare-birth">, z.ZodLiteral<"record.import">, 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.ZodUnion<[z.ZodLiteral<"record.export-records">, z.ZodLiteral<"record.declaration-print">, z.ZodLiteral<"record.declaration-print-supporting-documents">, z.ZodLiteral<"record.registration-print">, z.ZodLiteral<"record.registration-print&issue-certified-copies">, z.ZodLiteral<"record.registration-print-certified-copies">, z.ZodLiteral<"record.registration-bulk-print-certified-copies">, z.ZodLiteral<"record.registration-verify-certified-copies">]>, z.ZodUnion<[z.ZodLiteral<"record.registration-request-correction">, z.ZodLiteral<"record.registration-correct">, z.ZodLiteral<"record.registration-request-revocation">, z.ZodLiteral<"record.registration-revoke">, z.ZodLiteral<"record.registration-request-reinstatement">, z.ZodLiteral<"record.registration-reinstate">, z.ZodLiteral<"record.confirm-registration">, z.ZodLiteral<"record.reject-registration">]>]>;
246
- export type ActionScopes = z.infer<typeof ActionScopes>;
247
156
  export {};
248
157
  //# sourceMappingURL=scopes.d.ts.map
@@ -20,13 +20,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/scopes/index.ts
21
21
  var scopes_exports = {};
22
22
  __export(scopes_exports, {
23
- ActionScopes: () => ActionScopes,
24
23
  SCOPES: () => SCOPES,
25
- SearchScopes: () => SearchScopes,
26
24
  findScope: () => findScope,
27
25
  parseScope: () => parseScope,
28
- scopes: () => scopes,
29
- stringifyScope: () => stringifyScope
26
+ scopes: () => scopes
30
27
  });
31
28
  module.exports = __toCommonJS(scopes_exports);
32
29
 
@@ -55,8 +52,6 @@ var SCOPES = {
55
52
  */
56
53
  RECORD_DECLARE: "record.declare-birth",
57
54
  // declare
58
- RECORD_IMPORT: "record.import",
59
- // declare
60
55
  RECORD_DECLARE_BIRTH: "record.declare-birth",
61
56
  RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
62
57
  RECORD_DECLARE_DEATH: "record.declare-death",
@@ -144,7 +139,7 @@ var SCOPES = {
144
139
  // data seeding
145
140
  USER_DATA_SEEDING: "user.data-seeding"
146
141
  };
147
- var LegacyScopes = import_zod.z.union([
142
+ var LiteralScopes = import_zod.z.union([
148
143
  import_zod.z.literal(SCOPES.NATLSYSADMIN),
149
144
  import_zod.z.literal(SCOPES.BYPASSRATELIMIT),
150
145
  import_zod.z.literal(SCOPES.DECLARE),
@@ -155,17 +150,11 @@ var LegacyScopes = import_zod.z.union([
155
150
  import_zod.z.literal(SCOPES.PERFORMANCE),
156
151
  import_zod.z.literal(SCOPES.SYSADMIN),
157
152
  import_zod.z.literal(SCOPES.TEAMS),
158
- import_zod.z.literal(SCOPES.CONFIG)
159
- ]);
160
- var IntegrationScopes = import_zod.z.union([
153
+ import_zod.z.literal(SCOPES.CONFIG),
161
154
  import_zod.z.literal(SCOPES.WEBHOOK),
162
155
  import_zod.z.literal(SCOPES.NATIONALID),
163
156
  import_zod.z.literal(SCOPES.NOTIFICATION_API),
164
- import_zod.z.literal(SCOPES.RECORDSEARCH)
165
- ]);
166
- var DeclareScopes = import_zod.z.union([
167
- import_zod.z.literal(SCOPES.RECORD_DECLARE),
168
- import_zod.z.literal(SCOPES.RECORD_IMPORT),
157
+ import_zod.z.literal(SCOPES.RECORDSEARCH),
169
158
  import_zod.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
170
159
  import_zod.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
171
160
  import_zod.z.literal(SCOPES.RECORD_DECLARE_DEATH),
@@ -173,19 +162,15 @@ var DeclareScopes = import_zod.z.union([
173
162
  import_zod.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
174
163
  import_zod.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
175
164
  import_zod.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
176
- import_zod.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW)
177
- ]);
178
- var UnassignScope = import_zod.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS);
179
- var ValidateScopes = import_zod.z.union([
165
+ import_zod.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW),
166
+ import_zod.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS),
180
167
  import_zod.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
181
168
  import_zod.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
182
169
  import_zod.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
183
170
  import_zod.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
184
171
  import_zod.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
185
- import_zod.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE)
186
- ]);
187
- var RegisterScope = import_zod.z.literal(SCOPES.RECORD_REGISTER);
188
- var CertifyScopes = import_zod.z.union([
172
+ import_zod.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE),
173
+ import_zod.z.literal(SCOPES.RECORD_REGISTER),
189
174
  import_zod.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
190
175
  import_zod.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
191
176
  import_zod.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
@@ -193,9 +178,7 @@ var CertifyScopes = import_zod.z.union([
193
178
  import_zod.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
194
179
  import_zod.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
195
180
  import_zod.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
196
- import_zod.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES)
197
- ]);
198
- var CorrectionScopes = import_zod.z.union([
181
+ import_zod.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES),
199
182
  import_zod.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
200
183
  import_zod.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
201
184
  import_zod.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
@@ -203,37 +186,25 @@ var CorrectionScopes = import_zod.z.union([
203
186
  import_zod.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
204
187
  import_zod.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
205
188
  import_zod.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
206
- import_zod.z.literal(SCOPES.RECORD_REJECT_REGISTRATION)
207
- ]);
208
- var SearchScopes = import_zod.z.union([
189
+ import_zod.z.literal(SCOPES.RECORD_REJECT_REGISTRATION),
209
190
  import_zod.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
210
191
  import_zod.z.literal(SCOPES.SEARCH_BIRTH),
211
192
  import_zod.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
212
193
  import_zod.z.literal(SCOPES.SEARCH_DEATH),
213
194
  import_zod.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
214
- import_zod.z.literal(SCOPES.SEARCH_MARRIAGE)
215
- ]);
216
- var AuditScopes = import_zod.z.union([
195
+ import_zod.z.literal(SCOPES.SEARCH_MARRIAGE),
217
196
  import_zod.z.literal(SCOPES.RECORD_READ),
218
197
  import_zod.z.literal(SCOPES.RECORD_READ_AUDIT),
219
198
  import_zod.z.literal(SCOPES.RECORD_READ_COMMENTS),
220
- import_zod.z.literal(SCOPES.RECORD_CREATE_COMMENTS)
221
- ]);
222
- var ProfileScopes = import_zod.z.union([
199
+ import_zod.z.literal(SCOPES.RECORD_CREATE_COMMENTS),
223
200
  import_zod.z.literal(SCOPES.PROFILE_UPDATE),
224
- import_zod.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE)
225
- ]);
226
- var PerformanceScopes = import_zod.z.union([
201
+ import_zod.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
227
202
  import_zod.z.literal(SCOPES.PERFORMANCE_READ),
228
203
  import_zod.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
229
- import_zod.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS)
230
- ]);
231
- var OrganisationScopes = import_zod.z.union([
204
+ import_zod.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS),
232
205
  import_zod.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
233
206
  import_zod.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
234
- import_zod.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION)
235
- ]);
236
- var UserScopes = import_zod.z.union([
207
+ import_zod.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION),
237
208
  import_zod.z.literal(SCOPES.USER_READ),
238
209
  import_zod.z.literal(SCOPES.USER_READ_MY_OFFICE),
239
210
  import_zod.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
@@ -241,29 +212,11 @@ var UserScopes = import_zod.z.union([
241
212
  import_zod.z.literal(SCOPES.USER_CREATE),
242
213
  import_zod.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
243
214
  import_zod.z.literal(SCOPES.USER_UPDATE),
244
- import_zod.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION)
245
- ]);
246
- var ConfigScope = import_zod.z.literal(SCOPES.CONFIG_UPDATE_ALL);
247
- var DataSeedingScope = import_zod.z.literal(SCOPES.USER_DATA_SEEDING);
248
- var LiteralScopes = import_zod.z.union([
249
- LegacyScopes,
250
- IntegrationScopes,
251
- UnassignScope,
252
- DeclareScopes,
253
- ValidateScopes,
254
- RegisterScope,
255
- CertifyScopes,
256
- CorrectionScopes,
257
- SearchScopes,
258
- AuditScopes,
259
- ProfileScopes,
260
- PerformanceScopes,
261
- OrganisationScopes,
262
- UserScopes,
263
- ConfigScope,
264
- DataSeedingScope
215
+ import_zod.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION),
216
+ import_zod.z.literal(SCOPES.CONFIG_UPDATE_ALL),
217
+ import_zod.z.literal(SCOPES.USER_DATA_SEEDING)
265
218
  ]);
266
- var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
219
+ var rawConfigurableScopeRegex = /^([a-zA-Z]+\.[a-zA-Z]+)\[((?:\w+=\w+(?:\|\w+)*)(:?,\w+=\w+(?:\|\w+)*)*)\]$/;
267
220
  var rawConfigurableScope = import_zod.z.string().regex(rawConfigurableScopeRegex);
268
221
  var CreateUserScope = import_zod.z.object({
269
222
  type: import_zod.z.literal("user.create"),
@@ -277,27 +230,12 @@ var EditUserScope = import_zod.z.object({
277
230
  role: import_zod.z.array(import_zod.z.string())
278
231
  })
279
232
  });
280
- var WorkqueueScope = import_zod.z.object({
281
- type: import_zod.z.literal("workqueue"),
282
- options: import_zod.z.object({
283
- id: import_zod.z.array(import_zod.z.string())
284
- })
285
- });
286
- var NotifyRecordScope = import_zod.z.object({
287
- type: import_zod.z.literal("record.notify"),
288
- options: import_zod.z.object({
289
- event: import_zod.z.array(import_zod.z.string())
290
- })
291
- });
292
233
  var ConfigurableScopes = import_zod.z.discriminatedUnion("type", [
293
234
  CreateUserScope,
294
- EditUserScope,
295
- WorkqueueScope,
296
- NotifyRecordScope
235
+ EditUserScope
297
236
  ]);
298
237
  function findScope(scopes2, scopeType) {
299
- const parsedScopes = scopes2.map((rawScope) => parseScope(rawScope));
300
- return parsedScopes.find(
238
+ return scopes2.map((rawScope) => parseScope(rawScope)).find(
301
239
  (parsedScope) => parsedScope?.type === scopeType
302
240
  );
303
241
  }
@@ -309,32 +247,23 @@ function parseScope(scope) {
309
247
  };
310
248
  }
311
249
  const maybeConfigurableScope = rawConfigurableScope.safeParse(scope);
312
- if (!maybeConfigurableScope.success) {
313
- return;
250
+ if (maybeConfigurableScope.success) {
251
+ const rawScope = maybeConfigurableScope.data;
252
+ const [, type, rawOptions] = rawScope.match(rawConfigurableScopeRegex) ?? [];
253
+ const options = rawOptions.split(",").reduce((acc, option) => {
254
+ const [key, value] = option.split("=");
255
+ acc[key] = value.split("|");
256
+ return acc;
257
+ }, {});
258
+ const parsedScope = {
259
+ type,
260
+ options
261
+ };
262
+ const result = ConfigurableScopes.safeParse(parsedScope);
263
+ if (result.success) {
264
+ return result.data;
265
+ }
314
266
  }
315
- const rawScope = maybeConfigurableScope.data;
316
- const [, type, rawOptions] = rawScope.match(rawConfigurableScopeRegex) ?? [];
317
- const options = rawOptions.split(",").reduce((acc, option) => {
318
- const [key, value] = option.split("=");
319
- acc[key] = value.split("|");
320
- return acc;
321
- }, {});
322
- const parsedScope = {
323
- type,
324
- options
325
- };
326
- const result = ConfigurableScopes.safeParse(parsedScope);
327
- return result.success ? result.data : void 0;
328
- }
329
- function stringifyScope(scope) {
330
- const options = Object.entries(scope.options).map(([key, value]) => `${key}=${value.join("|")}`).join(",");
331
- return `${scope.type}[${options}]`;
267
+ return void 0;
332
268
  }
333
269
  var scopes = Object.values(SCOPES);
334
- var ActionScopes = import_zod.z.union([
335
- DeclareScopes,
336
- ValidateScopes,
337
- RegisterScope,
338
- CertifyScopes,
339
- CorrectionScopes
340
- ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "1.8.0-rc.f7aaf07",
3
+ "version": "1.8.0-rc.f7bcb31",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "exports": {
@@ -20,8 +20,7 @@
20
20
  "ajv-formats": "^3.0.1",
21
21
  "superjson": "1.9.0-0",
22
22
  "@trpc/client": "^11.0.0-rc.648",
23
- "@trpc/server": "^11.0.0-rc.532",
24
- "zod-openapi": "^4.2.4"
23
+ "@trpc/server": "^11.0.0-rc.532"
25
24
  },
26
25
  "devDependencies": {
27
26
  "@types/uuid": "^9.0.3",
@@ -1,3 +0,0 @@
1
- export declare const TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
2
- export declare const BIRTH_EVENT = "v2-birth";
3
- //# sourceMappingURL=Constants.d.ts.map