@opencrvs/toolkit 2.0.0-rc.d87f90c → 2.0.0-rc.d9d584a

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.
@@ -0,0 +1,73 @@
1
+ #!/usr/bin/env node
2
+
3
+ /*
4
+ * This Source Code Form is subject to the terms of the Mozilla Public
5
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
6
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/.
7
+ *
8
+ * OpenCRVS is also distributed under the terms of the Civil Registration
9
+ * & Healthcare Disclaimer located at http://opencrvs.org/license.
10
+ *
11
+ * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
12
+ */
13
+
14
+ const { execSync } = require('child_process')
15
+ const path = require('path')
16
+ const fs = require('fs')
17
+
18
+ const REPO_URL = 'https://github.com/opencrvs/opencrvs-countryconfig.git'
19
+
20
+ const projectName = process.argv[2]
21
+
22
+ if (!projectName) {
23
+ console.error(
24
+ 'Please specify a project name:\n\n npm create @opencrvs/countryconfig <project-name>\n'
25
+ )
26
+ process.exit(1)
27
+ }
28
+
29
+ const targetDir = path.resolve(process.cwd(), projectName)
30
+
31
+ if (fs.existsSync(targetDir)) {
32
+ console.error(`Error: Directory "${projectName}" already exists.`)
33
+ process.exit(1)
34
+ }
35
+
36
+ console.log(`\nScaffolding OpenCRVS country config in ./${projectName}...\n`)
37
+
38
+ try {
39
+ execSync(`git clone --depth 1 ${REPO_URL} ${projectName}`, {
40
+ stdio: 'inherit'
41
+ })
42
+ } catch (err) {
43
+ console.error('Failed to clone the repository:', err.message)
44
+ process.exit(1)
45
+ }
46
+
47
+ try {
48
+ fs.rmSync(path.join(targetDir, '.git'), { recursive: true, force: true })
49
+ } catch (err) {
50
+ console.error('Failed to remove .git directory:', err.message)
51
+ process.exit(1)
52
+ }
53
+
54
+ const pkgPath = path.join(targetDir, 'package.json')
55
+ if (fs.existsSync(pkgPath)) {
56
+ try {
57
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
58
+ pkg.name = projectName
59
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
60
+ } catch (err) {
61
+ console.error('Failed to update package.json:', err.message)
62
+ process.exit(1)
63
+ }
64
+ } else {
65
+ console.warn(
66
+ `Warning: No package.json found in the cloned repository. Project name was not updated.`
67
+ )
68
+ }
69
+
70
+ console.log(`\nDone! To get started:\n`)
71
+ console.log(` cd ${projectName}`)
72
+ console.log(` git init`)
73
+ console.log(` npm install\n`)
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "@opencrvs/create-countryconfig",
3
+ "version": "1.0.0",
4
+ "description": "Scaffold a new OpenCRVS country configuration",
5
+ "bin": {
6
+ "create-countryconfig": "./index.js"
7
+ },
8
+ "files": ["index.js"],
9
+ "keywords": ["opencrvs", "countryconfig", "create"],
10
+ "license": "MPL-2.0"
11
+ }
@@ -418,28 +418,20 @@ function schemaPriority(schema) {
418
418
  return idx === -1 ? 9999 : idx;
419
419
  }
420
420
  function safeUnion(schemas) {
421
+ const sortedSchemas = [...schemas].sort(
422
+ (a, b) => schemaPriority(a) - schemaPriority(b)
423
+ );
421
424
  return z7.any().superRefine((val, ctx) => {
422
- const successful = schemas.filter((s) => s.safeParse(val).success);
423
- if (successful.length === 1) {
424
- return;
425
- }
426
- if (successful.length === 0) {
427
- ctx.addIssue({
428
- code: "invalid_type",
429
- expected: "custom",
430
- message: "Value does not match any schema"
431
- });
432
- return;
433
- }
434
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
435
- const best = successful[0];
436
- if (!best.safeParse(val).success) {
437
- ctx.addIssue({
438
- expected: "custom",
439
- code: "invalid_type",
440
- message: "Value did not match the best schema"
441
- });
425
+ for (const schema of sortedSchemas) {
426
+ if (schema.safeParse(val).success) {
427
+ return;
428
+ }
442
429
  }
430
+ ctx.addIssue({
431
+ code: "invalid_type",
432
+ expected: "custom",
433
+ message: "Value does not match any schema"
434
+ });
443
435
  }).meta({
444
436
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
445
437
  });
@@ -772,12 +764,14 @@ var SystemScopeType = z11.enum([
772
764
  "organisation.read-locations",
773
765
  "user.read",
774
766
  "user.create",
775
- "user.edit"
767
+ "user.edit",
768
+ "user.search"
776
769
  ]);
777
770
  var UserScopeType = SystemScopeType.extract([
778
771
  "user.read",
779
772
  "user.create",
780
- "user.edit"
773
+ "user.edit",
774
+ "user.search"
781
775
  ]);
782
776
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
783
777
  var UserScopeV2 = z11.discriminatedUnion("type", [
@@ -786,7 +780,7 @@ var UserScopeV2 = z11.discriminatedUnion("type", [
786
780
  options: AllUserScopeOptions.optional()
787
781
  }),
788
782
  z11.object({
789
- type: UserScopeType.extract(["user.read"]),
783
+ type: UserScopeType.extract(["user.read", "user.search"]),
790
784
  options: AccessLevelOptions.optional()
791
785
  })
792
786
  ]);
package/dist/cli.js CHANGED
@@ -2296,12 +2296,14 @@ var SystemScopeType = z3.enum([
2296
2296
  "organisation.read-locations",
2297
2297
  "user.read",
2298
2298
  "user.create",
2299
- "user.edit"
2299
+ "user.edit",
2300
+ "user.search"
2300
2301
  ]);
2301
2302
  var UserScopeType = SystemScopeType.extract([
2302
2303
  "user.read",
2303
2304
  "user.create",
2304
- "user.edit"
2305
+ "user.edit",
2306
+ "user.search"
2305
2307
  ]);
2306
2308
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
2307
2309
  var UserScopeV2 = z3.discriminatedUnion("type", [
@@ -2310,7 +2312,7 @@ var UserScopeV2 = z3.discriminatedUnion("type", [
2310
2312
  options: AllUserScopeOptions.optional()
2311
2313
  }),
2312
2314
  z3.object({
2313
- type: UserScopeType.extract(["user.read"]),
2315
+ type: UserScopeType.extract(["user.read", "user.search"]),
2314
2316
  options: AccessLevelOptions.optional()
2315
2317
  })
2316
2318
  ]);
@@ -1105,6 +1105,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1105
1105
  annotation?: Record<string, unknown> | undefined;
1106
1106
  originalActionId?: string | undefined;
1107
1107
  keepAssignment?: boolean | undefined;
1108
+ waitFor?: boolean | undefined;
1108
1109
  createdAtLocation?: string | null | undefined;
1109
1110
  };
1110
1111
  output: {
@@ -1225,6 +1226,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1225
1226
  annotation?: Record<string, unknown> | undefined;
1226
1227
  originalActionId?: string | undefined;
1227
1228
  keepAssignment?: boolean | undefined;
1229
+ waitFor?: boolean | undefined;
1228
1230
  createdAtLocation?: string | null | undefined;
1229
1231
  type?: "DECLARE" | undefined;
1230
1232
  };
@@ -1799,6 +1801,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1799
1801
  annotation?: Record<string, unknown> | undefined;
1800
1802
  originalActionId?: string | undefined;
1801
1803
  keepAssignment?: boolean | undefined;
1804
+ waitFor?: boolean | undefined;
1802
1805
  createdAtLocation?: string | null | undefined;
1803
1806
  type?: "CUSTOM" | undefined;
1804
1807
  };
