@deadair/plugin-sdk 0.52.2 → 0.54.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.
@@ -205,8 +205,8 @@ export interface ConfigFieldColumn {
205
205
  * rule that hid a cell there would hide it on the one row that most needs filling in.
206
206
  *
207
207
  * A `secret` cell that does not apply keeps whatever is stored rather than being cleared.
208
- * Absent already means "keep it" in `plugin.config.rows.ts`, and reading a visibility rule as
209
- * an instruction to destroy a credential would be a surprise nobody asked for.
208
+ * Absent already means "keep it" in the host's `shared/config.rows.ts`, and reading a visibility
209
+ * rule as an instruction to destroy a credential would be a surprise nobody asked for.
210
210
  */
211
211
  dependsOn?: string;
212
212
  /**
@@ -216,6 +216,12 @@ export interface ConfigFieldColumn {
216
216
  * an author who knows that one knows this.
217
217
  */
218
218
  dependsOnValues?: string[];
219
+ /**
220
+ * Key of the `url` (or `string`) column in the same list that this `secret` cell is SENT to.
221
+ * Ignored on every other type. See {@link ConfigField.sentTo}, which is the same declaration for
222
+ * a field: a row whose address moves to another origin has to have its credential typed again.
223
+ */
224
+ sentTo?: string;
219
225
  }
220
226
  /**
221
227
  * The chosen values of a `multiselect`, out of the string it is stored as.
@@ -418,7 +424,35 @@ export interface ConfigField {
418
424
  * for that.
419
425
  */
420
426
  rangeWith?: string;
427
+ /**
428
+ * Key of the `url` (or `string`) field in the same form that this `secret` is SENT to. Ignored
429
+ * on every other type.
430
+ *
431
+ * A secret is write-only and an omitted one is kept, which is what lets an operator save the
432
+ * rest of a form without retyping a key. Without this, the same rule lets anybody allowed to
433
+ * save the form point the address at a server of their own and have the station send it a
434
+ * credential the console never shows them. Declared, the host refuses a save that KEEPS this
435
+ * secret while moving the field it names to another origin (scheme, host and port), and asks
436
+ * for the secret again. A changed path on the same server is not a move, and a secret typed
437
+ * fresh or cleared in the same save is never refused.
438
+ *
439
+ * Declare it on every secret that goes to an address the operator types. Leave it off one that
440
+ * goes to a fixed vendor whatever the form says: there is no address to move.
441
+ *
442
+ * A field that is empty counts as wherever the field's `default` points, or as "no address" if
443
+ * there is none, so filling in an address that was empty is a move too.
444
+ */
445
+ sentTo?: string;
421
446
  }
447
+ /**
448
+ * What is wrong with the `sentTo` declarations in one form, as sentences. Empty when nothing is.
449
+ *
450
+ * A `sentTo` naming nothing would be worse than none at all: the host would compare an address that
451
+ * is never there with itself, find nothing moved, and the protection the author meant to declare
452
+ * would be silently off. So the manifest schema refuses one, at load, and a station setting's
453
+ * registry test asks the same question of the station's own form.
454
+ */
455
+ export declare function sentToProblems(fields: readonly ConfigField[]): string[];
422
456
  export declare const configFieldOptionSchema: z.ZodObject<{
423
457
  value: z.ZodString;
424
458
  label: z.ZodString;
@@ -503,6 +537,7 @@ export declare const configFieldColumnSchema: z.ZodObject<{
503
537
  }>>;
504
538
  dependsOn: z.ZodOptional<z.ZodString>;
505
539
  dependsOnValues: z.ZodOptional<z.ZodArray<z.ZodString>>;
540
+ sentTo: z.ZodOptional<z.ZodString>;
506
541
  }, z.core.$strip>;
507
542
  export declare const configFieldPresetSchema: z.ZodObject<{
508
543
  label: z.ZodString;
@@ -585,6 +620,7 @@ export declare const configFieldSchema: z.ZodObject<{
585
620
  }>>;
586
621
  dependsOn: z.ZodOptional<z.ZodString>;
587
622
  dependsOnValues: z.ZodOptional<z.ZodArray<z.ZodString>>;
623
+ sentTo: z.ZodOptional<z.ZodString>;
588
624
  }, z.core.$strip>>>;
589
625
  presets: z.ZodOptional<z.ZodArray<z.ZodObject<{
590
626
  label: z.ZodString;
@@ -592,6 +628,7 @@ export declare const configFieldSchema: z.ZodObject<{
592
628
  }, z.core.$strip>>>;
593
629
  dependsOn: z.ZodOptional<z.ZodString>;
594
630
  rangeWith: z.ZodOptional<z.ZodString>;
631
+ sentTo: z.ZodOptional<z.ZodString>;
595
632
  }, z.core.$strip>;
596
633
  export {};
597
634
  //# sourceMappingURL=plugin.config.fields.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.config.fields.d.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AC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,WAAW,EAAE,GAAG,MAAM,EAAE,CAkBvE;AAED,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;EAA4G,CAAC;AAE/I,eAAO,MAAM,qBAAqB;;;EAAgC,CAAC;AAEnE,eAAO,MAAM,wBAAwB;;;EAA6B,CAAC;AAEnE;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;EAYxC,CAAC;AAEH,4GAA4G;AAC5G,KAAK,WAAW,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAEpF,wCAAwC;AACxC,KAAK,UAAU,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,MAAM,oCAAoC,GAAG,UAAU,CAAC,WAAW,CAAC,uBAAuB,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC,CAAC,CAAC;AAMnJ,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmBlC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;iBAGlC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsB5B,CAAC"}
