@opencrvs/toolkit 1.8.0-rc.fb96ec1 → 1.8.0-rc.fbababd

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.
Files changed (30) hide show
  1. package/dist/commons/api/router.d.ts +5865 -12088
  2. package/dist/commons/events/ActionConfig.d.ts +18584 -30632
  3. package/dist/commons/events/ActionDocument.d.ts +387 -486
  4. package/dist/commons/events/ActionInput.d.ts +126 -126
  5. package/dist/commons/events/ActionType.d.ts +0 -2
  6. package/dist/commons/events/AdvancedSearchConfig.d.ts +0 -204
  7. package/dist/commons/events/CountryConfigQueryInput.d.ts +412 -1160
  8. package/dist/commons/events/CreatedAtLocation.d.ts +2 -1
  9. package/dist/commons/events/Draft.d.ts +23 -28
  10. package/dist/commons/events/EventConfig.d.ts +17504 -26141
  11. package/dist/commons/events/EventDocument.d.ts +275 -350
  12. package/dist/commons/events/EventIndex.d.ts +214 -629
  13. package/dist/commons/events/EventMetadata.d.ts +31 -73
  14. package/dist/commons/events/FieldConfig.d.ts +37 -19
  15. package/dist/commons/events/FormConfig.d.ts +66 -0
  16. package/dist/commons/events/PageConfig.d.ts +18 -0
  17. package/dist/commons/events/WorkqueueColumnConfig.d.ts +11 -11
  18. package/dist/commons/events/WorkqueueConfig.d.ts +740 -3237
  19. package/dist/commons/events/defineConfig.d.ts +1589 -3224
  20. package/dist/commons/events/field.d.ts +0 -5
  21. package/dist/commons/events/index.d.ts +0 -1
  22. package/dist/commons/events/scopes.d.ts +3 -2
  23. package/dist/commons/events/test.utils.d.ts +5 -28
  24. package/dist/commons/events/transactions.d.ts +1 -1
  25. package/dist/commons/events/utils.d.ts +1600 -3232
  26. package/dist/conditionals/index.js +17 -20
  27. package/dist/events/index.js +1312 -1681
  28. package/dist/scopes/index.d.ts +1 -4
  29. package/dist/scopes/index.js +17 -67
  30. package/package.json +3 -3
@@ -1,6 +1,5 @@
1
1
  import { FieldConditional } from './Conditional';
2
2
  import { TranslationConfig } from './TranslationConfig';
3
- import { ValidationConfig } from './FieldConfig';
4
3
  /**
5
4
  * Entry point for defining conditional logic or configuration for a form field.
6
5
  * @param fieldId - The ID of the field to define rules or config for.
@@ -8,12 +7,10 @@ import { ValidationConfig } from './FieldConfig';
8
7
  */
