@opencrvs/toolkit 2.0.0-rc.086745c → 2.0.0-rc.0896b42
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/create-countryconfig/index.js +103 -0
- package/create-countryconfig/package.json +21 -0
- package/dist/application-config/index.js +288 -123
- package/dist/cli.js +521 -174
- package/dist/commons/api/router.d.ts +3387 -237
- package/dist/commons/application-config/index.d.ts +1 -0
- package/dist/commons/conditionals/conditionals.d.ts +360 -10
- package/dist/commons/conditionals/validate.d.ts +52 -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 +114 -0
- package/dist/commons/events/AdvancedSearchConfig.d.ts +354 -0
- package/dist/commons/events/CountryConfigQueryInput.d.ts +42 -0
- package/dist/commons/events/Draft.d.ts +4 -2
- 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 +25 -3
- package/dist/commons/events/EventMetadata.d.ts +26 -7
- package/dist/commons/events/FieldConfig.d.ts +393 -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/WorkqueueConfig.d.ts +189 -150
- package/dist/commons/events/field.d.ts +53 -1
- package/dist/commons/events/index.d.ts +2 -0
- package/dist/commons/events/locations.d.ts +22 -0
- package/dist/commons/events/mocks.test.utils.d.ts +19 -0
- package/dist/commons/events/scopes.d.ts +24 -1
- package/dist/commons/events/state/flags.d.ts +16 -0
- package/dist/commons/events/state/index.d.ts +8 -4
- package/dist/commons/events/state/utils.d.ts +21 -289
- package/dist/commons/events/utils.d.ts +13 -2
- package/dist/conditionals/index.js +65 -5
- package/dist/events/index.js +1170 -288
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.d.ts.map +1 -1
- package/dist/migrations/v2.0/add-birth-certificate-issuance-flag.js +60 -35
- 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 -2
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts +9 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.d.ts.map +1 -1
- package/dist/migrations/v2.0/delete-infrastructure-directory.js +66 -20
- 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 +5 -3
- package/dist/migrations/v2.0/index.d.ts.map +1 -1
- package/dist/migrations/v2.0/index.js +519 -172
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.d.ts.map +1 -1
- package/dist/migrations/v2.0/make-built-in-validate-actions-custom.js +90 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts +11 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.d.ts.map +1 -1
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +17 -16
- package/dist/migrations/v2.0/migrate-scopes.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-scopes.js +54 -30
- package/dist/migrations/v2.0/migrate-workqueue-configs.d.ts.map +1 -1
- package/dist/migrations/v2.0/migrate-workqueue-configs.js +140 -59
- package/dist/notification/index.js +916 -159
- package/dist/scopes/index.d.ts +98 -7
- package/dist/scopes/index.js +22 -7
- package/opencrvs-toolkit-2.0.0-rc.0896b42.tgz +0 -0
- package/package.json +6 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.086745c.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(
|
|
@@ -298,12 +303,14 @@ var SystemScopeType = z6.enum([
|
|
|
298
303
|
"organisation.read-locations",
|
|
299
304
|
"user.read",
|
|
300
305
|
"user.create",
|
|
301
|
-
"user.edit"
|
|
306
|
+
"user.edit",
|
|
307
|
+
"user.search"
|
|
302
308
|
]);
|
|
303
309
|
var UserScopeType = SystemScopeType.extract([
|
|
304
310
|
"user.read",
|
|
305
311
|
"user.create",
|
|
306
|
-
"user.edit"
|
|
312
|
+
"user.edit",
|
|
313
|
+
"user.search"
|
|
307
314
|
]);
|
|
308
315
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
309
316
|
var UserScopeV2 = z6.discriminatedUnion("type", [
|
|
@@ -312,7 +319,7 @@ var UserScopeV2 = z6.discriminatedUnion("type", [
|
|
|
312
319
|
options: AllUserScopeOptions.optional()
|
|
313
320
|
}),
|
|
314
321
|
z6.object({
|
|
315
|
-
type: UserScopeType.extract(["user.read"]),
|
|
322
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
316
323
|
options: AccessLevelOptions.optional()
|
|
317
324
|
})
|
|
318
325
|
]);
|
|
@@ -363,7 +370,10 @@ var ScopeType2 = z6.enum([
|
|
|
363
370
|
var EncodedScope2 = z6.string().brand("EncodedScope");
|
|
364
371
|
var DEFAULT_SCOPE_OPTIONS = {
|
|
365
372
|
placeOfEvent: JurisdictionFilter.enum.all,
|
|
366
|
-
accessLevel: JurisdictionFilter.enum.all
|
|
373
|
+
accessLevel: JurisdictionFilter.enum.all,
|
|
374
|
+
notifiedIn: JurisdictionFilter.enum.all,
|
|
375
|
+
declaredIn: JurisdictionFilter.enum.all,
|
|
376
|
+
registeredIn: JurisdictionFilter.enum.all
|
|
367
377
|
};
|
|
368
378
|
|
|
369
379
|
// ../commons/src/users/userReferences.ts
|
|
@@ -450,6 +460,9 @@ function not(condition) {
|
|
|
450
460
|
function never() {
|
|
451
461
|
return not(alwaysTrue());
|
|
452
462
|
}
|
|
463
|
+
function always() {
|
|
464
|
+
return defineConditional(alwaysTrue());
|
|
465
|
+
}
|
|
453
466
|
function jsonFieldPath(field) {
|
|
454
467
|
return [field.$$field, ...field.$$subfield].join("/");
|
|
455
468
|
}
|
|
@@ -997,7 +1010,54 @@ function createFieldConditionals(fieldId) {
|
|
|
997
1010
|
}
|
|
998
1011
|
},
|
|
999
1012
|
required: [fieldId]
|
|
1000
|
-
})
|
|
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
|
+
}
|
|
1001
1061
|
};
|
|
1002
1062
|
}
|
|
1003
1063
|
|