@@ -2154,6 +2157,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2154
2157
  annotation?: Record<string, unknown> | undefined;
2155
2158
  originalActionId?: string | undefined;
2156
2159
  keepAssignment?: boolean | undefined;
2160
+ waitFor?: boolean | undefined;
2157
2161
  createdAtLocation?: string | null | undefined;
2158
2162
  };
2159
2163
  output: {
@@ -2467,6 +2471,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2467
2471
  annotation?: Record<string, unknown> | undefined;
2468
2472
  originalActionId?: string | undefined;
2469
2473
  keepAssignment?: boolean | undefined;
2474
+ waitFor?: boolean | undefined;
2470
2475
  createdAtLocation?: string | null | undefined;
2471
2476
  type?: "UNASSIGN" | undefined;
2472
2477
  assignedTo?: null | undefined;
@@ -2960,6 +2965,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2960
2965
  annotation?: Record<string, unknown> | undefined;
2961
2966
  originalActionId?: string | undefined;
2962
2967
  keepAssignment?: boolean | undefined;
2968
+ waitFor?: boolean | undefined;
2963
2969
  createdAtLocation?: string | null | undefined;
2964
2970
  type?: "MARK_AS_DUPLICATE" | undefined;
2965
2971
  content?: {
@@ -3277,6 +3283,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
3277
3283
  annotation?: Record<string, unknown> | undefined;
3278
3284
  originalActionId?: string | undefined;
3279
3285
  keepAssignment?: boolean | undefined;
3286
+ waitFor?: boolean | undefined;
3280
3287
  createdAtLocation?: string | null | undefined;
3281
3288
  type?: "MARK_AS_NOT_DUPLICATE" | undefined;
3282
3289
  };
@@ -4774,7 +4781,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4774
4781
  'legalStatuses.DECLARED.createdAtLocation'?: {
4775
4782
  type: "within";
4776
4783
  location: string | {
4777
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4784
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4778
4785
  $location?: string | undefined;
4779
4786
  };
4780
4787
  } | undefined;
@@ -4796,7 +4803,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4796
4803
  'legalStatuses.REGISTERED.createdAtLocation'?: {
4797
4804
  type: "within";
4798
4805
  location: string | {
4799
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4806
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4800
4807
  $location?: string | undefined;
4801
4808
  };
4802
4809
  } | undefined;
@@ -4811,47 +4818,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4811
4818
  createdAtLocation?: {
4812
4819
  type: "within";
4813
4820
  location: string | {
4814
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4821
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4815
4822
  $location?: string | undefined;
4816
4823
  };
4817
4824
  } | {
4818
4825
  type: "exact";
4819
4826
  term: string | {
4820
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4827
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4821
4828
  $location?: string | undefined;
4822
4829
  };
4823
4830
  } | undefined;
4824
4831
  updatedAtLocation?: {
4825
4832
  type: "within";
4826
4833
  location: string | {
4827
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4834
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4828
4835
  $location?: string | undefined;
4829
4836
  };
4830
4837
  } | {
4831
4838
  type: "exact";
4832
4839
  term: string | {
4833
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4840
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4834
4841
  $location?: string | undefined;
4835
4842
  };
4836
4843
  } | undefined;
4837
4844
  updatedByUserRole?: {
4838
4845
  type: "exact";
4839
4846
  term: string | {
4840
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4847
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4841
4848
  $location?: string | undefined;
4842
4849
  };
4843
4850
  } | undefined;
4844
4851
  assignedTo?: {
4845
4852
  type: "exact";
4846
4853
  term: string | {
4847
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4854
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4848
4855
  $location?: string | undefined;
4849
4856
  };
4850
4857
  } | undefined;
4851
4858
  createdBy?: {
4852
4859
  type: "exact";
4853
4860
  term: string | {
4854
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4861
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4855
4862
  $location?: string | undefined;
4856
4863
  };
4857
4864
  } | undefined;
@@ -4862,7 +4869,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4862
4869
  updatedBy?: {
4863
4870
  type: "exact";
4864
4871
  term: string | {
4865
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4872
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4866
4873
  $location?: string | undefined;
4867
4874
  };
4868
4875
  } | undefined;
@@ -4912,7 +4919,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4912
4919
  'legalStatuses.DECLARED.createdAtLocation'?: {
4913
4920
  type: "within";
4914
4921
  location: string | {
4915
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4922
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4916
4923
  $location?: string | undefined;
4917
4924
  };
4918
4925
  } | undefined;
@@ -4934,7 +4941,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4934
4941
  'legalStatuses.REGISTERED.createdAtLocation'?: {
4935
4942
  type: "within";
4936
4943
  location: string | {
4937
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4944
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4938
4945
  $location?: string | undefined;
4939
4946
  };
4940
4947
  } | undefined;
@@ -4949,47 +4956,47 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4949
4956
  createdAtLocation?: {
4950
4957
  type: "within";
4951
4958
  location: string | {
4952
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4959
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4953
4960
  $location?: string | undefined;
4954
4961
  };
4955
4962
  } | {
4956
4963
  type: "exact";
4957
4964
  term: string | {
4958
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4965
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4959
4966
  $location?: string | undefined;
4960
4967
  };
4961
4968
  } | undefined;
4962
4969
  updatedAtLocation?: {
4963
4970
  type: "within";
4964
4971
  location: string | {
4965
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4972
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4966
4973
  $location?: string | undefined;
4967
4974
  };
4968
4975
  } | {
4969
4976
  type: "exact";
4970
4977
  term: string | {
4971
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4978
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4972
4979
  $location?: string | undefined;
4973
4980
  };
4974
4981
  } | undefined;
4975
4982
  updatedByUserRole?: {
4976
4983
  type: "exact";
4977
4984
  term: string | {
4978
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4985
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4979
4986
  $location?: string | undefined;
4980
4987
  };
4981
4988
  } | undefined;
4982
4989
  assignedTo?: {
4983
4990
  type: "exact";
4984
4991
  term: string | {
4985
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4992
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4986
4993
  $location?: string | undefined;
4987
4994
  };
4988
4995
  } | undefined;
4989
4996
  createdBy?: {
4990
4997
  type: "exact";
4991
4998
  term: string | {
4992
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
4999
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
4993
5000
  $location?: string | undefined;
4994
5001
  };
4995
5002
  } | undefined;
@@ -5000,7 +5007,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
5000
5007
  updatedBy?: {
5001
5008
  type: "exact";
5002
5009
  term: string | {
5003
- $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "middlename" | "signature" | "avatar" | "primaryOfficeId";
5010
+ $userField: "id" | "name" | "administrativeAreaId" | "firstname" | "surname" | "fullHonorificName" | "role" | "device" | "primaryOfficeId" | "middlename" | "signature" | "avatar";
5004
5011
  $location?: string | undefined;
5005
5012
  };
5006
5013
  } | undefined;
@@ -86,16 +86,16 @@ export declare const user: typeof userSerializer & {
86
86
  };
87
87
  scope: (scope: import("../scopes").ScopeType) => {
88
88
  attribute: (option: import("../scopes").ScopeOptionKey) => {
89
- $scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
89
+ $scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
90
90
  $option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
91
91
  };
92
92
  };
93
93
  jurisdiction: (jurisdiction: import("../scopes").JurisdictionFilter | {
94
- $scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
94
+ $scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
95
95
  $option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
96
96
  }) => {
97
97
  $jurisdiction: "administrativeArea" | "location" | "all" | {
98
- $scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "workqueue" | "dashboard.view";
98
+ $scope: "record.search" | "record.create" | "record.read" | "record.declare" | "record.notify" | "record.edit" | "record.reject" | "record.archive" | "record.review-duplicates" | "record.register" | "record.print-certified-copies" | "record.request-correction" | "record.correct" | "record.unassign-others" | "record.custom-action" | "bypassratelimit" | "record.reindex" | "user.data-seeding" | "integration.create" | "record.import" | "config.update-all" | "attachment.upload" | "profile.electronic-signature" | "user.read-only-my-audit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "record.confirm-registration" | "record.reject-registration" | "organisation.read-locations" | "user.read" | "user.create" | "user.edit" | "user.search" | "workqueue" | "dashboard.view";
99
99
  $option: "role" | "event" | "placeOfEvent" | "declaredIn" | "declaredBy" | "registeredIn" | "registeredBy" | "accessLevel" | "ids";
100
100
  };
101
101
  };
@@ -6,6 +6,7 @@ export declare const BaseActionInput: z.ZodObject<{
6
6
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
7
7
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
8
8
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
9
+ waitFor: z.ZodOptional<z.ZodBoolean>;
9
10
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
10
11
  }, z.core.$strip>;
11
12
  export declare const RegisterActionInput: z.ZodObject<{
@@ -15,6 +16,7 @@ export declare const RegisterActionInput: z.ZodObject<{
15
16
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
16
17
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
17
18
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
19
+ waitFor: z.ZodOptional<z.ZodBoolean>;
18
20
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
19
21
  type: z.ZodDefault<z.ZodLiteral<"REGISTER">>;
20
22
  registrationNumber: z.ZodOptional<z.ZodString>;
@@ -27,6 +29,7 @@ export declare const NotifyActionInput: z.ZodObject<{
27
29
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
28
30
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
29
31
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
32
+ waitFor: z.ZodOptional<z.ZodBoolean>;
30
33
  type: z.ZodDefault<z.ZodLiteral<"NOTIFY">>;
31
34
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
32
35
  }, z.core.$strip>;
@@ -38,6 +41,7 @@ export declare const DeclareActionInput: z.ZodObject<{
38
41
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
39
42
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
40
43
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
44
+ waitFor: z.ZodOptional<z.ZodBoolean>;
41
45
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
42
46
  type: z.ZodDefault<z.ZodLiteral<"DECLARE">>;
43
47
  }, z.core.$strip>;
@@ -48,6 +52,7 @@ export declare const EditActionInput: z.ZodObject<{
48
52
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
49
53
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
50
54
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
55
+ waitFor: z.ZodOptional<z.ZodBoolean>;
51
56
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
52
57
  type: z.ZodDefault<z.ZodLiteral<"EDIT">>;
53
58
  content: z.ZodObject<{
@@ -62,6 +67,7 @@ export declare const PrintCertificateActionInput: z.ZodObject<{
62
67
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
63
68
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
64
69
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
70
+ waitFor: z.ZodOptional<z.ZodBoolean>;
65
71
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
66
72
  type: z.ZodDefault<z.ZodLiteral<"PRINT_CERTIFICATE">>;
67
73
  content: z.ZodOptional<z.ZodObject<{
@@ -76,6 +82,7 @@ export declare const RejectDeclarationActionInput: z.ZodObject<{
76
82
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
77
83
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
78
84
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
85
+ waitFor: z.ZodOptional<z.ZodBoolean>;
79
86
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
80
87
  type: z.ZodDefault<z.ZodLiteral<"REJECT">>;
81
88
  content: z.ZodObject<{
@@ -90,6 +97,7 @@ export declare const DuplicateDetectedActionInput: z.ZodObject<{
90
97
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
91
98
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
92
99
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
100
+ waitFor: z.ZodOptional<z.ZodBoolean>;
93
101
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
94
102
  type: z.ZodDefault<z.ZodLiteral<"DUPLICATE_DETECTED">>;
95
103
  content: z.ZodObject<{
@@ -106,6 +114,7 @@ export declare const MarkAsDuplicateActionInput: z.ZodObject<{
106
114
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
107
115
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
108
116
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
117
+ waitFor: z.ZodOptional<z.ZodBoolean>;
109
118
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
110
119
  type: z.ZodDefault<z.ZodLiteral<"MARK_AS_DUPLICATE">>;
111
120
  content: z.ZodOptional<z.ZodObject<{
@@ -120,6 +129,7 @@ export declare const MarkNotDuplicateActionInput: z.ZodObject<{
120
129
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
121
130
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
122
131
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
132
+ waitFor: z.ZodOptional<z.ZodBoolean>;
123
133
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
124
134
  type: z.ZodDefault<z.ZodLiteral<"MARK_AS_NOT_DUPLICATE">>;
125
135
  }, z.core.$strip>;
@@ -131,6 +141,7 @@ export declare const ArchiveActionInput: z.ZodObject<{
131
141
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
132
142
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
133
143
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
144
+ waitFor: z.ZodOptional<z.ZodBoolean>;
134
145
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
135
146
  type: z.ZodDefault<z.ZodLiteral<"ARCHIVE">>;
136
147
  content: z.ZodObject<{
@@ -145,6 +156,7 @@ export declare const AssignActionInput: z.ZodObject<{
145
156
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
146
157
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
147
158
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
159
+ waitFor: z.ZodOptional<z.ZodBoolean>;
148
160
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
149
161
  type: z.ZodLiteral<"ASSIGN">;
150
162
  assignedTo: z.ZodString;
@@ -157,6 +169,7 @@ export declare const UnassignActionInput: z.ZodObject<{
157
169
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
158
170
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
159
171
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
172
+ waitFor: z.ZodOptional<z.ZodBoolean>;
160
173
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
161
174
  type: z.ZodDefault<z.ZodLiteral<"UNASSIGN">>;
162
175
  assignedTo: z.ZodDefault<z.ZodLiteral<null>>;
@@ -169,6 +182,7 @@ export declare const RequestCorrectionActionInput: z.ZodObject<{
169
182
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
170
183
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
171
184
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
185
+ waitFor: z.ZodOptional<z.ZodBoolean>;
172
186
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
173
187
  type: z.ZodDefault<z.ZodLiteral<"REQUEST_CORRECTION">>;
174
188
  }, z.core.$strip>;
@@ -180,6 +194,7 @@ export declare const RejectCorrectionActionInput: z.ZodObject<{
180
194
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
181
195
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
182
196
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
197
+ waitFor: z.ZodOptional<z.ZodBoolean>;
183
198
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
184
199
  requestId: z.ZodString;
185
200
  type: z.ZodDefault<z.ZodLiteral<"REJECT_CORRECTION">>;
@@ -195,6 +210,7 @@ export declare const ApproveCorrectionActionInput: z.ZodObject<{
195
210
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
196
211
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
197
212
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
213
+ waitFor: z.ZodOptional<z.ZodBoolean>;
198
214
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
199
215
  requestId: z.ZodString;
200
216
  type: z.ZodDefault<z.ZodLiteral<"APPROVE_CORRECTION">>;
@@ -207,6 +223,7 @@ export declare const ReadActionInput: z.ZodObject<{
207
223
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
208
224
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
209
225
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
226
+ waitFor: z.ZodOptional<z.ZodBoolean>;
210
227
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
211
228
  type: z.ZodDefault<z.ZodLiteral<"READ">>;
212
229
  }, z.core.$strip>;
@@ -222,6 +239,7 @@ export declare const CustomActionInput: z.ZodObject<{
222
239
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
223
240
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
224
241
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
242
+ waitFor: z.ZodOptional<z.ZodBoolean>;
225
243
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
226
244
  type: z.ZodDefault<z.ZodLiteral<"CUSTOM">>;
227
245
  customActionType: z.ZodString;
@@ -242,6 +260,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
242
260
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
243
261
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
244
262
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
263
+ waitFor: z.ZodOptional<z.ZodBoolean>;
245
264
  type: z.ZodDefault<z.ZodLiteral<"CREATE">>;
246
265
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
247
266
  }, z.core.$strip>, z.ZodObject<{
@@ -251,6 +270,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
251
270
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
252
271
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
253
272
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
273
+ waitFor: z.ZodOptional<z.ZodBoolean>;
254
274
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
255
275
  type: z.ZodDefault<z.ZodLiteral<"REGISTER">>;
256
276
  registrationNumber: z.ZodOptional<z.ZodString>;
@@ -261,6 +281,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
261
281
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
262
282
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
263
283
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
284
+ waitFor: z.ZodOptional<z.ZodBoolean>;
264
285
  type: z.ZodDefault<z.ZodLiteral<"NOTIFY">>;
265
286
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
266
287
  }, z.core.$strip>, z.ZodObject<{
@@ -270,6 +291,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
270
291
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
271
292
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
272
293
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
294
+ waitFor: z.ZodOptional<z.ZodBoolean>;
273
295
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
274
296
  type: z.ZodDefault<z.ZodLiteral<"DECLARE">>;
275
297
  }, z.core.$strip>, z.ZodObject<{
@@ -279,6 +301,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
279
301
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
280
302
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
281
303
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
304
+ waitFor: z.ZodOptional<z.ZodBoolean>;
282
305
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
283
306
  type: z.ZodDefault<z.ZodLiteral<"REJECT">>;
284
307
  content: z.ZodObject<{
@@ -291,6 +314,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
291
314
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
292
315
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
293
316
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
317
+ waitFor: z.ZodOptional<z.ZodBoolean>;
294
318
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
295
319
  type: z.ZodDefault<z.ZodLiteral<"DUPLICATE_DETECTED">>;
296
320
  content: z.ZodObject<{
@@ -306,6 +330,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
306
330
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
307
331
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
308
332
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
333
+ waitFor: z.ZodOptional<z.ZodBoolean>;
309
334
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
310
335
  type: z.ZodDefault<z.ZodLiteral<"MARK_AS_DUPLICATE">>;
311
336
  content: z.ZodOptional<z.ZodObject<{
@@ -318,6 +343,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
318
343
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
319
344
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
320
345
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
346
+ waitFor: z.ZodOptional<z.ZodBoolean>;
321
347
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
322
348
  type: z.ZodDefault<z.ZodLiteral<"MARK_AS_NOT_DUPLICATE">>;
323
349
  }, z.core.$strip>, z.ZodObject<{
@@ -327,6 +353,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
327
353
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
328
354
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
329
355
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
356
+ waitFor: z.ZodOptional<z.ZodBoolean>;
330
357
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
331
358
  type: z.ZodDefault<z.ZodLiteral<"ARCHIVE">>;
332
359
  content: z.ZodObject<{
@@ -339,6 +366,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
339
366
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
340
367
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
341
368
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
369
+ waitFor: z.ZodOptional<z.ZodBoolean>;
342
370
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
343
371
  type: z.ZodLiteral<"ASSIGN">;
344
372
  assignedTo: z.ZodString;
@@ -349,6 +377,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
349
377
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
350
378
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
351
379
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
380
+ waitFor: z.ZodOptional<z.ZodBoolean>;
352
381
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
353
382
  type: z.ZodDefault<z.ZodLiteral<"UNASSIGN">>;
354
383
  assignedTo: z.ZodDefault<z.ZodLiteral<null>>;
@@ -359,6 +388,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
359
388
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
360
389
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
361
390
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
391
+ waitFor: z.ZodOptional<z.ZodBoolean>;
362
392
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
363
393
  type: z.ZodDefault<z.ZodLiteral<"PRINT_CERTIFICATE">>;
364
394
  content: z.ZodOptional<z.ZodObject<{
@@ -371,6 +401,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
371
401
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
372
402
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
373
403
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
404
+ waitFor: z.ZodOptional<z.ZodBoolean>;
374
405
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
375
406
  type: z.ZodDefault<z.ZodLiteral<"REQUEST_CORRECTION">>;
376
407
  }, z.core.$strip>, z.ZodObject<{
@@ -380,6 +411,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
380
411
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
381
412
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
382
413
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
414
+ waitFor: z.ZodOptional<z.ZodBoolean>;
383
415
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
384
416
  requestId: z.ZodString;
385
417
  type: z.ZodDefault<z.ZodLiteral<"REJECT_CORRECTION">>;
@@ -393,6 +425,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
393
425
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
394
426
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
395
427
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
428
+ waitFor: z.ZodOptional<z.ZodBoolean>;
396
429
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
397
430
  requestId: z.ZodString;
398
431
  type: z.ZodDefault<z.ZodLiteral<"APPROVE_CORRECTION">>;
@@ -403,6 +436,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
403
436
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
404
437
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
405
438
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
439
+ waitFor: z.ZodOptional<z.ZodBoolean>;
406
440
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
407
441
  type: z.ZodDefault<z.ZodLiteral<"READ">>;
408
442
  }, z.core.$strip>, z.ZodObject<{
@@ -412,6 +446,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
412
446
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
413
447
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
414
448
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
449
+ waitFor: z.ZodOptional<z.ZodBoolean>;
415
450
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
416
451
  type: z.ZodDefault<z.ZodLiteral<"CUSTOM">>;
417
452
  customActionType: z.ZodString;
@@ -422,6 +457,7 @@ export declare const ActionInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
422
457
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
423
458
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
424
459
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
460
+ waitFor: z.ZodOptional<z.ZodBoolean>;
425
461
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
426
462
  type: z.ZodDefault<z.ZodLiteral<"EDIT">>;
427
463
  content: z.ZodObject<{
@@ -51,6 +51,7 @@ export declare const DraftInput: z.ZodObject<{
51
51
  annotation: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("./FieldValue").FieldUpdateValue, unknown, z.core.$ZodTypeInternals<import("./FieldValue").FieldUpdateValue, unknown>>>>;
52
52
  originalActionId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
53
53
  keepAssignment: z.ZodOptional<z.ZodBoolean>;
54
+ waitFor: z.ZodOptional<z.ZodBoolean>;
54
55
  createdAtLocation: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
55
56
  type: z.ZodEnum<{
56
57
  CUSTOM: "CUSTOM";
@@ -1723,6 +1723,7 @@ 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
  }>;
@@ -1842,6 +1843,7 @@ declare const LocationInput: z.ZodObject<{
1842
1843
  "user.read": "user.read";
1843
1844
  "user.create": "user.create";
1844
1845
  "user.edit": "user.edit";
1846
+ "user.search": "user.search";
1845
1847
  workqueue: "workqueue";
1846
1848
  "dashboard.view": "dashboard.view";
1847
1849
  }>;
@@ -2026,6 +2028,7 @@ declare const Facility: z.ZodObject<{
2026
2028
  "user.read": "user.read";
2027
2029
  "user.create": "user.create";
2028
2030
  "user.edit": "user.edit";
2031
+ "user.search": "user.search";
2029
2032
  workqueue: "workqueue";
2030
2033
  "dashboard.view": "dashboard.view";
2031
2034
  }>;
@@ -2131,6 +2134,7 @@ declare const Office: z.ZodObject<{
2131
2134
  "user.read": "user.read";
2132
2135
  "user.create": "user.create";
2133
2136
  "user.edit": "user.edit";
2137
+ "user.search": "user.search";
2134
2138
  workqueue: "workqueue";
2135
2139
  "dashboard.view": "dashboard.view";
2136
2140
  }>;
@@ -2323,6 +2327,7 @@ declare const Address: z.ZodObject<{
2323
2327
  "user.read": "user.read";
2324
2328
  "user.create": "user.create";
2325
2329
  "user.edit": "user.edit";
2330
+ "user.search": "user.search";
2326
2331
  workqueue: "workqueue";
2327
2332
  "dashboard.view": "dashboard.view";
2328
2333
  }>;
@@ -73,5 +73,26 @@ export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, use
73
73
  * One of the scopes must allow access for the event to be accessible.
74
74
  */
75
75
  export declare function userCanAccessEventWithScopes(event: Partial<EventIndexWithAdministrativeHierarchy>, scopes: RecordScopeV2[], user: UserContext | SystemContext, customActionType?: string): boolean;
76
+ export declare function getAdministrativeAreaHierarchy(administrativeAreaId: string | undefined | null, administrativeAreas: Map<UUID, AdministrativeArea>): {
77
+ id: string & z.core.$brand<"UUID">;
78
+ name: string;
79
+ parentId: (string & z.core.$brand<"UUID">) | null;
80
+ validUntil: string | null;
81
+ externalId?: string | null | undefined;
82
+ }[];
83
+ /**
84
+ * Resolves a location or administrative area UUID into a root-first hierarchy of UUIDs.
85
+ *
86
+ * If the ID refers to a `Location` (e.g. CRVS office), the hierarchy includes
87
+ * the administrative area ancestors followed by the location itself.
88
+ * If the ID refers to an `AdministrativeArea`, returns the area's ancestor chain (root-first).
89
+ *
90
+ * Uses `getAdministrativeAreaHierarchy` which returns leaf-first order,
91
+ * so the result is reversed to match the root-first convention used by the server.
92
+ */
93
+ export declare function getLocationHierarchy(selectedId: UUID, context: {
94
+ administrativeAreas: Map<UUID, AdministrativeArea>;
95
+ locations: Map<UUID, Location>;
96
+ }): UUID[];
76
97
  export {};
77
98
  //# sourceMappingURL=locations.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { AdministrativeArea, Location } from './locations';
2
+ export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: AdministrativeArea[];
3
+ export declare const V2_DEFAULT_MOCK_LOCATIONS: Location[];
4
+ export declare const V2_DEFAULT_MOCK_LOCATIONS_MAP: Map<string & import("zod").$brand<"UUID">, {
5
+ id: string & import("zod").$brand<"UUID">;
6
+ name: string;
7
+ administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
8
+ validUntil: string | null;
9
+ locationType: string | null;
10
+ externalId?: string | null | undefined;
11
+ }>;
12
+ export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: Map<string & import("zod").$brand<"UUID">, {
13
+ id: string & import("zod").$brand<"UUID">;
14
+ name: string;
15
+ parentId: (string & import("zod").$brand<"UUID">) | null;
16
+ validUntil: string | null;
17
+ externalId?: string | null | undefined;
18
+ }>;
19
+ //# sourceMappingURL=mocks.test.utils.d.ts.map
@@ -1,8 +1,9 @@
1
1
  import { DisplayableAction } from './ActionType';
2
- import { EncodedScope } from '../scopes';
2
+ import { EncodedScope, UserScopeV2 } from '../scopes';
3
3
  import { EventIndexWithAdministrativeHierarchy } from './locations';
4
4
  import { UserContext } from '../users/User';
5
5
  import { EventIndex } from './EventIndex';
6
+ import { UUID } from 'src/uuid';
6
7
  export declare const ACTION_SCOPE_MAP: {
7
8
  READ: "record.read"[];
8
9
  CREATE: "record.create"[];
@@ -53,4 +54,26 @@ export declare function isActionInScope({ scopes, action, event, currentUser }:
53
54
  event: EventIndexWithAdministrativeHierarchy;
54
55
  currentUser: UserContext;
55
56
  }): boolean;
57
+ /**
58
+ *
59
+ *
60
+ * @param allRoles - All possible roles in the system
61
+ * @param userLocation - The location and role information of the user whose role options are being determined
62
+ * @param acceptedScopes - The scopes of the user requesting the role update, used to determine which roles they can assign.
63
+ * @param userRequesting - The user context of the user requesting the role update, used to check location-based access to the target user's location.
64
+ *
65
+ * @returns An array of roles that the requesting user is allowed to assign to the target user based on their scopes and location
66
+ *
67
+ * 1) Used to determine which roles should be available in the dropdown when a user is editing another user's role in the user management interface.
68
+ * 2) Used to check if payload includes valid role.
69
+ */
70
+ export declare function getAvailableRolesForUserUpdatePayload({ allRoles, userLocation, acceptedScopes, userRequesting }: {
71
+ allRoles: string[];
72
+ userRequesting: UserContext;
73
+ acceptedScopes: UserScopeV2[];
74
+ userLocation: {
75
+ administrativeHierarchy: UUID[];
76
+ primaryOfficeId: UUID;
77
+ };
78
+ }): string[];
56
79
  //# sourceMappingURL=scopes.d.ts.map
@@ -298,12 +298,14 @@ var SystemScopeType = z6.enum([
298
298
  "organisation.read-locations",
299
299
  "user.read",
300
300
  "user.create",
301
- "user.edit"
301
+ "user.edit",
302
+ "user.search"
302
303
  ]);
303
304
  var UserScopeType = SystemScopeType.extract([
304
305
  "user.read",
305
306
  "user.create",
306
- "user.edit"
307
+ "user.edit",
308
+ "user.search"
307
309
  ]);
308
310
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
309
311
  var UserScopeV2 = z6.discriminatedUnion("type", [
@@ -312,7 +314,7 @@ var UserScopeV2 = z6.discriminatedUnion("type", [
312
314
  options: AllUserScopeOptions.optional()
313
315
  }),
314
316
  z6.object({
315
- type: UserScopeType.extract(["user.read"]),
317
+ type: UserScopeType.extract(["user.read", "user.search"]),
316
318
  options: AccessLevelOptions.optional()
317
319
  })
318
320
  ]);
@@ -302,12 +302,14 @@ __export(events_exports, {
302
302
  getActionConfig: () => getActionConfig,
303
303
  getActionReview: () => getActionReview,
304
304
  getActionReviewFields: () => getActionReviewFields,
305
+ getAdministrativeAreaHierarchy: () => getAdministrativeAreaHierarchy,
305
306
  getAllUniqueFields: () => getAllUniqueFields,
306
307
  getAnnotationFromDrafts: () => getAnnotationFromDrafts,
307
308
  getAssignedUserFromActions: () => getAssignedUserFromActions,
308
309
  getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
309
310
  getAssignmentStatus: () => getAssignmentStatus,
310
311
  getAvailableActionsForEvent: () => getAvailableActionsForEvent,
312
+ getAvailableRolesForUserUpdatePayload: () => getAvailableRolesForUserUpdatePayload,
311
313
  getCompleteActionAnnotation: () => getCompleteActionAnnotation,
312
314
  getCompleteActionDeclaration: () => getCompleteActionDeclaration,
313
315
  getCurrentEventState: () => getCurrentEventState,
@@ -318,6 +320,7 @@ __export(events_exports, {
318
320
  getDeclarationPages: () => getDeclarationPages,
319
321
  getEventConfigById: () => getEventConfigById,
320
322
  getFilePathsFromEvent: () => getFilePathsFromEvent,
323
+ getLocationHierarchy: () => getLocationHierarchy,
321
324
  getMixedPath: () => getMixedPath,
322
325
  getPendingAction: () => getPendingAction,
323
326
  getPrintCertificatePages: () => getPrintCertificatePages,
@@ -607,12 +610,14 @@ var SystemScopeType = z2.enum([
607
610
  "organisation.read-locations",
608
611
  "user.read",
609
612
  "user.create",
610
- "user.edit"
613
+ "user.edit",
614
+ "user.search"
611
615
  ]);
612
616
  var UserScopeType = SystemScopeType.extract([
613
617
  "user.read",
614
618
  "user.create",
615
- "user.edit"
619
+ "user.edit",
620
+ "user.search"
616
621
  ]);
617
622
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
618
623
  var UserScopeV2 = z2.discriminatedUnion("type", [
@@ -621,7 +626,7 @@ var UserScopeV2 = z2.discriminatedUnion("type", [
621
626
  options: AllUserScopeOptions.optional()
622
627
  }),
623
628
  z2.object({
624
- type: UserScopeType.extract(["user.read"]),
629
+ type: UserScopeType.extract(["user.read", "user.search"]),
625
630
  options: AccessLevelOptions.optional()
626
631
  })
627
632
  ]);
@@ -1409,28 +1414,20 @@ function schemaPriority(schema) {
1409
1414
  return idx === -1 ? 9999 : idx;
1410
1415
  }
1411
1416
  function safeUnion(schemas) {
1417
+ const sortedSchemas = [...schemas].sort(
1418
+ (a, b) => schemaPriority(a) - schemaPriority(b)
1419
+ );
1412
1420
  return z12.any().superRefine((val, ctx) => {
1413
- const successful = schemas.filter((s) => s.safeParse(val).success);
1414
- if (successful.length === 1) {
1415
- return;
1416
- }
1417
- if (successful.length === 0) {
1418
- ctx.addIssue({
1419
- code: "invalid_type",
1420
- expected: "custom",
1421
- message: "Value does not match any schema"
1422
- });
1423
- return;
1424
- }
1425
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
1426
- const best = successful[0];
1427
- if (!best.safeParse(val).success) {
1428
- ctx.addIssue({
1429
- expected: "custom",
1430
- code: "invalid_type",
1431
- message: "Value did not match the best schema"
1432
- });
1421
+ for (const schema of sortedSchemas) {
1422
+ if (schema.safeParse(val).success) {
1423
+ return;
1424
+ }
1433
1425
  }
1426
+ ctx.addIssue({
1427
+ code: "invalid_type",
1428
+ expected: "custom",
1429
+ message: "Value does not match any schema"
1430
+ });
1434
1431
  }).meta({
1435
1432
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
1436
1433
  });
@@ -5895,6 +5892,7 @@ var BaseActionInput = z38.object({
5895
5892
  originalActionId: UUID.optional(),
5896
5893
  // should not be part of base action.
5897
5894
  keepAssignment: z38.boolean().optional(),
5895
+ waitFor: z38.boolean().optional(),
5898
5896
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
5899
5897
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
5900
5898
  createdAtLocation: UUID.nullish().describe(
@@ -10001,6 +9999,39 @@ function userCanAccessEventWithScopes(event2, scopes, user2, customActionType) {
10001
9999
  (scope) => canAccessEventWithScope(event2, scope, user2, customActionType)
10002
10000
  );
10003
10001
  }
10002
+ function getAdministrativeAreaHierarchy(administrativeAreaId, administrativeAreas) {
10003
+ const collectedLocations = [];
10004
+ const parsedAdministrativeAreaId = administrativeAreaId && UUID.safeParse(administrativeAreaId).data;
10005
+ let current = parsedAdministrativeAreaId ? administrativeAreas.get(parsedAdministrativeAreaId) : null;
10006
+ while (current) {
10007
+ collectedLocations.push(current);
10008
+ if (!current.parentId) {
10009
+ break;
10010
+ }
10011
+ const parentId = current.parentId;
10012
+ current = administrativeAreas.get(parentId);
10013
+ }
10014
+ return collectedLocations;
10015
+ }
10016
+ function getLocationHierarchy(selectedId, context) {
10017
+ const { administrativeAreas, locations } = context;
10018
+ const loc = locations.get(selectedId);
10019
+ if (loc) {
10020
+ if (loc.administrativeAreaId) {
10021
+ const hierarchy2 = getAdministrativeAreaHierarchy(
10022
+ loc.administrativeAreaId,
10023
+ administrativeAreas
10024
+ );
10025
+ return [...hierarchy2.reverse().map((area) => area.id), loc.id];
10026
+ }
10027
+ return [loc.id];
10028
+ }
10029
+ const hierarchy = getAdministrativeAreaHierarchy(
10030
+ selectedId,
10031
+ administrativeAreas
10032
+ );
10033
+ return hierarchy.reverse().map((area) => area.id);
10034
+ }
10004
10035
 
10005
10036
  // ../commons/src/events/scopes.ts
10006
10037
  var ACTION_SCOPE_MAP = {
@@ -10075,6 +10106,25 @@ function isActionInScope({
10075
10106
  );
10076
10107
  return canAccess;
10077
10108
  }
10109
+ function getAvailableRolesForUserUpdatePayload({
10110
+ allRoles,
10111
+ userLocation,
10112
+ acceptedScopes,
10113
+ userRequesting
10114
+ }) {
10115
+ const availableRoles = allRoles.filter((role) => {
10116
+ const canAccess = canAccessOtherUserWithScopes({
10117
+ userToAccess: {
10118
+ ...userLocation,
10119
+ role
10120
+ },
10121
+ user: userRequesting,
10122
+ scopes: acceptedScopes
10123
+ });
10124
+ return canAccess;
10125
+ });
10126
+ return availableRoles;
10127
+ }
10078
10128
 
10079
10129
  // ../commons/src/events/serializers/user/deserializer.ts
10080
10130
  function userDeserializer(serializedUserField, user2) {
@@ -2308,12 +2308,14 @@ var SystemScopeType = z3.enum([
2308
2308
  "organisation.read-locations",
2309
2309
  "user.read",
2310
2310
  "user.create",
2311
- "user.edit"
2311
+ "user.edit",
2312
+ "user.search"
2312
2313
  ]);
2313
2314
  var UserScopeType = SystemScopeType.extract([
2314
2315
  "user.read",
2315
2316
  "user.create",
2316
- "user.edit"
2317
+ "user.edit",
2318
+ "user.search"
2317
2319
  ]);
2318
2320
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
2319
2321
  var UserScopeV2 = z3.discriminatedUnion("type", [
@@ -2322,7 +2324,7 @@ var UserScopeV2 = z3.discriminatedUnion("type", [
2322
2324
  options: AllUserScopeOptions.optional()
2323
2325
  }),
2324
2326
  z3.object({
2325
- type: UserScopeType.extract(["user.read"]),
2327
+ type: UserScopeType.extract(["user.read", "user.search"]),
2326
2328
  options: AccessLevelOptions.optional()
2327
2329
  })
2328
2330
  ]);
@@ -226,12 +226,14 @@ var SystemScopeType = z2.enum([
226
226
  "organisation.read-locations",
227
227
  "user.read",
228
228
  "user.create",
229
- "user.edit"
229
+ "user.edit",
230
+ "user.search"
230
231
  ]);
231
232
  var UserScopeType = SystemScopeType.extract([
232
233
  "user.read",
233
234
  "user.create",
234
- "user.edit"
235
+ "user.edit",
236
+ "user.search"
235
237
  ]);
236
238
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
237
239
  var UserScopeV2 = z2.discriminatedUnion("type", [
@@ -240,7 +242,7 @@ var UserScopeV2 = z2.discriminatedUnion("type", [
240
242
  options: AllUserScopeOptions.optional()
241
243
  }),
242
244
  z2.object({
243
- type: UserScopeType.extract(["user.read"]),
245
+ type: UserScopeType.extract(["user.read", "user.search"]),
244
246
  options: AccessLevelOptions.optional()
245
247
  })
246
248
  ]);
@@ -978,28 +980,20 @@ function schemaPriority(schema) {
978
980
  return idx === -1 ? 9999 : idx;
979
981
  }
980
982
  function safeUnion(schemas) {
983
+ const sortedSchemas = [...schemas].sort(
984
+ (a, b) => schemaPriority(a) - schemaPriority(b)
985
+ );
981
986
  return z12.any().superRefine((val, ctx) => {
982
- const successful = schemas.filter((s) => s.safeParse(val).success);
983
- if (successful.length === 1) {
984
- return;
985
- }
986
- if (successful.length === 0) {
987
- ctx.addIssue({
988
- code: "invalid_type",
989
- expected: "custom",
990
- message: "Value does not match any schema"
991
- });
992
- return;
993
- }
994
- successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
995
- const best = successful[0];
996
- if (!best.safeParse(val).success) {
997
- ctx.addIssue({
998
- expected: "custom",
999
- code: "invalid_type",
1000
- message: "Value did not match the best schema"
1001
- });
987
+ for (const schema of sortedSchemas) {
988
+ if (schema.safeParse(val).success) {
989
+ return;
990
+ }
1002
991
  }
992
+ ctx.addIssue({
993
+ code: "invalid_type",
994
+ expected: "custom",
995
+ message: "Value does not match any schema"
996
+ });
1003
997
  }).meta({
1004
998
  description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
1005
999
  });
@@ -4178,6 +4172,7 @@ var BaseActionInput = z38.object({
4178
4172
  originalActionId: UUID.optional(),
4179
4173
  // should not be part of base action.
4180
4174
  keepAssignment: z38.boolean().optional(),
4175
+ waitFor: z38.boolean().optional(),
4181
4176
  // For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
4182
4177
  // @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
4183
4178
  createdAtLocation: UUID.nullish().describe(
@@ -227,12 +227,14 @@ declare const SystemScopeType: z.ZodEnum<{
227
227
  "user.read": "user.read";
228
228
  "user.create": "user.create";
229
229
  "user.edit": "user.edit";
230
+ "user.search": "user.search";
230
231
  }>;
231
232
  export type SystemScopeType = z.infer<typeof SystemScopeType>;
232
233
  declare const UserScopeType: z.ZodEnum<{
233
234
  "user.read": "user.read";
234
235
  "user.create": "user.create";
235
236
  "user.edit": "user.edit";
237
+ "user.search": "user.search";
236
238
  }>;
237
239
  export type UserScopeType = z.infer<typeof UserScopeType>;
238
240
  declare const ScopesWithRoleOption: z.ZodEnum<{
@@ -256,6 +258,7 @@ export declare const UserScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
256
258
  }, z.core.$strip>, z.ZodObject<{
257
259
  type: z.ZodEnum<{
258
260
  "user.read": "user.read";
261
+ "user.search": "user.search";
259
262
  }>;
260
263
  options: z.ZodOptional<z.ZodObject<{
261
264
  accessLevel: z.ZodOptional<z.ZodEnum<{
@@ -493,6 +496,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
493
496
  }, z.core.$strip>, z.ZodObject<{
494
497
  type: z.ZodEnum<{
495
498
  "user.read": "user.read";
499
+ "user.search": "user.search";
496
500
  }>;
497
501
  options: z.ZodOptional<z.ZodObject<{
498
502
  accessLevel: z.ZodOptional<z.ZodEnum<{
@@ -556,6 +560,7 @@ export declare const ScopeType: z.ZodEnum<{
556
560
  "user.read": "user.read";
557
561
  "user.create": "user.create";
558
562
  "user.edit": "user.edit";
563
+ "user.search": "user.search";
559
564
  workqueue: "workqueue";
560
565
  "dashboard.view": "dashboard.view";
561
566
  }>;
@@ -635,7 +640,7 @@ export declare const decodeScope: (query: EncodedScope) => {
635
640
  role?: string[] | undefined;
636
641
  } | undefined;
637
642
  } | {
638
- type: "user.read";
643
+ type: "user.read" | "user.search";
639
644
  options?: {
640
645
  accessLevel?: "administrativeArea" | "location" | "all" | undefined;
641
646
  } | undefined;
@@ -257,12 +257,14 @@ var SystemScopeType = z3.enum([
257
257
  "organisation.read-locations",
258
258
  "user.read",
259
259
  "user.create",
260
- "user.edit"
260
+ "user.edit",
261
+ "user.search"
261
262
  ]);
262
263
  var UserScopeType = SystemScopeType.extract([
263
264
  "user.read",
264
265
  "user.create",
265
- "user.edit"
266
+ "user.edit",
267
+ "user.search"
266
268
  ]);
267
269
  var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
268
270
  var UserScopeV2 = z3.discriminatedUnion("type", [
@@ -271,7 +273,7 @@ var UserScopeV2 = z3.discriminatedUnion("type", [
271
273
  options: AllUserScopeOptions.optional()
272
274
  }),
273
275
  z3.object({
274
- type: UserScopeType.extract(["user.read"]),
276
+ type: UserScopeType.extract(["user.read", "user.search"]),
275
277
  options: AccessLevelOptions.optional()
276
278
  })
277
279
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencrvs/toolkit",
3
- "version": "2.0.0-rc.d87f90c",
3
+ "version": "2.0.0-rc.d9d584a",
4
4
  "description": "OpenCRVS toolkit for building country configurations",
5
5
  "license": "MPL-2.0",
6
6
  "bin": {