@webpieces/http-client-node 0.4.698 → 0.4.700

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.
Files changed (38) hide show
  1. package/README.md +75 -1
  2. package/package.json +5 -5
  3. package/src/AddressResolver.d.ts +23 -0
  4. package/src/AddressResolver.js +29 -0
  5. package/src/AddressResolver.js.map +1 -0
  6. package/src/ClientConfig.d.ts +41 -11
  7. package/src/ClientConfig.js +24 -7
  8. package/src/ClientConfig.js.map +1 -1
  9. package/src/ClientHttpFactory.d.ts +21 -4
  10. package/src/ClientHttpFactory.js +21 -5
  11. package/src/ClientHttpFactory.js.map +1 -1
  12. package/src/ContextBaseUrlOverrideFilter.d.ts +38 -0
  13. package/src/ContextBaseUrlOverrideFilter.js +57 -0
  14. package/src/ContextBaseUrlOverrideFilter.js.map +1 -0
  15. package/src/HostPolicy.d.ts +118 -0
  16. package/src/HostPolicy.js +169 -0
  17. package/src/HostPolicy.js.map +1 -0
  18. package/src/InternalAddressRules.d.ts +37 -0
  19. package/src/InternalAddressRules.js +132 -0
  20. package/src/InternalAddressRules.js.map +1 -0
  21. package/src/NodeProxyClient.d.ts +24 -6
  22. package/src/NodeProxyClient.js +30 -8
  23. package/src/NodeProxyClient.js.map +1 -1
  24. package/src/RuntimeHostErrors.d.ts +42 -0
  25. package/src/RuntimeHostErrors.js +54 -0
  26. package/src/RuntimeHostErrors.js.map +1 -0
  27. package/src/SsrfGuardFilter.d.ts +50 -0
  28. package/src/SsrfGuardFilter.js +146 -0
  29. package/src/SsrfGuardFilter.js.map +1 -0
  30. package/src/SsrfPolicy.d.ts +64 -0
  31. package/src/SsrfPolicy.js +52 -0
  32. package/src/SsrfPolicy.js.map +1 -0
  33. package/src/SsrfRefusedError.d.ts +20 -0
  34. package/src/SsrfRefusedError.js +28 -0
  35. package/src/SsrfRefusedError.js.map +1 -0
  36. package/src/index.d.ts +15 -1
  37. package/src/index.js +38 -2
  38. package/src/index.js.map +1 -1
package/src/index.js CHANGED
@@ -15,12 +15,16 @@
15
15
  * import { ClientHttpFactory, ClientConfig } from '@webpieces/http-client-node';
16
16
  *
17
17
  * // inject the factory, then one client per contract
18
- * const server2 = factory.createRpcClient(Server2Api, new ClientConfig('server2'));
18
+ * const server2 = factory.createRpcClient(
19
+ * Server2Api,
20
+ * new ClientConfig('server2', new DeployedServiceHost()),
21
+ * [], // this client's outbound filters
22
+ * );
19
23
  * const response = await server2.fetchValue(req);
