@opencrvs/toolkit 1.8.0-rc.ffe8c17 → 1.8.1-rc.0c972dc

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 (49) hide show
  1. package/README.md +1 -1
  2. package/dist/commons/api/router.d.ts +8949 -10987
  3. package/dist/commons/conditionals/conditionals.d.ts +31 -12
  4. package/dist/commons/conditionals/validate.d.ts +33 -18
  5. package/dist/commons/events/ActionConfig.d.ts +120316 -3282
  6. package/dist/commons/events/ActionDocument.d.ts +14099 -797
  7. package/dist/commons/events/ActionInput.d.ts +8194 -1095
  8. package/dist/commons/events/ActionType.d.ts +35 -11
  9. package/dist/commons/events/AdvancedSearchConfig.d.ts +1300 -22
  10. package/dist/commons/events/CompositeFieldValue.d.ts +192 -11
  11. package/dist/commons/events/Conditional.d.ts +21 -5
  12. package/dist/commons/events/Constants.d.ts +3 -0
  13. package/dist/commons/events/CountryConfigQueryInput.d.ts +4132 -0
  14. package/dist/commons/events/CreatedAtLocation.d.ts +2 -0
  15. package/dist/commons/events/Draft.d.ts +608 -114
  16. package/dist/commons/events/EventConfig.d.ts +54502 -3192
  17. package/dist/commons/events/EventConfigInput.d.ts +6 -3
  18. package/dist/commons/events/EventDocument.d.ts +5847 -999
  19. package/dist/commons/events/EventIndex.d.ts +2350 -26
  20. package/dist/commons/events/EventMetadata.d.ts +347 -44
  21. package/dist/commons/events/FieldConfig.d.ts +7197 -1211
  22. package/dist/commons/events/FieldType.d.ts +8 -3
  23. package/dist/commons/events/FieldTypeMapping.d.ts +253 -268
  24. package/dist/commons/events/FieldValue.d.ts +159 -93
  25. package/dist/commons/events/FormConfig.d.ts +56618 -336
  26. package/dist/commons/events/PageConfig.d.ts +14169 -0
  27. package/dist/commons/events/SummaryConfig.d.ts +93 -42
  28. package/dist/commons/events/TemplateConfig.d.ts +5 -5
  29. package/dist/commons/events/User.d.ts +34 -2
  30. package/dist/commons/events/WorkqueueColumnConfig.d.ts +53 -0
  31. package/dist/commons/events/WorkqueueConfig.d.ts +8240 -20
  32. package/dist/commons/events/defineConfig.d.ts +8634 -460
  33. package/dist/commons/events/event.d.ts +108 -0
  34. package/dist/commons/events/field.d.ts +108 -0
  35. package/dist/commons/events/index.d.ts +10 -1
  36. package/dist/commons/events/scopes.d.ts +45 -0
  37. package/dist/commons/events/serializer.d.ts +2 -0
  38. package/dist/commons/events/test.utils.d.ts +284 -237
  39. package/dist/commons/events/transactions.d.ts +1 -1
  40. package/dist/commons/events/utils.d.ts +15662 -168
  41. package/dist/commons/events/workqueueDefaultColumns.d.ts +3 -0
  42. package/dist/conditionals/index.js +211 -115
  43. package/dist/events/index.js +5405 -1871
  44. package/dist/scopes/index.d.ts +247 -1
  45. package/dist/scopes/index.js +231 -1
  46. package/package.json +4 -3
  47. package/tsconfig.json +1 -1
  48. package/dist/commons/conditionals/conditionals.test.d.ts +0 -2
  49. package/dist/commons/conditionals/validate.test.d.ts +0 -2
