@opencrvs/toolkit 2.0.0-rc.77e37b6 → 2.0.0-rc.7b00e3c
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 +18 -28
- package/dist/cli.js +300 -125
- package/dist/commons/api/router.d.ts +2981 -266
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/conditionals/validate.d.ts +1 -0
- package/dist/commons/events/ActionInput.d.ts +108 -0
- package/dist/commons/events/Draft.d.ts +3 -0
- package/dist/commons/events/EventIndex.d.ts +0 -3
- package/dist/commons/events/EventMetadata.d.ts +0 -7
- package/dist/commons/events/FieldConfig.d.ts +5 -0
- package/dist/commons/events/state/index.d.ts +0 -4
- package/dist/commons/events/state/utils.d.ts +0 -2
- package/dist/commons/events/utils.d.ts +1 -1
- package/dist/conditionals/index.js +5 -3
- package/dist/events/index.js +34 -58
- 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/index.d.ts +5 -3
- package/dist/migrations/v2.0/index.d.ts.map +1 -1
- package/dist/migrations/v2.0/index.js +300 -125
- 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 +21 -28
- package/dist/scopes/index.d.ts +6 -1
- package/dist/scopes/index.js +5 -3
- package/opencrvs-toolkit-2.0.0-rc.7b00e3c.tgz +0 -0
- package/package.json +1 -1
- package/opencrvs-toolkit-2.0.0-rc.77e37b6.tgz +0 -0
|
@@ -418,28 +418,20 @@ function schemaPriority(schema) {
|
|
|
418
418
|
return idx === -1 ? 9999 : idx;
|
|
419
419
|
}
|
|
420
420
|
function safeUnion(schemas) {
|
|
421
|
+
const sortedSchemas = [...schemas].sort(
|
|
422
|
+
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
423
|
+
);
|
|
421
424
|
return z7.any().superRefine((val, ctx) => {
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
if (successful.length === 0) {
|
|
427
|
-
ctx.addIssue({
|
|
428
|
-
code: "invalid_type",
|
|
429
|
-
expected: "custom",
|
|
430
|
-
message: "Value does not match any schema"
|
|
431
|
-
});
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
435
|
-
const best = successful[0];
|
|
436
|
-
if (!best.safeParse(val).success) {
|
|
437
|
-
ctx.addIssue({
|
|
438
|
-
expected: "custom",
|
|
439
|
-
code: "invalid_type",
|
|
440
|
-
message: "Value did not match the best schema"
|
|
441
|
-
});
|
|
425
|
+
for (const schema of sortedSchemas) {
|
|
426
|
+
if (schema.safeParse(val).success) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
442
429
|
}
|
|
430
|
+
ctx.addIssue({
|
|
431
|
+
code: "invalid_type",
|
|
432
|
+
expected: "custom",
|
|
433
|
+
message: "Value does not match any schema"
|
|
434
|
+
});
|
|
443
435
|
}).meta({
|
|
444
436
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
445
437
|
});
|
|
@@ -772,12 +764,14 @@ var SystemScopeType = z11.enum([
|
|
|
772
764
|
"organisation.read-locations",
|
|
773
765
|
"user.read",
|
|
774
766
|
"user.create",
|
|
775
|
-
"user.edit"
|
|
767
|
+
"user.edit",
|
|
768
|
+
"user.search"
|
|
776
769
|
]);
|
|
777
770
|
var UserScopeType = SystemScopeType.extract([
|
|
778
771
|
"user.read",
|
|
779
772
|
"user.create",
|
|
780
|
-
"user.edit"
|
|
773
|
+
"user.edit",
|
|
774
|
+
"user.search"
|
|
781
775
|
]);
|
|
782
776
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
783
777
|
var UserScopeV2 = z11.discriminatedUnion("type", [
|
|
@@ -786,7 +780,7 @@ var UserScopeV2 = z11.discriminatedUnion("type", [
|
|
|
786
780
|
options: AllUserScopeOptions.optional()
|
|
787
781
|
}),
|
|
788
782
|
z11.object({
|
|
789
|
-
type: UserScopeType.extract(["user.read"]),
|
|
783
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
790
784
|
options: AccessLevelOptions.optional()
|
|
791
785
|
})
|
|
792
786
|
]);
|
|
@@ -1111,8 +1105,7 @@ var ActionCreationMetadata = z15.object({
|
|
|
1111
1105
|
),
|
|
1112
1106
|
createdByUserType: z15.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1113
1107
|
acceptedAt: z15.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1114
|
-
createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1115
|
-
createdBySignature: z15.string().nullish().describe("Signature of the user who created the action request.")
|
|
1108
|
+
createdByRole: z15.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1116
1109
|
});
|
|
1117
1110
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1118
1111
|
registrationNumber: z15.string().describe(
|
|
@@ -1140,9 +1133,6 @@ var EventMetadata = z15.object({
|
|
|
1140
1133
|
createdAtLocation: UUID.nullish().describe(
|
|
1141
1134
|
"Location of the user who created the event."
|
|
1142
1135
|
),
|
|
1143
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1144
|
-
"Signature of the user who created the event."
|
|
1145
|
-
),
|
|
1146
1136
|
updatedAtLocation: UUID.nullish().describe(
|
|
1147
1137
|
"Location of the user who last changed the status."
|
|
1148
1138
|
),
|