@pramen/client 0.0.48 → 0.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -11,6 +11,10 @@ type HandlerOutput<H> = H extends {
11
11
  } ? Awaited<O> : unknown;
12
12
  export type Input<Api, K extends keyof Api> = HandlerInput<Api[K]>;
13
13
  export type Output<Api, K extends keyof Api> = HandlerOutput<Api[K]>;
14
+ /** Just the call signature the client uses. Narrower than `typeof fetch`, whose extra
15
+ * statics (`preconnect`) a caller supplying a mock or a polyfill has no reason to
16
+ * provide. */
17
+ export type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
14
18
  export interface ClientOptions {
15
19
  /** Base URL of the deployed Worker, e.g. https://app.example.workers.dev */
16
20
  url: string;
@@ -18,7 +22,7 @@ export interface ClientOptions {
18
22
  tenant?: string;
19
23
  /** Override for non-browser environments (defaults to globals). */
20
24
  WebSocketImpl?: typeof WebSocket;
21
- fetchImpl?: typeof fetch;
25
+ fetchImpl?: FetchLike;
22
26
  /** Give up reconnecting the live socket after this many consecutive failed
23
27
  * attempts and surface a connection error to every subscriber (default 8). */
24
28
  maxReconnectAttempts?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pramen/client",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "description": "Typed client for a pramen backend — RPC over HTTP + live queries over WebSocket.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -26,6 +26,11 @@ type HandlerOutput<H> = H extends { run: (ctx: any, input: any) => infer O } ? A
26
26
  export type Input<Api, K extends keyof Api> = HandlerInput<Api[K]>;
27
27
  export type Output<Api, K extends keyof Api> = HandlerOutput<Api[K]>;
28
28
 
29
+ /** Just the call signature the client uses. Narrower than `typeof fetch`, whose extra
30
+ * statics (`preconnect`) a caller supplying a mock or a polyfill has no reason to
31
+ * provide. */
32
+ export type FetchLike = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
33
+
29
34
  export interface ClientOptions {
30
35
  /** Base URL of the deployed Worker, e.g. https://app.example.workers.dev */
31
36
  url: string;
@@ -33,7 +38,7 @@ export interface ClientOptions {
33
38
  tenant?: string;
34
39
  /** Override for non-browser environments (defaults to globals). */
35
40
  WebSocketImpl?: typeof WebSocket;
36
- fetchImpl?: typeof fetch;
41
+ fetchImpl?: FetchLike;
37
42
  /** Give up reconnecting the live socket after this many consecutive failed
38
43
  * attempts and surface a connection error to every subscriber (default 8). */
39
44
  maxReconnectAttempts?: number;