20
24
  * ```
21
25
  */
22
26
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.TranslatedFailure = exports.ClientErrorTranslator = exports.ProxyClient = exports.ClientConfig = exports.NODE_PROXY_CLIENT_PROVIDER = exports.NodeProxyClient = exports.ClientHttpFactory = void 0;
27
+ exports.ClientFilterDefinition = exports.ClientRequest = exports.TranslatedFailure = exports.ClientErrorTranslator = exports.ProxyClient = exports.SSRF_GUARD_PRIORITY = exports.BASE_URL_OVERRIDE_PRIORITY = exports.ContextBaseUrlOverrideFilter = exports.DnsAddressResolver = exports.AddressResolver = exports.InternalAddressRules = exports.MissingRuntimeBaseUrlError = exports.RuntimeHostEndpointUnsupportedError = exports.SsrfRefusedError = exports.SsrfGuardFilter = exports.SsrfPolicy = exports.RuntimeHostFromContextAllowingInternalAddresses = exports.RuntimeHostFromContext = exports.DeployedServiceHost = exports.HostPolicy = exports.ClientConfig = exports.NODE_PROXY_CLIENT_PROVIDER = exports.NodeProxyClient = exports.ClientHttpFactory = void 0;
24
28
  var ClientHttpFactory_1 = require("./ClientHttpFactory");
25
29
  Object.defineProperty(exports, "ClientHttpFactory", { enumerable: true, get: function () { return ClientHttpFactory_1.ClientHttpFactory; } });
26
30
  var NodeProxyClient_1 = require("./NodeProxyClient");
@@ -28,9 +32,41 @@ Object.defineProperty(exports, "NodeProxyClient", { enumerable: true, get: funct
28
32
  Object.defineProperty(exports, "NODE_PROXY_CLIENT_PROVIDER", { enumerable: true, get: function () { return NodeProxyClient_1.NODE_PROXY_CLIENT_PROVIDER; } });
29
33
  var ClientConfig_1 = require("./ClientConfig");
30
34
  Object.defineProperty(exports, "ClientConfig", { enumerable: true, get: function () { return ClientConfig_1.ClientConfig; } });
35
+ // WHERE a client's requests go. Naming one is required on every ClientConfig — see HostPolicy.
36
+ var HostPolicy_1 = require("./HostPolicy");
37
+ Object.defineProperty(exports, "HostPolicy", { enumerable: true, get: function () { return HostPolicy_1.HostPolicy; } });
38
+ Object.defineProperty(exports, "DeployedServiceHost", { enumerable: true, get: function () { return HostPolicy_1.DeployedServiceHost; } });
39
+ Object.defineProperty(exports, "RuntimeHostFromContext", { enumerable: true, get: function () { return HostPolicy_1.RuntimeHostFromContext; } });
40
+ Object.defineProperty(exports, "RuntimeHostFromContextAllowingInternalAddresses", { enumerable: true, get: function () { return HostPolicy_1.RuntimeHostFromContextAllowingInternalAddresses; } });
41
+ // The SSRF policy a runtime host is judged under, and the refusal it produces. On by default; the
42
+ // ONLY way to relax it is naming RuntimeHostFromContextAllowingInternalAddresses at the call site.
43
+ var SsrfPolicy_1 = require("./SsrfPolicy");
44
+ Object.defineProperty(exports, "SsrfPolicy", { enumerable: true, get: function () { return SsrfPolicy_1.SsrfPolicy; } });
45
+ var SsrfGuardFilter_1 = require("./SsrfGuardFilter");
46
+ Object.defineProperty(exports, "SsrfGuardFilter", { enumerable: true, get: function () { return SsrfGuardFilter_1.SsrfGuardFilter; } });
47
+ var SsrfRefusedError_1 = require("./SsrfRefusedError");
48
+ Object.defineProperty(exports, "SsrfRefusedError", { enumerable: true, get: function () { return SsrfRefusedError_1.SsrfRefusedError; } });
49
+ // The two refusals that happen BEFORE any bytes leave, and are not about the destination itself.
50
+ var RuntimeHostErrors_1 = require("./RuntimeHostErrors");
51
+ Object.defineProperty(exports, "RuntimeHostEndpointUnsupportedError", { enumerable: true, get: function () { return RuntimeHostErrors_1.RuntimeHostEndpointUnsupportedError; } });
52
+ Object.defineProperty(exports, "MissingRuntimeBaseUrlError", { enumerable: true, get: function () { return RuntimeHostErrors_1.MissingRuntimeBaseUrlError; } });
53
+ var InternalAddressRules_1 = require("./InternalAddressRules");
54
+ Object.defineProperty(exports, "InternalAddressRules", { enumerable: true, get: function () { return InternalAddressRules_1.InternalAddressRules; } });
55
+ var AddressResolver_1 = require("./AddressResolver");
56
+ Object.defineProperty(exports, "AddressResolver", { enumerable: true, get: function () { return AddressResolver_1.AddressResolver; } });
57
+ Object.defineProperty(exports, "DnsAddressResolver", { enumerable: true, get: function () { return AddressResolver_1.DnsAddressResolver; } });
58
+ // The built-in outbound filter that carries a per-call destination from the RequestContext into the
59
+ // send path, and the two framework priorities an app orders its own filters against.
60
+ var ContextBaseUrlOverrideFilter_1 = require("./ContextBaseUrlOverrideFilter");
61
+ Object.defineProperty(exports, "ContextBaseUrlOverrideFilter", { enumerable: true, get: function () { return ContextBaseUrlOverrideFilter_1.ContextBaseUrlOverrideFilter; } });
62
+ Object.defineProperty(exports, "BASE_URL_OVERRIDE_PRIORITY", { enumerable: true, get: function () { return ContextBaseUrlOverrideFilter_1.BASE_URL_OVERRIDE_PRIORITY; } });
63
+ Object.defineProperty(exports, "SSRF_GUARD_PRIORITY", { enumerable: true, get: function () { return ContextBaseUrlOverrideFilter_1.SSRF_GUARD_PRIORITY; } });
31
64
  // The isomorphic engine, re-exported so a server app needs one import.
32
65
  var http_client_core_1 = require("@webpieces/http-client-core");
33
66
  Object.defineProperty(exports, "ProxyClient", { enumerable: true, get: function () { return http_client_core_1.ProxyClient; } });
34
67
  Object.defineProperty(exports, "ClientErrorTranslator", { enumerable: true, get: function () { return http_client_core_1.ClientErrorTranslator; } });
35
68
  Object.defineProperty(exports, "TranslatedFailure", { enumerable: true, get: function () { return http_client_core_1.TranslatedFailure; } });
69
+ var http_client_core_2 = require("@webpieces/http-client-core");
70
+ Object.defineProperty(exports, "ClientRequest", { enumerable: true, get: function () { return http_client_core_2.ClientRequest; } });
71
+ Object.defineProperty(exports, "ClientFilterDefinition", { enumerable: true, get: function () { return http_client_core_2.ClientFilterDefinition; } });
36
72
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-node/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAEH,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAC1B,qDAAgF;AAAvE,kHAAA,eAAe,OAAA;AAAE,6HAAA,0BAA0B,OAAA;AACpD,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAErB,uEAAuE;AACvE,gEAAoG;AAA3F,+GAAA,WAAW,OAAA;AAAE,yHAAA,qBAAqB,OAAA;AAAE,qHAAA,iBAAiB,OAAA","sourcesContent":["/**\n * @webpieces/http-client-node\n *\n * The SERVER-side HTTP client. Reads an API contract's decorators and generates type-safe HTTP\n * clients from it — the same contract the callee's controller implements.\n *\n * Node-only, so unlike @webpieces/http-client-browser it is fully inversify-wired and reads the\n * magic context straight out of the AsyncLocalStorage-backed RequestContext. There is no\n * ContextReader indirection, because a server has exactly one right answer, and a call made\n * OUTSIDE `RequestContext.run(...)` throws instead of silently dropping the trace.\n *\n * Usage:\n * ```typescript\n * import { ClientHttpFactory, ClientConfig } from '@webpieces/http-client-node';\n *\n * // inject the factory, then one client per contract\n * const server2 = factory.createRpcClient(Server2Api, new ClientConfig('server2'));\n * const response = await server2.fetchValue(req);\n * ```\n */\n\nexport { ClientHttpFactory } from './ClientHttpFactory';\nexport { NodeProxyClient, NODE_PROXY_CLIENT_PROVIDER } from './NodeProxyClient';\nexport { ClientConfig } from './ClientConfig';\n\n// The isomorphic engine, re-exported so a server app needs one import.\nexport { ProxyClient, ClientErrorTranslator, TranslatedFailure } from '@webpieces/http-client-core';\nexport type { ApiPrototype } from '@webpieces/http-client-core';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/http/http-client-node/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAC1B,qDAAgF;AAAvE,kHAAA,eAAe,OAAA;AAAE,6HAAA,0BAA0B,OAAA;AACpD,+CAA8C;AAArC,4GAAA,YAAY,OAAA;AAErB,+FAA+F;AAC/F,2CAAwI;AAA/H,wGAAA,UAAU,OAAA;AAAE,iHAAA,mBAAmB,OAAA;AAAE,oHAAA,sBAAsB,OAAA;AAAE,6IAAA,+CAA+C,OAAA;AAEjH,kGAAkG;AAClG,mGAAmG;AACnG,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,qDAAoD;AAA3C,kHAAA,eAAe,OAAA;AACxB,uDAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,iGAAiG;AACjG,yDAAsG;AAA7F,wIAAA,mCAAmC,OAAA;AAAE,+HAAA,0BAA0B,OAAA;AACxE,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,qDAAwE;AAA/D,kHAAA,eAAe,OAAA;AAAE,qHAAA,kBAAkB,OAAA;AAE5C,oGAAoG;AACpG,qFAAqF;AACrF,+EAA+H;AAAtH,4IAAA,4BAA4B,OAAA;AAAE,0IAAA,0BAA0B,OAAA;AAAE,mIAAA,mBAAmB,OAAA;AAEtF,uEAAuE;AACvE,gEAAoG;AAA3F,+GAAA,WAAW,OAAA;AAAE,yHAAA,qBAAqB,OAAA;AAAE,qHAAA,iBAAiB,OAAA;AAC9D,gEAAoF;AAA3E,iHAAA,aAAa,OAAA;AAAE,0HAAA,sBAAsB,OAAA","sourcesContent":["/**\n * @webpieces/http-client-node\n *\n * The SERVER-side HTTP client. Reads an API contract's decorators and generates type-safe HTTP\n * clients from it — the same contract the callee's controller implements.\n *\n * Node-only, so unlike @webpieces/http-client-browser it is fully inversify-wired and reads the\n * magic context straight out of the AsyncLocalStorage-backed RequestContext. There is no\n * ContextReader indirection, because a server has exactly one right answer, and a call made\n * OUTSIDE `RequestContext.run(...)` throws instead of silently dropping the trace.\n *\n * Usage:\n * ```typescript\n * import { ClientHttpFactory, ClientConfig } from '@webpieces/http-client-node';\n *\n * // inject the factory, then one client per contract\n * const server2 = factory.createRpcClient(\n * Server2Api,\n * new ClientConfig('server2', new DeployedServiceHost()),\n * [], // this client's outbound filters\n * );\n * const response = await server2.fetchValue(req);\n * ```\n */\n\nexport { ClientHttpFactory } from './ClientHttpFactory';\nexport { NodeProxyClient, NODE_PROXY_CLIENT_PROVIDER } from './NodeProxyClient';\nexport { ClientConfig } from './ClientConfig';\n\n// WHERE a client's requests go. Naming one is required on every ClientConfig — see HostPolicy.\nexport { HostPolicy, DeployedServiceHost, RuntimeHostFromContext, RuntimeHostFromContextAllowingInternalAddresses } from './HostPolicy';\n\n// The SSRF policy a runtime host is judged under, and the refusal it produces. On by default; the\n// ONLY way to relax it is naming RuntimeHostFromContextAllowingInternalAddresses at the call site.\nexport { SsrfPolicy } from './SsrfPolicy';\nexport { SsrfGuardFilter } from './SsrfGuardFilter';\nexport { SsrfRefusedError } from './SsrfRefusedError';\n// The two refusals that happen BEFORE any bytes leave, and are not about the destination itself.\nexport { RuntimeHostEndpointUnsupportedError, MissingRuntimeBaseUrlError } from './RuntimeHostErrors';\nexport { InternalAddressRules } from './InternalAddressRules';\nexport { AddressResolver, DnsAddressResolver } from './AddressResolver';\n\n// The built-in outbound filter that carries a per-call destination from the RequestContext into the\n// send path, and the two framework priorities an app orders its own filters against.\nexport { ContextBaseUrlOverrideFilter, BASE_URL_OVERRIDE_PRIORITY, SSRF_GUARD_PRIORITY } from './ContextBaseUrlOverrideFilter';\n\n// The isomorphic engine, re-exported so a server app needs one import.\nexport { ProxyClient, ClientErrorTranslator, TranslatedFailure } from '@webpieces/http-client-core';\nexport { ClientRequest, ClientFilterDefinition } from '@webpieces/http-client-core';\nexport type { ClientFilter } from '@webpieces/http-client-core';\nexport type { ApiPrototype } from '@webpieces/http-client-core';\n"]}