@cdklabs/cdk-ecs-codedeploy 0.0.298 → 0.0.300

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.
Files changed (61) hide show
  1. package/.jsii +3 -3
  2. package/lib/api-canary/index.js +1 -1
  3. package/lib/ecs-appspec/index.js +1 -1
  4. package/lib/ecs-deployment/index.js +1 -1
  5. package/lib/ecs-patterns/application-load-balanced-codedeployed-fargate-service.js +1 -1
  6. package/node_modules/@aws-sdk/client-codedeploy/package.json +20 -20
  7. package/node_modules/@aws-sdk/client-sso/package.json +17 -17
  8. package/node_modules/@aws-sdk/client-sso-oidc/package.json +21 -21
  9. package/node_modules/@aws-sdk/client-sts/package.json +19 -19
  10. package/node_modules/@aws-sdk/core/package.json +3 -3
  11. package/node_modules/@aws-sdk/credential-provider-http/package.json +5 -5
  12. package/node_modules/@aws-sdk/credential-provider-ini/package.json +7 -7
  13. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  14. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  15. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  16. package/node_modules/@aws-sdk/middleware-user-agent/package.json +2 -2
  17. package/node_modules/@aws-sdk/region-config-resolver/package.json +2 -2
  18. package/node_modules/@aws-sdk/token-providers/package.json +3 -3
  19. package/node_modules/@aws-sdk/util-endpoints/package.json +2 -2
  20. package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
  21. package/node_modules/@smithy/core/package.json +4 -4
  22. package/node_modules/@smithy/fetch-http-handler/package.json +2 -2
  23. package/node_modules/@smithy/middleware-content-length/package.json +3 -3
  24. package/node_modules/@smithy/middleware-retry/package.json +4 -4
  25. package/node_modules/@smithy/node-http-handler/package.json +2 -2
  26. package/node_modules/@smithy/protocol-http/dist-cjs/index.js +30 -8
  27. package/node_modules/@smithy/protocol-http/dist-es/httpRequest.js +13 -8
  28. package/node_modules/@smithy/protocol-http/dist-types/httpRequest.d.ts +31 -1
  29. package/node_modules/@smithy/protocol-http/dist-types/ts3.4/httpRequest.d.ts +31 -1
  30. package/node_modules/@smithy/protocol-http/package.json +1 -1
  31. package/node_modules/@smithy/smithy-client/package.json +3 -3
  32. package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
  33. package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
  34. package/node_modules/@smithy/util-stream/dist-cjs/headStream.browser.js +36 -0
  35. package/node_modules/@smithy/util-stream/dist-cjs/headStream.js +46 -0
  36. package/node_modules/@smithy/util-stream/dist-cjs/index.js +7 -1
  37. package/node_modules/@smithy/util-stream/dist-cjs/sdk-stream-mixin.browser.js +3 -3
  38. package/node_modules/@smithy/util-stream/dist-cjs/splitStream.browser.js +11 -0
  39. package/node_modules/@smithy/util-stream/dist-cjs/splitStream.js +17 -0
  40. package/node_modules/@smithy/util-stream/dist-cjs/stream-type-check.js +9 -0
  41. package/node_modules/@smithy/util-stream/dist-es/headStream.browser.js +31 -0
  42. package/node_modules/@smithy/util-stream/dist-es/headStream.js +41 -0
  43. package/node_modules/@smithy/util-stream/dist-es/index.js +3 -0
  44. package/node_modules/@smithy/util-stream/dist-es/sdk-stream-mixin.browser.js +3 -3
  45. package/node_modules/@smithy/util-stream/dist-es/splitStream.browser.js +7 -0
  46. package/node_modules/@smithy/util-stream/dist-es/splitStream.js +13 -0
  47. package/node_modules/@smithy/util-stream/dist-es/stream-type-check.js +2 -0
  48. package/node_modules/@smithy/util-stream/dist-types/headStream.browser.d.ts +8 -0
  49. package/node_modules/@smithy/util-stream/dist-types/headStream.d.ts +9 -0
  50. package/node_modules/@smithy/util-stream/dist-types/index.d.ts +3 -0
  51. package/node_modules/@smithy/util-stream/dist-types/splitStream.browser.d.ts +5 -0
  52. package/node_modules/@smithy/util-stream/dist-types/splitStream.d.ts +8 -0
  53. package/node_modules/@smithy/util-stream/dist-types/stream-type-check.d.ts +4 -0
  54. package/node_modules/@smithy/util-stream/dist-types/ts3.4/headStream.browser.d.ts +8 -0
  55. package/node_modules/@smithy/util-stream/dist-types/ts3.4/headStream.d.ts +9 -0
  56. package/node_modules/@smithy/util-stream/dist-types/ts3.4/index.d.ts +3 -0
  57. package/node_modules/@smithy/util-stream/dist-types/ts3.4/splitStream.browser.d.ts +8 -0
  58. package/node_modules/@smithy/util-stream/dist-types/ts3.4/splitStream.d.ts +14 -0
  59. package/node_modules/@smithy/util-stream/dist-types/ts3.4/stream-type-check.d.ts +4 -0
  60. package/node_modules/@smithy/util-stream/package.json +12 -6
  61. package/package.json +4 -4
