@jjrawlins/cdk-iam-policy-builder-helper 0.0.52 → 0.0.53
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 +3 -3
- package/cdk-iam-policy-builder-helper/jsii/jsii.go +2 -2
- package/cdk-iam-policy-builder-helper/version +1 -1
- package/node_modules/@aws-sdk/client-iam/dist-cjs/index.js +13439 -13574
- package/node_modules/@aws-sdk/client-iam/package.json +5 -5
- package/node_modules/@aws-sdk/client-sso/dist-cjs/index.js +478 -596
- package/node_modules/@aws-sdk/client-sso/package.json +4 -4
- package/node_modules/@aws-sdk/core/dist-cjs/index.js +1969 -6
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/account-id-endpoint/index.js +48 -88
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +35 -74
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js +273 -365
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +1581 -1863
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +2 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsRestJsonProtocol.js +2 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeSerializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/AwsQueryProtocol.js +3 -3
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/QueryShapeSerializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/AwsRestXmlProtocol.js +2 -2
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeSerializer.js +4 -4
- package/node_modules/@aws-sdk/core/dist-types/submodules/account-id-endpoint/AccountIdEndpointModeConfigResolver.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4ASigner.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/AwsSdkSigV4Signer.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4AConfig.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/httpAuthSchemes/aws_sdk/resolveAwsSdkSigV4Config.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/ConfigurableSerdeContext.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonCodec.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonShapeDeserializer.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/JsonShapeSerializer.d.ts +2 -2
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/query/QuerySerializerSettings.d.ts +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/xml/XmlCodec.d.ts +1 -1
- package/node_modules/@aws-sdk/core/package.json +1 -1
- package/node_modules/@aws-sdk/credential-provider-env/dist-cjs/index.js +38 -73
- package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-ini/dist-cjs/index.js +194 -259
- package/node_modules/@aws-sdk/credential-provider-ini/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-node/dist-cjs/index.js +72 -132
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/dist-cjs/index.js +71 -107
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js +176 -249
- package/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-CVy8iqsZ.js +14 -0
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/dist-cjs/index.js +16 -25
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js +170 -203
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/index.js +2 -2
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +583 -858
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +795 -928
- package/node_modules/@aws-sdk/nested-clients/package.json +4 -4
- package/node_modules/@aws-sdk/token-providers/dist-cjs/index.js +147 -222
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js +50 -94
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +1 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +5 -3
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +32 -30
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +133 -202
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +126 -34
- package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +5 -3
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +4 -4
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +3 -3
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +2 -2
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js +19 -17
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js +4 -4
- package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/determineTimestampFormat.js +5 -6
- package/node_modules/@smithy/core/dist-es/submodules/schema/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +82 -176
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/translateTraits.js +22 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/schema-serde-lib/schema-date-utils.js +110 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/value/NumericValue.js +4 -26
- package/node_modules/@smithy/core/dist-types/submodules/schema/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +5 -24
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/sentinels.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/translateTraits.d.ts +7 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/serde/schema-serde-lib/schema-date-utils.d.ts +47 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +5 -24
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/sentinels.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/translateTraits.d.ts +7 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/serde/schema-serde-lib/schema-date-utils.d.ts +47 -0
- package/node_modules/@smithy/core/package.json +3 -3
- package/node_modules/@smithy/fetch-http-handler/package.json +2 -2
- package/node_modules/@smithy/middleware-endpoint/package.json +2 -2
- package/node_modules/@smithy/middleware-retry/package.json +2 -2
- package/node_modules/@smithy/smithy-client/package.json +4 -4
- package/node_modules/@smithy/util-base64/dist-cjs/constants.browser.js +9 -32
- package/node_modules/@smithy/util-base64/dist-es/constants.browser.js +9 -28
- package/node_modules/@smithy/util-base64/dist-types/constants.browser.d.ts +5 -6
- package/node_modules/@smithy/util-base64/dist-types/ts3.4/constants.browser.d.ts +5 -6
- package/node_modules/@smithy/util-base64/package.json +1 -1
- package/node_modules/@smithy/util-body-length-node/dist-cjs/index.js +8 -6
- package/node_modules/@smithy/util-body-length-node/dist-es/calculateBodyLength.js +8 -6
- package/node_modules/@smithy/util-body-length-node/package.json +1 -1
- package/node_modules/@smithy/util-defaults-mode-browser/dist-cjs/resolveDefaultsModeConfig.js +11 -9
- package/node_modules/@smithy/util-defaults-mode-browser/dist-es/resolveDefaultsModeConfig.js +11 -8
- package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -3
- package/node_modules/@smithy/util-defaults-mode-node/package.json +2 -2
- package/node_modules/@smithy/util-stream/dist-cjs/index.js +3 -5
- package/node_modules/@smithy/util-stream/dist-es/blob/Uint8ArrayBlobAdapter.js +3 -5
- package/node_modules/@smithy/util-stream/dist-types/blob/Uint8ArrayBlobAdapter.d.ts +1 -0
- package/node_modules/@smithy/util-stream/dist-types/ts3.4/blob/Uint8ArrayBlobAdapter.d.ts +1 -0
- package/node_modules/@smithy/util-stream/package.json +3 -3
- package/package.json +3 -3
|
@@ -53,10 +53,10 @@ class HttpProtocol {
|
|
|
53
53
|
request.fragment = endpoint.url.hash || void 0;
|
|
54
54
|
request.username = endpoint.url.username || void 0;
|
|
55
55
|
request.password = endpoint.url.password || void 0;
|
|
56
|
+
if (!request.query) {
|
|
57
|
+
request.query = {};
|
|
58
|
+
}
|
|
56
59
|
for (const [k, v] of endpoint.url.searchParams.entries()) {
|
|
57
|
-
if (!request.query) {
|
|
58
|
-
request.query = {};
|
|
59
|
-
}
|
|
60
60
|
request.query[k] = v;
|
|
61
61
|
}
|
|
62
62
|
return request;
|
|
@@ -165,7 +165,7 @@ class HttpBindingProtocol extends HttpProtocol {
|
|
|
165
165
|
if (endpoint) {
|
|
166
166
|
this.updateServiceEndpoint(request, endpoint);
|
|
167
167
|
this.setHostPrefix(request, operationSchema, input);
|
|
168
|
-
const opTraits = schema.
|
|
168
|
+
const opTraits = schema.translateTraits(operationSchema.traits);
|
|
169
169
|
if (opTraits.http) {
|
|
170
170
|
request.method = opTraits.http[0];
|
|
171
171
|
const [path, search] = opTraits.http[1].split("?");
|
|
@@ -289,7 +289,7 @@ class HttpBindingProtocol extends HttpProtocol {
|
|
|
289
289
|
if (response.statusCode >= 300) {
|
|
290
290
|
const bytes = await collectBody(response.body, context);
|
|
291
291
|
if (bytes.byteLength > 0) {
|
|
292
|
-
Object.assign(dataObject, await deserializer.read(
|
|
292
|
+
Object.assign(dataObject, await deserializer.read(15, bytes));
|
|
293
293
|
}
|
|
294
294
|
await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
|
|
295
295
|
throw new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.");
|
|
@@ -355,7 +355,7 @@ class HttpBindingProtocol extends HttpProtocol {
|
|
|
355
355
|
headerListValueSchema.getMergedTraits().httpHeader = key;
|
|
356
356
|
let sections;
|
|
357
357
|
if (headerListValueSchema.isTimestampSchema() &&
|
|
358
|
-
headerListValueSchema.getSchema() ===
|
|
358
|
+
headerListValueSchema.getSchema() === 4) {
|
|
359
359
|
sections = serde.splitEvery(value, ",", 2);
|
|
360
360
|
}
|
|
361
361
|
else {
|
|
@@ -455,7 +455,7 @@ class RpcProtocol extends HttpProtocol {
|
|
|
455
455
|
if (response.statusCode >= 300) {
|
|
456
456
|
const bytes = await collectBody(response.body, context);
|
|
457
457
|
if (bytes.byteLength > 0) {
|
|
458
|
-
Object.assign(dataObject, await deserializer.read(
|
|
458
|
+
Object.assign(dataObject, await deserializer.read(15, bytes));
|
|
459
459
|
}
|
|
460
460
|
await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
|
|
461
461
|
throw new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.");
|
|
@@ -574,18 +574,18 @@ class RequestBuilder {
|
|
|
574
574
|
function determineTimestampFormat(ns, settings) {
|
|
575
575
|
if (settings.timestampFormat.useTrait) {
|
|
576
576
|
if (ns.isTimestampSchema() &&
|
|
577
|
-
(ns.getSchema() ===
|
|
578
|
-
ns.getSchema() ===
|
|
579
|
-
ns.getSchema() ===
|
|
577
|
+
(ns.getSchema() === 5 ||
|
|
578
|
+
ns.getSchema() === 6 ||
|
|
579
|
+
ns.getSchema() === 7)) {
|
|
580
580
|
return ns.getSchema();
|
|
581
581
|
}
|
|
582
582
|
}
|
|
583
583
|
const { httpLabel, httpPrefixHeaders, httpHeader, httpQuery } = ns.getMergedTraits();
|
|
584
584
|
const bindingFormat = settings.httpBindings
|
|
585
585
|
? typeof httpPrefixHeaders === "string" || Boolean(httpHeader)
|
|
586
|
-
?
|
|
586
|
+
? 6
|
|
587
587
|
: Boolean(httpQuery) || Boolean(httpLabel)
|
|
588
|
-
?
|
|
588
|
+
? 5
|
|
589
589
|
: undefined
|
|
590
590
|
: undefined;
|
|
591
591
|
return bindingFormat ?? settings.timestampFormat.default;
|
|
@@ -611,12 +611,12 @@ class FromStringShapeDeserializer {
|
|
|
611
611
|
if (ns.isTimestampSchema()) {
|
|
612
612
|
const format = determineTimestampFormat(ns, this.settings);
|
|
613
613
|
switch (format) {
|
|
614
|
-
case
|
|
615
|
-
return serde.
|
|
616
|
-
case
|
|
617
|
-
return serde.
|
|
618
|
-
case
|
|
619
|
-
return serde.
|
|
614
|
+
case 5:
|
|
615
|
+
return serde._parseRfc3339DateTimeWithOffset(data);
|
|
616
|
+
case 6:
|
|
617
|
+
return serde._parseRfc7231DateTime(data);
|
|
618
|
+
case 7:
|
|
619
|
+
return serde._parseEpochTimestamp(data);
|
|
620
620
|
default:
|
|
621
621
|
console.warn("Missing timestamp format, parsing value with Date constructor:", data);
|
|
622
622
|
return new Date(data);
|
|
@@ -636,15 +636,17 @@ class FromStringShapeDeserializer {
|
|
|
636
636
|
return intermediateValue;
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
639
|
+
if (ns.isNumericSchema()) {
|
|
640
|
+
return Number(data);
|
|
641
|
+
}
|
|
642
|
+
if (ns.isBigIntegerSchema()) {
|
|
643
|
+
return BigInt(data);
|
|
644
|
+
}
|
|
645
|
+
if (ns.isBigDecimalSchema()) {
|
|
646
|
+
return new serde.NumericValue(data, "bigDecimal");
|
|
647
|
+
}
|
|
648
|
+
if (ns.isBooleanSchema()) {
|
|
649
|
+
return String(data).toLowerCase() === "true";
|
|
648
650
|
}
|
|
649
651
|
return data;
|
|
650
652
|
}
|
|
@@ -716,13 +718,13 @@ class ToStringShapeSerializer {
|
|
|
716
718
|
}
|
|
717
719
|
const format = determineTimestampFormat(ns, this.settings);
|
|
718
720
|
switch (format) {
|
|
719
|
-
case
|
|
721
|
+
case 5:
|
|
720
722
|
this.stringBuffer = value.toISOString().replace(".000Z", "Z");
|
|
721
723
|
break;
|
|
722
|
-
case
|
|
724
|
+
case 6:
|
|
723
725
|
this.stringBuffer = serde.dateToUtcString(value);
|
|
724
726
|
break;
|
|
725
|
-
case
|
|
727
|
+
case 7:
|
|
726
728
|
this.stringBuffer = String(value.getTime() / 1000);
|
|
727
729
|
break;
|
|
728
730
|
default:
|
|
@@ -264,36 +264,28 @@ const error = (namespace, name, traits, memberNames, memberList, ctor) => Schema
|
|
|
264
264
|
ctor: null,
|
|
265
265
|
});
|
|
266
266
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
traits;
|
|
289
|
-
symbol = SimpleSchema.symbol;
|
|
267
|
+
function translateTraits(indicator) {
|
|
268
|
+
if (typeof indicator === "object") {
|
|
269
|
+
return indicator;
|
|
270
|
+
}
|
|
271
|
+
indicator = indicator | 0;
|
|
272
|
+
const traits = {};
|
|
273
|
+
let i = 0;
|
|
274
|
+
for (const trait of [
|
|
275
|
+
"httpLabel",
|
|
276
|
+
"idempotent",
|
|
277
|
+
"idempotencyToken",
|
|
278
|
+
"sensitive",
|
|
279
|
+
"httpPayload",
|
|
280
|
+
"httpResponseCode",
|
|
281
|
+
"httpQueryParams",
|
|
282
|
+
]) {
|
|
283
|
+
if (((indicator >> i++) & 1) === 1) {
|
|
284
|
+
traits[trait] = 1;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
return traits;
|
|
290
288
|
}
|
|
291
|
-
const sim = (namespace, name, schemaRef, traits) => Schema.assign(new SimpleSchema(), {
|
|
292
|
-
name,
|
|
293
|
-
namespace,
|
|
294
|
-
traits,
|
|
295
|
-
schemaRef,
|
|
296
|
-
});
|
|
297
289
|
|
|
298
290
|
class NormalizedSchema {
|
|
299
291
|
ref;
|
|
@@ -323,7 +315,7 @@ class NormalizedSchema {
|
|
|
323
315
|
this.memberTraits = {};
|
|
324
316
|
for (let i = traitStack.length - 1; i >= 0; --i) {
|
|
325
317
|
const traitSet = traitStack[i];
|
|
326
|
-
Object.assign(this.memberTraits,
|
|
318
|
+
Object.assign(this.memberTraits, translateTraits(traitSet));
|
|
327
319
|
}
|
|
328
320
|
}
|
|
329
321
|
else {
|
|
@@ -344,8 +336,7 @@ class NormalizedSchema {
|
|
|
344
336
|
else {
|
|
345
337
|
this.traits = 0;
|
|
346
338
|
}
|
|
347
|
-
this.name =
|
|
348
|
-
(this.schema instanceof Schema ? this.schema.getName?.() : void 0) ?? this.memberName ?? this.getSchemaName();
|
|
339
|
+
this.name = (this.schema instanceof Schema ? this.schema.getName?.() : void 0) ?? this.memberName ?? String(schema);
|
|
349
340
|
if (this._isMemberSchema && !memberName) {
|
|
350
341
|
throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`);
|
|
351
342
|
}
|
|
@@ -354,138 +345,90 @@ class NormalizedSchema {
|
|
|
354
345
|
return Schema[Symbol.hasInstance].bind(this)(lhs);
|
|
355
346
|
}
|
|
356
347
|
static of(ref) {
|
|
357
|
-
|
|
358
|
-
|
|
348
|
+
const sc = deref(ref);
|
|
349
|
+
if (sc instanceof NormalizedSchema) {
|
|
350
|
+
return sc;
|
|
359
351
|
}
|
|
360
|
-
if (Array.isArray(
|
|
361
|
-
const [ns, traits] =
|
|
352
|
+
if (Array.isArray(sc)) {
|
|
353
|
+
const [ns, traits] = sc;
|
|
362
354
|
if (ns instanceof NormalizedSchema) {
|
|
363
|
-
Object.assign(ns.getMergedTraits(),
|
|
355
|
+
Object.assign(ns.getMergedTraits(), translateTraits(traits));
|
|
364
356
|
return ns;
|
|
365
357
|
}
|
|
366
358
|
throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(ref, null, 2)}.`);
|
|
367
359
|
}
|
|
368
|
-
return new NormalizedSchema(
|
|
369
|
-
}
|
|
370
|
-
static translateTraits(indicator) {
|
|
371
|
-
if (typeof indicator === "object") {
|
|
372
|
-
return indicator;
|
|
373
|
-
}
|
|
374
|
-
indicator = indicator | 0;
|
|
375
|
-
const traits = {};
|
|
376
|
-
let i = 0;
|
|
377
|
-
for (const trait of [
|
|
378
|
-
"httpLabel",
|
|
379
|
-
"idempotent",
|
|
380
|
-
"idempotencyToken",
|
|
381
|
-
"sensitive",
|
|
382
|
-
"httpPayload",
|
|
383
|
-
"httpResponseCode",
|
|
384
|
-
"httpQueryParams",
|
|
385
|
-
]) {
|
|
386
|
-
if (((indicator >> i++) & 1) === 1) {
|
|
387
|
-
traits[trait] = 1;
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
return traits;
|
|
360
|
+
return new NormalizedSchema(sc);
|
|
391
361
|
}
|
|
392
362
|
getSchema() {
|
|
393
|
-
|
|
394
|
-
Object.assign(this, { schema: this.schema.getSchema() });
|
|
395
|
-
return this.schema;
|
|
396
|
-
}
|
|
397
|
-
if (this.schema instanceof SimpleSchema) {
|
|
398
|
-
return deref(this.schema.schemaRef);
|
|
399
|
-
}
|
|
400
|
-
return deref(this.schema);
|
|
363
|
+
return deref(this.schema?.schemaRef ?? this.schema);
|
|
401
364
|
}
|
|
402
365
|
getName(withNamespace = false) {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
return this.name || undefined;
|
|
366
|
+
const { name } = this;
|
|
367
|
+
const short = !withNamespace && name && name.includes("#");
|
|
368
|
+
return short ? name.split("#")[1] : name || undefined;
|
|
409
369
|
}
|
|
410
370
|
getMemberName() {
|
|
411
|
-
if (!this.isMemberSchema()) {
|
|
412
|
-
throw new Error(`@smithy/core/schema - non-member schema: ${this.getName(true)}`);
|
|
413
|
-
}
|
|
414
371
|
return this.memberName;
|
|
415
372
|
}
|
|
416
373
|
isMemberSchema() {
|
|
417
374
|
return this._isMemberSchema;
|
|
418
375
|
}
|
|
419
|
-
isUnitSchema() {
|
|
420
|
-
return this.getSchema() === "unit";
|
|
421
|
-
}
|
|
422
376
|
isListSchema() {
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
return inner instanceof ListSchema;
|
|
377
|
+
const sc = this.getSchema();
|
|
378
|
+
return typeof sc === "number"
|
|
379
|
+
? sc >= 64 && sc < 128
|
|
380
|
+
: sc instanceof ListSchema;
|
|
428
381
|
}
|
|
429
382
|
isMapSchema() {
|
|
430
|
-
const
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
return inner instanceof MapSchema;
|
|
383
|
+
const sc = this.getSchema();
|
|
384
|
+
return typeof sc === "number"
|
|
385
|
+
? sc >= 128 && sc <= 0b1111_1111
|
|
386
|
+
: sc instanceof MapSchema;
|
|
435
387
|
}
|
|
436
388
|
isStructSchema() {
|
|
437
|
-
const
|
|
438
|
-
return (
|
|
389
|
+
const sc = this.getSchema();
|
|
390
|
+
return (sc !== null && typeof sc === "object" && "members" in sc) || sc instanceof StructureSchema;
|
|
439
391
|
}
|
|
440
392
|
isBlobSchema() {
|
|
441
|
-
|
|
393
|
+
const sc = this.getSchema();
|
|
394
|
+
return sc === 21 || sc === 42;
|
|
442
395
|
}
|
|
443
396
|
isTimestampSchema() {
|
|
444
|
-
const
|
|
445
|
-
return typeof
|
|
397
|
+
const sc = this.getSchema();
|
|
398
|
+
return (typeof sc === "number" &&
|
|
399
|
+
sc >= 4 &&
|
|
400
|
+
sc <= 7);
|
|
401
|
+
}
|
|
402
|
+
isUnitSchema() {
|
|
403
|
+
return this.getSchema() === "unit";
|
|
446
404
|
}
|
|
447
405
|
isDocumentSchema() {
|
|
448
|
-
return this.getSchema() ===
|
|
406
|
+
return this.getSchema() === 15;
|
|
449
407
|
}
|
|
450
408
|
isStringSchema() {
|
|
451
|
-
return this.getSchema() ===
|
|
409
|
+
return this.getSchema() === 0;
|
|
452
410
|
}
|
|
453
411
|
isBooleanSchema() {
|
|
454
|
-
return this.getSchema() ===
|
|
412
|
+
return this.getSchema() === 2;
|
|
455
413
|
}
|
|
456
414
|
isNumericSchema() {
|
|
457
|
-
return this.getSchema() ===
|
|
415
|
+
return this.getSchema() === 1;
|
|
458
416
|
}
|
|
459
417
|
isBigIntegerSchema() {
|
|
460
|
-
return this.getSchema() ===
|
|
418
|
+
return this.getSchema() === 17;
|
|
461
419
|
}
|
|
462
420
|
isBigDecimalSchema() {
|
|
463
|
-
return this.getSchema() ===
|
|
421
|
+
return this.getSchema() === 19;
|
|
464
422
|
}
|
|
465
423
|
isStreaming() {
|
|
466
|
-
const streaming =
|
|
467
|
-
|
|
468
|
-
return true;
|
|
469
|
-
}
|
|
470
|
-
return this.getSchema() === SCHEMA.STREAMING_BLOB;
|
|
424
|
+
const { streaming } = this.getMergedTraits();
|
|
425
|
+
return !!streaming || this.getSchema() === 42;
|
|
471
426
|
}
|
|
472
427
|
isIdempotencyToken() {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
if (typeof traits === "number") {
|
|
478
|
-
if ((traits & 0b0100) === 0b0100) {
|
|
479
|
-
return true;
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
else if (typeof traits === "object") {
|
|
483
|
-
if (!!traits.idempotencyToken) {
|
|
484
|
-
return true;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
return false;
|
|
428
|
+
const match = (traits) => (traits & 0b0100) === 0b0100 ||
|
|
429
|
+
!!traits?.idempotencyToken;
|
|
430
|
+
const { normalizedTraits, traits, memberTraits } = this;
|
|
431
|
+
return match(normalizedTraits) || match(traits) || match(memberTraits);
|
|
489
432
|
}
|
|
490
433
|
getMergedTraits() {
|
|
491
434
|
return (this.normalizedTraits ??
|
|
@@ -495,74 +438,48 @@ class NormalizedSchema {
|
|
|
495
438
|
}));
|
|
496
439
|
}
|
|
497
440
|
getMemberTraits() {
|
|
498
|
-
return
|
|
441
|
+
return translateTraits(this.memberTraits);
|
|
499
442
|
}
|
|
500
443
|
getOwnTraits() {
|
|
501
|
-
return
|
|
444
|
+
return translateTraits(this.traits);
|
|
502
445
|
}
|
|
503
446
|
getKeySchema() {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
}
|
|
507
|
-
if (!this.isMapSchema()) {
|
|
447
|
+
const [isDoc, isMap] = [this.isDocumentSchema(), this.isMapSchema()];
|
|
448
|
+
if (!isDoc && !isMap) {
|
|
508
449
|
throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(true)}`);
|
|
509
450
|
}
|
|
510
451
|
const schema = this.getSchema();
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
return
|
|
452
|
+
const memberSchema = isDoc
|
|
453
|
+
? 15
|
|
454
|
+
: schema?.keySchema ?? 0;
|
|
455
|
+
return member([memberSchema, 0], "key");
|
|
515
456
|
}
|
|
516
457
|
getValueSchema() {
|
|
517
|
-
const
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
if (
|
|
527
|
-
|
|
528
|
-
throw new Error(`may not getValueSchema() on structure ${this.getName(true)}`);
|
|
529
|
-
}
|
|
530
|
-
const collection = schema;
|
|
531
|
-
if ("valueSchema" in collection) {
|
|
532
|
-
if (this.isMapSchema()) {
|
|
533
|
-
return this.memberFrom([collection.valueSchema, 0], "value");
|
|
534
|
-
}
|
|
535
|
-
else if (this.isListSchema()) {
|
|
536
|
-
return this.memberFrom([collection.valueSchema, 0], "member");
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
if (this.isDocumentSchema()) {
|
|
541
|
-
return this.memberFrom([SCHEMA.DOCUMENT, 0], "value");
|
|
458
|
+
const sc = this.getSchema();
|
|
459
|
+
const [isDoc, isMap, isList] = [this.isDocumentSchema(), this.isMapSchema(), this.isListSchema()];
|
|
460
|
+
const memberSchema = typeof sc === "number"
|
|
461
|
+
? 0b0011_1111 & sc
|
|
462
|
+
: sc && typeof sc === "object" && (isMap || isList)
|
|
463
|
+
? sc.valueSchema
|
|
464
|
+
: isDoc
|
|
465
|
+
? 15
|
|
466
|
+
: void 0;
|
|
467
|
+
if (memberSchema != null) {
|
|
468
|
+
return member([memberSchema, 0], isMap ? "value" : "member");
|
|
542
469
|
}
|
|
543
470
|
throw new Error(`@smithy/core/schema - ${this.getName(true)} has no value member.`);
|
|
544
471
|
}
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
}
|
|
550
|
-
return false;
|
|
551
|
-
}
|
|
552
|
-
getMemberSchema(member) {
|
|
553
|
-
if (this.isStructSchema()) {
|
|
554
|
-
const struct = this.getSchema();
|
|
555
|
-
if (!struct.memberNames.includes(member)) {
|
|
556
|
-
throw new Error(`@smithy/core/schema - ${this.getName(true)} has no member=${member}.`);
|
|
557
|
-
}
|
|
558
|
-
const i = struct.memberNames.indexOf(member);
|
|
472
|
+
getMemberSchema(memberName) {
|
|
473
|
+
const struct = this.getSchema();
|
|
474
|
+
if (this.isStructSchema() && struct.memberNames.includes(memberName)) {
|
|
475
|
+
const i = struct.memberNames.indexOf(memberName);
|
|
559
476
|
const memberSchema = struct.memberList[i];
|
|
560
|
-
return
|
|
477
|
+
return member(Array.isArray(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
|
|
561
478
|
}
|
|
562
479
|
if (this.isDocumentSchema()) {
|
|
563
|
-
return
|
|
480
|
+
return member([15, 0], memberName);
|
|
564
481
|
}
|
|
565
|
-
throw new Error(`@smithy/core/schema - ${this.getName(true)} has no
|
|
482
|
+
throw new Error(`@smithy/core/schema - ${this.getName(true)} has no no member=${memberName}.`);
|
|
566
483
|
}
|
|
567
484
|
getMemberSchemas() {
|
|
568
485
|
const buffer = {};
|
|
@@ -593,39 +510,52 @@ class NormalizedSchema {
|
|
|
593
510
|
}
|
|
594
511
|
const struct = this.getSchema();
|
|
595
512
|
for (let i = 0; i < struct.memberNames.length; ++i) {
|
|
596
|
-
yield [struct.memberNames[i],
|
|
513
|
+
yield [struct.memberNames[i], member([struct.memberList[i], 0], struct.memberNames[i])];
|
|
597
514
|
}
|
|
598
515
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
}
|
|
606
|
-
return new NormalizedSchema(memberSchema, memberName);
|
|
607
|
-
}
|
|
608
|
-
getSchemaName() {
|
|
609
|
-
const schema = this.getSchema();
|
|
610
|
-
if (typeof schema === "number") {
|
|
611
|
-
const _schema = 0b0011_1111 & schema;
|
|
612
|
-
const container = 0b1100_0000 & schema;
|
|
613
|
-
const type = Object.entries(SCHEMA).find(([, value]) => {
|
|
614
|
-
return value === _schema;
|
|
615
|
-
})?.[0] ?? "Unknown";
|
|
616
|
-
switch (container) {
|
|
617
|
-
case SCHEMA.MAP_MODIFIER:
|
|
618
|
-
return `${type}Map`;
|
|
619
|
-
case SCHEMA.LIST_MODIFIER:
|
|
620
|
-
return `${type}List`;
|
|
621
|
-
case 0:
|
|
622
|
-
return type;
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
return "Unknown";
|
|
516
|
+
}
|
|
517
|
+
function member(memberSchema, memberName) {
|
|
518
|
+
if (memberSchema instanceof NormalizedSchema) {
|
|
519
|
+
return Object.assign(memberSchema, {
|
|
520
|
+
memberName,
|
|
521
|
+
_isMemberSchema: true,
|
|
522
|
+
});
|
|
626
523
|
}
|
|
524
|
+
const internalCtorAccess = NormalizedSchema;
|
|
525
|
+
return new internalCtorAccess(memberSchema, memberName);
|
|
627
526
|
}
|
|
628
527
|
|
|
528
|
+
class SimpleSchema extends Schema {
|
|
529
|
+
static symbol = Symbol.for("@smithy/sim");
|
|
530
|
+
name;
|
|
531
|
+
schemaRef;
|
|
532
|
+
traits;
|
|
533
|
+
symbol = SimpleSchema.symbol;
|
|
534
|
+
}
|
|
535
|
+
const sim = (namespace, name, schemaRef, traits) => Schema.assign(new SimpleSchema(), {
|
|
536
|
+
name,
|
|
537
|
+
namespace,
|
|
538
|
+
traits,
|
|
539
|
+
schemaRef,
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
const SCHEMA = {
|
|
543
|
+
BLOB: 0b0001_0101,
|
|
544
|
+
STREAMING_BLOB: 0b0010_1010,
|
|
545
|
+
BOOLEAN: 0b0000_0010,
|
|
546
|
+
STRING: 0b0000_0000,
|
|
547
|
+
NUMERIC: 0b0000_0001,
|
|
548
|
+
BIG_INTEGER: 0b0001_0001,
|
|
549
|
+
BIG_DECIMAL: 0b0001_0011,
|
|
550
|
+
DOCUMENT: 0b0000_1111,
|
|
551
|
+
TIMESTAMP_DEFAULT: 0b0000_0100,
|
|
552
|
+
TIMESTAMP_DATE_TIME: 0b0000_0101,
|
|
553
|
+
TIMESTAMP_HTTP_DATE: 0b0000_0110,
|
|
554
|
+
TIMESTAMP_EPOCH_SECONDS: 0b0000_0111,
|
|
555
|
+
LIST_MODIFIER: 0b0100_0000,
|
|
556
|
+
MAP_MODIFIER: 0b1000_0000,
|
|
557
|
+
};
|
|
558
|
+
|
|
629
559
|
exports.ErrorSchema = ErrorSchema;
|
|
630
560
|
exports.ListSchema = ListSchema;
|
|
631
561
|
exports.MapSchema = MapSchema;
|
|
@@ -646,3 +576,4 @@ exports.op = op;
|
|
|
646
576
|
exports.serializerMiddlewareOption = serializerMiddlewareOption;
|
|
647
577
|
exports.sim = sim;
|
|
648
578
|
exports.struct = struct;
|
|
579
|
+
exports.translateTraits = translateTraits;
|