@mavogel/awscdk-rootmail 0.0.96 → 0.0.97

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 (176) hide show
  1. package/.jsii +7 -7
  2. package/lib/rootmail.js +1 -1
  3. package/lib/ses-receive.js +1 -1
  4. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-cjs/index.js +5 -5
  5. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-es/CloudWatchLogsClient.js +5 -5
  6. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/CloudWatchLogsClient.d.ts +2 -2
  7. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/runtimeConfig.browser.d.ts +1 -1
  8. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/runtimeConfig.d.ts +1 -1
  9. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/runtimeConfig.native.d.ts +1 -1
  10. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/CloudWatchLogsClient.d.ts +2 -2
  11. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -1
  12. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/runtimeConfig.d.ts +1 -1
  13. package/node_modules/@aws-sdk/client-cloudwatch-logs/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -1
  14. package/node_modules/@aws-sdk/client-cloudwatch-logs/package.json +17 -17
  15. package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +5 -5
  16. package/node_modules/@aws-sdk/client-route-53/dist-es/Route53Client.js +5 -5
  17. package/node_modules/@aws-sdk/client-route-53/dist-types/Route53Client.d.ts +2 -2
  18. package/node_modules/@aws-sdk/client-route-53/dist-types/runtimeConfig.browser.d.ts +1 -1
  19. package/node_modules/@aws-sdk/client-route-53/dist-types/runtimeConfig.d.ts +1 -1
  20. package/node_modules/@aws-sdk/client-route-53/dist-types/runtimeConfig.native.d.ts +1 -1
  21. package/node_modules/@aws-sdk/client-route-53/dist-types/ts3.4/Route53Client.d.ts +2 -2
  22. package/node_modules/@aws-sdk/client-route-53/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -1
  23. package/node_modules/@aws-sdk/client-route-53/dist-types/ts3.4/runtimeConfig.d.ts +1 -1
  24. package/node_modules/@aws-sdk/client-route-53/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -1
  25. package/node_modules/@aws-sdk/client-route-53/package.json +17 -17
  26. package/node_modules/@aws-sdk/client-s3/dist-cjs/index.js +174 -64
  27. package/node_modules/@aws-sdk/client-s3/dist-es/S3Client.js +7 -7
  28. package/node_modules/@aws-sdk/client-s3/dist-es/commands/AbortMultipartUploadCommand.js +2 -0
  29. package/node_modules/@aws-sdk/client-s3/dist-es/commands/CreateBucketCommand.js +2 -0
  30. package/node_modules/@aws-sdk/client-s3/dist-es/commands/CreateMultipartUploadCommand.js +2 -0
  31. package/node_modules/@aws-sdk/client-s3/dist-es/commands/CreateSessionCommand.js +2 -0
  32. package/node_modules/@aws-sdk/client-s3/dist-es/commands/DeleteObjectCommand.js +2 -0
  33. package/node_modules/@aws-sdk/client-s3/dist-es/commands/DeleteObjectTaggingCommand.js +2 -0
  34. package/node_modules/@aws-sdk/client-s3/dist-es/commands/DeleteObjectsCommand.js +2 -0
  35. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketAccelerateConfigurationCommand.js +2 -0
  36. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketAclCommand.js +2 -0
  37. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketAnalyticsConfigurationCommand.js +2 -0
  38. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketCorsCommand.js +2 -0
  39. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketEncryptionCommand.js +2 -0
  40. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketIntelligentTieringConfigurationCommand.js +2 -0
  41. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketInventoryConfigurationCommand.js +2 -0
  42. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketLifecycleConfigurationCommand.js +2 -0
  43. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketLocationCommand.js +2 -0
  44. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketLoggingCommand.js +2 -0
  45. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketMetricsConfigurationCommand.js +2 -0
  46. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketNotificationConfigurationCommand.js +2 -0
  47. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketOwnershipControlsCommand.js +2 -0
  48. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketPolicyCommand.js +2 -0
  49. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketPolicyStatusCommand.js +2 -0
  50. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketReplicationCommand.js +2 -0
  51. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketRequestPaymentCommand.js +2 -0
  52. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketTaggingCommand.js +2 -0
  53. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketVersioningCommand.js +2 -0
  54. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetBucketWebsiteCommand.js +2 -0
  55. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetObjectAclCommand.js +2 -0
  56. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetObjectAttributesCommand.js +2 -0
  57. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetObjectLegalHoldCommand.js +2 -0
  58. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetObjectLockConfigurationCommand.js +2 -0
  59. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetObjectRetentionCommand.js +2 -0
  60. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetObjectTaggingCommand.js +2 -0
  61. package/node_modules/@aws-sdk/client-s3/dist-es/commands/GetPublicAccessBlockCommand.js +2 -0
  62. package/node_modules/@aws-sdk/client-s3/dist-es/commands/HeadBucketCommand.js +2 -0
  63. package/node_modules/@aws-sdk/client-s3/dist-es/commands/HeadObjectCommand.js +2 -1
  64. package/node_modules/@aws-sdk/client-s3/dist-es/commands/ListBucketAnalyticsConfigurationsCommand.js +2 -0
  65. package/node_modules/@aws-sdk/client-s3/dist-es/commands/ListBucketIntelligentTieringConfigurationsCommand.js +2 -0
  66. package/node_modules/@aws-sdk/client-s3/dist-es/commands/ListBucketInventoryConfigurationsCommand.js +2 -0
  67. package/node_modules/@aws-sdk/client-s3/dist-es/commands/ListBucketMetricsConfigurationsCommand.js +2 -0
  68. package/node_modules/@aws-sdk/client-s3/dist-es/commands/ListBucketsCommand.js +2 -0
  69. package/node_modules/@aws-sdk/client-s3/dist-es/commands/ListDirectoryBucketsCommand.js +2 -0
  70. package/node_modules/@aws-sdk/client-s3/dist-es/commands/ListMultipartUploadsCommand.js +2 -0
  71. package/node_modules/@aws-sdk/client-s3/dist-es/commands/ListObjectVersionsCommand.js +2 -0
  72. package/node_modules/@aws-sdk/client-s3/dist-es/commands/ListObjectsCommand.js +2 -0
  73. package/node_modules/@aws-sdk/client-s3/dist-es/commands/ListObjectsV2Command.js +2 -0
  74. package/node_modules/@aws-sdk/client-s3/dist-es/commands/ListPartsCommand.js +2 -0
  75. package/node_modules/@aws-sdk/client-s3/dist-es/commands/PutObjectAclCommand.js +2 -0
  76. package/node_modules/@aws-sdk/client-s3/dist-es/commands/PutObjectCommand.js +2 -1
  77. package/node_modules/@aws-sdk/client-s3/dist-es/commands/PutObjectLegalHoldCommand.js +2 -0
  78. package/node_modules/@aws-sdk/client-s3/dist-es/commands/PutObjectLockConfigurationCommand.js +2 -0
  79. package/node_modules/@aws-sdk/client-s3/dist-es/commands/PutObjectRetentionCommand.js +2 -0
  80. package/node_modules/@aws-sdk/client-s3/dist-es/commands/PutObjectTaggingCommand.js +2 -0
  81. package/node_modules/@aws-sdk/client-s3/dist-es/commands/RestoreObjectCommand.js +2 -0
  82. package/node_modules/@aws-sdk/client-s3/dist-es/commands/SelectObjectContentCommand.js +2 -0
  83. package/node_modules/@aws-sdk/client-s3/dist-es/commands/UploadPartCommand.js +2 -0
  84. package/node_modules/@aws-sdk/client-s3/dist-types/S3Client.d.ts +2 -2
  85. package/node_modules/@aws-sdk/client-s3/dist-types/commands/DeleteObjectTaggingCommand.d.ts +11 -11
  86. package/node_modules/@aws-sdk/client-s3/dist-types/commands/DeleteObjectsCommand.d.ts +22 -22
  87. package/node_modules/@aws-sdk/client-s3/dist-types/commands/GetObjectCommand.d.ts +19 -19
  88. package/node_modules/@aws-sdk/client-s3/dist-types/commands/PutObjectCommand.d.ts +50 -50
  89. package/node_modules/@aws-sdk/client-s3/dist-types/commands/UploadPartCopyCommand.d.ts +13 -13
  90. package/node_modules/@aws-sdk/client-s3/dist-types/runtimeConfig.browser.d.ts +1 -1
  91. package/node_modules/@aws-sdk/client-s3/dist-types/runtimeConfig.d.ts +1 -1
  92. package/node_modules/@aws-sdk/client-s3/dist-types/runtimeConfig.native.d.ts +1 -1
  93. package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/S3Client.d.ts +2 -2
  94. package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/runtimeConfig.browser.d.ts +4 -4
  95. package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/runtimeConfig.d.ts +4 -4
  96. package/node_modules/@aws-sdk/client-s3/dist-types/ts3.4/runtimeConfig.native.d.ts +4 -4
  97. package/node_modules/@aws-sdk/client-s3/package.json +25 -25
  98. package/node_modules/@aws-sdk/client-ses/dist-cjs/index.js +5 -5
  99. package/node_modules/@aws-sdk/client-ses/dist-es/SESClient.js +5 -5
  100. package/node_modules/@aws-sdk/client-ses/dist-types/SESClient.d.ts +2 -2
  101. package/node_modules/@aws-sdk/client-ses/dist-types/runtimeConfig.browser.d.ts +1 -1
  102. package/node_modules/@aws-sdk/client-ses/dist-types/runtimeConfig.d.ts +1 -1
  103. package/node_modules/@aws-sdk/client-ses/dist-types/runtimeConfig.native.d.ts +1 -1
  104. package/node_modules/@aws-sdk/client-ses/dist-types/ts3.4/SESClient.d.ts +2 -2
  105. package/node_modules/@aws-sdk/client-ses/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -1
  106. package/node_modules/@aws-sdk/client-ses/dist-types/ts3.4/runtimeConfig.d.ts +1 -1
  107. package/node_modules/@aws-sdk/client-ses/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -1
  108. package/node_modules/@aws-sdk/client-ses/package.json +17 -17
  109. package/node_modules/@aws-sdk/client-ssm/dist-cjs/index.js +5 -5
  110. package/node_modules/@aws-sdk/client-ssm/dist-es/SSMClient.js +5 -5
  111. package/node_modules/@aws-sdk/client-ssm/dist-types/SSMClient.d.ts +2 -2
  112. package/node_modules/@aws-sdk/client-ssm/dist-types/runtimeConfig.browser.d.ts +1 -1
  113. package/node_modules/@aws-sdk/client-ssm/dist-types/runtimeConfig.d.ts +1 -1
  114. package/node_modules/@aws-sdk/client-ssm/dist-types/runtimeConfig.native.d.ts +1 -1
  115. package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/SSMClient.d.ts +2 -2
  116. package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -1
  117. package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/runtimeConfig.d.ts +1 -1
  118. package/node_modules/@aws-sdk/client-ssm/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -1
  119. package/node_modules/@aws-sdk/client-ssm/package.json +17 -17
  120. package/node_modules/@aws-sdk/client-sso/dist-cjs/index.js +5 -5
  121. package/node_modules/@aws-sdk/client-sso/dist-es/SSOClient.js +5 -5
  122. package/node_modules/@aws-sdk/client-sso/dist-types/SSOClient.d.ts +2 -2
  123. package/node_modules/@aws-sdk/client-sso/dist-types/runtimeConfig.browser.d.ts +1 -1
  124. package/node_modules/@aws-sdk/client-sso/dist-types/runtimeConfig.d.ts +1 -1
  125. package/node_modules/@aws-sdk/client-sso/dist-types/runtimeConfig.native.d.ts +1 -1
  126. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/SSOClient.d.ts +2 -2
  127. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -1
  128. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/runtimeConfig.d.ts +1 -1
  129. package/node_modules/@aws-sdk/client-sso/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -1
  130. package/node_modules/@aws-sdk/client-sso/package.json +14 -14
  131. package/node_modules/@aws-sdk/client-sso-oidc/dist-cjs/index.js +5 -5
  132. package/node_modules/@aws-sdk/client-sso-oidc/dist-es/SSOOIDCClient.js +5 -5
  133. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/SSOOIDCClient.d.ts +2 -2
  134. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/runtimeConfig.browser.d.ts +1 -1
  135. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/runtimeConfig.d.ts +1 -1
  136. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/runtimeConfig.native.d.ts +1 -1
  137. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/SSOOIDCClient.d.ts +2 -2
  138. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -1
  139. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/runtimeConfig.d.ts +1 -1
  140. package/node_modules/@aws-sdk/client-sso-oidc/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -1
  141. package/node_modules/@aws-sdk/client-sso-oidc/package.json +16 -16
  142. package/node_modules/@aws-sdk/client-sts/dist-cjs/STSClient.js +5 -5
  143. package/node_modules/@aws-sdk/client-sts/dist-es/STSClient.js +5 -5
  144. package/node_modules/@aws-sdk/client-sts/dist-types/STSClient.d.ts +2 -2
  145. package/node_modules/@aws-sdk/client-sts/dist-types/runtimeConfig.browser.d.ts +1 -1
  146. package/node_modules/@aws-sdk/client-sts/dist-types/runtimeConfig.d.ts +1 -1
  147. package/node_modules/@aws-sdk/client-sts/dist-types/runtimeConfig.native.d.ts +1 -1
  148. package/node_modules/@aws-sdk/client-sts/dist-types/ts3.4/STSClient.d.ts +2 -2
  149. package/node_modules/@aws-sdk/client-sts/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -1
  150. package/node_modules/@aws-sdk/client-sts/dist-types/ts3.4/runtimeConfig.d.ts +1 -1
  151. package/node_modules/@aws-sdk/client-sts/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -1
  152. package/node_modules/@aws-sdk/client-sts/package.json +16 -16
  153. package/node_modules/@aws-sdk/core/package.json +5 -5
  154. package/node_modules/@aws-sdk/credential-provider-http/package.json +6 -6
  155. package/node_modules/@aws-sdk/credential-provider-ini/package.json +4 -4
  156. package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +30 -6
  157. package/node_modules/@aws-sdk/credential-provider-node/dist-es/defaultProvider.js +29 -9
  158. package/node_modules/@aws-sdk/credential-provider-node/package.json +4 -4
  159. package/node_modules/@aws-sdk/credential-provider-sso/package.json +2 -2
  160. package/node_modules/@aws-sdk/middleware-bucket-endpoint/package.json +2 -2
  161. package/node_modules/@aws-sdk/middleware-expect-continue/package.json +2 -2
  162. package/node_modules/@aws-sdk/middleware-flexible-checksums/package.json +3 -3
  163. package/node_modules/@aws-sdk/middleware-host-header/package.json +2 -2
  164. package/node_modules/@aws-sdk/middleware-recursion-detection/package.json +2 -2
  165. package/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js +27 -10
  166. package/node_modules/@aws-sdk/middleware-sdk-s3/dist-es/throw-200-exceptions.js +27 -10
  167. package/node_modules/@aws-sdk/middleware-sdk-s3/dist-types/throw-200-exceptions.d.ts +1 -2
  168. package/node_modules/@aws-sdk/middleware-sdk-s3/dist-types/ts3.4/throw-200-exceptions.d.ts +0 -2
  169. package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +6 -4
  170. package/node_modules/@aws-sdk/middleware-signing/package.json +3 -3
  171. package/node_modules/@aws-sdk/middleware-user-agent/package.json +2 -2
  172. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +4 -4
  173. package/node_modules/@smithy/signature-v4/dist-types/SignatureV4.d.ts +1 -1
  174. package/node_modules/@smithy/signature-v4/dist-types/ts3.4/SignatureV4.d.ts +1 -1
  175. package/node_modules/@smithy/signature-v4/package.json +2 -2
  176. package/package.json +10 -10