@@ -107,6 +107,19 @@ export declare class PluginError extends Error {
107
107
  * Diagnostic only: the host never forwards it as its own response status.
108
108
  */
109
109
  upstreamStatus?: number;
110
+ /**
111
+ * The upstream's own code for what went wrong, as it sent it: Last.fm's
112
+ * error number, Spotify's `reason`, an analyzer's `unfetchable` against
113
+ * `undecodable`. Finer than {@link code}, which is the host's vocabulary
114
+ * and the only thing the host maps to a response.
115
+ *
116
+ * This is the one place for it. A subclass that wants to branch on its
117
+ * upstream's code reads it here rather than declaring a field of its own,
118
+ * so the code survives the invoker's wrapping and reaches the host's logs.
119
+ * A capability that reads it says which values it knows, and the host
120
+ * ignores one it does not.
121
+ */
122
+ upstreamCode?: string | number;
110
123
  constructor(message: string, options?: {
111
124
  cause?: unknown;
112
125
  });
@@ -119,6 +132,7 @@ export declare class PluginError extends Error {
119
132
  */
120
133
  withRetry(retryAfterMs: number): this;
121
134
  withUpstreamStatus(upstreamStatus: number): this;
135
+ withUpstreamCode(upstreamCode: string | number): this;
122
136
  }
123
137
  /**
124
138
  * Whether `value` is one of ours: an error this copy of the module built.
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.error.d.ts","sourceRoot":"","sources":["../src/plugin.error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,eAAe;AACvB,qFAAqF;AACnF,MAAM;AACR,8FAA8F;GAC5F,QAAQ;AACV,kFAAkF;GAChF,WAAW;AACb;;;;GAIG;GACD,WAAW;AACb,wEAAwE;GACtE,cAAc;AAChB,uCAAuC;GACrC,SAAS;AACX,gEAAgE;GAC9D,aAAa;AACf,0DAA0D;GACxD,aAAa;AACf,6DAA6D;GAC3D,UAAU;AACZ,oDAAoD;GAClD,UAAU,CAAC;AAEjB,+FAA+F;AAC/F,eAAO,MAAM,kBAAkB,wIAWrB,CAAC;AAoBX;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAEnE;AAwBD;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,kBAAkB,eAAwC,CAAC;AAEjE;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,WAAY,SAAQ,KAAK;IAClC,uFAAuF;IACvF,QAAQ,C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ackFetchSession;
218
218
  }
219
+ /**
220
+ * One record, asked of a PLAYER the station runs rather than of a protocol shim.
221
+ *
222
+ * No session, and that is the difference from {@link TrackFetchRequest} rather than an omission. A
223
+ * shim is lent a login per call because it speaks the provider's protocol as the operator's account.
224
+ * A player holds its own sign-in — an operator authorized it once, in a browser, and it keeps that —
225
+ * so there is nothing for the plugin to lend it and nothing it would do with a token if it had one.
226
+ *
227
+ * What is on the other side today is `stream/apple-player`: Chrome with a Widevine CDM driving Apple's
228
+ * own web player, recording what it plays. A provider whose audio can only be PERFORMED — decoded
229
+ * inside a player that will not hand over a URL — is the shape this exists for, and it is a different
230
+ * shape from Spotify's encrypted CDN, which is why it is a second method and not a flag on the first.
231
+ */
232
+ export interface PlayerFetchRequest {
233
+ /** Provider-scoped track id, exactly as the plugin's own catalog reports it. */
234
+ trackId: string;
235
+ }
219
236
  /**
220
237
  * One page of a playlist, asked of the fetcher rather than of the provider's own API.
221
238
  *
@@ -262,6 +279,18 @@ export interface PluginTrackFetcher {
262
279
  * stream side up is a normal state, not a fault.
263
280
  */
264
281
  serve(request: TrackFetchRequest): Promise<ProviderStream | undefined>;
282
+ /**
283
+ * Get a URL for one record from a player the station runs.
284
+ *
285
+ * Resolves to `undefined` on exactly the terms {@link PluginTrackFetcher.serve} does: this station
286
+ * has no such player configured, which a plugin passes straight through as "cannot resolve this
287
+ * item". An operator who has not set the stream side up is a normal state, not a fault.
288
+ *
289
+ * The URL it answers with is signed by the HOST and carries its own authorization, so it satisfies
290
+ * `resolveStreamUrl`'s contract unchanged — and it will take as long to fetch as the record takes
291
+ * to play, which is why the stream it comes back in carries `fetchBudgetMs`. Pass that through.
292
+ */
293
+ servePlayer(request: PlayerFetchRequest): Promise<ProviderStream | undefined>;
265
294
  /**
266
295
  * Read a page of a playlist your own API will not hand over.
267
296
  *
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.host.d.ts","sourceRoot":"","sources":["../src/plugin.host.ts"],"names":[],"mappings":"AAAA;;;;;;;;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C,eAAe,CAAC,CAAC;IAEvE;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAE1F;;;;;;;;;;OAUG;IACH,MAAM,EAAE,WAAW,CAAC;IAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,WAAW,IAAI,MAAM,CAAC;IAEtB,OAAO,EAAE,aAAa,CAAC;IAEvB,OAAO,EAAE,aAAa,CAAC;IAEvB,MAAM,EAAE,kBAAkB,CAAC;IAE3B,KAAK,EAAE,WAAW,CAAC;IAEnB,MAAM,EAAE,YAAY,CAAC;IAErB,YAAY,EAAE,kBAAkB,CAAC;CACpC"}
@@ -363,6 +363,7 @@ export declare const pluginManifestSchema: z.ZodObject<{
363
363
  }>>;
364
364
  dependsOn: z.ZodOptional<z.ZodString>;
365
365
  dependsOnValues: z.ZodOptional<z.ZodArray<z.ZodString>>;
366
+ sentTo: z.ZodOptional<z.ZodString>;
366
367
  }, z.core.$strip>>>;
367
368
  presets: z.ZodOptional<z.ZodArray<z.ZodObject<{
368
369
  label: z.ZodString;
@@ -370,6 +371,7 @@ export declare const pluginManifestSchema: z.ZodObject<{
370
371
  }, z.core.$strip>>>;
371
372
  dependsOn: z.ZodOptional<z.ZodString>;
372
373
  rangeWith: z.ZodOptional<z.ZodString>;
374
+ sentTo: z.ZodOptional<z.ZodString>;
373
375
  }, z.core.$strip>>;
374
376
  configSchema: z.ZodCustom<PluginConfigSchema, PluginConfigSchema>;
375
377
  }, z.core.$strip>;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.manifest.d.ts","sourceRoot":"","sources":["../src/plugin.manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAA2B,KAA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AC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAKD,mEAAmE;AACnE,wBAAgB,qBAAqB,CAAC,IAAI,GAAE,gBAAqB,GAAG,QAAQ,CAa3E;AAED,uGAAuG;AACvG,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAoCpE;AAED,+GAA+G;AAC/G,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,mBAAmB,CAiCtG;AAED,wBAAgB,oBAAoB,IAAI,cAAc,CAwIrD"}
@@ -183,6 +183,11 @@ function createFakePluginHost() {
183
183
  },
184
184
  trackFetcher: {
185
185
  serve: vi.fn(async () => fetchedTrack),
186
+ // Answers the same canned stream as `serve`: a plugin under test cares that it asked the
187
+ // host for audio and passed the answer through, not which helper the station happens to run
188
+ // behind it. `fetchedTrack` is what a test sets to say "the station has a fetcher" or, as
189
+ // undefined, "it has not got one".
190
+ servePlayer: vi.fn(async () => fetchedTrack),
186
191
  playlistTracks: vi.fn(async () => {
187
192
  if (fetchedPlaylist instanceof Error) throw fetchedPlaylist;
188
193
  return fetchedPlaylist;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/testing/fake.plugin.host.ts"],"sourcesContent":["import { vi } from 'vitest';\n\nimport type {\n DiscoveredService,\n DiscoveryQuery,\n HostFetchInit,\n HostFetchMethod,\n PluginHost,\n PluginSocket,\n PluginTlsOptions,\n PluginTlsSocket,\n ProviderStream,\n ProviderTrack,\n} from '../index.js';\n\n/**\n * Shipped from the SDK rather than copied into each plugin, which three of them\n * were doing — two of those carrying a comment saying the copy was deliberate\n * because plugins do not depend on each other.\n *\n * That reasoning held for the copies and does not hold for this: every plugin\n * already depends on the SDK, and `PluginHost` is the SDK's own contract, so its\n * test double belongs beside the interface it doubles. A plugin importing this\n * gains no dependency on any other plugin. It also means a host method added to\n * the contract turns up in one fake rather than being added to three and\n * forgotten in the other three.\n *\n * Reached as `@deadair/plugin-sdk/testing`, which is kept out of the runtime\n * entry so nothing ships a dependency on vitest.\n */\n\n/** One `host.fetch` call, recorded with only the fields tests care about. */\nexport interface RecordedFetchCall {\n url: string;\n method: HostFetchMethod | undefined;\n headers: Record<string, string> | undefined;\n body: string | undefined;\n}\n\n/**\n * One `host.socket` the plugin opened, driven from the test: frames the plugin sent are in `sent`,\n * and `receive` / `closeFromServer` play the far end.\n */\nexport interface FakePluginSocket extends PluginSocket {\n readonly url: string;\n /** Every text frame the plugin sent, in order. */\n readonly sent: string[];\n /** Whether either end has closed it. */\n readonly closed: boolean;\n /** The frames the plugin sent, each parsed as JSON. */\n sentJson(): unknown[];\n /** Deliver one text frame to the plugin's listeners. */\n receive(text: string): void;\n /** Deliver `JSON.stringify(value)`. */\n receiveJson(value: unknown): void;\n /** Close it from the far end, telling the plugin's close listeners. */\n closeFromServer(code?: number, reason?: string): void;\n}\n\n/**\n * One `host.tls` connection the plugin opened, driven from the test: bytes the plugin wrote are in\n * `sent`, and `receive` / `closeFromServer` play the device.\n */\nexport interface FakePluginTlsSocket extends PluginTlsSocket {\n readonly url: string;\n /** The options the plugin opened it with. */\n readonly options: PluginTlsOptions | undefined;\n /** Every write the plugin made, in order, one entry per `send`. */\n readonly sent: Uint8Array[];\n /** Whether either end has closed it. */\n readonly closed: boolean;\n /** Deliver one chunk to the plugin's data listeners. */\n receive(bytes: Uint8Array): void;\n /** Close it from the far end, telling the plugin's close listeners. */\n closeFromServer(reason?: string): void;\n}\n\n/**\n * A `PluginHost` for tests. `fetch` replays a queue of scripted\n * `Response`s (FIFO, one per call) — or a custom handler installed\n * with `setFetchImpl`, for call-count-driven scenarios like a 401-then-200\n * retry — and records every call it received in `calls`. `storage`, `config`,\n * `secrets` and the `oauth` vault are in-memory and can be seeded or read\n * directly, bypassing the `PluginHost` methods, so a test can assert on state\n * without going through the code under test twice.\n */\nexport interface FakePluginHost extends PluginHost {\n /** Every `host.fetch` call so far, in call order. */\n readonly calls: RecordedFetchCall[];\n /** Set what `host.remainingMs()` reports, for testing budget shedding. */\n seedRemainingMs(ms: number): void;\n /** Push one scripted response onto the back of the reply queue. */\n queueResponse(response: FakeResponseInit): void;\n /** Replace the fetch handler outright; overrides the queue while set. */\n setFetchImpl(impl: (url: string, init?: HostFetchInit) => Promise<Response>): void;\n /** Seed the value `host.config.get()` resolves to. */\n seedConfig(config: Record<string, unknown>): void;\n /** Seed a value `host.secrets.get(key)` resolves to. */\n seedSecret(key: string, value: string): void;\n /** Seed a storage entry directly, bypassing `host.storage.set`. */\n seedStorage(key: string, value: unknown): void;\n /** Read a storage entry directly, bypassing `host.storage.get`. */\n getStorageEntry(key: string): unknown;\n /** All storage keys currently set, unfiltered. */\n storageKeys(): string[];\n /** Seed the oauth vault directly, bypassing `host.oauth.saveTokens`. */\n seedTokens(tokens: Record<string, string>): void;\n /** Read the oauth vault directly, bypassing `host.oauth.getTokens`. */\n getVaultTokens(): Record<string, string> | undefined;\n /** Set what `host.trackFetcher.serve()` answers with; `undefined` means \"this station has no fetcher\". */\n seedFetchedTrack(stream: ProviderStream | undefined): void;\n /**\n * Set what `host.trackFetcher.playlistTracks()` answers with. `undefined` means \"this station\n * has no fetcher\"; pass an `Error` to make it throw, which is the fetcher having tried and\n * failed and is a different case for a plugin to handle.\n */\n seedFetchedPlaylist(tracks: ProviderTrack[] | Error | undefined): void;\n /** Every socket `host.socket` opened, in order, closed ones included. */\n readonly sockets: FakePluginSocket[];\n /** Make every later `host.socket` reject with `error`; `undefined` lets them open again. */\n refuseSockets(error: Error | undefined): void;\n /** Every connection `host.tls` opened, in order, closed ones included. */\n readonly tlsSockets: FakePluginTlsSocket[];\n /** Make every later `host.tls` reject with `error`; `undefined` lets them open again. */\n refuseTls(error: Error | undefined): void;\n /**\n * Called with each connection as `host.tls` opens it, before the plugin sees it, so a test can\n * script the device's answers to whatever the plugin writes.\n */\n onTlsOpen(listener: ((socket: FakePluginTlsSocket) => void) | undefined): void;\n /**\n * What `host.discover` answers from now on: a fixed list, or one worked out per query. Nothing\n * is found until a test says otherwise, which is what a station on a bridge network sees.\n */\n seedDiscovery(found: DiscoveredService[] | ((query: DiscoveryQuery) => DiscoveredService[])): void;\n}\n\n/**\n * What `host.remainingMs()` reports unless a test says otherwise: what a live\n * call reads on its first line. The host's default per-call deadline is 8s, and\n * the clock has already been running for a few milliseconds by the time plugin\n * code asks, so a live call never sees the whole 8s. A plugin that refuses to\n * start unless a full request timeout is left therefore never starts at all,\n * and a default above the real deadline hid exactly that: every test passed\n * while every live call returned nothing.\n */\nconst DEFAULT_REMAINING_MS = 8_000 - 5;\n\n/**\n * What a test says a scripted reply should be.\n *\n * Not `ResponseInit`, because `url` is not on it: `host.fetch` reports the last\n * hop of the redirect chain there, and a `Response` built by hand has an empty\n * one unless it is defined in.\n */\nexport interface FakeResponseInit {\n status?: number;\n statusText?: string;\n headers?: Record<string, string>;\n /**\n * Text for a JSON or error reply, bytes for a binary one.\n *\n * `Uint8Array<ArrayBuffer>` rather than a bare `Uint8Array`: the DOM lib's\n * `BodyInit` accepts a view over a real `ArrayBuffer`, and the unparameterized\n * form widens to `ArrayBufferLike`, which includes `SharedArrayBuffer` and is\n * not something `Response` will take. `new Uint8Array([...])` already has the\n * narrow type, so no test has to say so.\n */\n body?: string | Uint8Array<ArrayBuffer>;\n url?: string;\n}\n\n/** Statuses whose `Response` must carry a null body, or the constructor throws. */\nconst NULL_BODY_STATUSES = new Set([101, 204, 205, 304]);\n\n/** Builds a default 200 `Response`, overridable field by field. */\nexport function fakeHostFetchResponse(init: FakeResponseInit = {}): Response {\n const status = init.status ?? 200;\n\n const response = new Response(NULL_BODY_STATUSES.has(status) ? null : (init.body ?? ''), {\n status,\n statusText: init.statusText ?? 'OK',\n headers: init.headers ?? { 'content-type': 'application/json' },\n });\n\n // Read-only on a constructed response, and part of what the host promises.\n Object.defineProperty(response, 'url', { value: init.url ?? 'https://example.test/' });\n\n return response;\n}\n\n/** A socket that is open until either end closes it. Exported for a test that wants one on its own. */\nexport function createFakePluginSocket(url: string): FakePluginSocket {\n const messageListeners: ((text: string) => void)[] = [];\n const closeListeners: ((code?: number, reason?: string) => void)[] = [];\n const sent: string[] = [];\n let closed = false;\n\n const shut = (code: number | undefined, reason: string | undefined): void => {\n if (closed) return;\n closed = true;\n for (const listener of closeListeners) listener(code, reason);\n };\n\n return {\n url,\n sent,\n get closed() {\n return closed;\n },\n send: vi.fn((text: string) => {\n if (!closed) sent.push(text);\n }),\n close: vi.fn((code?: number, reason?: string) => shut(code ?? 1000, reason)),\n onMessage: listener => void messageListeners.push(listener),\n onClose: listener => void closeListeners.push(listener),\n sentJson: () => sent.map(text => JSON.parse(text) as unknown),\n receive(text) {\n if (closed) throw new Error(`fake plugin socket: ${url} is closed`);\n for (const listener of messageListeners) listener(text);\n },\n receiveJson(value) {\n this.receive(JSON.stringify(value));\n },\n closeFromServer(code = 1000, reason = '') {\n shut(code, reason);\n },\n };\n}\n\n/** A TLS connection that is open until either end closes it. Exported for a test that wants one on its own. */\nexport function createFakePluginTlsSocket(url: string, options?: PluginTlsOptions): FakePluginTlsSocket {\n const dataListeners: ((bytes: Uint8Array) => void)[] = [];\n const closeListeners: ((reason?: string) => void)[] = [];\n const sent: Uint8Array[] = [];\n let closed = false;\n\n const shut = (reason: string | undefined): void => {\n if (closed) return;\n closed = true;\n for (const listener of closeListeners) listener(reason);\n };\n\n return {\n url,\n options,\n sent,\n get closed() {\n return closed;\n },\n send: vi.fn((bytes: Uint8Array) => {\n if (!closed) sent.push(bytes);\n }),\n close: vi.fn(() => shut(undefined)),\n onData: listener => void dataListeners.push(listener),\n onClose: listener => void closeListeners.push(listener),\n receive(bytes) {\n if (closed) throw new Error(`fake plugin tls socket: ${url} is closed`);\n for (const listener of dataListeners) listener(bytes);\n },\n closeFromServer(reason) {\n shut(reason);\n },\n };\n}\n\nexport function createFakePluginHost(): FakePluginHost {\n const calls: RecordedFetchCall[] = [];\n const queue: Response[] = [];\n let customImpl: ((url: string, init?: HostFetchInit) => Promise<Response>) | undefined;\n\n const storageData = new Map<string, unknown>();\n let configData: Record<string, unknown> = {};\n const secretsData = new Map<string, string>();\n let tokens: Record<string, string> | undefined;\n let remainingMs = DEFAULT_REMAINING_MS;\n let fetchedTrack: ProviderStream | undefined = { url: 'http://127.0.0.1:3679/track/song-1?t=signed', expiresAt: 1_893_456_000_000 };\n // Nothing by default: a plugin should ask its own API first, and a test that means to exercise\n // the fetcher says so.\n let fetchedPlaylist: ProviderTrack[] | Error | undefined;\n const sockets: FakePluginSocket[] = [];\n let socketRefusal: Error | undefined;\n const tlsSockets: FakePluginTlsSocket[] = [];\n let tlsRefusal: Error | undefined;\n let tlsOpened: ((socket: FakePluginTlsSocket) => void) | undefined;\n let discovered: (query: DiscoveryQuery) => DiscoveredService[] = () => [];\n\n const fetchImpl = vi.fn(async (url: string, init?: HostFetchInit): Promise<Response> => {\n calls.push({ url, method: init?.method, headers: init?.headers, body: init?.body });\n if (customImpl) return customImpl(url, init);\n const next = queue.shift();\n if (!next) throw new Error(`fake plugin host: no response queued for ${init?.method ?? 'GET'} ${url}`);\n return next;\n });\n\n const host: FakePluginHost = {\n logger: { debug: vi.fn(), info: vi.fn(), warn: vi.fn(), error: vi.fn() },\n fetch: fetchImpl,\n socket: vi.fn(async (url: string) => {\n if (socketRefusal !== undefined) throw socketRefusal;\n const socket = createFakePluginSocket(url);\n sockets.push(socket);\n return socket;\n }),\n tls: vi.fn(async (url: string, options?: PluginTlsOptions) => {\n if (tlsRefusal !== undefined) throw tlsRefusal;\n const socket = createFakePluginTlsSocket(url, options);\n tlsSockets.push(socket);\n tlsOpened?.(socket);\n return socket;\n }),\n discover: vi.fn(async (query: DiscoveryQuery) => discovered(query)),\n // Never aborts: these tests are about what a plugin does with a reply,\n // not about being cancelled half way through one.\n signal: new AbortController().signal,\n remainingMs: vi.fn(() => remainingMs),\n storage: {\n get: vi.fn(async (key: string) => storageData.get(key)),\n set: vi.fn(async (key: string, value: unknown) => {\n storageData.set(key, value);\n }),\n delete: vi.fn(async (key: string) => {\n storageData.delete(key);\n }),\n list: vi.fn(async (prefix?: string) => [...storageData.keys()].filter(key => !prefix || key.startsWith(prefix))),\n },\n secrets: { get: vi.fn(async (key: string) => secretsData.get(key)) },\n config: { get: vi.fn(async () => configData) },\n oauth: {\n getRedirectUri: vi.fn(async () => 'https://example.test/callback'),\n saveTokens: vi.fn(async (next: Record<string, string>) => {\n tokens = next;\n }),\n getTokens: vi.fn(async () => tokens),\n },\n events: { emit: vi.fn() },\n trackFetcher: {\n serve: vi.fn(async () => fetchedTrack),\n playlistTracks: vi.fn(async () => {\n if (fetchedPlaylist instanceof Error) throw fetchedPlaylist;\n return fetchedPlaylist;\n }),\n },\n calls,\n sockets,\n refuseSockets(error) {\n socketRefusal = error;\n },\n tlsSockets,\n refuseTls(error) {\n tlsRefusal = error;\n },\n onTlsOpen(listener) {\n tlsOpened = listener;\n },\n seedDiscovery(found) {\n discovered = typeof found === 'function' ? found : () => found;\n },\n seedRemainingMs(ms) {\n remainingMs = ms;\n },\n queueResponse(response: FakeResponseInit) {\n queue.push(fakeHostFetchResponse(response));\n },\n setFetchImpl(impl) {\n customImpl = impl;\n },\n seedConfig(config) {\n configData = config;\n },\n seedSecret(key, value) {\n secretsData.set(key, value);\n },\n seedStorage(key, value) {\n storageData.set(key, value);\n },\n getStorageEntry(key) {\n return storageData.get(key);\n },\n storageKeys() {\n return [...storageData.keys()];\n },\n seedTokens(next) {\n tokens = next;\n },\n getVaultTokens() {\n return tokens;\n },\n seedFetchedTrack(stream) {\n fetchedTrack = stream;\n },\n seedFetchedPlaylist(tracks) {\n fetchedPlaylist = tracks;\n },\n };\n\n return host;\n}\n"],"mappings":";;;;;AAAA,SAASA,UAAU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,UAAU9B,OAAK;AACXZ,mBAAaY;IACjB;IACA+B,UAAUnF,UAAQ;AACdyC,kBAAYzC;IAChB;IACAoF,cAAcC,OAAK;AACf3C,mBAAa,OAAO2C,UAAU,aAAaA,QAAQ,MAAMA;IAC7D;IACAC,gBAAgBC,IAAE;AACdtD,oBAAcsD;IAClB;IACAC,cAAc1G,UAA0B;AACpC4C,YAAMrB,KAAK1B,sBAAsBG,QAAAA,CAAAA;IACrC;IACA2G,aAAaC,MAAI;AACb/D,mBAAa+D;IACjB;IACAC,WAAWpB,QAAM;AACbzC,mBAAayC;IACjB;IACAqB,WAAW9B,KAAKxE,OAAK;AACjByC,kBAAYgC,IAAID,KAAKxE,KAAAA;IACzB;IACAuG,YAAY/B,KAAKxE,OAAK;AAClBsC,kBAAYmC,IAAID,KAAKxE,KAAAA;IACzB;IACAwG,gBAAgBhC,KAAG;AACf,aAAOlC,YAAYiC,IAAIC,GAAAA;IAC3B;IACAiC,cAAAA;AACI,aAAO;WAAInE,YAAYuC,KAAI;;IAC/B;IACA6B,WAAWnD,MAAI;AACXb,eAASa;IACb;IACAoD,iBAAAA;AACI,aAAOjE;IACX;IACAkE,iBAAiBC,QAAM;AACnBjE,qBAAeiE;IACnB;IACAC,oBAAoBC,QAAM;AACtBjE,wBAAkBiE;IACtB;EACJ;AAEA,SAAOtD;AACX;AAnIgBvB;","names":["vi","DEFAULT_REMAINING_MS","NULL_BODY_STATUSES","Set","fakeHostFetchResponse","init","status","response","Response","has","body","statusText","headers","Object","defineProperty","value","url","createFakePluginSocket","messageListeners","closeListeners","sent","closed","shut","code","reason","listener","send","vi","fn","text","push","close","onMessage","onClose","sentJson","map","JSON","parse","receive","Error","receiveJson","stringify","closeFromServer","createFakePluginTlsSocket","options","dataListeners","bytes","undefined","onData","createFakePluginHost","calls","queue","customImpl","storageData","Map","configData","secretsData","tokens","remainingMs","fetchedTrack","expiresAt","fetchedPlaylist","sockets","socketRefusal","tlsSockets","tlsRefusal","tlsOpened","discovered","fetchImpl","method","next","shift","host","logger","debug","info","warn","error","fetch","socket","tls","discover","query","signal","AbortController","storage","get","key","set","delete","list","prefix","keys","filter","startsWith","secrets","config","oauth","getRedirectUri","saveTokens","getTokens","events","emit","trackFetcher","serve","playlistTracks","refuseSockets","refuseTls","onTlsOpen","seedDiscovery","found","seedRemainingMs","ms","queueResponse","setFetchImpl","impl","seedConfig","seedSecret","seedStorage","getStorageEntry","storageKeys","seedTokens","getVaultTokens","seedFetchedTrack","stream","seedFetchedPlaylist","tracks"]}
1
+ {"version":3,"sources":["../../src/testing/fake.plugin.host.ts"],"sourcesContent":["import { vi } from 'vitest';\n\nimport type {\n DiscoveredService,\n DiscoveryQuery,\n HostFetchInit,\n HostFetchMethod,\n PluginHost,\n PluginSocket,\n PluginTlsOptions,\n PluginTlsSocket,\n ProviderStream,\n ProviderTrack,\n} from '../index.js';\n\n/**\n * Shipped from the SDK rather than copied into each plugin, which three of them\n * were doing — two of those carrying a comment saying the copy was deliberate\n * because plugins do not depend on each other.\n *\n * That reasoning held for the copies and does not hold for this: every plugin\n * already depends on the SDK, and `PluginHost` is the SDK's own contract, so its\n * test double belongs beside the interface it doubles. A plugin importing this\n * gains no dependency on any other plugin. It also means a host method added to\n * the contract turns up in one fake rather than being added to three and\n * forgotten in the other three.\n *\n * Reached as `@deadair/plugin-sdk/testing`, which is kept out of the runtime\n * entry so nothing ships a dependency on vitest.\n */\n\n/** One `host.fetch` call, recorded with only the fields tests care about. */\nexport interface RecordedFetchCall {\n url: string;\n method: HostFetchMethod | undefined;\n headers: Record<string, string> | undefined;\n body: string | undefined;\n}\n\n/**\n * One `host.socket` the plugin opened, driven from the test: frames the plugin sent are in `sent`,\n * and `receive` / `closeFromServer` play the far end.\n */\nexport interface FakePluginSocket extends PluginSocket {\n readonly url: string;\n /** Every text frame the plugin sent, in order. */\n readonly sent: string[];\n /** Whether either end has closed it. */\n readonly closed: boolean;\n /** The frames the plugin sent, each parsed as JSON. */\n sentJson(): unknown[];\n /** Deliver one text frame to the plugin's listeners. */\n receive(text: string): void;\n /** Deliver `JSON.stringify(value)`. */\n receiveJson(value: unknown): void;\n /** Close it from the far end, telling the plugin's close listeners. */\n closeFromServer(code?: number, reason?: string): void;\n}\n\n/**\n * One `host.tls` connection the plugin opened, driven from the test: bytes the plugin wrote are in\n * `sent`, and `receive` / `closeFromServer` play the device.\n */\nexport interface FakePluginTlsSocket extends PluginTlsSocket {\n readonly url: string;\n /** The options the plugin opened it with. */\n readonly options: PluginTlsOptions | undefined;\n /** Every write the plugin made, in order, one entry per `send`. */\n readonly sent: Uint8Array[];\n /** Whether either end has closed it. */\n readonly closed: boolean;\n /** Deliver one chunk to the plugin's data listeners. */\n receive(bytes: Uint8Array): void;\n /** Close it from the far end, telling the plugin's close listeners. */\n closeFromServer(reason?: string): void;\n}\n\n/**\n * A `PluginHost` for tests. `fetch` replays a queue of scripted\n * `Response`s (FIFO, one per call) — or a custom handler installed\n * with `setFetchImpl`, for call-count-driven scenarios like a 401-then-200\n * retry — and records every call it received in `calls`. `storage`, `config`,\n * `secrets` and the `oauth` vault are in-memory and can be seeded or read\n * directly, bypassing the `PluginHost` methods, so a test can assert on state\n * without going through the code under test twice.\n */\nexport interface FakePluginHost extends PluginHost {\n /** Every `host.fetch` call so far, in call order. */\n readonly calls: RecordedFetchCall[];\n /** Set what `host.remainingMs()` reports, for testing budget shedding. */\n seedRemainingMs(ms: number): void;\n /** Push one scripted response onto the back of the reply queue. */\n queueResponse(response: FakeResponseInit): void;\n /** Replace the fetch handler outright; overrides the queue while set. */\n setFetchImpl(impl: (url: string, init?: HostFetchInit) => Promise<Response>): void;\n /** Seed the value `host.config.get()` resolves to. */\n seedConfig(config: Record<string, unknown>): void;\n /** Seed a value `host.secrets.get(key)` resolves to. */\n seedSecret(key: string, value: string): void;\n /** Seed a storage entry directly, bypassing `host.storage.set`. */\n seedStorage(key: string, value: unknown): void;\n /** Read a storage entry directly, bypassing `host.storage.get`. */\n getStorageEntry(key: string): unknown;\n /** All storage keys currently set, unfiltered. */\n storageKeys(): string[];\n /** Seed the oauth vault directly, bypassing `host.oauth.saveTokens`. */\n seedTokens(tokens: Record<string, string>): void;\n /** Read the oauth vault directly, bypassing `host.oauth.getTokens`. */\n getVaultTokens(): Record<string, string> | undefined;\n /** Set what `host.trackFetcher.serve()` answers with; `undefined` means \"this station has no fetcher\". */\n seedFetchedTrack(stream: ProviderStream | undefined): void;\n /**\n * Set what `host.trackFetcher.playlistTracks()` answers with. `undefined` means \"this station\n * has no fetcher\"; pass an `Error` to make it throw, which is the fetcher having tried and\n * failed and is a different case for a plugin to handle.\n */\n seedFetchedPlaylist(tracks: ProviderTrack[] | Error | undefined): void;\n /** Every socket `host.socket` opened, in order, closed ones included. */\n readonly sockets: FakePluginSocket[];\n /** Make every later `host.socket` reject with `error`; `undefined` lets them open again. */\n refuseSockets(error: Error | undefined): void;\n /** Every connection `host.tls` opened, in order, closed ones included. */\n readonly tlsSockets: FakePluginTlsSocket[];\n /** Make every later `host.tls` reject with `error`; `undefined` lets them open again. */\n refuseTls(error: Error | undefined): void;\n /**\n * Called with each connection as `host.tls` opens it, before the plugin sees it, so a test can\n * script the device's answers to whatever the plugin writes.\n */\n onTlsOpen(listener: ((socket: FakePluginTlsSocket) => void) | undefined): void;\n /**\n * What `host.discover` answers from now on: a fixed list, or one worked out per query. Nothing\n * is found until a test says otherwise, which is what a station on a bridge network sees.\n */\n seedDiscovery(found: DiscoveredService[] | ((query: DiscoveryQuery) => DiscoveredService[])): void;\n}\n\n/**\n * What `host.remainingMs()` reports unless a test says otherwise: what a live\n * call reads on its first line. The host's default per-call deadline is 8s, and\n * the clock has already been running for a few milliseconds by the time plugin\n * code asks, so a live call never sees the whole 8s. A plugin that refuses to\n * start unless a full request timeout is left therefore never starts at all,\n * and a default above the real deadline hid exactly that: every test passed\n * while every live call returned nothing.\n */\nconst DEFAULT_REMAINING_MS = 8_000 - 5;\n\n/**\n * What a test says a scripted reply should be.\n *\n * Not `ResponseInit`, because `url` is not on it: `host.fetch` reports the last\n * hop of the redirect chain there, and a `Response` built by hand has an empty\n * one unless it is defined in.\n */\nexport interface FakeResponseInit {\n status?: number;\n statusText?: string;\n headers?: Record<string, string>;\n /**\n * Text for a JSON or error reply, bytes for a binary one.\n *\n * `Uint8Array<ArrayBuffer>` rather than a bare `Uint8Array`: the DOM lib's\n * `BodyInit` accepts a view over a real `ArrayBuffer`, and the unparameterized\n * form widens to `ArrayBufferLike`, which includes `SharedArrayBuffer` and is\n * not something `Response` will take. `new Uint8Array([...])` already has the\n * narrow type, so no test has to say so.\n */\n body?: string | Uint8Array<ArrayBuffer>;\n url?: string;\n}\n\n/** Statuses whose `Response` must carry a null body, or the constructor throws. */\nconst NULL_BODY_STATUSES = new Set([101, 204, 205, 304]);\n\n/** Builds a default 200 `Response`, overridable field by field. */\nexport function fakeHostFetchResponse(init: FakeResponseInit = {}): Response {\n const status = init.status ?? 200;\n\n const response = new Response(NULL_BODY_STATUSES.has(status) ? null : (init.body ?? ''), {\n status,\n statusText: init.statusText ?? 'OK',\n headers: init.headers ?? { 'content-type': 'application/json' },\n });\n\n // Read-only on a constructed response, and part of what the host promises.\n Object.defineProperty(response, 'url', { value: init.url ?? 'https://example.test/' });\n\n return response;\n}\n\n/** A socket that is open until either end closes it. Exported for a test that wants one on its own. */\nexport function createFakePluginSocket(url: string): FakePluginSocket {\n const messageListeners: ((text: string) => void)[] = [];\n const closeListeners: ((code?: number, reason?: string) => void)[] = [];\n const sent: string[] = [];\n let closed = false;\n\n const shut = (code: number | undefined, reason: string | undefined): void => {\n if (closed) return;\n closed = true;\n for (const listener of closeListeners) listener(code, reason);\n };\n\n return {\n url,\n sent,\n get closed() {\n return closed;\n },\n send: vi.fn((text: string) => {\n if (!closed) sent.push(text);\n }),\n close: vi.fn((code?: number, reason?: string) => shut(code ?? 1000, reason)),\n onMessage: listener => void messageListeners.push(listener),\n onClose: listener => void closeListeners.push(listener),\n sentJson: () => sent.map(text => JSON.parse(text) as unknown),\n receive(text) {\n if (closed) throw new Error(`fake plugin socket: ${url} is closed`);\n for (const listener of messageListeners) listener(text);\n },\n receiveJson(value) {\n this.receive(JSON.stringify(value));\n },\n closeFromServer(code = 1000, reason = '') {\n shut(code, reason);\n },\n };\n}\n\n/** A TLS connection that is open until either end closes it. Exported for a test that wants one on its own. */\nexport function createFakePluginTlsSocket(url: string, options?: PluginTlsOptions): FakePluginTlsSocket {\n const dataListeners: ((bytes: Uint8Array) => void)[] = [];\n const closeListeners: ((reason?: string) => void)[] = [];\n const sent: Uint8Array[] = [];\n let closed = false;\n\n const shut = (reason: string | undefined): void => {\n if (closed) return;\n closed = true;\n for (const listener of closeListeners) listener(reason);\n };\n\n return {\n url,\n options,\n sent,\n get closed() {\n return closed;\n },\n send: vi.fn((bytes: Uint8Array) => {\n if (!closed) sent.push(bytes);\n }),\n close: vi.fn(() => shut(undefined)),\n onData: listener => void dataListeners.push(listener),\n onClose: listener => void closeListeners.push(listener),\n receive(bytes) {\n if (closed) throw new Error(`fake plugin tls socket: ${url} is closed`);\n for (const listener of dataListeners) listener(bytes);\n },\n closeFromServer(reason) {\n shut(reason);\n },\n };\n}\n\nexport function createFakePluginHost(): FakePluginHost {\n const calls: RecordedFetchCall[] = [];\n const queue: Response[] = [];\n let customImpl: ((url: string, init?: HostFetchInit) => Promise<Response>) | undefined;\n\n const storageData = new Map<string, unknown>();\n let configData: Record<string, unknown> = {};\n const secretsData = new Map<string, string>();\n let tokens: Record<string, string> | undefined;\n let remainingMs = DEFAULT_REMAINING_MS;\n let fetchedTrack: ProviderStream | undefined = { url: 'http://127.0.0.1:3679/track/song-1?t=signed', expiresAt: 1_893_456_000_000 };\n // Nothing by default: a plugin should ask its own API first, and a test that means to exercise\n // the fetcher says so.\n let fetchedPlaylist: ProviderTrack[] | Error | undefined;\n const sockets: FakePluginSocket[] = [];\n let socketRefusal: Error | undefined;\n const tlsSockets: FakePluginTlsSocket[] = [];\n let tlsRefusal: Error | undefined;\n let tlsOpened: ((socket: FakePluginTlsSocket) => void) | undefined;\n let discovered: (query: DiscoveryQuery) => DiscoveredService[] = () => [];\n\n const fetchImpl = vi.fn(async (url: string, init?: HostFetchInit): Promise<Response> => {\n calls.push({ url, method: init?.method, headers: init?.headers, body: init?.body });\n if (customImpl) return customImpl(url, init);\n const next = queue.shift();\n if (!next) throw new Error(`fake plugin host: no response queued for ${init?.method ?? 'GET'} ${url}`);\n return next;\n });\n\n const host: FakePluginHost = {\n logger: { debug: vi.fn(), info: vi.fn(), warn: vi.fn(), error: vi.fn() },\n fetch: fetchImpl,\n socket: vi.fn(async (url: string) => {\n if (socketRefusal !== undefined) throw socketRefusal;\n const socket = createFakePluginSocket(url);\n sockets.push(socket);\n return socket;\n }),\n tls: vi.fn(async (url: string, options?: PluginTlsOptions) => {\n if (tlsRefusal !== undefined) throw tlsRefusal;\n const socket = createFakePluginTlsSocket(url, options);\n tlsSockets.push(socket);\n tlsOpened?.(socket);\n return socket;\n }),\n discover: vi.fn(async (query: DiscoveryQuery) => discovered(query)),\n // Never aborts: these tests are about what a plugin does with a reply,\n // not about being cancelled half way through one.\n signal: new AbortController().signal,\n remainingMs: vi.fn(() => remainingMs),\n storage: {\n get: vi.fn(async (key: string) => storageData.get(key)),\n set: vi.fn(async (key: string, value: unknown) => {\n storageData.set(key, value);\n }),\n delete: vi.fn(async (key: string) => {\n storageData.delete(key);\n }),\n list: vi.fn(async (prefix?: string) => [...storageData.keys()].filter(key => !prefix || key.startsWith(prefix))),\n },\n secrets: { get: vi.fn(async (key: string) => secretsData.get(key)) },\n config: { get: vi.fn(async () => configData) },\n oauth: {\n getRedirectUri: vi.fn(async () => 'https://example.test/callback'),\n saveTokens: vi.fn(async (next: Record<string, string>) => {\n tokens = next;\n }),\n getTokens: vi.fn(async () => tokens),\n },\n events: { emit: vi.fn() },\n trackFetcher: {\n serve: vi.fn(async () => fetchedTrack),\n // Answers the same canned stream as `serve`: a plugin under test cares that it asked the\n // host for audio and passed the answer through, not which helper the station happens to run\n // behind it. `fetchedTrack` is what a test sets to say \"the station has a fetcher\" or, as\n // undefined, \"it has not got one\".\n servePlayer: vi.fn(async () => fetchedTrack),\n playlistTracks: vi.fn(async () => {\n if (fetchedPlaylist instanceof Error) throw fetchedPlaylist;\n return fetchedPlaylist;\n }),\n },\n calls,\n sockets,\n refuseSockets(error) {\n socketRefusal = error;\n },\n tlsSockets,\n refuseTls(error) {\n tlsRefusal = error;\n },\n onTlsOpen(listener) {\n tlsOpened = listener;\n },\n seedDiscovery(found) {\n discovered = typeof found === 'function' ? found : () => found;\n },\n seedRemainingMs(ms) {\n remainingMs = ms;\n },\n queueResponse(response: FakeResponseInit) {\n queue.push(fakeHostFetchResponse(response));\n },\n setFetchImpl(impl) {\n customImpl = impl;\n },\n seedConfig(config) {\n configData = config;\n },\n seedSecret(key, value) {\n secretsData.set(key, value);\n },\n seedStorage(key, value) {\n storageData.set(key, value);\n },\n getStorageEntry(key) {\n return storageData.get(key);\n },\n storageKeys() {\n return [...storageData.keys()];\n },\n seedTokens(next) {\n tokens = next;\n },\n getVaultTokens() {\n return tokens;\n },\n seedFetchedTrack(stream) {\n fetchedTrack = stream;\n },\n seedFetchedPlaylist(tracks) {\n fetchedPlaylist = tracks;\n },\n };\n\n return host;\n}\n"],"mappings":";;;;;AAAA,SAASA,UAAU;AAkJnB,IAAMC,uBAAuB,MAAQ;AA2BrC,IAAMC,qBAAqB,oBAAIC,IAAI;EAAC;EAAK;EAAK;EAAK;CAAI;AAGhD,SAASC,sBAAsBC,OAAyB,CAAC,GAAC;AAC7D,QAAMC,SAASD,KAAKC,UAAU;AAE9B,QAAMC,WAAW,IAAIC,SAASN,mBAAmBO,IAAIH,MAAAA,IAAU,OAAQD,KAAKK,QAAQ,IAAK;IACrFJ;IACAK,YAAYN,KAAKM,cAAc;IAC/BC,SAASP,KAAKO,WAAW;MAAE,gBAAgB;IAAmB;EAClE,CAAA;AAGAC,SAAOC,eAAeP,UAAU,OAAO;IAAEQ,OAAOV,KAAKW,OAAO;E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AAW/B,KAAKxE,OAAK;AACjByC,kBAAYgC,IAAID,KAAKxE,KAAAA;IACzB;IACAwG,YAAYhC,KAAKxE,OAAK;AAClBsC,kBAAYmC,IAAID,KAAKxE,KAAAA;IACzB;IACAyG,gBAAgBjC,KAAG;AACf,aAAOlC,YAAYiC,IAAIC,GAAAA;IAC3B;IACAkC,cAAAA;AACI,aAAO;WAAIpE,YAAYuC,KAAI;;IAC/B;IACA8B,WAAWpD,MAAI;AACXb,eAASa;IACb;IACAqD,iBAAAA;AACI,aAAOlE;IACX;IACAmE,iBAAiBC,QAAM;AACnBlE,qBAAekE;IACnB;IACAC,oBAAoBC,QAAM;AACtBlE,wBAAkBkE;IACtB;EACJ;AAEA,SAAOvD;AACX;AAxIgBvB;","names":["vi","DEFAULT_REMAINING_MS","NULL_BODY_STATUSES","Set","fakeHostFetchResponse","init","status","response","Response","has","body","statusText","headers","Object","defineProperty","value","url","createFakePluginSocket","messageListeners","closeListeners","sent","closed","shut","code","reason","listener","send","vi","fn","text","push","close","onMessage","onClose","sentJson","map","JSON","parse","receive","Error","receiveJson","stringify","closeFromServer","createFakePluginTlsSocket","options","dataListeners","bytes","undefined","onData","createFakePluginHost","calls","queue","customImpl","storageData","Map","configData","secretsData","tokens","remainingMs","fetchedTrack","expiresAt","fetchedPlaylist","sockets","socketRefusal","tlsSockets","tlsRefusal","tlsOpened","discovered","fetchImpl","method","next","shift","host","logger","debug","info","warn","error","fetch","socket","tls","discover","query","signal","AbortController","storage","get","key","set","delete","list","prefix","keys","filter","startsWith","secrets","config","oauth","getRedirectUri","saveTokens","getTokens","events","emit","trackFetcher","serve","servePlayer","playlistTracks","refuseSockets","refuseTls","onTlsOpen","seedDiscovery","found","seedRemainingMs","ms","queueResponse","setFetchImpl","impl","seedConfig","seedSecret","seedStorage","getStorageEntry","storageKeys","seedTokens","getVaultTokens","seedFetchedTrack","stream","seedFetchedPlaylist","tracks"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deadair/plugin-sdk",
3
- "version": "0.52.2",
3
+ "version": "0.54.0",
4
4
  "description": "The contract a deadair plugin is written against: the manifest, the capabilities, the host it is handed, and a fake host for its tests.",
5
5
  "keywords": [
6
6
  "deadair",