@@ -0,0 +1,108 @@
1
+ import { ActionType } from './ActionType';
2
+ import { EventFieldIdInput } from './AdvancedSearchConfig';
3
+ import { WorkqueueColumnKeys, WorkqueueColumnValue } from './WorkqueueColumnConfig';
4
+ /**
5
+ * Creates a function that acts like a callable + static method container.
6
+ *
7
+ * @example
8
+ * event('status') // → returns search config
9
+ * event.hasAction('CLICKED') // → returns conditional
10
+ */
11
+ declare function eventFn(fieldId: EventFieldIdInput): {
12
+ range: () => {
13
+ fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
14
+ fieldType: "event";
15
+ } & {
16
+ config: {
17
+ type: "range";
18
+ };
19
+ };
20
+ exact: () => {
21
+ fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
22
+ fieldType: "event";
23
+ } & {
24
+ config: {
25
+ type: "exact";
26
+ };
27
+ };
28
+ fuzzy: () => {
29
+ fieldId: "event.status" | "event.updatedAt" | "event.trackingId" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation";
30
+ fieldType: "event";
31
+ } & {
32
+ config: {
33
+ type: "fuzzy";
34
+ };
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
+ };
44
+ };
45
+ declare const event: typeof eventFn & {
46
+ /**
47
+ * Checks if the event contains a specific action type.
48
+ * Can be used directly as a conditional or chained with additional methods.
49
+ * @param action - The action type to check for.
50
+ */
51
+ hasAction: (action: ActionType) => {
52
+ /**
53
+ * Creates a conditional that checks if the event contains a specific action type
54
+ * with a minimum count of occurrences.
55
+ *
56
+ * @param minCount - The minimum number of actions required.
57
+ */
58
+ minCount: (minCount: number) => import("../conditionals/conditionals").JSONSchema;
59
+ /**
60
+ * Builds a conditional that sets a maximum count for the number of actions.
61
+ * This is useful for limiting the number of actions of a specific type in a single event.
62
+ */
63
+ maxCount: (maxCount: number) => import("../conditionals/conditionals").JSONSchema;
64
+ /**
65
+ * Adds additional field constraints to the action matching.
66
+ *
67
+ * @param fields - Object containing additional fields to match on the action.
68
+ */
69
+ withFields: (fields: Record<string, unknown>) => {
70
+ /**
71
+ * Creates a conditional that checks if the event contains a specific action type
72
+ * with a minimum count of occurrences.
73
+ *
74
+ * @param minCount - The minimum number of actions required.
75
+ */
76
+ minCount: (minCount: number) => import("../conditionals/conditionals").JSONSchema;
77
+ /**
78
+ * Builds a conditional that sets a maximum count for the number of actions.
79
+ * This is useful for limiting the number of actions of a specific type in a single event.
80
+ */
81
+ maxCount: (maxCount: number) => import("../conditionals/conditionals").JSONSchema;
82
+ };
83
+ /**
84
+ * Adds template ID constraint to the action matching.
85
+ * This is a convenience method that adds content.templateId to the fields.
86
+ *
87
+ * @param id - The template ID to match against.
88
+ */
89
+ withTemplate: (id: string) => {
90
+ /**
91
+ * Creates a conditional that checks if the event contains a specific action type
92
+ * with a minimum count of occurrences.
93
+ *
94
+ * @param minCount - The minimum number of actions required.
95
+ */
96
+ minCount: (minCount: number) => import("../conditionals/conditionals").JSONSchema;
97
+ /**
98
+ * Builds a conditional that sets a maximum count for the number of actions.
99
+ * This is useful for limiting the number of actions of a specific type in a single event.
100
+ */
101
+ maxCount: (maxCount: number) => import("../conditionals/conditionals").JSONSchema;
102
+ };
103
+ __nominal__type: "JSONSchema";
104
+ };
105
+ field(field: WorkqueueColumnKeys): WorkqueueColumnValue;
106
+ };
107
+ export { event };
108
+ //# sourceMappingURL=event.d.ts.map
@@ -0,0 +1,108 @@
1
+ import { FieldConditional } from './Conditional';
2
+ import { TranslationConfig } from './TranslationConfig';
3
+ import { SelectOption, ValidationConfig } from './FieldConfig';
4
+ /**
5
+ * Entry point for defining conditional logic or configuration for a form field.
6
+ * @param fieldId - The ID of the field to define rules or config for.
7
+ * @returns An object combining conditional methods and configuration builders.
8
+ */
9
+ export declare function field(fieldId: string, options?: {
10
+ options?: SelectOption[];
11
+ excludeInSearchQuery?: boolean;
12
+ alternateFieldIds?: string[];
13
+ conditionals?: FieldConditional[];
14
+ validations?: ValidationConfig[];
15
+ searchCriteriaLabelPrefix?: TranslationConfig;
16
+ }): {
17
+ range: () => {
18
+ options?: SelectOption[];
19
+ excludeInSearchQuery?: boolean;
20
+ alternateFieldIds?: string[];
21
+ conditionals?: FieldConditional[];
22
+ validations?: ValidationConfig[];
23
+ searchCriteriaLabelPrefix?: TranslationConfig;
24
+ fieldId: string;
25
+ fieldType: "field";
26
+ } & {
27
+ config: {
28
+ type: "range";
29
+ };
30
+ };
31
+ exact: () => {
32
+ options?: SelectOption[];
33
+ excludeInSearchQuery?: boolean;
34
+ alternateFieldIds?: string[];
35
+ conditionals?: FieldConditional[];
36
+ validations?: ValidationConfig[];
37
+ searchCriteriaLabelPrefix?: TranslationConfig;
38
+ fieldId: string;
39
+ fieldType: "field";
40
+ } & {
41
+ config: {
42
+ type: "exact";
43
+ };
44
+ };
45
+ fuzzy: () => {
46
+ options?: SelectOption[];
47
+ excludeInSearchQuery?: boolean;
48
+ alternateFieldIds?: string[];
49
+ conditionals?: FieldConditional[];
50
+ validations?: ValidationConfig[];
51
+ searchCriteriaLabelPrefix?: TranslationConfig;
52
+ fieldId: string;
53
+ fieldType: "field";
54
+ } & {
55
+ config: {
56
+ type: "fuzzy";
57
+ };
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
+ };
73
+ $$field: string;
74
+ isAfter: () => {
75
+ days: (days: number) => {
76
+ inPast: () => import("../conditionals/conditionals").JSONSchema;
77
+ inFuture: () => import("../conditionals/conditionals").JSONSchema;
78
+ };
79
+ date: (date: string | {
80
+ $$field: string;
81
+ }) => import("../conditionals/conditionals").JSONSchema;
82
+ now: () => import("../conditionals/conditionals").JSONSchema;
83
+ };
84
+ isBefore: () => {
85
+ days: (days: number) => {
86
+ inPast: () => import("../conditionals/conditionals").JSONSchema;
87
+ inFuture: () => import("../conditionals/conditionals").JSONSchema;
88
+ };
89
+ date: (date: string | {
90
+ $$field: string;
91
+ }) => import("../conditionals/conditionals").JSONSchema;
92
+ now: () => import("../conditionals/conditionals").JSONSchema;
93
+ };
94
+ isEqualTo: (value: string | boolean | {
95
+ $$field: string;
96
+ }) => import("../conditionals/conditionals").JSONSchema;
97
+ isFalsy: () => import("../conditionals/conditionals").JSONSchema;
98
+ isUndefined: () => import("../conditionals/conditionals").JSONSchema;
99
+ inArray: (values: string[]) => import("../conditionals/conditionals").JSONSchema;
100
+ isValidEnglishName: () => import("../conditionals/conditionals").JSONSchema;
101
+ matches: (pattern: string) => import("../conditionals/conditionals").JSONSchema;
102
+ isBetween: (min: number, max: number) => import("../conditionals/conditionals").JSONSchema;
103
+ getId: () => {
104
+ fieldId: string;
105
+ };
106
+ object: (options: Record<string, any>) => import("../conditionals/conditionals").JSONSchema;
107
+ };
108
+ //# sourceMappingURL=field.d.ts.map
@@ -1,11 +1,14 @@
1
+ export * from './Constants';
1
2
  export * from './ActionConfig';
