@oxyhq/core 20.0.0 → 21.0.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.
Files changed (94) hide show
  1. package/NOTICE +10 -9
  2. package/dist/cjs/.tsbuildinfo +1 -1
  3. package/dist/cjs/boot/sessionColdBoot.js +107 -8
  4. package/dist/cjs/i18n/locales/en-US.json +19 -2
  5. package/dist/cjs/i18n/locales/es-ES.json +19 -2
  6. package/dist/cjs/i18n/locales/locales/en-US.json +19 -2
  7. package/dist/cjs/i18n/locales/locales/es-ES.json +19 -2
  8. package/dist/cjs/index.js +50 -16
  9. package/dist/cjs/mixins/OxyServices.auth.js +27 -3
  10. package/dist/cjs/mixins/OxyServices.chains.js +73 -0
  11. package/dist/cjs/mixins/OxyServices.store.js +266 -0
  12. package/dist/cjs/mixins/OxyServices.utility.js +159 -104
  13. package/dist/cjs/mixins/index.js +7 -0
  14. package/dist/cjs/server/rateLimit.js +15 -6
  15. package/dist/cjs/session/SessionClient.js +361 -1
  16. package/dist/cjs/session/accountDialogController.js +121 -147
  17. package/dist/cjs/session/accountSwitchTargets.js +75 -0
  18. package/dist/cjs/session/deviceDirectory.js +143 -0
  19. package/dist/cjs/session/deviceSwitcherRows.js +76 -0
  20. package/dist/cjs/session/projectSessionState.js +8 -1
  21. package/dist/cjs/session/sharedDeviceCredential.js +247 -0
  22. package/dist/esm/.tsbuildinfo +1 -1
  23. package/dist/esm/boot/sessionColdBoot.js +107 -8
  24. package/dist/esm/i18n/locales/en-US.json +19 -2
  25. package/dist/esm/i18n/locales/es-ES.json +19 -2
  26. package/dist/esm/i18n/locales/locales/en-US.json +19 -2
  27. package/dist/esm/i18n/locales/locales/es-ES.json +19 -2
  28. package/dist/esm/index.js +32 -10
  29. package/dist/esm/mixins/OxyServices.auth.js +27 -3
  30. package/dist/esm/mixins/OxyServices.chains.js +70 -0
  31. package/dist/esm/mixins/OxyServices.store.js +263 -0
  32. package/dist/esm/mixins/OxyServices.utility.js +159 -104
  33. package/dist/esm/mixins/index.js +7 -0
  34. package/dist/esm/server/rateLimit.js +15 -6
  35. package/dist/esm/session/SessionClient.js +362 -2
  36. package/dist/esm/session/accountDialogController.js +121 -147
  37. package/dist/esm/session/accountSwitchTargets.js +71 -0
  38. package/dist/esm/session/deviceDirectory.js +135 -0
  39. package/dist/esm/session/deviceSwitcherRows.js +72 -0
  40. package/dist/esm/session/projectSessionState.js +8 -2
  41. package/dist/esm/session/sharedDeviceCredential.js +239 -0
  42. package/dist/types/.tsbuildinfo +1 -1
  43. package/dist/types/boot/sessionColdBoot.d.ts +24 -4
  44. package/dist/types/index.d.ts +15 -3
  45. package/dist/types/mixins/OxyServices.auth.d.ts +75 -3
  46. package/dist/types/mixins/OxyServices.chains.d.ts +156 -0
  47. package/dist/types/mixins/OxyServices.store.d.ts +334 -0
  48. package/dist/types/mixins/OxyServices.utility.d.ts +31 -8
  49. package/dist/types/mixins/index.d.ts +3 -1
  50. package/dist/types/models/session.d.ts +11 -0
  51. package/dist/types/session/SessionClient.d.ts +202 -1
  52. package/dist/types/session/accountDialogController.d.ts +76 -64
  53. package/dist/types/session/accountSwitchTargets.d.ts +64 -0
  54. package/dist/types/session/deviceDirectory.d.ts +182 -0
  55. package/dist/types/session/deviceSwitcherRows.d.ts +92 -0
  56. package/dist/types/session/projectSessionState.d.ts +29 -0
  57. package/dist/types/session/sharedDeviceCredential.d.ts +202 -0
  58. package/package.json +3 -3
  59. package/src/boot/__tests__/sessionColdBoot.sharedDevice.test.ts +325 -0
  60. package/src/boot/sessionColdBoot.ts +133 -9
  61. package/src/i18n/locales/en-US.json +19 -2
  62. package/src/i18n/locales/es-ES.json +19 -2
  63. package/src/index.ts +105 -18
  64. package/src/mixins/OxyServices.auth.ts +67 -5
  65. package/src/mixins/OxyServices.chains.ts +134 -0
  66. package/src/mixins/OxyServices.store.ts +585 -0
  67. package/src/mixins/OxyServices.utility.ts +161 -108
  68. package/src/mixins/__tests__/chains.test.ts +113 -0
  69. package/src/mixins/__tests__/preSessionSkipAuth.test.ts +54 -1
  70. package/src/mixins/__tests__/store.test.ts +304 -0
  71. package/src/mixins/__tests__/userTokenAuth.test.ts +746 -0
  72. package/src/mixins/index.ts +9 -0
  73. package/src/models/session.ts +11 -0
  74. package/src/server/__tests__/rateLimit.test.ts +47 -0
  75. package/src/server/rateLimit.ts +18 -8
  76. package/src/session/SessionClient.ts +386 -1
  77. package/src/session/__tests__/SessionClient.directory.test.ts +688 -0
  78. package/src/session/__tests__/accountDialogController.test.ts +411 -278
  79. package/src/session/__tests__/accountSwitchTargets.test.ts +132 -0
  80. package/src/session/__tests__/deviceDirectory.test.ts +422 -0
  81. package/src/session/__tests__/deviceSwitcherRows.test.ts +223 -0
  82. package/src/session/__tests__/projectSessionState.test.ts +17 -0
  83. package/src/session/__tests__/sharedDeviceCredential.test.ts +300 -0
  84. package/src/session/accountDialogController.ts +141 -179
  85. package/src/session/accountSwitchTargets.ts +87 -0
  86. package/src/session/deviceDirectory.ts +269 -0
  87. package/src/session/deviceSwitcherRows.ts +145 -0
  88. package/src/session/projectSessionState.ts +9 -3
  89. package/src/session/sharedDeviceCredential.ts +349 -0
  90. package/dist/cjs/session/accountProjection.js +0 -213
  91. package/dist/esm/session/accountProjection.js +0 -207
  92. package/dist/types/session/accountProjection.d.ts +0 -198
  93. package/src/session/__tests__/accountProjection.test.ts +0 -447
  94. package/src/session/accountProjection.ts +0 -354