@@ -441,25 +441,43 @@ var resolveS3Config = /* @__PURE__ */ __name((input, {
441
441
 
442
442
  // src/throw-200-exceptions.ts
443
443
 
444
- var throw200ExceptionsMiddleware = /* @__PURE__ */ __name((config) => (next) => async (args) => {
444
+ var import_util_stream = require("@smithy/util-stream");
445
+ var THROW_IF_EMPTY_BODY = {
446
+ CopyObjectCommand: true,
447
+ UploadPartCopyCommand: true,
448
+ CompleteMultipartUploadCommand: true
449
+ };
450
+ var MAX_BYTES_TO_INSPECT = 3e3;
451
+ var throw200ExceptionsMiddleware = /* @__PURE__ */ __name((config) => (next, context) => async (args) => {
445
452
  const result = await next(args);
446
453
  const { response } = result;
447
- if (!import_protocol_http.HttpResponse.isInstance(response))
454
+ if (!import_protocol_http.HttpResponse.isInstance(response)) {
448
455
  return result;
449
- const { statusCode, body } = response;
450
- if (statusCode < 200 || statusCode >= 300)
456
+ }
457
+ const { statusCode, body: sourceBody } = response;
458
+ if (statusCode < 200 || statusCode >= 300) {
451
459
  return result;
452
- const bodyBytes = await collectBody(body, config);
453
- const bodyString = await collectBodyString(bodyBytes, config);
454
- if (bodyBytes.length === 0) {
460
+ }
461
+ let bodyCopy = sourceBody;
462
+ let body = sourceBody;
463
+ if (sourceBody && typeof sourceBody === "object" && !(sourceBody instanceof Uint8Array)) {
464
+ [bodyCopy, body] = await (0, import_util_stream.splitStream)(sourceBody);
465
+ }
466
+ response.body = body;
467
+ const bodyBytes = await collectBody(bodyCopy, {
468
+ streamCollector: async (stream) => {
469
+ return (0, import_util_stream.headStream)(stream, MAX_BYTES_TO_INSPECT);
470
+ }
471
+ });
472
+ const bodyStringTail = config.utf8Encoder(bodyBytes.subarray(bodyBytes.length - 16));
473
+ if (bodyBytes.length === 0 && THROW_IF_EMPTY_BODY[context.commandName]) {
455
474
  const err = new Error("S3 aborted request");
456
475
  err.name = "InternalError";
457
476
  throw err;
458
477
  }
459
- if (bodyString && bodyString.match("<Error>")) {
478
+ if (bodyStringTail && bodyStringTail.endsWith("</Error>")) {
460
479
  response.statusCode = 400;
461
480
  }
462
- response.body = bodyBytes;
463
481
  return result;
464
482
  }, "throw200ExceptionsMiddleware");
465
483
  var collectBody = /* @__PURE__ */ __name((streamBody = new Uint8Array(), context) => {
@@ -468,7 +486,6 @@ var collectBody = /* @__PURE__ */ __name((streamBody = new Uint8Array(), context
468
486
  }
469
487
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
470
488
  }, "collectBody");
471
- var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
472
489
  var throw200ExceptionsMiddlewareOptions = {
473
490
  relation: "after",
474
491
  toMiddleware: "deserializerMiddleware",
@@ -1,23 +1,41 @@
1
1
  import { HttpResponse } from "@smithy/protocol-http";
2
- export const throw200ExceptionsMiddleware = (config) => (next) => async (args) => {
2
+ import { headStream, splitStream } from "@smithy/util-stream";
3
+ const THROW_IF_EMPTY_BODY = {
4
+ CopyObjectCommand: true,
5
+ UploadPartCopyCommand: true,
6
+ CompleteMultipartUploadCommand: true,
7
+ };
8
+ const MAX_BYTES_TO_INSPECT = 3000;
9
+ export const throw200ExceptionsMiddleware = (config) => (next, context) => async (args) => {
3
10
  const result = await next(args);
4
11
  const { response } = result;
5
- if (!HttpResponse.isInstance(response))
12
+ if (!HttpResponse.isInstance(response)) {
6
13
  return result;
7
- const { statusCode, body } = response;
8
- if (statusCode < 200 || statusCode >= 300)
14
+ }
15
+ const { statusCode, body: sourceBody } = response;
16
+ if (statusCode < 200 || statusCode >= 300) {
9
17
  return result;
10
- const bodyBytes = await collectBody(body, config);
11
- const bodyString = await collectBodyString(bodyBytes, config);
12
- if (bodyBytes.length === 0) {
18
+ }
19
+ let bodyCopy = sourceBody;
20
+ let body = sourceBody;
21
+ if (sourceBody && typeof sourceBody === "object" && !(sourceBody instanceof Uint8Array)) {
22
+ [bodyCopy, body] = await splitStream(sourceBody);
23
+ }
24
+ response.body = body;
25
+ const bodyBytes = await collectBody(bodyCopy, {
26
+ streamCollector: async (stream) => {
27
+ return headStream(stream, MAX_BYTES_TO_INSPECT);
28
+ },
29
+ });
30
+ const bodyStringTail = config.utf8Encoder(bodyBytes.subarray(bodyBytes.length - 16));
31
+ if (bodyBytes.length === 0 && THROW_IF_EMPTY_BODY[context.commandName]) {
13
32
  const err = new Error("S3 aborted request");
14
33
  err.name = "InternalError";
15
34
  throw err;
16
35
  }
17
- if (bodyString && bodyString.match("<Error>")) {
36
+ if (bodyStringTail && bodyStringTail.endsWith("</Error>")) {
18
37
  response.statusCode = 400;
19
38
  }
20
- response.body = bodyBytes;
21
39
  return result;
22
40
  };
23
41
  const collectBody = (streamBody = new Uint8Array(), context) => {
@@ -26,7 +44,6 @@ const collectBody = (streamBody = new Uint8Array(), context) => {
26
44
  }
27
45
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
28
46
  };
29
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
30
47
  export const throw200ExceptionsMiddlewareOptions = {
31
48
  relation: "after",
32
49
  toMiddleware: "deserializerMiddleware",
@@ -1,6 +1,5 @@
1
- import { DeserializeMiddleware, Encoder, Pluggable, RelativeMiddlewareOptions, StreamCollector } from "@smithy/types";
1
+ import { DeserializeMiddleware, Encoder, Pluggable, RelativeMiddlewareOptions } from "@smithy/types";
2
2
  type PreviouslyResolved = {
3
- streamCollector: StreamCollector;
4
3
  utf8Encoder: Encoder;
5
4
  };
6
5
  /**
@@ -3,10 +3,8 @@ import {
3
3
  Encoder,
4
4
  Pluggable,
5
5
  RelativeMiddlewareOptions,
6
- StreamCollector,
7
6
  } from "@smithy/types";
8
7
  type PreviouslyResolved = {
9
- streamCollector: StreamCollector;
10
8
  utf8Encoder: Encoder;
11
9
  };
12
10
  export declare const throw200ExceptionsMiddleware: (
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-sdk-s3",
3
- "version": "3.614.0",
3
+ "version": "3.616.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "node ../../scripts/compilation/inline middleware-sdk-s3",
@@ -26,11 +26,13 @@
26
26
  "@aws-sdk/types": "3.609.0",
27
27
  "@aws-sdk/util-arn-parser": "3.568.0",
28
28
  "@smithy/node-config-provider": "^3.1.4",
29
- "@smithy/protocol-http": "^4.0.3",
30
- "@smithy/signature-v4": "^3.1.2",
31
- "@smithy/smithy-client": "^3.1.7",
29
+ "@smithy/protocol-http": "^4.0.4",
30
+ "@smithy/signature-v4": "^4.0.0",
31
+ "@smithy/smithy-client": "^3.1.8",
32
32
  "@smithy/types": "^3.3.0",
33
33
  "@smithy/util-config-provider": "^3.0.0",
34
+ "@smithy/util-stream": "^3.1.0",
35
+ "@smithy/util-utf8": "^3.0.0",
34
36
  "tslib": "^2.6.2"
35
37
  },
36
38
  "devDependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-signing",
3
- "version": "3.609.0",
3
+ "version": "3.616.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "node ../../scripts/compilation/inline middleware-signing",
@@ -24,8 +24,8 @@
24
24
  "dependencies": {
25
25
  "@aws-sdk/types": "3.609.0",
26
26
  "@smithy/property-provider": "^3.1.3",
27
- "@smithy/protocol-http": "^4.0.3",
28
- "@smithy/signature-v4": "^3.1.2",
27
+ "@smithy/protocol-http": "^4.0.4",
28
+ "@smithy/signature-v4": "^4.0.0",
29
29
  "@smithy/types": "^3.3.0",
30
30
  "@smithy/util-middleware": "^3.0.3",
31
31
  "tslib": "^2.6.2"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/middleware-user-agent",
3
- "version": "3.614.0",
3
+ "version": "3.616.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "node ../../scripts/compilation/inline middleware-user-agent",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@aws-sdk/types": "3.609.0",
26
26
  "@aws-sdk/util-endpoints": "3.614.0",
27
- "@smithy/protocol-http": "^4.0.3",
27
+ "@smithy/protocol-http": "^4.0.4",
28
28
  "@smithy/types": "^3.3.0",
29
29
  "tslib": "^2.6.2"
30
30
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-sdk/signature-v4-multi-region",
3
- "version": "3.614.0",
3
+ "version": "3.616.0",
4
4
  "scripts": {
5
5
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
6
6
  "build:cjs": "node ../../scripts/compilation/inline signature-v4-multi-region",
@@ -20,10 +20,10 @@
20
20
  },
21
21
  "license": "Apache-2.0",
22
22
  "dependencies": {
23
- "@aws-sdk/middleware-sdk-s3": "3.614.0",
23
+ "@aws-sdk/middleware-sdk-s3": "3.616.0",
24
24
  "@aws-sdk/types": "3.609.0",
25
- "@smithy/protocol-http": "^4.0.3",
26
- "@smithy/signature-v4": "^3.1.2",
25
+ "@smithy/protocol-http": "^4.0.4",
26
+ "@smithy/signature-v4": "^4.0.0",
27
27
  "@smithy/types": "^3.3.0",
28
28
  "tslib": "^2.6.2"
29
29
  },
@@ -18,7 +18,7 @@ export interface SignatureV4Init {
18
18
  * A constructor function for a hash object that will calculate SHA-256 HMAC
19
19
  * checksums.
20
20
  */
21
- sha256?: ChecksumConstructor | HashConstructor;
21
+ sha256: ChecksumConstructor | HashConstructor;
22
22
  /**
23
23
  * Whether to uri-escape the request URI path as part of computing the
24
24
  * canonical request string. This is required for every AWS service, except
@@ -18,7 +18,7 @@ export interface SignatureV4Init {
18
18
  * A constructor function for a hash object that will calculate SHA-256 HMAC
19
19
  * checksums.
20
20
  */
21
- sha256?: ChecksumConstructor | HashConstructor;
21
+ sha256: ChecksumConstructor | HashConstructor;
22
22
  /**
23
23
  * Whether to uri-escape the request URI path as part of computing the
24
24
  * canonical request string. This is required for every AWS service, except
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/signature-v4",
3
- "version": "3.1.2",
3
+ "version": "4.0.0",
4
4
  "description": "A standalone implementation of the AWS Signature V4 request signing algorithm",
5
5
  "main": "./dist-cjs/index.js",
6
6
  "module": "./dist-es/index.js",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@aws-crypto/sha256-js": "5.2.0",
37
- "@smithy/protocol-http": "^4.0.3",
37
+ "@smithy/protocol-http": "^4.0.4",
38
38
  "concurrently": "7.0.0",
39
39
  "downlevel-dts": "0.10.1",
40
40
  "rimraf": "3.0.2",
package/package.json CHANGED
@@ -69,9 +69,9 @@
69
69
  "jsii-pacmak": "^1.101.0",
70
70
  "jsii-rosetta": "~5.3.0",
71
71
  "jsonfile": "^6.1.0",
72
- "projen": "^0.84.5",
72
+ "projen": "^0.84.6",
73
73
  "standard-version": "^9",
74
- "ts-jest": "^29.2.2",
74
+ "ts-jest": "^29.2.3",
75
75
  "ts-node": "^10.9.2",
76
76
  "typescript": "^5.5.3"
77
77
  },
@@ -80,11 +80,11 @@
80
80
  "constructs": "^10.0.5"
81
81
  },
82
82
  "dependencies": {
83
- "@aws-sdk/client-cloudwatch-logs": "^3.614.0",
84
- "@aws-sdk/client-route-53": "^3.614.0",
85
- "@aws-sdk/client-s3": "^3.614.0",
86
- "@aws-sdk/client-ses": "^3.614.0",
87
- "@aws-sdk/client-ssm": "^3.614.0",
83
+ "@aws-sdk/client-cloudwatch-logs": "^3.616.0",
84
+ "@aws-sdk/client-route-53": "^3.616.0",
85
+ "@aws-sdk/client-s3": "^3.616.0",
86
+ "@aws-sdk/client-ses": "^3.616.0",
87
+ "@aws-sdk/client-ssm": "^3.616.0",
88
88
  "async-retry": "^1.3.3",
89
89
  "axios": "^1.7.2",
90
90
  "cdk-nag": "^2.28.161",
@@ -115,13 +115,13 @@
115
115
  "publishConfig": {
116
116
  "access": "public"
117
117
  },
118
- "version": "0.0.96",
118
+ "version": "0.0.97",
119
119
  "jest": {
120
120
  "coverageProvider": "v8",
121
121
  "testMatch": [
122
- "<rootDir>/@(src|test)/**/?(*.)+(spec|test).ts?(x)",
122
+ "<rootDir>/@(src|test)/**/*(*.)@(spec|test).ts?(x)",
123
123
  "<rootDir>/@(src|test)/**/__tests__/**/*.ts?(x)",
124
- "<rootDir>/@(projenrc)/**/?(*.)+(spec|test).ts?(x)",
124
+ "<rootDir>/@(projenrc)/**/*(*.)@(spec|test).ts?(x)",
125
125
  "<rootDir>/@(projenrc)/**/__tests__/**/*.ts?(x)"
126
126
  ],
127
127
  "clearMocks": true,