@webpieces/http-client-core 0.4.1009 → 0.4.1010

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/http-client-core",
3
- "version": "0.4.1009",
3
+ "version": "0.4.1010",
4
4
  "description": "Isomorphic core of the webpieces HTTP client: the decorator-driven ProxyClient, error translation, and the Proxy trap shared by http-client-node and http-client-browser",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -21,6 +21,6 @@
21
21
  "access": "public"
22
22
  },
23
23
  "dependencies": {
24
- "@webpieces/core-util": "0.4.1009"
24
+ "@webpieces/core-util": "0.4.1010"
25
25
  }
26
26
  }
@@ -1,4 +1,5 @@
1
1
  import { DeadlineScheduler } from '@webpieces/core-util';
2
+ import { MobileWebViewHost } from './MobileWebViewHost';
2
3
  /**
3
4
  * The options ONE generated-client transmission hands its {@link HttpFetch}. A class rather than a
4
5
  * `RequestInit` literal so every field the client sends is named in one place; it is structurally a
@@ -26,12 +27,14 @@ export declare class HttpFetchInit {
26
27
  * `Response`-compatible object.
27
28
  */
28
29
  export type HttpFetch = (url: string, init: HttpFetchInit) => Promise<Response>;
29
- /** Which runtime a {@link HttpClientRuntime} was built for; see its two factory methods. */
30
+ /** Which runtime a {@link HttpClientRuntime} was built for; see its named constructors. */
30
31
  export declare enum HttpRuntimeKind {
31
- /** Platform fetch + JS timers: browsers, WebView pages, Node, SSR, workers, tests. */
32
+ /** Platform fetch + JS timers: standalone browsers, Node, SSR, workers, tests. */
32
33
  PLATFORM_DEFAULT = "platform-default",
33
34
  /** The application declared a React Native JS runtime and supplied native-backed collaborators. */
34
- REACT_NATIVE = "react-native"
35
+ REACT_NATIVE = "react-native",
36
+ /** Page HTTP delegates through a declared mobile shell to its native adapter. */
37
+ MOBILE_WEBVIEW = "mobile-webview"
35
38
  }
36
39
  /**
37
40
  * The two runtime collaborators of ONE client factory (#1445): how a request reaches the network
@@ -39,7 +42,7 @@ export declare enum HttpRuntimeKind {
39
42
  * Held per factory, never process-wide, so two factories in one app can use different transports and
40
43
  * nothing monkey-patches `globalThis.fetch` or the JS timers.
41
44
  *
42
- * - {@link HttpClientRuntime.platformDefaults} — browser/WebView/Node/SSR/worker/test: platform fetch,
45
+ * - {@link HttpClientRuntime.platformDefaults} — standalone browser/Node/SSR/worker/test: platform fetch,
43
46
  * looked up on EVERY call (so a test's stubbed global is honoured), and standard JS timers.
44
47
  * - {@link HttpClientRuntime.reactNative} — the React Native JS runtime, whose default fetch and JS
45
48
  * timers can stop progressing while an Android phone is locked. The application passes a
@@ -51,6 +54,7 @@ export declare class HttpClientRuntime {
51
54
  readonly kind: HttpRuntimeKind;
52
55
  readonly fetch: HttpFetch;
53
56
  readonly deadlines: DeadlineScheduler;
57
+ readonly host?: MobileWebViewHost | undefined;
54
58
  private constructor();
55
59
  static platformDefaults(): HttpClientRuntime;
56
60
  /**
@@ -59,6 +63,12 @@ export declare class HttpClientRuntime {
59
63
  * runtime) is refused with the name of what is missing, before any client is built.
60
64
  */
61
65
  static reactNative(fetch: HttpFetch, deadlines: DeadlineScheduler): HttpClientRuntime;
66
+ /**
67
+ * Declare the page's negotiated mobile host and native-backed adapter. No Expo import belongs
68
+ * in this portable package or in page JS: fetch must cross IPC to native HTTP, not Expo's web
69
+ * fallback. The native side owns resource deadlines even while page JavaScript is suspended.
70
+ */
71
+ static mobileWebView(fetch: HttpFetch, deadlines: DeadlineScheduler, host: MobileWebViewHost): HttpClientRuntime;
62
72
  private static missingCollaborators;
63
73
  }
64
74
  /**
@@ -71,8 +81,8 @@ export declare class ReactNativeRuntimeConfigError extends Error {
71
81
  readonly missing: string[];
72
82
  /** Where the problem was detected, for the message. */
73
83
  readonly site: string;