@@ -0,0 +1,334 @@
1
+ /**
2
+ * App Store Methods Mixin
3
+ *
4
+ * The client surface for the Oxy app store: the public storefront (`/store`),
5
+ * the reviews people write there, and the listing a publisher edits for an
6
+ * application they own (`/applications/:appId/listing`).
7
+ *
8
+ * Deliberately separate from `OxyServices.accounts.ts` even though the
9
+ * publisher's routes hang off an application, for the same reason
10
+ * `OxyServices.connectedApps.ts` is: those mixins answer "may this program act
11
+ * for this person?", and this one answers "should this person choose it?". Turn
12
+ * the store off and OAuth still works — which is the test that says the store is
13
+ * a module over the platform rather than part of it.
14
+ *
15
+ * The two prefixes are one domain. A listing IS the store's page for an
16
+ * application, so both halves of its life belong to the same surface; the API
17
+ * puts the publisher's half beside credentials and webhooks because that is
18
+ * where the permission that guards it already lives, and reusing that permission
19
+ * is what stops a store page becoming a second, weaker way to act for somebody's
20
+ * app.
21
+ *
22
+ * ## What is NOT duplicated here
23
+ *
24
+ * A listing carries no name, icon or legal links: `applications` already holds
25
+ * them and the storefront joins them in. A rating is computed from the visible
26
+ * reviews on every read rather than stored, so a hidden review stops counting
27
+ * the moment it is hidden. Reference listings by their `slug` in the storefront
28
+ * (it is what every link carries) and applications by their `_id` in the
29
+ * publisher's calls.
30
+ */
31
+ import type { OxyServicesBase } from '../OxyServices.base';
32
+ /** A shelf on the storefront. */
33
+ export interface StoreCategory {
34
+ /** The public identifier a link carries. Never the row id. */
35
+ slug: string;
36
+ /** What a person reads. Never derived from the slug at render time. */
37
+ label: string;
38
+ description?: string | null;
39
+ }
40
+ /** The rating of an app, computed from its visible reviews. */
41
+ export interface StoreRating {
42
+ /** Rounded to one decimal, or `null` when nobody has reviewed it — never 0. */
43
+ average: number | null;
44
+ count: number;
45
+ }
46
+ /** An app as a card on the storefront: what a listing page needs, and no more. */
47
+ export interface StoreListingSummary {
48
+ slug: string;
49
+ /** From the APPLICATION, joined in — the listing keeps no copy. */
50
+ name: string;
51
+ tagline: string | null;
52
+ /** A file id for the app's icon, resolved through the usual image resolver. */
53
+ icon: string | null;
54
+ category: StoreCategory | null;
55
+ rating: StoreRating;
56
+ }
57
+ /** A store page in full. */
58
+ export interface StoreListingDetail extends StoreListingSummary {
59
+ description: string | null;
60
+ /** These four come from the application; the consent screen shows the same values. */
61
+ websiteUrl: string | null;
62
+ privacyPolicyUrl: string | null;
63
+ termsUrl: string | null;
64
+ supportUrl: string | null;
65
+ supportEmail: string | null;
66
+ publishedAt: string | null;
67
+ screenshots: StoreScreenshot[];
68
+ /** How many visible reviews gave each of 1..5. Absent keys are zero. */
69
+ ratingBreakdown: Record<number, number>;
70
+ }
71
+ /** Which frame a screenshot was taken in. The store groups by it on the page. */
72
+ export type StoreScreenshotPlatform = 'phone' | 'tablet' | 'desktop' | 'web';
73
+ export interface StoreScreenshot {
74
+ id: string;
75
+ /** The uploaded asset's file id. Upload through the assets surface first. */
76
+ fileId: string;
77
+ platform: StoreScreenshotPlatform;
78
+ caption: string | null;
79
+ position: number;
80
+ }
81
+ /** Somebody's review, as it appears on a store page. */
82
+ export interface StoreReview {
83
+ id: string;
84
+ rating: number;
85
+ title: string | null;
86
+ body: string | null;
87
+ createdAt: string;
88
+ author: {
89
+ id: string;
90
+ username: string | null;
91
+ };
92
+ /** The publisher's answer, when there is one. */
93
+ reply: {
94
+ body: string;
95
+ createdAt: string;
96
+ } | null;
97
+ /**
98
+ * Whether this author has authorized the application, read from their grant
99
+ * at request time rather than stored on the review.
100
+ *
101
+ * It is not a claim that they still use it, and it is `false` for a
102
+ * first-party app nobody has to consent to — so render its absence as nothing
103
+ * at all rather than as a demotion.
104
+ */
105
+ authorUsesApp: boolean;
106
+ }
107
+ /** A review as its own author sees it, whatever its moderation state. */
108
+ export interface StoreOwnReview {
109
+ id: string;
110
+ rating: number;
111
+ title: string | null;
112
+ body: string | null;
113
+ /** An author is told when their review is hidden; the public list is not. */
114
+ status: 'visible' | 'hidden' | 'flagged' | 'removed';
115
+ createdAt: string;
116
+ updatedAt: string;
117
+ }
118
+ /** What a person submits about an app. One review each; writing again replaces it. */
119
+ export interface WriteStoreReviewInput {
120
+ /** Whole stars, 1 to 5. The database enforces the bound too. */
121
+ rating: number;
122
+ title?: string | null;
123
+ body?: string | null;
124
+ }
125
+ /** Where a listing is in its life. `pending_review` is the STORE's review of the page. */
126
+ export type StoreListingStatus = 'draft' | 'pending_review' | 'published' | 'rejected';
127
+ /** A listing as its publisher sees it: whatever state it is in. */
128
+ export interface PublisherListing {
129
+ id: string;
130
+ applicationId: string;
131
+ slug: string;
132
+ tagline: string | null;
133
+ description: string | null;
134
+ category: StoreCategory | null;
135
+ supportUrl: string | null;
136
+ supportEmail: string | null;
137
+ status: StoreListingStatus;
138
+ publishedAt: string | null;
139
+ createdAt: string;
140
+ updatedAt: string;
141
+ }
142
+ /**
143
+ * The whole page, not a patch: sending everything is what makes "clear the
144
+ * tagline" expressible at all.
145
+ *
146
+ * `status` is absent on purpose. Publishing is the store's decision and has its
147
+ * own calls, so a publisher cannot publish themselves by putting a field in a
148
+ * body.
149
+ */
150
+ export interface WriteListingInput {
151
+ /** Lowercase letters, digits and single hyphens. What every link carries. */
152
+ slug: string;
153
+ tagline?: string | null;
154
+ description?: string | null;
155
+ /** A category SLUG, never its id. */
156
+ categorySlug?: string | null;
157
+ supportUrl?: string | null;
158
+ supportEmail?: string | null;
159
+ }
160
+ export interface AddScreenshotInput {
161
+ /** An already-uploaded image. Must be live, an image, and yours to publish. */
162
+ fileId: string;
163
+ platform?: StoreScreenshotPlatform;
164
+ caption?: string | null;
165
+ }
166
+ export interface UpdateScreenshotInput {
167
+ platform?: StoreScreenshotPlatform;
168
+ caption?: string | null;
169
+ }
170
+ /**
171
+ * One page of a paginated store read.
172
+ *
173
+ * `hasMore` comes from the API rather than being derived here, so a caller that
174
+ * pages does not have to re-implement the boundary the server already computed.
175
+ */
176
+ export interface StorePage<T> {
177
+ items: T[];
178
+ total: number;
179
+ hasMore: boolean;
180
+ }
181
+ /** Options for paging the storefront and the reviews under an app. */
182
+ export interface StorePageOptions {
183
+ limit?: number;
184
+ offset?: number;
185
+ }
186
+ export interface StoreReviewsOptions extends StorePageOptions {
187
+ /** Newest first by default; `rating` surfaces the strongest opinions. */
188
+ sort?: 'recent' | 'rating';
189
+ }
190
+ export declare function OxyServicesStoreMixin<T extends typeof OxyServicesBase>(Base: T): {
191
+ new (...args: any[]): {
192
+ /** The shelves, in the order the store curates them. */
193
+ listStoreCategories(): Promise<StoreCategory[]>;
194
+ /**
195
+ * Published listings, newest first, optionally one shelf.
196
+ *
197
+ * An unknown category slug is an EMPTY shelf, not every app on the store —
198
+ * so a typo shows nothing rather than showing everything.
199
+ *
200
+ * @param options - `category` is a category slug; `limit` defaults to 24.
201
+ */
202
+ listStoreApps(options?: StorePageOptions & {
203
+ category?: string;
204
+ }): Promise<StorePage<StoreListingSummary>>;
205
+ /**
206
+ * One store page.
207
+ *
208
+ * A draft answers 404 exactly as an unknown slug does: whether an
209
+ * unpublished page exists under a name is not something a visitor learns.
210
+ *
211
+ * @param slug - The listing's public slug, not an application id.
212
+ */
213
+ getStoreApp(slug: string): Promise<StoreListingDetail>;
214
+ /** Visible reviews for a published app, each with the publisher's reply. */
215
+ listStoreReviews(slug: string, options?: StoreReviewsOptions): Promise<StorePage<StoreReview>>;
216
+ /** The caller's own review of an app, or `null` if they have not written one. */
217
+ getMyStoreReview(slug: string): Promise<StoreOwnReview | null>;
218
+ /**
219
+ * Write the caller's review, or replace what they said before.
220
+ *
221
+ * A person has one review per app, so this sets it rather than adding one.
222
+ * Rewriting does not clear a moderator's decision: a hidden review stays
223
+ * hidden when its author edits it.
224
+ */
225
+ writeStoreReview(slug: string, input: WriteStoreReviewInput): Promise<StoreOwnReview>;
226
+ /** Withdraw the caller's own review. A real delete — the words were theirs. */
227
+ deleteMyStoreReview(slug: string): Promise<void>;
228
+ /**
229
+ * Answer a review on the publisher's behalf.
230
+ *
231
+ * Requires `app:update` over the application's owning account — the same
232
+ * permission that guards every other write to that application. Addressed
233
+ * by review id because the reply belongs to the review, and a listing can be
234
+ * renamed or withdrawn out from under it.
235
+ */
236
+ replyToStoreReview(reviewId: string, body: string): Promise<{
237
+ id: string;
238
+ reviewId: string;
239
+ body: string;
240
+ }>;
241
+ /** Withdraw the publisher's answer. Same permission that wrote it. */
242
+ deleteStoreReviewReply(reviewId: string): Promise<void>;
243
+ /** The application's store page in whatever state, or `null` if it has none. */
244
+ getAppListing(applicationId: string): Promise<PublisherListing | null>;
245
+ /**
246
+ * Create the page or replace its content. Never its status.
247
+ *
248
+ * Editing does not move a page: correcting a typo on a live listing leaves
249
+ * it live, and fixing a rejected one does not re-submit it.
250
+ */
251
+ writeAppListing(applicationId: string, input: WriteListingInput): Promise<PublisherListing>;
252
+ /** Hand the page to the store for review. From a draft, or a rejected page once fixed. */
253
+ submitAppListing(applicationId: string): Promise<PublisherListing>;
254
+ /**
255
+ * Take the page down, or withdraw it from the queue.
256
+ *
257
+ * Back to a draft, never deleted: the slug, the words and the screenshots
258
+ * are the publisher's work, and the reviews were never the listing's to take
259
+ * with them.
260
+ */
261
+ unpublishAppListing(applicationId: string): Promise<PublisherListing>;
262
+ /** Every picture on the listing, in the author's order. */
263
+ listAppListingScreenshots(applicationId: string): Promise<StoreScreenshot[]>;
264
+ /**
265
+ * Attach an already-uploaded image, appended to the end.
266
+ *
267
+ * Upload through the assets surface first; the store keeps a reference
268
+ * rather than a second copy of the asset pipeline. The file must be live, an
269
+ * image, and one the caller is entitled to.
270
+ */
271
+ addAppListingScreenshot(applicationId: string, input: AddScreenshotInput): Promise<StoreScreenshot>;
272
+ /** Edit a picture's caption or the frame it was taken in. Order is {@link reorderAppListingScreenshots}. */
273
+ updateAppListingScreenshot(applicationId: string, screenshotId: string, input: UpdateScreenshotInput): Promise<StoreScreenshot>;
274
+ /** Remove a picture. The uploaded file stays — it may be in use elsewhere. */
275
+ deleteAppListingScreenshot(applicationId: string, screenshotId: string): Promise<void>;
276
+ /**
277
+ * Set the order of every picture at once.
278
+ *
279
+ * Send EVERY id on the listing, exactly once, in the order they should
280
+ * appear. A partial list is rejected rather than applied: it would leave the
281
+ * pictures it omits at their old positions, interleaved with the new ones.
282
+ */
283
+ reorderAppListingScreenshots(applicationId: string, screenshotIds: string[]): Promise<StoreScreenshot[]>;
284
+ httpService: import("../HttpService").HttpService;
285
+ cloudURL: string;
286
+ config: import("../OxyServices.base").OxyConfig;
287
+ __resetTokensForTests(): void;
288
+ makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T_1>;
289
+ getBaseURL(): string;
290
+ getClient(): import("../HttpService").HttpService;
291
+ createLinkedClient(config: import("../OxyServices.base").OxyConfig): import("..").LinkedHttpClient;
292
+ getMetrics(): {
293
+ totalRequests: number;
294
+ successfulRequests: number;
295
+ failedRequests: number;
296
+ cacheHits: number;
297
+ cacheMisses: number;
298
+ averageResponseTime: number;
299
+ };
300
+ clearCache(): void;
301
+ clearCacheEntry(key: string): void;
302
+ clearCacheByPrefix(prefix: string): number;
303
+ getCacheStats(): {
304
+ size: number;
305
+ hits: number;
306
+ misses: number;
307
+ hitRate: number;
308
+ };
309
+ getCloudURL(): string;
310
+ setTokens(accessToken: string): void;
311
+ clearTokens(): void;
312
+ onTokensChanged(listener: (accessToken: string | null) => void): () => void;
313
+ _cachedUserId: string | null | undefined;
314
+ _cachedAccessToken: string | null;
315
+ getCurrentUserId(): string | null;
316
+ hasValidToken(): boolean;
317
+ getAccessToken(): string | null;
318
+ getAccessTokenExpiry(): number | null;
319
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
320
+ withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
321
+ maxRetries?: number;
322
+ retryDelay?: number;
323
+ authTimeoutMs?: number;
324
+ }): Promise<T_1>;
325
+ validate(): Promise<boolean>;
326
+ handleError(error: unknown): Error;
327
+ healthCheck(): Promise<{
328
+ status: string;
329
+ users?: number;
330
+ timestamp?: string;
331
+ [key: string]: any;
332
+ }>;
333
+ };
334
+ } & T;
@@ -109,18 +109,41 @@ export declare function OxyServicesUtilityMixin<T extends typeof OxyServicesBase
109
109
  * Uses server-side session validation for security (not just JWT decode).
