@opencrvs/toolkit 1.8.0-rc.f7aaf07 → 1.8.0-rc.f7e4aad
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 +726 -662
- package/dist/commons/events/ActionDocument.d.ts +381 -387
- package/dist/commons/events/ActionInput.d.ts +126 -126
- package/dist/commons/events/CountryConfigQueryInput.d.ts +884 -222
- package/dist/commons/events/CreatedAtLocation.d.ts +1 -2
- package/dist/commons/events/Draft.d.ts +23 -23
- package/dist/commons/events/EventDocument.d.ts +270 -275
- package/dist/commons/events/EventIndex.d.ts +120 -141
- package/dist/commons/events/EventMetadata.d.ts +38 -29
- package/dist/commons/events/WorkqueueConfig.d.ts +1504 -494
- package/dist/commons/events/test.utils.d.ts +16 -6
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +7 -6
- package/dist/conditionals/index.js +20 -17
- package/dist/events/index.js +176 -102
- package/package.json +3 -3
@@ -1,3 +1,4 @@
|
|
1
|
+
import { UUID } from '../uuid';
|
1
2
|
import { ActionDocument, EventState } from './ActionDocument';
|
2
3
|
import { ArchiveActionInput, AssignActionInput, DeclareActionInput, NotifyActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
|
3
4
|
import { ActionType } from './ActionType';
|
@@ -38,7 +39,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
|
|
38
39
|
id: string;
|
39
40
|
};
|
40
41
|
draft: ({ eventId, actionType }: {
|
41
|
-
eventId:
|
42
|
+
eventId: UUID;
|
42
43
|
actionType: ActionType;
|
43
44
|
}, input?: Partial<Draft>) => Draft;
|
44
45
|
actions: {
|
@@ -272,7 +273,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
|
|
272
273
|
message: string;
|
273
274
|
};
|
274
275
|
};
|
275
|
-
register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
|
276
|
+
register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment" | "registrationNumber">>) => {
|
276
277
|
transactionId: string;
|
277
278
|
declaration: Record<string, string | number | boolean | {
|
278
279
|
type: string;
|
@@ -317,6 +318,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
|
|
317
318
|
originalFilename: string;
|
318
319
|
}[] | [string, string] | null | undefined>;
|
319
320
|
annotation: {};
|
321
|
+
registrationNumber?: string | undefined;
|
320
322
|
keepAssignment?: boolean | undefined;
|
321
323
|
type: "REGISTER";
|
322
324
|
eventId: string;
|
@@ -400,25 +402,31 @@ export declare function eventPayloadGenerator(rng: () => number): {
|
|
400
402
|
};
|
401
403
|
};
|
402
404
|
};
|
403
|
-
export declare function generateActionDocument({ configuration, action, rng, defaults }: {
|
405
|
+
export declare function generateActionDocument({ configuration, action, rng, defaults, user }: {
|
404
406
|
configuration: EventConfig;
|
405
407
|
action: ActionType;
|
406
408
|
rng?: () => number;
|
407
409
|
defaults?: Partial<ActionDocument>;
|
408
410
|
user?: Partial<{
|
409
411
|
signature: string;
|
410
|
-
primaryOfficeId:
|
412
|
+
primaryOfficeId: UUID;
|
411
413
|
role: TestUserRole;
|
412
414
|
id: string;
|
413
415
|
}>;
|
414
416
|
}): ActionDocument;
|
415
|
-
export declare function generateEventDocument({ configuration, actions, rng }: {
|
417
|
+
export declare function generateEventDocument({ configuration, actions, rng, user }: {
|
416
418
|
configuration: EventConfig;
|
417
419
|
actions: ActionType[];
|
418
420
|
rng?: () => number;
|
421
|
+
user?: Partial<{
|
422
|
+
signature: string;
|
423
|
+
primaryOfficeId: UUID;
|
424
|
+
role: TestUserRole;
|
425
|
+
id: string;
|
426
|
+
}>;
|
419
427
|
}): EventDocument;
|
420
428
|
export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
|
421
|
-
eventId:
|
429
|
+
eventId: UUID;
|
422
430
|
actionType: ActionType;
|
423
431
|
rng?: () => number;
|
424
432
|
declaration?: EventState;
|
@@ -432,6 +440,8 @@ export declare function getRandomDate(rng: () => number, start: string, end: str
|
|
432
440
|
* @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
|
433
441
|
*/
|
434
442
|
export declare function createPrng(seed: number): () => number;
|
443
|
+
export declare function generateUuid(rng?: () => number): UUID;
|
444
|
+
export declare function generateRegistrationNumber(rng: () => number): string;
|
435
445
|
export declare function generateRandomSignature(rng: () => number): string;
|
436
446
|
export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
|
437
447
|
export declare const generateTranslationConfig: (message: string) => TranslationConfig;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
export declare function generateTransactionId(): import("
|
1
|
+
export declare function generateTransactionId(): string & import("zod").BRAND<"UUID">;
|
2
2
|
//# sourceMappingURL=transactions.d.ts.map
|
@@ -5,6 +5,7 @@ import { Action, ActionUpdate, EventState } from './ActionDocument';
|
|
5
5
|
import { PageConfig, VerificationPageConfig } from './PageConfig';
|
6
6
|
import { Draft } from './Draft';
|
7
7
|
import { EventDocument } from './EventDocument';
|
8
|
+
import { UUID } from '../uuid';
|
8
9
|
import { ActionConfig } from './ActionConfig';
|
9
10
|
import { FormConfig } from './FormConfig';
|
10
11
|
export declare function getDeclarationFields(configuration: EventConfig): FieldConfig[];
|
@@ -4121,10 +4122,10 @@ export declare function omitHiddenPaginatedFields(formConfig: FormConfig, declar
|
|
4121
4122
|
originalFilename: string;
|
4122
4123
|
}[] | [string, string] | null | undefined>>;
|
4123
4124
|
export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]): {
|
4124
|
-
id: string
|
4125
|
+
id: string & import("zod").BRAND<"UUID">;
|
4125
4126
|
transactionId: string;
|
4126
4127
|
createdAt: string;
|
4127
|
-
eventId: string
|
4128
|
+
eventId: string & import("zod").BRAND<"UUID">;
|
4128
4129
|
action: {
|
4129
4130
|
type: "DECLARE" | "REGISTER" | "VALIDATE" | "DELETE" | "CREATE" | "NOTIFY" | "DETECT_DUPLICATE" | "REJECT" | "MARKED_AS_DUPLICATE" | "ARCHIVE" | "PRINT_CERTIFICATE" | "REQUEST_CORRECTION" | "REJECT_CORRECTION" | "APPROVE_CORRECTION" | "READ" | "ASSIGN" | "UNASSIGN";
|
4130
4131
|
status: "Rejected" | "Requested" | "Accepted";
|
@@ -4176,7 +4177,7 @@ export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]):
|
|
4176
4177
|
originalFilename: string;
|
4177
4178
|
}[] | [string, string] | null | undefined>;
|
4178
4179
|
createdBySignature?: string | null | undefined;
|
4179
|
-
createdAtLocation?: string | null | undefined;
|
4180
|
+
createdAtLocation?: (string & import("zod").BRAND<"UUID">) | null | undefined;
|
4180
4181
|
annotation?: Record<string, string | number | boolean | {
|
4181
4182
|
type: string;
|
4182
4183
|
filename: string;
|
@@ -4218,11 +4219,11 @@ export declare function findActiveDrafts(event: EventDocument, drafts: Draft[]):
|
|
4218
4219
|
option: string;
|
4219
4220
|
filename: string;
|
4220
4221
|
originalFilename: string;
|
4221
|
-
}[] | [string, string] | null | undefined> | undefined;
|
4222
|
-
originalActionId?: string | undefined;
|
4222
|
+
}[] | [string, string] | null | undefined> | null | undefined;
|
4223
|
+
originalActionId?: (string & import("zod").BRAND<"UUID">) | null | undefined;
|
4223
4224
|
};
|
4224
4225
|
}[];
|
4225
|
-
export declare function createEmptyDraft(eventId:
|
4226
|
+
export declare function createEmptyDraft(eventId: UUID, draftId: UUID, actionType: ActionType): Draft;
|
4226
4227
|
export declare function isVerificationPage(page: PageConfig): page is VerificationPageConfig;
|
4227
4228
|
export declare function getVisibleVerificationPageIds(pages: PageConfig[], annotation: ActionUpdate): string[];
|
4228
4229
|
export declare function getActionVerificationPageIds(actionConfig: ActionConfig, annotation: ActionUpdate): string[];
|
@@ -144,9 +144,6 @@ function createEventConditionals() {
|
|
144
144
|
})
|
145
145
|
};
|
146
146
|
}
|
147
|
-
function getDateFromNow(days) {
|
148
|
-
return new Date(Date.now() - days * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
149
|
-
}
|
150
147
|
function getDateRangeToFieldReference(fieldId, comparedFieldId, clause) {
|
151
148
|
return {
|
152
149
|
type: "object",
|
@@ -165,6 +162,20 @@ function isFieldReference(value) {
|
|
165
162
|
return typeof value === "object" && value !== null && "$$field" in value;
|
166
163
|
}
|
167
164
|
function createFieldConditionals(fieldId) {
|
165
|
+
const getDayRange = (days, clause) => ({
|
166
|
+
type: "object",
|
167
|
+
properties: {
|
168
|
+
[fieldId]: {
|
169
|
+
type: "string",
|
170
|
+
format: "date",
|
171
|
+
daysFromNow: {
|
172
|
+
days,
|
173
|
+
clause
|
174
|
+
}
|
175
|
+
}
|
176
|
+
},
|
177
|
+
required: [fieldId]
|
178
|
+
});
|
168
179
|
const getDateRange = (date, clause) => ({
|
169
180
|
type: "object",
|
170
181
|
properties: {
|
@@ -183,12 +194,8 @@ function createFieldConditionals(fieldId) {
|
|
183
194
|
$$field: fieldId,
|
184
195
|
isAfter: () => ({
|
185
196
|
days: (days) => ({
|
186
|
-
inPast: () => defineFormConditional(
|
187
|
-
|
188
|
-
),
|
189
|
-
inFuture: () => defineFormConditional(
|
190
|
-
getDateRange(getDateFromNow(-days), "formatMinimum")
|
191
|
-
)
|
197
|
+
inPast: () => defineFormConditional(getDayRange(-days, "after")),
|
198
|
+
inFuture: () => defineFormConditional(getDayRange(days, "after"))
|
192
199
|
}),
|
193
200
|
date: (date) => {
|
194
201
|
if (isFieldReference(date)) {
|
@@ -203,16 +210,12 @@ function createFieldConditionals(fieldId) {
|
|
203
210
|
}
|
204
211
|
return defineFormConditional(getDateRange(date, "formatMinimum"));
|
205
212
|
},
|
206
|
-
now: () => defineFormConditional(getDateRange(
|
213
|
+
now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMinimum"))
|
207
214
|
}),
|
208
215
|
isBefore: () => ({
|
209
216
|
days: (days) => ({
|
210
|
-
inPast: () => defineFormConditional(
|
211
|
-
|
212
|
-
),
|
213
|
-
inFuture: () => defineFormConditional(
|
214
|
-
getDateRange(getDateFromNow(-days), "formatMaximum")
|
215
|
-
)
|
217
|
+
inPast: () => defineFormConditional(getDayRange(days, "before")),
|
218
|
+
inFuture: () => defineFormConditional(getDayRange(-days, "before"))
|
216
219
|
}),
|
217
220
|
date: (date) => {
|
218
221
|
if (isFieldReference(date)) {
|
@@ -227,7 +230,7 @@ function createFieldConditionals(fieldId) {
|
|
227
230
|
}
|
228
231
|
return defineFormConditional(getDateRange(date, "formatMaximum"));
|
229
232
|
},
|
230
|
-
now: () => defineFormConditional(getDateRange(
|
233
|
+
now: () => defineFormConditional(getDateRange({ $data: "/$now" }, "formatMaximum"))
|
231
234
|
}),
|
232
235
|
isEqualTo: (value) => {
|
233
236
|
if (isFieldReference(value)) {
|