@webpieces/http-client-browser 0.3.334 → 0.3.335

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/README.md CHANGED
@@ -12,7 +12,7 @@ HeaderRegistry.configure(AppHeaders.getAllHeaders(), CompanyHeaders.getAllHeader
12
12
 
13
13
  const store = new MutableContextStore();
14
14
  const factory = new ClientHttpBrowserFactory(store);
15
- const saveApi = factory.createClient(SaveApi, new ClientConfig(env.apiBaseUrl));
15
+ const saveApi = factory.createRpcClient(SaveApi, new ClientConfig(env.apiBaseUrl));
16
16
 
17
17
  const res = await saveApi.save({ query: 'test' }); // type-safe
18
18
 
@@ -22,4 +22,4 @@ store.set(CompanyHeaders.TENANT_ID, tenantId);
22
22
  ```
23
23
 
24
24
  A browser cannot hold service credentials, so a contract with an `@AuthOidc` endpoint fails fast at
25
- `createClient`. The server twin is [@webpieces/http-client-node](../http-client-node).
25
+ `createRpcClient`. The server twin is [@webpieces/http-client-node](../http-client-node).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/http-client-browser",
3
- "version": "0.3.334",
3
+ "version": "0.3.335",
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.334",
26
- "@webpieces/http-client-core": "0.3.334"
25
+ "@webpieces/core-util": "0.3.335",
26
+ "@webpieces/http-client-core": "0.3.335"
27
27
  }
28
28
  }
@@ -18,7 +18,7 @@ import { MutableContextStore } from './MutableContextStore';
18
18
  * const store = new MutableContextStore();
19
19
  * const factory = new ClientHttpBrowserFactory(store);
20
20
  *
21
- * const saveApi = factory.createClient(SaveApi, new ClientConfig(env.apiBaseUrl));
21
+ * const saveApi = factory.createRpcClient(SaveApi, new ClientConfig(env.apiBaseUrl));
22
22
  * const response = await saveApi.save({ query: 'test' }); // type-safe
23
23
  *
24
24
  * // later, when the user logs in / picks a tenant — every subsequent call carries them:
@@ -27,7 +27,7 @@ import { MutableContextStore } from './MutableContextStore';
27
27
  * ```
28
28
  *
29
29
  * A browser cannot hold service credentials, so a contract with an @AuthOidc or @AuthSharedSecret
30
- * endpoint throws in `createClient`, not on the first call.
30
+ * endpoint throws in `createRpcClient`, not on the first call.
31
31
  */
32
32
  export declare class ClientHttpBrowserFactory {
33
33
  private readonly contextMgr;
@@ -38,5 +38,5 @@ export declare class ClientHttpBrowserFactory {
38
38
  * @param apiPrototype - The API prototype class with @ApiPath/@Endpoint decorators
39
39
  * @param config - This client's state (its baseUrl)
40
40
  */
41
- createClient<T extends object>(apiPrototype: ApiPrototype<T>, config: ClientConfig): T;
41
+ createRpcClient<T extends object>(apiPrototype: ApiPrototype<T>, config: ClientConfig): T;
42
42
  }
@@ -23,7 +23,7 @@ const MutableContextStore_1 = require("./MutableContextStore");
23
23
  * const store = new MutableContextStore();
24
24
  * const factory = new ClientHttpBrowserFactory(store);
25
25
  *
26
- * const saveApi = factory.createClient(SaveApi, new ClientConfig(env.apiBaseUrl));
26
+ * const saveApi = factory.createRpcClient(SaveApi, new ClientConfig(env.apiBaseUrl));
27
27
  * const response = await saveApi.save({ query: 'test' }); // type-safe
28
28
  *
29
29
  * // later, when the user logs in / picks a tenant — every subsequent call carries them:
@@ -32,7 +32,7 @@ const MutableContextStore_1 = require("./MutableContextStore");
32
32
  * ```
33
33
  *
34
34
  * A browser cannot hold service credentials, so a contract with an @AuthOidc or @AuthSharedSecret
35
- * endpoint throws in `createClient`, not on the first call.
35
+ * endpoint throws in `createRpcClient`, not on the first call.
36
36
  */
37
37
  let ClientHttpBrowserFactory = class ClientHttpBrowserFactory {
38
38
  contextMgr;
@@ -45,7 +45,7 @@ let ClientHttpBrowserFactory = class ClientHttpBrowserFactory {
45
45
  * @param apiPrototype - The API prototype class with @ApiPath/@Endpoint decorators
46
46
  * @param config - This client's state (its baseUrl)
47
47
  */
48
- createClient(apiPrototype, config) {
48
+ createRpcClient(apiPrototype, config) {
49
49
  const proxyClient = new BrowserProxyClient_1.BrowserProxyClient(this.contextMgr);
50
50
  proxyClient.init(apiPrototype, config);
51
51
  return (0, http_client_core_1.buildClientProxy)(apiPrototype, proxyClient);
@@ -1 +1 @@
1
- {"version":3,"file":"ClientHttpBrowserFactory.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/ClientHttpBrowserFactory.ts"],"names":[],"mappings":";;;;AAAA,oDAAkE;AAClE,kEAA6E;AAC7E,6DAA0D;AAE1D,+DAA4D;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAChB,UAAU,CAAa;IAExC,YAAY,KAA0B;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,sBAAU,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAmB,YAA6B,EAAE,MAAoB;QAC9E,MAAM,WAAW,GAAG,IAAI,uCAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5D,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACvC,OAAO,IAAA,mCAAgB,EAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IACvD,CAAC;CACJ,CAAA;AAlBY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,0BAAc,GAAE;6CAIM,yCAAmB;GAH7B,wBAAwB,CAkBpC","sourcesContent":["import { ContextMgr, DocumentDesign } from '@webpieces/core-util';\nimport { ApiPrototype, buildClientProxy } from '@webpieces/http-client-core';\nimport { BrowserProxyClient } from './BrowserProxyClient';\nimport { ClientConfig } from './ClientConfig';\nimport { MutableContextStore } from './MutableContextStore';\n\n/**\n * ClientHttpBrowserFactory - builds type-safe HTTP clients for a BROWSER from API prototypes\n * carrying @ApiPath/@Endpoint decorators.\n *\n * Deliberately a plain class with NO decorators and NO inversify: this package may be bundled by\n * React just as easily as by Angular, and neither should be forced to adopt a Node DI container.\n * The app provides it through whatever DI it already has — Angular's `useFactory`, a React context,\n * or a module-level `const`.\n *\n * The factory holds the ONE collaborator every browser client shares (the app's\n * {@link MutableContextStore}); each {@link ClientConfig} holds only that one client's base URL.\n *\n * ```typescript\n * // once, at startup (after HeaderRegistry.configure(...)):\n * const store = new MutableContextStore();\n * const factory = new ClientHttpBrowserFactory(store);\n *\n * const saveApi = factory.createClient(SaveApi, new ClientConfig(env.apiBaseUrl));\n * const response = await saveApi.save({ query: 'test' }); // type-safe\n *\n * // later, when the user logs in / picks a tenant — every subsequent call carries them:\n * store.set(AppHeaders.AUTHORIZATION, token); // an app-defined key, if it wants auto-attach\n * store.set(CompanyHeaders.TENANT_ID, tenantId);\n * ```\n *\n * A browser cannot hold service credentials, so a contract with an @AuthOidc or @AuthSharedSecret\n * endpoint throws in `createClient`, not on the first call.\n */\n@DocumentDesign()\nexport class ClientHttpBrowserFactory {\n private readonly contextMgr: ContextMgr;\n\n constructor(store: MutableContextStore) {\n this.contextMgr = new ContextMgr(store);\n }\n\n /**\n * Create a type-safe HTTP client for one API contract.\n *\n * @param apiPrototype - The API prototype class with @ApiPath/@Endpoint decorators\n * @param config - This client's state (its baseUrl)\n */\n createClient<T extends object>(apiPrototype: ApiPrototype<T>, config: ClientConfig): T {\n const proxyClient = new BrowserProxyClient(this.contextMgr);\n proxyClient.init(apiPrototype, config);\n return buildClientProxy(apiPrototype, proxyClient);\n }\n}\n"]}
1
+ {"version":3,"file":"ClientHttpBrowserFactory.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/ClientHttpBrowserFactory.ts"],"names":[],"mappings":";;;;AAAA,oDAAkE;AAClE,kEAA6E;AAC7E,6DAA0D;AAE1D,+DAA4D;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAChB,UAAU,CAAa;IAExC,YAAY,KAA0B;QAClC,IAAI,CAAC,UAAU,GAAG,IAAI,sBAAU,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;OAKG;IACH,eAAe,CAAmB,YAA6B,EAAE,MAAoB;QACjF,MAAM,WAAW,GAAG,IAAI,uCAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC5D,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACvC,OAAO,IAAA,mCAAgB,EAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IACvD,CAAC;CACJ,CAAA;AAlBY,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,0BAAc,GAAE;6CAIM,yCAAmB;GAH7B,wBAAwB,CAkBpC","sourcesContent":["import { ContextMgr, DocumentDesign } from '@webpieces/core-util';\nimport { ApiPrototype, buildClientProxy } from '@webpieces/http-client-core';\nimport { BrowserProxyClient } from './BrowserProxyClient';\nimport { ClientConfig } from './ClientConfig';\nimport { MutableContextStore } from './MutableContextStore';\n\n/**\n * ClientHttpBrowserFactory - builds type-safe HTTP clients for a BROWSER from API prototypes\n * carrying @ApiPath/@Endpoint decorators.\n *\n * Deliberately a plain class with NO decorators and NO inversify: this package may be bundled by\n * React just as easily as by Angular, and neither should be forced to adopt a Node DI container.\n * The app provides it through whatever DI it already has — Angular's `useFactory`, a React context,\n * or a module-level `const`.\n *\n * The factory holds the ONE collaborator every browser client shares (the app's\n * {@link MutableContextStore}); each {@link ClientConfig} holds only that one client's base URL.\n *\n * ```typescript\n * // once, at startup (after HeaderRegistry.configure(...)):\n * const store = new MutableContextStore();\n * const factory = new ClientHttpBrowserFactory(store);\n *\n * const saveApi = factory.createRpcClient(SaveApi, new ClientConfig(env.apiBaseUrl));\n * const response = await saveApi.save({ query: 'test' }); // type-safe\n *\n * // later, when the user logs in / picks a tenant — every subsequent call carries them:\n * store.set(AppHeaders.AUTHORIZATION, token); // an app-defined key, if it wants auto-attach\n * store.set(CompanyHeaders.TENANT_ID, tenantId);\n * ```\n *\n * A browser cannot hold service credentials, so a contract with an @AuthOidc or @AuthSharedSecret\n * endpoint throws in `createRpcClient`, not on the first call.\n */\n@DocumentDesign()\nexport class ClientHttpBrowserFactory {\n private readonly contextMgr: ContextMgr;\n\n constructor(store: MutableContextStore) {\n this.contextMgr = new ContextMgr(store);\n }\n\n /**\n * Create a type-safe HTTP client for one API contract.\n *\n * @param apiPrototype - The API prototype class with @ApiPath/@Endpoint decorators\n * @param config - This client's state (its baseUrl)\n */\n createRpcClient<T extends object>(apiPrototype: ApiPrototype<T>, config: ClientConfig): T {\n const proxyClient = new BrowserProxyClient(this.contextMgr);\n proxyClient.init(apiPrototype, config);\n return buildClientProxy(apiPrototype, proxyClient);\n }\n}\n"]}
@@ -13,7 +13,7 @@ import { ContextKey, ContextReader } from '@webpieces/core-util';
13
13
  * // startup:
14
14
  * HeaderRegistry.configure(AppHeaders.getAllHeaders(), CompanyHeaders.getAllHeaders(), true);
15
15
  * const factory = new ClientHttpFactory(new ContextMgr(store));
16
- * const client = factory.createClient(SaveApi, new ClientConfig(baseUrl));
16
+ * const client = factory.createRpcClient(SaveApi, new ClientConfig(baseUrl));
17
17
  *
18
18
  * // later, when the user logs in / picks a tenant:
19
19
  * store.set(AppHeaders.AUTHORIZATION, token); // an app-defined key, if it wants auto-attach
@@ -15,7 +15,7 @@ exports.MutableContextStore = void 0;
15
15
  * // startup:
16
16
  * HeaderRegistry.configure(AppHeaders.getAllHeaders(), CompanyHeaders.getAllHeaders(), true);
17
17
  * const factory = new ClientHttpFactory(new ContextMgr(store));
18
- * const client = factory.createClient(SaveApi, new ClientConfig(baseUrl));
18
+ * const client = factory.createRpcClient(SaveApi, new ClientConfig(baseUrl));
19
19
  *
20
20
  * // later, when the user logs in / picks a tenant:
21
21
  * store.set(AppHeaders.AUTHORIZATION, token); // an app-defined key, if it wants auto-attach
@@ -1 +1 @@
1
- {"version":3,"file":"MutableContextStore.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/MutableContextStore.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,mBAAmB;IACpB,MAAM,GAAwB,IAAI,GAAG,EAAE,CAAC;IAEhD,8DAA8D;IAC9D,GAAG,CAAC,GAAe,EAAE,KAAa;QAC9B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,mEAAmE;IACnE,MAAM,CAAC,GAAe;QAClB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,+BAA+B;IAC/B,KAAK;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAED,IAAI,CAAC,GAAe;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACJ;AArBD,kDAqBC","sourcesContent":["import { ContextKey, ContextReader } from '@webpieces/core-util';\n\n/**\n * MutableContextStore - the BROWSER ContextReader.\n *\n * Browsers have no AsyncLocalStorage, so apps (Angular/React) hold one of these\n * (e.g. as an Angular service / React context value) and set values as they become\n * known (login token, selected tenant, ...). The ContextMgr then reads from it on\n * every outbound request.\n *\n * Example (Angular):\n * ```typescript\n * const store = new MutableContextStore();\n * // startup:\n * HeaderRegistry.configure(AppHeaders.getAllHeaders(), CompanyHeaders.getAllHeaders(), true);\n * const factory = new ClientHttpFactory(new ContextMgr(store));\n * const client = factory.createClient(SaveApi, new ClientConfig(baseUrl));\n *\n * // later, when the user logs in / picks a tenant:\n * store.set(AppHeaders.AUTHORIZATION, token); // an app-defined key, if it wants auto-attach\n * store.set(CompanyHeaders.TENANT_ID, tenantId);\n * ```\n */\nexport class MutableContextStore implements ContextReader {\n private values: Map<string, string> = new Map();\n\n /** Set (or overwrite) the current value for a context key. */\n set(key: ContextKey, value: string): void {\n this.values.set(key.name, value);\n }\n\n /** Remove the current value for a context key (e.g. on logout). */\n remove(key: ContextKey): void {\n this.values.delete(key.name);\n }\n\n /** Clear all stored values. */\n clear(): void {\n this.values.clear();\n }\n\n read(key: ContextKey): string | undefined {\n return this.values.get(key.name);\n }\n}\n"]}
1
+ {"version":3,"file":"MutableContextStore.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/MutableContextStore.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAa,mBAAmB;IACpB,MAAM,GAAwB,IAAI,GAAG,EAAE,CAAC;IAEhD,8DAA8D;IAC9D,GAAG,CAAC,GAAe,EAAE,KAAa;QAC9B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,mEAAmE;IACnE,MAAM,CAAC,GAAe;QAClB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,+BAA+B;IAC/B,KAAK;QACD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAED,IAAI,CAAC,GAAe;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;CACJ;AArBD,kDAqBC","sourcesContent":["import { ContextKey, ContextReader } from '@webpieces/core-util';\n\n/**\n * MutableContextStore - the BROWSER ContextReader.\n *\n * Browsers have no AsyncLocalStorage, so apps (Angular/React) hold one of these\n * (e.g. as an Angular service / React context value) and set values as they become\n * known (login token, selected tenant, ...). The ContextMgr then reads from it on\n * every outbound request.\n *\n * Example (Angular):\n * ```typescript\n * const store = new MutableContextStore();\n * // startup:\n * HeaderRegistry.configure(AppHeaders.getAllHeaders(), CompanyHeaders.getAllHeaders(), true);\n * const factory = new ClientHttpFactory(new ContextMgr(store));\n * const client = factory.createRpcClient(SaveApi, new ClientConfig(baseUrl));\n *\n * // later, when the user logs in / picks a tenant:\n * store.set(AppHeaders.AUTHORIZATION, token); // an app-defined key, if it wants auto-attach\n * store.set(CompanyHeaders.TENANT_ID, tenantId);\n * ```\n */\nexport class MutableContextStore implements ContextReader {\n private values: Map<string, string> = new Map();\n\n /** Set (or overwrite) the current value for a context key. */\n set(key: ContextKey, value: string): void {\n this.values.set(key.name, value);\n }\n\n /** Remove the current value for a context key (e.g. on logout). */\n remove(key: ContextKey): void {\n this.values.delete(key.name);\n }\n\n /** Clear all stored values. */\n clear(): void {\n this.values.clear();\n }\n\n read(key: ContextKey): string | undefined {\n return this.values.get(key.name);\n }\n}\n"]}
package/src/index.d.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  * const store = new MutableContextStore();
18
18
  * const factory = new ClientHttpBrowserFactory(store);
19
19
  *
20
- * const client = factory.createClient(SaveApi, new ClientConfig('http://localhost:3000'));
20
+ * const client = factory.createRpcClient(SaveApi, new ClientConfig('http://localhost:3000'));
21
21
  * const response = await client.save({ query: 'test' });
22
22
  * ```
23
23
  *
package/src/index.js CHANGED
@@ -18,7 +18,7 @@
18
18
  * const store = new MutableContextStore();
19
19
  * const factory = new ClientHttpBrowserFactory(store);
20
20
  *
21
- * const client = factory.createClient(SaveApi, new ClientConfig('http://localhost:3000'));
21
+ * const client = factory.createRpcClient(SaveApi, new ClientConfig('http://localhost:3000'));
22
22
  * const response = await client.save({ query: 'test' });
23
23
  * ```
24
24
  *
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,kDAK8B;AAH1B,uGAAA,UAAU,OAAA;AACV,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(AppHeaders.getAllHeaders(), CompanyHeaders.getAllHeaders(), true);\n * const store = new MutableContextStore();\n * const factory = new ClientHttpBrowserFactory(store);\n *\n * const client = factory.createClient(SaveApi, new ClientConfig('http://localhost:3000'));\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 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,kDAK8B;AAH1B,uGAAA,UAAU,OAAA;AACV,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(AppHeaders.getAllHeaders(), CompanyHeaders.getAllHeaders(), true);\n * const store = new MutableContextStore();\n * const factory = new ClientHttpBrowserFactory(store);\n *\n * const client = factory.createRpcClient(SaveApi, new ClientConfig('http://localhost:3000'));\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 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"]}