@opencrvs/toolkit 2.2.0-rc.1a111f2 → 2.2.0-rc.25c3c81
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/build.sh +15 -2
- package/dist/application-config/index.js +16 -5
- package/dist/authentication/index.d.ts +1 -1
- package/dist/authentication/index.js +4 -8
- package/dist/cli.js +1109 -25
- package/dist/commons/api/router.d.ts +13 -0
- package/dist/commons/application-config/index.d.ts +1 -1
- package/dist/commons/conditionals/conditionals.d.ts +4 -4
- package/dist/commons/conditionals/validate.d.ts +1 -1
- package/dist/commons/events/ActionStatus.d.ts +2 -2
- package/dist/commons/events/EventConfig.d.ts +66 -5
- package/dist/commons/events/EventDocument.d.ts +2 -0
- package/dist/commons/events/EventIndex.d.ts +1 -0
- package/dist/commons/events/EventInput.d.ts +1 -0
- package/dist/commons/events/EventMetadata.d.ts +1 -0
- package/dist/commons/events/FieldTypeMapping.d.ts +19 -19
- package/dist/commons/events/PlainDate.d.ts +5 -0
- package/dist/commons/events/defineConfig.d.ts +1 -1
- package/dist/commons/events/locations.d.ts +1 -1
- package/dist/commons/events/scopes.d.ts +1 -1
- package/dist/commons/events/state/index.d.ts +1 -0
- package/dist/commons/events/test.utils.d.ts +2 -1
- package/dist/commons/events/utils.d.ts +15 -2
- package/dist/commons/users/Role.d.ts +23 -0
- package/dist/commons/users/User.d.ts +263 -0
- package/dist/commons/users/authentication.d.ts +67 -0
- package/dist/commons/users/index.d.ts +5 -0
- package/dist/commons/users/roleValidations.d.ts +15 -0
- package/dist/commons/users/scopes.d.ts +1402 -0
- package/dist/commons/users/userReferences.d.ts +176 -0
- package/dist/conditionals/index.js +3 -3
- package/dist/configurator/index.d.ts +24 -0
- package/dist/configurator/index.d.ts.map +1 -0
- package/dist/configurator/index.js +161 -0
- package/dist/configurator/layout.d.ts +28 -0
- package/dist/configurator/layout.d.ts.map +1 -0
- package/dist/configurator/layout.js +78 -0
- package/dist/configurator/paths.d.ts +13 -0
- package/dist/configurator/paths.d.ts.map +1 -0
- package/dist/configurator/paths.js +48 -0
- package/dist/configurator/server/environments.d.ts +20 -0
- package/dist/configurator/server/environments.d.ts.map +1 -0
- package/dist/configurator/server/environments.js +143 -0
- package/dist/configurator/server/files.d.ts +11 -0
- package/dist/configurator/server/files.d.ts.map +1 -0
- package/dist/configurator/server/files.js +67 -0
- package/dist/configurator/server/github.d.ts +56 -0
- package/dist/configurator/server/github.d.ts.map +1 -0
- package/dist/configurator/server/github.js +239 -0
- package/dist/configurator/server/plugin.d.ts +39 -0
- package/dist/configurator/server/plugin.d.ts.map +1 -0
- package/dist/configurator/server/plugin.js +298 -0
- package/dist/configurator/server/seal.d.ts +2 -0
- package/dist/configurator/server/seal.d.ts.map +1 -0
- package/dist/configurator/server/seal.js +36 -0
- package/dist/configurator/server/sshKeys.d.ts +5 -0
- package/dist/configurator/server/sshKeys.d.ts.map +1 -0
- package/dist/configurator/server/sshKeys.js +28 -0
- package/dist/configurator/server/start.d.ts +12 -0
- package/dist/configurator/server/start.d.ts.map +1 -0
- package/dist/configurator/server/start.js +91 -0
- package/dist/configurator/testing.d.ts +11 -0
- package/dist/configurator/testing.d.ts.map +1 -0
- package/dist/configurator/testing.js +74 -0
- package/dist/configurator/ui/bindings/bindings.d.ts +35 -0
- package/dist/configurator/ui/bindings/bindings.d.ts.map +1 -0
- package/dist/configurator/ui/bindings/bindings.js +5 -0
- package/dist/configurator/ui/bindings/parsers.d.ts +7 -0
- package/dist/configurator/ui/bindings/parsers.d.ts.map +1 -0
- package/dist/configurator/ui/bindings/parsers.js +85 -0
- package/dist/configurator/ui/form/users.d.ts +11 -0
- package/dist/configurator/ui/form/users.d.ts.map +1 -0
- package/dist/configurator/ui/form/users.js +33 -0
- package/dist/configurator/ui/plan/dependencyHosts.d.ts +2 -0
- package/dist/configurator/ui/plan/dependencyHosts.d.ts.map +1 -0
- package/dist/configurator/ui/plan/dependencyHosts.js +36 -0
- package/dist/configurator/ui/plan/templateValues.d.ts +11 -0
- package/dist/configurator/ui/plan/templateValues.d.ts.map +1 -0
- package/dist/configurator/ui/plan/templateValues.js +70 -0
- package/dist/configurator/workflows.d.ts +53 -0
- package/dist/configurator/workflows.d.ts.map +1 -0
- package/dist/configurator/workflows.js +161 -0
- package/dist/configurator-assets/forms/bindings.yml +263 -0
- package/dist/configurator-assets/templates/README.md +18 -0
- package/dist/configurator-assets/templates/charts-values/dependencies/values.override.yaml +4 -0
- package/dist/configurator-assets/templates/charts-values/dependencies/values.yaml +99 -0
- package/dist/configurator-assets/templates/charts-values/opencrvs-services/values.override.yaml +4 -0
- package/dist/configurator-assets/templates/charts-values/opencrvs-services/values.yaml +83 -0
- package/dist/configurator-assets/templates/charts-values/opentelemetry/values.yaml +102 -0
- package/dist/configurator-assets/templates/charts-values/traefik/values.override.yaml +4 -0
- package/dist/configurator-assets/templates/charts-values/traefik/values.yaml +130 -0
- package/dist/configurator-assets/templates/inventory/inventory.template.yml +98 -0
- package/dist/configurator-assets/ui/apple-touch-icon.png +0 -0
- package/dist/configurator-assets/ui/assets/index-Bf3eC7uO.js +169 -0
- package/dist/configurator-assets/ui/assets/index-CaqYFJUk.css +6 -0
- package/dist/configurator-assets/ui/assets/opencrvs-logo-sIjz08HT.svg +1 -0
- package/dist/configurator-assets/ui/assets/poppins-400-BwTUGeWf.woff2 +0 -0
- package/dist/configurator-assets/ui/assets/poppins-500-CWICHMj6.woff2 +0 -0
- package/dist/configurator-assets/ui/assets/poppins-600-DJVo7c07.woff2 +0 -0
- package/dist/configurator-assets/ui/assets/poppins-700-g9MkRaG0.woff2 +0 -0
- package/dist/configurator-assets/ui/favicon-32x32.png +0 -0
- package/dist/configurator-assets/ui/index.html +25 -0
- package/dist/environment/setup-environment.d.ts.map +1 -1
- package/dist/environment/setup-environment.js +6 -0
- package/dist/events/index.js +188 -65
- package/dist/notification/index.js +124 -48
- package/dist/roles/index.d.ts +2 -0
- package/dist/roles/index.d.ts.map +1 -0
- package/dist/roles/index.js +730 -0
- package/dist/scopes/index.d.ts +0 -10
- package/dist/scopes/index.js +3 -7
- package/dist/templates/charts-values/dependencies/values.yaml +2 -0
- package/opencrvs-toolkit-2.2.0-rc.25c3c81.tgz +0 -0
- package/package.json +15 -3
- package/tsconfig.build.json +11 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +15 -6
- package/opencrvs-toolkit-2.2.0-rc.1a111f2.tgz +0 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import * as z from 'zod/v4';
|
|
2
|
+
import { UUID } from '../uuid';
|
|
3
|
+
import { FieldValue } from '../events';
|
|
4
|
+
export declare const REINDEX_USER_ID: UUID;
|
|
5
|
+
/**
|
|
6
|
+
* Subject of the short-lived bootstrap token countryconfig uses to register
|
|
7
|
+
* integrations on startup. Must be a well-formed UUID so it can be resolved as
|
|
8
|
+
* a `SystemContext` by services verifying the token — hence the v4 version and
|
|
9
|
+
* variant nibbles rather than an all-zero sentinel like `REINDEX_USER_ID`.
|
|
10
|
+
*/
|
|
11
|
+
export declare const INTEGRATION_CREATOR_USER_ID: UUID;
|
|
12
|
+
export declare const UserName: z.ZodObject<{
|
|
13
|
+
firstname: z.ZodString;
|
|
14
|
+
surname: z.ZodString;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export declare const User: z.ZodObject<{
|
|
17
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
18
|
+
name: z.ZodObject<{
|
|
19
|
+
firstname: z.ZodString;
|
|
20
|
+
surname: z.ZodString;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
role: z.ZodString;
|
|
23
|
+
avatar: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">>;
|
|
24
|
+
signature: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">>>;
|
|
25
|
+
primaryOfficeId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
26
|
+
administrativeAreaId: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
27
|
+
device: z.ZodOptional<z.ZodString>;
|
|
28
|
+
fullHonorificName: z.ZodOptional<z.ZodString>;
|
|
29
|
+
type: z.ZodEnum<{
|
|
30
|
+
user: "user";
|
|
31
|
+
}>;
|
|
32
|
+
mobile: z.ZodOptional<z.ZodString>;
|
|
33
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
34
|
+
status: z.ZodEnum<{
|
|
35
|
+
active: "active";
|
|
36
|
+
deactivated: "deactivated";
|
|
37
|
+
pending: "pending";
|
|
38
|
+
}>;
|
|
39
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<FieldValue, unknown, z.core.$ZodTypeInternals<FieldValue, unknown>>>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type User = z.infer<typeof User>;
|
|
42
|
+
export declare const UserSummary: z.ZodObject<{
|
|
43
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
44
|
+
name: z.ZodObject<{
|
|
45
|
+
firstname: z.ZodString;
|
|
46
|
+
surname: z.ZodString;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
role: z.ZodString;
|
|
49
|
+
avatar: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">>;
|
|
50
|
+
primaryOfficeId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
51
|
+
administrativeAreaId: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
52
|
+
fullHonorificName: z.ZodOptional<z.ZodString>;
|
|
53
|
+
type: z.ZodEnum<{
|
|
54
|
+
user: "user";
|
|
55
|
+
}>;
|
|
56
|
+
}, z.core.$strip>;
|
|
57
|
+
export type UserSummary = z.infer<typeof UserSummary>;
|
|
58
|
+
export type UserName = User['name'];
|
|
59
|
+
export declare const CreateUserInput: z.ZodObject<{
|
|
60
|
+
name: z.ZodObject<{
|
|
61
|
+
firstname: z.ZodString;
|
|
62
|
+
surname: z.ZodString;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
role: z.ZodString;
|
|
65
|
+
primaryOfficeId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
66
|
+
device: z.ZodOptional<z.ZodString>;
|
|
67
|
+
fullHonorificName: z.ZodOptional<z.ZodString>;
|
|
68
|
+
mobile: z.ZodOptional<z.ZodString>;
|
|
69
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
70
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<FieldValue, unknown, z.core.$ZodTypeInternals<FieldValue, unknown>>>>;
|
|
71
|
+
username: z.ZodOptional<z.ZodUndefined>;
|
|
72
|
+
password: z.ZodOptional<z.ZodUndefined>;
|
|
73
|
+
signature: z.ZodOptional<z.ZodObject<{
|
|
74
|
+
path: z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">;
|
|
75
|
+
originalFilename: z.ZodString;
|
|
76
|
+
type: z.ZodString;
|
|
77
|
+
}, z.core.$strip>>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
export type CreateUserInput = z.infer<typeof CreateUserInput>;
|
|
80
|
+
export declare const UpdateUserInput: z.ZodObject<{
|
|
81
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
82
|
+
firstname: z.ZodString;
|
|
83
|
+
surname: z.ZodString;
|
|
84
|
+
}, z.core.$strip>>;
|
|
85
|
+
role: z.ZodOptional<z.ZodString>;
|
|
86
|
+
primaryOfficeId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
87
|
+
device: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
88
|
+
fullHonorificName: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
89
|
+
mobile: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
90
|
+
email: z.ZodOptional<z.ZodOptional<z.ZodEmail>>;
|
|
91
|
+
data: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<FieldValue, unknown, z.core.$ZodTypeInternals<FieldValue, unknown>>>>>;
|
|
92
|
+
signature: z.ZodOptional<z.ZodObject<{
|
|
93
|
+
path: z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">;
|
|
94
|
+
originalFilename: z.ZodString;
|
|
95
|
+
type: z.ZodString;
|
|
96
|
+
}, z.core.$strip>>;
|
|
97
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
98
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
99
|
+
active: "active";
|
|
100
|
+
deactivated: "deactivated";
|
|
101
|
+
}>>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
export type UpdateUserInput = z.infer<typeof UpdateUserInput>;
|
|
104
|
+
export declare const MIN_USERNAME_LENGTH = 5;
|
|
105
|
+
export declare const MAX_USERNAME_LENGTH = 30;
|
|
106
|
+
export declare const CreateUserInputInternal: z.ZodObject<{
|
|
107
|
+
name: z.ZodObject<{
|
|
108
|
+
firstname: z.ZodString;
|
|
109
|
+
surname: z.ZodString;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
role: z.ZodString;
|
|
112
|
+
primaryOfficeId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
113
|
+
mobile: z.ZodOptional<z.ZodString>;
|
|
114
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
115
|
+
username: z.ZodString;
|
|
116
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
117
|
+
active: "active";
|
|
118
|
+
}>>;
|
|
119
|
+
password: z.ZodOptional<z.ZodString>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
export type CreateUserInputInternal = z.infer<typeof CreateUserInputInternal>;
|
|
122
|
+
export declare const System: z.ZodObject<{
|
|
123
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
124
|
+
name: z.ZodString;
|
|
125
|
+
type: z.ZodEnum<{
|
|
126
|
+
system: "system";
|
|
127
|
+
}>;
|
|
128
|
+
primaryOfficeId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
129
|
+
administrativeAreaId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
130
|
+
signature: z.ZodOptional<z.ZodUndefined>;
|
|
131
|
+
avatar: z.ZodOptional<z.ZodUndefined>;
|
|
132
|
+
fullHonorificName: z.ZodOptional<z.ZodString>;
|
|
133
|
+
legacyId: z.ZodOptional<z.ZodString>;
|
|
134
|
+
status: z.ZodOptional<z.ZodUndefined>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
export type System = z.infer<typeof System>;
|
|
137
|
+
export declare const SystemSummary: z.ZodObject<{
|
|
138
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
139
|
+
name: z.ZodString;
|
|
140
|
+
type: z.ZodEnum<{
|
|
141
|
+
system: "system";
|
|
142
|
+
}>;
|
|
143
|
+
primaryOfficeId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
144
|
+
administrativeAreaId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
145
|
+
}, z.core.$strip>;
|
|
146
|
+
export declare const UserOrSystem: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
147
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
148
|
+
name: z.ZodObject<{
|
|
149
|
+
firstname: z.ZodString;
|
|
150
|
+
surname: z.ZodString;
|
|
151
|
+
}, z.core.$strip>;
|
|
152
|
+
role: z.ZodString;
|
|
153
|
+
avatar: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">>;
|
|
154
|
+
signature: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">>>;
|
|
155
|
+
primaryOfficeId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
156
|
+
administrativeAreaId: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
157
|
+
device: z.ZodOptional<z.ZodString>;
|
|
158
|
+
fullHonorificName: z.ZodOptional<z.ZodString>;
|
|
159
|
+
type: z.ZodEnum<{
|
|
160
|
+
user: "user";
|
|
161
|
+
}>;
|
|
162
|
+
mobile: z.ZodOptional<z.ZodString>;
|
|
163
|
+
email: z.ZodOptional<z.ZodEmail>;
|
|
164
|
+
status: z.ZodEnum<{
|
|
165
|
+
active: "active";
|
|
166
|
+
deactivated: "deactivated";
|
|
167
|
+
pending: "pending";
|
|
168
|
+
}>;
|
|
169
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<FieldValue, unknown, z.core.$ZodTypeInternals<FieldValue, unknown>>>>;
|
|
170
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
171
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
172
|
+
name: z.ZodString;
|
|
173
|
+
type: z.ZodEnum<{
|
|
174
|
+
system: "system";
|
|
175
|
+
}>;
|
|
176
|
+
primaryOfficeId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
177
|
+
administrativeAreaId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
178
|
+
signature: z.ZodOptional<z.ZodUndefined>;
|
|
179
|
+
avatar: z.ZodOptional<z.ZodUndefined>;
|
|
180
|
+
fullHonorificName: z.ZodOptional<z.ZodString>;
|
|
181
|
+
legacyId: z.ZodOptional<z.ZodString>;
|
|
182
|
+
status: z.ZodOptional<z.ZodUndefined>;
|
|
183
|
+
}, z.core.$strip>], "type">;
|
|
184
|
+
export type UserOrSystem = z.infer<typeof UserOrSystem>;
|
|
185
|
+
export declare const UserOrSystemSummary: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
186
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
187
|
+
name: z.ZodObject<{
|
|
188
|
+
firstname: z.ZodString;
|
|
189
|
+
surname: z.ZodString;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
role: z.ZodString;
|
|
192
|
+
avatar: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">>;
|
|
193
|
+
primaryOfficeId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
194
|
+
administrativeAreaId: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
195
|
+
fullHonorificName: z.ZodOptional<z.ZodString>;
|
|
196
|
+
type: z.ZodEnum<{
|
|
197
|
+
user: "user";
|
|
198
|
+
}>;
|
|
199
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
200
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
201
|
+
name: z.ZodString;
|
|
202
|
+
type: z.ZodEnum<{
|
|
203
|
+
system: "system";
|
|
204
|
+
}>;
|
|
205
|
+
primaryOfficeId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
206
|
+
administrativeAreaId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
207
|
+
}, z.core.$strip>], "type">;
|
|
208
|
+
export declare const UserOrSystemSummaryWithStatus: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
209
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
210
|
+
name: z.ZodObject<{
|
|
211
|
+
firstname: z.ZodString;
|
|
212
|
+
surname: z.ZodString;
|
|
213
|
+
}, z.core.$strip>;
|
|
214
|
+
role: z.ZodString;
|
|
215
|
+
avatar: z.ZodOptional<z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">>;
|
|
216
|
+
primaryOfficeId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
217
|
+
administrativeAreaId: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
218
|
+
fullHonorificName: z.ZodOptional<z.ZodString>;
|
|
219
|
+
type: z.ZodEnum<{
|
|
220
|
+
user: "user";
|
|
221
|
+
}>;
|
|
222
|
+
status: z.ZodEnum<{
|
|
223
|
+
active: "active";
|
|
224
|
+
deactivated: "deactivated";
|
|
225
|
+
pending: "pending";
|
|
226
|
+
}>;
|
|
227
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
228
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
229
|
+
name: z.ZodString;
|
|
230
|
+
type: z.ZodEnum<{
|
|
231
|
+
system: "system";
|
|
232
|
+
}>;
|
|
233
|
+
primaryOfficeId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
234
|
+
administrativeAreaId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
235
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
236
|
+
active: "active";
|
|
237
|
+
deactivated: "deactivated";
|
|
238
|
+
pending: "pending";
|
|
239
|
+
}>>;
|
|
240
|
+
}, z.core.$strip>], "type">;
|
|
241
|
+
export type UserOrSystemSummary = z.infer<typeof UserOrSystemSummary>;
|
|
242
|
+
export declare const UserContext: z.ZodObject<{
|
|
243
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
244
|
+
role: z.ZodString;
|
|
245
|
+
signature: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodString, "DocumentPath", "out">>>;
|
|
246
|
+
primaryOfficeId: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
247
|
+
administrativeAreaId: z.ZodOptional<z.ZodNullable<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>>;
|
|
248
|
+
type: z.ZodEnum<{
|
|
249
|
+
user: "user";
|
|
250
|
+
}>;
|
|
251
|
+
}, z.core.$strip>;
|
|
252
|
+
export type UserContext = z.infer<typeof UserContext>;
|
|
253
|
+
export declare const SystemContext: z.ZodObject<{
|
|
254
|
+
id: z.core.$ZodBranded<z.ZodUUID, "UUID", "out">;
|
|
255
|
+
type: z.ZodEnum<{
|
|
256
|
+
system: "system";
|
|
257
|
+
}>;
|
|
258
|
+
primaryOfficeId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
259
|
+
administrativeAreaId: z.ZodOptional<z.core.$ZodBranded<z.ZodUUID, "UUID", "out">>;
|
|
260
|
+
signature: z.ZodOptional<z.ZodUndefined>;
|
|
261
|
+
}, z.core.$strip>;
|
|
262
|
+
export type SystemContext = z.infer<typeof SystemContext>;
|
|
263
|
+
//# sourceMappingURL=User.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Nominal } from '../nominal';
|
|
2
|
+
import * as z from 'zod/v4';
|
|
3
|
+
import { ScopeType, Scope, EncodedScope } from './scopes';
|
|
4
|
+
export * from './scopes';
|
|
5
|
+
/**
|
|
6
|
+
* Returns an array of accepted scopes from a JWT token, filtered by the given accepted scope types.
|
|
7
|
+
*
|
|
8
|
+
* @param token - The JWT token containing scope definitions.
|
|
9
|
+
* @param acceptedScopes - An array of acceptable scope types to filter by.
|
|
10
|
+
* @returns An array of parsed RecordScopeV2 objects that are found in the token and match the accepted scope types.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getAcceptedScopesFromToken<T extends ScopeType>(token: string, acceptedScopes: T[]): Array<Extract<Scope, {
|
|
13
|
+
type: T;
|
|
14
|
+
}>>;
|
|
15
|
+
export declare const TokenUserType: z.ZodEnum<{
|
|
16
|
+
system: "system";
|
|
17
|
+
user: "user";
|
|
18
|
+
}>;
|
|
19
|
+
export type TokenUserType = z.infer<typeof TokenUserType>;
|
|
20
|
+
export interface ITokenPayload {
|
|
21
|
+
sub: string;
|
|
22
|
+
exp: string;
|
|
23
|
+
algorithm: string;
|
|
24
|
+
scope: EncodedScope[];
|
|
25
|
+
role?: string;
|
|
26
|
+
userType: TokenUserType;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Depending on how the API is called, there might or might not be Bearer keyword in the header.
|
|
30
|
+
* To allow for usage with both direct HTTP calls and TRPC, ensure it's present to be able to use shared scope auth functions.
|
|
31
|
+
*/
|
|
32
|
+
export declare function setBearerForToken(token: string): string;
|
|
33
|
+
export declare function getScopes(token: string): EncodedScope[];
|
|
34
|
+
export declare const getTokenPayload: (token: string) => ITokenPayload;
|
|
35
|
+
export declare const getUserId: (token: TokenWithBearer) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Extracts the subject (user ID) from a raw JWT string (without Bearer prefix).
|
|
38
|
+
* Returns null if the token cannot be decoded.
|
|
39
|
+
*/
|
|
40
|
+
export declare const getUserIdFromToken: (token: string) => string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Fixed subject (`sub`) of the service token that core's auth service mints at `GET /internal/service-token`.
|
|
43
|
+
* Core uses it for service-to-service calls where no user is involved.
|
|
44
|
+
*
|
|
45
|
+
* Must be a well-formed UUID so a service verifying the token can resolve it as
|
|
46
|
+
* a `SystemContext` as with `INTEGRATION_CREATOR_USER_ID` / `REINDEX_USER_ID`.
|
|
47
|
+
*
|
|
48
|
+
* See packages/auth/src/features/serviceToken/handler.ts
|
|
49
|
+
*/
|
|
50
|
+
export declare const SERVICE_USER_ID = "00000000-0000-4000-8000-000000000002";
|
|
51
|
+
/**
|
|
52
|
+
* True when a decoded token payload (e.g. Hapi's `request.auth.credentials`)
|
|
53
|
+
* belongs to core's service token, identified by its fixed subject. A country
|
|
54
|
+
* configuration uses this to accept core's own service-to-service calls (e.g.
|
|
55
|
+
* telemetry, all-user broadcasts) while rejecting any logged-in user's token.
|
|
56
|
+
*
|
|
57
|
+
* Accepts `unknown` so loosely-typed framework credentials can be passed
|
|
58
|
+
* directly without a cast; anything that is not an object with the matching
|
|
59
|
+
* `sub` yields `false`.
|
|
60
|
+
*/
|
|
61
|
+
export declare function isServiceToken(credentials: unknown): boolean;
|
|
62
|
+
export declare const getUserTypeFromToken: (token: TokenWithBearer) => TokenUserType;
|
|
63
|
+
export declare const TokenWithBearer: z.ZodType<`Bearer ${string}`>;
|
|
64
|
+
export type TokenWithBearer = z.infer<typeof TokenWithBearer>;
|
|
65
|
+
export type Token = Nominal<string, 'TokenWithoutBearer'>;
|
|
66
|
+
export declare function isTokenWithBearer(value: unknown): value is TokenWithBearer;
|
|
67
|
+
//# sourceMappingURL=authentication.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { VersionedEventConfig } from '../events/EventConfig';
|
|
2
|
+
import { Role, Roles } from './Role';
|
|
3
|
+
/**
|
|
4
|
+
* @returns a message for each rule the role breaks, empty when it is valid.
|
|
5
|
+
*/
|
|
6
|
+
export declare function validateRole(role: Role, eventConfigs: VersionedEventConfig[]): string[];
|
|
7
|
+
/**
|
|
8
|
+
* Validates roles, to ensure roles fill certain application requirements.
|
|
9
|
+
*
|
|
10
|
+
* @param roles Array of roles in object format.
|
|
11
|
+
* @param eventConfigs Array of event configurations, which are needed to run validations for scopes.
|
|
12
|
+
* @throws Error if roles are invalid.
|
|
13
|
+
*/
|
|
14
|
+
export declare function validateRoles(roles: Roles, eventConfigs: VersionedEventConfig[]): void;
|
|
15
|
+
//# sourceMappingURL=roleValidations.d.ts.map
|