74
- /** Where the setup example lives; every message links it. */
75
- static readonly SETUP_URL = "https://github.com/deanhiller/webpieces-ts/tree/main/packages/http/http-client-browser#react-native";
84
+ /** The reproduction and setup rationale; every message links it. */
85
+ static readonly SETUP_URL = "https://github.com/deanhiller/webpieces-ts/issues/1463";
76
86
  constructor(
77
87
  /** The missing collaborator names: `fetch`, `deadlines`, or both. */
78
88
  missing: string[],
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ReactNativeRuntimeConfigError = exports.HttpClientRuntime = exports.HttpRuntimeKind = exports.HttpFetchInit = void 0;
4
4
  const core_util_1 = require("@webpieces/core-util");
5
+ const MobileWebViewHost_1 = require("./MobileWebViewHost");
5
6
  /**
6
7
  * The options ONE generated-client transmission hands its {@link HttpFetch}. A class rather than a
7
8
  * `RequestInit` literal so every field the client sends is named in one place; it is structurally a
@@ -27,13 +28,15 @@ class HttpFetchInit {
27
28
  }
28
29
  }
29
30
  exports.HttpFetchInit = HttpFetchInit;
30
- /** Which runtime a {@link HttpClientRuntime} was built for; see its two factory methods. */
31
+ /** Which runtime a {@link HttpClientRuntime} was built for; see its named constructors. */
31
32
  var HttpRuntimeKind;
32
33
  (function (HttpRuntimeKind) {
33
- /** Platform fetch + JS timers: browsers, WebView pages, Node, SSR, workers, tests. */
34
+ /** Platform fetch + JS timers: standalone browsers, Node, SSR, workers, tests. */
34
35
  HttpRuntimeKind["PLATFORM_DEFAULT"] = "platform-default";
35
36
  /** The application declared a React Native JS runtime and supplied native-backed collaborators. */
36
37
  HttpRuntimeKind["REACT_NATIVE"] = "react-native";
38
+ /** Page HTTP delegates through a declared mobile shell to its native adapter. */
39
+ HttpRuntimeKind["MOBILE_WEBVIEW"] = "mobile-webview";
37
40
  })(HttpRuntimeKind || (exports.HttpRuntimeKind = HttpRuntimeKind = {}));
38
41
  /**
39
42
  * The two runtime collaborators of ONE client factory (#1445): how a request reaches the network
@@ -41,7 +44,7 @@ var HttpRuntimeKind;
41
44
  * Held per factory, never process-wide, so two factories in one app can use different transports and
42
45
  * nothing monkey-patches `globalThis.fetch` or the JS timers.
43
46
  *
44
- * - {@link HttpClientRuntime.platformDefaults} — browser/WebView/Node/SSR/worker/test: platform fetch,
47
+ * - {@link HttpClientRuntime.platformDefaults} — standalone browser/Node/SSR/worker/test: platform fetch,
45
48
  * looked up on EVERY call (so a test's stubbed global is honoured), and standard JS timers.
46
49
  * - {@link HttpClientRuntime.reactNative} — the React Native JS runtime, whose default fetch and JS
47
50
  * timers can stop progressing while an Android phone is locked. The application passes a
@@ -53,10 +56,12 @@ class HttpClientRuntime {
53
56
  kind;
54
57
  fetch;
55
58
  deadlines;
56
- constructor(kind, fetch, deadlines) {
59
+ host;
60
+ constructor(kind, fetch, deadlines, host) {
57
61
  this.kind = kind;
58
62
  this.fetch = fetch;
59
63
  this.deadlines = deadlines;
64
+ this.host = host;
60
65
  }
61
66
  // webpieces-disable no-function-outside-class -- named constructor of an immutable runtime value
62
67
  static platformDefaults() {
@@ -77,6 +82,24 @@ class HttpClientRuntime {
77
82
  }
78
83
  return new HttpClientRuntime(HttpRuntimeKind.REACT_NATIVE, fetch, deadlines);
79
84
  }
85
+ /**
86
+ * Declare the page's negotiated mobile host and native-backed adapter. No Expo import belongs
87
+ * in this portable package or in page JS: fetch must cross IPC to native HTTP, not Expo's web
88
+ * fallback. The native side owns resource deadlines even while page JavaScript is suspended.
89
+ */
90
+ // webpieces-disable no-function-outside-class -- named constructor of an immutable runtime value
91
+ static mobileWebView(fetch, deadlines, host) {
92
+ const missing = HttpClientRuntime.missingCollaborators(fetch, deadlines);
93
+ if (!host) {
94
+ missing.push('shell host capabilities');
95
+ }
96
+ else {
97
+ missing.push(...MobileWebViewHost_1.MobileWebViewHost.missingCapabilities(host));
98
+ }
99
+ if (missing.length > 0)
100
+ throw new MobileWebViewHost_1.MobileWebViewRuntimeConfigError(missing);
101
+ return new HttpClientRuntime(HttpRuntimeKind.MOBILE_WEBVIEW, fetch, deadlines, Object.freeze(new MobileWebViewHost_1.MobileWebViewHost(host.kind, host.protocolVersion, host.documentId, host.sessionId, host.nativeHttp, host.nativeDeadlines, host.nativeCancellation)));
102
+ }
80
103
  // webpieces-disable no-function-outside-class -- pure validation of the two collaborators
81
104
  static missingCollaborators(fetch, deadlines) {
82
105
  const missing = [];
@@ -100,14 +123,14 @@ exports.HttpClientRuntime = HttpClientRuntime;
100
123
  class ReactNativeRuntimeConfigError extends Error {
101
124
  missing;
102
125
  site;
103
- /** Where the setup example lives; every message links it. */
104
- static SETUP_URL = 'https://github.com/deanhiller/webpieces-ts/tree/main/packages/http/http-client-browser#react-native';
126
+ /** The reproduction and setup rationale; every message links it. */
127
+ static SETUP_URL = 'https://github.com/deanhiller/webpieces-ts/issues/1463';
105
128
  constructor(
106
129
  /** The missing collaborator names: `fetch`, `deadlines`, or both. */
107
130
  missing,
108
131
  /** Where the problem was detected, for the message. */
109
132
  site) {
110
- super(`${site}: React Native HTTP clients need explicit native-backed collaborators; missing: ` +
133
+ super(`${site}: Expo/native HTTP client required for React Native; missing: ` +
111
134
  `${missing.join(', ')}. React Native's default fetch and JS timers can stop while the ` +
112
135
  `device is locked. Pass HttpClientRuntime.reactNative(fetch, deadlines) — e.g. ` +
113
136
  `\`import { fetch } from 'expo/fetch'\` and a DeadlineScheduler backed by a native timer. ` +
@@ -1 +1 @@
1
- {"version":3,"file":"HttpClientRuntime.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/src/HttpClientRuntime.ts"],"names":[],"mappings":";;;AAAA,oDAAiF;AAEjF;;;;;GAKG;AACH,MAAa,aAAa;IAET;IACA;IACA;IAEA;IAEA;IAPb,YACa,MAAc,EACd,OAA+B,EAC/B,MAAmB;IAC5B,+FAA+F;IACtF,QAA6B;IACtC,qEAAqE;IAC5D,IAAa;QANb,WAAM,GAAN,MAAM,CAAQ;QACd,YAAO,GAAP,OAAO,CAAwB;QAC/B,WAAM,GAAN,MAAM,CAAa;QAEnB,aAAQ,GAAR,QAAQ,CAAqB;QAE7B,SAAI,GAAJ,IAAI,CAAS;IACvB,CAAC;CACP;AAVD,sCAUC;AAUD,4FAA4F;AAC5F,IAAY,eAKX;AALD,WAAY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CAAC,QAAQ,KAAK,UAAU;YACxC,OAAO,SAAS,CAAC,GAAG,KAAK,UAAU,EACrC,CAAC;YACC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAhDD,8CAgDC;AAED;;;;GAIG;AACH,MAAa,6BAA8B,SAAQ,KAAK;IAOvC;IAEA;IARb,6DAA6D;IAC7D,MAAM,CAAU,SAAS,GACrB,qGAAqG,CAAC;IAE1G;IACI,qEAAqE;IAC5D,OAAiB;IAC1B,uDAAuD;IAC9C,IAAY;QAErB,KAAK,CACD,GAAG,IAAI,kFAAkF;YACrF,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,kEAAkE;YACvF,gFAAgF;YAChF,2FAA2F;YAC3F,UAAU,6BAA6B,CAAC,SAAS,EAAE,CAC1D,CAAC;QAVO,YAAO,GAAP,OAAO,CAAU;QAEjB,SAAI,GAAJ,IAAI,CAAQ;QASrB,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;IAChD,CAAC;;AAnBL,sEAoBC","sourcesContent":["import { DeadlineScheduler, TimerDeadlineScheduler } from '@webpieces/core-util';\n\n/**\n * The options ONE generated-client transmission hands its {@link HttpFetch}. A class rather than a\n * `RequestInit` literal so every field the client sends is named in one place; it is structurally a\n * subset of the DOM `RequestInit` AND of Expo's `FetchRequestInit`, which is what lets `globalThis.fetch`\n * and `import { fetch } from 'expo/fetch'` both be passed as an {@link HttpFetch} with no cast.\n */\nexport class HttpFetchInit {\n constructor(\n readonly method: string,\n readonly headers: Record<string, string>,\n readonly signal: AbortSignal,\n /** `manual` for a `full` response or a filter that follows redirects itself; else `follow`. */\n readonly redirect: 'manual' | 'follow',\n /** The exact serialized body; absent for a call with no argument. */\n readonly body?: string,\n ) {}\n}\n\n/**\n * A fetch-compatible function: the ONLY thing a generated client calls to put a request on the wire.\n * `globalThis.fetch` and Expo's `expo/fetch` (whose `FetchResponse` implements `Response`) both satisfy\n * it as-is. Any other native-backed transport does too, if it accepts these options and resolves a\n * `Response`-compatible object.\n */\nexport type HttpFetch = (url: string, init: HttpFetchInit) => Promise<Response>;\n\n/** Which runtime a {@link HttpClientRuntime} was built for; see its two factory methods. */\nexport enum HttpRuntimeKind {\n /** Platform fetch + JS timers: browsers, WebView pages, Node, SSR, workers, tests. */\n PLATFORM_DEFAULT = 'platform-default',\n /** The application declared a React Native JS runtime and supplied native-backed collaborators. */\n REACT_NATIVE = 'react-native',\n}\n\n/**\n * The two runtime collaborators of ONE client factory (#1445): how a request reaches the network\n * ({@link HttpFetch}) and where its deadline's clock and wake-up come from ({@link DeadlineScheduler}).\n * Held per factory, never process-wide, so two factories in one app can use different transports and\n * nothing monkey-patches `globalThis.fetch` or the JS timers.\n *\n * - {@link HttpClientRuntime.platformDefaults} — browser/WebView/Node/SSR/worker/test: platform fetch,\n * looked up on EVERY call (so a test's stubbed global is honoured), and standard JS timers.\n * - {@link HttpClientRuntime.reactNative} — the React Native JS runtime, whose default fetch and JS\n * timers can stop progressing while an Android phone is locked. The application passes a\n * native-backed fetch (e.g. `expo/fetch`) and a native-backed {@link DeadlineScheduler}; this call is\n * the explicit capability acknowledgement, because no runtime check can PROVE a function is\n * background-safe from its name or source text.\n */\nexport class HttpClientRuntime {\n private constructor(\n readonly kind: HttpRuntimeKind,\n readonly fetch: HttpFetch,\n readonly deadlines: DeadlineScheduler,\n ) {}\n\n // webpieces-disable no-function-outside-class -- named constructor of an immutable runtime value\n static platformDefaults(): HttpClientRuntime {\n return new HttpClientRuntime(\n HttpRuntimeKind.PLATFORM_DEFAULT,\n // webpieces-disable no-fetch -- this IS the generated-client implementation the rule points everyone to\n (url: string, init: HttpFetchInit): Promise<Response> => fetch(url, init),\n new TimerDeadlineScheduler(),\n );\n }\n\n /**\n * Declare the React Native JS runtime and its native-backed collaborators. Both are REQUIRED; a\n * caller that reaches here without one (plain JavaScript, or a value that was `undefined` at\n * runtime) is refused with the name of what is missing, before any client is built.\n */\n // webpieces-disable no-function-outside-class -- named constructor of an immutable runtime value\n static reactNative(fetch: HttpFetch, deadlines: DeadlineScheduler): HttpClientRuntime {\n const missing = HttpClientRuntime.missingCollaborators(fetch, deadlines);\n if (missing.length > 0) {\n throw new ReactNativeRuntimeConfigError(missing, 'HttpClientRuntime.reactNative(...)');\n }\n return new HttpClientRuntime(HttpRuntimeKind.REACT_NATIVE, fetch, deadlines);\n }\n\n // webpieces-disable no-function-outside-class -- pure validation of the two collaborators\n private static missingCollaborators(\n fetch: HttpFetch | undefined,\n deadlines: DeadlineScheduler | undefined,\n ): string[] {\n const missing: string[] = [];\n if (typeof fetch !== 'function') missing.push('fetch');\n if (\n deadlines === undefined ||\n deadlines === null ||\n typeof deadlines.schedule !== 'function' ||\n typeof deadlines.now !== 'function'\n ) {\n missing.push('deadlines');\n }\n return missing;\n }\n}\n\n/**\n * A React Native client was configured without the native-backed collaborators it needs. Thrown when\n * the factory/runtime is CREATED — never on a request — so the misconfiguration surfaces at startup\n * instead of as a request that silently stalls while the phone is locked.\n */\nexport class ReactNativeRuntimeConfigError extends Error {\n /** Where the setup example lives; every message links it. */\n static readonly SETUP_URL =\n 'https://github.com/deanhiller/webpieces-ts/tree/main/packages/http/http-client-browser#react-native';\n\n constructor(\n /** The missing collaborator names: `fetch`, `deadlines`, or both. */\n readonly missing: string[],\n /** Where the problem was detected, for the message. */\n readonly site: string,\n ) {\n super(\n `${site}: React Native HTTP clients need explicit native-backed collaborators; missing: ` +\n `${missing.join(', ')}. React Native's default fetch and JS timers can stop while the ` +\n `device is locked. Pass HttpClientRuntime.reactNative(fetch, deadlines) — e.g. ` +\n `\\`import { fetch } from 'expo/fetch'\\` and a DeadlineScheduler backed by a native timer. ` +\n `Setup: ${ReactNativeRuntimeConfigError.SETUP_URL}`,\n );\n this.name = 'ReactNativeRuntimeConfigError';\n }\n}\n"]}
1
+ {"version":3,"file":"HttpClientRuntime.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/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AE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvD,IACI,SAAS,KAAK,SAAS;YACvB,SAAS,KAAK,IAAI;YAClB,OAAO,SAAS,CAAC,QAAQ,KAAK,UAAU;YACxC,OAAO,SAAS,CAAC,GAAG,KAAK,UAAU,EACrC,CAAC;YACC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AArFD,8CAqFC;AAED;;;;GAIG;AACH,MAAa,6BAA8B,SAAQ,KAAK;IAMvC;IAEA;IAPb,oEAAoE;IACpE,MAAM,CAAU,SAAS,GAAG,wDAAwD,CAAC;IAErF;IACI,qEAAqE;IAC5D,OAAiB;IAC1B,uDAAuD;IAC9C,IAAY;QAErB,KAAK,CACD,GAAG,IAAI,gEAAgE;YACnE,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,kEAAkE;YACvF,gFAAgF;YAChF,2FAA2F;YAC3F,UAAU,6BAA6B,CAAC,SAAS,EAAE,CAC1D,CAAC;QAVO,YAAO,GAAP,OAAO,CAAU;QAEjB,SAAI,GAAJ,IAAI,CAAQ;QASrB,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;IAChD,CAAC;;AAlBL,sEAmBC","sourcesContent":["import { DeadlineScheduler, TimerDeadlineScheduler } from '@webpieces/core-util';\nimport { MobileWebViewHost, MobileWebViewRuntimeConfigError } from './MobileWebViewHost';\n\n/**\n * The options ONE generated-client transmission hands its {@link HttpFetch}. A class rather than a\n * `RequestInit` literal so every field the client sends is named in one place; it is structurally a\n * subset of the DOM `RequestInit` AND of Expo's `FetchRequestInit`, which is what lets `globalThis.fetch`\n * and `import { fetch } from 'expo/fetch'` both be passed as an {@link HttpFetch} with no cast.\n */\nexport class HttpFetchInit {\n constructor(\n readonly method: string,\n readonly headers: Record<string, string>,\n readonly signal: AbortSignal,\n /** `manual` for a `full` response or a filter that follows redirects itself; else `follow`. */\n readonly redirect: 'manual' | 'follow',\n /** The exact serialized body; absent for a call with no argument. */\n readonly body?: string,\n ) {}\n}\n\n/**\n * A fetch-compatible function: the ONLY thing a generated client calls to put a request on the wire.\n * `globalThis.fetch` and Expo's `expo/fetch` (whose `FetchResponse` implements `Response`) both satisfy\n * it as-is. Any other native-backed transport does too, if it accepts these options and resolves a\n * `Response`-compatible object.\n */\nexport type HttpFetch = (url: string, init: HttpFetchInit) => Promise<Response>;\n\n/** Which runtime a {@link HttpClientRuntime} was built for; see its named constructors. */\nexport enum HttpRuntimeKind {\n /** Platform fetch + JS timers: standalone browsers, Node, SSR, workers, tests. */\n PLATFORM_DEFAULT = 'platform-default',\n /** The application declared a React Native JS runtime and supplied native-backed collaborators. */\n REACT_NATIVE = 'react-native',\n /** Page HTTP delegates through a declared mobile shell to its native adapter. */\n MOBILE_WEBVIEW = 'mobile-webview',\n}\n\n/**\n * The two runtime collaborators of ONE client factory (#1445): how a request reaches the network\n * ({@link HttpFetch}) and where its deadline's clock and wake-up come from ({@link DeadlineScheduler}).\n * Held per factory, never process-wide, so two factories in one app can use different transports and\n * nothing monkey-patches `globalThis.fetch` or the JS timers.\n *\n * - {@link HttpClientRuntime.platformDefaults} — standalone browser/Node/SSR/worker/test: platform fetch,\n * looked up on EVERY call (so a test's stubbed global is honoured), and standard JS timers.\n * - {@link HttpClientRuntime.reactNative} — the React Native JS runtime, whose default fetch and JS\n * timers can stop progressing while an Android phone is locked. The application passes a\n * native-backed fetch (e.g. `expo/fetch`) and a native-backed {@link DeadlineScheduler}; this call is\n * the explicit capability acknowledgement, because no runtime check can PROVE a function is\n * background-safe from its name or source text.\n */\nexport class HttpClientRuntime {\n private constructor(\n readonly kind: HttpRuntimeKind,\n readonly fetch: HttpFetch,\n readonly deadlines: DeadlineScheduler,\n readonly host?: MobileWebViewHost,\n ) {}\n\n // webpieces-disable no-function-outside-class -- named constructor of an immutable runtime value\n static platformDefaults(): HttpClientRuntime {\n return new HttpClientRuntime(\n HttpRuntimeKind.PLATFORM_DEFAULT,\n // webpieces-disable no-fetch -- this IS the generated-client implementation the rule points everyone to\n (url: string, init: HttpFetchInit): Promise<Response> => fetch(url, init),\n new TimerDeadlineScheduler(),\n );\n }\n\n /**\n * Declare the React Native JS runtime and its native-backed collaborators. Both are REQUIRED; a\n * caller that reaches here without one (plain JavaScript, or a value that was `undefined` at\n * runtime) is refused with the name of what is missing, before any client is built.\n */\n // webpieces-disable no-function-outside-class -- named constructor of an immutable runtime value\n static reactNative(fetch: HttpFetch, deadlines: DeadlineScheduler): HttpClientRuntime {\n const missing = HttpClientRuntime.missingCollaborators(fetch, deadlines);\n if (missing.length > 0) {\n throw new ReactNativeRuntimeConfigError(missing, 'HttpClientRuntime.reactNative(...)');\n }\n return new HttpClientRuntime(HttpRuntimeKind.REACT_NATIVE, fetch, deadlines);\n }\n\n /**\n * Declare the page's negotiated mobile host and native-backed adapter. No Expo import belongs\n * in this portable package or in page JS: fetch must cross IPC to native HTTP, not Expo's web\n * fallback. The native side owns resource deadlines even while page JavaScript is suspended.\n */\n // webpieces-disable no-function-outside-class -- named constructor of an immutable runtime value\n static mobileWebView(\n fetch: HttpFetch,\n deadlines: DeadlineScheduler,\n host: MobileWebViewHost,\n ): HttpClientRuntime {\n const missing = HttpClientRuntime.missingCollaborators(fetch, deadlines);\n if (!host) {\n missing.push('shell host capabilities');\n } else {\n missing.push(...MobileWebViewHost.missingCapabilities(host));\n }\n if (missing.length > 0) throw new MobileWebViewRuntimeConfigError(missing);\n return new HttpClientRuntime(\n HttpRuntimeKind.MOBILE_WEBVIEW,\n fetch,\n deadlines,\n Object.freeze(\n new MobileWebViewHost(\n host.kind,\n host.protocolVersion,\n host.documentId,\n host.sessionId,\n host.nativeHttp,\n host.nativeDeadlines,\n host.nativeCancellation,\n ),\n ),\n );\n }\n\n // webpieces-disable no-function-outside-class -- pure validation of the two collaborators\n private static missingCollaborators(\n fetch: HttpFetch | undefined,\n deadlines: DeadlineScheduler | undefined,\n ): string[] {\n const missing: string[] = [];\n if (typeof fetch !== 'function') missing.push('fetch');\n if (\n deadlines === undefined ||\n deadlines === null ||\n typeof deadlines.schedule !== 'function' ||\n typeof deadlines.now !== 'function'\n ) {\n missing.push('deadlines');\n }\n return missing;\n }\n}\n\n/**\n * A React Native client was configured without the native-backed collaborators it needs. Thrown when\n * the factory/runtime is CREATED — never on a request — so the misconfiguration surfaces at startup\n * instead of as a request that silently stalls while the phone is locked.\n */\nexport class ReactNativeRuntimeConfigError extends Error {\n /** The reproduction and setup rationale; every message links it. */\n static readonly SETUP_URL = 'https://github.com/deanhiller/webpieces-ts/issues/1463';\n\n constructor(\n /** The missing collaborator names: `fetch`, `deadlines`, or both. */\n readonly missing: string[],\n /** Where the problem was detected, for the message. */\n readonly site: string,\n ) {\n super(\n `${site}: Expo/native HTTP client required for React Native; missing: ` +\n `${missing.join(', ')}. React Native's default fetch and JS timers can stop while the ` +\n `device is locked. Pass HttpClientRuntime.reactNative(fetch, deadlines) — e.g. ` +\n `\\`import { fetch } from 'expo/fetch'\\` and a DeadlineScheduler backed by a native timer. ` +\n `Setup: ${ReactNativeRuntimeConfigError.SETUP_URL}`,\n );\n this.name = 'ReactNativeRuntimeConfigError';\n }\n}\n"]}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_util_1 = require("@webpieces/core-util");
4
4
  const HttpClientRuntime_1 = require("./HttpClientRuntime");
5
+ const MobileWebViewHost_1 = require("./MobileWebViewHost");
5
6
  /**
6
7
  * The shape of Expo SDK 55's `expo/fetch` (`build/winter/fetch/fetch.d.ts` + `fetch.types.d.ts`),
7
8
  * restated locally because this package must never depend on Expo:
@@ -39,6 +40,16 @@ class HttpClientRuntimeCompileAssertions {
39
40
  // @ts-expect-error the runtime is built by platformDefaults() / reactNative(...), never `new`
40
41
  void new HttpClientRuntime_1.HttpClientRuntime();
41
42
  }
43
+ webViewRequiresNegotiatedNativeCapabilities() {
44
+ const host = new MobileWebViewHost_1.MobileWebViewHost('expo-webview', 1, 'document', 'session', true, true, true);
45
+ void HttpClientRuntime_1.HttpClientRuntime.mobileWebView(expoShapedFetch, nativeDeadlines, host);
46
+ // @ts-expect-error a WebView runtime requires a shell acknowledgement
47
+ void HttpClientRuntime_1.HttpClientRuntime.mobileWebView(expoShapedFetch, nativeDeadlines);
48
+ // @ts-expect-error unsupported bootstrap versions must be negotiated before client construction
49
+ void new MobileWebViewHost_1.MobileWebViewHost('expo-webview', 2, 'document', 'session', true, true, true);
50
+ // @ts-expect-error native deadlines cannot be omitted/disabled in a declared mobile host
51
+ void new MobileWebViewHost_1.MobileWebViewHost('expo-webview', 1, 'document', 'session', true, false, true);
52
+ }
42
53
  }
43
54
  void HttpClientRuntimeCompileAssertions;
44
55
  //# sourceMappingURL=HttpClientRuntimeCompileAssertions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HttpClientRuntimeCompileAssertions.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/src/HttpClientRuntimeCompileAssertions.ts"],"names":[],"mappings":";;AAAA,oDAAiF;AACjF,2DAAmE;AAEnE;;;;;GAKG;AACH,MAAM,cAAc;IAChB,IAAI,CAA8B;IAClC,WAAW,CAAsC;IACjD,OAAO,CAA+C;IACtD,MAAM,CAAU;IAChB,MAAM,CAAsB;IAC5B,QAAQ,CAAiC;IACzC,SAAS,CAAW;IACpB,SAAS,CAAU;IACnB,QAAQ,CAAU;CACrB;AACD,MAAM,kBAAmB,SAAQ,QAAQ;CAAG;AAO5C;;;;GAIG;AACH,MAAM,kCAAkC;IACpC,8BAA8B;QAC1B,MAAM,QAAQ,GAAc,KAAK,CAAC;QAClC,MAAM,IAAI,GAAc,eAAe,CAAC;QACxC,KAAK,qCAAiB,CAAC,WAAW,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAC1D,KAAK,qCAAiB,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,kCAAsB,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED,iCAAiC;QAC7B,sFAAsF;QACtF,KAAK,qCAAiB,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;QACpD,8FAA8F;QAC9F,KAAK,IAAI,qCAAiB,EAAE,CAAC;IACjC,CAAC;CACJ;AACD,KAAK,kCAAkC,CAAC","sourcesContent":["import { DeadlineScheduler, TimerDeadlineScheduler } from '@webpieces/core-util';\nimport { HttpClientRuntime, HttpFetch } from './HttpClientRuntime';\n\n/**\n * The shape of Expo SDK 55's `expo/fetch` (`build/winter/fetch/fetch.d.ts` + `fetch.types.d.ts`),\n * restated locally because this package must never depend on Expo:\n * `fetch(input: string | URL | FetchRequestLike, init?: FetchRequestInit): Promise<FetchResponse>`,\n * where `FetchResponse implements Response`.\n */\nclass ExpoShapedInit {\n body?: string | Uint8Array | null;\n credentials?: 'include' | 'omit' | 'same-origin';\n headers?: Record<string, string> | [string, string][];\n method?: string;\n signal?: AbortSignal | null;\n redirect?: 'error' | 'follow' | 'manual';\n keepalive?: boolean;\n integrity?: string;\n referrer?: string;\n}\nclass ExpoShapedResponse extends Response {}\ndeclare const expoShapedFetch: (\n input: string | URL,\n init?: ExpoShapedInit,\n) => Promise<ExpoShapedResponse>;\ndeclare const nativeDeadlines: DeadlineScheduler;\n\n/**\n * Compiled by tsc (spec files are not), never executed. Pins that the platform fetch and Expo's\n * `expo/fetch` are BOTH an {@link HttpFetch} with no cast (#1445), and that a React Native runtime\n * cannot be declared without both collaborators. tsc fails with TS2578 if a bad case ever compiles.\n */\nclass HttpClientRuntimeCompileAssertions {\n platformAndExpoFetchNeedNoCast(): void {\n const platform: HttpFetch = fetch;\n const expo: HttpFetch = expoShapedFetch;\n void HttpClientRuntime.reactNative(expo, nativeDeadlines);\n void HttpClientRuntime.reactNative(platform, new TimerDeadlineScheduler());\n }\n\n reactNativeNeedsBothCollaborators(): void {\n // @ts-expect-error a React Native runtime needs a native-backed DeadlineScheduler too\n void HttpClientRuntime.reactNative(expoShapedFetch);\n // @ts-expect-error the runtime is built by platformDefaults() / reactNative(...), never `new`\n void new HttpClientRuntime();\n }\n}\nvoid HttpClientRuntimeCompileAssertions;\n"]}
1
+ {"version":3,"file":"HttpClientRuntimeCompileAssertions.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/src/HttpClientRuntimeCompileAssertions.ts"],"names":[],"mappings":";;AAAA,oDAAiF;AACjF,2DAAmE;AACnE,2DAAwD;AAExD;;;;;GAKG;AACH,MAAM,cAAc;IAChB,IAAI,CAA8B;IAClC,WAAW,CAAsC;IACjD,OAAO,CAA+C;IACtD,MAAM,CAAU;IAChB,MAAM,CAAsB;IAC5B,QAAQ,CAAiC;IACzC,SAAS,CAAW;IACpB,SAAS,CAAU;IACnB,QAAQ,CAAU;CACrB;AACD,MAAM,kBAAmB,SAAQ,QAAQ;CAAG;AAO5C;;;;GAIG;AACH,MAAM,kCAAkC;IACpC,8BAA8B;QAC1B,MAAM,QAAQ,GAAc,KAAK,CAAC;QAClC,MAAM,IAAI,GAAc,eAAe,CAAC;QACxC,KAAK,qCAAiB,CAAC,WAAW,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAC1D,KAAK,qCAAiB,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,kCAAsB,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED,iCAAiC;QAC7B,sFAAsF;QACtF,KAAK,qCAAiB,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;QACpD,8FAA8F;QAC9F,KAAK,IAAI,qCAAiB,EAAE,CAAC;IACjC,CAAC;IAED,2CAA2C;QACvC,MAAM,IAAI,GAAG,IAAI,qCAAiB,CAC9B,cAAc,EACd,CAAC,EACD,UAAU,EACV,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,IAAI,CACP,CAAC;QACF,KAAK,qCAAiB,CAAC,aAAa,CAAC,eAAe,EAAE,eAAe,EAAE,IAAI,CAAC,CAAC;QAC7E,sEAAsE;QACtE,KAAK,qCAAiB,CAAC,aAAa,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;QACvE,gGAAgG;QAChG,KAAK,IAAI,qCAAiB,CAAC,cAAc,EAAE,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACvF,yFAAyF;QACzF,KAAK,IAAI,qCAAiB,CAAC,cAAc,EAAE,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IAC5F,CAAC;CACJ;AACD,KAAK,kCAAkC,CAAC","sourcesContent":["import { DeadlineScheduler, TimerDeadlineScheduler } from '@webpieces/core-util';\nimport { HttpClientRuntime, HttpFetch } from './HttpClientRuntime';\nimport { MobileWebViewHost } from './MobileWebViewHost';\n\n/**\n * The shape of Expo SDK 55's `expo/fetch` (`build/winter/fetch/fetch.d.ts` + `fetch.types.d.ts`),\n * restated locally because this package must never depend on Expo:\n * `fetch(input: string | URL | FetchRequestLike, init?: FetchRequestInit): Promise<FetchResponse>`,\n * where `FetchResponse implements Response`.\n */\nclass ExpoShapedInit {\n body?: string | Uint8Array | null;\n credentials?: 'include' | 'omit' | 'same-origin';\n headers?: Record<string, string> | [string, string][];\n method?: string;\n signal?: AbortSignal | null;\n redirect?: 'error' | 'follow' | 'manual';\n keepalive?: boolean;\n integrity?: string;\n referrer?: string;\n}\nclass ExpoShapedResponse extends Response {}\ndeclare const expoShapedFetch: (\n input: string | URL,\n init?: ExpoShapedInit,\n) => Promise<ExpoShapedResponse>;\ndeclare const nativeDeadlines: DeadlineScheduler;\n\n/**\n * Compiled by tsc (spec files are not), never executed. Pins that the platform fetch and Expo's\n * `expo/fetch` are BOTH an {@link HttpFetch} with no cast (#1445), and that a React Native runtime\n * cannot be declared without both collaborators. tsc fails with TS2578 if a bad case ever compiles.\n */\nclass HttpClientRuntimeCompileAssertions {\n platformAndExpoFetchNeedNoCast(): void {\n const platform: HttpFetch = fetch;\n const expo: HttpFetch = expoShapedFetch;\n void HttpClientRuntime.reactNative(expo, nativeDeadlines);\n void HttpClientRuntime.reactNative(platform, new TimerDeadlineScheduler());\n }\n\n reactNativeNeedsBothCollaborators(): void {\n // @ts-expect-error a React Native runtime needs a native-backed DeadlineScheduler too\n void HttpClientRuntime.reactNative(expoShapedFetch);\n // @ts-expect-error the runtime is built by platformDefaults() / reactNative(...), never `new`\n void new HttpClientRuntime();\n }\n\n webViewRequiresNegotiatedNativeCapabilities(): void {\n const host = new MobileWebViewHost(\n 'expo-webview',\n 1,\n 'document',\n 'session',\n true,\n true,\n true,\n );\n void HttpClientRuntime.mobileWebView(expoShapedFetch, nativeDeadlines, host);\n // @ts-expect-error a WebView runtime requires a shell acknowledgement\n void HttpClientRuntime.mobileWebView(expoShapedFetch, nativeDeadlines);\n // @ts-expect-error unsupported bootstrap versions must be negotiated before client construction\n void new MobileWebViewHost('expo-webview', 2, 'document', 'session', true, true, true);\n // @ts-expect-error native deadlines cannot be omitted/disabled in a declared mobile host\n void new MobileWebViewHost('expo-webview', 1, 'document', 'session', true, false, true);\n }\n}\nvoid HttpClientRuntimeCompileAssertions;\n"]}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * A shell's serialized bootstrap acknowledgement, supplied before constructing HTTP clients.
3
+ * This is configuration, not authentication or proof that a function runs natively. The adapter
4
+ * must bind this identity to its native session and enforce it on every request and reply.
5
+ */
6
+ export declare class MobileWebViewHost {
7
+ readonly kind: 'expo-webview' | 'react-native-webview';
8
+ readonly protocolVersion: 1;
9
+ readonly documentId: string;
10
+ readonly sessionId: string;
11
+ readonly nativeHttp: true;
12
+ readonly nativeDeadlines: true;
13
+ readonly nativeCancellation: true;
14
+ constructor(kind: 'expo-webview' | 'react-native-webview', protocolVersion: 1, documentId: string, sessionId: string, nativeHttp: true, nativeDeadlines: true, nativeCancellation: true);
15
+ /** Validate plain JavaScript / deserialized bootstrap data as well as typed callers. */
16
+ static missingCapabilities(host: MobileWebViewHost): string[];
17
+ }
18
+ /** A mobile shell has not negotiated the native HTTP implementation required by #1463. */
19
+ export declare class MobileWebViewRuntimeConfigError extends Error {
20
+ readonly missing: readonly string[];
21
+ static readonly ISSUE_URL = "https://github.com/deanhiller/webpieces-ts/issues/1463";
22
+ constructor(missing: readonly string[]);
23
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MobileWebViewRuntimeConfigError = exports.MobileWebViewHost = void 0;
4
+ /**
5
+ * A shell's serialized bootstrap acknowledgement, supplied before constructing HTTP clients.
6
+ * This is configuration, not authentication or proof that a function runs natively. The adapter
7
+ * must bind this identity to its native session and enforce it on every request and reply.
8
+ */
9
+ class MobileWebViewHost {
10
+ kind;
11
+ protocolVersion;
12
+ documentId;
13
+ sessionId;
14
+ nativeHttp;
15
+ nativeDeadlines;
16
+ nativeCancellation;
17
+ constructor(kind, protocolVersion, documentId, sessionId, nativeHttp, nativeDeadlines, nativeCancellation) {
18
+ this.kind = kind;
19
+ this.protocolVersion = protocolVersion;
20
+ this.documentId = documentId;
21
+ this.sessionId = sessionId;
22
+ this.nativeHttp = nativeHttp;
23
+ this.nativeDeadlines = nativeDeadlines;
24
+ this.nativeCancellation = nativeCancellation;
25
+ }
26
+ /** Validate plain JavaScript / deserialized bootstrap data as well as typed callers. */
27
+ // webpieces-disable no-function-outside-class -- validate the serialized bootstrap contract
28
+ static missingCapabilities(host) {
29
+ const missing = [];
30
+ if (host.kind !== 'expo-webview' && host.kind !== 'react-native-webview')
31
+ missing.push('host kind');
32
+ if (host.protocolVersion !== 1)
33
+ missing.push('protocolVersion=1');
34
+ if (typeof host.documentId !== 'string' || !host.documentId.trim())
35
+ missing.push('documentId');
36
+ if (typeof host.sessionId !== 'string' || !host.sessionId.trim())
37
+ missing.push('sessionId');
38
+ if (host.nativeHttp !== true)
39
+ missing.push('nativeHttp');
40
+ if (host.nativeDeadlines !== true)
41
+ missing.push('nativeDeadlines');
42
+ if (host.nativeCancellation !== true)
43
+ missing.push('nativeCancellation');
44
+ return missing;
45
+ }
46
+ }
47
+ exports.MobileWebViewHost = MobileWebViewHost;
48
+ /** A mobile shell has not negotiated the native HTTP implementation required by #1463. */
49
+ class MobileWebViewRuntimeConfigError extends Error {
50
+ missing;
51
+ static ISSUE_URL = 'https://github.com/deanhiller/webpieces-ts/issues/1463';
52
+ constructor(missing) {
53
+ super('Expo/native HTTP client required for a React Native WebView: ' +
54
+ `missing or incompatible: ${missing.join(', ')}. ` +
55
+ 'Complete shell bootstrap, then pass HttpClientRuntime.mobileWebView(fetch, deadlines, host) ' +
56
+ 'with native-backed HTTP, end-to-end deadlines and cancellation. Browser fetch/timers can ' +
57
+ `stall while locked. Reason: ${MobileWebViewRuntimeConfigError.ISSUE_URL}`);
58
+ this.missing = missing;
59
+ this.name = 'MobileWebViewRuntimeConfigError';
60
+ }
61
+ }
62
+ exports.MobileWebViewRuntimeConfigError = MobileWebViewRuntimeConfigError;
63
+ //# sourceMappingURL=MobileWebViewHost.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MobileWebViewHost.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/src/MobileWebViewHost.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,MAAa,iBAAiB;IAEb;IACA;IACA;IACA;IACA;IACA;IACA;IAPb,YACa,IAA6C,EAC7C,eAAkB,EAClB,UAAkB,EAClB,SAAiB,EACjB,UAAgB,EAChB,eAAqB,EACrB,kBAAwB;QANxB,SAAI,GAAJ,IAAI,CAAyC;QAC7C,oBAAe,GAAf,eAAe,CAAG;QAClB,eAAU,GAAV,UAAU,CAAQ;QAClB,cAAS,GAAT,SAAS,CAAQ;QACjB,eAAU,GAAV,UAAU,CAAM;QAChB,oBAAe,GAAf,eAAe,CAAM;QACrB,uBAAkB,GAAlB,kBAAkB,CAAM;IAClC,CAAC;IAEJ,wFAAwF;IACxF,4FAA4F;IAC5F,MAAM,CAAC,mBAAmB,CAAC,IAAuB;QAC9C,MAAM,OAAO,GAAa,EAAE,CAAC;QAC7B,IAAI,IA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","sourcesContent":["/**\n * A shell's serialized bootstrap acknowledgement, supplied before constructing HTTP clients.\n * This is configuration, not authentication or proof that a function runs natively. The adapter\n * must bind this identity to its native session and enforce it on every request and reply.\n */\nexport class MobileWebViewHost {\n constructor(\n readonly kind: 'expo-webview' | 'react-native-webview',\n readonly protocolVersion: 1,\n readonly documentId: string,\n readonly sessionId: string,\n readonly nativeHttp: true,\n readonly nativeDeadlines: true,\n readonly nativeCancellation: true,\n ) {}\n\n /** Validate plain JavaScript / deserialized bootstrap data as well as typed callers. */\n // webpieces-disable no-function-outside-class -- validate the serialized bootstrap contract\n static missingCapabilities(host: MobileWebViewHost): string[] {\n const missing: string[] = [];\n if (host.kind !== 'expo-webview' && host.kind !== 'react-native-webview')\n missing.push('host kind');\n if (host.protocolVersion !== 1) missing.push('protocolVersion=1');\n if (typeof host.documentId !== 'string' || !host.documentId.trim())\n missing.push('documentId');\n if (typeof host.sessionId !== 'string' || !host.sessionId.trim()) missing.push('sessionId');\n if (host.nativeHttp !== true) missing.push('nativeHttp');\n if (host.nativeDeadlines !== true) missing.push('nativeDeadlines');\n if (host.nativeCancellation !== true) missing.push('nativeCancellation');\n return missing;\n }\n}\n\n/** A mobile shell has not negotiated the native HTTP implementation required by #1463. */\nexport class MobileWebViewRuntimeConfigError extends Error {\n static readonly ISSUE_URL = 'https://github.com/deanhiller/webpieces-ts/issues/1463';\n\n constructor(readonly missing: readonly string[]) {\n super(\n 'Expo/native HTTP client required for a React Native WebView: ' +\n `missing or incompatible: ${missing.join(', ')}. ` +\n 'Complete shell bootstrap, then pass HttpClientRuntime.mobileWebView(fetch, deadlines, host) ' +\n 'with native-backed HTTP, end-to-end deadlines and cancellation. Browser fetch/timers can ' +\n `stall while locked. Reason: ${MobileWebViewRuntimeConfigError.ISSUE_URL}`,\n );\n this.name = 'MobileWebViewRuntimeConfigError';\n }\n}\n"]}
package/src/index.d.ts CHANGED
@@ -36,6 +36,7 @@ export { ClientRequest } from './ClientRequest';
36
36
  export type { HttpTransport } from './HttpTransport';
37
37
  export { HttpClientRuntime, HttpFetchInit, HttpRuntimeKind, ReactNativeRuntimeConfigError, } from './HttpClientRuntime';
38
38
  export type { HttpFetch } from './HttpClientRuntime';
39
+ export { MobileWebViewHost, MobileWebViewRuntimeConfigError } from './MobileWebViewHost';
39
40
  export { ClientFilterDefinition } from './ClientFilter';
40
41
  export type { ClientFilter } from './ClientFilter';
41
42
  export { SseEvent, SseEventParser } from './SseEventParser';
package/src/index.js CHANGED
@@ -26,7 +26,7 @@
26
26
  * a browser bundle, and nothing browser-only (a ContextReader store) reaches a server.
27
27
  */
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.WiringPolicy = exports.WiringOrder = exports.WiringModules = exports.Utf8Codec = exports.StreamingCapabilityError = exports.SseEventParser = exports.SseEvent = exports.ClientFilterDefinition = exports.ReactNativeRuntimeConfigError = exports.HttpRuntimeKind = exports.HttpFetchInit = exports.HttpClientRuntime = exports.ClientRequest = exports.ResponseBodyReader = exports.RequestBodySerializer = exports.HttpResponseDtoFactory = exports.ClientErrorTranslator = exports.buildClientProxy = exports.RequestOutcome = exports.ProxyClient = void 0;
29
+ exports.WiringPolicy = exports.WiringOrder = exports.WiringModules = exports.Utf8Codec = exports.StreamingCapabilityError = exports.SseEventParser = exports.SseEvent = exports.ClientFilterDefinition = exports.MobileWebViewRuntimeConfigError = exports.MobileWebViewHost = exports.ReactNativeRuntimeConfigError = exports.HttpRuntimeKind = exports.HttpFetchInit = exports.HttpClientRuntime = exports.ClientRequest = exports.ResponseBodyReader = exports.RequestBodySerializer = exports.HttpResponseDtoFactory = exports.ClientErrorTranslator = exports.buildClientProxy = exports.RequestOutcome = exports.ProxyClient = void 0;
30
30
  var ProxyClient_1 = require("./ProxyClient");
31
31
  Object.defineProperty(exports, "ProxyClient", { enumerable: true, get: function () { return ProxyClient_1.ProxyClient; } });
32
32
  var RequestOutcome_1 = require("./RequestOutcome");
@@ -54,6 +54,9 @@ Object.defineProperty(exports, "HttpClientRuntime", { enumerable: true, get: fun
54
54
  Object.defineProperty(exports, "HttpFetchInit", { enumerable: true, get: function () { return HttpClientRuntime_1.HttpFetchInit; } });
55
55
  Object.defineProperty(exports, "HttpRuntimeKind", { enumerable: true, get: function () { return HttpClientRuntime_1.HttpRuntimeKind; } });
56
56
  Object.defineProperty(exports, "ReactNativeRuntimeConfigError", { enumerable: true, get: function () { return HttpClientRuntime_1.ReactNativeRuntimeConfigError; } });
57
+ var MobileWebViewHost_1 = require("./MobileWebViewHost");
58
+ Object.defineProperty(exports, "MobileWebViewHost", { enumerable: true, get: function () { return MobileWebViewHost_1.MobileWebViewHost; } });
59
+ Object.defineProperty(exports, "MobileWebViewRuntimeConfigError", { enumerable: true, get: function () { return MobileWebViewHost_1.MobileWebViewRuntimeConfigError; } });
57
60
  var ClientFilter_1 = require("./ClientFilter");
58
61
  Object.defineProperty(exports, "ClientFilterDefinition", { enumerable: true, get: function () { return ClientFilter_1.ClientFilterDefinition; } });
59
62
  // Generic streaming wire adapters: NDJSON uploads, request-scoped SSE downloads, and a typed
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAEH,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AAEvB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,gGAAgG;AAChG,iFAAiF;AACjF,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,kGAAkG;AAClG,kFAAkF;AAClF,gEAAgE;AAChE,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AAEtB,qGAAqG;AACrG,yDAK6B;AAJzB,sHAAA,iBAAiB,OAAA;AACjB,kHAAA,aAAa,OAAA;AACb,oHAAA,eAAe,OAAA;AACf,kIAAA,6BAA6B,OAAA;AAGjC,+CAAwD;AAA/C,sHAAA,sBAAsB,OAAA;AAE/B,6FAA6F;AAC7F,+FAA+F;AAC/F,mDAA4D;AAAnD,0GAAA,QAAQ,OAAA;AAAE,gHAAA,cAAc,OAAA;AACjC,uEAAsE;AAA7D,oIAAA,wBAAwB,OAAA;AACjC,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAIlB,mCAAsD;AAA7C,uGAAA,aAAa,OAAA;AAAE,qGAAA,WAAW,OAAA;AACnC,+CAA8C;AAArC,4GAAA,YAAY,OAAA","sourcesContent":["/**\n * @webpieces/http-client-core\n *\n * The ISOMORPHIC core of the webpieces HTTP client — everything that reads an API contract's\n * decorators and turns a method call into an HTTP request, with no opinion about where the\n * magic context comes from or whether a DI container exists.\n *\n * You almost certainly want one of its two environment packages instead:\n * - Server: @webpieces/http-client-node (inversify-wired, reads RequestContext, mints OIDC)\n * - Browser: @webpieces/http-client-browser (no DI — React or Angular, app-managed context store)\n *\n * Architecture:\n * ```\n * http-api (defines the contract)\n * ^\n * +-- http-routing (server: contract -> handlers)\n * +-- http-client-core (contract -> HTTP requests) <- YOU ARE HERE\n * +-- http-client-node (RequestContext + Secrets + OIDC + inversify factory)\n * +-- http-client-browser (app-held store + plain factory, no DI)\n * ```\n *\n * There is no context/credential/recording seam here at all: ProxyClient is ABSTRACT and asks its\n * subclass for the base URL, the context headers, the log map, the outbound credential, and the\n * recorder. Nothing server-only (RequestContext, Secrets, mintIdToken, TestCaseRecorder) can reach\n * a browser bundle, and nothing browser-only (a ContextReader store) reaches a server.\n */\n\nexport { ProxyClient } from './ProxyClient';\nexport { RequestOutcome } from './RequestOutcome';\nexport type { ApiPrototype } from './ApiPrototype';\nexport { buildClientProxy } from './buildClientProxy';\nexport { ClientErrorTranslator } from './ClientErrorTranslator';\n// The CLIENT-side transport boundary: a fetch Response becomes the ONE HttpResponseDto an app's\n// ErrorTranslator sees, so node and browser hand `fromWire` the identical shape.\nexport { HttpResponseDtoFactory } from './HttpResponseDtoFactory';\nexport { RequestBodySerializer } from './RequestBodySerializer';\nexport { ResponseBodyReader } from './ResponseBodyReader';\n// The OUTBOUND filter chain: the mutable request a filter edits, and one registration of a filter\n// at a priority. The `Filter`/`Service`/`FilterChain` abstraction itself lives in\n// @webpieces/core-util, shared with the server's inbound chain.\nexport { ClientRequest } from './ClientRequest';\nexport type { HttpTransport } from './HttpTransport';\n// #1445: the per-factory runtime — the fetch a client sends through and the clock its deadlines use.\nexport {\n HttpClientRuntime,\n HttpFetchInit,\n HttpRuntimeKind,\n ReactNativeRuntimeConfigError,\n} from './HttpClientRuntime';\nexport type { HttpFetch } from './HttpClientRuntime';\nexport { ClientFilterDefinition } from './ClientFilter';\nexport type { ClientFilter } from './ClientFilter';\n// Generic streaming wire adapters: NDJSON uploads, request-scoped SSE downloads, and a typed\n// capability failure for runtimes that cannot safely keep both fetch halves open concurrently.\nexport { SseEvent, SseEventParser } from './SseEventParser';\nexport { StreamingCapabilityError } from './StreamingCapabilityError';\nexport { Utf8Codec } from './Utf8Codec';\nexport type { ByteReadableStream, ByteStreamReader, ByteReadResult } from './ByteStream';\n\nexport type { BindModule, Wiring, AppWiring } from './Wiring';\nexport { WiringModules, WiringOrder } from './Wiring';\nexport { WiringPolicy } from './WiringPolicy';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAEH,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AAEvB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,gGAAgG;AAChG,iFAAiF;AACjF,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,kGAAkG;AAClG,kFAAkF;AAClF,gEAAgE;AAChE,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AAEtB,qGAAqG;AACrG,yDAK6B;AAJzB,sHAAA,iBAAiB,OAAA;AACjB,kHAAA,aAAa,OAAA;AACb,oHAAA,eAAe,OAAA;AACf,kIAAA,6BAA6B,OAAA;AAGjC,yDAAyF;AAAhF,sHAAA,iBAAiB,OAAA;AAAE,oIAAA,+BAA+B,OAAA;AAC3D,+CAAwD;AAA/C,sHAAA,sBAAsB,OAAA;AAE/B,6FAA6F;AAC7F,+FAA+F;AAC/F,mDAA4D;AAAnD,0GAAA,QAAQ,OAAA;AAAE,gHAAA,cAAc,OAAA;AACjC,uEAAsE;AAA7D,oIAAA,wBAAwB,OAAA;AACjC,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAIlB,mCAAsD;AAA7C,uGAAA,aAAa,OAAA;AAAE,qGAAA,WAAW,OAAA;AACnC,+CAA8C;AAArC,4GAAA,YAAY,OAAA","sourcesContent":["/**\n * @webpieces/http-client-core\n *\n * The ISOMORPHIC core of the webpieces HTTP client — everything that reads an API contract's\n * decorators and turns a method call into an HTTP request, with no opinion about where the\n * magic context comes from or whether a DI container exists.\n *\n * You almost certainly want one of its two environment packages instead:\n * - Server: @webpieces/http-client-node (inversify-wired, reads RequestContext, mints OIDC)\n * - Browser: @webpieces/http-client-browser (no DI — React or Angular, app-managed context store)\n *\n * Architecture:\n * ```\n * http-api (defines the contract)\n * ^\n * +-- http-routing (server: contract -> handlers)\n * +-- http-client-core (contract -> HTTP requests) <- YOU ARE HERE\n * +-- http-client-node (RequestContext + Secrets + OIDC + inversify factory)\n * +-- http-client-browser (app-held store + plain factory, no DI)\n * ```\n *\n * There is no context/credential/recording seam here at all: ProxyClient is ABSTRACT and asks its\n * subclass for the base URL, the context headers, the log map, the outbound credential, and the\n * recorder. Nothing server-only (RequestContext, Secrets, mintIdToken, TestCaseRecorder) can reach\n * a browser bundle, and nothing browser-only (a ContextReader store) reaches a server.\n */\n\nexport { ProxyClient } from './ProxyClient';\nexport { RequestOutcome } from './RequestOutcome';\nexport type { ApiPrototype } from './ApiPrototype';\nexport { buildClientProxy } from './buildClientProxy';\nexport { ClientErrorTranslator } from './ClientErrorTranslator';\n// The CLIENT-side transport boundary: a fetch Response becomes the ONE HttpResponseDto an app's\n// ErrorTranslator sees, so node and browser hand `fromWire` the identical shape.\nexport { HttpResponseDtoFactory } from './HttpResponseDtoFactory';\nexport { RequestBodySerializer } from './RequestBodySerializer';\nexport { ResponseBodyReader } from './ResponseBodyReader';\n// The OUTBOUND filter chain: the mutable request a filter edits, and one registration of a filter\n// at a priority. The `Filter`/`Service`/`FilterChain` abstraction itself lives in\n// @webpieces/core-util, shared with the server's inbound chain.\nexport { ClientRequest } from './ClientRequest';\nexport type { HttpTransport } from './HttpTransport';\n// #1445: the per-factory runtime — the fetch a client sends through and the clock its deadlines use.\nexport {\n HttpClientRuntime,\n HttpFetchInit,\n HttpRuntimeKind,\n ReactNativeRuntimeConfigError,\n} from './HttpClientRuntime';\nexport type { HttpFetch } from './HttpClientRuntime';\nexport { MobileWebViewHost, MobileWebViewRuntimeConfigError } from './MobileWebViewHost';\nexport { ClientFilterDefinition } from './ClientFilter';\nexport type { ClientFilter } from './ClientFilter';\n// Generic streaming wire adapters: NDJSON uploads, request-scoped SSE downloads, and a typed\n// capability failure for runtimes that cannot safely keep both fetch halves open concurrently.\nexport { SseEvent, SseEventParser } from './SseEventParser';\nexport { StreamingCapabilityError } from './StreamingCapabilityError';\nexport { Utf8Codec } from './Utf8Codec';\nexport type { ByteReadableStream, ByteStreamReader, ByteReadResult } from './ByteStream';\n\nexport type { BindModule, Wiring, AppWiring } from './Wiring';\nexport { WiringModules, WiringOrder } from './Wiring';\nexport { WiringPolicy } from './WiringPolicy';\n"]}