@slycode/slycode 0.2.10 → 0.2.12
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/messaging/index.js +4 -2
- package/dist/messaging/index.js.map +1 -1
- package/dist/messaging/stt.d.ts +1 -0
- package/dist/messaging/stt.js +66 -57
- package/dist/messaging/stt.js.map +1 -1
- package/dist/messaging/types.d.ts +1 -0
- package/dist/web/.next/BUILD_ID +1 -1
- package/dist/web/.next/build-manifest.json +2 -2
- package/dist/web/.next/node_modules/@aws-sdk/client-s3-ecbef8e33fd0b8f0/dist-cjs/auth/httpAuthSchemeProvider.js +126 -0
- package/dist/web/.next/node_modules/@aws-sdk/client-s3-ecbef8e33fd0b8f0/dist-cjs/endpoint/endpointResolver.js +33 -0
- package/dist/web/.next/node_modules/@aws-sdk/client-s3-ecbef8e33fd0b8f0/dist-cjs/endpoint/ruleset.js +7 -0
- package/dist/web/.next/node_modules/@aws-sdk/client-s3-ecbef8e33fd0b8f0/dist-cjs/index.js +3057 -0
- package/dist/web/.next/node_modules/@aws-sdk/client-s3-ecbef8e33fd0b8f0/dist-cjs/models/S3ServiceException.js +12 -0
- package/dist/web/.next/node_modules/@aws-sdk/client-s3-ecbef8e33fd0b8f0/dist-cjs/models/errors.js +203 -0
- package/dist/web/.next/node_modules/@aws-sdk/client-s3-ecbef8e33fd0b8f0/dist-cjs/runtimeConfig.js +67 -0
- package/dist/web/.next/node_modules/@aws-sdk/client-s3-ecbef8e33fd0b8f0/dist-cjs/runtimeConfig.shared.js +56 -0
- package/dist/web/.next/node_modules/@aws-sdk/client-s3-ecbef8e33fd0b8f0/dist-cjs/schemas/schemas_0.js +3258 -0
- package/dist/web/.next/node_modules/@aws-sdk/client-s3-ecbef8e33fd0b8f0/package.json +127 -0
- package/dist/web/.next/prerender-manifest.json +3 -3
- package/dist/web/.next/server/app/_global-error.html +2 -2
- package/dist/web/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/.next/server/app/_not-found.html +1 -1
- package/dist/web/.next/server/app/_not-found.rsc +2 -2
- package/dist/web/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/dist/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/dist/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/dist/web/.next/server/app/api/cli-assets/assistant/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/cli-assets/fix/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/cli-assets/import/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/cli-assets/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/cli-assets/store/preview/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/cli-assets/store/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/cli-assets/sync/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/cli-assets/updates/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/dashboard/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/file/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/git-status/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/kanban/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/kanban/stream/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/projects/[id]/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/projects/reorder/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/projects/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/scheduler/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/search/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/sly-actions/invalidate/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/sly-actions/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/transcribe/route.js +5 -5
- package/dist/web/.next/server/app/api/transcribe/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/api/version-check/route.js.nft.json +1 -1
- package/dist/web/.next/server/app/page.js.nft.json +1 -1
- package/dist/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/.next/server/app/project/[id]/page.js.nft.json +1 -1
- package/dist/web/.next/server/app/project/[id]/page_client-reference-manifest.js +1 -1
- package/dist/web/.next/server/chunks/[root-of-the-server]__1b9e0d6e._.js +19 -0
- package/dist/web/.next/server/chunks/{[root-of-the-server]__104b2da3._.js → [root-of-the-server]__4297cb97._.js} +3 -3
- package/dist/web/.next/server/chunks/[root-of-the-server]__52da7fe0._.js +5 -0
- package/dist/web/.next/server/chunks/{[root-of-the-server]__41df0777._.js → [root-of-the-server]__cf14e306._.js} +2 -2
- package/dist/web/.next/server/chunks/[root-of-the-server]__d5272169._.js +3 -0
- package/dist/web/.next/server/chunks/[root-of-the-server]__d56e68cb._.js +3 -0
- package/dist/web/.next/server/chunks/[root-of-the-server]__f5dae2ad._.js +3 -0
- package/dist/web/.next/server/chunks/{node_modules_ec9ae6c4._.js → node_modules_269a84e6._.js} +5 -5
- package/dist/web/.next/server/chunks/node_modules_9fc3887b._.js +3 -0
- package/dist/web/.next/server/chunks/node_modules_@aws-sdk_credential-provider-sso_dist-es_loadSso_570f147e.js +3 -0
- package/dist/web/.next/server/chunks/node_modules_@aws-sdk_nested-clients_dist-es_submodules_sts_index_c78619b3.js +1 -1
- package/dist/web/.next/server/chunks/node_modules_@smithy_smithy-client_dist-es_create-aggregated-client_db42850b.js +3 -0
- package/dist/web/.next/server/chunks/node_modules_c58ca22f._.js +3 -0
- package/dist/web/.next/server/chunks/node_modules_f96dfac4._.js +7 -0
- package/dist/web/.next/server/pages/404.html +1 -1
- package/dist/web/.next/server/pages/500.html +2 -2
- package/dist/web/.next/server/server-reference-manifest.js +1 -1
- package/dist/web/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/.next/static/chunks/{0bab8c7c82cef548.js → 17bf7ad67057dc74.js} +1 -1
- package/dist/web/.next/static/chunks/{1b46e836090e130b.js → 29b5d391d655a999.js} +1 -1
- package/dist/web/.next/static/chunks/3df3846316317676.css +1 -0
- package/dist/web/.next/static/chunks/{345c46e638c28d26.js → 8cb404d087e9f3c7.js} +1 -1
- package/dist/web/.next/static/chunks/{de965b463aff71a9.js → e8b318caa49fce00.js} +1 -1
- package/dist/web/node_modules/@aws/lambda-invoke-store/dist-cjs/invoke-store.js +119 -0
- package/dist/web/node_modules/@aws/lambda-invoke-store/package.json +55 -0
- package/dist/web/node_modules/@aws-crypto/crc32/build/main/aws_crc32.js +31 -0
- package/dist/web/node_modules/@aws-crypto/crc32/build/main/index.js +108 -0
- package/dist/web/node_modules/@aws-crypto/crc32/package.json +32 -0
- package/dist/web/node_modules/@aws-crypto/crc32c/build/main/aws_crc32c.js +31 -0
- package/dist/web/node_modules/@aws-crypto/crc32c/build/main/index.js +78 -0
- package/dist/web/node_modules/@aws-crypto/crc32c/package.json +32 -0
- package/dist/web/node_modules/@aws-crypto/util/build/main/convertToBuffer.js +24 -0
- package/dist/web/node_modules/@aws-crypto/util/build/main/index.js +14 -0
- package/dist/web/node_modules/@aws-crypto/util/build/main/isEmptyData.js +13 -0
- package/dist/web/node_modules/@aws-crypto/util/build/main/numToUint8.js +15 -0
- package/dist/web/node_modules/@aws-crypto/util/build/main/uint32ArrayFrom.js +20 -0
- package/dist/web/node_modules/@aws-crypto/util/node_modules/@smithy/is-array-buffer/dist-cjs/index.js +32 -0
- package/dist/web/node_modules/@aws-crypto/util/node_modules/@smithy/is-array-buffer/package.json +60 -0
- package/dist/web/node_modules/@aws-crypto/util/node_modules/@smithy/util-buffer-from/dist-cjs/index.js +47 -0
- package/dist/web/node_modules/@aws-crypto/util/node_modules/@smithy/util-buffer-from/package.json +61 -0
- package/dist/web/node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8/dist-cjs/index.js +65 -0
- package/dist/web/node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8/package.json +66 -0
- package/dist/web/node_modules/@aws-crypto/util/package.json +32 -0
- package/dist/web/node_modules/@aws-sdk/client-s3/dist-cjs/auth/httpAuthSchemeProvider.js +126 -0
- package/dist/web/node_modules/@aws-sdk/client-s3/dist-cjs/endpoint/endpointResolver.js +33 -0
- package/dist/web/node_modules/@aws-sdk/client-s3/dist-cjs/endpoint/ruleset.js +7 -0
- package/dist/web/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +3057 -0
- package/dist/web/node_modules/@aws-sdk/client-s3/dist-cjs/models/S3ServiceException.js +12 -0
- package/dist/web/node_modules/@aws-sdk/client-s3/dist-cjs/models/errors.js +203 -0
- package/dist/web/node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js +67 -0
- package/dist/web/node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.shared.js +56 -0
- package/dist/web/node_modules/@aws-sdk/client-s3/dist-cjs/schemas/schemas_0.js +3258 -0
- package/dist/web/node_modules/@aws-sdk/client-s3/package.json +127 -0
- package/dist/web/node_modules/@aws-sdk/core/dist-cjs/index.js +2212 -0
- package/dist/web/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +51 -0
- package/dist/web/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +307 -0
- package/dist/web/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +1859 -0
- package/dist/web/node_modules/@aws-sdk/core/package.json +121 -0
- package/dist/web/node_modules/@aws-sdk/crc64-nvme/dist-cjs/index.js +101 -0
- package/dist/web/node_modules/@aws-sdk/crc64-nvme/package.json +50 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js +41 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-env/package.json +63 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/checkUrl.js +46 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/fromHttp.js +70 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/requestHelpers.js +53 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-http/dist-cjs/fromHttp/retry-wrapper.js +17 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-http/dist-cjs/index.js +5 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-http/package.json +70 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js +224 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-ini/package.json +74 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-login/dist-cjs/index.js +286 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-login/package.json +68 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +156 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-node/package.json +72 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js +79 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-process/package.json +64 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +192 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-BKDNrsal.js +8 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-sso/package.json +66 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromTokenFile.js +34 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/fromWebToken.js +62 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js +27 -0
- package/dist/web/node_modules/@aws-sdk/credential-provider-web-identity/package.json +73 -0
- package/dist/web/node_modules/@aws-sdk/middleware-bucket-endpoint/dist-cjs/index.js +352 -0
- package/dist/web/node_modules/@aws-sdk/middleware-bucket-endpoint/package.json +60 -0
- package/dist/web/node_modules/@aws-sdk/middleware-expect-continue/dist-cjs/index.js +48 -0
- package/dist/web/node_modules/@aws-sdk/middleware-expect-continue/package.json +58 -0
- package/dist/web/node_modules/@aws-sdk/middleware-flexible-checksums/dist-cjs/getCrc32ChecksumAlgorithmFunction.js +26 -0
- package/dist/web/node_modules/@aws-sdk/middleware-flexible-checksums/dist-cjs/index.js +451 -0
- package/dist/web/node_modules/@aws-sdk/middleware-flexible-checksums/package.json +78 -0
- package/dist/web/node_modules/@aws-sdk/middleware-host-header/dist-cjs/index.js +41 -0
- package/dist/web/node_modules/@aws-sdk/middleware-host-header/package.json +59 -0
- package/dist/web/node_modules/@aws-sdk/middleware-location-constraint/dist-cjs/index.js +30 -0
- package/dist/web/node_modules/@aws-sdk/middleware-location-constraint/package.json +57 -0
- package/dist/web/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js +48 -0
- package/dist/web/node_modules/@aws-sdk/middleware-logger/package.json +59 -0
- package/dist/web/node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/index.js +29 -0
- package/dist/web/node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/recursionDetectionMiddleware.js +33 -0
- package/dist/web/node_modules/@aws-sdk/middleware-recursion-detection/package.json +63 -0
- package/dist/web/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js +570 -0
- package/dist/web/node_modules/@aws-sdk/middleware-sdk-s3/package.json +72 -0
- package/dist/web/node_modules/@aws-sdk/middleware-ssec/dist-cjs/index.js +73 -0
- package/dist/web/node_modules/@aws-sdk/middleware-ssec/package.json +57 -0
- package/dist/web/node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js +194 -0
- package/dist/web/node_modules/@aws-sdk/middleware-user-agent/package.json +63 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/auth/httpAuthSchemeProvider.js +56 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/endpoint/endpointResolver.js +18 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/endpoint/ruleset.js +133 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +170 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/models/SigninServiceException.js +12 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/models/errors.js +64 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/runtimeConfig.js +53 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/runtimeConfig.shared.js +49 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/schemas/schemas_0.js +125 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/auth/httpAuthSchemeProvider.js +56 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/endpoint/endpointResolver.js +18 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/endpoint/ruleset.js +106 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +160 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/models/SSOServiceException.js +12 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/models/errors.js +56 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/runtimeConfig.js +53 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/runtimeConfig.shared.js +49 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/schemas/schemas_0.js +90 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/auth/httpAuthSchemeProvider.js +56 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/endpoint/endpointResolver.js +18 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/endpoint/ruleset.js +106 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +172 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/models/SSOOIDCServiceException.js +12 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/models/errors.js +195 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/runtimeConfig.js +53 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/runtimeConfig.shared.js +49 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/schemas/schemas_0.js +140 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/STSClient.js +54 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/auth/httpAuthExtensionConfiguration.js +43 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/auth/httpAuthSchemeProvider.js +62 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/endpoint/EndpointParameters.js +19 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/endpoint/endpointResolver.js +18 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/endpoint/ruleset.js +145 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +202 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/models/STSServiceException.js +12 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/models/errors.js +95 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/runtimeConfig.js +67 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/runtimeConfig.shared.js +50 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/runtimeExtensions.js +13 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/schemas/schemas_0.js +195 -0
- package/dist/web/node_modules/@aws-sdk/nested-clients/package.json +147 -0
- package/dist/web/node_modules/@aws-sdk/region-config-resolver/dist-cjs/index.js +38 -0
- package/dist/web/node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/stsRegionDefaultResolver.js +20 -0
- package/dist/web/node_modules/@aws-sdk/region-config-resolver/package.json +62 -0
- package/dist/web/node_modules/@aws-sdk/signature-v4-multi-region/dist-cjs/index.js +121 -0
- package/dist/web/node_modules/@aws-sdk/signature-v4-multi-region/package.json +61 -0
- package/dist/web/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +157 -0
- package/dist/web/node_modules/@aws-sdk/token-providers/package.json +70 -0
- package/dist/web/node_modules/@aws-sdk/util-arn-parser/dist-cjs/index.js +27 -0
- package/dist/web/node_modules/@aws-sdk/util-arn-parser/package.json +55 -0
- package/dist/web/node_modules/@aws-sdk/util-endpoints/dist-cjs/index.js +406 -0
- package/dist/web/node_modules/@aws-sdk/util-endpoints/package.json +60 -0
- package/dist/web/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js +185 -0
- package/dist/web/node_modules/@aws-sdk/util-user-agent-node/package.json +69 -0
- package/dist/web/node_modules/@aws-sdk/xml-builder/dist-cjs/index.js +131 -0
- package/dist/web/node_modules/@aws-sdk/xml-builder/dist-cjs/xml-parser.js +23 -0
- package/dist/web/node_modules/@aws-sdk/xml-builder/package.json +63 -0
- package/dist/web/node_modules/@smithy/config-resolver/dist-cjs/index.js +198 -0
- package/dist/web/node_modules/@smithy/config-resolver/package.json +66 -0
- package/dist/web/node_modules/@smithy/core/dist-cjs/index.js +345 -0
- package/dist/web/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +1096 -0
- package/dist/web/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +22 -0
- package/dist/web/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +259 -0
- package/dist/web/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +884 -0
- package/dist/web/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +698 -0
- package/dist/web/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +694 -0
- package/dist/web/node_modules/@smithy/core/package.json +146 -0
- package/dist/web/node_modules/@smithy/credential-provider-imds/dist-cjs/index.js +372 -0
- package/dist/web/node_modules/@smithy/credential-provider-imds/package.json +70 -0
- package/dist/web/node_modules/@smithy/eventstream-codec/dist-cjs/index.js +388 -0
- package/dist/web/node_modules/@smithy/eventstream-codec/package.json +65 -0
- package/dist/web/node_modules/@smithy/eventstream-serde-config-resolver/dist-cjs/index.js +7 -0
- package/dist/web/node_modules/@smithy/eventstream-serde-config-resolver/package.json +62 -0
- package/dist/web/node_modules/@smithy/eventstream-serde-node/dist-cjs/index.js +53 -0
- package/dist/web/node_modules/@smithy/eventstream-serde-node/package.json +62 -0
- package/dist/web/node_modules/@smithy/eventstream-serde-universal/dist-cjs/index.js +132 -0
- package/dist/web/node_modules/@smithy/eventstream-serde-universal/package.json +66 -0
- package/dist/web/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +233 -0
- package/dist/web/node_modules/@smithy/fetch-http-handler/package.json +69 -0
- package/dist/web/node_modules/@smithy/hash-node/dist-cjs/index.js +42 -0
- package/dist/web/node_modules/@smithy/hash-node/package.json +65 -0
- package/dist/web/node_modules/@smithy/hash-stream-node/dist-cjs/index.js +67 -0
- package/dist/web/node_modules/@smithy/hash-stream-node/package.json +65 -0
- package/dist/web/node_modules/@smithy/is-array-buffer/dist-cjs/index.js +6 -0
- package/dist/web/node_modules/@smithy/is-array-buffer/package.json +61 -0
- package/dist/web/node_modules/@smithy/middleware-content-length/dist-cjs/index.js +46 -0
- package/dist/web/node_modules/@smithy/middleware-content-length/package.json +64 -0
- package/dist/web/node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointFromConfig.js +7 -0
- package/dist/web/node_modules/@smithy/middleware-endpoint/dist-cjs/adaptors/getEndpointUrlConfig.js +35 -0
- package/dist/web/node_modules/@smithy/middleware-endpoint/dist-cjs/index.js +264 -0
- package/dist/web/node_modules/@smithy/middleware-endpoint/package.json +75 -0
- package/dist/web/node_modules/@smithy/middleware-retry/dist-cjs/index.js +355 -0
- package/dist/web/node_modules/@smithy/middleware-retry/dist-cjs/isStreamingPayload/isStreamingPayload.js +7 -0
- package/dist/web/node_modules/@smithy/middleware-retry/package.json +79 -0
- package/dist/web/node_modules/@smithy/middleware-serde/dist-cjs/index.js +104 -0
- package/dist/web/node_modules/@smithy/middleware-serde/package.json +66 -0
- package/dist/web/node_modules/@smithy/middleware-stack/dist-cjs/index.js +285 -0
- package/dist/web/node_modules/@smithy/middleware-stack/package.json +64 -0
- package/dist/web/node_modules/@smithy/node-config-provider/dist-cjs/index.js +62 -0
- package/dist/web/node_modules/@smithy/node-config-provider/package.json +66 -0
- package/dist/web/node_modules/@smithy/node-http-handler/dist-cjs/index.js +762 -0
- package/dist/web/node_modules/@smithy/node-http-handler/package.json +68 -0
- package/dist/web/node_modules/@smithy/property-provider/dist-cjs/index.js +117 -0
- package/dist/web/node_modules/@smithy/property-provider/package.json +61 -0
- package/dist/web/node_modules/@smithy/protocol-http/dist-cjs/index.js +169 -0
- package/dist/web/node_modules/@smithy/protocol-http/package.json +62 -0
- package/dist/web/node_modules/@smithy/querystring-builder/dist-cjs/index.js +26 -0
- package/dist/web/node_modules/@smithy/querystring-builder/package.json +61 -0
- package/dist/web/node_modules/@smithy/querystring-parser/dist-cjs/index.js +27 -0
- package/dist/web/node_modules/@smithy/querystring-parser/package.json +61 -0
- package/dist/web/node_modules/@smithy/service-error-classification/dist-cjs/index.js +77 -0
- package/dist/web/node_modules/@smithy/service-error-classification/package.json +60 -0
- package/dist/web/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getHomeDir.js +26 -0
- package/dist/web/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFilepath.js +12 -0
- package/dist/web/node_modules/@smithy/shared-ini-file-loader/dist-cjs/getSSOTokenFromFile.js +15 -0
- package/dist/web/node_modules/@smithy/shared-ini-file-loader/dist-cjs/index.js +196 -0
- package/dist/web/node_modules/@smithy/shared-ini-file-loader/dist-cjs/readFile.js +16 -0
- package/dist/web/node_modules/@smithy/shared-ini-file-loader/package.json +73 -0
- package/dist/web/node_modules/@smithy/signature-v4/dist-cjs/index.js +556 -0
- package/dist/web/node_modules/@smithy/signature-v4/package.json +70 -0
- package/dist/web/node_modules/@smithy/smithy-client/dist-cjs/index.js +635 -0
- package/dist/web/node_modules/@smithy/smithy-client/package.json +70 -0
- package/dist/web/node_modules/@smithy/types/dist-cjs/index.js +91 -0
- package/dist/web/node_modules/@smithy/types/package.json +61 -0
- package/dist/web/node_modules/@smithy/url-parser/dist-cjs/index.js +23 -0
- package/dist/web/node_modules/@smithy/url-parser/package.json +62 -0
- package/dist/web/node_modules/@smithy/util-base64/dist-cjs/fromBase64.js +16 -0
- package/dist/web/node_modules/@smithy/util-base64/dist-cjs/index.js +27 -0
- package/dist/web/node_modules/@smithy/util-base64/dist-cjs/toBase64.js +19 -0
- package/dist/web/node_modules/@smithy/util-base64/package.json +74 -0
- package/dist/web/node_modules/@smithy/util-body-length-browser/dist-cjs/index.js +30 -0
- package/dist/web/node_modules/@smithy/util-body-length-browser/package.json +61 -0
- package/dist/web/node_modules/@smithy/util-body-length-node/dist-cjs/index.js +32 -0
- package/dist/web/node_modules/@smithy/util-body-length-node/package.json +62 -0
- package/dist/web/node_modules/@smithy/util-buffer-from/dist-cjs/index.js +20 -0
- package/dist/web/node_modules/@smithy/util-buffer-from/package.json +62 -0
- package/dist/web/node_modules/@smithy/util-config-provider/dist-cjs/index.js +30 -0
- package/dist/web/node_modules/@smithy/util-config-provider/package.json +63 -0
- package/dist/web/node_modules/@smithy/util-defaults-mode-node/dist-cjs/index.js +74 -0
- package/dist/web/node_modules/@smithy/util-defaults-mode-node/package.json +67 -0
- package/dist/web/node_modules/@smithy/util-endpoints/dist-cjs/index.js +472 -0
- package/dist/web/node_modules/@smithy/util-endpoints/package.json +69 -0
- package/dist/web/node_modules/@smithy/util-hex-encoding/dist-cjs/index.js +38 -0
- package/dist/web/node_modules/@smithy/util-hex-encoding/package.json +61 -0
- package/dist/web/node_modules/@smithy/util-middleware/dist-cjs/index.js +15 -0
- package/dist/web/node_modules/@smithy/util-middleware/package.json +67 -0
- package/dist/web/node_modules/@smithy/util-retry/dist-cjs/index.js +278 -0
- package/dist/web/node_modules/@smithy/util-retry/package.json +71 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/ByteArrayCollector.js +36 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/checksum/ChecksumStream.browser.js +7 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/checksum/ChecksumStream.js +64 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/checksum/createChecksumStream.browser.js +39 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/checksum/createChecksumStream.js +12 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/createBufferedReadable.js +60 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/createBufferedReadableStream.js +103 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.browser.js +31 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/getAwsChunkedEncodingStream.js +41 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/headStream.browser.js +34 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/headStream.js +42 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/index.js +108 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.browser.js +68 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.js +54 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/splitStream.browser.js +10 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/splitStream.js +16 -0
- package/dist/web/node_modules/@smithy/util-stream/dist-cjs/stream-type-check.js +10 -0
- package/dist/web/node_modules/@smithy/util-stream/package.json +99 -0
- package/dist/web/node_modules/@smithy/util-uri-escape/dist-cjs/index.js +9 -0
- package/dist/web/node_modules/@smithy/util-uri-escape/package.json +60 -0
- package/dist/web/node_modules/@smithy/util-utf8/dist-cjs/index.js +32 -0
- package/dist/web/node_modules/@smithy/util-utf8/package.json +67 -0
- package/dist/web/node_modules/@smithy/util-waiter/dist-cjs/index.js +179 -0
- package/dist/web/node_modules/@smithy/util-waiter/package.json +63 -0
- package/dist/web/node_modules/@smithy/uuid/dist-cjs/index.js +36 -0
- package/dist/web/node_modules/@smithy/uuid/dist-cjs/randomUUID.js +6 -0
- package/dist/web/node_modules/@smithy/uuid/package.json +66 -0
- package/dist/web/node_modules/fast-xml-parser/lib/fxp.cjs +1 -0
- package/dist/web/node_modules/fast-xml-parser/package.json +94 -0
- package/dist/web/node_modules/tslib/package.json +47 -0
- package/dist/web/node_modules/tslib/tslib.js +484 -0
- package/dist/web/package-lock.json +470 -161
- package/dist/web/package.json +3 -1
- package/dist/web/src/app/api/transcribe/route.ts +84 -68
- package/dist/web/src/components/VoiceControlBar.tsx +1 -0
- package/dist/web/src/lib/webm-to-ogg-opus.ts +254 -0
- package/dist/web/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/templates/kanban-seed.json +1 -1
- package/dist/web/.next/server/chunks/[root-of-the-server]__0f8687da._.js +0 -3
- package/dist/web/.next/server/chunks/[root-of-the-server]__1cdc76ef._.js +0 -3
- package/dist/web/.next/server/chunks/[root-of-the-server]__3998d59e._.js +0 -19
- package/dist/web/.next/server/chunks/[root-of-the-server]__3dc5531f._.js +0 -5
- package/dist/web/.next/server/chunks/[root-of-the-server]__403750fd._.js +0 -3
- package/dist/web/.next/server/chunks/[root-of-the-server]__934c9bb4._.js +0 -5
- package/dist/web/.next/server/chunks/[root-of-the-server]__e00fb85f._.js +0 -9
- package/dist/web/.next/server/chunks/a9bf9_@aws-sdk_core_dist-es_submodules_protocols_json_AwsRestJsonProtocol_764d7a83.js +0 -3
- package/dist/web/.next/static/chunks/f3d7065d54a0b9ac.css +0 -1
- /package/dist/web/.next/static/{_fCicMElBguqtWA_EpzdZ → rlJUIaeDUP-JDj2nvHySS}/_buildManifest.js +0 -0
- /package/dist/web/.next/static/{_fCicMElBguqtWA_EpzdZ → rlJUIaeDUP-JDj2nvHySS}/_clientMiddlewareManifest.json +0 -0
- /package/dist/web/.next/static/{_fCicMElBguqtWA_EpzdZ → rlJUIaeDUP-JDj2nvHySS}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@smithy/util-middleware",
|
|
3
|
+
"version": "4.2.12",
|
|
4
|
+
"description": "Shared utilities for to be used in middleware packages.",
|
|
5
|
+
"main": "./dist-cjs/index.js",
|
|
6
|
+
"module": "./dist-es/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
|
9
|
+
"build:cjs": "node ../../scripts/inline util-middleware",
|
|
10
|
+
"build:es": "yarn g:tsc -p tsconfig.es.json",
|
|
11
|
+
"build:types": "yarn g:tsc -p tsconfig.types.json",
|
|
12
|
+
"build:types:downlevel": "premove dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4",
|
|
13
|
+
"stage-release": "premove .release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
|
|
14
|
+
"clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
|
|
15
|
+
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
|
|
16
|
+
"format": "prettier --config ../../prettier.config.js --ignore-path ../../.prettierignore --write \"**/*.{ts,md,json}\"",
|
|
17
|
+
"test": "yarn g:vitest run",
|
|
18
|
+
"test:watch": "yarn g:vitest watch"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"aws",
|
|
22
|
+
"middleware"
|
|
23
|
+
],
|
|
24
|
+
"author": {
|
|
25
|
+
"name": "AWS SDK for JavaScript Team",
|
|
26
|
+
"url": "https://aws.amazon.com/javascript/"
|
|
27
|
+
},
|
|
28
|
+
"license": "Apache-2.0",
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@smithy/types": "^4.13.1",
|
|
32
|
+
"tslib": "^2.6.2"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^18.11.9",
|
|
36
|
+
"concurrently": "7.0.0",
|
|
37
|
+
"downlevel-dts": "0.10.1",
|
|
38
|
+
"premove": "4.0.0",
|
|
39
|
+
"typedoc": "0.23.23"
|
|
40
|
+
},
|
|
41
|
+
"types": "./dist-types/index.d.ts",
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=18.0.0"
|
|
44
|
+
},
|
|
45
|
+
"typesVersions": {
|
|
46
|
+
"<4.5": {
|
|
47
|
+
"types/*": [
|
|
48
|
+
"types/ts3.4/*"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"dist-*/**"
|
|
54
|
+
],
|
|
55
|
+
"homepage": "https://github.com/smithy-lang/smithy-typescript/tree/master/packages/util-middleware",
|
|
56
|
+
"repository": {
|
|
57
|
+
"type": "git",
|
|
58
|
+
"url": "https://github.com/smithy-lang/smithy-typescript.git",
|
|
59
|
+
"directory": "packages/util-middleware"
|
|
60
|
+
},
|
|
61
|
+
"typedoc": {
|
|
62
|
+
"entryPoint": "src/index.ts"
|
|
63
|
+
},
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"directory": ".release/package"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var serviceErrorClassification = require('@smithy/service-error-classification');
|
|
4
|
+
|
|
5
|
+
exports.RETRY_MODES = void 0;
|
|
6
|
+
(function (RETRY_MODES) {
|
|
7
|
+
RETRY_MODES["STANDARD"] = "standard";
|
|
8
|
+
RETRY_MODES["ADAPTIVE"] = "adaptive";
|
|
9
|
+
})(exports.RETRY_MODES || (exports.RETRY_MODES = {}));
|
|
10
|
+
const DEFAULT_MAX_ATTEMPTS = 3;
|
|
11
|
+
const DEFAULT_RETRY_MODE = exports.RETRY_MODES.STANDARD;
|
|
12
|
+
|
|
13
|
+
class DefaultRateLimiter {
|
|
14
|
+
static setTimeoutFn = setTimeout;
|
|
15
|
+
beta;
|
|
16
|
+
minCapacity;
|
|
17
|
+
minFillRate;
|
|
18
|
+
scaleConstant;
|
|
19
|
+
smooth;
|
|
20
|
+
currentCapacity = 0;
|
|
21
|
+
enabled = false;
|
|
22
|
+
lastMaxRate = 0;
|
|
23
|
+
measuredTxRate = 0;
|
|
24
|
+
requestCount = 0;
|
|
25
|
+
fillRate;
|
|
26
|
+
lastThrottleTime;
|
|
27
|
+
lastTimestamp = 0;
|
|
28
|
+
lastTxRateBucket;
|
|
29
|
+
maxCapacity;
|
|
30
|
+
timeWindow = 0;
|
|
31
|
+
constructor(options) {
|
|
32
|
+
this.beta = options?.beta ?? 0.7;
|
|
33
|
+
this.minCapacity = options?.minCapacity ?? 1;
|
|
34
|
+
this.minFillRate = options?.minFillRate ?? 0.5;
|
|
35
|
+
this.scaleConstant = options?.scaleConstant ?? 0.4;
|
|
36
|
+
this.smooth = options?.smooth ?? 0.8;
|
|
37
|
+
const currentTimeInSeconds = this.getCurrentTimeInSeconds();
|
|
38
|
+
this.lastThrottleTime = currentTimeInSeconds;
|
|
39
|
+
this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds());
|
|
40
|
+
this.fillRate = this.minFillRate;
|
|
41
|
+
this.maxCapacity = this.minCapacity;
|
|
42
|
+
}
|
|
43
|
+
getCurrentTimeInSeconds() {
|
|
44
|
+
return Date.now() / 1000;
|
|
45
|
+
}
|
|
46
|
+
async getSendToken() {
|
|
47
|
+
return this.acquireTokenBucket(1);
|
|
48
|
+
}
|
|
49
|
+
async acquireTokenBucket(amount) {
|
|
50
|
+
if (!this.enabled) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
this.refillTokenBucket();
|
|
54
|
+
if (amount > this.currentCapacity) {
|
|
55
|
+
const delay = ((amount - this.currentCapacity) / this.fillRate) * 1000;
|
|
56
|
+
await new Promise((resolve) => DefaultRateLimiter.setTimeoutFn(resolve, delay));
|
|
57
|
+
}
|
|
58
|
+
this.currentCapacity = this.currentCapacity - amount;
|
|
59
|
+
}
|
|
60
|
+
refillTokenBucket() {
|
|
61
|
+
const timestamp = this.getCurrentTimeInSeconds();
|
|
62
|
+
if (!this.lastTimestamp) {
|
|
63
|
+
this.lastTimestamp = timestamp;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const fillAmount = (timestamp - this.lastTimestamp) * this.fillRate;
|
|
67
|
+
this.currentCapacity = Math.min(this.maxCapacity, this.currentCapacity + fillAmount);
|
|
68
|
+
this.lastTimestamp = timestamp;
|
|
69
|
+
}
|
|
70
|
+
updateClientSendingRate(response) {
|
|
71
|
+
let calculatedRate;
|
|
72
|
+
this.updateMeasuredRate();
|
|
73
|
+
if (serviceErrorClassification.isThrottlingError(response)) {
|
|
74
|
+
const rateToUse = !this.enabled ? this.measuredTxRate : Math.min(this.measuredTxRate, this.fillRate);
|
|
75
|
+
this.lastMaxRate = rateToUse;
|
|
76
|
+
this.calculateTimeWindow();
|
|
77
|
+
this.lastThrottleTime = this.getCurrentTimeInSeconds();
|
|
78
|
+
calculatedRate = this.cubicThrottle(rateToUse);
|
|
79
|
+
this.enableTokenBucket();
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this.calculateTimeWindow();
|
|
83
|
+
calculatedRate = this.cubicSuccess(this.getCurrentTimeInSeconds());
|
|
84
|
+
}
|
|
85
|
+
const newRate = Math.min(calculatedRate, 2 * this.measuredTxRate);
|
|
86
|
+
this.updateTokenBucketRate(newRate);
|
|
87
|
+
}
|
|
88
|
+
calculateTimeWindow() {
|
|
89
|
+
this.timeWindow = this.getPrecise(Math.pow((this.lastMaxRate * (1 - this.beta)) / this.scaleConstant, 1 / 3));
|
|
90
|
+
}
|
|
91
|
+
cubicThrottle(rateToUse) {
|
|
92
|
+
return this.getPrecise(rateToUse * this.beta);
|
|
93
|
+
}
|
|
94
|
+
cubicSuccess(timestamp) {
|
|
95
|
+
return this.getPrecise(this.scaleConstant * Math.pow(timestamp - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate);
|
|
96
|
+
}
|
|
97
|
+
enableTokenBucket() {
|
|
98
|
+
this.enabled = true;
|
|
99
|
+
}
|
|
100
|
+
updateTokenBucketRate(newRate) {
|
|
101
|
+
this.refillTokenBucket();
|
|
102
|
+
this.fillRate = Math.max(newRate, this.minFillRate);
|
|
103
|
+
this.maxCapacity = Math.max(newRate, this.minCapacity);
|
|
104
|
+
this.currentCapacity = Math.min(this.currentCapacity, this.maxCapacity);
|
|
105
|
+
}
|
|
106
|
+
updateMeasuredRate() {
|
|
107
|
+
const t = this.getCurrentTimeInSeconds();
|
|
108
|
+
const timeBucket = Math.floor(t * 2) / 2;
|
|
109
|
+
this.requestCount++;
|
|
110
|
+
if (timeBucket > this.lastTxRateBucket) {
|
|
111
|
+
const currentRate = this.requestCount / (timeBucket - this.lastTxRateBucket);
|
|
112
|
+
this.measuredTxRate = this.getPrecise(currentRate * this.smooth + this.measuredTxRate * (1 - this.smooth));
|
|
113
|
+
this.requestCount = 0;
|
|
114
|
+
this.lastTxRateBucket = timeBucket;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
getPrecise(num) {
|
|
118
|
+
return parseFloat(num.toFixed(8));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const DEFAULT_RETRY_DELAY_BASE = 100;
|
|
123
|
+
const MAXIMUM_RETRY_DELAY = 20 * 1000;
|
|
124
|
+
const THROTTLING_RETRY_DELAY_BASE = 500;
|
|
125
|
+
const INITIAL_RETRY_TOKENS = 500;
|
|
126
|
+
const RETRY_COST = 5;
|
|
127
|
+
const TIMEOUT_RETRY_COST = 10;
|
|
128
|
+
const NO_RETRY_INCREMENT = 1;
|
|
129
|
+
const INVOCATION_ID_HEADER = "amz-sdk-invocation-id";
|
|
130
|
+
const REQUEST_HEADER = "amz-sdk-request";
|
|
131
|
+
|
|
132
|
+
const getDefaultRetryBackoffStrategy = () => {
|
|
133
|
+
let delayBase = DEFAULT_RETRY_DELAY_BASE;
|
|
134
|
+
const computeNextBackoffDelay = (attempts) => {
|
|
135
|
+
return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase));
|
|
136
|
+
};
|
|
137
|
+
const setDelayBase = (delay) => {
|
|
138
|
+
delayBase = delay;
|
|
139
|
+
};
|
|
140
|
+
return {
|
|
141
|
+
computeNextBackoffDelay,
|
|
142
|
+
setDelayBase,
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const createDefaultRetryToken = ({ retryDelay, retryCount, retryCost, }) => {
|
|
147
|
+
const getRetryCount = () => retryCount;
|
|
148
|
+
const getRetryDelay = () => Math.min(MAXIMUM_RETRY_DELAY, retryDelay);
|
|
149
|
+
const getRetryCost = () => retryCost;
|
|
150
|
+
return {
|
|
151
|
+
getRetryCount,
|
|
152
|
+
getRetryDelay,
|
|
153
|
+
getRetryCost,
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
class StandardRetryStrategy {
|
|
158
|
+
maxAttempts;
|
|
159
|
+
mode = exports.RETRY_MODES.STANDARD;
|
|
160
|
+
capacity = INITIAL_RETRY_TOKENS;
|
|
161
|
+
retryBackoffStrategy = getDefaultRetryBackoffStrategy();
|
|
162
|
+
maxAttemptsProvider;
|
|
163
|
+
constructor(maxAttempts) {
|
|
164
|
+
this.maxAttempts = maxAttempts;
|
|
165
|
+
this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts;
|
|
166
|
+
}
|
|
167
|
+
async acquireInitialRetryToken(retryTokenScope) {
|
|
168
|
+
return createDefaultRetryToken({
|
|
169
|
+
retryDelay: DEFAULT_RETRY_DELAY_BASE,
|
|
170
|
+
retryCount: 0,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
async refreshRetryTokenForRetry(token, errorInfo) {
|
|
174
|
+
const maxAttempts = await this.getMaxAttempts();
|
|
175
|
+
if (this.shouldRetry(token, errorInfo, maxAttempts)) {
|
|
176
|
+
const errorType = errorInfo.errorType;
|
|
177
|
+
this.retryBackoffStrategy.setDelayBase(errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE);
|
|
178
|
+
const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount());
|
|
179
|
+
const retryDelay = errorInfo.retryAfterHint
|
|
180
|
+
? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType)
|
|
181
|
+
: delayFromErrorType;
|
|
182
|
+
const capacityCost = this.getCapacityCost(errorType);
|
|
183
|
+
this.capacity -= capacityCost;
|
|
184
|
+
return createDefaultRetryToken({
|
|
185
|
+
retryDelay,
|
|
186
|
+
retryCount: token.getRetryCount() + 1,
|
|
187
|
+
retryCost: capacityCost,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
throw new Error("No retry token available");
|
|
191
|
+
}
|
|
192
|
+
recordSuccess(token) {
|
|
193
|
+
this.capacity = Math.max(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT));
|
|
194
|
+
}
|
|
195
|
+
getCapacity() {
|
|
196
|
+
return this.capacity;
|
|
197
|
+
}
|
|
198
|
+
async getMaxAttempts() {
|
|
199
|
+
try {
|
|
200
|
+
return await this.maxAttemptsProvider();
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`);
|
|
204
|
+
return DEFAULT_MAX_ATTEMPTS;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
shouldRetry(tokenToRenew, errorInfo, maxAttempts) {
|
|
208
|
+
const attempts = tokenToRenew.getRetryCount() + 1;
|
|
209
|
+
return (attempts < maxAttempts &&
|
|
210
|
+
this.capacity >= this.getCapacityCost(errorInfo.errorType) &&
|
|
211
|
+
this.isRetryableError(errorInfo.errorType));
|
|
212
|
+
}
|
|
213
|
+
getCapacityCost(errorType) {
|
|
214
|
+
return errorType === "TRANSIENT" ? TIMEOUT_RETRY_COST : RETRY_COST;
|
|
215
|
+
}
|
|
216
|
+
isRetryableError(errorType) {
|
|
217
|
+
return errorType === "THROTTLING" || errorType === "TRANSIENT";
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
class AdaptiveRetryStrategy {
|
|
222
|
+
maxAttemptsProvider;
|
|
223
|
+
rateLimiter;
|
|
224
|
+
standardRetryStrategy;
|
|
225
|
+
mode = exports.RETRY_MODES.ADAPTIVE;
|
|
226
|
+
constructor(maxAttemptsProvider, options) {
|
|
227
|
+
this.maxAttemptsProvider = maxAttemptsProvider;
|
|
228
|
+
const { rateLimiter } = options ?? {};
|
|
229
|
+
this.rateLimiter = rateLimiter ?? new DefaultRateLimiter();
|
|
230
|
+
this.standardRetryStrategy = new StandardRetryStrategy(maxAttemptsProvider);
|
|
231
|
+
}
|
|
232
|
+
async acquireInitialRetryToken(retryTokenScope) {
|
|
233
|
+
await this.rateLimiter.getSendToken();
|
|
234
|
+
return this.standardRetryStrategy.acquireInitialRetryToken(retryTokenScope);
|
|
235
|
+
}
|
|
236
|
+
async refreshRetryTokenForRetry(tokenToRenew, errorInfo) {
|
|
237
|
+
this.rateLimiter.updateClientSendingRate(errorInfo);
|
|
238
|
+
return this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo);
|
|
239
|
+
}
|
|
240
|
+
recordSuccess(token) {
|
|
241
|
+
this.rateLimiter.updateClientSendingRate({});
|
|
242
|
+
this.standardRetryStrategy.recordSuccess(token);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
class ConfiguredRetryStrategy extends StandardRetryStrategy {
|
|
247
|
+
computeNextBackoffDelay;
|
|
248
|
+
constructor(maxAttempts, computeNextBackoffDelay = DEFAULT_RETRY_DELAY_BASE) {
|
|
249
|
+
super(typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts);
|
|
250
|
+
if (typeof computeNextBackoffDelay === "number") {
|
|
251
|
+
this.computeNextBackoffDelay = () => computeNextBackoffDelay;
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
this.computeNextBackoffDelay = computeNextBackoffDelay;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
async refreshRetryTokenForRetry(tokenToRenew, errorInfo) {
|
|
258
|
+
const token = await super.refreshRetryTokenForRetry(tokenToRenew, errorInfo);
|
|
259
|
+
token.getRetryDelay = () => this.computeNextBackoffDelay(token.getRetryCount());
|
|
260
|
+
return token;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
exports.AdaptiveRetryStrategy = AdaptiveRetryStrategy;
|
|
265
|
+
exports.ConfiguredRetryStrategy = ConfiguredRetryStrategy;
|
|
266
|
+
exports.DEFAULT_MAX_ATTEMPTS = DEFAULT_MAX_ATTEMPTS;
|
|
267
|
+
exports.DEFAULT_RETRY_DELAY_BASE = DEFAULT_RETRY_DELAY_BASE;
|
|
268
|
+
exports.DEFAULT_RETRY_MODE = DEFAULT_RETRY_MODE;
|
|
269
|
+
exports.DefaultRateLimiter = DefaultRateLimiter;
|
|
270
|
+
exports.INITIAL_RETRY_TOKENS = INITIAL_RETRY_TOKENS;
|
|
271
|
+
exports.INVOCATION_ID_HEADER = INVOCATION_ID_HEADER;
|
|
272
|
+
exports.MAXIMUM_RETRY_DELAY = MAXIMUM_RETRY_DELAY;
|
|
273
|
+
exports.NO_RETRY_INCREMENT = NO_RETRY_INCREMENT;
|
|
274
|
+
exports.REQUEST_HEADER = REQUEST_HEADER;
|
|
275
|
+
exports.RETRY_COST = RETRY_COST;
|
|
276
|
+
exports.StandardRetryStrategy = StandardRetryStrategy;
|
|
277
|
+
exports.THROTTLING_RETRY_DELAY_BASE = THROTTLING_RETRY_DELAY_BASE;
|
|
278
|
+
exports.TIMEOUT_RETRY_COST = TIMEOUT_RETRY_COST;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@smithy/util-retry",
|
|
3
|
+
"version": "4.2.12",
|
|
4
|
+
"description": "Shared retry utilities to be used in middleware packages.",
|
|
5
|
+
"main": "./dist-cjs/index.js",
|
|
6
|
+
"module": "./dist-es/index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
|
|
9
|
+
"build:cjs": "node ../../scripts/inline util-retry",
|
|
10
|
+
"build:es": "yarn g:tsc -p tsconfig.es.json",
|
|
11
|
+
"build:types": "yarn g:tsc -p tsconfig.types.json",
|
|
12
|
+
"build:types:downlevel": "premove dist-types/ts3.4 && downlevel-dts dist-types dist-types/ts3.4",
|
|
13
|
+
"stage-release": "premove .release && yarn pack && mkdir ./.release && tar zxvf ./package.tgz --directory ./.release && rm ./package.tgz",
|
|
14
|
+
"clean": "premove dist-cjs dist-es dist-types tsconfig.cjs.tsbuildinfo tsconfig.es.tsbuildinfo tsconfig.types.tsbuildinfo",
|
|
15
|
+
"lint": "eslint -c ../../.eslintrc.js \"src/**/*.ts\"",
|
|
16
|
+
"format": "prettier --config ../../prettier.config.js --ignore-path ../../.prettierignore --write \"**/*.{ts,md,json}\"",
|
|
17
|
+
"extract:docs": "api-extractor run --local",
|
|
18
|
+
"test": "yarn g:vitest run",
|
|
19
|
+
"test:watch": "yarn g:vitest watch",
|
|
20
|
+
"test:integration": "yarn g:vitest run -c vitest.config.integ.mts",
|
|
21
|
+
"test:integration:watch": "yarn g:vitest watch -c vitest.config.integ.mts"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"aws",
|
|
25
|
+
"retry"
|
|
26
|
+
],
|
|
27
|
+
"author": {
|
|
28
|
+
"name": "AWS SDK for JavaScript Team",
|
|
29
|
+
"url": "https://aws.amazon.com/javascript/"
|
|
30
|
+
},
|
|
31
|
+
"license": "Apache-2.0",
|
|
32
|
+
"sideEffects": false,
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@smithy/service-error-classification": "^4.2.12",
|
|
35
|
+
"@smithy/types": "^4.13.1",
|
|
36
|
+
"tslib": "^2.6.2"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^18.11.9",
|
|
40
|
+
"concurrently": "7.0.0",
|
|
41
|
+
"downlevel-dts": "0.10.1",
|
|
42
|
+
"premove": "4.0.0",
|
|
43
|
+
"typedoc": "0.23.23"
|
|
44
|
+
},
|
|
45
|
+
"types": "./dist-types/index.d.ts",
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=18.0.0"
|
|
48
|
+
},
|
|
49
|
+
"typesVersions": {
|
|
50
|
+
"<4.5": {
|
|
51
|
+
"types/*": [
|
|
52
|
+
"types/ts3.4/*"
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"files": [
|
|
57
|
+
"dist-*/**"
|
|
58
|
+
],
|
|
59
|
+
"homepage": "https://github.com/smithy-lang/smithy-typescript/tree/master/packages/util-retry",
|
|
60
|
+
"repository": {
|
|
61
|
+
"type": "git",
|
|
62
|
+
"url": "https://github.com/smithy-lang/smithy-typescript.git",
|
|
63
|
+
"directory": "packages/util-retry"
|
|
64
|
+
},
|
|
65
|
+
"typedoc": {
|
|
66
|
+
"entryPoint": "src/index.ts"
|
|
67
|
+
},
|
|
68
|
+
"publishConfig": {
|
|
69
|
+
"directory": ".release/package"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ByteArrayCollector = void 0;
|
|
4
|
+
class ByteArrayCollector {
|
|
5
|
+
allocByteArray;
|
|
6
|
+
byteLength = 0;
|
|
7
|
+
byteArrays = [];
|
|
8
|
+
constructor(allocByteArray) {
|
|
9
|
+
this.allocByteArray = allocByteArray;
|
|
10
|
+
}
|
|
11
|
+
push(byteArray) {
|
|
12
|
+
this.byteArrays.push(byteArray);
|
|
13
|
+
this.byteLength += byteArray.byteLength;
|
|
14
|
+
}
|
|
15
|
+
flush() {
|
|
16
|
+
if (this.byteArrays.length === 1) {
|
|
17
|
+
const bytes = this.byteArrays[0];
|
|
18
|
+
this.reset();
|
|
19
|
+
return bytes;
|
|
20
|
+
}
|
|
21
|
+
const aggregation = this.allocByteArray(this.byteLength);
|
|
22
|
+
let cursor = 0;
|
|
23
|
+
for (let i = 0; i < this.byteArrays.length; ++i) {
|
|
24
|
+
const bytes = this.byteArrays[i];
|
|
25
|
+
aggregation.set(bytes, cursor);
|
|
26
|
+
cursor += bytes.byteLength;
|
|
27
|
+
}
|
|
28
|
+
this.reset();
|
|
29
|
+
return aggregation;
|
|
30
|
+
}
|
|
31
|
+
reset() {
|
|
32
|
+
this.byteArrays = [];
|
|
33
|
+
this.byteLength = 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.ByteArrayCollector = ByteArrayCollector;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChecksumStream = void 0;
|
|
4
|
+
const ReadableStreamRef = typeof ReadableStream === "function" ? ReadableStream : function () { };
|
|
5
|
+
class ChecksumStream extends ReadableStreamRef {
|
|
6
|
+
}
|
|
7
|
+
exports.ChecksumStream = ChecksumStream;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChecksumStream = void 0;
|
|
4
|
+
const util_base64_1 = require("@smithy/util-base64");
|
|
5
|
+
const stream_1 = require("stream");
|
|
6
|
+
class ChecksumStream extends stream_1.Duplex {
|
|
7
|
+
expectedChecksum;
|
|
8
|
+
checksumSourceLocation;
|
|
9
|
+
checksum;
|
|
10
|
+
source;
|
|
11
|
+
base64Encoder;
|
|
12
|
+
pendingCallback = null;
|
|
13
|
+
constructor({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder, }) {
|
|
14
|
+
super();
|
|
15
|
+
if (typeof source.pipe === "function") {
|
|
16
|
+
this.source = source;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
throw new Error(`@smithy/util-stream: unsupported source type ${source?.constructor?.name ?? source} in ChecksumStream.`);
|
|
20
|
+
}
|
|
21
|
+
this.base64Encoder = base64Encoder ?? util_base64_1.toBase64;
|
|
22
|
+
this.expectedChecksum = expectedChecksum;
|
|
23
|
+
this.checksum = checksum;
|
|
24
|
+
this.checksumSourceLocation = checksumSourceLocation;
|
|
25
|
+
this.source.pipe(this);
|
|
26
|
+
}
|
|
27
|
+
_read(size) {
|
|
28
|
+
if (this.pendingCallback) {
|
|
29
|
+
const callback = this.pendingCallback;
|
|
30
|
+
this.pendingCallback = null;
|
|
31
|
+
callback();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
_write(chunk, encoding, callback) {
|
|
35
|
+
try {
|
|
36
|
+
this.checksum.update(chunk);
|
|
37
|
+
const canPushMore = this.push(chunk);
|
|
38
|
+
if (!canPushMore) {
|
|
39
|
+
this.pendingCallback = callback;
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
return callback(e);
|
|
45
|
+
}
|
|
46
|
+
return callback();
|
|
47
|
+
}
|
|
48
|
+
async _final(callback) {
|
|
49
|
+
try {
|
|
50
|
+
const digest = await this.checksum.digest();
|
|
51
|
+
const received = this.base64Encoder(digest);
|
|
52
|
+
if (this.expectedChecksum !== received) {
|
|
53
|
+
return callback(new Error(`Checksum mismatch: expected "${this.expectedChecksum}" but received "${received}"` +
|
|
54
|
+
` in response header "${this.checksumSourceLocation}".`));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
return callback(e);
|
|
59
|
+
}
|
|
60
|
+
this.push(null);
|
|
61
|
+
return callback();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.ChecksumStream = ChecksumStream;
|
package/dist/web/node_modules/@smithy/util-stream/dist-cjs/checksum/createChecksumStream.browser.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createChecksumStream = void 0;
|
|
4
|
+
const util_base64_1 = require("@smithy/util-base64");
|
|
5
|
+
const stream_type_check_1 = require("../stream-type-check");
|
|
6
|
+
const ChecksumStream_browser_1 = require("./ChecksumStream.browser");
|
|
7
|
+
const createChecksumStream = ({ expectedChecksum, checksum, source, checksumSourceLocation, base64Encoder, }) => {
|
|
8
|
+
if (!(0, stream_type_check_1.isReadableStream)(source)) {
|
|
9
|
+
throw new Error(`@smithy/util-stream: unsupported source type ${source?.constructor?.name ?? source} in ChecksumStream.`);
|
|
10
|
+
}
|
|
11
|
+
const encoder = base64Encoder ?? util_base64_1.toBase64;
|
|
12
|
+
if (typeof TransformStream !== "function") {
|
|
13
|
+
throw new Error("@smithy/util-stream: unable to instantiate ChecksumStream because API unavailable: ReadableStream/TransformStream.");
|
|
14
|
+
}
|
|
15
|
+
const transform = new TransformStream({
|
|
16
|
+
start() { },
|
|
17
|
+
async transform(chunk, controller) {
|
|
18
|
+
checksum.update(chunk);
|
|
19
|
+
controller.enqueue(chunk);
|
|
20
|
+
},
|
|
21
|
+
async flush(controller) {
|
|
22
|
+
const digest = await checksum.digest();
|
|
23
|
+
const received = encoder(digest);
|
|
24
|
+
if (expectedChecksum !== received) {
|
|
25
|
+
const error = new Error(`Checksum mismatch: expected "${expectedChecksum}" but received "${received}"` +
|
|
26
|
+
` in response header "${checksumSourceLocation}".`);
|
|
27
|
+
controller.error(error);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
controller.terminate();
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
source.pipeThrough(transform);
|
|
35
|
+
const readable = transform.readable;
|
|
36
|
+
Object.setPrototypeOf(readable, ChecksumStream_browser_1.ChecksumStream.prototype);
|
|
37
|
+
return readable;
|
|
38
|
+
};
|
|
39
|
+
exports.createChecksumStream = createChecksumStream;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createChecksumStream = createChecksumStream;
|
|
4
|
+
const stream_type_check_1 = require("../stream-type-check");
|
|
5
|
+
const ChecksumStream_1 = require("./ChecksumStream");
|
|
6
|
+
const createChecksumStream_browser_1 = require("./createChecksumStream.browser");
|
|
7
|
+
function createChecksumStream(init) {
|
|
8
|
+
if (typeof ReadableStream === "function" && (0, stream_type_check_1.isReadableStream)(init.source)) {
|
|
9
|
+
return (0, createChecksumStream_browser_1.createChecksumStream)(init);
|
|
10
|
+
}
|
|
11
|
+
return new ChecksumStream_1.ChecksumStream(init);
|
|
12
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBufferedReadable = createBufferedReadable;
|
|
4
|
+
const node_stream_1 = require("node:stream");
|
|
5
|
+
const ByteArrayCollector_1 = require("./ByteArrayCollector");
|
|
6
|
+
const createBufferedReadableStream_1 = require("./createBufferedReadableStream");
|
|
7
|
+
const stream_type_check_1 = require("./stream-type-check");
|
|
8
|
+
function createBufferedReadable(upstream, size, logger) {
|
|
9
|
+
if ((0, stream_type_check_1.isReadableStream)(upstream)) {
|
|
10
|
+
return (0, createBufferedReadableStream_1.createBufferedReadableStream)(upstream, size, logger);
|
|
11
|
+
}
|
|
12
|
+
const downstream = new node_stream_1.Readable({ read() { } });
|
|
13
|
+
let streamBufferingLoggedWarning = false;
|
|
14
|
+
let bytesSeen = 0;
|
|
15
|
+
const buffers = [
|
|
16
|
+
"",
|
|
17
|
+
new ByteArrayCollector_1.ByteArrayCollector((size) => new Uint8Array(size)),
|
|
18
|
+
new ByteArrayCollector_1.ByteArrayCollector((size) => Buffer.from(new Uint8Array(size))),
|
|
19
|
+
];
|
|
20
|
+
let mode = -1;
|
|
21
|
+
upstream.on("data", (chunk) => {
|
|
22
|
+
const chunkMode = (0, createBufferedReadableStream_1.modeOf)(chunk, true);
|
|
23
|
+
if (mode !== chunkMode) {
|
|
24
|
+
if (mode >= 0) {
|
|
25
|
+
downstream.push((0, createBufferedReadableStream_1.flush)(buffers, mode));
|
|
26
|
+
}
|
|
27
|
+
mode = chunkMode;
|
|
28
|
+
}
|
|
29
|
+
if (mode === -1) {
|
|
30
|
+
downstream.push(chunk);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const chunkSize = (0, createBufferedReadableStream_1.sizeOf)(chunk);
|
|
34
|
+
bytesSeen += chunkSize;
|
|
35
|
+
const bufferSize = (0, createBufferedReadableStream_1.sizeOf)(buffers[mode]);
|
|
36
|
+
if (chunkSize >= size && bufferSize === 0) {
|
|
37
|
+
downstream.push(chunk);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const newSize = (0, createBufferedReadableStream_1.merge)(buffers, mode, chunk);
|
|
41
|
+
if (!streamBufferingLoggedWarning && bytesSeen > size * 2) {
|
|
42
|
+
streamBufferingLoggedWarning = true;
|
|
43
|
+
logger?.warn(`@smithy/util-stream - stream chunk size ${chunkSize} is below threshold of ${size}, automatically buffering.`);
|
|
44
|
+
}
|
|
45
|
+
if (newSize >= size) {
|
|
46
|
+
downstream.push((0, createBufferedReadableStream_1.flush)(buffers, mode));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
upstream.on("end", () => {
|
|
51
|
+
if (mode !== -1) {
|
|
52
|
+
const remainder = (0, createBufferedReadableStream_1.flush)(buffers, mode);
|
|
53
|
+
if ((0, createBufferedReadableStream_1.sizeOf)(remainder) > 0) {
|
|
54
|
+
downstream.push(remainder);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
downstream.push(null);
|
|
58
|
+
});
|
|
59
|
+
return downstream;
|
|
60
|
+
}
|