@webpieces/http-client-core 0.4.869 → 0.4.871
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 +2 -2
- package/src/Wiring.d.ts +29 -14
- package/src/Wiring.js +27 -23
- package/src/Wiring.js.map +1 -1
- package/src/index.d.ts +2 -4
- package/src/index.js +2 -5
- package/src/index.js.map +1 -1
- package/src/ClientToken.d.ts +0 -8
- package/src/ClientToken.js +0 -12
- package/src/ClientToken.js.map +0 -1
- package/src/ExternalContractUse.d.ts +0 -5
- package/src/ExternalContractUse.js +0 -12
- package/src/ExternalContractUse.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/http-client-core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.871",
|
|
4
4
|
"description": "Isomorphic core of the webpieces HTTP client: the decorator-driven ProxyClient, error translation, and the Proxy trap shared by http-client-node and http-client-browser",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@webpieces/core-util": "0.4.
|
|
24
|
+
"@webpieces/core-util": "0.4.871"
|
|
25
25
|
}
|
|
26
26
|
}
|
package/src/Wiring.d.ts
CHANGED
|
@@ -1,15 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
/**
|
|
2
|
+
* One named DI module, for every host. The host hands it the ONE binder it understands: Node's binder
|
|
3
|
+
* wraps an Inversify load, the browser's collects Angular provider recipes. Each host re-exports a
|
|
4
|
+
* non-generic alias, so app code still writes `implements BindModule`.
|
|
5
|
+
*/
|
|
6
|
+
export interface BindModule<B> {
|
|
7
|
+
configure(binder: B): void | Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
/** A library's selectable modules. Hosts with routes (Node) add their route channel on top. */
|
|
10
|
+
export interface Wiring<M> {
|
|
11
|
+
getBindModules(): M[];
|
|
12
|
+
}
|
|
13
|
+
/** Only applications select libraries. */
|
|
14
|
+
export interface AppWiring<M, W extends Wiring<M> = Wiring<M>> extends Wiring<M> {
|
|
15
|
+
getWirings(): W[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The app first, then each selected library in order. A repeated selection is retained (its lists
|
|
19
|
+
* appear again) but each wiring instance's getters run exactly once.
|
|
20
|
+
*/
|
|
21
|
+
export declare class WiringOrder<W> {
|
|
22
|
+
readonly ordered: W[];
|
|
23
|
+
constructor(app: W, libraries: readonly W[]);
|
|
24
|
+
collect<T>(read: (wiring: W) => T[]): T[];
|
|
25
|
+
}
|
|
26
|
+
/** Ordered materialization of the bind channel; preserves configured instances and repeated selections. */
|
|
27
|
+
export declare class WiringModules<M> {
|
|
28
|
+
readonly bindModules: M[];
|
|
29
|
+
constructor(app: AppWiring<M>);
|
|
15
30
|
}
|
package/src/Wiring.js
CHANGED
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WiringModules = void 0;
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
exports.WiringModules = exports.WiringOrder = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The app first, then each selected library in order. A repeated selection is retained (its lists
|
|
6
|
+
* appear again) but each wiring instance's getters run exactly once.
|
|
7
|
+
*/
|
|
8
|
+
class WiringOrder {
|
|
9
|
+
ordered;
|
|
10
|
+
constructor(app, libraries) {
|
|
11
|
+
this.ordered = [app, ...libraries];
|
|
12
|
+
}
|
|
13
|
+
collect(read) {
|
|
14
|
+
const cache = new Map();
|
|
15
|
+
const result = [];
|
|
16
|
+
for (const wiring of this.ordered) {
|
|
17
|
+
let list = cache.get(wiring);
|
|
18
|
+
if (list === undefined) {
|
|
19
|
+
list = [...read(wiring)];
|
|
20
|
+
cache.set(wiring, list);
|
|
17
21
|
}
|
|
18
|
-
|
|
19
|
-
this.routingModules.push(...lists.routes);
|
|
22
|
+
result.push(...list);
|
|
20
23
|
}
|
|
24
|
+
return result;
|
|
21
25
|
}
|
|
22
26
|
}
|
|
23
|
-
exports.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
constructor(
|
|
28
|
-
this.
|
|
29
|
-
this.routes = routes;
|
|
27
|
+
exports.WiringOrder = WiringOrder;
|
|
28
|
+
/** Ordered materialization of the bind channel; preserves configured instances and repeated selections. */
|
|
29
|
+
class WiringModules {
|
|
30
|
+
bindModules;
|
|
31
|
+
constructor(app) {
|
|
32
|
+
this.bindModules = new WiringOrder(app, app.getWirings()).collect((wiring) => wiring.getBindModules());
|
|
30
33
|
}
|
|
31
34
|
}
|
|
35
|
+
exports.WiringModules = WiringModules;
|
|
32
36
|
//# sourceMappingURL=Wiring.js.map
|
package/src/Wiring.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wiring.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/src/Wiring.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Wiring.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/src/Wiring.ts"],"names":[],"mappings":";;;AAmBA;;;GAGG;AACH,MAAa,WAAW;IACX,OAAO,CAAM;IAEtB,YAAY,GAAM,EAAE,SAAuB;QACvC,IAAI,CAAC,OAAO,GAAG,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,CAAI,IAAwB;QAC/B,MAAM,KAAK,GAAG,IAAI,GAAG,EAAU,CAAC;QAChC,MAAM,MAAM,GAAQ,EAAE,CAAC;QACvB,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAChC,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAC7B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACrB,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;gBACzB,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC5B,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QACzB,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AApBD,kCAoBC;AAED,2GAA2G;AAC3G,MAAa,aAAa;IACb,WAAW,CAAM;IAE1B,YAAY,GAAiB;QACzB,IAAI,CAAC,WAAW,GAAG,IAAI,WAAW,CAAY,GAAG,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,OAAO,CACxE,CAAC,MAAiB,EAAE,EAAE,CAAC,MAAM,CAAC,cAAc,EAAE,CACjD,CAAC;IACN,CAAC;CACJ;AARD,sCAQC","sourcesContent":["/**\n * One named DI module, for every host. The host hands it the ONE binder it understands: Node's binder\n * wraps an Inversify load, the browser's collects Angular provider recipes. Each host re-exports a\n * non-generic alias, so app code still writes `implements BindModule`.\n */\nexport interface BindModule<B> {\n configure(binder: B): void | Promise<void>;\n}\n\n/** A library's selectable modules. Hosts with routes (Node) add their route channel on top. */\nexport interface Wiring<M> {\n getBindModules(): M[];\n}\n\n/** Only applications select libraries. */\nexport interface AppWiring<M, W extends Wiring<M> = Wiring<M>> extends Wiring<M> {\n getWirings(): W[];\n}\n\n/**\n * The app first, then each selected library in order. A repeated selection is retained (its lists\n * appear again) but each wiring instance's getters run exactly once.\n */\nexport class WiringOrder<W> {\n readonly ordered: W[];\n\n constructor(app: W, libraries: readonly W[]) {\n this.ordered = [app, ...libraries];\n }\n\n collect<T>(read: (wiring: W) => T[]): T[] {\n const cache = new Map<W, T[]>();\n const result: T[] = [];\n for (const wiring of this.ordered) {\n let list = cache.get(wiring);\n if (list === undefined) {\n list = [...read(wiring)];\n cache.set(wiring, list);\n }\n result.push(...list);\n }\n return result;\n }\n}\n\n/** Ordered materialization of the bind channel; preserves configured instances and repeated selections. */\nexport class WiringModules<M> {\n readonly bindModules: M[];\n\n constructor(app: AppWiring<M>) {\n this.bindModules = new WiringOrder<Wiring<M>>(app, app.getWirings()).collect(\n (wiring: Wiring<M>) => wiring.getBindModules(),\n );\n }\n}\n"]}
|
package/src/index.d.ts
CHANGED
|
@@ -40,8 +40,6 @@ export { SseEvent, SseEventParser } from './SseEventParser';
|
|
|
40
40
|
export { StreamingCapabilityError } from './StreamingCapabilityError';
|
|
41
41
|
export { Utf8Codec } from './Utf8Codec';
|
|
42
42
|
export type { ByteReadableStream, ByteStreamReader, ByteReadResult } from './ByteStream';
|
|
43
|
-
export type { Wiring, AppWiring } from './Wiring';
|
|
44
|
-
export { WiringModules } from './Wiring';
|
|
45
|
-
export { ClientToken } from './ClientToken';
|
|
46
|
-
export { ExternalContractUse } from './ExternalContractUse';
|
|
43
|
+
export type { BindModule, Wiring, AppWiring } from './Wiring';
|
|
44
|
+
export { WiringModules, WiringOrder } from './Wiring';
|
|
47
45
|
export { WiringPolicy } from './WiringPolicy';
|
package/src/index.js
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
* a browser bundle, and nothing browser-only (a ContextReader store) reaches a server.
|
|
27
27
|
*/
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.WiringPolicy = exports.
|
|
29
|
+
exports.WiringPolicy = exports.WiringOrder = exports.WiringModules = exports.Utf8Codec = exports.StreamingCapabilityError = exports.SseEventParser = exports.SseEvent = exports.ClientFilterDefinition = exports.ClientRequest = exports.ResponseBodyReader = exports.RequestBodySerializer = exports.HttpResponseDtoFactory = exports.ClientErrorTranslator = exports.buildClientProxy = exports.RequestOutcome = exports.ProxyClient = void 0;
|
|
30
30
|
var ProxyClient_1 = require("./ProxyClient");
|
|
31
31
|
Object.defineProperty(exports, "ProxyClient", { enumerable: true, get: function () { return ProxyClient_1.ProxyClient; } });
|
|
32
32
|
var RequestOutcome_1 = require("./RequestOutcome");
|
|
@@ -61,10 +61,7 @@ var Utf8Codec_1 = require("./Utf8Codec");
|
|
|
61
61
|
Object.defineProperty(exports, "Utf8Codec", { enumerable: true, get: function () { return Utf8Codec_1.Utf8Codec; } });
|
|
62
62
|
var Wiring_1 = require("./Wiring");
|
|
63
63
|
Object.defineProperty(exports, "WiringModules", { enumerable: true, get: function () { return Wiring_1.WiringModules; } });
|
|
64
|
-
|
|
65
|
-
Object.defineProperty(exports, "ClientToken", { enumerable: true, get: function () { return ClientToken_1.ClientToken; } });
|
|
66
|
-
var ExternalContractUse_1 = require("./ExternalContractUse");
|
|
67
|
-
Object.defineProperty(exports, "ExternalContractUse", { enumerable: true, get: function () { return ExternalContractUse_1.ExternalContractUse; } });
|
|
64
|
+
Object.defineProperty(exports, "WiringOrder", { enumerable: true, get: function () { return Wiring_1.WiringOrder; } });
|
|
68
65
|
var WiringPolicy_1 = require("./WiringPolicy");
|
|
69
66
|
Object.defineProperty(exports, "WiringPolicy", { enumerable: true, get: function () { return WiringPolicy_1.WiringPolicy; } });
|
|
70
67
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAEH,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,mDAAkD;AAAzC,gHAAA,cAAc,OAAA;AA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OAAA;AAAE,gHAAA,cAAc,OAAA;AACjC,uEAAsE;AAA7D,oIAAA,wBAAwB,OAAA;AACjC,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAIlB,mCAAsD;AAA7C,uGAAA,aAAa,OAAA;AAAE,qGAAA,WAAW,OAAA;AACnC,+CAA8C;AAArC,4GAAA,YAAY,OAAA","sourcesContent":["/**\n * @webpieces/http-client-core\n *\n * The ISOMORPHIC core of the webpieces HTTP client — everything that reads an API contract's\n * decorators and turns a method call into an HTTP request, with no opinion about where the\n * magic context comes from or whether a DI container exists.\n *\n * You almost certainly want one of its two environment packages instead:\n * - Server: @webpieces/http-client-node (inversify-wired, reads RequestContext, mints OIDC)\n * - Browser: @webpieces/http-client-browser (no DI — React or Angular, app-managed context store)\n *\n * Architecture:\n * ```\n * http-api (defines the contract)\n * ^\n * +-- http-routing (server: contract -> handlers)\n * +-- http-client-core (contract -> HTTP requests) <- YOU ARE HERE\n * +-- http-client-node (RequestContext + Secrets + OIDC + inversify factory)\n * +-- http-client-browser (app-held store + plain factory, no DI)\n * ```\n *\n * There is no context/credential/recording seam here at all: ProxyClient is ABSTRACT and asks its\n * subclass for the base URL, the context headers, the log map, the outbound credential, and the\n * recorder. Nothing server-only (RequestContext, Secrets, mintIdToken, TestCaseRecorder) can reach\n * a browser bundle, and nothing browser-only (a ContextReader store) reaches a server.\n */\n\nexport { ProxyClient } from './ProxyClient';\nexport { RequestOutcome } from './RequestOutcome';\nexport type { ApiPrototype } from './ApiPrototype';\nexport { buildClientProxy } from './buildClientProxy';\nexport { ClientErrorTranslator } from './ClientErrorTranslator';\n// The CLIENT-side transport boundary: a fetch Response becomes the ONE HttpResponseDto an app's\n// ErrorTranslator sees, so node and browser hand `fromWire` the identical shape.\nexport { HttpResponseDtoFactory } from './HttpResponseDtoFactory';\nexport { RequestBodySerializer } from './RequestBodySerializer';\nexport { ResponseBodyReader } from './ResponseBodyReader';\n// The OUTBOUND filter chain: the mutable request a filter edits, and one registration of a filter\n// at a priority. The `Filter`/`Service`/`FilterChain` abstraction itself lives in\n// @webpieces/core-util, shared with the server's inbound chain.\nexport { ClientRequest } from './ClientRequest';\nexport type { HttpTransport } from './HttpTransport';\nexport { ClientFilterDefinition } from './ClientFilter';\nexport type { ClientFilter } from './ClientFilter';\n// Generic streaming wire adapters: NDJSON uploads, request-scoped SSE downloads, and a typed\n// capability failure for runtimes that cannot safely keep both fetch halves open concurrently.\nexport { SseEvent, SseEventParser } from './SseEventParser';\nexport { StreamingCapabilityError } from './StreamingCapabilityError';\nexport { Utf8Codec } from './Utf8Codec';\nexport type { ByteReadableStream, ByteStreamReader, ByteReadResult } from './ByteStream';\n\nexport type { BindModule, Wiring, AppWiring } from './Wiring';\nexport { WiringModules, WiringOrder } from './Wiring';\nexport { WiringPolicy } from './WiringPolicy';\n"]}
|
package/src/ClientToken.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
declare const clientTokenContract: unique symbol;
|
|
2
|
-
/** Opt-in invariant contract type for a local DI token; legacy symbols remain supported. */
|
|
3
|
-
export declare class ClientToken<T extends object> {
|
|
4
|
-
readonly identifier: symbol;
|
|
5
|
-
readonly [clientTokenContract]: (value: T) => T;
|
|
6
|
-
constructor(identifier: symbol);
|
|
7
|
-
}
|
|
8
|
-
export {};
|
package/src/ClientToken.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ClientToken = void 0;
|
|
4
|
-
/** Opt-in invariant contract type for a local DI token; legacy symbols remain supported. */
|
|
5
|
-
class ClientToken {
|
|
6
|
-
identifier;
|
|
7
|
-
constructor(identifier) {
|
|
8
|
-
this.identifier = identifier;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.ClientToken = ClientToken;
|
|
12
|
-
//# sourceMappingURL=ClientToken.js.map
|
package/src/ClientToken.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientToken.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/src/ClientToken.ts"],"names":[],"mappings":";;;AAEA,4FAA4F;AAC5F,MAAa,WAAW;IAEQ;IAA5B,YAA4B,UAAkB;QAAlB,eAAU,GAAV,UAAU,CAAQ;IAAG,CAAC;CACrD;AAHD,kCAGC","sourcesContent":["declare const clientTokenContract: unique symbol;\n\n/** Opt-in invariant contract type for a local DI token; legacy symbols remain supported. */\nexport class ClientToken<T extends object> {\n declare readonly [clientTokenContract]: (value: T) => T;\n constructor(public readonly identifier: symbol) {}\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExternalContractUse = void 0;
|
|
4
|
-
/** An erased vendor interface's qualified identity; this metadata never binds or instantiates an SDK. */
|
|
5
|
-
class ExternalContractUse {
|
|
6
|
-
contract;
|
|
7
|
-
constructor(contract) {
|
|
8
|
-
this.contract = contract;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.ExternalContractUse = ExternalContractUse;
|
|
12
|
-
//# sourceMappingURL=ExternalContractUse.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalContractUse.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/src/ExternalContractUse.ts"],"names":[],"mappings":";;;AAAA,yGAAyG;AACzG,MAAa,mBAAmB;IACA;IAA5B,YAA4B,QAA+B;QAA/B,aAAQ,GAAR,QAAQ,CAAuB;IAAG,CAAC;CAClE;AAFD,kDAEC","sourcesContent":["/** An erased vendor interface's qualified identity; this metadata never binds or instantiates an SDK. */\nexport class ExternalContractUse {\n constructor(public readonly contract: `${string}#${string}`) {}\n}\n"]}
|