@opencrvs/toolkit 1.8.0-rc.fd754eb → 1.8.0-rc.fe87a15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commons/api/router.d.ts +7904 -3728
- package/dist/commons/conditionals/conditionals.d.ts +7 -6
- package/dist/commons/events/ActionConfig.d.ts +22281 -7289
- package/dist/commons/events/ActionDocument.d.ts +533 -346
- package/dist/commons/events/ActionInput.d.ts +197 -125
- package/dist/commons/events/AdvancedSearchConfig.d.ts +603 -12
- package/dist/commons/events/Constants.d.ts +2 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +2982 -0
- package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
- package/dist/commons/events/Draft.d.ts +29 -24
- package/dist/commons/events/EventConfig.d.ts +17241 -9571
- package/dist/commons/events/EventDocument.d.ts +386 -267
- package/dist/commons/events/EventIndex.d.ts +316 -323
- package/dist/commons/events/EventInput.d.ts +0 -13
- package/dist/commons/events/EventMetadata.d.ts +72 -48
- package/dist/commons/events/FieldConfig.d.ts +991 -428
- package/dist/commons/events/FieldTypeMapping.d.ts +5 -2
- package/dist/commons/events/FieldValue.d.ts +2 -0
- package/dist/commons/events/FormConfig.d.ts +7190 -3722
- package/dist/commons/events/PageConfig.d.ts +1512 -660
- package/dist/commons/events/User.d.ts +31 -7
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
- package/dist/commons/events/WorkqueueConfig.d.ts +4033 -644
- package/dist/commons/events/defineConfig.d.ts +1632 -574
- package/dist/commons/events/event.d.ts +37 -10
- package/dist/commons/events/field.d.ts +25 -20
- package/dist/commons/events/index.d.ts +4 -0
- package/dist/commons/events/scopes.d.ts +20 -1
- package/dist/commons/events/serializer.d.ts +2 -0
- package/dist/commons/events/test.utils.d.ts +28 -7
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +443 -291
- package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
- package/dist/conditionals/index.js +28 -8
- package/dist/events/index.js +2024 -733
- package/dist/scopes/index.d.ts +94 -6
- package/dist/scopes/index.js +42 -21
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
30
30
|
// src/events/index.ts
|
31
31
|
var events_exports = {};
|
32
32
|
__export(events_exports, {
|
33
|
+
ACTION_ALLOWED_CONFIGURABLE_SCOPES: () => ACTION_ALLOWED_CONFIGURABLE_SCOPES,
|
33
34
|
ACTION_ALLOWED_SCOPES: () => ACTION_ALLOWED_SCOPES,
|
34
35
|
Action: () => Action,
|
35
36
|
ActionBase: () => ActionBase,
|
@@ -49,11 +50,14 @@ __export(events_exports, {
|
|
49
50
|
AddressType: () => AddressType,
|
50
51
|
AdministrativeAreas: () => AdministrativeAreas,
|
51
52
|
AdvancedSearchConfig: () => AdvancedSearchConfig,
|
53
|
+
AnyOf: () => AnyOf,
|
54
|
+
AnyOfStatus: () => AnyOfStatus,
|
52
55
|
ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
|
53
56
|
ArchiveActionInput: () => ArchiveActionInput,
|
54
57
|
AssignActionInput: () => AssignActionInput,
|
55
58
|
AsyncRejectActionDocument: () => AsyncRejectActionDocument,
|
56
59
|
BaseActionInput: () => BaseActionInput,
|
60
|
+
BearerTokenByUserType: () => BearerTokenByUserType,
|
57
61
|
CONFIG_GET_ALLOWED_SCOPES: () => CONFIG_GET_ALLOWED_SCOPES,
|
58
62
|
CONFIG_SEARCH_ALLOWED_SCOPES: () => CONFIG_SEARCH_ALLOWED_SCOPES,
|
59
63
|
CertificateConfig: () => CertificateConfig,
|
@@ -67,6 +71,7 @@ __export(events_exports, {
|
|
67
71
|
DEFAULT_DATE_OF_EVENT_PROPERTY: () => DEFAULT_DATE_OF_EVENT_PROPERTY,
|
68
72
|
DataEntry: () => DataEntry,
|
69
73
|
DataFieldValue: () => DataFieldValue,
|
74
|
+
DateCondition: () => DateCondition,
|
70
75
|
DateRangeFieldValue: () => DateRangeFieldValue,
|
71
76
|
DateValue: () => DateValue,
|
72
77
|
DatetimeValue: () => DatetimeValue,
|
@@ -92,14 +97,18 @@ __export(events_exports, {
|
|
92
97
|
EventInput: () => EventInput,
|
93
98
|
EventMetadata: () => EventMetadata,
|
94
99
|
EventMetadataKeys: () => EventMetadataKeys,
|
95
|
-
|
100
|
+
EventMetadataKeysArray: () => EventMetadataKeysArray,
|
96
101
|
EventSearchIndex: () => EventSearchIndex,
|
97
102
|
EventState: () => EventState,
|
98
103
|
EventStatus: () => EventStatus,
|
104
|
+
EventStatusEnum: () => EventStatusEnum,
|
99
105
|
EventStatuses: () => EventStatuses,
|
106
|
+
Exact: () => Exact,
|
107
|
+
ExactStatus: () => ExactStatus,
|
100
108
|
FieldConditional: () => FieldConditional,
|
101
109
|
FieldConfig: () => FieldConfig,
|
102
110
|
FieldConfigSchema: () => FieldConfigSchema,
|
111
|
+
FieldReference: () => FieldReference,
|
103
112
|
FieldType: () => FieldType,
|
104
113
|
FieldUpdateValue: () => FieldUpdateValue,
|
105
114
|
FieldValue: () => FieldValue,
|
@@ -109,6 +118,7 @@ __export(events_exports, {
|
|
109
118
|
Flag: () => Flag,
|
110
119
|
FormConfig: () => FormConfig,
|
111
120
|
FormPageConfig: () => FormPageConfig,
|
121
|
+
Fuzzy: () => Fuzzy,
|
112
122
|
GenericAddressUpdateValue: () => GenericAddressUpdateValue,
|
113
123
|
GenericAddressValue: () => GenericAddressValue,
|
114
124
|
GeographicalArea: () => GeographicalArea,
|
@@ -118,36 +128,52 @@ __export(events_exports, {
|
|
118
128
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
119
129
|
MimeType: () => MimeType,
|
120
130
|
NonEmptyTextValue: () => NonEmptyTextValue,
|
131
|
+
Not: () => Not,
|
121
132
|
NotifyActionInput: () => NotifyActionInput,
|
122
133
|
NumberFieldValue: () => NumberFieldValue,
|
123
134
|
PageConfig: () => PageConfig,
|
124
135
|
PageTypes: () => PageTypes,
|
125
136
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
137
|
+
QueryExpression: () => QueryExpression,
|
126
138
|
QueryInput: () => QueryInput,
|
127
139
|
QueryType: () => QueryType,
|
140
|
+
Range: () => Range,
|
128
141
|
ReadActionInput: () => ReadActionInput,
|
129
142
|
RegisterAction: () => RegisterAction,
|
130
143
|
RegisterActionInput: () => RegisterActionInput,
|
131
144
|
RegistrationCreationMetadata: () => RegistrationCreationMetadata,
|
132
145
|
RejectCorrectionActionInput: () => RejectCorrectionActionInput,
|
133
146
|
RejectDeclarationActionInput: () => RejectDeclarationActionInput,
|
147
|
+
RejectionReason: () => RejectionReason,
|
134
148
|
RequestCorrectionActionInput: () => RequestCorrectionActionInput,
|
135
149
|
ResolvedUser: () => ResolvedUser,
|
136
150
|
RuralAddressUpdateValue: () => RuralAddressUpdateValue,
|
137
151
|
RuralAddressValue: () => RuralAddressValue,
|
138
152
|
SearchField: () => SearchField,
|
153
|
+
SearchQueryParams: () => SearchQueryParams,
|
139
154
|
SelectOption: () => SelectOption,
|
140
155
|
ShowConditional: () => ShowConditional,
|
156
|
+
SignatureFieldValue: () => SignatureFieldValue,
|
141
157
|
SummaryConfig: () => SummaryConfig,
|
158
|
+
TENNIS_CLUB_MEMBERSHIP: () => TENNIS_CLUB_MEMBERSHIP,
|
142
159
|
TextValue: () => TextValue,
|
143
160
|
TranslationConfig: () => TranslationConfig,
|
144
161
|
UnassignActionInput: () => UnassignActionInput,
|
145
162
|
UrbanAddressUpdateValue: () => UrbanAddressUpdateValue,
|
146
163
|
UrbanAddressValue: () => UrbanAddressValue,
|
164
|
+
User: () => User,
|
147
165
|
ValidateActionInput: () => ValidateActionInput,
|
148
166
|
VerificationActionConfig: () => VerificationActionConfig,
|
149
167
|
VerificationPageConfig: () => VerificationPageConfig,
|
168
|
+
Within: () => Within,
|
169
|
+
WorkqueueColumn: () => WorkqueueColumn,
|
170
|
+
WorkqueueColumnKeys: () => WorkqueueColumnKeys,
|
171
|
+
WorkqueueColumnKeysArray: () => WorkqueueColumnKeysArray,
|
172
|
+
WorkqueueColumnValue: () => WorkqueueColumnValue,
|
150
173
|
WorkqueueConfig: () => WorkqueueConfig,
|
174
|
+
WorkqueueConfigInput: () => WorkqueueConfigInput,
|
175
|
+
WorkqueueCountInput: () => WorkqueueCountInput,
|
176
|
+
WorkqueueCountOutput: () => WorkqueueCountOutput,
|
151
177
|
ZodDate: () => ZodDate,
|
152
178
|
alwaysTrue: () => alwaysTrue,
|
153
179
|
and: () => and,
|
@@ -158,9 +184,12 @@ __export(events_exports, {
|
|
158
184
|
createEmptyDraft: () => createEmptyDraft,
|
159
185
|
createEventConditionals: () => createEventConditionals,
|
160
186
|
createFieldConditionals: () => createFieldConditionals,
|
187
|
+
createPseudoRandomNumberGenerator: () => createPseudoRandomNumberGenerator,
|
161
188
|
createValidationSchema: () => createValidationSchema,
|
189
|
+
dateOfEventColumn: () => dateOfEventColumn,
|
162
190
|
deepDropNulls: () => deepDropNulls,
|
163
191
|
deepMerge: () => deepMerge,
|
192
|
+
defaultWorkqueueColumns: () => defaultWorkqueueColumns,
|
164
193
|
defineActionForm: () => defineActionForm,
|
165
194
|
defineConditional: () => defineConditional,
|
166
195
|
defineConfig: () => defineConfig,
|
@@ -169,6 +198,9 @@ __export(events_exports, {
|
|
169
198
|
defineFormPage: () => defineFormPage,
|
170
199
|
definePage: () => definePage,
|
171
200
|
defineWorkqueue: () => defineWorkqueue,
|
201
|
+
defineWorkqueues: () => defineWorkqueues,
|
202
|
+
defineWorkqueuesColumns: () => defineWorkqueuesColumns,
|
203
|
+
deserializeQuery: () => deserializeQuery,
|
172
204
|
errorMessages: () => errorMessages,
|
173
205
|
event: () => event,
|
174
206
|
eventMetadataLabelMap: () => eventMetadataLabelMap,
|
@@ -187,8 +219,10 @@ __export(events_exports, {
|
|
187
219
|
generateActionDocument: () => generateActionDocument,
|
188
220
|
generateEventDocument: () => generateEventDocument,
|
189
221
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
222
|
+
generateRandomSignature: () => generateRandomSignature,
|
190
223
|
generateTransactionId: () => generateTransactionId,
|
191
224
|
generateTranslationConfig: () => generateTranslationConfig,
|
225
|
+
generateWorkqueues: () => generateWorkqueues,
|
192
226
|
getAcceptedActions: () => getAcceptedActions,
|
193
227
|
getActionAnnotation: () => getActionAnnotation,
|
194
228
|
getActionAnnotationFields: () => getActionAnnotationFields,
|
@@ -197,12 +231,15 @@ __export(events_exports, {
|
|
197
231
|
getActionVerificationPageIds: () => getActionVerificationPageIds,
|
198
232
|
getAnnotationFromDrafts: () => getAnnotationFromDrafts,
|
199
233
|
getAssignedUserFromActions: () => getAssignedUserFromActions,
|
234
|
+
getAssignedUserSignatureFromActions: () => getAssignedUserSignatureFromActions,
|
200
235
|
getCurrentEventState: () => getCurrentEventState,
|
201
236
|
getCurrentEventStateWithDrafts: () => getCurrentEventStateWithDrafts,
|
202
237
|
getDeclaration: () => getDeclaration,
|
203
238
|
getDeclarationFields: () => getDeclarationFields,
|
204
239
|
getDeclarationPages: () => getDeclarationPages,
|
205
240
|
getMixedPath: () => getMixedPath,
|
241
|
+
getRandomDatetime: () => getRandomDatetime,
|
242
|
+
getStatusFromActions: () => getStatusFromActions,
|
206
243
|
getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
|
207
244
|
hasAnyOfScopes: () => hasAnyOfScopes,
|
208
245
|
isAddressFieldType: () => isAddressFieldType,
|
@@ -226,6 +263,7 @@ __export(events_exports, {
|
|
226
263
|
isFileFieldType: () => isFileFieldType,
|
227
264
|
isFileFieldWithOptionType: () => isFileFieldWithOptionType,
|
228
265
|
isLocationFieldType: () => isLocationFieldType,
|
266
|
+
isNonInteractiveFieldType: () => isNonInteractiveFieldType,
|
229
267
|
isNumberFieldType: () => isNumberFieldType,
|
230
268
|
isOfficeFieldType: () => isOfficeFieldType,
|
231
269
|
isPageHeaderFieldType: () => isPageHeaderFieldType,
|
@@ -257,14 +295,20 @@ __export(events_exports, {
|
|
257
295
|
});
|
258
296
|
module.exports = __toCommonJS(events_exports);
|
259
297
|
|
298
|
+
// ../commons/src/events/Constants.ts
|
299
|
+
var TENNIS_CLUB_MEMBERSHIP = "tennis-club-membership";
|
300
|
+
|
260
301
|
// ../commons/src/events/ActionConfig.ts
|
261
302
|
var import_zod9 = require("zod");
|
262
303
|
|
263
304
|
// ../commons/src/events/Conditional.ts
|
264
305
|
var import_zod = require("zod");
|
265
|
-
var
|
266
|
-
|
267
|
-
)
|
306
|
+
var import_zod_openapi = require("zod-openapi");
|
307
|
+
(0, import_zod_openapi.extendZodWithOpenApi)(import_zod.z);
|
308
|
+
var Conditional = import_zod.z.custom((val) => typeof val === "object" && val !== null).openapi({
|
309
|
+
description: "JSON schema conditional configuration",
|
310
|
+
ref: "Conditional"
|
311
|
+
});
|
268
312
|
var ConditionalType = {
|
269
313
|
SHOW: "SHOW",
|
270
314
|
ENABLE: "ENABLE",
|
@@ -301,7 +345,10 @@ var FieldConditional = import_zod.z.discriminatedUnion("type", [
|
|
301
345
|
EnableConditional,
|
302
346
|
// Field output can be shown / hidden on the review page
|
303
347
|
DisplayOnReviewConditional
|
304
|
-
])
|
348
|
+
]).openapi({
|
349
|
+
description: "Field conditional configuration",
|
350
|
+
ref: "FieldConditional"
|
351
|
+
});
|
305
352
|
|
306
353
|
// ../commons/src/events/PageConfig.ts
|
307
354
|
var import_zod6 = require("zod");
|
@@ -311,6 +358,8 @@ var import_zod5 = require("zod");
|
|
311
358
|
|
312
359
|
// ../commons/src/events/TranslationConfig.ts
|
313
360
|
var import_zod2 = require("zod");
|
361
|
+
var import_zod_openapi2 = require("zod-openapi");
|
362
|
+
(0, import_zod_openapi2.extendZodWithOpenApi)(import_zod2.z);
|
314
363
|
var TranslationConfig = import_zod2.z.object({
|
315
364
|
id: import_zod2.z.string().describe(
|
316
365
|
"The identifier of the translation referred in translation CSV files"
|
@@ -319,6 +368,9 @@ var TranslationConfig = import_zod2.z.object({
|
|
319
368
|
description: import_zod2.z.string().describe(
|
320
369
|
"Describe the translation for a translator to be able to identify it."
|
321
370
|
)
|
371
|
+
}).openapi({
|
372
|
+
description: "Translation configuration",
|
373
|
+
ref: "TranslationConfig"
|
322
374
|
});
|
323
375
|
|
324
376
|
// ../commons/src/events/FieldType.ts
|
@@ -448,6 +500,7 @@ var EmailValue = import_zod4.z.string().email();
|
|
448
500
|
var CheckboxFieldValue = import_zod4.z.boolean();
|
449
501
|
var NumberFieldValue = import_zod4.z.number();
|
450
502
|
var DataFieldValue = import_zod4.z.undefined();
|
503
|
+
var SignatureFieldValue = import_zod4.z.string();
|
451
504
|
var FieldValue = import_zod4.z.union([
|
452
505
|
TextValue,
|
453
506
|
DateValue,
|
@@ -476,19 +529,15 @@ var FieldUpdateValue = import_zod4.z.union([
|
|
476
529
|
]);
|
477
530
|
|
478
531
|
// ../commons/src/events/FieldConfig.ts
|
479
|
-
var
|
480
|
-
|
481
|
-
|
482
|
-
|
532
|
+
var import_zod_openapi3 = require("zod-openapi");
|
533
|
+
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod5.z);
|
534
|
+
var FieldId = import_zod5.z.string().describe("Unique identifier for the field");
|
535
|
+
var FieldReference = import_zod5.z.object({
|
536
|
+
$$field: FieldId
|
537
|
+
}).describe("Reference to a field by its ID");
|
538
|
+
var ParentReference = FieldReference.optional();
|
483
539
|
var BaseField = import_zod5.z.object({
|
484
540
|
id: FieldId,
|
485
|
-
defaultValue: import_zod5.z.union([
|
486
|
-
TextValue,
|
487
|
-
NonEmptyTextValue,
|
488
|
-
DateValue,
|
489
|
-
NumberFieldValue,
|
490
|
-
CheckboxFieldValue
|
491
|
-
]).optional(),
|
492
541
|
parent: ParentReference,
|
493
542
|
conditionals: import_zod5.z.array(FieldConditional).default([]).optional(),
|
494
543
|
required: import_zod5.z.boolean().default(false).optional(),
|
@@ -500,6 +549,7 @@ var BaseField = import_zod5.z.object({
|
|
500
549
|
})
|
501
550
|
).default([]).optional(),
|
502
551
|
label: TranslationConfig,
|
552
|
+
helperText: TranslationConfig.optional(),
|
503
553
|
hideLabel: import_zod5.z.boolean().default(false).optional()
|
504
554
|
});
|
505
555
|
var Divider = BaseField.extend({
|
@@ -549,6 +599,7 @@ var SignatureField = BaseField.extend({
|
|
549
599
|
signaturePromptLabel: TranslationConfig.describe(
|
550
600
|
"Title of the signature modal"
|
551
601
|
),
|
602
|
+
defaultValue: SignatureFieldValue.optional(),
|
552
603
|
configuration: import_zod5.z.object({
|
553
604
|
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
554
605
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
@@ -608,6 +659,7 @@ var PageHeader = BaseField.extend({
|
|
608
659
|
}).describe("A read-only header component for form pages");
|
609
660
|
var File = BaseField.extend({
|
610
661
|
type: import_zod5.z.literal(FieldType.FILE),
|
662
|
+
defaultValue: FileFieldValue.optional(),
|
611
663
|
configuration: import_zod5.z.object({
|
612
664
|
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
613
665
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature"),
|
@@ -681,6 +733,7 @@ var Location = BaseField.extend({
|
|
681
733
|
var FileUploadWithOptions = BaseField.extend({
|
682
734
|
type: import_zod5.z.literal(FieldType.FILE_WITH_OPTIONS),
|
683
735
|
options: import_zod5.z.array(SelectOption).describe("A list of options"),
|
736
|
+
defaultValue: FileFieldWithOptionValue.optional(),
|
684
737
|
configuration: import_zod5.z.object({
|
685
738
|
maxFileSize: import_zod5.z.number().describe("Maximum file size in bytes").default(DEFAULT_MAX_FILE_SIZE_BYTES),
|
686
739
|
acceptedFileTypes: MimeType.array().optional().describe("List of allowed file formats for the signature")
|
@@ -740,9 +793,14 @@ var FieldConfig = import_zod5.z.discriminatedUnion("type", [
|
|
740
793
|
EmailField,
|
741
794
|
FileUploadWithOptions,
|
742
795
|
DataField
|
743
|
-
])
|
796
|
+
]).openapi({
|
797
|
+
description: "Form field configuration",
|
798
|
+
ref: "FieldConfig"
|
799
|
+
});
|
744
800
|
|
745
801
|
// ../commons/src/events/PageConfig.ts
|
802
|
+
var import_zod_openapi4 = require("zod-openapi");
|
803
|
+
(0, import_zod_openapi4.extendZodWithOpenApi)(import_zod6.z);
|
746
804
|
var PageTypes = import_zod6.z.enum(["FORM", "VERIFICATION"]);
|
747
805
|
var PageConfigBase = import_zod6.z.object({
|
748
806
|
id: import_zod6.z.string().describe("Unique identifier for the page"),
|
@@ -751,6 +809,9 @@ var PageConfigBase = import_zod6.z.object({
|
|
751
809
|
conditional: Conditional.optional().describe(
|
752
810
|
"Page will be shown if condition is met. If conditional is not defined, the page will be always shown."
|
753
811
|
)
|
812
|
+
}).openapi({
|
813
|
+
description: "Form page configuration",
|
814
|
+
ref: "FormPageConfig"
|
754
815
|
});
|
755
816
|
var FormPageConfig = PageConfigBase.extend({
|
756
817
|
type: import_zod6.z.literal(PageTypes.enum.FORM).default(PageTypes.enum.FORM)
|
@@ -764,7 +825,10 @@ var VerificationActionConfig = import_zod6.z.object({
|
|
764
825
|
body: TranslationConfig
|
765
826
|
})
|
766
827
|
})
|
767
|
-
}).describe("Actions available on the verification page")
|
828
|
+
}).describe("Actions available on the verification page").openapi({
|
829
|
+
description: "Verification action configuration",
|
830
|
+
ref: "VerificationActionConfig"
|
831
|
+
});
|
768
832
|
var VerificationPageConfig = FormPageConfig.extend({
|
769
833
|
type: import_zod6.z.literal(PageTypes.enum.VERIFICATION),
|
770
834
|
actions: VerificationActionConfig
|
@@ -864,8 +928,8 @@ var ActionFormConfig = import_zod8.z.object({
|
|
864
928
|
var FormConfig = import_zod8.z.union([DeclarationFormConfig, ActionFormConfig]);
|
865
929
|
|
866
930
|
// ../commons/src/events/ActionConfig.ts
|
867
|
-
var
|
868
|
-
(0,
|
931
|
+
var import_zod_openapi5 = require("zod-openapi");
|
932
|
+
(0, import_zod_openapi5.extendZodWithOpenApi)(import_zod9.z);
|
869
933
|
var ActionConditional2 = import_zod9.z.discriminatedUnion("type", [
|
870
934
|
/** If conditional is defined, the action is shown to the user only if the condition is met */
|
871
935
|
ShowConditional,
|
@@ -881,6 +945,12 @@ var ActionConfigBase = import_zod9.z.object({
|
|
881
945
|
conditionals: import_zod9.z.array(ActionConditional2).optional().default([]),
|
882
946
|
draft: import_zod9.z.boolean().optional()
|
883
947
|
});
|
948
|
+
var ReadActionConfig = ActionConfigBase.merge(
|
949
|
+
import_zod9.z.object({
|
950
|
+
type: import_zod9.z.literal(ActionType.READ),
|
951
|
+
review: DeclarationReviewConfig
|
952
|
+
})
|
953
|
+
);
|
884
954
|
var DeclareConfig = ActionConfigBase.merge(
|
885
955
|
import_zod9.z.object({
|
886
956
|
type: import_zod9.z.literal(ActionType.DECLARE),
|
@@ -947,6 +1017,7 @@ var ActionConfig = import_zod9.z.discriminatedUnion("type", [
|
|
947
1017
|
* OpenAPI references are defined here so our generated OpenAPI spec knows to reuse the models
|
948
1018
|
* and treat them as "models" instead of duplicating the data structure in each endpoint.
|
949
1019
|
*/
|
1020
|
+
ReadActionConfig.openapi({ ref: "ReadActionConfig" }),
|
950
1021
|
DeclareConfig.openapi({ ref: "DeclareActionConfig" }),
|
951
1022
|
ValidateConfig.openapi({ ref: "ValidateActionConfig" }),
|
952
1023
|
RejectDeclarationConfig.openapi({ ref: "RejectDeclarationActionConfig" }),
|
@@ -1004,13 +1075,13 @@ var LanguageConfig = import_zod11.z.object({
|
|
1004
1075
|
});
|
1005
1076
|
|
1006
1077
|
// ../commons/src/events/EventConfig.ts
|
1007
|
-
var
|
1078
|
+
var import_zod18 = require("zod");
|
1008
1079
|
|
1009
1080
|
// ../commons/src/events/DeduplicationConfig.ts
|
1010
1081
|
var import_zod12 = require("zod");
|
1011
|
-
var
|
1012
|
-
(0,
|
1013
|
-
var
|
1082
|
+
var import_zod_openapi6 = require("zod-openapi");
|
1083
|
+
(0, import_zod_openapi6.extendZodWithOpenApi)(import_zod12.z);
|
1084
|
+
var FieldReference2 = import_zod12.z.string();
|
1014
1085
|
var Matcher = import_zod12.z.object({
|
1015
1086
|
fieldId: import_zod12.z.string(),
|
1016
1087
|
options: import_zod12.z.object({
|
@@ -1039,7 +1110,7 @@ var DateRangeMatcher = Matcher.extend({
|
|
1039
1110
|
type: import_zod12.z.literal("dateRange"),
|
1040
1111
|
options: import_zod12.z.object({
|
1041
1112
|
days: import_zod12.z.number(),
|
1042
|
-
origin:
|
1113
|
+
origin: FieldReference2,
|
1043
1114
|
boost: import_zod12.z.number().optional().default(1)
|
1044
1115
|
})
|
1045
1116
|
});
|
@@ -1047,7 +1118,7 @@ var DateDistanceMatcher = Matcher.extend({
|
|
1047
1118
|
type: import_zod12.z.literal("dateDistance"),
|
1048
1119
|
options: import_zod12.z.object({
|
1049
1120
|
days: import_zod12.z.number(),
|
1050
|
-
origin:
|
1121
|
+
origin: FieldReference2,
|
1051
1122
|
boost: import_zod12.z.number().optional().default(1)
|
1052
1123
|
})
|
1053
1124
|
});
|
@@ -1110,13 +1181,58 @@ var BaseField3 = import_zod14.z.object({
|
|
1110
1181
|
config: import_zod14.z.object({
|
1111
1182
|
type: MatchType.describe("Determines the type of field")
|
1112
1183
|
}),
|
1113
|
-
options: import_zod14.z.array(SelectOption).optional()
|
1184
|
+
options: import_zod14.z.array(SelectOption).optional(),
|
1185
|
+
searchCriteriaLabelPrefix: TranslationConfig.optional().describe(
|
1186
|
+
`
|
1187
|
+
This property determines whether to add a prefix (such as "Child" or "Applicant") before the field label
|
1188
|
+
when rendering search parameter labels \u2014 for example, in the search results page to indicate which fields were used in the search.
|
1189
|
+
|
1190
|
+
For example, a field config like { id: "child.firstname", label: { defaultMessage: "First Name(s)" } } would render as "First Name(s)" by default.
|
1191
|
+
|
1192
|
+
A field config like { id: "mother.firstname", label: { defaultMessage: "First Name(s)" } } would also render as "First Name(s)" by default.
|
1193
|
+
|
1194
|
+
So, if both child.firstname and mother.firstname are used in a search, the resulting search criteria labels would be "First Name(s)", "First Name(s)",
|
1195
|
+
which is ambiguous.
|
1196
|
+
|
1197
|
+
Now, if we treat the field ID prefix as a label (e.g., "applicant.firstname" \u2192 "Applicant"), and the field label is already
|
1198
|
+
descriptive \u2014 like { id: "applicant.firstname", label: { defaultMessage: "Applicant's First Name" } } \u2014 then the resulting
|
1199
|
+
label would be "Applicant Applicant's First Name", which is redundant and awkward.
|
1200
|
+
|
1201
|
+
By setting searchCriteriaLabelPrefix to a translation config object, we can explicitly define the desired prefix
|
1202
|
+
in the country-config > event.advancedSearch configuration. For example: field("child.dob", { searchCriteriaLabelPrefix: TranslationConfig }).
|
1203
|
+
`
|
1204
|
+
),
|
1205
|
+
conditionals: import_zod14.z.array(FieldConditional).default([]).optional().describe(
|
1206
|
+
`
|
1207
|
+
In advanced search, we sometimes need to override the default field visibility conditionals.
|
1208
|
+
|
1209
|
+
For example, Informant fields in the declaration form may have conditional logic
|
1210
|
+
that hides them based on other field values. Since the advanced search form reuses
|
1211
|
+
the declaration form config, those same conditionals would apply by default.
|
1212
|
+
|
1213
|
+
However, in advanced search we often want to make all Informant fields searchable,
|
1214
|
+
regardless of their original visibility logic. To do this, we explicitly set their
|
1215
|
+
'conditionals' to an empty array ('[]') in the search config. This ensures they
|
1216
|
+
are always rendered in the advanced search form.
|
1217
|
+
`
|
1218
|
+
)
|
1114
1219
|
});
|
1220
|
+
var SearchQueryParams = import_zod14.z.object({
|
1221
|
+
eventType: import_zod14.z.string().optional().describe(
|
1222
|
+
"Defines type of event so that when redirecting to Advanced Search page, appropriate tab can be selected"
|
1223
|
+
)
|
1224
|
+
}).catchall(FieldValue);
|
1115
1225
|
var FieldConfigSchema = BaseField3.extend({
|
1116
1226
|
fieldId: import_zod14.z.string(),
|
1117
1227
|
fieldType: import_zod14.z.literal("field")
|
1118
1228
|
});
|
1119
|
-
var EventFieldId = import_zod14.z.enum([
|
1229
|
+
var EventFieldId = import_zod14.z.enum([
|
1230
|
+
"trackingId",
|
1231
|
+
"status",
|
1232
|
+
"legalStatus.REGISTERED.createdAt",
|
1233
|
+
"legalStatus.REGISTERED.createdAtLocation",
|
1234
|
+
"updatedAt"
|
1235
|
+
]);
|
1120
1236
|
var EventFieldConfigSchema = BaseField3.extend({
|
1121
1237
|
fieldId: EventFieldId,
|
1122
1238
|
fieldType: import_zod14.z.literal("event")
|
@@ -1134,114 +1250,134 @@ var AdvancedSearchConfig = import_zod14.z.object({
|
|
1134
1250
|
var import_lodash = require("lodash");
|
1135
1251
|
|
1136
1252
|
// ../commons/src/events/ActionDocument.ts
|
1253
|
+
var import_zod16 = require("zod");
|
1254
|
+
var import_zod_openapi7 = require("zod-openapi");
|
1255
|
+
|
1256
|
+
// ../commons/src/uuid.ts
|
1257
|
+
var import_uuid = require("uuid");
|
1137
1258
|
var import_zod15 = require("zod");
|
1138
|
-
var
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1259
|
+
var UUID = import_zod15.z.string().uuid().brand("UUID");
|
1260
|
+
function getUUID() {
|
1261
|
+
return (0, import_uuid.v4)();
|
1262
|
+
}
|
1263
|
+
|
1264
|
+
// ../commons/src/events/CreatedAtLocation.ts
|
1265
|
+
var CreatedAtLocation = UUID.nullish();
|
1266
|
+
|
1267
|
+
// ../commons/src/events/ActionDocument.ts
|
1268
|
+
(0, import_zod_openapi7.extendZodWithOpenApi)(import_zod16.z);
|
1269
|
+
var ActionUpdate = import_zod16.z.record(import_zod16.z.string(), FieldUpdateValue);
|
1270
|
+
var EventState = import_zod16.z.record(import_zod16.z.string(), FieldValue);
|
1142
1271
|
var ActionStatus = {
|
1143
1272
|
Requested: "Requested",
|
1144
1273
|
Accepted: "Accepted",
|
1145
1274
|
Rejected: "Rejected"
|
1146
1275
|
};
|
1147
|
-
var ActionBase =
|
1148
|
-
id:
|
1149
|
-
transactionId:
|
1150
|
-
createdAt:
|
1151
|
-
createdBy:
|
1152
|
-
createdByRole:
|
1276
|
+
var ActionBase = import_zod16.z.object({
|
1277
|
+
id: import_zod16.z.string(),
|
1278
|
+
transactionId: import_zod16.z.string(),
|
1279
|
+
createdAt: import_zod16.z.string().datetime(),
|
1280
|
+
createdBy: import_zod16.z.string(),
|
1281
|
+
createdByRole: import_zod16.z.string(),
|
1282
|
+
createdBySignature: import_zod16.z.string().nullish().describe("Reference to signature of the user who created the action"),
|
1283
|
+
createdAtLocation: CreatedAtLocation,
|
1153
1284
|
declaration: ActionUpdate,
|
1154
|
-
annotation: ActionUpdate.optional(),
|
1155
|
-
|
1156
|
-
status: import_zod15.z.enum([
|
1285
|
+
annotation: ActionUpdate.optional().nullable(),
|
1286
|
+
status: import_zod16.z.enum([
|
1157
1287
|
ActionStatus.Requested,
|
1158
1288
|
ActionStatus.Accepted,
|
1159
1289
|
ActionStatus.Rejected
|
1160
1290
|
]),
|
1161
1291
|
// If the action is an asynchronous confirmation for another action, we will save the original action id here.
|
1162
|
-
originalActionId:
|
1292
|
+
originalActionId: UUID.optional().nullable()
|
1163
1293
|
});
|
1164
1294
|
var AssignedAction = ActionBase.merge(
|
1165
|
-
|
1166
|
-
type:
|
1167
|
-
assignedTo:
|
1295
|
+
import_zod16.z.object({
|
1296
|
+
type: import_zod16.z.literal(ActionType.ASSIGN),
|
1297
|
+
assignedTo: import_zod16.z.string()
|
1168
1298
|
})
|
1169
1299
|
);
|
1170
1300
|
var UnassignedAction = ActionBase.merge(
|
1171
|
-
|
1172
|
-
type:
|
1173
|
-
assignedTo:
|
1301
|
+
import_zod16.z.object({
|
1302
|
+
type: import_zod16.z.literal(ActionType.UNASSIGN),
|
1303
|
+
assignedTo: import_zod16.z.literal(null)
|
1174
1304
|
})
|
1175
1305
|
);
|
1176
1306
|
var RegisterAction = ActionBase.merge(
|
1177
|
-
|
1178
|
-
type:
|
1179
|
-
registrationNumber:
|
1307
|
+
import_zod16.z.object({
|
1308
|
+
type: import_zod16.z.literal(ActionType.REGISTER),
|
1309
|
+
registrationNumber: import_zod16.z.string().optional()
|
1180
1310
|
})
|
1181
1311
|
);
|
1182
1312
|
var DeclareAction = ActionBase.merge(
|
1183
|
-
|
1184
|
-
type:
|
1313
|
+
import_zod16.z.object({
|
1314
|
+
type: import_zod16.z.literal(ActionType.DECLARE)
|
1185
1315
|
})
|
1186
1316
|
);
|
1187
1317
|
var ValidateAction = ActionBase.merge(
|
1188
|
-
|
1189
|
-
type:
|
1318
|
+
import_zod16.z.object({
|
1319
|
+
type: import_zod16.z.literal(ActionType.VALIDATE)
|
1190
1320
|
})
|
1191
1321
|
);
|
1322
|
+
var RejectionReason = import_zod16.z.object({
|
1323
|
+
message: import_zod16.z.string().min(1, { message: "Message cannot be empty" }).describe("Message describing reason for rejection or archiving"),
|
1324
|
+
isDuplicate: import_zod16.z.boolean().optional().describe("If a declaration is duplicated")
|
1325
|
+
});
|
1192
1326
|
var RejectAction = ActionBase.merge(
|
1193
|
-
|
1194
|
-
type:
|
1327
|
+
import_zod16.z.object({
|
1328
|
+
type: import_zod16.z.literal(ActionType.REJECT),
|
1329
|
+
reason: RejectionReason
|
1195
1330
|
})
|
1196
1331
|
);
|
1197
1332
|
var MarkAsDuplicateAction = ActionBase.merge(
|
1198
|
-
|
1199
|
-
type:
|
1333
|
+
import_zod16.z.object({
|
1334
|
+
type: import_zod16.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1200
1335
|
})
|
1201
1336
|
);
|
1202
1337
|
var ArchiveAction = ActionBase.merge(
|
1203
|
-
|
1204
|
-
type:
|
1338
|
+
import_zod16.z.object({
|
1339
|
+
type: import_zod16.z.literal(ActionType.ARCHIVE),
|
1340
|
+
reason: RejectionReason
|
1205
1341
|
})
|
1206
1342
|
);
|
1207
1343
|
var CreatedAction = ActionBase.merge(
|
1208
|
-
|
1209
|
-
type:
|
1344
|
+
import_zod16.z.object({
|
1345
|
+
type: import_zod16.z.literal(ActionType.CREATE)
|
1210
1346
|
})
|
1211
1347
|
);
|
1212
1348
|
var NotifiedAction = ActionBase.merge(
|
1213
|
-
|
1214
|
-
type:
|
1349
|
+
import_zod16.z.object({
|
1350
|
+
type: import_zod16.z.literal(ActionType.NOTIFY)
|
1215
1351
|
})
|
1216
1352
|
);
|
1217
1353
|
var PrintCertificateAction = ActionBase.merge(
|
1218
|
-
|
1219
|
-
type:
|
1354
|
+
import_zod16.z.object({
|
1355
|
+
type: import_zod16.z.literal(ActionType.PRINT_CERTIFICATE)
|
1220
1356
|
})
|
1221
1357
|
);
|
1222
1358
|
var RequestedCorrectionAction = ActionBase.merge(
|
1223
|
-
|
1224
|
-
type:
|
1359
|
+
import_zod16.z.object({
|
1360
|
+
type: import_zod16.z.literal(ActionType.REQUEST_CORRECTION)
|
1225
1361
|
})
|
1226
1362
|
);
|
1227
1363
|
var ApprovedCorrectionAction = ActionBase.merge(
|
1228
|
-
|
1229
|
-
type:
|
1230
|
-
requestId:
|
1364
|
+
import_zod16.z.object({
|
1365
|
+
type: import_zod16.z.literal(ActionType.APPROVE_CORRECTION),
|
1366
|
+
requestId: import_zod16.z.string()
|
1231
1367
|
})
|
1232
1368
|
);
|
1233
1369
|
var RejectedCorrectionAction = ActionBase.merge(
|
1234
|
-
|
1235
|
-
type:
|
1236
|
-
requestId:
|
1370
|
+
import_zod16.z.object({
|
1371
|
+
type: import_zod16.z.literal(ActionType.REJECT_CORRECTION),
|
1372
|
+
requestId: import_zod16.z.string()
|
1237
1373
|
})
|
1238
1374
|
);
|
1239
1375
|
var ReadAction = ActionBase.merge(
|
1240
|
-
|
1241
|
-
type:
|
1376
|
+
import_zod16.z.object({
|
1377
|
+
type: import_zod16.z.literal(ActionType.READ)
|
1242
1378
|
})
|
1243
1379
|
);
|
1244
|
-
var ActionDocument =
|
1380
|
+
var ActionDocument = import_zod16.z.discriminatedUnion("type", [
|
1245
1381
|
CreatedAction.openapi({ ref: "CreatedAction" }),
|
1246
1382
|
ValidateAction.openapi({ ref: "ValidateAction" }),
|
1247
1383
|
RejectAction.openapi({ ref: "RejectAction" }),
|
@@ -1264,20 +1400,20 @@ var AsyncRejectActionDocument = ActionBase.omit({
|
|
1264
1400
|
declaration: true,
|
1265
1401
|
annotation: true
|
1266
1402
|
}).merge(
|
1267
|
-
|
1268
|
-
type:
|
1269
|
-
status:
|
1403
|
+
import_zod16.z.object({
|
1404
|
+
type: import_zod16.z.enum(ConfirmableActions),
|
1405
|
+
status: import_zod16.z.literal(ActionStatus.Rejected)
|
1270
1406
|
})
|
1271
1407
|
);
|
1272
|
-
var Action =
|
1273
|
-
var ResolvedUser =
|
1274
|
-
id:
|
1275
|
-
role:
|
1276
|
-
name:
|
1277
|
-
|
1278
|
-
use:
|
1279
|
-
given:
|
1280
|
-
family:
|
1408
|
+
var Action = import_zod16.z.union([ActionDocument, AsyncRejectActionDocument]);
|
1409
|
+
var ResolvedUser = import_zod16.z.object({
|
1410
|
+
id: import_zod16.z.string(),
|
1411
|
+
role: import_zod16.z.string(),
|
1412
|
+
name: import_zod16.z.array(
|
1413
|
+
import_zod16.z.object({
|
1414
|
+
use: import_zod16.z.string(),
|
1415
|
+
given: import_zod16.z.array(import_zod16.z.string()),
|
1416
|
+
family: import_zod16.z.string()
|
1281
1417
|
})
|
1282
1418
|
)
|
1283
1419
|
});
|
@@ -1288,7 +1424,7 @@ var import_ajv_formats = __toESM(require("ajv-formats"));
|
|
1288
1424
|
var import_date_fns = require("date-fns");
|
1289
1425
|
|
1290
1426
|
// ../commons/src/events/FieldTypeMapping.ts
|
1291
|
-
var
|
1427
|
+
var import_zod17 = require("zod");
|
1292
1428
|
function mapFieldTypeToZod(type, required) {
|
1293
1429
|
let schema;
|
1294
1430
|
switch (type) {
|
@@ -1314,7 +1450,6 @@ function mapFieldTypeToZod(type, required) {
|
|
1314
1450
|
case FieldType.ADMINISTRATIVE_AREA:
|
1315
1451
|
case FieldType.FACILITY:
|
1316
1452
|
case FieldType.OFFICE:
|
1317
|
-
case FieldType.SIGNATURE:
|
1318
1453
|
schema = required ? NonEmptyTextValue : TextValue;
|
1319
1454
|
break;
|
1320
1455
|
case FieldType.NUMBER:
|
@@ -1323,6 +1458,7 @@ function mapFieldTypeToZod(type, required) {
|
|
1323
1458
|
case FieldType.CHECKBOX:
|
1324
1459
|
schema = CheckboxFieldValue;
|
1325
1460
|
break;
|
1461
|
+
case FieldType.SIGNATURE:
|
1326
1462
|
case FieldType.FILE:
|
1327
1463
|
schema = FileFieldValue;
|
1328
1464
|
break;
|
@@ -1343,7 +1479,7 @@ function createValidationSchema(config) {
|
|
1343
1479
|
for (const field2 of config) {
|
1344
1480
|
shape[field2.id] = mapFieldTypeToZod(field2.type, field2.required);
|
1345
1481
|
}
|
1346
|
-
return
|
1482
|
+
return import_zod17.z.object(shape);
|
1347
1483
|
}
|
1348
1484
|
function mapFieldTypeToMockValue(field2, i) {
|
1349
1485
|
switch (field2.type) {
|
@@ -1356,7 +1492,6 @@ function mapFieldTypeToMockValue(field2, i) {
|
|
1356
1492
|
case FieldType.SELECT:
|
1357
1493
|
case FieldType.COUNTRY:
|
1358
1494
|
case FieldType.RADIO_GROUP:
|
1359
|
-
case FieldType.SIGNATURE:
|
1360
1495
|
case FieldType.PARAGRAPH:
|
1361
1496
|
case FieldType.ADMINISTRATIVE_AREA:
|
1362
1497
|
case FieldType.FACILITY:
|
@@ -1385,6 +1520,7 @@ function mapFieldTypeToMockValue(field2, i) {
|
|
1385
1520
|
return ["2021-01-01", "2021-01-02"];
|
1386
1521
|
case FieldType.CHECKBOX:
|
1387
1522
|
return true;
|
1523
|
+
case FieldType.SIGNATURE:
|
1388
1524
|
case FieldType.FILE:
|
1389
1525
|
return {
|
1390
1526
|
filename: "4f095fc4-4312-4de2-aa38-86dcc0f71044.png",
|
@@ -1408,7 +1544,6 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1408
1544
|
case FieldType.SELECT:
|
1409
1545
|
case FieldType.COUNTRY:
|
1410
1546
|
case FieldType.RADIO_GROUP:
|
1411
|
-
case FieldType.SIGNATURE:
|
1412
1547
|
case FieldType.PARAGRAPH:
|
1413
1548
|
case FieldType.ADMINISTRATIVE_AREA:
|
1414
1549
|
case FieldType.FACILITY:
|
@@ -1434,6 +1569,7 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
1434
1569
|
number: null,
|
1435
1570
|
zipCode: null
|
1436
1571
|
};
|
1572
|
+
case FieldType.SIGNATURE:
|
1437
1573
|
case FieldType.FILE:
|
1438
1574
|
return {
|
1439
1575
|
filename: "",
|
@@ -1513,6 +1649,9 @@ var isOfficeFieldType = (field2) => {
|
|
1513
1649
|
var isDataFieldType = (field2) => {
|
1514
1650
|
return field2.config.type === FieldType.DATA;
|
1515
1651
|
};
|
1652
|
+
var isNonInteractiveFieldType = (field2) => {
|
1653
|
+
return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA;
|
1654
|
+
};
|
1516
1655
|
|
1517
1656
|
// ../commons/src/conditionals/validate.ts
|
1518
1657
|
var ajv = new import_ajv.default({
|
@@ -1689,12 +1828,6 @@ function runFieldValidations({
|
|
1689
1828
|
};
|
1690
1829
|
}
|
1691
1830
|
|
1692
|
-
// ../commons/src/uuid.ts
|
1693
|
-
var import_uuid = require("uuid");
|
1694
|
-
function getUUID() {
|
1695
|
-
return (0, import_uuid.v4)();
|
1696
|
-
}
|
1697
|
-
|
1698
1831
|
// ../commons/src/utils.ts
|
1699
1832
|
function getOrThrow(x, message) {
|
1700
1833
|
if (x === void 0 || x === null) {
|
@@ -1795,7 +1928,7 @@ function createEmptyDraft(eventId, draftId, actionType) {
|
|
1795
1928
|
annotation: {},
|
1796
1929
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
1797
1930
|
createdBy: "@todo",
|
1798
|
-
createdAtLocation: "
|
1931
|
+
createdAtLocation: "00000000-0000-0000-0000-000000000000",
|
1799
1932
|
status: ActionStatus.Accepted,
|
1800
1933
|
transactionId: "@todo",
|
1801
1934
|
createdByRole: "@todo"
|
@@ -1890,23 +2023,23 @@ function getMixedPath(obj, path, defaultValue) {
|
|
1890
2023
|
}
|
1891
2024
|
|
1892
2025
|
// ../commons/src/events/EventConfig.ts
|
1893
|
-
var
|
1894
|
-
(0,
|
1895
|
-
var EventConfig =
|
1896
|
-
id:
|
2026
|
+
var import_zod_openapi8 = require("zod-openapi");
|
2027
|
+
(0, import_zod_openapi8.extendZodWithOpenApi)(import_zod18.z);
|
2028
|
+
var EventConfig = import_zod18.z.object({
|
2029
|
+
id: import_zod18.z.string().describe(
|
1897
2030
|
'A machine-readable identifier for the event, e.g. "birth" or "death"'
|
1898
2031
|
),
|
1899
|
-
dateOfEvent:
|
2032
|
+
dateOfEvent: FieldReference.optional(),
|
1900
2033
|
title: TranslationConfig,
|
1901
2034
|
fallbackTitle: TranslationConfig.optional().describe(
|
1902
2035
|
"This is a fallback title if actual title resolves to empty string"
|
1903
2036
|
),
|
1904
2037
|
summary: SummaryConfig,
|
1905
2038
|
label: TranslationConfig,
|
1906
|
-
actions:
|
2039
|
+
actions: import_zod18.z.array(ActionConfig),
|
1907
2040
|
declaration: DeclarationFormConfig,
|
1908
|
-
deduplication:
|
1909
|
-
advancedSearch:
|
2041
|
+
deduplication: import_zod18.z.array(DeduplicationConfig).optional().default([]),
|
2042
|
+
advancedSearch: import_zod18.z.array(AdvancedSearchConfig).optional().default([])
|
1910
2043
|
}).superRefine((event2, ctx) => {
|
1911
2044
|
const allFields = findAllFields(event2);
|
1912
2045
|
const fieldIds = allFields.map((field2) => field2.id);
|
@@ -1940,13 +2073,13 @@ var EventConfig = import_zod17.z.object({
|
|
1940
2073
|
}
|
1941
2074
|
if (event2.dateOfEvent) {
|
1942
2075
|
const eventDateFieldId = getDeclarationFields(event2).find(
|
1943
|
-
({ id }) => id === event2.dateOfEvent
|
2076
|
+
({ id }) => id === event2.dateOfEvent?.$$field
|
1944
2077
|
);
|
1945
2078
|
if (!eventDateFieldId) {
|
1946
2079
|
ctx.addIssue({
|
1947
2080
|
code: "custom",
|
1948
2081
|
message: `Date of event field id must match a field id in fields array.
|
1949
|
-
Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent
|
2082
|
+
Invalid date of event field ID for event ${event2.id}: ${event2.dateOfEvent.$$field}`,
|
1950
2083
|
path: ["dateOfEvent"]
|
1951
2084
|
});
|
1952
2085
|
} else if (eventDateFieldId.type !== FieldType.DATE) {
|
@@ -1968,215 +2101,24 @@ var definePage = (page) => PageConfig.parse(page);
|
|
1968
2101
|
var defineFormPage = (formPage) => FormPageConfig.parse(formPage);
|
1969
2102
|
|
1970
2103
|
// ../commons/src/events/WorkqueueConfig.ts
|
1971
|
-
var
|
2104
|
+
var import_zod25 = require("zod");
|
1972
2105
|
|
1973
|
-
// ../commons/src/events/
|
2106
|
+
// ../commons/src/events/serializers/user/serializer.ts
|
1974
2107
|
var import_zod19 = require("zod");
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
VALIDATED: "VALIDATED",
|
1983
|
-
REGISTERED: "REGISTERED",
|
1984
|
-
CERTIFIED: "CERTIFIED",
|
1985
|
-
REJECTED: "REJECTED",
|
1986
|
-
ARCHIVED: "ARCHIVED"
|
1987
|
-
};
|
1988
|
-
var CustomFlags = {
|
1989
|
-
CERTIFICATE_PRINTED: "certificate-printed"
|
1990
|
-
};
|
1991
|
-
var Flag = import_zod18.z.string().regex(
|
1992
|
-
new RegExp(
|
1993
|
-
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(ActionStatus).join("|").toLowerCase()})$`
|
1994
|
-
),
|
1995
|
-
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
1996
|
-
).or(import_zod18.z.nativeEnum(CustomFlags));
|
1997
|
-
var eventStatuses = Object.values(EventStatus);
|
1998
|
-
var EventStatuses = import_zod18.z.nativeEnum(EventStatus);
|
1999
|
-
var ZodDate = import_zod18.z.string().date();
|
2000
|
-
var ActionCreationMetadata = import_zod18.z.object({
|
2001
|
-
createdAt: import_zod18.z.string().datetime().describe("The timestamp when the action request was created."),
|
2002
|
-
createdBy: import_zod18.z.string().describe("ID of the user who created the action request."),
|
2003
|
-
createdAtLocation: import_zod18.z.string().describe("Location of the user who created the action request."),
|
2004
|
-
acceptedAt: import_zod18.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
2005
|
-
createdByRole: import_zod18.z.string().describe("Role of the user at the time of action request creation.")
|
2006
|
-
});
|
2007
|
-
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
2008
|
-
registrationNumber: import_zod18.z.string().describe(
|
2009
|
-
"Registration number of the event. Always present for accepted registrations."
|
2010
|
-
)
|
2011
|
-
});
|
2012
|
-
var LegalStatuses = import_zod18.z.object({
|
2013
|
-
[EventStatus.DECLARED]: ActionCreationMetadata.nullish(),
|
2014
|
-
[EventStatus.REGISTERED]: RegistrationCreationMetadata.nullish()
|
2015
|
-
});
|
2016
|
-
var EventMetadata = import_zod18.z.object({
|
2017
|
-
id: import_zod18.z.string(),
|
2018
|
-
type: import_zod18.z.string().describe("The type of event, such as birth, death, or marriage."),
|
2019
|
-
status: EventStatuses,
|
2020
|
-
legalStatuses: LegalStatuses.describe(
|
2021
|
-
"Metadata related to the legal registration of the event, such as who registered it and when."
|
2022
|
-
),
|
2023
|
-
createdAt: import_zod18.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
2024
|
-
dateOfEvent: ZodDate.nullish(),
|
2025
|
-
createdBy: import_zod18.z.string().describe("ID of the user who created the event."),
|
2026
|
-
updatedByUserRole: import_zod18.z.string().describe("Role of the user who last updated the declaration."),
|
2027
|
-
createdAtLocation: import_zod18.z.string().describe("Location of the user who created the event."),
|
2028
|
-
updatedAtLocation: import_zod18.z.string().nullish().describe("Location of the user who last updated the declaration."),
|
2029
|
-
updatedAt: import_zod18.z.string().datetime().describe("Timestamp of the most recent declaration update."),
|
2030
|
-
assignedTo: import_zod18.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
2031
|
-
updatedBy: import_zod18.z.string().nullish().describe("ID of the user who last updated the declaration."),
|
2032
|
-
trackingId: import_zod18.z.string().describe(
|
2033
|
-
"System-generated tracking ID used by informants or registrars to look up the event."
|
2034
|
-
),
|
2035
|
-
flags: import_zod18.z.array(Flag)
|
2036
|
-
});
|
2037
|
-
var EventMetadataKeys = import_zod18.z.enum([
|
2038
|
-
"id",
|
2039
|
-
"type",
|
2040
|
-
"status",
|
2041
|
-
"createdAt",
|
2042
|
-
"dateOfEvent",
|
2043
|
-
"createdBy",
|
2044
|
-
"updatedByUserRole",
|
2045
|
-
"createdAtLocation",
|
2046
|
-
"updatedAtLocation",
|
2047
|
-
"updatedAt",
|
2048
|
-
"assignedTo",
|
2049
|
-
"updatedBy",
|
2050
|
-
"trackingId",
|
2051
|
-
"legalStatuses",
|
2052
|
-
"flags"
|
2053
|
-
]);
|
2054
|
-
var EventMetadataParameter = import_zod18.z.object({
|
2055
|
-
// @TODO: Reconcile with the event metadata definition. How could we derive one from the other?
|
2056
|
-
$event: EventMetadataKeys
|
2057
|
-
});
|
2058
|
-
var eventMetadataLabelMap = {
|
2059
|
-
"event.assignedTo": {
|
2060
|
-
id: "event.assignedTo.label",
|
2061
|
-
defaultMessage: "Assigned To",
|
2062
|
-
description: "Assigned To"
|
2063
|
-
},
|
2064
|
-
"event.createdAt": {
|
2065
|
-
id: "event.createdAt.label",
|
2066
|
-
defaultMessage: "Created",
|
2067
|
-
description: "Created At"
|
2068
|
-
},
|
2069
|
-
"event.dateOfEvent": {
|
2070
|
-
id: "event.dateOfEvent.label",
|
2071
|
-
defaultMessage: "Date of Event",
|
2072
|
-
description: "Date of Event"
|
2073
|
-
},
|
2074
|
-
"event.createdAtLocation": {
|
2075
|
-
id: "event.createdAtLocation.label",
|
2076
|
-
defaultMessage: "Location",
|
2077
|
-
description: "Created At Location"
|
2078
|
-
},
|
2079
|
-
"event.updatedAtLocation": {
|
2080
|
-
id: "event.updatedAtLocation.label",
|
2081
|
-
defaultMessage: "Location",
|
2082
|
-
description: "Updated At Location"
|
2083
|
-
},
|
2084
|
-
"event.createdBy": {
|
2085
|
-
id: "event.createdBy.label",
|
2086
|
-
defaultMessage: "Created By",
|
2087
|
-
description: "Created By"
|
2088
|
-
},
|
2089
|
-
"event.updatedByUserRole": {
|
2090
|
-
id: "event.updatedByUserRole.label",
|
2091
|
-
defaultMessage: "Updated By Role",
|
2092
|
-
description: "Updated By Role"
|
2093
|
-
},
|
2094
|
-
"event.id": {
|
2095
|
-
id: "event.id.label",
|
2096
|
-
defaultMessage: "ID",
|
2097
|
-
description: "ID"
|
2098
|
-
},
|
2099
|
-
"event.updatedAt": {
|
2100
|
-
id: "event.modifiedAt.label",
|
2101
|
-
defaultMessage: "Updated",
|
2102
|
-
description: "Modified At"
|
2103
|
-
},
|
2104
|
-
"event.status": {
|
2105
|
-
id: "event.status.label",
|
2106
|
-
defaultMessage: "Status",
|
2107
|
-
description: "Status"
|
2108
|
-
},
|
2109
|
-
"event.type": {
|
2110
|
-
id: "event.type.label",
|
2111
|
-
defaultMessage: "Type",
|
2112
|
-
description: "Type"
|
2113
|
-
},
|
2114
|
-
"event.updatedBy": {
|
2115
|
-
id: "event.updatedBy.label",
|
2116
|
-
defaultMessage: "Updated By",
|
2117
|
-
description: "Updated By"
|
2118
|
-
},
|
2119
|
-
"event.trackingId": {
|
2120
|
-
id: "event.trackingId.label",
|
2121
|
-
defaultMessage: "Tracking ID",
|
2122
|
-
description: "Tracking ID"
|
2123
|
-
},
|
2124
|
-
"event.flags": {
|
2125
|
-
id: "event.flags.label",
|
2126
|
-
defaultMessage: "Flags",
|
2127
|
-
description: "Flags"
|
2128
|
-
}
|
2129
|
-
};
|
2130
|
-
|
2131
|
-
// ../commons/src/events/EventIndex.ts
|
2132
|
-
var EventIndex = EventMetadata.extend({
|
2133
|
-
declaration: EventState
|
2134
|
-
});
|
2135
|
-
var EventSearchIndex = import_zod19.z.record(import_zod19.z.string(), import_zod19.z.any()).and(
|
2136
|
-
import_zod19.z.object({
|
2137
|
-
type: import_zod19.z.string()
|
2138
|
-
// Ensures "type" (event-id) exists and is a string
|
2139
|
-
})
|
2140
|
-
);
|
2141
|
-
var Fuzzy = import_zod19.z.object({ type: import_zod19.z.literal("fuzzy"), term: import_zod19.z.string() });
|
2142
|
-
var Exact = import_zod19.z.object({ type: import_zod19.z.literal("exact"), term: import_zod19.z.string() });
|
2143
|
-
var AnyOf = import_zod19.z.object({
|
2144
|
-
type: import_zod19.z.literal("anyOf"),
|
2145
|
-
terms: import_zod19.z.array(import_zod19.z.string())
|
2146
|
-
});
|
2147
|
-
var Range = import_zod19.z.object({
|
2148
|
-
type: import_zod19.z.literal("range"),
|
2149
|
-
gte: import_zod19.z.string(),
|
2150
|
-
lte: import_zod19.z.string()
|
2151
|
-
});
|
2152
|
-
var Not = import_zod19.z.object({ type: import_zod19.z.literal("not"), term: import_zod19.z.string() });
|
2153
|
-
var Within = import_zod19.z.object({ type: import_zod19.z.literal("within"), location: import_zod19.z.string() });
|
2154
|
-
var DateCondition = import_zod19.z.union([Exact, Range]);
|
2155
|
-
var QueryInput = import_zod19.z.lazy(
|
2156
|
-
() => import_zod19.z.union([
|
2157
|
-
import_zod19.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
|
2158
|
-
import_zod19.z.record(import_zod19.z.string(), QueryInput)
|
2108
|
+
var SerializedUserField = import_zod19.z.object({
|
2109
|
+
$userField: import_zod19.z.enum([
|
2110
|
+
"id",
|
2111
|
+
"name",
|
2112
|
+
"role",
|
2113
|
+
"signatureFilename",
|
2114
|
+
"primaryOfficeId"
|
2159
2115
|
])
|
2160
|
-
);
|
2161
|
-
var QueryExpression = import_zod19.z.object({
|
2162
|
-
type: import_zod19.z.literal("and"),
|
2163
|
-
eventType: import_zod19.z.string(),
|
2164
|
-
status: import_zod19.z.optional(import_zod19.z.union([AnyOf, Exact])),
|
2165
|
-
createdAt: import_zod19.z.optional(DateCondition),
|
2166
|
-
updatedAt: import_zod19.z.optional(DateCondition),
|
2167
|
-
createAtLocation: import_zod19.z.optional(import_zod19.z.union([Within, Exact])),
|
2168
|
-
updatedAtLocation: import_zod19.z.optional(import_zod19.z.union([Within, Exact])),
|
2169
|
-
createdBy: import_zod19.z.optional(Exact),
|
2170
|
-
updatedBy: import_zod19.z.optional(Exact),
|
2171
|
-
trackingId: import_zod19.z.optional(Exact),
|
2172
|
-
flags: import_zod19.z.optional(import_zod19.z.array(import_zod19.z.union([AnyOf, Not]))),
|
2173
|
-
data: QueryInput
|
2174
|
-
}).partial();
|
2175
|
-
var Or2 = import_zod19.z.object({
|
2176
|
-
type: import_zod19.z.literal("or"),
|
2177
|
-
clauses: import_zod19.z.array(QueryExpression)
|
2178
2116
|
});
|
2179
|
-
|
2117
|
+
function userSerializer(userField) {
|
2118
|
+
return {
|
2119
|
+
$userField: userField
|
2120
|
+
};
|
2121
|
+
}
|
2180
2122
|
|
2181
2123
|
// ../commons/src/conditionals/conditionals.ts
|
2182
2124
|
function defineConditional(schema) {
|
@@ -2219,7 +2161,7 @@ function not(condition) {
|
|
2219
2161
|
function never() {
|
2220
2162
|
return not(alwaysTrue());
|
2221
2163
|
}
|
2222
|
-
var user = {
|
2164
|
+
var user = Object.assign(userSerializer, {
|
2223
2165
|
hasScope: (scope) => defineConditional({
|
2224
2166
|
type: "object",
|
2225
2167
|
properties: {
|
@@ -2239,7 +2181,7 @@ var user = {
|
|
2239
2181
|
},
|
2240
2182
|
required: ["$user"]
|
2241
2183
|
})
|
2242
|
-
};
|
2184
|
+
});
|
2243
2185
|
function createEventConditionals() {
|
2244
2186
|
return {
|
2245
2187
|
/**
|
@@ -2290,7 +2232,7 @@ function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
|
2290
2232
|
};
|
2291
2233
|
}
|
2292
2234
|
function isFieldReference(value) {
|
2293
|
-
return typeof value === "object" && value !== null && "
|
2235
|
+
return typeof value === "object" && value !== null && "$$field" in value;
|
2294
2236
|
}
|
2295
2237
|
function createFieldConditionals(fieldId) {
|
2296
2238
|
const getDateRange = (date, clause) => ({
|
@@ -2305,6 +2247,10 @@ function createFieldConditionals(fieldId) {
|
|
2305
2247
|
required: [fieldId]
|
2306
2248
|
});
|
2307
2249
|
return {
|
2250
|
+
/**
|
2251
|
+
* @private Internal property used for field reference tracking.
|
2252
|
+
*/
|
2253
|
+
$$field: fieldId,
|
2308
2254
|
isAfter: () => ({
|
2309
2255
|
days: (days) => ({
|
2310
2256
|
inPast: () => defineFormConditional(
|
@@ -2316,7 +2262,7 @@ function createFieldConditionals(fieldId) {
|
|
2316
2262
|
}),
|
2317
2263
|
date: (date) => {
|
2318
2264
|
if (isFieldReference(date)) {
|
2319
|
-
const comparedFieldId = date
|
2265
|
+
const comparedFieldId = date.$$field;
|
2320
2266
|
return defineFormConditional(
|
2321
2267
|
getDateRangeToFieldReference(
|
2322
2268
|
fieldId,
|
@@ -2340,7 +2286,7 @@ function createFieldConditionals(fieldId) {
|
|
2340
2286
|
}),
|
2341
2287
|
date: (date) => {
|
2342
2288
|
if (isFieldReference(date)) {
|
2343
|
-
const comparedFieldId = date
|
2289
|
+
const comparedFieldId = date.$$field;
|
2344
2290
|
return defineFormConditional(
|
2345
2291
|
getDateRangeToFieldReference(
|
2346
2292
|
fieldId,
|
@@ -2355,7 +2301,7 @@ function createFieldConditionals(fieldId) {
|
|
2355
2301
|
}),
|
2356
2302
|
isEqualTo: (value) => {
|
2357
2303
|
if (isFieldReference(value)) {
|
2358
|
-
const comparedFieldId = value
|
2304
|
+
const comparedFieldId = value.$$field;
|
2359
2305
|
return defineFormConditional({
|
2360
2306
|
type: "object",
|
2361
2307
|
properties: {
|
@@ -2471,19 +2417,65 @@ function createFieldConditionals(fieldId) {
|
|
2471
2417
|
}
|
2472
2418
|
},
|
2473
2419
|
required: [fieldId]
|
2420
|
+
})
|
2421
|
+
};
|
2422
|
+
}
|
2423
|
+
|
2424
|
+
// ../commons/src/searchConfigs.ts
|
2425
|
+
function createSearchConfig(baseField) {
|
2426
|
+
return {
|
2427
|
+
/**
|
2428
|
+
* Creates a range configuration for the specified field.
|
2429
|
+
*
|
2430
|
+
* @returns An object containing the field ID and a configuration object with a type of 'range'.
|
2431
|
+
*
|
2432
|
+
* @example event('legalStatus.REGISTERED.createdAt').range()
|
2433
|
+
* // {
|
2434
|
+
* // ...
|
2435
|
+
* // config: { type: 'range' }
|
2436
|
+
* // }
|
2437
|
+
*/
|
2438
|
+
range: () => ({
|
2439
|
+
...baseField,
|
2440
|
+
config: { type: "range" }
|
2441
|
+
}),
|
2442
|
+
/**
|
2443
|
+
* Creates a configuration for exact matching of the specified field.
|
2444
|
+
* @returns An object containing the field ID and a configuration object with a type of 'exact'.
|
2445
|
+
* @example field('dob').exact()
|
2446
|
+
* // {
|
2447
|
+
* // ...
|
2448
|
+
* // config: { type: 'exact' }
|
2449
|
+
* // }
|
2450
|
+
*/
|
2451
|
+
exact: () => ({
|
2452
|
+
...baseField,
|
2453
|
+
config: { type: "exact" }
|
2474
2454
|
}),
|
2475
|
-
|
2455
|
+
/**
|
2456
|
+
* Creates a configuration for fuzzy matching of the specified field.
|
2457
|
+
* @returns An object containing the field ID and a configuration object with a type of 'exact'.
|
2458
|
+
* @example field('name').fuzzy()
|
2459
|
+
* // {
|
2460
|
+
* // ...
|
2461
|
+
* // config: { type: 'fuzzy' }
|
2462
|
+
* // }
|
2463
|
+
*/
|
2464
|
+
fuzzy: () => ({
|
2465
|
+
...baseField,
|
2466
|
+
config: { type: "fuzzy" }
|
2467
|
+
})
|
2476
2468
|
};
|
2477
2469
|
}
|
2478
2470
|
|
2479
2471
|
// ../commons/src/event-config/event-configuration.ts
|
2480
2472
|
function createEventFieldConfig(fieldId, options) {
|
2481
|
-
|
2473
|
+
const baseField = {
|
2482
2474
|
fieldId,
|
2483
2475
|
options,
|
2484
|
-
config: { type: "exact" },
|
2485
2476
|
fieldType: "event"
|
2486
2477
|
};
|
2478
|
+
return createSearchConfig(baseField);
|
2487
2479
|
}
|
2488
2480
|
|
2489
2481
|
// ../commons/src/events/event.ts
|
@@ -2499,135 +2491,670 @@ var event = Object.assign(eventFn, {
|
|
2499
2491
|
}
|
2500
2492
|
});
|
2501
2493
|
|
2494
|
+
// ../commons/src/events/WorkqueueColumnConfig.ts
|
2495
|
+
var import_zod21 = require("zod");
|
2496
|
+
|
2497
|
+
// ../commons/src/events/EventMetadata.ts
|
2498
|
+
var import_zod20 = require("zod");
|
2499
|
+
var EventStatus = {
|
2500
|
+
CREATED: "CREATED",
|
2501
|
+
NOTIFIED: "NOTIFIED",
|
2502
|
+
DECLARED: "DECLARED",
|
2503
|
+
VALIDATED: "VALIDATED",
|
2504
|
+
REGISTERED: "REGISTERED",
|
2505
|
+
CERTIFIED: "CERTIFIED",
|
2506
|
+
REJECTED: "REJECTED",
|
2507
|
+
ARCHIVED: "ARCHIVED"
|
2508
|
+
};
|
2509
|
+
var eventStatusValues = [
|
2510
|
+
EventStatus.CREATED,
|
2511
|
+
EventStatus.NOTIFIED,
|
2512
|
+
EventStatus.DECLARED,
|
2513
|
+
EventStatus.VALIDATED,
|
2514
|
+
EventStatus.REGISTERED,
|
2515
|
+
EventStatus.CERTIFIED,
|
2516
|
+
EventStatus.REJECTED,
|
2517
|
+
EventStatus.ARCHIVED
|
2518
|
+
];
|
2519
|
+
var EventStatusEnum = import_zod20.z.enum(eventStatusValues);
|
2520
|
+
var CustomFlags = {
|
2521
|
+
CERTIFICATE_PRINTED: "certificate-printed"
|
2522
|
+
};
|
2523
|
+
var Flag = import_zod20.z.string().regex(
|
2524
|
+
new RegExp(
|
2525
|
+
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
2526
|
+
ActionStatus
|
2527
|
+
).join("|").toLowerCase()})$`
|
2528
|
+
),
|
2529
|
+
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
2530
|
+
).or(import_zod20.z.nativeEnum(CustomFlags));
|
2531
|
+
var eventStatuses = Object.values(EventStatus);
|
2532
|
+
var EventStatuses = import_zod20.z.nativeEnum(EventStatus);
|
2533
|
+
var ZodDate = import_zod20.z.string().date();
|
2534
|
+
var ActionCreationMetadata = import_zod20.z.object({
|
2535
|
+
createdAt: import_zod20.z.string().datetime().describe("The timestamp when the action request was created."),
|
2536
|
+
createdBy: import_zod20.z.string().describe("ID of the user who created the action request."),
|
2537
|
+
createdAtLocation: CreatedAtLocation.describe(
|
2538
|
+
"Location of the user who created the action request."
|
2539
|
+
),
|
2540
|
+
acceptedAt: import_zod20.z.string().datetime().describe("Timestamp when the action request was accepted."),
|
2541
|
+
createdByRole: import_zod20.z.string().describe("Role of the user at the time of action request creation."),
|
2542
|
+
createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the action request.")
|
2543
|
+
});
|
2544
|
+
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
2545
|
+
registrationNumber: import_zod20.z.string().describe(
|
2546
|
+
"Registration number of the event. Always present for accepted registrations."
|
2547
|
+
)
|
2548
|
+
});
|
2549
|
+
var LegalStatuses = import_zod20.z.object({
|
2550
|
+
[EventStatus.DECLARED]: ActionCreationMetadata.nullish(),
|
2551
|
+
[EventStatus.REGISTERED]: RegistrationCreationMetadata.nullish()
|
2552
|
+
});
|
2553
|
+
var EventMetadata = import_zod20.z.object({
|
2554
|
+
id: UUID,
|
2555
|
+
type: import_zod20.z.string().describe("The type of event, such as birth, death, or marriage."),
|
2556
|
+
status: EventStatuses,
|
2557
|
+
legalStatuses: LegalStatuses.describe(
|
2558
|
+
"Metadata related to the legal registration of the event, such as who registered it and when."
|
2559
|
+
),
|
2560
|
+
createdAt: import_zod20.z.string().datetime().describe("The timestamp when the event was first created and saved."),
|
2561
|
+
dateOfEvent: ZodDate.nullish(),
|
2562
|
+
createdBy: import_zod20.z.string().describe("ID of the user who created the event."),
|
2563
|
+
updatedByUserRole: import_zod20.z.string().describe("Role of the user who last updated the declaration."),
|
2564
|
+
createdAtLocation: CreatedAtLocation.describe(
|
2565
|
+
"Location of the user who created the event."
|
2566
|
+
),
|
2567
|
+
createdBySignature: import_zod20.z.string().nullish().describe("Signature of the user who created the event."),
|
2568
|
+
updatedAtLocation: UUID.nullish().describe(
|
2569
|
+
"Location of the user who last updated the declaration."
|
2570
|
+
),
|
2571
|
+
updatedAt: import_zod20.z.string().datetime().describe("Timestamp of the most recent declaration update."),
|
2572
|
+
assignedTo: import_zod20.z.string().nullish().describe("ID of the user currently assigned to the event."),
|
2573
|
+
updatedBy: import_zod20.z.string().nullish().describe("ID of the user who last updated the declaration."),
|
2574
|
+
trackingId: import_zod20.z.string().describe(
|
2575
|
+
"System-generated tracking ID used by informants or registrars to look up the event."
|
2576
|
+
),
|
2577
|
+
flags: import_zod20.z.array(Flag)
|
2578
|
+
});
|
2579
|
+
var EventMetadataKeysArray = [
|
2580
|
+
"id",
|
2581
|
+
"type",
|
2582
|
+
"status",
|
2583
|
+
"createdAt",
|
2584
|
+
"dateOfEvent",
|
2585
|
+
"createdBy",
|
2586
|
+
"updatedByUserRole",
|
2587
|
+
"createdAtLocation",
|
2588
|
+
"updatedAtLocation",
|
2589
|
+
"updatedAt",
|
2590
|
+
"assignedTo",
|
2591
|
+
"updatedBy",
|
2592
|
+
"trackingId",
|
2593
|
+
"legalStatuses",
|
2594
|
+
"flags"
|
2595
|
+
];
|
2596
|
+
var EventMetadataKeys = import_zod20.z.enum(EventMetadataKeysArray);
|
2597
|
+
var eventMetadataLabelMap = {
|
2598
|
+
"event.assignedTo": {
|
2599
|
+
id: "event.assignedTo.label",
|
2600
|
+
defaultMessage: "Assigned To",
|
2601
|
+
description: "Assigned To"
|
2602
|
+
},
|
2603
|
+
"event.createdAt": {
|
2604
|
+
id: "event.createdAt.label",
|
2605
|
+
defaultMessage: "Created",
|
2606
|
+
description: "Created At"
|
2607
|
+
},
|
2608
|
+
"event.dateOfEvent": {
|
2609
|
+
id: "event.dateOfEvent.label",
|
2610
|
+
defaultMessage: "Date of Event",
|
2611
|
+
description: "Date of Event"
|
2612
|
+
},
|
2613
|
+
"event.createdAtLocation": {
|
2614
|
+
id: "event.createdAtLocation.label",
|
2615
|
+
defaultMessage: "Location",
|
2616
|
+
description: "Created At Location"
|
2617
|
+
},
|
2618
|
+
"event.updatedAtLocation": {
|
2619
|
+
id: "event.updatedAtLocation.label",
|
2620
|
+
defaultMessage: "Location",
|
2621
|
+
description: "Updated At Location"
|
2622
|
+
},
|
2623
|
+
"event.createdBy": {
|
2624
|
+
id: "event.createdBy.label",
|
2625
|
+
defaultMessage: "Created By",
|
2626
|
+
description: "Created By"
|
2627
|
+
},
|
2628
|
+
"event.updatedByUserRole": {
|
2629
|
+
id: "event.updatedByUserRole.label",
|
2630
|
+
defaultMessage: "Updated By Role",
|
2631
|
+
description: "Updated By Role"
|
2632
|
+
},
|
2633
|
+
"event.id": {
|
2634
|
+
id: "event.id.label",
|
2635
|
+
defaultMessage: "ID",
|
2636
|
+
description: "ID"
|
2637
|
+
},
|
2638
|
+
"event.updatedAt": {
|
2639
|
+
id: "event.modifiedAt.label",
|
2640
|
+
defaultMessage: "Updated",
|
2641
|
+
description: "Modified At"
|
2642
|
+
},
|
2643
|
+
"event.status": {
|
2644
|
+
id: "event.status.label",
|
2645
|
+
defaultMessage: "Status",
|
2646
|
+
description: "Status"
|
2647
|
+
},
|
2648
|
+
"event.type": {
|
2649
|
+
id: "event.type.label",
|
2650
|
+
defaultMessage: "Type",
|
2651
|
+
description: "Type"
|
2652
|
+
},
|
2653
|
+
"event.updatedBy": {
|
2654
|
+
id: "event.updatedBy.label",
|
2655
|
+
defaultMessage: "Updated By",
|
2656
|
+
description: "Updated By"
|
2657
|
+
},
|
2658
|
+
"event.trackingId": {
|
2659
|
+
id: "event.trackingId.label",
|
2660
|
+
defaultMessage: "Tracking ID",
|
2661
|
+
description: "Tracking ID"
|
2662
|
+
},
|
2663
|
+
"event.flags": {
|
2664
|
+
id: "event.flags.label",
|
2665
|
+
defaultMessage: "Flags",
|
2666
|
+
description: "Flags"
|
2667
|
+
}
|
2668
|
+
};
|
2669
|
+
|
2670
|
+
// ../commons/src/events/WorkqueueColumnConfig.ts
|
2671
|
+
var WorkqueueColumnKeysArray = [
|
2672
|
+
...EventMetadataKeysArray,
|
2673
|
+
"title"
|
2674
|
+
];
|
2675
|
+
var WorkqueueColumnKeys = import_zod21.z.enum(WorkqueueColumnKeysArray);
|
2676
|
+
var WorkqueueColumnValue = import_zod21.z.object({
|
2677
|
+
$event: WorkqueueColumnKeys
|
2678
|
+
});
|
2679
|
+
var WorkqueueColumn = import_zod21.z.object({
|
2680
|
+
label: TranslationConfig,
|
2681
|
+
value: WorkqueueColumnValue
|
2682
|
+
});
|
2683
|
+
function defineWorkqueuesColumns(workqueueColumns) {
|
2684
|
+
return workqueueColumns.map(
|
2685
|
+
(workqueueColumn) => WorkqueueColumn.parse(workqueueColumn)
|
2686
|
+
);
|
2687
|
+
}
|
2688
|
+
|
2689
|
+
// ../commons/src/events/CountryConfigQueryInput.ts
|
2690
|
+
var import_zod23 = require("zod");
|
2691
|
+
|
2692
|
+
// ../commons/src/events/EventIndex.ts
|
2693
|
+
var import_zod22 = require("zod");
|
2694
|
+
var import_zod_openapi9 = require("zod-openapi");
|
2695
|
+
(0, import_zod_openapi9.extendZodWithOpenApi)(import_zod22.z);
|
2696
|
+
var EventIndex = EventMetadata.extend({
|
2697
|
+
declaration: EventState
|
2698
|
+
}).openapi({
|
2699
|
+
ref: "EventIndex"
|
2700
|
+
});
|
2701
|
+
var EventSearchIndex = import_zod22.z.record(import_zod22.z.string(), import_zod22.z.any()).and(
|
2702
|
+
import_zod22.z.object({
|
2703
|
+
type: import_zod22.z.string()
|
2704
|
+
// Ensures "type" (event-id) exists and is a string
|
2705
|
+
})
|
2706
|
+
).openapi({
|
2707
|
+
ref: "EventSearchIndex"
|
2708
|
+
});
|
2709
|
+
var Fuzzy = import_zod22.z.object({ type: import_zod22.z.literal("fuzzy"), term: import_zod22.z.string() }).openapi({
|
2710
|
+
ref: "Fuzzy"
|
2711
|
+
});
|
2712
|
+
var Exact = import_zod22.z.object({ type: import_zod22.z.literal("exact"), term: import_zod22.z.string() }).openapi({
|
2713
|
+
ref: "Exact"
|
2714
|
+
});
|
2715
|
+
var AnyOf = import_zod22.z.object({
|
2716
|
+
type: import_zod22.z.literal("anyOf"),
|
2717
|
+
terms: import_zod22.z.array(import_zod22.z.string())
|
2718
|
+
}).openapi({
|
2719
|
+
ref: "AnyOf"
|
2720
|
+
});
|
2721
|
+
var ExactStatus = import_zod22.z.object({
|
2722
|
+
type: import_zod22.z.literal("exact"),
|
2723
|
+
term: EventStatusEnum
|
2724
|
+
}).openapi({
|
2725
|
+
ref: "ExactStatus"
|
2726
|
+
});
|
2727
|
+
var AnyOfStatus = import_zod22.z.object({
|
2728
|
+
type: import_zod22.z.literal("anyOf"),
|
2729
|
+
terms: import_zod22.z.array(EventStatusEnum)
|
2730
|
+
}).openapi({
|
2731
|
+
ref: "AnyOfStatus"
|
2732
|
+
});
|
2733
|
+
var Range = import_zod22.z.object({
|
2734
|
+
type: import_zod22.z.literal("range"),
|
2735
|
+
gte: import_zod22.z.string(),
|
2736
|
+
lte: import_zod22.z.string()
|
2737
|
+
}).openapi({
|
2738
|
+
ref: "Range"
|
2739
|
+
});
|
2740
|
+
var Not = import_zod22.z.object({ type: import_zod22.z.literal("not"), term: import_zod22.z.string() }).openapi({
|
2741
|
+
ref: "Not"
|
2742
|
+
});
|
2743
|
+
var Within = import_zod22.z.object({ type: import_zod22.z.literal("within"), location: import_zod22.z.string() }).openapi({
|
2744
|
+
ref: "Within"
|
2745
|
+
});
|
2746
|
+
var DateCondition = import_zod22.z.union([Exact, Range]).openapi({
|
2747
|
+
ref: "DateCondition"
|
2748
|
+
});
|
2749
|
+
var QueryInput = import_zod22.z.lazy(
|
2750
|
+
() => import_zod22.z.union([
|
2751
|
+
import_zod22.z.discriminatedUnion("type", [Fuzzy, Exact, Range, Within, AnyOf, Not]),
|
2752
|
+
import_zod22.z.record(import_zod22.z.string(), QueryInput)
|
2753
|
+
])
|
2754
|
+
).openapi({
|
2755
|
+
ref: "QueryInput"
|
2756
|
+
});
|
2757
|
+
var QueryExpression = import_zod22.z.object({
|
2758
|
+
eventType: import_zod22.z.string(),
|
2759
|
+
status: import_zod22.z.optional(import_zod22.z.union([AnyOfStatus, ExactStatus])),
|
2760
|
+
createdAt: import_zod22.z.optional(DateCondition),
|
2761
|
+
updatedAt: import_zod22.z.optional(DateCondition),
|
2762
|
+
"legalStatus.REGISTERED.createdAt": import_zod22.z.optional(DateCondition),
|
2763
|
+
"legalStatus.REGISTERED.createdAtLocation": import_zod22.z.optional(
|
2764
|
+
import_zod22.z.union([Within, Exact])
|
2765
|
+
),
|
2766
|
+
createdAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
|
2767
|
+
updatedAtLocation: import_zod22.z.optional(import_zod22.z.union([Within, Exact])),
|
2768
|
+
assignedTo: import_zod22.z.optional(Exact),
|
2769
|
+
createdBy: import_zod22.z.optional(Exact),
|
2770
|
+
updatedBy: import_zod22.z.optional(Exact),
|
2771
|
+
trackingId: import_zod22.z.optional(Exact),
|
2772
|
+
flags: import_zod22.z.optional(import_zod22.z.array(import_zod22.z.union([AnyOf, Not]))),
|
2773
|
+
data: QueryInput
|
2774
|
+
}).partial().openapi({
|
2775
|
+
ref: "QueryExpression"
|
2776
|
+
});
|
2777
|
+
var QueryType = import_zod22.z.object({
|
2778
|
+
type: import_zod22.z.literal("and").or(import_zod22.z.literal("or")).openapi({ default: "and" }),
|
2779
|
+
clauses: import_zod22.z.preprocess(
|
2780
|
+
(val) => {
|
2781
|
+
if (typeof val === "string") {
|
2782
|
+
return [JSON.parse(val)];
|
2783
|
+
}
|
2784
|
+
if (Array.isArray(val)) {
|
2785
|
+
return val.map((v) => typeof v === "string" ? JSON.parse(v) : v);
|
2786
|
+
}
|
2787
|
+
return val;
|
2788
|
+
},
|
2789
|
+
import_zod22.z.array(QueryExpression).openapi({
|
2790
|
+
default: [
|
2791
|
+
{
|
2792
|
+
eventType: TENNIS_CLUB_MEMBERSHIP,
|
2793
|
+
status: {
|
2794
|
+
type: "anyOf",
|
2795
|
+
terms: [
|
2796
|
+
"CREATED",
|
2797
|
+
"NOTIFIED",
|
2798
|
+
"DECLARED",
|
2799
|
+
"VALIDATED",
|
2800
|
+
"REGISTERED",
|
2801
|
+
"CERTIFIED",
|
2802
|
+
"REJECTED",
|
2803
|
+
"ARCHIVED"
|
2804
|
+
]
|
2805
|
+
},
|
2806
|
+
updatedAt: {
|
2807
|
+
type: "range",
|
2808
|
+
gte: "2025-05-22",
|
2809
|
+
lte: "2025-05-29"
|
2810
|
+
},
|
2811
|
+
data: {}
|
2812
|
+
}
|
2813
|
+
]
|
2814
|
+
})
|
2815
|
+
)
|
2816
|
+
}).openapi({
|
2817
|
+
ref: "QueryType"
|
2818
|
+
});
|
2819
|
+
|
2820
|
+
// ../commons/src/events/CountryConfigQueryInput.ts
|
2821
|
+
var SerializableExact = import_zod23.z.object({
|
2822
|
+
type: import_zod23.z.literal("exact"),
|
2823
|
+
term: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
|
2824
|
+
});
|
2825
|
+
var SerializableWithin = import_zod23.z.object({
|
2826
|
+
type: import_zod23.z.literal("within"),
|
2827
|
+
location: import_zod23.z.union([import_zod23.z.string(), SerializedUserField])
|
2828
|
+
});
|
2829
|
+
var SerializedQueryExpression = import_zod23.z.object({
|
2830
|
+
eventType: import_zod23.z.string(),
|
2831
|
+
status: import_zod23.z.optional(import_zod23.z.union([AnyOfStatus, ExactStatus])),
|
2832
|
+
createdAt: import_zod23.z.optional(DateCondition),
|
2833
|
+
updatedAt: import_zod23.z.optional(DateCondition),
|
2834
|
+
createdAtLocation: import_zod23.z.optional(
|
2835
|
+
import_zod23.z.union([SerializableWithin, SerializableExact])
|
2836
|
+
),
|
2837
|
+
updatedAtLocation: import_zod23.z.optional(
|
2838
|
+
import_zod23.z.union([SerializableWithin, SerializableExact])
|
2839
|
+
),
|
2840
|
+
assignedTo: import_zod23.z.optional(SerializableExact),
|
2841
|
+
createdBy: import_zod23.z.optional(SerializableExact),
|
2842
|
+
updatedBy: import_zod23.z.optional(SerializableExact),
|
2843
|
+
trackingId: import_zod23.z.optional(Exact),
|
2844
|
+
flags: import_zod23.z.optional(import_zod23.z.array(import_zod23.z.union([AnyOf, Not]))),
|
2845
|
+
data: QueryInput
|
2846
|
+
}).partial();
|
2847
|
+
var Or2 = import_zod23.z.object({
|
2848
|
+
type: import_zod23.z.literal("or"),
|
2849
|
+
clauses: import_zod23.z.array(SerializedQueryExpression)
|
2850
|
+
});
|
2851
|
+
var And2 = import_zod23.z.object({
|
2852
|
+
type: import_zod23.z.literal("and"),
|
2853
|
+
clauses: import_zod23.z.array(SerializedQueryExpression)
|
2854
|
+
});
|
2855
|
+
var CountryConfigQueryType = import_zod23.z.discriminatedUnion("type", [And2, Or2]);
|
2856
|
+
var CountryConfigQueryInputType = import_zod23.z.union([
|
2857
|
+
SerializedQueryExpression,
|
2858
|
+
And2,
|
2859
|
+
Or2
|
2860
|
+
]);
|
2861
|
+
|
2862
|
+
// ../commons/src/icons.ts
|
2863
|
+
var import_zod24 = require("zod");
|
2864
|
+
var AvailableIcons = import_zod24.z.enum([
|
2865
|
+
"Archived",
|
2866
|
+
"Assigned",
|
2867
|
+
"Certified",
|
2868
|
+
"Close",
|
2869
|
+
"Collapse",
|
2870
|
+
"Draft",
|
2871
|
+
"DuplicateYellow",
|
2872
|
+
"Expand",
|
2873
|
+
"ExternalValidate",
|
2874
|
+
"FilledCheck",
|
2875
|
+
"InReview",
|
2876
|
+
"Offline",
|
2877
|
+
"Registered",
|
2878
|
+
"RequiresUpdates",
|
2879
|
+
"Sent",
|
2880
|
+
"Validated",
|
2881
|
+
"WaitingApproval",
|
2882
|
+
"ChartActivity",
|
2883
|
+
"Activity",
|
2884
|
+
"Archive",
|
2885
|
+
"ArchiveTray",
|
2886
|
+
"ArrowLeft",
|
2887
|
+
"ArrowRight",
|
2888
|
+
"Buildings",
|
2889
|
+
"Circle",
|
2890
|
+
"CaretDown",
|
2891
|
+
"CaretLeft",
|
2892
|
+
"CaretRight",
|
2893
|
+
"ChartBar",
|
2894
|
+
"ChartLine",
|
2895
|
+
"ChatCircle",
|
2896
|
+
"CheckSquare",
|
2897
|
+
"Compass",
|
2898
|
+
"Check",
|
2899
|
+
"Copy",
|
2900
|
+
"Database",
|
2901
|
+
"DotsThreeVertical",
|
2902
|
+
"DownloadSimple",
|
2903
|
+
"ArrowCounterClockwise",
|
2904
|
+
"MagnifyingGlassMinus",
|
2905
|
+
"MagnifyingGlassPlus",
|
2906
|
+
"Export",
|
2907
|
+
"Eye",
|
2908
|
+
"EyeSlash",
|
2909
|
+
"Envelope",
|
2910
|
+
"File",
|
2911
|
+
"FileSearch",
|
2912
|
+
"FileMinus",
|
2913
|
+
"FilePlus",
|
2914
|
+
"FileText",
|
2915
|
+
"FileX",
|
2916
|
+
"Handshake",
|
2917
|
+
"Gear",
|
2918
|
+
"GitBranch",
|
2919
|
+
"IdentificationCard",
|
2920
|
+
"List",
|
2921
|
+
"ListBullets",
|
2922
|
+
"Lock",
|
2923
|
+
"MagnifyingGlass",
|
2924
|
+
"MapPin",
|
2925
|
+
"Medal",
|
2926
|
+
"NotePencil",
|
2927
|
+
"Paperclip",
|
2928
|
+
"PaperPlaneTilt",
|
2929
|
+
"Pen",
|
2930
|
+
"Pencil",
|
2931
|
+
"PencilSimpleLine",
|
2932
|
+
"Phone",
|
2933
|
+
"Plus",
|
2934
|
+
"Printer",
|
2935
|
+
"SignOut",
|
2936
|
+
"Star",
|
2937
|
+
"Target",
|
2938
|
+
"TextT",
|
2939
|
+
"Trash",
|
2940
|
+
"UploadSimple",
|
2941
|
+
"User",
|
2942
|
+
"UserPlus",
|
2943
|
+
"Users",
|
2944
|
+
"WarningCircle",
|
2945
|
+
"X",
|
2946
|
+
"CircleWavyCheck",
|
2947
|
+
"CircleWavyQuestion",
|
2948
|
+
"ArchiveBox",
|
2949
|
+
"ArrowCircleDown",
|
2950
|
+
"FileArrowUp",
|
2951
|
+
"FileDotted",
|
2952
|
+
"Files",
|
2953
|
+
"PencilLine",
|
2954
|
+
"PencilCircle",
|
2955
|
+
"UserCircle",
|
2956
|
+
"Clock",
|
2957
|
+
"QrCode",
|
2958
|
+
"Webcam",
|
2959
|
+
"Sun",
|
2960
|
+
"DeviceTabletCamera",
|
2961
|
+
"Globe",
|
2962
|
+
"Fingerprint",
|
2963
|
+
"PushPin",
|
2964
|
+
"Timer"
|
2965
|
+
]);
|
2966
|
+
|
2502
2967
|
// ../commons/src/events/WorkqueueConfig.ts
|
2503
|
-
var
|
2504
|
-
|
2968
|
+
var dateOfEventColumn = defineWorkqueuesColumns([
|
2969
|
+
{
|
2970
|
+
label: {
|
2971
|
+
id: "workqueues.dateOfEvent",
|
2972
|
+
defaultMessage: "Date of Event",
|
2973
|
+
description: "Label for workqueue column: dateOfEvent"
|
2974
|
+
},
|
2975
|
+
value: event.field("dateOfEvent")
|
2976
|
+
},
|
2977
|
+
{
|
2978
|
+
label: {
|
2979
|
+
defaultMessage: "Last updated",
|
2980
|
+
description: "This is the label for the workqueue column",
|
2981
|
+
id: "workqueue.default.column.modifiedAt"
|
2982
|
+
},
|
2983
|
+
value: event.field("updatedAt")
|
2984
|
+
}
|
2985
|
+
]);
|
2986
|
+
var WorkqueueConfig = import_zod25.z.object({
|
2987
|
+
slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
|
2505
2988
|
name: TranslationConfig.describe(
|
2506
2989
|
"Title of the workflow (both in navigation and on the page)"
|
2507
2990
|
),
|
2508
|
-
query:
|
2509
|
-
actions:
|
2510
|
-
|
2511
|
-
type:
|
2512
|
-
conditionals:
|
2991
|
+
query: CountryConfigQueryType,
|
2992
|
+
actions: import_zod25.z.array(
|
2993
|
+
import_zod25.z.object({
|
2994
|
+
type: import_zod25.z.string(),
|
2995
|
+
conditionals: import_zod25.z.array(Conditional).optional()
|
2513
2996
|
})
|
2514
2997
|
),
|
2515
|
-
columns:
|
2516
|
-
|
2517
|
-
).default([
|
2518
|
-
{
|
2519
|
-
label: {
|
2520
|
-
id: "workqueues.dateOfEvent",
|
2521
|
-
defaultMessage: "Date of Event",
|
2522
|
-
description: "Label for workqueue column: dateOfEvent"
|
2523
|
-
},
|
2524
|
-
value: event.field("dateOfEvent")
|
2525
|
-
}
|
2526
|
-
])
|
2998
|
+
columns: import_zod25.z.array(WorkqueueColumn).default(dateOfEventColumn),
|
2999
|
+
icon: AvailableIcons
|
2527
3000
|
}).describe("Configuration for workqueue.");
|
2528
|
-
|
2529
|
-
|
3001
|
+
var WorkqueueConfigInput = import_zod25.z.object({
|
3002
|
+
slug: import_zod25.z.string().describe("Determines the url of the workqueue."),
|
3003
|
+
name: TranslationConfig.describe(
|
3004
|
+
"Title of the workflow (both in navigation and on the page)"
|
3005
|
+
),
|
3006
|
+
query: CountryConfigQueryInputType,
|
3007
|
+
actions: import_zod25.z.array(
|
3008
|
+
import_zod25.z.object({
|
3009
|
+
type: import_zod25.z.string(),
|
3010
|
+
conditionals: import_zod25.z.array(Conditional).optional()
|
3011
|
+
})
|
3012
|
+
),
|
3013
|
+
columns: import_zod25.z.array(WorkqueueColumn).default(dateOfEventColumn),
|
3014
|
+
icon: AvailableIcons
|
3015
|
+
});
|
3016
|
+
function defineWorkqueue(workqueueInput) {
|
3017
|
+
const queryInput = workqueueInput.query;
|
3018
|
+
const query = "type" in queryInput ? queryInput : { type: "and", clauses: [queryInput] };
|
3019
|
+
return WorkqueueConfig.parse({ ...workqueueInput, query });
|
2530
3020
|
}
|
3021
|
+
function defineWorkqueues(workqueues) {
|
3022
|
+
return workqueues.map((workqueue) => defineWorkqueue(workqueue));
|
3023
|
+
}
|
3024
|
+
var WorkqueueCountInput = import_zod25.z.array(
|
3025
|
+
import_zod25.z.object({ slug: import_zod25.z.string(), query: QueryType })
|
3026
|
+
);
|
3027
|
+
var WorkqueueCountOutput = import_zod25.z.record(import_zod25.z.string(), import_zod25.z.number());
|
3028
|
+
|
3029
|
+
// ../commons/src/events/workqueueDefaultColumns.ts
|
3030
|
+
var defaultWorkqueueColumns = [
|
3031
|
+
{
|
3032
|
+
label: {
|
3033
|
+
defaultMessage: "Title",
|
3034
|
+
description: "This is the label for the workqueue column",
|
3035
|
+
id: "workqueue.in-reveiw.column.title"
|
3036
|
+
},
|
3037
|
+
value: event.field("title")
|
3038
|
+
},
|
3039
|
+
{
|
3040
|
+
label: {
|
3041
|
+
defaultMessage: "Event",
|
3042
|
+
description: "This is the label for the workqueue column",
|
3043
|
+
id: "workqueue.default.column.event"
|
3044
|
+
},
|
3045
|
+
value: event.field("type")
|
3046
|
+
}
|
3047
|
+
];
|
2531
3048
|
|
2532
3049
|
// ../commons/src/events/Draft.ts
|
2533
|
-
var
|
3050
|
+
var import_zod27 = require("zod");
|
2534
3051
|
|
2535
3052
|
// ../commons/src/events/ActionInput.ts
|
2536
|
-
var
|
2537
|
-
var
|
2538
|
-
(0,
|
2539
|
-
var BaseActionInput =
|
2540
|
-
eventId:
|
2541
|
-
transactionId:
|
3053
|
+
var import_zod26 = require("zod");
|
3054
|
+
var import_zod_openapi10 = require("zod-openapi");
|
3055
|
+
(0, import_zod_openapi10.extendZodWithOpenApi)(import_zod26.z);
|
3056
|
+
var BaseActionInput = import_zod26.z.object({
|
3057
|
+
eventId: UUID,
|
3058
|
+
transactionId: import_zod26.z.string(),
|
2542
3059
|
declaration: ActionUpdate.default({}),
|
2543
3060
|
annotation: ActionUpdate.optional(),
|
2544
|
-
originalActionId:
|
2545
|
-
keepAssignment:
|
3061
|
+
originalActionId: UUID.optional(),
|
3062
|
+
keepAssignment: import_zod26.z.boolean().optional()
|
2546
3063
|
});
|
2547
3064
|
var CreateActionInput = BaseActionInput.merge(
|
2548
|
-
|
2549
|
-
type:
|
2550
|
-
createdAtLocation:
|
3065
|
+
import_zod26.z.object({
|
3066
|
+
type: import_zod26.z.literal(ActionType.CREATE).default(ActionType.CREATE),
|
3067
|
+
createdAtLocation: CreatedAtLocation
|
2551
3068
|
})
|
2552
3069
|
);
|
2553
3070
|
var RegisterActionInput = BaseActionInput.merge(
|
2554
|
-
|
2555
|
-
type:
|
2556
|
-
registrationNumber:
|
3071
|
+
import_zod26.z.object({
|
3072
|
+
type: import_zod26.z.literal(ActionType.REGISTER).default(ActionType.REGISTER),
|
3073
|
+
registrationNumber: import_zod26.z.string().optional()
|
2557
3074
|
})
|
2558
3075
|
);
|
2559
3076
|
var ValidateActionInput = BaseActionInput.merge(
|
2560
|
-
|
2561
|
-
type:
|
2562
|
-
duplicates:
|
3077
|
+
import_zod26.z.object({
|
3078
|
+
type: import_zod26.z.literal(ActionType.VALIDATE).default(ActionType.VALIDATE),
|
3079
|
+
duplicates: import_zod26.z.array(import_zod26.z.string())
|
2563
3080
|
})
|
2564
3081
|
);
|
2565
3082
|
var NotifyActionInput = BaseActionInput.merge(
|
2566
|
-
|
2567
|
-
type:
|
3083
|
+
import_zod26.z.object({
|
3084
|
+
type: import_zod26.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
2568
3085
|
})
|
2569
|
-
)
|
3086
|
+
).openapi({
|
3087
|
+
default: {
|
3088
|
+
eventId: "<event-id-here>",
|
3089
|
+
transactionId: getUUID(),
|
3090
|
+
declaration: {},
|
3091
|
+
annotation: {},
|
3092
|
+
type: ActionType.NOTIFY
|
3093
|
+
}
|
3094
|
+
});
|
2570
3095
|
var DeclareActionInput = BaseActionInput.merge(
|
2571
|
-
|
2572
|
-
type:
|
3096
|
+
import_zod26.z.object({
|
3097
|
+
type: import_zod26.z.literal(ActionType.DECLARE).default(ActionType.DECLARE)
|
2573
3098
|
})
|
2574
3099
|
);
|
2575
3100
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
2576
|
-
|
2577
|
-
type:
|
3101
|
+
import_zod26.z.object({
|
3102
|
+
type: import_zod26.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
2578
3103
|
})
|
2579
3104
|
);
|
2580
3105
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
2581
|
-
|
2582
|
-
type:
|
3106
|
+
import_zod26.z.object({
|
3107
|
+
type: import_zod26.z.literal(ActionType.REJECT).default(ActionType.REJECT),
|
3108
|
+
reason: RejectionReason
|
2583
3109
|
})
|
2584
3110
|
);
|
2585
3111
|
var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
2586
|
-
|
2587
|
-
type:
|
3112
|
+
import_zod26.z.object({
|
3113
|
+
type: import_zod26.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
2588
3114
|
})
|
2589
3115
|
);
|
2590
3116
|
var ArchiveActionInput = BaseActionInput.merge(
|
2591
|
-
|
2592
|
-
type:
|
3117
|
+
import_zod26.z.object({
|
3118
|
+
type: import_zod26.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE),
|
3119
|
+
reason: RejectionReason
|
2593
3120
|
})
|
2594
3121
|
);
|
2595
3122
|
var AssignActionInput = BaseActionInput.merge(
|
2596
|
-
|
2597
|
-
type:
|
2598
|
-
assignedTo:
|
3123
|
+
import_zod26.z.object({
|
3124
|
+
type: import_zod26.z.literal(ActionType.ASSIGN).default(ActionType.ASSIGN),
|
3125
|
+
assignedTo: import_zod26.z.string()
|
2599
3126
|
})
|
2600
3127
|
);
|
2601
3128
|
var UnassignActionInput = BaseActionInput.merge(
|
2602
|
-
|
2603
|
-
type:
|
2604
|
-
assignedTo:
|
3129
|
+
import_zod26.z.object({
|
3130
|
+
type: import_zod26.z.literal(ActionType.UNASSIGN).default(ActionType.UNASSIGN),
|
3131
|
+
assignedTo: import_zod26.z.literal(null).default(null)
|
2605
3132
|
})
|
2606
3133
|
);
|
2607
3134
|
var RequestCorrectionActionInput = BaseActionInput.merge(
|
2608
|
-
|
2609
|
-
type:
|
3135
|
+
import_zod26.z.object({
|
3136
|
+
type: import_zod26.z.literal(ActionType.REQUEST_CORRECTION).default(ActionType.REQUEST_CORRECTION)
|
2610
3137
|
})
|
2611
3138
|
);
|
2612
3139
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
2613
|
-
|
2614
|
-
requestId:
|
2615
|
-
type:
|
3140
|
+
import_zod26.z.object({
|
3141
|
+
requestId: import_zod26.z.string(),
|
3142
|
+
type: import_zod26.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
2616
3143
|
})
|
2617
3144
|
);
|
2618
3145
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
2619
|
-
|
2620
|
-
requestId:
|
2621
|
-
type:
|
3146
|
+
import_zod26.z.object({
|
3147
|
+
requestId: import_zod26.z.string(),
|
3148
|
+
type: import_zod26.z.literal(ActionType.APPROVE_CORRECTION).default(ActionType.APPROVE_CORRECTION)
|
2622
3149
|
})
|
2623
3150
|
);
|
2624
3151
|
var ReadActionInput = BaseActionInput.merge(
|
2625
|
-
|
2626
|
-
type:
|
3152
|
+
import_zod26.z.object({
|
3153
|
+
type: import_zod26.z.literal(ActionType.READ).default(ActionType.READ)
|
2627
3154
|
})
|
2628
3155
|
);
|
2629
|
-
var DeleteActionInput =
|
2630
|
-
var ActionInput =
|
3156
|
+
var DeleteActionInput = import_zod26.z.object({ eventId: UUID });
|
3157
|
+
var ActionInput = import_zod26.z.discriminatedUnion("type", [
|
2631
3158
|
CreateActionInput.openapi({ ref: "CreateActionInput" }),
|
2632
3159
|
ValidateActionInput.openapi({ ref: "ValidateActionInput" }),
|
2633
3160
|
RegisterActionInput.openapi({ ref: "RegisterActionInput" }),
|
@@ -2656,18 +3183,18 @@ var ActionInput = import_zod21.z.discriminatedUnion("type", [
|
|
2656
3183
|
});
|
2657
3184
|
|
2658
3185
|
// ../commons/src/events/Draft.ts
|
2659
|
-
var Draft =
|
2660
|
-
id:
|
2661
|
-
eventId:
|
2662
|
-
transactionId:
|
2663
|
-
createdAt:
|
3186
|
+
var Draft = import_zod27.z.object({
|
3187
|
+
id: UUID,
|
3188
|
+
eventId: UUID,
|
3189
|
+
transactionId: import_zod27.z.string(),
|
3190
|
+
createdAt: import_zod27.z.string().datetime(),
|
2664
3191
|
action: ActionBase.extend({
|
2665
3192
|
type: ActionTypes
|
2666
3193
|
}).omit({ id: true })
|
2667
3194
|
});
|
2668
3195
|
var DraftInput = BaseActionInput.extend({
|
2669
3196
|
type: ActionTypes,
|
2670
|
-
status:
|
3197
|
+
status: import_zod27.z.enum([
|
2671
3198
|
ActionStatus.Requested,
|
2672
3199
|
ActionStatus.Accepted,
|
2673
3200
|
ActionStatus.Rejected
|
@@ -2675,25 +3202,24 @@ var DraftInput = BaseActionInput.extend({
|
|
2675
3202
|
});
|
2676
3203
|
|
2677
3204
|
// ../commons/src/events/EventInput.ts
|
2678
|
-
var
|
2679
|
-
var
|
2680
|
-
|
2681
|
-
|
2682
|
-
|
2683
|
-
});
|
3205
|
+
var import_zod28 = require("zod");
|
3206
|
+
var import_uuid8 = require("uuid");
|
3207
|
+
var EventInput = import_zod28.z.object({
|
3208
|
+
transactionId: import_zod28.z.string(),
|
3209
|
+
type: import_zod28.z.string()
|
3210
|
+
}).openapi({ default: { transactionId: (0, import_uuid8.v4)(), type: "v2.birth" } });
|
2684
3211
|
|
2685
3212
|
// ../commons/src/events/EventDocument.ts
|
2686
|
-
var
|
2687
|
-
var
|
2688
|
-
(0,
|
2689
|
-
var EventDocument =
|
2690
|
-
id:
|
2691
|
-
type:
|
2692
|
-
|
2693
|
-
|
2694
|
-
|
2695
|
-
|
2696
|
-
trackingId: import_zod24.z.string()
|
3213
|
+
var import_zod29 = require("zod");
|
3214
|
+
var import_zod_openapi11 = require("zod-openapi");
|
3215
|
+
(0, import_zod_openapi11.extendZodWithOpenApi)(import_zod29.z);
|
3216
|
+
var EventDocument = import_zod29.z.object({
|
3217
|
+
id: UUID,
|
3218
|
+
type: import_zod29.z.string(),
|
3219
|
+
createdAt: import_zod29.z.string().datetime(),
|
3220
|
+
updatedAt: import_zod29.z.string().datetime(),
|
3221
|
+
actions: import_zod29.z.array(Action),
|
3222
|
+
trackingId: import_zod29.z.string()
|
2697
3223
|
}).openapi({ ref: "EventDocument" });
|
2698
3224
|
|
2699
3225
|
// ../commons/src/events/state/utils.ts
|
@@ -2730,6 +3256,7 @@ function getDeclarationActionCreationMetadata(actionType, actions) {
|
|
2730
3256
|
createdAtLocation: requestAction?.createdAtLocation ?? acceptAction.createdAtLocation,
|
2731
3257
|
acceptedAt: acceptAction.createdAt,
|
2732
3258
|
createdByRole: requestAction?.createdByRole ?? acceptAction.createdByRole,
|
3259
|
+
createdBySignature: requestAction?.createdBySignature ?? acceptAction.createdBySignature,
|
2733
3260
|
registrationNumber
|
2734
3261
|
};
|
2735
3262
|
}
|
@@ -2850,23 +3377,34 @@ function getAssignedUserFromActions(actions) {
|
|
2850
3377
|
return user2;
|
2851
3378
|
}, null);
|
2852
3379
|
}
|
3380
|
+
function getAssignedUserSignatureFromActions(actions) {
|
3381
|
+
return actions.reduce((signature, action) => {
|
3382
|
+
if (action.type === ActionType.ASSIGN) {
|
3383
|
+
return action.createdBySignature || null;
|
3384
|
+
}
|
3385
|
+
if (action.type === ActionType.UNASSIGN) {
|
3386
|
+
return null;
|
3387
|
+
}
|
3388
|
+
return signature;
|
3389
|
+
}, null);
|
3390
|
+
}
|
2853
3391
|
function aggregateActionDeclarations(actions) {
|
2854
3392
|
const excludedActions = [
|
2855
3393
|
ActionType.REQUEST_CORRECTION,
|
2856
3394
|
ActionType.PRINT_CERTIFICATE
|
2857
3395
|
];
|
2858
|
-
return actions.reduce((
|
3396
|
+
return actions.reduce((declaration, action) => {
|
2859
3397
|
if (excludedActions.some((excludedAction) => excludedAction === action.type)) {
|
2860
|
-
return
|
3398
|
+
return declaration;
|
2861
3399
|
}
|
2862
3400
|
if (action.type === ActionType.APPROVE_CORRECTION) {
|
2863
3401
|
const requestAction = actions.find(({ id }) => id === action.requestId);
|
2864
3402
|
if (!requestAction) {
|
2865
|
-
return
|
3403
|
+
return declaration;
|
2866
3404
|
}
|
2867
|
-
return deepMerge(
|
3405
|
+
return deepMerge(declaration, requestAction.declaration);
|
2868
3406
|
}
|
2869
|
-
return deepMerge(
|
3407
|
+
return deepMerge(declaration, action.declaration);
|
2870
3408
|
}, {});
|
2871
3409
|
}
|
2872
3410
|
function deepDropNulls(obj) {
|
@@ -2894,7 +3432,7 @@ function getAcceptedActions(event2) {
|
|
2894
3432
|
);
|
2895
3433
|
}
|
2896
3434
|
var DEFAULT_DATE_OF_EVENT_PROPERTY = "createdAt";
|
2897
|
-
function getCurrentEventState(event2) {
|
3435
|
+
function getCurrentEventState(event2, config) {
|
2898
3436
|
const creationAction = event2.actions.find(
|
2899
3437
|
(action) => action.type === ActionType.CREATE
|
2900
3438
|
);
|
@@ -2906,9 +3444,17 @@ function getCurrentEventState(event2) {
|
|
2906
3444
|
event2.actions
|
2907
3445
|
);
|
2908
3446
|
const declaration = aggregateActionDeclarations(acceptedActions);
|
2909
|
-
|
2910
|
-
|
2911
|
-
|
3447
|
+
let dateOfEvent;
|
3448
|
+
if (config.dateOfEvent) {
|
3449
|
+
const parsedDate = ZodDate.safeParse(
|
3450
|
+
declaration[config.dateOfEvent.$$field]
|
3451
|
+
);
|
3452
|
+
if (parsedDate.success) {
|
3453
|
+
dateOfEvent = parsedDate.data;
|
3454
|
+
}
|
3455
|
+
} else {
|
3456
|
+
dateOfEvent = event2[DEFAULT_DATE_OF_EVENT_PROPERTY].split("T")[0];
|
3457
|
+
}
|
2912
3458
|
return deepDropNulls({
|
2913
3459
|
id: event2.id,
|
2914
3460
|
type: event2.type,
|
@@ -2917,19 +3463,24 @@ function getCurrentEventState(event2) {
|
|
2917
3463
|
createdAt: creationAction.createdAt,
|
2918
3464
|
createdBy: creationAction.createdBy,
|
2919
3465
|
createdAtLocation: creationAction.createdAtLocation,
|
3466
|
+
createdBySignature: creationAction.createdBySignature,
|
2920
3467
|
updatedAt: declarationUpdateMetadata.createdAt,
|
2921
3468
|
assignedTo: getAssignedUserFromActions(acceptedActions),
|
3469
|
+
assignedToSignature: getAssignedUserSignatureFromActions(acceptedActions),
|
2922
3470
|
updatedBy: declarationUpdateMetadata.createdBy,
|
2923
3471
|
updatedAtLocation: declarationUpdateMetadata.createdAtLocation,
|
2924
3472
|
declaration,
|
2925
3473
|
trackingId: event2.trackingId,
|
2926
|
-
// @TODO: unify this with rest of the code. It will trip us if updatedBy has different rules than updatedByUserRole
|
2927
3474
|
updatedByUserRole: declarationUpdateMetadata.createdByRole,
|
2928
3475
|
dateOfEvent,
|
2929
3476
|
flags: getFlagsFromActions(event2.actions)
|
2930
3477
|
});
|
2931
3478
|
}
|
2932
|
-
function getCurrentEventStateWithDrafts(
|
3479
|
+
function getCurrentEventStateWithDrafts({
|
3480
|
+
event: event2,
|
3481
|
+
drafts,
|
3482
|
+
configuration
|
3483
|
+
}) {
|
2933
3484
|
const actions = event2.actions.slice().sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
2934
3485
|
const activeDrafts = findActiveDrafts(event2, drafts).map((draft) => draft.action).flatMap((action) => {
|
2935
3486
|
if (action.type === ActionType.REQUEST_CORRECTION) {
|
@@ -2948,7 +3499,7 @@ function getCurrentEventStateWithDrafts(event2, drafts) {
|
|
2948
3499
|
...event2,
|
2949
3500
|
actions: actionWithDrafts
|
2950
3501
|
};
|
2951
|
-
return getCurrentEventState(withDrafts);
|
3502
|
+
return getCurrentEventState(withDrafts, configuration);
|
2952
3503
|
}
|
2953
3504
|
function applyDraftsToEventIndex(eventIndex, drafts) {
|
2954
3505
|
const indexedAt = eventIndex.updatedAt;
|
@@ -3002,73 +3553,45 @@ function generateTransactionId() {
|
|
3002
3553
|
return getUUID();
|
3003
3554
|
}
|
3004
3555
|
|
3556
|
+
// ../commons/src/events/User.ts
|
3557
|
+
var import_zod30 = require("zod");
|
3558
|
+
var User = import_zod30.z.object({
|
3559
|
+
id: import_zod30.z.string(),
|
3560
|
+
name: import_zod30.z.array(
|
3561
|
+
import_zod30.z.object({
|
3562
|
+
use: import_zod30.z.string(),
|
3563
|
+
given: import_zod30.z.array(import_zod30.z.string()),
|
3564
|
+
family: import_zod30.z.string()
|
3565
|
+
})
|
3566
|
+
),
|
3567
|
+
role: import_zod30.z.string(),
|
3568
|
+
signatureFilename: import_zod30.z.string().optional()
|
3569
|
+
});
|
3570
|
+
|
3005
3571
|
// ../commons/src/events/test.utils.ts
|
3006
3572
|
var import_lodash2 = require("lodash");
|
3573
|
+
var import_addDays = __toESM(require("date-fns/addDays"));
|
3007
3574
|
|
3008
3575
|
// ../commons/src/field-config/field-configuration.ts
|
3009
|
-
function
|
3576
|
+
function createFieldConfig(fieldId, options) {
|
3010
3577
|
const baseField = {
|
3011
3578
|
fieldId,
|
3012
|
-
fieldType: "field"
|
3579
|
+
fieldType: "field",
|
3580
|
+
...options
|
3013
3581
|
};
|
3582
|
+
return createSearchConfig(baseField);
|
3583
|
+
}
|
3584
|
+
|
3585
|
+
// ../commons/src/events/field.ts
|
3586
|
+
function field(fieldId, options = {}) {
|
3014
3587
|
return {
|
3015
|
-
/**
|
3016
|
-
* Creates a range configuration for the specified field.
|
3017
|
-
*
|
3018
|
-
* @returns An object containing the field ID and a configuration object with a type of 'range'.
|
3019
|
-
*
|
3020
|
-
* @example field('age').range()
|
3021
|
-
* // {
|
3022
|
-
* // fieldId: 'age',
|
3023
|
-
* // config: { type: 'range' }
|
3024
|
-
* // }
|
3025
|
-
*/
|
3026
|
-
range: () => ({
|
3027
|
-
...baseField,
|
3028
|
-
config: { type: "range" }
|
3029
|
-
}),
|
3030
|
-
/**
|
3031
|
-
* Creates a configuration for exact matching of the specified field.
|
3032
|
-
* @returns An object containing the field ID and a configuration object with a type of 'exact'.
|
3033
|
-
* @example field('dob').exact()
|
3034
|
-
* // {
|
3035
|
-
* // fieldId: 'dob',
|
3036
|
-
* // config: { type: 'exact' }
|
3037
|
-
* // }
|
3038
|
-
*/
|
3039
|
-
exact: () => ({
|
3040
|
-
...baseField,
|
3041
|
-
config: { type: "exact" }
|
3042
|
-
}),
|
3043
|
-
/**
|
3044
|
-
* Creates a configuration for fuzzy matching of the specified field.
|
3045
|
-
* @returns An object containing the field ID and a configuration object with a type of 'exact'.
|
3046
|
-
* @example field('name').fuzzy()
|
3047
|
-
* // {
|
3048
|
-
* // fieldId: 'name',
|
3049
|
-
* // config: { type: 'fuzzy' }
|
3050
|
-
* // }
|
3051
|
-
*/
|
3052
|
-
fuzzy: () => ({
|
3053
|
-
...baseField,
|
3054
|
-
config: { type: "fuzzy" }
|
3055
|
-
})
|
3056
|
-
};
|
3057
|
-
}
|
3058
|
-
|
3059
|
-
// ../commons/src/events/field.ts
|
3060
|
-
function field(fieldId) {
|
3061
|
-
return {
|
3062
|
-
/**
|
3063
|
-
* @private Internal property used for field reference tracking.
|
3064
|
-
*/
|
3065
|
-
_fieldId: fieldId,
|
3066
3588
|
...createFieldConditionals(fieldId),
|
3067
|
-
...
|
3589
|
+
...createFieldConfig(fieldId, options)
|
3068
3590
|
};
|
3069
3591
|
}
|
3070
3592
|
|
3071
|
-
// ../commons/src/fixtures/
|
3593
|
+
// ../commons/src/fixtures/forms.ts
|
3594
|
+
var import_date_fns2 = require("date-fns");
|
3072
3595
|
var PRINT_CERTIFICATE_FORM = defineActionForm({
|
3073
3596
|
label: {
|
3074
3597
|
id: "v2.event.tennis-club-membership.action.certificate.form.label",
|
@@ -3886,108 +4409,627 @@ var TENNIS_CLUB_DECLARATION_FORM = defineDeclarationForm({
|
|
3886
4409
|
]
|
3887
4410
|
},
|
3888
4411
|
{
|
3889
|
-
id: "senior-pass",
|
3890
|
-
conditional: field("applicant.dob").isBefore().date("1950-01-01"),
|
4412
|
+
id: "senior-pass",
|
4413
|
+
conditional: field("applicant.dob").isBefore().date("1950-01-01"),
|
4414
|
+
title: {
|
4415
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.title",
|
4416
|
+
defaultMessage: "Assign senior pass for applicant",
|
4417
|
+
description: "This is the title of the section"
|
4418
|
+
},
|
4419
|
+
fields: [
|
4420
|
+
{
|
4421
|
+
id: "senior-pass.id",
|
4422
|
+
type: FieldType.TEXT,
|
4423
|
+
required: true,
|
4424
|
+
label: {
|
4425
|
+
defaultMessage: "Senior pass ID",
|
4426
|
+
description: "This is the label for the field",
|
4427
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.field.id.label"
|
4428
|
+
}
|
4429
|
+
}
|
4430
|
+
]
|
4431
|
+
},
|
4432
|
+
{
|
4433
|
+
id: "recommender",
|
4434
|
+
title: {
|
4435
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.title",
|
4436
|
+
defaultMessage: "Who is recommending the applicant?",
|
4437
|
+
description: "This is the title of the section"
|
4438
|
+
},
|
4439
|
+
fields: [
|
4440
|
+
{
|
4441
|
+
id: "recommender.none",
|
4442
|
+
type: "CHECKBOX",
|
4443
|
+
required: false,
|
4444
|
+
conditionals: [],
|
4445
|
+
label: {
|
4446
|
+
defaultMessage: "No recommender",
|
4447
|
+
description: "This is the label for the field",
|
4448
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.none.label"
|
4449
|
+
}
|
4450
|
+
},
|
4451
|
+
{
|
4452
|
+
id: "recommender.firstname",
|
4453
|
+
type: FieldType.TEXT,
|
4454
|
+
required: true,
|
4455
|
+
conditionals: [
|
4456
|
+
{
|
4457
|
+
type: ConditionalType.SHOW,
|
4458
|
+
conditional: field("recommender.none").isFalsy()
|
4459
|
+
}
|
4460
|
+
],
|
4461
|
+
label: {
|
4462
|
+
defaultMessage: "Recommender's first name",
|
4463
|
+
description: "This is the label for the field",
|
4464
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label"
|
4465
|
+
}
|
4466
|
+
},
|
4467
|
+
{
|
4468
|
+
id: "recommender.surname",
|
4469
|
+
type: FieldType.TEXT,
|
4470
|
+
required: true,
|
4471
|
+
conditionals: [
|
4472
|
+
{
|
4473
|
+
type: ConditionalType.SHOW,
|
4474
|
+
conditional: field("recommender.none").isFalsy()
|
4475
|
+
}
|
4476
|
+
],
|
4477
|
+
label: {
|
4478
|
+
defaultMessage: "Recommender's surname",
|
4479
|
+
description: "This is the label for the field",
|
4480
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label"
|
4481
|
+
}
|
4482
|
+
},
|
4483
|
+
{
|
4484
|
+
id: "recommender.id",
|
4485
|
+
type: FieldType.TEXT,
|
4486
|
+
required: true,
|
4487
|
+
conditionals: [
|
4488
|
+
{
|
4489
|
+
type: ConditionalType.SHOW,
|
4490
|
+
conditional: field("recommender.none").isFalsy()
|
4491
|
+
}
|
4492
|
+
],
|
4493
|
+
label: {
|
4494
|
+
defaultMessage: "Recommender's membership ID",
|
4495
|
+
description: "This is the label for the field",
|
4496
|
+
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.id.label"
|
4497
|
+
}
|
4498
|
+
}
|
4499
|
+
]
|
4500
|
+
}
|
4501
|
+
]
|
4502
|
+
});
|
4503
|
+
var statusOptions = [
|
4504
|
+
{
|
4505
|
+
value: "ALL",
|
4506
|
+
label: {
|
4507
|
+
defaultMessage: "Any status",
|
4508
|
+
description: "Option for form field: status of record",
|
4509
|
+
id: "v2.advancedSearch.form.recordStatusAny"
|
4510
|
+
}
|
4511
|
+
},
|
4512
|
+
{
|
4513
|
+
value: EventStatus.CREATED,
|
4514
|
+
label: {
|
4515
|
+
defaultMessage: "Draft",
|
4516
|
+
description: "Option for form field: status of record",
|
4517
|
+
id: "v2.advancedSearch.form.recordStatusCreated"
|
4518
|
+
}
|
4519
|
+
},
|
4520
|
+
{
|
4521
|
+
value: EventStatus.NOTIFIED,
|
4522
|
+
label: {
|
4523
|
+
defaultMessage: "Notified",
|
4524
|
+
description: "Option for form field: status of record",
|
4525
|
+
id: "v2.advancedSearch.form.recordStatusNotified"
|
4526
|
+
}
|
4527
|
+
},
|
4528
|
+
{
|
4529
|
+
value: EventStatus.DECLARED,
|
4530
|
+
label: {
|
4531
|
+
defaultMessage: "Declared",
|
4532
|
+
description: "Option for form field: status of record",
|
4533
|
+
id: "v2.advancedSearch.form.recordStatusDeclared"
|
4534
|
+
}
|
4535
|
+
},
|
4536
|
+
{
|
4537
|
+
value: EventStatus.VALIDATED,
|
4538
|
+
label: {
|
4539
|
+
defaultMessage: "Validated",
|
4540
|
+
description: "Option for form field: status of record",
|
4541
|
+
id: "v2.advancedSearch.form.recordStatusValidated"
|
4542
|
+
}
|
4543
|
+
},
|
4544
|
+
{
|
4545
|
+
value: EventStatus.REGISTERED,
|
4546
|
+
label: {
|
4547
|
+
defaultMessage: "Registered",
|
4548
|
+
description: "Option for form field: status of record",
|
4549
|
+
id: "v2.advancedSearch.form.recordStatusRegistered"
|
4550
|
+
}
|
4551
|
+
},
|
4552
|
+
{
|
4553
|
+
value: EventStatus.CERTIFIED,
|
4554
|
+
label: {
|
4555
|
+
defaultMessage: "Certified",
|
4556
|
+
description: "Option for form field: status of record",
|
4557
|
+
id: "v2.advancedSearch.form.recordStatusCertified"
|
4558
|
+
}
|
4559
|
+
},
|
4560
|
+
{
|
4561
|
+
value: EventStatus.REJECTED,
|
4562
|
+
label: {
|
4563
|
+
defaultMessage: "Rejected",
|
4564
|
+
description: "Option for form field: status of record",
|
4565
|
+
id: "v2.advancedSearch.form.recordStatusRejected"
|
4566
|
+
}
|
4567
|
+
},
|
4568
|
+
{
|
4569
|
+
value: EventStatus.ARCHIVED,
|
4570
|
+
label: {
|
4571
|
+
defaultMessage: "Archived",
|
4572
|
+
description: "Option for form field: status of record",
|
4573
|
+
id: "v2.advancedSearch.form.recordStatusArchived"
|
4574
|
+
}
|
4575
|
+
}
|
4576
|
+
];
|
4577
|
+
var timePeriodOptions = [
|
4578
|
+
{
|
4579
|
+
label: {
|
4580
|
+
defaultMessage: "Last 7 days",
|
4581
|
+
description: "Label for option of time period select: last 7 days",
|
4582
|
+
id: "form.section.label.timePeriodLast7Days"
|
4583
|
+
},
|
4584
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4585
|
+
/* @__PURE__ */ new Date(),
|
4586
|
+
"yyyy-MM-dd"
|
4587
|
+
)}`
|
4588
|
+
},
|
4589
|
+
{
|
4590
|
+
label: {
|
4591
|
+
defaultMessage: "Last 30 days",
|
4592
|
+
description: "Label for option of time period select: last 30 days",
|
4593
|
+
id: "form.section.label.timePeriodLast30Days"
|
4594
|
+
},
|
4595
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subMonths)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4596
|
+
/* @__PURE__ */ new Date(),
|
4597
|
+
"yyyy-MM-dd"
|
4598
|
+
)}`
|
4599
|
+
},
|
4600
|
+
{
|
4601
|
+
label: {
|
4602
|
+
defaultMessage: "Last 90 days",
|
4603
|
+
description: "Label for option of time period select: last 90 days",
|
4604
|
+
id: "form.section.label.timePeriodLast90Days"
|
4605
|
+
},
|
4606
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subQuarters)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4607
|
+
/* @__PURE__ */ new Date(),
|
4608
|
+
"yyyy-MM-dd"
|
4609
|
+
)}`
|
4610
|
+
},
|
4611
|
+
{
|
4612
|
+
label: {
|
4613
|
+
defaultMessage: "Last year",
|
4614
|
+
description: "Label for option of time period select: last year",
|
4615
|
+
id: "form.section.label.timePeriodLastYear"
|
4616
|
+
},
|
4617
|
+
value: `${(0, import_date_fns2.format)((0, import_date_fns2.subYears)(/* @__PURE__ */ new Date(), 1), "yyyy-MM-dd")},${(0, import_date_fns2.format)(
|
4618
|
+
/* @__PURE__ */ new Date(),
|
4619
|
+
"yyyy-MM-dd"
|
4620
|
+
)}`
|
4621
|
+
}
|
4622
|
+
];
|
4623
|
+
|
4624
|
+
// ../commons/src/fixtures/tennis-club-membership-event.ts
|
4625
|
+
var tennisClubMembershipEvent = defineConfig({
|
4626
|
+
id: TENNIS_CLUB_MEMBERSHIP,
|
4627
|
+
label: {
|
4628
|
+
defaultMessage: "Tennis club membership application",
|
4629
|
+
description: "This is what this event is referred as in the system",
|
4630
|
+
id: "v2.event.tennis-club-membership.label"
|
4631
|
+
},
|
4632
|
+
title: {
|
4633
|
+
defaultMessage: "{applicant.firstname} {applicant.surname}",
|
4634
|
+
description: "This is the title of the summary",
|
4635
|
+
id: "v2.event.tennis-club-membership.title"
|
4636
|
+
},
|
4637
|
+
summary: {
|
4638
|
+
fields: [
|
4639
|
+
{
|
4640
|
+
id: "applicant.firstname",
|
4641
|
+
label: {
|
4642
|
+
defaultMessage: "Applicant's first name",
|
4643
|
+
description: "This is the label for the field",
|
4644
|
+
id: "event.tennis-club-membership.summary.field.firstname.label"
|
4645
|
+
},
|
4646
|
+
value: {
|
4647
|
+
defaultMessage: "{applicant.firstname}",
|
4648
|
+
description: "This is the value to show in the summary",
|
4649
|
+
id: "event.tennis-club-membership.summary.field.firstname"
|
4650
|
+
},
|
4651
|
+
emptyValueMessage: {
|
4652
|
+
defaultMessage: "First name is not provided",
|
4653
|
+
description: "This is the message to show when the field is empty",
|
4654
|
+
id: "event.tennis-club-membership.summary.field.firstname.empty"
|
4655
|
+
}
|
4656
|
+
},
|
4657
|
+
{
|
4658
|
+
fieldId: "applicant.surname",
|
4659
|
+
label: {
|
4660
|
+
defaultMessage: "Applicant's last name",
|
4661
|
+
description: "Label for surname",
|
4662
|
+
id: "v2.event.tennis-club-membership.summary.field.surname.label"
|
4663
|
+
}
|
4664
|
+
},
|
4665
|
+
{
|
4666
|
+
fieldId: "applicant.email"
|
4667
|
+
}
|
4668
|
+
]
|
4669
|
+
},
|
4670
|
+
actions: [
|
4671
|
+
{
|
4672
|
+
type: ActionType.READ,
|
4673
|
+
label: {
|
4674
|
+
id: "v2.event.tennis-club-membership.action.read.label",
|
4675
|
+
defaultMessage: "Read",
|
4676
|
+
description: "Title of the read only page"
|
4677
|
+
},
|
4678
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4679
|
+
},
|
4680
|
+
{
|
4681
|
+
type: ActionType.DECLARE,
|
4682
|
+
label: {
|
4683
|
+
defaultMessage: "Send an application",
|
4684
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4685
|
+
id: "event.tennis-club-membership.action.declare.label"
|
4686
|
+
},
|
4687
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4688
|
+
},
|
4689
|
+
{
|
4690
|
+
type: ActionType.VALIDATE,
|
4691
|
+
label: {
|
4692
|
+
defaultMessage: "Validate",
|
4693
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4694
|
+
id: "event.tennis-club-membership.action.validate.label"
|
4695
|
+
},
|
4696
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4697
|
+
},
|
4698
|
+
{
|
4699
|
+
type: ActionType.REGISTER,
|
4700
|
+
label: {
|
4701
|
+
defaultMessage: "Register",
|
4702
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4703
|
+
id: "event.tennis-club-membership.action.register.label"
|
4704
|
+
},
|
4705
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4706
|
+
},
|
4707
|
+
{
|
4708
|
+
type: ActionType.REQUEST_CORRECTION,
|
4709
|
+
label: {
|
4710
|
+
defaultMessage: "Request correction",
|
4711
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4712
|
+
id: "event.tennis-club-membership.action.correction.request.label"
|
4713
|
+
},
|
4714
|
+
onboardingForm: [
|
4715
|
+
{
|
4716
|
+
id: "correction-requester",
|
4717
|
+
type: PageTypes.enum.FORM,
|
4718
|
+
title: {
|
4719
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
4720
|
+
defaultMessage: "Correction requester",
|
4721
|
+
description: "This is the title of the section"
|
4722
|
+
},
|
4723
|
+
fields: [
|
4724
|
+
{
|
4725
|
+
id: "correction.requester.relationshop.intro",
|
4726
|
+
type: "PAGE_HEADER",
|
4727
|
+
label: {
|
4728
|
+
id: "correction.requester.relationshop.intro.label",
|
4729
|
+
defaultMessage: "Note: In the case that the child is now of legal age (18) then only they should be able to request a change to their birth record.",
|
4730
|
+
description: "The title for the corrector form"
|
4731
|
+
}
|
4732
|
+
},
|
4733
|
+
{
|
4734
|
+
id: "correction.requester.relationship",
|
4735
|
+
type: "RADIO_GROUP",
|
4736
|
+
label: {
|
4737
|
+
id: "v2.correction.corrector.title",
|
4738
|
+
defaultMessage: "Who is requesting a change to this record?",
|
4739
|
+
description: "The title for the corrector form"
|
4740
|
+
},
|
4741
|
+
defaultValue: "",
|
4742
|
+
options: [
|
4743
|
+
{
|
4744
|
+
value: "INFORMANT",
|
4745
|
+
label: {
|
4746
|
+
id: "v2.correction.corrector.informant",
|
4747
|
+
defaultMessage: "Informant",
|
4748
|
+
description: "Label for informant option in certificate correction form"
|
4749
|
+
}
|
4750
|
+
},
|
4751
|
+
{
|
4752
|
+
value: "ANOTHER_AGENT",
|
4753
|
+
label: {
|
4754
|
+
id: "v2.correction.corrector.anotherAgent",
|
4755
|
+
defaultMessage: "Another registration agent or field agent",
|
4756
|
+
description: "Label for another registration or field agent option in certificate correction form"
|
4757
|
+
}
|
4758
|
+
},
|
4759
|
+
{
|
4760
|
+
value: "REGISTRAR",
|
4761
|
+
label: {
|
4762
|
+
id: "v2.correction.corrector.me",
|
4763
|
+
defaultMessage: "Me (Registrar)",
|
4764
|
+
description: "Label for registrar option in certificate correction form"
|
4765
|
+
}
|
4766
|
+
},
|
4767
|
+
{
|
4768
|
+
value: "OTHER",
|
4769
|
+
label: {
|
4770
|
+
id: "v2.correction.corrector.others",
|
4771
|
+
defaultMessage: "Someone else",
|
4772
|
+
description: "Label for someone else option in certificate correction form"
|
4773
|
+
}
|
4774
|
+
}
|
4775
|
+
]
|
4776
|
+
}
|
4777
|
+
]
|
4778
|
+
},
|
4779
|
+
{
|
4780
|
+
id: "identity-check",
|
4781
|
+
type: PageTypes.enum.FORM,
|
4782
|
+
title: {
|
4783
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
4784
|
+
defaultMessage: "Verify their identity",
|
4785
|
+
description: "This is the title of the section"
|
4786
|
+
},
|
4787
|
+
fields: [
|
4788
|
+
{
|
4789
|
+
id: "correction.identity-check.instructions",
|
4790
|
+
type: "PAGE_HEADER",
|
4791
|
+
label: {
|
4792
|
+
id: "correction.corrector.identity.instruction",
|
4793
|
+
defaultMessage: "Please verify the identity of the person making this request",
|
4794
|
+
description: "The title for the corrector form"
|
4795
|
+
}
|
4796
|
+
},
|
4797
|
+
{
|
4798
|
+
id: "correction.identity-check.verified",
|
4799
|
+
type: "RADIO_GROUP",
|
4800
|
+
label: {
|
4801
|
+
id: "correction.corrector.identity.verified.label",
|
4802
|
+
defaultMessage: "Identity verified",
|
4803
|
+
description: "The title for the corrector form"
|
4804
|
+
},
|
4805
|
+
defaultValue: "",
|
4806
|
+
required: true,
|
4807
|
+
options: [
|
4808
|
+
{
|
4809
|
+
value: "VERIFIED",
|
4810
|
+
label: {
|
4811
|
+
id: "correction.corrector.identity.verified",
|
4812
|
+
defaultMessage: "I have verified their identity",
|
4813
|
+
description: "Label for verified option in corrector identity check page"
|
4814
|
+
}
|
4815
|
+
}
|
4816
|
+
]
|
4817
|
+
}
|
4818
|
+
]
|
4819
|
+
}
|
4820
|
+
],
|
4821
|
+
additionalDetailsForm: [
|
4822
|
+
{
|
4823
|
+
id: "correction-request.supporting-documents",
|
4824
|
+
type: PageTypes.enum.FORM,
|
4825
|
+
title: {
|
4826
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.verify",
|
4827
|
+
defaultMessage: "Upload supporting documents",
|
4828
|
+
description: "This is the title of the section"
|
4829
|
+
},
|
4830
|
+
fields: [
|
4831
|
+
{
|
4832
|
+
id: "correction.supportingDocs.introduction",
|
4833
|
+
type: "PAGE_HEADER",
|
4834
|
+
label: {
|
4835
|
+
id: "correction.corrector.paragraph.title",
|
4836
|
+
defaultMessage: "For all record corrections at a minimum an affidavit must be provided. For material errors and omissions eg. in paternity cases, a court order must also be provided.",
|
4837
|
+
description: "The title for the corrector form"
|
4838
|
+
}
|
4839
|
+
},
|
4840
|
+
{
|
4841
|
+
id: "correction.supportingDocs",
|
4842
|
+
type: FieldType.FILE,
|
4843
|
+
label: {
|
4844
|
+
id: "correction.corrector.title",
|
4845
|
+
defaultMessage: "Upload supporting documents",
|
4846
|
+
description: "The title for the corrector form"
|
4847
|
+
}
|
4848
|
+
},
|
4849
|
+
{
|
4850
|
+
id: "correction.request.supportingDocuments",
|
4851
|
+
type: "RADIO_GROUP",
|
4852
|
+
label: {
|
4853
|
+
id: "correction.corrector.title",
|
4854
|
+
defaultMessage: "Who is requesting a change to this record?",
|
4855
|
+
description: "The title for the corrector form"
|
4856
|
+
},
|
4857
|
+
defaultValue: "",
|
4858
|
+
configuration: {
|
4859
|
+
styles: {
|
4860
|
+
size: "NORMAL"
|
4861
|
+
}
|
4862
|
+
},
|
4863
|
+
options: [
|
4864
|
+
{
|
4865
|
+
value: "ATTEST",
|
4866
|
+
label: {
|
4867
|
+
id: "correction.supportingDocuments.attest.label",
|
4868
|
+
defaultMessage: "I attest to seeing supporting documentation and have a copy filed at my office",
|
4869
|
+
description: ""
|
4870
|
+
}
|
4871
|
+
},
|
4872
|
+
{
|
4873
|
+
value: "NOT_NEEDED",
|
4874
|
+
label: {
|
4875
|
+
id: "correction.supportingDocuments.notNeeded.label",
|
4876
|
+
defaultMessage: "No supporting documents required",
|
4877
|
+
description: ""
|
4878
|
+
}
|
4879
|
+
}
|
4880
|
+
]
|
4881
|
+
}
|
4882
|
+
]
|
4883
|
+
},
|
4884
|
+
{
|
4885
|
+
id: "correction-request.additional-details",
|
4886
|
+
type: PageTypes.enum.FORM,
|
4887
|
+
title: {
|
4888
|
+
id: "event.tennis-club-membership.action.requestCorrection.form.section.corrector",
|
4889
|
+
defaultMessage: "Reason for correction",
|
4890
|
+
description: "This is the title of the section"
|
4891
|
+
},
|
4892
|
+
fields: [
|
4893
|
+
{
|
4894
|
+
id: "correction.request.reason",
|
4895
|
+
type: FieldType.TEXT,
|
4896
|
+
label: {
|
4897
|
+
id: "correction.reason.title",
|
4898
|
+
defaultMessage: "Reason for correction?",
|
4899
|
+
description: "The title for the corrector form"
|
4900
|
+
}
|
4901
|
+
}
|
4902
|
+
]
|
4903
|
+
}
|
4904
|
+
]
|
4905
|
+
},
|
4906
|
+
{
|
4907
|
+
type: ActionType.APPROVE_CORRECTION,
|
4908
|
+
label: {
|
4909
|
+
defaultMessage: "Approve correction",
|
4910
|
+
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4911
|
+
id: "event.tennis-club-membership.action.correction.approve.label"
|
4912
|
+
}
|
4913
|
+
},
|
4914
|
+
{
|
4915
|
+
type: ActionType.PRINT_CERTIFICATE,
|
4916
|
+
label: {
|
4917
|
+
id: "v2.event.tennis-club-membership.action.collect-certificate.label",
|
4918
|
+
defaultMessage: "Print certificate",
|
4919
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4920
|
+
},
|
4921
|
+
printForm: PRINT_CERTIFICATE_FORM,
|
4922
|
+
conditionals: [
|
4923
|
+
{
|
4924
|
+
type: "SHOW",
|
4925
|
+
conditional: defineConditional({
|
4926
|
+
type: "object",
|
4927
|
+
properties: {
|
4928
|
+
$event: {
|
4929
|
+
type: "object",
|
4930
|
+
properties: {
|
4931
|
+
actions: {
|
4932
|
+
type: "array",
|
4933
|
+
contains: {
|
4934
|
+
type: "object",
|
4935
|
+
properties: {
|
4936
|
+
type: {
|
4937
|
+
const: "REGISTER"
|
4938
|
+
},
|
4939
|
+
draft: {
|
4940
|
+
type: "boolean"
|
4941
|
+
}
|
4942
|
+
},
|
4943
|
+
required: ["type"],
|
4944
|
+
not: {
|
4945
|
+
properties: {
|
4946
|
+
draft: {
|
4947
|
+
const: true
|
4948
|
+
}
|
4949
|
+
}
|
4950
|
+
}
|
4951
|
+
}
|
4952
|
+
}
|
4953
|
+
},
|
4954
|
+
required: ["actions"]
|
4955
|
+
}
|
4956
|
+
},
|
4957
|
+
required: ["$event"]
|
4958
|
+
})
|
4959
|
+
}
|
4960
|
+
]
|
4961
|
+
},
|
4962
|
+
{
|
4963
|
+
type: ActionType.ARCHIVE,
|
4964
|
+
label: {
|
4965
|
+
id: "v2.event.tennis-club-membership.action.archive.label",
|
4966
|
+
defaultMessage: "Archive",
|
4967
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4968
|
+
}
|
4969
|
+
},
|
4970
|
+
{
|
4971
|
+
type: ActionType.REJECT,
|
4972
|
+
label: {
|
4973
|
+
id: "v2.event.tennis-club-membership.action.reject.label",
|
4974
|
+
defaultMessage: "Reject",
|
4975
|
+
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4976
|
+
}
|
4977
|
+
}
|
4978
|
+
],
|
4979
|
+
advancedSearch: [
|
4980
|
+
{
|
3891
4981
|
title: {
|
3892
|
-
|
3893
|
-
|
3894
|
-
|
4982
|
+
defaultMessage: "Registration details",
|
4983
|
+
description: "The title of Registration details accordion",
|
4984
|
+
id: "v2.advancedSearch.form.registrationDetails"
|
3895
4985
|
},
|
3896
4986
|
fields: [
|
3897
|
-
|
3898
|
-
|
3899
|
-
|
3900
|
-
|
3901
|
-
label: {
|
3902
|
-
defaultMessage: "Senior pass ID",
|
3903
|
-
description: "This is the label for the field",
|
3904
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.senior-pass.field.id.label"
|
3905
|
-
}
|
3906
|
-
}
|
4987
|
+
event("legalStatus.REGISTERED.createdAtLocation").exact(),
|
4988
|
+
event("legalStatus.REGISTERED.createdAt").range(),
|
4989
|
+
event("status", statusOptions).exact(),
|
4990
|
+
event("updatedAt", timePeriodOptions).range()
|
3907
4991
|
]
|
3908
4992
|
},
|
3909
4993
|
{
|
3910
|
-
id: "recommender",
|
3911
4994
|
title: {
|
3912
|
-
|
3913
|
-
|
3914
|
-
|
4995
|
+
defaultMessage: "Applicant's details",
|
4996
|
+
description: "Applicant details search field section title",
|
4997
|
+
id: "v2.event.tennis-club-membership.search.applicants"
|
3915
4998
|
},
|
3916
4999
|
fields: [
|
3917
|
-
|
3918
|
-
|
3919
|
-
|
3920
|
-
|
3921
|
-
|
3922
|
-
|
3923
|
-
|
3924
|
-
|
3925
|
-
|
3926
|
-
|
3927
|
-
|
3928
|
-
|
3929
|
-
|
3930
|
-
|
3931
|
-
|
3932
|
-
conditionals: [
|
3933
|
-
{
|
3934
|
-
type: ConditionalType.SHOW,
|
3935
|
-
conditional: field("recommender.none").isFalsy()
|
3936
|
-
}
|
3937
|
-
],
|
3938
|
-
label: {
|
3939
|
-
defaultMessage: "Recommender's first name",
|
3940
|
-
description: "This is the label for the field",
|
3941
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.firstname.label"
|
3942
|
-
}
|
3943
|
-
},
|
3944
|
-
{
|
3945
|
-
id: "recommender.surname",
|
3946
|
-
type: FieldType.TEXT,
|
3947
|
-
required: true,
|
3948
|
-
conditionals: [
|
3949
|
-
{
|
3950
|
-
type: ConditionalType.SHOW,
|
3951
|
-
conditional: field("recommender.none").isFalsy()
|
3952
|
-
}
|
3953
|
-
],
|
3954
|
-
label: {
|
3955
|
-
defaultMessage: "Recommender's surname",
|
3956
|
-
description: "This is the label for the field",
|
3957
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.surname.label"
|
3958
|
-
}
|
3959
|
-
},
|
3960
|
-
{
|
3961
|
-
id: "recommender.id",
|
3962
|
-
type: FieldType.TEXT,
|
3963
|
-
required: true,
|
3964
|
-
conditionals: [
|
3965
|
-
{
|
3966
|
-
type: ConditionalType.SHOW,
|
3967
|
-
conditional: field("recommender.none").isFalsy()
|
3968
|
-
}
|
3969
|
-
],
|
3970
|
-
label: {
|
3971
|
-
defaultMessage: "Recommender's membership ID",
|
3972
|
-
description: "This is the label for the field",
|
3973
|
-
id: "v2.event.tennis-club-membership.action.declare.form.section.recommender.field.id.label"
|
3974
|
-
}
|
3975
|
-
}
|
5000
|
+
field("applicant.firstname").fuzzy(),
|
5001
|
+
field("applicant.surname").fuzzy(),
|
5002
|
+
field("applicant.dob").range(),
|
5003
|
+
field("applicant.email").exact()
|
5004
|
+
]
|
5005
|
+
},
|
5006
|
+
{
|
5007
|
+
title: {
|
5008
|
+
defaultMessage: "Recommender's details",
|
5009
|
+
description: "Recommender details search field section title",
|
5010
|
+
id: "v2.event.tennis-club-membership.search.recommender"
|
5011
|
+
},
|
5012
|
+
fields: [
|
5013
|
+
field("recommender.firstname").fuzzy(),
|
5014
|
+
field("recommender.surname").fuzzy()
|
3976
5015
|
]
|
3977
5016
|
}
|
3978
|
-
]
|
5017
|
+
],
|
5018
|
+
declaration: TENNIS_CLUB_DECLARATION_FORM
|
3979
5019
|
});
|
3980
|
-
|
3981
|
-
|
5020
|
+
|
5021
|
+
// ../commons/src/fixtures/football-club-membership-event.ts
|
5022
|
+
var footballClubMembershipEvent = defineConfig({
|
5023
|
+
id: "FOOTBALL_CLUB_MEMBERSHIP",
|
3982
5024
|
label: {
|
3983
|
-
defaultMessage: "
|
5025
|
+
defaultMessage: "Football club membership application",
|
3984
5026
|
description: "This is what this event is referred as in the system",
|
3985
|
-
id: "event.
|
5027
|
+
id: "event.football-club-membership.label"
|
3986
5028
|
},
|
3987
5029
|
title: {
|
3988
5030
|
defaultMessage: "{applicant.firstname} {applicant.surname}",
|
3989
5031
|
description: "This is the title of the summary",
|
3990
|
-
id: "v2.event.
|
5032
|
+
id: "v2.event.football-club-membership.title"
|
3991
5033
|
},
|
3992
5034
|
summary: {
|
3993
5035
|
fields: [
|
@@ -3996,17 +5038,17 @@ var tennisClubMembershipEvent = defineConfig({
|
|
3996
5038
|
label: {
|
3997
5039
|
defaultMessage: "Applicant's first name",
|
3998
5040
|
description: "This is the label for the field",
|
3999
|
-
id: "event.
|
5041
|
+
id: "event.football-club-membership.summary.field.firstname.label"
|
4000
5042
|
},
|
4001
5043
|
value: {
|
4002
5044
|
defaultMessage: "{applicant.firstname}",
|
4003
5045
|
description: "This is the value to show in the summary",
|
4004
|
-
id: "event.
|
5046
|
+
id: "event.football-club-membership.summary.field.firstname"
|
4005
5047
|
},
|
4006
5048
|
emptyValueMessage: {
|
4007
5049
|
defaultMessage: "First name is not provided",
|
4008
5050
|
description: "This is the message to show when the field is empty",
|
4009
|
-
id: "event.
|
5051
|
+
id: "event.football-club-membership.summary.field.firstname.empty"
|
4010
5052
|
}
|
4011
5053
|
},
|
4012
5054
|
{
|
@@ -4014,7 +5056,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4014
5056
|
label: {
|
4015
5057
|
defaultMessage: "Applicant's last name",
|
4016
5058
|
description: "Label for surname",
|
4017
|
-
id: "v2.event.
|
5059
|
+
id: "v2.event.football-club-membership.summary.field.surname.label"
|
4018
5060
|
}
|
4019
5061
|
},
|
4020
5062
|
{
|
@@ -4023,12 +5065,21 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4023
5065
|
]
|
4024
5066
|
},
|
4025
5067
|
actions: [
|
5068
|
+
{
|
5069
|
+
type: ActionType.READ,
|
5070
|
+
label: {
|
5071
|
+
id: "v2.event.football-club-membership.action.read.label",
|
5072
|
+
defaultMessage: "Read",
|
5073
|
+
description: "Title of the read only page"
|
5074
|
+
},
|
5075
|
+
review: TENNIS_CLUB_DECLARATION_REVIEW
|
5076
|
+
},
|
4026
5077
|
{
|
4027
5078
|
type: ActionType.DECLARE,
|
4028
5079
|
label: {
|
4029
5080
|
defaultMessage: "Send an application",
|
4030
5081
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4031
|
-
id: "event.
|
5082
|
+
id: "event.football-club-membership.action.declare.label"
|
4032
5083
|
},
|
4033
5084
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4034
5085
|
},
|
@@ -4037,7 +5088,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4037
5088
|
label: {
|
4038
5089
|
defaultMessage: "Validate",
|
4039
5090
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4040
|
-
id: "event.
|
5091
|
+
id: "event.football-club-membership.action.validate.label"
|
4041
5092
|
},
|
4042
5093
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4043
5094
|
},
|
@@ -4046,7 +5097,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4046
5097
|
label: {
|
4047
5098
|
defaultMessage: "Register",
|
4048
5099
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4049
|
-
id: "event.
|
5100
|
+
id: "event.football-club-membership.action.register.label"
|
4050
5101
|
},
|
4051
5102
|
review: TENNIS_CLUB_DECLARATION_REVIEW
|
4052
5103
|
},
|
@@ -4055,14 +5106,14 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4055
5106
|
label: {
|
4056
5107
|
defaultMessage: "Request correction",
|
4057
5108
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4058
|
-
id: "event.
|
5109
|
+
id: "event.football-club-membership.action.correction.request.label"
|
4059
5110
|
},
|
4060
5111
|
onboardingForm: [
|
4061
5112
|
{
|
4062
5113
|
id: "correction-requester",
|
4063
5114
|
type: PageTypes.enum.FORM,
|
4064
5115
|
title: {
|
4065
|
-
id: "event.
|
5116
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
|
4066
5117
|
defaultMessage: "Correction requester",
|
4067
5118
|
description: "This is the title of the section"
|
4068
5119
|
},
|
@@ -4126,7 +5177,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4126
5177
|
id: "identity-check",
|
4127
5178
|
type: PageTypes.enum.FORM,
|
4128
5179
|
title: {
|
4129
|
-
id: "event.
|
5180
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.verify",
|
4130
5181
|
defaultMessage: "Verify their identity",
|
4131
5182
|
description: "This is the title of the section"
|
4132
5183
|
},
|
@@ -4169,7 +5220,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4169
5220
|
id: "correction-request.supporting-documents",
|
4170
5221
|
type: PageTypes.enum.FORM,
|
4171
5222
|
title: {
|
4172
|
-
id: "event.
|
5223
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.verify",
|
4173
5224
|
defaultMessage: "Upload supporting documents",
|
4174
5225
|
description: "This is the title of the section"
|
4175
5226
|
},
|
@@ -4231,7 +5282,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4231
5282
|
id: "correction-request.additional-details",
|
4232
5283
|
type: PageTypes.enum.FORM,
|
4233
5284
|
title: {
|
4234
|
-
id: "event.
|
5285
|
+
id: "event.football-club-membership.action.requestCorrection.form.section.corrector",
|
4235
5286
|
defaultMessage: "Reason for correction",
|
4236
5287
|
description: "This is the title of the section"
|
4237
5288
|
},
|
@@ -4254,13 +5305,13 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4254
5305
|
label: {
|
4255
5306
|
defaultMessage: "Approve correction",
|
4256
5307
|
description: "This is shown as the action name anywhere the user can trigger the action from",
|
4257
|
-
id: "event.
|
5308
|
+
id: "event.football-club-membership.action.correction.approve.label"
|
4258
5309
|
}
|
4259
5310
|
},
|
4260
5311
|
{
|
4261
5312
|
type: ActionType.PRINT_CERTIFICATE,
|
4262
5313
|
label: {
|
4263
|
-
id: "v2.event.
|
5314
|
+
id: "v2.event.football-club-membership.action.collect-certificate.label",
|
4264
5315
|
defaultMessage: "Print certificate",
|
4265
5316
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4266
5317
|
},
|
@@ -4308,7 +5359,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4308
5359
|
{
|
4309
5360
|
type: ActionType.ARCHIVE,
|
4310
5361
|
label: {
|
4311
|
-
id: "v2.event.
|
5362
|
+
id: "v2.event.football-club-membership.action.archive.label",
|
4312
5363
|
defaultMessage: "Archive",
|
4313
5364
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4314
5365
|
}
|
@@ -4316,7 +5367,7 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4316
5367
|
{
|
4317
5368
|
type: ActionType.REJECT,
|
4318
5369
|
label: {
|
4319
|
-
id: "v2.event.
|
5370
|
+
id: "v2.event.football-club-membership.action.reject.label",
|
4320
5371
|
defaultMessage: "Reject",
|
4321
5372
|
description: "This is shown as the action name anywhere the user can trigger the action from"
|
4322
5373
|
}
|
@@ -4325,16 +5376,104 @@ var tennisClubMembershipEvent = defineConfig({
|
|
4325
5376
|
advancedSearch: [
|
4326
5377
|
{
|
4327
5378
|
title: {
|
4328
|
-
defaultMessage: "
|
4329
|
-
description: "
|
4330
|
-
id: "v2.
|
5379
|
+
defaultMessage: "Registration details",
|
5380
|
+
description: "The title of Registration details accordion",
|
5381
|
+
id: "v2.advancedSearch.form.registrationDetails"
|
5382
|
+
},
|
5383
|
+
fields: [
|
5384
|
+
event("legalStatus.REGISTERED.createdAtLocation").exact(),
|
5385
|
+
event("legalStatus.REGISTERED.createdAt").range(),
|
5386
|
+
event("status", statusOptions).exact(),
|
5387
|
+
event("updatedAt", timePeriodOptions).range()
|
5388
|
+
]
|
5389
|
+
},
|
5390
|
+
{
|
5391
|
+
title: {
|
5392
|
+
defaultMessage: "Applicant's details",
|
5393
|
+
description: "Applicant details search field section title",
|
5394
|
+
id: "v2.event.football-club-membership.search.applicants"
|
5395
|
+
},
|
5396
|
+
fields: [
|
5397
|
+
field("applicant.firstname").fuzzy(),
|
5398
|
+
field("applicant.surname").fuzzy(),
|
5399
|
+
field("applicant.dob").range(),
|
5400
|
+
field("applicant.email").exact()
|
5401
|
+
]
|
5402
|
+
},
|
5403
|
+
{
|
5404
|
+
title: {
|
5405
|
+
defaultMessage: "Recommender's details",
|
5406
|
+
description: "Recommender details search field section title",
|
5407
|
+
id: "v2.event.football-club-membership.search.recommender"
|
4331
5408
|
},
|
4332
|
-
fields: [
|
5409
|
+
fields: [
|
5410
|
+
field("recommender.firstname").fuzzy(),
|
5411
|
+
field("recommender.surname").fuzzy()
|
5412
|
+
]
|
4333
5413
|
}
|
4334
5414
|
],
|
4335
5415
|
declaration: TENNIS_CLUB_DECLARATION_FORM
|
4336
5416
|
});
|
4337
5417
|
|
5418
|
+
// ../commons/src/fixtures/library-membership-event.ts
|
5419
|
+
var libraryMembershipForm = defineDeclarationForm({
|
5420
|
+
label: {
|
5421
|
+
id: "v2.event.library-membership.action.declare.form.label",
|
5422
|
+
defaultMessage: "Library membership application",
|
5423
|
+
description: "This is what this form is referred as in the system"
|
5424
|
+
},
|
5425
|
+
pages: [
|
5426
|
+
{
|
5427
|
+
id: "member",
|
5428
|
+
title: {
|
5429
|
+
id: "v2.event.library-membership.action.declare.form.section.who.title",
|
5430
|
+
defaultMessage: "Who is applying for the membership?",
|
5431
|
+
description: "This is the title of the section"
|
5432
|
+
},
|
5433
|
+
fields: [
|
5434
|
+
{
|
5435
|
+
id: "member.firstname",
|
5436
|
+
type: FieldType.TEXT,
|
5437
|
+
required: true,
|
5438
|
+
conditionals: [],
|
5439
|
+
label: {
|
5440
|
+
defaultMessage: "Member's first name",
|
5441
|
+
description: "This is the label for the field",
|
5442
|
+
id: "v2.event.library-membership.action.declare.form.section.who.field.firstname.label"
|
5443
|
+
}
|
5444
|
+
},
|
5445
|
+
{
|
5446
|
+
id: "member.surname",
|
5447
|
+
type: FieldType.TEXT,
|
5448
|
+
required: true,
|
5449
|
+
conditionals: [],
|
5450
|
+
label: {
|
5451
|
+
defaultMessage: "Member's surname",
|
5452
|
+
description: "This is the label for the field",
|
5453
|
+
id: "v2.event.library-membership.action.declare.form.section.who.field.surname.label"
|
5454
|
+
}
|
5455
|
+
}
|
5456
|
+
]
|
5457
|
+
}
|
5458
|
+
]
|
5459
|
+
});
|
5460
|
+
var libraryMembershipEvent = defineConfig({
|
5461
|
+
id: "library-membership",
|
5462
|
+
label: {
|
5463
|
+
defaultMessage: "Library membership application",
|
5464
|
+
description: "This is what this event is referred as in the system",
|
5465
|
+
id: "event.library-membership.label"
|
5466
|
+
},
|
5467
|
+
title: {
|
5468
|
+
defaultMessage: "{member.firstname} {member.surname}",
|
5469
|
+
description: "This is the title of the summary",
|
5470
|
+
id: "v2.event.library-membership.title"
|
5471
|
+
},
|
5472
|
+
summary: { fields: [] },
|
5473
|
+
actions: [],
|
5474
|
+
declaration: libraryMembershipForm
|
5475
|
+
});
|
5476
|
+
|
4338
5477
|
// ../commons/src/events/test.utils.ts
|
4339
5478
|
function fieldConfigsToActionPayload(fields) {
|
4340
5479
|
return fields.reduce(
|
@@ -4382,11 +5521,11 @@ function generateActionAnnotationInput(configuration, action) {
|
|
4382
5521
|
var eventPayloadGenerator = {
|
4383
5522
|
create: (input = {}) => ({
|
4384
5523
|
transactionId: input.transactionId ?? getUUID(),
|
4385
|
-
type: input.type ??
|
5524
|
+
type: input.type ?? TENNIS_CLUB_MEMBERSHIP
|
4386
5525
|
}),
|
4387
5526
|
patch: (id, input = {}) => ({
|
4388
5527
|
transactionId: input.transactionId ?? getUUID(),
|
4389
|
-
type: input.type ??
|
5528
|
+
type: input.type ?? TENNIS_CLUB_MEMBERSHIP,
|
4390
5529
|
id
|
4391
5530
|
}),
|
4392
5531
|
draft: ({ eventId, actionType }, input = {}) => (0, import_lodash2.merge)(
|
@@ -4412,7 +5551,7 @@ var eventPayloadGenerator = {
|
|
4412
5551
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
4413
5552
|
createdBy: "@todo",
|
4414
5553
|
createdByRole: "@todo",
|
4415
|
-
createdAtLocation: "
|
5554
|
+
createdAtLocation: "a45b982a-5c7b-4bd9-8fd8-a42d0994054c"
|
4416
5555
|
}
|
4417
5556
|
},
|
4418
5557
|
input
|
@@ -4486,9 +5625,13 @@ var eventPayloadGenerator = {
|
|
4486
5625
|
transactionId: input.transactionId ?? getUUID(),
|
4487
5626
|
declaration: {},
|
4488
5627
|
// @TODO: Check whether generator is needed?
|
4489
|
-
annotation: {
|
5628
|
+
annotation: {},
|
4490
5629
|
duplicates: [],
|
4491
|
-
eventId
|
5630
|
+
eventId,
|
5631
|
+
reason: {
|
5632
|
+
message: `${ActionType.ARCHIVE}`,
|
5633
|
+
isDuplicate: isDuplicate ?? false
|
5634
|
+
}
|
4492
5635
|
}),
|
4493
5636
|
reject: (eventId, input = {}) => ({
|
4494
5637
|
type: ActionType.REJECT,
|
@@ -4499,7 +5642,8 @@ var eventPayloadGenerator = {
|
|
4499
5642
|
ActionType.REJECT
|
4500
5643
|
),
|
4501
5644
|
duplicates: [],
|
4502
|
-
eventId
|
5645
|
+
eventId,
|
5646
|
+
reason: { message: `${ActionType.REJECT}` }
|
4503
5647
|
}),
|
4504
5648
|
register: (eventId, input = {}) => ({
|
4505
5649
|
type: ActionType.REGISTER,
|
@@ -4596,9 +5740,9 @@ function generateActionDocument({
|
|
4596
5740
|
case ActionType.VALIDATE:
|
4597
5741
|
return { ...actionBase, type: action };
|
4598
5742
|
case ActionType.ARCHIVE:
|
4599
|
-
return { ...actionBase, type: action };
|
5743
|
+
return { ...actionBase, type: action, reason: { message: "Archive" } };
|
4600
5744
|
case ActionType.REJECT:
|
4601
|
-
return { ...actionBase, type: action };
|
5745
|
+
return { ...actionBase, type: action, reason: { message: "Reject" } };
|
4602
5746
|
case ActionType.CREATE:
|
4603
5747
|
return { ...actionBase, type: action };
|
4604
5748
|
case ActionType.NOTIFY:
|
@@ -4610,7 +5754,11 @@ function generateActionDocument({
|
|
4610
5754
|
case ActionType.APPROVE_CORRECTION:
|
4611
5755
|
return { ...actionBase, requestId: getUUID(), type: action };
|
4612
5756
|
case ActionType.REJECT_CORRECTION:
|
4613
|
-
return {
|
5757
|
+
return {
|
5758
|
+
...actionBase,
|
5759
|
+
requestId: getUUID(),
|
5760
|
+
type: action
|
5761
|
+
};
|
4614
5762
|
case ActionType.REGISTER:
|
4615
5763
|
return {
|
4616
5764
|
...actionBase,
|
@@ -4638,8 +5786,7 @@ function generateEventDocument({
|
|
4638
5786
|
id: getUUID(),
|
4639
5787
|
// Offset is needed so the createdAt timestamps for events, actions and drafts make logical sense in storybook tests.
|
4640
5788
|
// @TODO: This should be fixed in the future.
|
4641
|
-
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
4642
|
-
dateOfEvent: configuration.dateOfEvent
|
5789
|
+
updatedAt: new Date(Date.now() - 1e3).toISOString()
|
4643
5790
|
};
|
4644
5791
|
}
|
4645
5792
|
function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, declaration = {}) {
|
@@ -4661,21 +5808,16 @@ function generateEventDraftDocument(eventId, actionType = ActionType.DECLARE, de
|
|
4661
5808
|
eventId
|
4662
5809
|
};
|
4663
5810
|
}
|
4664
|
-
function
|
4665
|
-
|
4666
|
-
EventStatus.CREATED,
|
4667
|
-
EventStatus.REGISTERED,
|
4668
|
-
EventStatus.DECLARED
|
4669
|
-
];
|
4670
|
-
const randomIndex = Math.floor(Math.random() * 3);
|
4671
|
-
return statuses[randomIndex];
|
5811
|
+
function pickRandom(rng, items) {
|
5812
|
+
return items[Math.floor(rng() * items.length)];
|
4672
5813
|
}
|
4673
|
-
function
|
4674
|
-
const
|
4675
|
-
const
|
4676
|
-
|
5814
|
+
function getRandomDatetime(rng, start, end) {
|
5815
|
+
const range = end.getTime() - start.getTime();
|
5816
|
+
const offset = Math.floor(rng() * range);
|
5817
|
+
const randomDate = new Date(start.getTime() + offset);
|
5818
|
+
return randomDate.toISOString();
|
4677
5819
|
}
|
4678
|
-
function
|
5820
|
+
function generateRandomApplicant(rng) {
|
4679
5821
|
const firstNames = [
|
4680
5822
|
"Danny",
|
4681
5823
|
"John",
|
@@ -4696,18 +5838,13 @@ function getRandomApplicant() {
|
|
4696
5838
|
"Garcia",
|
4697
5839
|
"Miller"
|
4698
5840
|
];
|
4699
|
-
|
4700
|
-
|
4701
|
-
|
4702
|
-
|
4703
|
-
return randomDate.toISOString().split("T")[0];
|
4704
|
-
}
|
4705
|
-
const randomFirstName = firstNames[Math.floor(Math.random() * firstNames.length)];
|
4706
|
-
const randomSurname = surnames[Math.floor(Math.random() * surnames.length)];
|
4707
|
-
const randomDob = getRandomDate(
|
5841
|
+
const randomFirstName = pickRandom(rng, firstNames);
|
5842
|
+
const randomSurname = pickRandom(rng, surnames);
|
5843
|
+
const randomDob = getRandomDatetime(
|
5844
|
+
rng,
|
4708
5845
|
/* @__PURE__ */ new Date("1990-01-01"),
|
4709
5846
|
/* @__PURE__ */ new Date("2010-12-31")
|
4710
|
-
);
|
5847
|
+
).split("T")[0];
|
4711
5848
|
return {
|
4712
5849
|
"recommender.none": true,
|
4713
5850
|
"applicant.firstname": randomFirstName,
|
@@ -4715,28 +5852,84 @@ function getRandomApplicant() {
|
|
4715
5852
|
"applicant.dob": randomDob
|
4716
5853
|
};
|
4717
5854
|
}
|
4718
|
-
|
4719
|
-
|
4720
|
-
|
4721
|
-
|
4722
|
-
|
4723
|
-
|
4724
|
-
|
4725
|
-
|
4726
|
-
|
4727
|
-
|
4728
|
-
|
4729
|
-
|
4730
|
-
|
4731
|
-
|
4732
|
-
|
4733
|
-
|
4734
|
-
}
|
5855
|
+
function createPseudoRandomNumberGenerator(seed) {
|
5856
|
+
const MODULUS = 2 ** 32;
|
5857
|
+
const MULTIPLIER = 1664525;
|
5858
|
+
const INCREMENT = 1013904223;
|
5859
|
+
let state = seed >>> 0;
|
5860
|
+
return () => {
|
5861
|
+
state = (MULTIPLIER * state + INCREMENT) % MODULUS;
|
5862
|
+
return state / MODULUS;
|
5863
|
+
};
|
5864
|
+
}
|
5865
|
+
function generateUuid(rng) {
|
5866
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
5867
|
+
const r = Math.floor(rng() * 16);
|
5868
|
+
const v = c === "x" ? r : r & 3 | 8;
|
5869
|
+
return v.toString(16);
|
5870
|
+
});
|
5871
|
+
}
|
5872
|
+
function generateTrackingId(rng) {
|
5873
|
+
const uuid = generateUuid(rng).replace(/-/g, "");
|
5874
|
+
const trackingId = uuid.slice(0, 6).toUpperCase();
|
5875
|
+
return trackingId;
|
5876
|
+
}
|
5877
|
+
function generateRandomSignature(rng) {
|
5878
|
+
return `/random-bucket/${generateUuid(rng)}.png`;
|
5879
|
+
}
|
5880
|
+
var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
5881
|
+
const rng = createPseudoRandomNumberGenerator(seed);
|
5882
|
+
const createdAt = getRandomDatetime(
|
5883
|
+
rng,
|
5884
|
+
/* @__PURE__ */ new Date("2024-01-01"),
|
5885
|
+
/* @__PURE__ */ new Date("2024-12-31")
|
5886
|
+
);
|
5887
|
+
return {
|
5888
|
+
id: overrides.id ?? generateUuid(rng),
|
5889
|
+
type: overrides.type ?? TENNIS_CLUB_MEMBERSHIP,
|
5890
|
+
status: overrides.status ?? pickRandom(rng, eventStatuses),
|
5891
|
+
createdAt: overrides.createdAt ?? createdAt,
|
5892
|
+
createdBy: overrides.createdBy ?? generateUuid(rng),
|
5893
|
+
createdAtLocation: overrides.createdAtLocation ?? generateUuid(rng),
|
5894
|
+
updatedAtLocation: overrides.updatedAtLocation ?? generateUuid(rng),
|
5895
|
+
createdBySignature: overrides.createdBySignature ?? generateRandomSignature(rng),
|
5896
|
+
updatedAt: overrides.updatedAt ?? (0, import_addDays.default)(new Date(createdAt), 1).toISOString(),
|
5897
|
+
assignedTo: overrides.assignedTo ?? null,
|
5898
|
+
updatedBy: overrides.updatedBy ?? generateUuid(rng),
|
5899
|
+
updatedByUserRole: overrides.updatedByUserRole ?? "FIELD_AGENT",
|
5900
|
+
flags: [],
|
5901
|
+
legalStatuses: overrides.legalStatuses ?? {},
|
5902
|
+
declaration: overrides.declaration ?? generateRandomApplicant(rng),
|
5903
|
+
trackingId: overrides.trackingId ?? generateTrackingId(rng)
|
5904
|
+
};
|
5905
|
+
};
|
4735
5906
|
var generateTranslationConfig = (message) => ({
|
4736
5907
|
defaultMessage: message,
|
4737
5908
|
description: "Description for ${message}",
|
4738
5909
|
id: message
|
4739
5910
|
});
|
5911
|
+
var BearerTokenByUserType = {
|
5912
|
+
fieldAgent: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQuZGVjbGFyZS1iaXJ0aCIsInJlY29yZC5kZWNsYXJlLWRlYXRoIiwicmVjb3JkLmRlY2xhcmUtbWFycmlhZ2UiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWluY29tcGxldGUiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWZvci1yZXZpZXciLCJzZWFyY2guYmlydGgiLCJzZWFyY2guZGVhdGgiLCJzZWFyY2gubWFycmlhZ2UiLCJkZW1vIl0sInVzZXJUeXBlIjoidXNlciIsImlhdCI6MTc0ODUyNjQ4OCwiZXhwIjoxNzQ5MTMxMjg4LCJhdWQiOlsib3BlbmNydnM6YXV0aC11c2VyIiwib3BlbmNydnM6dXNlci1tZ250LXVzZXIiLCJvcGVuY3J2czpoZWFydGgtdXNlciIsIm9wZW5jcnZzOmdhdGV3YXktdXNlciIsIm9wZW5jcnZzOm5vdGlmaWNhdGlvbi11c2VyIiwib3BlbmNydnM6d29ya2Zsb3ctdXNlciIsIm9wZW5jcnZzOnNlYXJjaC11c2VyIiwib3BlbmNydnM6bWV0cmljcy11c2VyIiwib3BlbmNydnM6Y291bnRyeWNvbmZpZy11c2VyIiwib3BlbmNydnM6d2ViaG9va3MtdXNlciIsIm9wZW5jcnZzOmNvbmZpZy11c2VyIiwib3BlbmNydnM6ZG9jdW1lbnRzLXVzZXIiXSwiaXNzIjoib3BlbmNydnM6YXV0aC1zZXJ2aWNlIiwic3ViIjoiNjc3ZmIwODYzMGYzYWJmYTMzMDcyNzBmIn0.qLif2TmTPpqfbSUWR3TSfWf5syyCtRRJV-fDOZBtN9th-gdT0sUPZp5PB_t2QHHCLes7JLDlSA9CGNIbVvRR8a7EedXTAf0T7pwiE96PgljHSKI9jLMCYb_rhqnl8BwfsxAU3qv8EBYM9rDlcabl5iKnAOM-YLMv63CRMQxZOZ0O3Wl1Xil82dp6PqW_Lom5Qd-Esftt9BWXk5gxmqq-YegT8qU9n3hDXEsOvmIyYQvPDwmUOB-xp74CKJk_o3eBuq4TVCMYxY-tS9qkkn2A7Txhh-bzWMVNrQjQ1Yumvs8gi_F-XYTi89QbZVz8PzJ9kT8w3jshYwmAy7be9M-EQg",
|
5913
|
+
registrationAgent: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQucmVhZCIsInJlY29yZC5kZWNsYXJlLWJpcnRoIiwicmVjb3JkLmRlY2xhcmUtZGVhdGgiLCJyZWNvcmQuZGVjbGFyZS1tYXJyaWFnZSIsInJlY29yZC5kZWNsYXJhdGlvbi1lZGl0IiwicmVjb3JkLmRlY2xhcmF0aW9uLXN1Ym1pdC1mb3ItYXBwcm92YWwiLCJyZWNvcmQuZGVjbGFyYXRpb24tc3VibWl0LWZvci11cGRhdGVzIiwicmVjb3JkLmRlY2xhcmF0aW9uLWFyY2hpdmUiLCJyZWNvcmQuZGVjbGFyYXRpb24tcmVpbnN0YXRlIiwicmVjb3JkLnJlZ2lzdHJhdGlvbi1yZXF1ZXN0LWNvcnJlY3Rpb24iLCJyZWNvcmQuZGVjbGFyYXRpb24tcHJpbnQtc3VwcG9ydGluZy1kb2N1bWVudHMiLCJyZWNvcmQuZXhwb3J0LXJlY29yZHMiLCJyZWNvcmQucmVnaXN0cmF0aW9uLXByaW50Jmlzc3VlLWNlcnRpZmllZC1jb3BpZXMiLCJwZXJmb3JtYW5jZS5yZWFkIiwicGVyZm9ybWFuY2UucmVhZC1kYXNoYm9hcmRzIiwib3JnYW5pc2F0aW9uLnJlYWQtbG9jYXRpb25zOm15LW9mZmljZSIsInNlYXJjaC5iaXJ0aCIsInNlYXJjaC5kZWF0aCIsInNlYXJjaC5tYXJyaWFnZSIsImRlbW8iXSwidXNlclR5cGUiOiJ1c2VyIiwiaWF0IjoxNzQ4NTI2NDY4LCJleHAiOjE3NDkxMzEyNjgsImF1ZCI6WyJvcGVuY3J2czphdXRoLXVzZXIiLCJvcGVuY3J2czp1c2VyLW1nbnQtdXNlciIsIm9wZW5jcnZzOmhlYXJ0aC11c2VyIiwib3BlbmNydnM6Z2F0ZXdheS11c2VyIiwib3BlbmNydnM6bm90aWZpY2F0aW9uLXVzZXIiLCJvcGVuY3J2czp3b3JrZmxvdy11c2VyIiwib3BlbmNydnM6c2VhcmNoLXVzZXIiLCJvcGVuY3J2czptZXRyaWNzLXVzZXIiLCJvcGVuY3J2czpjb3VudHJ5Y29uZmlnLXVzZXIiLCJvcGVuY3J2czp3ZWJob29rcy11c2VyIiwib3BlbmNydnM6Y29uZmlnLXVzZXIiLCJvcGVuY3J2czpkb2N1bWVudHMtdXNlciJdLCJpc3MiOiJvcGVuY3J2czphdXRoLXNlcnZpY2UiLCJzdWIiOiI2NzdmYjA4NjMwZjNhYmZhMzMwNzI3MTgifQ.C0R3cda9tczdJyadyJzk_wjVx79yiQ4r2BZbrF5VMTol97CwqMk1cPKVv5xZR1fHW5nhYl1X_vsmTYx-p9oSmcAYVud-4Z24TrA3oZ214zCB8RW_RmmFzJSczwe-9Son-96JOpRJTz2F-F_SSmblF0cjndJ-iXCAbOn1hmQ1q45NqaV-oFaFWigvAaRoBFcEvGufQxss_NjRmG12ooENSfWQl0tYM9BmTw4JQo2xerwJcgaJTrtDgRagkuiR7zhVNjcoT64AQiSRp5KmWRhbU4ozlJ2tfy1ccD9jJkbQTf1AZT2pl1diusjstJYFuM9QPFPOyCO0umaxYfgSer_Hmg",
|
5914
|
+
localRegistrar: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJyZWNvcmQucmVhZCIsInJlY29yZC5kZWNsYXJlLWJpcnRoIiwicmVjb3JkLmRlY2xhcmUtZGVhdGgiLCJyZWNvcmQuZGVjbGFyZS1tYXJyaWFnZSIsInJlY29yZC5kZWNsYXJhdGlvbi1lZGl0IiwicmVjb3JkLmRlY2xhcmF0aW9uLXN1Ym1pdC1mb3ItdXBkYXRlcyIsInJlY29yZC5yZXZpZXctZHVwbGljYXRlcyIsInJlY29yZC5kZWNsYXJhdGlvbi1hcmNoaXZlIiwicmVjb3JkLmRlY2xhcmF0aW9uLXJlaW5zdGF0ZSIsInJlY29yZC5yZWdpc3RlciIsInJlY29yZC5yZWdpc3RyYXRpb24tY29ycmVjdCIsInJlY29yZC5kZWNsYXJhdGlvbi1wcmludC1zdXBwb3J0aW5nLWRvY3VtZW50cyIsInJlY29yZC5leHBvcnQtcmVjb3JkcyIsInJlY29yZC51bmFzc2lnbi1vdGhlcnMiLCJyZWNvcmQucmVnaXN0cmF0aW9uLXByaW50Jmlzc3VlLWNlcnRpZmllZC1jb3BpZXMiLCJyZWNvcmQuY29uZmlybS1yZWdpc3RyYXRpb24iLCJyZWNvcmQucmVqZWN0LXJlZ2lzdHJhdGlvbiIsInBlcmZvcm1hbmNlLnJlYWQiLCJwZXJmb3JtYW5jZS5yZWFkLWRhc2hib2FyZHMiLCJwcm9maWxlLmVsZWN0cm9uaWMtc2lnbmF0dXJlIiwib3JnYW5pc2F0aW9uLnJlYWQtbG9jYXRpb25zOm15LW9mZmljZSIsInNlYXJjaC5iaXJ0aCIsInNlYXJjaC5kZWF0aCIsInNlYXJjaC5tYXJyaWFnZSIsImRlbW8iXSwidXNlclR5cGUiOiJ1c2VyIiwiaWF0IjoxNzQ4NTI2NDIwLCJleHAiOjE3NDkxMzEyMjAsImF1ZCI6WyJvcGVuY3J2czphdXRoLXVzZXIiLCJvcGVuY3J2czp1c2VyLW1nbnQtdXNlciIsIm9wZW5jcnZzOmhlYXJ0aC11c2VyIiwib3BlbmNydnM6Z2F0ZXdheS11c2VyIiwib3BlbmNydnM6bm90aWZpY2F0aW9uLXVzZXIiLCJvcGVuY3J2czp3b3JrZmxvdy11c2VyIiwib3BlbmNydnM6c2VhcmNoLXVzZXIiLCJvcGVuY3J2czptZXRyaWNzLXVzZXIiLCJvcGVuY3J2czpjb3VudHJ5Y29uZmlnLXVzZXIiLCJvcGVuY3J2czp3ZWJob29rcy11c2VyIiwib3BlbmNydnM6Y29uZmlnLXVzZXIiLCJvcGVuY3J2czpkb2N1bWVudHMtdXNlciJdLCJpc3MiOiJvcGVuY3J2czphdXRoLXNlcnZpY2UiLCJzdWIiOiI2NzdmYjA4NjMwZjNhYmZhMzMwNzI3MjEifQ.Exwojy_1lsoPmp-kQ79SMWI0eQy8Qt7yO_ynGvb_oIVdqSwTxFkkNr9x4UxhBA-o0P6LkMZ2ELKOlSzBr3PRJ8IQnfMQ7Db8oG8HAPsY8sKqra_L6ryV088NW2e2LqAjoOX0dXRIqYMolUhF_OOuZpHW5K8nvog5SLlnJ1gKysQ1EuWBg2dcKbjkkB16v-9NGz4XHye3vcoZlalyha5OOujzbPhkmr9UGiksSIXFNbanBhkQdt-EJlLX9SXvQ4ACJWPKFb_f4gv8p84jdLiryzQux46zHPpTicZHzg0nZtoKKIH1AyFtqWfBFm4y8qWC3ht9TAk93NAXTfkS0wzxKA"
|
5915
|
+
};
|
5916
|
+
var generateWorkqueues = (slug = "all-events") => defineWorkqueues([
|
5917
|
+
{
|
5918
|
+
slug,
|
5919
|
+
name: {
|
5920
|
+
id: "workqueues.inProgress.title",
|
5921
|
+
defaultMessage: slug.charAt(0).toUpperCase() + slug.slice(1).split("-").join(" "),
|
5922
|
+
description: "Title of in progress workqueue"
|
5923
|
+
},
|
5924
|
+
query: {
|
5925
|
+
type: "and",
|
5926
|
+
clauses: [{ eventType: tennisClubMembershipEvent.id }]
|
5927
|
+
},
|
5928
|
+
actions: [],
|
5929
|
+
icon: "Draft",
|
5930
|
+
columns: []
|
5931
|
+
}
|
5932
|
+
]);
|
4740
5933
|
|
4741
5934
|
// ../commons/src/events/TemplateConfig.ts
|
4742
5935
|
function isTemplateVariable(value) {
|
@@ -4774,7 +5967,7 @@ function isFieldConfigDefaultValue(value) {
|
|
4774
5967
|
var import_lodash3 = require("lodash");
|
4775
5968
|
|
4776
5969
|
// ../commons/src/scopes.ts
|
4777
|
-
var
|
5970
|
+
var import_zod31 = require("zod");
|
4778
5971
|
var SCOPES = {
|
4779
5972
|
// TODO v1.8 legacy scopes
|
4780
5973
|
NATLSYSADMIN: "natlsysadmin",
|
@@ -4798,6 +5991,8 @@ var SCOPES = {
|
|
4798
5991
|
*/
|
4799
5992
|
RECORD_DECLARE: "record.declare-birth",
|
4800
5993
|
// declare
|
5994
|
+
RECORD_IMPORT: "record.import",
|
5995
|
+
// declare
|
4801
5996
|
RECORD_DECLARE_BIRTH: "record.declare-birth",
|
4802
5997
|
RECORD_DECLARE_BIRTH_MY_JURISDICTION: "record.declare-birth:my-jurisdiction",
|
4803
5998
|
RECORD_DECLARE_DEATH: "record.declare-death",
|
@@ -4885,107 +6080,119 @@ var SCOPES = {
|
|
4885
6080
|
// data seeding
|
4886
6081
|
USER_DATA_SEEDING: "user.data-seeding"
|
4887
6082
|
};
|
4888
|
-
var LiteralScopes =
|
4889
|
-
|
4890
|
-
|
4891
|
-
|
4892
|
-
|
4893
|
-
|
4894
|
-
|
4895
|
-
|
4896
|
-
|
4897
|
-
|
4898
|
-
|
4899
|
-
|
4900
|
-
|
4901
|
-
|
4902
|
-
|
4903
|
-
|
4904
|
-
|
4905
|
-
|
4906
|
-
|
4907
|
-
|
4908
|
-
|
4909
|
-
|
4910
|
-
|
4911
|
-
|
4912
|
-
|
4913
|
-
|
4914
|
-
|
4915
|
-
|
4916
|
-
|
4917
|
-
|
4918
|
-
|
4919
|
-
|
4920
|
-
|
4921
|
-
|
4922
|
-
|
4923
|
-
|
4924
|
-
|
4925
|
-
|
4926
|
-
|
4927
|
-
|
4928
|
-
|
4929
|
-
|
4930
|
-
|
4931
|
-
|
4932
|
-
|
4933
|
-
|
4934
|
-
|
4935
|
-
|
4936
|
-
|
4937
|
-
|
4938
|
-
|
4939
|
-
|
4940
|
-
|
4941
|
-
|
4942
|
-
|
4943
|
-
|
4944
|
-
|
4945
|
-
|
4946
|
-
|
4947
|
-
|
4948
|
-
|
4949
|
-
|
4950
|
-
|
4951
|
-
|
4952
|
-
|
4953
|
-
|
4954
|
-
|
4955
|
-
|
4956
|
-
|
4957
|
-
|
4958
|
-
|
4959
|
-
|
4960
|
-
|
4961
|
-
|
4962
|
-
|
4963
|
-
|
6083
|
+
var LiteralScopes = import_zod31.z.union([
|
6084
|
+
import_zod31.z.literal(SCOPES.NATLSYSADMIN),
|
6085
|
+
import_zod31.z.literal(SCOPES.BYPASSRATELIMIT),
|
6086
|
+
import_zod31.z.literal(SCOPES.DECLARE),
|
6087
|
+
import_zod31.z.literal(SCOPES.REGISTER),
|
6088
|
+
import_zod31.z.literal(SCOPES.VALIDATE),
|
6089
|
+
import_zod31.z.literal(SCOPES.DEMO),
|
6090
|
+
import_zod31.z.literal(SCOPES.CERTIFY),
|
6091
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE),
|
6092
|
+
import_zod31.z.literal(SCOPES.SYSADMIN),
|
6093
|
+
import_zod31.z.literal(SCOPES.TEAMS),
|
6094
|
+
import_zod31.z.literal(SCOPES.CONFIG),
|
6095
|
+
import_zod31.z.literal(SCOPES.WEBHOOK),
|
6096
|
+
import_zod31.z.literal(SCOPES.NATIONALID),
|
6097
|
+
import_zod31.z.literal(SCOPES.NOTIFICATION_API),
|
6098
|
+
import_zod31.z.literal(SCOPES.RECORDSEARCH),
|
6099
|
+
import_zod31.z.literal(SCOPES.RECORD_IMPORT),
|
6100
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH),
|
6101
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_BIRTH_MY_JURISDICTION),
|
6102
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH),
|
6103
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_DEATH_MY_JURISDICTION),
|
6104
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE),
|
6105
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARE_MARRIAGE_MY_JURISDICTION),
|
6106
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_INCOMPLETE),
|
6107
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_REVIEW),
|
6108
|
+
import_zod31.z.literal(SCOPES.RECORD_UNASSIGN_OTHERS),
|
6109
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_APPROVAL),
|
6110
|
+
import_zod31.z.literal(SCOPES.RECORD_SUBMIT_FOR_UPDATES),
|
6111
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_EDIT),
|
6112
|
+
import_zod31.z.literal(SCOPES.RECORD_REVIEW_DUPLICATES),
|
6113
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_ARCHIVE),
|
6114
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_REINSTATE),
|
6115
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTER),
|
6116
|
+
import_zod31.z.literal(SCOPES.RECORD_EXPORT_RECORDS),
|
6117
|
+
import_zod31.z.literal(SCOPES.RECORD_DECLARATION_PRINT),
|
6118
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_RECORDS_SUPPORTING_DOCUMENTS),
|
6119
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_PRINT),
|
6120
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_ISSUE_CERTIFIED_COPIES),
|
6121
|
+
import_zod31.z.literal(SCOPES.RECORD_PRINT_CERTIFIED_COPIES),
|
6122
|
+
import_zod31.z.literal(SCOPES.RECORD_BULK_PRINT_CERTIFIED_COPIES),
|
6123
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_VERIFY_CERTIFIED_COPIES),
|
6124
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_CORRECTION),
|
6125
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_CORRECT),
|
6126
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REVOCATION),
|
6127
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REVOKE),
|
6128
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REQUEST_REINSTATEMENT),
|
6129
|
+
import_zod31.z.literal(SCOPES.RECORD_REGISTRATION_REINSTATE),
|
6130
|
+
import_zod31.z.literal(SCOPES.RECORD_CONFIRM_REGISTRATION),
|
6131
|
+
import_zod31.z.literal(SCOPES.RECORD_REJECT_REGISTRATION),
|
6132
|
+
import_zod31.z.literal(SCOPES.SEARCH_BIRTH_MY_JURISDICTION),
|
6133
|
+
import_zod31.z.literal(SCOPES.SEARCH_BIRTH),
|
6134
|
+
import_zod31.z.literal(SCOPES.SEARCH_DEATH_MY_JURISDICTION),
|
6135
|
+
import_zod31.z.literal(SCOPES.SEARCH_DEATH),
|
6136
|
+
import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE_MY_JURISDICTION),
|
6137
|
+
import_zod31.z.literal(SCOPES.SEARCH_MARRIAGE),
|
6138
|
+
import_zod31.z.literal(SCOPES.RECORD_READ),
|
6139
|
+
import_zod31.z.literal(SCOPES.RECORD_READ_AUDIT),
|
6140
|
+
import_zod31.z.literal(SCOPES.RECORD_READ_COMMENTS),
|
6141
|
+
import_zod31.z.literal(SCOPES.RECORD_CREATE_COMMENTS),
|
6142
|
+
import_zod31.z.literal(SCOPES.PROFILE_UPDATE),
|
6143
|
+
import_zod31.z.literal(SCOPES.PROFILE_ELECTRONIC_SIGNATURE),
|
6144
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_READ),
|
6145
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_READ_DASHBOARDS),
|
6146
|
+
import_zod31.z.literal(SCOPES.PERFORMANCE_EXPORT_VITAL_STATISTICS),
|
6147
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS),
|
6148
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_OFFICE),
|
6149
|
+
import_zod31.z.literal(SCOPES.ORGANISATION_READ_LOCATIONS_MY_JURISDICTION),
|
6150
|
+
import_zod31.z.literal(SCOPES.USER_READ),
|
6151
|
+
import_zod31.z.literal(SCOPES.USER_READ_MY_OFFICE),
|
6152
|
+
import_zod31.z.literal(SCOPES.USER_READ_MY_JURISDICTION),
|
6153
|
+
import_zod31.z.literal(SCOPES.USER_READ_ONLY_MY_AUDIT),
|
6154
|
+
import_zod31.z.literal(SCOPES.USER_CREATE),
|
6155
|
+
import_zod31.z.literal(SCOPES.USER_CREATE_MY_JURISDICTION),
|
6156
|
+
import_zod31.z.literal(SCOPES.USER_UPDATE),
|
6157
|
+
import_zod31.z.literal(SCOPES.USER_UPDATE_MY_JURISDICTION),
|
6158
|
+
import_zod31.z.literal(SCOPES.CONFIG_UPDATE_ALL),
|
6159
|
+
import_zod31.z.literal(SCOPES.USER_DATA_SEEDING)
|
4964
6160
|
]);
|
4965
|
-
var rawConfigurableScopeRegex = /^([a-zA-Z]
|
4966
|
-
var rawConfigurableScope =
|
4967
|
-
var CreateUserScope =
|
4968
|
-
type:
|
4969
|
-
options:
|
4970
|
-
role:
|
6161
|
+
var rawConfigurableScopeRegex = /^([a-zA-Z\.]+)\[((?:\w+=[\w.-]+(?:\|[\w.-]+)*)(?:,[\w]+=[\w.-]+(?:\|[\w.-]+)*)*)\]$/;
|
6162
|
+
var rawConfigurableScope = import_zod31.z.string().regex(rawConfigurableScopeRegex);
|
6163
|
+
var CreateUserScope = import_zod31.z.object({
|
6164
|
+
type: import_zod31.z.literal("user.create"),
|
6165
|
+
options: import_zod31.z.object({
|
6166
|
+
role: import_zod31.z.array(import_zod31.z.string())
|
4971
6167
|
})
|
4972
6168
|
});
|
4973
|
-
var EditUserScope =
|
4974
|
-
type:
|
4975
|
-
options:
|
4976
|
-
role:
|
6169
|
+
var EditUserScope = import_zod31.z.object({
|
6170
|
+
type: import_zod31.z.literal("user.edit"),
|
6171
|
+
options: import_zod31.z.object({
|
6172
|
+
role: import_zod31.z.array(import_zod31.z.string())
|
4977
6173
|
})
|
4978
6174
|
});
|
4979
|
-
var
|
6175
|
+
var WorkqueueScope = import_zod31.z.object({
|
6176
|
+
type: import_zod31.z.literal("workqueue"),
|
6177
|
+
options: import_zod31.z.object({
|
6178
|
+
id: import_zod31.z.array(import_zod31.z.string())
|
6179
|
+
})
|
6180
|
+
});
|
6181
|
+
var NotifyRecordScope = import_zod31.z.object({
|
6182
|
+
type: import_zod31.z.literal("record.notify"),
|
6183
|
+
options: import_zod31.z.object({
|
6184
|
+
event: import_zod31.z.array(import_zod31.z.string())
|
6185
|
+
})
|
6186
|
+
});
|
6187
|
+
var ConfigurableScopes = import_zod31.z.discriminatedUnion("type", [
|
4980
6188
|
CreateUserScope,
|
4981
|
-
EditUserScope
|
6189
|
+
EditUserScope,
|
6190
|
+
WorkqueueScope,
|
6191
|
+
NotifyRecordScope
|
4982
6192
|
]);
|
4983
6193
|
var scopes = Object.values(SCOPES);
|
4984
6194
|
|
4985
6195
|
// ../commons/src/events/scopes.ts
|
4986
|
-
function hasAnyOfScopes(a, b) {
|
4987
|
-
return (0, import_lodash3.intersection)(a, b).length > 0;
|
4988
|
-
}
|
4989
6196
|
var CONFIG_GET_ALLOWED_SCOPES = [
|
4990
6197
|
SCOPES.RECORD_DECLARE,
|
4991
6198
|
SCOPES.RECORD_READ,
|
@@ -5043,6 +6250,28 @@ var ACTION_ALLOWED_SCOPES = {
|
|
5043
6250
|
[ActionType.UNASSIGN]: null,
|
5044
6251
|
[ActionType.DETECT_DUPLICATE]: []
|
5045
6252
|
};
|
6253
|
+
var ACTION_ALLOWED_CONFIGURABLE_SCOPES = {
|
6254
|
+
[ActionType.READ]: [],
|
6255
|
+
[ActionType.CREATE]: ["record.notify"],
|
6256
|
+
[ActionType.NOTIFY]: ["record.notify"],
|
6257
|
+
[ActionType.DECLARE]: [],
|
6258
|
+
[ActionType.DELETE]: [],
|
6259
|
+
[ActionType.VALIDATE]: [],
|
6260
|
+
[ActionType.REGISTER]: [],
|
6261
|
+
[ActionType.PRINT_CERTIFICATE]: [],
|
6262
|
+
[ActionType.REQUEST_CORRECTION]: [],
|
6263
|
+
[ActionType.REJECT_CORRECTION]: [],
|
6264
|
+
[ActionType.APPROVE_CORRECTION]: [],
|
6265
|
+
[ActionType.MARKED_AS_DUPLICATE]: [],
|
6266
|
+
[ActionType.ARCHIVE]: [],
|
6267
|
+
[ActionType.REJECT]: [],
|
6268
|
+
[ActionType.ASSIGN]: [],
|
6269
|
+
[ActionType.UNASSIGN]: [],
|
6270
|
+
[ActionType.DETECT_DUPLICATE]: []
|
6271
|
+
};
|
6272
|
+
function hasAnyOfScopes(a, b) {
|
6273
|
+
return (0, import_lodash3.intersection)(a, b).length > 0;
|
6274
|
+
}
|
5046
6275
|
function filterUnallowedActions(actions, userScopes) {
|
5047
6276
|
const allowedActions = actions.filter((action) => {
|
5048
6277
|
const requiredScopes = ACTION_ALLOWED_SCOPES[action];
|
@@ -5059,3 +6288,65 @@ function filterUnallowedActions(actions, userScopes) {
|
|
5059
6288
|
}
|
5060
6289
|
return [ActionType.READ];
|
5061
6290
|
}
|
6291
|
+
|
6292
|
+
// ../commons/src/events/serializers/user/deserializer.ts
|
6293
|
+
var import_zod32 = require("zod");
|
6294
|
+
var UserWithPrimaryOffice = User.extend({
|
6295
|
+
primaryOfficeId: import_zod32.z.string()
|
6296
|
+
});
|
6297
|
+
function userDeserializer(serializedUserField, user2) {
|
6298
|
+
if (typeof serializedUserField === "string") {
|
6299
|
+
return serializedUserField;
|
6300
|
+
}
|
6301
|
+
if (serializedUserField.$userField === "name" || serializedUserField.$userField === "signatureFilename") {
|
6302
|
+
throw new Error(
|
6303
|
+
`Deserializer for ${serializedUserField.$userField} is not implemented yet`
|
6304
|
+
);
|
6305
|
+
}
|
6306
|
+
return user2[serializedUserField.$userField];
|
6307
|
+
}
|
6308
|
+
function deserializeQueryExpression(expression, user2) {
|
6309
|
+
return {
|
6310
|
+
...expression,
|
6311
|
+
assignedTo: expression.assignedTo && {
|
6312
|
+
...expression.assignedTo,
|
6313
|
+
term: userDeserializer(expression.assignedTo.term, user2)
|
6314
|
+
},
|
6315
|
+
createdBy: expression.createdBy && {
|
6316
|
+
...expression.createdBy,
|
6317
|
+
term: userDeserializer(expression.createdBy.term, user2)
|
6318
|
+
},
|
6319
|
+
updatedBy: expression.updatedBy && {
|
6320
|
+
...expression.updatedBy,
|
6321
|
+
term: userDeserializer(expression.updatedBy.term, user2)
|
6322
|
+
},
|
6323
|
+
createdAtLocation: expression.createdAtLocation && (expression.createdAtLocation.type === "within" ? {
|
6324
|
+
...expression.createdAtLocation,
|
6325
|
+
location: userDeserializer(
|
6326
|
+
expression.createdAtLocation.location,
|
6327
|
+
user2
|
6328
|
+
)
|
6329
|
+
} : {
|
6330
|
+
...expression.createdAtLocation,
|
6331
|
+
term: userDeserializer(expression.createdAtLocation.term, user2)
|
6332
|
+
}),
|
6333
|
+
updatedAtLocation: expression.updatedAtLocation && (expression.updatedAtLocation.type === "within" ? {
|
6334
|
+
...expression.updatedAtLocation,
|
6335
|
+
location: userDeserializer(
|
6336
|
+
expression.updatedAtLocation.location,
|
6337
|
+
user2
|
6338
|
+
)
|
6339
|
+
} : {
|
6340
|
+
...expression.updatedAtLocation,
|
6341
|
+
term: userDeserializer(expression.updatedAtLocation.term, user2)
|
6342
|
+
})
|
6343
|
+
};
|
6344
|
+
}
|
6345
|
+
function deserializeQuery(query, user2) {
|
6346
|
+
return {
|
6347
|
+
...query,
|
6348
|
+
clauses: query.clauses.map(
|
6349
|
+
(clause) => deserializeQueryExpression(clause, user2)
|
6350
|
+
)
|
6351
|
+
};
|
6352
|
+
}
|