@opencrvs/toolkit 2.0.0-rc.57eca4e → 2.0.0-rc.57fff6f
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/application-config/index.js +65 -36
- package/dist/cli.js +17 -6
- package/dist/commons/api/router.d.ts +100 -17
- package/dist/commons/application-config/index.d.ts +1 -0
- package/dist/commons/conditionals/conditionals.d.ts +351 -7
- package/dist/commons/conditionals/validate.d.ts +51 -2
- package/dist/commons/events/ActionConfig.d.ts +28 -2
- package/dist/commons/events/ActionDocument.d.ts +6 -0
- package/dist/commons/events/ActionInput.d.ts +6 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +354 -0
- package/dist/commons/events/EventConfig.d.ts +2 -0
- package/dist/commons/events/EventDocument.d.ts +3 -0
- package/dist/commons/events/EventIndex.d.ts +11 -0
- package/dist/commons/events/EventMetadata.d.ts +26 -0
- package/dist/commons/events/FieldConfig.d.ts +388 -50
- package/dist/commons/events/FieldType.d.ts +1 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
- package/dist/commons/events/FieldValue.d.ts +6 -0
- package/dist/commons/events/field.d.ts +53 -1
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locations.d.ts +1 -0
- package/dist/commons/events/state/flags.d.ts +1 -0
- package/dist/commons/events/state/index.d.ts +8 -0
- package/dist/commons/events/state/utils.d.ts +21 -287
- package/dist/commons/events/utils.d.ts +12 -1
- package/dist/conditionals/index.js +55 -3
- package/dist/events/index.js +417 -149
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +1 -1
- package/dist/migrations/v2.0/index.js +17 -6
- package/dist/notification/index.js +260 -41
- package/dist/scopes/index.d.ts +92 -6
- package/dist/scopes/index.js +16 -5
- package/opencrvs-toolkit-2.0.0-rc.57fff6f.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.57eca4e.tgz +0 -0
|
@@ -192,6 +192,8 @@ var scopeOptionsPlaceEvent = z6.object({
|
|
|
192
192
|
placeOfEvent: JurisdictionFilter.optional()
|
|
193
193
|
}).describe("Options applicable to all record scopes.");
|
|
194
194
|
var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
|
|
195
|
+
notifiedIn: JurisdictionFilter.optional(),
|
|
196
|
+
notifiedBy: UserFilter.optional(),
|
|
195
197
|
declaredIn: JurisdictionFilter.optional(),
|
|
196
198
|
declaredBy: UserFilter.optional()
|
|
197
199
|
}).describe("Options applicable to actions that may take place after DECLARE");
|
|
@@ -233,6 +235,8 @@ var ResolvedScopeOptionsPlaceEvent = z6.object({
|
|
|
233
235
|
"Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
|
|
234
236
|
);
|
|
235
237
|
var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
|
|
238
|
+
notifiedIn: UUID.nullish(),
|
|
239
|
+
notifiedBy: z6.string().optional(),
|
|
236
240
|
declaredIn: UUID.nullish(),
|
|
237
241
|
declaredBy: z6.string().optional()
|
|
238
242
|
}).describe(
|
|
@@ -367,8 +371,9 @@ var EncodedScope2 = z6.string().brand("EncodedScope");
|
|
|
367
371
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
368
372
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
369
373
|
accessLevel: JurisdictionFilter.enum.all,
|
|
370
|
-
|
|
371
|
-
declaredIn: JurisdictionFilter.enum.all
|
|
374
|
+
notifiedIn: JurisdictionFilter.enum.all,
|
|
375
|
+
declaredIn: JurisdictionFilter.enum.all,
|
|
376
|
+
registeredIn: JurisdictionFilter.enum.all
|
|
372
377
|
};
|
|
373
378
|
|
|
374
379
|
// ../commons/src/users/userReferences.ts
|
|
@@ -1005,7 +1010,54 @@ function createFieldConditionals(fieldId) {
|
|
|
1005
1010
|
}
|
|
1006
1011
|
},
|
|
1007
1012
|
required: [fieldId]
|
|
1008
|
-
})
|
|
1013
|
+
}),
|
|
1014
|
+
/**
|
|
1015
|
+
* Custom client-side validator. The provided function is serialised and executed
|
|
1016
|
+
* just-in-time on the client only. External references (e.g. lodash) are not
|
|
1017
|
+
* available inside the function body — all logic must be self-contained.
|
|
1018
|
+
*
|
|
1019
|
+
* @example
|
|
1020
|
+
* field('nid').customClientValidator((value) => {
|
|
1021
|
+
* // LUHN check — all logic must be inline
|
|
1022
|
+
* const digits = String(value).split('').map(Number)
|
|
1023
|
+
* // ...
|
|
1024
|
+
* return isValid
|
|
1025
|
+
* })
|
|
1026
|
+
*/
|
|
1027
|
+
customClientValidator(validationFn) {
|
|
1028
|
+
const code = validationFn.toString();
|
|
1029
|
+
return defineFormConditional({
|
|
1030
|
+
type: "object",
|
|
1031
|
+
properties: wrapToPath(
|
|
1032
|
+
{ [fieldId]: { customClientValidator: { code } } },
|
|
1033
|
+
this.$$subfield
|
|
1034
|
+
),
|
|
1035
|
+
required: [fieldId]
|
|
1036
|
+
});
|
|
1037
|
+
},
|
|
1038
|
+
/**
|
|
1039
|
+
* Custom client-side evaluation. Returns a {@link FieldReference} descriptor
|
|
1040
|
+
* that can be used as the `value` property or a DATA component entry.
|
|
1041
|
+
* The function receives the referenced field's value as the first argument and
|
|
1042
|
+
* the full form context as the second; its return value replaces the field reference.
|
|
1043
|
+
* The function is serialised and executed just-in-time on the client only.
|
|
1044
|
+
* External references (e.g. lodash) are not available inside the function body.
|
|
1045
|
+
*
|
|
1046
|
+
* For computing a default value without referencing a specific field, use
|
|
1047
|
+
* `evaluate(fn)` in the `defaultValue` property instead.
|
|
1048
|
+
*
|
|
1049
|
+
* @example
|
|
1050
|
+
* field('a').customClientEvaluation((aValue, ctx) =>
|
|
1051
|
+
* Number(aValue) + Number(ctx.$form.b)
|
|
1052
|
+
* )
|
|
1053
|
+
*/
|
|
1054
|
+
customClientEvaluation(computationFn) {
|
|
1055
|
+
return {
|
|
1056
|
+
$$code: computationFn.toString(),
|
|
1057
|
+
$$field: fieldId,
|
|
1058
|
+
$$subfield: this.$$subfield
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1009
1061
|
};
|
|
1010
1062
|
}
|
|
1011
1063
|
|