@smithy/core 3.9.2 → 3.11.0

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 (59) hide show
  1. package/dist-cjs/index.js +10 -11
  2. package/dist-cjs/submodules/cbor/index.js +3 -3
  3. package/dist-cjs/submodules/event-streams/index.js +3 -3
  4. package/dist-cjs/submodules/protocols/index.js +22 -19
  5. package/dist-cjs/submodules/schema/index.js +158 -224
  6. package/dist-cjs/submodules/serde/index.js +3 -3
  7. package/dist-es/middleware-http-auth-scheme/httpAuthSchemeMiddleware.js +0 -1
  8. package/dist-es/middleware-http-signing/httpSigningMiddleware.js +0 -1
  9. package/dist-es/submodules/cbor/parseCborBody.js +1 -1
  10. package/dist-es/submodules/protocols/HttpBindingProtocol.js +12 -10
  11. package/dist-es/submodules/schema/schemas/ErrorSchema.js +12 -22
  12. package/dist-es/submodules/schema/schemas/ListSchema.js +9 -20
  13. package/dist-es/submodules/schema/schemas/MapSchema.js +10 -21
  14. package/dist-es/submodules/schema/schemas/NormalizedSchema.js +76 -87
  15. package/dist-es/submodules/schema/schemas/OperationSchema.js +11 -12
  16. package/dist-es/submodules/schema/schemas/Schema.js +16 -3
  17. package/dist-es/submodules/schema/schemas/SimpleSchema.js +9 -20
  18. package/dist-es/submodules/schema/schemas/StructureSchema.js +10 -27
  19. package/dist-types/getSmithyContext.d.ts +1 -1
  20. package/dist-types/middleware-http-auth-scheme/getHttpAuthSchemeEndpointRuleSetPlugin.d.ts +2 -2
  21. package/dist-types/middleware-http-auth-scheme/getHttpAuthSchemePlugin.d.ts +2 -2
  22. package/dist-types/middleware-http-auth-scheme/httpAuthSchemeMiddleware.d.ts +1 -1
  23. package/dist-types/middleware-http-auth-scheme/resolveAuthOptions.d.ts +1 -1
  24. package/dist-types/middleware-http-signing/getHttpSigningMiddleware.d.ts +1 -1
  25. package/dist-types/middleware-http-signing/httpSigningMiddleware.d.ts +1 -1
  26. package/dist-types/normalizeProvider.d.ts +1 -1
  27. package/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +1 -2
  28. package/dist-types/submodules/cbor/cbor-decode.d.ts +1 -1
  29. package/dist-types/submodules/cbor/parseCborBody.d.ts +1 -1
  30. package/dist-types/submodules/event-streams/EventStreamSerde.d.ts +1 -1
  31. package/dist-types/submodules/protocols/collect-stream-body.d.ts +1 -1
  32. package/dist-types/submodules/protocols/serde/determineTimestampFormat.d.ts +1 -1
  33. package/dist-types/submodules/schema/TypeRegistry.d.ts +1 -1
  34. package/dist-types/submodules/schema/middleware/getSchemaSerdePlugin.d.ts +1 -1
  35. package/dist-types/submodules/schema/middleware/schemaDeserializationMiddleware.d.ts +1 -1
  36. package/dist-types/submodules/schema/middleware/schemaSerializationMiddleware.d.ts +2 -2
  37. package/dist-types/submodules/schema/schemas/ErrorSchema.d.ts +3 -16
  38. package/dist-types/submodules/schema/schemas/ListSchema.d.ts +3 -5
  39. package/dist-types/submodules/schema/schemas/MapSchema.d.ts +3 -9
  40. package/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +15 -13
  41. package/dist-types/submodules/schema/schemas/OperationSchema.d.ts +3 -2
  42. package/dist-types/submodules/schema/schemas/Schema.d.ts +5 -1
  43. package/dist-types/submodules/schema/schemas/SimpleSchema.d.ts +3 -5
  44. package/dist-types/submodules/schema/schemas/StructureSchema.d.ts +3 -6
  45. package/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +1 -2
  46. package/dist-types/ts3.4/submodules/schema/schemas/ErrorSchema.d.ts +3 -16
  47. package/dist-types/ts3.4/submodules/schema/schemas/ListSchema.d.ts +3 -5
  48. package/dist-types/ts3.4/submodules/schema/schemas/MapSchema.d.ts +3 -9
  49. package/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +15 -13
  50. package/dist-types/ts3.4/submodules/schema/schemas/OperationSchema.d.ts +3 -2
  51. package/dist-types/ts3.4/submodules/schema/schemas/Schema.d.ts +5 -1
  52. package/dist-types/ts3.4/submodules/schema/schemas/SimpleSchema.d.ts +3 -5
  53. package/dist-types/ts3.4/submodules/schema/schemas/StructureSchema.d.ts +3 -9
  54. package/dist-types/util-identity-and-auth/DefaultIdentityProviderConfig.d.ts +1 -1
  55. package/dist-types/util-identity-and-auth/httpAuthSchemes/httpApiKeyAuth.d.ts +1 -1
  56. package/dist-types/util-identity-and-auth/httpAuthSchemes/httpBearerAuth.d.ts +1 -1
  57. package/dist-types/util-identity-and-auth/httpAuthSchemes/noAuth.d.ts +1 -1
  58. package/dist-types/util-identity-and-auth/memoizeIdentityProvider.d.ts +1 -1
  59. package/package.json +10 -10
