@smithy/core 3.16.1 → 3.17.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 (32) hide show
  1. package/dist-cjs/submodules/event-streams/index.js +1 -2
  2. package/dist-cjs/submodules/protocols/index.js +3 -3
  3. package/dist-cjs/submodules/schema/index.js +171 -169
  4. package/dist-es/submodules/event-streams/EventStreamSerde.js +1 -2
  5. package/dist-es/submodules/protocols/HttpProtocol.js +4 -4
  6. package/dist-es/submodules/schema/TypeRegistry.js +1 -1
  7. package/dist-es/submodules/schema/index.js +1 -0
  8. package/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js +4 -6
  9. package/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js +4 -6
  10. package/dist-es/submodules/schema/schemas/NormalizedSchema.js +26 -35
  11. package/dist-es/submodules/schema/schemas/operation.js +7 -0
  12. package/dist-types/submodules/schema/index.d.ts +1 -0
  13. package/dist-types/submodules/schema/schemas/ErrorSchema.d.ts +2 -0
  14. package/dist-types/submodules/schema/schemas/ListSchema.d.ts +2 -0
  15. package/dist-types/submodules/schema/schemas/MapSchema.d.ts +2 -0
  16. package/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +4 -21
  17. package/dist-types/submodules/schema/schemas/OperationSchema.d.ts +2 -0
  18. package/dist-types/submodules/schema/schemas/Schema.d.ts +1 -0
  19. package/dist-types/submodules/schema/schemas/SimpleSchema.d.ts +2 -0
  20. package/dist-types/submodules/schema/schemas/StructureSchema.d.ts +2 -0
  21. package/dist-types/submodules/schema/schemas/operation.d.ts +7 -0
  22. package/dist-types/ts3.4/submodules/schema/index.d.ts +1 -0
  23. package/dist-types/ts3.4/submodules/schema/schemas/ErrorSchema.d.ts +2 -0
  24. package/dist-types/ts3.4/submodules/schema/schemas/ListSchema.d.ts +2 -0
  25. package/dist-types/ts3.4/submodules/schema/schemas/MapSchema.d.ts +2 -0
  26. package/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +4 -21
  27. package/dist-types/ts3.4/submodules/schema/schemas/OperationSchema.d.ts +2 -0
  28. package/dist-types/ts3.4/submodules/schema/schemas/Schema.d.ts +1 -0
  29. package/dist-types/ts3.4/submodules/schema/schemas/SimpleSchema.d.ts +2 -0
  30. package/dist-types/ts3.4/submodules/schema/schemas/StructureSchema.d.ts +2 -0
  31. package/dist-types/ts3.4/submodules/schema/schemas/operation.d.ts +7 -0
  32. package/package.json +7 -7
