@opencrvs/toolkit 1.8.0-rc.feaeeb7 → 1.8.0-rc.ff73871
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 +15 -27
- package/dist/commons/events/ActionConfig.d.ts +6 -6
- package/dist/commons/events/ActionDocument.d.ts +3 -3
- package/dist/commons/events/ActionInput.d.ts +8 -92
- package/dist/commons/events/ActionType.d.ts +1 -1
- package/dist/commons/events/Draft.d.ts +0 -3
- package/dist/commons/events/EventConfig.d.ts +4 -4
- package/dist/commons/events/EventDocument.d.ts +5 -5
- package/dist/commons/events/FieldConfig.d.ts +1 -0
- package/dist/commons/events/FieldType.d.ts +4 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +30 -0
- package/dist/commons/events/TemplateConfig.d.ts +28 -8
- package/dist/commons/events/defineConfig.d.ts +1 -1
- package/dist/commons/events/test.utils.d.ts +3 -3
- package/dist/commons/events/utils.d.ts +5 -0
- package/dist/events/index.js +96 -23
- package/package.json +1 -1
@@ -1282,9 +1282,9 @@ export declare const EventDocument: z.ZodObject<{
|
|
1282
1282
|
}>]>>>;
|
1283
1283
|
createdAtLocation: z.ZodString;
|
1284
1284
|
}, {
|
1285
|
-
type: z.ZodLiteral<"
|
1285
|
+
type: z.ZodLiteral<"ARCHIVE">;
|
1286
1286
|
}>, "strip", z.ZodTypeAny, {
|
1287
|
-
type: "
|
1287
|
+
type: "ARCHIVE";
|
1288
1288
|
id: string;
|
1289
1289
|
data: Record<string, string | number | boolean | {
|
1290
1290
|
type: string;
|
@@ -1342,7 +1342,7 @@ export declare const EventDocument: z.ZodObject<{
|
|
1342
1342
|
originalFilename: string;
|
1343
1343
|
}[]> | undefined;
|
1344
1344
|
}, {
|
1345
|
-
type: "
|
1345
|
+
type: "ARCHIVE";
|
1346
1346
|
id: string;
|
1347
1347
|
data: Record<string, string | number | boolean | {
|
1348
1348
|
type: string;
|
@@ -4636,7 +4636,7 @@ export declare const EventDocument: z.ZodObject<{
|
|
4636
4636
|
originalFilename: string;
|
4637
4637
|
}[]> | undefined;
|
4638
4638
|
} | {
|
4639
|
-
type: "
|
4639
|
+
type: "ARCHIVE";
|
4640
4640
|
id: string;
|
4641
4641
|
data: Record<string, string | number | boolean | {
|
4642
4642
|
type: string;
|
@@ -5520,7 +5520,7 @@ export declare const EventDocument: z.ZodObject<{
|
|
5520
5520
|
originalFilename: string;
|
5521
5521
|
}[]> | undefined;
|
5522
5522
|
} | {
|
5523
|
-
type: "
|
5523
|
+
type: "ARCHIVE";
|
5524
5524
|
id: string;
|
5525
5525
|
data: Record<string, string | number | boolean | {
|
5526
5526
|
type: string;
|
@@ -2319,6 +2319,7 @@ declare const Country: z.ZodObject<z.objectUtil.extendShape<{
|
|
2319
2319
|
hideLabel?: boolean | undefined;
|
2320
2320
|
}>;
|
2321
2321
|
export type Country = z.infer<typeof Country>;
|
2322
|
+
export declare const AdministrativeAreas: z.ZodEnum<["ADMIN_STRUCTURE", "HEALTH_FACILITY", "CRVS_OFFICE"]>;
|
2322
2323
|
declare const AdministrativeAreaConfiguration: z.ZodObject<{
|
2323
2324
|
partOf: z.ZodOptional<z.ZodObject<{
|
2324
2325
|
$data: z.ZodString;
|
@@ -24,4 +24,8 @@ export declare const FieldType: {
|
|
24
24
|
};
|
25
25
|
export declare const fieldTypes: ("ADDRESS" | "TEXT" | "NUMBER" | "TEXTAREA" | "EMAIL" | "DATE" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "HIDDEN" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE")[];
|
26
26
|
export type FieldType = (typeof fieldTypes)[number];
|
27
|
+
/**
|
28
|
+
* Composite field types are field types that consist of multiple field values.
|
29
|
+
*/
|
30
|
+
export declare const compositeFieldTypes: ("ADDRESS" | "FILE" | "FILE_WITH_OPTIONS")[];
|
27
31
|
//# sourceMappingURL=FieldType.d.ts.map
|
@@ -258,6 +258,36 @@ export declare function mapFieldTypeToMockValue(field: FieldConfig, i: number):
|
|
258
258
|
number?: undefined;
|
259
259
|
zipCode?: undefined;
|
260
260
|
} | null;
|
261
|
+
/**
|
262
|
+
* Maps complex or nested field types, such as Address fields, to their corresponding empty values.
|
263
|
+
*/
|
264
|
+
export declare function mapFieldTypeToEmptyValue(field: FieldConfig): never[] | {
|
265
|
+
country: null;
|
266
|
+
province: null;
|
267
|
+
district: null;
|
268
|
+
urbanOrRural: string;
|
269
|
+
town: null;
|
270
|
+
residentialArea: null;
|
271
|
+
street: null;
|
272
|
+
number: null;
|
273
|
+
zipCode: null;
|
274
|
+
filename?: undefined;
|
275
|
+
originalFilename?: undefined;
|
276
|
+
type?: undefined;
|
277
|
+
} | {
|
278
|
+
filename: string;
|
279
|
+
originalFilename: string;
|
280
|
+
type: string;
|
281
|
+
country?: undefined;
|
282
|
+
province?: undefined;
|
283
|
+
district?: undefined;
|
284
|
+
urbanOrRural?: undefined;
|
285
|
+
town?: undefined;
|
286
|
+
residentialArea?: undefined;
|
287
|
+
street?: undefined;
|
288
|
+
number?: undefined;
|
289
|
+
zipCode?: undefined;
|
290
|
+
} | null;
|
261
291
|
export declare const isParagraphFieldType: (field: {
|
262
292
|
config: FieldConfig;
|
263
293
|
value: FieldValue;
|
@@ -1,18 +1,38 @@
|
|
1
|
+
/**
|
2
|
+
* TemplateConfig defines configuration rules for system-based variables (e.g. $user.province).
|
3
|
+
* They are currently used for providing default values in FieldConfig.
|
4
|
+
*/
|
1
5
|
import { FieldValue } from './FieldValue';
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
export declare function isFieldValueWithoutTemplates(value: DefaultValue): value is FieldValue;
|
6
|
-
export declare function isDefaultValue(value: any): value is DefaultValue;
|
6
|
+
/**
|
7
|
+
* Available system variables for configuration.
|
8
|
+
*/
|
7
9
|
export interface MetaFields {
|
8
10
|
$user: {
|
9
11
|
province: string;
|
10
12
|
district: string;
|
11
13
|
};
|
12
14
|
}
|
13
|
-
|
14
|
-
|
15
|
+
/**
|
16
|
+
* Recursively flatten the keys of an object. Used to limit types when configuring default values in country config.
|
17
|
+
* @example
|
18
|
+
* type Test = FlattenedKeyStrings<{ a: { b: string, c: { d: string } } }>
|
19
|
+
* // 'a.b' | 'a.c.d' but not 'a' or 'a.c'
|
20
|
+
*/
|
21
|
+
type FlattenedKeyStrings<T, Prefix extends string = ''> = {
|
22
|
+
[K in keyof T]: T[K] extends Record<string, any> ? FlattenedKeyStrings<T[K], `${Prefix}${K & string}.`> : `${Prefix}${K & string}`;
|
15
23
|
}[keyof T];
|
16
|
-
export type
|
24
|
+
export type FlattenedMetaFields = FlattenedKeyStrings<MetaFields>;
|
25
|
+
/**
|
26
|
+
* Default value for a field when configuring a form.
|
27
|
+
*/
|
28
|
+
export type FieldConfigDefaultValue = FieldValue | FlattenedMetaFields | Record<string, FlattenedMetaFields | FieldValue>;
|
29
|
+
export declare function isTemplateVariable(value: FieldConfigDefaultValue): value is FlattenedMetaFields;
|
30
|
+
export declare function isFieldValue(value: FieldConfigDefaultValue): value is FieldValue;
|
31
|
+
/**
|
32
|
+
* Checks if given value is valid for a field, and known template variables are already resolved.
|
33
|
+
* @todo: Extend functionality to arbitrary depth objects. Currently only checks first level since our compoosite fields are only 1 level deep.
|
34
|
+
*/
|
35
|
+
export declare function isFieldValueWithoutTemplates(value: FieldConfigDefaultValue): value is FieldValue;
|
36
|
+
export declare function isFieldConfigDefaultValue(value: any): value is FieldConfigDefaultValue;
|
17
37
|
export {};
|
18
38
|
//# sourceMappingURL=TemplateConfig.d.ts.map
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { ActionDocument } from './ActionDocument';
|
2
|
-
import {
|
2
|
+
import { ArchiveActionInput, DeclareActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, ValidateActionInput } from './ActionInput';
|
3
3
|
import { ActionType } from './ActionType';
|
4
4
|
import { Draft } from './Draft';
|
5
5
|
import { EventConfig } from './EventConfig';
|
@@ -192,8 +192,8 @@ export declare const eventPayloadGenerator: {
|
|
192
192
|
duplicates: never[];
|
193
193
|
eventId: string;
|
194
194
|
};
|
195
|
-
archive: (eventId: string, input?: Partial<Pick<
|
196
|
-
type: "
|
195
|
+
archive: (eventId: string, input?: Partial<Pick<ArchiveActionInput, "transactionId" | "data">>, isDuplicate?: boolean) => {
|
196
|
+
type: "ARCHIVE";
|
197
197
|
transactionId: string;
|
198
198
|
data: Record<string, string | number | boolean | {
|
199
199
|
type: string;
|
@@ -75,6 +75,11 @@ export declare const findActiveActionFormFields: (configuration: EventConfig, ac
|
|
75
75
|
* Returns all fields for the action type, including review fields, if any.
|
76
76
|
*/
|
77
77
|
export declare const findActiveActionFields: (configuration: EventConfig, action: ActionType) => FieldConfig[] | undefined;
|
78
|
+
export declare const getActiveActionFormPages: (configuration: EventConfig, action: ActionType) => {
|
79
|
+
id: string;
|
80
|
+
title: TranslationConfig;
|
81
|
+
fields: import("./FieldConfig").Inferred[];
|
82
|
+
}[];
|
78
83
|
/**
|
79
84
|
* Returns all fields for the action type, including review fields, or throws
|
80
85
|
*/
|
package/dist/events/index.js
CHANGED
@@ -40,9 +40,10 @@ __export(events_exports, {
|
|
40
40
|
ActionUpdate: () => ActionUpdate,
|
41
41
|
AddressFieldUpdateValue: () => AddressFieldUpdateValue,
|
42
42
|
AddressFieldValue: () => AddressFieldValue,
|
43
|
+
AdministrativeAreas: () => AdministrativeAreas,
|
43
44
|
AdvancedSearchConfig: () => AdvancedSearchConfig,
|
44
45
|
ApproveCorrectionActionInput: () => ApproveCorrectionActionInput,
|
45
|
-
|
46
|
+
ArchiveActionInput: () => ArchiveActionInput,
|
46
47
|
BaseActionInput: () => BaseActionInput,
|
47
48
|
CertificateConfig: () => CertificateConfig,
|
48
49
|
CertificateTemplateConfig: () => CertificateTemplateConfig,
|
@@ -100,6 +101,7 @@ __export(events_exports, {
|
|
100
101
|
alwaysTrue: () => alwaysTrue,
|
101
102
|
and: () => and,
|
102
103
|
applyDraftsToEventIndex: () => applyDraftsToEventIndex,
|
104
|
+
compositeFieldTypes: () => compositeFieldTypes,
|
103
105
|
createValidationSchema: () => createValidationSchema,
|
104
106
|
deepDropNulls: () => deepDropNulls,
|
105
107
|
defineConditional: () => defineConditional,
|
@@ -125,6 +127,7 @@ __export(events_exports, {
|
|
125
127
|
generateEventDraftDocument: () => generateEventDraftDocument,
|
126
128
|
generateTransactionId: () => generateTransactionId,
|
127
129
|
getActiveActionFields: () => getActiveActionFields,
|
130
|
+
getActiveActionFormPages: () => getActiveActionFormPages,
|
128
131
|
getAllFields: () => getAllFields,
|
129
132
|
getAllPages: () => getAllPages,
|
130
133
|
getCurrentEventState: () => getCurrentEventState,
|
@@ -139,10 +142,10 @@ __export(events_exports, {
|
|
139
142
|
isCheckboxFieldType: () => isCheckboxFieldType,
|
140
143
|
isCountryFieldType: () => isCountryFieldType,
|
141
144
|
isDateFieldType: () => isDateFieldType,
|
142
|
-
isDefaultValue: () => isDefaultValue,
|
143
145
|
isDividerFieldType: () => isDividerFieldType,
|
144
146
|
isEmailFieldType: () => isEmailFieldType,
|
145
147
|
isFacilityFieldType: () => isFacilityFieldType,
|
148
|
+
isFieldConfigDefaultValue: () => isFieldConfigDefaultValue,
|
146
149
|
isFieldEnabled: () => isFieldEnabled,
|
147
150
|
isFieldValue: () => isFieldValue,
|
148
151
|
isFieldValueWithoutTemplates: () => isFieldValueWithoutTemplates,
|
@@ -161,6 +164,7 @@ __export(events_exports, {
|
|
161
164
|
isTextAreaFieldType: () => isTextAreaFieldType,
|
162
165
|
isTextFieldType: () => isTextFieldType,
|
163
166
|
isUndeclaredDraft: () => isUndeclaredDraft,
|
167
|
+
mapFieldTypeToEmptyValue: () => mapFieldTypeToEmptyValue,
|
164
168
|
mapFieldTypeToMockValue: () => mapFieldTypeToMockValue,
|
165
169
|
mapFieldTypeToZod: () => mapFieldTypeToZod,
|
166
170
|
not: () => not,
|
@@ -247,6 +251,11 @@ var FieldType = {
|
|
247
251
|
SIGNATURE: "SIGNATURE"
|
248
252
|
};
|
249
253
|
var fieldTypes = Object.values(FieldType);
|
254
|
+
var compositeFieldTypes = [
|
255
|
+
FieldType.ADDRESS,
|
256
|
+
FieldType.FILE_WITH_OPTIONS,
|
257
|
+
FieldType.FILE
|
258
|
+
];
|
250
259
|
|
251
260
|
// ../commons/src/events/FieldValue.ts
|
252
261
|
var import_zod4 = require("zod");
|
@@ -499,11 +508,16 @@ var Country = BaseField.extend({
|
|
499
508
|
type: import_zod5.z.literal(FieldType.COUNTRY),
|
500
509
|
defaultValue: import_zod5.z.union([RequiredTextValue, DependencyExpression]).optional()
|
501
510
|
}).describe("Country select field");
|
511
|
+
var AdministrativeAreas = import_zod5.z.enum([
|
512
|
+
"ADMIN_STRUCTURE",
|
513
|
+
"HEALTH_FACILITY",
|
514
|
+
"CRVS_OFFICE"
|
515
|
+
]);
|
502
516
|
var AdministrativeAreaConfiguration = import_zod5.z.object({
|
503
517
|
partOf: import_zod5.z.object({
|
504
518
|
$data: import_zod5.z.string()
|
505
519
|
}).optional().describe("Parent location"),
|
506
|
-
type:
|
520
|
+
type: AdministrativeAreas
|
507
521
|
}).describe("Administrative area options");
|
508
522
|
var AdministrativeArea = BaseField.extend({
|
509
523
|
type: import_zod5.z.literal(FieldType.ADMINISTRATIVE_AREA),
|
@@ -598,7 +612,7 @@ var ActionType = {
|
|
598
612
|
CUSTOM: "CUSTOM",
|
599
613
|
REJECT: "REJECT",
|
600
614
|
MARKED_AS_DUPLICATE: "MARKED_AS_DUPLICATE",
|
601
|
-
|
615
|
+
ARCHIVE: "ARCHIVE"
|
602
616
|
};
|
603
617
|
|
604
618
|
// ../commons/src/events/ActionConfig.ts
|
@@ -638,9 +652,9 @@ var MarkedAsDuplicateConfig = ActionConfigBase.merge(
|
|
638
652
|
duplicates: import_zod7.z.array(import_zod7.z.string()).describe("UUIDs of duplicate records")
|
639
653
|
})
|
640
654
|
);
|
641
|
-
var
|
655
|
+
var ArchiveConfig = ActionConfigBase.merge(
|
642
656
|
import_zod7.z.object({
|
643
|
-
type: import_zod7.z.literal(ActionType.
|
657
|
+
type: import_zod7.z.literal(ActionType.ARCHIVE),
|
644
658
|
comment: import_zod7.z.string(),
|
645
659
|
isDuplicate: import_zod7.z.boolean()
|
646
660
|
})
|
@@ -687,7 +701,7 @@ var ActionConfig = import_zod7.z.discriminatedUnion("type", [
|
|
687
701
|
ValidateConfig,
|
688
702
|
RejectDeclarationConfig,
|
689
703
|
MarkedAsDuplicateConfig,
|
690
|
-
|
704
|
+
ArchiveConfig,
|
691
705
|
RegisterConfig,
|
692
706
|
DeleteConfig,
|
693
707
|
PrintCertificateActionConfig,
|
@@ -1163,6 +1177,50 @@ function mapFieldTypeToMockValue(field2, i) {
|
|
1163
1177
|
return null;
|
1164
1178
|
}
|
1165
1179
|
}
|
1180
|
+
function mapFieldTypeToEmptyValue(field2) {
|
1181
|
+
switch (field2.type) {
|
1182
|
+
case FieldType.DIVIDER:
|
1183
|
+
case FieldType.TEXT:
|
1184
|
+
case FieldType.TEXTAREA:
|
1185
|
+
case FieldType.BULLET_LIST:
|
1186
|
+
case FieldType.PAGE_HEADER:
|
1187
|
+
case FieldType.LOCATION:
|
1188
|
+
case FieldType.SELECT:
|
1189
|
+
case FieldType.COUNTRY:
|
1190
|
+
case FieldType.RADIO_GROUP:
|
1191
|
+
case FieldType.SIGNATURE:
|
1192
|
+
case FieldType.PARAGRAPH:
|
1193
|
+
case FieldType.ADMINISTRATIVE_AREA:
|
1194
|
+
case FieldType.FACILITY:
|
1195
|
+
case FieldType.OFFICE:
|
1196
|
+
case FieldType.NUMBER:
|
1197
|
+
case FieldType.EMAIL:
|
1198
|
+
case FieldType.DATE:
|
1199
|
+
case FieldType.CHECKBOX:
|
1200
|
+
return null;
|
1201
|
+
case FieldType.ADDRESS:
|
1202
|
+
return {
|
1203
|
+
country: null,
|
1204
|
+
province: null,
|
1205
|
+
district: null,
|
1206
|
+
urbanOrRural: "URBAN",
|
1207
|
+
// Default to urban needed for validation
|
1208
|
+
town: null,
|
1209
|
+
residentialArea: null,
|
1210
|
+
street: null,
|
1211
|
+
number: null,
|
1212
|
+
zipCode: null
|
1213
|
+
};
|
1214
|
+
case FieldType.FILE:
|
1215
|
+
return {
|
1216
|
+
filename: "",
|
1217
|
+
originalFilename: "",
|
1218
|
+
type: ""
|
1219
|
+
};
|
1220
|
+
case FieldType.FILE_WITH_OPTIONS:
|
1221
|
+
return [];
|
1222
|
+
}
|
1223
|
+
}
|
1166
1224
|
var isParagraphFieldType = (field2) => {
|
1167
1225
|
return field2.config.type === FieldType.PARAGRAPH;
|
1168
1226
|
};
|
@@ -1367,6 +1425,14 @@ function validateFieldInput({
|
|
1367
1425
|
return rawError.error?.issues.map((issue) => issue.message) ?? [];
|
1368
1426
|
}
|
1369
1427
|
|
1428
|
+
// ../commons/src/utils.ts
|
1429
|
+
function getOrThrow(x, message) {
|
1430
|
+
if (x === void 0 || x === null) {
|
1431
|
+
throw new Error(message);
|
1432
|
+
}
|
1433
|
+
return x;
|
1434
|
+
}
|
1435
|
+
|
1370
1436
|
// ../commons/src/events/utils.ts
|
1371
1437
|
function isMetadataField(field2) {
|
1372
1438
|
return field2 in eventMetadataLabelMap;
|
@@ -1463,6 +1529,12 @@ var findActiveActionFields = (configuration, action) => {
|
|
1463
1529
|
const allFields = formFields ? formFields.concat(reviewFields ?? []) : reviewFields;
|
1464
1530
|
return allFields;
|
1465
1531
|
};
|
1532
|
+
var getActiveActionFormPages = (configuration, action) => {
|
1533
|
+
return getOrThrow(
|
1534
|
+
findActiveActionForm(configuration, action)?.pages,
|
1535
|
+
"Form configuration not found for type: " + configuration.id
|
1536
|
+
);
|
1537
|
+
};
|
1466
1538
|
function getActiveActionFields(configuration, action) {
|
1467
1539
|
const fields = findActiveActionFields(configuration, action);
|
1468
1540
|
if (!fields) {
|
@@ -1592,9 +1664,9 @@ var MarkAsDuplicateAction = ActionBase.merge(
|
|
1592
1664
|
type: import_zod19.z.literal(ActionType.MARKED_AS_DUPLICATE)
|
1593
1665
|
})
|
1594
1666
|
);
|
1595
|
-
var
|
1667
|
+
var ArchiveAction = ActionBase.merge(
|
1596
1668
|
import_zod19.z.object({
|
1597
|
-
type: import_zod19.z.literal(ActionType.
|
1669
|
+
type: import_zod19.z.literal(ActionType.ARCHIVE)
|
1598
1670
|
})
|
1599
1671
|
);
|
1600
1672
|
var CreatedAction = ActionBase.merge(
|
@@ -1639,7 +1711,7 @@ var ActionDocument = import_zod19.z.discriminatedUnion("type", [
|
|
1639
1711
|
ValidateAction,
|
1640
1712
|
RejectAction,
|
1641
1713
|
MarkAsDuplicateAction,
|
1642
|
-
|
1714
|
+
ArchiveAction,
|
1643
1715
|
NotifiedAction,
|
1644
1716
|
RegisterAction,
|
1645
1717
|
DeclareAction,
|
@@ -1668,7 +1740,6 @@ var import_zod20 = require("zod");
|
|
1668
1740
|
var BaseActionInput = import_zod20.z.object({
|
1669
1741
|
eventId: import_zod20.z.string(),
|
1670
1742
|
transactionId: import_zod20.z.string(),
|
1671
|
-
incomplete: import_zod20.z.boolean().optional().default(false).describe("Allows action with partial data to be saved"),
|
1672
1743
|
data: ActionUpdate,
|
1673
1744
|
metadata: ActionUpdate.optional()
|
1674
1745
|
});
|
@@ -1695,8 +1766,7 @@ var ValidateActionInput = BaseActionInput.merge(
|
|
1695
1766
|
);
|
1696
1767
|
var NotifyActionInput = BaseActionInput.merge(
|
1697
1768
|
import_zod20.z.object({
|
1698
|
-
type: import_zod20.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
1699
|
-
createdAtLocation: import_zod20.z.string()
|
1769
|
+
type: import_zod20.z.literal(ActionType.NOTIFY).default(ActionType.NOTIFY)
|
1700
1770
|
})
|
1701
1771
|
);
|
1702
1772
|
var DeclareActionInput = BaseActionInput.merge(
|
@@ -1719,9 +1789,9 @@ var MarkedAsDuplicateActionInput = BaseActionInput.merge(
|
|
1719
1789
|
type: import_zod20.z.literal(ActionType.MARKED_AS_DUPLICATE).default(ActionType.MARKED_AS_DUPLICATE)
|
1720
1790
|
})
|
1721
1791
|
);
|
1722
|
-
var
|
1792
|
+
var ArchiveActionInput = BaseActionInput.merge(
|
1723
1793
|
import_zod20.z.object({
|
1724
|
-
type: import_zod20.z.literal(ActionType.
|
1794
|
+
type: import_zod20.z.literal(ActionType.ARCHIVE).default(ActionType.ARCHIVE)
|
1725
1795
|
})
|
1726
1796
|
);
|
1727
1797
|
var AssignActionInput = BaseActionInput.merge(
|
@@ -1760,7 +1830,7 @@ var ActionInput = import_zod20.z.discriminatedUnion("type", [
|
|
1760
1830
|
DeclareActionInput,
|
1761
1831
|
RejectDeclarationActionInput,
|
1762
1832
|
MarkedAsDuplicateActionInput,
|
1763
|
-
|
1833
|
+
ArchiveActionInput,
|
1764
1834
|
AssignActionInput,
|
1765
1835
|
UnassignActionInput,
|
1766
1836
|
PrintCertificateActionInput,
|
@@ -1832,9 +1902,12 @@ function getStatusFromActions(actions) {
|
|
1832
1902
|
if (action.type === ActionType.REJECT) {
|
1833
1903
|
return EventStatus.REJECTED;
|
1834
1904
|
}
|
1835
|
-
if (action.type === ActionType.
|
1905
|
+
if (action.type === ActionType.ARCHIVE) {
|
1836
1906
|
return EventStatus.ARCHIVED;
|
1837
1907
|
}
|
1908
|
+
if (action.type === ActionType.NOTIFY) {
|
1909
|
+
return EventStatus.NOTIFIED;
|
1910
|
+
}
|
1838
1911
|
return status;
|
1839
1912
|
}, EventStatus.CREATED);
|
1840
1913
|
}
|
@@ -1901,8 +1974,8 @@ function deepMerge(currentDocument, actionDocument) {
|
|
1901
1974
|
}
|
1902
1975
|
);
|
1903
1976
|
}
|
1904
|
-
function isUndeclaredDraft(
|
1905
|
-
return
|
1977
|
+
function isUndeclaredDraft(status) {
|
1978
|
+
return status === EventStatus.CREATED;
|
1906
1979
|
}
|
1907
1980
|
function getCurrentEventState(event2) {
|
1908
1981
|
const creationAction = event2.actions.find(
|
@@ -3495,7 +3568,7 @@ var eventPayloadGenerator = {
|
|
3495
3568
|
eventId
|
3496
3569
|
}),
|
3497
3570
|
archive: (eventId, input = {}, isDuplicate) => ({
|
3498
|
-
type: ActionType.
|
3571
|
+
type: ActionType.ARCHIVE,
|
3499
3572
|
transactionId: input.transactionId ?? getUUID(),
|
3500
3573
|
data: input.data ?? {},
|
3501
3574
|
metadata: { isDuplicate: isDuplicate ?? false },
|
@@ -3581,7 +3654,7 @@ function generateActionDocument({
|
|
3581
3654
|
return { ...actionBase, assignedTo: getUUID(), type: action };
|
3582
3655
|
case ActionType.VALIDATE:
|
3583
3656
|
return { ...actionBase, type: action };
|
3584
|
-
case ActionType.
|
3657
|
+
case ActionType.ARCHIVE:
|
3585
3658
|
return { ...actionBase, type: action };
|
3586
3659
|
case ActionType.REJECT:
|
3587
3660
|
return { ...actionBase, type: action };
|
@@ -3678,7 +3751,7 @@ function isFieldValueWithoutTemplates(value) {
|
|
3678
3751
|
}
|
3679
3752
|
return true;
|
3680
3753
|
}
|
3681
|
-
function
|
3754
|
+
function isFieldConfigDefaultValue(value) {
|
3682
3755
|
if (!value) return false;
|
3683
3756
|
if (isFieldValue(value)) {
|
3684
3757
|
return true;
|
@@ -3687,7 +3760,7 @@ function isDefaultValue(value) {
|
|
3687
3760
|
return true;
|
3688
3761
|
}
|
3689
3762
|
if (typeof value === "object" && Object.values(value).every((v) => typeof v === "object" && v !== null)) {
|
3690
|
-
return Object.values(value).every((v) =>
|
3763
|
+
return Object.values(value).every((v) => isFieldConfigDefaultValue(v));
|
3691
3764
|
}
|
3692
3765
|
return false;
|
3693
3766
|
}
|