cloudstructs 0.9.6 → 0.9.7

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 (73) hide show
  1. package/.jsii +3 -3
  2. package/assets/slack-textract/detect.lambda/index.js +477 -211
  3. package/lib/codecommit-mirror/index.js +2 -2
  4. package/lib/dmarc/index.js +1 -1
  5. package/lib/ecs-service-roller/index.js +2 -2
  6. package/lib/email-receiver/receiver.js +1 -1
  7. package/lib/saml-identity-provider/index.js +2 -2
  8. package/lib/slack-app/manifest.js +1 -1
  9. package/lib/slack-app/slack-app.js +2 -2
  10. package/lib/slack-events/index.js +1 -1
  11. package/lib/slack-textract/index.js +1 -1
  12. package/lib/ssl-server-test/index.js +1 -1
  13. package/lib/state-machine-cr-provider/index.js +1 -1
  14. package/lib/static-website/index.js +1 -1
  15. package/lib/toolkit-cleaner/index.js +1 -1
  16. package/lib/url-shortener/index.js +1 -1
  17. package/node_modules/@slack/logger/node_modules/@types/node/README.md +1 -1
  18. package/node_modules/@slack/logger/node_modules/@types/node/fs.d.ts +6 -0
  19. package/node_modules/@slack/logger/node_modules/@types/node/package.json +2 -2
  20. package/node_modules/@slack/logger/node_modules/@types/node/stream.d.ts +50 -46
  21. package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
  22. package/node_modules/@slack/web-api/node_modules/@types/node/fs.d.ts +6 -0
  23. package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
  24. package/node_modules/@slack/web-api/node_modules/@types/node/stream.d.ts +50 -46
  25. package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +1 -1
  26. package/node_modules/@types/cacheable-request/node_modules/@types/node/fs.d.ts +6 -0
  27. package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +2 -2
  28. package/node_modules/@types/cacheable-request/node_modules/@types/node/stream.d.ts +50 -46
  29. package/node_modules/@types/is-stream/node_modules/@types/node/README.md +1 -1
  30. package/node_modules/@types/is-stream/node_modules/@types/node/fs.d.ts +6 -0
  31. package/node_modules/@types/is-stream/node_modules/@types/node/package.json +2 -2
  32. package/node_modules/@types/is-stream/node_modules/@types/node/stream.d.ts +50 -46
  33. package/node_modules/@types/keyv/node_modules/@types/node/README.md +1 -1
  34. package/node_modules/@types/keyv/node_modules/@types/node/fs.d.ts +6 -0
  35. package/node_modules/@types/keyv/node_modules/@types/node/package.json +2 -2
  36. package/node_modules/@types/keyv/node_modules/@types/node/stream.d.ts +50 -46
  37. package/node_modules/@types/responselike/node_modules/@types/node/README.md +1 -1
  38. package/node_modules/@types/responselike/node_modules/@types/node/fs.d.ts +6 -0
  39. package/node_modules/@types/responselike/node_modules/@types/node/package.json +2 -2
  40. package/node_modules/@types/responselike/node_modules/@types/node/stream.d.ts +50 -46
  41. package/node_modules/axios/CHANGELOG.md +868 -790
  42. package/node_modules/axios/README.md +60 -15
  43. package/node_modules/axios/dist/axios.js +1018 -294
  44. package/node_modules/axios/dist/axios.js.map +1 -1
  45. package/node_modules/axios/dist/axios.min.js +1 -1
  46. package/node_modules/axios/dist/axios.min.js.map +1 -1
  47. package/node_modules/axios/dist/browser/axios.cjs +688 -308
  48. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  49. package/node_modules/axios/dist/esm/axios.js +688 -308
  50. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  51. package/node_modules/axios/dist/esm/axios.min.js +1 -1
  52. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  53. package/node_modules/axios/dist/node/axios.cjs +597 -246
  54. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  55. package/node_modules/axios/index.d.cts +5 -2
  56. package/node_modules/axios/index.d.ts +5 -2
  57. package/node_modules/axios/lib/adapters/adapters.js +3 -1
  58. package/node_modules/axios/lib/adapters/fetch.js +227 -0
  59. package/node_modules/axios/lib/adapters/xhr.js +31 -101
  60. package/node_modules/axios/lib/core/Axios.js +9 -6
  61. package/node_modules/axios/lib/core/AxiosHeaders.js +4 -0
  62. package/node_modules/axios/lib/defaults/index.js +7 -2
  63. package/node_modules/axios/lib/env/data.js +1 -1
  64. package/node_modules/axios/lib/helpers/AxiosTransformStream.js +9 -8
  65. package/node_modules/axios/lib/helpers/composeSignals.js +46 -0
  66. package/node_modules/axios/lib/helpers/progressEventReducer.js +32 -0
  67. package/node_modules/axios/lib/helpers/resolveConfig.js +57 -0
  68. package/node_modules/axios/lib/helpers/throttle.js +5 -3
  69. package/node_modules/axios/lib/helpers/trackStream.js +55 -0
  70. package/node_modules/axios/lib/platform/common/utils.js +4 -1
  71. package/node_modules/axios/lib/utils.js +7 -2
  72. package/node_modules/axios/package.json +4 -3
  73. package/package.json +16 -16