@@ -19,7 +19,6 @@ class EventStreamSerde {
19
19
  const marshaller = this.marshaller;
20
20
  const eventStreamMember = requestSchema.getEventStreamMember();
21
21
  const unionSchema = requestSchema.getMemberSchema(eventStreamMember);
22
- unionSchema.getMemberSchemas();
23
22
  const serializer = this.serializer;
24
23
  const defaultContentType = this.defaultContentType;
25
24
  const initialRequestMarker = Symbol("initialRequestMarker");
@@ -132,7 +131,7 @@ class EventStreamSerde {
132
131
  let explicitPayloadContentType;
133
132
  const isKnownSchema = (() => {
134
133
  const struct = unionSchema.getSchema();
135
- return struct.memberNames.includes(unionMember);
134
+ return struct[4].includes(unionMember);
136
135
  })();
137
136
  const additionalHeaders = {};
138
137
  if (!isKnownSchema) {
@@ -80,10 +80,10 @@ class HttpProtocol extends SerdeContext {
80
80
  }
81
81
  }
82
82
  setHostPrefix(request, operationSchema, input) {
83
- const operationNs = schema.NormalizedSchema.of(operationSchema);
84
83
  const inputNs = schema.NormalizedSchema.of(operationSchema.input);
85
- if (operationNs.getMergedTraits().endpoint) {
86
- let hostPrefix = operationNs.getMergedTraits().endpoint?.[0];
84
+ const opTraits = schema.translateTraits(operationSchema.traits ?? {});
85
+ if (opTraits.endpoint) {
86
+ let hostPrefix = opTraits.endpoint?.[0];
87
87
  if (typeof hostPrefix === "string") {
88
88
  const hostLabelInputs = [...inputNs.structIterator()].filter(([, member]) => member.getMergedTraits().hostLabel);
89
89
  for (const [name] of hostLabelInputs) {
@@ -10,6 +10,113 @@ const deref = (schemaRef) => {
10
10
  return schemaRef;
11
11
  };
12
12
 
13
+ const operation = (namespace, name, traits, input, output) => ({
14
+ name,
15
+ namespace,
16
+ traits,
17
+ input,
18
+ output,
19
+ });
20
+
21
+ const schemaDeserializationMiddleware = (config) => (next, context) => async (args) => {
22
+ const { response } = await next(args);
23
+ const { operationSchema } = utilMiddleware.getSmithyContext(context);
24
+ const [, ns, n, t, i, o] = operationSchema ?? [];
25
+ try {
26
+ const parsed = await config.protocol.deserializeResponse(operation(ns, n, t, i, o), {
27
+ ...config,
28
+ ...context,
29
+ }, response);
30
+ return {
31
+ response,
32
+ output: parsed,
33
+ };
34
+ }
35
+ catch (error) {
36
+ Object.defineProperty(error, "$response", {
37
+ value: response,
38
+ });
39
+ if (!("$metadata" in error)) {
40
+ const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
41
+ try {
42
+ error.message += "\n " + hint;
43
+ }
44
+ catch (e) {
45
+ if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
46
+ console.warn(hint);
47
+ }
48
+ else {
49
+ context.logger?.warn?.(hint);
50
+ }
51
+ }
52
+ if (typeof error.$responseBodyText !== "undefined") {
53
+ if (error.$response) {
54
+ error.$response.body = error.$responseBodyText;
55
+ }
56
+ }
57
+ try {
58
+ if (protocolHttp.HttpResponse.isInstance(response)) {
59
+ const { headers = {} } = response;
60
+ const headerEntries = Object.entries(headers);
61
+ error.$metadata = {
62
+ httpStatusCode: response.statusCode,
63
+ requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
64
+ extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
65
+ cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries),
66
+ };
67
+ }
68
+ }
69
+ catch (e) {
70
+ }
71
+ }
72
+ throw error;
73
+ }
74
+ };
75
+ const findHeader = (pattern, headers) => {
76
+ return (headers.find(([k]) => {
77
+ return k.match(pattern);
78
+ }) || [void 0, void 0])[1];
79
+ };
80
+
81
+ const schemaSerializationMiddleware = (config) => (next, context) => async (args) => {
82
+ const { operationSchema } = utilMiddleware.getSmithyContext(context);
83
+ const [, ns, n, t, i, o] = operationSchema ?? [];
84
+ const endpoint = context.endpointV2?.url && config.urlParser
85
+ ? async () => config.urlParser(context.endpointV2.url)
86
+ : config.endpoint;
87
+ const request = await config.protocol.serializeRequest(operation(ns, n, t, i, o), args.input, {
88
+ ...config,
89
+ ...context,
90
+ endpoint,
91
+ });
92
+ return next({
93
+ ...args,
94
+ request,
95
+ });
96
+ };
97
+
98
+ const deserializerMiddlewareOption = {
99
+ name: "deserializerMiddleware",
100
+ step: "deserialize",
101
+ tags: ["DESERIALIZER"],
102
+ override: true,
103
+ };
104
+ const serializerMiddlewareOption = {
105
+ name: "serializerMiddleware",
106
+ step: "serialize",
107
+ tags: ["SERIALIZER"],
108
+ override: true,
109
+ };
110
+ function getSchemaSerdePlugin(config) {
111
+ return {
112
+ applyToStack: (commandStack) => {
113
+ commandStack.add(schemaSerializationMiddleware(config), serializerMiddlewareOption);
114
+ commandStack.add(schemaDeserializationMiddleware(config), deserializerMiddlewareOption);
115
+ config.protocol.setSerdeContext(config);
116
+ },
117
+ };
118
+ }
119
+
13
120
  class Schema {
14
121
  name;
15
122
  namespace;
@@ -31,36 +138,6 @@ class Schema {
31
138
  }
32
139
  }
33
140
 
34
- class StructureSchema extends Schema {
35
- static symbol = Symbol.for("@smithy/str");
36
- name;
37
- traits;
38
- memberNames;
39
- memberList;
40
- symbol = StructureSchema.symbol;
41
- }
42
- const struct = (namespace, name, traits, memberNames, memberList) => Schema.assign(new StructureSchema(), {
43
- name,
44
- namespace,
45
- traits,
46
- memberNames,
47
- memberList,
48
- });
49
-
50
- class ErrorSchema extends StructureSchema {
51
- static symbol = Symbol.for("@smithy/err");
52
- ctor;
53
- symbol = ErrorSchema.symbol;
54
- }
55
- const error = (namespace, name, traits, memberNames, memberList, ctor) => Schema.assign(new ErrorSchema(), {
56
- name,
57
- namespace,
58
- traits,
59
- memberNames,
60
- memberList,
61
- ctor: null,
62
- });
63
-
64
141
  class ListSchema extends Schema {
65
142
  static symbol = Symbol.for("@smithy/lis");
66
143
  name;
@@ -107,24 +184,34 @@ const op = (namespace, name, traits, input, output) => Schema.assign(new Operati
107
184
  output,
108
185
  });
109
186
 
110
- class SimpleSchema extends Schema {
111
- static symbol = Symbol.for("@smithy/sim");
187
+ class StructureSchema extends Schema {
188
+ static symbol = Symbol.for("@smithy/str");
112
189
  name;
113
- schemaRef;
114
190
  traits;
115
- symbol = SimpleSchema.symbol;
191
+ memberNames;
192
+ memberList;
193
+ symbol = StructureSchema.symbol;
116
194
  }
117
- const sim = (namespace, name, schemaRef, traits) => Schema.assign(new SimpleSchema(), {
195
+ const struct = (namespace, name, traits, memberNames, memberList) => Schema.assign(new StructureSchema(), {
118
196
  name,
119
197
  namespace,
120
198
  traits,
121
- schemaRef,
199
+ memberNames,
200
+ memberList,
122
201
  });
123
- const simAdapter = (namespace, name, traits, schemaRef) => Schema.assign(new SimpleSchema(), {
202
+
203
+ class ErrorSchema extends StructureSchema {
204
+ static symbol = Symbol.for("@smithy/err");
205
+ ctor;
206
+ symbol = ErrorSchema.symbol;
207
+ }
208
+ const error = (namespace, name, traits, memberNames, memberList, ctor) => Schema.assign(new ErrorSchema(), {
124
209
  name,
125
210
  namespace,
126
211
  traits,
127
- schemaRef,
212
+ memberNames,
213
+ memberList,
214
+ ctor: null,
128
215
  });
129
216
 
130
217
  function translateTraits(indicator) {
@@ -174,8 +261,6 @@ class NormalizedSchema {
174
261
  schema = deref(_ref);
175
262
  this._isMemberSchema = true;
176
263
  }
177
- if (isStaticSchema(schema))
178
- schema = hydrate(schema);
179
264
  if (traitStack.length > 0) {
180
265
  this.memberTraits = {};
181
266
  for (let i = traitStack.length - 1; i >= 0; --i) {
@@ -195,19 +280,25 @@ class NormalizedSchema {
195
280
  return;
196
281
  }
197
282
  this.schema = deref(schema);
198
- if (this.schema && typeof this.schema === "object") {
199
- this.traits = this.schema?.traits ?? {};
283
+ if (isStaticSchema(this.schema)) {
284
+ this.name = `${this.schema[1]}#${this.schema[2]}`;
285
+ this.traits = this.schema[3];
200
286
  }
201
287
  else {
288
+ this.name = this.memberName ?? String(schema);
202
289
  this.traits = 0;
203
290
  }
204
- this.name = (this.schema instanceof Schema ? this.schema.getName?.() : void 0) ?? this.memberName ?? String(schema);
205
291
  if (this._isMemberSchema && !memberName) {
206
292
  throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`);
207
293
  }
208
294
  }
209
295
  static [Symbol.hasInstance](lhs) {
210
- return Schema[Symbol.hasInstance].bind(this)(lhs);
296
+ const isPrototype = this.prototype.isPrototypeOf(lhs);
297
+ if (!isPrototype && typeof lhs === "object" && lhs !== null) {
298
+ const ns = lhs;
299
+ return ns.symbol === this.symbol;
300
+ }
301
+ return isPrototype;
211
302
  }
212
303
  static of(ref) {
213
304
  const sc = deref(ref);
@@ -225,7 +316,11 @@ class NormalizedSchema {
225
316
  return new NormalizedSchema(sc);
226
317
  }
227
318
  getSchema() {
228
- return deref(this.schema?.schemaRef ?? this.schema);
319
+ const sc = this.schema;
320
+ if (sc[0] === 0) {
321
+ return sc[4];
322
+ }
323
+ return sc;
229
324
  }
230
325
  getName(withNamespace = false) {
231
326
  const { name } = this;
@@ -242,17 +337,18 @@ class NormalizedSchema {
242
337
  const sc = this.getSchema();
243
338
  return typeof sc === "number"
244
339
  ? sc >= 64 && sc < 128
245
- : sc instanceof ListSchema;
340
+ : sc[0] === 1;
246
341
  }
247
342
  isMapSchema() {
248
343
  const sc = this.getSchema();
249
344
  return typeof sc === "number"
250
345
  ? sc >= 128 && sc <= 0b1111_1111
251
- : sc instanceof MapSchema;
346
+ : sc[0] === 2;
252
347
  }
253
348
  isStructSchema() {
254
349
  const sc = this.getSchema();
255
- return (sc !== null && typeof sc === "object" && "members" in sc) || sc instanceof StructureSchema;
350
+ return (sc[0] === 3 ||
351
+ sc[0] === -3);
256
352
  }
257
353
  isBlobSchema() {
258
354
  const sc = this.getSchema();
@@ -316,7 +412,7 @@ class NormalizedSchema {
316
412
  const schema = this.getSchema();
317
413
  const memberSchema = isDoc
318
414
  ? 15
319
- : schema?.keySchema ?? 0;
415
+ : schema[4] ?? 0;
320
416
  return member([memberSchema, 0], "key");
321
417
  }
322
418
  getValueSchema() {
@@ -325,7 +421,7 @@ class NormalizedSchema {
325
421
  const memberSchema = typeof sc === "number"
326
422
  ? 0b0011_1111 & sc
327
423
  : sc && typeof sc === "object" && (isMap || isList)
328
- ? sc.valueSchema
424
+ ? sc[3 + sc[0]]
329
425
  : isDoc
330
426
  ? 15
331
427
  : void 0;
@@ -336,9 +432,9 @@ class NormalizedSchema {
336
432
  }
337
433
  getMemberSchema(memberName) {
338
434
  const struct = this.getSchema();
339
- if (this.isStructSchema() && struct.memberNames.includes(memberName)) {
340
- const i = struct.memberNames.indexOf(memberName);
341
- const memberSchema = struct.memberList[i];
435
+ if (this.isStructSchema() && struct[4].includes(memberName)) {
436
+ const i = struct[4].indexOf(memberName);
437
+ const memberSchema = struct[5][i];
342
438
  return member(isMemberSchema(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
343
439
  }
344
440
  if (this.isDocumentSchema()) {
@@ -374,8 +470,8 @@ class NormalizedSchema {
374
470
  throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
375
471
  }
376
472
  const struct = this.getSchema();
377
- for (let i = 0; i < struct.memberNames.length; ++i) {
378
- yield [struct.memberNames[i], member([struct.memberList[i], 0], struct.memberNames[i])];
473
+ for (let i = 0; i < struct[4].length; ++i) {
474
+ yield [struct[4][i], member([struct[5][i], 0], struct[4][i])];
379
475
  }
380
476
  }
381
477
  }
@@ -389,122 +485,28 @@ function member(memberSchema, memberName) {
389
485
  const internalCtorAccess = NormalizedSchema;
390
486
  return new internalCtorAccess(memberSchema, memberName);
391
487
  }
392
- function hydrate(ss) {
393
- const [id, ...rest] = ss;
394
- return {
395
- [0]: simAdapter,
396
- [1]: list,
397
- [2]: map,
398
- [3]: struct,
399
- [-3]: error,
400
- [9]: op,
401
- }[id].call(null, ...rest);
402
- }
403
488
  const isMemberSchema = (sc) => Array.isArray(sc) && sc.length === 2;
404
489
  const isStaticSchema = (sc) => Array.isArray(sc) && sc.length >= 5;
405
490
 
406
- const schemaDeserializationMiddleware = (config) => (next, context) => async (args) => {
407
- const { response } = await next(args);
408
- let { operationSchema } = utilMiddleware.getSmithyContext(context);
409
- if (isStaticSchema(operationSchema)) {
410
- operationSchema = hydrate(operationSchema);
411
- }
412
- try {
413
- const parsed = await config.protocol.deserializeResponse(operationSchema, {
414
- ...config,
415
- ...context,
416
- }, response);
417
- return {
418
- response,
419
- output: parsed,
420
- };
421
- }
422
- catch (error) {
423
- Object.defineProperty(error, "$response", {
424
- value: response,
425
- });
426
- if (!("$metadata" in error)) {
427
- const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
428
- try {
429
- error.message += "\n " + hint;
430
- }
431
- catch (e) {
432
- if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
433
- console.warn(hint);
434
- }
435
- else {
436
- context.logger?.warn?.(hint);
437
- }
438
- }
439
- if (typeof error.$responseBodyText !== "undefined") {
440
- if (error.$response) {
441
- error.$response.body = error.$responseBodyText;
442
- }
443
- }
444
- try {
445
- if (protocolHttp.HttpResponse.isInstance(response)) {
446
- const { headers = {} } = response;
447
- const headerEntries = Object.entries(headers);
448
- error.$metadata = {
449
- httpStatusCode: response.statusCode,
450
- requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
451
- extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
452
- cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries),
453
- };
454
- }
455
- }
456
- catch (e) {
457
- }
458
- }
459
- throw error;
460
- }
461
- };
462
- const findHeader = (pattern, headers) => {
463
- return (headers.find(([k]) => {
464
- return k.match(pattern);
465
- }) || [void 0, void 0])[1];
466
- };
467
-
468
- const schemaSerializationMiddleware = (config) => (next, context) => async (args) => {
469
- let { operationSchema } = utilMiddleware.getSmithyContext(context);
470
- if (isStaticSchema(operationSchema)) {
471
- operationSchema = hydrate(operationSchema);
472
- }
473
- const endpoint = context.endpointV2?.url && config.urlParser
474
- ? async () => config.urlParser(context.endpointV2.url)
475
- : config.endpoint;
476
- const request = await config.protocol.serializeRequest(operationSchema, args.input, {
477
- ...config,
478
- ...context,
479
- endpoint,
480
- });
481
- return next({
482
- ...args,
483
- request,
484
- });
485
- };
486
-
487
- const deserializerMiddlewareOption = {
488
- name: "deserializerMiddleware",
489
- step: "deserialize",
490
- tags: ["DESERIALIZER"],
491
- override: true,
492
- };
493
- const serializerMiddlewareOption = {
494
- name: "serializerMiddleware",
495
- step: "serialize",
496
- tags: ["SERIALIZER"],
497
- override: true,
498
- };
499
- function getSchemaSerdePlugin(config) {
500
- return {
501
- applyToStack: (commandStack) => {
502
- commandStack.add(schemaSerializationMiddleware(config), serializerMiddlewareOption);
503
- commandStack.add(schemaDeserializationMiddleware(config), deserializerMiddlewareOption);
504
- config.protocol.setSerdeContext(config);
505
- },
506
- };
491
+ class SimpleSchema extends Schema {
492
+ static symbol = Symbol.for("@smithy/sim");
493
+ name;
494
+ schemaRef;
495
+ traits;
496
+ symbol = SimpleSchema.symbol;
507
497
  }
498
+ const sim = (namespace, name, schemaRef, traits) => Schema.assign(new SimpleSchema(), {
499
+ name,
500
+ namespace,
501
+ traits,
502
+ schemaRef,
503
+ });
504
+ const simAdapter = (namespace, name, traits, schemaRef) => Schema.assign(new SimpleSchema(), {
505
+ name,
506
+ namespace,
507
+ traits,
508
+ schemaRef,
509
+ });
508
510
 
509
511
  const SCHEMA = {
510
512
  BLOB: 0b0001_0101,
@@ -560,7 +562,7 @@ class TypeRegistry {
560
562
  getErrorCtor(es) {
561
563
  const $error = es;
562
564
  const registry = TypeRegistry.for($error[1]);
563
- return registry.exceptions.get(es);
565
+ return registry.exceptions.get($error);
564
566
  }
565
567
  getBaseException() {
566
568
  for (const exceptionKey of this.exceptions.keys()) {
@@ -603,11 +605,11 @@ exports.deref = deref;
603
605
  exports.deserializerMiddlewareOption = deserializerMiddlewareOption;
604
606
  exports.error = error;
605
607
  exports.getSchemaSerdePlugin = getSchemaSerdePlugin;
606
- exports.hydrate = hydrate;
607
608
  exports.isStaticSchema = isStaticSchema;
608
609
  exports.list = list;
609
610
  exports.map = map;
610
611
  exports.op = op;
612
+ exports.operation = operation;
611
613
  exports.serializerMiddlewareOption = serializerMiddlewareOption;
612
614
  exports.sim = sim;
613
615
  exports.simAdapter = simAdapter;
@@ -16,7 +16,6 @@ export class EventStreamSerde {
16
16
  const marshaller = this.marshaller;
17
17
  const eventStreamMember = requestSchema.getEventStreamMember();
18
18
  const unionSchema = requestSchema.getMemberSchema(eventStreamMember);
19
- const memberSchemas = unionSchema.getMemberSchemas();
20
19
  const serializer = this.serializer;
21
20
  const defaultContentType = this.defaultContentType;
22
21
  const initialRequestMarker = Symbol("initialRequestMarker");
@@ -129,7 +128,7 @@ export class EventStreamSerde {
129
128
  let explicitPayloadContentType;
130
129
  const isKnownSchema = (() => {
131
130
  const struct = unionSchema.getSchema();
132
- return struct.memberNames.includes(unionMember);
131
+ return struct[4].includes(unionMember);
133
132
  })();
134
133
  const additionalHeaders = {};
135
134
  if (!isKnownSchema) {
@@ -1,4 +1,4 @@
1
- import { NormalizedSchema } from "@smithy/core/schema";
1
+ import { NormalizedSchema, translateTraits } from "@smithy/core/schema";
2
2
  import { HttpRequest, HttpResponse } from "@smithy/protocol-http";
3
3
  import { SerdeContext } from "./SerdeContext";
4
4
  export class HttpProtocol extends SerdeContext {
@@ -50,10 +50,10 @@ export class HttpProtocol extends SerdeContext {
50
50
  }
51
51
  }
52
52
  setHostPrefix(request, operationSchema, input) {
53
- const operationNs = NormalizedSchema.of(operationSchema);
54
53
  const inputNs = NormalizedSchema.of(operationSchema.input);
55
- if (operationNs.getMergedTraits().endpoint) {
56
- let hostPrefix = operationNs.getMergedTraits().endpoint?.[0];
54
+ const opTraits = translateTraits(operationSchema.traits ?? {});
55
+ if (opTraits.endpoint) {
56
+ let hostPrefix = opTraits.endpoint?.[0];
57
57
  if (typeof hostPrefix === "string") {
58
58
  const hostLabelInputs = [...inputNs.structIterator()].filter(([, member]) => member.getMergedTraits().hostLabel);
59
59
  for (const [name] of hostLabelInputs) {
@@ -35,7 +35,7 @@ export class TypeRegistry {
35
35
  getErrorCtor(es) {
36
36
  const $error = es;
37
37
  const registry = TypeRegistry.for($error[1]);
38
- return registry.exceptions.get(es);
38
+ return registry.exceptions.get($error);
39
39
  }
40
40
  getBaseException() {
41
41
  for (const exceptionKey of this.exceptions.keys()) {
@@ -3,6 +3,7 @@ export * from "./middleware/getSchemaSerdePlugin";
3
3
  export * from "./schemas/ListSchema";
4
4
  export * from "./schemas/MapSchema";
5
5
  export * from "./schemas/OperationSchema";
6
+ export * from "./schemas/operation";
6
7
  export * from "./schemas/ErrorSchema";
7
8
  export * from "./schemas/NormalizedSchema";
8
9
  export * from "./schemas/Schema";
@@ -1,14 +1,12 @@
1
1
  import { HttpResponse } from "@smithy/protocol-http";
2
2
  import { getSmithyContext } from "@smithy/util-middleware";
3
- import { hydrate, isStaticSchema } from "../schemas/NormalizedSchema";
3
+ import { operation } from "../schemas/operation";
4
4
  export const schemaDeserializationMiddleware = (config) => (next, context) => async (args) => {
5
5
  const { response } = await next(args);
6
- let { operationSchema } = getSmithyContext(context);
7
- if (isStaticSchema(operationSchema)) {
8
- operationSchema = hydrate(operationSchema);
9
- }
6
+ const { operationSchema } = getSmithyContext(context);
7
+ const [, ns, n, t, i, o] = operationSchema ?? [];
10
8
  try {
11
- const parsed = await config.protocol.deserializeResponse(operationSchema, {
9
+ const parsed = await config.protocol.deserializeResponse(operation(ns, n, t, i, o), {
12
10
  ...config,
13
11
  ...context,
14
12
  }, response);
@@ -1,14 +1,12 @@
1
1
  import { getSmithyContext } from "@smithy/util-middleware";
2
- import { hydrate, isStaticSchema } from "../schemas/NormalizedSchema";
2
+ import { operation } from "../schemas/operation";
3
3
  export const schemaSerializationMiddleware = (config) => (next, context) => async (args) => {
4
- let { operationSchema } = getSmithyContext(context);
5
- if (isStaticSchema(operationSchema)) {
6
- operationSchema = hydrate(operationSchema);
7
- }
4
+ const { operationSchema } = getSmithyContext(context);
5
+ const [, ns, n, t, i, o] = operationSchema ?? [];
8
6
  const endpoint = context.endpointV2?.url && config.urlParser
9
7
  ? async () => config.urlParser(context.endpointV2.url)
10
8
  : config.endpoint;
11
- const request = await config.protocol.serializeRequest(operationSchema, args.input, {
9
+ const request = await config.protocol.serializeRequest(operation(ns, n, t, i, o), args.input, {
12
10
  ...config,
13
11
  ...context,
14
12
  endpoint,
@@ -1,11 +1,4 @@
1
1
  import { deref } from "../deref";
2
- import { error } from "./ErrorSchema";
3
- import { list, ListSchema } from "./ListSchema";
4
- import { map, MapSchema } from "./MapSchema";
5
- import { op } from "./OperationSchema";
6
- import { Schema } from "./Schema";
7
- import { simAdapter } from "./SimpleSchema";
8
- import { struct, StructureSchema } from "./StructureSchema";
9
2
  import { translateTraits } from "./translateTraits";
10
3
  export class NormalizedSchema {
11
4
  ref;
@@ -31,8 +24,6 @@ export class NormalizedSchema {
31
24
  schema = deref(_ref);
32
25
  this._isMemberSchema = true;
33
26
  }
34
- if (isStaticSchema(schema))
35
- schema = hydrate(schema);
36
27
  if (traitStack.length > 0) {
37
28
  this.memberTraits = {};
38
29
  for (let i = traitStack.length - 1; i >= 0; --i) {
@@ -52,19 +43,25 @@ export class NormalizedSchema {
52
43
  return;
53
44
  }
54
45
  this.schema = deref(schema);
55
- if (this.schema && typeof this.schema === "object") {
56
- this.traits = this.schema?.traits ?? {};
46
+ if (isStaticSchema(this.schema)) {
47
+ this.name = `${this.schema[1]}#${this.schema[2]}`;
48
+ this.traits = this.schema[3];
57
49
  }
58
50
  else {
51
+ this.name = this.memberName ?? String(schema);
59
52
  this.traits = 0;
60
53
  }
61
- this.name = (this.schema instanceof Schema ? this.schema.getName?.() : void 0) ?? this.memberName ?? String(schema);
62
54
  if (this._isMemberSchema && !memberName) {
63
55
  throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`);
64
56
  }
65
57
  }
66
58
  static [Symbol.hasInstance](lhs) {
67
- return Schema[Symbol.hasInstance].bind(this)(lhs);
59
+ const isPrototype = this.prototype.isPrototypeOf(lhs);
60
+ if (!isPrototype && typeof lhs === "object" && lhs !== null) {
61
+ const ns = lhs;
62
+ return ns.symbol === this.symbol;
63
+ }
64
+ return isPrototype;
68
65
  }
69
66
  static of(ref) {
70
67
  const sc = deref(ref);
@@ -82,7 +79,11 @@ export class NormalizedSchema {
82
79
  return new NormalizedSchema(sc);
83
80
  }
84
81
  getSchema() {
85
- return deref(this.schema?.schemaRef ?? this.schema);
82
+ const sc = this.schema;
83
+ if (sc[0] === 0) {
84
+ return sc[4];
85
+ }
86
+ return sc;
86
87
  }
87
88
  getName(withNamespace = false) {
88
89
  const { name } = this;
@@ -99,17 +100,18 @@ export class NormalizedSchema {
99
100
  const sc = this.getSchema();
100
101
  return typeof sc === "number"
101
102
  ? sc >= 64 && sc < 128
102
- : sc instanceof ListSchema;
103
+ : sc[0] === 1;
103
104
  }
104
105
  isMapSchema() {
105
106
  const sc = this.getSchema();
106
107
  return typeof sc === "number"
107
108
  ? sc >= 128 && sc <= 0b1111_1111
108
- : sc instanceof MapSchema;
109
+ : sc[0] === 2;
109
110
  }
110
111
  isStructSchema() {
111
112
  const sc = this.getSchema();
112
- return (sc !== null && typeof sc === "object" && "members" in sc) || sc instanceof StructureSchema;
113
+ return (sc[0] === 3 ||
114
+ sc[0] === -3);
113
115
  }
114
116
  isBlobSchema() {
115
117
  const sc = this.getSchema();
@@ -173,7 +175,7 @@ export class NormalizedSchema {
173
175
  const schema = this.getSchema();
174
176
  const memberSchema = isDoc
175
177
  ? 15
176
- : schema?.keySchema ?? 0;
178
+ : schema[4] ?? 0;
177
179
  return member([memberSchema, 0], "key");
178
180
  }
179
181
  getValueSchema() {
@@ -182,7 +184,7 @@ export class NormalizedSchema {
182
184
  const memberSchema = typeof sc === "number"
183
185
  ? 0b0011_1111 & sc
184
186
  : sc && typeof sc === "object" && (isMap || isList)
185
- ? sc.valueSchema
187
+ ? sc[3 + sc[0]]
186
188
  : isDoc
187
189
  ? 15
188
190
  : void 0;
@@ -193,9 +195,9 @@ export class NormalizedSchema {
193
195
  }
194
196
  getMemberSchema(memberName) {
195
197
  const struct = this.getSchema();
196
- if (this.isStructSchema() && struct.memberNames.includes(memberName)) {
197
- const i = struct.memberNames.indexOf(memberName);
198
- const memberSchema = struct.memberList[i];
198
+ if (this.isStructSchema() && struct[4].includes(memberName)) {
199
+ const i = struct[4].indexOf(memberName);
200
+ const memberSchema = struct[5][i];
199
201
  return member(isMemberSchema(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
200
202
  }
201
203
  if (this.isDocumentSchema()) {
@@ -231,8 +233,8 @@ export class NormalizedSchema {
231
233
  throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
232
234
  }
233
235
  const struct = this.getSchema();
234
- for (let i = 0; i < struct.memberNames.length; ++i) {
235
- yield [struct.memberNames[i], member([struct.memberList[i], 0], struct.memberNames[i])];
236
+ for (let i = 0; i < struct[4].length; ++i) {
237
+ yield [struct[4][i], member([struct[5][i], 0], struct[4][i])];
236
238
  }
237
239
  }
238
240
  }
@@ -246,16 +248,5 @@ function member(memberSchema, memberName) {
246
248
  const internalCtorAccess = NormalizedSchema;
247
249
  return new internalCtorAccess(memberSchema, memberName);
248
250
  }
249
- export function hydrate(ss) {
250
- const [id, ...rest] = ss;
251
- return {
252
- [0]: simAdapter,
253
- [1]: list,
254
- [2]: map,
255
- [3]: struct,
256
- [-3]: error,
257
- [9]: op,
258
- }[id].call(null, ...rest);
259
- }
260
251
  const isMemberSchema = (sc) => Array.isArray(sc) && sc.length === 2;
261
252
  export const isStaticSchema = (sc) => Array.isArray(sc) && sc.length >= 5;
@@ -0,0 +1,7 @@
1
+ export const operation = (namespace, name, traits, input, output) => ({
2
+ name,
3
+ namespace,
4
+ traits,
5
+ input,
6
+ output,
7
+ });
@@ -3,6 +3,7 @@ export * from "./middleware/getSchemaSerdePlugin";
3
3
  export * from "./schemas/ListSchema";
4
4
  export * from "./schemas/MapSchema";
5
5
  export * from "./schemas/OperationSchema";
6
+ export * from "./schemas/operation";
6
7
  export * from "./schemas/ErrorSchema";
7
8
  export * from "./schemas/NormalizedSchema";
8
9
  export * from "./schemas/Schema";
@@ -7,6 +7,7 @@ import { StructureSchema } from "./StructureSchema";
7
7
  * by additionally holding the class reference for the corresponding ServiceException class.
8
8
  *
9
9
  * @alpha
10
+ * @deprecated use StaticSchema
10
11
  */
11
12
  export declare class ErrorSchema extends StructureSchema {
12
13
  static readonly symbol: unique symbol;
@@ -20,6 +21,7 @@ export declare class ErrorSchema extends StructureSchema {
20
21
  * Factory for ErrorSchema, to reduce codegen output and register the schema.
21
22
  *
22
23
  * @internal
24
+ * @deprecated use StaticSchema
23
25
  *
24
26
  * @param namespace - shapeId namespace.
25
27
  * @param name - shapeId name.
@@ -5,6 +5,7 @@ import { Schema } from "./Schema";
5
5
  * The deprecated Set type may be represented as a list.
6
6
  *
7
7
  * @alpha
8
+ * @deprecated use StaticSchema
8
9
  */
9
10
  export declare class ListSchema extends Schema implements IListSchema {
10
11
  static readonly symbol: unique symbol;
@@ -17,5 +18,6 @@ export declare class ListSchema extends Schema implements IListSchema {
17
18
  * Factory for ListSchema.
18
19
  *
19
20
  * @internal
21
+ * @deprecated use StaticSchema
20
22
  */
21
23
  export declare const list: (namespace: string, name: string, traits: SchemaTraits, valueSchema: SchemaRef) => ListSchema;
@@ -3,6 +3,7 @@ import { Schema } from "./Schema";
3
3
  /**
4
4
  * A schema with a key schema and value schema.
5
5
  * @alpha
6
+ * @deprecated use StaticSchema
6
7
  */
7
8
  export declare class MapSchema extends Schema implements IMapSchema {
8
9
  static readonly symbol: unique symbol;
@@ -18,5 +19,6 @@ export declare class MapSchema extends Schema implements IMapSchema {
18
19
  /**
19
20
  * Factory for MapSchema.
20
21
  * @internal
22
+ * @deprecated use StaticSchema
21
23
  */
22
24
  export declare const map: (namespace: string, name: string, traits: SchemaTraits, keySchema: SchemaRef, valueSchema: SchemaRef) => MapSchema;
@@ -1,10 +1,4 @@
1
- import type { MemberSchema, NormalizedSchema as INormalizedSchema, Schema as ISchema, SchemaRef, SchemaTraitsObject, StaticErrorSchema, StaticListSchema, StaticMapSchema, StaticOperationSchema, StaticSchema, StaticSimpleSchema, StaticStructureSchema } from "@smithy/types";
2
- import type { ErrorSchema } from "./ErrorSchema";
3
- import { ListSchema } from "./ListSchema";
4
- import { MapSchema } from "./MapSchema";
5
- import type { OperationSchema } from "./OperationSchema";
6
- import type { SimpleSchema } from "./SimpleSchema";
7
- import { StructureSchema } from "./StructureSchema";
1
+ import type { $MemberSchema, $Schema, $SchemaRef, NormalizedSchema as INormalizedSchema, SchemaRef, SchemaTraitsObject, StaticSchema } from "@smithy/types";
8
2
  /**
9
3
  * Wraps both class instances, numeric sentinel values, and member schema pairs.
10
4
  * Presents a consistent interface for interacting with polymorphic schema representations.
@@ -12,7 +6,7 @@ import { StructureSchema } from "./StructureSchema";
12
6
  * @alpha
13
7
  */
14
8
  export declare class NormalizedSchema implements INormalizedSchema {
15
- readonly ref: SchemaRef;
9
+ readonly ref: $SchemaRef;
16
10
  private readonly memberName?;
17
11
  static readonly symbol: unique symbol;
18
12
  protected readonly symbol: symbol;
@@ -31,11 +25,11 @@ export declare class NormalizedSchema implements INormalizedSchema {
31
25
  /**
32
26
  * Static constructor that attempts to avoid wrapping a NormalizedSchema within another.
33
27
  */
34
- static of(ref: SchemaRef): NormalizedSchema;
28
+ static of(ref: SchemaRef | $SchemaRef): NormalizedSchema;
35
29
  /**
36
30
  * @returns the underlying non-normalized schema.
37
31
  */
38
- getSchema(): Exclude<ISchema, MemberSchema | INormalizedSchema>;
32
+ getSchema(): Exclude<$Schema, $MemberSchema | INormalizedSchema>;
39
33
  /**
40
34
  * @param withNamespace - qualifies the name.
41
35
  * @returns e.g. `MyShape` or `com.namespace#MyShape`.
@@ -127,17 +121,6 @@ export declare class NormalizedSchema implements INormalizedSchema {
127
121
  */
128
122
  structIterator(): Generator<[string, NormalizedSchema], undefined, undefined>;
129
123
  }
130
- /**
131
- * @internal
132
- * @returns a class instance version of a static schema.
133
- */
134
- export declare function hydrate(ss: StaticSimpleSchema): SimpleSchema;
135
- export declare function hydrate(ss: StaticListSchema): ListSchema;
136
- export declare function hydrate(ss: StaticMapSchema): MapSchema;
137
- export declare function hydrate(ss: StaticStructureSchema): StructureSchema;
138
- export declare function hydrate(ss: StaticErrorSchema): ErrorSchema;
139
- export declare function hydrate(ss: StaticOperationSchema): OperationSchema;
140
- export declare function hydrate(ss: StaticSchema): SimpleSchema | ListSchema | MapSchema | StructureSchema | ErrorSchema | OperationSchema;
141
124
  /**
142
125
  * @internal
143
126
  */
@@ -5,6 +5,7 @@ import { Schema } from "./Schema";
5
5
  * detection on the operation that may affect client protocol logic.
6
6
  *
7
7
  * @alpha
8
+ * @deprecated use StaticSchema
8
9
  */
9
10
  export declare class OperationSchema extends Schema implements IOperationSchema {
10
11
  static readonly symbol: unique symbol;
@@ -17,5 +18,6 @@ export declare class OperationSchema extends Schema implements IOperationSchema
17
18
  /**
18
19
  * Factory for OperationSchema.
19
20
  * @internal
21
+ * @deprecated use StaticSchema
20
22
  */
21
23
  export declare const op: (namespace: string, name: string, traits: SchemaTraits, input: SchemaRef, output: SchemaRef) => OperationSchema;
@@ -3,6 +3,7 @@ import type { SchemaTraits, TraitsSchema } from "@smithy/types";
3
3
  * Abstract base for class-based Schema except NormalizedSchema.
4
4
  *
5
5
  * @alpha
6
+ * @deprecated use StaticSchema
6
7
  */
7
8
  export declare abstract class Schema implements TraitsSchema {
8
9
  name: string;
@@ -5,6 +5,7 @@ import { Schema } from "./Schema";
5
5
  * attached to those schema, since a single number cannot easily represent both a schema and its traits.
6
6
  *
7
7
  * @alpha
8
+ * @deprecated use StaticSchema
8
9
  */
9
10
  export declare class SimpleSchema extends Schema implements TraitsSchema {
10
11
  static readonly symbol: unique symbol;
@@ -17,6 +18,7 @@ export declare class SimpleSchema extends Schema implements TraitsSchema {
17
18
  * Factory for simple schema class objects.
18
19
  *
19
20
  * @internal
21
+ * @deprecated use StaticSchema
20
22
  */
21
23
  export declare const sim: (namespace: string, name: string, schemaRef: SchemaRef, traits: SchemaTraits) => SimpleSchema;
22
24
  /**
@@ -4,6 +4,7 @@ import { Schema } from "./Schema";
4
4
  * A structure schema has a known list of members. This is also used for unions.
5
5
  *
6
6
  * @alpha
7
+ * @deprecated use StaticSchema
7
8
  */
8
9
  export declare class StructureSchema extends Schema implements IStructureSchema {
9
10
  static symbol: symbol;
@@ -17,5 +18,6 @@ export declare class StructureSchema extends Schema implements IStructureSchema
17
18
  * Factory for StructureSchema.
18
19
  *
19
20
  * @internal
21
+ * @deprecated use StaticSchema
20
22
  */
21
23
  export declare const struct: (namespace: string, name: string, traits: SchemaTraits, memberNames: string[], memberList: SchemaRef[]) => StructureSchema;
@@ -0,0 +1,7 @@
1
+ import type { OperationSchema, SchemaRef, SchemaTraits } from "@smithy/types";
2
+ /**
3
+ * Converts the static schema array into an object-form to adapt
4
+ * to the signature of ClientProtocol classes.
5
+ * @internal
6
+ */
7
+ export declare const operation: (namespace: string, name: string, traits: SchemaTraits, input: SchemaRef, output: SchemaRef) => OperationSchema;
@@ -3,6 +3,7 @@ export * from "./middleware/getSchemaSerdePlugin";
3
3
  export * from "./schemas/ListSchema";
4
4
  export * from "./schemas/MapSchema";
5
5
  export * from "./schemas/OperationSchema";
6
+ export * from "./schemas/operation";
6
7
  export * from "./schemas/ErrorSchema";
7
8
  export * from "./schemas/NormalizedSchema";
8
9
  export * from "./schemas/Schema";
@@ -7,6 +7,7 @@ import { StructureSchema } from "./StructureSchema";
7
7
  * by additionally holding the class reference for the corresponding ServiceException class.
8
8
  *
9
9
  * @alpha
10
+ * @deprecated use StaticSchema
10
11
  */
11
12
  export declare class ErrorSchema extends StructureSchema {
12
13
  static readonly symbol: unique symbol;
@@ -20,6 +21,7 @@ export declare class ErrorSchema extends StructureSchema {
20
21
  * Factory for ErrorSchema, to reduce codegen output and register the schema.
21
22
  *
22
23
  * @internal
24
+ * @deprecated use StaticSchema
23
25
  *
24
26
  * @param namespace - shapeId namespace.
25
27
  * @param name - shapeId name.
@@ -5,6 +5,7 @@ import { Schema } from "./Schema";
5
5
  * The deprecated Set type may be represented as a list.
6
6
  *
7
7
  * @alpha
8
+ * @deprecated use StaticSchema
8
9
  */
9
10
  export declare class ListSchema extends Schema implements IListSchema {
10
11
  static readonly symbol: unique symbol;
@@ -17,5 +18,6 @@ export declare class ListSchema extends Schema implements IListSchema {
17
18
  * Factory for ListSchema.
18
19
  *
19
20
  * @internal
21
+ * @deprecated use StaticSchema
20
22
  */
21
23
  export declare const list: (namespace: string, name: string, traits: SchemaTraits, valueSchema: SchemaRef) => ListSchema;
@@ -3,6 +3,7 @@ import { Schema } from "./Schema";
3
3
  /**
4
4
  * A schema with a key schema and value schema.
5
5
  * @alpha
6
+ * @deprecated use StaticSchema
6
7
  */
7
8
  export declare class MapSchema extends Schema implements IMapSchema {
8
9
  static readonly symbol: unique symbol;
@@ -18,5 +19,6 @@ export declare class MapSchema extends Schema implements IMapSchema {
18
19
  /**
19
20
  * Factory for MapSchema.
20
21
  * @internal
22
+ * @deprecated use StaticSchema
21
23
  */
22
24
  export declare const map: (namespace: string, name: string, traits: SchemaTraits, keySchema: SchemaRef, valueSchema: SchemaRef) => MapSchema;
@@ -1,10 +1,4 @@
1
- import { MemberSchema, NormalizedSchema as INormalizedSchema, Schema as ISchema, SchemaRef, SchemaTraitsObject, StaticErrorSchema, StaticListSchema, StaticMapSchema, StaticOperationSchema, StaticSchema, StaticSimpleSchema, StaticStructureSchema } from "@smithy/types";
2
- import { ErrorSchema } from "./ErrorSchema";
3
- import { ListSchema } from "./ListSchema";
4
- import { MapSchema } from "./MapSchema";
5
- import { OperationSchema } from "./OperationSchema";
6
- import { SimpleSchema } from "./SimpleSchema";
7
- import { StructureSchema } from "./StructureSchema";
1
+ import { $MemberSchema, $Schema, $SchemaRef, NormalizedSchema as INormalizedSchema, SchemaRef, SchemaTraitsObject, StaticSchema } from "@smithy/types";
8
2
  /**
9
3
  * Wraps both class instances, numeric sentinel values, and member schema pairs.
10
4
  * Presents a consistent interface for interacting with polymorphic schema representations.
@@ -12,7 +6,7 @@ import { StructureSchema } from "./StructureSchema";
12
6
  * @alpha
13
7
  */
14
8
  export declare class NormalizedSchema implements INormalizedSchema {
15
- readonly ref: SchemaRef;
9
+ readonly ref: $SchemaRef;
16
10
  private readonly memberName?;
17
11
  static readonly symbol: unique symbol;
18
12
  protected readonly symbol: symbol;
@@ -31,11 +25,11 @@ export declare class NormalizedSchema implements INormalizedSchema {
31
25
  /**
32
26
  * Static constructor that attempts to avoid wrapping a NormalizedSchema within another.
33
27
  */
34
- static of(ref: SchemaRef): NormalizedSchema;
28
+ static of(ref: SchemaRef | $SchemaRef): NormalizedSchema;
35
29
  /**
36
30
  * @returns the underlying non-normalized schema.
37
31
  */
38
- getSchema(): Exclude<ISchema, MemberSchema | INormalizedSchema>;
32
+ getSchema(): Exclude<$Schema, $MemberSchema | INormalizedSchema>;
39
33
  /**
40
34
  * @param withNamespace - qualifies the name.
41
35
  * @returns e.g. `MyShape` or `com.namespace#MyShape`.
@@ -130,17 +124,6 @@ export declare class NormalizedSchema implements INormalizedSchema {
130
124
  NormalizedSchema
131
125
  ], undefined, undefined>;
132
126
  }
133
- /**
134
- * @internal
135
- * @returns a class instance version of a static schema.
136
- */
137
- export declare function hydrate(ss: StaticSimpleSchema): SimpleSchema;
138
- export declare function hydrate(ss: StaticListSchema): ListSchema;
139
- export declare function hydrate(ss: StaticMapSchema): MapSchema;
140
- export declare function hydrate(ss: StaticStructureSchema): StructureSchema;
141
- export declare function hydrate(ss: StaticErrorSchema): ErrorSchema;
142
- export declare function hydrate(ss: StaticOperationSchema): OperationSchema;
143
- export declare function hydrate(ss: StaticSchema): SimpleSchema | ListSchema | MapSchema | StructureSchema | ErrorSchema | OperationSchema;
144
127
  /**
145
128
  * @internal
146
129
  */
@@ -5,6 +5,7 @@ import { Schema } from "./Schema";
5
5
  * detection on the operation that may affect client protocol logic.
6
6
  *
7
7
  * @alpha
8
+ * @deprecated use StaticSchema
8
9
  */
9
10
  export declare class OperationSchema extends Schema implements IOperationSchema {
10
11
  static readonly symbol: unique symbol;
@@ -17,5 +18,6 @@ export declare class OperationSchema extends Schema implements IOperationSchema
17
18
  /**
18
19
  * Factory for OperationSchema.
19
20
  * @internal
21
+ * @deprecated use StaticSchema
20
22
  */
21
23
  export declare const op: (namespace: string, name: string, traits: SchemaTraits, input: SchemaRef, output: SchemaRef) => OperationSchema;
@@ -3,6 +3,7 @@ import { SchemaTraits, TraitsSchema } from "@smithy/types";
3
3
  * Abstract base for class-based Schema except NormalizedSchema.
4
4
  *
5
5
  * @alpha
6
+ * @deprecated use StaticSchema
6
7
  */
7
8
  export declare abstract class Schema implements TraitsSchema {
8
9
  name: string;
@@ -5,6 +5,7 @@ import { Schema } from "./Schema";
5
5
  * attached to those schema, since a single number cannot easily represent both a schema and its traits.
6
6
  *
7
7
  * @alpha
8
+ * @deprecated use StaticSchema
8
9
  */
9
10
  export declare class SimpleSchema extends Schema implements TraitsSchema {
10
11
  static readonly symbol: unique symbol;
@@ -17,6 +18,7 @@ export declare class SimpleSchema extends Schema implements TraitsSchema {
17
18
  * Factory for simple schema class objects.
18
19
  *
19
20
  * @internal
21
+ * @deprecated use StaticSchema
20
22
  */
21
23
  export declare const sim: (namespace: string, name: string, schemaRef: SchemaRef, traits: SchemaTraits) => SimpleSchema;
22
24
  /**
@@ -4,6 +4,7 @@ import { Schema } from "./Schema";
4
4
  * A structure schema has a known list of members. This is also used for unions.
5
5
  *
6
6
  * @alpha
7
+ * @deprecated use StaticSchema
7
8
  */
8
9
  export declare class StructureSchema extends Schema implements IStructureSchema {
9
10
  static symbol: symbol;
@@ -17,5 +18,6 @@ export declare class StructureSchema extends Schema implements IStructureSchema
17
18
  * Factory for StructureSchema.
18
19
  *
19
20
  * @internal
21
+ * @deprecated use StaticSchema
20
22
  */
21
23
  export declare const struct: (namespace: string, name: string, traits: SchemaTraits, memberNames: string[], memberList: SchemaRef[]) => StructureSchema;
@@ -0,0 +1,7 @@
1
+ import { OperationSchema, SchemaRef, SchemaTraits } from "@smithy/types";
2
+ /**
3
+ * Converts the static schema array into an object-form to adapt
4
+ * to the signature of ClientProtocol classes.
5
+ * @internal
6
+ */
7
+ export declare const operation: (namespace: string, name: string, traits: SchemaTraits, input: SchemaRef, output: SchemaRef) => OperationSchema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithy/core",
3
- "version": "3.16.1",
3
+ "version": "3.17.0",
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",
@@ -77,13 +77,13 @@
77
77
  "license": "Apache-2.0",
78
78
  "sideEffects": false,
79
79
  "dependencies": {
80
- "@smithy/middleware-serde": "^4.2.2",
81
- "@smithy/protocol-http": "^5.3.2",
82
- "@smithy/types": "^4.7.1",
80
+ "@smithy/middleware-serde": "^4.2.3",
81
+ "@smithy/protocol-http": "^5.3.3",
82
+ "@smithy/types": "^4.8.0",
83
83
  "@smithy/util-base64": "^4.3.0",
84
84
  "@smithy/util-body-length-browser": "^4.2.0",
85
- "@smithy/util-middleware": "^4.2.2",
86
- "@smithy/util-stream": "^4.5.2",
85
+ "@smithy/util-middleware": "^4.2.3",
86
+ "@smithy/util-stream": "^4.5.3",
87
87
  "@smithy/util-utf8": "^4.2.0",
88
88
  "@smithy/uuid": "^1.1.0",
89
89
  "tslib": "^2.6.2"
@@ -118,7 +118,7 @@
118
118
  "directory": "packages/core"
119
119
  },
120
120
  "devDependencies": {
121
- "@smithy/eventstream-serde-node": "^4.2.2",
121
+ "@smithy/eventstream-serde-node": "^4.2.3",
122
122
  "@types/node": "^18.11.9",
123
123
  "concurrently": "7.0.0",
124
124
  "downlevel-dts": "0.10.1",