@oxyhq/contracts 0.1.0
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/cjs/index.js +26 -0
- package/dist/cjs/userResponse.js +157 -0
- package/dist/esm/index.js +16 -0
- package/dist/esm/userResponse.js +152 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/userResponse.d.ts +993 -0
- package/package.json +84 -0
|
@@ -0,0 +1,993 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical API user-response contracts.
|
|
3
|
+
*
|
|
4
|
+
* SINGLE SOURCE OF TRUTH for the wire shape of every user object the API emits
|
|
5
|
+
* and every consumer (the auth app, services, accounts) parses. The API
|
|
6
|
+
* validates its OUTPUT against these schemas; web/RN consumers validate their
|
|
7
|
+
* INPUT against the same schemas. Because there is exactly one definition, the
|
|
8
|
+
* producer and the consumers cannot drift — the class of bugs that motivated
|
|
9
|
+
* this module (the auth app's local Zod schema requiring `name` to be a plain
|
|
10
|
+
* string, dropping every account that had a structured name) is impossible.
|
|
11
|
+
*
|
|
12
|
+
* This package (`@oxyhq/contracts`) is the dedicated, zero-dependency home for
|
|
13
|
+
* these contracts so the backend (`@oxyhq/api`) and the client SDKs
|
|
14
|
+
* (`@oxyhq/core`, `@oxyhq/auth`, `@oxyhq/services`) can all depend on it without
|
|
15
|
+
* the backend having to depend on a client SDK to obtain its schemas.
|
|
16
|
+
*
|
|
17
|
+
* Faithful to the producers:
|
|
18
|
+
* - `packages/api/src/utils/userTransform.ts` `formatUserResponse` — the
|
|
19
|
+
* canonical serialization used by `/auth/refresh-all`, device sessions, etc.
|
|
20
|
+
* Emits `id` (NOT `_id`), forwards `username` verbatim (may be absent), and
|
|
21
|
+
* emits `name` as the structured `{ first, last, full }` subdocument.
|
|
22
|
+
* - `packages/api/src/models/User.ts` — `NameSchema` (`first`/`last` default
|
|
23
|
+
* `''`; `full` is a Mongoose VIRTUAL) and the `displayName` virtual. Because
|
|
24
|
+
* virtuals are only present when a query uses `.lean({ virtuals: true })` (or
|
|
25
|
+
* a hydrated doc), `name.full` and `displayName` MUST be treated as OPTIONAL.
|
|
26
|
+
* - The `/auth/refresh-all` handler in `packages/api/src/routes/auth.ts`, whose
|
|
27
|
+
* per-slot `authuser` is `number | null` (null = legacy un-suffixed `oxy_rt`
|
|
28
|
+
* cookie slot).
|
|
29
|
+
*
|
|
30
|
+
* Platform-agnostic — zod only, no react/react-native/expo. ESM-safe (no
|
|
31
|
+
* `require()`).
|
|
32
|
+
*/
|
|
33
|
+
import { z } from 'zod';
|
|
34
|
+
/**
|
|
35
|
+
* Structured human name subdocument. Mirrors `User.name` (`NameSchema`).
|
|
36
|
+
*
|
|
37
|
+
* - `first` / `last` default to `''` in Mongo, so they are optional on the wire.
|
|
38
|
+
* - `full` is a Mongoose virtual — ABSENT unless the query materialised virtuals.
|
|
39
|
+
*
|
|
40
|
+
* `.passthrough()` is intentional: it tolerates additive name fields without a
|
|
41
|
+
* coordinated contract bump, while the three known keys stay strongly typed.
|
|
42
|
+
*/
|
|
43
|
+
export declare const userNameSchema: z.ZodObject<{
|
|
44
|
+
first: z.ZodOptional<z.ZodString>;
|
|
45
|
+
last: z.ZodOptional<z.ZodString>;
|
|
46
|
+
full: z.ZodOptional<z.ZodString>;
|
|
47
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
48
|
+
first: z.ZodOptional<z.ZodString>;
|
|
49
|
+
last: z.ZodOptional<z.ZodString>;
|
|
50
|
+
full: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
52
|
+
first: z.ZodOptional<z.ZodString>;
|
|
53
|
+
last: z.ZodOptional<z.ZodString>;
|
|
54
|
+
full: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
56
|
+
export type UserNameResponse = z.infer<typeof userNameSchema>;
|
|
57
|
+
/**
|
|
58
|
+
* The canonical user object emitted by `formatUserResponse`.
|
|
59
|
+
*
|
|
60
|
+
* Only `id` is guaranteed present (it is the early-return guard in
|
|
61
|
+
* `formatUserResponse`). Every other field is forwarded verbatim from the user
|
|
62
|
+
* document and may be absent depending on the query's `.select(...)`/`.lean()`
|
|
63
|
+
* projection — so all are optional/nullable to match reality. Both `id` and
|
|
64
|
+
* `_id` are accepted because RAW-document responses (e.g. `GET /users/me`,
|
|
65
|
+
* which does NOT pass through `formatUserResponse`) carry `_id` instead of `id`;
|
|
66
|
+
* resolve the identifier with {@link resolveUserId}.
|
|
67
|
+
*
|
|
68
|
+
* `.passthrough()` keeps the large tail of profile fields
|
|
69
|
+
* (`privacySettings`, `locations`, `links`, `linksMetadata`, `bio`,
|
|
70
|
+
* `description`, `language`, `verified`, timestamps, …) available to callers
|
|
71
|
+
* that need them without enumerating every nested shape here — the load-bearing
|
|
72
|
+
* identity/display fields are the ones we pin precisely.
|
|
73
|
+
*/
|
|
74
|
+
export declare const userResponseSchema: z.ZodObject<{
|
|
75
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
76
|
+
id: z.ZodOptional<z.ZodString>;
|
|
77
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
78
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
79
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
80
|
+
username: z.ZodOptional<z.ZodString>;
|
|
81
|
+
email: z.ZodOptional<z.ZodString>;
|
|
82
|
+
/** Avatar file id (string) or null. */
|
|
83
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
84
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
85
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
86
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
87
|
+
first: z.ZodOptional<z.ZodString>;
|
|
88
|
+
last: z.ZodOptional<z.ZodString>;
|
|
89
|
+
full: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
91
|
+
first: z.ZodOptional<z.ZodString>;
|
|
92
|
+
last: z.ZodOptional<z.ZodString>;
|
|
93
|
+
full: z.ZodOptional<z.ZodString>;
|
|
94
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
95
|
+
first: z.ZodOptional<z.ZodString>;
|
|
96
|
+
last: z.ZodOptional<z.ZodString>;
|
|
97
|
+
full: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
99
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
100
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
101
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
+
language: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
104
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
105
|
+
id: z.ZodOptional<z.ZodString>;
|
|
106
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
107
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
108
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
109
|
+
username: z.ZodOptional<z.ZodString>;
|
|
110
|
+
email: z.ZodOptional<z.ZodString>;
|
|
111
|
+
/** Avatar file id (string) or null. */
|
|
112
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
113
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
114
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
115
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
116
|
+
first: z.ZodOptional<z.ZodString>;
|
|
117
|
+
last: z.ZodOptional<z.ZodString>;
|
|
118
|
+
full: z.ZodOptional<z.ZodString>;
|
|
119
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
120
|
+
first: z.ZodOptional<z.ZodString>;
|
|
121
|
+
last: z.ZodOptional<z.ZodString>;
|
|
122
|
+
full: z.ZodOptional<z.ZodString>;
|
|
123
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
124
|
+
first: z.ZodOptional<z.ZodString>;
|
|
125
|
+
last: z.ZodOptional<z.ZodString>;
|
|
126
|
+
full: z.ZodOptional<z.ZodString>;
|
|
127
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
128
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
129
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
130
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
131
|
+
language: z.ZodOptional<z.ZodString>;
|
|
132
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
133
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
134
|
+
id: z.ZodOptional<z.ZodString>;
|
|
135
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
136
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
137
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
138
|
+
username: z.ZodOptional<z.ZodString>;
|
|
139
|
+
email: z.ZodOptional<z.ZodString>;
|
|
140
|
+
/** Avatar file id (string) or null. */
|
|
141
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
142
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
143
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
144
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
145
|
+
first: z.ZodOptional<z.ZodString>;
|
|
146
|
+
last: z.ZodOptional<z.ZodString>;
|
|
147
|
+
full: z.ZodOptional<z.ZodString>;
|
|
148
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
149
|
+
first: z.ZodOptional<z.ZodString>;
|
|
150
|
+
last: z.ZodOptional<z.ZodString>;
|
|
151
|
+
full: z.ZodOptional<z.ZodString>;
|
|
152
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
153
|
+
first: z.ZodOptional<z.ZodString>;
|
|
154
|
+
last: z.ZodOptional<z.ZodString>;
|
|
155
|
+
full: z.ZodOptional<z.ZodString>;
|
|
156
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
157
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
158
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
159
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
160
|
+
language: z.ZodOptional<z.ZodString>;
|
|
161
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
162
|
+
export type UserResponse = z.infer<typeof userResponseSchema>;
|
|
163
|
+
/**
|
|
164
|
+
* Resolve the canonical user id from a {@link UserResponse}, accepting either
|
|
165
|
+
* the `formatUserResponse` `id` field or the raw-document `_id` field.
|
|
166
|
+
*/
|
|
167
|
+
export declare function resolveUserId(user: UserResponse): string | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* One rotated account entry from `POST /auth/refresh-all`.
|
|
170
|
+
*
|
|
171
|
+
* `authuser` is the device-local slot index (`0..N-1`). The server emits
|
|
172
|
+
* `authuser: null` for the legacy un-suffixed `oxy_rt` cookie slot — accept null
|
|
173
|
+
* so a browser holding only a legacy cookie is NOT dropped from the account
|
|
174
|
+
* chooser. `user` is the canonical {@link userResponseSchema} shape (the handler
|
|
175
|
+
* projects a whitelist and runs it through `formatUserResponse`).
|
|
176
|
+
*/
|
|
177
|
+
export declare const refreshAllAccountSchema: z.ZodObject<{
|
|
178
|
+
authuser: z.ZodNullable<z.ZodNumber>;
|
|
179
|
+
accessToken: z.ZodString;
|
|
180
|
+
expiresAt: z.ZodString;
|
|
181
|
+
sessionId: z.ZodString;
|
|
182
|
+
user: z.ZodObject<{
|
|
183
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
184
|
+
id: z.ZodOptional<z.ZodString>;
|
|
185
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
186
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
187
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
188
|
+
username: z.ZodOptional<z.ZodString>;
|
|
189
|
+
email: z.ZodOptional<z.ZodString>;
|
|
190
|
+
/** Avatar file id (string) or null. */
|
|
191
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
192
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
193
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
194
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
195
|
+
first: z.ZodOptional<z.ZodString>;
|
|
196
|
+
last: z.ZodOptional<z.ZodString>;
|
|
197
|
+
full: z.ZodOptional<z.ZodString>;
|
|
198
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
199
|
+
first: z.ZodOptional<z.ZodString>;
|
|
200
|
+
last: z.ZodOptional<z.ZodString>;
|
|
201
|
+
full: z.ZodOptional<z.ZodString>;
|
|
202
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
203
|
+
first: z.ZodOptional<z.ZodString>;
|
|
204
|
+
last: z.ZodOptional<z.ZodString>;
|
|
205
|
+
full: z.ZodOptional<z.ZodString>;
|
|
206
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
207
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
208
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
209
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
210
|
+
language: z.ZodOptional<z.ZodString>;
|
|
211
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
212
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
213
|
+
id: z.ZodOptional<z.ZodString>;
|
|
214
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
215
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
216
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
217
|
+
username: z.ZodOptional<z.ZodString>;
|
|
218
|
+
email: z.ZodOptional<z.ZodString>;
|
|
219
|
+
/** Avatar file id (string) or null. */
|
|
220
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
221
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
222
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
223
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
224
|
+
first: z.ZodOptional<z.ZodString>;
|
|
225
|
+
last: z.ZodOptional<z.ZodString>;
|
|
226
|
+
full: z.ZodOptional<z.ZodString>;
|
|
227
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
228
|
+
first: z.ZodOptional<z.ZodString>;
|
|
229
|
+
last: z.ZodOptional<z.ZodString>;
|
|
230
|
+
full: z.ZodOptional<z.ZodString>;
|
|
231
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
232
|
+
first: z.ZodOptional<z.ZodString>;
|
|
233
|
+
last: z.ZodOptional<z.ZodString>;
|
|
234
|
+
full: z.ZodOptional<z.ZodString>;
|
|
235
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
236
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
237
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
238
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
239
|
+
language: z.ZodOptional<z.ZodString>;
|
|
240
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
241
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
242
|
+
id: z.ZodOptional<z.ZodString>;
|
|
243
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
244
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
245
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
246
|
+
username: z.ZodOptional<z.ZodString>;
|
|
247
|
+
email: z.ZodOptional<z.ZodString>;
|
|
248
|
+
/** Avatar file id (string) or null. */
|
|
249
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
250
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
251
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
252
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
253
|
+
first: z.ZodOptional<z.ZodString>;
|
|
254
|
+
last: z.ZodOptional<z.ZodString>;
|
|
255
|
+
full: z.ZodOptional<z.ZodString>;
|
|
256
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
257
|
+
first: z.ZodOptional<z.ZodString>;
|
|
258
|
+
last: z.ZodOptional<z.ZodString>;
|
|
259
|
+
full: z.ZodOptional<z.ZodString>;
|
|
260
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
261
|
+
first: z.ZodOptional<z.ZodString>;
|
|
262
|
+
last: z.ZodOptional<z.ZodString>;
|
|
263
|
+
full: z.ZodOptional<z.ZodString>;
|
|
264
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
265
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
266
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
267
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
268
|
+
language: z.ZodOptional<z.ZodString>;
|
|
269
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
270
|
+
}, "strip", z.ZodTypeAny, {
|
|
271
|
+
authuser: number | null;
|
|
272
|
+
accessToken: string;
|
|
273
|
+
expiresAt: string;
|
|
274
|
+
sessionId: string;
|
|
275
|
+
user: {
|
|
276
|
+
id?: string | undefined;
|
|
277
|
+
_id?: string | undefined;
|
|
278
|
+
publicKey?: string | undefined;
|
|
279
|
+
username?: string | undefined;
|
|
280
|
+
email?: string | undefined;
|
|
281
|
+
avatar?: string | null | undefined;
|
|
282
|
+
color?: string | null | undefined;
|
|
283
|
+
name?: z.objectOutputType<{
|
|
284
|
+
first: z.ZodOptional<z.ZodString>;
|
|
285
|
+
last: z.ZodOptional<z.ZodString>;
|
|
286
|
+
full: z.ZodOptional<z.ZodString>;
|
|
287
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
288
|
+
displayName?: string | undefined;
|
|
289
|
+
verified?: boolean | undefined;
|
|
290
|
+
language?: string | undefined;
|
|
291
|
+
} & {
|
|
292
|
+
[k: string]: unknown;
|
|
293
|
+
};
|
|
294
|
+
}, {
|
|
295
|
+
authuser: number | null;
|
|
296
|
+
accessToken: string;
|
|
297
|
+
expiresAt: string;
|
|
298
|
+
sessionId: string;
|
|
299
|
+
user: {
|
|
300
|
+
id?: string | undefined;
|
|
301
|
+
_id?: string | undefined;
|
|
302
|
+
publicKey?: string | undefined;
|
|
303
|
+
username?: string | undefined;
|
|
304
|
+
email?: string | undefined;
|
|
305
|
+
avatar?: string | null | undefined;
|
|
306
|
+
color?: string | null | undefined;
|
|
307
|
+
name?: z.objectInputType<{
|
|
308
|
+
first: z.ZodOptional<z.ZodString>;
|
|
309
|
+
last: z.ZodOptional<z.ZodString>;
|
|
310
|
+
full: z.ZodOptional<z.ZodString>;
|
|
311
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
312
|
+
displayName?: string | undefined;
|
|
313
|
+
verified?: boolean | undefined;
|
|
314
|
+
language?: string | undefined;
|
|
315
|
+
} & {
|
|
316
|
+
[k: string]: unknown;
|
|
317
|
+
};
|
|
318
|
+
}>;
|
|
319
|
+
export type RefreshAllAccountResponse = z.infer<typeof refreshAllAccountSchema>;
|
|
320
|
+
/**
|
|
321
|
+
* Wire shape of `POST /auth/refresh-all`: every valid device-local account,
|
|
322
|
+
* sorted by `authuser` ascending. An empty `accounts` array means "no signed-in
|
|
323
|
+
* accounts on this device" — the IdP must show the sign-in form. A 404 means the
|
|
324
|
+
* endpoint is not deployed and the caller falls back to single-account
|
|
325
|
+
* `/auth/refresh`.
|
|
326
|
+
*/
|
|
327
|
+
export declare const refreshAllResponseSchema: z.ZodObject<{
|
|
328
|
+
accounts: z.ZodArray<z.ZodObject<{
|
|
329
|
+
authuser: z.ZodNullable<z.ZodNumber>;
|
|
330
|
+
accessToken: z.ZodString;
|
|
331
|
+
expiresAt: z.ZodString;
|
|
332
|
+
sessionId: z.ZodString;
|
|
333
|
+
user: z.ZodObject<{
|
|
334
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
335
|
+
id: z.ZodOptional<z.ZodString>;
|
|
336
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
337
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
338
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
339
|
+
username: z.ZodOptional<z.ZodString>;
|
|
340
|
+
email: z.ZodOptional<z.ZodString>;
|
|
341
|
+
/** Avatar file id (string) or null. */
|
|
342
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
343
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
344
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
345
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
346
|
+
first: z.ZodOptional<z.ZodString>;
|
|
347
|
+
last: z.ZodOptional<z.ZodString>;
|
|
348
|
+
full: z.ZodOptional<z.ZodString>;
|
|
349
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
350
|
+
first: z.ZodOptional<z.ZodString>;
|
|
351
|
+
last: z.ZodOptional<z.ZodString>;
|
|
352
|
+
full: z.ZodOptional<z.ZodString>;
|
|
353
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
354
|
+
first: z.ZodOptional<z.ZodString>;
|
|
355
|
+
last: z.ZodOptional<z.ZodString>;
|
|
356
|
+
full: z.ZodOptional<z.ZodString>;
|
|
357
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
358
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
359
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
360
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
361
|
+
language: z.ZodOptional<z.ZodString>;
|
|
362
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
363
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
364
|
+
id: z.ZodOptional<z.ZodString>;
|
|
365
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
366
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
367
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
368
|
+
username: z.ZodOptional<z.ZodString>;
|
|
369
|
+
email: z.ZodOptional<z.ZodString>;
|
|
370
|
+
/** Avatar file id (string) or null. */
|
|
371
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
372
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
373
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
374
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
375
|
+
first: z.ZodOptional<z.ZodString>;
|
|
376
|
+
last: z.ZodOptional<z.ZodString>;
|
|
377
|
+
full: z.ZodOptional<z.ZodString>;
|
|
378
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
379
|
+
first: z.ZodOptional<z.ZodString>;
|
|
380
|
+
last: z.ZodOptional<z.ZodString>;
|
|
381
|
+
full: z.ZodOptional<z.ZodString>;
|
|
382
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
383
|
+
first: z.ZodOptional<z.ZodString>;
|
|
384
|
+
last: z.ZodOptional<z.ZodString>;
|
|
385
|
+
full: z.ZodOptional<z.ZodString>;
|
|
386
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
387
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
388
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
389
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
390
|
+
language: z.ZodOptional<z.ZodString>;
|
|
391
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
392
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
393
|
+
id: z.ZodOptional<z.ZodString>;
|
|
394
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
395
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
396
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
397
|
+
username: z.ZodOptional<z.ZodString>;
|
|
398
|
+
email: z.ZodOptional<z.ZodString>;
|
|
399
|
+
/** Avatar file id (string) or null. */
|
|
400
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
401
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
402
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
403
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
404
|
+
first: z.ZodOptional<z.ZodString>;
|
|
405
|
+
last: z.ZodOptional<z.ZodString>;
|
|
406
|
+
full: z.ZodOptional<z.ZodString>;
|
|
407
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
408
|
+
first: z.ZodOptional<z.ZodString>;
|
|
409
|
+
last: z.ZodOptional<z.ZodString>;
|
|
410
|
+
full: z.ZodOptional<z.ZodString>;
|
|
411
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
412
|
+
first: z.ZodOptional<z.ZodString>;
|
|
413
|
+
last: z.ZodOptional<z.ZodString>;
|
|
414
|
+
full: z.ZodOptional<z.ZodString>;
|
|
415
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
416
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
417
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
418
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
419
|
+
language: z.ZodOptional<z.ZodString>;
|
|
420
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
421
|
+
}, "strip", z.ZodTypeAny, {
|
|
422
|
+
authuser: number | null;
|
|
423
|
+
accessToken: string;
|
|
424
|
+
expiresAt: string;
|
|
425
|
+
sessionId: string;
|
|
426
|
+
user: {
|
|
427
|
+
id?: string | undefined;
|
|
428
|
+
_id?: string | undefined;
|
|
429
|
+
publicKey?: string | undefined;
|
|
430
|
+
username?: string | undefined;
|
|
431
|
+
email?: string | undefined;
|
|
432
|
+
avatar?: string | null | undefined;
|
|
433
|
+
color?: string | null | undefined;
|
|
434
|
+
name?: z.objectOutputType<{
|
|
435
|
+
first: z.ZodOptional<z.ZodString>;
|
|
436
|
+
last: z.ZodOptional<z.ZodString>;
|
|
437
|
+
full: z.ZodOptional<z.ZodString>;
|
|
438
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
439
|
+
displayName?: string | undefined;
|
|
440
|
+
verified?: boolean | undefined;
|
|
441
|
+
language?: string | undefined;
|
|
442
|
+
} & {
|
|
443
|
+
[k: string]: unknown;
|
|
444
|
+
};
|
|
445
|
+
}, {
|
|
446
|
+
authuser: number | null;
|
|
447
|
+
accessToken: string;
|
|
448
|
+
expiresAt: string;
|
|
449
|
+
sessionId: string;
|
|
450
|
+
user: {
|
|
451
|
+
id?: string | undefined;
|
|
452
|
+
_id?: string | undefined;
|
|
453
|
+
publicKey?: string | undefined;
|
|
454
|
+
username?: string | undefined;
|
|
455
|
+
email?: string | undefined;
|
|
456
|
+
avatar?: string | null | undefined;
|
|
457
|
+
color?: string | null | undefined;
|
|
458
|
+
name?: z.objectInputType<{
|
|
459
|
+
first: z.ZodOptional<z.ZodString>;
|
|
460
|
+
last: z.ZodOptional<z.ZodString>;
|
|
461
|
+
full: z.ZodOptional<z.ZodString>;
|
|
462
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
463
|
+
displayName?: string | undefined;
|
|
464
|
+
verified?: boolean | undefined;
|
|
465
|
+
language?: string | undefined;
|
|
466
|
+
} & {
|
|
467
|
+
[k: string]: unknown;
|
|
468
|
+
};
|
|
469
|
+
}>, "many">;
|
|
470
|
+
}, "strip", z.ZodTypeAny, {
|
|
471
|
+
accounts: {
|
|
472
|
+
authuser: number | null;
|
|
473
|
+
accessToken: string;
|
|
474
|
+
expiresAt: string;
|
|
475
|
+
sessionId: string;
|
|
476
|
+
user: {
|
|
477
|
+
id?: string | undefined;
|
|
478
|
+
_id?: string | undefined;
|
|
479
|
+
publicKey?: string | undefined;
|
|
480
|
+
username?: string | undefined;
|
|
481
|
+
email?: string | undefined;
|
|
482
|
+
avatar?: string | null | undefined;
|
|
483
|
+
color?: string | null | undefined;
|
|
484
|
+
name?: z.objectOutputType<{
|
|
485
|
+
first: z.ZodOptional<z.ZodString>;
|
|
486
|
+
last: z.ZodOptional<z.ZodString>;
|
|
487
|
+
full: z.ZodOptional<z.ZodString>;
|
|
488
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
489
|
+
displayName?: string | undefined;
|
|
490
|
+
verified?: boolean | undefined;
|
|
491
|
+
language?: string | undefined;
|
|
492
|
+
} & {
|
|
493
|
+
[k: string]: unknown;
|
|
494
|
+
};
|
|
495
|
+
}[];
|
|
496
|
+
}, {
|
|
497
|
+
accounts: {
|
|
498
|
+
authuser: number | null;
|
|
499
|
+
accessToken: string;
|
|
500
|
+
expiresAt: string;
|
|
501
|
+
sessionId: string;
|
|
502
|
+
user: {
|
|
503
|
+
id?: string | undefined;
|
|
504
|
+
_id?: string | undefined;
|
|
505
|
+
publicKey?: string | undefined;
|
|
506
|
+
username?: string | undefined;
|
|
507
|
+
email?: string | undefined;
|
|
508
|
+
avatar?: string | null | undefined;
|
|
509
|
+
color?: string | null | undefined;
|
|
510
|
+
name?: z.objectInputType<{
|
|
511
|
+
first: z.ZodOptional<z.ZodString>;
|
|
512
|
+
last: z.ZodOptional<z.ZodString>;
|
|
513
|
+
full: z.ZodOptional<z.ZodString>;
|
|
514
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
515
|
+
displayName?: string | undefined;
|
|
516
|
+
verified?: boolean | undefined;
|
|
517
|
+
language?: string | undefined;
|
|
518
|
+
} & {
|
|
519
|
+
[k: string]: unknown;
|
|
520
|
+
};
|
|
521
|
+
}[];
|
|
522
|
+
}>;
|
|
523
|
+
export type RefreshAllResponseContract = z.infer<typeof refreshAllResponseSchema>;
|
|
524
|
+
/**
|
|
525
|
+
* Wire shape of `GET /users/me` — the API success envelope (`{ data: <user> }`)
|
|
526
|
+
* wrapping the RAW Mongo user document. It does NOT pass through
|
|
527
|
+
* `formatUserResponse`, so the id field is `_id` (resolve via
|
|
528
|
+
* {@link resolveUserId}) and virtuals (`name.full`, `displayName`) may be
|
|
529
|
+
* present when the query materialised them.
|
|
530
|
+
*/
|
|
531
|
+
export declare const currentUserResponseSchema: z.ZodObject<{
|
|
532
|
+
data: z.ZodObject<{
|
|
533
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
534
|
+
id: z.ZodOptional<z.ZodString>;
|
|
535
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
536
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
537
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
538
|
+
username: z.ZodOptional<z.ZodString>;
|
|
539
|
+
email: z.ZodOptional<z.ZodString>;
|
|
540
|
+
/** Avatar file id (string) or null. */
|
|
541
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
542
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
543
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
544
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
545
|
+
first: z.ZodOptional<z.ZodString>;
|
|
546
|
+
last: z.ZodOptional<z.ZodString>;
|
|
547
|
+
full: z.ZodOptional<z.ZodString>;
|
|
548
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
549
|
+
first: z.ZodOptional<z.ZodString>;
|
|
550
|
+
last: z.ZodOptional<z.ZodString>;
|
|
551
|
+
full: z.ZodOptional<z.ZodString>;
|
|
552
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
553
|
+
first: z.ZodOptional<z.ZodString>;
|
|
554
|
+
last: z.ZodOptional<z.ZodString>;
|
|
555
|
+
full: z.ZodOptional<z.ZodString>;
|
|
556
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
557
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
558
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
559
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
560
|
+
language: z.ZodOptional<z.ZodString>;
|
|
561
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
562
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
563
|
+
id: z.ZodOptional<z.ZodString>;
|
|
564
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
565
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
566
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
567
|
+
username: z.ZodOptional<z.ZodString>;
|
|
568
|
+
email: z.ZodOptional<z.ZodString>;
|
|
569
|
+
/** Avatar file id (string) or null. */
|
|
570
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
571
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
572
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
573
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
574
|
+
first: z.ZodOptional<z.ZodString>;
|
|
575
|
+
last: z.ZodOptional<z.ZodString>;
|
|
576
|
+
full: z.ZodOptional<z.ZodString>;
|
|
577
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
578
|
+
first: z.ZodOptional<z.ZodString>;
|
|
579
|
+
last: z.ZodOptional<z.ZodString>;
|
|
580
|
+
full: z.ZodOptional<z.ZodString>;
|
|
581
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
582
|
+
first: z.ZodOptional<z.ZodString>;
|
|
583
|
+
last: z.ZodOptional<z.ZodString>;
|
|
584
|
+
full: z.ZodOptional<z.ZodString>;
|
|
585
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
586
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
587
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
588
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
589
|
+
language: z.ZodOptional<z.ZodString>;
|
|
590
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
591
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
592
|
+
id: z.ZodOptional<z.ZodString>;
|
|
593
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
594
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
595
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
596
|
+
username: z.ZodOptional<z.ZodString>;
|
|
597
|
+
email: z.ZodOptional<z.ZodString>;
|
|
598
|
+
/** Avatar file id (string) or null. */
|
|
599
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
600
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
601
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
602
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
603
|
+
first: z.ZodOptional<z.ZodString>;
|
|
604
|
+
last: z.ZodOptional<z.ZodString>;
|
|
605
|
+
full: z.ZodOptional<z.ZodString>;
|
|
606
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
607
|
+
first: z.ZodOptional<z.ZodString>;
|
|
608
|
+
last: z.ZodOptional<z.ZodString>;
|
|
609
|
+
full: z.ZodOptional<z.ZodString>;
|
|
610
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
611
|
+
first: z.ZodOptional<z.ZodString>;
|
|
612
|
+
last: z.ZodOptional<z.ZodString>;
|
|
613
|
+
full: z.ZodOptional<z.ZodString>;
|
|
614
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
615
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
616
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
617
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
618
|
+
language: z.ZodOptional<z.ZodString>;
|
|
619
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
620
|
+
}, "strip", z.ZodTypeAny, {
|
|
621
|
+
data: {
|
|
622
|
+
id?: string | undefined;
|
|
623
|
+
_id?: string | undefined;
|
|
624
|
+
publicKey?: string | undefined;
|
|
625
|
+
username?: string | undefined;
|
|
626
|
+
email?: string | undefined;
|
|
627
|
+
avatar?: string | null | undefined;
|
|
628
|
+
color?: string | null | undefined;
|
|
629
|
+
name?: z.objectOutputType<{
|
|
630
|
+
first: z.ZodOptional<z.ZodString>;
|
|
631
|
+
last: z.ZodOptional<z.ZodString>;
|
|
632
|
+
full: z.ZodOptional<z.ZodString>;
|
|
633
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
634
|
+
displayName?: string | undefined;
|
|
635
|
+
verified?: boolean | undefined;
|
|
636
|
+
language?: string | undefined;
|
|
637
|
+
} & {
|
|
638
|
+
[k: string]: unknown;
|
|
639
|
+
};
|
|
640
|
+
}, {
|
|
641
|
+
data: {
|
|
642
|
+
id?: string | undefined;
|
|
643
|
+
_id?: string | undefined;
|
|
644
|
+
publicKey?: string | undefined;
|
|
645
|
+
username?: string | undefined;
|
|
646
|
+
email?: string | undefined;
|
|
647
|
+
avatar?: string | null | undefined;
|
|
648
|
+
color?: string | null | undefined;
|
|
649
|
+
name?: z.objectInputType<{
|
|
650
|
+
first: z.ZodOptional<z.ZodString>;
|
|
651
|
+
last: z.ZodOptional<z.ZodString>;
|
|
652
|
+
full: z.ZodOptional<z.ZodString>;
|
|
653
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
654
|
+
displayName?: string | undefined;
|
|
655
|
+
verified?: boolean | undefined;
|
|
656
|
+
language?: string | undefined;
|
|
657
|
+
} & {
|
|
658
|
+
[k: string]: unknown;
|
|
659
|
+
};
|
|
660
|
+
}>;
|
|
661
|
+
export type CurrentUserResponseContract = z.infer<typeof currentUserResponseSchema>;
|
|
662
|
+
/**
|
|
663
|
+
* One entry of `GET /session/device/sessions/:sessionId` — the deduplicated
|
|
664
|
+
* accounts signed in on this physical device (one per user, most recent
|
|
665
|
+
* session). Backs the multi-account chooser. The embedded user mirrors
|
|
666
|
+
* `formatUserResponse`; it is nullable on slots that lost their user document.
|
|
667
|
+
*/
|
|
668
|
+
export declare const deviceSessionAccountSchema: z.ZodObject<{
|
|
669
|
+
sessionId: z.ZodString;
|
|
670
|
+
isCurrent: z.ZodOptional<z.ZodBoolean>;
|
|
671
|
+
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
672
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
673
|
+
id: z.ZodOptional<z.ZodString>;
|
|
674
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
675
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
676
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
677
|
+
username: z.ZodOptional<z.ZodString>;
|
|
678
|
+
email: z.ZodOptional<z.ZodString>;
|
|
679
|
+
/** Avatar file id (string) or null. */
|
|
680
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
681
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
682
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
683
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
684
|
+
first: z.ZodOptional<z.ZodString>;
|
|
685
|
+
last: z.ZodOptional<z.ZodString>;
|
|
686
|
+
full: z.ZodOptional<z.ZodString>;
|
|
687
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
688
|
+
first: z.ZodOptional<z.ZodString>;
|
|
689
|
+
last: z.ZodOptional<z.ZodString>;
|
|
690
|
+
full: z.ZodOptional<z.ZodString>;
|
|
691
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
692
|
+
first: z.ZodOptional<z.ZodString>;
|
|
693
|
+
last: z.ZodOptional<z.ZodString>;
|
|
694
|
+
full: z.ZodOptional<z.ZodString>;
|
|
695
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
696
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
697
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
698
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
699
|
+
language: z.ZodOptional<z.ZodString>;
|
|
700
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
701
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
702
|
+
id: z.ZodOptional<z.ZodString>;
|
|
703
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
704
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
705
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
706
|
+
username: z.ZodOptional<z.ZodString>;
|
|
707
|
+
email: z.ZodOptional<z.ZodString>;
|
|
708
|
+
/** Avatar file id (string) or null. */
|
|
709
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
710
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
711
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
712
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
713
|
+
first: z.ZodOptional<z.ZodString>;
|
|
714
|
+
last: z.ZodOptional<z.ZodString>;
|
|
715
|
+
full: z.ZodOptional<z.ZodString>;
|
|
716
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
717
|
+
first: z.ZodOptional<z.ZodString>;
|
|
718
|
+
last: z.ZodOptional<z.ZodString>;
|
|
719
|
+
full: z.ZodOptional<z.ZodString>;
|
|
720
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
721
|
+
first: z.ZodOptional<z.ZodString>;
|
|
722
|
+
last: z.ZodOptional<z.ZodString>;
|
|
723
|
+
full: z.ZodOptional<z.ZodString>;
|
|
724
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
725
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
726
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
727
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
728
|
+
language: z.ZodOptional<z.ZodString>;
|
|
729
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
730
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
731
|
+
id: z.ZodOptional<z.ZodString>;
|
|
732
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
733
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
734
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
735
|
+
username: z.ZodOptional<z.ZodString>;
|
|
736
|
+
email: z.ZodOptional<z.ZodString>;
|
|
737
|
+
/** Avatar file id (string) or null. */
|
|
738
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
739
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
740
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
741
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
742
|
+
first: z.ZodOptional<z.ZodString>;
|
|
743
|
+
last: z.ZodOptional<z.ZodString>;
|
|
744
|
+
full: z.ZodOptional<z.ZodString>;
|
|
745
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
746
|
+
first: z.ZodOptional<z.ZodString>;
|
|
747
|
+
last: z.ZodOptional<z.ZodString>;
|
|
748
|
+
full: z.ZodOptional<z.ZodString>;
|
|
749
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
750
|
+
first: z.ZodOptional<z.ZodString>;
|
|
751
|
+
last: z.ZodOptional<z.ZodString>;
|
|
752
|
+
full: z.ZodOptional<z.ZodString>;
|
|
753
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
754
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
755
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
756
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
757
|
+
language: z.ZodOptional<z.ZodString>;
|
|
758
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
759
|
+
}, "strip", z.ZodTypeAny, {
|
|
760
|
+
sessionId: string;
|
|
761
|
+
user?: z.objectOutputType<{
|
|
762
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
763
|
+
id: z.ZodOptional<z.ZodString>;
|
|
764
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
765
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
766
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
767
|
+
username: z.ZodOptional<z.ZodString>;
|
|
768
|
+
email: z.ZodOptional<z.ZodString>;
|
|
769
|
+
/** Avatar file id (string) or null. */
|
|
770
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
771
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
772
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
773
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
774
|
+
first: z.ZodOptional<z.ZodString>;
|
|
775
|
+
last: z.ZodOptional<z.ZodString>;
|
|
776
|
+
full: z.ZodOptional<z.ZodString>;
|
|
777
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
778
|
+
first: z.ZodOptional<z.ZodString>;
|
|
779
|
+
last: z.ZodOptional<z.ZodString>;
|
|
780
|
+
full: z.ZodOptional<z.ZodString>;
|
|
781
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
782
|
+
first: z.ZodOptional<z.ZodString>;
|
|
783
|
+
last: z.ZodOptional<z.ZodString>;
|
|
784
|
+
full: z.ZodOptional<z.ZodString>;
|
|
785
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
786
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
787
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
788
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
789
|
+
language: z.ZodOptional<z.ZodString>;
|
|
790
|
+
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
791
|
+
isCurrent?: boolean | undefined;
|
|
792
|
+
}, {
|
|
793
|
+
sessionId: string;
|
|
794
|
+
user?: z.objectInputType<{
|
|
795
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
796
|
+
id: z.ZodOptional<z.ZodString>;
|
|
797
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
798
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
799
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
800
|
+
username: z.ZodOptional<z.ZodString>;
|
|
801
|
+
email: z.ZodOptional<z.ZodString>;
|
|
802
|
+
/** Avatar file id (string) or null. */
|
|
803
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
804
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
805
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
806
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
807
|
+
first: z.ZodOptional<z.ZodString>;
|
|
808
|
+
last: z.ZodOptional<z.ZodString>;
|
|
809
|
+
full: z.ZodOptional<z.ZodString>;
|
|
810
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
811
|
+
first: z.ZodOptional<z.ZodString>;
|
|
812
|
+
last: z.ZodOptional<z.ZodString>;
|
|
813
|
+
full: z.ZodOptional<z.ZodString>;
|
|
814
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
815
|
+
first: z.ZodOptional<z.ZodString>;
|
|
816
|
+
last: z.ZodOptional<z.ZodString>;
|
|
817
|
+
full: z.ZodOptional<z.ZodString>;
|
|
818
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
819
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
820
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
821
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
822
|
+
language: z.ZodOptional<z.ZodString>;
|
|
823
|
+
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
824
|
+
isCurrent?: boolean | undefined;
|
|
825
|
+
}>;
|
|
826
|
+
export type DeviceSessionAccountResponse = z.infer<typeof deviceSessionAccountSchema>;
|
|
827
|
+
/** Wire shape of `GET /session/device/sessions/:sessionId` (an array). */
|
|
828
|
+
export declare const deviceSessionsResponseSchema: z.ZodArray<z.ZodObject<{
|
|
829
|
+
sessionId: z.ZodString;
|
|
830
|
+
isCurrent: z.ZodOptional<z.ZodBoolean>;
|
|
831
|
+
user: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
832
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
833
|
+
id: z.ZodOptional<z.ZodString>;
|
|
834
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
835
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
836
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
837
|
+
username: z.ZodOptional<z.ZodString>;
|
|
838
|
+
email: z.ZodOptional<z.ZodString>;
|
|
839
|
+
/** Avatar file id (string) or null. */
|
|
840
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
841
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
842
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
843
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
844
|
+
first: z.ZodOptional<z.ZodString>;
|
|
845
|
+
last: z.ZodOptional<z.ZodString>;
|
|
846
|
+
full: z.ZodOptional<z.ZodString>;
|
|
847
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
848
|
+
first: z.ZodOptional<z.ZodString>;
|
|
849
|
+
last: z.ZodOptional<z.ZodString>;
|
|
850
|
+
full: z.ZodOptional<z.ZodString>;
|
|
851
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
852
|
+
first: z.ZodOptional<z.ZodString>;
|
|
853
|
+
last: z.ZodOptional<z.ZodString>;
|
|
854
|
+
full: z.ZodOptional<z.ZodString>;
|
|
855
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
856
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
857
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
858
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
859
|
+
language: z.ZodOptional<z.ZodString>;
|
|
860
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
861
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
862
|
+
id: z.ZodOptional<z.ZodString>;
|
|
863
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
864
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
865
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
866
|
+
username: z.ZodOptional<z.ZodString>;
|
|
867
|
+
email: z.ZodOptional<z.ZodString>;
|
|
868
|
+
/** Avatar file id (string) or null. */
|
|
869
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
870
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
871
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
872
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
873
|
+
first: z.ZodOptional<z.ZodString>;
|
|
874
|
+
last: z.ZodOptional<z.ZodString>;
|
|
875
|
+
full: z.ZodOptional<z.ZodString>;
|
|
876
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
877
|
+
first: z.ZodOptional<z.ZodString>;
|
|
878
|
+
last: z.ZodOptional<z.ZodString>;
|
|
879
|
+
full: z.ZodOptional<z.ZodString>;
|
|
880
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
881
|
+
first: z.ZodOptional<z.ZodString>;
|
|
882
|
+
last: z.ZodOptional<z.ZodString>;
|
|
883
|
+
full: z.ZodOptional<z.ZodString>;
|
|
884
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
885
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
886
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
887
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
888
|
+
language: z.ZodOptional<z.ZodString>;
|
|
889
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
890
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
891
|
+
id: z.ZodOptional<z.ZodString>;
|
|
892
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
893
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
894
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
895
|
+
username: z.ZodOptional<z.ZodString>;
|
|
896
|
+
email: z.ZodOptional<z.ZodString>;
|
|
897
|
+
/** Avatar file id (string) or null. */
|
|
898
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
899
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
900
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
901
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
902
|
+
first: z.ZodOptional<z.ZodString>;
|
|
903
|
+
last: z.ZodOptional<z.ZodString>;
|
|
904
|
+
full: z.ZodOptional<z.ZodString>;
|
|
905
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
906
|
+
first: z.ZodOptional<z.ZodString>;
|
|
907
|
+
last: z.ZodOptional<z.ZodString>;
|
|
908
|
+
full: z.ZodOptional<z.ZodString>;
|
|
909
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
910
|
+
first: z.ZodOptional<z.ZodString>;
|
|
911
|
+
last: z.ZodOptional<z.ZodString>;
|
|
912
|
+
full: z.ZodOptional<z.ZodString>;
|
|
913
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
914
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
915
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
916
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
917
|
+
language: z.ZodOptional<z.ZodString>;
|
|
918
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
919
|
+
}, "strip", z.ZodTypeAny, {
|
|
920
|
+
sessionId: string;
|
|
921
|
+
user?: z.objectOutputType<{
|
|
922
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
923
|
+
id: z.ZodOptional<z.ZodString>;
|
|
924
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
925
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
926
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
927
|
+
username: z.ZodOptional<z.ZodString>;
|
|
928
|
+
email: z.ZodOptional<z.ZodString>;
|
|
929
|
+
/** Avatar file id (string) or null. */
|
|
930
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
931
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
932
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
933
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
934
|
+
first: z.ZodOptional<z.ZodString>;
|
|
935
|
+
last: z.ZodOptional<z.ZodString>;
|
|
936
|
+
full: z.ZodOptional<z.ZodString>;
|
|
937
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
938
|
+
first: z.ZodOptional<z.ZodString>;
|
|
939
|
+
last: z.ZodOptional<z.ZodString>;
|
|
940
|
+
full: z.ZodOptional<z.ZodString>;
|
|
941
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
942
|
+
first: z.ZodOptional<z.ZodString>;
|
|
943
|
+
last: z.ZodOptional<z.ZodString>;
|
|
944
|
+
full: z.ZodOptional<z.ZodString>;
|
|
945
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
946
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
947
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
948
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
949
|
+
language: z.ZodOptional<z.ZodString>;
|
|
950
|
+
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
951
|
+
isCurrent?: boolean | undefined;
|
|
952
|
+
}, {
|
|
953
|
+
sessionId: string;
|
|
954
|
+
user?: z.objectInputType<{
|
|
955
|
+
/** MongoDB ObjectId as a string. Present on `formatUserResponse` output. */
|
|
956
|
+
id: z.ZodOptional<z.ZodString>;
|
|
957
|
+
/** Raw-document id (e.g. `GET /users/me`). Present when `id` is not. */
|
|
958
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
959
|
+
publicKey: z.ZodOptional<z.ZodString>;
|
|
960
|
+
username: z.ZodOptional<z.ZodString>;
|
|
961
|
+
email: z.ZodOptional<z.ZodString>;
|
|
962
|
+
/** Avatar file id (string) or null. */
|
|
963
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
964
|
+
/** Named Bloom color preset (e.g. `"blue"`) or null. */
|
|
965
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
966
|
+
name: z.ZodOptional<z.ZodObject<{
|
|
967
|
+
first: z.ZodOptional<z.ZodString>;
|
|
968
|
+
last: z.ZodOptional<z.ZodString>;
|
|
969
|
+
full: z.ZodOptional<z.ZodString>;
|
|
970
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
971
|
+
first: z.ZodOptional<z.ZodString>;
|
|
972
|
+
last: z.ZodOptional<z.ZodString>;
|
|
973
|
+
full: z.ZodOptional<z.ZodString>;
|
|
974
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
975
|
+
first: z.ZodOptional<z.ZodString>;
|
|
976
|
+
last: z.ZodOptional<z.ZodString>;
|
|
977
|
+
full: z.ZodOptional<z.ZodString>;
|
|
978
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
979
|
+
/** Server `displayName` virtual (`username || truncatedKey`). Optional. */
|
|
980
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
981
|
+
verified: z.ZodOptional<z.ZodBoolean>;
|
|
982
|
+
language: z.ZodOptional<z.ZodString>;
|
|
983
|
+
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
984
|
+
isCurrent?: boolean | undefined;
|
|
985
|
+
}>, "many">;
|
|
986
|
+
export type DeviceSessionsResponseContract = z.infer<typeof deviceSessionsResponseSchema>;
|
|
987
|
+
/**
|
|
988
|
+
* Safely parse a value against a contract schema. Returns the parsed (typed)
|
|
989
|
+
* value, or `null` when validation fails — the same ergonomics the auth app's
|
|
990
|
+
* local `safeParse` provided, now sourced from the contracts package so the
|
|
991
|
+
* parse helper and the schemas live together.
|
|
992
|
+
*/
|
|
993
|
+
export declare function safeParseContract<T>(schema: z.ZodType<T>, data: unknown): T | null;
|