110
110
  *
111
111
  * **Design note — jwtDecode vs jwt.verify:**
112
- * This middleware intentionally uses `jwtDecode()` (decode-only, no signature
113
- * verification) for user tokens. This is by design, NOT a security gap:
114
- * - Third-party apps using `oxy.auth()` don't have the Oxy JWT secret
115
- * - Security comes from API-based session validation (`validateSession()`)
116
- * which checks the session server-side on every request
117
- * - Service tokens (type: 'service') DO use cryptographic HMAC verification
118
- * via the `jwtSecret` option, since they are stateless. Service tokens
119
- * are additionally checked for `aud`, `iss`, and `type` claims to prevent
112
+ * This middleware uses `jwtDecode()` (decode-only, NO signature check) for
113
+ * user tokens, because third-party apps mounting `oxy.auth()` do not hold
114
+ * the Oxy signing secret. **Every claim in a user token is therefore
115
+ * attacker-controlled and proves nothing on its own.** The identity comes
116
+ * from somewhere else entirely:
117
+ * - A user token MUST carry a `sessionId`. That session is validated
118
+ * server-side on every request via `validateSession()`, and the user id
119
+ * is read off the VALIDATED SESSION never off the token. A token whose
120
+ * `userId` claim disagrees with the session is refused
121
+ * (`SESSION_USER_MISMATCH`); a token with no `sessionId` at all is
122
+ * refused outright (`SESSION_REQUIRED`). There is no local-claims path.
123
+ * - Service tokens (type: 'service') ARE stateless, so they use
124
+ * cryptographic HMAC verification via the `jwtSecret` option, and are
125
+ * additionally checked for `aud`, `iss`, and `type` claims to prevent
120
126
  * cross-token-type confusion attacks.
