@webpieces/http-client-browser 0.4.853 → 0.4.855
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 +3 -3
- package/src/BrowserWiring.d.ts +6 -0
- package/src/BrowserWiring.js +15 -0
- package/src/BrowserWiring.js.map +1 -0
- package/src/RpcClientProvider.d.ts +13 -0
- package/src/RpcClientProvider.js +25 -0
- package/src/RpcClientProvider.js.map +1 -0
- package/src/index.d.ts +5 -1
- package/src/index.js +8 -1
- package/src/index.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/http-client-browser",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.855",
|
|
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.
|
|
26
|
-
"@webpieces/http-client-core": "0.4.
|
|
25
|
+
"@webpieces/core-util": "0.4.855",
|
|
26
|
+
"@webpieces/http-client-core": "0.4.855"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrowserWiring = void 0;
|
|
4
|
+
/** A framework-owned provider list; no Angular or Node runtime is imported here. */
|
|
5
|
+
class BrowserWiring {
|
|
6
|
+
providers;
|
|
7
|
+
constructor(providers) {
|
|
8
|
+
this.providers = providers;
|
|
9
|
+
}
|
|
10
|
+
toProviders() {
|
|
11
|
+
return [...this.providers];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.BrowserWiring = BrowserWiring;
|
|
15
|
+
//# sourceMappingURL=BrowserWiring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserWiring.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-browser/src/BrowserWiring.ts"],"names":[],"mappings":";;;AAAA,oFAAoF;AACpF,MAAa,aAAa;IACO;IAA7B,YAA6B,SAAuB;QAAvB,cAAS,GAAT,SAAS,CAAc;IAAG,CAAC;IAExD,WAAW;QACP,OAAO,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;CACJ;AAND,sCAMC","sourcesContent":["/** A framework-owned provider list; no Angular or Node runtime is imported here. */\nexport class BrowserWiring<P> {\n constructor(private readonly providers: readonly P[]) {}\n\n toProviders(): P[] {\n return [...this.providers];\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ApiPrototype, RpcTarget } from '@webpieces/http-client-core';
|
|
2
|
+
import { ClientHttpBrowserFactory } from './ClientHttpBrowserFactory';
|
|
3
|
+
import { ClientConfig } from './ClientConfig';
|
|
4
|
+
/** Structurally compatible Angular factory provider. The original token remains overrideable. */
|
|
5
|
+
export declare class RpcClientProvider<T extends object> {
|
|
6
|
+
readonly provide: ApiPrototype<T> | symbol;
|
|
7
|
+
private readonly api;
|
|
8
|
+
private readonly target;
|
|
9
|
+
readonly deps: (typeof ClientConfig | typeof ClientHttpBrowserFactory)[];
|
|
10
|
+
constructor(provide: ApiPrototype<T> | symbol, api: ApiPrototype<T>, target: RpcTarget<T>);
|
|
11
|
+
readonly useFactory: (factory: ClientHttpBrowserFactory, _config: ClientConfig) => T;
|
|
12
|
+
}
|
|
13
|
+
export declare function provideRpcClient<T extends object>(token: ApiPrototype<NoInfer<T>> | symbol, api: ApiPrototype<T>, target: RpcTarget<NoInfer<T>>): RpcClientProvider<T>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RpcClientProvider = void 0;
|
|
4
|
+
exports.provideRpcClient = provideRpcClient;
|
|
5
|
+
const ClientHttpBrowserFactory_1 = require("./ClientHttpBrowserFactory");
|
|
6
|
+
const ClientConfig_1 = require("./ClientConfig");
|
|
7
|
+
/** Structurally compatible Angular factory provider. The original token remains overrideable. */
|
|
8
|
+
class RpcClientProvider {
|
|
9
|
+
provide;
|
|
10
|
+
api;
|
|
11
|
+
target;
|
|
12
|
+
deps = [ClientHttpBrowserFactory_1.ClientHttpBrowserFactory, ClientConfig_1.ClientConfig];
|
|
13
|
+
constructor(provide, api, target) {
|
|
14
|
+
this.provide = provide;
|
|
15
|
+
this.api = api;
|
|
16
|
+
this.target = target;
|
|
17
|
+
}
|
|
18
|
+
useFactory = (factory, _config) => factory.createRpcClient(this.api, new ClientConfig_1.ClientConfig(this.target.serviceName));
|
|
19
|
+
}
|
|
20
|
+
exports.RpcClientProvider = RpcClientProvider;
|
|
21
|
+
// webpieces-disable no-function-outside-class -- declarative framework integration seam
|
|
22
|
+
function provideRpcClient(token, api, target) {
|
|
23
|
+
return new RpcClientProvider(token, api, target);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=RpcClientProvider.js.map
|
|
@@ -0,0 +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,MAAoB;QAFrB,YAAO,GAAP,OAAO,CAA0B;QAChC,QAAG,GAAH,GAAG,CAAiB;QACpB,WAAM,GAAN,MAAM,CAAc;IACtC,CAAC;IAEK,UAAU,GAAG,CAAC,OAAiC,EAAE,OAAqB,EAAK,EAAE,CAClF,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,2BAAY,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;CACpF;AAXD,8CAWC;AAED,wFAAwF;AACxF,SAAgB,gBAAgB,CAC5B,KAAwC,EACxC,GAAoB,EACpB,MAA6B;IAE7B,OAAO,IAAI,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AACrD,CAAC","sourcesContent":["import type { ApiPrototype, RpcTarget } 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 target: RpcTarget<T>,\n ) {}\n\n readonly useFactory = (factory: ClientHttpBrowserFactory, _config: ClientConfig): T =>\n factory.createRpcClient(this.api, new ClientConfig(this.target.serviceName));\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 target: RpcTarget<NoInfer<T>>,\n): RpcClientProvider<T> {\n return new RpcClientProvider(token, api, target);\n}\n"]}
|
package/src/index.d.ts
CHANGED
|
@@ -29,10 +29,14 @@ export { BrowserApiCallContext } from './BrowserApiCallContext';
|
|
|
29
29
|
export { ClientConfig } from './ClientConfig';
|
|
30
30
|
export { MutableContextStore } from './MutableContextStore';
|
|
31
31
|
export type { RequestLifecycleListener } from './RequestLifecycleListener';
|
|
32
|
-
export { ProxyClient, ClientErrorTranslator, RequestOutcome
|
|
32
|
+
export { ProxyClient, ClientErrorTranslator, RequestOutcome } from '@webpieces/http-client-core';
|
|
33
33
|
export type { ApiPrototype } from '@webpieces/http-client-core';
|
|
34
34
|
export { StreamingCapabilityError } from '@webpieces/http-client-core';
|
|
35
35
|
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, WpAuthJwt, WpAuthOidc, WpAuthSharedSecret, WpAuthLocalOnly, Rpc, PubSub, Queue, ValidateImplementation, } from '@webpieces/core-util';
|
|
39
|
+
export { BrowserWiring } from './BrowserWiring';
|
|
40
|
+
export { RpcClientProvider, provideRpcClient } from './RpcClientProvider';
|
|
41
|
+
export { rpcTarget } from '@webpieces/http-client-core';
|
|
42
|
+
export type { RpcTarget } 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.Queue = exports.PubSub = exports.Rpc = exports.WpAuthLocalOnly = exports.WpAuthSharedSecret = exports.WpAuthOidc = exports.WpAuthJwt = 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.rpcTarget = exports.provideRpcClient = exports.RpcClientProvider = exports.BrowserWiring = exports.Queue = exports.PubSub = exports.Rpc = exports.WpAuthLocalOnly = exports.WpAuthSharedSecret = exports.WpAuthOidc = exports.WpAuthJwt = 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");
|
|
@@ -71,4 +71,11 @@ Object.defineProperty(exports, "WpAuthLocalOnly", { enumerable: true, get: funct
|
|
|
71
71
|
Object.defineProperty(exports, "Rpc", { enumerable: true, get: function () { return core_util_3.Rpc; } });
|
|
72
72
|
Object.defineProperty(exports, "PubSub", { enumerable: true, get: function () { return core_util_3.PubSub; } });
|
|
73
73
|
Object.defineProperty(exports, "Queue", { enumerable: true, get: function () { return core_util_3.Queue; } });
|
|
74
|
+
var BrowserWiring_1 = require("./BrowserWiring");
|
|
75
|
+
Object.defineProperty(exports, "BrowserWiring", { enumerable: true, get: function () { return BrowserWiring_1.BrowserWiring; } });
|
|
76
|
+
var RpcClientProvider_1 = require("./RpcClientProvider");
|
|
77
|
+
Object.defineProperty(exports, "RpcClientProvider", { enumerable: true, get: function () { return RpcClientProvider_1.RpcClientProvider; } });
|
|
78
|
+
Object.defineProperty(exports, "provideRpcClient", { enumerable: true, get: function () { return RpcClientProvider_1.provideRpcClient; } });
|
|
79
|
+
var http_client_core_3 = require("@webpieces/http-client-core");
|
|
80
|
+
Object.defineProperty(exports, "rpcTarget", { enumerable: true, get: function () { return http_client_core_3.rpcTarget; } });
|
|
74
81
|
//# 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,
|
|
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,kDAc8B;AAb1B,oGAAA,OAAO,OAAA;AACP,qGAAA,QAAQ,OAAA;AACR,sGAAA,SAAS,OAAA;AACT,uGAAA,UAAU,OAAA;AACV,yGAAA,YAAY,OAAA;AACZ,sGAAA,SAAS,OAAA;AACT,uGAAA,UAAU,OAAA;AACV,+GAAA,kBAAkB,OAAA;AAClB,4GAAA,eAAe,OAAA;AACf,gGAAA,GAAG,OAAA;AACH,mGAAA,MAAM,OAAA;AACN,kGAAA,KAAK,OAAA;AAIT,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,yDAA0E;AAAjE,sHAAA,iBAAiB,OAAA;AAAE,qHAAA,gBAAgB,OAAA;AAC5C,gEAAwD;AAA/C,6GAAA,SAAS,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 WpAuthJwt,\n WpAuthOidc,\n WpAuthSharedSecret,\n WpAuthLocalOnly,\n Rpc,\n PubSub,\n Queue,\n ValidateImplementation,\n} from '@webpieces/core-util';\n\nexport { BrowserWiring } from './BrowserWiring';\nexport { RpcClientProvider, provideRpcClient } from './RpcClientProvider';\nexport { rpcTarget } from '@webpieces/http-client-core';\nexport type { RpcTarget } from '@webpieces/http-client-core';\n"]}
|