2
3
  export * from './offline';
3
4
  export * from './EventConfig';
4
5
  export * from './EventConfigInput';
5
6
  export * from './FieldConfig';
6
- export * from './FormConfig';
7
+ export * from './PageConfig';
7
8
  export * from './SummaryConfig';
8
9
  export * from './WorkqueueConfig';
10
+ export * from './WorkqueueColumnConfig';
11
+ export * from './workqueueDefaultColumns';
9
12
  export * from './Draft';
10
13
  export * from './EventMetadata';
11
14
  export * from './EventInput';
@@ -15,6 +18,7 @@ export * from './ActionDocument';
15
18
  export * from './EventIndex';
16
19
  export * from './TranslationConfig';
17
20
  export * from './FieldValue';
21
+ export * from './FormConfig';
18
22
  export * from './CompositeFieldValue';
19
23
  export * from './state';
20
24
  export * from './utils';
@@ -29,6 +33,11 @@ export * from './Conditional';
29
33
  export * from './AdvancedSearchConfig';
30
34
  export * from './test.utils';
31
35
  export * from './TemplateConfig';
36
+ export * from './scopes';
37
+ export * from './serializer';
38
+ export * from './state/availableActions';
32
39
  export * from '../conditionals/conditionals';
33
40
  export * from '../conditionals/validate';
