@opencrvs/toolkit 2.0.0-rc.1d9a00b → 2.0.0-rc.1f6b78f
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 +73 -0
- package/create-countryconfig/package.json +11 -0
- package/dist/application-config/index.js +29 -30
- package/dist/cli.js +394 -130
- package/dist/commons/api/router.d.ts +3321 -267
- 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/WorkqueueConfig.d.ts +146 -146
- package/dist/commons/events/locations.d.ts +21 -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/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 +111 -78
- 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 +392 -128
- 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 +43 -48
- package/dist/scopes/index.d.ts +6 -1
- package/dist/scopes/index.js +5 -3
- package/opencrvs-toolkit-2.0.0-rc.1f6b78f.tgz +0 -0
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.0.0-rc.1d9a00b.tgz +0 -0
|
@@ -226,12 +226,14 @@ var SystemScopeType = z2.enum([
|
|
|
226
226
|
"organisation.read-locations",
|
|
227
227
|
"user.read",
|
|
228
228
|
"user.create",
|
|
229
|
-
"user.edit"
|
|
229
|
+
"user.edit",
|
|
230
|
+
"user.search"
|
|
230
231
|
]);
|
|
231
232
|
var UserScopeType = SystemScopeType.extract([
|
|
232
233
|
"user.read",
|
|
233
234
|
"user.create",
|
|
234
|
-
"user.edit"
|
|
235
|
+
"user.edit",
|
|
236
|
+
"user.search"
|
|
235
237
|
]);
|
|
236
238
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
237
239
|
var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
@@ -240,7 +242,7 @@ var UserScopeV2 = z2.discriminatedUnion("type", [
|
|
|
240
242
|
options: AllUserScopeOptions.optional()
|
|
241
243
|
}),
|
|
242
244
|
z2.object({
|
|
243
|
-
type: UserScopeType.extract(["user.read"]),
|
|
245
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
244
246
|
options: AccessLevelOptions.optional()
|
|
245
247
|
})
|
|
246
248
|
]);
|
|
@@ -650,7 +652,10 @@ var ActionConditional = z7.discriminatedUnion("type", [
|
|
|
650
652
|
ShowConditional,
|
|
651
653
|
// Action can be shown to the user in the list but as disabled
|
|
652
654
|
EnableConditional
|
|
653
|
-
])
|
|
655
|
+
]).meta({
|
|
656
|
+
description: "Action conditional configuration",
|
|
657
|
+
id: "ActionConditional"
|
|
658
|
+
});
|
|
654
659
|
var DisplayOnReviewConditional = z7.object({
|
|
655
660
|
type: z7.literal(ConditionalType.DISPLAY_ON_REVIEW),
|
|
656
661
|
conditional: Conditional
|
|
@@ -978,28 +983,20 @@ function schemaPriority(schema) {
|
|
|
978
983
|
return idx === -1 ? 9999 : idx;
|
|
979
984
|
}
|
|
980
985
|
function safeUnion(schemas) {
|
|
986
|
+
const sortedSchemas = [...schemas].sort(
|
|
987
|
+
(a, b) => schemaPriority(a) - schemaPriority(b)
|
|
988
|
+
);
|
|
981
989
|
return z12.any().superRefine((val, ctx) => {
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
if (successful.length === 0) {
|
|
987
|
-
ctx.addIssue({
|
|
988
|
-
code: "invalid_type",
|
|
989
|
-
expected: "custom",
|
|
990
|
-
message: "Value does not match any schema"
|
|
991
|
-
});
|
|
992
|
-
return;
|
|
993
|
-
}
|
|
994
|
-
successful.sort((a, b) => schemaPriority(a) - schemaPriority(b));
|
|
995
|
-
const best = successful[0];
|
|
996
|
-
if (!best.safeParse(val).success) {
|
|
997
|
-
ctx.addIssue({
|
|
998
|
-
expected: "custom",
|
|
999
|
-
code: "invalid_type",
|
|
1000
|
-
message: "Value did not match the best schema"
|
|
1001
|
-
});
|
|
990
|
+
for (const schema of sortedSchemas) {
|
|
991
|
+
if (schema.safeParse(val).success) {
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
1002
994
|
}
|
|
995
|
+
ctx.addIssue({
|
|
996
|
+
code: "invalid_type",
|
|
997
|
+
expected: "custom",
|
|
998
|
+
message: "Value does not match any schema"
|
|
999
|
+
});
|
|
1003
1000
|
}).meta({
|
|
1004
1001
|
description: "Value that matches exactly one of the possible schema types (TextValue, DateValue, DateRangeFieldValue). The best matching schema is chosen by priority."
|
|
1005
1002
|
});
|
|
@@ -1309,6 +1306,9 @@ var FlagConfig = z15.object({
|
|
|
1309
1306
|
"Indicates if this flag expects an action to be performed to be cleared."
|
|
1310
1307
|
),
|
|
1311
1308
|
label: TranslationConfig.describe("Human readable label of the flag.")
|
|
1309
|
+
}).meta({
|
|
1310
|
+
description: "Flag configuration",
|
|
1311
|
+
id: "FlagConfig"
|
|
1312
1312
|
});
|
|
1313
1313
|
var ActionFlagConfig = z15.object({
|
|
1314
1314
|
id: Flag,
|
|
@@ -1316,6 +1316,9 @@ var ActionFlagConfig = z15.object({
|
|
|
1316
1316
|
conditional: Conditional.optional().describe(
|
|
1317
1317
|
"When conditional is met, the operation is performed on the flag. If not provided, the operation is performed unconditionally."
|
|
1318
1318
|
)
|
|
1319
|
+
}).meta({
|
|
1320
|
+
description: "Action flag configuration",
|
|
1321
|
+
id: "ActionFlagConfig"
|
|
1319
1322
|
});
|
|
1320
1323
|
|
|
1321
1324
|
// ../commons/src/events/EventMetadata.ts
|
|
@@ -1337,8 +1340,7 @@ var ActionCreationMetadata = z16.object({
|
|
|
1337
1340
|
),
|
|
1338
1341
|
createdByUserType: z16.enum(["user", "system"]).nullish().describe("Whether the user is a normal user or a system."),
|
|
1339
1342
|
acceptedAt: z16.iso.datetime().describe("Timestamp when the action request was accepted."),
|
|
1340
|
-
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1341
|
-
createdBySignature: z16.string().nullish().describe("Signature of the user who created the action request.")
|
|
1343
|
+
createdByRole: z16.string().optional().describe("Role of the user at the time of action request creation.")
|
|
1342
1344
|
});
|
|
1343
1345
|
var RegistrationCreationMetadata = ActionCreationMetadata.extend({
|
|
1344
1346
|
registrationNumber: z16.string().describe(
|
|
@@ -1366,9 +1368,6 @@ var EventMetadata = z16.object({
|
|
|
1366
1368
|
createdAtLocation: UUID.nullish().describe(
|
|
1367
1369
|
"Location of the user who created the event."
|
|
1368
1370
|
),
|
|
1369
|
-
createdBySignature: DocumentPath.nullish().describe(
|
|
1370
|
-
"Signature of the user who created the event."
|
|
1371
|
-
),
|
|
1372
1371
|
updatedAtLocation: UUID.nullish().describe(
|
|
1373
1372
|
"Location of the user who last changed the status."
|
|
1374
1373
|
),
|
|
@@ -1661,7 +1660,7 @@ var FieldId = import_v43.default.string().superRefine((val, ctx) => {
|
|
|
1661
1660
|
}
|
|
1662
1661
|
}).describe("Unique identifier for the field");
|
|
1663
1662
|
var FieldReference = import_v43.default.object({
|
|
1664
|
-
$$field: FieldId,
|
|
1663
|
+
$$field: FieldId.describe("Id of the field to reference"),
|
|
1665
1664
|
$$subfield: import_v43.default.array(import_v43.default.string()).optional().default([]).describe(
|
|
1666
1665
|
'If the FieldValue is an object, subfield can be used to refer to e.g. `["foo", "bar"]` in `{ foo: { bar: 3 } }`'
|
|
1667
1666
|
)
|
|
@@ -2374,10 +2373,10 @@ var VerificationPageConfig = FormPageConfig.extend({
|
|
|
2374
2373
|
type: z21.literal(PageTypes.enum.VERIFICATION),
|
|
2375
2374
|
actions: VerificationActionConfig
|
|
2376
2375
|
});
|
|
2377
|
-
var PageConfig = z21.discriminatedUnion("type", [
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2376
|
+
var PageConfig = z21.discriminatedUnion("type", [FormPageConfig, VerificationPageConfig]).meta({
|
|
2377
|
+
description: "Page configuration",
|
|
2378
|
+
id: "PageConfig"
|
|
2379
|
+
});
|
|
2381
2380
|
|
|
2382
2381
|
// ../commons/src/events/FormConfig.ts
|
|
2383
2382
|
var DeclarationFormConfig = z22.object({
|
|
@@ -3677,7 +3676,7 @@ var _EventConfigBase = z33.object({
|
|
|
3677
3676
|
),
|
|
3678
3677
|
label: TranslationConfig.describe("Human-readable label for the event type."),
|
|
3679
3678
|
actions: z33.array(ActionConfig).describe(
|
|
3680
|
-
"Configuration of
|
|
3679
|
+
"Configuration of core and custom actions associated with the event."
|
|
3681
3680
|
),
|
|
3682
3681
|
actionOrder: z33.array(z33.string()).optional().describe(
|
|
3683
3682
|
"Order of actions in the action menu. Use either the action type for core actions or the customActionType for custom actions."
|
|
@@ -3689,7 +3688,7 @@ var _EventConfigBase = z33.object({
|
|
|
3689
3688
|
"Configuration of fields available in the advanced search feature."
|
|
3690
3689
|
),
|
|
3691
3690
|
flags: z33.array(FlagConfig).optional().default([]).describe(
|
|
3692
|
-
"Configuration of flags associated with the actions of this event type."
|
|
3691
|
+
"Configuration of custom flags associated with the actions of this event type."
|
|
3693
3692
|
),
|
|
3694
3693
|
analytics: z33.boolean().optional().default(true).describe(
|
|
3695
3694
|
"Indicates whether the records of this event type are included in analytics"
|
|
@@ -4127,18 +4126,11 @@ var WorkqueueConfigWithoutQuery = WorkqueueConfig.omit({
|
|
|
4127
4126
|
query: true,
|
|
4128
4127
|
columns: true
|
|
4129
4128
|
});
|
|
4130
|
-
var WorkqueueConfigInput =
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
query: CountryConfigQueryInputType,
|
|
4136
|
-
action: z37.object({ type: WorkqueueActionType }).optional().describe(
|
|
4137
|
-
"Workqueue call-to-action button configuration. This determines the quick action button shown on each event card and the action taken when the button is clicked."
|
|
4138
|
-
),
|
|
4139
|
-
columns: z37.array(WorkqueueColumn).default(mandatoryColumns),
|
|
4140
|
-
icon: AvailableIcons,
|
|
4141
|
-
emptyMessage: TranslationConfig.optional()
|
|
4129
|
+
var WorkqueueConfigInput = WorkqueueConfig.extend({
|
|
4130
|
+
query: CountryConfigQueryInputType
|
|
4131
|
+
}).meta({
|
|
4132
|
+
description: "Workqueue configuration",
|
|
4133
|
+
id: "WorkqueueConfig"
|
|
4142
4134
|
});
|
|
4143
4135
|
var WorkqueueCountInput = z37.array(
|
|
4144
4136
|
z37.object({ slug: z37.string(), query: QueryType })
|
|
@@ -4178,6 +4170,9 @@ var BaseActionInput = z38.object({
|
|
|
4178
4170
|
originalActionId: UUID.optional(),
|
|
4179
4171
|
// should not be part of base action.
|
|
4180
4172
|
keepAssignment: z38.boolean().optional(),
|
|
4173
|
+
keepAssignmentIfAccepted: z38.boolean().optional(),
|
|
4174
|
+
keepAssignmentIfRejected: z38.boolean().optional(),
|
|
4175
|
+
waitFor: z38.boolean().optional(),
|
|
4181
4176
|
// For normal users, the createdAtLocation is resolved on the backend from the user's primaryOfficeId.
|
|
4182
4177
|
// @TODO: createdAtLocation should be limited to actions that system users can perform. For normal users, it should not be part of the base action.
|
|
4183
4178
|
createdAtLocation: UUID.nullish().describe(
|
package/dist/scopes/index.d.ts
CHANGED
|
@@ -227,12 +227,14 @@ declare const SystemScopeType: z.ZodEnum<{
|
|
|
227
227
|
"user.read": "user.read";
|
|
228
228
|
"user.create": "user.create";
|
|
229
229
|
"user.edit": "user.edit";
|
|
230
|
+
"user.search": "user.search";
|
|
230
231
|
}>;
|
|
231
232
|
export type SystemScopeType = z.infer<typeof SystemScopeType>;
|
|
232
233
|
declare const UserScopeType: z.ZodEnum<{
|
|
233
234
|
"user.read": "user.read";
|
|
234
235
|
"user.create": "user.create";
|
|
235
236
|
"user.edit": "user.edit";
|
|
237
|
+
"user.search": "user.search";
|
|
236
238
|
}>;
|
|
237
239
|
export type UserScopeType = z.infer<typeof UserScopeType>;
|
|
238
240
|
declare const ScopesWithRoleOption: z.ZodEnum<{
|
|
@@ -256,6 +258,7 @@ export declare const UserScopeV2: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
256
258
|
}, z.core.$strip>, z.ZodObject<{
|
|
257
259
|
type: z.ZodEnum<{
|
|
258
260
|
"user.read": "user.read";
|
|
261
|
+
"user.search": "user.search";
|
|
259
262
|
}>;
|
|
260
263
|
options: z.ZodOptional<z.ZodObject<{
|
|
261
264
|
accessLevel: z.ZodOptional<z.ZodEnum<{
|
|
@@ -493,6 +496,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
493
496
|
}, z.core.$strip>, z.ZodObject<{
|
|
494
497
|
type: z.ZodEnum<{
|
|
495
498
|
"user.read": "user.read";
|
|
499
|
+
"user.search": "user.search";
|
|
496
500
|
}>;
|
|
497
501
|
options: z.ZodOptional<z.ZodObject<{
|
|
498
502
|
accessLevel: z.ZodOptional<z.ZodEnum<{
|
|
@@ -556,6 +560,7 @@ export declare const ScopeType: z.ZodEnum<{
|
|
|
556
560
|
"user.read": "user.read";
|
|
557
561
|
"user.create": "user.create";
|
|
558
562
|
"user.edit": "user.edit";
|
|
563
|
+
"user.search": "user.search";
|
|
559
564
|
workqueue: "workqueue";
|
|
560
565
|
"dashboard.view": "dashboard.view";
|
|
561
566
|
}>;
|
|
@@ -635,7 +640,7 @@ export declare const decodeScope: (query: EncodedScope) => {
|
|
|
635
640
|
role?: string[] | undefined;
|
|
636
641
|
} | undefined;
|
|
637
642
|
} | {
|
|
638
|
-
type: "user.read";
|
|
643
|
+
type: "user.read" | "user.search";
|
|
639
644
|
options?: {
|
|
640
645
|
accessLevel?: "administrativeArea" | "location" | "all" | undefined;
|
|
641
646
|
} | undefined;
|
package/dist/scopes/index.js
CHANGED
|
@@ -257,12 +257,14 @@ var SystemScopeType = z3.enum([
|
|
|
257
257
|
"organisation.read-locations",
|
|
258
258
|
"user.read",
|
|
259
259
|
"user.create",
|
|
260
|
-
"user.edit"
|
|
260
|
+
"user.edit",
|
|
261
|
+
"user.search"
|
|
261
262
|
]);
|
|
262
263
|
var UserScopeType = SystemScopeType.extract([
|
|
263
264
|
"user.read",
|
|
264
265
|
"user.create",
|
|
265
|
-
"user.edit"
|
|
266
|
+
"user.edit",
|
|
267
|
+
"user.search"
|
|
266
268
|
]);
|
|
267
269
|
var ScopesWithRoleOption = UserScopeType.extract(["user.edit", "user.create"]);
|
|
268
270
|
var UserScopeV2 = z3.discriminatedUnion("type", [
|
|
@@ -271,7 +273,7 @@ var UserScopeV2 = z3.discriminatedUnion("type", [
|
|
|
271
273
|
options: AllUserScopeOptions.optional()
|
|
272
274
|
}),
|
|
273
275
|
z3.object({
|
|
274
|
-
type: UserScopeType.extract(["user.read"]),
|
|
276
|
+
type: UserScopeType.extract(["user.read", "user.search"]),
|
|
275
277
|
options: AccessLevelOptions.optional()
|
|
276
278
|
})
|
|
277
279
|
]);
|
|
Binary file
|
package/package.json
CHANGED
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/events/deduplication.ts","./src/events/index.ts","./src/migrations/v2.0/add-birth-certificate-issuance-flag.ts","./src/migrations/v2.0/add-resend-invite-notification.ts","./src/migrations/v2.0/checkout-upstream-files.ts","./src/migrations/v2.0/convert-config-files-to-ts.ts","./src/migrations/v2.0/convert-paragraph-to-heading.ts","./src/migrations/v2.0/create-events-index.ts","./src/migrations/v2.0/delete-infrastructure-directory.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/merge-infrastructure-directory.ts","./src/migrations/v2.0/migrate-application-config-url.ts","./src/migrations/v2.0/migrate-scopes.ts","./src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts","./src/migrations/v2.0/migrate-workqueue-configs.ts","./src/migrations/v2.0/remove-delete-actions.ts","./src/migrations/v2.0/remove-demo-scope.ts","./src/migrations/v2.0/remove-deprecated-imports.ts","./src/migrations/v2.0/remove-fhir-url-helpers.ts","./src/migrations/v2.0/remove-hearth-migrations.ts","./src/migrations/v2.0/remove-old-statistics-service.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/remove-unused-environment-variables.ts","./src/migrations/v2.0/rename-api-paths.ts","./src/migrations/v2.0/rename-location-parent-id.ts","./src/migrations/v2.0/simplify-analytics-precalculations.ts","./src/migrations/v2.0/update-package-json.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"5.6.3"}
|
|
1
|
+
{"root":["./src/cli.ts","./src/api/index.ts","./src/application-config/index.ts","./src/conditionals/index.ts","./src/events/deduplication.ts","./src/events/index.ts","./src/migrations/v2.0/add-birth-certificate-issuance-flag.ts","./src/migrations/v2.0/add-resend-invite-notification.ts","./src/migrations/v2.0/checkout-upstream-files.ts","./src/migrations/v2.0/convert-config-files-to-ts.ts","./src/migrations/v2.0/convert-paragraph-to-heading.ts","./src/migrations/v2.0/create-events-index.ts","./src/migrations/v2.0/delete-infrastructure-directory.ts","./src/migrations/v2.0/fix-accept-requested-registration-function-type.ts","./src/migrations/v2.0/index.ts","./src/migrations/v2.0/make-built-in-validate-actions-custom.ts","./src/migrations/v2.0/merge-infrastructure-directory.ts","./src/migrations/v2.0/migrate-application-config-url.ts","./src/migrations/v2.0/migrate-scopes.ts","./src/migrations/v2.0/migrate-validated-workqueue-status-to-flag.ts","./src/migrations/v2.0/migrate-workqueue-configs.ts","./src/migrations/v2.0/remove-delete-actions.ts","./src/migrations/v2.0/remove-demo-scope.ts","./src/migrations/v2.0/remove-deprecated-imports.ts","./src/migrations/v2.0/remove-fhir-url-helpers.ts","./src/migrations/v2.0/remove-hearth-migrations.ts","./src/migrations/v2.0/remove-old-statistics-service.ts","./src/migrations/v2.0/remove-pending-certification-flag.ts","./src/migrations/v2.0/remove-review-from-register-action.ts","./src/migrations/v2.0/remove-unused-environment-variables.ts","./src/migrations/v2.0/rename-api-paths.ts","./src/migrations/v2.0/rename-location-parent-id.ts","./src/migrations/v2.0/simplify-analytics-precalculations.ts","./src/migrations/v2.0/update-package-json.ts","./src/notification/index.ts","./src/scopes/index.ts"],"version":"5.6.3"}
|
|
Binary file
|