@opencrvs/toolkit 2.0.1-rc.fed4de8 → 2.1.0-beta
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/README.md +16 -0
- package/build.sh +14 -5
- package/create-countryconfig/index.js +412 -59
- package/create-countryconfig/node_modules/.bin/degit +21 -0
- package/create-countryconfig/package.json +5 -2
- package/dist/application-config/index.js +369 -280
- package/dist/authentication/index.d.ts +67 -0
- package/dist/authentication/index.d.ts.map +1 -0
- package/dist/authentication/index.js +750 -0
- package/dist/cli.js +4619 -4737
- package/dist/commons/api/router.d.ts +4122 -2944
- package/dist/commons/application-config/index.d.ts +6 -6
- package/dist/commons/conditionals/conditionals.d.ts +32 -323
- package/dist/commons/conditionals/validate.d.ts +16 -5
- package/dist/commons/events/ActionConfig.d.ts +302 -67
- package/dist/commons/events/ActionDocument.d.ts +159 -121
- package/dist/commons/events/ActionInput.d.ts +30 -10
- package/dist/commons/events/ActionStatus.d.ts +14 -0
- package/dist/commons/events/ActionType.d.ts +63 -58
- package/dist/commons/events/AdvancedSearchConfig.d.ts +531 -495
- package/dist/commons/events/AuditLog.d.ts +189 -40
- package/dist/commons/events/CompositeFieldValue.d.ts +4 -4
- package/dist/commons/events/Conditional.d.ts +3 -3
- package/dist/commons/events/CountryConfigQueryInput.d.ts +603 -561
- package/dist/commons/events/Draft.d.ts +38 -36
- package/dist/commons/events/DynamicFieldValue.d.ts +9 -9
- package/dist/commons/events/EventConfig.d.ts +8 -3
- package/dist/commons/events/EventDocument.d.ts +537 -47
- package/dist/commons/events/EventIndex.d.ts +61 -59
- package/dist/commons/events/EventMetadata.d.ts +59 -43
- package/dist/commons/events/EventStatus.d.ts +19 -0
- package/dist/commons/events/FieldConfig.d.ts +424 -379
- package/dist/commons/events/FieldType.d.ts +51 -51
- package/dist/commons/events/FieldTypeMapping.d.ts +86 -86
- package/dist/commons/events/FieldValue.d.ts +14 -14
- package/dist/commons/events/Flag.d.ts +57 -15
- package/dist/commons/events/PlainDate.d.ts +8 -0
- package/dist/commons/events/SummaryConfig.d.ts +249 -0
- package/dist/commons/events/TemplateConfig.d.ts +1 -1
- package/dist/commons/events/WorkqueueColumnConfig.d.ts +40 -40
- package/dist/commons/events/WorkqueueConfig.d.ts +835 -790
- package/dist/commons/events/deduplication.d.ts +1 -1
- package/dist/commons/events/event.d.ts +14 -2
- package/dist/commons/events/field.d.ts +69 -198
- 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 +248 -14
- package/dist/commons/events/mocks.test.utils.d.ts +48 -4
- package/dist/commons/events/scopes.d.ts +5 -4
- package/dist/commons/events/state/index.d.ts +23 -15
- package/dist/commons/events/state/utils.d.ts +15 -6
- package/dist/commons/events/test.utils.d.ts +68 -42
- package/dist/commons/events/utils.d.ts +139 -106
- package/dist/commons/notification/UserNotifications.d.ts +38 -23
- package/dist/commons/notification/dispatch.d.ts +10 -0
- package/dist/commons/notification/index.d.ts +1 -0
- package/dist/conditionals/index.js +341 -66
- package/dist/csv.d.ts +25 -0
- package/dist/csv.d.ts.map +1 -0
- package/dist/csv.js +120 -0
- package/dist/environment/custom-types.d.ts +33 -0
- package/dist/environment/custom-types.d.ts.map +1 -0
- package/dist/environment/custom-types.js +12 -0
- package/dist/environment/derived-variables.d.ts +122 -0
- package/dist/environment/derived-variables.d.ts.map +1 -0
- package/dist/environment/derived-variables.js +155 -0
- package/dist/environment/editor-questions.d.ts +4 -0
- package/dist/environment/editor-questions.d.ts.map +1 -0
- package/dist/environment/editor-questions.js +67 -0
- package/dist/environment/git.d.ts +5 -0
- package/dist/environment/git.d.ts.map +1 -0
- package/dist/environment/git.js +38 -0
- package/dist/environment/github.d.ts +26 -0
- package/dist/environment/github.d.ts.map +1 -0
- package/dist/environment/github.js +247 -0
- package/dist/environment/index.d.ts +6 -0
- package/dist/environment/index.d.ts.map +1 -0
- package/dist/environment/index.js +81 -0
- package/dist/environment/logger.d.ts +18 -0
- package/dist/environment/logger.d.ts.map +1 -0
- package/dist/environment/logger.js +25 -0
- package/dist/environment/manage-users.d.ts +11 -0
- package/dist/environment/manage-users.d.ts.map +1 -0
- package/dist/environment/manage-users.js +507 -0
- package/dist/environment/paths.d.ts +7 -0
- package/dist/environment/paths.d.ts.map +1 -0
- package/dist/environment/paths.js +72 -0
- package/dist/environment/questions-helper.d.ts +15 -0
- package/dist/environment/questions-helper.d.ts.map +1 -0
- package/dist/environment/questions-helper.js +70 -0
- package/dist/environment/questions.d.ts +200 -0
- package/dist/environment/questions.d.ts.map +1 -0
- package/dist/environment/questions.js +418 -0
- package/dist/environment/setup-environment.d.ts +2 -0
- package/dist/environment/setup-environment.d.ts.map +1 -0
- package/dist/environment/setup-environment.js +795 -0
- package/dist/environment/ssh-keygen.d.ts +5 -0
- package/dist/environment/ssh-keygen.d.ts.map +1 -0
- package/dist/environment/ssh-keygen.js +21 -0
- package/dist/environment/swarm-to-k8s.d.ts +2 -0
- package/dist/environment/swarm-to-k8s.d.ts.map +1 -0
- package/dist/environment/swarm-to-k8s.js +183 -0
- package/dist/environment/templates.d.ts +27 -0
- package/dist/environment/templates.d.ts.map +1 -0
- package/dist/environment/templates.js +164 -0
- package/dist/environment/update-workflows.d.ts +2 -0
- package/dist/environment/update-workflows.d.ts.map +1 -0
- package/dist/environment/update-workflows.js +191 -0
- package/dist/environment/upgrade.d.ts +2 -0
- package/dist/environment/upgrade.d.ts.map +1 -0
- package/dist/environment/upgrade.js +82 -0
- package/dist/environment/users.d.ts +2 -0
- package/dist/environment/users.d.ts.map +1 -0
- package/dist/environment/users.js +120 -0
- package/dist/environment/utils.d.ts +18 -0
- package/dist/environment/utils.d.ts.map +1 -0
- package/dist/environment/utils.js +110 -0
- package/dist/events/deduplication.d.ts +1 -1
- package/dist/events/index.js +8106 -7390
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts +2 -2
- package/dist/migrations/v2.0/checkout-upstream-files.d.ts.map +1 -1
- package/dist/migrations/v2.0/checkout-upstream-files.js +2 -2
- package/dist/migrations/v2.0/convert-config-files-to-ts.js +17 -7
- package/dist/migrations/v2.0/index.js +88 -5141
- package/dist/migrations/v2.0/merge-infrastructure-directory.js +3 -3
- package/dist/migrations/v2.0/migrate-application-config-url.js +4 -3
- package/dist/migrations/v2.0/remove-hearth-migrations.js +17 -7
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts +3 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-explicit-correction-flags.js +234 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts +3 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-recovery-link-notifications.js +511 -0
- package/dist/migrations/v2.1/add-translations.d.ts +9 -0
- package/dist/migrations/v2.1/add-translations.d.ts.map +1 -0
- package/dist/migrations/v2.1/add-translations.js +213 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts +3 -0
- package/dist/migrations/v2.1/enable-telemetry.d.ts.map +1 -0
- package/dist/migrations/v2.1/enable-telemetry.js +438 -0
- package/dist/migrations/v2.1/index.d.ts +6 -0
- package/dist/migrations/v2.1/index.d.ts.map +1 -0
- package/dist/migrations/v2.1/index.js +1276 -0
- package/dist/notification/index.js +2011 -1446
- package/dist/scopes/index.d.ts +514 -168
- package/dist/scopes/index.js +342 -66
- package/dist/telemetry/index.d.ts +45 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +39 -0
- package/dist/templates/charts-values/dependencies/values.override.yaml +4 -0
- package/dist/templates/charts-values/dependencies/values.yaml +82 -0
- package/dist/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
- package/dist/templates/charts-values/opencrvs-services/values.yaml +78 -0
- package/dist/templates/charts-values/opentelemetry/values.yaml +95 -0
- package/dist/templates/charts-values/traefik/values.override.yaml +4 -0
- package/dist/templates/charts-values/traefik/values.yaml +129 -0
- package/dist/templates/inventory/inventory.template.yml +98 -0
- package/dist/translations/check.d.ts +19 -0
- package/dist/translations/check.d.ts.map +1 -0
- package/dist/translations/check.js +127 -0
- package/dist/verify/endpoints.d.ts +2 -0
- package/dist/verify/endpoints.d.ts.map +1 -0
- package/dist/verify/endpoints.js +345 -0
- package/opencrvs-toolkit-2.1.0-beta.tgz +0 -0
- package/package.json +25 -6
- package/tsconfig.build.json +11 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/opencrvs-toolkit-2.0.1-rc.fed4de8.tgz +0 -0
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UUID } from '../uuid';
|
|
2
2
|
import * as z from 'zod/v4';
|
|
3
|
+
import { PlainDate } from './PlainDate';
|
|
3
4
|
import { EventIndex } from './EventIndex';
|
|
4
5
|
import { ActionCreationMetadata, RegistrationCreationMetadata } from './EventMetadata';
|
|
5
6
|
import { RecordScopeV2, UserScopeV2 } from '../scopes';
|
|
@@ -7,16 +8,56 @@ import { SystemContext, UserContext } from '../users/User';
|
|
|
7
8
|
/** @deprecated Moving on, location types are arbitrary and defined by the country config. */
|
|
8
9
|
export declare const LocationTypeV1: z.ZodEnum<{
|
|
9
10
|
ADMIN_STRUCTURE: "ADMIN_STRUCTURE";
|
|
10
|
-
HEALTH_FACILITY: "HEALTH_FACILITY";
|
|
11
11
|
CRVS_OFFICE: "CRVS_OFFICE";
|
|
12
|
+
HEALTH_FACILITY: "HEALTH_FACILITY";
|
|
12
13
|
}>;
|
|
13
14
|
export type LocationTypeV1 = z.infer<typeof LocationTypeV1>;
|
|
15
|
+
export declare const LocationStatus: z.ZodEnum<{
|
|
16
|
+
active: "active";
|
|
17
|
+
inactive: "inactive";
|
|
18
|
+
}>;
|
|
19
|
+
export type LocationStatus = z.infer<typeof LocationStatus>;
|
|
20
|
+
/** Thrown when a user's assigned office is inactive and must not be allowed to authenticate. */
|
|
21
|
+
export declare class InactiveOfficeError extends Error {
|
|
22
|
+
constructor(message?: string);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A single element of the `versions` history of a location or administrative
|
|
26
|
+
* area. Versions are sorted ascending by `effectiveFrom` ('0001-01-01' is used
|
|
27
|
+
* as the beginning-of-time sentinel). Updates only ever append, but a
|
|
28
|
+
* not-yet-effective version can be withdrawn and seeding replaces a history
|
|
29
|
+
* wholesale, so the array is not append-only.
|
|
30
|
+
*/
|
|
31
|
+
export declare const LocationVersion: z.ZodObject<{
|
|
32
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
33
|
+
effectiveFrom: z.ZodISODate;
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
36
|
+
status: z.ZodEnum<{
|
|
37
|
+
active: "active";
|
|
38
|
+
inactive: "inactive";
|
|
39
|
+
}>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type LocationVersion = z.infer<typeof LocationVersion>;
|
|
14
42
|
export declare const AdministrativeArea: z.ZodObject<{
|
|
15
43
|
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
16
44
|
name: z.ZodString;
|
|
17
45
|
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
18
46
|
parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
19
|
-
|
|
47
|
+
status: z.ZodEnum<{
|
|
48
|
+
active: "active";
|
|
49
|
+
inactive: "inactive";
|
|
50
|
+
}>;
|
|
51
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
52
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
53
|
+
effectiveFrom: z.ZodISODate;
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
56
|
+
status: z.ZodEnum<{
|
|
57
|
+
active: "active";
|
|
58
|
+
inactive: "inactive";
|
|
59
|
+
}>;
|
|
60
|
+
}, z.core.$strip>>;
|
|
20
61
|
}, z.core.$strip>;
|
|
21
62
|
export type AdministrativeArea = z.infer<typeof AdministrativeArea>;
|
|
22
63
|
export declare const Location: z.ZodObject<{
|
|
@@ -24,10 +65,168 @@ export declare const Location: z.ZodObject<{
|
|
|
24
65
|
name: z.ZodString;
|
|
25
66
|
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
26
67
|
administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
27
|
-
validUntil: z.ZodNullable<z.ZodISODateTime>;
|
|
28
68
|
locationType: z.ZodNullable<z.ZodString>;
|
|
69
|
+
status: z.ZodEnum<{
|
|
70
|
+
active: "active";
|
|
71
|
+
inactive: "inactive";
|
|
72
|
+
}>;
|
|
73
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
74
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
75
|
+
effectiveFrom: z.ZodISODate;
|
|
76
|
+
name: z.ZodString;
|
|
77
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
|
+
status: z.ZodEnum<{
|
|
79
|
+
active: "active";
|
|
80
|
+
inactive: "inactive";
|
|
81
|
+
}>;
|
|
82
|
+
}, z.core.$strip>>;
|
|
29
83
|
}, z.core.$strip>;
|
|
30
84
|
export type Location = z.infer<typeof Location>;
|
|
85
|
+
/**
|
|
86
|
+
* TEMPORARY — client-side view of {@link AdministrativeArea} with the
|
|
87
|
+
* server-flattened `name`, `status` and `externalId` removed, leaving exactly
|
|
88
|
+
* identity + versions. Every name/status read is thereby forced through the
|
|
89
|
+
* anchored resolution utilities ({@link resolveVersion}, {@link resolvePath})
|
|
90
|
+
* at compile time. Delete this type when the contract migration removes the
|
|
91
|
+
* flat fields from the server schema, at which point the wire type itself
|
|
92
|
+
* becomes identity + versions.
|
|
93
|
+
*/
|
|
94
|
+
export declare const ClientAdministrativeArea: z.ZodObject<{
|
|
95
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
96
|
+
parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
97
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
98
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
99
|
+
effectiveFrom: z.ZodISODate;
|
|
100
|
+
name: z.ZodString;
|
|
101
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
102
|
+
status: z.ZodEnum<{
|
|
103
|
+
active: "active";
|
|
104
|
+
inactive: "inactive";
|
|
105
|
+
}>;
|
|
106
|
+
}, z.core.$strip>>;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
export type ClientAdministrativeArea = z.infer<typeof ClientAdministrativeArea>;
|
|
109
|
+
/**
|
|
110
|
+
* TEMPORARY — client-side view of {@link Location} with the server-flattened
|
|
111
|
+
* `name`, `status` and `externalId` removed, leaving exactly identity +
|
|
112
|
+
* versions. See {@link ClientAdministrativeArea} for the full rationale and
|
|
113
|
+
* deletion condition.
|
|
114
|
+
*/
|
|
115
|
+
export declare const ClientLocation: z.ZodObject<{
|
|
116
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
117
|
+
administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
118
|
+
locationType: z.ZodNullable<z.ZodString>;
|
|
119
|
+
versions: z.ZodArray<z.ZodObject<{
|
|
120
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
121
|
+
effectiveFrom: z.ZodISODate;
|
|
122
|
+
name: z.ZodString;
|
|
123
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
124
|
+
status: z.ZodEnum<{
|
|
125
|
+
active: "active";
|
|
126
|
+
inactive: "inactive";
|
|
127
|
+
}>;
|
|
128
|
+
}, z.core.$strip>>;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
export type ClientLocation = z.infer<typeof ClientLocation>;
|
|
131
|
+
/**
|
|
132
|
+
* Strips the server-flattened fields from a location as it enters the
|
|
133
|
+
* client's cached maps. The wire format keeps the flat fields for
|
|
134
|
+
* compatibility; the cache must not, or devices would keep rendering names
|
|
135
|
+
* flattened before a future-dated version takes effect.
|
|
136
|
+
*/
|
|
137
|
+
export declare function toClientLocation(location: Location): ClientLocation;
|
|
138
|
+
/** See {@link toClientLocation}. */
|
|
139
|
+
export declare function toClientAdministrativeArea(area: AdministrativeArea): ClientAdministrativeArea;
|
|
140
|
+
export declare const SeededLocationVersions: z.ZodArray<z.ZodObject<{
|
|
141
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
142
|
+
effectiveFrom: z.ZodISODate;
|
|
143
|
+
name: z.ZodString;
|
|
144
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
145
|
+
status: z.ZodEnum<{
|
|
146
|
+
active: "active";
|
|
147
|
+
inactive: "inactive";
|
|
148
|
+
}>;
|
|
149
|
+
}, z.core.$strip>>;
|
|
150
|
+
export type SeededLocationVersions = z.infer<typeof SeededLocationVersions>;
|
|
151
|
+
/**
|
|
152
|
+
* Input payload for the locations `set` mutation. Carries the seedable
|
|
153
|
+
* identity and hierarchy fields, plus an optional pre-built history.
|
|
154
|
+
*
|
|
155
|
+
* Last-write-wins on history: a repeated seed of the same row replaces its
|
|
156
|
+
* stored `versions`, so a caller that means to keep one has to send it every
|
|
157
|
+
* time. Seeding is only reachable while system initialisation is incomplete,
|
|
158
|
+
* so this replaces what an earlier seed attempt wrote, never a live history.
|
|
159
|
+
*/
|
|
160
|
+
export declare const SetLocationPayload: z.ZodObject<{
|
|
161
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
162
|
+
name: z.ZodString;
|
|
163
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
164
|
+
administrativeAreaId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
165
|
+
locationType: z.ZodNullable<z.ZodString>;
|
|
166
|
+
versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
167
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
168
|
+
effectiveFrom: z.ZodISODate;
|
|
169
|
+
name: z.ZodString;
|
|
170
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
171
|
+
status: z.ZodEnum<{
|
|
172
|
+
active: "active";
|
|
173
|
+
inactive: "inactive";
|
|
174
|
+
}>;
|
|
175
|
+
}, z.core.$strip>>>;
|
|
176
|
+
}, z.core.$strip>;
|
|
177
|
+
export type SetLocationPayload = z.infer<typeof SetLocationPayload>;
|
|
178
|
+
/**
|
|
179
|
+
* Input payload for the administrative areas `set` mutation. Twin of
|
|
180
|
+
* {@link SetLocationPayload}, including the optional pre-built `versions`
|
|
181
|
+
* history and the same semantics for omitting it.
|
|
182
|
+
*/
|
|
183
|
+
export declare const SetAdministrativeAreaPayload: z.ZodObject<{
|
|
184
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
185
|
+
name: z.ZodString;
|
|
186
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
187
|
+
parentId: z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
188
|
+
versions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
189
|
+
versionId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
190
|
+
effectiveFrom: z.ZodISODate;
|
|
191
|
+
name: z.ZodString;
|
|
192
|
+
externalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
193
|
+
status: z.ZodEnum<{
|
|
194
|
+
active: "active";
|
|
195
|
+
inactive: "inactive";
|
|
196
|
+
}>;
|
|
197
|
+
}, z.core.$strip>>>;
|
|
198
|
+
}, z.core.$strip>;
|
|
199
|
+
export type SetAdministrativeAreaPayload = z.infer<typeof SetAdministrativeAreaPayload>;
|
|
200
|
+
/**
|
|
201
|
+
* Resolves the version in effect at the given anchor date.
|
|
202
|
+
*
|
|
203
|
+
* Returns the element with the greatest `effectiveFrom` that is less than or
|
|
204
|
+
* equal to `anchor`, falling back to the earliest element when the anchor
|
|
205
|
+
* precedes all versions. Assumes `versions` is sorted ascending by
|
|
206
|
+
* `effectiveFrom`. Both `effectiveFrom` and `anchor` are 'YYYY-MM-DD' strings,
|
|
207
|
+
* so plain string comparison is correct.
|
|
208
|
+
*/
|
|
209
|
+
export declare function resolveVersion<T extends {
|
|
210
|
+
effectiveFrom: string;
|
|
211
|
+
}>(versions: T[], anchor: string): T;
|
|
212
|
+
/**
|
|
213
|
+
* Whether the entity is selectable at `anchor`: it must already have a
|
|
214
|
+
* version effective by then, and the version that resolves at `anchor` must
|
|
215
|
+
* be active. `resolveVersion` alone is not enough for this — when `anchor`
|
|
216
|
+
* precedes every version it falls back to the earliest one, which would
|
|
217
|
+
* otherwise make a location created after `anchor` look selectable.
|
|
218
|
+
*/
|
|
219
|
+
export declare function isSelectableAtAnchor<T extends {
|
|
220
|
+
effectiveFrom: string;
|
|
221
|
+
status: string;
|
|
222
|
+
}>(versions: T[], anchor: string): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Whether the entity holds the given externalId with active status at the
|
|
225
|
+
* anchor date or at any point after it. Used for point-in-time uniqueness of
|
|
226
|
+
* external codes: a new holder starting at `anchor` collides when an existing
|
|
227
|
+
* holder is (or is scheduled to be) active with the code from then on.
|
|
228
|
+
*/
|
|
229
|
+
export declare function hasActiveExternalIdOnOrAfter(versions: LocationVersion[], externalId: string, anchor: string): boolean;
|
|
31
230
|
type WrapArrayPreserveNullish<V> = V extends readonly any[] ? V : NonNullable<V>[] | Extract<V, null | undefined>;
|
|
32
231
|
/**
|
|
33
232
|
* For type T, convert fields K to arrays. If field is string, convert to string[].
|
|
@@ -40,6 +239,7 @@ type ToArrayFields<T, K extends PropertyKey> = T extends unknown ? T extends obj
|
|
|
40
239
|
*/
|
|
41
240
|
export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventIndex, 'createdAtLocation' | 'updatedAtLocation' | 'placeOfEvent'>, 'legalStatuses'> & {
|
|
42
241
|
legalStatuses: {
|
|
242
|
+
NOTIFIED: ToArrayFields<ActionCreationMetadata, 'createdAtLocation'> | undefined;
|
|
43
243
|
DECLARED: ToArrayFields<ActionCreationMetadata, 'createdAtLocation'> | undefined;
|
|
44
244
|
REGISTERED: ToArrayFields<RegistrationCreationMetadata, 'createdAtLocation'> | undefined;
|
|
45
245
|
};
|
|
@@ -51,7 +251,7 @@ export type EventIndexWithAdministrativeHierarchy = Omit<ToArrayFields<EventInde
|
|
|
51
251
|
* Return false early to break out of checks as soon as possible - if any option is not satisfied, the scope does not allow access to the event, so no need to check further options.
|
|
52
252
|
*
|
|
53
253
|
*/
|
|
54
|
-
export declare function canAccessEventWithScope(event:
|
|
254
|
+
export declare function canAccessEventWithScope(event: EventIndexWithAdministrativeHierarchy, scope: RecordScopeV2, user: UserContext | SystemContext, customActionType?: string): boolean;
|
|
55
255
|
export type UserWithResolvedHierarchy = {
|
|
56
256
|
role: string;
|
|
57
257
|
administrativeHierarchy: UUID[];
|
|
@@ -72,14 +272,11 @@ export declare function canAccessOtherUserWithScopes({ scopes, userToAccess, use
|
|
|
72
272
|
*
|
|
73
273
|
* One of the scopes must allow access for the event to be accessible.
|
|
74
274
|
*/
|
|
75
|
-
export declare function userCanAccessEventWithScopes(event:
|
|
76
|
-
export declare function getAdministrativeAreaHierarchy
|
|
77
|
-
id:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
validUntil: string | null;
|
|
81
|
-
externalId?: string | null | undefined;
|
|
82
|
-
}[];
|
|
275
|
+
export declare function userCanAccessEventWithScopes(event: EventIndexWithAdministrativeHierarchy, scopes: RecordScopeV2[], user: UserContext | SystemContext, customActionType?: string): boolean;
|
|
276
|
+
export declare function getAdministrativeAreaHierarchy<A extends {
|
|
277
|
+
id: UUID;
|
|
278
|
+
parentId: UUID | null;
|
|
279
|
+
}>(administrativeAreaId: string | undefined | null, administrativeAreas: Map<UUID, A>): A[];
|
|
83
280
|
/**
|
|
84
281
|
* Resolves a location or administrative area UUID into a root-first hierarchy of UUIDs.
|
|
85
282
|
*
|
|
@@ -91,8 +288,45 @@ export declare function getAdministrativeAreaHierarchy(administrativeAreaId: str
|
|
|
91
288
|
* so the result is reversed to match the root-first convention used by the server.
|
|
92
289
|
*/
|
|
93
290
|
export declare function getLocationHierarchy(selectedId: UUID, context: {
|
|
94
|
-
administrativeAreas: Map<UUID,
|
|
95
|
-
|
|
291
|
+
administrativeAreas: Map<UUID, {
|
|
292
|
+
id: UUID;
|
|
293
|
+
parentId: UUID | null;
|
|
294
|
+
}>;
|
|
295
|
+
locations: Map<UUID, {
|
|
296
|
+
id: UUID;
|
|
297
|
+
administrativeAreaId: UUID | null;
|
|
298
|
+
}>;
|
|
96
299
|
}): UUID[];
|
|
300
|
+
/**
|
|
301
|
+
* A node of an anchored hierarchy path: the identity id plus the name and
|
|
302
|
+
* status in effect at the anchor date.
|
|
303
|
+
*/
|
|
304
|
+
export type ResolvedPathNode = {
|
|
305
|
+
id: UUID;
|
|
306
|
+
name: string;
|
|
307
|
+
status: LocationStatus;
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Resolves a location or administrative area id into its root-first
|
|
311
|
+
* hierarchy path — leaf included — with every node's name and status
|
|
312
|
+
* resolved at the anchor date.
|
|
313
|
+
*
|
|
314
|
+
* The parent chain is identity-level and fixed for life, so the chain is
|
|
315
|
+
* constant and only each node's name/status varies with the anchor. Status is
|
|
316
|
+
* returned for callers that filter on it; an inactive node still resolves to
|
|
317
|
+
* its name. Returns an empty array for an unknown id.
|
|
318
|
+
*/
|
|
319
|
+
export declare function resolvePath(locationId: UUID, anchor: PlainDate, context: {
|
|
320
|
+
administrativeAreas: Map<UUID, {
|
|
321
|
+
id: UUID;
|
|
322
|
+
parentId: UUID | null;
|
|
323
|
+
versions: LocationVersion[];
|
|
324
|
+
}>;
|
|
325
|
+
locations: Map<UUID, {
|
|
326
|
+
id: UUID;
|
|
327
|
+
administrativeAreaId: UUID | null;
|
|
328
|
+
versions: LocationVersion[];
|
|
329
|
+
}>;
|
|
330
|
+
}): ResolvedPathNode[];
|
|
97
331
|
export {};
|
|
98
332
|
//# sourceMappingURL=locations.d.ts.map
|
|
@@ -4,16 +4,60 @@ export declare const V2_DEFAULT_MOCK_LOCATIONS: Location[];
|
|
|
4
4
|
export declare const V2_DEFAULT_MOCK_LOCATIONS_MAP: Map<string & import("zod").$brand<"UUID">, {
|
|
5
5
|
id: string & import("zod").$brand<"UUID">;
|
|
6
6
|
name: string;
|
|
7
|
+
externalId?: string | null | undefined;
|
|
7
8
|
administrativeAreaId: (string & import("zod").$brand<"UUID">) | null;
|
|
8
|
-
validUntil: string | null;
|
|
9
9
|
locationType: string | null;
|
|
10
|
-
|
|
10
|
+
status: "active" | "inactive";
|
|
11
|
+
versions: {
|
|
12
|
+
versionId: string & import("zod").$brand<"UUID">;
|
|
13
|
+
effectiveFrom: string;
|
|
14
|
+
name: string;
|
|
15
|
+
externalId?: string | null | undefined;
|
|
16
|
+
status: "active" | "inactive";
|
|
17
|
+
}[];
|
|
11
18
|
}>;
|
|
12
19
|
export declare const V2_DEFAULT_MOCK_ADMINISTRATIVE_AREAS_MAP: Map<string & import("zod").$brand<"UUID">, {
|
|
13
20
|
id: string & import("zod").$brand<"UUID">;
|
|
14
21
|
name: string;
|
|
15
|
-
parentId: (string & import("zod").$brand<"UUID">) | null;
|
|
16
|
-
validUntil: string | null;
|
|
17
22
|
externalId?: string | null | undefined;
|
|
23
|
+
parentId: (string & import("zod").$brand<"UUID">) | null;
|
|
24
|
+
status: "active" | "inactive";
|
|
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;
|
|
55
|
+
versions: {
|
|
56
|
+
versionId: string & import("zod").$brand<"UUID">;
|
|
57
|
+
effectiveFrom: string;
|
|
58
|
+
name: string;
|
|
59
|
+
externalId?: string | null | undefined;
|
|
60
|
+
status: "active" | "inactive";
|
|
61
|
+
}[];
|
|
18
62
|
}>;
|
|
19
63
|
//# sourceMappingURL=mocks.test.utils.d.ts.map
|
|
@@ -13,13 +13,14 @@ export declare const ACTION_SCOPE_MAP: {
|
|
|
13
13
|
DELETE: ("record.declare" | "record.notify")[];
|
|
14
14
|
REGISTER: "record.register"[];
|
|
15
15
|
PRINT_CERTIFICATE: "record.print-certified-copies"[];
|
|
16
|
-
REQUEST_CORRECTION: ("record.
|
|
16
|
+
REQUEST_CORRECTION: ("record.correct" | "record.request-correction")[];
|
|
17
17
|
REVIEW_CORRECTION_REQUEST: "record.correct"[];
|
|
18
18
|
REJECT_CORRECTION: "record.correct"[];
|
|
19
19
|
APPROVE_CORRECTION: "record.correct"[];
|
|
20
20
|
MARK_AS_DUPLICATE: "record.review-duplicates"[];
|
|
21
21
|
MARK_AS_NOT_DUPLICATE: "record.review-duplicates"[];
|
|
22
22
|
ARCHIVE: "record.archive"[];
|
|
23
|
+
UNARCHIVE: "record.unarchive"[];
|
|
23
24
|
REJECT: "record.reject"[];
|
|
24
25
|
ASSIGN: null;
|
|
25
26
|
UNASSIGN: null;
|
|
@@ -28,9 +29,9 @@ export declare const ACTION_SCOPE_MAP: {
|
|
|
28
29
|
};
|
|
29
30
|
export declare function hasAnyOfScopes(a: string[], b: string[]): boolean;
|
|
30
31
|
export declare const AssignmentStatus: {
|
|
31
|
-
readonly ASSIGNED_TO_SELF:
|
|
32
|
-
readonly ASSIGNED_TO_OTHERS:
|
|
33
|
-
readonly UNASSIGNED:
|
|
32
|
+
readonly ASSIGNED_TO_SELF: 'ASSIGNED_TO_SELF';
|
|
33
|
+
readonly ASSIGNED_TO_OTHERS: 'ASSIGNED_TO_OTHERS';
|
|
34
|
+
readonly UNASSIGNED: 'UNASSIGNED';
|
|
34
35
|
};
|
|
35
36
|
export type AssignmentStatus = (typeof AssignmentStatus)[keyof typeof AssignmentStatus];
|
|
36
37
|
export declare function getAssignmentStatus(eventState: EventIndex | EventIndexWithAdministrativeHierarchy, userId: string): AssignmentStatus;
|
|
@@ -7,7 +7,7 @@ import { Draft } from '../Draft';
|
|
|
7
7
|
import { EventConfig } from '../EventConfig';
|
|
8
8
|
import { UUID } from '../../uuid';
|
|
9
9
|
import { DocumentPath } from '../../documents';
|
|
10
|
-
export declare function getStatusFromActions(actions: Array<Action>): "
|
|
10
|
+
export declare function getStatusFromActions(actions: Array<Action>): "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED";
|
|
11
11
|
export declare function getAssignedUserFromActions(actions: Array<ActionDocument>): string | null;
|
|
12
12
|
type NonNullableDeep<T> = T extends [unknown, ...unknown[]] ? {
|
|
13
13
|
[K in keyof T]: NonNullableDeep<NonNullable<T[K]>>;
|
|
@@ -63,29 +63,45 @@ export declare function applyDeclarationToEventIndex(eventIndex: EventIndex, dec
|
|
|
63
63
|
export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Draft, eventConfiguration: EventConfig): {
|
|
64
64
|
id: string & import("zod").$brand<"UUID">;
|
|
65
65
|
type: string;
|
|
66
|
-
status: "
|
|
66
|
+
status: "ARCHIVED" | "CREATED" | "DECLARED" | "NOTIFIED" | "REGISTERED";
|
|
67
67
|
legalStatuses: {
|
|
68
|
-
|
|
68
|
+
NOTIFIED?: {
|
|
69
69
|
createdAt: string;
|
|
70
70
|
createdBy: string;
|
|
71
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
72
|
+
createdByUserType?: "system" | "user" | null | undefined;
|
|
71
73
|
acceptedAt: string;
|
|
74
|
+
createdByRole?: string | undefined;
|
|
75
|
+
} | null | undefined;
|
|
76
|
+
DECLARED?: {
|
|
77
|
+
createdAt: string;
|
|
78
|
+
createdBy: string;
|
|
72
79
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
73
|
-
createdByUserType?: "
|
|
80
|
+
createdByUserType?: "system" | "user" | null | undefined;
|
|
81
|
+
acceptedAt: string;
|
|
74
82
|
createdByRole?: string | undefined;
|
|
75
83
|
} | null | undefined;
|
|
76
84
|
REGISTERED?: {
|
|
77
85
|
createdAt: string;
|
|
78
86
|
createdBy: string;
|
|
79
|
-
acceptedAt: string;
|
|
80
|
-
registrationNumber: string;
|
|
81
87
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
82
|
-
createdByUserType?: "
|
|
88
|
+
createdByUserType?: "system" | "user" | null | undefined;
|
|
89
|
+
acceptedAt: string;
|
|
83
90
|
createdByRole?: string | undefined;
|
|
91
|
+
registrationNumber: string;
|
|
84
92
|
} | null | undefined;
|
|
85
93
|
};
|
|
86
94
|
createdAt: string;
|
|
95
|
+
dateOfEvent?: string | null | undefined;
|
|
96
|
+
placeOfEvent?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
87
97
|
createdBy: string;
|
|
98
|
+
createdByUserType?: "system" | "user" | null | undefined;
|
|
99
|
+
updatedByUserRole?: string | null | undefined;
|
|
100
|
+
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
101
|
+
updatedAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
88
102
|
updatedAt: string;
|
|
103
|
+
assignedTo?: string | null | undefined;
|
|
104
|
+
updatedBy?: string | null | undefined;
|
|
89
105
|
trackingId: string;
|
|
90
106
|
potentialDuplicates: {
|
|
91
107
|
id: string & import("zod").$brand<"UUID">;
|
|
@@ -93,14 +109,6 @@ export declare function applyDraftToEventIndex(eventIndex: EventIndex, draft: Dr
|
|
|
93
109
|
}[];
|
|
94
110
|
flags: string[];
|
|
95
111
|
declaration: Record<string, import("..").FieldValue>;
|
|
96
|
-
dateOfEvent?: string | null | undefined;
|
|
97
|
-
placeOfEvent?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
98
|
-
createdByUserType?: "user" | "system" | null | undefined;
|
|
99
|
-
updatedByUserRole?: string | null | undefined;
|
|
100
|
-
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
101
|
-
updatedAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
102
|
-
assignedTo?: string | null | undefined;
|
|
103
|
-
updatedBy?: string | null | undefined;
|
|
104
112
|
};
|
|
105
113
|
/**
|
|
106
114
|
* Annotation is always specific to the action. when action with annotation is triggered multiple times,
|
|
@@ -14,26 +14,35 @@ import { Action } from '../ActionDocument';
|
|
|
14
14
|
export declare function getActionUpdateMetadata(actions: Action[]): Pick<{
|
|
15
15
|
id: string & import("zod").$brand<"UUID">;
|
|
16
16
|
transactionId: string;
|
|
17
|
-
createdByUserType: "
|
|
17
|
+
createdByUserType: "system" | "user";
|
|
18
18
|
createdAt: string;
|
|
19
19
|
createdBy: string;
|
|
20
|
-
declaration: Record<string, import("..").FieldUpdateValue>;
|
|
21
|
-
status: "Requested" | "Accepted" | "Rejected";
|
|
22
20
|
createdByRole?: string | undefined;
|
|
23
21
|
createdBySignature?: (string & import("zod").$brand<"DocumentPath">) | null | undefined;
|
|
24
22
|
createdAtLocation?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
23
|
+
declaration: Record<string, import("..").FieldUpdateValue>;
|
|
25
24
|
annotation?: Record<string, import("..").FieldUpdateValue> | null | undefined;
|
|
25
|
+
status: "Accepted" | "Rejected" | "Requested";
|
|
26
26
|
originalActionId?: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
27
|
-
}, "
|
|
27
|
+
}, "createdAt" | "createdAtLocation" | "createdBy" | "createdByRole" | "createdByUserType">;
|
|
28
28
|
/**
|
|
29
29
|
* @returns the legal statuses of the event. Event is considered legal if it has been accepted.
|
|
30
30
|
* @see EventIndex for the description of the returned object.
|
|
31
31
|
*/
|
|
32
32
|
export declare function getLegalStatuses(actions: Action[]): {
|
|
33
|
+
NOTIFIED: {
|
|
34
|
+
createdAt: string;
|
|
35
|
+
createdBy: string;
|
|
36
|
+
createdByUserType: "system" | "user";
|
|
37
|
+
createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
38
|
+
acceptedAt: string;
|
|
39
|
+
createdByRole: string | undefined;
|
|
40
|
+
registrationNumber: string | null | undefined;
|
|
41
|
+
} | null;
|
|
33
42
|
DECLARED: {
|
|
34
43
|
createdAt: string;
|
|
35
44
|
createdBy: string;
|
|
36
|
-
createdByUserType: "
|
|
45
|
+
createdByUserType: "system" | "user";
|
|
37
46
|
createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
38
47
|
acceptedAt: string;
|
|
39
48
|
createdByRole: string | undefined;
|
|
@@ -42,7 +51,7 @@ export declare function getLegalStatuses(actions: Action[]): {
|
|
|
42
51
|
REGISTERED: {
|
|
43
52
|
createdAt: string;
|
|
44
53
|
createdBy: string;
|
|
45
|
-
createdByUserType: "
|
|
54
|
+
createdByUserType: "system" | "user";
|
|
46
55
|
createdAtLocation: (string & import("zod").$brand<"UUID">) | null | undefined;
|
|
47
56
|
acceptedAt: string;
|
|
48
57
|
createdByRole: string | undefined;
|