@opencrvs/toolkit 2.0.0-rc.92bed7b → 2.0.0-rc.931b878

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 (37) hide show
  1. package/dist/application-config/index.js +65 -36
  2. package/dist/cli.js +17 -6
  3. package/dist/commons/api/router.d.ts +100 -17
  4. package/dist/commons/application-config/index.d.ts +1 -0
  5. package/dist/commons/conditionals/conditionals.d.ts +357 -7
  6. package/dist/commons/conditionals/validate.d.ts +51 -2
  7. package/dist/commons/events/ActionConfig.d.ts +28 -2
  8. package/dist/commons/events/ActionDocument.d.ts +6 -0
  9. package/dist/commons/events/ActionInput.d.ts +6 -0
  10. package/dist/commons/events/AdvancedSearchConfig.d.ts +354 -0
  11. package/dist/commons/events/EventConfig.d.ts +2 -0
  12. package/dist/commons/events/EventDocument.d.ts +3 -0
  13. package/dist/commons/events/EventIndex.d.ts +11 -0
  14. package/dist/commons/events/EventMetadata.d.ts +26 -0
  15. package/dist/commons/events/FieldConfig.d.ts +388 -50
  16. package/dist/commons/events/FieldType.d.ts +1 -0
  17. package/dist/commons/events/FieldTypeMapping.d.ts +1 -1
  18. package/dist/commons/events/FieldValue.d.ts +6 -0
  19. package/dist/commons/events/field.d.ts +53 -1
  20. package/dist/commons/events/index.d.ts +1 -0
  21. package/dist/commons/events/locations.d.ts +1 -0
  22. package/dist/commons/events/state/flags.d.ts +16 -0
  23. package/dist/commons/events/state/index.d.ts +8 -0
  24. package/dist/commons/events/state/utils.d.ts +21 -287
  25. package/dist/commons/events/utils.d.ts +12 -1
  26. package/dist/conditionals/index.js +59 -3
  27. package/dist/events/index.js +445 -143
  28. package/dist/migrations/v2.0/checkout-upstream-files.d.ts +1 -1
  29. package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
  30. package/dist/migrations/v2.0/checkout-upstream-files.js +1 -1
  31. package/dist/migrations/v2.0/index.js +17 -6
  32. package/dist/notification/index.js +260 -41
  33. package/dist/scopes/index.d.ts +92 -6
  34. package/dist/scopes/index.js +16 -5
  35. package/opencrvs-toolkit-2.0.0-rc.931b878.tgz +0 -0
  36. package/package.json +1 -1
  37. package/opencrvs-toolkit-2.0.0-rc.92bed7b.tgz +0 -0
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/conditionals/index.ts
31
31
  var conditionals_exports = {};
32
32
  __export(conditionals_exports, {
33
+ always: () => always,
33
34
  alwaysTrue: () => alwaysTrue,
34
35
  and: () => and,
35
36
  createFieldConditionals: () => createFieldConditionals,
@@ -191,6 +192,8 @@ var scopeOptionsPlaceEvent = z6.object({
191
192
  placeOfEvent: JurisdictionFilter.optional()
192
193
  }).describe("Options applicable to all record scopes.");
193
194
  var scopeOptionsDeclared = scopeOptionsPlaceEvent.extend({
195
+ notifiedIn: JurisdictionFilter.optional(),
196
+ notifiedBy: UserFilter.optional(),
194
197
  declaredIn: JurisdictionFilter.optional(),
195
198
  declaredBy: UserFilter.optional()
196
199
  }).describe("Options applicable to actions that may take place after DECLARE");
@@ -232,6 +235,8 @@ var ResolvedScopeOptionsPlaceEvent = z6.object({
232
235
  "Resolved options applicable to all record scopes, with location ID instead of jurisdiction filter."
233
236
  );
234
237
  var ResolvedScopeOptionsDeclared = ResolvedScopeOptionsPlaceEvent.extend({
238
+ notifiedIn: UUID.nullish(),
239
+ notifiedBy: z6.string().optional(),
235
240
  declaredIn: UUID.nullish(),
236
241
  declaredBy: z6.string().optional()
237
242
  }).describe(
@@ -366,8 +371,9 @@ var EncodedScope2 = z6.string().brand("EncodedScope");
366
371
  var DEFAULT_SCOPE_OPTIONS = {
367
372
  placeOfEvent: JurisdictionFilter.enum.all,
368
373
  accessLevel: JurisdictionFilter.enum.all,
369
- registeredIn: JurisdictionFilter.enum.all,
370
- declaredIn: JurisdictionFilter.enum.all
374
+ notifiedIn: JurisdictionFilter.enum.all,
375
+ declaredIn: JurisdictionFilter.enum.all,
376
+ registeredIn: JurisdictionFilter.enum.all
371
377
  };
372
378
 
373
379
  // ../commons/src/users/userReferences.ts
@@ -454,6 +460,9 @@ function not(condition) {
454
460
  function never() {
455
461
  return not(alwaysTrue());
456
462
  }
463
+ function always() {
464
+ return defineConditional(alwaysTrue());
465
+ }
457
466
  function jsonFieldPath(field) {
458
467
  return [field.$$field, ...field.$$subfield].join("/");
459
468
  }
@@ -1001,7 +1010,54 @@ function createFieldConditionals(fieldId) {
1001
1010
  }
1002
1011
  },
1003
1012
  required: [fieldId]
1004
- })
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
+ }
1005
1061
  };
1006
1062
  }
1007
1063