@cdklabs/cdk-ecs-codedeploy 0.0.338 → 0.0.339

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 (129) hide show
  1. package/.jsii +2 -2
  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/@smithy/abort-controller/package.json +2 -2
  7. package/node_modules/@smithy/config-resolver/package.json +4 -4
  8. package/node_modules/@smithy/core/dist-cjs/index.js +79 -158
  9. package/node_modules/@smithy/core/dist-cjs/setFeature.js +1 -0
  10. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +2 -2
  11. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +163 -0
  12. package/node_modules/@smithy/core/dist-es/index.js +4 -3
  13. package/node_modules/@smithy/core/dist-es/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.js +1 -2
  14. package/node_modules/@smithy/core/dist-es/middleware-http-signing/getHttpSigningMiddleware.js +1 -2
  15. package/node_modules/@smithy/core/dist-es/protocols/requestBuilder.js +1 -67
  16. package/node_modules/@smithy/core/dist-es/setFeature.js +11 -0
  17. package/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +1 -1
  18. package/node_modules/@smithy/core/dist-es/submodules/protocols/collect-stream-body.js +11 -0
  19. package/node_modules/@smithy/core/dist-es/submodules/protocols/extended-encode-uri-component.js +5 -0
  20. package/node_modules/@smithy/core/dist-es/submodules/protocols/index.js +4 -0
  21. package/node_modules/@smithy/core/dist-es/submodules/protocols/requestBuilder.js +67 -0
  22. package/node_modules/@smithy/core/dist-es/submodules/protocols/resolve-path.js +19 -0
  23. package/node_modules/@smithy/core/dist-types/index.d.ts +4 -3
  24. package/node_modules/@smithy/core/dist-types/protocols/requestBuilder.d.ts +2 -48
  25. package/node_modules/@smithy/core/dist-types/setFeature.d.ts +12 -0
  26. package/node_modules/@smithy/core/dist-types/submodules/protocols/collect-stream-body.d.ts +10 -0
  27. package/node_modules/@smithy/core/dist-types/submodules/protocols/extended-encode-uri-component.d.ts +7 -0
  28. package/node_modules/@smithy/core/dist-types/submodules/protocols/index.d.ts +4 -0
  29. package/node_modules/@smithy/core/dist-types/submodules/protocols/requestBuilder.d.ts +51 -0
  30. package/node_modules/@smithy/core/dist-types/submodules/protocols/resolve-path.d.ts +4 -0
  31. package/node_modules/@smithy/core/dist-types/ts3.4/index.d.ts +4 -3
  32. package/node_modules/@smithy/core/dist-types/ts3.4/protocols/requestBuilder.d.ts +2 -48
  33. package/node_modules/@smithy/core/dist-types/ts3.4/setFeature.d.ts +12 -0
  34. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/collect-stream-body.d.ts +10 -0
  35. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/extended-encode-uri-component.d.ts +7 -0
  36. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/index.d.ts +4 -0
  37. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/requestBuilder.d.ts +51 -0
  38. package/node_modules/@smithy/core/dist-types/ts3.4/submodules/protocols/resolve-path.d.ts +4 -0
  39. package/node_modules/@smithy/core/package.json +15 -8
  40. package/node_modules/@smithy/core/protocols.d.ts +7 -0
  41. package/node_modules/@smithy/core/protocols.js +6 -0
  42. package/node_modules/@smithy/credential-provider-imds/package.json +5 -5
  43. package/node_modules/@smithy/hash-node/package.json +2 -2
  44. package/node_modules/@smithy/invalid-dependency/package.json +2 -2
  45. package/node_modules/@smithy/middleware-content-length/package.json +3 -3
  46. package/node_modules/@smithy/middleware-endpoint/dist-cjs/index.js +4 -0
  47. package/node_modules/@smithy/middleware-endpoint/dist-es/endpointMiddleware.js +4 -0
  48. package/node_modules/@smithy/middleware-endpoint/package.json +8 -7
  49. package/node_modules/@smithy/middleware-retry/package.json +8 -8
  50. package/node_modules/@smithy/middleware-serde/package.json +2 -2
  51. package/node_modules/@smithy/middleware-stack/package.json +2 -2
  52. package/node_modules/@smithy/node-config-provider/package.json +4 -4
  53. package/node_modules/@smithy/node-http-handler/package.json +5 -5
  54. package/node_modules/@smithy/property-provider/package.json +2 -2
  55. package/node_modules/@smithy/protocol-http/package.json +2 -2
  56. package/node_modules/@smithy/querystring-builder/package.json +2 -2
  57. package/node_modules/@smithy/querystring-parser/package.json +2 -2
  58. package/node_modules/@smithy/service-error-classification/package.json +2 -2
  59. package/node_modules/@smithy/shared-ini-file-loader/package.json +2 -2
  60. package/node_modules/@smithy/signature-v4/package.json +4 -4
  61. package/node_modules/@smithy/smithy-client/dist-cjs/index.js +6 -35
  62. package/node_modules/@smithy/smithy-client/dist-es/collect-stream-body.js +1 -11
  63. package/node_modules/@smithy/smithy-client/dist-es/extended-encode-uri-component.js +1 -5
  64. package/node_modules/@smithy/smithy-client/dist-es/resolve-path.js +1 -19
  65. package/node_modules/@smithy/smithy-client/dist-types/collect-stream-body.d.ts +2 -7
  66. package/node_modules/@smithy/smithy-client/dist-types/extended-encode-uri-component.d.ts +2 -4
  67. package/node_modules/@smithy/smithy-client/dist-types/resolve-path.d.ts +2 -1
  68. package/node_modules/@smithy/smithy-client/dist-types/ts3.4/collect-stream-body.d.ts +2 -7
  69. package/node_modules/@smithy/smithy-client/dist-types/ts3.4/extended-encode-uri-component.d.ts +2 -4
  70. package/node_modules/@smithy/smithy-client/dist-types/ts3.4/resolve-path.d.ts +2 -1
  71. package/node_modules/@smithy/smithy-client/package.json +7 -6
  72. package/node_modules/@smithy/types/dist-cjs/feature-ids.js +1 -0
  73. package/node_modules/@smithy/types/dist-es/feature-ids.js +1 -0
  74. package/node_modules/@smithy/types/dist-es/index.js +1 -0
  75. package/node_modules/@smithy/types/dist-types/feature-ids.d.ts +16 -0
  76. package/node_modules/@smithy/types/dist-types/index.d.ts +1 -0
  77. package/node_modules/@smithy/types/dist-types/middleware.d.ts +30 -6
  78. package/node_modules/@smithy/types/dist-types/ts3.4/feature-ids.d.ts +16 -0
  79. package/node_modules/@smithy/types/dist-types/ts3.4/index.d.ts +1 -0
  80. package/node_modules/@smithy/types/dist-types/ts3.4/middleware.d.ts +26 -2
  81. package/node_modules/@smithy/types/package.json +1 -1
  82. package/node_modules/@smithy/url-parser/package.json +3 -3
  83. package/node_modules/@smithy/util-defaults-mode-browser/package.json +4 -4
  84. package/node_modules/@smithy/util-defaults-mode-node/package.json +7 -7
  85. package/node_modules/@smithy/util-endpoints/package.json +3 -3
  86. package/node_modules/@smithy/util-middleware/package.json +2 -2
  87. package/node_modules/@smithy/util-retry/package.json +3 -3
  88. package/node_modules/@smithy/util-stream/dist-cjs/checksum/ChecksumStream.browser.js +7 -0
  89. package/node_modules/@smithy/util-stream/dist-cjs/checksum/ChecksumStream.js +49 -0
  90. package/node_modules/@smithy/util-stream/dist-cjs/checksum/createChecksumStream.browser.js +40 -0
  91. package/node_modules/@smithy/util-stream/dist-cjs/checksum/createChecksumStream.js +13 -0
  92. package/node_modules/@smithy/util-stream/dist-cjs/index.js +5 -1
  93. package/node_modules/@smithy/util-stream/dist-es/checksum/ChecksumStream.browser.js +3 -0
  94. package/node_modules/@smithy/util-stream/dist-es/checksum/ChecksumStream.js +44 -0
  95. package/node_modules/@smithy/util-stream/dist-es/checksum/createChecksumStream.browser.js +35 -0
  96. package/node_modules/@smithy/util-stream/dist-es/checksum/createChecksumStream.js +9 -0
  97. package/node_modules/@smithy/util-stream/dist-es/index.js +2 -0
  98. package/node_modules/@smithy/util-stream/dist-types/checksum/ChecksumStream.browser.d.ts +37 -0
  99. package/node_modules/@smithy/util-stream/dist-types/checksum/ChecksumStream.d.ts +61 -0
  100. package/node_modules/@smithy/util-stream/dist-types/checksum/createChecksumStream.browser.d.ts +15 -0
  101. package/node_modules/@smithy/util-stream/dist-types/checksum/createChecksumStream.d.ts +12 -0
  102. package/node_modules/@smithy/util-stream/dist-types/index.d.ts +2 -0
  103. package/node_modules/@smithy/util-stream/dist-types/ts3.4/checksum/ChecksumStream.browser.d.ts +37 -0
  104. package/node_modules/@smithy/util-stream/dist-types/ts3.4/checksum/ChecksumStream.d.ts +60 -0
  105. package/node_modules/@smithy/util-stream/dist-types/ts3.4/checksum/createChecksumStream.browser.d.ts +15 -0
  106. package/node_modules/@smithy/util-stream/dist-types/ts3.4/checksum/createChecksumStream.d.ts +12 -0
  107. package/node_modules/@smithy/util-stream/dist-types/ts3.4/index.d.ts +2 -0
  108. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/LICENSE +201 -0
  109. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/README.md +11 -0
  110. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-cjs/fetch-http-handler.js +1 -0
  111. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-cjs/index.js +230 -0
  112. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-cjs/request-timeout.js +1 -0
  113. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-cjs/stream-collector.js +1 -0
  114. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-es/fetch-http-handler.js +138 -0
  115. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-es/index.js +2 -0
  116. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-es/request-timeout.js +11 -0
  117. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-es/stream-collector.js +27 -0
  118. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-types/fetch-http-handler.d.ts +33 -0
  119. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-types/index.d.ts +2 -0
  120. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-types/request-timeout.d.ts +1 -0
  121. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-types/stream-collector.d.ts +2 -0
  122. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-types/ts3.4/fetch-http-handler.d.ts +33 -0
  123. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-types/ts3.4/index.d.ts +2 -0
  124. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-types/ts3.4/request-timeout.d.ts +1 -0
  125. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/dist-types/ts3.4/stream-collector.d.ts +2 -0
  126. package/node_modules/@smithy/util-stream/node_modules/@smithy/fetch-http-handler/package.json +62 -0
  127. package/node_modules/@smithy/util-stream/package.json +10 -4
  128. package/node_modules/@smithy/util-waiter/package.json +3 -3
  129. package/package.json +2 -2