121
127
  * - The backend's own `authMiddleware` uses `jwt.verify()` because it has
122
128
  * direct access to `SERVICE_TOKEN_SECRET` / `ACCESS_TOKEN_SECRET`.
123
129
  *
130
+ * **Why session-less user tokens are refused rather than trusted:**
131
+ * every user access token the Oxy API issues carries a `sessionId` (see
132
+ * `packages/api/src/utils/sessionUtils.ts`, `generateSessionTokens` — the
133
+ * only mint site for user tokens, including the OAuth code exchange). So
134
+ * refusing session-less user tokens costs nothing legitimate, while
135
+ * accepting them let anyone authenticate as anyone by hand-rolling a JWT
136
+ * with a `userId` claim and a garbage signature.
137
+ *
138
+ * **Why the claimed user id is cross-checked against the session:**
139
+ * `GET /session/validate/:sessionId` is UNAUTHENTICATED and does not bind
140
+ * the bearer token — it returns whoever owns the session id it was handed.
141
+ * Trusting the token's `userId` claim after a successful validation would
142
+ * therefore let a caller holding ANY live session id (their own, for
143
+ * instance) pair it with a forged `userId` and be trusted as that user.
144
+ * `authSocket()` has always cross-checked this; the HTTP middleware now
145
+ * does too.
146
+ *
124
147
  * **Service-token delegation (X-Oxy-User-Id):**
