@opencrvs/toolkit 1.8.1-rc.b849abb → 1.8.1-rc.b8eea90
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 +19 -1
- package/dist/commons/events/ActionConfig.d.ts +13593 -4629
- package/dist/commons/events/ActionDocument.d.ts +536 -0
- package/dist/commons/events/ActionInput.d.ts +26 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +34 -34
- package/dist/commons/events/EventConfig.d.ts +7463 -3521
- package/dist/commons/events/EventDocument.d.ts +19 -0
- package/dist/commons/events/EventIndex.d.ts +122 -0
- package/dist/commons/events/FieldConfig.d.ts +1050 -362
- package/dist/commons/events/FieldType.d.ts +3 -1
- package/dist/commons/events/FieldTypeMapping.d.ts +15 -1
- package/dist/commons/events/FieldValue.d.ts +4 -0
- package/dist/commons/events/FormConfig.d.ts +6350 -2138
- package/dist/commons/events/PageConfig.d.ts +2058 -1014
- package/dist/commons/events/WorkqueueConfig.d.ts +97 -8
- package/dist/commons/events/defineConfig.d.ts +640 -10
- package/dist/commons/events/event.d.ts +8 -0
- package/dist/commons/events/field.d.ts +14 -0
- package/dist/commons/events/utils.d.ts +1138 -18
- package/dist/events/index.js +86 -7
- package/package.json +1 -1
package/dist/events/index.js
CHANGED
@@ -60,6 +60,7 @@ __export(events_exports, {
|
|
60
60
|
BIRTH_EVENT: () => BIRTH_EVENT,
|
61
61
|
BaseActionInput: () => BaseActionInput,
|
62
62
|
BearerTokenByUserType: () => BearerTokenByUserType,
|
63
|
+
ButtonFieldValue: () => ButtonFieldValue,
|
63
64
|
CONFIG_GET_ALLOWED_SCOPES: () => CONFIG_GET_ALLOWED_SCOPES,
|
64
65
|
CONFIG_SEARCH_ALLOWED_SCOPES: () => CONFIG_SEARCH_ALLOWED_SCOPES,
|
65
66
|
CertificateConfig: () => CertificateConfig,
|
@@ -125,6 +126,7 @@ __export(events_exports, {
|
|
125
126
|
GenericAddressUpdateValue: () => GenericAddressUpdateValue,
|
126
127
|
GenericAddressValue: () => GenericAddressValue,
|
127
128
|
GeographicalArea: () => GeographicalArea,
|
129
|
+
HttpFieldValue: () => HttpFieldValue,
|
128
130
|
ImageMimeType: () => ImageMimeType,
|
129
131
|
InherentFlags: () => InherentFlags,
|
130
132
|
LanguageConfig: () => LanguageConfig,
|
@@ -139,6 +141,7 @@ __export(events_exports, {
|
|
139
141
|
PageConfig: () => PageConfig,
|
140
142
|
PageTypes: () => PageTypes,
|
141
143
|
PrintCertificateActionInput: () => PrintCertificateActionInput,
|
144
|
+
PrintContent: () => PrintContent,
|
142
145
|
QueryExpression: () => QueryExpression,
|
143
146
|
QueryInput: () => QueryInput,
|
144
147
|
QueryType: () => QueryType,
|
@@ -269,6 +272,7 @@ __export(events_exports, {
|
|
269
272
|
isAddressFieldType: () => isAddressFieldType,
|
270
273
|
isAdministrativeAreaFieldType: () => isAdministrativeAreaFieldType,
|
271
274
|
isBulletListFieldType: () => isBulletListFieldType,
|
275
|
+
isButtonFieldType: () => isButtonFieldType,
|
272
276
|
isCheckboxFieldType: () => isCheckboxFieldType,
|
273
277
|
isConditionMet: () => isConditionMet,
|
274
278
|
isCountryFieldType: () => isCountryFieldType,
|
@@ -286,6 +290,7 @@ __export(events_exports, {
|
|
286
290
|
isFieldVisible: () => isFieldVisible,
|
287
291
|
isFileFieldType: () => isFileFieldType,
|
288
292
|
isFileFieldWithOptionType: () => isFileFieldWithOptionType,
|
293
|
+
isHttpFieldType: () => isHttpFieldType,
|
289
294
|
isIdFieldType: () => isIdFieldType,
|
290
295
|
isLocationFieldType: () => isLocationFieldType,
|
291
296
|
isMetaAction: () => isMetaAction,
|
@@ -537,7 +542,9 @@ var FieldType = {
|
|
537
542
|
FACILITY: "FACILITY",
|
538
543
|
OFFICE: "OFFICE",
|
539
544
|
SIGNATURE: "SIGNATURE",
|
540
|
-
DATA: "DATA"
|
545
|
+
DATA: "DATA",
|
546
|
+
BUTTON: "BUTTON",
|
547
|
+
HTTP: "HTTP"
|
541
548
|
};
|
542
549
|
var fieldTypes = Object.values(FieldType);
|
543
550
|
var compositeFieldTypes = [
|
@@ -606,8 +613,8 @@ var UrbanAddressUpdateValue = AdminStructure.extend({
|
|
606
613
|
zipCode: import_zod5.z.string().nullish()
|
607
614
|
});
|
608
615
|
var NameFieldValue = import_zod5.z.object({
|
609
|
-
firstname: import_zod5.z.string(),
|
610
|
-
surname: import_zod5.z.string(),
|
616
|
+
firstname: import_zod5.z.string().min(1),
|
617
|
+
surname: import_zod5.z.string().min(1),
|
611
618
|
middlename: import_zod5.z.string().optional()
|
612
619
|
});
|
613
620
|
var NameFieldUpdateValue = import_zod5.z.object({
|
@@ -677,6 +684,8 @@ var CheckboxFieldValue = import_zod6.z.boolean();
|
|
677
684
|
var NumberFieldValue = import_zod6.z.number();
|
678
685
|
var DataFieldValue = import_zod6.z.undefined();
|
679
686
|
var SignatureFieldValue = import_zod6.z.string();
|
687
|
+
var ButtonFieldValue = import_zod6.z.undefined();
|
688
|
+
var HttpFieldValue = import_zod6.z.undefined();
|
680
689
|
var FieldValue = import_zod6.z.union([
|
681
690
|
TextValue,
|
682
691
|
DateValue,
|
@@ -1004,6 +1013,28 @@ var DataField = BaseField.extend({
|
|
1004
1013
|
data: import_zod7.z.array(DataEntry)
|
1005
1014
|
})
|
1006
1015
|
}).describe("Data field for displaying read-only data");
|
1016
|
+
var ButtonField = BaseField.extend({
|
1017
|
+
type: import_zod7.z.literal(FieldType.BUTTON),
|
1018
|
+
configuration: import_zod7.z.object({
|
1019
|
+
onClick: FieldReference,
|
1020
|
+
icon: import_zod7.z.string().optional().describe(
|
1021
|
+
"Icon for the button. Use icon names from the OpenCRVS UI-Kit."
|
1022
|
+
),
|
1023
|
+
shouldHandleLoadingState: import_zod7.z.boolean().default(false).optional(),
|
1024
|
+
buttonLabel: TranslationConfig,
|
1025
|
+
loadingLabel: TranslationConfig.optional()
|
1026
|
+
})
|
1027
|
+
}).describe("Button for triggering HTTP requests");
|
1028
|
+
var HttpField = BaseField.extend({
|
1029
|
+
type: import_zod7.z.literal(FieldType.HTTP),
|
1030
|
+
configuration: import_zod7.z.object({
|
1031
|
+
method: import_zod7.z.enum(["GET", "POST", "PUT", "DELETE"]),
|
1032
|
+
headers: import_zod7.z.record(import_zod7.z.string()).optional(),
|
1033
|
+
body: import_zod7.z.record(import_zod7.z.string()).optional(),
|
1034
|
+
params: import_zod7.z.record(import_zod7.z.string()).optional(),
|
1035
|
+
url: import_zod7.z.string().describe("URL to send the HTTP request to")
|
1036
|
+
})
|
1037
|
+
}).describe("HTTP request function triggered by a button click");
|
1007
1038
|
var FieldConfig = import_zod7.z.discriminatedUnion("type", [
|
1008
1039
|
Address,
|
1009
1040
|
TextField,
|
@@ -1032,7 +1063,9 @@ var FieldConfig = import_zod7.z.discriminatedUnion("type", [
|
|
1032
1063
|
SignatureField,
|
1033
1064
|
EmailField,
|
1034
1065
|
FileUploadWithOptions,
|
1035
|
-
DataField
|
1066
|
+
DataField,
|
1067
|
+
ButtonField,
|
1068
|
+
HttpField
|
1036
1069
|
]).openapi({
|
1037
1070
|
description: "Form field configuration",
|
1038
1071
|
ref: "FieldConfig"
|
@@ -1340,7 +1373,7 @@ var SummaryConfig = import_zod14.z.object({
|
|
1340
1373
|
|
1341
1374
|
// ../commons/src/events/AdvancedSearchConfig.ts
|
1342
1375
|
var import_zod15 = require("zod");
|
1343
|
-
var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range"]);
|
1376
|
+
var MatchType = import_zod15.z.enum(["fuzzy", "exact", "range", "within"]);
|
1344
1377
|
var BaseField3 = import_zod15.z.object({
|
1345
1378
|
config: import_zod15.z.object({
|
1346
1379
|
type: MatchType.describe("Determines the type of field")
|
@@ -1902,11 +1935,15 @@ var ActionBase = import_zod19.z.object({
|
|
1902
1935
|
originalActionId: UUID.optional().nullable().describe(
|
1903
1936
|
"Reference to the original action that was asynchronously rejected or accepted by 3rd party integration."
|
1904
1937
|
)
|
1938
|
+
// 'content' field reserved for additional data
|
1939
|
+
// Each action can define its own content specifc to the action
|
1940
|
+
// See PrintCertificateAction
|
1905
1941
|
});
|
1906
1942
|
var AssignedAction = ActionBase.merge(
|
1907
1943
|
import_zod19.z.object({
|
1908
1944
|
type: import_zod19.z.literal(ActionType.ASSIGN),
|
1909
1945
|
assignedTo: import_zod19.z.string()
|
1946
|
+
// TODO move into 'content' property
|
1910
1947
|
})
|
1911
1948
|
);
|
1912
1949
|
var UnassignedAction = ActionBase.merge(
|
@@ -1918,6 +1955,7 @@ var RegisterAction = ActionBase.merge(
|
|
1918
1955
|
import_zod19.z.object({
|
1919
1956
|
type: import_zod19.z.literal(ActionType.REGISTER),
|
1920
1957
|
registrationNumber: import_zod19.z.string().optional()
|
1958
|
+
// TODO move into 'content' property
|
1921
1959
|
})
|
1922
1960
|
);
|
1923
1961
|
var DeclareAction = ActionBase.merge(
|
@@ -1938,6 +1976,7 @@ var RejectAction = ActionBase.merge(
|
|
1938
1976
|
import_zod19.z.object({
|
1939
1977
|
type: import_zod19.z.literal(ActionType.REJECT),
|
1940
1978
|
reason: RejectionReason
|
1979
|
+
// TODO move into 'content' property
|
1941
1980
|
})
|
1942
1981
|
);
|
1943
1982
|
var MarkAsDuplicateAction = ActionBase.merge(
|
@@ -1949,6 +1988,7 @@ var ArchiveAction = ActionBase.merge(
|
|
1949
1988
|
import_zod19.z.object({
|
1950
1989
|
type: import_zod19.z.literal(ActionType.ARCHIVE),
|
1951
1990
|
reason: RejectionReason
|
1991
|
+
// TODO move into 'content' property
|
1952
1992
|
})
|
1953
1993
|
);
|
1954
1994
|
var CreatedAction = ActionBase.merge(
|
@@ -1961,9 +2001,13 @@ var NotifiedAction = ActionBase.merge(
|
|
1961
2001
|
type: import_zod19.z.literal(ActionType.NOTIFY)
|
1962
2002
|
})
|
1963
2003
|
);
|
2004
|
+
var PrintContent = import_zod19.z.object({
|
2005
|
+
templateId: import_zod19.z.string().optional()
|
2006
|
+
});
|
1964
2007
|
var PrintCertificateAction = ActionBase.merge(
|
1965
2008
|
import_zod19.z.object({
|
1966
|
-
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE)
|
2009
|
+
type: import_zod19.z.literal(ActionType.PRINT_CERTIFICATE),
|
2010
|
+
content: PrintContent.optional().nullable()
|
1967
2011
|
})
|
1968
2012
|
);
|
1969
2013
|
var RequestedCorrectionAction = ActionBase.merge(
|
@@ -1975,12 +2019,14 @@ var ApprovedCorrectionAction = ActionBase.merge(
|
|
1975
2019
|
import_zod19.z.object({
|
1976
2020
|
type: import_zod19.z.literal(ActionType.APPROVE_CORRECTION),
|
1977
2021
|
requestId: import_zod19.z.string()
|
2022
|
+
// TODO move into 'content' property
|
1978
2023
|
})
|
1979
2024
|
);
|
1980
2025
|
var RejectedCorrectionAction = ActionBase.merge(
|
1981
2026
|
import_zod19.z.object({
|
1982
2027
|
type: import_zod19.z.literal(ActionType.REJECT_CORRECTION),
|
1983
2028
|
requestId: import_zod19.z.string(),
|
2029
|
+
// TODO move into 'content' property
|
1984
2030
|
reason: RejectionReason
|
1985
2031
|
})
|
1986
2032
|
);
|
@@ -2094,6 +2140,12 @@ function mapFieldTypeToZod(type, required) {
|
|
2094
2140
|
case FieldType.NAME:
|
2095
2141
|
schema = required ? NameFieldValue : NameFieldUpdateValue;
|
2096
2142
|
break;
|
2143
|
+
case FieldType.BUTTON:
|
2144
|
+
schema = ButtonFieldValue;
|
2145
|
+
break;
|
2146
|
+
case FieldType.HTTP:
|
2147
|
+
schema = ButtonFieldValue;
|
2148
|
+
break;
|
2097
2149
|
}
|
2098
2150
|
return required ? schema : schema.nullish();
|
2099
2151
|
}
|
@@ -2127,6 +2179,8 @@ function mapFieldTypeToEmptyValue(field2) {
|
|
2127
2179
|
case FieldType.DATE_RANGE:
|
2128
2180
|
case FieldType.SELECT_DATE_RANGE:
|
2129
2181
|
case FieldType.DATA:
|
2182
|
+
case FieldType.BUTTON:
|
2183
|
+
case FieldType.HTTP:
|
2130
2184
|
case FieldType.NAME:
|
2131
2185
|
case FieldType.PHONE:
|
2132
2186
|
case FieldType.ID:
|
@@ -2240,6 +2294,12 @@ var isOfficeFieldType = (field2) => {
|
|
2240
2294
|
var isDataFieldType = (field2) => {
|
2241
2295
|
return field2.config.type === FieldType.DATA;
|
2242
2296
|
};
|
2297
|
+
var isButtonFieldType = (field2) => {
|
2298
|
+
return field2.config.type === FieldType.BUTTON;
|
2299
|
+
};
|
2300
|
+
var isHttpFieldType = (field2) => {
|
2301
|
+
return field2.config.type === FieldType.HTTP;
|
2302
|
+
};
|
2243
2303
|
var isNonInteractiveFieldType = (field2) => {
|
2244
2304
|
return field2.type === FieldType.DIVIDER || field2.type === FieldType.PAGE_HEADER || field2.type === FieldType.PARAGRAPH || field2.type === FieldType.BULLET_LIST || field2.type === FieldType.DATA;
|
2245
2305
|
};
|
@@ -3175,6 +3235,19 @@ function createSearchConfig(baseField) {
|
|
3175
3235
|
fuzzy: () => ({
|
3176
3236
|
...baseField,
|
3177
3237
|
config: { type: "fuzzy" }
|
3238
|
+
}),
|
3239
|
+
/**
|
3240
|
+
* Creates a configuration for matching locations and the child locations
|
3241
|
+
* @returns An object containing the field ID and a configuration object with a type of 'within'.
|
3242
|
+
* @example field('createdAtLocation').within()
|
3243
|
+
* // {
|
3244
|
+
* // ...
|
3245
|
+
* // config: { type: 'within' }
|
3246
|
+
* // }
|
3247
|
+
*/
|
3248
|
+
within: () => ({
|
3249
|
+
...baseField,
|
3250
|
+
config: { type: "within" }
|
3178
3251
|
})
|
3179
3252
|
};
|
3180
3253
|
}
|
@@ -3524,6 +3597,9 @@ var QueryExpression = import_zod25.z.object({
|
|
3524
3597
|
createdAt: import_zod25.z.optional(DateCondition),
|
3525
3598
|
updatedAt: import_zod25.z.optional(DateCondition),
|
3526
3599
|
"legalStatuses.REGISTERED.acceptedAt": import_zod25.z.optional(DateCondition),
|
3600
|
+
"legalStatuses.DECLARED.createdAtLocation": import_zod25.z.optional(
|
3601
|
+
import_zod25.z.union([Within, Exact])
|
3602
|
+
),
|
3527
3603
|
"legalStatuses.REGISTERED.createdAtLocation": import_zod25.z.optional(
|
3528
3604
|
import_zod25.z.union([Within, Exact])
|
3529
3605
|
),
|
@@ -3877,7 +3953,8 @@ var DeclareActionInput = BaseActionInput.merge(
|
|
3877
3953
|
);
|
3878
3954
|
var PrintCertificateActionInput = BaseActionInput.merge(
|
3879
3955
|
import_zod29.z.object({
|
3880
|
-
type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE)
|
3956
|
+
type: import_zod29.z.literal(ActionType.PRINT_CERTIFICATE).default(ActionType.PRINT_CERTIFICATE),
|
3957
|
+
content: PrintContent.optional()
|
3881
3958
|
})
|
3882
3959
|
);
|
3883
3960
|
var RejectDeclarationActionInput = BaseActionInput.merge(
|
@@ -6459,6 +6536,8 @@ function mapFieldTypeToMockValue(field2, i, rng) {
|
|
6459
6536
|
case FieldType.PHONE:
|
6460
6537
|
case FieldType.ID:
|
6461
6538
|
case FieldType.OFFICE:
|
6539
|
+
case FieldType.HTTP:
|
6540
|
+
case FieldType.BUTTON:
|
6462
6541
|
return `${field2.id}-${field2.type}-${i}`;
|
6463
6542
|
case FieldType.NAME:
|
6464
6543
|
return generateRandomName(rng);
|