@opencrvs/toolkit 1.8.1-rc.e23b224 → 1.8.1-rc.fa83f7b
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 +49 -24
- package/dist/commons/events/ActionDocument.d.ts +59 -23
- package/dist/commons/events/ActionInput.d.ts +50 -14
- package/dist/commons/events/AdvancedSearchConfig.d.ts +65 -47
- package/dist/commons/events/CountryConfigQueryInput.d.ts +88 -88
- package/dist/commons/events/EventConfig.d.ts +31 -31
- package/dist/commons/events/EventDocument.d.ts +39 -13
- package/dist/commons/events/EventIndex.d.ts +174 -52
- package/dist/commons/events/EventMetadata.d.ts +9 -9
- package/dist/commons/events/FieldConfig.d.ts +1 -8
- package/dist/commons/events/WorkqueueConfig.d.ts +288 -164
- package/dist/commons/events/defineConfig.d.ts +3 -3
- package/dist/commons/events/event.d.ts +13 -5
- package/dist/commons/events/field.d.ts +14 -0
- package/dist/commons/events/test.utils.d.ts +5 -1
- package/dist/commons/events/utils.d.ts +4 -4
- package/dist/conditionals/index.js +2 -2
- package/dist/events/index.js +88 -70
- package/package.json +1 -1
@@ -8657,7 +8657,7 @@ export declare const defineConfig: (config: EventConfigInput) => {
|
|
8657
8657
|
title: import("./TranslationConfig").TranslationConfig;
|
8658
8658
|
fields: ({
|
8659
8659
|
config: {
|
8660
|
-
type: "exact" | "fuzzy" | "range";
|
8660
|
+
type: "exact" | "fuzzy" | "range" | "within";
|
8661
8661
|
};
|
8662
8662
|
fieldId: string;
|
8663
8663
|
fieldType: "field";
|
@@ -8684,9 +8684,9 @@ export declare const defineConfig: (config: EventConfigInput) => {
|
|
8684
8684
|
excludeInSearchQuery?: boolean | undefined;
|
8685
8685
|
} | {
|
8686
8686
|
config: {
|
8687
|
-
type: "exact" | "fuzzy" | "range";
|
8687
|
+
type: "exact" | "fuzzy" | "range" | "within";
|
8688
8688
|
};
|
8689
|
-
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
|
8689
|
+
fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
|
8690
8690
|
fieldType: "event";
|
8691
8691
|
options?: {
|
8692
8692
|
value: string;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ActionType } from './ActionType';
|
2
|
-
import {
|
2
|
+
import { EventFieldIdInput } from './AdvancedSearchConfig';
|
3
3
|
import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConfig';
|
4
4
|
/**
|
5
5
|
* Creates a function that acts like a callable + static method container.
|
@@ -8,9 +8,9 @@ import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConf
|
|
8
8
|
* event('status') // → returns search config
|
9
9
|
* event.hasAction('CLICKED') // → returns conditional
|
10
10
|
*/
|
11
|
-
declare function eventFn(fieldId:
|
11
|
+
declare function eventFn(fieldId: EventFieldIdInput): {
|
12
12
|
range: () => {
|
13
|
-
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
|
13
|
+
fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
|
14
14
|
fieldType: "event";
|
15
15
|
} & {
|
16
16
|
config: {
|
@@ -18,7 +18,7 @@ declare function eventFn(fieldId: EventFieldId): {
|
|
18
18
|
};
|
19
19
|
};
|
20
20
|
exact: () => {
|
21
|
-
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
|
21
|
+
fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
|
22
22
|
fieldType: "event";
|
23
23
|
} & {
|
24
24
|
config: {
|
@@ -26,13 +26,21 @@ declare function eventFn(fieldId: EventFieldId): {
|
|
26
26
|
};
|
27
27
|
};
|
28
28
|
fuzzy: () => {
|
29
|
-
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
|
29
|
+
fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
|
30
30
|
fieldType: "event";
|
31
31
|
} & {
|
32
32
|
config: {
|
33
33
|
type: "fuzzy";
|
34
34
|
};
|
35
35
|
};
|
36
|
+
within: () => {
|
37
|
+
fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
|
38
|
+
fieldType: "event";
|
39
|
+
} & {
|
40
|
+
config: {
|
41
|
+
type: "within";
|
42
|
+
};
|
43
|
+
};
|
36
44
|
};
|
37
45
|
declare const event: typeof eventFn & {
|
38
46
|
/**
|
@@ -56,6 +56,20 @@ export declare function field(fieldId: string, options?: {
|
|
56
56
|
type: "fuzzy";
|
57
57
|
};
|
58
58
|
};
|
59
|
+
within: () => {
|
60
|
+
options?: SelectOption[];
|
61
|
+
excludeInSearchQuery?: boolean;
|
62
|
+
alternateFieldIds?: string[];
|
63
|
+
conditionals?: FieldConditional[];
|
64
|
+
validations?: ValidationConfig[];
|
65
|
+
searchCriteriaLabelPrefix?: TranslationConfig;
|
66
|
+
fieldId: string;
|
67
|
+
fieldType: "field";
|
68
|
+
} & {
|
69
|
+
config: {
|
70
|
+
type: "within";
|
71
|
+
};
|
72
|
+
};
|
59
73
|
$$field: string;
|
60
74
|
isAfter: () => {
|
61
75
|
days: (days: number) => {
|
@@ -414,7 +414,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
|
|
414
414
|
requestId: string;
|
415
415
|
keepAssignment: boolean | undefined;
|
416
416
|
};
|
417
|
-
reject: (eventId: string, requestId: string, input
|
417
|
+
reject: (eventId: string, requestId: string, input: Partial<Pick<RejectCorrectionActionInput, "transactionId" | "annotation" | "keepAssignment" | "reason">>) => {
|
418
418
|
type: "REJECT_CORRECTION";
|
419
419
|
transactionId: string;
|
420
420
|
declaration: {};
|
@@ -422,6 +422,10 @@ export declare function eventPayloadGenerator(rng: () => number): {
|
|
422
422
|
eventId: string;
|
423
423
|
requestId: string;
|
424
424
|
keepAssignment: boolean | undefined;
|
425
|
+
reason: {
|
426
|
+
message: string;
|
427
|
+
isDuplicate?: boolean | undefined;
|
428
|
+
};
|
425
429
|
};
|
426
430
|
};
|
427
431
|
};
|
@@ -4723,7 +4723,7 @@ export declare const getActionAnnotationFields: (actionConfig: ActionConfig) =>
|
|
4723
4723
|
hideLabel?: boolean | undefined;
|
4724
4724
|
uncorrectable?: boolean | undefined;
|
4725
4725
|
})[];
|
4726
|
-
export declare function getAllUniqueFields(eventConfig: EventConfig):
|
4726
|
+
export declare function getAllUniqueFields(eventConfig: EventConfig): FieldConfig[];
|
4727
4727
|
export declare function getDeclarationFieldById(config: EventConfig, fieldId: string): FieldConfig;
|
4728
4728
|
/**
|
4729
4729
|
* @TODO: Request correction should have same format as print certificate
|
@@ -15520,7 +15520,7 @@ export declare function getEventConfigById(eventConfigs: EventConfig[], id: stri
|
|
15520
15520
|
title: import("./TranslationConfig").TranslationConfig;
|
15521
15521
|
fields: ({
|
15522
15522
|
config: {
|
15523
|
-
type: "exact" | "fuzzy" | "range";
|
15523
|
+
type: "exact" | "fuzzy" | "range" | "within";
|
15524
15524
|
};
|
15525
15525
|
fieldId: string;
|
15526
15526
|
fieldType: "field";
|
@@ -15547,9 +15547,9 @@ export declare function getEventConfigById(eventConfigs: EventConfig[], id: stri
|
|
15547
15547
|
excludeInSearchQuery?: boolean | undefined;
|
15548
15548
|
} | {
|
15549
15549
|
config: {
|
15550
|
-
type: "exact" | "fuzzy" | "range";
|
15550
|
+
type: "exact" | "fuzzy" | "range" | "within";
|
15551
15551
|
};
|
15552
|
-
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
|
15552
|
+
fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
|
15553
15553
|
fieldType: "event";
|
15554
15554
|
options?: {
|
15555
15555
|
value: string;
|
@@ -287,8 +287,8 @@ function createFieldConditionals(fieldId) {
|
|
287
287
|
properties: {
|
288
288
|
[fieldId]: {
|
289
289
|
type: "string",
|
290
|
-
pattern: "^[\\p{Script=Latin}0-9'
|
291
|
-
description: "Name must contain only letters, numbers, and allowed special characters ('
|
290
|
+
pattern: "^[\\p{Script=Latin}0-9'.-]*(\\([\\p{Script=Latin}0-9'.-]+\\))?[\\p{Script=Latin}0-9'.-]*( [\\p{Script=Latin}0-9'.-]*(\\([\\p{Script=Latin}0-9'.-]+\\))?[\\p{Script=Latin}0-9'.-]*)*$",
|
291
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('.-). No double spaces."
|
292
292
|
}
|
293
293
|
}
|
294
294
|
}),
|
package/dist/events/index.js
CHANGED
@@ -40,6 +40,7 @@ __export(events_exports, {
|
|
40
40
|
ActionConfigBase: () => ActionConfigBase,
|
41
41
|
ActionCreationMetadata: () => ActionCreationMetadata,
|
42
42
|
ActionDocument: () => ActionDocument,
|
43
|
+
ActionFlag: () => ActionFlag,
|
43
44
|
ActionFormConfig: () => ActionFormConfig,
|
44
45
|
ActionInput: () => ActionInput,
|
45
46
|
ActionStatus: () => ActionStatus,
|
@@ -95,6 +96,7 @@ __export(events_exports, {
|
|
95
96
|
EventDocument: () => EventDocument,
|
96
97
|
EventFieldConfigSchema: () => EventFieldConfigSchema,
|
97
98
|
EventFieldId: () => EventFieldId,
|
99
|
+
EventFieldIdInput: () => EventFieldIdInput,
|
98
100
|
EventIndex: () => EventIndex,
|
99
101
|
EventInput: () => EventInput,
|
100
102
|
EventMetadata: () => EventMetadata,
|
@@ -129,6 +131,7 @@ __export(events_exports, {
|
|
129
131
|
InherentFlags: () => InherentFlags,
|
130
132
|
LanguageConfig: () => LanguageConfig,
|
131
133
|
LegalStatuses: () => LegalStatuses,
|
134
|
+
METADATA_FIELD_PREFIX: () => METADATA_FIELD_PREFIX,
|
132
135
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
133
136
|
MimeType: () => MimeType,
|
134
137
|
NameFieldUpdateValue: () => NameFieldUpdateValue,
|
@@ -139,7 +142,7 @@ __export(events_exports, {
|
|
139
142
|
PageConfig: () => PageConfig,
|
140
143
|
PageTypes: () => PageTypes,
|
141
144
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
142
|
-
|
145
|
+
PrintContent: () => PrintContent,
|
143
146
|
QueryExpression: () => QueryExpression,
|
144
147
|
QueryInput: () => QueryInput,
|
145
148
|
QueryType: () => QueryType,
|
@@ -179,7 +182,6 @@ __export(events_exports, {
|
|
179
182
|
ValidationConfig: () => ValidationConfig,
|
180
183
|
VerificationActionConfig: () => VerificationActionConfig,
|
181
184
|
VerificationPageConfig: () => VerificationPageConfig,
|
182
|
-
VisibleStatus: () => VisibleStatus,
|
183
185
|
WRITE_ACTION_SCOPES: () => WRITE_ACTION_SCOPES,
|
184
186
|
Within: () => Within,
|
185
187
|
WorkqueueActionsWithDefault: () => WorkqueueActionsWithDefault,
|
@@ -555,7 +557,7 @@ var import_zod6 = require("zod");
|
|
555
557
|
var import_zod4 = require("zod");
|
556
558
|
var import_zod_openapi3 = require("zod-openapi");
|
557
559
|
(0, import_zod_openapi3.extendZodWithOpenApi)(import_zod4.z);
|
558
|
-
var
|
560
|
+
var FullDocumentUrl = import_zod4.z.string().brand("FullDocumentUrl").describe(
|
559
561
|
"A full url with protocol, host, bucket name, starting from the root of the S3 server, https://minio/bucket-name/document-id.jpg"
|
560
562
|
);
|
561
563
|
var FullDocumentPath = import_zod4.z.string().transform((val) => val.startsWith("/") ? val : `/${val}`).openapi({ effectType: "input", type: "string" }).describe(
|
@@ -607,8 +609,8 @@ var UrbanAddressUpdateValue = AdminStructure.extend({
|
|
607
609
|
zipCode: import_zod5.z.string().nullish()
|
608
610
|
});
|
609
611
|
var NameFieldValue = import_zod5.z.object({
|
610
|
-
firstname: import_zod5.z.string(),
|
611
|
-
surname: import_zod5.z.string(),
|
612
|
+
firstname: import_zod5.z.string().min(1),
|
613
|
+
surname: import_zod5.z.string().min(1),
|
612
614
|
middlename: import_zod5.z.string().optional()
|
613
615
|
});
|
614
616
|
var NameFieldUpdateValue = import_zod5.z.object({
|
@@ -1341,7 +1343,7 @@ var SummaryConfig = import_zod14.z.object({
|
|
1341
1343
|
|
1342
1344
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
1343
1345
|
var import_zod15 = require("zod");
|
1344
|
-
var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range"]);
|
1346
|
+
var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range", "within"]);
|
1345
1347
|
var BaseField3 = import_zod15.z.object({
|
1346
1348
|
config: import_zod15.z.object({
|
1347
1349
|
type: MatchType.describe("Determines the type of field")
|
@@ -1395,22 +1397,30 @@ var FieldConfigSchema = BaseField3.extend({
|
|
1395
1397
|
fieldType: import_zod15.z.literal("field"),
|
1396
1398
|
alternateFieldIds: import_zod15.z.array(import_zod15.z.string()).optional().describe(
|
1397
1399
|
`Sometimes there might be need to search a value against multiple field of same FormField type. For example
|
1398
|
-
search Country, Province, District against child.address.private and child.address.other. In such case, we
|
1400
|
+
search Country, Province, District against child.address.private and child.address.other. In such case, we
|
1399
1401
|
add a one field as fieldId, and accomodate others in alternateFieldIds`
|
1400
1402
|
),
|
1401
|
-
excludeInSearchQuery: import_zod15.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
|
1402
|
-
conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
|
1403
|
+
excludeInSearchQuery: import_zod15.z.boolean().default(false).optional().describe(`Sometimes there will be search fields which are used to
|
1404
|
+
conditionally display another search field, but its not needed in search query. For example, child.placeOfBirth
|
1403
1405
|
is select field, which has 3 options, FACILITY, PRIVATE_HOME, OTHER. Upon selecting any of the option, pops up another field
|
1404
1406
|
related to the selected option, whose value is required in the search query. But child.placeOfBirth itself is not needed in the query.
|
1405
1407
|
In such case, populate this field (excludeInSearchQuery) with boolean true`)
|
1406
1408
|
});
|
1407
|
-
var
|
1409
|
+
var EventFieldIdInput = import_zod15.z.enum([
|
1408
1410
|
"trackingId",
|
1409
1411
|
"status",
|
1410
1412
|
"legalStatuses.REGISTERED.acceptedAt",
|
1411
1413
|
"legalStatuses.REGISTERED.createdAtLocation",
|
1412
1414
|
"updatedAt"
|
1413
1415
|
]);
|
1416
|
+
var METADATA_FIELD_PREFIX = "event.";
|
1417
|
+
var EventFieldId = import_zod15.z.enum([
|
1418
|
+
`${METADATA_FIELD_PREFIX}trackingId`,
|
1419
|
+
`${METADATA_FIELD_PREFIX}status`,
|
1420
|
+
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.acceptedAt`,
|
1421
|
+
`${METADATA_FIELD_PREFIX}legalStatuses.REGISTERED.createdAtLocation`,
|
1422
|
+
`${METADATA_FIELD_PREFIX}updatedAt`
|
1423
|
+
]);
|
1414
1424
|
var EventFieldConfigSchema = BaseField3.extend({
|
1415
1425
|
fieldId: EventFieldId,
|
1416
1426
|
fieldType: import_zod15.z.literal("event")
|
@@ -1903,14 +1913,15 @@ var ActionBase = import_zod19.z.object({
|
|
1903
1913
|
originalActionId: UUID.optional().nullable().describe(
|
1904
1914
|
"Reference to the original action that was asynchronously rejected or accepted by 3rd party integration."
|
1905
1915
|
)
|
1906
|
-
// '
|
1907
|
-
// Each action can define its own
|
1916
|
+
// 'content' field reserved for additional data
|
1917
|
+
// Each action can define its own content specifc to the action
|
1908
1918
|
// See PrintCertificateAction
|
1909
1919
|
});
|
1910
1920
|
var AssignedAction = ActionBase.merge(
|
1911
1921
|
import_zod19.z.object({
|
1912
1922
|
type: import_zod19.z.literal(ActionType.ASSIGN),
|
1913
1923
|
assignedTo: import_zod19.z.string()
|
1924
|
+
// TODO move into 'content' property
|
1914
1925
|
})
|
1915
1926
|
);
|
1916
1927
|
var UnassignedAction = ActionBase.merge(
|
@@ -1922,6 +1933,7 @@ var RegisterAction = ActionBase.merge(
|
|
1922
1933
|
import_zod19.z.object({
|
1923
1934
|
type: import_zod19.z.literal(ActionType.REGISTER),
|
1924
1935
|
registrationNumber: import_zod19.z.string().optional()
|
1936
|
+
// TODO move into 'content' property
|
1925
1937
|
})
|
1926
1938
|
);
|
1927
1939
|
var DeclareAction = ActionBase.merge(
|
@@ -1942,6 +1954,7 @@ var RejectAction = ActionBase.merge(
|
|
1942
1954
|
import_zod19.z.object({
|
1943
1955
|
type: import_zod19.z.literal(ActionType.REJECT),
|
1944
1956
|
reason: RejectionReason
|
1957
|
+
// TODO move into 'content' property
|
1945
1958
|
})
|
1946
1959
|
);
|
1947
1960
|
var MarkAsDuplicateAction = ActionBase.merge(
|
@@ -1953,6 +1966,7 @@ var ArchiveAction = ActionBase.merge(
|
|
1953
1966
|
import_zod19.z.object({
|
1954
1967
|
type: import_zod19.z.literal(ActionType.ARCHIVE),
|
1955
1968
|
reason: RejectionReason
|
1969
|
+
// TODO move into 'content' property
|
1956
1970
|
})
|
1957
1971
|
);
|
1958
1972
|
var CreatedAction = ActionBase.merge(
|
@@ -1965,13 +1979,13 @@ var NotifiedAction = ActionBase.merge(
|
|
1965
1979
|
type: import_zod19.z.literal(ActionType.NOTIFY)
|
1966
1980
|
})
|
1967
1981
|
);
|
1968
|
-
var
|
1982
|
+
var PrintContent = import_zod19.z.object({
|
1969
1983
|
templateId: import_zod19.z.string().optional()
|
1970
1984
|
});
|
1971
1985
|
var PrintCertificateAction = ActionBase.merge(
|
1972
1986
|
import_zod19.z.object({
|
1973
1987
|
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE),
|
1974
|
-
|
1988
|
+
content: PrintContent.optional().nullable()
|
1975
1989
|
})
|
1976
1990
|
);
|
1977
1991
|
var RequestedCorrectionAction = ActionBase.merge(
|
@@ -1983,12 +1997,15 @@ var ApprovedCorrectionAction = ActionBase.merge(
|
|
1983
1997
|
import_zod19.z.object({
|
1984
1998
|
type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
|
1985
1999
|
requestId: import_zod19.z.string()
|
2000
|
+
// TODO move into 'content' property
|
1986
2001
|
})
|
1987
2002
|
);
|
1988
2003
|
var RejectedCorrectionAction = ActionBase.merge(
|
1989
2004
|
import_zod19.z.object({
|
1990
2005
|
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
|
1991
|
-
requestId: import_zod19.z.string()
|
2006
|
+
requestId: import_zod19.z.string(),
|
2007
|
+
// TODO move into 'content' property
|
2008
|
+
reason: RejectionReason
|
1992
2009
|
})
|
1993
2010
|
);
|
1994
2011
|
var ReadAction = ActionBase.merge(
|
@@ -2712,16 +2729,16 @@ function timePeriodToDateRange(value) {
|
|
2712
2729
|
let startDate;
|
2713
2730
|
switch (value) {
|
2714
2731
|
case "last7Days":
|
2715
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2732
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7);
|
2716
2733
|
break;
|
2717
2734
|
case "last30Days":
|
2718
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2735
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 30);
|
2719
2736
|
break;
|
2720
2737
|
case "last90Days":
|
2721
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2738
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 90);
|
2722
2739
|
break;
|
2723
2740
|
case "last365Days":
|
2724
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2741
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 365);
|
2725
2742
|
break;
|
2726
2743
|
}
|
2727
2744
|
return {
|
@@ -3088,8 +3105,8 @@ function createFieldConditionals(fieldId) {
|
|
3088
3105
|
properties: {
|
3089
3106
|
[fieldId]: {
|
3090
3107
|
type: "string",
|
3091
|
-
pattern: "^[\\p{Script=Latin}0-9'
|
3092
|
-
description: "Name must contain only letters, numbers, and allowed special characters ('
|
3108
|
+
pattern: "^[\\p{Script=Latin}0-9'.-]*(\\([\\p{Script=Latin}0-9'.-]+\\))?[\\p{Script=Latin}0-9'.-]*( [\\p{Script=Latin}0-9'.-]*(\\([\\p{Script=Latin}0-9'.-]+\\))?[\\p{Script=Latin}0-9'.-]*)*$",
|
3109
|
+
description: "Name must contain only letters, numbers, and allowed special characters ('.-). No double spaces."
|
3093
3110
|
}
|
3094
3111
|
}
|
3095
3112
|
}),
|
@@ -3182,6 +3199,19 @@ function createSearchConfig(baseField) {
|
|
3182
3199
|
fuzzy: () => ({
|
3183
3200
|
...baseField,
|
3184
3201
|
config: { type: "fuzzy" }
|
3202
|
+
}),
|
3203
|
+
/**
|
3204
|
+
* Creates a configuration for matching locations and the child locations
|
3205
|
+
* @returns An object containing the field ID and a configuration object with a type of 'within'.
|
3206
|
+
* @example field('createdAtLocation').within()
|
3207
|
+
* // {
|
3208
|
+
* // ...
|
3209
|
+
* // config: { type: 'within' }
|
3210
|
+
* // }
|
3211
|
+
*/
|
3212
|
+
within: () => ({
|
3213
|
+
...baseField,
|
3214
|
+
config: { type: "within" }
|
3185
3215
|
})
|
3186
3216
|
};
|
3187
3217
|
}
|
@@ -3189,7 +3219,7 @@ function createSearchConfig(baseField) {
|
|
3189
3219
|
// ../commons/src/event-config/event-configuration.ts
|
3190
3220
|
function createEventFieldConfig(fieldId) {
|
3191
3221
|
const baseField = {
|
3192
|
-
fieldId
|
3222
|
+
fieldId: `${METADATA_FIELD_PREFIX}${fieldId}`,
|
3193
3223
|
fieldType: "event"
|
3194
3224
|
};
|
3195
3225
|
return createSearchConfig(baseField);
|
@@ -3246,24 +3276,23 @@ var EventStatus = import_zod23.z.enum([
|
|
3246
3276
|
"DECLARED",
|
3247
3277
|
"VALIDATED",
|
3248
3278
|
"REGISTERED",
|
3249
|
-
"CERTIFIED",
|
3250
3279
|
"ARCHIVED"
|
3251
3280
|
]);
|
3252
|
-
var VisibleStatus = import_zod23.z.enum([...EventStatus.options, "REJECTED"]);
|
3253
3281
|
var InherentFlags = {
|
3254
|
-
|
3282
|
+
PENDING_CERTIFICATION: "pending-certification",
|
3255
3283
|
INCOMPLETE: "incomplete",
|
3256
3284
|
REJECTED: "rejected",
|
3257
3285
|
CORRECTION_REQUESTED: "correction-requested"
|
3258
3286
|
};
|
3259
|
-
var
|
3287
|
+
var ActionFlag = import_zod23.z.string().regex(
|
3260
3288
|
new RegExp(
|
3261
3289
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
3262
3290
|
ActionStatus
|
3263
3291
|
).join("|").toLowerCase()})$`
|
3264
3292
|
),
|
3265
3293
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
3266
|
-
)
|
3294
|
+
);
|
3295
|
+
var Flag = ActionFlag.or(import_zod23.z.nativeEnum(InherentFlags));
|
3267
3296
|
var ZodDate = import_zod23.z.string().date();
|
3268
3297
|
var ActionCreationMetadata = import_zod23.z.object({
|
3269
3298
|
createdAt: import_zod23.z.string().datetime().describe("The timestamp when the action request was created."),
|
@@ -3531,6 +3560,9 @@ var QueryExpression = import_zod25.z.object({
|
|
3531
3560
|
createdAt: import_zod25.z.optional(DateCondition),
|
3532
3561
|
updatedAt: import_zod25.z.optional(DateCondition),
|
3533
3562
|
"legalStatuses.REGISTERED.acceptedAt": import_zod25.z.optional(DateCondition),
|
3563
|
+
"legalStatuses.DECLARED.createdAtLocation": import_zod25.z.optional(
|
3564
|
+
import_zod25.z.union([Within, Exact])
|
3565
|
+
),
|
3534
3566
|
"legalStatuses.REGISTERED.createdAtLocation": import_zod25.z.optional(
|
3535
3567
|
import_zod25.z.union([Within, Exact])
|
3536
3568
|
),
|
@@ -3776,7 +3808,8 @@ var WorkqueueConfig = import_zod28.z.object({
|
|
3776
3808
|
})
|
3777
3809
|
),
|
3778
3810
|
columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3779
|
-
icon: AvailableIcons
|
3811
|
+
icon: AvailableIcons,
|
3812
|
+
emptyMessage: TranslationConfig.optional()
|
3780
3813
|
}).describe("Configuration for workqueue.");
|
3781
3814
|
var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
3782
3815
|
query: true,
|
@@ -3795,7 +3828,8 @@ var WorkqueueConfigInput = import_zod28.z.object({
|
|
3795
3828
|
})
|
3796
3829
|
),
|
3797
3830
|
columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3798
|
-
icon: AvailableIcons
|
3831
|
+
icon: AvailableIcons,
|
3832
|
+
emptyMessage: TranslationConfig.optional()
|
3799
3833
|
});
|
3800
3834
|
function defineWorkqueue(workqueueInput) {
|
3801
3835
|
const queryInput = workqueueInput.query;
|
@@ -3885,7 +3919,7 @@ var DeclareActionInput = BaseActionInput.merge(
|
|
3885
3919
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
3886
3920
|
import_zod29.z.object({
|
3887
3921
|
type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
3888
|
-
|
3922
|
+
content: PrintContent.optional()
|
3889
3923
|
})
|
3890
3924
|
);
|
3891
3925
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
@@ -3925,7 +3959,8 @@ var RequestCorrectionActionInput = BaseActionInput.merge(
|
|
3925
3959
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
3926
3960
|
import_zod29.z.object({
|
3927
3961
|
requestId: import_zod29.z.string(),
|
3928
|
-
type: import_zod29.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
3962
|
+
type: import_zod29.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
|
3963
|
+
reason: RejectionReason
|
3929
3964
|
})
|
3930
3965
|
);
|
3931
3966
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
@@ -4096,16 +4131,19 @@ function getLegalStatuses(actions) {
|
|
4096
4131
|
}
|
4097
4132
|
|
4098
4133
|
// ../commons/src/events/state/flags.ts
|
4099
|
-
function
|
4134
|
+
function isPendingCertification(actions) {
|
4135
|
+
if (getStatusFromActions(actions) !== EventStatus.enum.REGISTERED) {
|
4136
|
+
return false;
|
4137
|
+
}
|
4100
4138
|
return actions.reduce((prev, { type }) => {
|
4101
4139
|
if (type === ActionType.PRINT_CERTIFICATE) {
|
4102
|
-
return
|
4140
|
+
return false;
|
4103
4141
|
}
|
4104
4142
|
if (type === ActionType.APPROVE_CORRECTION) {
|
4105
|
-
return
|
4143
|
+
return true;
|
4106
4144
|
}
|
4107
4145
|
return prev;
|
4108
|
-
},
|
4146
|
+
}, true);
|
4109
4147
|
}
|
4110
4148
|
function isCorrectionRequested(actions) {
|
4111
4149
|
return actions.reduce((prev, { type }) => {
|
@@ -4140,8 +4178,8 @@ function getFlagsFromActions(actions) {
|
|
4140
4178
|
const flag = joinValues([type, status], ":").toLowerCase();
|
4141
4179
|
return flag;
|
4142
4180
|
});
|
4143
|
-
if (
|
4144
|
-
flags.push(InherentFlags.
|
4181
|
+
if (isPendingCertification(sortedActions)) {
|
4182
|
+
flags.push(InherentFlags.PENDING_CERTIFICATION);
|
4145
4183
|
}
|
4146
4184
|
if (isCorrectionRequested(sortedActions)) {
|
4147
4185
|
flags.push(InherentFlags.CORRECTION_REQUESTED);
|
@@ -4172,7 +4210,6 @@ function getStatusFromActions(actions) {
|
|
4172
4210
|
case ActionType.NOTIFY:
|
4173
4211
|
return EventStatus.enum.NOTIFIED;
|
4174
4212
|
case ActionType.PRINT_CERTIFICATE:
|
4175
|
-
return EventStatus.enum.CERTIFIED;
|
4176
4213
|
case ActionType.ASSIGN:
|
4177
4214
|
case ActionType.UNASSIGN:
|
4178
4215
|
case ActionType.REJECT:
|
@@ -5359,22 +5396,6 @@ var statusOptions = [
|
|
5359
5396
|
id: "v2.advancedSearch.form.recordStatusRegistered"
|
5360
5397
|
}
|
5361
5398
|
},
|
5362
|
-
{
|
5363
|
-
value: EventStatus.enum.CERTIFIED,
|
5364
|
-
label: {
|
5365
|
-
defaultMessage: "Certified",
|
5366
|
-
description: "Option for form field: status of record",
|
5367
|
-
id: "v2.advancedSearch.form.recordStatusCertified"
|
5368
|
-
}
|
5369
|
-
},
|
5370
|
-
{
|
5371
|
-
value: VisibleStatus.enum.REJECTED,
|
5372
|
-
label: {
|
5373
|
-
defaultMessage: "Rejected",
|
5374
|
-
description: "Option for form field: status of record",
|
5375
|
-
id: "v2.advancedSearch.form.recordStatusRejected"
|
5376
|
-
}
|
5377
|
-
},
|
5378
5399
|
{
|
5379
5400
|
value: EventStatus.enum.ARCHIVED,
|
5380
5401
|
label: {
|
@@ -6764,7 +6785,7 @@ function eventPayloadGenerator(rng) {
|
|
6764
6785
|
requestId,
|
6765
6786
|
keepAssignment: input.keepAssignment
|
6766
6787
|
}),
|
6767
|
-
reject: (eventId, requestId, input
|
6788
|
+
reject: (eventId, requestId, input) => ({
|
6768
6789
|
type: ActionType.REJECT_CORRECTION,
|
6769
6790
|
transactionId: input.transactionId ?? getUUID(),
|
6770
6791
|
declaration: {},
|
@@ -6775,7 +6796,8 @@ function eventPayloadGenerator(rng) {
|
|
6775
6796
|
),
|
6776
6797
|
eventId,
|
6777
6798
|
requestId,
|
6778
|
-
keepAssignment: input.keepAssignment
|
6799
|
+
keepAssignment: input.keepAssignment,
|
6800
|
+
reason: input.reason ?? { message: "" }
|
6779
6801
|
})
|
6780
6802
|
}
|
6781
6803
|
}
|
@@ -6834,7 +6856,8 @@ function generateActionDocument({
|
|
6834
6856
|
return {
|
6835
6857
|
...actionBase,
|
6836
6858
|
requestId: getUUID(),
|
6837
|
-
type: action
|
6859
|
+
type: action,
|
6860
|
+
reason: { message: "Correction rejection" }
|
6838
6861
|
};
|
6839
6862
|
case ActionType.REGISTER:
|
6840
6863
|
return {
|
@@ -7224,14 +7247,6 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
7224
7247
|
ActionType.REJECT_CORRECTION,
|
7225
7248
|
ExclusiveActions.REVIEW_CORRECTION_REQUEST
|
7226
7249
|
],
|
7227
|
-
[EventStatus.enum.CERTIFIED]: [
|
7228
|
-
ActionType.READ,
|
7229
|
-
ActionType.PRINT_CERTIFICATE,
|
7230
|
-
ActionType.REQUEST_CORRECTION,
|
7231
|
-
ActionType.APPROVE_CORRECTION,
|
7232
|
-
ActionType.REJECT_CORRECTION,
|
7233
|
-
ExclusiveActions.REVIEW_CORRECTION_REQUEST
|
7234
|
-
],
|
7235
7250
|
[EventStatus.enum.ARCHIVED]: [
|
7236
7251
|
ActionType.READ,
|
7237
7252
|
ActionType.ASSIGN,
|
@@ -7239,9 +7254,12 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
7239
7254
|
]
|
7240
7255
|
};
|
7241
7256
|
var getAvailableActionsForEvent = (event2) => {
|
7242
|
-
|
7243
|
-
|
7244
|
-
|
7245
|
-
|
7246
|
-
|
7257
|
+
if (event2.flags.includes(InherentFlags.REJECTED)) {
|
7258
|
+
return [
|
7259
|
+
ActionType.READ,
|
7260
|
+
event2.status === EventStatus.Enum.VALIDATED ? ActionType.VALIDATE : ActionType.DECLARE,
|
7261
|
+
ActionType.ARCHIVE
|
7262
|
+
];
|
7263
|
+
}
|
7264
|
+
return AVAILABLE_ACTIONS_BY_EVENT_STATUS[event2.status];
|
7247
7265
|
};
|