shelving 1.181.0 → 1.181.1

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.
@@ -12,14 +12,19 @@ export type MockAPICall = {
12
12
  readonly response: Response;
13
13
  readonly result: unknown;
14
14
  };
15
- /** Construction options for a `MockAPIProvider`. */
16
- export interface MockAPIProviderOptions extends ClientAPIProviderOptions {
15
+ /**
16
+ * Construction options for a `MockAPIProvider`
17
+ * - Same as options for a normal `ClientAPIProvider`, but with an optional URL.
18
+ */
19
+ export interface MockAPIProviderOptions extends Omit<ClientAPIProviderOptions, "url"> {
20
+ /** Optional URL, defaults to `"https://api.mock.com"` */
21
+ url?: ClientAPIProviderOptions["url"];
17
22
  }
18
23
  /** Provider that logs API calls without sending network requests. */
19
24
  export declare class MockAPIProvider extends ClientAPIProvider {
20
25
  readonly calls: MockAPICall[];
21
26
  readonly handler: RequestHandler;
22
- constructor(handler: RequestHandler, options?: MockAPIProviderOptions);
27
+ constructor(handler: RequestHandler, { url, ...options }?: MockAPIProviderOptions);
23
28
  /**
24
29
  * Log a `fetch()` call without using the network.
25
30
  * - If `getResult` is configured, its return value is returned as-is (no schema validation).
@@ -4,8 +4,8 @@ import { ClientAPIProvider } from "./ClientAPIProvider.js";
4
4
  export class MockAPIProvider extends ClientAPIProvider {
5
5
  calls = [];
6
6
  handler;
7
- constructor(handler, options = { url: "https://api.mock.com" }) {
8
- super(options);
7
+ constructor(handler, { url = "https://api.mock.com", ...options } = {}) {
8
+ super({ url, ...options });
9
9
  this.handler = handler;
10
10
  }
11
11
  /**
@@ -1,6 +1,10 @@
1
1
  import { type EndpointHandlers } from "../endpoint/util.js";
2
2
  import { MockAPIProvider, type MockAPIProviderOptions } from "./MockAPIProvider.js";
3
- export interface MockEndpointAPIProviderOptions<C> extends MockAPIProviderOptions {
3
+ /**
4
+ * Construction options for a `MockAPIProvider`
5
+ * - Same as options for a normal `MockAPIProviderOptions`, but with a `context` property for the endpoints.
6
+ */
7
+ export interface MockEndpointAPIProviderOptions<C = void> extends MockAPIProviderOptions {
4
8
  context: C;
5
9
  }
6
10
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shelving",
3
- "version": "1.181.0",
3
+ "version": "1.181.1",
4
4
  "author": "Dave Houlbrooke <dave@shax.com>",
5
5
  "repository": {
6
6
  "type": "git",