@opencrvs/toolkit 2.0.0-rc.bdffe06 → 2.0.0-rc.bee0e60

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 (90) hide show
  1. package/README.md +14 -0
  2. package/build.sh +1 -0
  3. package/dist/application-config/index.js +51 -33
  4. package/dist/cli.js +3164 -45
  5. package/dist/commons/api/router.d.ts +26 -17
  6. package/dist/commons/application-config/index.d.ts +1 -0
  7. package/dist/commons/conditionals/conditionals.d.ts +348 -4
  8. package/dist/commons/conditionals/validate.d.ts +51 -2
  9. package/dist/commons/events/ActionConfig.d.ts +28 -2
  10. package/dist/commons/events/AdvancedSearchConfig.d.ts +342 -0
  11. package/dist/commons/events/FieldConfig.d.ts +378 -50
  12. package/dist/commons/events/FieldType.d.ts +1 -0
  13. package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
  14. package/dist/commons/events/FieldValue.d.ts +6 -0
  15. package/dist/commons/events/field.d.ts +53 -1
  16. package/dist/commons/events/state/utils.d.ts +12 -290
  17. package/dist/commons/events/utils.d.ts +1 -1
  18. package/dist/conditionals/index.js +48 -1
  19. package/dist/environment/custom-types.d.ts +33 -0
  20. package/dist/environment/custom-types.d.ts.map +1 -0
  21. package/dist/environment/custom-types.js +12 -0
  22. package/dist/environment/derived-variables.d.ts +134 -0
  23. package/dist/environment/derived-variables.d.ts.map +1 -0
  24. package/dist/environment/derived-variables.js +169 -0
  25. package/dist/environment/editor-questions.d.ts +4 -0
  26. package/dist/environment/editor-questions.d.ts.map +1 -0
  27. package/dist/environment/editor-questions.js +65 -0
  28. package/dist/environment/git.d.ts +5 -0
  29. package/dist/environment/git.d.ts.map +1 -0
  30. package/dist/environment/git.js +38 -0
  31. package/dist/environment/github.d.ts +26 -0
  32. package/dist/environment/github.d.ts.map +1 -0
  33. package/dist/environment/github.js +244 -0
  34. package/dist/environment/index.d.ts +5 -0
  35. package/dist/environment/index.d.ts.map +1 -0
  36. package/dist/environment/index.js +71 -0
  37. package/dist/environment/logger.d.ts +15 -0
  38. package/dist/environment/logger.d.ts.map +1 -0
  39. package/dist/environment/logger.js +25 -0
  40. package/dist/environment/manage-users.d.ts +11 -0
  41. package/dist/environment/manage-users.d.ts.map +1 -0
  42. package/dist/environment/manage-users.js +494 -0
  43. package/dist/environment/questions-helper.d.ts +15 -0
  44. package/dist/environment/questions-helper.d.ts.map +1 -0
  45. package/dist/environment/questions-helper.js +70 -0
  46. package/dist/environment/questions.d.ts +199 -0
  47. package/dist/environment/questions.d.ts.map +1 -0
  48. package/dist/environment/questions.js +412 -0
  49. package/dist/environment/setup-environment.d.ts +2 -0
  50. package/dist/environment/setup-environment.d.ts.map +1 -0
  51. package/dist/environment/setup-environment.js +773 -0
  52. package/dist/environment/ssh-keygen.d.ts +5 -0
  53. package/dist/environment/ssh-keygen.d.ts.map +1 -0
  54. package/dist/environment/ssh-keygen.js +18 -0
  55. package/dist/environment/swarm-to-k8s.d.ts +2 -0
  56. package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
  57. package/dist/environment/swarm-to-k8s.js +172 -0
  58. package/dist/environment/templates/charts-values/dependencies/values.override.yaml +4 -0
  59. package/dist/environment/templates/charts-values/dependencies/values.yaml +82 -0
  60. package/dist/environment/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
  61. package/dist/environment/templates/charts-values/opencrvs-services/values.yaml +79 -0
  62. package/dist/environment/templates/charts-values/traefik/values.override.yaml +4 -0
  63. package/dist/environment/templates/charts-values/traefik/values.yaml +116 -0
  64. package/dist/environment/templates/inventory/inventory.template.yml +100 -0
  65. package/dist/environment/templates/inventory/production.example.yml +77 -0
  66. package/dist/environment/templates/inventory/qa.example.yml +48 -0
  67. package/dist/environment/templates.d.ts +27 -0
  68. package/dist/environment/templates.d.ts.map +1 -0
  69. package/dist/environment/templates.js +159 -0
  70. package/dist/environment/update-workflows.d.ts +2 -0
  71. package/dist/environment/update-workflows.d.ts.map +1 -0
  72. package/dist/environment/update-workflows.js +168 -0
  73. package/dist/environment/users.d.ts +2 -0
  74. package/dist/environment/users.d.ts.map +1 -0
  75. package/dist/environment/users.js +108 -0
  76. package/dist/environment/utils.d.ts +18 -0
  77. package/dist/environment/utils.d.ts.map +1 -0
  78. package/dist/environment/utils.js +100 -0
  79. package/dist/events/index.js +357 -145
  80. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  81. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  82. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -1
  83. package/dist/migrations/v2.0/index.js +10 -4
  84. package/dist/notification/index.js +244 -37
  85. package/dist/scopes/index.d.ts +4 -6
  86. package/dist/scopes/index.js +9 -3
  87. package/opencrvs-toolkit-2.0.0-rc.bee0e60.tgz +0 -0
  88. package/package.json +15 -1
  89. package/tsconfig.tsbuildinfo +1 -1
  90. package/opencrvs-toolkit-2.0.0-rc.bdffe06.tgz +0 -0