125
148
  * When a service token is accompanied by `X-Oxy-User-Id`, the SDK calls
126
149
  * `verifyServiceActingAs(appId, userId)` to confirm an explicit delegation
@@ -16,6 +16,7 @@ import { OxyServicesReputationMixin } from './OxyServices.reputation';
16
16
  import { OxyServicesAssetsMixin } from './OxyServices.assets';
17
17
  import { OxyServicesAccountsMixin } from './OxyServices.accounts';
18
18
  import { OxyServicesConnectedAppsMixin } from './OxyServices.connectedApps';
19
+ import { OxyServicesStoreMixin } from './OxyServices.store';
19
20
  import { OxyServicesLocationMixin } from './OxyServices.location';
20
21
  import { OxyServicesAnalyticsMixin } from './OxyServices.analytics';
21
22
  import { OxyServicesDevicesMixin } from './OxyServices.devices';
@@ -27,6 +28,7 @@ import { OxyServicesContactsMixin } from './OxyServices.contacts';
27
28
  import { OxyServicesNotificationsMixin } from './OxyServices.notifications';
28
29
  import { OxyServicesAppDataMixin } from './OxyServices.appData';
29
30
  import { OxyServicesCivicMixin } from './OxyServices.civic';
31
+ import { OxyServicesChainsMixin } from './OxyServices.chains';
30
32
  import { OxyServicesNodesMixin } from './OxyServices.nodes';
