@smithy/core 3.5.0 → 3.5.2

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.
@@ -136,7 +136,7 @@ var HttpProtocol = class {
136
136
  cfId: output.headers["x-amz-cf-id"]
137
137
  };
138
138
  }
139
- async deserializeHttpMessage(schema, context, response, headerBindings, dataObject) {
139
+ async deserializeHttpMessage(schema, context, response, dataObject) {
140
140
  const deserializer = this.deserializer;
141
141
  const ns = import_schema.NormalizedSchema.of(schema);
142
142
  const nonHttpBindingMembers = [];
@@ -200,7 +200,7 @@ var HttpProtocol = class {
200
200
  } else if (memberTraits.httpPrefixHeaders !== void 0) {
201
201
  dataObject[memberName] = {};
202
202
  for (const [header, value] of Object.entries(response.headers)) {
203
- if (!headerBindings.has(header) && header.startsWith(memberTraits.httpPrefixHeaders)) {
203
+ if (header.startsWith(memberTraits.httpPrefixHeaders)) {
204
204
  dataObject[memberName][header.slice(memberTraits.httpPrefixHeaders.length)] = await deserializer.read(
205
205
  [memberSchema.getValueSchema(), { httpHeader: header }],
206
206
  value
@@ -373,12 +373,7 @@ var HttpBindingProtocol = class extends HttpProtocol {
373
373
  delete response.headers[header];
374
374
  response.headers[header.toLowerCase()] = value;
375
375
  }
376
- const headerBindings = new Set(
377
- Object.values(ns.getMemberSchemas()).map((schema) => {
378
- return schema.getMergedTraits().httpHeader;
379
- }).filter(Boolean)
380
- );
381
- const nonHttpBindingMembers = await this.deserializeHttpMessage(ns, context, response, headerBindings, dataObject);
376
+ const nonHttpBindingMembers = await this.deserializeHttpMessage(ns, context, response, dataObject);
382
377
  if (nonHttpBindingMembers.length) {
383
378
  const bytes = await collectBody(response.body, context);
384
379
  if (bytes.byteLength > 0) {
@@ -207,7 +207,7 @@ var TypeRegistry = class _TypeRegistry {
207
207
  */
208
208
  getBaseException() {
209
209
  for (const [id, schema] of this.schemas.entries()) {
210
- if (id.startsWith("smithyts.client.synthetic.") && id.endsWith("ServiceException")) {
210
+ if (id.startsWith("smithy.ts.sdk.synthetic.") && id.endsWith("ServiceException")) {
211
211
  return schema;
212
212
  }
213
213
  }
@@ -715,6 +715,9 @@ var NormalizedSchema = class _NormalizedSchema {
715
715
  * This avoids the overhead of calling Object.entries(ns.getMemberSchemas()).
716
716
  */
717
717
  *structIterator() {
718
+ if (this.isUnitSchema()) {
719
+ return;
720
+ }
718
721
  if (!this.isStructSchema()) {
719
722
  throw new Error("@smithy/core/schema - cannot acquire structIterator on non-struct schema.");
720
723
  }
@@ -159,12 +159,7 @@ export class HttpBindingProtocol extends HttpProtocol {
159
159
  delete response.headers[header];
160
160
  response.headers[header.toLowerCase()] = value;
161
161
  }
162
- const headerBindings = new Set(Object.values(ns.getMemberSchemas())
163
- .map((schema) => {
164
- return schema.getMergedTraits().httpHeader;
165
- })
166
- .filter(Boolean));
167
- const nonHttpBindingMembers = await this.deserializeHttpMessage(ns, context, response, headerBindings, dataObject);
162
+ const nonHttpBindingMembers = await this.deserializeHttpMessage(ns, context, response, dataObject);
168
163
  if (nonHttpBindingMembers.length) {
169
164
  const bytes = await collectBody(response.body, context);
170
165
  if (bytes.byteLength > 0) {
@@ -75,7 +75,7 @@ export class HttpProtocol {
75
75
  cfId: output.headers["x-amz-cf-id"],
76
76
  };
77
77
  }
78
- async deserializeHttpMessage(schema, context, response, headerBindings, dataObject) {
78
+ async deserializeHttpMessage(schema, context, response, dataObject) {
79
79
  const deserializer = this.deserializer;
80
80
  const ns = NormalizedSchema.of(schema);
81
81
  const nonHttpBindingMembers = [];
@@ -147,7 +147,7 @@ export class HttpProtocol {
147
147
  else if (memberTraits.httpPrefixHeaders !== undefined) {
148
148
  dataObject[memberName] = {};
149
149
  for (const [header, value] of Object.entries(response.headers)) {
150
- if (!headerBindings.has(header) && header.startsWith(memberTraits.httpPrefixHeaders)) {
150
+ if (header.startsWith(memberTraits.httpPrefixHeaders)) {
151
151
  dataObject[memberName][header.slice(memberTraits.httpPrefixHeaders.length)] = await deserializer.read([memberSchema.getValueSchema(), { httpHeader: header }], value);
152
152
  }
153
153
  }
@@ -23,7 +23,7 @@ export class TypeRegistry {
23
23
  }
24
24
  getBaseException() {
25
25
  for (const [id, schema] of this.schemas.entries()) {
26
- if (id.startsWith("smithyts.client.synthetic.") && id.endsWith("ServiceException")) {
26
+ if (id.startsWith("smithy.ts.sdk.synthetic.") && id.endsWith("ServiceException")) {
27
27
  return schema;
28
28
  }
29
29
  }
@@ -261,6 +261,9 @@ export class NormalizedSchema {
261
261
  return {};
262
262
  }
263
263
  *structIterator() {
264
+ if (this.isUnitSchema()) {
265
+ return;
266
+ }
264
267
  if (!this.isStructSchema()) {
265
268
  throw new Error("@smithy/core/schema - cannot acquire structIterator on non-struct schema.");
266
269
  }
@@ -25,5 +25,5 @@ export declare abstract class HttpProtocol implements ClientProtocol<IHttpReques
25
25
  protected setHostPrefix<Input extends object>(request: IHttpRequest, operationSchema: OperationSchema, input: Input): void;
26
26
  protected abstract handleError(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, dataObject: any, metadata: ResponseMetadata): Promise<never>;
27
27
  protected deserializeMetadata(output: IHttpResponse): ResponseMetadata;
28
- protected deserializeHttpMessage(schema: Schema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, headerBindings: Set<string>, dataObject: any): Promise<string[]>;
28
+ protected deserializeHttpMessage(schema: Schema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, dataObject: any): Promise<string[]>;
29
29
  }
@@ -25,5 +25,5 @@ export declare abstract class HttpProtocol implements ClientProtocol<IHttpReques
25
25
  protected setHostPrefix<Input extends object>(request: IHttpRequest, operationSchema: OperationSchema, input: Input): void;
26
26
  protected abstract handleError(operationSchema: OperationSchema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, dataObject: any, metadata: ResponseMetadata): Promise<never>;
27
27
  protected deserializeMetadata(output: IHttpResponse): ResponseMetadata;
28
- protected deserializeHttpMessage(schema: Schema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, headerBindings: Set<string>, dataObject: any): Promise<string[]>;
28
+ protected deserializeHttpMessage(schema: Schema, context: HandlerExecutionContext & SerdeFunctions, response: IHttpResponse, dataObject: any): Promise<string[]>;
29
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/core",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "scripts": {
5
5
  "build": "yarn lint && concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types && yarn build:types:downlevel'",
6
6
  "build:cjs": "node ../../scripts/inline core",
@@ -69,13 +69,13 @@
69
69
  },
70
70
  "license": "Apache-2.0",
71
71
  "dependencies": {
72
- "@smithy/middleware-serde": "^4.0.7",
73
- "@smithy/protocol-http": "^5.1.1",
74
- "@smithy/types": "^4.3.0",
72
+ "@smithy/middleware-serde": "^4.0.8",
73
+ "@smithy/protocol-http": "^5.1.2",
74
+ "@smithy/types": "^4.3.1",
75
75
  "@smithy/util-base64": "^4.0.0",
76
76
  "@smithy/util-body-length-browser": "^4.0.0",
77
- "@smithy/util-middleware": "^4.0.3",
78
- "@smithy/util-stream": "^4.2.1",
77
+ "@smithy/util-middleware": "^4.0.4",
78
+ "@smithy/util-stream": "^4.2.2",
79
79
  "@smithy/util-utf8": "^4.0.0",
80
80
  "tslib": "^2.6.2"
81
81
  },