@qqbrowser/openclaw-qbot 0.10.18 → 0.10.20
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/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/auth/httpAuthSchemeProvider.js +11 -17
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/endpoint/bdd.js +2 -5
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/endpoint/endpointResolver.js +7 -11
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js +147 -99
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/models/BedrockRuntimeServiceException.js +4 -8
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/models/errors.js +25 -40
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/runtimeConfig.browser.js +27 -31
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/runtimeConfig.js +40 -44
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/runtimeConfig.native.js +6 -9
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/runtimeConfig.shared.js +22 -26
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/schemas/schemas_0.js +688 -315
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/BedrockRuntime.js +2 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/commands/InvokeGuardrailChecksCommand.js +16 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/commands/index.js +1 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/models/enums.js +50 -0
- package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/schemas/schemas_0.js +204 -16
- package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +18 -18
- package/node_modules/@aws-sdk/core/dist-cjs/index.js +45 -50
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/account-id-endpoint/index.js +2 -4
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.browser.js +21 -22
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +51 -51
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.native.js +21 -22
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +19 -21
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +107 -109
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/util/index.js +2 -4
- package/node_modules/@aws-sdk/core/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js +4 -6
- package/node_modules/@aws-sdk/credential-provider-env/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/checkUrl.js +3 -7
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.browser.js +12 -16
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js +16 -21
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/requestHelpers.js +14 -18
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/retry-wrapper.js +1 -5
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.browser.js +2 -5
- package/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js +2 -7
- package/node_modules/@aws-sdk/credential-provider-http/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js +47 -41
- package/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveProcessCredentials.js +8 -4
- package/node_modules/@aws-sdk/credential-provider-ini/dist-es/resolveWebIdentityCredentials.js +14 -10
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +13 -13
- package/node_modules/@aws-sdk/credential-provider-login/dist-cjs/index.js +31 -33
- package/node_modules/@aws-sdk/credential-provider-login/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +16 -18
- package/node_modules/@aws-sdk/credential-provider-node/package.json +11 -11
- package/node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js +11 -13
- package/node_modules/@aws-sdk/credential-provider-process/package.json +6 -6
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +22 -24
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-BGYXHf8s.js +3 -0
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js +10 -14
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js +2 -6
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js +3 -27
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +7 -7
- package/node_modules/@aws-sdk/eventstream-handler-node/dist-cjs/index.js +7 -9
- package/node_modules/@aws-sdk/eventstream-handler-node/package.json +5 -5
- package/node_modules/@aws-sdk/middleware-eventstream/dist-cjs/index.js +3 -5
- package/node_modules/@aws-sdk/middleware-eventstream/package.json +5 -5
- package/node_modules/@aws-sdk/middleware-websocket/dist-cjs/index.js +16 -18
- package/node_modules/@aws-sdk/middleware-websocket/package.json +6 -6
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/index.js +0 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +82 -84
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +158 -119
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +80 -82
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +80 -82
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +99 -101
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/commands/CreateOAuth2TokenCommand.js +4 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/bdd.js +70 -35
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/endpointResolver.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/models/enums.js +3 -0
- package/node_modules/@aws-sdk/nested-clients/package.json +9 -8
- package/node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js +4 -6
- package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +5 -5
- package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +26 -28
- package/node_modules/@aws-sdk/token-providers/package.json +7 -7
- package/node_modules/@aws-sdk/types/dist-cjs/index.js +7 -8
- package/node_modules/@aws-sdk/types/package.json +4 -4
- package/node_modules/@aws-sdk/util-locate-window/dist-cjs/index.js +0 -2
- package/node_modules/@aws-sdk/util-locate-window/package.json +4 -4
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js +2 -4
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-external/nodable_entities.js +4 -7
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.browser.js +2 -5
- package/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +7 -10
- package/node_modules/@aws-sdk/xml-builder/package.json +4 -4
- package/node_modules/@line/bot-sdk/node_modules/@types/node/package.json +2 -2
- package/node_modules/@nodable/entities/package.json +4 -1
- package/node_modules/@nodable/entities/src/EntityDecoder.js +104 -3
- package/node_modules/@nodable/entities/src/index.js +1 -1
- package/node_modules/@slack/oauth/node_modules/@slack/web-api/dist/chat-stream.js +8 -0
- package/node_modules/@slack/oauth/node_modules/@slack/web-api/package.json +1 -1
- package/node_modules/@slack/socket-mode/node_modules/@slack/web-api/dist/chat-stream.js +8 -0
- package/node_modules/@slack/socket-mode/node_modules/@slack/web-api/package.json +1 -1
- package/node_modules/@smithy/core/dist-cjs/index.js +13 -15
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +29 -31
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.browser.js +2 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.js +7 -9
- package/node_modules/@smithy/core/dist-cjs/submodules/checksum/index.native.js +3 -5
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +22 -23
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.browser.js +10 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.js +38 -39
- package/node_modules/@smithy/core/dist-cjs/submodules/config/index.native.js +10 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +14 -17
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +20 -23
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +9 -11
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +11 -13
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +59 -60
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +26 -27
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +28 -29
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +5 -7
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +4 -6
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +23 -25
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +4 -6
- package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +2 -4
- package/node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/legacy-root-exports/middleware-http-signing/httpSigningMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/cbor/SmithyRpcV2CborProtocol.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/endpointMiddleware.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/retry-pre-sra-deprecated/StandardRetryStrategy.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/retry/util-retry/DefaultRateLimiter.js +1 -1
- package/node_modules/@smithy/core/package.json +18 -17
- package/node_modules/@smithy/credential-provider-imds/dist-cjs/index.js +23 -24
- package/node_modules/@smithy/credential-provider-imds/package.json +7 -7
- package/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +6 -8
- package/node_modules/@smithy/fetch-http-handler/package.json +10 -10
- package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +11 -13
- package/node_modules/@smithy/node-http-handler/package.json +8 -8
- package/node_modules/@smithy/signature-v4/dist-cjs/index.js +27 -29
- package/node_modules/@smithy/signature-v4/package.json +7 -7
- package/node_modules/@smithy/types/dist-cjs/index.js +23 -18
- package/node_modules/@smithy/types/package.json +10 -10
- package/node_modules/axios/dist/axios.js +350 -134
- package/node_modules/axios/dist/axios.min.js +3 -3
- package/node_modules/axios/dist/browser/axios.cjs +355 -90
- package/node_modules/axios/dist/esm/axios.js +355 -90
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/node/axios.cjs +399 -104
- package/node_modules/axios/index.d.cts +2 -0
- package/node_modules/axios/lib/adapters/fetch.js +113 -37
- package/node_modules/axios/lib/adapters/http.js +132 -43
- package/node_modules/axios/lib/core/Axios.js +3 -2
- package/node_modules/axios/lib/core/AxiosHeaders.js +10 -7
- package/node_modules/axios/lib/core/buildFullPath.js +29 -1
- package/node_modules/axios/lib/core/mergeConfig.js +34 -0
- package/node_modules/axios/lib/defaults/transitional.js +1 -0
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/buildURL.js +5 -3
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +16 -11
- package/node_modules/axios/lib/helpers/formDataToJSON.js +25 -3
- package/node_modules/axios/lib/helpers/resolveConfig.js +5 -3
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +33 -1
- package/node_modules/axios/lib/helpers/toFormData.js +40 -10
- package/node_modules/axios/lib/utils.js +75 -11
- package/node_modules/axios/package.json +1 -1
- package/node_modules/body-parser/index.js +4 -20
- package/node_modules/body-parser/lib/read.js +17 -17
- package/node_modules/body-parser/lib/types/json.js +60 -32
- package/node_modules/body-parser/lib/types/raw.js +3 -3
- package/node_modules/body-parser/lib/types/text.js +3 -3
- package/node_modules/body-parser/lib/types/urlencoded.js +16 -20
- package/node_modules/body-parser/lib/utils.js +18 -16
- package/node_modules/body-parser/node_modules/content-type/dist/index.js +170 -0
- package/node_modules/body-parser/node_modules/content-type/package.json +52 -0
- package/node_modules/body-parser/package.json +23 -10
- package/node_modules/form-data/lib/form_data.js +14 -2
- package/node_modules/form-data/package.json +7 -7
- package/node_modules/protobufjs/dist/light/protobuf.js +145 -188
- package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/minimal/protobuf.js +33 -76
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/protobuf.js +165 -208
- package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/protobufjs/package.json +2 -3
- package/node_modules/protobufjs/src/util/minimal.js +0 -3
- package/package.json +1 -1
- package/skills/qqbrowser-skill/SKILL.md +90 -8
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-BKDNrsal.js +0 -8
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/signature-v4-multi-region",
|
|
3
|
-
"version": "3.996.
|
|
3
|
+
"version": "3.996.35",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
6
6
|
"build:browser": "node ./test-browser/browser-build/esbuild",
|
|
7
7
|
"build:cjs": "node ../../scripts/compilation/inline",
|
|
8
|
-
"build:es": "tsc -p tsconfig.es.json",
|
|
8
|
+
"build:es": "premove dist-es && tsc -p tsconfig.es.json",
|
|
9
9
|
"build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
|
|
10
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
10
|
+
"build:types": "premove dist-types && tsc -p tsconfig.types.json",
|
|
11
11
|
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
12
|
-
"clean": "premove dist-cjs dist-es dist-types
|
|
12
|
+
"clean": "premove dist-cjs dist-es dist-types",
|
|
13
13
|
"test": "yarn g:vitest run",
|
|
14
14
|
"test:watch": "yarn g:vitest watch",
|
|
15
15
|
"test:e2e": "yarn g:vitest run -c vitest.config.e2e.mts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"license": "Apache-2.0",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aws-sdk/types": "^3.973.
|
|
29
|
+
"@aws-sdk/types": "^3.973.13",
|
|
30
30
|
"@smithy/signature-v4": "^5.4.6",
|
|
31
31
|
"@smithy/types": "^4.14.3",
|
|
32
32
|
"tslib": "^2.6.2"
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var config = require('@smithy/core/config');
|
|
6
|
-
var node_fs = require('node:fs');
|
|
1
|
+
const { setTokenFeature } = require("@aws-sdk/core/client");
|
|
2
|
+
const { getBearerTokenEnvKey } = require("@aws-sdk/core/httpAuthSchemes");
|
|
3
|
+
const { TokenProviderError, getSSOTokenFilepath, parseKnownFiles, getProfileName, loadSsoSessionData, getSSOTokenFromFile, memoize, chain } = require("@smithy/core/config");
|
|
4
|
+
const { promises } = require("node:fs");
|
|
7
5
|
|
|
8
6
|
const fromEnvSigningName = ({ logger, signingName } = {}) => async () => {
|
|
9
7
|
logger?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
|
|
10
8
|
if (!signingName) {
|
|
11
|
-
throw new
|
|
9
|
+
throw new TokenProviderError("Please pass 'signingName' to compute environment variable key", { logger });
|
|
12
10
|
}
|
|
13
|
-
const bearerTokenKey =
|
|
11
|
+
const bearerTokenKey = getBearerTokenEnvKey(signingName);
|
|
14
12
|
if (!(bearerTokenKey in process.env)) {
|
|
15
|
-
throw new
|
|
13
|
+
throw new TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger });
|
|
16
14
|
}
|
|
17
15
|
const token = { token: process.env[bearerTokenKey] };
|
|
18
|
-
|
|
16
|
+
setTokenFeature(token, "BEARER_SERVICE_ENV_VARS", "3");
|
|
19
17
|
return token;
|
|
20
18
|
};
|
|
21
19
|
|
|
@@ -23,7 +21,7 @@ const EXPIRE_WINDOW_MS = 5 * 60 * 1000;
|
|
|
23
21
|
const REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;
|
|
24
22
|
|
|
25
23
|
const getSsoOidcClient = async (ssoRegion, init = {}, callerClientConfig) => {
|
|
26
|
-
const { SSOOIDCClient } =
|
|
24
|
+
const { SSOOIDCClient } = require('@aws-sdk/nested-clients/sso-oidc');
|
|
27
25
|
const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop] ?? callerClientConfig?.[prop];
|
|
28
26
|
const ssoOidcClient = new SSOOIDCClient(Object.assign({}, init.clientConfig ?? {}, {
|
|
29
27
|
region: ssoRegion ?? init.clientConfig?.region,
|
|
@@ -34,7 +32,7 @@ const getSsoOidcClient = async (ssoRegion, init = {}, callerClientConfig) => {
|
|
|
34
32
|
};
|
|
35
33
|
|
|
36
34
|
const getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConfig) => {
|
|
37
|
-
const { CreateTokenCommand } =
|
|
35
|
+
const { CreateTokenCommand } = require('@aws-sdk/nested-clients/sso-oidc');
|
|
38
36
|
const ssoOidcClient = await getSsoOidcClient(ssoRegion, init, callerClientConfig);
|
|
39
37
|
return ssoOidcClient.send(new CreateTokenCommand({
|
|
40
38
|
clientId: ssoToken.clientId,
|
|
@@ -46,19 +44,19 @@ const getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientCo
|
|
|
46
44
|
|
|
47
45
|
const validateTokenExpiry = (token) => {
|
|
48
46
|
if (token.expiration && token.expiration.getTime() < Date.now()) {
|
|
49
|
-
throw new
|
|
47
|
+
throw new TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);
|
|
50
48
|
}
|
|
51
49
|
};
|
|
52
50
|
|
|
53
51
|
const validateTokenKey = (key, value, forRefresh = false) => {
|
|
54
52
|
if (typeof value === "undefined") {
|
|
55
|
-
throw new
|
|
53
|
+
throw new TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
|
|
56
54
|
}
|
|
57
55
|
};
|
|
58
56
|
|
|
59
|
-
const { writeFile } =
|
|
57
|
+
const { writeFile } = promises;
|
|
60
58
|
const writeSSOTokenToFile = (id, ssoToken) => {
|
|
61
|
-
const tokenFilepath =
|
|
59
|
+
const tokenFilepath = getSSOTokenFilepath(id);
|
|
62
60
|
const tokenString = JSON.stringify(ssoToken, null, 2);
|
|
63
61
|
return writeFile(tokenFilepath, tokenString);
|
|
64
62
|
};
|
|
@@ -66,36 +64,36 @@ const writeSSOTokenToFile = (id, ssoToken) => {
|
|
|
66
64
|
const lastRefreshAttemptTime = new Date(0);
|
|
67
65
|
const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
68
66
|
init.logger?.debug("@aws-sdk/token-providers - fromSso");
|
|
69
|
-
const profiles = await
|
|
70
|
-
const profileName =
|
|
67
|
+
const profiles = await parseKnownFiles(init);
|
|
68
|
+
const profileName = getProfileName({
|
|
71
69
|
profile: init.profile ?? callerClientConfig?.profile,
|
|
72
70
|
});
|
|
73
71
|
const profile = profiles[profileName];
|
|
74
72
|
if (!profile) {
|
|
75
|
-
throw new
|
|
73
|
+
throw new TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
|
|
76
74
|
}
|
|
77
75
|
else if (!profile["sso_session"]) {
|
|
78
|
-
throw new
|
|
76
|
+
throw new TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
|
|
79
77
|
}
|
|
80
78
|
const ssoSessionName = profile["sso_session"];
|
|
81
|
-
const ssoSessions = await
|
|
79
|
+
const ssoSessions = await loadSsoSessionData(init);
|
|
82
80
|
const ssoSession = ssoSessions[ssoSessionName];
|
|
83
81
|
if (!ssoSession) {
|
|
84
|
-
throw new
|
|
82
|
+
throw new TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
|
|
85
83
|
}
|
|
86
84
|
for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) {
|
|
87
85
|
if (!ssoSession[ssoSessionRequiredKey]) {
|
|
88
|
-
throw new
|
|
86
|
+
throw new TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
|
|
89
87
|
}
|
|
90
88
|
}
|
|
91
89
|
ssoSession["sso_start_url"];
|
|
92
90
|
const ssoRegion = ssoSession["sso_region"];
|
|
93
91
|
let ssoToken;
|
|
94
92
|
try {
|
|
95
|
-
ssoToken = await
|
|
93
|
+
ssoToken = await getSSOTokenFromFile(ssoSessionName);
|
|
96
94
|
}
|
|
97
95
|
catch (e) {
|
|
98
|
-
throw new
|
|
96
|
+
throw new TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
|
|
99
97
|
}
|
|
100
98
|
validateTokenKey("accessToken", ssoToken.accessToken);
|
|
101
99
|
validateTokenKey("expiresAt", ssoToken.expiresAt);
|
|
@@ -141,13 +139,13 @@ const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
|
|
|
141
139
|
const fromStatic = ({ token, logger }) => async () => {
|
|
142
140
|
logger?.debug("@aws-sdk/token-providers - fromStatic");
|
|
143
141
|
if (!token || !token.token) {
|
|
144
|
-
throw new
|
|
142
|
+
throw new TokenProviderError(`Please pass a valid token to fromStatic`, false);
|
|
145
143
|
}
|
|
146
144
|
return token;
|
|
147
145
|
};
|
|
148
146
|
|
|
149
|
-
const nodeProvider = (init = {}) =>
|
|
150
|
-
throw new
|
|
147
|
+
const nodeProvider = (init = {}) => memoize(chain(fromSso(init), async () => {
|
|
148
|
+
throw new TokenProviderError("Could not load token from any providers", false);
|
|
151
149
|
}), (token) => token.expiration !== undefined && token.expiration.getTime() - Date.now() < 300000, (token) => token.expiration !== undefined);
|
|
152
150
|
|
|
153
151
|
exports.fromEnvSigningName = fromEnvSigningName;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/token-providers",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1069.0",
|
|
4
4
|
"description": "A collection of token providers",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
9
9
|
"build:cjs": "node ../../scripts/compilation/inline",
|
|
10
|
-
"build:es": "tsc -p tsconfig.es.json",
|
|
10
|
+
"build:es": "premove dist-es && tsc -p tsconfig.es.json",
|
|
11
11
|
"build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
|
|
12
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
12
|
+
"build:types": "premove dist-types && tsc -p tsconfig.types.json",
|
|
13
13
|
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
14
|
-
"clean": "premove dist-cjs dist-es dist-types
|
|
14
|
+
"clean": "premove dist-cjs dist-es dist-types",
|
|
15
15
|
"extract:docs": "api-extractor run --local",
|
|
16
16
|
"test": "yarn g:vitest run",
|
|
17
17
|
"test:watch": "yarn g:vitest watch",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
},
|
|
30
30
|
"license": "Apache-2.0",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@aws-sdk/core": "^3.974.
|
|
33
|
-
"@aws-sdk/nested-clients": "^3.997.
|
|
34
|
-
"@aws-sdk/types": "^3.973.
|
|
32
|
+
"@aws-sdk/core": "^3.974.21",
|
|
33
|
+
"@aws-sdk/nested-clients": "^3.997.21",
|
|
34
|
+
"@aws-sdk/types": "^3.973.13",
|
|
35
35
|
"@smithy/core": "^3.24.6",
|
|
36
36
|
"@smithy/types": "^4.14.3",
|
|
37
37
|
"tslib": "^2.6.2"
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
const { EndpointURLScheme, HttpAuthLocation, RequestHandlerProtocol } = require("@smithy/types");
|
|
2
|
+
exports.EndpointURLScheme = EndpointURLScheme;
|
|
3
|
+
exports.HttpAuthLocation = HttpAuthLocation;
|
|
4
|
+
exports.RequestHandlerProtocol = RequestHandlerProtocol;
|
|
2
5
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
exports.HostAddressType = void 0;
|
|
6
|
+
var HostAddressType;
|
|
6
7
|
(function (HostAddressType) {
|
|
7
8
|
HostAddressType["AAAA"] = "AAAA";
|
|
8
9
|
HostAddressType["A"] = "A";
|
|
9
|
-
})(
|
|
10
|
+
})(HostAddressType || (HostAddressType = {}));
|
|
10
11
|
|
|
11
|
-
exports.
|
|
12
|
-
exports.HttpAuthLocation = types.HttpAuthLocation;
|
|
13
|
-
exports.RequestHandlerProtocol = types.RequestHandlerProtocol;
|
|
12
|
+
exports.HostAddressType = HostAddressType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/types",
|
|
3
|
-
"version": "3.973.
|
|
3
|
+
"version": "3.973.13",
|
|
4
4
|
"main": "./dist-cjs/index.js",
|
|
5
5
|
"module": "./dist-es/index.js",
|
|
6
6
|
"types": "./dist-types/index.d.ts",
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
10
10
|
"build:cjs": "node ../../scripts/compilation/inline",
|
|
11
|
-
"build:es": "tsc -p tsconfig.es.json",
|
|
11
|
+
"build:es": "premove dist-es && tsc -p tsconfig.es.json",
|
|
12
12
|
"build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
|
|
13
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
13
|
+
"build:types": "premove dist-types && tsc -p tsconfig.types.json",
|
|
14
14
|
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
15
|
-
"clean": "premove dist-cjs dist-es dist-types
|
|
15
|
+
"clean": "premove dist-cjs dist-es dist-types",
|
|
16
16
|
"extract:docs": "api-extractor run --local",
|
|
17
17
|
"test": "tsc -p tsconfig.test.json"
|
|
18
18
|
},
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/util-locate-window",
|
|
3
|
-
"version": "3.965.
|
|
3
|
+
"version": "3.965.8",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
6
6
|
"build:cjs": "node ../../scripts/compilation/inline",
|
|
7
|
-
"build:es": "tsc -p tsconfig.es.json",
|
|
7
|
+
"build:es": "premove dist-es && tsc -p tsconfig.es.json",
|
|
8
8
|
"build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
|
|
9
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
9
|
+
"build:types": "premove dist-types && tsc -p tsconfig.types.json",
|
|
10
10
|
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
11
|
-
"clean": "premove dist-cjs dist-es dist-types
|
|
11
|
+
"clean": "premove dist-cjs dist-es dist-types",
|
|
12
12
|
"test": "yarn g:vitest run",
|
|
13
13
|
"test:watch": "yarn g:vitest watch"
|
|
14
14
|
},
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var xmlParser = require('./xml-parser');
|
|
1
|
+
const { parseXML } = require("./xml-parser");
|
|
2
|
+
exports.parseXML = parseXML;
|
|
4
3
|
|
|
5
4
|
const ATTR_ESCAPE_RE = /[&<>"]/g;
|
|
6
5
|
const ATTR_ESCAPE_MAP = {
|
|
@@ -126,6 +125,5 @@ class XmlNode {
|
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
127
|
|
|
129
|
-
exports.parseXML = xmlParser.parseXML;
|
|
130
128
|
exports.XmlNode = XmlNode;
|
|
131
129
|
exports.XmlText = XmlText;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EntityDecoderImpl = exports.CURRENCY = exports.COMMON_HTML = exports.XML = void 0;
|
|
4
|
-
exports.XML = {
|
|
1
|
+
const XML = {
|
|
5
2
|
amp: "&",
|
|
6
3
|
apos: "'",
|
|
7
4
|
gt: ">",
|
|
8
5
|
lt: "<",
|
|
9
6
|
quot: '"',
|
|
10
7
|
};
|
|
8
|
+
exports.XML = XML;
|
|
11
9
|
exports.COMMON_HTML = {
|
|
12
10
|
nbsp: "\u00a0",
|
|
13
11
|
copy: "\u00a9",
|
|
@@ -110,7 +108,7 @@ function parseNCRConfig(ncr) {
|
|
|
110
108
|
const clampedNull = Math.max(nullLevel, NCR_LEVEL.remove);
|
|
111
109
|
return { xmlVersion, onLevel, nullLevel: clampedNull };
|
|
112
110
|
}
|
|
113
|
-
|
|
111
|
+
exports.EntityDecoderImpl = class EntityDecoderImpl {
|
|
114
112
|
_limit;
|
|
115
113
|
_maxTotalExpansions;
|
|
116
114
|
_maxExpandedLength;
|
|
@@ -134,7 +132,7 @@ const EntityDecoderImpl = class EntityDecoderImpl {
|
|
|
134
132
|
this._postCheck = typeof options.postCheck === "function" ? options.postCheck : (r) => r;
|
|
135
133
|
this._limitTiers = parseLimitTiers(this._limit.applyLimitsTo ?? LIMIT_TIER_EXTERNAL);
|
|
136
134
|
this._numericAllowed = options.numericAllowed ?? true;
|
|
137
|
-
this._baseMap = mergeEntityMaps(
|
|
135
|
+
this._baseMap = mergeEntityMaps(XML, options.namedEntities || null);
|
|
138
136
|
this._externalMap = Object.create(null);
|
|
139
137
|
this._inputMap = Object.create(null);
|
|
140
138
|
this._totalExpansions = 0;
|
|
@@ -333,4 +331,3 @@ const EntityDecoderImpl = class EntityDecoderImpl {
|
|
|
333
331
|
return this._applyNCRAction(effective, token, cp);
|
|
334
332
|
}
|
|
335
333
|
};
|
|
336
|
-
exports.EntityDecoderImpl = EntityDecoderImpl;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseXML = parseXML;
|
|
4
1
|
let parser;
|
|
5
|
-
function parseXML(xmlString) {
|
|
2
|
+
exports.parseXML = function parseXML(xmlString) {
|
|
6
3
|
if (!parser) {
|
|
7
4
|
parser = new DOMParser();
|
|
8
5
|
}
|
|
@@ -57,4 +54,4 @@ function parseXML(xmlString) {
|
|
|
57
54
|
return {
|
|
58
55
|
[xmlDocument.documentElement.nodeName]: xmlToObj(xmlDocument.documentElement),
|
|
59
56
|
};
|
|
60
|
-
}
|
|
57
|
+
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const nodable_entities_1 = require("./xml-external/nodable_entities");
|
|
6
|
-
const entityDecoder = new nodable_entities_1.EntityDecoderImpl({
|
|
7
|
-
namedEntities: { ...nodable_entities_1.XML, ...nodable_entities_1.COMMON_HTML, ...nodable_entities_1.CURRENCY },
|
|
1
|
+
const { XMLParser } = require("fast-xml-parser");
|
|
2
|
+
const { COMMON_HTML, CURRENCY, EntityDecoderImpl, XML } = require("./xml-external/nodable_entities");
|
|
3
|
+
const entityDecoder = new EntityDecoderImpl({
|
|
4
|
+
namedEntities: { ...XML, ...COMMON_HTML, ...CURRENCY },
|
|
8
5
|
numericAllowed: true,
|
|
9
6
|
limit: {
|
|
10
7
|
maxTotalExpansions: Infinity,
|
|
@@ -13,7 +10,7 @@ const entityDecoder = new nodable_entities_1.EntityDecoderImpl({
|
|
|
13
10
|
xmlVersion: 1.1,
|
|
14
11
|
},
|
|
15
12
|
});
|
|
16
|
-
const parser = new
|
|
13
|
+
const parser = new XMLParser({
|
|
17
14
|
attributeNamePrefix: "",
|
|
18
15
|
processEntities: {
|
|
19
16
|
enabled: true,
|
|
@@ -42,6 +39,6 @@ const parser = new fast_xml_parser_1.XMLParser({
|
|
|
42
39
|
tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined),
|
|
43
40
|
maxNestedTags: Infinity,
|
|
44
41
|
});
|
|
45
|
-
function parseXML(xmlString) {
|
|
42
|
+
exports.parseXML = function parseXML(xmlString) {
|
|
46
43
|
return parser.parse(xmlString, true);
|
|
47
|
-
}
|
|
44
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/xml-builder",
|
|
3
|
-
"version": "3.972.
|
|
3
|
+
"version": "3.972.30",
|
|
4
4
|
"description": "XML utilities for the AWS SDK",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@smithy/types": "^4.14.3",
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
12
12
|
"build:cjs": "node ../../scripts/compilation/inline",
|
|
13
|
-
"build:es": "tsc -p tsconfig.es.json",
|
|
13
|
+
"build:es": "premove dist-es && tsc -p tsconfig.es.json",
|
|
14
14
|
"build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
|
|
15
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
15
|
+
"build:types": "premove dist-types && tsc -p tsconfig.types.json",
|
|
16
16
|
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
17
|
-
"clean": "premove dist-cjs dist-es dist-types
|
|
17
|
+
"clean": "premove dist-cjs dist-es dist-types",
|
|
18
18
|
"test": "yarn g:vitest run",
|
|
19
19
|
"test:watch": "yarn g:vitest watch"
|
|
20
20
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@types/node",
|
|
3
|
-
"version": "24.13.
|
|
3
|
+
"version": "24.13.2",
|
|
4
4
|
"description": "TypeScript definitions for node",
|
|
5
5
|
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -150,6 +150,6 @@
|
|
|
150
150
|
"undici-types": "~7.18.0"
|
|
151
151
|
},
|
|
152
152
|
"peerDependencies": {},
|
|
153
|
-
"typesPublisherContentHash": "
|
|
153
|
+
"typesPublisherContentHash": "a89004d9764ce24ab2bba15ae9f27f0c75ae8c293f77ce7f8846bbe10f8e18a8",
|
|
154
154
|
"typeScriptVersion": "5.3"
|
|
155
155
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodable/entities",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Entity parser for XML, HTML, External entites with security and NCR control",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -25,10 +25,13 @@
|
|
|
25
25
|
"xml",
|
|
26
26
|
"html",
|
|
27
27
|
"entity",
|
|
28
|
+
"entities",
|
|
29
|
+
"stringify",
|
|
28
30
|
"encode",
|
|
29
31
|
"decode",
|
|
30
32
|
"ncr",
|
|
31
33
|
"security",
|
|
34
|
+
"safe",
|
|
32
35
|
"performance"
|
|
33
36
|
],
|
|
34
37
|
"author": "Amit Gupta (https://solothought.com)",
|
|
@@ -5,6 +5,30 @@
|
|
|
5
5
|
|
|
6
6
|
import { XML as DEFAULT_XML_ENTITIES } from "./entities.js"
|
|
7
7
|
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Entity hook action constants
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Action constants for `onExternalEntity` and `onInputEntity` hooks.
|
|
14
|
+
*
|
|
15
|
+
* Use these instead of raw strings to avoid typos:
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* import EntityDecoder, { ENTITY_ACTION } from './EntityDecoder.js';
|
|
19
|
+
* const dec = new EntityDecoder({
|
|
20
|
+
* onInputEntity: (name, value) => ENTITY_ACTION.BLOCK,
|
|
21
|
+
* });
|
|
22
|
+
*/
|
|
23
|
+
export const ENTITY_ACTION = Object.freeze({
|
|
24
|
+
/** Resolve and expand the entity normally. */
|
|
25
|
+
ALLOW: 'allow',
|
|
26
|
+
/** Silently skip this entity — it will not be registered. */
|
|
27
|
+
BLOCK: 'block',
|
|
28
|
+
/** Throw an error, aborting entity registration entirely. */
|
|
29
|
+
THROW: 'throw',
|
|
30
|
+
});
|
|
31
|
+
|
|
8
32
|
// ---------------------------------------------------------------------------
|
|
9
33
|
// Helpers
|
|
10
34
|
// ---------------------------------------------------------------------------
|
|
@@ -169,6 +193,14 @@ export default class EntityDecoder {
|
|
|
169
193
|
* the effective action is max(onNCR, rangeMinimum).
|
|
170
194
|
* @param {'remove'|'throw'} [options.ncr.nullNCR='remove']
|
|
171
195
|
* Action for U+0000 (null). 'allow' and 'leave' are clamped to 'remove' since null is never safe.
|
|
196
|
+
* @param {((name: string, value: string) => 'allow'|'block'|'throw')|null} [options.onExternalEntity=null]
|
|
197
|
+
* Hook called when an external entity is registered via `setExternalEntities()` or
|
|
198
|
+
* `addExternalEntity()`. Return `ENTITY_ACTION.ALLOW` to accept the entity,
|
|
199
|
+
* `ENTITY_ACTION.BLOCK` to silently skip it, or `ENTITY_ACTION.THROW` to abort with an error.
|
|
200
|
+
* @param {((name: string, value: string) => 'allow'|'block'|'throw')|null} [options.onInputEntity=null]
|
|
201
|
+
* Hook called when an input entity is registered via `addInputEntities()`. Return
|
|
202
|
+
* `ENTITY_ACTION.ALLOW` to accept, `ENTITY_ACTION.BLOCK` to silently skip, or
|
|
203
|
+
* `ENTITY_ACTION.THROW` to abort with an error.
|
|
172
204
|
*/
|
|
173
205
|
constructor(options = {}) {
|
|
174
206
|
this._limit = options.limit || {};
|
|
@@ -204,6 +236,43 @@ export default class EntityDecoder {
|
|
|
204
236
|
this._ncrXmlVersion = ncrCfg.xmlVersion;
|
|
205
237
|
this._ncrOnLevel = ncrCfg.onLevel;
|
|
206
238
|
this._ncrNullLevel = ncrCfg.nullLevel;
|
|
239
|
+
|
|
240
|
+
// --- Registration hooks ---
|
|
241
|
+
/** @type {((name: string, value: string) => 'allow'|'block'|'throw')|null} */
|
|
242
|
+
this._onExternalEntity = typeof options.onExternalEntity === 'function'
|
|
243
|
+
? options.onExternalEntity
|
|
244
|
+
: null;
|
|
245
|
+
/** @type {((name: string, value: string) => 'allow'|'block'|'throw')|null} */
|
|
246
|
+
this._onInputEntity = typeof options.onInputEntity === 'function'
|
|
247
|
+
? options.onInputEntity
|
|
248
|
+
: null;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// -------------------------------------------------------------------------
|
|
252
|
+
// Private: registration hook dispatch
|
|
253
|
+
// -------------------------------------------------------------------------
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Invoke a registration hook for a single entity name/value pair.
|
|
257
|
+
* Returns true when the entity should be accepted, false when it should be
|
|
258
|
+
* silently skipped (BLOCK), and throws when the hook returns THROW.
|
|
259
|
+
*
|
|
260
|
+
* @param {((name: string, value: string) => 'allow'|'block'|'throw')|null} hook
|
|
261
|
+
* @param {string} name
|
|
262
|
+
* @param {string} value
|
|
263
|
+
* @param {string} context — used in error messages ('external' | 'input')
|
|
264
|
+
* @returns {boolean} true = accept, false = skip
|
|
265
|
+
*/
|
|
266
|
+
_applyRegistrationHook(hook, name, value, context) {
|
|
267
|
+
if (!hook) return true; // no hook → always accept
|
|
268
|
+
const action = hook(name, value);
|
|
269
|
+
if (action === ENTITY_ACTION.BLOCK) return false;
|
|
270
|
+
if (action === ENTITY_ACTION.THROW) {
|
|
271
|
+
throw new Error(
|
|
272
|
+
`[EntityDecoder] Registration of ${context} entity "&${name};" was rejected by hook`
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
return true; // ALLOW or any unknown return value → accept
|
|
207
276
|
}
|
|
208
277
|
|
|
209
278
|
// -------------------------------------------------------------------------
|
|
@@ -213,6 +282,9 @@ export default class EntityDecoder {
|
|
|
213
282
|
/**
|
|
214
283
|
* Replace the full set of persistent external entities.
|
|
215
284
|
* All keys are validated — throws on invalid characters.
|
|
285
|
+
* If `onExternalEntity` is set, it is called once per entry; entries that
|
|
286
|
+
* return `ENTITY_ACTION.BLOCK` are silently omitted, `ENTITY_ACTION.THROW`
|
|
287
|
+
* aborts the whole call.
|
|
216
288
|
* @param {Record<string, string | { regex?: RegExp, val: string }>} map
|
|
217
289
|
*/
|
|
218
290
|
setExternalEntities(map) {
|
|
@@ -221,18 +293,34 @@ export default class EntityDecoder {
|
|
|
221
293
|
validateEntityName(key);
|
|
222
294
|
}
|
|
223
295
|
}
|
|
224
|
-
this.
|
|
296
|
+
if (!this._onExternalEntity) {
|
|
297
|
+
this._externalMap = mergeEntityMaps(map);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
// Hook present — resolve values first, then filter
|
|
301
|
+
const flat = mergeEntityMaps(map);
|
|
302
|
+
const filtered = Object.create(null);
|
|
303
|
+
for (const [name, value] of Object.entries(flat)) {
|
|
304
|
+
if (this._applyRegistrationHook(this._onExternalEntity, name, value, 'external')) {
|
|
305
|
+
filtered[name] = value;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
this._externalMap = filtered;
|
|
225
309
|
}
|
|
226
310
|
|
|
227
311
|
/**
|
|
228
312
|
* Add a single persistent external entity.
|
|
313
|
+
* If `onExternalEntity` is set it is called before the entity is stored;
|
|
314
|
+
* `ENTITY_ACTION.BLOCK` silently skips storage, `ENTITY_ACTION.THROW` raises.
|
|
229
315
|
* @param {string} key
|
|
230
316
|
* @param {string} value
|
|
231
317
|
*/
|
|
232
318
|
addExternalEntity(key, value) {
|
|
233
319
|
validateEntityName(key);
|
|
234
320
|
if (typeof value === 'string' && value.indexOf('&') === -1) {
|
|
235
|
-
this.
|
|
321
|
+
if (this._applyRegistrationHook(this._onExternalEntity, key, value, 'external')) {
|
|
322
|
+
this._externalMap[key] = value;
|
|
323
|
+
}
|
|
236
324
|
}
|
|
237
325
|
}
|
|
238
326
|
|
|
@@ -243,12 +331,25 @@ export default class EntityDecoder {
|
|
|
243
331
|
/**
|
|
244
332
|
* Inject DOCTYPE entities for the current document.
|
|
245
333
|
* Also resets per-document expansion counters.
|
|
334
|
+
* If `onInputEntity` is set it is called once per entry; entries returning
|
|
335
|
+
* `ENTITY_ACTION.BLOCK` are silently omitted, `ENTITY_ACTION.THROW` aborts.
|
|
246
336
|
* @param {Record<string, string | { regx?: RegExp, regex?: RegExp, val: string }>} map
|
|
247
337
|
*/
|
|
248
338
|
addInputEntities(map) {
|
|
249
339
|
this._totalExpansions = 0;
|
|
250
340
|
this._expandedLength = 0;
|
|
251
|
-
this.
|
|
341
|
+
if (!this._onInputEntity) {
|
|
342
|
+
this._inputMap = mergeEntityMaps(map);
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
const flat = mergeEntityMaps(map);
|
|
346
|
+
const filtered = Object.create(null);
|
|
347
|
+
for (const [name, value] of Object.entries(flat)) {
|
|
348
|
+
if (this._applyRegistrationHook(this._onInputEntity, name, value, 'input')) {
|
|
349
|
+
filtered[name] = value;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
this._inputMap = filtered;
|
|
252
353
|
}
|
|
253
354
|
|
|
254
355
|
// -------------------------------------------------------------------------
|
|
@@ -46,6 +46,14 @@ class ChatStreamer {
|
|
|
46
46
|
this.state = 'starting';
|
|
47
47
|
this.streamArgs = args;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* @description The message timestamp of the stream. Returns `undefined` until the first flush
|
|
51
|
+
* (when `chat.startStream` is called).
|
|
52
|
+
* @see {@link https://docs.slack.dev/reference/methods/chat.update}
|
|
53
|
+
*/
|
|
54
|
+
get ts() {
|
|
55
|
+
return this.streamTs;
|
|
56
|
+
}
|
|
49
57
|
/**
|
|
50
58
|
* Append to the stream.
|
|
51
59
|
*
|