@@ -0,0 +1,31 @@
1
+ export async function headStream(stream, bytes) {
2
+ let byteLengthCounter = 0;
3
+ const chunks = [];
4
+ const reader = stream.getReader();
5
+ let isDone = false;
6
+ while (!isDone) {
7
+ const { done, value } = await reader.read();
8
+ if (value) {
9
+ chunks.push(value);
10
+ byteLengthCounter += value?.byteLength ?? 0;
11
+ }
12
+ if (byteLengthCounter >= bytes) {
13
+ break;
14
+ }
15
+ isDone = done;
16
+ }
17
+ reader.releaseLock();
18
+ const collected = new Uint8Array(Math.min(bytes, byteLengthCounter));
19
+ let offset = 0;
20
+ for (const chunk of chunks) {
21
+ if (chunk.byteLength > collected.byteLength - offset) {
22
+ collected.set(chunk.subarray(0, collected.byteLength - offset), offset);
23
+ break;
24
+ }
25
+ else {
26
+ collected.set(chunk, offset);
27
+ }
28
+ offset += chunk.length;
29
+ }
30
+ return collected;
31
+ }
@@ -0,0 +1,41 @@
1
+ import { Writable } from "stream";
2
+ import { headStream as headWebStream } from "./headStream.browser";
3
+ import { isReadableStream } from "./stream-type-check";
4
+ export const headStream = (stream, bytes) => {
5
+ if (isReadableStream(stream)) {
6
+ return headWebStream(stream, bytes);
7
+ }
8
+ return new Promise((resolve, reject) => {
9
+ const collector = new Collector();
10
+ collector.limit = bytes;
11
+ stream.pipe(collector);
12
+ stream.on("error", (err) => {
13
+ collector.end();
14
+ reject(err);
15
+ });
16
+ collector.on("error", reject);
17
+ collector.on("finish", function () {
18
+ const bytes = new Uint8Array(Buffer.concat(this.buffers));
19
+ resolve(bytes);
20
+ });
21
+ });
22
+ };
23
+ class Collector extends Writable {
24
+ constructor() {
25
+ super(...arguments);
26
+ this.buffers = [];
27
+ this.limit = Infinity;
28
+ this.bytesBuffered = 0;
29
+ }
30
+ _write(chunk, encoding, callback) {
31
+ this.buffers.push(chunk);
32
+ this.bytesBuffered += chunk.byteLength ?? 0;
33
+ if (this.bytesBuffered >= this.limit) {
34
+ const excess = this.bytesBuffered - this.limit;
35
+ const tailBuffer = this.buffers[this.buffers.length - 1];
36
+ this.buffers[this.buffers.length - 1] = tailBuffer.subarray(0, tailBuffer.byteLength - excess);
37
+ this.emit("finish");
38
+ }
39
+ callback();
40
+ }
41
+ }
@@ -1,3 +1,6 @@
1
1
  export * from "./blob/Uint8ArrayBlobAdapter";
2
2
  export * from "./getAwsChunkedEncodingStream";
3
3
  export * from "./sdk-stream-mixin";
4
+ export * from "./splitStream";
5
+ export * from "./headStream";
6
+ export * from "./stream-type-check";
@@ -2,9 +2,10 @@ import { streamCollector } from "@smithy/fetch-http-handler";
2
2
  import { toBase64 } from "@smithy/util-base64";
3
3
  import { toHex } from "@smithy/util-hex-encoding";
4
4
  import { toUtf8 } from "@smithy/util-utf8";
5
+ import { isReadableStream } from "./stream-type-check";
5
6
  const ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed.";
