@shawnstack/quickforge 1.3.20 → 1.3.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/README.md +348 -348
- package/dist/assets/{anthropic-Bj3HAZgj.js → anthropic--qj3xmqE.js} +1 -1
- package/dist/assets/{azure-openai-responses-IdZZrSrI.js → azure-openai-responses-DDRaS-MZ.js} +1 -1
- package/dist/assets/{google-Brt_lS1J.js → google-C-8-FIZS.js} +1 -1
- package/dist/assets/{google-vertex-B6HsoZ34.js → google-vertex-Dw2y_nqS.js} +1 -1
- package/dist/assets/{index-D0W9hAl_.css → index-B-WkttzD.css} +1 -1
- package/dist/assets/{index-D0CVLdX_.js → index-DRGbHzkd.js} +4 -4
- package/dist/assets/{mistral-CenXqwPz.js → mistral-u_5S4wj6.js} +1 -1
- package/dist/assets/{openai-codex-responses-D9ffGwbj.js → openai-codex-responses-CWZGpchs.js} +1 -1
- package/dist/assets/{openai-completions-eWdeSGBG.js → openai-completions-C_DdwPuH.js} +1 -1
- package/dist/assets/{openai-responses-Cavpmjeu.js → openai-responses-CMp0ziUV.js} +1 -1
- package/dist/assets/{openai-responses-shared-DF3ZGaUx.js → openai-responses-shared-CORWeerT.js} +1 -1
- package/dist/index.html +2 -2
- package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/LICENSE +201 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/README.md +62 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +156 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/constants.js +2 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromEnvSigningName.js +16 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js +80 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/fromStatic.js +8 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/getNewSsoOidcToken.js +11 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/getSsoOidcClient.js +10 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/index.js +4 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/nodeProvider.js +5 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/validateTokenExpiry.js +7 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/validateTokenKey.js +7 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/dist-es/writeSSOTokenToFile.js +8 -0
- package/node_modules/@aws-sdk/credential-provider-sso/node_modules/@aws-sdk/token-providers/package.json +69 -0
- package/node_modules/@aws-sdk/token-providers/package.json +1 -1
- package/node_modules/@smithy/core/dist-cjs/index.js +3 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +3 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.browser.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.native.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +9 -40
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +9 -40
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +12 -142
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +7 -9
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +184 -0
- package/node_modules/@smithy/core/dist-es/index.js +6 -6
- package/node_modules/@smithy/core/dist-es/submodules/client/index.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/config/config-resolver/regionConfig/checkRegion.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/index.browser.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/index.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/toEndpointV1.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/resolveEndpointConfig.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/lib/index.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +1 -2
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +5 -5
- package/node_modules/@smithy/core/dist-es/submodules/protocols/middleware-content-length/contentLengthMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/requestBuilder.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js +3 -4
- package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js +1 -2
- package/node_modules/@smithy/core/dist-es/submodules/serde/middleware-serde/deserializerMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/transport/index.js +9 -0
- package/node_modules/@smithy/core/dist-es/submodules/{protocols/url-parser → transport}/parseUrl.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/{endpoints → transport}/toEndpointV1.js +1 -1
- package/node_modules/@smithy/core/package.json +19 -10
- package/node_modules/@smithy/core/transport.js +5 -0
- package/node_modules/@smithy/credential-provider-imds/package.json +2 -2
- package/node_modules/@smithy/fetch-http-handler/package.json +2 -2
- package/node_modules/@smithy/node-http-handler/package.json +2 -2
- package/node_modules/@smithy/signature-v4/package.json +2 -2
- package/node_modules/eventsource-parser/README.md +31 -0
- package/node_modules/eventsource-parser/dist/index.cjs +21 -10
- package/node_modules/eventsource-parser/dist/index.js +21 -10
- package/node_modules/eventsource-parser/dist/stream.cjs +4 -3
- package/node_modules/eventsource-parser/dist/stream.js +4 -3
- package/node_modules/eventsource-parser/package.json +8 -8
- package/package.json +1 -1
- package/node_modules/@smithy/core/dist-cjs/getSmithyContext.js +0 -6
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.js +0 -21
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/getHttpAuthSchemePlugin.js +0 -21
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +0 -46
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/index.js +0 -6
- package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/resolveAuthOptions.js +0 -24
- package/node_modules/@smithy/core/dist-cjs/middleware-http-signing/getHttpSigningMiddleware.js +0 -19
- package/node_modules/@smithy/core/dist-cjs/middleware-http-signing/httpSigningMiddleware.js +0 -27
- package/node_modules/@smithy/core/dist-cjs/middleware-http-signing/index.js +0 -5
- package/node_modules/@smithy/core/dist-cjs/normalizeProvider.js +0 -10
- package/node_modules/@smithy/core/dist-cjs/pagination/createPaginator.js +0 -44
- package/node_modules/@smithy/core/dist-cjs/request-builder/requestBuilder.js +0 -5
- package/node_modules/@smithy/core/dist-cjs/setFeature.js +0 -14
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/DefaultIdentityProviderConfig.js +0 -18
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/httpAuthSchemes/httpApiKeyAuth.js +0 -38
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/httpAuthSchemes/httpBearerAuth.js +0 -15
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/httpAuthSchemes/index.js +0 -6
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/httpAuthSchemes/noAuth.js +0 -9
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/index.js +0 -6
- package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/memoizeIdentityProvider.js +0 -61
- package/node_modules/@smithy/core/dist-es/request-builder/requestBuilder.js +0 -1
- package/node_modules/@smithy/core/dist-es/submodules/client/util-middleware/getSmithyContext.js +0 -2
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/TestVectors.fixture.js +0 -146
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/vectorTypes.fixture.js +0 -1
- package/node_modules/@smithy/credential-provider-imds/dist-es/remoteProvider/index.js +0 -2
- package/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +0 -21
- package/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +0 -88
- package/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +0 -21
- package/node_modules/@smithy/signature-v4/dist-es/suite.fixture.js +0 -399
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/getHttpAuthSchemeEndpointRuleSetPlugin.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/getHttpAuthSchemePlugin.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/httpAuthSchemeMiddleware.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/index.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-auth-scheme → legacy-root-exports/middleware-http-auth-scheme}/resolveAuthOptions.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/getHttpSigningMiddleware.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/httpSigningMiddleware.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{middleware-http-signing → legacy-root-exports/middleware-http-signing}/index.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{pagination → legacy-root-exports/pagination}/createPaginator.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/DefaultIdentityProviderConfig.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/httpApiKeyAuth.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/httpBearerAuth.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/index.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/httpAuthSchemes/noAuth.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/index.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{util-identity-and-auth → legacy-root-exports/util-identity-and-auth}/memoizeIdentityProvider.js +0 -0
- /package/node_modules/@smithy/core/dist-es/{getSmithyContext.js → submodules/transport/getSmithyContext.js} +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{protocols/protocol-http → transport}/httpRequest.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{protocols/protocol-http → transport}/httpResponse.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{endpoints/util-endpoints/lib → transport}/isValidHostLabel.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{protocols/protocol-http → transport}/isValidHostname.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{client/util-middleware → transport}/normalizeProvider.js +0 -0
- /package/node_modules/@smithy/core/dist-es/submodules/{protocols/querystring-parser → transport}/parseQueryString.js +0 -0
package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.httpAuthSchemeMiddleware = void 0;
|
|
4
|
-
const client_1 = require("@smithy/core/client");
|
|
5
|
-
const resolveAuthOptions_1 = require("./resolveAuthOptions");
|
|
6
|
-
function convertHttpAuthSchemesToMap(httpAuthSchemes) {
|
|
7
|
-
const map = new Map();
|
|
8
|
-
for (const scheme of httpAuthSchemes) {
|
|
9
|
-
map.set(scheme.schemeId, scheme);
|
|
10
|
-
}
|
|
11
|
-
return map;
|
|
12
|
-
}
|
|
13
|
-
const httpAuthSchemeMiddleware = (config, mwOptions) => (next, context) => async (args) => {
|
|
14
|
-
const options = config.httpAuthSchemeProvider(await mwOptions.httpAuthSchemeParametersProvider(config, context, args.input));
|
|
15
|
-
const authSchemePreference = config.authSchemePreference ? await config.authSchemePreference() : [];
|
|
16
|
-
const resolvedOptions = (0, resolveAuthOptions_1.resolveAuthOptions)(options, authSchemePreference);
|
|
17
|
-
const authSchemes = convertHttpAuthSchemesToMap(config.httpAuthSchemes);
|
|
18
|
-
const smithyContext = (0, client_1.getSmithyContext)(context);
|
|
19
|
-
const failureReasons = [];
|
|
20
|
-
for (const option of resolvedOptions) {
|
|
21
|
-
const scheme = authSchemes.get(option.schemeId);
|
|
22
|
-
if (!scheme) {
|
|
23
|
-
failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`);
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
const identityProvider = scheme.identityProvider(await mwOptions.identityProviderConfigProvider(config));
|
|
27
|
-
if (!identityProvider) {
|
|
28
|
-
failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` did not have an IdentityProvider configured.`);
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
const { identityProperties = {}, signingProperties = {} } = option.propertiesExtractor?.(config, context) || {};
|
|
32
|
-
option.identityProperties = Object.assign(option.identityProperties || {}, identityProperties);
|
|
33
|
-
option.signingProperties = Object.assign(option.signingProperties || {}, signingProperties);
|
|
34
|
-
smithyContext.selectedHttpAuthScheme = {
|
|
35
|
-
httpAuthOption: option,
|
|
36
|
-
identity: await identityProvider(option.identityProperties),
|
|
37
|
-
signer: scheme.signer,
|
|
38
|
-
};
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
if (!smithyContext.selectedHttpAuthScheme) {
|
|
42
|
-
throw new Error(failureReasons.join("\n"));
|
|
43
|
-
}
|
|
44
|
-
return next(args);
|
|
45
|
-
};
|
|
46
|
-
exports.httpAuthSchemeMiddleware = httpAuthSchemeMiddleware;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./httpAuthSchemeMiddleware"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./getHttpAuthSchemeEndpointRuleSetPlugin"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./getHttpAuthSchemePlugin"), exports);
|
package/node_modules/@smithy/core/dist-cjs/middleware-http-auth-scheme/resolveAuthOptions.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.resolveAuthOptions = void 0;
|
|
4
|
-
const resolveAuthOptions = (candidateAuthOptions, authSchemePreference) => {
|
|
5
|
-
if (!authSchemePreference || authSchemePreference.length === 0) {
|
|
6
|
-
return candidateAuthOptions;
|
|
7
|
-
}
|
|
8
|
-
const preferredAuthOptions = [];
|
|
9
|
-
for (const preferredSchemeName of authSchemePreference) {
|
|
10
|
-
for (const candidateAuthOption of candidateAuthOptions) {
|
|
11
|
-
const candidateAuthSchemeName = candidateAuthOption.schemeId.split("#")[1];
|
|
12
|
-
if (candidateAuthSchemeName === preferredSchemeName) {
|
|
13
|
-
preferredAuthOptions.push(candidateAuthOption);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
for (const candidateAuthOption of candidateAuthOptions) {
|
|
18
|
-
if (!preferredAuthOptions.find(({ schemeId }) => schemeId === candidateAuthOption.schemeId)) {
|
|
19
|
-
preferredAuthOptions.push(candidateAuthOption);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return preferredAuthOptions;
|
|
23
|
-
};
|
|
24
|
-
exports.resolveAuthOptions = resolveAuthOptions;
|
package/node_modules/@smithy/core/dist-cjs/middleware-http-signing/getHttpSigningMiddleware.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getHttpSigningPlugin = exports.httpSigningMiddlewareOptions = void 0;
|
|
4
|
-
const httpSigningMiddleware_1 = require("./httpSigningMiddleware");
|
|
5
|
-
exports.httpSigningMiddlewareOptions = {
|
|
6
|
-
step: "finalizeRequest",
|
|
7
|
-
tags: ["HTTP_SIGNING"],
|
|
8
|
-
name: "httpSigningMiddleware",
|
|
9
|
-
aliases: ["apiKeyMiddleware", "tokenMiddleware", "awsAuthMiddleware"],
|
|
10
|
-
override: true,
|
|
11
|
-
relation: "after",
|
|
12
|
-
toMiddleware: "retryMiddleware",
|
|
13
|
-
};
|
|
14
|
-
const getHttpSigningPlugin = (config) => ({
|
|
15
|
-
applyToStack: (clientStack) => {
|
|
16
|
-
clientStack.addRelativeTo((0, httpSigningMiddleware_1.httpSigningMiddleware)(config), exports.httpSigningMiddlewareOptions);
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
exports.getHttpSigningPlugin = getHttpSigningPlugin;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.httpSigningMiddleware = void 0;
|
|
4
|
-
const client_1 = require("@smithy/core/client");
|
|
5
|
-
const protocols_1 = require("@smithy/core/protocols");
|
|
6
|
-
const defaultErrorHandler = (signingProperties) => (error) => {
|
|
7
|
-
throw error;
|
|
8
|
-
};
|
|
9
|
-
const defaultSuccessHandler = (httpResponse, signingProperties) => { };
|
|
10
|
-
const httpSigningMiddleware = (config) => (next, context) => async (args) => {
|
|
11
|
-
if (!protocols_1.HttpRequest.isInstance(args.request)) {
|
|
12
|
-
return next(args);
|
|
13
|
-
}
|
|
14
|
-
const smithyContext = (0, client_1.getSmithyContext)(context);
|
|
15
|
-
const scheme = smithyContext.selectedHttpAuthScheme;
|
|
16
|
-
if (!scheme) {
|
|
17
|
-
throw new Error(`No HttpAuthScheme was selected: unable to sign request`);
|
|
18
|
-
}
|
|
19
|
-
const { httpAuthOption: { signingProperties = {} }, identity, signer, } = scheme;
|
|
20
|
-
const output = await next({
|
|
21
|
-
...args,
|
|
22
|
-
request: await signer.sign(args.request, identity, signingProperties),
|
|
23
|
-
}).catch((signer.errorHandler || defaultErrorHandler)(signingProperties));
|
|
24
|
-
(signer.successHandler || defaultSuccessHandler)(output.response, signingProperties);
|
|
25
|
-
return output;
|
|
26
|
-
};
|
|
27
|
-
exports.httpSigningMiddleware = httpSigningMiddleware;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeProvider = void 0;
|
|
4
|
-
const normalizeProvider = (input) => {
|
|
5
|
-
if (typeof input === "function")
|
|
6
|
-
return input;
|
|
7
|
-
const promisified = Promise.resolve(input);
|
|
8
|
-
return () => promisified;
|
|
9
|
-
};
|
|
10
|
-
exports.normalizeProvider = normalizeProvider;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPaginator = createPaginator;
|
|
4
|
-
const makePagedClientRequest = async (CommandCtor, client, input, withCommand = (_) => _, ...args) => {
|
|
5
|
-
let command = new CommandCtor(input);
|
|
6
|
-
command = withCommand(command) ?? command;
|
|
7
|
-
return await client.send(command, ...args);
|
|
8
|
-
};
|
|
9
|
-
function createPaginator(ClientCtor, CommandCtor, inputTokenName, outputTokenName, pageSizeTokenName) {
|
|
10
|
-
return async function* paginateOperation(config, input, ...additionalArguments) {
|
|
11
|
-
const _input = input;
|
|
12
|
-
let token = config.startingToken ?? _input[inputTokenName];
|
|
13
|
-
let hasNext = true;
|
|
14
|
-
let page;
|
|
15
|
-
while (hasNext) {
|
|
16
|
-
_input[inputTokenName] = token;
|
|
17
|
-
if (pageSizeTokenName) {
|
|
18
|
-
_input[pageSizeTokenName] = _input[pageSizeTokenName] ?? config.pageSize;
|
|
19
|
-
}
|
|
20
|
-
if (config.client instanceof ClientCtor) {
|
|
21
|
-
page = await makePagedClientRequest(CommandCtor, config.client, input, config.withCommand, ...additionalArguments);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
throw new Error(`Invalid client, expected instance of ${ClientCtor.name}`);
|
|
25
|
-
}
|
|
26
|
-
yield page;
|
|
27
|
-
const prevToken = token;
|
|
28
|
-
token = get(page, outputTokenName);
|
|
29
|
-
hasNext = !!(token && (!config.stopOnSameToken || token !== prevToken));
|
|
30
|
-
}
|
|
31
|
-
return undefined;
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
const get = (fromObject, path) => {
|
|
35
|
-
let cursor = fromObject;
|
|
36
|
-
const pathComponents = path.split(".");
|
|
37
|
-
for (const step of pathComponents) {
|
|
38
|
-
if (!cursor || typeof cursor !== "object") {
|
|
39
|
-
return undefined;
|
|
40
|
-
}
|
|
41
|
-
cursor = cursor[step];
|
|
42
|
-
}
|
|
43
|
-
return cursor;
|
|
44
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.requestBuilder = void 0;
|
|
4
|
-
var protocols_1 = require("@smithy/core/protocols");
|
|
5
|
-
Object.defineProperty(exports, "requestBuilder", { enumerable: true, get: function () { return protocols_1.requestBuilder; } });
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setFeature = setFeature;
|
|
4
|
-
function setFeature(context, feature, value) {
|
|
5
|
-
if (!context.__smithy_context) {
|
|
6
|
-
context.__smithy_context = {
|
|
7
|
-
features: {},
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
else if (!context.__smithy_context.features) {
|
|
11
|
-
context.__smithy_context.features = {};
|
|
12
|
-
}
|
|
13
|
-
context.__smithy_context.features[feature] = value;
|
|
14
|
-
}
|
package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/DefaultIdentityProviderConfig.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DefaultIdentityProviderConfig = void 0;
|
|
4
|
-
class DefaultIdentityProviderConfig {
|
|
5
|
-
authSchemes = new Map();
|
|
6
|
-
constructor(config) {
|
|
7
|
-
for (const key in config) {
|
|
8
|
-
const value = config[key];
|
|
9
|
-
if (value !== undefined) {
|
|
10
|
-
this.authSchemes.set(key, value);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
getIdentityProvider(schemeId) {
|
|
15
|
-
return this.authSchemes.get(schemeId);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.DefaultIdentityProviderConfig = DefaultIdentityProviderConfig;
|
package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/httpAuthSchemes/httpApiKeyAuth.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpApiKeyAuthSigner = void 0;
|
|
4
|
-
const protocols_1 = require("@smithy/core/protocols");
|
|
5
|
-
const types_1 = require("@smithy/types");
|
|
6
|
-
class HttpApiKeyAuthSigner {
|
|
7
|
-
async sign(httpRequest, identity, signingProperties) {
|
|
8
|
-
if (!signingProperties) {
|
|
9
|
-
throw new Error("request could not be signed with `apiKey` since the `name` and `in` signer properties are missing");
|
|
10
|
-
}
|
|
11
|
-
if (!signingProperties.name) {
|
|
12
|
-
throw new Error("request could not be signed with `apiKey` since the `name` signer property is missing");
|
|
13
|
-
}
|
|
14
|
-
if (!signingProperties.in) {
|
|
15
|
-
throw new Error("request could not be signed with `apiKey` since the `in` signer property is missing");
|
|
16
|
-
}
|
|
17
|
-
if (!identity.apiKey) {
|
|
18
|
-
throw new Error("request could not be signed with `apiKey` since the `apiKey` is not defined");
|
|
19
|
-
}
|
|
20
|
-
const clonedRequest = protocols_1.HttpRequest.clone(httpRequest);
|
|
21
|
-
if (signingProperties.in === types_1.HttpApiKeyAuthLocation.QUERY) {
|
|
22
|
-
clonedRequest.query[signingProperties.name] = identity.apiKey;
|
|
23
|
-
}
|
|
24
|
-
else if (signingProperties.in === types_1.HttpApiKeyAuthLocation.HEADER) {
|
|
25
|
-
clonedRequest.headers[signingProperties.name] = signingProperties.scheme
|
|
26
|
-
? `${signingProperties.scheme} ${identity.apiKey}`
|
|
27
|
-
: identity.apiKey;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
throw new Error("request can only be signed with `apiKey` locations `query` or `header`, " +
|
|
31
|
-
"but found: `" +
|
|
32
|
-
signingProperties.in +
|
|
33
|
-
"`");
|
|
34
|
-
}
|
|
35
|
-
return clonedRequest;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
exports.HttpApiKeyAuthSigner = HttpApiKeyAuthSigner;
|
package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/httpAuthSchemes/httpBearerAuth.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HttpBearerAuthSigner = void 0;
|
|
4
|
-
const protocols_1 = require("@smithy/core/protocols");
|
|
5
|
-
class HttpBearerAuthSigner {
|
|
6
|
-
async sign(httpRequest, identity, signingProperties) {
|
|
7
|
-
const clonedRequest = protocols_1.HttpRequest.clone(httpRequest);
|
|
8
|
-
if (!identity.token) {
|
|
9
|
-
throw new Error("request could not be signed with `token` since the `token` is not defined");
|
|
10
|
-
}
|
|
11
|
-
clonedRequest.headers["Authorization"] = `Bearer ${identity.token}`;
|
|
12
|
-
return clonedRequest;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.HttpBearerAuthSigner = HttpBearerAuthSigner;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./httpApiKeyAuth"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./httpBearerAuth"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./noAuth"), exports);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./DefaultIdentityProviderConfig"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./httpAuthSchemes"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./memoizeIdentityProvider"), exports);
|
package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/memoizeIdentityProvider.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.memoizeIdentityProvider = exports.doesIdentityRequireRefresh = exports.isIdentityExpired = exports.EXPIRATION_MS = exports.createIsIdentityExpiredFunction = void 0;
|
|
4
|
-
const createIsIdentityExpiredFunction = (expirationMs) => function isIdentityExpired(identity) {
|
|
5
|
-
return (0, exports.doesIdentityRequireRefresh)(identity) && identity.expiration.getTime() - Date.now() < expirationMs;
|
|
6
|
-
};
|
|
7
|
-
exports.createIsIdentityExpiredFunction = createIsIdentityExpiredFunction;
|
|
8
|
-
exports.EXPIRATION_MS = 300_000;
|
|
9
|
-
exports.isIdentityExpired = (0, exports.createIsIdentityExpiredFunction)(exports.EXPIRATION_MS);
|
|
10
|
-
const doesIdentityRequireRefresh = (identity) => identity.expiration !== undefined;
|
|
11
|
-
exports.doesIdentityRequireRefresh = doesIdentityRequireRefresh;
|
|
12
|
-
const memoizeIdentityProvider = (provider, isExpired, requiresRefresh) => {
|
|
13
|
-
if (provider === undefined) {
|
|
14
|
-
return undefined;
|
|
15
|
-
}
|
|
16
|
-
const normalizedProvider = typeof provider !== "function" ? async () => Promise.resolve(provider) : provider;
|
|
17
|
-
let resolved;
|
|
18
|
-
let pending;
|
|
19
|
-
let hasResult;
|
|
20
|
-
let isConstant = false;
|
|
21
|
-
const coalesceProvider = async (options) => {
|
|
22
|
-
if (!pending) {
|
|
23
|
-
pending = normalizedProvider(options);
|
|
24
|
-
}
|
|
25
|
-
try {
|
|
26
|
-
resolved = await pending;
|
|
27
|
-
hasResult = true;
|
|
28
|
-
isConstant = false;
|
|
29
|
-
}
|
|
30
|
-
finally {
|
|
31
|
-
pending = undefined;
|
|
32
|
-
}
|
|
33
|
-
return resolved;
|
|
34
|
-
};
|
|
35
|
-
if (isExpired === undefined) {
|
|
36
|
-
return async (options) => {
|
|
37
|
-
if (!hasResult || options?.forceRefresh) {
|
|
38
|
-
resolved = await coalesceProvider(options);
|
|
39
|
-
}
|
|
40
|
-
return resolved;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
return async (options) => {
|
|
44
|
-
if (!hasResult || options?.forceRefresh) {
|
|
45
|
-
resolved = await coalesceProvider(options);
|
|
46
|
-
}
|
|
47
|
-
if (isConstant) {
|
|
48
|
-
return resolved;
|
|
49
|
-
}
|
|
50
|
-
if (!requiresRefresh(resolved)) {
|
|
51
|
-
isConstant = true;
|
|
52
|
-
return resolved;
|
|
53
|
-
}
|
|
54
|
-
if (isExpired(resolved)) {
|
|
55
|
-
await coalesceProvider(options);
|
|
56
|
-
return resolved;
|
|
57
|
-
}
|
|
58
|
-
return resolved;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
exports.memoizeIdentityProvider = memoizeIdentityProvider;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { requestBuilder } from "@smithy/core/protocols";
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { Int64 } from "./Int64";
|
|
2
|
-
export const vectors = {
|
|
3
|
-
all_headers: {
|
|
4
|
-
expectation: "success",
|
|
5
|
-
encoded: Uint8Array.from([
|
|
6
|
-
0, 0, 0, 204, 0, 0, 0, 175, 15, 174, 100, 202, 10, 101, 118, 101, 110, 116, 45, 116, 121, 112, 101, 4, 0, 0, 160,
|
|
7
|
-
12, 12, 99, 111, 110, 116, 101, 110, 116, 45, 116, 121, 112, 101, 7, 0, 16, 97, 112, 112, 108, 105, 99, 97, 116,
|
|
8
|
-
105, 111, 110, 47, 106, 115, 111, 110, 10, 98, 111, 111, 108, 32, 102, 97, 108, 115, 101, 1, 9, 98, 111, 111, 108,
|
|
9
|
-
32, 116, 114, 117, 101, 0, 4, 98, 121, 116, 101, 2, 207, 8, 98, 121, 116, 101, 32, 98, 117, 102, 6, 0, 20, 73, 39,
|
|
10
|
-
109, 32, 97, 32, 108, 105, 116, 116, 108, 101, 32, 116, 101, 97, 112, 111, 116, 33, 9, 116, 105, 109, 101, 115,
|
|
11
|
-
116, 97, 109, 112, 8, 0, 0, 0, 0, 0, 132, 95, 237, 5, 105, 110, 116, 49, 54, 3, 0, 42, 5, 105, 110, 116, 54, 52,
|
|
12
|
-
5, 0, 0, 0, 0, 2, 135, 87, 178, 4, 117, 117, 105, 100, 9, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
|
|
13
|
-
123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125, 171, 165, 241, 12,
|
|
14
|
-
]),
|
|
15
|
-
decoded: {
|
|
16
|
-
headers: {
|
|
17
|
-
"event-type": {
|
|
18
|
-
type: "integer",
|
|
19
|
-
value: 40972,
|
|
20
|
-
},
|
|
21
|
-
"content-type": {
|
|
22
|
-
type: "string",
|
|
23
|
-
value: "application/json",
|
|
24
|
-
},
|
|
25
|
-
"bool false": {
|
|
26
|
-
type: "boolean",
|
|
27
|
-
value: false,
|
|
28
|
-
},
|
|
29
|
-
"bool true": {
|
|
30
|
-
type: "boolean",
|
|
31
|
-
value: true,
|
|
32
|
-
},
|
|
33
|
-
byte: {
|
|
34
|
-
type: "byte",
|
|
35
|
-
value: -49,
|
|
36
|
-
},
|
|
37
|
-
"byte buf": {
|
|
38
|
-
type: "binary",
|
|
39
|
-
value: Uint8Array.from([
|
|
40
|
-
73, 39, 109, 32, 97, 32, 108, 105, 116, 116, 108, 101, 32, 116, 101, 97, 112, 111, 116, 33,
|
|
41
|
-
]),
|
|
42
|
-
},
|
|
43
|
-
timestamp: {
|
|
44
|
-
type: "timestamp",
|
|
45
|
-
value: new Date(8675309),
|
|
46
|
-
},
|
|
47
|
-
int16: {
|
|
48
|
-
type: "short",
|
|
49
|
-
value: 42,
|
|
50
|
-
},
|
|
51
|
-
int64: {
|
|
52
|
-
type: "long",
|
|
53
|
-
value: Int64.fromNumber(42424242),
|
|
54
|
-
},
|
|
55
|
-
uuid: {
|
|
56
|
-
type: "uuid",
|
|
57
|
-
value: "01020304-0506-0708-090a-0b0c0d0e0f10",
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
body: Uint8Array.from([123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125]),
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
empty_message: {
|
|
64
|
-
expectation: "success",
|
|
65
|
-
encoded: Uint8Array.from([0, 0, 0, 16, 0, 0, 0, 0, 5, 194, 72, 235, 125, 152, 200, 255]),
|
|
66
|
-
decoded: {
|
|
67
|
-
headers: {},
|
|
68
|
-
body: Uint8Array.from([]),
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
int32_header: {
|
|
72
|
-
expectation: "success",
|
|
73
|
-
encoded: Uint8Array.from([
|
|
74
|
-
0, 0, 0, 45, 0, 0, 0, 16, 65, 196, 36, 184, 10, 101, 118, 101, 110, 116, 45, 116, 121, 112, 101, 4, 0, 0, 160, 12,
|
|
75
|
-
123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125, 54, 244, 128, 160,
|
|
76
|
-
]),
|
|
77
|
-
decoded: {
|
|
78
|
-
headers: {
|
|
79
|
-
"event-type": {
|
|
80
|
-
type: "integer",
|
|
81
|
-
value: 40972,
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
body: Uint8Array.from([123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125]),
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
payload_no_headers: {
|
|
88
|
-
expectation: "success",
|
|
89
|
-
encoded: Uint8Array.from([
|
|
90
|
-
0, 0, 0, 29, 0, 0, 0, 0, 253, 82, 140, 90, 123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125, 195, 101, 57,
|
|
91
|
-
54,
|
|
92
|
-
]),
|
|
93
|
-
decoded: {
|
|
94
|
-
headers: {},
|
|
95
|
-
body: Uint8Array.from([123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125]),
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
payload_one_str_header: {
|
|
99
|
-
expectation: "success",
|
|
100
|
-
encoded: Uint8Array.from([
|
|
101
|
-
0, 0, 0, 61, 0, 0, 0, 32, 7, 253, 131, 150, 12, 99, 111, 110, 116, 101, 110, 116, 45, 116, 121, 112, 101, 7, 0,
|
|
102
|
-
16, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, 115, 111, 110, 123, 39, 102, 111, 111, 39, 58,
|
|
103
|
-
39, 98, 97, 114, 39, 125, 141, 156, 8, 177,
|
|
104
|
-
]),
|
|
105
|
-
decoded: {
|
|
106
|
-
headers: {
|
|
107
|
-
"content-type": {
|
|
108
|
-
type: "string",
|
|
109
|
-
value: "application/json",
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
body: Uint8Array.from([123, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125]),
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
corrupted_headers: {
|
|
116
|
-
expectation: "failure",
|
|
117
|
-
encoded: Uint8Array.from([
|
|
118
|
-
0, 0, 0, 61, 0, 0, 0, 32, 7, 253, 131, 150, 12, 99, 111, 110, 116, 101, 110, 116, 45, 116, 121, 112, 101, 7, 0,
|
|
119
|
-
16, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, 115, 111, 110, 123, 97, 102, 111, 111, 39, 58,
|
|
120
|
-
39, 98, 97, 114, 39, 125, 141, 156, 8, 177,
|
|
121
|
-
]),
|
|
122
|
-
},
|
|
123
|
-
corrupted_header_len: {
|
|
124
|
-
expectation: "failure",
|
|
125
|
-
encoded: Uint8Array.from([
|
|
126
|
-
0, 0, 0, 61, 0, 0, 0, 33, 7, 253, 131, 150, 12, 99, 111, 110, 116, 101, 110, 116, 45, 116, 121, 112, 101, 7, 0,
|
|
127
|
-
16, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, 115, 111, 110, 123, 39, 102, 111, 111, 39, 58,
|
|
128
|
-
39, 98, 97, 114, 39, 125, 141, 156, 8, 177,
|
|
129
|
-
]),
|
|
130
|
-
},
|
|
131
|
-
corrupted_length: {
|
|
132
|
-
expectation: "failure",
|
|
133
|
-
encoded: Uint8Array.from([
|
|
134
|
-
0, 0, 0, 62, 0, 0, 0, 32, 7, 253, 131, 150, 12, 99, 111, 110, 116, 101, 110, 116, 45, 116, 121, 112, 101, 7, 0,
|
|
135
|
-
16, 97, 112, 112, 108, 105, 99, 97, 116, 105, 111, 110, 47, 106, 115, 111, 110, 123, 39, 102, 111, 111, 39, 58,
|
|
136
|
-
39, 98, 97, 114, 39, 125, 141, 156, 8, 177,
|
|
137
|
-
]),
|
|
138
|
-
},
|
|
139
|
-
corrupted_payload: {
|
|
140
|
-
expectation: "failure",
|
|
141
|
-
encoded: Uint8Array.from([
|
|
142
|
-
0, 0, 0, 29, 0, 0, 0, 0, 253, 82, 140, 90, 91, 39, 102, 111, 111, 39, 58, 39, 98, 97, 114, 39, 125, 195, 101, 57,
|
|
143
|
-
54,
|
|
144
|
-
]),
|
|
145
|
-
},
|
|
146
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Readable } from "node:stream";
|
|
2
|
-
export class ReadFromBuffers extends Readable {
|
|
3
|
-
buffersToRead;
|
|
4
|
-
numBuffersRead = 0;
|
|
5
|
-
errorAfter;
|
|
6
|
-
constructor(options) {
|
|
7
|
-
super(options);
|
|
8
|
-
this.buffersToRead = options.buffers;
|
|
9
|
-
this.errorAfter = typeof options.errorAfter === "number" ? options.errorAfter : -1;
|
|
10
|
-
}
|
|
11
|
-
_read() {
|
|
12
|
-
if (this.errorAfter !== -1 && this.errorAfter === this.numBuffersRead) {
|
|
13
|
-
this.emit("error", new Error("Mock Error"));
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
if (this.numBuffersRead >= this.buffersToRead.length) {
|
|
17
|
-
return this.push(null);
|
|
18
|
-
}
|
|
19
|
-
return this.push(this.buffersToRead[this.numBuffersRead++]);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { createServer as createHttp2Server } from "node:http2";
|
|
3
|
-
import { createServer as createHttpServer, } from "node:http";
|
|
4
|
-
import { createServer as createHttpsServer } from "node:https";
|
|
5
|
-
import { join } from "node:path";
|
|
6
|
-
import { Readable } from "node:stream";
|
|
7
|
-
import { timing } from "./timing";
|
|
8
|
-
const fixturesDir = join(__dirname, "..", "fixtures");
|
|
9
|
-
const setResponseHeaders = (response, headers) => {
|
|
10
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
11
|
-
response.setHeader(key, value);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
const setResponseBody = (response, body) => {
|
|
15
|
-
if (body instanceof Readable) {
|
|
16
|
-
body.pipe(response);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
response.end(body);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
export const createResponseFunction = (httpResp) => (request, response) => {
|
|
23
|
-
response.statusCode = httpResp.statusCode;
|
|
24
|
-
if (httpResp.reason) {
|
|
25
|
-
response.statusMessage = httpResp.reason;
|
|
26
|
-
}
|
|
27
|
-
setResponseHeaders(response, httpResp.headers);
|
|
28
|
-
setResponseBody(response, httpResp.body);
|
|
29
|
-
};
|
|
30
|
-
export const createResponseFunctionWithDelay = (httpResp, delay) => (request, response) => {
|
|
31
|
-
response.statusCode = httpResp.statusCode;
|
|
32
|
-
if (httpResp.reason) {
|
|
33
|
-
response.statusMessage = httpResp.reason;
|
|
34
|
-
}
|
|
35
|
-
setResponseHeaders(response, httpResp.headers);
|
|
36
|
-
timing.setTimeout(() => setResponseBody(response, httpResp.body), delay);
|
|
37
|
-
};
|
|
38
|
-
export const createContinueResponseFunction = (httpResp) => (request, response) => {
|
|
39
|
-
response.writeContinue();
|
|
40
|
-
timing.setTimeout(() => {
|
|
41
|
-
createResponseFunction(httpResp)(request, response);
|
|
42
|
-
}, 100);
|
|
43
|
-
};
|
|
44
|
-
export const createMockHttpsServer = () => {
|
|
45
|
-
const server = createHttpsServer({
|
|
46
|
-
key: readFileSync(join(fixturesDir, "test-server-key.pem")),
|
|
47
|
-
cert: readFileSync(join(fixturesDir, "test-server-cert.pem")),
|
|
48
|
-
});
|
|
49
|
-
return server;
|
|
50
|
-
};
|
|
51
|
-
export const createMockHttpServer = () => {
|
|
52
|
-
const server = createHttpServer();
|
|
53
|
-
return server;
|
|
54
|
-
};
|
|
55
|
-
export const createMockHttp2Server = () => {
|
|
56
|
-
const server = createHttp2Server();
|
|
57
|
-
return server;
|
|
58
|
-
};
|
|
59
|
-
export const createMirrorResponseFunction = (httpResp) => (request, response) => {
|
|
60
|
-
const bufs = [];
|
|
61
|
-
request.on("data", (chunk) => {
|
|
62
|
-
bufs.push(chunk);
|
|
63
|
-
});
|
|
64
|
-
request.on("end", () => {
|
|
65
|
-
response.statusCode = httpResp.statusCode;
|
|
66
|
-
setResponseHeaders(response, httpResp.headers);
|
|
67
|
-
setResponseBody(response, Buffer.concat(bufs));
|
|
68
|
-
});
|
|
69
|
-
request.on("error", (err) => {
|
|
70
|
-
response.statusCode = 500;
|
|
71
|
-
setResponseHeaders(response, httpResp.headers);
|
|
72
|
-
setResponseBody(response, err.message);
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
export const getResponseBody = (response) => {
|
|
76
|
-
return new Promise((resolve, reject) => {
|
|
77
|
-
const bufs = [];
|
|
78
|
-
response.body.on("data", function (d) {
|
|
79
|
-
bufs.push(d);
|
|
80
|
-
});
|
|
81
|
-
response.body.on("end", function () {
|
|
82
|
-
resolve(Buffer.concat(bufs).toString());
|
|
83
|
-
});
|
|
84
|
-
response.body.on("error", (err) => {
|
|
85
|
-
reject(err);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
};
|