@cdk8s/awscdk-resolver 0.0.356 → 0.0.358
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.
- package/.jsii +2 -2
- package/lib/resolve.js +1 -1
- package/node_modules/@smithy/abort-controller/package.json +2 -2
- package/node_modules/@smithy/config-resolver/package.json +4 -4
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +14 -16
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +155 -221
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +12 -10
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/ErrorSchema.js +12 -22
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/ListSchema.js +9 -20
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/MapSchema.js +10 -21
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +76 -87
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/OperationSchema.js +11 -12
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/Schema.js +16 -3
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/SimpleSchema.js +9 -20
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/StructureSchema.js +10 -27
- package/node_modules/@smithy/core/dist-types/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +1 -2
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/ErrorSchema.d.ts +3 -16
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/ListSchema.d.ts +3 -5
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/MapSchema.d.ts +3 -9
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +15 -13
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/OperationSchema.d.ts +3 -2
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/Schema.d.ts +5 -1
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/SimpleSchema.d.ts +3 -5
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/StructureSchema.d.ts +3 -6
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/cbor/SmithyRpcV2CborProtocol.d.ts +1 -2
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/ErrorSchema.d.ts +3 -16
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/ListSchema.d.ts +3 -5
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/MapSchema.d.ts +3 -9
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +15 -13
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/OperationSchema.d.ts +3 -2
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/Schema.d.ts +5 -1
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/SimpleSchema.d.ts +3 -5
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/StructureSchema.d.ts +3 -9
- package/node_modules/@smithy/core/package.json +7 -7
- package/node_modules/@smithy/credential-provider-imds/package.json +5 -5
- package/node_modules/@smithy/fetch-http-handler/package.json +5 -5
- package/node_modules/@smithy/hash-node/package.json +2 -2
- package/node_modules/@smithy/invalid-dependency/package.json +2 -2
- package/node_modules/@smithy/middleware-content-length/package.json +3 -3
- package/node_modules/@smithy/middleware-endpoint/package.json +8 -8
- package/node_modules/@smithy/middleware-retry/package.json +8 -8
- package/node_modules/@smithy/middleware-serde/package.json +3 -3
- package/node_modules/@smithy/middleware-stack/package.json +2 -2
- package/node_modules/@smithy/node-config-provider/package.json +4 -4
- package/node_modules/@smithy/node-http-handler/package.json +5 -5
- package/node_modules/@smithy/property-provider/package.json +2 -2
- package/node_modules/@smithy/protocol-http/package.json +2 -2
- package/node_modules/@smithy/querystring-builder/package.json +2 -2
- package/node_modules/@smithy/querystring-parser/package.json +2 -2
- package/node_modules/@smithy/service-error-classification/package.json +2 -2
- package/node_modules/@smithy/shared-ini-file-loader/package.json +2 -2
- package/node_modules/@smithy/signature-v4/package.json +4 -4
- package/node_modules/@smithy/smithy-client/package.json +7 -7
- package/node_modules/@smithy/types/dist-types/schema/schema.d.ts +9 -2
- package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema.d.ts +13 -3
- package/node_modules/@smithy/types/package.json +1 -1
- package/node_modules/@smithy/url-parser/package.json +3 -3
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +4 -4
- package/node_modules/@smithy/util-defaults-mode-node/package.json +7 -7
- package/node_modules/@smithy/util-endpoints/package.json +3 -3
- package/node_modules/@smithy/util-middleware/package.json +2 -2
- package/node_modules/@smithy/util-retry/package.json +3 -3
- package/node_modules/@smithy/util-stream/package.json +4 -4
- package/node_modules/@smithy/util-waiter/package.json +3 -3
- package/package.json +4 -4
@@ -240,152 +240,113 @@ var TypeRegistry = class _TypeRegistry {
|
|
240
240
|
|
241
241
|
// src/submodules/schema/schemas/Schema.ts
|
242
242
|
var Schema = class {
|
243
|
-
|
244
|
-
|
245
|
-
|
243
|
+
static assign(instance, values) {
|
244
|
+
const schema = Object.assign(instance, values);
|
245
|
+
TypeRegistry.for(schema.namespace).register(schema.name, schema);
|
246
|
+
return schema;
|
247
|
+
}
|
248
|
+
static [Symbol.hasInstance](lhs) {
|
249
|
+
const isPrototype = this.prototype.isPrototypeOf(lhs);
|
250
|
+
if (!isPrototype && typeof lhs === "object" && lhs !== null) {
|
251
|
+
const list2 = lhs;
|
252
|
+
return list2.symbol === this.symbol;
|
253
|
+
}
|
254
|
+
return isPrototype;
|
255
|
+
}
|
256
|
+
getName() {
|
257
|
+
return this.namespace + "#" + this.name;
|
246
258
|
}
|
247
259
|
};
|
248
260
|
|
249
261
|
// src/submodules/schema/schemas/ListSchema.ts
|
250
262
|
var ListSchema = class _ListSchema extends Schema {
|
251
|
-
constructor(
|
252
|
-
super(
|
253
|
-
this.name = name;
|
254
|
-
this.traits = traits;
|
255
|
-
this.valueSchema = valueSchema;
|
263
|
+
constructor() {
|
264
|
+
super(...arguments);
|
256
265
|
this.symbol = _ListSchema.symbol;
|
257
266
|
}
|
258
267
|
static {
|
259
|
-
this.symbol = Symbol.for("@smithy/
|
260
|
-
}
|
261
|
-
static [Symbol.hasInstance](lhs) {
|
262
|
-
const isPrototype = _ListSchema.prototype.isPrototypeOf(lhs);
|
263
|
-
if (!isPrototype && typeof lhs === "object" && lhs !== null) {
|
264
|
-
const list2 = lhs;
|
265
|
-
return list2.symbol === _ListSchema.symbol;
|
266
|
-
}
|
267
|
-
return isPrototype;
|
268
|
+
this.symbol = Symbol.for("@smithy/lis");
|
268
269
|
}
|
269
270
|
};
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
TypeRegistry.for(namespace).register(name, schema);
|
277
|
-
return schema;
|
278
|
-
}
|
271
|
+
var list = (namespace, name, traits, valueSchema) => Schema.assign(new ListSchema(), {
|
272
|
+
name,
|
273
|
+
namespace,
|
274
|
+
traits,
|
275
|
+
valueSchema
|
276
|
+
});
|
279
277
|
|
280
278
|
// src/submodules/schema/schemas/MapSchema.ts
|
281
279
|
var MapSchema = class _MapSchema extends Schema {
|
282
|
-
constructor(
|
283
|
-
super(
|
284
|
-
this.name = name;
|
285
|
-
this.traits = traits;
|
286
|
-
this.keySchema = keySchema;
|
287
|
-
this.valueSchema = valueSchema;
|
280
|
+
constructor() {
|
281
|
+
super(...arguments);
|
288
282
|
this.symbol = _MapSchema.symbol;
|
289
283
|
}
|
290
284
|
static {
|
291
|
-
this.symbol = Symbol.for("@smithy/
|
292
|
-
}
|
293
|
-
static [Symbol.hasInstance](lhs) {
|
294
|
-
const isPrototype = _MapSchema.prototype.isPrototypeOf(lhs);
|
295
|
-
if (!isPrototype && typeof lhs === "object" && lhs !== null) {
|
296
|
-
const map2 = lhs;
|
297
|
-
return map2.symbol === _MapSchema.symbol;
|
298
|
-
}
|
299
|
-
return isPrototype;
|
285
|
+
this.symbol = Symbol.for("@smithy/map");
|
300
286
|
}
|
301
287
|
};
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
TypeRegistry.for(namespace).register(name, schema);
|
310
|
-
return schema;
|
311
|
-
}
|
288
|
+
var map = (namespace, name, traits, keySchema, valueSchema) => Schema.assign(new MapSchema(), {
|
289
|
+
name,
|
290
|
+
namespace,
|
291
|
+
traits,
|
292
|
+
keySchema,
|
293
|
+
valueSchema
|
294
|
+
});
|
312
295
|
|
313
296
|
// src/submodules/schema/schemas/OperationSchema.ts
|
314
|
-
var OperationSchema = class extends Schema {
|
315
|
-
constructor(
|
316
|
-
super(
|
317
|
-
this.
|
318
|
-
|
319
|
-
|
320
|
-
this.
|
297
|
+
var OperationSchema = class _OperationSchema extends Schema {
|
298
|
+
constructor() {
|
299
|
+
super(...arguments);
|
300
|
+
this.symbol = _OperationSchema.symbol;
|
301
|
+
}
|
302
|
+
static {
|
303
|
+
this.symbol = Symbol.for("@smithy/ope");
|
321
304
|
}
|
322
305
|
};
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
306
|
+
var op = (namespace, name, traits, input, output) => Schema.assign(new OperationSchema(), {
|
307
|
+
name,
|
308
|
+
namespace,
|
309
|
+
traits,
|
310
|
+
input,
|
311
|
+
output
|
312
|
+
});
|
328
313
|
|
329
314
|
// src/submodules/schema/schemas/StructureSchema.ts
|
330
315
|
var StructureSchema = class _StructureSchema extends Schema {
|
331
|
-
constructor(
|
332
|
-
super(
|
333
|
-
this.name = name;
|
334
|
-
this.traits = traits;
|
335
|
-
this.memberNames = memberNames;
|
336
|
-
this.memberList = memberList;
|
316
|
+
constructor() {
|
317
|
+
super(...arguments);
|
337
318
|
this.symbol = _StructureSchema.symbol;
|
338
|
-
this.members = {};
|
339
|
-
for (let i = 0; i < memberNames.length; ++i) {
|
340
|
-
this.members[memberNames[i]] = Array.isArray(memberList[i]) ? memberList[i] : [memberList[i], 0];
|
341
|
-
}
|
342
319
|
}
|
343
320
|
static {
|
344
|
-
this.symbol = Symbol.for("@smithy/
|
345
|
-
}
|
346
|
-
static [Symbol.hasInstance](lhs) {
|
347
|
-
const isPrototype = _StructureSchema.prototype.isPrototypeOf(lhs);
|
348
|
-
if (!isPrototype && typeof lhs === "object" && lhs !== null) {
|
349
|
-
const struct2 = lhs;
|
350
|
-
return struct2.symbol === _StructureSchema.symbol;
|
351
|
-
}
|
352
|
-
return isPrototype;
|
321
|
+
this.symbol = Symbol.for("@smithy/str");
|
353
322
|
}
|
354
323
|
};
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
324
|
+
var struct = (namespace, name, traits, memberNames, memberList) => Schema.assign(new StructureSchema(), {
|
325
|
+
name,
|
326
|
+
namespace,
|
327
|
+
traits,
|
328
|
+
memberNames,
|
329
|
+
memberList
|
330
|
+
});
|
360
331
|
|
361
332
|
// src/submodules/schema/schemas/ErrorSchema.ts
|
362
333
|
var ErrorSchema = class _ErrorSchema extends StructureSchema {
|
363
|
-
constructor(
|
364
|
-
super(
|
365
|
-
this.name = name;
|
366
|
-
this.traits = traits;
|
367
|
-
this.memberNames = memberNames;
|
368
|
-
this.memberList = memberList;
|
369
|
-
this.ctor = ctor;
|
334
|
+
constructor() {
|
335
|
+
super(...arguments);
|
370
336
|
this.symbol = _ErrorSchema.symbol;
|
371
337
|
}
|
372
338
|
static {
|
373
|
-
this.symbol = Symbol.for("@smithy/
|
374
|
-
}
|
375
|
-
static [Symbol.hasInstance](lhs) {
|
376
|
-
const isPrototype = _ErrorSchema.prototype.isPrototypeOf(lhs);
|
377
|
-
if (!isPrototype && typeof lhs === "object" && lhs !== null) {
|
378
|
-
const err = lhs;
|
379
|
-
return err.symbol === _ErrorSchema.symbol;
|
380
|
-
}
|
381
|
-
return isPrototype;
|
339
|
+
this.symbol = Symbol.for("@smithy/err");
|
382
340
|
}
|
383
341
|
};
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
342
|
+
var error = (namespace, name, traits, memberNames, memberList, ctor) => Schema.assign(new ErrorSchema(), {
|
343
|
+
name,
|
344
|
+
namespace,
|
345
|
+
traits,
|
346
|
+
memberNames,
|
347
|
+
memberList,
|
348
|
+
ctor
|
349
|
+
});
|
389
350
|
|
390
351
|
// src/submodules/schema/schemas/sentinels.ts
|
391
352
|
var SCHEMA = {
|
@@ -421,30 +382,20 @@ var SCHEMA = {
|
|
421
382
|
|
422
383
|
// src/submodules/schema/schemas/SimpleSchema.ts
|
423
384
|
var SimpleSchema = class _SimpleSchema extends Schema {
|
424
|
-
constructor(
|
425
|
-
super(
|
426
|
-
this.name = name;
|
427
|
-
this.schemaRef = schemaRef;
|
428
|
-
this.traits = traits;
|
385
|
+
constructor() {
|
386
|
+
super(...arguments);
|
429
387
|
this.symbol = _SimpleSchema.symbol;
|
430
388
|
}
|
431
389
|
static {
|
432
|
-
this.symbol = Symbol.for("@smithy/
|
433
|
-
}
|
434
|
-
static [Symbol.hasInstance](lhs) {
|
435
|
-
const isPrototype = _SimpleSchema.prototype.isPrototypeOf(lhs);
|
436
|
-
if (!isPrototype && typeof lhs === "object" && lhs !== null) {
|
437
|
-
const sim2 = lhs;
|
438
|
-
return sim2.symbol === _SimpleSchema.symbol;
|
439
|
-
}
|
440
|
-
return isPrototype;
|
390
|
+
this.symbol = Symbol.for("@smithy/sim");
|
441
391
|
}
|
442
392
|
};
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
393
|
+
var sim = (namespace, name, schemaRef, traits) => Schema.assign(new SimpleSchema(), {
|
394
|
+
name,
|
395
|
+
namespace,
|
396
|
+
traits,
|
397
|
+
schemaRef
|
398
|
+
});
|
448
399
|
|
449
400
|
// src/submodules/schema/schemas/NormalizedSchema.ts
|
450
401
|
var NormalizedSchema = class _NormalizedSchema {
|
@@ -476,13 +427,9 @@ var NormalizedSchema = class _NormalizedSchema {
|
|
476
427
|
this.memberTraits = 0;
|
477
428
|
}
|
478
429
|
if (schema instanceof _NormalizedSchema) {
|
479
|
-
this
|
480
|
-
this.traits = schema.traits;
|
481
|
-
this._isMemberSchema = schema._isMemberSchema;
|
482
|
-
this.schema = schema.schema;
|
430
|
+
Object.assign(this, schema);
|
483
431
|
this.memberTraits = Object.assign({}, schema.getMemberTraits(), this.getMemberTraits());
|
484
432
|
this.normalizedTraits = void 0;
|
485
|
-
this.ref = schema.ref;
|
486
433
|
this.memberName = memberName ?? schema.memberName;
|
487
434
|
return;
|
488
435
|
}
|
@@ -492,34 +439,33 @@ var NormalizedSchema = class _NormalizedSchema {
|
|
492
439
|
} else {
|
493
440
|
this.traits = 0;
|
494
441
|
}
|
495
|
-
this.name = (
|
442
|
+
this.name = (this.schema instanceof Schema ? this.schema.getName?.() : void 0) ?? this.memberName ?? this.getSchemaName();
|
496
443
|
if (this._isMemberSchema && !memberName) {
|
497
|
-
throw new Error(
|
498
|
-
`@smithy/core/schema - NormalizedSchema member schema ${this.getName(
|
499
|
-
true
|
500
|
-
)} must initialize with memberName argument.`
|
501
|
-
);
|
444
|
+
throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`);
|
502
445
|
}
|
503
446
|
}
|
504
447
|
static {
|
505
|
-
this.symbol = Symbol.for("@smithy/
|
448
|
+
this.symbol = Symbol.for("@smithy/nor");
|
506
449
|
}
|
507
450
|
static [Symbol.hasInstance](lhs) {
|
508
|
-
|
509
|
-
if (!isPrototype && typeof lhs === "object" && lhs !== null) {
|
510
|
-
const ns = lhs;
|
511
|
-
return ns.symbol === _NormalizedSchema.symbol;
|
512
|
-
}
|
513
|
-
return isPrototype;
|
451
|
+
return Schema[Symbol.hasInstance].bind(this)(lhs);
|
514
452
|
}
|
515
453
|
/**
|
516
454
|
* Static constructor that attempts to avoid wrapping a NormalizedSchema within another.
|
517
455
|
*/
|
518
|
-
static of(ref
|
456
|
+
static of(ref) {
|
519
457
|
if (ref instanceof _NormalizedSchema) {
|
520
458
|
return ref;
|
521
459
|
}
|
522
|
-
|
460
|
+
if (Array.isArray(ref)) {
|
461
|
+
const [ns, traits] = ref;
|
462
|
+
if (ns instanceof _NormalizedSchema) {
|
463
|
+
Object.assign(ns.getMergedTraits(), _NormalizedSchema.translateTraits(traits));
|
464
|
+
return ns;
|
465
|
+
}
|
466
|
+
throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(ref, null, 2)}.`);
|
467
|
+
}
|
468
|
+
return new _NormalizedSchema(ref);
|
523
469
|
}
|
524
470
|
/**
|
525
471
|
* @param indicator - numeric indicator for preset trait combination.
|
@@ -531,46 +477,29 @@ var NormalizedSchema = class _NormalizedSchema {
|
|
531
477
|
}
|
532
478
|
indicator = indicator | 0;
|
533
479
|
const traits = {};
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
traits.httpPayload = 1;
|
548
|
-
}
|
549
|
-
if ((indicator >> 5 & 1) === 1) {
|
550
|
-
traits.httpResponseCode = 1;
|
551
|
-
}
|
552
|
-
if ((indicator >> 6 & 1) === 1) {
|
553
|
-
traits.httpQueryParams = 1;
|
480
|
+
let i = 0;
|
481
|
+
for (const trait of [
|
482
|
+
"httpLabel",
|
483
|
+
"idempotent",
|
484
|
+
"idempotencyToken",
|
485
|
+
"sensitive",
|
486
|
+
"httpPayload",
|
487
|
+
"httpResponseCode",
|
488
|
+
"httpQueryParams"
|
489
|
+
]) {
|
490
|
+
if ((indicator >> i++ & 1) === 1) {
|
491
|
+
traits[trait] = 1;
|
492
|
+
}
|
554
493
|
}
|
555
494
|
return traits;
|
556
495
|
}
|
557
|
-
/**
|
558
|
-
* Creates a normalized member schema from the given schema and member name.
|
559
|
-
*/
|
560
|
-
static memberFrom(memberSchema, memberName) {
|
561
|
-
if (memberSchema instanceof _NormalizedSchema) {
|
562
|
-
memberSchema.memberName = memberName;
|
563
|
-
memberSchema._isMemberSchema = true;
|
564
|
-
return memberSchema;
|
565
|
-
}
|
566
|
-
return new _NormalizedSchema(memberSchema, memberName);
|
567
|
-
}
|
568
496
|
/**
|
569
497
|
* @returns the underlying non-normalized schema.
|
570
498
|
*/
|
571
499
|
getSchema() {
|
572
500
|
if (this.schema instanceof _NormalizedSchema) {
|
573
|
-
|
501
|
+
Object.assign(this, { schema: this.schema.getSchema() });
|
502
|
+
return this.schema;
|
574
503
|
}
|
575
504
|
if (this.schema instanceof SimpleSchema) {
|
576
505
|
return deref(this.schema.schemaRef);
|
@@ -595,7 +524,7 @@ var NormalizedSchema = class _NormalizedSchema {
|
|
595
524
|
*/
|
596
525
|
getMemberName() {
|
597
526
|
if (!this.isMemberSchema()) {
|
598
|
-
throw new Error(`@smithy/core/schema -
|
527
|
+
throw new Error(`@smithy/core/schema - non-member schema: ${this.getName(true)}`);
|
599
528
|
}
|
600
529
|
return this.memberName;
|
601
530
|
}
|
@@ -622,9 +551,6 @@ var NormalizedSchema = class _NormalizedSchema {
|
|
622
551
|
}
|
623
552
|
return inner instanceof MapSchema;
|
624
553
|
}
|
625
|
-
isDocumentSchema() {
|
626
|
-
return this.getSchema() === SCHEMA.DOCUMENT;
|
627
|
-
}
|
628
554
|
isStructSchema() {
|
629
555
|
const inner = this.getSchema();
|
630
556
|
return inner !== null && typeof inner === "object" && "members" in inner || inner instanceof StructureSchema;
|
@@ -636,6 +562,9 @@ var NormalizedSchema = class _NormalizedSchema {
|
|
636
562
|
const schema = this.getSchema();
|
637
563
|
return typeof schema === "number" && schema >= SCHEMA.TIMESTAMP_DEFAULT && schema <= SCHEMA.TIMESTAMP_EPOCH_SECONDS;
|
638
564
|
}
|
565
|
+
isDocumentSchema() {
|
566
|
+
return this.getSchema() === SCHEMA.DOCUMENT;
|
567
|
+
}
|
639
568
|
isStringSchema() {
|
640
569
|
return this.getSchema() === SCHEMA.STRING;
|
641
570
|
}
|
@@ -675,14 +604,10 @@ var NormalizedSchema = class _NormalizedSchema {
|
|
675
604
|
* This method is cached.
|
676
605
|
*/
|
677
606
|
getMergedTraits() {
|
678
|
-
|
679
|
-
return this.normalizedTraits;
|
680
|
-
}
|
681
|
-
this.normalizedTraits = {
|
607
|
+
return this.normalizedTraits ?? (this.normalizedTraits = {
|
682
608
|
...this.getOwnTraits(),
|
683
609
|
...this.getMemberTraits()
|
684
|
-
};
|
685
|
-
return this.normalizedTraits;
|
610
|
+
});
|
686
611
|
}
|
687
612
|
/**
|
688
613
|
* @returns only the member traits. If the schema is not a member, this returns empty.
|
@@ -704,16 +629,16 @@ var NormalizedSchema = class _NormalizedSchema {
|
|
704
629
|
*/
|
705
630
|
getKeySchema() {
|
706
631
|
if (this.isDocumentSchema()) {
|
707
|
-
return
|
632
|
+
return this.memberFrom([SCHEMA.DOCUMENT, 0], "key");
|
708
633
|
}
|
709
634
|
if (!this.isMapSchema()) {
|
710
|
-
throw new Error(`@smithy/core/schema - cannot get key
|
635
|
+
throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(true)}`);
|
711
636
|
}
|
712
637
|
const schema = this.getSchema();
|
713
638
|
if (typeof schema === "number") {
|
714
|
-
return
|
639
|
+
return this.memberFrom([63 & schema, 0], "key");
|
715
640
|
}
|
716
|
-
return
|
641
|
+
return this.memberFrom([schema.keySchema, 0], "key");
|
717
642
|
}
|
718
643
|
/**
|
719
644
|
* @returns the schema of the map's value or list's member.
|
@@ -725,28 +650,28 @@ var NormalizedSchema = class _NormalizedSchema {
|
|
725
650
|
const schema = this.getSchema();
|
726
651
|
if (typeof schema === "number") {
|
727
652
|
if (this.isMapSchema()) {
|
728
|
-
return
|
653
|
+
return this.memberFrom([63 & schema, 0], "value");
|
729
654
|
} else if (this.isListSchema()) {
|
730
|
-
return
|
655
|
+
return this.memberFrom([63 & schema, 0], "member");
|
731
656
|
}
|
732
657
|
}
|
733
658
|
if (schema && typeof schema === "object") {
|
734
659
|
if (this.isStructSchema()) {
|
735
|
-
throw new Error(`
|
660
|
+
throw new Error(`may not getValueSchema() on structure ${this.getName(true)}`);
|
736
661
|
}
|
737
662
|
const collection = schema;
|
738
663
|
if ("valueSchema" in collection) {
|
739
664
|
if (this.isMapSchema()) {
|
740
|
-
return
|
665
|
+
return this.memberFrom([collection.valueSchema, 0], "value");
|
741
666
|
} else if (this.isListSchema()) {
|
742
|
-
return
|
667
|
+
return this.memberFrom([collection.valueSchema, 0], "member");
|
743
668
|
}
|
744
669
|
}
|
745
670
|
}
|
746
671
|
if (this.isDocumentSchema()) {
|
747
|
-
return
|
672
|
+
return this.memberFrom([SCHEMA.DOCUMENT, 0], "value");
|
748
673
|
}
|
749
|
-
throw new Error(`@smithy/core/schema -
|
674
|
+
throw new Error(`@smithy/core/schema - ${this.getName(true)} has no value member.`);
|
750
675
|
}
|
751
676
|
/**
|
752
677
|
* @param member - to query.
|
@@ -755,7 +680,7 @@ var NormalizedSchema = class _NormalizedSchema {
|
|
755
680
|
hasMemberSchema(member) {
|
756
681
|
if (this.isStructSchema()) {
|
757
682
|
const struct2 = this.getSchema();
|
758
|
-
return
|
683
|
+
return struct2.memberNames.includes(member);
|
759
684
|
}
|
760
685
|
return false;
|
761
686
|
}
|
@@ -770,17 +695,17 @@ var NormalizedSchema = class _NormalizedSchema {
|
|
770
695
|
getMemberSchema(member) {
|
771
696
|
if (this.isStructSchema()) {
|
772
697
|
const struct2 = this.getSchema();
|
773
|
-
if (!(member
|
774
|
-
throw new Error(
|
775
|
-
`@smithy/core/schema - the schema ${this.getName(true)} does not have a member with name=${member}.`
|
776
|
-
);
|
698
|
+
if (!struct2.memberNames.includes(member)) {
|
699
|
+
throw new Error(`@smithy/core/schema - ${this.getName(true)} has no member=${member}.`);
|
777
700
|
}
|
778
|
-
|
701
|
+
const i = struct2.memberNames.indexOf(member);
|
702
|
+
const memberSchema = struct2.memberList[i];
|
703
|
+
return this.memberFrom(Array.isArray(memberSchema) ? memberSchema : [memberSchema, 0], member);
|
779
704
|
}
|
780
705
|
if (this.isDocumentSchema()) {
|
781
|
-
return
|
706
|
+
return this.memberFrom([SCHEMA.DOCUMENT, 0], member);
|
782
707
|
}
|
783
|
-
throw new Error(`@smithy/core/schema -
|
708
|
+
throw new Error(`@smithy/core/schema - ${this.getName(true)} has no members.`);
|
784
709
|
}
|
785
710
|
/**
|
786
711
|
* This can be used for checking the members as a hashmap.
|
@@ -788,22 +713,19 @@ var NormalizedSchema = class _NormalizedSchema {
|
|
788
713
|
*
|
789
714
|
* This does NOT return list and map members, it is only for structures.
|
790
715
|
*
|
716
|
+
* @deprecated use (checked) structIterator instead.
|
717
|
+
*
|
791
718
|
* @returns a map of member names to member schemas (normalized).
|
792
719
|
*/
|
793
720
|
getMemberSchemas() {
|
794
|
-
const
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
}
|
799
|
-
if ("members" in struct2) {
|
800
|
-
const buffer = {};
|
801
|
-
for (const member of struct2.memberNames) {
|
802
|
-
buffer[member] = this.getMemberSchema(member);
|
721
|
+
const buffer = {};
|
722
|
+
try {
|
723
|
+
for (const [k, v] of this.structIterator()) {
|
724
|
+
buffer[k] = v;
|
803
725
|
}
|
804
|
-
|
726
|
+
} catch (ignored) {
|
805
727
|
}
|
806
|
-
return
|
728
|
+
return buffer;
|
807
729
|
}
|
808
730
|
/**
|
809
731
|
* @returns member name of event stream or empty string indicating none exists or this
|
@@ -830,12 +752,24 @@ var NormalizedSchema = class _NormalizedSchema {
|
|
830
752
|
return;
|
831
753
|
}
|
832
754
|
if (!this.isStructSchema()) {
|
833
|
-
throw new Error("@smithy/core/schema - cannot
|
755
|
+
throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
|
834
756
|
}
|
835
757
|
const struct2 = this.getSchema();
|
836
758
|
for (let i = 0; i < struct2.memberNames.length; ++i) {
|
837
|
-
yield [struct2.memberNames[i],
|
759
|
+
yield [struct2.memberNames[i], this.memberFrom([struct2.memberList[i], 0], struct2.memberNames[i])];
|
760
|
+
}
|
761
|
+
}
|
762
|
+
/**
|
763
|
+
* Creates a normalized member schema from the given schema and member name.
|
764
|
+
*/
|
765
|
+
memberFrom(memberSchema, memberName) {
|
766
|
+
if (memberSchema instanceof _NormalizedSchema) {
|
767
|
+
return Object.assign(memberSchema, {
|
768
|
+
memberName,
|
769
|
+
_isMemberSchema: true
|
770
|
+
});
|
838
771
|
}
|
772
|
+
return new _NormalizedSchema(memberSchema, memberName);
|
839
773
|
}
|
840
774
|
/**
|
841
775
|
* @returns a last-resort human-readable name for the schema if it has no other identifiers.
|
@@ -120,14 +120,13 @@ export class HttpBindingProtocol extends HttpProtocol {
|
|
120
120
|
if (traits.httpQueryParams) {
|
121
121
|
for (const [key, val] of Object.entries(data)) {
|
122
122
|
if (!(key in query)) {
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
]), val, query);
|
123
|
+
const valueSchema = ns.getValueSchema();
|
124
|
+
Object.assign(valueSchema.getMergedTraits(), {
|
125
|
+
...traits,
|
126
|
+
httpQuery: key,
|
127
|
+
httpQueryParams: undefined,
|
128
|
+
});
|
129
|
+
this.serializeQuery(valueSchema, val, query);
|
131
130
|
}
|
132
131
|
}
|
133
132
|
return;
|
@@ -219,6 +218,7 @@ export class HttpBindingProtocol extends HttpProtocol {
|
|
219
218
|
if (null != value) {
|
220
219
|
if (memberSchema.isListSchema()) {
|
221
220
|
const headerListValueSchema = memberSchema.getValueSchema();
|
221
|
+
headerListValueSchema.getMergedTraits().httpHeader = key;
|
222
222
|
let sections;
|
223
223
|
if (headerListValueSchema.isTimestampSchema() &&
|
224
224
|
headerListValueSchema.getSchema() === SCHEMA.TIMESTAMP_DEFAULT) {
|
@@ -229,7 +229,7 @@ export class HttpBindingProtocol extends HttpProtocol {
|
|
229
229
|
}
|
230
230
|
const list = [];
|
231
231
|
for (const section of sections) {
|
232
|
-
list.push(await deserializer.read(
|
232
|
+
list.push(await deserializer.read(headerListValueSchema, section.trim()));
|
233
233
|
}
|
234
234
|
dataObject[memberName] = list;
|
235
235
|
}
|
@@ -242,7 +242,9 @@ export class HttpBindingProtocol extends HttpProtocol {
|
|
242
242
|
dataObject[memberName] = {};
|
243
243
|
for (const [header, value] of Object.entries(response.headers)) {
|
244
244
|
if (header.startsWith(memberTraits.httpPrefixHeaders)) {
|
245
|
-
|
245
|
+
const valueSchema = memberSchema.getValueSchema();
|
246
|
+
valueSchema.getMergedTraits().httpHeader = header;
|
247
|
+
dataObject[memberName][header.slice(memberTraits.httpPrefixHeaders.length)] = await deserializer.read(valueSchema, value);
|
246
248
|
}
|
247
249
|
}
|
248
250
|
}
|
@@ -1,27 +1,17 @@
|
|
1
|
-
import {
|
1
|
+
import { Schema } from "./Schema";
|
2
2
|
import { StructureSchema } from "./StructureSchema";
|
3
3
|
export class ErrorSchema extends StructureSchema {
|
4
|
-
constructor(
|
5
|
-
super(
|
6
|
-
this.name = name;
|
7
|
-
this.traits = traits;
|
8
|
-
this.memberNames = memberNames;
|
9
|
-
this.memberList = memberList;
|
10
|
-
this.ctor = ctor;
|
4
|
+
constructor() {
|
5
|
+
super(...arguments);
|
11
6
|
this.symbol = ErrorSchema.symbol;
|
12
7
|
}
|
13
|
-
static [Symbol.hasInstance](lhs) {
|
14
|
-
const isPrototype = ErrorSchema.prototype.isPrototypeOf(lhs);
|
15
|
-
if (!isPrototype && typeof lhs === "object" && lhs !== null) {
|
16
|
-
const err = lhs;
|
17
|
-
return err.symbol === ErrorSchema.symbol;
|
18
|
-
}
|
19
|
-
return isPrototype;
|
20
|
-
}
|
21
|
-
}
|
22
|
-
ErrorSchema.symbol = Symbol.for("@smithy/core/schema::ErrorSchema");
|
23
|
-
export function error(namespace, name, traits = {}, memberNames, memberList, ctor) {
|
24
|
-
const schema = new ErrorSchema(namespace + "#" + name, traits, memberNames, memberList, ctor);
|
25
|
-
TypeRegistry.for(namespace).register(name, schema);
|
26
|
-
return schema;
|
27
8
|
}
|
9
|
+
ErrorSchema.symbol = Symbol.for("@smithy/err");
|
10
|
+
export const error = (namespace, name, traits, memberNames, memberList, ctor) => Schema.assign(new ErrorSchema(), {
|
11
|
+
name,
|
12
|
+
namespace,
|
13
|
+
traits,
|
14
|
+
memberNames,
|
15
|
+
memberList,
|
16
|
+
ctor,
|
17
|
+
});
|