6
7
  export const sdkStreamMixin = (stream) => {
7
- if (!isBlobInstance(stream) && !isReadableStreamInstance(stream)) {
8
+ if (!isBlobInstance(stream) && !isReadableStream(stream)) {
8
9
  const name = stream?.__proto__?.constructor?.name || stream;
9
10
  throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${name}`);
10
11
  }
@@ -51,7 +52,7 @@ export const sdkStreamMixin = (stream) => {
51
52
  if (isBlobInstance(stream)) {
52
53
  return blobToWebStream(stream);
53
54
  }
54
- else if (isReadableStreamInstance(stream)) {
55
+ else if (isReadableStream(stream)) {
55
56
  return stream;
56
57
  }
57
58
  else {
@@ -61,4 +62,3 @@ export const sdkStreamMixin = (stream) => {
61
62
  });
62
63
  };
63
64
  const isBlobInstance = (stream) => typeof Blob === "function" && stream instanceof Blob;
64
- const isReadableStreamInstance = (stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream;
@@ -0,0 +1,7 @@
1
+ export async function splitStream(stream) {
2
+ if (typeof stream.stream === "function") {
3
+ stream = stream.stream();
4
+ }
5
+ const readableStream = stream;
6
+ return readableStream.tee();
7
+ }
@@ -0,0 +1,13 @@
1
+ import { PassThrough } from "stream";
2
+ import { splitStream as splitWebStream } from "./splitStream.browser";
3
+ import { isReadableStream } from "./stream-type-check";
4
+ export async function splitStream(stream) {
5
+ if (isReadableStream(stream)) {
6
+ return splitWebStream(stream);
7
+ }
8
+ const stream1 = new PassThrough();
9
+ const stream2 = new PassThrough();
10
+ stream.pipe(stream1);
11
+ stream.pipe(stream2);
12
+ return [stream1, stream2];
13
+ }
@@ -0,0 +1,2 @@
1
+ export const isReadableStream = (stream) => typeof ReadableStream === "function" &&
2
+ (stream?.constructor?.name === ReadableStream.name || stream instanceof ReadableStream);
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @internal
3
+ * @param stream
4
+ * @param bytes - read head bytes from the stream and discard the rest of it.
5
+ *
6
+ * Caution: the input stream must be destroyed separately, this function does not do so.
7
+ */
8
+ export declare function headStream(stream: ReadableStream, bytes: number): Promise<Uint8Array>;
@@ -0,0 +1,9 @@
1
+ import { Readable } from "stream";
2
+ /**
3
+ * @internal
4
+ * @param stream
5
+ * @param bytes - read head bytes from the stream and discard the rest of it.
6
+ *
7
+ * Caution: the input stream must be destroyed separately, this function does not do so.
8
+ */
9
+ export declare const headStream: (stream: Readable | ReadableStream, bytes: number) => Promise<Uint8Array>;
@@ -1,3 +1,6 @@
1
1
  export * from "./blob/Uint8ArrayBlobAdapter";
2
2
  export * from "./getAwsChunkedEncodingStream";
3
3
  export * from "./sdk-stream-mixin";
4
+ export * from "./splitStream";
5
+ export * from "./headStream";
6
+ export * from "./stream-type-check";
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @param stream
3
+ * @returns stream split into two identical streams.
4
+ */
5
+ export declare function splitStream(stream: ReadableStream | Blob): Promise<[ReadableStream, ReadableStream]>;
@@ -0,0 +1,8 @@
1
+ /// <reference types="node" />
2
+ import type { Readable } from "stream";
3
+ /**
4
+ * @param stream
5
+ * @returns stream split into two identical streams.
6
+ */
7
+ export declare function splitStream(stream: Readable): Promise<[Readable, Readable]>;
8
+ export declare function splitStream(stream: ReadableStream): Promise<[ReadableStream, ReadableStream]>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare const isReadableStream: (stream: unknown) => stream is ReadableStream<any>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @internal
3
+ * @param stream
4
+ * @param bytes - read head bytes from the stream and discard the rest of it.
5
+ *
6
+ * Caution: the input stream must be destroyed separately, this function does not do so.
7
+ */
8
+ export declare function headStream(stream: ReadableStream, bytes: number): Promise<Uint8Array>;
@@ -0,0 +1,9 @@
1
+ import { Readable } from "stream";
2
+ /**
3
+ * @internal
4
+ * @param stream
5
+ * @param bytes - read head bytes from the stream and discard the rest of it.
6
+ *
7
+ * Caution: the input stream must be destroyed separately, this function does not do so.
8
+ */
9
+ export declare const headStream: (stream: Readable | ReadableStream, bytes: number) => Promise<Uint8Array>;
@@ -1,3 +1,6 @@
1
1
  export * from "./blob/Uint8ArrayBlobAdapter";
2
2
  export * from "./getAwsChunkedEncodingStream";
3
3
  export * from "./sdk-stream-mixin";
4
+ export * from "./splitStream";
5
+ export * from "./headStream";
6
+ export * from "./stream-type-check";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @param stream
3
+ * @returns stream split into two identical streams.
4
+ */
5
+ export declare function splitStream(stream: ReadableStream | Blob): Promise<[
6
+ ReadableStream,
7
+ ReadableStream
8
+ ]>;
@@ -0,0 +1,14 @@
1
+ /// <reference types="node" />
2
+ import { Readable } from "stream";
3
+ /**
4
+ * @param stream
5
+ * @returns stream split into two identical streams.
6
+ */
7
+ export declare function splitStream(stream: Readable): Promise<[
8
+ Readable,
9
+ Readable
10
+ ]>;
11
+ export declare function splitStream(stream: ReadableStream): Promise<[
12
+ ReadableStream,
13
+ ReadableStream
14
+ ]>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare const isReadableStream: (stream: unknown) => stream is ReadableStream<any>;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/util-stream",
3
- "version": "3.0.6",
3
+ "version": "3.1.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline util-stream",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "license": "Apache-2.0",
26
26
  "dependencies": {
27
- "@smithy/fetch-http-handler": "^3.2.1",
28
- "@smithy/node-http-handler": "^3.1.2",
27
+ "@smithy/fetch-http-handler": "^3.2.2",
28
+ "@smithy/node-http-handler": "^3.1.3",
29
29
  "@smithy/types": "^3.3.0",
30
30
  "@smithy/util-base64": "^3.0.0",
31
31
  "@smithy/util-buffer-from": "^3.0.0",
@@ -34,7 +34,7 @@
34
34
  "tslib": "^2.6.2"
35
35
  },
36
36
  "devDependencies": {
37
- "@smithy/util-test": "^0.2.4",
37
+ "@smithy/util-test": "^0.2.5",
38
38
  "@types/node": "^16.18.96",
39
39
  "concurrently": "7.0.0",
40
40
  "downlevel-dts": "0.10.1",
@@ -56,13 +56,19 @@
56
56
  ],
57
57
  "browser": {
58
58
  "./dist-es/getAwsChunkedEncodingStream": "./dist-es/getAwsChunkedEncodingStream.browser",
59
- "./dist-es/sdk-stream-mixin": "./dist-es/sdk-stream-mixin.browser"
59
+ "./dist-es/headStream": "./dist-es/headStream.browser",
60
+ "./dist-es/sdk-stream-mixin": "./dist-es/sdk-stream-mixin.browser",
61
+ "./dist-es/splitStream": "./dist-es/splitStream.browser"
60
62
  },
61
63
  "react-native": {
62
64
  "./dist-es/getAwsChunkedEncodingStream": "./dist-es/getAwsChunkedEncodingStream.browser",
63
65
  "./dist-es/sdk-stream-mixin": "./dist-es/sdk-stream-mixin.browser",
66
+ "./dist-es/headStream": "./dist-es/headStream.browser",
67
+ "./dist-es/splitStream": "./dist-es/splitStream.browser",
64
68
  "./dist-cjs/getAwsChunkedEncodingStream": "./dist-cjs/getAwsChunkedEncodingStream.browser",
65
- "./dist-cjs/sdk-stream-mixin": "./dist-cjs/sdk-stream-mixin.browser"
69
+ "./dist-cjs/sdk-stream-mixin": "./dist-cjs/sdk-stream-mixin.browser",
70
+ "./dist-cjs/headStream": "./dist-cjs/headStream.browser",
71
+ "./dist-cjs/splitStream": "./dist-cjs/splitStream.browser"
66
72
  },
67
73
  "homepage": "https://github.com/awslabs/smithy-typescript/tree/main/packages/util-stream",
68
74
  "repository": {
package/package.json CHANGED
@@ -83,7 +83,7 @@
83
83
  "aws-cdk-lib": "2.139.0",
84
84
  "aws-sdk-client-mock": "^4.0.1",
85
85
  "aws-sdk-client-mock-jest": "^4.0.1",
86
- "cdk-nag": "^2.28.157",
86
+ "cdk-nag": "^2.28.159",
87
87
  "cdklabs-projen-project-types": "^0.1.199",
88
88
  "constructs": "10.0.5",
89
89
  "esbuild": "^0.23.0",
@@ -98,7 +98,7 @@
98
98
  "jsii-pacmak": "^1.101.0",
99
99
  "jsii-rosetta": "^5.4.25",
100
100
  "lambda-tester": "^4.0.1",
101
- "projen": "0.84.3",
101
+ "projen": "0.84.4",
102
102
  "standard-version": "^9",
103
103
  "ts-jest": "^27",
104
104
  "ts-node": "^10.9.2",
@@ -109,7 +109,7 @@
109
109
  "constructs": "^10.0.5"
110
110
  },
111
111
  "dependencies": {
112
- "@aws-sdk/client-codedeploy": "^3.613.0",
112
+ "@aws-sdk/client-codedeploy": "^3.614.0",
113
113
  "jmespath": "^0.16.0"
114
114
  },
115
115
  "bundledDependencies": [
@@ -127,7 +127,7 @@
127
127
  "publishConfig": {
128
128
  "access": "public"
129
129
  },
130
- "version": "0.0.298",
130
+ "version": "0.0.300",
131
131
  "jest": {
132
132
  "coverageProvider": "v8",
133
133
  "testMatch": [