@webpieces/http-client-core 0.4.865 → 0.4.867

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-core",
3
- "version": "0.4.865",
3
+ "version": "0.4.867",
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.865"
24
+ "@webpieces/core-util": "0.4.867"
25
25
  }
26
26
  }
@@ -0,0 +1,15 @@
1
+ /** Platform adapters supply their own module types; topology stays transport independent. */
2
+ export interface Wiring<B, R> {
3
+ getBindingModules(): B[];
4
+ getRoutingModules(): R[];
5
+ }
6
+ /** Only applications select libraries. Libraries expose their own two module channels. */
7
+ export interface AppWiring<B, R> extends Wiring<B, R> {
8
+ getWirings(): Wiring<B, R>[];
9
+ }
10
+ /** Ordered materialization preserves configured instances and repeated selections. */
11
+ export declare class WiringModules<B, R> {
12
+ readonly bindingModules: B[];
13
+ readonly routingModules: R[];
14
+ constructor(app: AppWiring<B, R>);
15
+ }
package/src/Wiring.js ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WiringModules = void 0;
4
+ /** Ordered materialization preserves configured instances and repeated selections. */
5
+ class WiringModules {
6
+ bindingModules;
7
+ routingModules;
8
+ constructor(app) {
9
+ this.bindingModules = [...app.getBindingModules()];
10
+ this.routingModules = [...app.getRoutingModules()];
11
+ const selected = new Map();
12
+ for (const library of app.getWirings()) {
13
+ let lists = selected.get(library);
14
+ if (lists === undefined) {
15
+ lists = new WiringLists(library.getBindingModules(), library.getRoutingModules());
16
+ selected.set(library, lists);
17
+ }
18
+ this.bindingModules.push(...lists.bindings);
19
+ this.routingModules.push(...lists.routes);
20
+ }
21
+ }
22
+ }
23
+ exports.WiringModules = WiringModules;
24
+ class WiringLists {
25
+ bindings;
26
+ routes;
27
+ constructor(bindings, routes) {
28
+ this.bindings = bindings;
29
+ this.routes = routes;
30
+ }
31
+ }
32
+ //# sourceMappingURL=Wiring.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Wiring.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/src/Wiring.ts"],"names":[],"mappings":";;;AAWA,sFAAsF;AACtF,MAAa,aAAa;IACb,cAAc,CAAM;IACpB,cAAc,CAAM;IAE7B,YAAY,GAAoB;QAC5B,IAAI,CAAC,cAAc,GAAG,CAAC,GAAG,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,cAAc,GAAG,CAAC,GAAG,GAAG,CAAC,iBAAiB,EAAE,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAmC,CAAC;QAC5D,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,UAAU,EAAE,EAAE,CAAC;YACrC,IAAI,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAClC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACtB,KAAK,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;gBAClF,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YACjC,CAAC;YACD,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;YAC5C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC;CACJ;AAlBD,sCAkBC;AAED,MAAM,WAAW;IACQ;IAAwB;IAA7C,YAAqB,QAAa,EAAW,MAAW;QAAnC,aAAQ,GAAR,QAAQ,CAAK;QAAW,WAAM,GAAN,MAAM,CAAK;IAAG,CAAC;CAC/D","sourcesContent":["/** Platform adapters supply their own module types; topology stays transport independent. */\nexport interface Wiring<B, R> {\n getBindingModules(): B[];\n getRoutingModules(): R[];\n}\n\n/** Only applications select libraries. Libraries expose their own two module channels. */\nexport interface AppWiring<B, R> extends Wiring<B, R> {\n getWirings(): Wiring<B, R>[];\n}\n\n/** Ordered materialization preserves configured instances and repeated selections. */\nexport class WiringModules<B, R> {\n readonly bindingModules: B[];\n readonly routingModules: R[];\n\n constructor(app: AppWiring<B, R>) {\n this.bindingModules = [...app.getBindingModules()];\n this.routingModules = [...app.getRoutingModules()];\n const selected = new Map<Wiring<B, R>, WiringLists<B, R>>();\n for (const library of app.getWirings()) {\n let lists = selected.get(library);\n if (lists === undefined) {\n lists = new WiringLists(library.getBindingModules(), library.getRoutingModules());\n selected.set(library, lists);\n }\n this.bindingModules.push(...lists.bindings);\n this.routingModules.push(...lists.routes);\n }\n }\n}\n\nclass WiringLists<B, R> {\n constructor(readonly bindings: B[], readonly routes: R[]) {}\n}\n"]}
package/src/index.d.ts CHANGED
@@ -40,8 +40,8 @@ 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 { rpcTarget } from './RpcTarget';
44
- export type { RpcTarget } from './RpcTarget';
43
+ export type { Wiring, AppWiring } from './Wiring';
44
+ export { WiringModules } from './Wiring';
45
45
  export { ClientToken } from './ClientToken';
46
46
  export { ExternalContractUse } from './ExternalContractUse';
47
47
  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.ExternalContractUse = exports.ClientToken = exports.rpcTarget = 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;
29
+ exports.WiringPolicy = exports.ExternalContractUse = exports.ClientToken = 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");
@@ -59,8 +59,8 @@ var StreamingCapabilityError_1 = require("./StreamingCapabilityError");
59
59
  Object.defineProperty(exports, "StreamingCapabilityError", { enumerable: true, get: function () { return StreamingCapabilityError_1.StreamingCapabilityError; } });
60
60
  var Utf8Codec_1 = require("./Utf8Codec");
61
61
  Object.defineProperty(exports, "Utf8Codec", { enumerable: true, get: function () { return Utf8Codec_1.Utf8Codec; } });
