@opencrvs/toolkit 1.8.1-rc.e32d7b8 → 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 -410
- package/dist/commons/events/ActionDocument.d.ts +588 -675
- package/dist/commons/events/ActionInput.d.ts +58 -536
- package/dist/commons/events/AdvancedSearchConfig.d.ts +65 -47
- package/dist/commons/events/CountryConfigQueryInput.d.ts +88 -88
- package/dist/commons/events/Draft.d.ts +0 -44
- package/dist/commons/events/EventConfig.d.ts +31 -31
- package/dist/commons/events/EventDocument.d.ts +43 -414
- 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 -8
- package/dist/conditionals/index.js +2 -2
- package/dist/events/index.js +93 -73
- 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
|
@@ -6758,10 +6758,6 @@ export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]):
|
|
6758
6758
|
start: string;
|
6759
6759
|
end: string;
|
6760
6760
|
} | null | undefined> | null | undefined;
|
6761
|
-
actionDetails?: {
|
6762
|
-
templateId?: string | undefined;
|
6763
|
-
isImmediateCorrection?: boolean | undefined;
|
6764
|
-
} | null | undefined;
|
6765
6761
|
originalActionId?: (string & import("zod").BRAND<"UUID">) | null | undefined;
|
6766
6762
|
};
|
6767
6763
|
}[];
|
@@ -15524,7 +15520,7 @@ export declare function getEventConfigById(eventConfigs: EventConfig[], id: stri
|
|
15524
15520
|
title: import("./TranslationConfig").TranslationConfig;
|
15525
15521
|
fields: ({
|
15526
15522
|
config: {
|
15527
|
-
type: "exact" | "fuzzy" | "range";
|
15523
|
+
type: "exact" | "fuzzy" | "range" | "within";
|
15528
15524
|
};
|
15529
15525
|
fieldId: string;
|
15530
15526
|
fieldType: "field";
|
@@ -15551,9 +15547,9 @@ export declare function getEventConfigById(eventConfigs: EventConfig[], id: stri
|
|
15551
15547
|
excludeInSearchQuery?: boolean | undefined;
|
15552
15548
|
} | {
|
15553
15549
|
config: {
|
15554
|
-
type: "exact" | "fuzzy" | "range";
|
15550
|
+
type: "exact" | "fuzzy" | "range" | "within";
|
15555
15551
|
};
|
15556
|
-
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";
|
15557
15553
|
fieldType: "event";
|
15558
15554
|
options?: {
|
15559
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
@@ -39,8 +39,8 @@ __export(events_exports, {
|
|
39
39
|
ActionConfig: () => ActionConfig,
|
40
40
|
ActionConfigBase: () => ActionConfigBase,
|
41
41
|
ActionCreationMetadata: () => ActionCreationMetadata,
|
42
|
-
ActionDetails: () => ActionDetails,
|
43
42
|
ActionDocument: () => ActionDocument,
|
43
|
+
ActionFlag: () => ActionFlag,
|
44
44
|
ActionFormConfig: () => ActionFormConfig,
|
45
45
|
ActionInput: () => ActionInput,
|
46
46
|
ActionStatus: () => ActionStatus,
|
@@ -96,6 +96,7 @@ __export(events_exports, {
|
|
96
96
|
EventDocument: () => EventDocument,
|
97
97
|
EventFieldConfigSchema: () => EventFieldConfigSchema,
|
98
98
|
EventFieldId: () => EventFieldId,
|
99
|
+
EventFieldIdInput: () => EventFieldIdInput,
|
99
100
|
EventIndex: () => EventIndex,
|
100
101
|
EventInput: () => EventInput,
|
101
102
|
EventMetadata: () => EventMetadata,
|
@@ -130,6 +131,7 @@ __export(events_exports, {
|
|
130
131
|
InherentFlags: () => InherentFlags,
|
131
132
|
LanguageConfig: () => LanguageConfig,
|
132
133
|
LegalStatuses: () => LegalStatuses,
|
134
|
+
METADATA_FIELD_PREFIX: () => METADATA_FIELD_PREFIX,
|
133
135
|
MarkedAsDuplicateActionInput: () => MarkedAsDuplicateActionInput,
|
134
136
|
MimeType: () => MimeType,
|
135
137
|
NameFieldUpdateValue: () => NameFieldUpdateValue,
|
@@ -140,6 +142,7 @@ __export(events_exports, {
|
|
140
142
|
PageConfig: () => PageConfig,
|
141
143
|
PageTypes: () => PageTypes,
|
142
144
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
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")
|
@@ -1883,10 +1893,6 @@ var ActionStatus = {
|
|
1883
1893
|
Accepted: "Accepted",
|
1884
1894
|
Rejected: "Rejected"
|
1885
1895
|
};
|
1886
|
-
var ActionDetails = import_zod19.z.object({
|
1887
|
-
templateId: import_zod19.z.string().optional(),
|
1888
|
-
isImmediateCorrection: import_zod19.z.boolean().optional()
|
1889
|
-
});
|
1890
1896
|
var ActionBase = import_zod19.z.object({
|
1891
1897
|
id: UUID,
|
1892
1898
|
transactionId: import_zod19.z.string(),
|
@@ -1898,7 +1904,6 @@ var ActionBase = import_zod19.z.object({
|
|
1898
1904
|
createdAtLocation: CreatedAtLocation,
|
1899
1905
|
declaration: ActionUpdate,
|
1900
1906
|
annotation: ActionUpdate.optional().nullable(),
|
1901
|
-
actionDetails: ActionDetails.optional().nullable(),
|
1902
1907
|
status: import_zod19.z.enum([
|
1903
1908
|
ActionStatus.Requested,
|
1904
1909
|
ActionStatus.Accepted,
|
@@ -1908,11 +1913,15 @@ var ActionBase = import_zod19.z.object({
|
|
1908
1913
|
originalActionId: UUID.optional().nullable().describe(
|
1909
1914
|
"Reference to the original action that was asynchronously rejected or accepted by 3rd party integration."
|
1910
1915
|
)
|
1916
|
+
// 'content' field reserved for additional data
|
1917
|
+
// Each action can define its own content specifc to the action
|
1918
|
+
// See PrintCertificateAction
|
1911
1919
|
});
|
1912
1920
|
var AssignedAction = ActionBase.merge(
|
1913
1921
|
import_zod19.z.object({
|
1914
1922
|
type: import_zod19.z.literal(ActionType.ASSIGN),
|
1915
1923
|
assignedTo: import_zod19.z.string()
|
1924
|
+
// TODO move into 'content' property
|
1916
1925
|
})
|
1917
1926
|
);
|
1918
1927
|
var UnassignedAction = ActionBase.merge(
|
@@ -1924,6 +1933,7 @@ var RegisterAction = ActionBase.merge(
|
|
1924
1933
|
import_zod19.z.object({
|
1925
1934
|
type: import_zod19.z.literal(ActionType.REGISTER),
|
1926
1935
|
registrationNumber: import_zod19.z.string().optional()
|
1936
|
+
// TODO move into 'content' property
|
1927
1937
|
})
|
1928
1938
|
);
|
1929
1939
|
var DeclareAction = ActionBase.merge(
|
@@ -1944,6 +1954,7 @@ var RejectAction = ActionBase.merge(
|
|
1944
1954
|
import_zod19.z.object({
|
1945
1955
|
type: import_zod19.z.literal(ActionType.REJECT),
|
1946
1956
|
reason: RejectionReason
|
1957
|
+
// TODO move into 'content' property
|
1947
1958
|
})
|
1948
1959
|
);
|
1949
1960
|
var MarkAsDuplicateAction = ActionBase.merge(
|
@@ -1955,6 +1966,7 @@ var ArchiveAction = ActionBase.merge(
|
|
1955
1966
|
import_zod19.z.object({
|
1956
1967
|
type: import_zod19.z.literal(ActionType.ARCHIVE),
|
1957
1968
|
reason: RejectionReason
|
1969
|
+
// TODO move into 'content' property
|
1958
1970
|
})
|
1959
1971
|
);
|
1960
1972
|
var CreatedAction = ActionBase.merge(
|
@@ -1967,9 +1979,13 @@ var NotifiedAction = ActionBase.merge(
|
|
1967
1979
|
type: import_zod19.z.literal(ActionType.NOTIFY)
|
1968
1980
|
})
|
1969
1981
|
);
|
1982
|
+
var PrintContent = import_zod19.z.object({
|
1983
|
+
templateId: import_zod19.z.string().optional()
|
1984
|
+
});
|
1970
1985
|
var PrintCertificateAction = ActionBase.merge(
|
1971
1986
|
import_zod19.z.object({
|
1972
|
-
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE)
|
1987
|
+
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE),
|
1988
|
+
content: PrintContent.optional().nullable()
|
1973
1989
|
})
|
1974
1990
|
);
|
1975
1991
|
var RequestedCorrectionAction = ActionBase.merge(
|
@@ -1981,12 +1997,15 @@ var ApprovedCorrectionAction = ActionBase.merge(
|
|
1981
1997
|
import_zod19.z.object({
|
1982
1998
|
type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
|
1983
1999
|
requestId: import_zod19.z.string()
|
2000
|
+
// TODO move into 'content' property
|
1984
2001
|
})
|
1985
2002
|
);
|
1986
2003
|
var RejectedCorrectionAction = ActionBase.merge(
|
1987
2004
|
import_zod19.z.object({
|
1988
2005
|
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
|
1989
|
-
requestId: import_zod19.z.string()
|
2006
|
+
requestId: import_zod19.z.string(),
|
2007
|
+
// TODO move into 'content' property
|
2008
|
+
reason: RejectionReason
|
1990
2009
|
})
|
1991
2010
|
);
|
1992
2011
|
var ReadAction = ActionBase.merge(
|
@@ -2710,16 +2729,16 @@ function timePeriodToDateRange(value) {
|
|
2710
2729
|
let startDate;
|
2711
2730
|
switch (value) {
|
2712
2731
|
case "last7Days":
|
2713
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2732
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 7);
|
2714
2733
|
break;
|
2715
2734
|
case "last30Days":
|
2716
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2735
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 30);
|
2717
2736
|
break;
|
2718
2737
|
case "last90Days":
|
2719
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2738
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 90);
|
2720
2739
|
break;
|
2721
2740
|
case "last365Days":
|
2722
|
-
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(),
|
2741
|
+
startDate = (0, import_date_fns2.subDays)(/* @__PURE__ */ new Date(), 365);
|
2723
2742
|
break;
|
2724
2743
|
}
|
2725
2744
|
return {
|
@@ -3086,8 +3105,8 @@ function createFieldConditionals(fieldId) {
|
|
3086
3105
|
properties: {
|
3087
3106
|
[fieldId]: {
|
3088
3107
|
type: "string",
|
3089
|
-
pattern: "^[\\p{Script=Latin}0-9'
|
3090
|
-
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."
|
3091
3110
|
}
|
3092
3111
|
}
|
3093
3112
|
}),
|
@@ -3180,6 +3199,19 @@ function createSearchConfig(baseField) {
|
|
3180
3199
|
fuzzy: () => ({
|
3181
3200
|
...baseField,
|
3182
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" }
|
3183
3215
|
})
|
3184
3216
|
};
|
3185
3217
|
}
|
@@ -3187,7 +3219,7 @@ function createSearchConfig(baseField) {
|
|
3187
3219
|
// ../commons/src/event-config/event-configuration.ts
|
3188
3220
|
function createEventFieldConfig(fieldId) {
|
3189
3221
|
const baseField = {
|
3190
|
-
fieldId
|
3222
|
+
fieldId: `${METADATA_FIELD_PREFIX}${fieldId}`,
|
3191
3223
|
fieldType: "event"
|
3192
3224
|
};
|
3193
3225
|
return createSearchConfig(baseField);
|
@@ -3244,24 +3276,23 @@ var EventStatus = import_zod23.z.enum([
|
|
3244
3276
|
"DECLARED",
|
3245
3277
|
"VALIDATED",
|
3246
3278
|
"REGISTERED",
|
3247
|
-
"CERTIFIED",
|
3248
3279
|
"ARCHIVED"
|
3249
3280
|
]);
|
3250
|
-
var VisibleStatus = import_zod23.z.enum([...EventStatus.options, "REJECTED"]);
|
3251
3281
|
var InherentFlags = {
|
3252
|
-
|
3282
|
+
PENDING_CERTIFICATION: "pending-certification",
|
3253
3283
|
INCOMPLETE: "incomplete",
|
3254
3284
|
REJECTED: "rejected",
|
3255
3285
|
CORRECTION_REQUESTED: "correction-requested"
|
3256
3286
|
};
|
3257
|
-
var
|
3287
|
+
var ActionFlag = import_zod23.z.string().regex(
|
3258
3288
|
new RegExp(
|
3259
3289
|
`^(${Object.values(ActionType).join("|").toLowerCase()}):(${Object.values(
|
3260
3290
|
ActionStatus
|
3261
3291
|
).join("|").toLowerCase()})$`
|
3262
3292
|
),
|
3263
3293
|
"Flag must be in the format ActionType:ActionStatus (lowerCase)"
|
3264
|
-
)
|
3294
|
+
);
|
3295
|
+
var Flag = ActionFlag.or(import_zod23.z.nativeEnum(InherentFlags));
|
3265
3296
|
var ZodDate = import_zod23.z.string().date();
|
3266
3297
|
var ActionCreationMetadata = import_zod23.z.object({
|
3267
3298
|
createdAt: import_zod23.z.string().datetime().describe("The timestamp when the action request was created."),
|
@@ -3529,6 +3560,9 @@ var QueryExpression = import_zod25.z.object({
|
|
3529
3560
|
createdAt: import_zod25.z.optional(DateCondition),
|
3530
3561
|
updatedAt: import_zod25.z.optional(DateCondition),
|
3531
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
|
+
),
|
3532
3566
|
"legalStatuses.REGISTERED.createdAtLocation": import_zod25.z.optional(
|
3533
3567
|
import_zod25.z.union([Within, Exact])
|
3534
3568
|
),
|
@@ -3774,7 +3808,8 @@ var WorkqueueConfig = import_zod28.z.object({
|
|
3774
3808
|
})
|
3775
3809
|
),
|
3776
3810
|
columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3777
|
-
icon: AvailableIcons
|
3811
|
+
icon: AvailableIcons,
|
3812
|
+
emptyMessage: TranslationConfig.optional()
|
3778
3813
|
}).describe("Configuration for workqueue.");
|
3779
3814
|
var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
3780
3815
|
query: true,
|
@@ -3793,7 +3828,8 @@ var WorkqueueConfigInput = import_zod28.z.object({
|
|
3793
3828
|
})
|
3794
3829
|
),
|
3795
3830
|
columns: import_zod28.z.array(WorkqueueColumn).default(mandatoryColumns),
|
3796
|
-
icon: AvailableIcons
|
3831
|
+
icon: AvailableIcons,
|
3832
|
+
emptyMessage: TranslationConfig.optional()
|
3797
3833
|
});
|
3798
3834
|
function defineWorkqueue(workqueueInput) {
|
3799
3835
|
const queryInput = workqueueInput.query;
|
@@ -3840,7 +3876,6 @@ var BaseActionInput = import_zod29.z.object({
|
|
3840
3876
|
transactionId: import_zod29.z.string(),
|
3841
3877
|
declaration: ActionUpdate.default({}),
|
3842
3878
|
annotation: ActionUpdate.optional(),
|
3843
|
-
actionDetails: ActionDetails.optional(),
|
3844
3879
|
originalActionId: UUID.optional(),
|
3845
3880
|
// should not be part of base action.
|
3846
3881
|
keepAssignment: import_zod29.z.boolean().optional()
|
@@ -3883,7 +3918,8 @@ var DeclareActionInput = BaseActionInput.merge(
|
|
3883
3918
|
);
|
3884
3919
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
3885
3920
|
import_zod29.z.object({
|
3886
|
-
type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
3921
|
+
type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
3922
|
+
content: PrintContent.optional()
|
3887
3923
|
})
|
3888
3924
|
);
|
3889
3925
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
@@ -3923,7 +3959,8 @@ var RequestCorrectionActionInput = BaseActionInput.merge(
|
|
3923
3959
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
3924
3960
|
import_zod29.z.object({
|
3925
3961
|
requestId: import_zod29.z.string(),
|
3926
|
-
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
|
3927
3964
|
})
|
3928
3965
|
);
|
3929
3966
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
@@ -4094,16 +4131,19 @@ function getLegalStatuses(actions) {
|
|
4094
4131
|
}
|
4095
4132
|
|
4096
4133
|
// ../commons/src/events/state/flags.ts
|
4097
|
-
function
|
4134
|
+
function isPendingCertification(actions) {
|
4135
|
+
if (getStatusFromActions(actions) !== EventStatus.enum.REGISTERED) {
|
4136
|
+
return false;
|
4137
|
+
}
|
4098
4138
|
return actions.reduce((prev, { type }) => {
|
4099
4139
|
if (type === ActionType.PRINT_CERTIFICATE) {
|
4100
|
-
return
|
4140
|
+
return false;
|
4101
4141
|
}
|
4102
4142
|
if (type === ActionType.APPROVE_CORRECTION) {
|
4103
|
-
return
|
4143
|
+
return true;
|
4104
4144
|
}
|
4105
4145
|
return prev;
|
4106
|
-
},
|
4146
|
+
}, true);
|
4107
4147
|
}
|
4108
4148
|
function isCorrectionRequested(actions) {
|
4109
4149
|
return actions.reduce((prev, { type }) => {
|
@@ -4138,8 +4178,8 @@ function getFlagsFromActions(actions) {
|
|
4138
4178
|
const flag = joinValues([type, status], ":").toLowerCase();
|
4139
4179
|
return flag;
|
4140
4180
|
});
|
4141
|
-
if (
|
4142
|
-
flags.push(InherentFlags.
|
4181
|
+
if (isPendingCertification(sortedActions)) {
|
4182
|
+
flags.push(InherentFlags.PENDING_CERTIFICATION);
|
4143
4183
|
}
|
4144
4184
|
if (isCorrectionRequested(sortedActions)) {
|
4145
4185
|
flags.push(InherentFlags.CORRECTION_REQUESTED);
|
@@ -4170,7 +4210,6 @@ function getStatusFromActions(actions) {
|
|
4170
4210
|
case ActionType.NOTIFY:
|
4171
4211
|
return EventStatus.enum.NOTIFIED;
|
4172
4212
|
case ActionType.PRINT_CERTIFICATE:
|
4173
|
-
return EventStatus.enum.CERTIFIED;
|
4174
4213
|
case ActionType.ASSIGN:
|
4175
4214
|
case ActionType.UNASSIGN:
|
4176
4215
|
case ActionType.REJECT:
|
@@ -5357,22 +5396,6 @@ var statusOptions = [
|
|
5357
5396
|
id: "v2.advancedSearch.form.recordStatusRegistered"
|
5358
5397
|
}
|
5359
5398
|
},
|
5360
|
-
{
|
5361
|
-
value: EventStatus.enum.CERTIFIED,
|
5362
|
-
label: {
|
5363
|
-
defaultMessage: "Certified",
|
5364
|
-
description: "Option for form field: status of record",
|
5365
|
-
id: "v2.advancedSearch.form.recordStatusCertified"
|
5366
|
-
}
|
5367
|
-
},
|
5368
|
-
{
|
5369
|
-
value: VisibleStatus.enum.REJECTED,
|
5370
|
-
label: {
|
5371
|
-
defaultMessage: "Rejected",
|
5372
|
-
description: "Option for form field: status of record",
|
5373
|
-
id: "v2.advancedSearch.form.recordStatusRejected"
|
5374
|
-
}
|
5375
|
-
},
|
5376
5399
|
{
|
5377
5400
|
value: EventStatus.enum.ARCHIVED,
|
5378
5401
|
label: {
|
@@ -6762,7 +6785,7 @@ function eventPayloadGenerator(rng) {
|
|
6762
6785
|
requestId,
|
6763
6786
|
keepAssignment: input.keepAssignment
|
6764
6787
|
}),
|
6765
|
-
reject: (eventId, requestId, input
|
6788
|
+
reject: (eventId, requestId, input) => ({
|
6766
6789
|
type: ActionType.REJECT_CORRECTION,
|
6767
6790
|
transactionId: input.transactionId ?? getUUID(),
|
6768
6791
|
declaration: {},
|
@@ -6773,7 +6796,8 @@ function eventPayloadGenerator(rng) {
|
|
6773
6796
|
),
|
6774
6797
|
eventId,
|
6775
6798
|
requestId,
|
6776
|
-
keepAssignment: input.keepAssignment
|
6799
|
+
keepAssignment: input.keepAssignment,
|
6800
|
+
reason: input.reason ?? { message: "" }
|
6777
6801
|
})
|
6778
6802
|
}
|
6779
6803
|
}
|
@@ -6832,7 +6856,8 @@ function generateActionDocument({
|
|
6832
6856
|
return {
|
6833
6857
|
...actionBase,
|
6834
6858
|
requestId: getUUID(),
|
6835
|
-
type: action
|
6859
|
+
type: action,
|
6860
|
+
reason: { message: "Correction rejection" }
|
6836
6861
|
};
|
6837
6862
|
case ActionType.REGISTER:
|
6838
6863
|
return {
|
@@ -7222,14 +7247,6 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
7222
7247
|
ActionType.REJECT_CORRECTION,
|
7223
7248
|
ExclusiveActions.REVIEW_CORRECTION_REQUEST
|
7224
7249
|
],
|
7225
|
-
[EventStatus.enum.CERTIFIED]: [
|
7226
|
-
ActionType.READ,
|
7227
|
-
ActionType.PRINT_CERTIFICATE,
|
7228
|
-
ActionType.REQUEST_CORRECTION,
|
7229
|
-
ActionType.APPROVE_CORRECTION,
|
7230
|
-
ActionType.REJECT_CORRECTION,
|
7231
|
-
ExclusiveActions.REVIEW_CORRECTION_REQUEST
|
7232
|
-
],
|
7233
7250
|
[EventStatus.enum.ARCHIVED]: [
|
7234
7251
|
ActionType.READ,
|
7235
7252
|
ActionType.ASSIGN,
|
@@ -7237,9 +7254,12 @@ var AVAILABLE_ACTIONS_BY_EVENT_STATUS = {
|
|
7237
7254
|
]
|
7238
7255
|
};
|
7239
7256
|
var getAvailableActionsForEvent = (event2) => {
|
7240
|
-
|
7241
|
-
|
7242
|
-
|
7243
|
-
|
7244
|
-
|
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];
|
7245
7265
|
};
|