@webpieces/http-client-core 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 +2 -2
- package/src/ClientToken.d.ts +8 -0
- package/src/ClientToken.js +12 -0
- package/src/ClientToken.js.map +1 -0
- package/src/ExternalContractUse.d.ts +5 -0
- package/src/ExternalContractUse.js +12 -0
- package/src/ExternalContractUse.js.map +1 -0
- package/src/RpcTarget.d.ts +11 -0
- package/src/RpcTarget.js +17 -0
- package/src/RpcTarget.js.map +1 -0
- package/src/WiringPolicy.d.ts +6 -0
- package/src/WiringPolicy.js +14 -0
- package/src/WiringPolicy.js.map +1 -0
- package/src/index.d.ts +5 -0
- package/src/index.js +9 -1
- package/src/index.js.map +1 -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.855",
|
|
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.855"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WiringPolicy = void 0;
|
|
4
|
+
/** Named runtime policy; extraction persists its condition, never the resolved environment value. */
|
|
5
|
+
class WiringPolicy {
|
|
6
|
+
name;
|
|
7
|
+
enabled;
|
|
8
|
+
constructor(name, enabled) {
|
|
9
|
+
this.name = name;
|
|
10
|
+
this.enabled = enabled;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.WiringPolicy = WiringPolicy;
|
|
14
|
+
//# sourceMappingURL=WiringPolicy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WiringPolicy.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-core/src/WiringPolicy.ts"],"names":[],"mappings":";;;AAAA,qGAAqG;AACrG,MAAa,YAAY;IAED;IACA;IAFpB,YACoB,IAAY,EACZ,OAAgB;QADhB,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAS;IACjC,CAAC;CACP;AALD,oCAKC","sourcesContent":["/** Named runtime policy; extraction persists its condition, never the resolved environment value. */\nexport class WiringPolicy {\n constructor(\n public readonly name: string,\n public readonly enabled: boolean,\n ) {}\n}\n"]}
|
package/src/index.d.ts
CHANGED
|
@@ -40,3 +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';
|
|
45
|
+
export { ClientToken } from './ClientToken';
|
|
46
|
+
export { ExternalContractUse } from './ExternalContractUse';
|
|
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.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.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;
|
|
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,4 +59,12 @@ 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; } });
|
|
64
|
+
var ClientToken_1 = require("./ClientToken");
|
|
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; } });
|
|
68
|
+
var WiringPolicy_1 = require("./WiringPolicy");
|
|
69
|
+
Object.defineProperty(exports, "WiringPolicy", { enumerable: true, get: function () { return WiringPolicy_1.WiringPolicy; } });
|
|
62
70
|
//# 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;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","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"]}
|
|
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"]}
|