31
33
  import { OxyServicesLinksMixin } from './OxyServices.links';
32
34
  import { OxyServicesFollowGraphMixin } from './OxyServices.followGraph';
@@ -41,7 +43,7 @@ import { OxyServicesDeviceTransferMixin } from './OxyServices.deviceTransfer';
41
43
  * If you add a new mixin to `MIXIN_PIPELINE`, add it here too so its methods
42
44
  * are visible without a cast.
43
45
  */
44
- type AllMixinInstances = InstanceType<ReturnType<typeof OxyServicesAuthMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesUserMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesIdentityMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesIdentityBackupMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesPrivacyMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesLanguageMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesPaymentMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesReputationMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesAssetsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesAccountsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesConnectedAppsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesLocationMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesAnalyticsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesDevicesMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesSecurityMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesFeaturesMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesTopicsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesContactsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesNotificationsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesAppDataMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesCivicMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesNodesMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesLinksMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesFollowGraphMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesDeviceBootMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesDeviceTransferMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesUtilityMixin<typeof OxyServicesBase>>>;
46
+ type AllMixinInstances = InstanceType<ReturnType<typeof OxyServicesAuthMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesUserMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesIdentityMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesIdentityBackupMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesPrivacyMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesLanguageMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesPaymentMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesReputationMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesAssetsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesAccountsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesConnectedAppsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesStoreMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesLocationMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesAnalyticsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesDevicesMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesSecurityMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesFeaturesMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesTopicsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesContactsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesNotificationsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesAppDataMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesCivicMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesChainsMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesNodesMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesLinksMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesFollowGraphMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesDeviceBootMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesDeviceTransferMixin<typeof OxyServicesBase>>> & InstanceType<ReturnType<typeof OxyServicesUtilityMixin<typeof OxyServicesBase>>>;
45
47
  /**
46
48
  * Constructor type for the fully composed mixin pipeline. Each mixin returns
47
49
  * a new constructor that augments its input; reducing across the pipeline
@@ -13,6 +13,17 @@ export interface ClientSession {
13
13
  * account-chooser ordering, not for any token-refresh mechanism.
14
14
  */
15
15
  authuser?: number;
16
+ /**
17
+ * The HUMAN operating this account, when it is a delegated session — the
18
+ * audit actor behind "The Oxy Collective". Absent when the session belongs to
19
+ * the account itself.
20
+ *
21
+ * The flat wire shape has carried it since the multi-account model shipped and
22
+ * nothing read it, so an operated org rendered exactly like a directly
23
+ * signed-in one. `SessionClient.getActiveContext()` is the richer answer
24
+ * (ADR 0002); this is the same fact on the compatibility lane.
25
+ */
26
+ operatedByUserId?: string;
16
27
  }
17
28
  export interface StorageKeys {
18
29
  sessions: string;