62
- var RpcTarget_1 = require("./RpcTarget");
63
- Object.defineProperty(exports, "rpcTarget", { enumerable: true, get: function () { return RpcTarget_1.rpcTarget; } });
62
+ var Wiring_1 = require("./Wiring");
63
+ Object.defineProperty(exports, "WiringModules", { enumerable: true, get: function () { return Wiring_1.WiringModules; } });
64
64
  var ClientToken_1 = require("./ClientToken");
65
65
  Object.defineProperty(exports, "ClientToken", { enumerable: true, get: function () { return ClientToken_1.ClientToken; } });
66
66
  var ExternalContractUse_1 = require("./ExternalContractUse");
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;AAEvB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,gGAAgG;AAChG,iFAAiF;AACjF,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,kGAAkG;AAClG,kFAAkF;AAClF,gEAAgE;AAChE,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AAEtB,+CAAwD;AAA/C,sHAAA,sBAAsB,OAAA;AAE/B,6FAA6F;AAC7F,+FAA+F;AAC/F,mDAA4D;AAAnD,0GAAA,QAAQ,OAAA;AAAE,gHAAA,cAAc,OAAA;AACjC,uEAAsE;AAA7D,oIAAA,wBAAwB,OAAA;AACjC,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAGlB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAElB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,+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 { rpcTarget } from './RpcTarget';\nexport type { RpcTarget } from './RpcTarget';\nexport { ClientToken } from './ClientToken';\nexport { ExternalContractUse } from './ExternalContractUse';\nexport { WiringPolicy } from './WiringPolicy';\n"]}
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;AAEvB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,gGAAgG;AAChG,iFAAiF;AACjF,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,iEAAgE;AAAvD,8HAAA,qBAAqB,OAAA;AAC9B,2DAA0D;AAAjD,wHAAA,kBAAkB,OAAA;AAC3B,kGAAkG;AAClG,kFAAkF;AAClF,gEAAgE;AAChE,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AAEtB,+CAAwD;AAA/C,sHAAA,sBAAsB,OAAA;AAE/B,6FAA6F;AAC7F,+FAA+F;AAC/F,mDAA4D;AAAnD,0GAAA,QAAQ,OAAA;AAAE,gHAAA,cAAc,OAAA;AACjC,uEAAsE;AAA7D,oIAAA,wBAAwB,OAAA;AACjC,yCAAwC;AAA/B,sGAAA,SAAS,OAAA;AAIlB,mCAAyC;AAAhC,uGAAA,aAAa,OAAA;AACtB,6CAA4C;AAAnC,0GAAA,WAAW,OAAA;AACpB,6DAA4D;AAAnD,0HAAA,mBAAmB,OAAA;AAC5B,+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 { Wiring, AppWiring } from './Wiring';\nexport { WiringModules } from './Wiring';\nexport { ClientToken } from './ClientToken';\nexport { ExternalContractUse } from './ExternalContractUse';\nexport { WiringPolicy } from './WiringPolicy';\n"]}
@@ -1,11 +0,0 @@
1
- import type { ApiPrototype } from './ApiPrototype';
2
- declare const rpcTargetContract: unique symbol;
3
- /** A contract capability at one deployment. URLs and credentials stay in the registry. */
4
- declare class RpcTarget<T extends object> {
5
- readonly api: ApiPrototype<T>;
6
- readonly serviceName: string;
7
- readonly [rpcTargetContract]: (value: T) => T;
8
- constructor(api: ApiPrototype<T>, serviceName: string);
9
- }
10
- export declare function rpcTarget<T extends object>(api: ApiPrototype<T>, serviceName: string): RpcTarget<T>;
11
- export type { RpcTarget };
package/src/RpcTarget.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rpcTarget = rpcTarget;
4
- /** A contract capability at one deployment. URLs and credentials stay in the registry. */
5
- class RpcTarget {
6
- api;
7
- serviceName;
8
- constructor(api, serviceName) {
9
- this.api = api;
10
- this.serviceName = serviceName;
11
- }
12
- }
13
- // webpieces-disable no-function-outside-class -- public declaration helper, deliberately one expression at the wiring boundary
14
- function rpcTarget(api, serviceName) {
15
- return new RpcTarget(api, serviceName);
16
- }
17
- //# sourceMappingURL=RpcTarget.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RpcTarget.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/src/RpcTarget.ts"],"names":[],"mappings":";;AAgBA,8BAKC;AAjBD,0FAA0F;AAC1F,MAAM,SAAS;IAKS;IACA;IAFpB,YACoB,GAAoB,EACpB,WAAmB;QADnB,QAAG,GAAH,GAAG,CAAiB;QACpB,gBAAW,GAAX,WAAW,CAAQ;IACpC,CAAC;CACP;AAED,+HAA+H;AAC/H,SAAgB,SAAS,CACrB,GAAoB,EACpB,WAAmB;IAEnB,OAAO,IAAI,SAAS,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import type { ApiPrototype } from './ApiPrototype';\n\ndeclare const rpcTargetContract: unique symbol;\n\n/** A contract capability at one deployment. URLs and credentials stay in the registry. */\nclass RpcTarget<T extends object> {\n // Invariance prevents a target for a narrower contract being widened to a different API.\n declare readonly [rpcTargetContract]: (value: T) => T;\n\n constructor(\n public readonly api: ApiPrototype<T>,\n public readonly serviceName: string,\n ) {}\n}\n\n// webpieces-disable no-function-outside-class -- public declaration helper, deliberately one expression at the wiring boundary\nexport function rpcTarget<T extends object>(\n api: ApiPrototype<T>,\n serviceName: string,\n): RpcTarget<T> {\n return new RpcTarget(api, serviceName);\n}\n\nexport type { RpcTarget };\n"]}