@oxyhq/contracts 0.25.0 → 0.26.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/NOTICE +10 -9
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/browserHub.js +215 -0
- package/dist/cjs/deviceDirectory.js +189 -0
- package/dist/cjs/index.js +30 -2
- package/dist/cjs/oauth.js +66 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/browserHub.js +212 -0
- package/dist/esm/deviceDirectory.js +186 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/oauth.js +63 -0
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/browserHub.d.ts +856 -0
- package/dist/types/deviceDirectory.d.ts +1317 -0
- package/dist/types/deviceSession.d.ts +46 -46
- package/dist/types/index.d.ts +6 -0
- package/dist/types/oauth.d.ts +86 -0
- package/dist/types/sessionStatus.d.ts +8 -8
- package/dist/types/userResponse.d.ts +8 -8
- package/package.json +1 -1
|
@@ -0,0 +1,1317 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The canonical device directory — the ONE server-authoritative read model an
|
|
4
|
+
* account switcher renders (issue #937, ADR 0002).
|
|
5
|
+
*
|
|
6
|
+
* It replaces the client-side union of `DeviceSessionState.accounts[]` with a
|
|
7
|
+
* separately fetched `AccountNode[]` graph. That union cannot be correct on a
|
|
8
|
+
* device holding more than one person: the client only ever holds ONE caller's
|
|
9
|
+
* account graph, so it cannot enumerate what the OTHER principals may act as.
|
|
10
|
+
* Switchability is an authorization question, so the server answers it.
|
|
11
|
+
*
|
|
12
|
+
* The directory is deterministic and revision-bound: two reads at the same
|
|
13
|
+
* `revision` describe the same device state, and `revision` only advances on a
|
|
14
|
+
* real mutation (an idempotent activation advances nothing — ADR 0002).
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* How a principal reaches an account.
|
|
18
|
+
*
|
|
19
|
+
* Mirrors `AccountRelationship` in `@oxyhq/core`'s account graph rather than
|
|
20
|
+
* inventing a second vocabulary for the same fact:
|
|
21
|
+
* - `self` — the principal's own personal account (`principal.userId === accountId`)
|
|
22
|
+
* - `owner` — the principal owns this account
|
|
23
|
+
* - `member` — the principal holds a membership granting `account:act_as`
|
|
24
|
+
*/
|
|
25
|
+
export declare const deviceContextRelationshipSchema: z.ZodEnum<["self", "owner", "member"]>;
|
|
26
|
+
/**
|
|
27
|
+
* Sanitized display metadata for a principal or an account context.
|
|
28
|
+
*
|
|
29
|
+
* Deliberately NOT `userResponseSchema`: a switcher needs a handle, a name, an
|
|
30
|
+
* avatar and the accent the row is drawn in, and the directory is read by every
|
|
31
|
+
* app on the device — so it carries the minimum that renders a row and nothing
|
|
32
|
+
* that would make it a general profile feed. `name.displayName` stays OPTIONAL;
|
|
33
|
+
* consumers fall back to the handle (`getNormalizedUserHandle`), never to a
|
|
34
|
+
* synthesized name.
|
|
35
|
+
*
|
|
36
|
+
* `color` is here and `email` is not, and the line between them is what the
|
|
37
|
+
* field is FOR rather than how sensitive it looks. An accent is a property of
|
|
38
|
+
* drawing the row — without it every non-active row falls back to the ambient
|
|
39
|
+
* theme accent and a device holding two people renders them identically
|
|
40
|
+
* (issue #961). An address is somebody's contact detail, and the `@handle` the
|
|
41
|
+
* secondary line already shows fills the same slot, so putting one in a payload
|
|
42
|
+
* every installed app reads would widen the profile for no rendering gain.
|
|
43
|
+
*/
|
|
44
|
+
export declare const deviceDirectoryProfileSchema: z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
username: z.ZodString;
|
|
47
|
+
name: z.ZodOptional<z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>>;
|
|
48
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
|
+
/**
|
|
50
|
+
* Named Bloom color preset (e.g. `"blue"`), or null when the account has
|
|
51
|
+
* none. Same shape as `userResponseSchema.color` — one spelling of one fact,
|
|
52
|
+
* so a consumer that themes a row from either source reads the same values.
|
|
53
|
+
*/
|
|
54
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
55
|
+
}, "strip", z.ZodTypeAny, {
|
|
56
|
+
username: string;
|
|
57
|
+
id: string;
|
|
58
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
59
|
+
avatar?: string | null | undefined;
|
|
60
|
+
color?: string | null | undefined;
|
|
61
|
+
}, {
|
|
62
|
+
username: string;
|
|
63
|
+
id: string;
|
|
64
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
65
|
+
avatar?: string | null | undefined;
|
|
66
|
+
color?: string | null | undefined;
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* One `principal acting as account` pair — the globally switchable unit.
|
|
70
|
+
*
|
|
71
|
+
* `id` is the identifier `POST /session/device/activate` takes. It names the
|
|
72
|
+
* PAIR, not the account: the same `accountId` legitimately appears under two
|
|
73
|
+
* principals on a shared device, and those are different sessions, permissions,
|
|
74
|
+
* audit actors and revocation paths.
|
|
75
|
+
*
|
|
76
|
+
* `onDevice` is `false` for a context the principal may act as but has never
|
|
77
|
+
* activated here — it exists as a row so it has a stable id to activate, and
|
|
78
|
+
* its delegated session is minted on first activation rather than eagerly for
|
|
79
|
+
* every organization the principal belongs to.
|
|
80
|
+
*
|
|
81
|
+
* `available` is `principalLive && (personal || live account:act_as)`, and the
|
|
82
|
+
* principal clause is not decoration: a principal whose own personal session
|
|
83
|
+
* has died makes EVERY context of theirs unavailable, including delegated ones
|
|
84
|
+
* whose sessions are perfectly alive. Activation verifies the principal's
|
|
85
|
+
* personal session (ADR 0002 step 3), so a client that models availability as
|
|
86
|
+
* "delegated context has a live session ⇒ activatable" will be refused by the
|
|
87
|
+
* server and the context healed away.
|
|
88
|
+
*
|
|
89
|
+
* A managed account whose membership was revoked is returned with
|
|
90
|
+
* `available: false` rather than silently omitted, so the UI can explain a row
|
|
91
|
+
* disappearing instead of just dropping it.
|
|
92
|
+
*
|
|
93
|
+
* (An earlier version of this comment described `available` as the
|
|
94
|
+
* `account:act_as` verdict alone. It was written before the server existed and
|
|
95
|
+
* was weaker than the code that shipped — the kind of wrong statement nothing
|
|
96
|
+
* recomputes, so it is spelled out here in full.)
|
|
97
|
+
*/
|
|
98
|
+
export declare const deviceAccountContextSchema: z.ZodObject<{
|
|
99
|
+
id: z.ZodString;
|
|
100
|
+
accountId: z.ZodString;
|
|
101
|
+
kind: z.ZodEnum<["personal", "organization", "project", "bot", "channel"]>;
|
|
102
|
+
relationship: z.ZodEnum<["self", "owner", "member"]>;
|
|
103
|
+
account: z.ZodObject<{
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
username: z.ZodString;
|
|
106
|
+
name: z.ZodOptional<z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>>;
|
|
107
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
108
|
+
/**
|
|
109
|
+
* Named Bloom color preset (e.g. `"blue"`), or null when the account has
|
|
110
|
+
* none. Same shape as `userResponseSchema.color` — one spelling of one fact,
|
|
111
|
+
* so a consumer that themes a row from either source reads the same values.
|
|
112
|
+
*/
|
|
113
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
username: string;
|
|
116
|
+
id: string;
|
|
117
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
118
|
+
avatar?: string | null | undefined;
|
|
119
|
+
color?: string | null | undefined;
|
|
120
|
+
}, {
|
|
121
|
+
username: string;
|
|
122
|
+
id: string;
|
|
123
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
124
|
+
avatar?: string | null | undefined;
|
|
125
|
+
color?: string | null | undefined;
|
|
126
|
+
}>;
|
|
127
|
+
onDevice: z.ZodBoolean;
|
|
128
|
+
available: z.ZodBoolean;
|
|
129
|
+
active: z.ZodBoolean;
|
|
130
|
+
lastUsedAt: z.ZodNullable<z.ZodNumber>;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
133
|
+
accountId: string;
|
|
134
|
+
id: string;
|
|
135
|
+
relationship: "self" | "owner" | "member";
|
|
136
|
+
account: {
|
|
137
|
+
username: string;
|
|
138
|
+
id: string;
|
|
139
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
140
|
+
avatar?: string | null | undefined;
|
|
141
|
+
color?: string | null | undefined;
|
|
142
|
+
};
|
|
143
|
+
onDevice: boolean;
|
|
144
|
+
available: boolean;
|
|
145
|
+
active: boolean;
|
|
146
|
+
lastUsedAt: number | null;
|
|
147
|
+
}, {
|
|
148
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
149
|
+
accountId: string;
|
|
150
|
+
id: string;
|
|
151
|
+
relationship: "self" | "owner" | "member";
|
|
152
|
+
account: {
|
|
153
|
+
username: string;
|
|
154
|
+
id: string;
|
|
155
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
156
|
+
avatar?: string | null | undefined;
|
|
157
|
+
color?: string | null | undefined;
|
|
158
|
+
};
|
|
159
|
+
onDevice: boolean;
|
|
160
|
+
available: boolean;
|
|
161
|
+
active: boolean;
|
|
162
|
+
lastUsedAt: number | null;
|
|
163
|
+
}>;
|
|
164
|
+
/**
|
|
165
|
+
* A human who authenticated onto this device.
|
|
166
|
+
*
|
|
167
|
+
* Never an organization, project, channel or bot — those are subjects a
|
|
168
|
+
* principal acts as, and they appear only in `contexts`. `authuser` is the
|
|
169
|
+
* Google-style signed-in-human slot and belongs HERE, not to an account: adding
|
|
170
|
+
* an organization must never consume one.
|
|
171
|
+
*/
|
|
172
|
+
export declare const devicePrincipalSchema: z.ZodObject<{
|
|
173
|
+
id: z.ZodString;
|
|
174
|
+
userId: z.ZodString;
|
|
175
|
+
authuser: z.ZodNumber;
|
|
176
|
+
user: z.ZodObject<{
|
|
177
|
+
id: z.ZodString;
|
|
178
|
+
username: z.ZodString;
|
|
179
|
+
name: z.ZodOptional<z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>>;
|
|
180
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
181
|
+
/**
|
|
182
|
+
* Named Bloom color preset (e.g. `"blue"`), or null when the account has
|
|
183
|
+
* none. Same shape as `userResponseSchema.color` — one spelling of one fact,
|
|
184
|
+
* so a consumer that themes a row from either source reads the same values.
|
|
185
|
+
*/
|
|
186
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
187
|
+
}, "strip", z.ZodTypeAny, {
|
|
188
|
+
username: string;
|
|
189
|
+
id: string;
|
|
190
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
191
|
+
avatar?: string | null | undefined;
|
|
192
|
+
color?: string | null | undefined;
|
|
193
|
+
}, {
|
|
194
|
+
username: string;
|
|
195
|
+
id: string;
|
|
196
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
197
|
+
avatar?: string | null | undefined;
|
|
198
|
+
color?: string | null | undefined;
|
|
199
|
+
}>;
|
|
200
|
+
contexts: z.ZodArray<z.ZodObject<{
|
|
201
|
+
id: z.ZodString;
|
|
202
|
+
accountId: z.ZodString;
|
|
203
|
+
kind: z.ZodEnum<["personal", "organization", "project", "bot", "channel"]>;
|
|
204
|
+
relationship: z.ZodEnum<["self", "owner", "member"]>;
|
|
205
|
+
account: z.ZodObject<{
|
|
206
|
+
id: z.ZodString;
|
|
207
|
+
username: z.ZodString;
|
|
208
|
+
name: z.ZodOptional<z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>>;
|
|
209
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
210
|
+
/**
|
|
211
|
+
* Named Bloom color preset (e.g. `"blue"`), or null when the account has
|
|
212
|
+
* none. Same shape as `userResponseSchema.color` — one spelling of one fact,
|
|
213
|
+
* so a consumer that themes a row from either source reads the same values.
|
|
214
|
+
*/
|
|
215
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
216
|
+
}, "strip", z.ZodTypeAny, {
|
|
217
|
+
username: string;
|
|
218
|
+
id: string;
|
|
219
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
220
|
+
avatar?: string | null | undefined;
|
|
221
|
+
color?: string | null | undefined;
|
|
222
|
+
}, {
|
|
223
|
+
username: string;
|
|
224
|
+
id: string;
|
|
225
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
226
|
+
avatar?: string | null | undefined;
|
|
227
|
+
color?: string | null | undefined;
|
|
228
|
+
}>;
|
|
229
|
+
onDevice: z.ZodBoolean;
|
|
230
|
+
available: z.ZodBoolean;
|
|
231
|
+
active: z.ZodBoolean;
|
|
232
|
+
lastUsedAt: z.ZodNullable<z.ZodNumber>;
|
|
233
|
+
}, "strip", z.ZodTypeAny, {
|
|
234
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
235
|
+
accountId: string;
|
|
236
|
+
id: string;
|
|
237
|
+
relationship: "self" | "owner" | "member";
|
|
238
|
+
account: {
|
|
239
|
+
username: string;
|
|
240
|
+
id: string;
|
|
241
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
242
|
+
avatar?: string | null | undefined;
|
|
243
|
+
color?: string | null | undefined;
|
|
244
|
+
};
|
|
245
|
+
onDevice: boolean;
|
|
246
|
+
available: boolean;
|
|
247
|
+
active: boolean;
|
|
248
|
+
lastUsedAt: number | null;
|
|
249
|
+
}, {
|
|
250
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
251
|
+
accountId: string;
|
|
252
|
+
id: string;
|
|
253
|
+
relationship: "self" | "owner" | "member";
|
|
254
|
+
account: {
|
|
255
|
+
username: string;
|
|
256
|
+
id: string;
|
|
257
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
258
|
+
avatar?: string | null | undefined;
|
|
259
|
+
color?: string | null | undefined;
|
|
260
|
+
};
|
|
261
|
+
onDevice: boolean;
|
|
262
|
+
available: boolean;
|
|
263
|
+
active: boolean;
|
|
264
|
+
lastUsedAt: number | null;
|
|
265
|
+
}>, "many">;
|
|
266
|
+
}, "strip", z.ZodTypeAny, {
|
|
267
|
+
authuser: number;
|
|
268
|
+
userId: string;
|
|
269
|
+
id: string;
|
|
270
|
+
user: {
|
|
271
|
+
username: string;
|
|
272
|
+
id: string;
|
|
273
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
274
|
+
avatar?: string | null | undefined;
|
|
275
|
+
color?: string | null | undefined;
|
|
276
|
+
};
|
|
277
|
+
contexts: {
|
|
278
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
279
|
+
accountId: string;
|
|
280
|
+
id: string;
|
|
281
|
+
relationship: "self" | "owner" | "member";
|
|
282
|
+
account: {
|
|
283
|
+
username: string;
|
|
284
|
+
id: string;
|
|
285
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
286
|
+
avatar?: string | null | undefined;
|
|
287
|
+
color?: string | null | undefined;
|
|
288
|
+
};
|
|
289
|
+
onDevice: boolean;
|
|
290
|
+
available: boolean;
|
|
291
|
+
active: boolean;
|
|
292
|
+
lastUsedAt: number | null;
|
|
293
|
+
}[];
|
|
294
|
+
}, {
|
|
295
|
+
authuser: number;
|
|
296
|
+
userId: string;
|
|
297
|
+
id: string;
|
|
298
|
+
user: {
|
|
299
|
+
username: string;
|
|
300
|
+
id: string;
|
|
301
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
302
|
+
avatar?: string | null | undefined;
|
|
303
|
+
color?: string | null | undefined;
|
|
304
|
+
};
|
|
305
|
+
contexts: {
|
|
306
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
307
|
+
accountId: string;
|
|
308
|
+
id: string;
|
|
309
|
+
relationship: "self" | "owner" | "member";
|
|
310
|
+
account: {
|
|
311
|
+
username: string;
|
|
312
|
+
id: string;
|
|
313
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
314
|
+
avatar?: string | null | undefined;
|
|
315
|
+
color?: string | null | undefined;
|
|
316
|
+
};
|
|
317
|
+
onDevice: boolean;
|
|
318
|
+
available: boolean;
|
|
319
|
+
active: boolean;
|
|
320
|
+
lastUsedAt: number | null;
|
|
321
|
+
}[];
|
|
322
|
+
}>;
|
|
323
|
+
/**
|
|
324
|
+
* Response of `GET /session/device/directory`.
|
|
325
|
+
*
|
|
326
|
+
* `activeContextId` is the authority for what every official app in
|
|
327
|
+
* `sessionMode: 'account'` renders. It is null when the device has no active
|
|
328
|
+
* context — a real state (every context removed, or an active context healed
|
|
329
|
+
* away), not an error.
|
|
330
|
+
*/
|
|
331
|
+
export declare const deviceDirectorySchema: z.ZodObject<{
|
|
332
|
+
deviceId: z.ZodString;
|
|
333
|
+
revision: z.ZodNumber;
|
|
334
|
+
activeContextId: z.ZodNullable<z.ZodString>;
|
|
335
|
+
principals: z.ZodArray<z.ZodObject<{
|
|
336
|
+
id: z.ZodString;
|
|
337
|
+
userId: z.ZodString;
|
|
338
|
+
authuser: z.ZodNumber;
|
|
339
|
+
user: z.ZodObject<{
|
|
340
|
+
id: z.ZodString;
|
|
341
|
+
username: z.ZodString;
|
|
342
|
+
name: z.ZodOptional<z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>>;
|
|
343
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
344
|
+
/**
|
|
345
|
+
* Named Bloom color preset (e.g. `"blue"`), or null when the account has
|
|
346
|
+
* none. Same shape as `userResponseSchema.color` — one spelling of one fact,
|
|
347
|
+
* so a consumer that themes a row from either source reads the same values.
|
|
348
|
+
*/
|
|
349
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
350
|
+
}, "strip", z.ZodTypeAny, {
|
|
351
|
+
username: string;
|
|
352
|
+
id: string;
|
|
353
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
354
|
+
avatar?: string | null | undefined;
|
|
355
|
+
color?: string | null | undefined;
|
|
356
|
+
}, {
|
|
357
|
+
username: string;
|
|
358
|
+
id: string;
|
|
359
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
360
|
+
avatar?: string | null | undefined;
|
|
361
|
+
color?: string | null | undefined;
|
|
362
|
+
}>;
|
|
363
|
+
contexts: z.ZodArray<z.ZodObject<{
|
|
364
|
+
id: z.ZodString;
|
|
365
|
+
accountId: z.ZodString;
|
|
366
|
+
kind: z.ZodEnum<["personal", "organization", "project", "bot", "channel"]>;
|
|
367
|
+
relationship: z.ZodEnum<["self", "owner", "member"]>;
|
|
368
|
+
account: z.ZodObject<{
|
|
369
|
+
id: z.ZodString;
|
|
370
|
+
username: z.ZodString;
|
|
371
|
+
name: z.ZodOptional<z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>>;
|
|
372
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
373
|
+
/**
|
|
374
|
+
* Named Bloom color preset (e.g. `"blue"`), or null when the account has
|
|
375
|
+
* none. Same shape as `userResponseSchema.color` — one spelling of one fact,
|
|
376
|
+
* so a consumer that themes a row from either source reads the same values.
|
|
377
|
+
*/
|
|
378
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
379
|
+
}, "strip", z.ZodTypeAny, {
|
|
380
|
+
username: string;
|
|
381
|
+
id: string;
|
|
382
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
383
|
+
avatar?: string | null | undefined;
|
|
384
|
+
color?: string | null | undefined;
|
|
385
|
+
}, {
|
|
386
|
+
username: string;
|
|
387
|
+
id: string;
|
|
388
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
389
|
+
avatar?: string | null | undefined;
|
|
390
|
+
color?: string | null | undefined;
|
|
391
|
+
}>;
|
|
392
|
+
onDevice: z.ZodBoolean;
|
|
393
|
+
available: z.ZodBoolean;
|
|
394
|
+
active: z.ZodBoolean;
|
|
395
|
+
lastUsedAt: z.ZodNullable<z.ZodNumber>;
|
|
396
|
+
}, "strip", z.ZodTypeAny, {
|
|
397
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
398
|
+
accountId: string;
|
|
399
|
+
id: string;
|
|
400
|
+
relationship: "self" | "owner" | "member";
|
|
401
|
+
account: {
|
|
402
|
+
username: string;
|
|
403
|
+
id: string;
|
|
404
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
405
|
+
avatar?: string | null | undefined;
|
|
406
|
+
color?: string | null | undefined;
|
|
407
|
+
};
|
|
408
|
+
onDevice: boolean;
|
|
409
|
+
available: boolean;
|
|
410
|
+
active: boolean;
|
|
411
|
+
lastUsedAt: number | null;
|
|
412
|
+
}, {
|
|
413
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
414
|
+
accountId: string;
|
|
415
|
+
id: string;
|
|
416
|
+
relationship: "self" | "owner" | "member";
|
|
417
|
+
account: {
|
|
418
|
+
username: string;
|
|
419
|
+
id: string;
|
|
420
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
421
|
+
avatar?: string | null | undefined;
|
|
422
|
+
color?: string | null | undefined;
|
|
423
|
+
};
|
|
424
|
+
onDevice: boolean;
|
|
425
|
+
available: boolean;
|
|
426
|
+
active: boolean;
|
|
427
|
+
lastUsedAt: number | null;
|
|
428
|
+
}>, "many">;
|
|
429
|
+
}, "strip", z.ZodTypeAny, {
|
|
430
|
+
authuser: number;
|
|
431
|
+
userId: string;
|
|
432
|
+
id: string;
|
|
433
|
+
user: {
|
|
434
|
+
username: string;
|
|
435
|
+
id: string;
|
|
436
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
437
|
+
avatar?: string | null | undefined;
|
|
438
|
+
color?: string | null | undefined;
|
|
439
|
+
};
|
|
440
|
+
contexts: {
|
|
441
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
442
|
+
accountId: string;
|
|
443
|
+
id: string;
|
|
444
|
+
relationship: "self" | "owner" | "member";
|
|
445
|
+
account: {
|
|
446
|
+
username: string;
|
|
447
|
+
id: string;
|
|
448
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
449
|
+
avatar?: string | null | undefined;
|
|
450
|
+
color?: string | null | undefined;
|
|
451
|
+
};
|
|
452
|
+
onDevice: boolean;
|
|
453
|
+
available: boolean;
|
|
454
|
+
active: boolean;
|
|
455
|
+
lastUsedAt: number | null;
|
|
456
|
+
}[];
|
|
457
|
+
}, {
|
|
458
|
+
authuser: number;
|
|
459
|
+
userId: string;
|
|
460
|
+
id: string;
|
|
461
|
+
user: {
|
|
462
|
+
username: string;
|
|
463
|
+
id: string;
|
|
464
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
465
|
+
avatar?: string | null | undefined;
|
|
466
|
+
color?: string | null | undefined;
|
|
467
|
+
};
|
|
468
|
+
contexts: {
|
|
469
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
470
|
+
accountId: string;
|
|
471
|
+
id: string;
|
|
472
|
+
relationship: "self" | "owner" | "member";
|
|
473
|
+
account: {
|
|
474
|
+
username: string;
|
|
475
|
+
id: string;
|
|
476
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
477
|
+
avatar?: string | null | undefined;
|
|
478
|
+
color?: string | null | undefined;
|
|
479
|
+
};
|
|
480
|
+
onDevice: boolean;
|
|
481
|
+
available: boolean;
|
|
482
|
+
active: boolean;
|
|
483
|
+
lastUsedAt: number | null;
|
|
484
|
+
}[];
|
|
485
|
+
}>, "many">;
|
|
486
|
+
updatedAt: z.ZodNumber;
|
|
487
|
+
}, "strip", z.ZodTypeAny, {
|
|
488
|
+
deviceId: string;
|
|
489
|
+
revision: number;
|
|
490
|
+
updatedAt: number;
|
|
491
|
+
activeContextId: string | null;
|
|
492
|
+
principals: {
|
|
493
|
+
authuser: number;
|
|
494
|
+
userId: string;
|
|
495
|
+
id: string;
|
|
496
|
+
user: {
|
|
497
|
+
username: string;
|
|
498
|
+
id: string;
|
|
499
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
500
|
+
avatar?: string | null | undefined;
|
|
501
|
+
color?: string | null | undefined;
|
|
502
|
+
};
|
|
503
|
+
contexts: {
|
|
504
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
505
|
+
accountId: string;
|
|
506
|
+
id: string;
|
|
507
|
+
relationship: "self" | "owner" | "member";
|
|
508
|
+
account: {
|
|
509
|
+
username: string;
|
|
510
|
+
id: string;
|
|
511
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
512
|
+
avatar?: string | null | undefined;
|
|
513
|
+
color?: string | null | undefined;
|
|
514
|
+
};
|
|
515
|
+
onDevice: boolean;
|
|
516
|
+
available: boolean;
|
|
517
|
+
active: boolean;
|
|
518
|
+
lastUsedAt: number | null;
|
|
519
|
+
}[];
|
|
520
|
+
}[];
|
|
521
|
+
}, {
|
|
522
|
+
deviceId: string;
|
|
523
|
+
revision: number;
|
|
524
|
+
updatedAt: number;
|
|
525
|
+
activeContextId: string | null;
|
|
526
|
+
principals: {
|
|
527
|
+
authuser: number;
|
|
528
|
+
userId: string;
|
|
529
|
+
id: string;
|
|
530
|
+
user: {
|
|
531
|
+
username: string;
|
|
532
|
+
id: string;
|
|
533
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
534
|
+
avatar?: string | null | undefined;
|
|
535
|
+
color?: string | null | undefined;
|
|
536
|
+
};
|
|
537
|
+
contexts: {
|
|
538
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
539
|
+
accountId: string;
|
|
540
|
+
id: string;
|
|
541
|
+
relationship: "self" | "owner" | "member";
|
|
542
|
+
account: {
|
|
543
|
+
username: string;
|
|
544
|
+
id: string;
|
|
545
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
546
|
+
avatar?: string | null | undefined;
|
|
547
|
+
color?: string | null | undefined;
|
|
548
|
+
};
|
|
549
|
+
onDevice: boolean;
|
|
550
|
+
available: boolean;
|
|
551
|
+
active: boolean;
|
|
552
|
+
lastUsedAt: number | null;
|
|
553
|
+
}[];
|
|
554
|
+
}[];
|
|
555
|
+
}>;
|
|
556
|
+
/**
|
|
557
|
+
* Request body of `POST /session/device/activate`.
|
|
558
|
+
*
|
|
559
|
+
* `contextId`, never `accountId`: an account id cannot name a context on a
|
|
560
|
+
* device where two people can both reach the same organization, and resolving
|
|
561
|
+
* that ambiguity server-side would mean guessing inside an authorization path.
|
|
562
|
+
*/
|
|
563
|
+
export declare const deviceActivateRequestSchema: z.ZodObject<{
|
|
564
|
+
contextId: z.ZodString;
|
|
565
|
+
}, "strip", z.ZodTypeAny, {
|
|
566
|
+
contextId: string;
|
|
567
|
+
}, {
|
|
568
|
+
contextId: string;
|
|
569
|
+
}>;
|
|
570
|
+
/**
|
|
571
|
+
* Response of `POST /session/device/activate`.
|
|
572
|
+
*
|
|
573
|
+
* Carries the post-transition directory AND the bearer for the newly active
|
|
574
|
+
* context, because the client's ordering invariant is
|
|
575
|
+
* `commit token → reset caches → publish snapshot → notify` (ADR 0002). Handing
|
|
576
|
+
* the directory back without the token would force a second round trip in the
|
|
577
|
+
* middle of that sequence, which is exactly where a component would render the
|
|
578
|
+
* new subject while still holding the previous subject's bearer.
|
|
579
|
+
*
|
|
580
|
+
* `activeToken` is null when the activation legitimately produced no bearer for
|
|
581
|
+
* THIS caller — an identity-pinned client, or a caller whose application is not
|
|
582
|
+
* entitled to a token for the new context. It is never an error signal.
|
|
583
|
+
*/
|
|
584
|
+
export declare const deviceActivateResponseSchema: z.ZodObject<{
|
|
585
|
+
directory: z.ZodObject<{
|
|
586
|
+
deviceId: z.ZodString;
|
|
587
|
+
revision: z.ZodNumber;
|
|
588
|
+
activeContextId: z.ZodNullable<z.ZodString>;
|
|
589
|
+
principals: z.ZodArray<z.ZodObject<{
|
|
590
|
+
id: z.ZodString;
|
|
591
|
+
userId: z.ZodString;
|
|
592
|
+
authuser: z.ZodNumber;
|
|
593
|
+
user: z.ZodObject<{
|
|
594
|
+
id: z.ZodString;
|
|
595
|
+
username: z.ZodString;
|
|
596
|
+
name: z.ZodOptional<z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>>;
|
|
597
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
598
|
+
/**
|
|
599
|
+
* Named Bloom color preset (e.g. `"blue"`), or null when the account has
|
|
600
|
+
* none. Same shape as `userResponseSchema.color` — one spelling of one fact,
|
|
601
|
+
* so a consumer that themes a row from either source reads the same values.
|
|
602
|
+
*/
|
|
603
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
604
|
+
}, "strip", z.ZodTypeAny, {
|
|
605
|
+
username: string;
|
|
606
|
+
id: string;
|
|
607
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
608
|
+
avatar?: string | null | undefined;
|
|
609
|
+
color?: string | null | undefined;
|
|
610
|
+
}, {
|
|
611
|
+
username: string;
|
|
612
|
+
id: string;
|
|
613
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
614
|
+
avatar?: string | null | undefined;
|
|
615
|
+
color?: string | null | undefined;
|
|
616
|
+
}>;
|
|
617
|
+
contexts: z.ZodArray<z.ZodObject<{
|
|
618
|
+
id: z.ZodString;
|
|
619
|
+
accountId: z.ZodString;
|
|
620
|
+
kind: z.ZodEnum<["personal", "organization", "project", "bot", "channel"]>;
|
|
621
|
+
relationship: z.ZodEnum<["self", "owner", "member"]>;
|
|
622
|
+
account: z.ZodObject<{
|
|
623
|
+
id: z.ZodString;
|
|
624
|
+
username: z.ZodString;
|
|
625
|
+
name: z.ZodOptional<z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>>;
|
|
626
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
627
|
+
/**
|
|
628
|
+
* Named Bloom color preset (e.g. `"blue"`), or null when the account has
|
|
629
|
+
* none. Same shape as `userResponseSchema.color` — one spelling of one fact,
|
|
630
|
+
* so a consumer that themes a row from either source reads the same values.
|
|
631
|
+
*/
|
|
632
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
633
|
+
}, "strip", z.ZodTypeAny, {
|
|
634
|
+
username: string;
|
|
635
|
+
id: string;
|
|
636
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
637
|
+
avatar?: string | null | undefined;
|
|
638
|
+
color?: string | null | undefined;
|
|
639
|
+
}, {
|
|
640
|
+
username: string;
|
|
641
|
+
id: string;
|
|
642
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
643
|
+
avatar?: string | null | undefined;
|
|
644
|
+
color?: string | null | undefined;
|
|
645
|
+
}>;
|
|
646
|
+
onDevice: z.ZodBoolean;
|
|
647
|
+
available: z.ZodBoolean;
|
|
648
|
+
active: z.ZodBoolean;
|
|
649
|
+
lastUsedAt: z.ZodNullable<z.ZodNumber>;
|
|
650
|
+
}, "strip", z.ZodTypeAny, {
|
|
651
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
652
|
+
accountId: string;
|
|
653
|
+
id: string;
|
|
654
|
+
relationship: "self" | "owner" | "member";
|
|
655
|
+
account: {
|
|
656
|
+
username: string;
|
|
657
|
+
id: string;
|
|
658
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
659
|
+
avatar?: string | null | undefined;
|
|
660
|
+
color?: string | null | undefined;
|
|
661
|
+
};
|
|
662
|
+
onDevice: boolean;
|
|
663
|
+
available: boolean;
|
|
664
|
+
active: boolean;
|
|
665
|
+
lastUsedAt: number | null;
|
|
666
|
+
}, {
|
|
667
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
668
|
+
accountId: string;
|
|
669
|
+
id: string;
|
|
670
|
+
relationship: "self" | "owner" | "member";
|
|
671
|
+
account: {
|
|
672
|
+
username: string;
|
|
673
|
+
id: string;
|
|
674
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
675
|
+
avatar?: string | null | undefined;
|
|
676
|
+
color?: string | null | undefined;
|
|
677
|
+
};
|
|
678
|
+
onDevice: boolean;
|
|
679
|
+
available: boolean;
|
|
680
|
+
active: boolean;
|
|
681
|
+
lastUsedAt: number | null;
|
|
682
|
+
}>, "many">;
|
|
683
|
+
}, "strip", z.ZodTypeAny, {
|
|
684
|
+
authuser: number;
|
|
685
|
+
userId: string;
|
|
686
|
+
id: string;
|
|
687
|
+
user: {
|
|
688
|
+
username: string;
|
|
689
|
+
id: string;
|
|
690
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
691
|
+
avatar?: string | null | undefined;
|
|
692
|
+
color?: string | null | undefined;
|
|
693
|
+
};
|
|
694
|
+
contexts: {
|
|
695
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
696
|
+
accountId: string;
|
|
697
|
+
id: string;
|
|
698
|
+
relationship: "self" | "owner" | "member";
|
|
699
|
+
account: {
|
|
700
|
+
username: string;
|
|
701
|
+
id: string;
|
|
702
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
703
|
+
avatar?: string | null | undefined;
|
|
704
|
+
color?: string | null | undefined;
|
|
705
|
+
};
|
|
706
|
+
onDevice: boolean;
|
|
707
|
+
available: boolean;
|
|
708
|
+
active: boolean;
|
|
709
|
+
lastUsedAt: number | null;
|
|
710
|
+
}[];
|
|
711
|
+
}, {
|
|
712
|
+
authuser: number;
|
|
713
|
+
userId: string;
|
|
714
|
+
id: string;
|
|
715
|
+
user: {
|
|
716
|
+
username: string;
|
|
717
|
+
id: string;
|
|
718
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
719
|
+
avatar?: string | null | undefined;
|
|
720
|
+
color?: string | null | undefined;
|
|
721
|
+
};
|
|
722
|
+
contexts: {
|
|
723
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
724
|
+
accountId: string;
|
|
725
|
+
id: string;
|
|
726
|
+
relationship: "self" | "owner" | "member";
|
|
727
|
+
account: {
|
|
728
|
+
username: string;
|
|
729
|
+
id: string;
|
|
730
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
731
|
+
avatar?: string | null | undefined;
|
|
732
|
+
color?: string | null | undefined;
|
|
733
|
+
};
|
|
734
|
+
onDevice: boolean;
|
|
735
|
+
available: boolean;
|
|
736
|
+
active: boolean;
|
|
737
|
+
lastUsedAt: number | null;
|
|
738
|
+
}[];
|
|
739
|
+
}>, "many">;
|
|
740
|
+
updatedAt: z.ZodNumber;
|
|
741
|
+
}, "strip", z.ZodTypeAny, {
|
|
742
|
+
deviceId: string;
|
|
743
|
+
revision: number;
|
|
744
|
+
updatedAt: number;
|
|
745
|
+
activeContextId: string | null;
|
|
746
|
+
principals: {
|
|
747
|
+
authuser: number;
|
|
748
|
+
userId: string;
|
|
749
|
+
id: string;
|
|
750
|
+
user: {
|
|
751
|
+
username: string;
|
|
752
|
+
id: string;
|
|
753
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
754
|
+
avatar?: string | null | undefined;
|
|
755
|
+
color?: string | null | undefined;
|
|
756
|
+
};
|
|
757
|
+
contexts: {
|
|
758
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
759
|
+
accountId: string;
|
|
760
|
+
id: string;
|
|
761
|
+
relationship: "self" | "owner" | "member";
|
|
762
|
+
account: {
|
|
763
|
+
username: string;
|
|
764
|
+
id: string;
|
|
765
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
766
|
+
avatar?: string | null | undefined;
|
|
767
|
+
color?: string | null | undefined;
|
|
768
|
+
};
|
|
769
|
+
onDevice: boolean;
|
|
770
|
+
available: boolean;
|
|
771
|
+
active: boolean;
|
|
772
|
+
lastUsedAt: number | null;
|
|
773
|
+
}[];
|
|
774
|
+
}[];
|
|
775
|
+
}, {
|
|
776
|
+
deviceId: string;
|
|
777
|
+
revision: number;
|
|
778
|
+
updatedAt: number;
|
|
779
|
+
activeContextId: string | null;
|
|
780
|
+
principals: {
|
|
781
|
+
authuser: number;
|
|
782
|
+
userId: string;
|
|
783
|
+
id: string;
|
|
784
|
+
user: {
|
|
785
|
+
username: string;
|
|
786
|
+
id: string;
|
|
787
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
788
|
+
avatar?: string | null | undefined;
|
|
789
|
+
color?: string | null | undefined;
|
|
790
|
+
};
|
|
791
|
+
contexts: {
|
|
792
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
793
|
+
accountId: string;
|
|
794
|
+
id: string;
|
|
795
|
+
relationship: "self" | "owner" | "member";
|
|
796
|
+
account: {
|
|
797
|
+
username: string;
|
|
798
|
+
id: string;
|
|
799
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
800
|
+
avatar?: string | null | undefined;
|
|
801
|
+
color?: string | null | undefined;
|
|
802
|
+
};
|
|
803
|
+
onDevice: boolean;
|
|
804
|
+
available: boolean;
|
|
805
|
+
active: boolean;
|
|
806
|
+
lastUsedAt: number | null;
|
|
807
|
+
}[];
|
|
808
|
+
}[];
|
|
809
|
+
}>;
|
|
810
|
+
activeToken: z.ZodNullable<z.ZodObject<{
|
|
811
|
+
accessToken: z.ZodString;
|
|
812
|
+
expiresAt: z.ZodString;
|
|
813
|
+
}, "strip", z.ZodTypeAny, {
|
|
814
|
+
accessToken: string;
|
|
815
|
+
expiresAt: string;
|
|
816
|
+
}, {
|
|
817
|
+
accessToken: string;
|
|
818
|
+
expiresAt: string;
|
|
819
|
+
}>>;
|
|
820
|
+
}, "strip", z.ZodTypeAny, {
|
|
821
|
+
activeToken: {
|
|
822
|
+
accessToken: string;
|
|
823
|
+
expiresAt: string;
|
|
824
|
+
} | null;
|
|
825
|
+
directory: {
|
|
826
|
+
deviceId: string;
|
|
827
|
+
revision: number;
|
|
828
|
+
updatedAt: number;
|
|
829
|
+
activeContextId: string | null;
|
|
830
|
+
principals: {
|
|
831
|
+
authuser: number;
|
|
832
|
+
userId: string;
|
|
833
|
+
id: string;
|
|
834
|
+
user: {
|
|
835
|
+
username: string;
|
|
836
|
+
id: string;
|
|
837
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
838
|
+
avatar?: string | null | undefined;
|
|
839
|
+
color?: string | null | undefined;
|
|
840
|
+
};
|
|
841
|
+
contexts: {
|
|
842
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
843
|
+
accountId: string;
|
|
844
|
+
id: string;
|
|
845
|
+
relationship: "self" | "owner" | "member";
|
|
846
|
+
account: {
|
|
847
|
+
username: string;
|
|
848
|
+
id: string;
|
|
849
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
850
|
+
avatar?: string | null | undefined;
|
|
851
|
+
color?: string | null | undefined;
|
|
852
|
+
};
|
|
853
|
+
onDevice: boolean;
|
|
854
|
+
available: boolean;
|
|
855
|
+
active: boolean;
|
|
856
|
+
lastUsedAt: number | null;
|
|
857
|
+
}[];
|
|
858
|
+
}[];
|
|
859
|
+
};
|
|
860
|
+
}, {
|
|
861
|
+
activeToken: {
|
|
862
|
+
accessToken: string;
|
|
863
|
+
expiresAt: string;
|
|
864
|
+
} | null;
|
|
865
|
+
directory: {
|
|
866
|
+
deviceId: string;
|
|
867
|
+
revision: number;
|
|
868
|
+
updatedAt: number;
|
|
869
|
+
activeContextId: string | null;
|
|
870
|
+
principals: {
|
|
871
|
+
authuser: number;
|
|
872
|
+
userId: string;
|
|
873
|
+
id: string;
|
|
874
|
+
user: {
|
|
875
|
+
username: string;
|
|
876
|
+
id: string;
|
|
877
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
878
|
+
avatar?: string | null | undefined;
|
|
879
|
+
color?: string | null | undefined;
|
|
880
|
+
};
|
|
881
|
+
contexts: {
|
|
882
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
883
|
+
accountId: string;
|
|
884
|
+
id: string;
|
|
885
|
+
relationship: "self" | "owner" | "member";
|
|
886
|
+
account: {
|
|
887
|
+
username: string;
|
|
888
|
+
id: string;
|
|
889
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
890
|
+
avatar?: string | null | undefined;
|
|
891
|
+
color?: string | null | undefined;
|
|
892
|
+
};
|
|
893
|
+
onDevice: boolean;
|
|
894
|
+
available: boolean;
|
|
895
|
+
active: boolean;
|
|
896
|
+
lastUsedAt: number | null;
|
|
897
|
+
}[];
|
|
898
|
+
}[];
|
|
899
|
+
};
|
|
900
|
+
}>;
|
|
901
|
+
/**
|
|
902
|
+
* Response of the CONTEXT-aware removals — `POST /session/device/signout` with
|
|
903
|
+
* `{ contextId }` (one `principal → account` pair) or `{ principalId }` (one
|
|
904
|
+
* person and every context they reach, and nobody else's).
|
|
905
|
+
*
|
|
906
|
+
* It carries BOTH halves because a removal elects a replacement active context,
|
|
907
|
+
* so both the directory and the flat compatibility projection move in the same
|
|
908
|
+
* transition — and a client that learned only one of them would render one
|
|
909
|
+
* half of a device that no longer exists.
|
|
910
|
+
*
|
|
911
|
+
* This is deliberately NOT {@link deviceSessionSyncSchema} and must never be
|
|
912
|
+
* merged into it. A zod object strips unknown keys, so `{directory, state,
|
|
913
|
+
* activeToken}` parses cleanly as `{state, activeToken}` — silently dropping the
|
|
914
|
+
* directory. One schema covering both shapes would therefore make "the server
|
|
915
|
+
* stopped sending the directory" and "this endpoint never sends one"
|
|
916
|
+
* indistinguishable at the parse, on the exact path that decides which identity
|
|
917
|
+
* the app is running as. Two schemas fail closed instead: `directory` is
|
|
918
|
+
* required here, so a directory-less payload is refused outright.
|
|
919
|
+
*
|
|
920
|
+
* `activeToken` is null on the same terms as everywhere else — an identity-
|
|
921
|
+
* pinned caller, or one not entitled to a bearer for the newly-elected context —
|
|
922
|
+
* and null is also the honest answer when the removal left the device with no
|
|
923
|
+
* active context at all.
|
|
924
|
+
*/
|
|
925
|
+
export declare const deviceDirectorySyncSchema: z.ZodObject<{
|
|
926
|
+
directory: z.ZodObject<{
|
|
927
|
+
deviceId: z.ZodString;
|
|
928
|
+
revision: z.ZodNumber;
|
|
929
|
+
activeContextId: z.ZodNullable<z.ZodString>;
|
|
930
|
+
principals: z.ZodArray<z.ZodObject<{
|
|
931
|
+
id: z.ZodString;
|
|
932
|
+
userId: z.ZodString;
|
|
933
|
+
authuser: z.ZodNumber;
|
|
934
|
+
user: z.ZodObject<{
|
|
935
|
+
id: z.ZodString;
|
|
936
|
+
username: z.ZodString;
|
|
937
|
+
name: z.ZodOptional<z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>>;
|
|
938
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
939
|
+
/**
|
|
940
|
+
* Named Bloom color preset (e.g. `"blue"`), or null when the account has
|
|
941
|
+
* none. Same shape as `userResponseSchema.color` — one spelling of one fact,
|
|
942
|
+
* so a consumer that themes a row from either source reads the same values.
|
|
943
|
+
*/
|
|
944
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
945
|
+
}, "strip", z.ZodTypeAny, {
|
|
946
|
+
username: string;
|
|
947
|
+
id: string;
|
|
948
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
949
|
+
avatar?: string | null | undefined;
|
|
950
|
+
color?: string | null | undefined;
|
|
951
|
+
}, {
|
|
952
|
+
username: string;
|
|
953
|
+
id: string;
|
|
954
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
955
|
+
avatar?: string | null | undefined;
|
|
956
|
+
color?: string | null | undefined;
|
|
957
|
+
}>;
|
|
958
|
+
contexts: z.ZodArray<z.ZodObject<{
|
|
959
|
+
id: z.ZodString;
|
|
960
|
+
accountId: z.ZodString;
|
|
961
|
+
kind: z.ZodEnum<["personal", "organization", "project", "bot", "channel"]>;
|
|
962
|
+
relationship: z.ZodEnum<["self", "owner", "member"]>;
|
|
963
|
+
account: z.ZodObject<{
|
|
964
|
+
id: z.ZodString;
|
|
965
|
+
username: z.ZodString;
|
|
966
|
+
name: z.ZodOptional<z.ZodType<import("./userResponse").UserNameResponse, z.ZodTypeDef, import("./userResponse").UserNameResponse>>;
|
|
967
|
+
avatar: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
968
|
+
/**
|
|
969
|
+
* Named Bloom color preset (e.g. `"blue"`), or null when the account has
|
|
970
|
+
* none. Same shape as `userResponseSchema.color` — one spelling of one fact,
|
|
971
|
+
* so a consumer that themes a row from either source reads the same values.
|
|
972
|
+
*/
|
|
973
|
+
color: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
974
|
+
}, "strip", z.ZodTypeAny, {
|
|
975
|
+
username: string;
|
|
976
|
+
id: string;
|
|
977
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
978
|
+
avatar?: string | null | undefined;
|
|
979
|
+
color?: string | null | undefined;
|
|
980
|
+
}, {
|
|
981
|
+
username: string;
|
|
982
|
+
id: string;
|
|
983
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
984
|
+
avatar?: string | null | undefined;
|
|
985
|
+
color?: string | null | undefined;
|
|
986
|
+
}>;
|
|
987
|
+
onDevice: z.ZodBoolean;
|
|
988
|
+
available: z.ZodBoolean;
|
|
989
|
+
active: z.ZodBoolean;
|
|
990
|
+
lastUsedAt: z.ZodNullable<z.ZodNumber>;
|
|
991
|
+
}, "strip", z.ZodTypeAny, {
|
|
992
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
993
|
+
accountId: string;
|
|
994
|
+
id: string;
|
|
995
|
+
relationship: "self" | "owner" | "member";
|
|
996
|
+
account: {
|
|
997
|
+
username: string;
|
|
998
|
+
id: string;
|
|
999
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
1000
|
+
avatar?: string | null | undefined;
|
|
1001
|
+
color?: string | null | undefined;
|
|
1002
|
+
};
|
|
1003
|
+
onDevice: boolean;
|
|
1004
|
+
available: boolean;
|
|
1005
|
+
active: boolean;
|
|
1006
|
+
lastUsedAt: number | null;
|
|
1007
|
+
}, {
|
|
1008
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
1009
|
+
accountId: string;
|
|
1010
|
+
id: string;
|
|
1011
|
+
relationship: "self" | "owner" | "member";
|
|
1012
|
+
account: {
|
|
1013
|
+
username: string;
|
|
1014
|
+
id: string;
|
|
1015
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
1016
|
+
avatar?: string | null | undefined;
|
|
1017
|
+
color?: string | null | undefined;
|
|
1018
|
+
};
|
|
1019
|
+
onDevice: boolean;
|
|
1020
|
+
available: boolean;
|
|
1021
|
+
active: boolean;
|
|
1022
|
+
lastUsedAt: number | null;
|
|
1023
|
+
}>, "many">;
|
|
1024
|
+
}, "strip", z.ZodTypeAny, {
|
|
1025
|
+
authuser: number;
|
|
1026
|
+
userId: string;
|
|
1027
|
+
id: string;
|
|
1028
|
+
user: {
|
|
1029
|
+
username: string;
|
|
1030
|
+
id: string;
|
|
1031
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
1032
|
+
avatar?: string | null | undefined;
|
|
1033
|
+
color?: string | null | undefined;
|
|
1034
|
+
};
|
|
1035
|
+
contexts: {
|
|
1036
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
1037
|
+
accountId: string;
|
|
1038
|
+
id: string;
|
|
1039
|
+
relationship: "self" | "owner" | "member";
|
|
1040
|
+
account: {
|
|
1041
|
+
username: string;
|
|
1042
|
+
id: string;
|
|
1043
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
1044
|
+
avatar?: string | null | undefined;
|
|
1045
|
+
color?: string | null | undefined;
|
|
1046
|
+
};
|
|
1047
|
+
onDevice: boolean;
|
|
1048
|
+
available: boolean;
|
|
1049
|
+
active: boolean;
|
|
1050
|
+
lastUsedAt: number | null;
|
|
1051
|
+
}[];
|
|
1052
|
+
}, {
|
|
1053
|
+
authuser: number;
|
|
1054
|
+
userId: string;
|
|
1055
|
+
id: string;
|
|
1056
|
+
user: {
|
|
1057
|
+
username: string;
|
|
1058
|
+
id: string;
|
|
1059
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
1060
|
+
avatar?: string | null | undefined;
|
|
1061
|
+
color?: string | null | undefined;
|
|
1062
|
+
};
|
|
1063
|
+
contexts: {
|
|
1064
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
1065
|
+
accountId: string;
|
|
1066
|
+
id: string;
|
|
1067
|
+
relationship: "self" | "owner" | "member";
|
|
1068
|
+
account: {
|
|
1069
|
+
username: string;
|
|
1070
|
+
id: string;
|
|
1071
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
1072
|
+
avatar?: string | null | undefined;
|
|
1073
|
+
color?: string | null | undefined;
|
|
1074
|
+
};
|
|
1075
|
+
onDevice: boolean;
|
|
1076
|
+
available: boolean;
|
|
1077
|
+
active: boolean;
|
|
1078
|
+
lastUsedAt: number | null;
|
|
1079
|
+
}[];
|
|
1080
|
+
}>, "many">;
|
|
1081
|
+
updatedAt: z.ZodNumber;
|
|
1082
|
+
}, "strip", z.ZodTypeAny, {
|
|
1083
|
+
deviceId: string;
|
|
1084
|
+
revision: number;
|
|
1085
|
+
updatedAt: number;
|
|
1086
|
+
activeContextId: string | null;
|
|
1087
|
+
principals: {
|
|
1088
|
+
authuser: number;
|
|
1089
|
+
userId: string;
|
|
1090
|
+
id: string;
|
|
1091
|
+
user: {
|
|
1092
|
+
username: string;
|
|
1093
|
+
id: string;
|
|
1094
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
1095
|
+
avatar?: string | null | undefined;
|
|
1096
|
+
color?: string | null | undefined;
|
|
1097
|
+
};
|
|
1098
|
+
contexts: {
|
|
1099
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
1100
|
+
accountId: string;
|
|
1101
|
+
id: string;
|
|
1102
|
+
relationship: "self" | "owner" | "member";
|
|
1103
|
+
account: {
|
|
1104
|
+
username: string;
|
|
1105
|
+
id: string;
|
|
1106
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
1107
|
+
avatar?: string | null | undefined;
|
|
1108
|
+
color?: string | null | undefined;
|
|
1109
|
+
};
|
|
1110
|
+
onDevice: boolean;
|
|
1111
|
+
available: boolean;
|
|
1112
|
+
active: boolean;
|
|
1113
|
+
lastUsedAt: number | null;
|
|
1114
|
+
}[];
|
|
1115
|
+
}[];
|
|
1116
|
+
}, {
|
|
1117
|
+
deviceId: string;
|
|
1118
|
+
revision: number;
|
|
1119
|
+
updatedAt: number;
|
|
1120
|
+
activeContextId: string | null;
|
|
1121
|
+
principals: {
|
|
1122
|
+
authuser: number;
|
|
1123
|
+
userId: string;
|
|
1124
|
+
id: string;
|
|
1125
|
+
user: {
|
|
1126
|
+
username: string;
|
|
1127
|
+
id: string;
|
|
1128
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
1129
|
+
avatar?: string | null | undefined;
|
|
1130
|
+
color?: string | null | undefined;
|
|
1131
|
+
};
|
|
1132
|
+
contexts: {
|
|
1133
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
1134
|
+
accountId: string;
|
|
1135
|
+
id: string;
|
|
1136
|
+
relationship: "self" | "owner" | "member";
|
|
1137
|
+
account: {
|
|
1138
|
+
username: string;
|
|
1139
|
+
id: string;
|
|
1140
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
1141
|
+
avatar?: string | null | undefined;
|
|
1142
|
+
color?: string | null | undefined;
|
|
1143
|
+
};
|
|
1144
|
+
onDevice: boolean;
|
|
1145
|
+
available: boolean;
|
|
1146
|
+
active: boolean;
|
|
1147
|
+
lastUsedAt: number | null;
|
|
1148
|
+
}[];
|
|
1149
|
+
}[];
|
|
1150
|
+
}>;
|
|
1151
|
+
state: z.ZodObject<{
|
|
1152
|
+
deviceId: z.ZodString;
|
|
1153
|
+
accounts: z.ZodArray<z.ZodObject<{
|
|
1154
|
+
accountId: z.ZodString;
|
|
1155
|
+
sessionId: z.ZodString;
|
|
1156
|
+
authuser: z.ZodNumber;
|
|
1157
|
+
operatedByUserId: z.ZodOptional<z.ZodString>;
|
|
1158
|
+
}, "strip", z.ZodTypeAny, {
|
|
1159
|
+
accountId: string;
|
|
1160
|
+
sessionId: string;
|
|
1161
|
+
authuser: number;
|
|
1162
|
+
operatedByUserId?: string | undefined;
|
|
1163
|
+
}, {
|
|
1164
|
+
accountId: string;
|
|
1165
|
+
sessionId: string;
|
|
1166
|
+
authuser: number;
|
|
1167
|
+
operatedByUserId?: string | undefined;
|
|
1168
|
+
}>, "many">;
|
|
1169
|
+
activeAccountId: z.ZodNullable<z.ZodString>;
|
|
1170
|
+
revision: z.ZodNumber;
|
|
1171
|
+
updatedAt: z.ZodNumber;
|
|
1172
|
+
}, "strip", z.ZodTypeAny, {
|
|
1173
|
+
deviceId: string;
|
|
1174
|
+
accounts: {
|
|
1175
|
+
accountId: string;
|
|
1176
|
+
sessionId: string;
|
|
1177
|
+
authuser: number;
|
|
1178
|
+
operatedByUserId?: string | undefined;
|
|
1179
|
+
}[];
|
|
1180
|
+
activeAccountId: string | null;
|
|
1181
|
+
revision: number;
|
|
1182
|
+
updatedAt: number;
|
|
1183
|
+
}, {
|
|
1184
|
+
deviceId: string;
|
|
1185
|
+
accounts: {
|
|
1186
|
+
accountId: string;
|
|
1187
|
+
sessionId: string;
|
|
1188
|
+
authuser: number;
|
|
1189
|
+
operatedByUserId?: string | undefined;
|
|
1190
|
+
}[];
|
|
1191
|
+
activeAccountId: string | null;
|
|
1192
|
+
revision: number;
|
|
1193
|
+
updatedAt: number;
|
|
1194
|
+
}>;
|
|
1195
|
+
activeToken: z.ZodNullable<z.ZodObject<{
|
|
1196
|
+
accessToken: z.ZodString;
|
|
1197
|
+
expiresAt: z.ZodString;
|
|
1198
|
+
}, "strip", z.ZodTypeAny, {
|
|
1199
|
+
accessToken: string;
|
|
1200
|
+
expiresAt: string;
|
|
1201
|
+
}, {
|
|
1202
|
+
accessToken: string;
|
|
1203
|
+
expiresAt: string;
|
|
1204
|
+
}>>;
|
|
1205
|
+
}, "strip", z.ZodTypeAny, {
|
|
1206
|
+
state: {
|
|
1207
|
+
deviceId: string;
|
|
1208
|
+
accounts: {
|
|
1209
|
+
accountId: string;
|
|
1210
|
+
sessionId: string;
|
|
1211
|
+
authuser: number;
|
|
1212
|
+
operatedByUserId?: string | undefined;
|
|
1213
|
+
}[];
|
|
1214
|
+
activeAccountId: string | null;
|
|
1215
|
+
revision: number;
|
|
1216
|
+
updatedAt: number;
|
|
1217
|
+
};
|
|
1218
|
+
activeToken: {
|
|
1219
|
+
accessToken: string;
|
|
1220
|
+
expiresAt: string;
|
|
1221
|
+
} | null;
|
|
1222
|
+
directory: {
|
|
1223
|
+
deviceId: string;
|
|
1224
|
+
revision: number;
|
|
1225
|
+
updatedAt: number;
|
|
1226
|
+
activeContextId: string | null;
|
|
1227
|
+
principals: {
|
|
1228
|
+
authuser: number;
|
|
1229
|
+
userId: string;
|
|
1230
|
+
id: string;
|
|
1231
|
+
user: {
|
|
1232
|
+
username: string;
|
|
1233
|
+
id: string;
|
|
1234
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
1235
|
+
avatar?: string | null | undefined;
|
|
1236
|
+
color?: string | null | undefined;
|
|
1237
|
+
};
|
|
1238
|
+
contexts: {
|
|
1239
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
1240
|
+
accountId: string;
|
|
1241
|
+
id: string;
|
|
1242
|
+
relationship: "self" | "owner" | "member";
|
|
1243
|
+
account: {
|
|
1244
|
+
username: string;
|
|
1245
|
+
id: string;
|
|
1246
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
1247
|
+
avatar?: string | null | undefined;
|
|
1248
|
+
color?: string | null | undefined;
|
|
1249
|
+
};
|
|
1250
|
+
onDevice: boolean;
|
|
1251
|
+
available: boolean;
|
|
1252
|
+
active: boolean;
|
|
1253
|
+
lastUsedAt: number | null;
|
|
1254
|
+
}[];
|
|
1255
|
+
}[];
|
|
1256
|
+
};
|
|
1257
|
+
}, {
|
|
1258
|
+
state: {
|
|
1259
|
+
deviceId: string;
|
|
1260
|
+
accounts: {
|
|
1261
|
+
accountId: string;
|
|
1262
|
+
sessionId: string;
|
|
1263
|
+
authuser: number;
|
|
1264
|
+
operatedByUserId?: string | undefined;
|
|
1265
|
+
}[];
|
|
1266
|
+
activeAccountId: string | null;
|
|
1267
|
+
revision: number;
|
|
1268
|
+
updatedAt: number;
|
|
1269
|
+
};
|
|
1270
|
+
activeToken: {
|
|
1271
|
+
accessToken: string;
|
|
1272
|
+
expiresAt: string;
|
|
1273
|
+
} | null;
|
|
1274
|
+
directory: {
|
|
1275
|
+
deviceId: string;
|
|
1276
|
+
revision: number;
|
|
1277
|
+
updatedAt: number;
|
|
1278
|
+
activeContextId: string | null;
|
|
1279
|
+
principals: {
|
|
1280
|
+
authuser: number;
|
|
1281
|
+
userId: string;
|
|
1282
|
+
id: string;
|
|
1283
|
+
user: {
|
|
1284
|
+
username: string;
|
|
1285
|
+
id: string;
|
|
1286
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
1287
|
+
avatar?: string | null | undefined;
|
|
1288
|
+
color?: string | null | undefined;
|
|
1289
|
+
};
|
|
1290
|
+
contexts: {
|
|
1291
|
+
kind: "personal" | "organization" | "project" | "bot" | "channel";
|
|
1292
|
+
accountId: string;
|
|
1293
|
+
id: string;
|
|
1294
|
+
relationship: "self" | "owner" | "member";
|
|
1295
|
+
account: {
|
|
1296
|
+
username: string;
|
|
1297
|
+
id: string;
|
|
1298
|
+
name?: import("./userResponse").UserNameResponse | undefined;
|
|
1299
|
+
avatar?: string | null | undefined;
|
|
1300
|
+
color?: string | null | undefined;
|
|
1301
|
+
};
|
|
1302
|
+
onDevice: boolean;
|
|
1303
|
+
available: boolean;
|
|
1304
|
+
active: boolean;
|
|
1305
|
+
lastUsedAt: number | null;
|
|
1306
|
+
}[];
|
|
1307
|
+
}[];
|
|
1308
|
+
};
|
|
1309
|
+
}>;
|
|
1310
|
+
export type DeviceContextRelationship = z.infer<typeof deviceContextRelationshipSchema>;
|
|
1311
|
+
export type DeviceDirectorySync = z.infer<typeof deviceDirectorySyncSchema>;
|
|
1312
|
+
export type DeviceDirectoryProfile = z.infer<typeof deviceDirectoryProfileSchema>;
|
|
1313
|
+
export type DeviceAccountContext = z.infer<typeof deviceAccountContextSchema>;
|
|
1314
|
+
export type DevicePrincipal = z.infer<typeof devicePrincipalSchema>;
|
|
1315
|
+
export type DeviceDirectory = z.infer<typeof deviceDirectorySchema>;
|
|
1316
|
+
export type DeviceActivateRequest = z.infer<typeof deviceActivateRequestSchema>;
|
|
1317
|
+
export type DeviceActivateResponse = z.infer<typeof deviceActivateResponseSchema>;
|