@zuplo/cli 6.70.15 → 6.70.21
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/dist/ca-certificate/create/handler.d.ts +3 -0
- package/dist/ca-certificate/create/handler.d.ts.map +1 -0
- package/dist/ca-certificate/create/handler.js +46 -0
- package/dist/ca-certificate/create/handler.js.map +1 -0
- package/dist/ca-certificate/delete/handler.d.ts +3 -0
- package/dist/ca-certificate/delete/handler.d.ts.map +1 -0
- package/dist/ca-certificate/delete/handler.js +18 -0
- package/dist/ca-certificate/delete/handler.js.map +1 -0
- package/dist/ca-certificate/describe/handler.d.ts +3 -0
- package/dist/ca-certificate/describe/handler.d.ts.map +1 -0
- package/dist/ca-certificate/describe/handler.js +32 -0
- package/dist/ca-certificate/describe/handler.js.map +1 -0
- package/dist/ca-certificate/list/handler.d.ts +3 -0
- package/dist/ca-certificate/list/handler.d.ts.map +1 -0
- package/dist/ca-certificate/list/handler.js +28 -0
- package/dist/ca-certificate/list/handler.js.map +1 -0
- package/dist/ca-certificate/models.d.ts +51 -0
- package/dist/ca-certificate/models.d.ts.map +1 -0
- package/dist/ca-certificate/models.js +2 -0
- package/dist/ca-certificate/models.js.map +1 -0
- package/dist/ca-certificate/update/handler.d.ts +3 -0
- package/dist/ca-certificate/update/handler.d.ts.map +1 -0
- package/dist/ca-certificate/update/handler.js +26 -0
- package/dist/ca-certificate/update/handler.js.map +1 -0
- package/dist/ca-certificate/validation.d.ts +21 -0
- package/dist/ca-certificate/validation.d.ts.map +1 -0
- package/dist/ca-certificate/validation.js +135 -0
- package/dist/ca-certificate/validation.js.map +1 -0
- package/dist/ca-certificate/validation.test.d.ts +2 -0
- package/dist/ca-certificate/validation.test.d.ts.map +1 -0
- package/dist/ca-certificate/validation.test.js +131 -0
- package/dist/ca-certificate/validation.test.js.map +1 -0
- package/dist/cli.js +2 -6
- package/dist/cli.js.map +1 -1
- package/dist/cmds/ca-certificate/create.d.ts +9 -0
- package/dist/cmds/ca-certificate/create.d.ts.map +1 -0
- package/dist/cmds/ca-certificate/create.js +66 -0
- package/dist/cmds/ca-certificate/create.js.map +1 -0
- package/dist/cmds/ca-certificate/delete.d.ts +9 -0
- package/dist/cmds/ca-certificate/delete.d.ts.map +1 -0
- package/dist/cmds/ca-certificate/delete.js +56 -0
- package/dist/cmds/ca-certificate/delete.js.map +1 -0
- package/dist/cmds/ca-certificate/describe.d.ts +9 -0
- package/dist/cmds/ca-certificate/describe.d.ts.map +1 -0
- package/dist/cmds/ca-certificate/describe.js +56 -0
- package/dist/cmds/ca-certificate/describe.js.map +1 -0
- package/dist/cmds/ca-certificate/index.d.ts +4 -0
- package/dist/cmds/ca-certificate/index.d.ts.map +1 -0
- package/dist/cmds/ca-certificate/index.js +18 -0
- package/dist/cmds/ca-certificate/index.js.map +1 -0
- package/dist/cmds/ca-certificate/list.d.ts +9 -0
- package/dist/cmds/ca-certificate/list.d.ts.map +1 -0
- package/dist/cmds/ca-certificate/list.js +48 -0
- package/dist/cmds/ca-certificate/list.js.map +1 -0
- package/dist/cmds/ca-certificate/update.d.ts +9 -0
- package/dist/cmds/ca-certificate/update.d.ts.map +1 -0
- package/dist/cmds/ca-certificate/update.js +56 -0
- package/dist/cmds/ca-certificate/update.js.map +1 -0
- package/dist/cmds/mtls-certificates/index.js +1 -1
- package/dist/cmds/mtls-certificates/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@cfworker/json-schema/README.md +75 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/deep-compare-strict.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/deep-compare-strict.js +42 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/dereference.d.ts +7 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/dereference.js +147 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/format.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/format.js +111 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/index.d.ts +8 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/index.js +24 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/package.json +3 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/pointer.d.ts +2 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/pointer.js +10 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/types.d.ts +72 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/types.js +9 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/ucs2-length.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/ucs2-length.js +20 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/validate.d.ts +3 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/validate.js +805 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/validator.d.ts +10 -0
- package/node_modules/@cfworker/json-schema/dist/commonjs/validator.js +27 -0
- package/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/esm/deep-compare-strict.js +39 -0
- package/node_modules/@cfworker/json-schema/dist/esm/dereference.d.ts +7 -0
- package/node_modules/@cfworker/json-schema/dist/esm/dereference.js +143 -0
- package/node_modules/@cfworker/json-schema/dist/esm/format.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/esm/format.js +108 -0
- package/node_modules/@cfworker/json-schema/dist/esm/index.d.ts +8 -0
- package/node_modules/@cfworker/json-schema/dist/esm/index.js +8 -0
- package/node_modules/@cfworker/json-schema/dist/esm/package.json +3 -0
- package/node_modules/@cfworker/json-schema/dist/esm/pointer.d.ts +2 -0
- package/node_modules/@cfworker/json-schema/dist/esm/pointer.js +6 -0
- package/node_modules/@cfworker/json-schema/dist/esm/types.d.ts +72 -0
- package/node_modules/@cfworker/json-schema/dist/esm/types.js +6 -0
- package/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/dist/esm/ucs2-length.js +17 -0
- package/node_modules/@cfworker/json-schema/dist/esm/validate.d.ts +3 -0
- package/node_modules/@cfworker/json-schema/dist/esm/validate.js +802 -0
- package/node_modules/@cfworker/json-schema/dist/esm/validator.d.ts +10 -0
- package/node_modules/@cfworker/json-schema/dist/esm/validator.js +23 -0
- package/node_modules/@cfworker/json-schema/package.json +68 -0
- package/node_modules/@cfworker/json-schema/src/deep-compare-strict.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/src/deep-compare-strict.ts +39 -0
- package/node_modules/@cfworker/json-schema/src/dereference.d.ts +12 -0
- package/node_modules/@cfworker/json-schema/src/dereference.ts +188 -0
- package/node_modules/@cfworker/json-schema/src/format.d.ts +2 -0
- package/node_modules/@cfworker/json-schema/src/format.ts +164 -0
- package/node_modules/@cfworker/json-schema/src/index.d.ts +8 -0
- package/node_modules/@cfworker/json-schema/src/index.ts +8 -0
- package/node_modules/@cfworker/json-schema/src/pointer.d.ts +2 -0
- package/node_modules/@cfworker/json-schema/src/pointer.ts +7 -0
- package/node_modules/@cfworker/json-schema/src/types.d.ts +79 -0
- package/node_modules/@cfworker/json-schema/src/types.ts +92 -0
- package/node_modules/@cfworker/json-schema/src/ucs2-length.d.ts +1 -0
- package/node_modules/@cfworker/json-schema/src/ucs2-length.ts +24 -0
- package/node_modules/@cfworker/json-schema/src/validate.d.ts +13 -0
- package/node_modules/@cfworker/json-schema/src/validate.ts +1168 -0
- package/node_modules/@cfworker/json-schema/src/validator.d.ts +14 -0
- package/node_modules/@cfworker/json-schema/src/validator.ts +32 -0
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +1 -1
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ3VHQXF.js → chunk-2ZQVIVZ3.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-STBDRSX7.js → chunk-UMZORQLU.js} +67 -66
- package/node_modules/@zuplo/runtime/out/esm/chunk-UMZORQLU.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-KWR5BV7H.js → chunk-YGYFQCBA.js} +6 -6
- package/node_modules/@zuplo/runtime/out/esm/chunk-YGYFQCBA.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/{chunk-NJNTFB34.js → chunk-ZS34EO4B.js} +2 -2
- package/node_modules/@zuplo/runtime/out/esm/{chunk-NJNTFB34.js.map → chunk-ZS34EO4B.js.map} +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/internal/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +208 -72
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/types/index.d.ts +61 -12
- package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +8 -17
- package/node_modules/@zuplo/runtime/out/types/mocks/index.d.ts +3 -12
- package/node_modules/@zuplo/runtime/package.json +3 -2
- package/node_modules/agent-base/README.md +145 -0
- package/node_modules/agent-base/dist/src/index.d.ts +78 -0
- package/node_modules/agent-base/dist/src/index.js +203 -0
- package/node_modules/agent-base/dist/src/index.js.map +1 -0
- package/node_modules/agent-base/dist/src/promisify.d.ts +4 -0
- package/node_modules/agent-base/dist/src/promisify.js +18 -0
- package/node_modules/agent-base/dist/src/promisify.js.map +1 -0
- package/node_modules/agent-base/package.json +64 -0
- package/node_modules/agent-base/src/index.ts +345 -0
- package/node_modules/agent-base/src/promisify.ts +33 -0
- package/node_modules/axios/CHANGELOG.md +71 -0
- package/node_modules/axios/README.md +46 -11
- package/node_modules/axios/dist/axios.js +81 -53
- package/node_modules/axios/dist/axios.js.map +1 -1
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +96 -64
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +96 -64
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +206 -85
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +1 -1
- package/node_modules/axios/index.d.ts +1 -1
- package/node_modules/axios/lib/adapters/fetch.js +6 -2
- package/node_modules/axios/lib/adapters/http.js +139 -29
- package/node_modules/axios/lib/adapters/xhr.js +2 -1
- package/node_modules/axios/lib/core/AxiosHeaders.js +1 -33
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/composeSignals.js +48 -47
- package/node_modules/axios/lib/helpers/formDataToJSON.js +1 -1
- package/node_modules/axios/lib/helpers/fromDataURI.js +18 -5
- package/node_modules/axios/lib/helpers/progressEventReducer.js +3 -0
- package/node_modules/axios/lib/helpers/sanitizeHeaderValue.js +60 -0
- package/node_modules/axios/lib/utils.js +8 -7
- package/node_modules/axios/package.json +3 -1
- package/node_modules/https-proxy-agent/README.md +137 -0
- package/node_modules/https-proxy-agent/dist/agent.d.ts +30 -0
- package/node_modules/https-proxy-agent/dist/agent.js +177 -0
- package/node_modules/https-proxy-agent/dist/agent.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/index.d.ts +23 -0
- package/node_modules/https-proxy-agent/dist/index.js +14 -0
- package/node_modules/https-proxy-agent/dist/index.js.map +1 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.d.ts +7 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
- package/node_modules/https-proxy-agent/dist/parse-proxy-response.js.map +1 -0
- package/node_modules/https-proxy-agent/package.json +56 -0
- package/node_modules/type-is/index.js +8 -18
- package/node_modules/type-is/node_modules/content-type/LICENSE +22 -0
- package/node_modules/type-is/node_modules/content-type/README.md +69 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.d.ts +26 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.js +170 -0
- package/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -0
- package/node_modules/type-is/node_modules/content-type/package.json +52 -0
- package/node_modules/type-is/package.json +9 -5
- package/package.json +6 -6
- package/node_modules/@zuplo/runtime/out/esm/chunk-KWR5BV7H.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-STBDRSX7.js.map +0 -1
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-YJ3VHQXF.js.map → chunk-2ZQVIVZ3.js.map} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-STBDRSX7.js.LEGAL.txt → chunk-UMZORQLU.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-KWR5BV7H.js.LEGAL.txt → chunk-YGYFQCBA.js.LEGAL.txt} +0 -0
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* DEALINGS IN THE SOFTWARE.
|
|
23
23
|
*--------------------------------------------------------------------------------------------*/
|
|
24
24
|
|
|
25
|
-
import{b as d}from"../chunk-
|
|
25
|
+
import{b as d}from"../chunk-ZS34EO4B.js";import{_ as n,a as t}from"../chunk-YGYFQCBA.js";function g(u={request:new Request("https://api.example.com")}){let e=[];function o(i){e.push(Promise.resolve(i))}return t(o,"waitUntil"),{context:new s({event:{waitUntil:o},route:u.route}),invokeResponse:t(async()=>{await Promise.all(e)},"invokeResponse")}}t(g,"createMockContext");var p={path:"/",methods:["GET"],handler:{module:{},export:"default"},raw:t(()=>({}),"raw")},s=class extends EventTarget{static{t(this,"MockZuploContext")}#e;contextId;requestId;log;route;custom;incomingRequestProperties;parentContext;analyticsContext;constructor({event:e,route:o=p,parentContext:r}){super(),this.requestId=crypto.randomUUID(),this.contextId=crypto.randomUUID(),this.log={info:n.console.info,log:n.console.log,debug:n.console.debug,warn:n.console.warn,error:n.console.error,setLogProperties:t(()=>{},"setLogProperties")},this.custom={},this.route=o,this.incomingRequestProperties={asn:1234,asOrganization:"ORGANIZATION",city:"Seattle",region:"Washington",regionCode:"WA",colo:"SEA",continent:"NA",country:"US",postalCode:"98004",metroCode:"SEA",latitude:void 0,longitude:void 0,timezone:void 0,httpProtocol:void 0,clientCert:void 0,clientMtlsVerificationStatus:void 0,clientMtlsVerificationReason:void 0},this.parentContext=r,this.#e=e,this.analyticsContext=new d(this.requestId)}waitUntil(e){this.#e.waitUntil(e)}invokeInboundPolicy(e,o){throw new Error("Not implemented")}invokeOutboundPolicy(e,o,r){throw new Error("Not implemented")}invokeRoute(e,o){throw new Error("Not implemented")}addResponseSendingHook(e){throw new Error("Not implemented")}addResponseSendingFinalHook(e){throw new Error("Not implemented")}addEventListener(e,o,r){let l=t(i=>{try{typeof o=="function"?o(i):o.handleEvent(i)}catch(a){throw this.log.error(`Error invoking event ${e}. See following logs for details.`),a}},"wrapped");super.addEventListener(e,l,r)}};export{s as MockZuploContext,g as createMockContext};
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -5063,18 +5063,9 @@ declare interface IncomingRequestProperties {
|
|
|
5063
5063
|
* If available, the HTTP protocol of the incoming request, for example, "HTTP/1.1".
|
|
5064
5064
|
*/
|
|
5065
5065
|
readonly httpProtocol: string | undefined;
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
readonly clientCert: string | undefined;
|
|
5070
|
-
/**
|
|
5071
|
-
* If available, the status of mTLS verification for the incoming request.
|
|
5072
|
-
*/
|
|
5073
|
-
readonly clientMtlsVerificationStatus: string | undefined;
|
|
5074
|
-
/**
|
|
5075
|
-
* If available, the reason mTLS verification failed for the incoming request.
|
|
5076
|
-
*/
|
|
5077
|
-
readonly clientMtlsVerificationReason: string | undefined;
|
|
5066
|
+
/* Excluded from this release type: clientCert */
|
|
5067
|
+
/* Excluded from this release type: clientMtlsVerificationStatus */
|
|
5068
|
+
/* Excluded from this release type: clientMtlsVerificationReason */
|
|
5078
5069
|
}
|
|
5079
5070
|
|
|
5080
5071
|
/**
|
|
@@ -6095,6 +6086,64 @@ export declare interface MonetizationSubscription {
|
|
|
6095
6086
|
updatedAt: string;
|
|
6096
6087
|
}
|
|
6097
6088
|
|
|
6089
|
+
/**
|
|
6090
|
+
* Authenticate requests based on the mTLS protocol.
|
|
6091
|
+
*
|
|
6092
|
+
* @title mTLS Auth
|
|
6093
|
+
* @product api-gateway
|
|
6094
|
+
* @public
|
|
6095
|
+
* @enterprise
|
|
6096
|
+
* @param request - The ZuploRequest
|
|
6097
|
+
* @param context - The ZuploContext
|
|
6098
|
+
* @param options - The policy options set in policies.json
|
|
6099
|
+
* @param policyName - The name of the policy as set in policies.json
|
|
6100
|
+
* @returns A Request or a Response
|
|
6101
|
+
*/
|
|
6102
|
+
export declare const MTLSAuthInboundPolicy: InboundPolicyHandler<MTLSAuthInboundPolicyOptions>;
|
|
6103
|
+
|
|
6104
|
+
/**
|
|
6105
|
+
* The options for this policy.
|
|
6106
|
+
* @public
|
|
6107
|
+
*/
|
|
6108
|
+
export declare interface MTLSAuthInboundPolicyOptions {
|
|
6109
|
+
/**
|
|
6110
|
+
* Allows requests to continue even when mTLS verification fails, no client certificate is presented, or the certificate metadata cannot be parsed. Defaults to false.
|
|
6111
|
+
*/
|
|
6112
|
+
allowUnauthenticatedRequests?: boolean;
|
|
6113
|
+
/**
|
|
6114
|
+
* Optional fully qualified issuer distinguished name to require on the client certificate. When set, the policy rejects certificates whose parsed issuer DN does not match this string exactly. The expected format matches the parsed metadata issuer, e.g. "CN=example-ca, O=Example, C=US".
|
|
6115
|
+
*/
|
|
6116
|
+
certIssuerDN?: string;
|
|
6117
|
+
}
|
|
6118
|
+
|
|
6119
|
+
/**
|
|
6120
|
+
* Parsed client certificate metadata attached by the mTLS auth policy.
|
|
6121
|
+
*
|
|
6122
|
+
* @public
|
|
6123
|
+
*/
|
|
6124
|
+
export declare interface MTLSAuthMetadata {
|
|
6125
|
+
/**
|
|
6126
|
+
* Certificate subject distinguished name.
|
|
6127
|
+
*/
|
|
6128
|
+
subject: string;
|
|
6129
|
+
/**
|
|
6130
|
+
* Certificate issuer distinguished name.
|
|
6131
|
+
*/
|
|
6132
|
+
issuer: string;
|
|
6133
|
+
/**
|
|
6134
|
+
* Certificate validity start time in ISO 8601 format.
|
|
6135
|
+
*/
|
|
6136
|
+
notBefore: string;
|
|
6137
|
+
/**
|
|
6138
|
+
* Certificate validity end time in ISO 8601 format.
|
|
6139
|
+
*/
|
|
6140
|
+
notAfter: string;
|
|
6141
|
+
/**
|
|
6142
|
+
* Certificate SHA-256 fingerprint formatted as uppercase colon-separated hex.
|
|
6143
|
+
*/
|
|
6144
|
+
sha256Fingerprint: string;
|
|
6145
|
+
}
|
|
6146
|
+
|
|
6098
6147
|
declare interface MultiRequests {
|
|
6099
6148
|
RequestReference: RequestReference;
|
|
6100
6149
|
}
|
|
@@ -621,18 +621,9 @@ declare interface IncomingRequestProperties {
|
|
|
621
621
|
* If available, the HTTP protocol of the incoming request, for example, "HTTP/1.1".
|
|
622
622
|
*/
|
|
623
623
|
readonly httpProtocol: string | undefined;
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
readonly clientCert: string | undefined;
|
|
628
|
-
/**
|
|
629
|
-
* If available, the status of mTLS verification for the incoming request.
|
|
630
|
-
*/
|
|
631
|
-
readonly clientMtlsVerificationStatus: string | undefined;
|
|
632
|
-
/**
|
|
633
|
-
* If available, the reason mTLS verification failed for the incoming request.
|
|
634
|
-
*/
|
|
635
|
-
readonly clientMtlsVerificationReason: string | undefined;
|
|
624
|
+
/* Excluded from this release type: clientCert */
|
|
625
|
+
/* Excluded from this release type: clientMtlsVerificationStatus */
|
|
626
|
+
/* Excluded from this release type: clientMtlsVerificationReason */
|
|
636
627
|
}
|
|
637
628
|
|
|
638
629
|
/**
|
|
@@ -1198,14 +1189,14 @@ export declare interface McpUpstreamConnectionInboundPolicyOptions {
|
|
|
1198
1189
|
required?: boolean;
|
|
1199
1190
|
}[];
|
|
1200
1191
|
/**
|
|
1201
|
-
* Authentication mode. `user_oauth` performs per-user OAuth federation; `
|
|
1192
|
+
* Authentication mode. `user_oauth` performs per-user OAuth federation; `shared-oauth` uses a gateway-wide OAuth grant; `static_secret` / `user-secret` / `shared-secret` use a configured secret instead of OAuth.
|
|
1202
1193
|
*/
|
|
1203
1194
|
authMode:
|
|
1204
1195
|
| "user_oauth"
|
|
1205
|
-
| "
|
|
1196
|
+
| "shared-oauth"
|
|
1206
1197
|
| "static_secret"
|
|
1207
|
-
| "
|
|
1208
|
-
| "
|
|
1198
|
+
| "user-secret"
|
|
1199
|
+
| "shared-secret";
|
|
1209
1200
|
/**
|
|
1210
1201
|
* OAuth scopes to request from the upstream (for OAuth modes).
|
|
1211
1202
|
*/
|
|
@@ -1249,7 +1240,7 @@ export declare interface McpUpstreamConnectionInboundPolicyOptions {
|
|
|
1249
1240
|
| "none";
|
|
1250
1241
|
};
|
|
1251
1242
|
/**
|
|
1252
|
-
* Static secret configuration (for
|
|
1243
|
+
* Static secret configuration (for `static_secret`, `user-secret`, and `shared-secret` auth modes).
|
|
1253
1244
|
*/
|
|
1254
1245
|
secret?: {
|
|
1255
1246
|
[k: string]: unknown;
|
|
@@ -562,18 +562,9 @@ declare interface IncomingRequestProperties {
|
|
|
562
562
|
* If available, the HTTP protocol of the incoming request, for example, "HTTP/1.1".
|
|
563
563
|
*/
|
|
564
564
|
readonly httpProtocol: string | undefined;
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
readonly clientCert: string | undefined;
|
|
569
|
-
/**
|
|
570
|
-
* If available, the status of mTLS verification for the incoming request.
|
|
571
|
-
*/
|
|
572
|
-
readonly clientMtlsVerificationStatus: string | undefined;
|
|
573
|
-
/**
|
|
574
|
-
* If available, the reason mTLS verification failed for the incoming request.
|
|
575
|
-
*/
|
|
576
|
-
readonly clientMtlsVerificationReason: string | undefined;
|
|
565
|
+
/* Excluded from this release type: clientCert */
|
|
566
|
+
/* Excluded from this release type: clientMtlsVerificationStatus */
|
|
567
|
+
/* Excluded from this release type: clientMtlsVerificationReason */
|
|
577
568
|
}
|
|
578
569
|
|
|
579
570
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zuplo/runtime",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.70.
|
|
4
|
+
"version": "6.70.21",
|
|
5
5
|
"repository": "https://github.com/zuplo/zuplo",
|
|
6
6
|
"author": "Zuplo, Inc.",
|
|
7
7
|
"exports": {
|
|
@@ -36,14 +36,15 @@
|
|
|
36
36
|
"typescript": "^5.6.2"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"@cfworker/json-schema": "4.1.1",
|
|
39
40
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
40
41
|
"ajv": "^8.17.1",
|
|
41
42
|
"bs58": "^6.0.0",
|
|
42
|
-
"uuid": "^11.1.0",
|
|
43
43
|
"cookie": "^1.0.1",
|
|
44
44
|
"graphql": "^16.8.1",
|
|
45
45
|
"jose": "^5.6.3",
|
|
46
46
|
"path-to-regexp": "^6.3.0",
|
|
47
|
+
"uuid": "^11.1.0",
|
|
47
48
|
"zod": "3.25.76"
|
|
48
49
|
}
|
|
49
50
|
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
agent-base
|
|
2
|
+
==========
|
|
3
|
+
### Turn a function into an [`http.Agent`][http.Agent] instance
|
|
4
|
+
[](https://github.com/TooTallNate/node-agent-base/actions?workflow=Node+CI)
|
|
5
|
+
|
|
6
|
+
This module provides an `http.Agent` generator. That is, you pass it an async
|
|
7
|
+
callback function, and it returns a new `http.Agent` instance that will invoke the
|
|
8
|
+
given callback function when sending outbound HTTP requests.
|
|
9
|
+
|
|
10
|
+
#### Some subclasses:
|
|
11
|
+
|
|
12
|
+
Here's some more interesting uses of `agent-base`.
|
|
13
|
+
Send a pull request to list yours!
|
|
14
|
+
|
|
15
|
+
* [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints
|
|
16
|
+
* [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints
|
|
17
|
+
* [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS
|
|
18
|
+
* [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Installation
|
|
22
|
+
------------
|
|
23
|
+
|
|
24
|
+
Install with `npm`:
|
|
25
|
+
|
|
26
|
+
``` bash
|
|
27
|
+
$ npm install agent-base
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
Example
|
|
32
|
+
-------
|
|
33
|
+
|
|
34
|
+
Here's a minimal example that creates a new `net.Socket` connection to the server
|
|
35
|
+
for every HTTP request (i.e. the equivalent of `agent: false` option):
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
var net = require('net');
|
|
39
|
+
var tls = require('tls');
|
|
40
|
+
var url = require('url');
|
|
41
|
+
var http = require('http');
|
|
42
|
+
var agent = require('agent-base');
|
|
43
|
+
|
|
44
|
+
var endpoint = 'http://nodejs.org/api/';
|
|
45
|
+
var parsed = url.parse(endpoint);
|
|
46
|
+
|
|
47
|
+
// This is the important part!
|
|
48
|
+
parsed.agent = agent(function (req, opts) {
|
|
49
|
+
var socket;
|
|
50
|
+
// `secureEndpoint` is true when using the https module
|
|
51
|
+
if (opts.secureEndpoint) {
|
|
52
|
+
socket = tls.connect(opts);
|
|
53
|
+
} else {
|
|
54
|
+
socket = net.connect(opts);
|
|
55
|
+
}
|
|
56
|
+
return socket;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// Everything else works just like normal...
|
|
60
|
+
http.get(parsed, function (res) {
|
|
61
|
+
console.log('"response" event!', res.headers);
|
|
62
|
+
res.pipe(process.stdout);
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Returning a Promise or using an `async` function is also supported:
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
agent(async function (req, opts) {
|
|
70
|
+
await sleep(1000);
|
|
71
|
+
// etc…
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Return another `http.Agent` instance to "pass through" the responsibility
|
|
76
|
+
for that HTTP request to that agent:
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
agent(function (req, opts) {
|
|
80
|
+
return opts.secureEndpoint ? https.globalAgent : http.globalAgent;
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
API
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Agent(Function callback[, Object options]) → [http.Agent][]
|
|
89
|
+
|
|
90
|
+
Creates a base `http.Agent` that will execute the callback function `callback`
|
|
91
|
+
for every HTTP request that it is used as the `agent` for. The callback function
|
|
92
|
+
is responsible for creating a `stream.Duplex` instance of some kind that will be
|
|
93
|
+
used as the underlying socket in the HTTP request.
|
|
94
|
+
|
|
95
|
+
The `options` object accepts the following properties:
|
|
96
|
+
|
|
97
|
+
* `timeout` - Number - Timeout for the `callback()` function in milliseconds. Defaults to Infinity (optional).
|
|
98
|
+
|
|
99
|
+
The callback function should have the following signature:
|
|
100
|
+
|
|
101
|
+
### callback(http.ClientRequest req, Object options, Function cb) → undefined
|
|
102
|
+
|
|
103
|
+
The ClientRequest `req` can be accessed to read request headers and
|
|
104
|
+
and the path, etc. The `options` object contains the options passed
|
|
105
|
+
to the `http.request()`/`https.request()` function call, and is formatted
|
|
106
|
+
to be directly passed to `net.connect()`/`tls.connect()`, or however
|
|
107
|
+
else you want a Socket to be created. Pass the created socket to
|
|
108
|
+
the callback function `cb` once created, and the HTTP request will
|
|
109
|
+
continue to proceed.
|
|
110
|
+
|
|
111
|
+
If the `https` module is used to invoke the HTTP request, then the
|
|
112
|
+
`secureEndpoint` property on `options` _will be set to `true`_.
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
License
|
|
116
|
+
-------
|
|
117
|
+
|
|
118
|
+
(The MIT License)
|
|
119
|
+
|
|
120
|
+
Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
|
121
|
+
|
|
122
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
123
|
+
a copy of this software and associated documentation files (the
|
|
124
|
+
'Software'), to deal in the Software without restriction, including
|
|
125
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
126
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
127
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
128
|
+
the following conditions:
|
|
129
|
+
|
|
130
|
+
The above copyright notice and this permission notice shall be
|
|
131
|
+
included in all copies or substantial portions of the Software.
|
|
132
|
+
|
|
133
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
134
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
135
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
136
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
137
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
138
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
139
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
140
|
+
|
|
141
|
+
[http-proxy-agent]: https://github.com/TooTallNate/node-http-proxy-agent
|
|
142
|
+
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
|
143
|
+
[pac-proxy-agent]: https://github.com/TooTallNate/node-pac-proxy-agent
|
|
144
|
+
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
|
|
145
|
+
[http.Agent]: https://nodejs.org/api/http.html#http_class_http_agent
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import net from 'net';
|
|
3
|
+
import http from 'http';
|
|
4
|
+
import https from 'https';
|
|
5
|
+
import { Duplex } from 'stream';
|
|
6
|
+
import { EventEmitter } from 'events';
|
|
7
|
+
declare function createAgent(opts?: createAgent.AgentOptions): createAgent.Agent;
|
|
8
|
+
declare function createAgent(callback: createAgent.AgentCallback, opts?: createAgent.AgentOptions): createAgent.Agent;
|
|
9
|
+
declare namespace createAgent {
|
|
10
|
+
interface ClientRequest extends http.ClientRequest {
|
|
11
|
+
_last?: boolean;
|
|
12
|
+
_hadError?: boolean;
|
|
13
|
+
method: string;
|
|
14
|
+
}
|
|
15
|
+
interface AgentRequestOptions {
|
|
16
|
+
host?: string;
|
|
17
|
+
path?: string;
|
|
18
|
+
port: number;
|
|
19
|
+
}
|
|
20
|
+
interface HttpRequestOptions extends AgentRequestOptions, Omit<http.RequestOptions, keyof AgentRequestOptions> {
|
|
21
|
+
secureEndpoint: false;
|
|
22
|
+
}
|
|
23
|
+
interface HttpsRequestOptions extends AgentRequestOptions, Omit<https.RequestOptions, keyof AgentRequestOptions> {
|
|
24
|
+
secureEndpoint: true;
|
|
25
|
+
}
|
|
26
|
+
type RequestOptions = HttpRequestOptions | HttpsRequestOptions;
|
|
27
|
+
type AgentLike = Pick<createAgent.Agent, 'addRequest'> | http.Agent;
|
|
28
|
+
type AgentCallbackReturn = Duplex | AgentLike;
|
|
29
|
+
type AgentCallbackCallback = (err?: Error | null, socket?: createAgent.AgentCallbackReturn) => void;
|
|
30
|
+
type AgentCallbackPromise = (req: createAgent.ClientRequest, opts: createAgent.RequestOptions) => createAgent.AgentCallbackReturn | Promise<createAgent.AgentCallbackReturn>;
|
|
31
|
+
type AgentCallback = typeof Agent.prototype.callback;
|
|
32
|
+
type AgentOptions = {
|
|
33
|
+
timeout?: number;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Base `http.Agent` implementation.
|
|
37
|
+
* No pooling/keep-alive is implemented by default.
|
|
38
|
+
*
|
|
39
|
+
* @param {Function} callback
|
|
40
|
+
* @api public
|
|
41
|
+
*/
|
|
42
|
+
class Agent extends EventEmitter {
|
|
43
|
+
timeout: number | null;
|
|
44
|
+
maxFreeSockets: number;
|
|
45
|
+
maxTotalSockets: number;
|
|
46
|
+
maxSockets: number;
|
|
47
|
+
sockets: {
|
|
48
|
+
[key: string]: net.Socket[];
|
|
49
|
+
};
|
|
50
|
+
freeSockets: {
|
|
51
|
+
[key: string]: net.Socket[];
|
|
52
|
+
};
|
|
53
|
+
requests: {
|
|
54
|
+
[key: string]: http.IncomingMessage[];
|
|
55
|
+
};
|
|
56
|
+
options: https.AgentOptions;
|
|
57
|
+
private promisifiedCallback?;
|
|
58
|
+
private explicitDefaultPort?;
|
|
59
|
+
private explicitProtocol?;
|
|
60
|
+
constructor(callback?: createAgent.AgentCallback | createAgent.AgentOptions, _opts?: createAgent.AgentOptions);
|
|
61
|
+
get defaultPort(): number;
|
|
62
|
+
set defaultPort(v: number);
|
|
63
|
+
get protocol(): string;
|
|
64
|
+
set protocol(v: string);
|
|
65
|
+
callback(req: createAgent.ClientRequest, opts: createAgent.RequestOptions, fn: createAgent.AgentCallbackCallback): void;
|
|
66
|
+
callback(req: createAgent.ClientRequest, opts: createAgent.RequestOptions): createAgent.AgentCallbackReturn | Promise<createAgent.AgentCallbackReturn>;
|
|
67
|
+
/**
|
|
68
|
+
* Called by node-core's "_http_client.js" module when creating
|
|
69
|
+
* a new HTTP request with this Agent instance.
|
|
70
|
+
*
|
|
71
|
+
* @api public
|
|
72
|
+
*/
|
|
73
|
+
addRequest(req: ClientRequest, _opts: RequestOptions): void;
|
|
74
|
+
freeSocket(socket: net.Socket, opts: AgentOptions): void;
|
|
75
|
+
destroy(): void;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export = createAgent;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const events_1 = require("events");
|
|
6
|
+
const debug_1 = __importDefault(require("debug"));
|
|
7
|
+
const promisify_1 = __importDefault(require("./promisify"));
|
|
8
|
+
const debug = debug_1.default('agent-base');
|
|
9
|
+
function isAgent(v) {
|
|
10
|
+
return Boolean(v) && typeof v.addRequest === 'function';
|
|
11
|
+
}
|
|
12
|
+
function isSecureEndpoint() {
|
|
13
|
+
const { stack } = new Error();
|
|
14
|
+
if (typeof stack !== 'string')
|
|
15
|
+
return false;
|
|
16
|
+
return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1 || l.indexOf('node:https:') !== -1);
|
|
17
|
+
}
|
|
18
|
+
function createAgent(callback, opts) {
|
|
19
|
+
return new createAgent.Agent(callback, opts);
|
|
20
|
+
}
|
|
21
|
+
(function (createAgent) {
|
|
22
|
+
/**
|
|
23
|
+
* Base `http.Agent` implementation.
|
|
24
|
+
* No pooling/keep-alive is implemented by default.
|
|
25
|
+
*
|
|
26
|
+
* @param {Function} callback
|
|
27
|
+
* @api public
|
|
28
|
+
*/
|
|
29
|
+
class Agent extends events_1.EventEmitter {
|
|
30
|
+
constructor(callback, _opts) {
|
|
31
|
+
super();
|
|
32
|
+
let opts = _opts;
|
|
33
|
+
if (typeof callback === 'function') {
|
|
34
|
+
this.callback = callback;
|
|
35
|
+
}
|
|
36
|
+
else if (callback) {
|
|
37
|
+
opts = callback;
|
|
38
|
+
}
|
|
39
|
+
// Timeout for the socket to be returned from the callback
|
|
40
|
+
this.timeout = null;
|
|
41
|
+
if (opts && typeof opts.timeout === 'number') {
|
|
42
|
+
this.timeout = opts.timeout;
|
|
43
|
+
}
|
|
44
|
+
// These aren't actually used by `agent-base`, but are required
|
|
45
|
+
// for the TypeScript definition files in `@types/node` :/
|
|
46
|
+
this.maxFreeSockets = 1;
|
|
47
|
+
this.maxSockets = 1;
|
|
48
|
+
this.maxTotalSockets = Infinity;
|
|
49
|
+
this.sockets = {};
|
|
50
|
+
this.freeSockets = {};
|
|
51
|
+
this.requests = {};
|
|
52
|
+
this.options = {};
|
|
53
|
+
}
|
|
54
|
+
get defaultPort() {
|
|
55
|
+
if (typeof this.explicitDefaultPort === 'number') {
|
|
56
|
+
return this.explicitDefaultPort;
|
|
57
|
+
}
|
|
58
|
+
return isSecureEndpoint() ? 443 : 80;
|
|
59
|
+
}
|
|
60
|
+
set defaultPort(v) {
|
|
61
|
+
this.explicitDefaultPort = v;
|
|
62
|
+
}
|
|
63
|
+
get protocol() {
|
|
64
|
+
if (typeof this.explicitProtocol === 'string') {
|
|
65
|
+
return this.explicitProtocol;
|
|
66
|
+
}
|
|
67
|
+
return isSecureEndpoint() ? 'https:' : 'http:';
|
|
68
|
+
}
|
|
69
|
+
set protocol(v) {
|
|
70
|
+
this.explicitProtocol = v;
|
|
71
|
+
}
|
|
72
|
+
callback(req, opts, fn) {
|
|
73
|
+
throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`');
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Called by node-core's "_http_client.js" module when creating
|
|
77
|
+
* a new HTTP request with this Agent instance.
|
|
78
|
+
*
|
|
79
|
+
* @api public
|
|
80
|
+
*/
|
|
81
|
+
addRequest(req, _opts) {
|
|
82
|
+
const opts = Object.assign({}, _opts);
|
|
83
|
+
if (typeof opts.secureEndpoint !== 'boolean') {
|
|
84
|
+
opts.secureEndpoint = isSecureEndpoint();
|
|
85
|
+
}
|
|
86
|
+
if (opts.host == null) {
|
|
87
|
+
opts.host = 'localhost';
|
|
88
|
+
}
|
|
89
|
+
if (opts.port == null) {
|
|
90
|
+
opts.port = opts.secureEndpoint ? 443 : 80;
|
|
91
|
+
}
|
|
92
|
+
if (opts.protocol == null) {
|
|
93
|
+
opts.protocol = opts.secureEndpoint ? 'https:' : 'http:';
|
|
94
|
+
}
|
|
95
|
+
if (opts.host && opts.path) {
|
|
96
|
+
// If both a `host` and `path` are specified then it's most
|
|
97
|
+
// likely the result of a `url.parse()` call... we need to
|
|
98
|
+
// remove the `path` portion so that `net.connect()` doesn't
|
|
99
|
+
// attempt to open that as a unix socket file.
|
|
100
|
+
delete opts.path;
|
|
101
|
+
}
|
|
102
|
+
delete opts.agent;
|
|
103
|
+
delete opts.hostname;
|
|
104
|
+
delete opts._defaultAgent;
|
|
105
|
+
delete opts.defaultPort;
|
|
106
|
+
delete opts.createConnection;
|
|
107
|
+
// Hint to use "Connection: close"
|
|
108
|
+
// XXX: non-documented `http` module API :(
|
|
109
|
+
req._last = true;
|
|
110
|
+
req.shouldKeepAlive = false;
|
|
111
|
+
let timedOut = false;
|
|
112
|
+
let timeoutId = null;
|
|
113
|
+
const timeoutMs = opts.timeout || this.timeout;
|
|
114
|
+
const onerror = (err) => {
|
|
115
|
+
if (req._hadError)
|
|
116
|
+
return;
|
|
117
|
+
req.emit('error', err);
|
|
118
|
+
// For Safety. Some additional errors might fire later on
|
|
119
|
+
// and we need to make sure we don't double-fire the error event.
|
|
120
|
+
req._hadError = true;
|
|
121
|
+
};
|
|
122
|
+
const ontimeout = () => {
|
|
123
|
+
timeoutId = null;
|
|
124
|
+
timedOut = true;
|
|
125
|
+
const err = new Error(`A "socket" was not created for HTTP request before ${timeoutMs}ms`);
|
|
126
|
+
err.code = 'ETIMEOUT';
|
|
127
|
+
onerror(err);
|
|
128
|
+
};
|
|
129
|
+
const callbackError = (err) => {
|
|
130
|
+
if (timedOut)
|
|
131
|
+
return;
|
|
132
|
+
if (timeoutId !== null) {
|
|
133
|
+
clearTimeout(timeoutId);
|
|
134
|
+
timeoutId = null;
|
|
135
|
+
}
|
|
136
|
+
onerror(err);
|
|
137
|
+
};
|
|
138
|
+
const onsocket = (socket) => {
|
|
139
|
+
if (timedOut)
|
|
140
|
+
return;
|
|
141
|
+
if (timeoutId != null) {
|
|
142
|
+
clearTimeout(timeoutId);
|
|
143
|
+
timeoutId = null;
|
|
144
|
+
}
|
|
145
|
+
if (isAgent(socket)) {
|
|
146
|
+
// `socket` is actually an `http.Agent` instance, so
|
|
147
|
+
// relinquish responsibility for this `req` to the Agent
|
|
148
|
+
// from here on
|
|
149
|
+
debug('Callback returned another Agent instance %o', socket.constructor.name);
|
|
150
|
+
socket.addRequest(req, opts);
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (socket) {
|
|
154
|
+
socket.once('free', () => {
|
|
155
|
+
this.freeSocket(socket, opts);
|
|
156
|
+
});
|
|
157
|
+
req.onSocket(socket);
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const err = new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``);
|
|
161
|
+
onerror(err);
|
|
162
|
+
};
|
|
163
|
+
if (typeof this.callback !== 'function') {
|
|
164
|
+
onerror(new Error('`callback` is not defined'));
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (!this.promisifiedCallback) {
|
|
168
|
+
if (this.callback.length >= 3) {
|
|
169
|
+
debug('Converting legacy callback function to promise');
|
|
170
|
+
this.promisifiedCallback = promisify_1.default(this.callback);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
this.promisifiedCallback = this.callback;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (typeof timeoutMs === 'number' && timeoutMs > 0) {
|
|
177
|
+
timeoutId = setTimeout(ontimeout, timeoutMs);
|
|
178
|
+
}
|
|
179
|
+
if ('port' in opts && typeof opts.port !== 'number') {
|
|
180
|
+
opts.port = Number(opts.port);
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
debug('Resolving socket for %o request: %o', opts.protocol, `${req.method} ${req.path}`);
|
|
184
|
+
Promise.resolve(this.promisifiedCallback(req, opts)).then(onsocket, callbackError);
|
|
185
|
+
}
|
|
186
|
+
catch (err) {
|
|
187
|
+
Promise.reject(err).catch(callbackError);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
freeSocket(socket, opts) {
|
|
191
|
+
debug('Freeing socket %o %o', socket.constructor.name, opts);
|
|
192
|
+
socket.destroy();
|
|
193
|
+
}
|
|
194
|
+
destroy() {
|
|
195
|
+
debug('Destroying agent %o', this.constructor.name);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
createAgent.Agent = Agent;
|
|
199
|
+
// So that `instanceof` works correctly
|
|
200
|
+
createAgent.prototype = createAgent.Agent.prototype;
|
|
201
|
+
})(createAgent || (createAgent = {}));
|
|
202
|
+
module.exports = createAgent;
|
|
203
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAIA,mCAAsC;AACtC,kDAAgC;AAChC,4DAAoC;AAEpC,MAAM,KAAK,GAAG,eAAW,CAAC,YAAY,CAAC,CAAC;AAExC,SAAS,OAAO,CAAC,CAAM;IACtB,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,UAAU,KAAK,UAAU,CAAC;AACzD,CAAC;AAED,SAAS,gBAAgB;IACxB,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,KAAK,EAAE,CAAC;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,IAAK,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACxG,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|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ClientRequest, RequestOptions, AgentCallbackCallback, AgentCallbackPromise } from './index';
|
|
2
|
+
declare type LegacyCallback = (req: ClientRequest, opts: RequestOptions, fn: AgentCallbackCallback) => void;
|
|
3
|
+
export default function promisify(fn: LegacyCallback): AgentCallbackPromise;
|
|
4
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
function promisify(fn) {
|
|
4
|
+
return function (req, opts) {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
fn.call(this, req, opts, (err, rtn) => {
|
|
7
|
+
if (err) {
|
|
8
|
+
reject(err);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
resolve(rtn);
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
exports.default = promisify;
|
|
18
|
+
//# sourceMappingURL=promisify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promisify.js","sourceRoot":"","sources":["../../src/promisify.ts"],"names":[],"mappings":";;AAeA,SAAwB,SAAS,CAAC,EAAkB;IACnD,OAAO,UAAsB,GAAkB,EAAE,IAAoB;QACpE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,EAAE,CAAC,IAAI,CACN,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,CAAC,GAA6B,EAAE,GAAyB,EAAE,EAAE;gBAC5D,IAAI,GAAG,EAAE;oBACR,MAAM,CAAC,GAAG,CAAC,CAAC;iBACZ;qBAAM;oBACN,OAAO,CAAC,GAAG,CAAC,CAAC;iBACb;YACF,CAAC,CACD,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;AACH,CAAC;AAjBD,4BAiBC"}
|