@@ -0,0 +1,32 @@
1
+ import speedometer from "./speedometer.js";
2
+ import throttle from "./throttle.js";
3
+
4
+ export default (listener, isDownloadStream, freq = 3) => {
5
+ let bytesNotified = 0;
6
+ const _speedometer = speedometer(50, 250);
7
+
8
+ return throttle(e => {
9
+ const loaded = e.loaded;
10
+ const total = e.lengthComputable ? e.total : undefined;
11
+ const progressBytes = loaded - bytesNotified;
12
+ const rate = _speedometer(progressBytes);
13
+ const inRange = loaded <= total;
14
+
15
+ bytesNotified = loaded;
16
+
17
+ const data = {
18
+ loaded,
19
+ total,
20
+ progress: total ? (loaded / total) : undefined,
21
+ bytes: progressBytes,
22
+ rate: rate ? rate : undefined,
23
+ estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
24
+ event: e,
25
+ lengthComputable: total != null
26
+ };
27
+
28
+ data[isDownloadStream ? 'download' : 'upload'] = true;
29
+
30
+ listener(data);
31
+ }, freq);
32
+ }
@@ -0,0 +1,57 @@
1
+ import platform from "../platform/index.js";
2
+ import utils from "../utils.js";
3
+ import isURLSameOrigin from "./isURLSameOrigin.js";
4
+ import cookies from "./cookies.js";
5
+ import buildFullPath from "../core/buildFullPath.js";
6
+ import mergeConfig from "../core/mergeConfig.js";
7
+ import AxiosHeaders from "../core/AxiosHeaders.js";
8
+ import buildURL from "./buildURL.js";
9
+
10
+ export default (config) => {
11
+ const newConfig = mergeConfig({}, config);
12
+
13
+ let {data, withXSRFToken, xsrfHeaderName, xsrfCookieName, headers, auth} = newConfig;
14
+
15
+ newConfig.headers = headers = AxiosHeaders.from(headers);
16
+
17
+ newConfig.url = buildURL(buildFullPath(newConfig.baseURL, newConfig.url), config.params, config.paramsSerializer);
18
+
19
+ // HTTP basic authentication
20
+ if (auth) {
21
+ headers.set('Authorization', 'Basic ' +
22
+ btoa((auth.username || '') + ':' + (auth.password ? unescape(encodeURIComponent(auth.password)) : ''))
23
+ );
24
+ }
25
+
26
+ let contentType;
27
+
28
+ if (utils.isFormData(data)) {
29
+ if (platform.hasStandardBrowserEnv || platform.hasStandardBrowserWebWorkerEnv) {
30
+ headers.setContentType(undefined); // Let the browser set it
31
+ } else if ((contentType = headers.getContentType()) !== false) {
32
+ // fix semicolon duplication issue for ReactNative FormData implementation
33
+ const [type, ...tokens] = contentType ? contentType.split(';').map(token => token.trim()).filter(Boolean) : [];
34
+ headers.setContentType([type || 'multipart/form-data', ...tokens].join('; '));
35
+ }
36
+ }
37
+
38
+ // Add xsrf header
39
+ // This is only done if running in a standard browser environment.
40
+ // Specifically not if we're in a web worker, or react-native.
41
+
42
+ if (platform.hasStandardBrowserEnv) {
43
+ withXSRFToken && utils.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
44
+
45
+ if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
46
+ // Add xsrf header
47
+ const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
48
+
49
+ if (xsrfValue) {
50
+ headers.set(xsrfHeaderName, xsrfValue);
51
+ }
52
+ }
53
+ }
54
+
55
+ return newConfig;
56
+ }
57
+
@@ -10,7 +10,9 @@ function throttle(fn, freq) {
10
10
  let timestamp = 0;
11
11
  const threshold = 1000 / freq;
12
12
  let timer = null;
13
- return function throttled(force, args) {
13
+ return function throttled() {
14
+ const force = this === true;
15
+
14
16
  const now = Date.now();
15
17
  if (force || now - timestamp > threshold) {
16
18
  if (timer) {
@@ -18,13 +20,13 @@ function throttle(fn, freq) {
18
20
  timer = null;
19
21
  }
20
22
  timestamp = now;
21
- return fn.apply(null, args);
23
+ return fn.apply(null, arguments);
22
24
  }
23
25
  if (!timer) {
24
26
  timer = setTimeout(() => {
25
27
  timer = null;
26
28
  timestamp = Date.now();
27
- return fn.apply(null, args);
29
+ return fn.apply(null, arguments);
28
30
  }, threshold - (now - timestamp));
29
31
  }
30
32
  };
@@ -0,0 +1,55 @@
1
+
2
+
3
+ export const streamChunk = function* (chunk, chunkSize) {
4
+ let len = chunk.byteLength;
5
+
6
+ if (!chunkSize || len < chunkSize) {
7
+ yield chunk;
8
+ return;
9
+ }
10
+
11
+ let pos = 0;
12
+ let end;
13
+
14
+ while (pos < len) {
15
+ end = pos + chunkSize;
16
+ yield chunk.slice(pos, end);
17
+ pos = end;
18
+ }
19
+ }
20
+
21
+ export const readBytes = async function* (iterable, chunkSize, encode) {
22
+ for await (const chunk of iterable) {
23
+ yield* streamChunk(ArrayBuffer.isView(chunk) ? chunk : (await encode(String(chunk))), chunkSize);
24
+ }
25
+ }
26
+
27
+ export const trackStream = (stream, chunkSize, onProgress, onFinish, encode) => {
28
+ const iterator = readBytes(stream, chunkSize, encode);
29
+
30
+ let bytes = 0;
31
+
32
+ return new ReadableStream({
33
+ type: 'bytes',
34
+
35
+ async pull(controller) {
36
+ const {done, value} = await iterator.next();
37
+
38
+ if (done) {
39
+ controller.close();
40
+ onFinish();
41
+ return;
42
+ }
43
+
44
+ let len = value.byteLength;
45
+ onProgress && onProgress(bytes += len);
46
+ controller.enqueue(new Uint8Array(value));
47
+ },
48
+ cancel(reason) {
49
+ onFinish(reason);
50
+ return iterator.return();
51
+ }
52
+ }, {
53
+ highWaterMark: 2
54
+ })
55
+ }
@@ -40,8 +40,11 @@ const hasStandardBrowserWebWorkerEnv = (() => {
40
40
  );
41
41
  })();
42
42
 
43
+ const origin = hasBrowserEnv && window.location.href || 'http://localhost';
44
+
43
45
  export {
44
46
  hasBrowserEnv,
45
47
  hasStandardBrowserWebWorkerEnv,
46
- hasStandardBrowserEnv
48
+ hasStandardBrowserEnv,
49
+ origin
47
50
  }
@@ -209,6 +209,8 @@ const isFormData = (thing) => {
209
209
  */
210
210
  const isURLSearchParams = kindOfTest('URLSearchParams');
211
211
 
212
+ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);
213
+
212
214
  /**
213
215
  * Trim excess whitespace off the beginning and end of a string
214
216
  *
@@ -597,8 +599,7 @@ const toObjectSet = (arrayOrString, delimiter) => {
597
599
  const noop = () => {}
598
600
 
599
601
  const toFiniteNumber = (value, defaultValue) => {
600
- value = +value;
601
- return Number.isFinite(value) ? value : defaultValue;
602
+ return value != null && Number.isFinite(value = +value) ? value : defaultValue;
602
603
  }
603
604
 
604
605
  const ALPHA = 'abcdefghijklmnopqrstuvwxyz'
@@ -679,6 +680,10 @@ export default {
679
680
  isBoolean,
680
681
  isObject,
681
682
  isPlainObject,
683
+ isReadableStream,
684
+ isRequest,
685
+ isResponse,
686
+ isHeaders,
682
687
  isUndefined,
683
688
  isDate,
684
689
  isFile,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axios",
3
- "version": "1.6.8",
3
+ "version": "1.7.2",
4
4
  "description": "Promise based HTTP client for the browser and node.js",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -135,7 +135,8 @@
135
135
  "stream-throttle": "^0.1.3",
136
136
  "string-replace-async": "^3.0.2",
137
137
  "terser-webpack-plugin": "^4.2.3",
138
- "typescript": "^4.9.5"
138
+ "typescript": "^4.9.5",
139
+ "@rollup/plugin-alias": "^5.1.0"
139
140
  },
140
141
  "browser": {
141
142
  "./lib/adapters/http.js": "./lib/helpers/null.js",
@@ -159,8 +160,8 @@
159
160
  "contributors": [
160
161
  "Matt Zabriskie (https://github.com/mzabriskie)",
161
162
  "Nick Uraltsev (https://github.com/nickuraltsev)",
162
- "Jay (https://github.com/jasonsaayman)",
163
163
  "Dmitriy Mozgovoy (https://github.com/DigitalBrainJS)",
164
+ "Jay (https://github.com/jasonsaayman)",
164
165
  "Emily Morehouse (https://github.com/emilyemorehouse)",
165
166
  "Rubén Norte (https://github.com/rubennorte)",
166
167
  "Justin Beckwith (https://github.com/JustinBeckwith)",
package/package.json CHANGED
@@ -86,18 +86,18 @@
86
86
  "organization": false
87
87
  },
88
88
  "devDependencies": {
89
- "@aws-sdk/client-cloudformation": "^3.569.0",
90
- "@aws-sdk/client-dynamodb": "^3.569.0",
91
- "@aws-sdk/client-ecr": "^3.569.0",
92
- "@aws-sdk/client-ecs": "^3.569.0",
93
- "@aws-sdk/client-eventbridge": "^3.569.0",
94
- "@aws-sdk/client-iam": "^3.569.0",
95
- "@aws-sdk/client-s3": "^3.569.0",
96
- "@aws-sdk/client-secrets-manager": "^3.569.0",
97
- "@aws-sdk/client-sfn": "^3.569.0",
98
- "@aws-sdk/client-textract": "^3.569.0",
99
- "@aws-sdk/lib-dynamodb": "^3.569.0",
100
- "@types/aws-lambda": "^8.10.137",
89
+ "@aws-sdk/client-cloudformation": "^3.583.0",
90
+ "@aws-sdk/client-dynamodb": "^3.584.0",
91
+ "@aws-sdk/client-ecr": "^3.583.0",
92
+ "@aws-sdk/client-ecs": "^3.583.0",
93
+ "@aws-sdk/client-eventbridge": "^3.583.0",
94
+ "@aws-sdk/client-iam": "^3.583.0",
95
+ "@aws-sdk/client-s3": "^3.583.0",
96
+ "@aws-sdk/client-secrets-manager": "^3.583.0",
97
+ "@aws-sdk/client-sfn": "^3.583.0",
98
+ "@aws-sdk/client-textract": "^3.583.0",
99
+ "@aws-sdk/lib-dynamodb": "^3.584.0",
100
+ "@types/aws-lambda": "^8.10.138",
101
101
  "@types/jest": "^29",
102
102
  "@types/node": "^18",
103
103
  "@types/tsscmp": "^1.0.2",
@@ -108,7 +108,7 @@
108
108
  "aws-sdk-client-mock": "^2.2.0",
109
109
  "aws-sdk-client-mock-jest": "^2.2.0",
110
110
  "constructs": "10.0.5",
111
- "esbuild": "^0.21.1",
111
+ "esbuild": "^0.21.3",
112
112
  "eslint": "^8",
113
113
  "eslint-import-resolver-typescript": "^3.6.1",
114
114
  "eslint-plugin-import": "^2.29.1",
@@ -120,7 +120,7 @@
120
120
  "jsii-pacmak": "^1.98.0",
121
121
  "jsii-rosetta": "5.x",
122
122
  "nock": "^13.5.4",
123
- "projen": "^0.81.7",
123
+ "projen": "^0.81.15",
124
124
  "standard-version": "^9",
125
125
  "ts-jest": "^29",
126
126
  "ts-node": "^10.9.2",
@@ -143,11 +143,11 @@
143
143
  ],
144
144
  "main": "lib/index.js",
145
145
  "license": "Apache-2.0",
146
- "version": "0.9.6",
146
+ "version": "0.9.7",
147
147
  "jest": {
148
148
  "testMatch": [
149
149
  "<rootDir>/src/**/__tests__/**/*.ts?(x)",
150
- "<rootDir>/(test|src)/**/*(*.)@(spec|test).ts?(x)"
150
+ "<rootDir>/@(test|src)/**/*(*.)@(spec|test).ts?(x)"
151
151
  ],
152
152
  "clearMocks": true,
153
153
  "collectCoverage": true,