@webpieces/http-client-browser 0.4.868 → 0.4.870

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.4.868",
3
+ "version": "0.4.870",
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.4.868",
26
- "@webpieces/http-client-core": "0.4.868"
25
+ "@webpieces/core-util": "0.4.870",
26
+ "@webpieces/http-client-core": "0.4.870"
27
27
  }
28
28
  }
@@ -0,0 +1,7 @@
1
+ import { Binder } from './Wiring';
2
+ import type { AppWiring, Wiring } from './Wiring';
3
+ /** Compiled fixtures protect token/API inference and the browser's missing route channel. */
4
+ export declare class BinderCompileAssertions {
5
+ check(binder: Binder, token: symbol): void;
6
+ routes(wiring: Wiring, app: AppWiring): void;
7
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BinderCompileAssertions = void 0;
4
+ const Wiring_1 = require("./Wiring");
5
+ class TextApi {
6
+ }
7
+ /** Compiled fixtures protect token/API inference and the browser's missing route channel. */
8
+ class BinderCompileAssertions {
9
+ check(binder, token) {
10
+ binder.createRpcClientAndBind(TextApi, 'text-service');
11
+ binder.createRpcClientAndBind(TextApi, 'text-service', new Wiring_1.ClientBindOptions(token));
12
+ // @ts-expect-error A service destination is required.
13
+ binder.createRpcClientAndBind(TextApi);
14
+ // @ts-expect-error Wrapper destinations were removed; use a service string.
15
+ binder.createRpcClientAndBind(TextApi, { serviceName: 'text-service' });
16
+ }
17
+ routes(wiring, app) {
18
+ // @ts-expect-error The browser has no route channel.
19
+ wiring.getRouteModules();
20
+ // @ts-expect-error The browser has no route channel.
21
+ app.getRoutingModules();
22
+ }
23
+ }
24
+ exports.BinderCompileAssertions = BinderCompileAssertions;
25
+ //# sourceMappingURL=BinderCompileAssertions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BinderCompileAssertions.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/BinderCompileAssertions.ts"],"names":[],"mappings":";;;AAAA,qCAAqD;AAGrD,MAAe,OAAO;CAA6B;AAEnD,6FAA6F;AAC7F,MAAa,uBAAuB;IAChC,KAAK,CAAC,MAAc,EAAE,KAAa;QAC/B,MAAM,CAAC,sBAAsB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QACvD,MAAM,CAAC,sBAAsB,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,0BAAiB,CAAU,KAAK,CAAC,CAAC,CAAC;QAC9F,sDAAsD;QACtD,MAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QACvC,4EAA4E;QAC5E,MAAM,CAAC,sBAAsB,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;IAC5E,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,GAAc;QACjC,qDAAqD;QACrD,MAAM,CAAC,eAAe,EAAE,CAAC;QACzB,qDAAqD;QACrD,GAAG,CAAC,iBAAiB,EAAE,CAAC;IAC5B,CAAC;CACJ;AAhBD,0DAgBC","sourcesContent":["import { Binder, ClientBindOptions } from './Wiring';\nimport type { AppWiring, Wiring } from './Wiring';\n\nabstract class TextApi { abstract read(): string; }\n\n/** Compiled fixtures protect token/API inference and the browser's missing route channel. */\nexport class BinderCompileAssertions {\n check(binder: Binder, token: symbol): void {\n binder.createRpcClientAndBind(TextApi, 'text-service');\n binder.createRpcClientAndBind(TextApi, 'text-service', new ClientBindOptions<TextApi>(token));\n // @ts-expect-error A service destination is required.\n binder.createRpcClientAndBind(TextApi);\n // @ts-expect-error Wrapper destinations were removed; use a service string.\n binder.createRpcClientAndBind(TextApi, { serviceName: 'text-service' });\n }\n\n routes(wiring: Wiring, app: AppWiring): void {\n // @ts-expect-error The browser has no route channel.\n wiring.getRouteModules();\n // @ts-expect-error The browser has no route channel.\n app.getRoutingModules();\n }\n}\n"]}
@@ -18,23 +18,31 @@ import { RequestOutcome } from '@webpieces/http-client-core';
18
18
  * `onRequestStart` and `onRequestEnd` are PAIRED: every start is followed by exactly one end, on
19
19
  * every path (2xx, HTTP error, network reject), so a counter driven off them cannot leak.
20
20
  *
21
- * `route.background` is the endpoint's own declaration that it is plumbing the user did not ask for
22
- * — a log shipper, a heartbeat, a telemetry flush (`@Endpoint(..., { background: true })`). It is not
23
- * progress, so a bar driven off these callbacks should skip it, and so should any app-level RPC
24
- * instrumentation whose own lines would otherwise become the next batch's payload. webpieces already
25
- * emits no `[API-client-*]` line for such a route; this is the app's half of the same fact, read from
26
- * the ROUTE rather than matched on a path string.
21
+ * Three independent endpoint declarations ride the route, each read from the ROUTE rather than
22
+ * matched on a path string, each false when absent:
23
+ *
24
+ * - `route.hideProgress` (`@Endpoint(..., { hideProgress: true })`) — the user is not waiting on this
25
+ * call (a background download, a log shipper), so a bar driven off these callbacks should skip it.
26
+ * - `route.allowUpgradeInFlight` (`@Endpoint(..., { allowUpgradeInFlight: true })`) — the app may
27
+ * upgrade while this call is in flight, and the call neither blocks nor arms that upgrade. Absent,
28
+ * the call must finish before an upgrade, and its success counts toward arming one — even when it
29
+ * is hidden from the bar.
30
+ * - `route.noLogging` (`@Endpoint(..., { noLogging: true })`) — webpieces already emits no
31
+ * `[API-client-*]` line for it; app-level RPC instrumentation whose own lines would become the next
32
+ * log batch's payload should skip it too.
33
+ *
34
+ * A log shipper declares all three; a background download declares only `hideProgress`.
27
35
  *
28
36
  * ```typescript
29
37
  * class RpcLifecycleListener implements RequestLifecycleListener {
30
38
  * onRequestStart(route: RouteMetadata): void {
31
- * if (route.background) return;
32
- * progressBar.noteRequestStart();
39
+ * if (!route.allowUpgradeInFlight) upgradeGate.noteRequestStart();
40
+ * if (!route.hideProgress) progressBar.noteRequestStart();
33
41
  * }
34
42
  * onRequestEnd(route: RouteMetadata, outcome: RequestOutcome): void {
35
43
  * serverVersionBridge.set(outcome.headers?.get('x-myorg-server-version'));
36
- * if (route.background) return;
37
- * progressBar.noteRequestEnd(!outcome.ok);
44
+ * if (!route.allowUpgradeInFlight) upgradeGate.noteRequestEnd(outcome.ok);
45
+ * if (!route.hideProgress) progressBar.noteRequestEnd(!outcome.ok);
38
46
  * }
39
47
  * }
40
48
  * const factory = new ClientHttpBrowserFactory(store, new RpcLifecycleListener());
@@ -1 +1 @@
1
- {"version":3,"file":"RequestLifecycleListener.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/RequestLifecycleListener.ts"],"names":[],"mappings":"","sourcesContent":["import { RouteMetadata } from '@webpieces/core-util';\nimport { RequestOutcome } from '@webpieces/http-client-core';\n\n/**\n * The inbound seam an app implements to observe the FULL lifecycle of every RPC call — symmetric\n * with the outbound header propagation done by {@link MutableContextStore} / {@link ContextMgr}.\n * Registered once on {@link ClientHttpBrowserFactory}; invoked by {@link BrowserProxyClient} around\n * each call.\n *\n * Replaces the older header-only ResponseHeadersListener. `onRequestEnd`'s `outcome.headers` carries\n * the same Response Headers (after settlement, on both ok and error), and it adds the\n * two signals the header-only seam could not give: a START marker, and success-or-error.\n *\n * The driver is a browser app that must drive ONE progress bar across N requests per user action,\n * AND detect that a newer server is deployed than this bundle (the server stamps\n * `x-<org>-server-version` on every response) — reloading only at a safe moment, so a half-filled\n * form is never blown away. It needs, per RPC: bar on, bar off, the outcome, and the headers.\n *\n * `onRequestStart` and `onRequestEnd` are PAIRED: every start is followed by exactly one end, on\n * every path (2xx, HTTP error, network reject), so a counter driven off them cannot leak.\n *\n * `route.background` is the endpoint's own declaration that it is plumbing the user did not ask for\n * — a log shipper, a heartbeat, a telemetry flush (`@Endpoint(..., { background: true })`). It is not\n * progress, so a bar driven off these callbacks should skip it, and so should any app-level RPC\n * instrumentation whose own lines would otherwise become the next batch's payload. webpieces already\n * emits no `[API-client-*]` line for such a route; this is the app's half of the same fact, read from\n * the ROUTE rather than matched on a path string.\n *\n * ```typescript\n * class RpcLifecycleListener implements RequestLifecycleListener {\n * onRequestStart(route: RouteMetadata): void {\n * if (route.background) return;\n * progressBar.noteRequestStart();\n * }\n * onRequestEnd(route: RouteMetadata, outcome: RequestOutcome): void {\n * serverVersionBridge.set(outcome.headers?.get('x-myorg-server-version'));\n * if (route.background) return;\n * progressBar.noteRequestEnd(!outcome.ok);\n * }\n * }\n * const factory = new ClientHttpBrowserFactory(store, new RpcLifecycleListener());\n * ```\n *\n * This is BUSINESS LOGIC (methods), so it is an interface, not a data class — unlike the\n * {@link RequestOutcome} it is handed.\n */\nexport interface RequestLifecycleListener {\n /** Before fetch, once per RPC. */\n onRequestStart(route: RouteMetadata): void;\n\n /** Once, after the call settles, on every path (success, HTTP error, network reject). */\n onRequestEnd(route: RouteMetadata, outcome: RequestOutcome): void;\n}\n"]}
1
+ {"version":3,"file":"RequestLifecycleListener.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/RequestLifecycleListener.ts"],"names":[],"mappings":"","sourcesContent":["import { RouteMetadata } from '@webpieces/core-util';\nimport { RequestOutcome } from '@webpieces/http-client-core';\n\n/**\n * The inbound seam an app implements to observe the FULL lifecycle of every RPC call — symmetric\n * with the outbound header propagation done by {@link MutableContextStore} / {@link ContextMgr}.\n * Registered once on {@link ClientHttpBrowserFactory}; invoked by {@link BrowserProxyClient} around\n * each call.\n *\n * Replaces the older header-only ResponseHeadersListener. `onRequestEnd`'s `outcome.headers` carries\n * the same Response Headers (after settlement, on both ok and error), and it adds the\n * two signals the header-only seam could not give: a START marker, and success-or-error.\n *\n * The driver is a browser app that must drive ONE progress bar across N requests per user action,\n * AND detect that a newer server is deployed than this bundle (the server stamps\n * `x-<org>-server-version` on every response) — reloading only at a safe moment, so a half-filled\n * form is never blown away. It needs, per RPC: bar on, bar off, the outcome, and the headers.\n *\n * `onRequestStart` and `onRequestEnd` are PAIRED: every start is followed by exactly one end, on\n * every path (2xx, HTTP error, network reject), so a counter driven off them cannot leak.\n *\n * Three independent endpoint declarations ride the route, each read from the ROUTE rather than\n * matched on a path string, each false when absent:\n *\n * - `route.hideProgress` (`@Endpoint(..., { hideProgress: true })`) — the user is not waiting on this\n * call (a background download, a log shipper), so a bar driven off these callbacks should skip it.\n * - `route.allowUpgradeInFlight` (`@Endpoint(..., { allowUpgradeInFlight: true })`) — the app may\n * upgrade while this call is in flight, and the call neither blocks nor arms that upgrade. Absent,\n * the call must finish before an upgrade, and its success counts toward arming one — even when it\n * is hidden from the bar.\n * - `route.noLogging` (`@Endpoint(..., { noLogging: true })`) — webpieces already emits no\n * `[API-client-*]` line for it; app-level RPC instrumentation whose own lines would become the next\n * log batch's payload should skip it too.\n *\n * A log shipper declares all three; a background download declares only `hideProgress`.\n *\n * ```typescript\n * class RpcLifecycleListener implements RequestLifecycleListener {\n * onRequestStart(route: RouteMetadata): void {\n * if (!route.allowUpgradeInFlight) upgradeGate.noteRequestStart();\n * if (!route.hideProgress) progressBar.noteRequestStart();\n * }\n * onRequestEnd(route: RouteMetadata, outcome: RequestOutcome): void {\n * serverVersionBridge.set(outcome.headers?.get('x-myorg-server-version'));\n * if (!route.allowUpgradeInFlight) upgradeGate.noteRequestEnd(outcome.ok);\n * if (!route.hideProgress) progressBar.noteRequestEnd(!outcome.ok);\n * }\n * }\n * const factory = new ClientHttpBrowserFactory(store, new RpcLifecycleListener());\n * ```\n *\n * This is BUSINESS LOGIC (methods), so it is an interface, not a data class — unlike the\n * {@link RequestOutcome} it is handed.\n */\nexport interface RequestLifecycleListener {\n /** Before fetch, once per RPC. */\n onRequestStart(route: RouteMetadata): void;\n\n /** Once, after the call settles, on every path (success, HTTP error, network reject). */\n onRequestEnd(route: RouteMetadata, outcome: RequestOutcome): void;\n}\n"]}
@@ -1,13 +1,16 @@
1
1
  import type { ApiPrototype } from '@webpieces/http-client-core';
2
+ import type { BrowserToken } from './BrowserProviders';
2
3
  import { ClientHttpBrowserFactory } from './ClientHttpBrowserFactory';
3
4
  import { ClientConfig } from './ClientConfig';
4
- /** Structurally compatible Angular factory provider. The original token remains overrideable. */
5
+ /**
6
+ * Structurally compatible Angular factory provider, created by Binder.createRpcClientAndBind. The
7
+ * token remains overrideable and the client is created lazily, on first inject.
8
+ */
5
9
  export declare class RpcClientProvider<T extends object> {
6
- readonly provide: ApiPrototype<T> | symbol;
10
+ readonly provide: BrowserToken;
7
11
  private readonly api;
8
12
  private readonly destination;
9
13
  readonly deps: (typeof ClientConfig | typeof ClientHttpBrowserFactory)[];
10
- constructor(provide: ApiPrototype<T> | symbol, api: ApiPrototype<T>, destination: string);
14
+ constructor(provide: BrowserToken, api: ApiPrototype<T>, destination: string);
11
15
  readonly useFactory: (factory: ClientHttpBrowserFactory, _config: ClientConfig) => T;
12
16
  }
13
- export declare function provideRpcClient<T extends object>(token: ApiPrototype<NoInfer<T>> | symbol, api: ApiPrototype<T>, destination: string): RpcClientProvider<T>;
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RpcClientProvider = void 0;
4
- exports.provideRpcClient = provideRpcClient;
5
4
  const ClientHttpBrowserFactory_1 = require("./ClientHttpBrowserFactory");
6
5
  const ClientConfig_1 = require("./ClientConfig");
7
- /** Structurally compatible Angular factory provider. The original token remains overrideable. */
6
+ /**
7
+ * Structurally compatible Angular factory provider, created by Binder.createRpcClientAndBind. The
8
+ * token remains overrideable and the client is created lazily, on first inject.
9
+ */
8
10
  class RpcClientProvider {
9
11
  provide;
10
12
  api;
@@ -18,8 +20,4 @@ class RpcClientProvider {
18
20
  useFactory = (factory, _config) => factory.createRpcClient(this.api, new ClientConfig_1.ClientConfig(this.destination));
19
21
  }
20
22
  exports.RpcClientProvider = RpcClientProvider;
21
- // webpieces-disable no-function-outside-class -- declarative framework integration seam
22
- function provideRpcClient(token, api, destination) {
23
- return new RpcClientProvider(token, api, destination);
24
- }
25
23
  //# sourceMappingURL=RpcClientProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RpcClientProvider.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/RpcClientProvider.ts"],"names":[],"mappings":";;;AAmBA,4CAMC;AAxBD,yEAAsE;AACtE,iDAA8C;AAE9C,iGAAiG;AACjG,MAAa,iBAAiB;IAIN;IACC;IACA;IALZ,IAAI,GAAG,CAAC,mDAAwB,EAAE,2BAAY,CAAC,CAAC;IAEzD,YACoB,OAAiC,EAChC,GAAoB,EACpB,WAAmB;QAFpB,YAAO,GAAP,OAAO,CAA0B;QAChC,QAAG,GAAH,GAAG,CAAiB;QACpB,gBAAW,GAAX,WAAW,CAAQ;IACrC,CAAC;IAEK,UAAU,GAAG,CAAC,OAAiC,EAAE,OAAqB,EAAK,EAAE,CAClF,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,2BAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;CAC7E;AAXD,8CAWC;AAED,wFAAwF;AACxF,SAAgB,gBAAgB,CAC5B,KAAwC,EACxC,GAAoB,EACpB,WAAmB;IAEnB,OAAO,IAAI,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import type { ApiPrototype } from '@webpieces/http-client-core';\nimport { ClientHttpBrowserFactory } from './ClientHttpBrowserFactory';\nimport { ClientConfig } from './ClientConfig';\n\n/** Structurally compatible Angular factory provider. The original token remains overrideable. */\nexport class RpcClientProvider<T extends object> {\n readonly deps = [ClientHttpBrowserFactory, ClientConfig];\n\n constructor(\n public readonly provide: ApiPrototype<T> | symbol,\n private readonly api: ApiPrototype<T>,\n private readonly destination: string,\n ) {}\n\n readonly useFactory = (factory: ClientHttpBrowserFactory, _config: ClientConfig): T =>\n factory.createRpcClient(this.api, new ClientConfig(this.destination));\n}\n\n// webpieces-disable no-function-outside-class -- declarative framework integration seam\nexport function provideRpcClient<T extends object>(\n token: ApiPrototype<NoInfer<T>> | symbol,\n api: ApiPrototype<T>,\n destination: string,\n): RpcClientProvider<T> {\n return new RpcClientProvider(token, api, destination);\n}\n"]}
1
+ {"version":3,"file":"RpcClientProvider.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/RpcClientProvider.ts"],"names":[],"mappings":";;;AAEA,yEAAsE;AACtE,iDAA8C;AAE9C;;;GAGG;AACH,MAAa,iBAAiB;IAIN;IACC;IACA;IALZ,IAAI,GAAG,CAAC,mDAAwB,EAAE,2BAAY,CAAC,CAAC;IAEzD,YACoB,OAAqB,EACpB,GAAoB,EACpB,WAAmB;QAFpB,YAAO,GAAP,OAAO,CAAc;QACpB,QAAG,GAAH,GAAG,CAAiB;QACpB,gBAAW,GAAX,WAAW,CAAQ;IACrC,CAAC;IAEK,UAAU,GAAG,CAAC,OAAiC,EAAE,OAAqB,EAAK,EAAE,CAClF,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,2BAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;CAC7E;AAXD,8CAWC","sourcesContent":["import type { ApiPrototype } from '@webpieces/http-client-core';\nimport type { BrowserToken } from './BrowserProviders';\nimport { ClientHttpBrowserFactory } from './ClientHttpBrowserFactory';\nimport { ClientConfig } from './ClientConfig';\n\n/**\n * Structurally compatible Angular factory provider, created by Binder.createRpcClientAndBind. The\n * token remains overrideable and the client is created lazily, on first inject.\n */\nexport class RpcClientProvider<T extends object> {\n readonly deps = [ClientHttpBrowserFactory, ClientConfig];\n\n constructor(\n public readonly provide: BrowserToken,\n private readonly api: ApiPrototype<T>,\n private readonly destination: string,\n ) {}\n\n readonly useFactory = (factory: ClientHttpBrowserFactory, _config: ClientConfig): T =>\n factory.createRpcClient(this.api, new ClientConfig(this.destination));\n}\n"]}
package/src/Wiring.d.ts CHANGED
@@ -1,22 +1,35 @@
1
1
  import type { BrowserProvider } from './BrowserProviders';
2
- import type { Wiring as Topology, AppWiring as AppTopology } from '@webpieces/http-client-core';
3
- /** The browser adapter imports neither Angular nor Node runtime or types. */
4
- export declare class BrowserBindings {
5
- readonly providers: BrowserProvider[];
6
- add(provider: BrowserProvider): void;
2
+ import type { ApiPrototype, BindModule as HostBindModule, Wiring as HostWiring, AppWiring as HostAppWiring } from '@webpieces/http-client-core';
3
+ /**
4
+ * Options for {@link Binder.createRpcClientAndBind}. `token` is an EXTRA identity, needed only when two
5
+ * clients of the SAME api must coexist (e.g. one per deployment); omitted, the API class is the token.
6
+ */
7
+ export declare class ClientBindOptions<T> {
8
+ readonly token?: (ApiPrototype<T> | symbol) | undefined;
9
+ constructor(token?: (ApiPrototype<T> | symbol) | undefined);
7
10
  }
8
- export interface BindingModule {
9
- configure(bindings: BrowserBindings): void;
11
+ /**
12
+ * The browser host's binder, handed to every {@link BindModule}.configure. It collects structural
13
+ * provider recipes; the package imports neither Angular nor Node runtime or types.
14
+ */
15
+ export declare class Binder {
16
+ private readonly recipes;
17
+ /** Angular-compatible provider recipes, in order. */
18
+ provide(...recipes: BrowserProvider[]): void;
19
+ /** Registers a lazy factory provider: the client is created from ClientHttpBrowserFactory on first inject. */
20
+ createRpcClientAndBind<T extends object>(api: ApiPrototype<T>, deployment: string, options?: ClientBindOptions<NoInfer<T>>): void;
21
+ get providers(): BrowserProvider[];
10
22
  }
11
- /** Lazy route providers remain separate from domain bindings. */
12
- export interface RouteModule {
13
- configure(bindings: BrowserBindings): void;
23
+ /** A browser DI module. Angular router providers are ordinary provider recipes here. */
24
+ export interface BindModule extends HostBindModule<Binder> {
25
+ configure(binder: Binder): void;
14
26
  }
15
- export interface Wiring extends Topology<BindingModule, RouteModule> {
27
+ /** The browser has no route channel: a Wiring selects bind modules only. */
28
+ export interface Wiring extends HostWiring<BindModule> {
16
29
  }
17
- export interface AppWiring extends AppTopology<BindingModule, RouteModule> {
30
+ export interface AppWiring extends HostAppWiring<BindModule, Wiring> {
18
31
  }
19
- /** Configure the selected domain and route modules once, in topology order. */
32
+ /** Configure the selected bind modules once, in topology order. */
20
33
  export declare class BrowserWiringProviders {
21
34
  toProviders(app: AppWiring): BrowserProvider[];
22
35
  }
package/src/Wiring.js CHANGED
@@ -1,25 +1,46 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BrowserWiringProviders = exports.BrowserBindings = void 0;
3
+ exports.BrowserWiringProviders = exports.Binder = exports.ClientBindOptions = void 0;
4
4
  const http_client_core_1 = require("@webpieces/http-client-core");
5
- /** The browser adapter imports neither Angular nor Node runtime or types. */
6
- class BrowserBindings {
7
- providers = [];
8
- add(provider) {
9
- this.providers.push(provider);
5
+ const RpcClientProvider_1 = require("./RpcClientProvider");
6
+ /**
7
+ * Options for {@link Binder.createRpcClientAndBind}. `token` is an EXTRA identity, needed only when two
8
+ * clients of the SAME api must coexist (e.g. one per deployment); omitted, the API class is the token.
9
+ */
10
+ class ClientBindOptions {
11
+ token;
12
+ constructor(token) {
13
+ this.token = token;
10
14
  }
11
15
  }
12
- exports.BrowserBindings = BrowserBindings;
13
- /** Configure the selected domain and route modules once, in topology order. */
16
+ exports.ClientBindOptions = ClientBindOptions;
17
+ /**
18
+ * The browser host's binder, handed to every {@link BindModule}.configure. It collects structural
19
+ * provider recipes; the package imports neither Angular nor Node runtime or types.
20
+ */
21
+ class Binder {
22
+ recipes = [];
23
+ /** Angular-compatible provider recipes, in order. */
24
+ provide(...recipes) {
25
+ this.recipes.push(...recipes);
26
+ }
27
+ /** Registers a lazy factory provider: the client is created from ClientHttpBrowserFactory on first inject. */
28
+ createRpcClientAndBind(api, deployment, options) {
29
+ const token = options?.token ?? api;
30
+ this.recipes.push(new RpcClientProvider_1.RpcClientProvider(token, api, deployment));
31
+ }
32
+ get providers() {
33
+ return [...this.recipes];
34
+ }
35
+ }
36
+ exports.Binder = Binder;
37
+ /** Configure the selected bind modules once, in topology order. */
14
38
  class BrowserWiringProviders {
15
39
  toProviders(app) {
16
- const modules = new http_client_core_1.WiringModules(app);
17
- const bindings = new BrowserBindings();
18
- for (const module of modules.bindingModules)
19
- module.configure(bindings);
20
- for (const module of modules.routingModules)
21
- module.configure(bindings);
22
- return bindings.providers;
40
+ const binder = new Binder();
41
+ for (const module of new http_client_core_1.WiringModules(app).bindModules)
42
+ module.configure(binder);
43
+ return binder.providers;
23
44
  }
24
45
  }
25
46
  exports.BrowserWiringProviders = BrowserWiringProviders;
package/src/Wiring.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Wiring.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/Wiring.ts"],"names":[],"mappings":";;;AAEA,kEAA4D;AAE5D,6EAA6E;AAC7E,MAAa,eAAe;IACf,SAAS,GAAsB,EAAE,CAAC;IAE3C,GAAG,CAAC,QAAyB;QACzB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClC,CAAC;CACJ;AAND,0CAMC;AAcD,+EAA+E;AAC/E,MAAa,sBAAsB;IAC/B,WAAW,CAAC,GAAc;QACtB,MAAM,OAAO,GAAG,IAAI,gCAAa,CAAC,GAAG,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;QACvC,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,cAAc;YAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACxE,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,cAAc;YAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QACxE,OAAO,QAAQ,CAAC,SAAS,CAAC;IAC9B,CAAC;CACJ;AARD,wDAQC","sourcesContent":["import type { BrowserProvider } from './BrowserProviders';\nimport type { Wiring as Topology, AppWiring as AppTopology } from '@webpieces/http-client-core';\nimport { WiringModules } from '@webpieces/http-client-core';\n\n/** The browser adapter imports neither Angular nor Node runtime or types. */\nexport class BrowserBindings {\n readonly providers: BrowserProvider[] = [];\n\n add(provider: BrowserProvider): void {\n this.providers.push(provider);\n }\n}\n\nexport interface BindingModule {\n configure(bindings: BrowserBindings): void;\n}\n\n/** Lazy route providers remain separate from domain bindings. */\nexport interface RouteModule {\n configure(bindings: BrowserBindings): void;\n}\n\nexport interface Wiring extends Topology<BindingModule, RouteModule> {}\nexport interface AppWiring extends AppTopology<BindingModule, RouteModule> {}\n\n/** Configure the selected domain and route modules once, in topology order. */\nexport class BrowserWiringProviders {\n toProviders(app: AppWiring): BrowserProvider[] {\n const modules = new WiringModules(app);\n const bindings = new BrowserBindings();\n for (const module of modules.bindingModules) module.configure(bindings);\n for (const module of modules.routingModules) module.configure(bindings);\n return bindings.providers;\n }\n}\n"]}
1
+ {"version":3,"file":"Wiring.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/Wiring.ts"],"names":[],"mappings":";;;AAOA,kEAA4D;AAC5D,2DAAwD;AAExD;;;GAGG;AACH,MAAa,iBAAiB;IACE;IAA5B,YAA4B,KAAgC;QAAhC,UAAK,GAAL,KAAK,CAA2B;IAAG,CAAC;CACnE;AAFD,8CAEC;AAED;;;GAGG;AACH,MAAa,MAAM;IACE,OAAO,GAAsB,EAAE,CAAC;IAEjD,qDAAqD;IACrD,OAAO,CAAC,GAAG,OAA0B;QACjC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,8GAA8G;IAC9G,sBAAsB,CAClB,GAAoB,EACpB,UAAkB,EAClB,OAAuC;QAEvC,MAAM,KAAK,GAAiB,OAAO,EAAE,KAAK,IAAI,GAAG,CAAC;QAClD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,qCAAiB,CAAI,KAAK,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;IACxE,CAAC;IAED,IAAI,SAAS;QACT,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;CACJ;AArBD,wBAqBC;AAWD,mEAAmE;AACnE,MAAa,sBAAsB;IAC/B,WAAW,CAAC,GAAc;QACtB,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;QAC5B,KAAK,MAAM,MAAM,IAAI,IAAI,gCAAa,CAAa,GAAG,CAAC,CAAC,WAAW;YAAE,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC9F,OAAO,MAAM,CAAC,SAAS,CAAC;IAC5B,CAAC;CACJ;AAND,wDAMC","sourcesContent":["import type { BrowserProvider, BrowserToken } from './BrowserProviders';\nimport type {\n ApiPrototype,\n BindModule as HostBindModule,\n Wiring as HostWiring,\n AppWiring as HostAppWiring,\n} from '@webpieces/http-client-core';\nimport { WiringModules } from '@webpieces/http-client-core';\nimport { RpcClientProvider } from './RpcClientProvider';\n\n/**\n * Options for {@link Binder.createRpcClientAndBind}. `token` is an EXTRA identity, needed only when two\n * clients of the SAME api must coexist (e.g. one per deployment); omitted, the API class is the token.\n */\nexport class ClientBindOptions<T> {\n constructor(public readonly token?: ApiPrototype<T> | symbol) {}\n}\n\n/**\n * The browser host's binder, handed to every {@link BindModule}.configure. It collects structural\n * provider recipes; the package imports neither Angular nor Node runtime or types.\n */\nexport class Binder {\n private readonly recipes: BrowserProvider[] = [];\n\n /** Angular-compatible provider recipes, in order. */\n provide(...recipes: BrowserProvider[]): void {\n this.recipes.push(...recipes);\n }\n\n /** Registers a lazy factory provider: the client is created from ClientHttpBrowserFactory on first inject. */\n createRpcClientAndBind<T extends object>(\n api: ApiPrototype<T>,\n deployment: string,\n options?: ClientBindOptions<NoInfer<T>>,\n ): void {\n const token: BrowserToken = options?.token ?? api;\n this.recipes.push(new RpcClientProvider<T>(token, api, deployment));\n }\n\n get providers(): BrowserProvider[] {\n return [...this.recipes];\n }\n}\n\n/** A browser DI module. Angular router providers are ordinary provider recipes here. */\nexport interface BindModule extends HostBindModule<Binder> {\n configure(binder: Binder): void;\n}\n\n/** The browser has no route channel: a Wiring selects bind modules only. */\nexport interface Wiring extends HostWiring<BindModule> {}\nexport interface AppWiring extends HostAppWiring<BindModule, Wiring> {}\n\n/** Configure the selected bind modules once, in topology order. */\nexport class BrowserWiringProviders {\n toProviders(app: AppWiring): BrowserProvider[] {\n const binder = new Binder();\n for (const module of new WiringModules<BindModule>(app).bindModules) module.configure(binder);\n return binder.providers;\n }\n}\n"]}
package/src/index.d.ts CHANGED
@@ -36,9 +36,8 @@ export { ContextMgr } from '@webpieces/core-util';
36
36
  export { ContextReader, ContextWriter, ContextStore, ContextKey, HeaderRegistry, ClientRegistry, templateDeriver, WebpiecesCoreHeaders, } from '@webpieces/core-util';
37
37
  export type { ServiceUrlDeriver } from '@webpieces/core-util';
38
38
  export { ApiPath, Endpoint, PathParam, QueryParam, WpAuthPublic, WpAuth, WpAuthorization, AuthorizationType, WpLocalOnly, jwt, oidc, sharedSecret, webhook, apiKey, Rpc, PubSub, Queue, ValidateImplementation, } from '@webpieces/core-util';
39
- export type { Wiring, AppWiring, BindingModule, RouteModule } from './Wiring';
40
- export { BrowserBindings, BrowserWiringProviders } from './Wiring';
39
+ export type { Wiring, AppWiring, BindModule } from './Wiring';
40
+ export { Binder, ClientBindOptions, BrowserWiringProviders } from './Wiring';
41
41
  export { BrowserValueProvider, BrowserClassProvider, BrowserExistingProvider, BrowserFactoryProvider } from './BrowserProviders';
42
42
  export type { BrowserProvider, BrowserToken, BrowserType } from './BrowserProviders';
43
- export { RpcClientProvider, provideRpcClient } from './RpcClientProvider';
44
- export { WiringPolicy, ExternalContractUse } from '@webpieces/http-client-core';
43
+ export { WiringPolicy } from '@webpieces/http-client-core';
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.ExternalContractUse = exports.WiringPolicy = exports.provideRpcClient = exports.RpcClientProvider = exports.BrowserFactoryProvider = exports.BrowserExistingProvider = exports.BrowserClassProvider = exports.BrowserValueProvider = exports.BrowserWiringProviders = exports.BrowserBindings = exports.Queue = exports.PubSub = exports.Rpc = exports.apiKey = exports.webhook = exports.sharedSecret = exports.oidc = exports.jwt = exports.WpLocalOnly = exports.AuthorizationType = exports.WpAuthorization = exports.WpAuth = exports.WpAuthPublic = exports.QueryParam = exports.PathParam = exports.Endpoint = exports.ApiPath = exports.WebpiecesCoreHeaders = exports.templateDeriver = exports.ClientRegistry = exports.HeaderRegistry = exports.ContextKey = exports.ContextMgr = exports.StreamingCapabilityError = exports.RequestOutcome = exports.ClientErrorTranslator = exports.ProxyClient = exports.MutableContextStore = exports.ClientConfig = exports.BrowserApiCallContext = exports.BrowserProxyClient = exports.ClientHttpBrowserFactory = void 0;
28
+ exports.WiringPolicy = exports.BrowserFactoryProvider = exports.BrowserExistingProvider = exports.BrowserClassProvider = exports.BrowserValueProvider = exports.BrowserWiringProviders = exports.ClientBindOptions = exports.Binder = exports.Queue = exports.PubSub = exports.Rpc = exports.apiKey = exports.webhook = exports.sharedSecret = exports.oidc = exports.jwt = exports.WpLocalOnly = exports.AuthorizationType = exports.WpAuthorization = exports.WpAuth = exports.WpAuthPublic = exports.QueryParam = exports.PathParam = exports.Endpoint = exports.ApiPath = exports.WebpiecesCoreHeaders = exports.templateDeriver = exports.ClientRegistry = exports.HeaderRegistry = exports.ContextKey = exports.ContextMgr = exports.StreamingCapabilityError = exports.RequestOutcome = exports.ClientErrorTranslator = exports.ProxyClient = exports.MutableContextStore = exports.ClientConfig = exports.BrowserApiCallContext = 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");
@@ -77,17 +77,14 @@ Object.defineProperty(exports, "Rpc", { enumerable: true, get: function () { ret
77
77
  Object.defineProperty(exports, "PubSub", { enumerable: true, get: function () { return core_util_3.PubSub; } });
78
78
  Object.defineProperty(exports, "Queue", { enumerable: true, get: function () { return core_util_3.Queue; } });
79
79
  var Wiring_1 = require("./Wiring");
80
- Object.defineProperty(exports, "BrowserBindings", { enumerable: true, get: function () { return Wiring_1.BrowserBindings; } });
80
+ Object.defineProperty(exports, "Binder", { enumerable: true, get: function () { return Wiring_1.Binder; } });
81
+ Object.defineProperty(exports, "ClientBindOptions", { enumerable: true, get: function () { return Wiring_1.ClientBindOptions; } });
81
82
  Object.defineProperty(exports, "BrowserWiringProviders", { enumerable: true, get: function () { return Wiring_1.BrowserWiringProviders; } });
82
83
  var BrowserProviders_1 = require("./BrowserProviders");
83
84
  Object.defineProperty(exports, "BrowserValueProvider", { enumerable: true, get: function () { return BrowserProviders_1.BrowserValueProvider; } });
84
85
  Object.defineProperty(exports, "BrowserClassProvider", { enumerable: true, get: function () { return BrowserProviders_1.BrowserClassProvider; } });
85
86
  Object.defineProperty(exports, "BrowserExistingProvider", { enumerable: true, get: function () { return BrowserProviders_1.BrowserExistingProvider; } });
86
87
  Object.defineProperty(exports, "BrowserFactoryProvider", { enumerable: true, get: function () { return BrowserProviders_1.BrowserFactoryProvider; } });
87
- var RpcClientProvider_1 = require("./RpcClientProvider");
88
- Object.defineProperty(exports, "RpcClientProvider", { enumerable: true, get: function () { return RpcClientProvider_1.RpcClientProvider; } });
89
- Object.defineProperty(exports, "provideRpcClient", { enumerable: true, get: function () { return RpcClientProvider_1.provideRpcClient; } });
90
88
  var http_client_core_3 = require("@webpieces/http-client-core");
91
89
  Object.defineProperty(exports, "WiringPolicy", { enumerable: true, get: function () { return http_client_core_3.WiringPolicy; } });
92
- Object.defineProperty(exports, "ExternalContractUse", { enumerable: true, get: function () { return http_client_core_3.ExternalContractUse; } });
93
90
  //# sourceMappingURL=index.js.map
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,4FAA4F;AAC5F,kGAAkG;AAClG,8BAA8B;AAC9B,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAG5B,wEAAwE;AACxE,gEAAiG;AAAxF,+GAAA,WAAW,OAAA;AAAE,yHAAA,qBAAqB,OAAA;AAAE,kHAAA,cAAc,OAAA;AAE3D,gEAAuE;AAA9D,4HAAA,wBAAwB,OAAA;AAEjC,iGAAiG;AACjG,mGAAmG;AACnG,kDAAkD;AAAzC,uGAAA,UAAU,OAAA;AAEnB,yFAAyF;AACzF,kDAS8B;AAL1B,uGAAA,UAAU,OAAA;AACV,2GAAA,cAAc,OAAA;AACd,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AACf,iHAAA,oBAAoB,OAAA;AAIxB,uEAAuE;AACvE,kDAmB8B;AAlB1B,oGAAA,OAAO,OAAA;AACP,qGAAA,QAAQ,OAAA;AACR,sGAAA,SAAS,OAAA;AACT,uGAAA,UAAU,OAAA;AACV,yGAAA,YAAY,OAAA;AACZ,mGAAA,MAAM,OAAA;AACN,4GAAA,eAAe,OAAA;AACf,8GAAA,iBAAiB,OAAA;AACjB,wGAAA,WAAW,OAAA;AACX,gGAAA,GAAG,OAAA;AACH,iGAAA,IAAI,OAAA;AACJ,yGAAA,YAAY,OAAA;AACZ,oGAAA,OAAO,OAAA;AACP,mGAAA,MAAM,OAAA;AACN,gGAAA,GAAG,OAAA;AACH,mGAAA,MAAM,OAAA;AACN,kGAAA,KAAK,OAAA;AAKT,mCAAmE;AAA1D,yGAAA,eAAe,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AAChD,uDAAiI;AAAxH,wHAAA,oBAAoB,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,2HAAA,uBAAuB,OAAA;AAAE,0HAAA,sBAAsB,OAAA;AAEpG,yDAA0E;AAAjE,sHAAA,iBAAiB,OAAA;AAAE,qHAAA,gBAAgB,OAAA;AAE5C,gEAAgF;AAAvE,gHAAA,YAAY,OAAA;AAAE,uHAAA,mBAAmB,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.ALL_HEADERS, 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';\n// Browser impl of the ApiCallContext seam, constructed by BrowserProxyClient. Exported so a\n// browser/Angular logger can read the current tag via the STATIC BrowserApiCallContext.snapshot()\n// and fold it into log lines.\nexport { BrowserApiCallContext } from './BrowserApiCallContext';\nexport { ClientConfig } from './ClientConfig';\nexport { MutableContextStore } from './MutableContextStore';\nexport type { RequestLifecycleListener } from './RequestLifecycleListener';\n\n// The isomorphic engine, re-exported so a browser app needs one import.\nexport { ProxyClient, ClientErrorTranslator, RequestOutcome } from '@webpieces/http-client-core';\nexport type { ApiPrototype } from '@webpieces/http-client-core';\nexport { StreamingCapabilityError } 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 ContextWriter,\n ContextStore,\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 PathParam,\n QueryParam,\n WpAuthPublic,\n WpAuth,\n WpAuthorization,\n AuthorizationType,\n WpLocalOnly,\n jwt,\n oidc,\n sharedSecret,\n webhook,\n apiKey,\n Rpc,\n PubSub,\n Queue,\n ValidateImplementation,\n} from '@webpieces/core-util';\n\nexport type { Wiring, AppWiring, BindingModule, RouteModule } from './Wiring';\nexport { BrowserBindings, BrowserWiringProviders } from './Wiring';\nexport { BrowserValueProvider, BrowserClassProvider, BrowserExistingProvider, BrowserFactoryProvider } from './BrowserProviders';\nexport type { BrowserProvider, BrowserToken, BrowserType } from './BrowserProviders';\nexport { RpcClientProvider, provideRpcClient } from './RpcClientProvider';\n\nexport { WiringPolicy, ExternalContractUse } from '@webpieces/http-client-core';\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,4FAA4F;AAC5F,kGAAkG;AAClG,8BAA8B;AAC9B,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AACrB,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAG5B,wEAAwE;AACxE,gEAAiG;AAAxF,+GAAA,WAAW,OAAA;AAAE,yHAAA,qBAAqB,OAAA;AAAE,kHAAA,cAAc,OAAA;AAE3D,gEAAuE;AAA9D,4HAAA,wBAAwB,OAAA;AAEjC,iGAAiG;AACjG,mGAAmG;AACnG,kDAAkD;AAAzC,uGAAA,UAAU,OAAA;AAEnB,yFAAyF;AACzF,kDAS8B;AAL1B,uGAAA,UAAU,OAAA;AACV,2GAAA,cAAc,OAAA;AACd,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AACf,iHAAA,oBAAoB,OAAA;AAIxB,uEAAuE;AACvE,kDAmB8B;AAlB1B,oGAAA,OAAO,OAAA;AACP,qGAAA,QAAQ,OAAA;AACR,sGAAA,SAAS,OAAA;AACT,uGAAA,UAAU,OAAA;AACV,yGAAA,YAAY,OAAA;AACZ,mGAAA,MAAM,OAAA;AACN,4GAAA,eAAe,OAAA;AACf,8GAAA,iBAAiB,OAAA;AACjB,wGAAA,WAAW,OAAA;AACX,gGAAA,GAAG,OAAA;AACH,iGAAA,IAAI,OAAA;AACJ,yGAAA,YAAY,OAAA;AACZ,oGAAA,OAAO,OAAA;AACP,mGAAA,MAAM,OAAA;AACN,gGAAA,GAAG,OAAA;AACH,mGAAA,MAAM,OAAA;AACN,kGAAA,KAAK,OAAA;AAMT,mCAA6E;AAApE,gGAAA,MAAM,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AAC1D,uDAAiI;AAAxH,wHAAA,oBAAoB,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,2HAAA,uBAAuB,OAAA;AAAE,0HAAA,sBAAsB,OAAA;AAGpG,gEAA2D;AAAlD,gHAAA,YAAY,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.ALL_HEADERS, 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';\n// Browser impl of the ApiCallContext seam, constructed by BrowserProxyClient. Exported so a\n// browser/Angular logger can read the current tag via the STATIC BrowserApiCallContext.snapshot()\n// and fold it into log lines.\nexport { BrowserApiCallContext } from './BrowserApiCallContext';\nexport { ClientConfig } from './ClientConfig';\nexport { MutableContextStore } from './MutableContextStore';\nexport type { RequestLifecycleListener } from './RequestLifecycleListener';\n\n// The isomorphic engine, re-exported so a browser app needs one import.\nexport { ProxyClient, ClientErrorTranslator, RequestOutcome } from '@webpieces/http-client-core';\nexport type { ApiPrototype } from '@webpieces/http-client-core';\nexport { StreamingCapabilityError } 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 ContextWriter,\n ContextStore,\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 PathParam,\n QueryParam,\n WpAuthPublic,\n WpAuth,\n WpAuthorization,\n AuthorizationType,\n WpLocalOnly,\n jwt,\n oidc,\n sharedSecret,\n webhook,\n apiKey,\n Rpc,\n PubSub,\n Queue,\n ValidateImplementation,\n} from '@webpieces/core-util';\n\n// The browser host's wiring: bind modules only (no route channel) and the Binder they configure.\nexport type { Wiring, AppWiring, BindModule } from './Wiring';\nexport { Binder, ClientBindOptions, BrowserWiringProviders } from './Wiring';\nexport { BrowserValueProvider, BrowserClassProvider, BrowserExistingProvider, BrowserFactoryProvider } from './BrowserProviders';\nexport type { BrowserProvider, BrowserToken, BrowserType } from './BrowserProviders';\n\nexport { WiringPolicy } from '@webpieces/http-client-core';\n"]}
@@ -1,4 +0,0 @@
1
- /** Compiled fixtures protect token/API inference after removing destination wrappers. */
2
- export declare class RpcClientProviderCompileAssertions {
3
- check(): void;
4
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RpcClientProviderCompileAssertions = void 0;
4
- const RpcClientProvider_1 = require("./RpcClientProvider");
5
- class TextApi {
6
- }
7
- class CountApi {
8
- }
9
- /** Compiled fixtures protect token/API inference after removing destination wrappers. */
10
- class RpcClientProviderCompileAssertions {
11
- check() {
12
- (0, RpcClientProvider_1.provideRpcClient)(TextApi, TextApi, 'text-service');
13
- // @ts-expect-error Class tokens must match the API contract.
14
- (0, RpcClientProvider_1.provideRpcClient)(CountApi, TextApi, 'text-service');
15
- // @ts-expect-error A service destination is required.
16
- (0, RpcClientProvider_1.provideRpcClient)(TextApi, TextApi);
17
- // @ts-expect-error Wrapper destinations were removed; use a service string.
18
- (0, RpcClientProvider_1.provideRpcClient)(TextApi, TextApi, { serviceName: 'text-service' });
19
- }
20
- }
21
- exports.RpcClientProviderCompileAssertions = RpcClientProviderCompileAssertions;
22
- //# sourceMappingURL=RpcClientProviderCompileAssertions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RpcClientProviderCompileAssertions.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/RpcClientProviderCompileAssertions.ts"],"names":[],"mappings":";;;AAAA,2DAAuD;AAEvD,MAAe,OAAO;CAA6B;AACnD,MAAe,QAAQ;CAA6B;AAEpD,yFAAyF;AACzF,MAAa,kCAAkC;IAC3C,KAAK;QACD,IAAA,oCAAgB,EAAC,OAAO,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACnD,6DAA6D;QAC7D,IAAA,oCAAgB,EAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;QACpD,sDAAsD;QACtD,IAAA,oCAAgB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACnC,4EAA4E;QAC5E,IAAA,oCAAgB,EAAC,OAAO,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;IACxE,CAAC;CACJ;AAVD,gFAUC","sourcesContent":["import { provideRpcClient } from './RpcClientProvider';\n\nabstract class TextApi { abstract read(): string; }\nabstract class CountApi { abstract read(): number; }\n\n/** Compiled fixtures protect token/API inference after removing destination wrappers. */\nexport class RpcClientProviderCompileAssertions {\n check(): void {\n provideRpcClient(TextApi, TextApi, 'text-service');\n // @ts-expect-error Class tokens must match the API contract.\n provideRpcClient(CountApi, TextApi, 'text-service');\n // @ts-expect-error A service destination is required.\n provideRpcClient(TextApi, TextApi);\n // @ts-expect-error Wrapper destinations were removed; use a service string.\n provideRpcClient(TextApi, TextApi, { serviceName: 'text-service' });\n }\n}\n"]}