@webpieces/http-client-browser 0.3.380 → 0.3.381

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-browser",
3
- "version": "0.3.380",
3
+ "version": "0.3.381",
4
4
  "description": "Browser HTTP client for webpieces: DI-free (React or Angular), app-managed context store, no AsyncLocalStorage",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -22,7 +22,7 @@
22
22
  "access": "public"
23
23
  },
24
24
  "dependencies": {
25
- "@webpieces/core-util": "0.3.380",
26
- "@webpieces/http-client-core": "0.3.380"
25
+ "@webpieces/core-util": "0.3.381",
26
+ "@webpieces/http-client-core": "0.3.381"
27
27
  }
28
28
  }
@@ -17,6 +17,17 @@ export declare class BrowserProxyClient extends ProxyClient {
17
17
  constructor(contextMgr: ContextMgr);
18
18
  /** Bind this client to one API contract + base URL. */
19
19
  init(apiPrototype: ApiPrototype<object>, config: ClientConfig): void;
20
+ /**
21
+ * The same chain every client runs — a ClientRegistry mapping, else the installed deriver — but
22
+ * with the BROWSER's fallback: `''`, which makes the URL RELATIVE (`/auth/oauth`) and therefore
23
+ * same-origin, by definition. A browser app almost always calls the backend that served it, so
24
+ * that is the default, and an unregistered svcName must NEVER throw the way it used to — a
25
+ * forgotten registration silently killed sign-in, the request never leaving the page.
26
+ *
27
+ * A mapping still wins, which is exactly how an Angular dev server on :4201 reaches its backend
28
+ * on :8201, while the same bundle served BY that backend in prod registers nothing and goes
29
+ * relative. No `window` access, so this stays SSR-safe and testable.
30
+ */
20
31
  protected resolveBaseUrl(): Promise<string>;
21
32
  protected outboundHeaders(): Map<string, string>;
22
33
  /**
@@ -25,10 +25,19 @@ class BrowserProxyClient extends http_client_core_1.ProxyClient {
25
25
  this.config = config;
26
26
  this.initRoutes(apiPrototype);
27
27
  }
28
- resolveBaseUrl() {
29
- // A browser cannot derive a GCP URL, so it resolves purely via the registry, which the app
30
- // populates at startup (per environment). lookup() throws if the svcName was not registered.
31
- return Promise.resolve(core_util_1.ClientRegistry.lookup(this.config.svcName));
28
+ /**
29
+ * The same chain every client runs a ClientRegistry mapping, else the installed deriver but
30
+ * with the BROWSER's fallback: `''`, which makes the URL RELATIVE (`/auth/oauth`) and therefore
31
+ * same-origin, by definition. A browser app almost always calls the backend that served it, so
32
+ * that is the default, and an unregistered svcName must NEVER throw the way it used to — a
33
+ * forgotten registration silently killed sign-in, the request never leaving the page.
34
+ *
35
+ * A mapping still wins, which is exactly how an Angular dev server on :4201 reaches its backend
36
+ * on :8201, while the same bundle served BY that backend in prod registers nothing and goes
37
+ * relative. No `window` access, so this stays SSR-safe and testable.
38
+ */
39
+ async resolveBaseUrl() {
40
+ return (await core_util_1.ClientRegistry.tryResolve(this.config.svcName)) ?? '';
32
41
  }
33
42
  outboundHeaders() {
34
43
  return this.contextMgr.buildOutboundHeaders();
@@ -1 +1 @@
1
- {"version":3,"file":"BrowserProxyClient.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/BrowserProxyClient.ts"],"names":[],"mappings":";;;AAAA,oDAA4E;AAC5E,kEAAwE;AAGxE;;;;;;;;;GASG;AACH,MAAa,kBAAmB,SAAQ,8BAAW;IAGlB;IAFrB,MAAM,CAAgB;IAE9B,YAA6B,UAAsB;QAC/C,KAAK,EAAE,CAAC;QADiB,eAAU,GAAV,UAAU,CAAY;IAEnD,CAAC;IAED,uDAAuD;IACvD,IAAI,CAAC,YAAkC,EAAE,MAAoB;QACzD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;IAEkB,cAAc;QAC7B,2FAA2F;QAC3F,6FAA6F;QAC7F,OAAO,OAAO,CAAC,OAAO,CAAC,0BAAc,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IACvE,CAAC;IAEkB,eAAe;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACgB,uBAAuB,CAAC,QAA8B,EAAE,UAAkB;QACzF,MAAM,IAAI,GAAG,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC;QACjC,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;YAC9C,OAAO;QACX,CAAC;QACD,MAAM,IAAI,KAAK,CACX,YAAY,UAAU,QAAQ,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,kBAAkB,sBAAsB;YACrG,wGAAwG,CAC3G,CAAC;IACN,CAAC;CACJ;AAtCD,gDAsCC","sourcesContent":["import { AuthMeta, ContextMgr, ClientRegistry } from '@webpieces/core-util';\nimport { ApiPrototype, ProxyClient } from '@webpieces/http-client-core';\nimport { ClientConfig } from './ClientConfig';\n\n/**\n * The browser {@link ProxyClient}. Reads context from the app-held store (via {@link ContextMgr}),\n * because a browser has no ambient request scope.\n *\n * It attaches NO outbound credential and does NO recording — both inherit the base's no-ops. A\n * browser cannot mint an OIDC token and must never hold a shared secret; the user's JWT travels as\n * an ordinary transferred context key, set on the store at login.\n *\n * This is the ONLY class in webpieces that names ContextMgr.\n */\nexport class BrowserProxyClient extends ProxyClient {\n private config!: ClientConfig;\n\n constructor(private readonly contextMgr: ContextMgr) {\n super();\n }\n\n /** Bind this client to one API contract + base URL. */\n init(apiPrototype: ApiPrototype<object>, config: ClientConfig): void {\n this.config = config;\n this.initRoutes(apiPrototype);\n }\n\n protected override resolveBaseUrl(): Promise<string> {\n // A browser cannot derive a GCP URL, so it resolves purely via the registry, which the app\n // populates at startup (per environment). lookup() throws if the svcName was not registered.\n return Promise.resolve(ClientRegistry.lookup(this.config.svcName));\n }\n\n protected override outboundHeaders(): Map<string, string> {\n return this.contextMgr.buildOutboundHeaders();\n }\n\n /**\n * Reject a contract this browser cannot satisfy, at bind time rather than on the first call.\n * Both service-to-service modes need credentials only a server has: @AuthOidc needs a runtime\n * service account to mint a token, @AuthSharedSecret needs a secret no browser may ship.\n */\n protected override assertEndpointSupported(authMeta: AuthMeta | undefined, methodName: string): void {\n const kind = authMeta?.mode.kind;\n if (kind !== 'oidc' && kind !== 'shared-secret') {\n return;\n }\n throw new Error(\n `Endpoint ${methodName} is @${kind === 'oidc' ? 'AuthOidc' : 'AuthSharedSecret'} — a browser cannot ` +\n `hold service credentials. Call it server-side with ClientHttpFactory from @webpieces/http-client-node.`,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"BrowserProxyClient.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/BrowserProxyClient.ts"],"names":[],"mappings":";;;AAAA,oDAA4E;AAC5E,kEAAwE;AAGxE;;;;;;;;;GASG;AACH,MAAa,kBAAmB,SAAQ,8BAAW;IAGlB;IAFrB,MAAM,CAAgB;IAE9B,YAA6B,UAAsB;QAC/C,KAAK,EAAE,CAAC;QADiB,eAAU,GAAV,UAAU,CAAY;IAEnD,CAAC;IAED,uDAAuD;IACvD,IAAI,CAAC,YAAkC,EAAE,MAAoB;QACzD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;;;;OAUG;IACgB,KAAK,CAAC,cAAc;QACnC,OAAO,CAAC,MAAM,0BAAc,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;IACxE,CAAC;IAEkB,eAAe;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACgB,uBAAuB,CAAC,QAA8B,EAAE,UAAkB;QACzF,MAAM,IAAI,GAAG,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC;QACjC,IAAI,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;YAC9C,OAAO;QACX,CAAC;QACD,MAAM,IAAI,KAAK,CACX,YAAY,UAAU,QAAQ,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,kBAAkB,sBAAsB;YACrG,wGAAwG,CAC3G,CAAC;IACN,CAAC;CACJ;AA/CD,gDA+CC","sourcesContent":["import { AuthMeta, ContextMgr, ClientRegistry } from '@webpieces/core-util';\nimport { ApiPrototype, ProxyClient } from '@webpieces/http-client-core';\nimport { ClientConfig } from './ClientConfig';\n\n/**\n * The browser {@link ProxyClient}. Reads context from the app-held store (via {@link ContextMgr}),\n * because a browser has no ambient request scope.\n *\n * It attaches NO outbound credential and does NO recording — both inherit the base's no-ops. A\n * browser cannot mint an OIDC token and must never hold a shared secret; the user's JWT travels as\n * an ordinary transferred context key, set on the store at login.\n *\n * This is the ONLY class in webpieces that names ContextMgr.\n */\nexport class BrowserProxyClient extends ProxyClient {\n private config!: ClientConfig;\n\n constructor(private readonly contextMgr: ContextMgr) {\n super();\n }\n\n /** Bind this client to one API contract + base URL. */\n init(apiPrototype: ApiPrototype<object>, config: ClientConfig): void {\n this.config = config;\n this.initRoutes(apiPrototype);\n }\n\n /**\n * The same chain every client runs — a ClientRegistry mapping, else the installed deriver — but\n * with the BROWSER's fallback: `''`, which makes the URL RELATIVE (`/auth/oauth`) and therefore\n * same-origin, by definition. A browser app almost always calls the backend that served it, so\n * that is the default, and an unregistered svcName must NEVER throw the way it used to a\n * forgotten registration silently killed sign-in, the request never leaving the page.\n *\n * A mapping still wins, which is exactly how an Angular dev server on :4201 reaches its backend\n * on :8201, while the same bundle served BY that backend in prod registers nothing and goes\n * relative. No `window` access, so this stays SSR-safe and testable.\n */\n protected override async resolveBaseUrl(): Promise<string> {\n return (await ClientRegistry.tryResolve(this.config.svcName)) ?? '';\n }\n\n protected override outboundHeaders(): Map<string, string> {\n return this.contextMgr.buildOutboundHeaders();\n }\n\n /**\n * Reject a contract this browser cannot satisfy, at bind time rather than on the first call.\n * Both service-to-service modes need credentials only a server has: @AuthOidc needs a runtime\n * service account to mint a token, @AuthSharedSecret needs a secret no browser may ship.\n */\n protected override assertEndpointSupported(authMeta: AuthMeta | undefined, methodName: string): void {\n const kind = authMeta?.mode.kind;\n if (kind !== 'oidc' && kind !== 'shared-secret') {\n return;\n }\n throw new Error(\n `Endpoint ${methodName} is @${kind === 'oidc' ? 'AuthOidc' : 'AuthSharedSecret'} — a browser cannot ` +\n `hold service credentials. Call it server-side with ClientHttpFactory from @webpieces/http-client-node.`,\n );\n }\n}\n"]}
@@ -2,10 +2,11 @@
2
2
  * Per-client STATE for a browser HTTP client — nothing else. A plain class; it extends nothing and
3
3
  * is unrelated to the server package's ClientConfig.
4
4
  *
5
- * A browser cannot read `K_SERVICE`, so it cannot derive a Cloud Run URL. It resolves its base URL
6
- * entirely through the global {@link ClientRegistry} by `svcName` — the Angular app registers each
7
- * svcName at startup (from its per-environment config; on localhost that URL points at a local port,
8
- * in the cloud at the deployed host). So this config is just the svcName.
5
+ * The base URL is resolved from `svcName` through the global {@link ClientRegistry}: a registered
6
+ * mapping, else the installed deriver, else RELATIVEi.e. the origin that served the page, which
7
+ * is what a browser app calling its own backend wants and needs NO configuration. Register a mapping
8
+ * only when the backend is somewhere else (an Angular dev server on :4201 reaching :8201). So this
9
+ * config is just the svcName, and an unregistered one never throws.
9
10
  *
10
11
  * The context store is NOT config: it is a dependency of {@link ClientHttpBrowserFactory}, shared
11
12
  * by every client it builds.
@@ -5,10 +5,11 @@ exports.ClientConfig = void 0;
5
5
  * Per-client STATE for a browser HTTP client — nothing else. A plain class; it extends nothing and
6
6
  * is unrelated to the server package's ClientConfig.
7
7
  *
8
- * A browser cannot read `K_SERVICE`, so it cannot derive a Cloud Run URL. It resolves its base URL
9
- * entirely through the global {@link ClientRegistry} by `svcName` — the Angular app registers each
10
- * svcName at startup (from its per-environment config; on localhost that URL points at a local port,
11
- * in the cloud at the deployed host). So this config is just the svcName.
8
+ * The base URL is resolved from `svcName` through the global {@link ClientRegistry}: a registered
9
+ * mapping, else the installed deriver, else RELATIVEi.e. the origin that served the page, which
10
+ * is what a browser app calling its own backend wants and needs NO configuration. Register a mapping
11
+ * only when the backend is somewhere else (an Angular dev server on :4201 reaching :8201). So this
12
+ * config is just the svcName, and an unregistered one never throws.
12
13
  *
13
14
  * The context store is NOT config: it is a dependency of {@link ClientHttpBrowserFactory}, shared
14
15
  * by every client it builds.
@@ -1 +1 @@
1
- {"version":3,"file":"ClientConfig.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/ClientConfig.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;GAWG;AACH,MAAa,YAAY;IAGD;IAFpB;IACI,2FAA2F;IAC3E,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAChC,CAAC;CACP;AALD,oCAKC","sourcesContent":["/**\n * Per-client STATE for a browser HTTP client — nothing else. A plain class; it extends nothing and\n * is unrelated to the server package's ClientConfig.\n *\n * A browser cannot read `K_SERVICE`, so it cannot derive a Cloud Run URL. It resolves its base URL\n * entirely through the global {@link ClientRegistry} by `svcName` — the Angular app registers each\n * svcName at startup (from its per-environment config; on localhost that URL points at a local port,\n * in the cloud at the deployed host). So this config is just the svcName.\n *\n * The context store is NOT config: it is a dependency of {@link ClientHttpBrowserFactory}, shared\n * by every client it builds.\n */\nexport class ClientConfig {\n constructor(\n /** Service name; resolved to a base URL via ClientRegistry (registered at app startup). */\n public readonly svcName: string,\n ) {}\n}\n"]}
1
+ {"version":3,"file":"ClientConfig.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/ClientConfig.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,MAAa,YAAY;IAGD;IAFpB;IACI,2FAA2F;IAC3E,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;IAChC,CAAC;CACP;AALD,oCAKC","sourcesContent":["/**\n * Per-client STATE for a browser HTTP client — nothing else. A plain class; it extends nothing and\n * is unrelated to the server package's ClientConfig.\n *\n * The base URL is resolved from `svcName` through the global {@link ClientRegistry}: a registered\n * mapping, else the installed deriver, else RELATIVEi.e. the origin that served the page, which\n * is what a browser app calling its own backend wants and needs NO configuration. Register a mapping\n * only when the backend is somewhere else (an Angular dev server on :4201 reaching :8201). So this\n * config is just the svcName, and an unregistered one never throws.\n *\n * The context store is NOT config: it is a dependency of {@link ClientHttpBrowserFactory}, shared\n * by every client it builds.\n */\nexport class ClientConfig {\n constructor(\n /** Service name; resolved to a base URL via ClientRegistry (registered at app startup). */\n public readonly svcName: string,\n ) {}\n}\n"]}
package/src/index.d.ts CHANGED
@@ -30,5 +30,6 @@ export { MutableContextStore } from './MutableContextStore';
30
30
  export { ProxyClient, ClientErrorTranslator } from '@webpieces/http-client-core';
31
31
  export type { ApiPrototype } from '@webpieces/http-client-core';
32
32
  export { ContextMgr } from '@webpieces/core-util';
33
- export { ContextReader, ContextKey, HeaderRegistry, ClientRegistry, WebpiecesCoreHeaders, } from '@webpieces/core-util';
33
+ export { ContextReader, ContextKey, HeaderRegistry, ClientRegistry, templateDeriver, WebpiecesCoreHeaders, } from '@webpieces/core-util';
34
+ export type { ServiceUrlDeriver } from '@webpieces/core-util';
34
35
  export { ApiPath, Endpoint, Authentication, AuthenticationConfig, Public, AuthJwt, AuthOidc, AuthSharedSecret, Rpc, PubSub, Queue, ValidateImplementation, } from '@webpieces/core-util';
package/src/index.js CHANGED
@@ -25,7 +25,7 @@
25
25
  * The server twin is @webpieces/http-client-node.
26
26
  */
27
27
  Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.Queue = exports.PubSub = exports.Rpc = exports.AuthSharedSecret = exports.AuthOidc = exports.AuthJwt = exports.Public = exports.AuthenticationConfig = exports.Authentication = exports.Endpoint = exports.ApiPath = exports.WebpiecesCoreHeaders = exports.ClientRegistry = exports.HeaderRegistry = exports.ContextKey = exports.ContextMgr = exports.ClientErrorTranslator = exports.ProxyClient = exports.MutableContextStore = exports.ClientConfig = exports.BrowserProxyClient = exports.ClientHttpBrowserFactory = void 0;
28
+ exports.Queue = exports.PubSub = exports.Rpc = exports.AuthSharedSecret = exports.AuthOidc = exports.AuthJwt = exports.Public = exports.AuthenticationConfig = exports.Authentication = exports.Endpoint = exports.ApiPath = exports.WebpiecesCoreHeaders = exports.templateDeriver = exports.ClientRegistry = exports.HeaderRegistry = exports.ContextKey = exports.ContextMgr = exports.ClientErrorTranslator = exports.ProxyClient = exports.MutableContextStore = exports.ClientConfig = exports.BrowserProxyClient = exports.ClientHttpBrowserFactory = void 0;
29
29
  var ClientHttpBrowserFactory_1 = require("./ClientHttpBrowserFactory");
30
30
  Object.defineProperty(exports, "ClientHttpBrowserFactory", { enumerable: true, get: function () { return ClientHttpBrowserFactory_1.ClientHttpBrowserFactory; } });
31
31
  var BrowserProxyClient_1 = require("./BrowserProxyClient");
@@ -47,6 +47,7 @@ var core_util_2 = require("@webpieces/core-util");
47
47
  Object.defineProperty(exports, "ContextKey", { enumerable: true, get: function () { return core_util_2.ContextKey; } });
48
48
  Object.defineProperty(exports, "HeaderRegistry", { enumerable: true, get: function () { return core_util_2.HeaderRegistry; } });
49
49
  Object.defineProperty(exports, "ClientRegistry", { enumerable: true, get: function () { return core_util_2.ClientRegistry; } });
50
+ Object.defineProperty(exports, "templateDeriver", { enumerable: true, get: function () { return core_util_2.templateDeriver; } });
50
51
  Object.defineProperty(exports, "WebpiecesCoreHeaders", { enumerable: true, get: function () { return core_util_2.WebpiecesCoreHeaders; } });
51
52
  // Re-export API decorators for convenience (same as http-routing does)
52
53
  var core_util_3 = require("@webpieces/core-util");
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;AAEH,uEAAsE;AAA7D,oIAAA,wBAAwB,OAAA;AACjC,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAE5B,wEAAwE;AACxE,gEAAiF;AAAxE,+GAAA,WAAW,OAAA;AAAE,yHAAA,qBAAqB,OAAA;AAG3C,iGAAiG;AACjG,mGAAmG;AACnG,kDAAkD;AAAzC,uGAAA,UAAU,OAAA;AAEnB,yFAAyF;AACzF,kDAM8B;AAJ1B,uGAAA,UAAU,OAAA;AACV,2GAAA,cAAc,OAAA;AACd,2GAAA,cAAc,OAAA;AACd,iHAAA,oBAAoB,OAAA;AAGxB,uEAAuE;AACvE,kDAa8B;AAZ1B,oGAAA,OAAO,OAAA;AACP,qGAAA,QAAQ,OAAA;AACR,2GAAA,cAAc,OAAA;AACd,iHAAA,oBAAoB,OAAA;AACpB,mGAAA,MAAM,OAAA;AACN,oGAAA,OAAO,OAAA;AACP,qGAAA,QAAQ,OAAA;AACR,6GAAA,gBAAgB,OAAA;AAChB,gGAAA,GAAG,OAAA;AACH,mGAAA,MAAM,OAAA;AACN,kGAAA,KAAK,OAAA","sourcesContent":["/**\n * @webpieces/http-client-browser\n *\n * The BROWSER HTTP client. Reads an API contract's decorators and generates type-safe HTTP\n * clients from it — the same contract the server implements.\n *\n * DI-free on purpose: this may be bundled by React or Angular, so it ships no inversify and no\n * @webpieces/core-context (which is AsyncLocalStorage-backed and Node-only). Browsers have no\n * ambient request scope, so the app holds a {@link MutableContextStore} and sets context values\n * as they become known; every outbound call then transfers them as headers.\n *\n * Usage:\n * ```typescript\n * import { ClientHttpBrowserFactory, ClientConfig, MutableContextStore } from '@webpieces/http-client-browser';\n *\n * HeaderRegistry.configure(CompanyHeaders.getAllHeaders(), true);\n * const store = new MutableContextStore();\n * const factory = new ClientHttpBrowserFactory(store);\n *\n * const client = factory.createRpcClient(SaveApi, new ClientConfig('save-svc'));\n * const response = await client.save({ query: 'test' });\n * ```\n *\n * The server twin is @webpieces/http-client-node.\n */\n\nexport { ClientHttpBrowserFactory } from './ClientHttpBrowserFactory';\nexport { BrowserProxyClient } from './BrowserProxyClient';\nexport { ClientConfig } from './ClientConfig';\nexport { MutableContextStore } from './MutableContextStore';\n\n// The isomorphic engine, re-exported so a browser app needs one import.\nexport { ProxyClient, ClientErrorTranslator } from '@webpieces/http-client-core';\nexport type { ApiPrototype } from '@webpieces/http-client-core';\n\n// ContextMgr is the BROWSER's outbound-header propagation. This is the only package that may use\n// it; the server reads RequestContext directly (RequestContextHeaders in @webpieces/core-context).\nexport { ContextMgr } from '@webpieces/core-util';\n\n// Re-export the context-key contract from core-util for convenience (browser one-import)\nexport {\n ContextReader,\n ContextKey,\n HeaderRegistry,\n ClientRegistry,\n WebpiecesCoreHeaders,\n} from '@webpieces/core-util';\n\n// Re-export API decorators for convenience (same as http-routing does)\nexport {\n ApiPath,\n Endpoint,\n Authentication,\n AuthenticationConfig,\n Public,\n AuthJwt,\n AuthOidc,\n AuthSharedSecret,\n Rpc,\n PubSub,\n Queue,\n ValidateImplementation,\n} from '@webpieces/core-util';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;;AAEH,uEAAsE;AAA7D,oIAAA,wBAAwB,OAAA;AACjC,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAE5B,wEAAwE;AACxE,gEAAiF;AAAxE,+GAAA,WAAW,OAAA;AAAE,yHAAA,qBAAqB,OAAA;AAG3C,iGAAiG;AACjG,mGAAmG;AACnG,kDAAkD;AAAzC,uGAAA,UAAU,OAAA;AAEnB,yFAAyF;AACzF,kDAO8B;AAL1B,uGAAA,UAAU,OAAA;AACV,2GAAA,cAAc,OAAA;AACd,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AACf,iHAAA,oBAAoB,OAAA;AAIxB,uEAAuE;AACvE,kDAa8B;AAZ1B,oGAAA,OAAO,OAAA;AACP,qGAAA,QAAQ,OAAA;AACR,2GAAA,cAAc,OAAA;AACd,iHAAA,oBAAoB,OAAA;AACpB,mGAAA,MAAM,OAAA;AACN,oGAAA,OAAO,OAAA;AACP,qGAAA,QAAQ,OAAA;AACR,6GAAA,gBAAgB,OAAA;AAChB,gGAAA,GAAG,OAAA;AACH,mGAAA,MAAM,OAAA;AACN,kGAAA,KAAK,OAAA","sourcesContent":["/**\n * @webpieces/http-client-browser\n *\n * The BROWSER HTTP client. Reads an API contract's decorators and generates type-safe HTTP\n * clients from it — the same contract the server implements.\n *\n * DI-free on purpose: this may be bundled by React or Angular, so it ships no inversify and no\n * @webpieces/core-context (which is AsyncLocalStorage-backed and Node-only). Browsers have no\n * ambient request scope, so the app holds a {@link MutableContextStore} and sets context values\n * as they become known; every outbound call then transfers them as headers.\n *\n * Usage:\n * ```typescript\n * import { ClientHttpBrowserFactory, ClientConfig, MutableContextStore } from '@webpieces/http-client-browser';\n *\n * HeaderRegistry.configure(CompanyHeaders.getAllHeaders(), true);\n * const store = new MutableContextStore();\n * const factory = new ClientHttpBrowserFactory(store);\n *\n * const client = factory.createRpcClient(SaveApi, new ClientConfig('save-svc'));\n * const response = await client.save({ query: 'test' });\n * ```\n *\n * The server twin is @webpieces/http-client-node.\n */\n\nexport { ClientHttpBrowserFactory } from './ClientHttpBrowserFactory';\nexport { BrowserProxyClient } from './BrowserProxyClient';\nexport { ClientConfig } from './ClientConfig';\nexport { MutableContextStore } from './MutableContextStore';\n\n// The isomorphic engine, re-exported so a browser app needs one import.\nexport { ProxyClient, ClientErrorTranslator } from '@webpieces/http-client-core';\nexport type { ApiPrototype } from '@webpieces/http-client-core';\n\n// ContextMgr is the BROWSER's outbound-header propagation. This is the only package that may use\n// it; the server reads RequestContext directly (RequestContextHeaders in @webpieces/core-context).\nexport { ContextMgr } from '@webpieces/core-util';\n\n// Re-export the context-key contract from core-util for convenience (browser one-import)\nexport {\n ContextReader,\n ContextKey,\n HeaderRegistry,\n ClientRegistry,\n templateDeriver,\n WebpiecesCoreHeaders,\n} from '@webpieces/core-util';\nexport type { ServiceUrlDeriver } from '@webpieces/core-util';\n\n// Re-export API decorators for convenience (same as http-routing does)\nexport {\n ApiPath,\n Endpoint,\n Authentication,\n AuthenticationConfig,\n Public,\n AuthJwt,\n AuthOidc,\n AuthSharedSecret,\n Rpc,\n PubSub,\n Queue,\n ValidateImplementation,\n} from '@webpieces/core-util';\n"]}