Skip to content

Commit 5e8ba25

Browse files
committed
feat: move stream-collector-web into fetch-http-handler
1 parent 168cdb8 commit 5e8ba25

File tree

14 files changed

+18
-427
lines changed

14 files changed

+18
-427
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"build:smithy-client": "yarn build:crypto-dependencies && lerna run --scope '@aws-sdk/client-rds-data' --include-dependencies pretest",
1616
"build:all": "yarn build:crypto-dependencies && lerna run pretest --include-dependencies --include-dependents",
1717
"pretest:all": "yarn build:all",
18-
"test:all": "jest --coverage --passWithNoTests && lerna run test --scope @aws-sdk/stream-collector-web --scope @aws-sdk/hash-blob-browser",
18+
"test:all": "jest --coverage --passWithNoTests && lerna run test --scope @aws-sdk/fetch-http-handler --scope @aws-sdk/hash-blob-browser",
1919
"test:functional": "jest --config tests/functional/jest.config.js --passWithNoTests",
2020
"test:integration": "cucumber-js --fail-fast",
2121
"test:protocols": "yarn build:protocols && lerna run test --scope '@aws-sdk/aws-*'"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const base = require("../../jest.config.base.js");
22

33
module.exports = {
4-
...base
4+
...base,
5+
testPathIgnorePatterns: ["/node_modules/", "stream-collector.spec.js"]
56
};

packages/stream-collector-web/karma.conf.js renamed to packages/fetch-http-handler/karma.conf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ process.env.CHROME_BIN = require("puppeteer").executablePath();
22
module.exports = function (config) {
33
config.set({
44
frameworks: ["jasmine", "karma-typescript"],
5-
files: ["src/**/*.ts"],
5+
files: ["src/stream-collector*.ts"],
66
exclude: ["**/*.d.ts"],
77
preprocessors: {
88
"**/*.ts": "karma-typescript"

packages/fetch-http-handler/package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"prepublishOnly": "tsc",
77
"pretest": "tsc -p tsconfig.test.json",
8-
"test": "jest --coverage"
8+
"test": "jest --coverage && karma start karma.conf.js"
99
},
1010
"author": {
1111
"name": "AWS SDK for JavaScript Team",
@@ -23,8 +23,13 @@
2323
"devDependencies": {
2424
"@aws-sdk/abort-controller": "1.0.0-beta.4",
2525
"@types/jest": "^25.1.4",
26-
"@types/node": "^10.0.0",
27-
"jest": "^25.1.0",
26+
"jasmine-core": "^3.5.0",
27+
"karma": "^4.4.1",
28+
"karma-chrome-launcher": "^3.1.0",
29+
"karma-jasmine": "^3.1.1",
30+
"karma-typescript": "^4.1.1",
31+
"puppeteer": "^3.0.1",
32+
"source-map": "^0.7.3",
2833
"typescript": "~3.8.3"
2934
}
3035
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from "./fetch-http-handler";
2+
export * from "./stream-collector";

packages/stream-collector-web/src/index.spec.ts renamed to packages/fetch-http-handler/src/stream-collector.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { streamCollector } from "./index";
1+
import { streamCollector } from "./stream-collector";
22

33
describe("streamCollector", () => {
44
it("returns a Uint8Array from a blob", done => {

packages/stream-collector-web/src/index.ts renamed to packages/fetch-http-handler/src/stream-collector.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { fromBase64 } from "@aws-sdk/util-base64-browser";
55
export const streamCollector: StreamCollector = (
66
stream: Blob | ReadableStream
77
): Promise<Uint8Array> => {
8-
if(stream instanceof Blob) {
8+
if (stream instanceof Blob) {
99
return collectBlob(stream);
1010
}
1111

@@ -22,9 +22,9 @@ async function collectStream(stream: ReadableStream): Promise<Uint8Array> {
2222
let res = new Uint8Array(0);
2323
const reader = stream.getReader();
2424
let isDone = false;
25-
while(!isDone) {
25+
while (!isDone) {
2626
const { done, value } = await reader.read();
27-
if(value) {
27+
if (value) {
2828
const prior = res;
2929
res = new Uint8Array(prior.length + value.length);
3030
res.set(prior);
@@ -53,4 +53,4 @@ function readToBase64(blob: Blob): Promise<string> {
5353
// reader.readAsArrayBuffer is not always available
5454
reader.readAsDataURL(blob);
5555
});
56-
}
56+
}

packages/stream-collector-web/.gitignore

Lines changed: 0 additions & 8 deletions
This file was deleted.

packages/stream-collector-web/.npmignore

Lines changed: 0 additions & 16 deletions
This file was deleted.

packages/stream-collector-web/CHANGELOG.md

Lines changed: 0 additions & 138 deletions
This file was deleted.

0 commit comments

Comments
 (0)