@opencrvs/toolkit 1.8.1-rc.bbbfede → 1.8.1-rc.d31fe05
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 +24 -408
- package/dist/commons/conditionals/validate.d.ts +2 -3
- package/dist/commons/events/ActionDocument.d.ts +36 -659
- package/dist/commons/events/ActionInput.d.ts +36 -540
- package/dist/commons/events/AdvancedSearchConfig.d.ts +34 -34
- package/dist/commons/events/Draft.d.ts +0 -44
- package/dist/commons/events/EventConfig.d.ts +22 -22
- package/dist/commons/events/EventDocument.d.ts +26 -416
- package/dist/commons/events/EventIndex.d.ts +0 -6
- package/dist/commons/events/EventMetadata.d.ts +0 -6
- package/dist/commons/events/defineConfig.d.ts +2 -2
- package/dist/commons/events/event.d.ts +9 -55
- 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 +2 -6
- package/dist/events/index.js +50 -128
- package/package.json +1 -1
@@ -117,8 +117,6 @@ export declare const EventIndex: z.ZodObject<z.objectUtil.extendShape<{
|
|
117
117
|
readonly REJECTED: "rejected";
|
118
118
|
readonly CORRECTION_REQUESTED: "correction-requested";
|
119
119
|
}>]>, "many">;
|
120
|
-
copiesPrintedForTemplate: z.ZodOptional<z.ZodNumber>;
|
121
|
-
modifiedAt: z.ZodOptional<z.ZodString>;
|
122
120
|
}, {
|
123
121
|
declaration: z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodString, z.ZodString, z.ZodUnion<[z.ZodObject<{
|
124
122
|
start: z.ZodString;
|
@@ -354,8 +352,6 @@ export declare const EventIndex: z.ZodObject<z.objectUtil.extendShape<{
|
|
354
352
|
dateOfEvent?: string | null | undefined;
|
355
353
|
updatedAtLocation?: (string & z.BRAND<"UUID">) | null | undefined;
|
356
354
|
updatedBy?: string | null | undefined;
|
357
|
-
copiesPrintedForTemplate?: number | undefined;
|
358
|
-
modifiedAt?: string | undefined;
|
359
355
|
}, {
|
360
356
|
type: string;
|
361
357
|
id: string;
|
@@ -443,8 +439,6 @@ export declare const EventIndex: z.ZodObject<z.objectUtil.extendShape<{
|
|
443
439
|
dateOfEvent?: string | null | undefined;
|
444
440
|
updatedAtLocation?: string | null | undefined;
|
445
441
|
updatedBy?: string | null | undefined;
|
446
|
-
copiesPrintedForTemplate?: number | undefined;
|
447
|
-
modifiedAt?: string | undefined;
|
448
442
|
}>;
|
449
443
|
export declare const EventSearchIndex: z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodObject<{
|
450
444
|
type: z.ZodString;
|
@@ -297,8 +297,6 @@ export declare const EventMetadata: z.ZodObject<{
|
|
297
297
|
readonly REJECTED: "rejected";
|
298
298
|
readonly CORRECTION_REQUESTED: "correction-requested";
|
299
299
|
}>]>, "many">;
|
300
|
-
copiesPrintedForTemplate: z.ZodOptional<z.ZodNumber>;
|
301
|
-
modifiedAt: z.ZodOptional<z.ZodString>;
|
302
300
|
}, "strip", z.ZodTypeAny, {
|
303
301
|
type: string;
|
304
302
|
id: string & z.BRAND<"UUID">;
|
@@ -337,8 +335,6 @@ export declare const EventMetadata: z.ZodObject<{
|
|
337
335
|
dateOfEvent?: string | null | undefined;
|
338
336
|
updatedAtLocation?: (string & z.BRAND<"UUID">) | null | undefined;
|
339
337
|
updatedBy?: string | null | undefined;
|
340
|
-
copiesPrintedForTemplate?: number | undefined;
|
341
|
-
modifiedAt?: string | undefined;
|
342
338
|
}, {
|
343
339
|
type: string;
|
344
340
|
id: string;
|
@@ -377,8 +373,6 @@ export declare const EventMetadata: z.ZodObject<{
|
|
377
373
|
dateOfEvent?: string | null | undefined;
|
378
374
|
updatedAtLocation?: string | null | undefined;
|
379
375
|
updatedBy?: string | null | undefined;
|
380
|
-
copiesPrintedForTemplate?: number | undefined;
|
381
|
-
modifiedAt?: string | undefined;
|
382
376
|
}>;
|
383
377
|
export type EventMetadata = z.infer<typeof EventMetadata>;
|
384
378
|
export declare const EventMetadataKeysArray: readonly ["id", "type", "status", "createdAt", "dateOfEvent", "createdBy", "createdByUserType", "updatedByUserRole", "createdAtLocation", "updatedAtLocation", "updatedAt", "assignedTo", "updatedBy", "trackingId", "legalStatuses", "flags"];
|
@@ -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,7 +8684,7 @@ 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
8689
|
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
|
8690
8690
|
fieldType: "event";
|
@@ -33,67 +33,21 @@ declare function eventFn(fieldId: EventFieldId): {
|
|
33
33
|
type: "fuzzy";
|
34
34
|
};
|
35
35
|
};
|
36
|
+
within: () => {
|
37
|
+
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "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
|
/**
|
39
47
|
* Checks if the event contains a specific action type.
|
40
|
-
* Can be used directly as a conditional or chained with additional methods.
|
41
48
|
* @param action - The action type to check for.
|
42
49
|
*/
|
43
|
-
hasAction: (action: ActionType) =>
|
44
|
-
/**
|
45
|
-
* Creates a conditional that checks if the event contains a specific action type
|
46
|
-
* with a minimum count of occurrences.
|
47
|
-
*
|
48
|
-
* @param minCount - The minimum number of actions required.
|
49
|
-
*/
|
50
|
-
minCount: (minCount: number) => import("../conditionals/conditionals").JSONSchema;
|
51
|
-
/**
|
52
|
-
* Builds a conditional that sets a maximum count for the number of actions.
|
53
|
-
* This is useful for limiting the number of actions of a specific type in a single event.
|
54
|
-
*/
|
55
|
-
maxCount: (maxCount: number) => import("../conditionals/conditionals").JSONSchema;
|
56
|
-
/**
|
57
|
-
* Adds additional field constraints to the action matching.
|
58
|
-
*
|
59
|
-
* @param fields - Object containing additional fields to match on the action.
|
60
|
-
*/
|
61
|
-
withFields: (fields: Record<string, unknown>) => {
|
62
|
-
/**
|
63
|
-
* Creates a conditional that checks if the event contains a specific action type
|
64
|
-
* with a minimum count of occurrences.
|
65
|
-
*
|
66
|
-
* @param minCount - The minimum number of actions required.
|
67
|
-
*/
|
68
|
-
minCount: (minCount: number) => import("../conditionals/conditionals").JSONSchema;
|
69
|
-
/**
|
70
|
-
* Builds a conditional that sets a maximum count for the number of actions.
|
71
|
-
* This is useful for limiting the number of actions of a specific type in a single event.
|
72
|
-
*/
|
73
|
-
maxCount: (maxCount: number) => import("../conditionals/conditionals").JSONSchema;
|
74
|
-
};
|
75
|
-
/**
|
76
|
-
* Adds template ID constraint to the action matching.
|
77
|
-
* This is a convenience method that adds actionDetails.templateId to the fields.
|
78
|
-
*
|
79
|
-
* @param id - The template ID to match against.
|
80
|
-
*/
|
81
|
-
withTemplate: (id: string) => {
|
82
|
-
/**
|
83
|
-
* Creates a conditional that checks if the event contains a specific action type
|
84
|
-
* with a minimum count of occurrences.
|
85
|
-
*
|
86
|
-
* @param minCount - The minimum number of actions required.
|
87
|
-
*/
|
88
|
-
minCount: (minCount: number) => import("../conditionals/conditionals").JSONSchema;
|
89
|
-
/**
|
90
|
-
* Builds a conditional that sets a maximum count for the number of actions.
|
91
|
-
* This is useful for limiting the number of actions of a specific type in a single event.
|
92
|
-
*/
|
93
|
-
maxCount: (maxCount: number) => import("../conditionals/conditionals").JSONSchema;
|
94
|
-
};
|
95
|
-
__nominal__type: "JSONSchema";
|
96
|
-
};
|
50
|
+
hasAction: (action: ActionType) => import("../conditionals/conditionals").JSONSchema;
|
97
51
|
field(field: WorkqueueColumnKeys): WorkqueueColumnValue;
|
98
52
|
};
|
99
53
|
export { event };
|
@@ -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
|
};
|
@@ -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,7 +15547,7 @@ 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
15552
|
fieldId: "status" | "updatedAt" | "trackingId" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.REGISTERED.createdAtLocation";
|
15557
15553
|
fieldType: "event";
|
package/dist/events/index.js
CHANGED
@@ -39,7 +39,6 @@ __export(events_exports, {
|
|
39
39
|
ActionConfig: () => ActionConfig,
|
40
40
|
ActionConfigBase: () => ActionConfigBase,
|
41
41
|
ActionCreationMetadata: () => ActionCreationMetadata,
|
42
|
-
ActionDetails: () => ActionDetails,
|
43
42
|
ActionDocument: () => ActionDocument,
|
44
43
|
ActionFormConfig: () => ActionFormConfig,
|
45
44
|
ActionInput: () => ActionInput,
|
@@ -198,7 +197,6 @@ __export(events_exports, {
|
|
198
197
|
annotationActions: () => annotationActions,
|
199
198
|
applyDeclarationToEventIndex: () => applyDeclarationToEventIndex,
|
200
199
|
applyDraftsToEventIndex: () => applyDraftsToEventIndex,
|
201
|
-
areCertificateConditionsMet: () => areCertificateConditionsMet,
|
202
200
|
areConditionsMet: () => areConditionsMet,
|
203
201
|
compositeFieldTypes: () => compositeFieldTypes,
|
204
202
|
createEmptyDraft: () => createEmptyDraft,
|
@@ -1224,8 +1222,7 @@ var CertificateConfig = import_zod11.z.object({
|
|
1224
1222
|
delayed: import_zod11.z.number()
|
1225
1223
|
}),
|
1226
1224
|
svgUrl: import_zod11.z.string(),
|
1227
|
-
fonts: import_zod11.z.record(FontFamily).optional()
|
1228
|
-
conditionals: import_zod11.z.array(ShowConditional).optional()
|
1225
|
+
fonts: import_zod11.z.record(FontFamily).optional()
|
1229
1226
|
});
|
1230
1227
|
var CertificateTemplateConfig = CertificateConfig.extend({
|
1231
1228
|
hash: import_zod11.z.string().optional(),
|
@@ -1343,7 +1340,7 @@ var SummaryConfig = import_zod14.z.object({
|
|
1343
1340
|
|
1344
1341
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
1345
1342
|
var import_zod15 = require("zod");
|
1346
|
-
var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range"]);
|
1343
|
+
var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range", "within"]);
|
1347
1344
|
var BaseField3 = import_zod15.z.object({
|
1348
1345
|
config: import_zod15.z.object({
|
1349
1346
|
type: MatchType.describe("Determines the type of field")
|
@@ -1885,10 +1882,6 @@ var ActionStatus = {
|
|
1885
1882
|
Accepted: "Accepted",
|
1886
1883
|
Rejected: "Rejected"
|
1887
1884
|
};
|
1888
|
-
var ActionDetails = import_zod19.z.object({
|
1889
|
-
templateId: import_zod19.z.string().optional(),
|
1890
|
-
isImmediateCorrection: import_zod19.z.boolean().optional()
|
1891
|
-
});
|
1892
1885
|
var ActionBase = import_zod19.z.object({
|
1893
1886
|
id: UUID,
|
1894
1887
|
transactionId: import_zod19.z.string(),
|
@@ -1900,7 +1893,6 @@ var ActionBase = import_zod19.z.object({
|
|
1900
1893
|
createdAtLocation: CreatedAtLocation,
|
1901
1894
|
declaration: ActionUpdate,
|
1902
1895
|
annotation: ActionUpdate.optional().nullable(),
|
1903
|
-
actionDetails: ActionDetails.optional().nullable(),
|
1904
1896
|
status: import_zod19.z.enum([
|
1905
1897
|
ActionStatus.Requested,
|
1906
1898
|
ActionStatus.Accepted,
|
@@ -1988,7 +1980,8 @@ var ApprovedCorrectionAction = ActionBase.merge(
|
|
1988
1980
|
var RejectedCorrectionAction = ActionBase.merge(
|
1989
1981
|
import_zod19.z.object({
|
1990
1982
|
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
|
1991
|
-
requestId: import_zod19.z.string()
|
1983
|
+
requestId: import_zod19.z.string(),
|
1984
|
+
reason: RejectionReason
|
1992
1985
|
})
|
1993
1986
|
);
|
1994
1987
|
var ReadAction = ActionBase.merge(
|
@@ -2038,7 +2031,7 @@ var ResolvedUser = import_zod19.z.object({
|
|
2038
2031
|
});
|
2039
2032
|
|
2040
2033
|
// ../commons/src/conditionals/validate.ts
|
2041
|
-
var
|
2034
|
+
var import_ajv = __toESM(require("ajv"));
|
2042
2035
|
var import_ajv_formats = __toESM(require("ajv-formats"));
|
2043
2036
|
var import_date_fns = require("date-fns");
|
2044
2037
|
|
@@ -2252,11 +2245,9 @@ var isNonInteractiveFieldType = (field2) => {
|
|
2252
2245
|
};
|
2253
2246
|
|
2254
2247
|
// ../commons/src/conditionals/validate.ts
|
2255
|
-
var ajv = new
|
2248
|
+
var ajv = new import_ajv.default({
|
2256
2249
|
$data: true,
|
2257
|
-
allowUnionTypes: true
|
2258
|
-
strict: false
|
2259
|
-
// Allow minContains and other newer features
|
2250
|
+
allowUnionTypes: true
|
2260
2251
|
});
|
2261
2252
|
(0, import_ajv_formats.default)(ajv);
|
2262
2253
|
ajv.addKeyword({
|
@@ -2494,11 +2485,6 @@ function getValidatorsForField(fieldId, validations) {
|
|
2494
2485
|
};
|
2495
2486
|
}).filter((x) => x !== null);
|
2496
2487
|
}
|
2497
|
-
function areCertificateConditionsMet(conditions, values) {
|
2498
|
-
return conditions.every((condition) => {
|
2499
|
-
return ajv.validate(condition.conditional, values);
|
2500
|
-
});
|
2501
|
-
}
|
2502
2488
|
|
2503
2489
|
// ../commons/src/utils.ts
|
2504
2490
|
function getOrThrow(x, message) {
|
@@ -3189,6 +3175,19 @@ function createSearchConfig(baseField) {
|
|
3189
3175
|
fuzzy: () => ({
|
3190
3176
|
...baseField,
|
3191
3177
|
config: { type: "fuzzy" }
|
3178
|
+
}),
|
3179
|
+
/**
|
3180
|
+
* Creates a configuration for matching locations and the child locations
|
3181
|
+
* @returns An object containing the field ID and a configuration object with a type of 'within'.
|
3182
|
+
* @example field('createdAtLocation').within()
|
3183
|
+
* // {
|
3184
|
+
* // ...
|
3185
|
+
* // config: { type: 'within' }
|
3186
|
+
* // }
|
3187
|
+
*/
|
3188
|
+
within: () => ({
|
3189
|
+
...baseField,
|
3190
|
+
config: { type: "within" }
|
3192
3191
|
})
|
3193
3192
|
};
|
3194
3193
|
}
|
@@ -3209,107 +3208,32 @@ function eventFn(fieldId) {
|
|
3209
3208
|
var event = Object.assign(eventFn, {
|
3210
3209
|
/**
|
3211
3210
|
* Checks if the event contains a specific action type.
|
3212
|
-
* Can be used directly as a conditional or chained with additional methods.
|
3213
3211
|
* @param action - The action type to check for.
|
3214
3212
|
*/
|
3215
|
-
hasAction: (action) => {
|
3216
|
-
|
3217
|
-
|
3218
|
-
|
3219
|
-
$event: {
|
3220
|
-
type: "object",
|
3221
|
-
properties: {
|
3222
|
-
actions: {
|
3223
|
-
type: "array",
|
3224
|
-
contains: {
|
3225
|
-
type: "object",
|
3226
|
-
properties: {
|
3227
|
-
type: {
|
3228
|
-
const: action
|
3229
|
-
}
|
3230
|
-
},
|
3231
|
-
required: ["type"]
|
3232
|
-
}
|
3233
|
-
}
|
3234
|
-
},
|
3235
|
-
required: ["actions"]
|
3236
|
-
}
|
3237
|
-
},
|
3238
|
-
required: ["$event"]
|
3239
|
-
});
|
3240
|
-
const buildActionConstraints = (additionalFields) => {
|
3241
|
-
const actionProperties = {
|
3242
|
-
type: { const: action }
|
3243
|
-
};
|
3244
|
-
const requiredFields = ["type"];
|
3245
|
-
if (additionalFields) {
|
3246
|
-
Object.entries(additionalFields).forEach(([key, value]) => {
|
3247
|
-
actionProperties[key] = { const: value };
|
3248
|
-
requiredFields.push(key);
|
3249
|
-
});
|
3250
|
-
}
|
3251
|
-
return { actionProperties, requiredFields };
|
3252
|
-
};
|
3253
|
-
const createCountConditional = (countType, count, additionalFields) => {
|
3254
|
-
const { actionProperties, requiredFields } = buildActionConstraints(additionalFields);
|
3255
|
-
return defineConditional({
|
3213
|
+
hasAction: (action) => defineConditional({
|
3214
|
+
type: "object",
|
3215
|
+
properties: {
|
3216
|
+
$event: {
|
3256
3217
|
type: "object",
|
3257
3218
|
properties: {
|
3258
|
-
|
3259
|
-
type: "
|
3260
|
-
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3269
|
-
}
|
3270
|
-
},
|
3271
|
-
required: ["actions"]
|
3219
|
+
actions: {
|
3220
|
+
type: "array",
|
3221
|
+
contains: {
|
3222
|
+
type: "object",
|
3223
|
+
properties: {
|
3224
|
+
type: {
|
3225
|
+
const: action
|
3226
|
+
}
|
3227
|
+
},
|
3228
|
+
required: ["type"]
|
3229
|
+
}
|
3272
3230
|
}
|
3273
3231
|
},
|
3274
|
-
required: ["
|
3275
|
-
}
|
3276
|
-
}
|
3277
|
-
|
3278
|
-
|
3279
|
-
/**
|
3280
|
-
* Creates a conditional that checks if the event contains a specific action type
|
3281
|
-
* with a minimum count of occurrences.
|
3282
|
-
*
|
3283
|
-
* @param minCount - The minimum number of actions required.
|
3284
|
-
*/
|
3285
|
-
minCount: (minCount) => createCountConditional("minContains", minCount, additionalFields),
|
3286
|
-
/**
|
3287
|
-
* Builds a conditional that sets a maximum count for the number of actions.
|
3288
|
-
* This is useful for limiting the number of actions of a specific type in a single event.
|
3289
|
-
*/
|
3290
|
-
maxCount: (maxCount) => createCountConditional("maxContains", maxCount, additionalFields)
|
3291
|
-
};
|
3292
|
-
};
|
3293
|
-
const chainableMethods = {
|
3294
|
-
/**
|
3295
|
-
* Adds additional field constraints to the action matching.
|
3296
|
-
*
|
3297
|
-
* @param fields - Object containing additional fields to match on the action.
|
3298
|
-
*/
|
3299
|
-
withFields: (fields) => withMinMax(fields),
|
3300
|
-
/**
|
3301
|
-
* Adds template ID constraint to the action matching.
|
3302
|
-
* This is a convenience method that adds actionDetails.templateId to the fields.
|
3303
|
-
*
|
3304
|
-
* @param id - The template ID to match against.
|
3305
|
-
*/
|
3306
|
-
withTemplate: (id) => withMinMax({
|
3307
|
-
actionDetails: { templateId: id }
|
3308
|
-
}),
|
3309
|
-
...withMinMax()
|
3310
|
-
};
|
3311
|
-
return { ...basicConditional, ...chainableMethods };
|
3312
|
-
},
|
3232
|
+
required: ["actions"]
|
3233
|
+
}
|
3234
|
+
},
|
3235
|
+
required: ["$event"]
|
3236
|
+
}),
|
3313
3237
|
field(field2) {
|
3314
3238
|
return {
|
3315
3239
|
$event: field2
|
@@ -3394,9 +3318,7 @@ var EventMetadata = import_zod23.z.object({
|
|
3394
3318
|
trackingId: import_zod23.z.string().describe(
|
3395
3319
|
"System-generated tracking ID used by informants or registrars to look up the event."
|
3396
3320
|
),
|
3397
|
-
flags: import_zod23.z.array(Flag)
|
3398
|
-
copiesPrintedForTemplate: import_zod23.z.number().optional(),
|
3399
|
-
modifiedAt: import_zod23.z.string().optional()
|
3321
|
+
flags: import_zod23.z.array(Flag)
|
3400
3322
|
});
|
3401
3323
|
var EventMetadataKeysArray = [
|
3402
3324
|
"id",
|
@@ -3926,7 +3848,6 @@ var BaseActionInput = import_zod29.z.object({
|
|
3926
3848
|
transactionId: import_zod29.z.string(),
|
3927
3849
|
declaration: ActionUpdate.default({}),
|
3928
3850
|
annotation: ActionUpdate.optional(),
|
3929
|
-
actionDetails: ActionDetails.optional(),
|
3930
3851
|
originalActionId: UUID.optional(),
|
3931
3852
|
// should not be part of base action.
|
3932
3853
|
keepAssignment: import_zod29.z.boolean().optional()
|
@@ -4009,7 +3930,8 @@ var RequestCorrectionActionInput = BaseActionInput.merge(
|
|
4009
3930
|
var RejectCorrectionActionInput = BaseActionInput.merge(
|
4010
3931
|
import_zod29.z.object({
|
4011
3932
|
requestId: import_zod29.z.string(),
|
4012
|
-
type: import_zod29.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION)
|
3933
|
+
type: import_zod29.z.literal(ActionType.REJECT_CORRECTION).default(ActionType.REJECT_CORRECTION),
|
3934
|
+
reason: RejectionReason
|
4013
3935
|
})
|
4014
3936
|
);
|
4015
3937
|
var ApproveCorrectionActionInput = BaseActionInput.merge(
|
@@ -4376,8 +4298,7 @@ function getCurrentEventState(event2, config) {
|
|
4376
4298
|
trackingId: event2.trackingId,
|
4377
4299
|
updatedByUserRole: requestActionMetadata.createdByRole,
|
4378
4300
|
dateOfEvent: resolveDateOfEvent(event2, declaration, config),
|
4379
|
-
flags: getFlagsFromActions(event2.actions)
|
4380
|
-
copiesPrintedForTemplate: event2.copiesPrintedForTemplate ?? 0
|
4301
|
+
flags: getFlagsFromActions(event2.actions)
|
4381
4302
|
});
|
4382
4303
|
}
|
4383
4304
|
function getCurrentEventStateWithDrafts({
|
@@ -6849,7 +6770,7 @@ function eventPayloadGenerator(rng) {
|
|
6849
6770
|
requestId,
|
6850
6771
|
keepAssignment: input.keepAssignment
|
6851
6772
|
}),
|
6852
|
-
reject: (eventId, requestId, input
|
6773
|
+
reject: (eventId, requestId, input) => ({
|
6853
6774
|
type: ActionType.REJECT_CORRECTION,
|
6854
6775
|
transactionId: input.transactionId ?? getUUID(),
|
6855
6776
|
declaration: {},
|
@@ -6860,7 +6781,8 @@ function eventPayloadGenerator(rng) {
|
|
6860
6781
|
),
|
6861
6782
|
eventId,
|
6862
6783
|
requestId,
|
6863
|
-
keepAssignment: input.keepAssignment
|
6784
|
+
keepAssignment: input.keepAssignment,
|
6785
|
+
reason: input.reason ?? { message: "" }
|
6864
6786
|
})
|
6865
6787
|
}
|
6866
6788
|
}
|
@@ -6919,7 +6841,8 @@ function generateActionDocument({
|
|
6919
6841
|
return {
|
6920
6842
|
...actionBase,
|
6921
6843
|
requestId: getUUID(),
|
6922
|
-
type: action
|
6844
|
+
type: action,
|
6845
|
+
reason: { message: "Correction rejection" }
|
6923
6846
|
};
|
6924
6847
|
case ActionType.REGISTER:
|
6925
6848
|
return {
|
@@ -7054,8 +6977,7 @@ var eventQueryDataGenerator = (overrides = {}, seed = 1) => {
|
|
7054
6977
|
flags: [],
|
7055
6978
|
legalStatuses: overrides.legalStatuses ?? {},
|
7056
6979
|
declaration: overrides.declaration ?? generateRandomApplicant(rng),
|
7057
|
-
trackingId: overrides.trackingId ?? generateTrackingId(rng)
|
7058
|
-
copiesPrintedForTemplate: overrides.copiesPrintedForTemplate ?? 0
|
6980
|
+
trackingId: overrides.trackingId ?? generateTrackingId(rng)
|
7059
6981
|
};
|
7060
6982
|
};
|
7061
6983
|
var generateTranslationConfig = (message) => ({
|