@@ -417,7 +417,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
417
417
  createdByUserType: "system" | "user";
418
418
  createdAt: string;
419
419
  createdBy: string;
420
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
420
+ type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
421
421
  status: "Rejected";
422
422
  createdByRole?: string | undefined;
423
423
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -729,7 +729,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
729
729
  createdByUserType: "system" | "user";
730
730
  createdAt: string;
731
731
  createdBy: string;
732
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
732
+ type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
733
733
  status: "Rejected";
734
734
  createdByRole?: string | undefined;
735
735
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -1040,7 +1040,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1040
1040
  createdByUserType: "system" | "user";
1041
1041
  createdAt: string;
1042
1042
  createdBy: string;
1043
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
1043
+ type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
1044
1044
  status: "Rejected";
1045
1045
  createdByRole?: string | undefined;
1046
1046
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -1090,7 +1090,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1090
1090
  transactionId: string;
1091
1091
  createdAt: string;
1092
1092
  action: {
1093
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "MARK_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "READ" | "CUSTOM" | "CREATE" | "NOTIFY" | "DUPLICATE_DETECTED" | "MARK_AS_NOT_DUPLICATE" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "ASSIGN" | "UNASSIGN";
1093
+ type: "CREATE" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "DUPLICATE_DETECTED" | "REJECT" | "MARK_AS_DUPLICATE" | "MARK_AS_NOT_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN" | "CUSTOM";
1094
1094
  transactionId: string;
1095
1095
  createdByUserType: "system" | "user";
1096
1096
  createdAt: string;
@@ -1109,7 +1109,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1109
1109
  input: {
1110
1110
  transactionId: string;
1111
1111
  eventId: string;
1112
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "MARK_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "READ" | "CUSTOM" | "CREATE" | "NOTIFY" | "DUPLICATE_DETECTED" | "MARK_AS_NOT_DUPLICATE" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "ASSIGN" | "UNASSIGN";
1112
+ type: "CREATE" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "DUPLICATE_DETECTED" | "REJECT" | "MARK_AS_DUPLICATE" | "MARK_AS_NOT_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN" | "CUSTOM";
1113
1113
  status: "Requested" | "Accepted" | "Rejected";
1114
1114
  createdAtLocation?: string | null | undefined;
1115
1115
  declaration?: Record<string, unknown> | undefined;
@@ -1125,7 +1125,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1125
1125
  transactionId: string;
1126
1126
  createdAt: string;
1127
1127
  action: {
1128
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "MARK_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "READ" | "CUSTOM" | "CREATE" | "NOTIFY" | "DUPLICATE_DETECTED" | "MARK_AS_NOT_DUPLICATE" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "ASSIGN" | "UNASSIGN";
1128
+ type: "CREATE" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "DUPLICATE_DETECTED" | "REJECT" | "MARK_AS_DUPLICATE" | "MARK_AS_NOT_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN" | "CUSTOM";
1129
1129
  transactionId: string;
1130
1130
  createdByUserType: "system" | "user";
1131
1131
  createdAt: string;
@@ -1788,7 +1788,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1788
1788
  createdByUserType: "system" | "user";
1789
1789
  createdAt: string;
1790
1790
  createdBy: string;
1791
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
1791
+ type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
1792
1792
  status: "Rejected";
1793
1793
  createdByRole?: string | undefined;
1794
1794
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -2131,7 +2131,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2131
2131
  createdByUserType: "system" | "user";
2132
2132
  createdAt: string;
2133
2133
  createdBy: string;
2134
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
2134
+ type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
2135
2135
  status: "Rejected";
2136
2136
  createdByRole?: string | undefined;
2137
2137
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -4217,7 +4217,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4217
4217
  createdByUserType: "system" | "user";
4218
4218
  createdAt: string;
4219
4219
  createdBy: string;
4220
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
4220
+ type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
4221
4221
  status: "Rejected";
4222
4222
  createdByRole?: string | undefined;
4223
4223
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -4828,7 +4828,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
4828
4828
  createdByUserType: "system" | "user";
4829
4829
  createdAt: string;
4830
4830
  createdBy: string;
4831
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
4831
+ type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
4832
4832
  status: "Rejected";
4833
4833
  createdByRole?: string | undefined;
4834
4834
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -5149,7 +5149,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
5149
5149
  createdByUserType: "system" | "user";
5150
5150
  createdAt: string;
5151
5151
  createdBy: string;
5152
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
5152
+ type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
5153
5153
  status: "Rejected";
5154
5154
  createdByRole?: string | undefined;
5155
5155
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -6403,7 +6403,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
6403
6403
  createdByUserType: "system" | "user";
6404
6404
  createdAt: string;
6405
6405
  createdBy: string;
6406
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
6406
+ type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
6407
6407
  status: "Rejected";
6408
6408
  createdByRole?: string | undefined;
6409
6409
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -6723,7 +6723,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
6723
6723
  createdByUserType: "system" | "user";
6724
6724
  createdAt: string;
6725
6725
  createdBy: string;
6726
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
6726
+ type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
6727
6727
  status: "Rejected";
6728
6728
  createdByRole?: string | undefined;
6729
6729
  createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
@@ -7086,7 +7086,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
7086
7086
  createdByUserType: "system" | "user";
7087
7087
  createdAt: string;
7088
7088
  createdBy: string;
7089
- type: "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "CUSTOM" | "NOTIFY" | "REJECT_CORRECTION" | "APPROVE_CORRECTION";
7089
+ type: "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "CUSTOM";
7090
7090
  status: "Rejected";
7091
7091
  createdByRole?: string | undefined;
7092
7092
  createdBySignature?: string | null | undefined;
@@ -7304,7 +7304,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
7304
7304
  count?: number | undefined;
7305
7305
  timeStart?: string | undefined;
7306
7306
  timeEnd?: string | undefined;
7307
- actionTypes?: ("DECLARE" | "REGISTER" | "EDIT" | "REJECT" | "MARK_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "READ" | "CUSTOM" | "CREATE" | "NOTIFY" | "DUPLICATE_DETECTED" | "MARK_AS_NOT_DUPLICATE" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "ASSIGN" | "UNASSIGN")[] | undefined;
7307
+ actionTypes?: ("CREATE" | "NOTIFY" | "DECLARE" | "REGISTER" | "EDIT" | "DUPLICATE_DETECTED" | "REJECT" | "MARK_AS_DUPLICATE" | "MARK_AS_NOT_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN" | "CUSTOM")[] | undefined;
7308
7308
  };
7309
7309
  output: {
7310
7310
  results: {
@@ -7374,9 +7374,18 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
7374
7374
  output: void;
7375
7375
  meta: import("trpc-to-openapi").OpenApiMeta;
7376
7376
  }>;
7377
- sendVerifyCode: import("@trpc/server").TRPCMutationProcedure<{
7377
+ requestEmailChange: import("@trpc/server").TRPCMutationProcedure<{
7378
7378
  input: {
7379
- notificationEvent: "change-phone-number" | "change-email-address";
7379
+ email: string;
7380
+ };
7381
+ output: {
7382
+ nonce: string;
7383
+ };
7384
+ meta: import("trpc-to-openapi").OpenApiMeta;
7385
+ }>;
7386
+ requestPhoneChange: import("@trpc/server").TRPCMutationProcedure<{
7387
+ input: {
7388
+ phoneNumber: string;
7380
7389
  };
7381
7390
  output: {
7382
7391
  nonce: string;
@@ -74,6 +74,7 @@ export declare const ClientConfig: z.ZodObject<{
74
74
  COUNTRY: z.ZodString;
75
75
  LANGUAGES: z.ZodArray<z.ZodString>;
76
76
  SENTRY: z.ZodOptional<z.ZodString>;
77
+ LOGIN_URL: z.ZodOptional<z.ZodString>;
77
78
  REGISTER_BACKGROUND: z.ZodObject<{
78
79
  backgroundColor: z.ZodOptional<z.ZodString>;
79
80
  backgroundImage: z.ZodOptional<z.ZodString>;
@@ -1,12 +1,13 @@
1
1
  import { EventDocument } from '../events/EventDocument';
2
- import { EventState } from '../events/ActionDocument';
2
+ import { ActionUpdate, EventState } from '../events/ActionDocument';
3
3
  import { ITokenPayload as TokenPayload } from '../authentication';
4
4
  import { PartialSchema as AjvJSONSchemaType } from 'ajv/dist/types/json-schema';
5
5
  import { userSerializer } from '../events/serializers/user/serializer';
6
6
  import { UUID } from '../uuid';
7
7
  import { todayDateTimeValueSerializer } from '../events/serializers/date/serializer';
8
8
  import { EventStatus } from '../events/EventMetadata';
9
- import { FieldReference } from '../events/FieldConfig';
9
+ import { CodeToEvaluate, FieldReference } from '../events/FieldConfig';
10
+ import type { ClientFunctionContext } from './validate';
10
11
  /** @knipignore */
11
12
  export type JSONSchema = {
12
13
  $id: string;
@@ -25,7 +26,7 @@ export type EventConditionalParameters = CommonConditionalParameters & {
25
26
  $event: EventDocument;
26
27
  };
27
28
  export type FormConditionalParameters = CommonConditionalParameters & {
28
- $form: EventState | Record<string, unknown>;
29
+ $form: EventState | ActionUpdate;
29
30
  $leafAdminStructureLocationIds?: Array<{
30
31
  id: UUID;
31
32
  }>;
@@ -107,7 +108,9 @@ export declare const user: typeof userSerializer & {
107
108
  };
108
109
  };
109
110
  export declare function isFieldReference(value: unknown): value is FieldReference;
110
- export declare function isEventFieldReference(value: unknown): value is FieldReference;
111
+ export declare function isEventFieldReference(value: unknown): value is {
112
+ $$event: string;
113
+ };
111
114
  /** Check if an event flag is present */
112
115
  export declare function flag(flagvalue: string): JSONSchema;
113
116
  /** Check if an event flag is present */
@@ -202,6 +205,37 @@ export declare function createFieldConditionals(fieldId: string): {
202
205
  * )
203
206
  */
204
207
  object: (options: Record<string, any>) => JSONSchema;
208
+ /**
209
+ * Custom client-side validator. The provided function is serialised and executed
210
+ * just-in-time on the client only. External references (e.g. lodash) are not
211
+ * available inside the function body — all logic must be self-contained.
212
+ *
213
+ * @example
214
+ * field('nid').customClientValidator((value) => {
215
+ * // LUHN check — all logic must be inline
216
+ * const digits = String(value).split('').map(Number)
217
+ * // ...
218
+ * return isValid
219
+ * })
220
+ */
221
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
222
+ /**
223
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
224
+ * that can be used as the `value` property or a DATA component entry.
225
+ * The function receives the referenced field's value as the first argument and
226
+ * the full form context as the second; its return value replaces the field reference.
227
+ * The function is serialised and executed just-in-time on the client only.
228
+ * External references (e.g. lodash) are not available inside the function body.
229
+ *
230
+ * For computing a default value without referencing a specific field, use
231
+ * `evaluate(fn)` in the `defaultValue` property instead.
232
+ *
233
+ * @example
234
+ * field('a').customClientEvaluation((aValue, ctx) =>
235
+ * Number(aValue) + Number(ctx.$form.b)
236
+ * )
237
+ */
238
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
205
239
  };
206
240
  asDob(): any;
207
241
  asAge(): any;
@@ -261,6 +295,37 @@ export declare function createFieldConditionals(fieldId: string): {
261
295
  * )
262
296
  */
263
297
  object: (options: Record<string, any>) => JSONSchema;
298
+ /**
299
+ * Custom client-side validator. The provided function is serialised and executed
300
+ * just-in-time on the client only. External references (e.g. lodash) are not
301
+ * available inside the function body — all logic must be self-contained.
302
+ *
303
+ * @example
304
+ * field('nid').customClientValidator((value) => {
305
+ * // LUHN check — all logic must be inline
306
+ * const digits = String(value).split('').map(Number)
307
+ * // ...
308
+ * return isValid
309
+ * })
310
+ */
311
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
312
+ /**
313
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
314
+ * that can be used as the `value` property or a DATA component entry.
315
+ * The function receives the referenced field's value as the first argument and
316
+ * the full form context as the second; its return value replaces the field reference.
317
+ * The function is serialised and executed just-in-time on the client only.
318
+ * External references (e.g. lodash) are not available inside the function body.
319
+ *
320
+ * For computing a default value without referencing a specific field, use
321
+ * `evaluate(fn)` in the `defaultValue` property instead.
322
+ *
323
+ * @example
324
+ * field('a').customClientEvaluation((aValue, ctx) =>
325
+ * Number(aValue) + Number(ctx.$form.b)
326
+ * )
327
+ */
328
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
264
329
  };
265
330
  getByPath(fieldPath: string[]): {
266
331
  $$subfield: string[];
@@ -334,6 +399,37 @@ export declare function createFieldConditionals(fieldId: string): {
334
399
  * )
335
400
  */
336
401
  object: (options: Record<string, any>) => JSONSchema;
402
+ /**
403
+ * Custom client-side validator. The provided function is serialised and executed
404
+ * just-in-time on the client only. External references (e.g. lodash) are not
405
+ * available inside the function body — all logic must be self-contained.
406
+ *
407
+ * @example
408
+ * field('nid').customClientValidator((value) => {
409
+ * // LUHN check — all logic must be inline
410
+ * const digits = String(value).split('').map(Number)
411
+ * // ...
412
+ * return isValid
413
+ * })
414
+ */
415
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
416
+ /**
417
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
418
+ * that can be used as the `value` property or a DATA component entry.
419
+ * The function receives the referenced field's value as the first argument and
420
+ * the full form context as the second; its return value replaces the field reference.
421
+ * The function is serialised and executed just-in-time on the client only.
422
+ * External references (e.g. lodash) are not available inside the function body.
423
+ *
424
+ * For computing a default value without referencing a specific field, use
425
+ * `evaluate(fn)` in the `defaultValue` property instead.
426
+ *
427
+ * @example
428
+ * field('a').customClientEvaluation((aValue, ctx) =>
429
+ * Number(aValue) + Number(ctx.$form.b)
430
+ * )
431
+ */
432
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
337
433
  };
338
434
  getByPath(fieldPath: string[]): any;
339
435
  asDob(): {
@@ -402,6 +498,37 @@ export declare function createFieldConditionals(fieldId: string): {
402
498
  * )
403
499
  */
404
500
  object: (options: Record<string, any>) => JSONSchema;
501
+ /**
502
+ * Custom client-side validator. The provided function is serialised and executed
503
+ * just-in-time on the client only. External references (e.g. lodash) are not
504
+ * available inside the function body — all logic must be self-contained.
505
+ *
506
+ * @example
507
+ * field('nid').customClientValidator((value) => {
508
+ * // LUHN check — all logic must be inline
509
+ * const digits = String(value).split('').map(Number)
510
+ * // ...
511
+ * return isValid
512
+ * })
513
+ */
514
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
515
+ /**
516
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
517
+ * that can be used as the `value` property or a DATA component entry.
518
+ * The function receives the referenced field's value as the first argument and
519
+ * the full form context as the second; its return value replaces the field reference.
520
+ * The function is serialised and executed just-in-time on the client only.
521
+ * External references (e.g. lodash) are not available inside the function body.
522
+ *
523
+ * For computing a default value without referencing a specific field, use
524
+ * `evaluate(fn)` in the `defaultValue` property instead.
525
+ *
526
+ * @example
527
+ * field('a').customClientEvaluation((aValue, ctx) =>
528
+ * Number(aValue) + Number(ctx.$form.b)
529
+ * )
530
+ */
531
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
405
532
  };
406
533
  asAge(): {
407
534
  $$subfield: string[];
@@ -469,6 +596,37 @@ export declare function createFieldConditionals(fieldId: string): {
469
596
  * )
470
597
  */
471
598
  object: (options: Record<string, any>) => JSONSchema;
599
+ /**
600
+ * Custom client-side validator. The provided function is serialised and executed
601
+ * just-in-time on the client only. External references (e.g. lodash) are not
602
+ * available inside the function body — all logic must be self-contained.
603
+ *
604
+ * @example
605
+ * field('nid').customClientValidator((value) => {
606
+ * // LUHN check — all logic must be inline
607
+ * const digits = String(value).split('').map(Number)
608
+ * // ...
609
+ * return isValid
610
+ * })
611
+ */
612
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
613
+ /**
614
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
615
+ * that can be used as the `value` property or a DATA component entry.
616
+ * The function receives the referenced field's value as the first argument and
617
+ * the full form context as the second; its return value replaces the field reference.
618
+ * The function is serialised and executed just-in-time on the client only.
619
+ * External references (e.g. lodash) are not available inside the function body.
620
+ *
621
+ * For computing a default value without referencing a specific field, use
622
+ * `evaluate(fn)` in the `defaultValue` property instead.
623
+ *
624
+ * @example
625
+ * field('a').customClientEvaluation((aValue, ctx) =>
626
+ * Number(aValue) + Number(ctx.$form.b)
627
+ * )
628
+ */
629
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
472
630
  };
473
631
  isAfter(): {
474
632
  days: (days: number) => {
@@ -526,6 +684,37 @@ export declare function createFieldConditionals(fieldId: string): {
526
684
  * )
527
685
  */
528
686
  object: (options: Record<string, any>) => JSONSchema;
687
+ /**
688
+ * Custom client-side validator. The provided function is serialised and executed
689
+ * just-in-time on the client only. External references (e.g. lodash) are not
690
+ * available inside the function body — all logic must be self-contained.
691
+ *
692
+ * @example
693
+ * field('nid').customClientValidator((value) => {
694
+ * // LUHN check — all logic must be inline
695
+ * const digits = String(value).split('').map(Number)
696
+ * // ...
697
+ * return isValid
698
+ * })
699
+ */
700
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
701
+ /**
702
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
703
+ * that can be used as the `value` property or a DATA component entry.
704
+ * The function receives the referenced field's value as the first argument and
705
+ * the full form context as the second; its return value replaces the field reference.
706
+ * The function is serialised and executed just-in-time on the client only.
707
+ * External references (e.g. lodash) are not available inside the function body.
708
+ *
709
+ * For computing a default value without referencing a specific field, use
710
+ * `evaluate(fn)` in the `defaultValue` property instead.
711
+ *
712
+ * @example
713
+ * field('a').customClientEvaluation((aValue, ctx) =>
714
+ * Number(aValue) + Number(ctx.$form.b)
715
+ * )
716
+ */
717
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
529
718
  };
530
719
  asDob(): {
531
720
  $$subfield: string[];
@@ -600,6 +789,37 @@ export declare function createFieldConditionals(fieldId: string): {
600
789
  * )
601
790
  */
602
791
  object: (options: Record<string, any>) => JSONSchema;
792
+ /**
793
+ * Custom client-side validator. The provided function is serialised and executed
794
+ * just-in-time on the client only. External references (e.g. lodash) are not
795
+ * available inside the function body — all logic must be self-contained.
796
+ *
797
+ * @example
798
+ * field('nid').customClientValidator((value) => {
799
+ * // LUHN check — all logic must be inline
800
+ * const digits = String(value).split('').map(Number)
801
+ * // ...
802
+ * return isValid
803
+ * })
804
+ */
805
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
806
+ /**
807
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
808
+ * that can be used as the `value` property or a DATA component entry.
809
+ * The function receives the referenced field's value as the first argument and
810
+ * the full form context as the second; its return value replaces the field reference.
811
+ * The function is serialised and executed just-in-time on the client only.
812
+ * External references (e.g. lodash) are not available inside the function body.
813
+ *
814
+ * For computing a default value without referencing a specific field, use
815
+ * `evaluate(fn)` in the `defaultValue` property instead.
816
+ *
817
+ * @example
818
+ * field('a').customClientEvaluation((aValue, ctx) =>
819
+ * Number(aValue) + Number(ctx.$form.b)
820
+ * )
821
+ */
822
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
603
823
  };
604
824
  asDob(): any;
605
825
  asAge(): any;
@@ -659,6 +879,37 @@ export declare function createFieldConditionals(fieldId: string): {
659
879
  * )
660
880
  */
661
881
  object: (options: Record<string, any>) => JSONSchema;
882
+ /**
883
+ * Custom client-side validator. The provided function is serialised and executed
884
+ * just-in-time on the client only. External references (e.g. lodash) are not
885
+ * available inside the function body — all logic must be self-contained.
886
+ *
887
+ * @example
888
+ * field('nid').customClientValidator((value) => {
889
+ * // LUHN check — all logic must be inline
890
+ * const digits = String(value).split('').map(Number)
891
+ * // ...
892
+ * return isValid
893
+ * })
894
+ */
895
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
896
+ /**
897
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
898
+ * that can be used as the `value` property or a DATA component entry.
899
+ * The function receives the referenced field's value as the first argument and
900
+ * the full form context as the second; its return value replaces the field reference.
901
+ * The function is serialised and executed just-in-time on the client only.
902
+ * External references (e.g. lodash) are not available inside the function body.
903
+ *
904
+ * For computing a default value without referencing a specific field, use
905
+ * `evaluate(fn)` in the `defaultValue` property instead.
906
+ *
907
+ * @example
908
+ * field('a').customClientEvaluation((aValue, ctx) =>
909
+ * Number(aValue) + Number(ctx.$form.b)
910
+ * )
911
+ */
912
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
662
913
  };
663
914
  asAge(): {
664
915
  $$subfield: string[];
@@ -733,6 +984,37 @@ export declare function createFieldConditionals(fieldId: string): {
733
984
  * )
734
985
  */
735
986
  object: (options: Record<string, any>) => JSONSchema;
987
+ /**
988
+ * Custom client-side validator. The provided function is serialised and executed
989
+ * just-in-time on the client only. External references (e.g. lodash) are not
990
+ * available inside the function body — all logic must be self-contained.
991
+ *
992
+ * @example
993
+ * field('nid').customClientValidator((value) => {
994
+ * // LUHN check — all logic must be inline
995
+ * const digits = String(value).split('').map(Number)
996
+ * // ...
997
+ * return isValid
998
+ * })
999
+ */
1000
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
1001
+ /**
1002
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1003
+ * that can be used as the `value` property or a DATA component entry.
1004
+ * The function receives the referenced field's value as the first argument and
1005
+ * the full form context as the second; its return value replaces the field reference.
1006
+ * The function is serialised and executed just-in-time on the client only.
1007
+ * External references (e.g. lodash) are not available inside the function body.
1008
+ *
1009
+ * For computing a default value without referencing a specific field, use
1010
+ * `evaluate(fn)` in the `defaultValue` property instead.
1011
+ *
1012
+ * @example
1013
+ * field('a').customClientEvaluation((aValue, ctx) =>
1014
+ * Number(aValue) + Number(ctx.$form.b)
1015
+ * )
1016
+ */
1017
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
736
1018
  };
737
1019
  asDob(): any;
738
1020
  asAge(): any;
@@ -792,6 +1074,37 @@ export declare function createFieldConditionals(fieldId: string): {
792
1074
  * )
793
1075
  */
794
1076
  object: (options: Record<string, any>) => JSONSchema;
1077
+ /**
1078
+ * Custom client-side validator. The provided function is serialised and executed
1079
+ * just-in-time on the client only. External references (e.g. lodash) are not
1080
+ * available inside the function body — all logic must be self-contained.
1081
+ *
1082
+ * @example
1083
+ * field('nid').customClientValidator((value) => {
1084
+ * // LUHN check — all logic must be inline
1085
+ * const digits = String(value).split('').map(Number)
1086
+ * // ...
1087
+ * return isValid
1088
+ * })
1089
+ */
1090
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
1091
+ /**
1092
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1093
+ * that can be used as the `value` property or a DATA component entry.
1094
+ * The function receives the referenced field's value as the first argument and
1095
+ * the full form context as the second; its return value replaces the field reference.
1096
+ * The function is serialised and executed just-in-time on the client only.
1097
+ * External references (e.g. lodash) are not available inside the function body.
1098
+ *
1099
+ * For computing a default value without referencing a specific field, use
1100
+ * `evaluate(fn)` in the `defaultValue` property instead.
1101
+ *
1102
+ * @example
1103
+ * field('a').customClientEvaluation((aValue, ctx) =>
1104
+ * Number(aValue) + Number(ctx.$form.b)
1105
+ * )
1106
+ */
1107
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
795
1108
  };
796
1109
  isAfter(): {
797
1110
  days: (days: number) => {
@@ -849,6 +1162,37 @@ export declare function createFieldConditionals(fieldId: string): {
849
1162
  * )
850
1163
  */
851
1164
  object: (options: Record<string, any>) => JSONSchema;
1165
+ /**
1166
+ * Custom client-side validator. The provided function is serialised and executed
1167
+ * just-in-time on the client only. External references (e.g. lodash) are not
1168
+ * available inside the function body — all logic must be self-contained.
1169
+ *
1170
+ * @example
1171
+ * field('nid').customClientValidator((value) => {
1172
+ * // LUHN check — all logic must be inline
1173
+ * const digits = String(value).split('').map(Number)
1174
+ * // ...
1175
+ * return isValid
1176
+ * })
1177
+ */
1178
+ customClientValidator(validationFn: (fieldValue: unknown, context: ClientFunctionContext) => boolean): JSONSchema;
1179
+ /**
1180
+ * Custom client-side evaluation. Returns a {@link FieldReference} descriptor
1181
+ * that can be used as the `value` property or a DATA component entry.
1182
+ * The function receives the referenced field's value as the first argument and
1183
+ * the full form context as the second; its return value replaces the field reference.
1184
+ * The function is serialised and executed just-in-time on the client only.
1185
+ * External references (e.g. lodash) are not available inside the function body.
1186
+ *
1187
+ * For computing a default value without referencing a specific field, use
1188
+ * `evaluate(fn)` in the `defaultValue` property instead.
1189
+ *
1190
+ * @example
1191
+ * field('a').customClientEvaluation((aValue, ctx) =>
1192
+ * Number(aValue) + Number(ctx.$form.b)
1193
+ * )
1194
+ */
1195
+ customClientEvaluation(computationFn: (fieldValue: unknown, context: ClientFunctionContext) => unknown): CodeToEvaluate;
852
1196
  };
853
1197
  export {};
854
1198
  //# sourceMappingURL=conditionals.d.ts.map