@opencrvs/toolkit 1.9.14 → 2.0.0-rc.013c085
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/build.sh +13 -0
- package/create-countryconfig/index.js +103 -0
- package/create-countryconfig/package.json +21 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/application-config/index.d.ts +2 -0
- package/dist/application-config/index.d.ts.map +1 -0
- package/dist/application-config/index.js +2304 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +5238 -0
- package/dist/commons/api/router.d.ts +5630 -3673
- package/dist/commons/application-config/index.d.ts +97 -0
- package/dist/commons/conditionals/conditionals.d.ts +33 -3
- package/dist/commons/conditionals/validate.d.ts +20 -1
- package/dist/commons/events/ActionConfig.d.ts +415 -1555
- package/dist/commons/events/ActionDocument.d.ts +894 -1941
- package/dist/commons/events/ActionInput.d.ts +326 -1212
- package/dist/commons/events/ActionType.d.ts +91 -11
- package/dist/commons/events/AdvancedSearchConfig.d.ts +294 -1496
- package/dist/commons/events/AuditLog.d.ts +407 -0
- package/dist/commons/events/CompositeFieldValue.d.ts +30 -190
- package/dist/commons/events/Conditional.d.ts +26 -38
- package/dist/commons/events/Constants.d.ts +1 -1
- package/dist/commons/events/CountryConfigQueryInput.d.ts +1592 -4471
- package/dist/commons/events/DeduplicationConfig.d.ts +15 -171
- package/dist/commons/events/Draft.d.ts +72 -111
- package/dist/commons/events/DynamicFieldValue.d.ts +12 -78
- package/dist/commons/events/EventConfig.d.ts +37 -2427
- package/dist/commons/events/EventConfigInput.d.ts +0 -3
- package/dist/commons/events/EventDocument.d.ts +357 -1366
- package/dist/commons/events/EventIndex.d.ts +211 -1012
- package/dist/commons/events/EventInput.d.ts +3 -8
- package/dist/commons/events/EventMetadata.d.ts +129 -363
- package/dist/commons/events/FieldConfig.d.ts +3147 -14211
- package/dist/commons/events/FieldType.d.ts +26 -4
- package/dist/commons/events/FieldTypeMapping.d.ts +314 -906
- package/dist/commons/events/FieldValue.d.ts +154 -526
- package/dist/commons/events/FileUtils.d.ts +2 -2
- package/dist/commons/events/Flag.d.ts +67 -0
- package/dist/commons/events/FormConfig.d.ts +54 -721
- package/dist/commons/events/PageConfig.d.ts +58 -320
- package/dist/commons/events/PlainDate.d.ts +1 -1
- package/dist/commons/events/SummaryConfig.d.ts +14 -161
- package/dist/commons/events/TemplateConfig.d.ts +2 -3
- package/dist/commons/events/TranslationConfig.d.ts +2 -2
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +74 -37
- package/dist/commons/events/WorkqueueConfig.d.ts +2232 -7577
- package/dist/commons/events/deduplication.d.ts +3 -3
- package/dist/commons/events/defineConfig.d.ts +2 -248
- package/dist/commons/events/eventConfigValidation.d.ts +8 -0
- package/dist/commons/events/index.d.ts +5 -0
- package/dist/commons/events/locations.d.ts +93 -19
- package/dist/commons/events/mocks.test.utils.d.ts +19 -0
- package/dist/commons/events/scopes.d.ts +56 -32
- package/dist/commons/events/state/availableActions.d.ts +7 -2
- package/dist/commons/events/state/flags.d.ts +37 -3
- package/dist/commons/events/state/index.d.ts +29 -30
- package/dist/commons/events/state/utils.d.ts +191 -172
- package/dist/commons/events/test.utils.d.ts +52 -11
- package/dist/commons/events/transactions.d.ts +1 -1
- package/dist/commons/events/utils.d.ts +383 -273
- package/dist/commons/notification/UserNotifications.d.ts +76 -637
- package/dist/conditionals/index.d.ts.map +1 -1
- package/dist/conditionals/index.js +338 -14
- package/dist/events/deduplication.d.ts +3 -3
- package/dist/events/index.js +3680 -2227
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts +3 -0
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +429 -0
- package/dist/migrations/v2.0/add-resend-invite-notification.d.ts +3 -0
- package/dist/migrations/v2.0/add-resend-invite-notification.d.ts.map +1 -0
- package/dist/migrations/v2.0/add-resend-invite-notification.js +373 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +22 -0
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -0
- package/dist/migrations/v2.0/checkout-upstream-files.js +146 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts +2 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.d.ts.map +1 -0
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +828 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts +3 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.d.ts.map +1 -0
- package/dist/migrations/v2.0/convert-paragraph-to-heading.js +158 -0
- package/dist/migrations/v2.0/create-events-index.d.ts +3 -0
- package/dist/migrations/v2.0/create-events-index.d.ts.map +1 -0
- package/dist/migrations/v2.0/create-events-index.js +325 -0
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +11 -0
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -0
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +123 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts +3 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.d.ts.map +1 -0
- package/dist/migrations/v2.0/fix-accept-requested-registration-function-type.js +110 -0
- package/dist/migrations/v2.0/index.d.ts +13 -0
- package/dist/migrations/v2.0/index.d.ts.map +1 -0
- package/dist/migrations/v2.0/index.js +5148 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts +3 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -0
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +432 -0
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +13 -0
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -0
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +222 -0
- package/dist/migrations/v2.0/migrate-application-config-url.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-application-config-url.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-application-config-url.js +342 -0
- package/dist/migrations/v2.0/migrate-scopes.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-scopes.js +305 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-validated-workqueue-status-to-flag.js +267 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts +3 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -0
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +317 -0
- package/dist/migrations/v2.0/remove-delete-actions.d.ts +3 -0
- package/dist/migrations/v2.0/remove-delete-actions.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-delete-actions.js +156 -0
- package/dist/migrations/v2.0/remove-demo-scope.d.ts +3 -0
- package/dist/migrations/v2.0/remove-demo-scope.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-demo-scope.js +74 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts +3 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-deprecated-imports.js +96 -0
- package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts +3 -0
- package/dist/migrations/v2.0/remove-fhir-url-helpers.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-fhir-url-helpers.js +163 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts +3 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-hearth-migrations.js +77 -0
- package/dist/migrations/v2.0/remove-old-statistics-service.d.ts +3 -0
- package/dist/migrations/v2.0/remove-old-statistics-service.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-old-statistics-service.js +356 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts +3 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-pending-certification-flag.js +109 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts +3 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-review-from-register-action.js +163 -0
- package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts +3 -0
- package/dist/migrations/v2.0/remove-unused-environment-variables.d.ts.map +1 -0
- package/dist/migrations/v2.0/remove-unused-environment-variables.js +186 -0
- package/dist/migrations/v2.0/rename-api-paths.d.ts +3 -0
- package/dist/migrations/v2.0/rename-api-paths.d.ts.map +1 -0
- package/dist/migrations/v2.0/rename-api-paths.js +187 -0
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts +3 -0
- package/dist/migrations/v2.0/rename-location-parent-id.d.ts.map +1 -0
- package/dist/migrations/v2.0/rename-location-parent-id.js +180 -0
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts +3 -0
- package/dist/migrations/v2.0/simplify-analytics-precalculations.d.ts.map +1 -0
- package/dist/migrations/v2.0/simplify-analytics-precalculations.js +195 -0
- package/dist/migrations/v2.0/update-package-json.d.ts +3 -0
- package/dist/migrations/v2.0/update-package-json.d.ts.map +1 -0
- package/dist/migrations/v2.0/update-package-json.js +105 -0
- package/dist/notification/index.d.ts.map +1 -1
- package/dist/notification/index.js +2727 -1848
- package/dist/scopes/index.d.ts +716 -352
- package/dist/scopes/index.d.ts.map +1 -1
- package/dist/scopes/index.js +376 -299
- package/opencrvs-toolkit-2.0.0-rc.013c085.tgz +0 -0
- package/package.json +14 -4
- package/tsconfig.json +12 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/commons/events/CreatedAtLocation.d.ts +0 -2
|
@@ -7,17 +7,17 @@ export declare function field(fieldId: string): {
|
|
|
7
7
|
fieldId: string;
|
|
8
8
|
type: "fuzzy";
|
|
9
9
|
options: {
|
|
10
|
+
fuzziness?: string | number | undefined;
|
|
10
11
|
boost?: number | undefined;
|
|
11
12
|
matchAgainst?: string | undefined;
|
|
12
|
-
fuzziness?: string | number | undefined;
|
|
13
13
|
} | undefined;
|
|
14
14
|
};
|
|
15
15
|
strictMatches: (options?: StrictMatcherOptions) => {
|
|
16
16
|
fieldId: string;
|
|
17
17
|
type: "strict";
|
|
18
18
|
options: {
|
|
19
|
-
value?: string | undefined;
|
|
20
19
|
boost?: number | undefined;
|
|
20
|
+
value?: string | undefined;
|
|
21
21
|
matchAgainst?: string | undefined;
|
|
22
22
|
} | undefined;
|
|
23
23
|
};
|
|
@@ -60,9 +60,9 @@ export declare function field(fieldId: string): {
|
|
|
60
60
|
type: "dateRange";
|
|
61
61
|
options: {
|
|
62
62
|
days: number;
|
|
63
|
+
pivot?: number | undefined;
|
|
63
64
|
boost?: number | undefined;
|
|
64
65
|
matchAgainst?: string | undefined;
|
|
65
|
-
pivot?: number | undefined;
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
68
|
};
|
|
@@ -1,249 +1,3 @@
|
|
|
1
|
-
import { EventConfigInput } from './
|
|
2
|
-
|
|
3
|
-
* Builds a validated configuration for an event
|
|
4
|
-
* @param config - Event specific configuration
|
|
5
|
-
*/
|
|
6
|
-
export declare const defineConfig: (config: EventConfigInput) => {
|
|
7
|
-
id: string;
|
|
8
|
-
title: import("./TranslationConfig").TranslationConfig;
|
|
9
|
-
declaration: {
|
|
10
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
11
|
-
pages: {
|
|
12
|
-
type: "FORM";
|
|
13
|
-
id: string;
|
|
14
|
-
title: import("./TranslationConfig").TranslationConfig;
|
|
15
|
-
fields: import("./FieldConfig").FieldConfig[];
|
|
16
|
-
requireCompletionToContinue: boolean;
|
|
17
|
-
conditional?: import(".").JSONSchema | undefined;
|
|
18
|
-
}[];
|
|
19
|
-
};
|
|
20
|
-
actions: ({
|
|
21
|
-
type: "READ";
|
|
22
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
23
|
-
review: {
|
|
24
|
-
title: import("./TranslationConfig").TranslationConfig;
|
|
25
|
-
fields: import("./FieldConfig").FieldConfig[];
|
|
26
|
-
};
|
|
27
|
-
} | {
|
|
28
|
-
type: "DECLARE";
|
|
29
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
30
|
-
review: {
|
|
31
|
-
title: import("./TranslationConfig").TranslationConfig;
|
|
32
|
-
fields: import("./FieldConfig").FieldConfig[];
|
|
33
|
-
};
|
|
34
|
-
deduplication?: {
|
|
35
|
-
id: string;
|
|
36
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
37
|
-
query: import("./DeduplicationConfig").ClauseOutput;
|
|
38
|
-
} | undefined;
|
|
39
|
-
} | {
|
|
40
|
-
type: "VALIDATE";
|
|
41
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
42
|
-
review: {
|
|
43
|
-
title: import("./TranslationConfig").TranslationConfig;
|
|
44
|
-
fields: import("./FieldConfig").FieldConfig[];
|
|
45
|
-
};
|
|
46
|
-
deduplication?: {
|
|
47
|
-
id: string;
|
|
48
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
49
|
-
query: import("./DeduplicationConfig").ClauseOutput;
|
|
50
|
-
} | undefined;
|
|
51
|
-
} | {
|
|
52
|
-
type: "REJECT";
|
|
53
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
54
|
-
} | {
|
|
55
|
-
type: "ARCHIVE";
|
|
56
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
57
|
-
} | {
|
|
58
|
-
type: "REGISTER";
|
|
59
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
60
|
-
review: {
|
|
61
|
-
title: import("./TranslationConfig").TranslationConfig;
|
|
62
|
-
fields: import("./FieldConfig").FieldConfig[];
|
|
63
|
-
};
|
|
64
|
-
deduplication?: {
|
|
65
|
-
id: string;
|
|
66
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
67
|
-
query: import("./DeduplicationConfig").ClauseOutput;
|
|
68
|
-
} | undefined;
|
|
69
|
-
} | {
|
|
70
|
-
type: "DELETE";
|
|
71
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
72
|
-
} | {
|
|
73
|
-
type: "PRINT_CERTIFICATE";
|
|
74
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
75
|
-
printForm: {
|
|
76
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
77
|
-
pages: ({
|
|
78
|
-
type: "FORM";
|
|
79
|
-
id: string;
|
|
80
|
-
title: import("./TranslationConfig").TranslationConfig;
|
|
81
|
-
fields: import("./FieldConfig").FieldConfig[];
|
|
82
|
-
requireCompletionToContinue: boolean;
|
|
83
|
-
conditional?: import(".").JSONSchema | undefined;
|
|
84
|
-
} | {
|
|
85
|
-
type: "VERIFICATION";
|
|
86
|
-
id: string;
|
|
87
|
-
title: import("./TranslationConfig").TranslationConfig;
|
|
88
|
-
actions: {
|
|
89
|
-
cancel: {
|
|
90
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
91
|
-
confirmation: {
|
|
92
|
-
title: import("./TranslationConfig").TranslationConfig;
|
|
93
|
-
body: import("./TranslationConfig").TranslationConfig;
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
verify: {
|
|
97
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
fields: import("./FieldConfig").FieldConfig[];
|
|
101
|
-
requireCompletionToContinue: boolean;
|
|
102
|
-
conditional?: import(".").JSONSchema | undefined;
|
|
103
|
-
})[];
|
|
104
|
-
};
|
|
105
|
-
} | {
|
|
106
|
-
type: "REQUEST_CORRECTION";
|
|
107
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
108
|
-
correctionForm: {
|
|
109
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
110
|
-
pages: ({
|
|
111
|
-
type: "FORM";
|
|
112
|
-
id: string;
|
|
113
|
-
title: import("./TranslationConfig").TranslationConfig;
|
|
114
|
-
fields: import("./FieldConfig").FieldConfig[];
|
|
115
|
-
requireCompletionToContinue: boolean;
|
|
116
|
-
conditional?: import(".").JSONSchema | undefined;
|
|
117
|
-
} | {
|
|
118
|
-
type: "VERIFICATION";
|
|
119
|
-
id: string;
|
|
120
|
-
title: import("./TranslationConfig").TranslationConfig;
|
|
121
|
-
actions: {
|
|
122
|
-
cancel: {
|
|
123
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
124
|
-
confirmation: {
|
|
125
|
-
title: import("./TranslationConfig").TranslationConfig;
|
|
126
|
-
body: import("./TranslationConfig").TranslationConfig;
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
verify: {
|
|
130
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
fields: import("./FieldConfig").FieldConfig[];
|
|
134
|
-
requireCompletionToContinue: boolean;
|
|
135
|
-
conditional?: import(".").JSONSchema | undefined;
|
|
136
|
-
})[];
|
|
137
|
-
};
|
|
138
|
-
} | {
|
|
139
|
-
type: "REJECT_CORRECTION";
|
|
140
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
141
|
-
} | {
|
|
142
|
-
type: "APPROVE_CORRECTION";
|
|
143
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
144
|
-
})[];
|
|
145
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
146
|
-
summary: {
|
|
147
|
-
fields: ({
|
|
148
|
-
fieldId: string;
|
|
149
|
-
label?: import("./TranslationConfig").TranslationConfig | undefined;
|
|
150
|
-
conditionals?: {
|
|
151
|
-
type: "SHOW";
|
|
152
|
-
conditional: import(".").JSONSchema;
|
|
153
|
-
}[] | undefined;
|
|
154
|
-
emptyValueMessage?: import("./TranslationConfig").TranslationConfig | undefined;
|
|
155
|
-
} | {
|
|
156
|
-
id: string;
|
|
157
|
-
value: import("./TranslationConfig").TranslationConfig;
|
|
158
|
-
label: import("./TranslationConfig").TranslationConfig;
|
|
159
|
-
conditionals?: {
|
|
160
|
-
type: "SHOW";
|
|
161
|
-
conditional: import(".").JSONSchema;
|
|
162
|
-
}[] | undefined;
|
|
163
|
-
emptyValueMessage?: import("./TranslationConfig").TranslationConfig | undefined;
|
|
164
|
-
})[];
|
|
165
|
-
};
|
|
166
|
-
advancedSearch: {
|
|
167
|
-
title: import("./TranslationConfig").TranslationConfig;
|
|
168
|
-
fields: ({
|
|
169
|
-
config: {
|
|
170
|
-
type: "exact" | "range" | "fuzzy" | "within";
|
|
171
|
-
searchFields?: string[] | undefined;
|
|
172
|
-
};
|
|
173
|
-
fieldId: string;
|
|
174
|
-
fieldType: "field";
|
|
175
|
-
type?: "NAME" | "PHONE" | "ID" | "ADDRESS" | "TEXT" | "NUMBER" | "NUMBER_WITH_UNIT" | "TEXTAREA" | "EMAIL" | "DATE" | "AGE" | "DATE_RANGE" | "SELECT_DATE_RANGE" | "TIME" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FIELD_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA" | "BUTTON" | "SEARCH" | "ALPHA_PRINT_BUTTON" | "HTTP" | "LINK_BUTTON" | "VERIFICATION_STATUS" | "QUERY_PARAM_READER" | "QR_READER" | "ID_READER" | "LOADER" | undefined;
|
|
176
|
-
options?: {
|
|
177
|
-
value: string;
|
|
178
|
-
label: string | import("./TranslationConfig").TranslationConfig;
|
|
179
|
-
conditionals?: ({
|
|
180
|
-
type: "SHOW";
|
|
181
|
-
conditional: import(".").JSONSchema;
|
|
182
|
-
} | {
|
|
183
|
-
type: "ENABLE";
|
|
184
|
-
conditional: import(".").JSONSchema;
|
|
185
|
-
})[] | undefined;
|
|
186
|
-
}[] | undefined;
|
|
187
|
-
label?: import("./TranslationConfig").TranslationConfig | undefined;
|
|
188
|
-
conditionals?: ({
|
|
189
|
-
type: "SHOW";
|
|
190
|
-
conditional: import(".").JSONSchema;
|
|
191
|
-
} | {
|
|
192
|
-
type: "ENABLE";
|
|
193
|
-
conditional: import(".").JSONSchema;
|
|
194
|
-
} | {
|
|
195
|
-
type: "DISPLAY_ON_REVIEW";
|
|
196
|
-
conditional: import(".").JSONSchema;
|
|
197
|
-
})[] | undefined;
|
|
198
|
-
searchCriteriaLabelPrefix?: import("./TranslationConfig").TranslationConfig | undefined;
|
|
199
|
-
validations?: {
|
|
200
|
-
message: import("./TranslationConfig").TranslationConfig;
|
|
201
|
-
validator: import(".").JSONSchema;
|
|
202
|
-
}[] | undefined;
|
|
203
|
-
} | {
|
|
204
|
-
config: {
|
|
205
|
-
type: "exact" | "range" | "fuzzy" | "within";
|
|
206
|
-
searchFields?: string[] | undefined;
|
|
207
|
-
};
|
|
208
|
-
fieldId: "event.trackingId" | "event.status" | "event.legalStatuses.REGISTERED.acceptedAt" | "event.legalStatuses.REGISTERED.createdAtLocation" | "event.legalStatuses.REGISTERED.registrationNumber" | "event.updatedAt";
|
|
209
|
-
fieldType: "event";
|
|
210
|
-
type?: "NAME" | "PHONE" | "ID" | "ADDRESS" | "TEXT" | "NUMBER" | "NUMBER_WITH_UNIT" | "TEXTAREA" | "EMAIL" | "DATE" | "AGE" | "DATE_RANGE" | "SELECT_DATE_RANGE" | "TIME" | "PARAGRAPH" | "PAGE_HEADER" | "RADIO_GROUP" | "FIELD_GROUP" | "FILE" | "FILE_WITH_OPTIONS" | "BULLET_LIST" | "CHECKBOX" | "SELECT" | "COUNTRY" | "LOCATION" | "DIVIDER" | "ADMINISTRATIVE_AREA" | "FACILITY" | "OFFICE" | "SIGNATURE" | "DATA" | "BUTTON" | "SEARCH" | "ALPHA_PRINT_BUTTON" | "HTTP" | "LINK_BUTTON" | "VERIFICATION_STATUS" | "QUERY_PARAM_READER" | "QR_READER" | "ID_READER" | "LOADER" | undefined;
|
|
211
|
-
options?: {
|
|
212
|
-
value: string;
|
|
213
|
-
label: string | import("./TranslationConfig").TranslationConfig;
|
|
214
|
-
conditionals?: ({
|
|
215
|
-
type: "SHOW";
|
|
216
|
-
conditional: import(".").JSONSchema;
|
|
217
|
-
} | {
|
|
218
|
-
type: "ENABLE";
|
|
219
|
-
conditional: import(".").JSONSchema;
|
|
220
|
-
})[] | undefined;
|
|
221
|
-
}[] | undefined;
|
|
222
|
-
label?: import("./TranslationConfig").TranslationConfig | undefined;
|
|
223
|
-
conditionals?: ({
|
|
224
|
-
type: "SHOW";
|
|
225
|
-
conditional: import(".").JSONSchema;
|
|
226
|
-
} | {
|
|
227
|
-
type: "ENABLE";
|
|
228
|
-
conditional: import(".").JSONSchema;
|
|
229
|
-
} | {
|
|
230
|
-
type: "DISPLAY_ON_REVIEW";
|
|
231
|
-
conditional: import(".").JSONSchema;
|
|
232
|
-
})[] | undefined;
|
|
233
|
-
searchCriteriaLabelPrefix?: import("./TranslationConfig").TranslationConfig | undefined;
|
|
234
|
-
validations?: {
|
|
235
|
-
message: import("./TranslationConfig").TranslationConfig;
|
|
236
|
-
validator: import(".").JSONSchema;
|
|
237
|
-
}[] | undefined;
|
|
238
|
-
})[];
|
|
239
|
-
}[];
|
|
240
|
-
dateOfEvent?: {
|
|
241
|
-
$$field: string;
|
|
242
|
-
$$subfield: string[];
|
|
243
|
-
$$code?: string | undefined;
|
|
244
|
-
} | {
|
|
245
|
-
$$event: "createdAt" | "updatedAt" | "legalStatuses.REGISTERED.acceptedAt" | "legalStatuses.DECLARED.createdAt" | "legalStatuses.DECLARED.acceptedAt" | "legalStatuses.REGISTERED.createdAt";
|
|
246
|
-
} | undefined;
|
|
247
|
-
fallbackTitle?: import("./TranslationConfig").TranslationConfig | undefined;
|
|
248
|
-
};
|
|
1
|
+
import { EventConfig, EventConfigInput } from './EventConfig';
|
|
2
|
+
export declare const defineConfig: (config: EventConfigInput) => EventConfig;
|
|
249
3
|
//# sourceMappingURL=defineConfig.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import { EventConfig } from './EventConfig';
|
|
3
|
+
export declare function validateAdvancedSearchConfig(event: EventConfig, ctx: z.RefinementCtx<EventConfig>): void;
|
|
4
|
+
export declare function validateDateOfEvent(event: EventConfig, ctx: z.RefinementCtx<EventConfig>): void;
|
|
5
|
+
export declare function validatePlaceOfEvent(event: EventConfig, ctx: z.RefinementCtx<EventConfig>): void;
|
|
6
|
+
export declare function validateActionFlags(event: EventConfig, ctx: z.RefinementCtx<EventConfig>): void;
|
|
7
|
+
export declare function validateActionOrder(event: EventConfig, ctx: z.RefinementCtx<EventConfig>): void;
|
|
8
|
+
//# sourceMappingURL=eventConfigValidation.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './AuditLog';
|
|
1
2
|
export * from './Constants';
|
|
2
3
|
export * from './ActionConfig';
|
|
3
4
|
export * from './offline';
|
|
@@ -21,6 +22,7 @@ export * from './FieldValue';
|
|
|
21
22
|
export * from './FormConfig';
|
|
22
23
|
export * from './CompositeFieldValue';
|
|
23
24
|
export * from './state';
|
|
25
|
+
export * from './state/flags';
|
|
24
26
|
export * from './utils';
|
|
25
27
|
export * from './defineConfig';
|
|
26
28
|
export * from './DeduplicationConfig';
|
|
@@ -36,10 +38,13 @@ export * from './scopes';
|
|
|
36
38
|
export * from './serializer';
|
|
37
39
|
export * from './state/availableActions';
|
|
38
40
|
export * from './FileUtils';
|
|
41
|
+
export * from './mocks.test.utils';
|
|
39
42
|
export * from '../conditionals/conditionals';
|
|
40
43
|
export * from '../conditionals/validate';
|
|
41
44
|
export * from './field';
|
|
45
|
+
export * from './Flag';
|
|
42
46
|
export * from './event';
|
|
43
47
|
export * from './locations';
|
|
44
48
|
export { UUID } from '../uuid';
|
|
49
|
+
export { DocumentPath } from '../documents';
|
|
45
50
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,24 +1,98 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { UUID } from '../uuid';
|
|
2
|
+
import * as z from 'zod/v4';
|
|
3
|
+
import { EventIndex } from './EventIndex';
|
|
4
|
+
import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
|
|
5
|
+
import { RecordScopeV2, UserScopeV2 } from '../scopes';
|
|
6
|
+
import { SystemContext, UserContext } from '../users/User';
|
|
7
|
+
/** @deprecated Moving on, location types are arbitrary and defined by the country config. */
|
|
8
|
+
export declare const LocationTypeV1: z.ZodEnum<{
|
|
9
|
+
ADMIN_STRUCTURE: "ADMIN_STRUCTURE";
|
|
10
|
+
HEALTH_FACILITY: "HEALTH_FACILITY";
|
|
11
|
+
CRVS_OFFICE: "CRVS_OFFICE";
|
|
12
|
+
}>;
|
|
13
|
+
export type LocationTypeV1 = z.infer<typeof LocationTypeV1>;
|
|
14
|
+
export declare const AdministrativeArea: z.ZodObject<{
|
|
15
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
16
|
+
name: z.ZodString;
|
|
17
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
18
|
+
parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
19
|
+
validUntil: z.ZodNullable<z.ZodISODateTime>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type AdministrativeArea = z.infer<typeof AdministrativeArea>;
|
|
4
22
|
export declare const Location: z.ZodObject<{
|
|
5
|
-
id: z.ZodBranded<z.
|
|
23
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
6
24
|
name: z.ZodString;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
25
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
|
+
administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
27
|
+
validUntil: z.ZodNullable<z.ZodISODateTime>;
|
|
28
|
+
locationType: z.ZodNullable<z.ZodString>;
|
|
29
|
+
}, z.core.$strip>;
|
|
30
|
+
export type Location = z.infer<typeof Location>;
|
|
31
|
+
type WrapArrayPreserveNullish<V> = V extends readonly any[] ? V : NonNullable<V>[] | Extract<V, null | undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* For type T, convert fields K to arrays. If field is string, convert to string[].
|
|
34
|
+
*/
|
|
35
|
+
type ToArrayFields<T, K extends PropertyKey> = T extends unknown ? T extends object ? {
|
|
36
|
+
[P in keyof T]: P extends K ? WrapArrayPreserveNullish<T[P]> : T[P];
|
|
37
|
+
} : T : never;
|
|
38
|
+
/**
|
|
39
|
+
* Event index type where all location fields are arrays representing full location hierarchy.
|
|
40
|
+
*/
|
|
41
|
+
export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventIndex, 'createdAtLocation' | 'updatedAtLocation' | 'placeOfEvent'>, 'legalStatuses'> & {
|
|
42
|
+
legalStatuses: {
|
|
43
|
+
DECLARED: ToArrayFields<ActionCreationMetadata, 'createdAtLocation'> | undefined;
|
|
44
|
+
REGISTERED: ToArrayFields<RegistrationCreationMetadata, 'createdAtLocation'> | undefined;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Given indexed event and resolved scope, determine if the scope allows access to the event.
|
|
49
|
+
*
|
|
50
|
+
* All of the options within the scope must be satisfied for access to be granted.
|
|
51
|
+
* Return false early to break out of checks as soon as possible - if any option is not satisfied, the scope does not allow access to the event, so no need to check further options.
|
|
52
|
+
*
|
|
53
|
+
*/
|
|
54
|
+
export declare function canAccessEventWithScope(event: Partial<EventIndexWithAdministrativeHierarchy>, scope: RecordScopeV2, user: UserContext | SystemContext, customActionType?: string): boolean;
|
|
55
|
+
export type UserWithResolvedHierarchy = {
|
|
56
|
+
role: string;
|
|
57
|
+
administrativeHierarchy: UUID[];
|
|
58
|
+
primaryOfficeId: UUID;
|
|
59
|
+
};
|
|
60
|
+
export declare function canAccessUserWithScope({ userToAccess, scope, user }: {
|
|
61
|
+
userToAccess: UserWithResolvedHierarchy;
|
|
62
|
+
scope: UserScopeV2;
|
|
63
|
+
user: UserContext | SystemContext;
|
|
64
|
+
}): boolean;
|
|
65
|
+
export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, user }: {
|
|
66
|
+
scopes: UserScopeV2[];
|
|
67
|
+
userToAccess: UserWithResolvedHierarchy;
|
|
68
|
+
user: UserContext | SystemContext;
|
|
69
|
+
}): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Given indexed event and list of resolved scopes, determine if any of the scopes allow access to the event.
|
|
72
|
+
*
|
|
73
|
+
* One of the scopes must allow access for the event to be accessible.
|
|
74
|
+
*/
|
|
75
|
+
export declare function userCanAccessEventWithScopes(event: Partial<EventIndexWithAdministrativeHierarchy>, scopes: RecordScopeV2[], user: UserContext | SystemContext, customActionType?: string): boolean;
|
|
76
|
+
export declare function getAdministrativeAreaHierarchy(administrativeAreaId: string | undefined | null, administrativeAreas: Map<UUID, AdministrativeArea>): {
|
|
77
|
+
id: string & z.core.$brand<"UUID">;
|
|
18
78
|
name: string;
|
|
19
|
-
parentId: string | null;
|
|
79
|
+
parentId: (string & z.core.$brand<"UUID">) | null;
|
|
20
80
|
validUntil: string | null;
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
81
|
+
externalId?: string | null | undefined;
|
|
82
|
+
}[];
|
|
83
|
+
/**
|
|
84
|
+
* Resolves a location or administrative area UUID into a root-first hierarchy of UUIDs.
|
|
85
|
+
*
|
|
86
|
+
* If the ID refers to a `Location` (e.g. CRVS office), the hierarchy includes
|
|
87
|
+
* the administrative area ancestors followed by the location itself.
|
|
88
|
+
* If the ID refers to an `AdministrativeArea`, returns the area's ancestor chain (root-first).
|
|
89
|
+
*
|
|
90
|
+
* Uses `getAdministrativeAreaHierarchy` which returns leaf-first order,
|
|
91
|
+
* so the result is reversed to match the root-first convention used by the server.
|
|
92
|
+
*/
|
|
93
|
+
export declare function getLocationHierarchy(selectedId: UUID, context: {
|
|
94
|
+
administrativeAreas: Map<UUID, AdministrativeArea>;
|
|
95
|
+
locations: Map<UUID, Location>;
|
|
96
|
+
}): UUID[];
|
|
97
|
+
export {};
|
|
24
98
|
//# sourceMappingURL=locations.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AdministrativeArea, Location } from './locations';
|
|
2
|
+
export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: AdministrativeArea[];
|
|
3
|
+
export declare const V2_DEFAULT_MOCK_LOCATIONS: Location[];
|
|
4
|
+
export declare const V2_DEFAULT_MOCK_LOCATIONS_MAP: Map<string & import("zod").$brand<"UUID">, {
|
|
5
|
+
id: string & import("zod").$brand<"UUID">;
|
|
6
|
+
name: string;
|
|
7
|
+
administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
|
|
8
|
+
validUntil: string | null;
|
|
9
|
+
locationType: string | null;
|
|
10
|
+
externalId?: string | null | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: Map<string & import("zod").$brand<"UUID">, {
|
|
13
|
+
id: string & import("zod").$brand<"UUID">;
|
|
14
|
+
name: string;
|
|
15
|
+
parentId: (string & import("zod").$brand<"UUID">) | null;
|
|
16
|
+
validUntil: string | null;
|
|
17
|
+
externalId?: string | null | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=mocks.test.utils.d.ts.map
|
|
@@ -1,55 +1,79 @@
|
|
|
1
|
-
import { ConfigurableScopeType, Scope } from '../scopes';
|
|
2
1
|
import { DisplayableAction } from './ActionType';
|
|
2
|
+
import { EncodedScope, UserScopeV2 } from '../scopes';
|
|
3
|
+
import { EventIndexWithAdministrativeHierarchy } from './locations';
|
|
4
|
+
import { UserContext } from '../users/User';
|
|
3
5
|
import { EventIndex } from './EventIndex';
|
|
6
|
+
import { UUID } from 'src/uuid';
|
|
4
7
|
export declare const ACTION_SCOPE_MAP: {
|
|
5
8
|
READ: "record.read"[];
|
|
6
9
|
CREATE: "record.create"[];
|
|
7
10
|
NOTIFY: "record.notify"[];
|
|
8
|
-
DECLARE: ("record.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
DECLARE: ("record.declare" | "record.register")[];
|
|
12
|
+
EDIT: "record.edit"[];
|
|
13
|
+
DELETE: ("record.declare" | "record.notify")[];
|
|
11
14
|
REGISTER: "record.register"[];
|
|
12
|
-
PRINT_CERTIFICATE: "record.
|
|
13
|
-
REQUEST_CORRECTION: ("record.
|
|
14
|
-
REVIEW_CORRECTION_REQUEST: "record.
|
|
15
|
-
REJECT_CORRECTION: "record.
|
|
16
|
-
APPROVE_CORRECTION: "record.
|
|
17
|
-
MARK_AS_DUPLICATE: "record.
|
|
18
|
-
MARK_AS_NOT_DUPLICATE: "record.
|
|
19
|
-
ARCHIVE: "record.
|
|
20
|
-
REJECT: "record.
|
|
15
|
+
PRINT_CERTIFICATE: "record.print-certified-copies"[];
|
|
16
|
+
REQUEST_CORRECTION: ("record.request-correction" | "record.correct")[];
|
|
17
|
+
REVIEW_CORRECTION_REQUEST: "record.correct"[];
|
|
18
|
+
REJECT_CORRECTION: "record.correct"[];
|
|
19
|
+
APPROVE_CORRECTION: "record.correct"[];
|
|
20
|
+
MARK_AS_DUPLICATE: "record.review-duplicates"[];
|
|
21
|
+
MARK_AS_NOT_DUPLICATE: "record.review-duplicates"[];
|
|
22
|
+
ARCHIVE: "record.archive"[];
|
|
23
|
+
REJECT: "record.reject"[];
|
|
21
24
|
ASSIGN: null;
|
|
22
25
|
UNASSIGN: null;
|
|
23
26
|
DUPLICATE_DETECTED: never[];
|
|
27
|
+
CUSTOM: never[];
|
|
24
28
|
};
|
|
25
|
-
export declare function hasAnyOfScopes(a:
|
|
26
|
-
export declare
|
|
29
|
+
export declare function hasAnyOfScopes(a: string[], b: string[]): boolean;
|
|
30
|
+
export declare const AssignmentStatus: {
|
|
31
|
+
readonly ASSIGNED_TO_SELF: "ASSIGNED_TO_SELF";
|
|
32
|
+
readonly ASSIGNED_TO_OTHERS: "ASSIGNED_TO_OTHERS";
|
|
33
|
+
readonly UNASSIGNED: "UNASSIGNED";
|
|
34
|
+
};
|
|
35
|
+
export type AssignmentStatus = (typeof AssignmentStatus)[keyof typeof AssignmentStatus];
|
|
36
|
+
export declare function getAssignmentStatus(eventState: EventIndex | EventIndexWithAdministrativeHierarchy, userId: string): AssignmentStatus;
|
|
27
37
|
/**
|
|
28
|
-
* Checks if a given action is allowed for the provided scopes and
|
|
38
|
+
* Checks if a given action is allowed for the provided scopes, event, and user context.
|
|
29
39
|
*
|
|
30
40
|
* This function determines whether the user, with the given set of scopes, is authorized
|
|
31
|
-
* to perform the specified action on
|
|
32
|
-
* (hardcoded, non-configurable) and
|
|
41
|
+
* to perform the specified action on the given event. It checks both legacy V1 scopes
|
|
42
|
+
* (hardcoded, non-configurable) and V2 scopes, which validate event type, jurisdiction,
|
|
43
|
+
* and user context via {@link userCanAccessEventWithScopes}.
|
|
33
44
|
*
|
|
34
|
-
* @param {
|
|
45
|
+
* @param {EncodedScope[]} scopes - The raw encoded scope strings the user possesses (from JWT).
|
|
35
46
|
* @param {DisplayableAction} action - The action to check authorization for.
|
|
36
|
-
* @param {
|
|
47
|
+
* @param {EventIndexWithAdministrativeHierarchy} event - The event with resolved administrative hierarchy.
|
|
48
|
+
* @param {UserContext} currentUser - The current user's context used for V2 scope validation.
|
|
37
49
|
* @returns {boolean} True if the action is in scope for the user, otherwise false.
|
|
38
50
|
*/
|
|
39
|
-
export declare function isActionInScope(scopes
|
|
51
|
+
export declare function isActionInScope({ scopes, action, event, currentUser }: {
|
|
52
|
+
scopes: EncodedScope[];
|
|
53
|
+
action: DisplayableAction;
|
|
54
|
+
event: EventIndexWithAdministrativeHierarchy;
|
|
55
|
+
currentUser: UserContext;
|
|
56
|
+
}): boolean;
|
|
40
57
|
/**
|
|
41
|
-
* A shared utility to check if the user can read a record.
|
|
42
|
-
* This will be removed in 1.10 and implemented by scopes.
|
|
43
58
|
*
|
|
44
|
-
* In order for us to limit the usage of 'record.read' scope, we allow users to view records they have created on system-level.
|
|
45
59
|
*
|
|
46
|
-
* @
|
|
60
|
+
* @param allRoles - All possible roles in the system
|
|
61
|
+
* @param userLocation - The location and role information of the user whose role options are being determined
|
|
62
|
+
* @param acceptedScopes - The scopes of the user requesting the role update, used to determine which roles they can assign.
|
|
63
|
+
* @param userRequesting - The user context of the user requesting the role update, used to check location-based access to the target user's location.
|
|
64
|
+
*
|
|
65
|
+
* @returns An array of roles that the requesting user is allowed to assign to the target user based on their scopes and location
|
|
66
|
+
*
|
|
67
|
+
* 1) Used to determine which roles should be available in the dropdown when a user is editing another user's role in the user management interface.
|
|
68
|
+
* 2) Used to check if payload includes valid role.
|
|
47
69
|
*/
|
|
48
|
-
export declare function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
70
|
+
export declare function getAvailableRolesForUserUpdatePayload({ allRoles, userLocation, acceptedScopes, userRequesting }: {
|
|
71
|
+
allRoles: string[];
|
|
72
|
+
userRequesting: UserContext;
|
|
73
|
+
acceptedScopes: UserScopeV2[];
|
|
74
|
+
userLocation: {
|
|
75
|
+
administrativeHierarchy: UUID[];
|
|
76
|
+
primaryOfficeId: UUID;
|
|
77
|
+
};
|
|
78
|
+
}): string[];
|
|
55
79
|
//# sourceMappingURL=scopes.d.ts.map
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { DisplayableAction } from '../ActionType';
|
|
2
2
|
import { EventIndex } from '../EventIndex';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { Flag } from '../Flag';
|
|
4
|
+
/**
|
|
5
|
+
* Filters actions based on flags
|
|
6
|
+
* Some actions can be performed only if certain flags are
|
|
7
|
+
* present and others only if certain flags are absent
|
|
8
|
+
*/
|
|
9
|
+
export declare function filterActionsByFlags(actions: DisplayableAction[], flags: Flag[]): DisplayableAction[];
|
|
5
10
|
export declare function getAvailableActionsForEvent(event: EventIndex): DisplayableAction[];
|
|
6
11
|
//# sourceMappingURL=availableActions.d.ts.map
|
|
@@ -1,4 +1,38 @@
|
|
|
1
|
-
import { Action } from '../ActionDocument';
|
|
2
|
-
import { Flag } from '../
|
|
3
|
-
|
|
1
|
+
import { Action, RequestedCorrectionAction } from '../ActionDocument';
|
|
2
|
+
import { Flag, CustomFlag } from '../Flag';
|
|
3
|
+
import { EventConfig } from '../EventConfig';
|
|
4
|
+
import { EventDocument } from '../EventDocument';
|
|
5
|
+
export declare function findPendingCorrectionAction(writeActions: Action[]): RequestedCorrectionAction | undefined;
|
|
6
|
+
export declare function isPotentialDuplicate(actions: Action[]): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* This function resolves custom flags for an event based on its actions.
|
|
9
|
+
* Flags are not stored to the event state or any database directly, instead they are always computed/evaluated from the event actions.
|
|
10
|
+
*
|
|
11
|
+
* Processes accepted actions in chronological order, evaluating flag conditions
|
|
12
|
+
* at each action step. Flags can be added or removed based on action configurations
|
|
13
|
+
* and conditional logic. Duplicate flags are filtered out.
|
|
14
|
+
*
|
|
15
|
+
* @param event - The event document containing actions and metadata
|
|
16
|
+
* @param eventConfiguration - The configuration object for the event type defining action rules and flag behaviors
|
|
17
|
+
* @returns An array of unique custom flag IDs that apply to the event after processing all non-meta actions
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* const flags = resolveEventCustomFlags(eventDoc, config);
|
|
21
|
+
* // Returns: ['flag-1', 'flag-3']
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveEventCustomFlags(event: EventDocument, eventConfiguration: EventConfig): CustomFlag[];
|
|
24
|
+
/**
|
|
25
|
+
* Computes all flags (inherent, action status, and custom) that should be attached to the given event,
|
|
26
|
+
* based on its actions and event-specific configuration.
|
|
27
|
+
*
|
|
28
|
+
* Flags are determined by combining:
|
|
29
|
+
* - Action status flags (format 'ActionType:ActionStatus')
|
|
30
|
+
* - Inherent flags (e.g. incomplete, rejected, correction requested, potential duplicate, edit in progress)
|
|
31
|
+
* - Event type-specific custom flags defined in the event configuration
|
|
32
|
+
*
|
|
33
|
+
* @param event - The EventDocument containing the action history and payload
|
|
34
|
+
* @param config - The EventConfig providing rules for custom flag evaluation
|
|
35
|
+
* @returns An array of flags currently relevant/applicable to the event
|
|
36
|
+
*/
|
|
37
|
+
export declare function getEventFlags(event: EventDocument, config: EventConfig): Flag[];
|
|
4
38
|
//# sourceMappingURL=flags.d.ts.map
|