package/dist-cjs/index.js CHANGED
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
20
  // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
23
  DefaultIdentityProviderConfig: () => DefaultIdentityProviderConfig,
24
24
  EXPIRATION_MS: () => EXPIRATION_MS,
25
25
  HttpApiKeyAuthSigner: () => HttpApiKeyAuthSigner,
@@ -43,7 +43,7 @@ __export(src_exports, {
43
43
  requestBuilder: () => import_protocols.requestBuilder,
44
44
  setFeature: () => setFeature
45
45
  });
46
- module.exports = __toCommonJS(src_exports);
46
+ module.exports = __toCommonJS(index_exports);
47
47
 
48
48
  // src/getSmithyContext.ts
49
49
  var import_types = require("@smithy/types");
@@ -132,7 +132,7 @@ var getHttpAuthSchemeEndpointRuleSetPlugin = /* @__PURE__ */ __name((config, {
132
132
  httpAuthSchemeParametersProvider,
133
133
  identityProviderConfigProvider
134
134
  }) => ({
135
- applyToStack: (clientStack) => {
135
+ applyToStack: /* @__PURE__ */ __name((clientStack) => {
136
136
  clientStack.addRelativeTo(
137
137
  httpAuthSchemeMiddleware(config, {
138
138
  httpAuthSchemeParametersProvider,
@@ -140,7 +140,7 @@ var getHttpAuthSchemeEndpointRuleSetPlugin = /* @__PURE__ */ __name((config, {
140
140
  }),
141
141
  httpAuthSchemeEndpointRuleSetMiddlewareOptions
142
142
  );
143
- }
143
+ }, "applyToStack")
144
144
  }), "getHttpAuthSchemeEndpointRuleSetPlugin");
145
145
 
146
146
  // src/middleware-http-auth-scheme/getHttpAuthSchemePlugin.ts
@@ -157,7 +157,7 @@ var getHttpAuthSchemePlugin = /* @__PURE__ */ __name((config, {
157
157
  httpAuthSchemeParametersProvider,
158
158
  identityProviderConfigProvider
159
159
  }) => ({
160
- applyToStack: (clientStack) => {
160
+ applyToStack: /* @__PURE__ */ __name((clientStack) => {
161
161
  clientStack.addRelativeTo(
162
162
  httpAuthSchemeMiddleware(config, {
163
163
  httpAuthSchemeParametersProvider,
@@ -165,7 +165,7 @@ var getHttpAuthSchemePlugin = /* @__PURE__ */ __name((config, {
165
165
  }),
166
166
  httpAuthSchemeMiddlewareOptions
167
167
  );
168
- }
168
+ }, "applyToStack")
169
169
  }), "getHttpAuthSchemePlugin");
170
170
 
171
171
  // src/middleware-http-signing/httpSigningMiddleware.ts
@@ -209,15 +209,14 @@ var httpSigningMiddlewareOptions = {
209
209
  toMiddleware: "retryMiddleware"
210
210
  };
211
211
  var getHttpSigningPlugin = /* @__PURE__ */ __name((config) => ({
212
- applyToStack: (clientStack) => {
212
+ applyToStack: /* @__PURE__ */ __name((clientStack) => {
213
213
  clientStack.addRelativeTo(httpSigningMiddleware(config), httpSigningMiddlewareOptions);
214
- }
214
+ }, "applyToStack")
215
215
  }), "getHttpSigningPlugin");
216
216
 
217
217
  // src/normalizeProvider.ts
218
218
  var normalizeProvider = /* @__PURE__ */ __name((input) => {
219
- if (typeof input === "function")
220
- return input;
219
+ if (typeof input === "function") return input;
221
220
  const promisified = Promise.resolve(input);
222
221
  return () => promisified;
223
222
  }, "normalizeProvider");
@@ -17,8 +17,8 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
 
19
19
  // src/submodules/cbor/index.ts
20
- var cbor_exports = {};
21
- __export(cbor_exports, {
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
22
  CborCodec: () => CborCodec,
23
23
  CborShapeDeserializer: () => CborShapeDeserializer,
24
24
  CborShapeSerializer: () => CborShapeSerializer,
@@ -33,7 +33,7 @@ __export(cbor_exports, {
33
33
  tag: () => tag,
34
34
  tagSymbol: () => tagSymbol
35
35
  });
36
- module.exports = __toCommonJS(cbor_exports);
36
+ module.exports = __toCommonJS(index_exports);
37
37
 
38
38
  // src/submodules/cbor/cbor-decode.ts
39
39
  var import_serde = require("@smithy/core/serde");
@@ -17,11 +17,11 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
 
19
19
  // src/submodules/event-streams/index.ts
20
- var event_streams_exports = {};
21
- __export(event_streams_exports, {
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
22
  EventStreamSerde: () => EventStreamSerde
23
23
  });
24
- module.exports = __toCommonJS(event_streams_exports);
24
+ module.exports = __toCommonJS(index_exports);
25
25
 
26
26
  // src/submodules/event-streams/EventStreamSerde.ts
27
27
  var import_schema = require("@smithy/core/schema");
@@ -27,8 +27,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
28
 
29
29
  // src/submodules/protocols/index.ts
30
- var protocols_exports = {};
31
- __export(protocols_exports, {
30
+ var index_exports = {};
31
+ __export(index_exports, {
32
32
  FromStringShapeDeserializer: () => FromStringShapeDeserializer,
33
33
  HttpBindingProtocol: () => HttpBindingProtocol,
34
34
  HttpInterceptingShapeDeserializer: () => HttpInterceptingShapeDeserializer,
@@ -43,7 +43,7 @@ __export(protocols_exports, {
43
43
  requestBuilder: () => requestBuilder,
44
44
  resolvedPath: () => resolvedPath
45
45
  });
46
- module.exports = __toCommonJS(protocols_exports);
46
+ module.exports = __toCommonJS(index_exports);
47
47
 
48
48
  // src/submodules/protocols/collect-stream-body.ts
49
49
  var import_util_stream = require("@smithy/util-stream");
@@ -207,6 +207,11 @@ var HttpProtocol = class {
207
207
  );
208
208
  }
209
209
  async deserializeHttpMessage(schema, context, response, arg4, arg5) {
210
+ void schema;
211
+ void context;
212
+ void response;
213
+ void arg4;
214
+ void arg5;
210
215
  return [];
211
216
  }
212
217
  getEventStreamMarshaller() {
@@ -328,20 +333,15 @@ var HttpBindingProtocol = class extends HttpProtocol {
328
333
  if (traits.httpQueryParams) {
329
334
  for (const [key, val] of Object.entries(data)) {
330
335
  if (!(key in query)) {
331
- this.serializeQuery(
332
- import_schema2.NormalizedSchema.of([
333
- ns.getValueSchema(),
334
- {
335
- // We pass on the traits to the sub-schema
336
- // because we are still in the process of serializing the map itself.
337
- ...traits,
338
- httpQuery: key,
339
- httpQueryParams: void 0
340
- }
341
- ]),
342
- val,
343
- query
344
- );
336
+ const valueSchema = ns.getValueSchema();
337
+ Object.assign(valueSchema.getMergedTraits(), {
338
+ // We pass on the traits to the sub-schema
339
+ // because we are still in the process of serializing the map itself.
340
+ ...traits,
341
+ httpQuery: key,
342
+ httpQueryParams: void 0
343
+ });
344
+ this.serializeQuery(valueSchema, val, query);
345
345
  }
346
346
  }
347
347
  return;
@@ -428,6 +428,7 @@ var HttpBindingProtocol = class extends HttpProtocol {
428
428
  if (null != value) {
429
429
  if (memberSchema.isListSchema()) {
430
430
  const headerListValueSchema = memberSchema.getValueSchema();
431
+ headerListValueSchema.getMergedTraits().httpHeader = key;
431
432
  let sections;
432
433
  if (headerListValueSchema.isTimestampSchema() && headerListValueSchema.getSchema() === import_schema2.SCHEMA.TIMESTAMP_DEFAULT) {
433
434
  sections = (0, import_serde.splitEvery)(value, ",", 2);
@@ -436,7 +437,7 @@ var HttpBindingProtocol = class extends HttpProtocol {
436
437
  }
437
438
  const list = [];
438
439
  for (const section of sections) {
439
- list.push(await deserializer.read([headerListValueSchema, { httpHeader: key }], section.trim()));
440
+ list.push(await deserializer.read(headerListValueSchema, section.trim()));
440
441
  }
441
442
  dataObject[memberName] = list;
442
443
  } else {
@@ -447,8 +448,10 @@ var HttpBindingProtocol = class extends HttpProtocol {
447
448
  dataObject[memberName] = {};
448
449
  for (const [header, value] of Object.entries(response.headers)) {
449
450
  if (header.startsWith(memberTraits.httpPrefixHeaders)) {
451
+ const valueSchema = memberSchema.getValueSchema();
452
+ valueSchema.getMergedTraits().httpHeader = header;
450
453
  dataObject[memberName][header.slice(memberTraits.httpPrefixHeaders.length)] = await deserializer.read(
451
- [memberSchema.getValueSchema(), { httpHeader: header }],
454
+ valueSchema,
452
455
  value
453
456
  );
454
457
  }