@opencrvs/toolkit 2.1.0-rc.9cfaa26 → 2.1.0-rc.9dce8c0
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 +1 -0
- package/dist/commons/api/router.d.ts +87 -5
- package/dist/commons/conditionals/conditionals.d.ts +3 -3
- package/dist/commons/conditionals/validate.d.ts +3 -3
- package/dist/commons/events/AdvancedSearchConfig.d.ts +6 -0
- package/dist/commons/events/AuditLog.d.ts +37 -0
- package/dist/commons/events/FieldConfig.d.ts +5 -0
- package/dist/commons/events/FieldValue.d.ts +2 -2
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/index.d.ts +1 -0
- package/dist/commons/events/locationPayloads.d.ts +95 -0
- package/dist/commons/events/locations.d.ts +106 -19
- package/dist/commons/events/mocks.test.utils.d.ts +30 -2
- package/dist/conditionals/index.js +1 -0
- package/dist/events/index.js +143 -3
- package/dist/notification/index.js +133 -28
- package/dist/scopes/index.d.ts +3 -1
- package/dist/scopes/index.js +1 -0
- package/opencrvs-toolkit-2.1.0-rc.9dce8c0.tgz +0 -0
- package/package.json +3 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/opencrvs-toolkit-2.1.0-rc.9cfaa26.tgz +0 -0
|
@@ -8,7 +8,6 @@ export declare const V2_DEFAULT_MOCK_LOCATIONS_MAP: Map<string & import("zod").$
|
|
|
8
8
|
administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
|
|
9
9
|
locationType: string | null;
|
|
10
10
|
status: "active" | "inactive";
|
|
11
|
-
effectiveFrom: string;
|
|
12
11
|
versions: {
|
|
13
12
|
versionId: string & import("zod").$brand<"UUID">;
|
|
14
13
|
effectiveFrom: string;
|
|
@@ -23,7 +22,36 @@ export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: Map<string & impo
|
|
|
23
22
|
externalId?: string | null | undefined;
|
|
24
23
|
parentId: (string & import("zod").$brand<"UUID">) | null;
|
|
25
24
|
status: "active" | "inactive";
|
|
26
|
-
|
|
25
|
+
versions: {
|
|
26
|
+
versionId: string & import("zod").$brand<"UUID">;
|
|
27
|
+
effectiveFrom: string;
|
|
28
|
+
name: string;
|
|
29
|
+
externalId?: string | null | undefined;
|
|
30
|
+
status: "active" | "inactive";
|
|
31
|
+
}[];
|
|
32
|
+
}>;
|
|
33
|
+
/**
|
|
34
|
+
* Stripped view of {@link V2_DEFAULT_MOCK_LOCATIONS_MAP} matching what the
|
|
35
|
+
* client's cached location map actually holds at runtime (identity +
|
|
36
|
+
* versions only). Use this — not the wire-format map above — wherever a test
|
|
37
|
+
* stands in for `useLocations().getLocations.useSuspenseQuery()`.
|
|
38
|
+
*/
|
|
39
|
+
export declare const V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP: Map<string & import("zod").$brand<"UUID">, {
|
|
40
|
+
id: string & import("zod").$brand<"UUID">;
|
|
41
|
+
administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
|
|
42
|
+
locationType: string | null;
|
|
43
|
+
versions: {
|
|
44
|
+
versionId: string & import("zod").$brand<"UUID">;
|
|
45
|
+
effectiveFrom: string;
|
|
46
|
+
name: string;
|
|
47
|
+
externalId?: string | null | undefined;
|
|
48
|
+
status: "active" | "inactive";
|
|
49
|
+
}[];
|
|
50
|
+
}>;
|
|
51
|
+
/** See {@link V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP}. */
|
|
52
|
+
export declare const V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP: Map<string & import("zod").$brand<"UUID">, {
|
|
53
|
+
id: string & import("zod").$brand<"UUID">;
|
|
54
|
+
parentId: (string & import("zod").$brand<"UUID">) | null;
|
|
27
55
|
versions: {
|
|
28
56
|
versionId: string & import("zod").$brand<"UUID">;
|
|
29
57
|
effectiveFrom: string;
|
package/dist/events/index.js
CHANGED
|
@@ -74,12 +74,16 @@ __export(events_exports, {
|
|
|
74
74
|
CertificateTemplateConfig: () => CertificateTemplateConfig,
|
|
75
75
|
CheckboxFieldValue: () => CheckboxFieldValue,
|
|
76
76
|
Clause: () => Clause,
|
|
77
|
+
ClientAdministrativeArea: () => ClientAdministrativeArea,
|
|
78
|
+
ClientLocation: () => ClientLocation,
|
|
77
79
|
ClientSpecificAction: () => ClientSpecificAction,
|
|
78
80
|
ComputedDefaultValue: () => ComputedDefaultValue,
|
|
79
81
|
Conditional: () => Conditional,
|
|
80
82
|
ConditionalType: () => ConditionalType,
|
|
81
83
|
ConfirmableActions: () => ConfirmableActions,
|
|
82
84
|
ContainsFlags: () => ContainsFlags,
|
|
85
|
+
CreateAdministrativeAreaPayload: () => CreateAdministrativeAreaPayload,
|
|
86
|
+
CreateLocationPayload: () => CreateLocationPayload,
|
|
83
87
|
CustomActionInput: () => CustomActionInput,
|
|
84
88
|
CustomFieldValue: () => CustomFieldValue,
|
|
85
89
|
CustomFlag: () => CustomFlag,
|
|
@@ -220,15 +224,21 @@ __export(events_exports, {
|
|
|
220
224
|
UUID: () => UUID,
|
|
221
225
|
UnarchiveActionInput: () => UnarchiveActionInput,
|
|
222
226
|
UnassignActionInput: () => UnassignActionInput,
|
|
227
|
+
UpdateAdministrativeAreaPayload: () => UpdateAdministrativeAreaPayload,
|
|
228
|
+
UpdateLocationPayload: () => UpdateLocationPayload,
|
|
223
229
|
UserAuditRecordInput: () => UserAuditRecordInput,
|
|
224
230
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS,
|
|
225
231
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: () => V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP,
|
|
232
|
+
V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP: () => V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP,
|
|
233
|
+
V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP: () => V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP,
|
|
226
234
|
V2_DEFAULT_MOCK_LOCATIONS: () => V2_DEFAULT_MOCK_LOCATIONS,
|
|
227
235
|
V2_DEFAULT_MOCK_LOCATIONS_MAP: () => V2_DEFAULT_MOCK_LOCATIONS_MAP,
|
|
228
236
|
ValidationConfig: () => ValidationConfig,
|
|
229
237
|
VerificationActionConfig: () => VerificationActionConfig,
|
|
230
238
|
VerificationPageConfig: () => VerificationPageConfig,
|
|
231
239
|
VerificationStatusValue: () => VerificationStatusValue,
|
|
240
|
+
WithdrawAdministrativeAreaVersionPayload: () => WithdrawAdministrativeAreaVersionPayload,
|
|
241
|
+
WithdrawLocationVersionPayload: () => WithdrawLocationVersionPayload,
|
|
232
242
|
Within: () => Within,
|
|
233
243
|
WorkqueueActionType: () => WorkqueueActionType,
|
|
234
244
|
WorkqueueColumn: () => WorkqueueColumn,
|
|
@@ -347,6 +357,7 @@ __export(events_exports, {
|
|
|
347
357
|
getStatusFromActions: () => getStatusFromActions,
|
|
348
358
|
getValidatorsForField: () => getValidatorsForField,
|
|
349
359
|
getVisibleVerificationPageIds: () => getVisibleVerificationPageIds,
|
|
360
|
+
hasActiveExternalIdOnOrAfter: () => hasActiveExternalIdOnOrAfter,
|
|
350
361
|
hasAnyOfScopes: () => hasAnyOfScopes,
|
|
351
362
|
isActionAvailable: () => isActionAvailable,
|
|
352
363
|
isActionConfigType: () => isActionConfigType,
|
|
@@ -436,6 +447,7 @@ __export(events_exports, {
|
|
|
436
447
|
precompileActionSchemas: () => precompileActionSchemas,
|
|
437
448
|
resolveDateOfEvent: () => resolveDateOfEvent,
|
|
438
449
|
resolveEventCustomFlags: () => resolveEventCustomFlags,
|
|
450
|
+
resolvePath: () => resolvePath,
|
|
439
451
|
resolvePlaceOfEvent: () => resolvePlaceOfEvent,
|
|
440
452
|
resolveVersion: () => resolveVersion,
|
|
441
453
|
runClientFunction: () => runClientFunction,
|
|
@@ -444,6 +456,9 @@ __export(events_exports, {
|
|
|
444
456
|
safeUnion: () => safeUnion,
|
|
445
457
|
status: () => status,
|
|
446
458
|
timePeriodToDateRange: () => timePeriodToDateRange,
|
|
459
|
+
toClientAdministrativeArea: () => toClientAdministrativeArea,
|
|
460
|
+
toClientLocation: () => toClientLocation,
|
|
461
|
+
toPlainDate: () => toPlainDate,
|
|
447
462
|
todayISO: () => todayISO,
|
|
448
463
|
user: () => user,
|
|
449
464
|
userCanAccessEventWithScopes: () => userCanAccessEventWithScopes,
|
|
@@ -505,6 +520,7 @@ var PlainScopeType = z2.enum([
|
|
|
505
520
|
"integration.create",
|
|
506
521
|
"record.import",
|
|
507
522
|
"config.update-all",
|
|
523
|
+
"location.edit",
|
|
508
524
|
"attachment.upload",
|
|
509
525
|
"profile.electronic-signature",
|
|
510
526
|
"user.read-only-my-audit",
|
|
@@ -987,6 +1003,29 @@ var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
|
|
|
987
1003
|
requestData: z5.object({ id: z5.string() }),
|
|
988
1004
|
responseSummary: z5.object({ clientId: z5.string() })
|
|
989
1005
|
});
|
|
1006
|
+
var createdVersionFields = {
|
|
1007
|
+
id: z5.string(),
|
|
1008
|
+
versionId: z5.string(),
|
|
1009
|
+
name: z5.string(),
|
|
1010
|
+
externalId: z5.string().nullish(),
|
|
1011
|
+
effectiveFrom: z5.string(),
|
|
1012
|
+
status: z5.string()
|
|
1013
|
+
};
|
|
1014
|
+
var LocationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
1015
|
+
operation: z5.literal("locations.create"),
|
|
1016
|
+
requestData: z5.object({
|
|
1017
|
+
...createdVersionFields,
|
|
1018
|
+
administrativeAreaId: z5.string().nullish(),
|
|
1019
|
+
locationType: z5.string().nullish()
|
|
1020
|
+
})
|
|
1021
|
+
});
|
|
1022
|
+
var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
|
|
1023
|
+
operation: z5.literal("administrativeAreas.create"),
|
|
1024
|
+
requestData: z5.object({
|
|
1025
|
+
...createdVersionFields,
|
|
1026
|
+
parentId: z5.string().nullish()
|
|
1027
|
+
})
|
|
1028
|
+
});
|
|
990
1029
|
var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
|
|
991
1030
|
operation: z5.literal("attachments.upload"),
|
|
992
1031
|
requestData: z5.object({
|
|
@@ -1062,6 +1101,8 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
|
|
|
1062
1101
|
IntegrationActivateEntrySchema,
|
|
1063
1102
|
IntegrationDeleteEntrySchema,
|
|
1064
1103
|
IntegrationRefreshSecretEntrySchema,
|
|
1104
|
+
LocationCreateEntrySchema,
|
|
1105
|
+
AdministrativeAreaCreateEntrySchema,
|
|
1065
1106
|
AttachmentUploadEntrySchema,
|
|
1066
1107
|
UserCreateEntrySchema,
|
|
1067
1108
|
UserReasonEntrySchema,
|
|
@@ -1362,6 +1403,9 @@ var CustomFieldValue = z10.unknown().brand("CustomFieldValue");
|
|
|
1362
1403
|
// ../commons/src/events/PlainDate.ts
|
|
1363
1404
|
var import_zod = require("zod");
|
|
1364
1405
|
var PlainDate = import_zod.z.string().date().brand("PlainDate").describe("Date in the format YYYY-MM-DD");
|
|
1406
|
+
function toPlainDate(dateTime) {
|
|
1407
|
+
return dateTime.split("T")[0];
|
|
1408
|
+
}
|
|
1365
1409
|
function plainDateToLocalDate(date) {
|
|
1366
1410
|
const [year, month, day] = date.split("-").map(Number);
|
|
1367
1411
|
return new Date(year, month - 1, day);
|
|
@@ -10485,7 +10529,6 @@ var AdministrativeArea = z43.object({
|
|
|
10485
10529
|
externalId: z43.string().nullish(),
|
|
10486
10530
|
parentId: UUID.nullable(),
|
|
10487
10531
|
status: LocationStatus,
|
|
10488
|
-
effectiveFrom: z43.iso.date(),
|
|
10489
10532
|
versions: z43.array(LocationVersion)
|
|
10490
10533
|
});
|
|
10491
10534
|
var Location = z43.object({
|
|
@@ -10495,9 +10538,33 @@ var Location = z43.object({
|
|
|
10495
10538
|
administrativeAreaId: UUID.nullable(),
|
|
10496
10539
|
locationType: z43.string().nullable(),
|
|
10497
10540
|
status: LocationStatus,
|
|
10498
|
-
effectiveFrom: z43.iso.date(),
|
|
10499
10541
|
versions: z43.array(LocationVersion)
|
|
10500
10542
|
});
|
|
10543
|
+
var ClientAdministrativeArea = AdministrativeArea.omit({
|
|
10544
|
+
name: true,
|
|
10545
|
+
status: true,
|
|
10546
|
+
externalId: true
|
|
10547
|
+
});
|
|
10548
|
+
var ClientLocation = Location.omit({
|
|
10549
|
+
name: true,
|
|
10550
|
+
status: true,
|
|
10551
|
+
externalId: true
|
|
10552
|
+
});
|
|
10553
|
+
function toClientLocation(location) {
|
|
10554
|
+
return {
|
|
10555
|
+
id: location.id,
|
|
10556
|
+
administrativeAreaId: location.administrativeAreaId,
|
|
10557
|
+
locationType: location.locationType,
|
|
10558
|
+
versions: location.versions
|
|
10559
|
+
};
|
|
10560
|
+
}
|
|
10561
|
+
function toClientAdministrativeArea(area) {
|
|
10562
|
+
return {
|
|
10563
|
+
id: area.id,
|
|
10564
|
+
parentId: area.parentId,
|
|
10565
|
+
versions: area.versions
|
|
10566
|
+
};
|
|
10567
|
+
}
|
|
10501
10568
|
var SetLocationPayload = z43.object({
|
|
10502
10569
|
id: UUID,
|
|
10503
10570
|
name: z43.string(),
|
|
@@ -10520,6 +10587,13 @@ function resolveVersion(versions, anchor) {
|
|
|
10520
10587
|
}
|
|
10521
10588
|
return resolved;
|
|
10522
10589
|
}
|
|
10590
|
+
function hasActiveExternalIdOnOrAfter(versions, externalId, anchor) {
|
|
10591
|
+
const inEffectAtAnchor = resolveVersion(versions, anchor);
|
|
10592
|
+
const laterVersions = versions.filter((v) => v.effectiveFrom > anchor);
|
|
10593
|
+
return [inEffectAtAnchor, ...laterVersions].some(
|
|
10594
|
+
(v) => v.externalId === externalId && v.status === "active"
|
|
10595
|
+
);
|
|
10596
|
+
}
|
|
10523
10597
|
function matchesJurisdictionFilter(locationIds, filter, user2) {
|
|
10524
10598
|
if (!locationIds) {
|
|
10525
10599
|
return false;
|
|
@@ -10695,6 +10769,16 @@ function getLocationHierarchy(selectedId, context) {
|
|
|
10695
10769
|
);
|
|
10696
10770
|
return hierarchy.reverse().map((area) => area.id);
|
|
10697
10771
|
}
|
|
10772
|
+
function resolvePath(locationId, anchor, context) {
|
|
10773
|
+
return getLocationHierarchy(locationId, context).flatMap((id) => {
|
|
10774
|
+
const node = context.locations.get(id) ?? context.administrativeAreas.get(id);
|
|
10775
|
+
if (!node) {
|
|
10776
|
+
return [];
|
|
10777
|
+
}
|
|
10778
|
+
const { name, status: status2 } = resolveVersion(node.versions, anchor);
|
|
10779
|
+
return [{ id, name, status: status2 }];
|
|
10780
|
+
});
|
|
10781
|
+
}
|
|
10698
10782
|
|
|
10699
10783
|
// ../commons/src/events/scopes.ts
|
|
10700
10784
|
var ACTION_SCOPE_MAP = {
|
|
@@ -11003,7 +11087,6 @@ function withVersionFields(entity) {
|
|
|
11003
11087
|
return {
|
|
11004
11088
|
...entity,
|
|
11005
11089
|
status: "active",
|
|
11006
|
-
effectiveFrom: "0001-01-01",
|
|
11007
11090
|
versions: [
|
|
11008
11091
|
{
|
|
11009
11092
|
versionId: entity.id,
|
|
@@ -11331,3 +11414,60 @@ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
|
|
|
11331
11414
|
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
11332
11415
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
|
|
11333
11416
|
);
|
|
11417
|
+
var V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP = new Map(
|
|
11418
|
+
V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, toClientLocation(l)])
|
|
11419
|
+
);
|
|
11420
|
+
var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
11421
|
+
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [
|
|
11422
|
+
a.id,
|
|
11423
|
+
toClientAdministrativeArea(a)
|
|
11424
|
+
])
|
|
11425
|
+
);
|
|
11426
|
+
|
|
11427
|
+
// ../commons/src/events/locationPayloads.ts
|
|
11428
|
+
var z44 = __toESM(require("zod/v4"));
|
|
11429
|
+
var CreateLocationPayload = z44.object({
|
|
11430
|
+
id: UUID.optional(),
|
|
11431
|
+
versionId: UUID.optional(),
|
|
11432
|
+
name: z44.string(),
|
|
11433
|
+
externalId: z44.string().nullish(),
|
|
11434
|
+
administrativeAreaId: UUID.nullable(),
|
|
11435
|
+
locationType: z44.string().nullable(),
|
|
11436
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
11437
|
+
status: LocationStatus.default("active")
|
|
11438
|
+
});
|
|
11439
|
+
var UpdateLocationPayload = z44.strictObject({
|
|
11440
|
+
id: UUID,
|
|
11441
|
+
versionId: UUID.optional(),
|
|
11442
|
+
name: z44.string(),
|
|
11443
|
+
externalId: z44.string().nullish(),
|
|
11444
|
+
status: LocationStatus,
|
|
11445
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
11446
|
+
lastVersionId: UUID
|
|
11447
|
+
});
|
|
11448
|
+
var WithdrawLocationVersionPayload = z44.object({
|
|
11449
|
+
id: UUID,
|
|
11450
|
+
versionId: UUID
|
|
11451
|
+
});
|
|
11452
|
+
var CreateAdministrativeAreaPayload = z44.object({
|
|
11453
|
+
id: UUID.optional(),
|
|
11454
|
+
versionId: UUID.optional(),
|
|
11455
|
+
name: z44.string(),
|
|
11456
|
+
externalId: z44.string().nullish(),
|
|
11457
|
+
parentId: UUID.nullable(),
|
|
11458
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
11459
|
+
status: LocationStatus.default("active")
|
|
11460
|
+
});
|
|
11461
|
+
var UpdateAdministrativeAreaPayload = z44.strictObject({
|
|
11462
|
+
id: UUID,
|
|
11463
|
+
versionId: UUID.optional(),
|
|
11464
|
+
name: z44.string(),
|
|
11465
|
+
externalId: z44.string().nullish(),
|
|
11466
|
+
status: LocationStatus,
|
|
11467
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
11468
|
+
lastVersionId: UUID
|
|
11469
|
+
});
|
|
11470
|
+
var WithdrawAdministrativeAreaVersionPayload = z44.object({
|
|
11471
|
+
id: UUID,
|
|
11472
|
+
versionId: UUID
|
|
11473
|
+
});
|
|
@@ -38,7 +38,7 @@ __export(notification_exports, {
|
|
|
38
38
|
triggerUserEventNotification: () => triggerUserEventNotification
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(notification_exports);
|
|
41
|
-
var
|
|
41
|
+
var z46 = __toESM(require("zod/v4"));
|
|
42
42
|
|
|
43
43
|
// ../commons/src/url.ts
|
|
44
44
|
function joinUrl(base, path) {
|
|
@@ -96,6 +96,7 @@ var PlainScopeType = z2.enum([
|
|
|
96
96
|
"integration.create",
|
|
97
97
|
"record.import",
|
|
98
98
|
"config.update-all",
|
|
99
|
+
"location.edit",
|
|
99
100
|
"attachment.upload",
|
|
100
101
|
"profile.electronic-signature",
|
|
101
102
|
"user.read-only-my-audit",
|
|
@@ -530,6 +531,29 @@ var IntegrationRefreshSecretEntrySchema = AuditLogEntryBase.extend({
|
|
|
530
531
|
requestData: z5.object({ id: z5.string() }),
|
|
531
532
|
responseSummary: z5.object({ clientId: z5.string() })
|
|
532
533
|
});
|
|
534
|
+
var createdVersionFields = {
|
|
535
|
+
id: z5.string(),
|
|
536
|
+
versionId: z5.string(),
|
|
537
|
+
name: z5.string(),
|
|
538
|
+
externalId: z5.string().nullish(),
|
|
539
|
+
effectiveFrom: z5.string(),
|
|
540
|
+
status: z5.string()
|
|
541
|
+
};
|
|
542
|
+
var LocationCreateEntrySchema = AuditLogEntryBase.extend({
|
|
543
|
+
operation: z5.literal("locations.create"),
|
|
544
|
+
requestData: z5.object({
|
|
545
|
+
...createdVersionFields,
|
|
546
|
+
administrativeAreaId: z5.string().nullish(),
|
|
547
|
+
locationType: z5.string().nullish()
|
|
548
|
+
})
|
|
549
|
+
});
|
|
550
|
+
var AdministrativeAreaCreateEntrySchema = AuditLogEntryBase.extend({
|
|
551
|
+
operation: z5.literal("administrativeAreas.create"),
|
|
552
|
+
requestData: z5.object({
|
|
553
|
+
...createdVersionFields,
|
|
554
|
+
parentId: z5.string().nullish()
|
|
555
|
+
})
|
|
556
|
+
});
|
|
533
557
|
var AttachmentUploadEntrySchema = AuditLogEntryBase.extend({
|
|
534
558
|
operation: z5.literal("attachments.upload"),
|
|
535
559
|
requestData: z5.object({
|
|
@@ -605,6 +629,8 @@ var AuditLogEntrySchema = z5.discriminatedUnion("operation", [
|
|
|
605
629
|
IntegrationActivateEntrySchema,
|
|
606
630
|
IntegrationDeleteEntrySchema,
|
|
607
631
|
IntegrationRefreshSecretEntrySchema,
|
|
632
|
+
LocationCreateEntrySchema,
|
|
633
|
+
AdministrativeAreaCreateEntrySchema,
|
|
608
634
|
AttachmentUploadEntrySchema,
|
|
609
635
|
UserCreateEntrySchema,
|
|
610
636
|
UserReasonEntrySchema,
|
|
@@ -7373,7 +7399,6 @@ var AdministrativeArea = z43.object({
|
|
|
7373
7399
|
externalId: z43.string().nullish(),
|
|
7374
7400
|
parentId: UUID.nullable(),
|
|
7375
7401
|
status: LocationStatus,
|
|
7376
|
-
effectiveFrom: z43.iso.date(),
|
|
7377
7402
|
versions: z43.array(LocationVersion)
|
|
7378
7403
|
});
|
|
7379
7404
|
var Location = z43.object({
|
|
@@ -7383,9 +7408,33 @@ var Location = z43.object({
|
|
|
7383
7408
|
administrativeAreaId: UUID.nullable(),
|
|
7384
7409
|
locationType: z43.string().nullable(),
|
|
7385
7410
|
status: LocationStatus,
|
|
7386
|
-
effectiveFrom: z43.iso.date(),
|
|
7387
7411
|
versions: z43.array(LocationVersion)
|
|
7388
7412
|
});
|
|
7413
|
+
var ClientAdministrativeArea = AdministrativeArea.omit({
|
|
7414
|
+
name: true,
|
|
7415
|
+
status: true,
|
|
7416
|
+
externalId: true
|
|
7417
|
+
});
|
|
7418
|
+
var ClientLocation = Location.omit({
|
|
7419
|
+
name: true,
|
|
7420
|
+
status: true,
|
|
7421
|
+
externalId: true
|
|
7422
|
+
});
|
|
7423
|
+
function toClientLocation(location) {
|
|
7424
|
+
return {
|
|
7425
|
+
id: location.id,
|
|
7426
|
+
administrativeAreaId: location.administrativeAreaId,
|
|
7427
|
+
locationType: location.locationType,
|
|
7428
|
+
versions: location.versions
|
|
7429
|
+
};
|
|
7430
|
+
}
|
|
7431
|
+
function toClientAdministrativeArea(area) {
|
|
7432
|
+
return {
|
|
7433
|
+
id: area.id,
|
|
7434
|
+
parentId: area.parentId,
|
|
7435
|
+
versions: area.versions
|
|
7436
|
+
};
|
|
7437
|
+
}
|
|
7389
7438
|
var SetLocationPayload = z43.object({
|
|
7390
7439
|
id: UUID,
|
|
7391
7440
|
name: z43.string(),
|
|
@@ -7501,7 +7550,6 @@ function withVersionFields(entity) {
|
|
|
7501
7550
|
return {
|
|
7502
7551
|
...entity,
|
|
7503
7552
|
status: "active",
|
|
7504
|
-
effectiveFrom: "0001-01-01",
|
|
7505
7553
|
versions: [
|
|
7506
7554
|
{
|
|
7507
7555
|
versionId: entity.id,
|
|
@@ -7829,9 +7877,66 @@ var V2_DEFAULT_MOCK_LOCATIONS_MAP = new Map(
|
|
|
7829
7877
|
var V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
7830
7878
|
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [a.id, a])
|
|
7831
7879
|
);
|
|
7880
|
+
var V2_DEFAULT_MOCK_CLIENT_LOCATIONS_MAP = new Map(
|
|
7881
|
+
V2_DEFAULT_MOCK_LOCATIONS.map((l) => [l.id, toClientLocation(l)])
|
|
7882
|
+
);
|
|
7883
|
+
var V2_DEFAULT_MOCK_CLIENT_ADMINISTRATIVE_AREAS_MAP = new Map(
|
|
7884
|
+
V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS.map((a) => [
|
|
7885
|
+
a.id,
|
|
7886
|
+
toClientAdministrativeArea(a)
|
|
7887
|
+
])
|
|
7888
|
+
);
|
|
7832
7889
|
|
|
7833
|
-
// ../commons/src/
|
|
7890
|
+
// ../commons/src/events/locationPayloads.ts
|
|
7834
7891
|
var z44 = __toESM(require("zod/v4"));
|
|
7892
|
+
var CreateLocationPayload = z44.object({
|
|
7893
|
+
id: UUID.optional(),
|
|
7894
|
+
versionId: UUID.optional(),
|
|
7895
|
+
name: z44.string(),
|
|
7896
|
+
externalId: z44.string().nullish(),
|
|
7897
|
+
administrativeAreaId: UUID.nullable(),
|
|
7898
|
+
locationType: z44.string().nullable(),
|
|
7899
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
7900
|
+
status: LocationStatus.default("active")
|
|
7901
|
+
});
|
|
7902
|
+
var UpdateLocationPayload = z44.strictObject({
|
|
7903
|
+
id: UUID,
|
|
7904
|
+
versionId: UUID.optional(),
|
|
7905
|
+
name: z44.string(),
|
|
7906
|
+
externalId: z44.string().nullish(),
|
|
7907
|
+
status: LocationStatus,
|
|
7908
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
7909
|
+
lastVersionId: UUID
|
|
7910
|
+
});
|
|
7911
|
+
var WithdrawLocationVersionPayload = z44.object({
|
|
7912
|
+
id: UUID,
|
|
7913
|
+
versionId: UUID
|
|
7914
|
+
});
|
|
7915
|
+
var CreateAdministrativeAreaPayload = z44.object({
|
|
7916
|
+
id: UUID.optional(),
|
|
7917
|
+
versionId: UUID.optional(),
|
|
7918
|
+
name: z44.string(),
|
|
7919
|
+
externalId: z44.string().nullish(),
|
|
7920
|
+
parentId: UUID.nullable(),
|
|
7921
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
7922
|
+
status: LocationStatus.default("active")
|
|
7923
|
+
});
|
|
7924
|
+
var UpdateAdministrativeAreaPayload = z44.strictObject({
|
|
7925
|
+
id: UUID,
|
|
7926
|
+
versionId: UUID.optional(),
|
|
7927
|
+
name: z44.string(),
|
|
7928
|
+
externalId: z44.string().nullish(),
|
|
7929
|
+
status: LocationStatus,
|
|
7930
|
+
effectiveFrom: z44.iso.date().optional(),
|
|
7931
|
+
lastVersionId: UUID
|
|
7932
|
+
});
|
|
7933
|
+
var WithdrawAdministrativeAreaVersionPayload = z44.object({
|
|
7934
|
+
id: UUID,
|
|
7935
|
+
versionId: UUID
|
|
7936
|
+
});
|
|
7937
|
+
|
|
7938
|
+
// ../commons/src/notification/UserNotifications.ts
|
|
7939
|
+
var z45 = __toESM(require("zod/v4"));
|
|
7835
7940
|
var TriggerEvent = {
|
|
7836
7941
|
USER_CREATED: "user-created",
|
|
7837
7942
|
USER_UPDATED: "user-updated",
|
|
@@ -7844,54 +7949,54 @@ var TriggerEvent = {
|
|
|
7844
7949
|
CHANGE_PHONE_NUMBER: "change-phone-number",
|
|
7845
7950
|
CHANGE_EMAIL_ADDRESS: "change-email-address"
|
|
7846
7951
|
};
|
|
7847
|
-
var Recipient =
|
|
7952
|
+
var Recipient = z45.object({
|
|
7848
7953
|
name: NameFieldValue.optional(),
|
|
7849
|
-
mobile:
|
|
7850
|
-
email:
|
|
7851
|
-
bcc:
|
|
7954
|
+
mobile: z45.string().optional(),
|
|
7955
|
+
email: z45.string().optional(),
|
|
7956
|
+
bcc: z45.array(z45.string()).optional()
|
|
7852
7957
|
});
|
|
7853
|
-
var BasePayload =
|
|
7958
|
+
var BasePayload = z45.object({
|
|
7854
7959
|
recipient: Recipient
|
|
7855
7960
|
});
|
|
7856
7961
|
var TriggerPayload = {
|
|
7857
7962
|
[TriggerEvent.USER_CREATED]: BasePayload.extend({
|
|
7858
|
-
username:
|
|
7859
|
-
temporaryPassword:
|
|
7963
|
+
username: z45.string(),
|
|
7964
|
+
temporaryPassword: z45.string()
|
|
7860
7965
|
}),
|
|
7861
7966
|
[TriggerEvent.USER_UPDATED]: BasePayload.extend({
|
|
7862
|
-
oldUsername:
|
|
7863
|
-
newUsername:
|
|
7967
|
+
oldUsername: z45.string(),
|
|
7968
|
+
newUsername: z45.string()
|
|
7864
7969
|
}),
|
|
7865
7970
|
[TriggerEvent.USERNAME_REMINDER]: BasePayload.extend({
|
|
7866
|
-
username:
|
|
7971
|
+
username: z45.string()
|
|
7867
7972
|
}),
|
|
7868
7973
|
[TriggerEvent.RESET_PASSWORD]: BasePayload.extend({
|
|
7869
|
-
code:
|
|
7974
|
+
code: z45.string()
|
|
7870
7975
|
}),
|
|
7871
7976
|
[TriggerEvent.RESET_PASSWORD_BY_ADMIN]: BasePayload.extend({
|
|
7872
|
-
temporaryPassword:
|
|
7873
|
-
admin:
|
|
7874
|
-
id:
|
|
7977
|
+
temporaryPassword: z45.string(),
|
|
7978
|
+
admin: z45.object({
|
|
7979
|
+
id: z45.string(),
|
|
7875
7980
|
name: NameFieldValue,
|
|
7876
|
-
role:
|
|
7981
|
+
role: z45.string()
|
|
7877
7982
|
})
|
|
7878
7983
|
}),
|
|
7879
7984
|
[TriggerEvent.RESEND_INVITE]: BasePayload.extend({
|
|
7880
|
-
username:
|
|
7881
|
-
temporaryPassword:
|
|
7985
|
+
username: z45.string(),
|
|
7986
|
+
temporaryPassword: z45.string()
|
|
7882
7987
|
}),
|
|
7883
7988
|
[TriggerEvent.TWO_FA]: BasePayload.extend({
|
|
7884
|
-
code:
|
|
7989
|
+
code: z45.string()
|
|
7885
7990
|
}),
|
|
7886
7991
|
[TriggerEvent.ALL_USER_NOTIFICATION]: BasePayload.extend({
|
|
7887
|
-
subject:
|
|
7888
|
-
body:
|
|
7992
|
+
subject: z45.string(),
|
|
7993
|
+
body: z45.string()
|
|
7889
7994
|
}),
|
|
7890
7995
|
[TriggerEvent.CHANGE_PHONE_NUMBER]: BasePayload.extend({
|
|
7891
|
-
code:
|
|
7996
|
+
code: z45.string()
|
|
7892
7997
|
}),
|
|
7893
7998
|
[TriggerEvent.CHANGE_EMAIL_ADDRESS]: BasePayload.extend({
|
|
7894
|
-
code:
|
|
7999
|
+
code: z45.string()
|
|
7895
8000
|
})
|
|
7896
8001
|
};
|
|
7897
8002
|
async function triggerUserEventNotification({
|
|
@@ -7915,4 +8020,4 @@ function parseUserEventTrigger(event2, body) {
|
|
|
7915
8020
|
}
|
|
7916
8021
|
|
|
7917
8022
|
// src/notification/index.ts
|
|
7918
|
-
|
|
8023
|
+
z46.globalRegistry.clear();
|
package/dist/scopes/index.d.ts
CHANGED
|
@@ -397,6 +397,7 @@ export declare const Scope: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
397
397
|
bypassratelimit: "bypassratelimit";
|
|
398
398
|
"config.update-all": "config.update-all";
|
|
399
399
|
"integration.create": "integration.create";
|
|
400
|
+
"location.edit": "location.edit";
|
|
400
401
|
"performance.read": "performance.read";
|
|
401
402
|
"performance.read-dashboards": "performance.read-dashboards";
|
|
402
403
|
"performance.vital-statistics-export": "performance.vital-statistics-export";
|
|
@@ -617,6 +618,7 @@ export declare const ScopeType: z.ZodEnum<{
|
|
|
617
618
|
"config.update-all": "config.update-all";
|
|
618
619
|
"dashboard.view": "dashboard.view";
|
|
619
620
|
"integration.create": "integration.create";
|
|
621
|
+
"location.edit": "location.edit";
|
|
620
622
|
"organisation.read-locations": "organisation.read-locations";
|
|
621
623
|
"performance.read": "performance.read";
|
|
622
624
|
"performance.read-dashboards": "performance.read-dashboards";
|
|
@@ -737,7 +739,7 @@ export declare const decodeScope: (encodedScope: EncodedScope) => {
|
|
|
737
739
|
accessLevel?: "administrativeArea" | "all" | "location" | undefined;
|
|
738
740
|
} | undefined;
|
|
739
741
|
} | {
|
|
740
|
-
type: "attachment.upload" | "bypassratelimit" | "config.update-all" | "integration.create" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.confirm-registration" | "record.import" | "record.reindex" | "record.reject-registration" | "user.data-seeding" | "user.read-only-my-audit";
|
|
742
|
+
type: "attachment.upload" | "bypassratelimit" | "config.update-all" | "integration.create" | "location.edit" | "performance.read" | "performance.read-dashboards" | "performance.vital-statistics-export" | "profile.electronic-signature" | "record.confirm-registration" | "record.import" | "record.reindex" | "record.reject-registration" | "user.data-seeding" | "user.read-only-my-audit";
|
|
741
743
|
} | {
|
|
742
744
|
type: "organisation.read-locations";
|
|
743
745
|
options?: {
|
package/dist/scopes/index.js
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencrvs/toolkit",
|
|
3
|
-
"version": "2.1.0-rc.
|
|
3
|
+
"version": "2.1.0-rc.9dce8c0",
|
|
4
4
|
"description": "OpenCRVS toolkit for building country configurations",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "./build.sh",
|
|
21
|
-
"build:all": "lerna run build --include-dependencies --scope @opencrvs/toolkit
|
|
21
|
+
"build:all": "lerna run build --include-dependencies --scope @opencrvs/toolkit"
|
|
22
22
|
},
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"zod-openapi": "^5.4.6"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
+
"@opencrvs/commons": "^2.0.0",
|
|
54
55
|
"@opencrvs/events": "^2.0.0",
|
|
55
56
|
"@types/js-yaml": "4.0.9",
|
|
56
57
|
"@types/libsodium-wrappers": "^0.7.10",
|