@@ -0,0 +1,163 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/submodules/protocols/index.ts
20
+ var protocols_exports = {};
21
+ __export(protocols_exports, {
22
+ RequestBuilder: () => RequestBuilder,
23
+ collectBody: () => collectBody,
24
+ extendedEncodeURIComponent: () => extendedEncodeURIComponent,
25
+ requestBuilder: () => requestBuilder,
26
+ resolvedPath: () => resolvedPath2
27
+ });
28
+ module.exports = __toCommonJS(protocols_exports);
29
+
30
+ // src/submodules/protocols/collect-stream-body.ts
31
+ var import_util_stream = require("@smithy/util-stream");
32
+ var collectBody = async (streamBody = new Uint8Array(), context) => {
33
+ if (streamBody instanceof Uint8Array) {
34
+ return import_util_stream.Uint8ArrayBlobAdapter.mutate(streamBody);
35
+ }
36
+ if (!streamBody) {
37
+ return import_util_stream.Uint8ArrayBlobAdapter.mutate(new Uint8Array());
38
+ }
39
+ const fromContext = context.streamCollector(streamBody);
40
+ return import_util_stream.Uint8ArrayBlobAdapter.mutate(await fromContext);
41
+ };
42
+
43
+ // src/submodules/protocols/extended-encode-uri-component.ts
44
+ function extendedEncodeURIComponent(str) {
45
+ return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
46
+ return "%" + c.charCodeAt(0).toString(16).toUpperCase();
47
+ });
48
+ }
49
+
50
+ // src/submodules/protocols/requestBuilder.ts
51
+ var import_protocols = require("@smithy/core/protocols");
52
+ var import_protocol_http = require("@smithy/protocol-http");
53
+ function requestBuilder(input, context) {
54
+ return new RequestBuilder(input, context);
55
+ }
56
+ var RequestBuilder = class {
57
+ constructor(input, context) {
58
+ this.input = input;
59
+ this.context = context;
60
+ this.query = {};
61
+ this.method = "";
62
+ this.headers = {};
63
+ this.path = "";
64
+ this.body = null;
65
+ this.hostname = "";
66
+ this.resolvePathStack = [];
67
+ }
68
+ async build() {
69
+ const { hostname, protocol = "https", port, path: basePath } = await this.context.endpoint();
70
+ this.path = basePath;
71
+ for (const resolvePath of this.resolvePathStack) {
72
+ resolvePath(this.path);
73
+ }
74
+ return new import_protocol_http.HttpRequest({
75
+ protocol,
76
+ hostname: this.hostname || hostname,
77
+ port,
78
+ method: this.method,
79
+ path: this.path,
80
+ query: this.query,
81
+ body: this.body,
82
+ headers: this.headers
83
+ });
84
+ }
85
+ /**
86
+ * Brevity setter for "hostname".
87
+ */
88
+ hn(hostname) {
89
+ this.hostname = hostname;
90
+ return this;
91
+ }
92
+ /**
93
+ * Brevity initial builder for "basepath".
94
+ */
95
+ bp(uriLabel) {
96
+ this.resolvePathStack.push((basePath) => {
97
+ this.path = `${(basePath == null ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + uriLabel;
98
+ });
99
+ return this;
100
+ }
101
+ /**
102
+ * Brevity incremental builder for "path".
103
+ */
104
+ p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
105
+ this.resolvePathStack.push((path) => {
106
+ this.path = (0, import_protocols.resolvedPath)(path, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
107
+ });
108
+ return this;
109
+ }
110
+ /**
111
+ * Brevity setter for "headers".
112
+ */
113
+ h(headers) {
114
+ this.headers = headers;
115
+ return this;
116
+ }
117
+ /**
118
+ * Brevity setter for "query".
119
+ */
120
+ q(query) {
121
+ this.query = query;
122
+ return this;
123
+ }
124
+ /**
125
+ * Brevity setter for "body".
126
+ */
127
+ b(body) {
128
+ this.body = body;
129
+ return this;
130
+ }
131
+ /**
132
+ * Brevity setter for "method".
133
+ */
134
+ m(method) {
135
+ this.method = method;
136
+ return this;
137
+ }
138
+ };
139
+
140
+ // src/submodules/protocols/resolve-path.ts
141
+ var resolvedPath2 = (resolvedPath3, input, memberName, labelValueProvider, uriLabel, isGreedyLabel) => {
142
+ if (input != null && input[memberName] !== void 0) {
143
+ const labelValue = labelValueProvider();
144
+ if (labelValue.length <= 0) {
145
+ throw new Error("Empty value provided for input HTTP label: " + memberName + ".");
146
+ }
147
+ resolvedPath3 = resolvedPath3.replace(
148
+ uriLabel,
149
+ isGreedyLabel ? labelValue.split("/").map((segment) => extendedEncodeURIComponent(segment)).join("/") : extendedEncodeURIComponent(labelValue)
150
+ );
151
+ } else {
152
+ throw new Error("No value provided for input HTTP label: " + memberName + ".");
153
+ }
154
+ return resolvedPath3;
155
+ };
156
+ // Annotate the CommonJS export names for ESM import in node:
157
+ 0 && (module.exports = {
158
+ RequestBuilder,
159
+ collectBody,
160
+ extendedEncodeURIComponent,
161
+ requestBuilder,
162
+ resolvedPath
163
+ });
@@ -1,7 +1,8 @@
1
+ export * from "./getSmithyContext";
1
2
  export * from "./middleware-http-auth-scheme";
2
3
  export * from "./middleware-http-signing";
3
- export * from "./util-identity-and-auth";
4
- export * from "./getSmithyContext";
5
4
  export * from "./normalizeProvider";
6
- export * from "./protocols/requestBuilder";
7
5
  export { createPaginator } from "./pagination/createPaginator";
6
+ export * from "./protocols/requestBuilder";
7
+ export * from "./setFeature";
8
+ export * from "./util-identity-and-auth";
@@ -1,4 +1,3 @@
1
- import { endpointMiddlewareOptions } from "@smithy/middleware-endpoint";
2
1
  import { httpAuthSchemeMiddleware } from "./httpAuthSchemeMiddleware";
3
2
  export const httpAuthSchemeEndpointRuleSetMiddlewareOptions = {
4
3
  step: "serialize",
@@ -6,7 +5,7 @@ export const httpAuthSchemeEndpointRuleSetMiddlewareOptions = {
6
5
  name: "httpAuthSchemeMiddleware",
7
6
  override: true,
8
7
  relation: "before",
9
- toMiddleware: endpointMiddlewareOptions.name,
8
+ toMiddleware: "endpointV2Middleware",
10
9
  };
11
10
  export const getHttpAuthSchemeEndpointRuleSetPlugin = (config, { httpAuthSchemeParametersProvider, identityProviderConfigProvider, }) => ({
12
11
  applyToStack: (clientStack) => {
@@ -1,4 +1,3 @@
1
- import { retryMiddlewareOptions } from "@smithy/middleware-retry";
2
1
  import { httpSigningMiddleware } from "./httpSigningMiddleware";
3
2
  export const httpSigningMiddlewareOptions = {
4
3
  step: "finalizeRequest",
@@ -7,7 +6,7 @@ export const httpSigningMiddlewareOptions = {
7
6
  aliases: ["apiKeyMiddleware", "tokenMiddleware", "awsAuthMiddleware"],
8
7
  override: true,
9
8
  relation: "after",
10
- toMiddleware: retryMiddlewareOptions.name,
9
+ toMiddleware: "retryMiddleware",
11
10
  };
12
11
  export const getHttpSigningPlugin = (config) => ({
13
12
  applyToStack: (clientStack) => {
@@ -1,67 +1 @@
1
- import { HttpRequest } from "@smithy/protocol-http";
2
- import { resolvedPath } from "@smithy/smithy-client";
3
- export function requestBuilder(input, context) {
4
- return new RequestBuilder(input, context);
5
- }
6
- export class RequestBuilder {
7
- constructor(input, context) {
8
- this.input = input;
9
- this.context = context;
10
- this.query = {};
11
- this.method = "";
12
- this.headers = {};
13
- this.path = "";
14
- this.body = null;
15
- this.hostname = "";
16
- this.resolvePathStack = [];
17
- }
18
- async build() {
19
- const { hostname, protocol = "https", port, path: basePath } = await this.context.endpoint();
20
- this.path = basePath;
21
- for (const resolvePath of this.resolvePathStack) {
22
- resolvePath(this.path);
23
- }
24
- return new HttpRequest({
25
- protocol,
26
- hostname: this.hostname || hostname,
27
- port,
28
- method: this.method,
29
- path: this.path,
30
- query: this.query,
31
- body: this.body,
32
- headers: this.headers,
33
- });
34
- }
35
- hn(hostname) {
36
- this.hostname = hostname;
37
- return this;
38
- }
39
- bp(uriLabel) {
40
- this.resolvePathStack.push((basePath) => {
41
- this.path = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + uriLabel;
42
- });
43
- return this;
44
- }
45
- p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
46
- this.resolvePathStack.push((path) => {
47
- this.path = resolvedPath(path, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
48
- });
49
- return this;
50
- }
51
- h(headers) {
52
- this.headers = headers;
53
- return this;
54
- }
55
- q(query) {
56
- this.query = query;
57
- return this;
58
- }
59
- b(body) {
60
- this.body = body;
61
- return this;
62
- }
63
- m(method) {
64
- this.method = method;
65
- return this;
66
- }
67
- }
1
+ export { requestBuilder } from "@smithy/core/protocols";
@@ -0,0 +1,11 @@
1
+ export function setFeature(context, feature, value) {
2
+ if (!context.__smithy_context) {
3
+ context.__smithy_context = {
4
+ features: {},
5
+ };
6
+ }
7
+ else if (!context.__smithy_context.features) {
8
+ context.__smithy_context.features = {};
9
+ }
10
+ context.__smithy_context.features[feature] = value;
11
+ }
@@ -1,5 +1,5 @@
1
+ import { collectBody } from "@smithy/core/protocols";
1
2
  import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
2
- import { collectBody } from "@smithy/smithy-client";
3
3
  import { calculateBodyLength } from "@smithy/util-body-length-browser";
4
4
  import { cbor } from "./cbor";
5
5
  export const parseCborBody = (streamBody, context) => {
@@ -0,0 +1,11 @@
1
+ import { Uint8ArrayBlobAdapter } from "@smithy/util-stream";
2
+ export const collectBody = async (streamBody = new Uint8Array(), context) => {
3
+ if (streamBody instanceof Uint8Array) {
4
+ return Uint8ArrayBlobAdapter.mutate(streamBody);
5
+ }
6
+ if (!streamBody) {
7
+ return Uint8ArrayBlobAdapter.mutate(new Uint8Array());
8
+ }
9
+ const fromContext = context.streamCollector(streamBody);
10
+ return Uint8ArrayBlobAdapter.mutate(await fromContext);
11
+ };
@@ -0,0 +1,5 @@
1
+ export function extendedEncodeURIComponent(str) {
2
+ return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
3
+ return "%" + c.charCodeAt(0).toString(16).toUpperCase();
4
+ });
5
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./collect-stream-body";
2
+ export * from "./extended-encode-uri-component";
3
+ export * from "./requestBuilder";
4
+ export * from "./resolve-path";
@@ -0,0 +1,67 @@
1
+ import { resolvedPath } from "@smithy/core/protocols";
2
+ import { HttpRequest } from "@smithy/protocol-http";
3
+ export function requestBuilder(input, context) {
4
+ return new RequestBuilder(input, context);
5
+ }
6
+ export class RequestBuilder {
7
+ constructor(input, context) {
8
+ this.input = input;
9
+ this.context = context;
10
+ this.query = {};
11
+ this.method = "";
12
+ this.headers = {};
13
+ this.path = "";
14
+ this.body = null;
15
+ this.hostname = "";
16
+ this.resolvePathStack = [];
17
+ }
18
+ async build() {
19
+ const { hostname, protocol = "https", port, path: basePath } = await this.context.endpoint();
20
+ this.path = basePath;
21
+ for (const resolvePath of this.resolvePathStack) {
22
+ resolvePath(this.path);
23
+ }
24
+ return new HttpRequest({
25
+ protocol,
26
+ hostname: this.hostname || hostname,
27
+ port,
28
+ method: this.method,
29
+ path: this.path,
30
+ query: this.query,
31
+ body: this.body,
32
+ headers: this.headers,
33
+ });
34
+ }
35
+ hn(hostname) {
36
+ this.hostname = hostname;
37
+ return this;
38
+ }
39
+ bp(uriLabel) {
40
+ this.resolvePathStack.push((basePath) => {
41
+ this.path = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + uriLabel;
42
+ });
43
+ return this;
44
+ }
45
+ p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
46
+ this.resolvePathStack.push((path) => {
47
+ this.path = resolvedPath(path, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
48
+ });
49
+ return this;
50
+ }
51
+ h(headers) {
52
+ this.headers = headers;
53
+ return this;
54
+ }
55
+ q(query) {
56
+ this.query = query;
57
+ return this;
58
+ }
59
+ b(body) {
60
+ this.body = body;
61
+ return this;
62
+ }
63
+ m(method) {
64
+ this.method = method;
65
+ return this;
66
+ }
67
+ }
@@ -0,0 +1,19 @@
1
+ import { extendedEncodeURIComponent } from "./extended-encode-uri-component";
2
+ export const resolvedPath = (resolvedPath, input, memberName, labelValueProvider, uriLabel, isGreedyLabel) => {
3
+ if (input != null && input[memberName] !== undefined) {
4
+ const labelValue = labelValueProvider();
5
+ if (labelValue.length <= 0) {
6
+ throw new Error("Empty value provided for input HTTP label: " + memberName + ".");
7
+ }
8
+ resolvedPath = resolvedPath.replace(uriLabel, isGreedyLabel
9
+ ? labelValue
10
+ .split("/")
11
+ .map((segment) => extendedEncodeURIComponent(segment))
12
+ .join("/")
13
+ : extendedEncodeURIComponent(labelValue));
14
+ }
15
+ else {
16
+ throw new Error("No value provided for input HTTP label: " + memberName + ".");
17
+ }
18
+ return resolvedPath;
19
+ };
@@ -1,7 +1,8 @@
1
+ export * from "./getSmithyContext";
1
2
  export * from "./middleware-http-auth-scheme";
2
3
  export * from "./middleware-http-signing";
3
- export * from "./util-identity-and-auth";
4
- export * from "./getSmithyContext";
5
4
  export * from "./normalizeProvider";
6
- export * from "./protocols/requestBuilder";
7
5
  export { createPaginator } from "./pagination/createPaginator";
6
+ export * from "./protocols/requestBuilder";
7
+ export * from "./setFeature";
8
+ export * from "./util-identity-and-auth";
@@ -1,51 +1,5 @@
1
- import { HttpRequest } from "@smithy/protocol-http";
2
- import type { SerdeContext } from "@smithy/types";
3
1
  /**
4
2
  * @internal
5
- * used in code-generated serde.
3
+ * Backwards compatibility re-export.
6
4
  */
7
- export declare function requestBuilder(input: any, context: SerdeContext): RequestBuilder;
8
- /**
9
- * @internal
10
- */
11
- export declare class RequestBuilder {
12
- private input;
13
- private context;
14
- private query;
15
- private method;
16
- private headers;
17
- private path;
18
- private body;
19
- private hostname;
20
- private resolvePathStack;
21
- constructor(input: any, context: SerdeContext);
22
- build(): Promise<HttpRequest>;
23
- /**
24
- * Brevity setter for "hostname".
25
- */
26
- hn(hostname: string): this;
27
- /**
28
- * Brevity initial builder for "basepath".
29
- */
30
- bp(uriLabel: string): this;
31
- /**
32
- * Brevity incremental builder for "path".
33
- */
34
- p(memberName: string, labelValueProvider: () => string | undefined, uriLabel: string, isGreedyLabel: boolean): this;
35
- /**
36
- * Brevity setter for "headers".
37
- */
38
- h(headers: Record<string, string>): this;
39
- /**
40
- * Brevity setter for "query".
41
- */
42
- q(query: Record<string, string>): this;
43
- /**
44
- * Brevity setter for "body".
45
- */
46
- b(body: any): this;
47
- /**
48
- * Brevity setter for "method".
49
- */
50
- m(method: string): this;
51
- }
5
+ export { requestBuilder } from "@smithy/core/protocols";
@@ -0,0 +1,12 @@
1
+ import type { HandlerExecutionContext, SmithyFeatures } from "@smithy/types";
2
+ /**
3
+ * @internal
4
+ * Indicates to the request context that a given feature is active.
5
+ *
6
+ * @param context - handler execution context.
7
+ * @param feature - readable name of feature.
8
+ * @param value - encoding value of feature. This is required because the
9
+ * specification asks the library not to include a runtime lookup of all
10
+ * the feature identifiers.
11
+ */
12
+ export declare function setFeature<F extends keyof SmithyFeatures>(context: HandlerExecutionContext, feature: F, value: SmithyFeatures[F]): void;
@@ -0,0 +1,10 @@
1
+ import { SerdeContext } from "@smithy/types";
2
+ import { Uint8ArrayBlobAdapter } from "@smithy/util-stream";
3
+ /**
4
+ * @internal
5
+ *
6
+ * Collect low-level response body stream to Uint8Array.
7
+ */
8
+ export declare const collectBody: (streamBody: any, context: {
9
+ streamCollector: SerdeContext["streamCollector"];
10
+ }) => Promise<Uint8ArrayBlobAdapter>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @internal
3
+ *
4
+ * Function that wraps encodeURIComponent to encode additional characters
5
+ * to fully adhere to RFC 3986.
6
+ */
7
+ export declare function extendedEncodeURIComponent(str: string): string;
@@ -0,0 +1,4 @@
1
+ export * from "./collect-stream-body";
2
+ export * from "./extended-encode-uri-component";
3
+ export * from "./requestBuilder";
4
+ export * from "./resolve-path";
@@ -0,0 +1,51 @@
1
+ import { HttpRequest } from "@smithy/protocol-http";
2
+ import type { SerdeContext } from "@smithy/types";
3
+ /**
4
+ * @internal
5
+ * used in code-generated serde.
6
+ */
7
+ export declare function requestBuilder(input: any, context: SerdeContext): RequestBuilder;
8
+ /**
9
+ * @internal
10
+ */
11
+ export declare class RequestBuilder {
12
+ private input;
13
+ private context;
14
+ private query;
15
+ private method;
16
+ private headers;
17
+ private path;
18
+ private body;
19
+ private hostname;
20
+ private resolvePathStack;
21
+ constructor(input: any, context: SerdeContext);
22
+ build(): Promise<HttpRequest>;
23
+ /**
24
+ * Brevity setter for "hostname".
25
+ */
26
+ hn(hostname: string): this;
27
+ /**
28
+ * Brevity initial builder for "basepath".
29
+ */
30
+ bp(uriLabel: string): this;
31
+ /**
32
+ * Brevity incremental builder for "path".
33
+ */
34
+ p(memberName: string, labelValueProvider: () => string | undefined, uriLabel: string, isGreedyLabel: boolean): this;
35
+ /**
36
+ * Brevity setter for "headers".
37
+ */
38
+ h(headers: Record<string, string>): this;
39
+ /**
40
+ * Brevity setter for "query".
41
+ */
42
+ q(query: Record<string, string>): this;
43
+ /**
44
+ * Brevity setter for "body".
45
+ */
46
+ b(body: any): this;
47
+ /**
48
+ * Brevity setter for "method".
49
+ */
50
+ m(method: string): this;
51
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare const resolvedPath: (resolvedPath: string, input: unknown, memberName: string, labelValueProvider: () => string | undefined, uriLabel: string, isGreedyLabel: boolean) => string;
@@ -1,7 +1,8 @@
1
+ export * from "./getSmithyContext";
1
2
  export * from "./middleware-http-auth-scheme";
2
3
  export * from "./middleware-http-signing";
3
- export * from "./util-identity-and-auth";
4
- export * from "./getSmithyContext";
5
4
  export * from "./normalizeProvider";
6
- export * from "./protocols/requestBuilder";
7
5
  export { createPaginator } from "./pagination/createPaginator";
6
+ export * from "./protocols/requestBuilder";
7
+ export * from "./setFeature";
8
+ export * from "./util-identity-and-auth";
@@ -1,51 +1,5 @@
1
- import { HttpRequest } from "@smithy/protocol-http";
2
- import { SerdeContext } from "@smithy/types";
3
1
  /**
4
2
  * @internal
5
- * used in code-generated serde.
3
+ * Backwards compatibility re-export.
6
4
  */
7
- export declare function requestBuilder(input: any, context: SerdeContext): RequestBuilder;
8
- /**
9
- * @internal
10
- */
11
- export declare class RequestBuilder {
12
- private input;
13
- private context;
14
- private query;
15
- private method;
16
- private headers;
17
- private path;
18
- private body;
19
- private hostname;
20
- private resolvePathStack;
21
- constructor(input: any, context: SerdeContext);
22
- build(): Promise<HttpRequest>;
23
- /**
24
- * Brevity setter for "hostname".
25
- */
26
- hn(hostname: string): this;
27
- /**
28
- * Brevity initial builder for "basepath".
29
- */
30
- bp(uriLabel: string): this;
31
- /**
32
- * Brevity incremental builder for "path".
33
- */
34
- p(memberName: string, labelValueProvider: () => string | undefined, uriLabel: string, isGreedyLabel: boolean): this;
35
- /**
36
- * Brevity setter for "headers".
37
- */
38
- h(headers: Record<string, string>): this;
39
- /**
40
- * Brevity setter for "query".
41
- */
42
- q(query: Record<string, string>): this;
43
- /**
44
- * Brevity setter for "body".
45
- */
46
- b(body: any): this;
47
- /**
48
- * Brevity setter for "method".
49
- */
50
- m(method: string): this;
51
- }
5
+ export { requestBuilder } from "@smithy/core/protocols";
@@ -0,0 +1,12 @@
1
+ import { HandlerExecutionContext, SmithyFeatures } from "@smithy/types";
2
+ /**
3
+ * @internal
4
+ * Indicates to the request context that a given feature is active.
5
+ *
6
+ * @param context - handler execution context.
7
+ * @param feature - readable name of feature.
8
+ * @param value - encoding value of feature. This is required because the
9
+ * specification asks the library not to include a runtime lookup of all
10
+ * the feature identifiers.
11
+ */
12
+ export declare function setFeature<F extends keyof SmithyFeatures>(context: HandlerExecutionContext, feature: F, value: SmithyFeatures[F]): void;
@@ -0,0 +1,10 @@
1
+ import { SerdeContext } from "@smithy/types";
2
+ import { Uint8ArrayBlobAdapter } from "@smithy/util-stream";
3
+ /**
4
+ * @internal
5
+ *
6
+ * Collect low-level response body stream to Uint8Array.
7
+ */
8
+ export declare const collectBody: (streamBody: any, context: {
9
+ streamCollector: SerdeContext["streamCollector"];
10
+ }) => Promise<Uint8ArrayBlobAdapter>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @internal
3
+ *
4
+ * Function that wraps encodeURIComponent to encode additional characters
5
+ * to fully adhere to RFC 3986.
6
+ */
7
+ export declare function extendedEncodeURIComponent(str: string): string;