41
+ export * from './field';
42
+ export * from './event';
34
43
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,45 @@
1
+ import { Scope } from '../scopes';
2
+ 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
+ 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
+ export declare const ACTION_ALLOWED_SCOPES: {
5
+ READ: ["record.declare-birth", "record.read", "record.declaration-submit-incomplete", "record.declaration-submit-for-review", "record.register", "record.export-records"];
6
+ CREATE: ["record.declare-birth", "record.declaration-submit-incomplete", "record.declaration-submit-for-review"];
7
+ NOTIFY: ["record.declaration-submit-incomplete"];
8
+ DECLARE: ["record.declare-birth", "record.declaration-submit-for-approval", "record.register"];
9
+ DELETE: ["record.declare-birth"];
10
+ VALIDATE: ["record.declaration-submit-for-approval", "record.register"];
11
+ REGISTER: ["record.register"];
12
+ PRINT_CERTIFICATE: ["record.registration-print&issue-certified-copies"];
13
+ REQUEST_CORRECTION: ["record.registration-request-correction", "record.registration-correct"];
14
+ REVIEW_CORRECTION_REQUEST: ["record.registration-correct"];
15
+ REJECT_CORRECTION: ["record.registration-correct"];
16
+ APPROVE_CORRECTION: ["record.registration-correct"];
17
+ MARKED_AS_DUPLICATE: ["record.declaration-archive"];
18
+ ARCHIVE: ["record.declaration-archive"];
19
+ REJECT: ["record.declaration-submit-for-updates"];
20
+ ASSIGN: null;
21
+ UNASSIGN: null;
22
+ DETECT_DUPLICATE: [];
23
+ };
24
+ export declare const ACTION_ALLOWED_CONFIGURABLE_SCOPES: {
25
+ READ: never[];
26
+ CREATE: "record.notify"[];
27
+ NOTIFY: "record.notify"[];
28
+ DECLARE: never[];
29
+ DELETE: never[];
30
+ VALIDATE: never[];
31
+ REGISTER: never[];
32
+ PRINT_CERTIFICATE: never[];
33
+ REQUEST_CORRECTION: never[];
34
+ REJECT_CORRECTION: never[];
35
+ APPROVE_CORRECTION: never[];
36
+ MARKED_AS_DUPLICATE: never[];
37
+ ARCHIVE: never[];
38
+ REJECT: never[];
39
+ ASSIGN: never[];
40
+ UNASSIGN: never[];
41
+ DETECT_DUPLICATE: never[];
42
+ };
43
+ export declare const WRITE_ACTION_SCOPES: ("record.declare-birth" | "record.declaration-submit-for-approval" | "record.register" | "record.registration-print&issue-certified-copies")[];
44
+ export declare function hasAnyOfScopes(a: Scope[], b: Scope[]): boolean;
45
+ //# sourceMappingURL=scopes.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { deserializeQuery } from './serializers/user/deserializer';
2
+ //# sourceMappingURL=serializer.d.ts.map