9
8
  export declare function field(fieldId: string, options?: {
10
9
  conditionals?: FieldConditional[];
11
- validations?: ValidationConfig[];
12
10
  searchCriteriaLabelPrefix?: TranslationConfig;
13
11
  }): {
14
12
  range: () => {
15
13
  conditionals?: FieldConditional[];
16
- validations?: ValidationConfig[];
17
14
  searchCriteriaLabelPrefix?: TranslationConfig;
18
15
  fieldId: string;
19
16
  fieldType: "field";
@@ -24,7 +21,6 @@ export declare function field(fieldId: string, options?: {
24
21
  };
25
22
  exact: () => {
26
23
  conditionals?: FieldConditional[];
27
- validations?: ValidationConfig[];
28
24
  searchCriteriaLabelPrefix?: TranslationConfig;
29
25
  fieldId: string;
30
26
  fieldType: "field";
@@ -35,7 +31,6 @@ export declare function field(fieldId: string, options?: {
35
31
  };
36
32
  fuzzy: () => {
37
33
  conditionals?: FieldConditional[];
38
- validations?: ValidationConfig[];
39
34
  searchCriteriaLabelPrefix?: TranslationConfig;
40
35
  fieldId: string;
41
36
  fieldType: "field";
@@ -35,7 +35,6 @@ export * from './test.utils';
35
35
  export * from './TemplateConfig';
36
36
  export * from './scopes';
37
37
  export * from './serializer';
38
- export * from './state/availableActions';
39
38
  export * from '../conditionals/conditionals';
40
39
  export * from '../conditionals/validate';
41
40
  export * from './field';
@@ -1,4 +1,5 @@
1
1
  import { Scope } from '../scopes';
2
+ import { ActionType } from './ActionType';
2
3
  export declare const CONFIG_GET_ALLOWED_SCOPES: ["record.declare-birth", "record.read", "record.declaration-submit-incomplete", "record.declaration-submit-for-review", "record.register", "record.export-records", "config", "config.update:all"];
3
4
  export declare const CONFIG_SEARCH_ALLOWED_SCOPES: ("search.birth:my-jurisdiction" | "search.birth" | "search.death:my-jurisdiction" | "search.death" | "search.marriage:my-jurisdiction" | "search.marriage")[];
4
5
  export declare const ACTION_ALLOWED_SCOPES: {
@@ -10,7 +11,7 @@ export declare const ACTION_ALLOWED_SCOPES: {
10
11
  VALIDATE: ["record.declaration-submit-for-approval", "record.register"];
11
12
  REGISTER: ["record.register"];
12
13
  PRINT_CERTIFICATE: ["record.registration-print&issue-certified-copies"];
13
- REQUEST_CORRECTION: ["record.registration-request-correction"];
14
+ REQUEST_CORRECTION: ["record.registration-request-correction", "record.registration-correct"];
14
15
  REJECT_CORRECTION: ["record.registration-correct"];
15
16
  APPROVE_CORRECTION: ["record.registration-correct"];
16
17
  MARKED_AS_DUPLICATE: ["record.declaration-archive"];
@@ -39,6 +40,6 @@ export declare const ACTION_ALLOWED_CONFIGURABLE_SCOPES: {
39
40
  UNASSIGN: never[];
40
41
  DETECT_DUPLICATE: never[];
41
42
  };
42
- export declare const WRITE_ACTION_SCOPES: ("record.declare-birth" | "record.declaration-submit-for-approval" | "record.register" | "record.registration-print&issue-certified-copies")[];
43
43
  export declare function hasAnyOfScopes(a: Scope[], b: Scope[]): boolean;
44
+ export declare function filterUnallowedActions(actions: ActionType[], userScopes: Scope[]): ActionType[];
44
45
  //# sourceMappingURL=scopes.d.ts.map
@@ -1,4 +1,3 @@
1
- import { UUID } from '../uuid';
2
1
  import { ActionDocument, EventState } from './ActionDocument';
3
2
  import { ArchiveActionInput, AssignActionInput, DeclareActionInput, NotifyActionInput, RegisterActionInput, RejectDeclarationActionInput, RequestCorrectionActionInput, UnassignActionInput, ValidateActionInput } from './ActionInput';
4
3
  import { ActionType } from './ActionType';
@@ -11,13 +10,6 @@ import { TranslationConfig } from './TranslationConfig';
11
10
  import { FieldConfig } from './FieldConfig';
12
11
  import { WorkqueueConfig } from './WorkqueueConfig';
13
12
  import { FieldValue } from './FieldValue';
14
- import { z } from 'zod';
15
- /**
16
- * In real application, the roles are defined in the countryconfig.
17
- * These are just for testing purposes to generate realistic mock data.
18
- */
19
- export declare const TestUserRole: z.ZodEnum<["FIELD_AGENT", "LOCAL_REGISTRAR", "LOCAL_SYSTEM_ADMIN", "NATIONAL_REGISTRAR", "REGISTRATION_AGENT"]>;
20
- export type TestUserRole = z.infer<typeof TestUserRole>;
21
13
  export declare function generateRandomName(rng: () => number): {
22
14
  firstname: string;
23
15
  surname: string;
@@ -39,7 +31,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
39
31
  id: string;
40
32
  };
41
33
  draft: ({ eventId, actionType }: {
42
- eventId: UUID;
34
+ eventId: string;
43
35
  actionType: ActionType;
44
36
  }, input?: Partial<Draft>) => Draft;
45
37
  actions: {
@@ -273,7 +265,7 @@ export declare function eventPayloadGenerator(rng: () => number): {
273
265
  message: string;
274
266
  };
275
267
  };
276
- register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment" | "registrationNumber">>) => {
268
+ register: (eventId: string, input?: Partial<Pick<RegisterActionInput, "transactionId" | "declaration" | "annotation" | "keepAssignment">>) => {
277
269
  transactionId: string;
278
270
  declaration: Record<string, string | number | boolean | {
279
271
  type: string;
@@ -318,7 +310,6 @@ export declare function eventPayloadGenerator(rng: () => number): {
318
310
  originalFilename: string;
319
311
  }[] | [string, string] | null | undefined>;
320
312
  annotation: {};
321
- registrationNumber?: string | undefined;
322
313
  keepAssignment?: boolean | undefined;
323
314
  type: "REGISTER";
324
315
  eventId: string;
@@ -402,31 +393,19 @@ export declare function eventPayloadGenerator(rng: () => number): {
402
393
  };
403
394
  };
404
395
  };
405
- export declare function generateActionDocument({ configuration, action, rng, defaults, user }: {
396
+ export declare function generateActionDocument({ configuration, action, rng, defaults }: {
406
397
  configuration: EventConfig;
407
398
  action: ActionType;
408
399
  rng?: () => number;
409
400
  defaults?: Partial<ActionDocument>;
410
- user?: Partial<{
411
- signature: string;
412
- primaryOfficeId: UUID;
413
- role: TestUserRole;
414
- id: string;
415
- }>;
416
401
  }): ActionDocument;
417
- export declare function generateEventDocument({ configuration, actions, rng, user }: {
402
+ export declare function generateEventDocument({ configuration, actions, rng }: {
418
403
  configuration: EventConfig;
419
404
  actions: ActionType[];
420
405
  rng?: () => number;
421
- user?: Partial<{
422
- signature: string;
423
- primaryOfficeId: UUID;
424
- role: TestUserRole;
425
- id: string;
426
- }>;
427
406
  }): EventDocument;
428
407
  export declare function generateEventDraftDocument({ eventId, actionType, rng, declaration }: {
429
- eventId: UUID;
408
+ eventId: string;
430
409
  actionType: ActionType;
431
410
  rng?: () => number;
432
411
  declaration?: EventState;
@@ -440,8 +419,6 @@ export declare function getRandomDate(rng: () => number, start: string, end: str
440
419
  * @returns A function that generates pseudo-random numbers between 0 and 1 [0, 1)
441
420
  */
442
421
  export declare function createPrng(seed: number): () => number;
443
- export declare function generateUuid(rng?: () => number): UUID;
444
- export declare function generateRegistrationNumber(rng: () => number): string;
445
422
  export declare function generateRandomSignature(rng: () => number): string;
446
423
  export declare const eventQueryDataGenerator: (overrides?: Partial<EventIndex>, seed?: number) => EventIndex;
447
424
  export declare const generateTranslationConfig: (message: string) => TranslationConfig;
@@ -1,2 +1,2 @@
1
- export declare function generateTransactionId(): string & import("zod").BRAND<"UUID">;
1
+ export declare function generateTransactionId(): import("../uuid").UUID;
2
2
  //# sourceMappingURL=transactions.d.ts.map