@jjrawlins/cdk-iam-policy-builder-helper 0.0.52 → 0.0.54
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 +6 -6
- package/node_modules/@aws-sdk/client-sso/dist-cjs/index.js +478 -596
- package/node_modules/@aws-sdk/client-sso/package.json +5 -5
- 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 +5 -5
- 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-browser/README.md +22 -3
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-cjs/createUserAgentStringParsingProvider.js +57 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-cjs/index.js +39 -8
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-es/createUserAgentStringParsingProvider.js +20 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-es/index.js +37 -6
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/createUserAgentStringParsingProvider.d.ts +14 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/index.d.ts +14 -4
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/index.native.d.ts +4 -3
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/ts3.4/createUserAgentStringParsingProvider.d.ts +9 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/ts3.4/index.d.ts +5 -0
- package/node_modules/@aws-sdk/util-user-agent-browser/package.json +1 -1
- package/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js +50 -94
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/crt-availability.d.ts +1 -2
- package/node_modules/@aws-sdk/util-user-agent-node/dist-types/defaultUserAgent.d.ts +10 -5
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NormalizedSchema } from "@smithy/core/schema";
|
|
2
|
-
import {
|
|
2
|
+
import { _parseEpochTimestamp, generateIdempotencyToken } from "@smithy/core/serde";
|
|
3
3
|
import { fromBase64 } from "@smithy/util-base64";
|
|
4
4
|
import { cbor } from "./cbor";
|
|
5
5
|
import { dateToTag } from "./parseCborBody";
|
|
@@ -110,7 +110,7 @@ export class CborShapeDeserializer {
|
|
|
110
110
|
readValue(_schema, value) {
|
|
111
111
|
const ns = NormalizedSchema.of(_schema);
|
|
112
112
|
if (ns.isTimestampSchema() && typeof value === "number") {
|
|
113
|
-
return
|
|
113
|
+
return _parseEpochTimestamp(value);
|
|
114
114
|
}
|
|
115
115
|
if (ns.isBlobSchema()) {
|
|
116
116
|
if (typeof value === "string") {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SCHEMA } from "@smithy/core/schema";
|
|
2
1
|
import { fromUtf8 } from "@smithy/util-utf8";
|
|
3
2
|
export class EventStreamSerde {
|
|
4
3
|
marshaller;
|
|
@@ -128,12 +127,15 @@ export class EventStreamSerde {
|
|
|
128
127
|
let eventType = unionMember;
|
|
129
128
|
let explicitPayloadMember = null;
|
|
130
129
|
let explicitPayloadContentType;
|
|
131
|
-
const isKnownSchema =
|
|
130
|
+
const isKnownSchema = (() => {
|
|
131
|
+
const struct = unionSchema.getSchema();
|
|
132
|
+
return struct.memberNames.includes(unionMember);
|
|
133
|
+
})();
|
|
132
134
|
const additionalHeaders = {};
|
|
133
135
|
if (!isKnownSchema) {
|
|
134
136
|
const [type, value] = event[unionMember];
|
|
135
137
|
eventType = type;
|
|
136
|
-
serializer.write(
|
|
138
|
+
serializer.write(15, value);
|
|
137
139
|
}
|
|
138
140
|
else {
|
|
139
141
|
const eventSchema = unionSchema.getMemberSchema(unionMember);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NormalizedSchema,
|
|
1
|
+
import { NormalizedSchema, translateTraits } from "@smithy/core/schema";
|
|
2
2
|
import { splitEvery, splitHeader } from "@smithy/core/serde";
|
|
3
3
|
import { HttpRequest } from "@smithy/protocol-http";
|
|
4
4
|
import { sdkStreamMixin } from "@smithy/util-stream";
|
|
@@ -31,7 +31,7 @@ export class HttpBindingProtocol extends HttpProtocol {
|
|
|
31
31
|
if (endpoint) {
|
|
32
32
|
this.updateServiceEndpoint(request, endpoint);
|
|
33
33
|
this.setHostPrefix(request, operationSchema, input);
|
|
34
|
-
const opTraits =
|
|
34
|
+
const opTraits = translateTraits(operationSchema.traits);
|
|
35
35
|
if (opTraits.http) {
|
|
36
36
|
request.method = opTraits.http[0];
|
|
37
37
|
const [path, search] = opTraits.http[1].split("?");
|
|
@@ -155,7 +155,7 @@ export class HttpBindingProtocol extends HttpProtocol {
|
|
|
155
155
|
if (response.statusCode >= 300) {
|
|
156
156
|
const bytes = await collectBody(response.body, context);
|
|
157
157
|
if (bytes.byteLength > 0) {
|
|
158
|
-
Object.assign(dataObject, await deserializer.read(
|
|
158
|
+
Object.assign(dataObject, await deserializer.read(15, bytes));
|
|
159
159
|
}
|
|
160
160
|
await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
|
|
161
161
|
throw new Error("@smithy/core/protocols - HTTP Protocol error handler failed to throw.");
|
|
@@ -221,7 +221,7 @@ export class HttpBindingProtocol extends HttpProtocol {
|
|
|
221
221
|
headerListValueSchema.getMergedTraits().httpHeader = key;
|
|
222
222
|
let sections;
|
|
223
223
|
if (headerListValueSchema.isTimestampSchema() &&
|
|
224
|
-
headerListValueSchema.getSchema() ===
|
|
224
|
+
headerListValueSchema.getSchema() === 4) {
|
|
225
225
|
sections = splitEvery(value, ",", 2);
|
|
226
226
|
}
|
|
227
227
|
else {
|
|
@@ -29,10 +29,10 @@ export class HttpProtocol {
|
|
|
29
29
|
request.fragment = endpoint.url.hash || void 0;
|
|
30
30
|
request.username = endpoint.url.username || void 0;
|
|
31
31
|
request.password = endpoint.url.password || void 0;
|
|
32
|
+
if (!request.query) {
|
|
33
|
+
request.query = {};
|
|
34
|
+
}
|
|
32
35
|
for (const [k, v] of endpoint.url.searchParams.entries()) {
|
|
33
|
-
if (!request.query) {
|
|
34
|
-
request.query = {};
|
|
35
|
-
}
|
|
36
36
|
request.query[k] = v;
|
|
37
37
|
}
|
|
38
38
|
return request;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NormalizedSchema
|
|
1
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
|
2
2
|
import { HttpRequest } from "@smithy/protocol-http";
|
|
3
3
|
import { collectBody } from "./collect-stream-body";
|
|
4
4
|
import { HttpProtocol } from "./HttpProtocol";
|
|
@@ -64,7 +64,7 @@ export class RpcProtocol extends HttpProtocol {
|
|
|
64
64
|
if (response.statusCode >= 300) {
|
|
65
65
|
const bytes = await collectBody(response.body, context);
|
|
66
66
|
if (bytes.byteLength > 0) {
|
|
67
|
-
Object.assign(dataObject, await deserializer.read(
|
|
67
|
+
Object.assign(dataObject, await deserializer.read(15, bytes));
|
|
68
68
|
}
|
|
69
69
|
await this.handleError(operationSchema, context, response, dataObject, this.deserializeMetadata(response));
|
|
70
70
|
throw new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.");
|
package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NormalizedSchema
|
|
2
|
-
import {
|
|
1
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
|
2
|
+
import { _parseEpochTimestamp, _parseRfc3339DateTimeWithOffset, _parseRfc7231DateTime, LazyJsonString, NumericValue, splitHeader, } from "@smithy/core/serde";
|
|
3
3
|
import { fromBase64 } from "@smithy/util-base64";
|
|
4
4
|
import { toUtf8 } from "@smithy/util-utf8";
|
|
5
5
|
import { determineTimestampFormat } from "./determineTimestampFormat";
|
|
@@ -23,12 +23,12 @@ export class FromStringShapeDeserializer {
|
|
|
23
23
|
if (ns.isTimestampSchema()) {
|
|
24
24
|
const format = determineTimestampFormat(ns, this.settings);
|
|
25
25
|
switch (format) {
|
|
26
|
-
case
|
|
27
|
-
return
|
|
28
|
-
case
|
|
29
|
-
return
|
|
30
|
-
case
|
|
31
|
-
return
|
|
26
|
+
case 5:
|
|
27
|
+
return _parseRfc3339DateTimeWithOffset(data);
|
|
28
|
+
case 6:
|
|
29
|
+
return _parseRfc7231DateTime(data);
|
|
30
|
+
case 7:
|
|
31
|
+
return _parseEpochTimestamp(data);
|
|
32
32
|
default:
|
|
33
33
|
console.warn("Missing timestamp format, parsing value with Date constructor:", data);
|
|
34
34
|
return new Date(data);
|
|
@@ -48,15 +48,17 @@ export class FromStringShapeDeserializer {
|
|
|
48
48
|
return intermediateValue;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
if (ns.isNumericSchema()) {
|
|
52
|
+
return Number(data);
|
|
53
|
+
}
|
|
54
|
+
if (ns.isBigIntegerSchema()) {
|
|
55
|
+
return BigInt(data);
|
|
56
|
+
}
|
|
57
|
+
if (ns.isBigDecimalSchema()) {
|
|
58
|
+
return new NumericValue(data, "bigDecimal");
|
|
59
|
+
}
|
|
60
|
+
if (ns.isBooleanSchema()) {
|
|
61
|
+
return String(data).toLowerCase() === "true";
|
|
60
62
|
}
|
|
61
63
|
return data;
|
|
62
64
|
}
|
package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NormalizedSchema
|
|
1
|
+
import { NormalizedSchema } from "@smithy/core/schema";
|
|
2
2
|
import { dateToUtcString, LazyJsonString, quoteHeader } from "@smithy/core/serde";
|
|
3
3
|
import { toBase64 } from "@smithy/util-base64";
|
|
4
4
|
import { determineTimestampFormat } from "./determineTimestampFormat";
|
|
@@ -26,13 +26,13 @@ export class ToStringShapeSerializer {
|
|
|
26
26
|
}
|
|
27
27
|
const format = determineTimestampFormat(ns, this.settings);
|
|
28
28
|
switch (format) {
|
|
29
|
-
case
|
|
29
|
+
case 5:
|
|
30
30
|
this.stringBuffer = value.toISOString().replace(".000Z", "Z");
|
|
31
31
|
break;
|
|
32
|
-
case
|
|
32
|
+
case 6:
|
|
33
33
|
this.stringBuffer = dateToUtcString(value);
|
|
34
34
|
break;
|
|
35
|
-
case
|
|
35
|
+
case 7:
|
|
36
36
|
this.stringBuffer = String(value.getTime() / 1000);
|
|
37
37
|
break;
|
|
38
38
|
default:
|
package/node_modules/@smithy/core/dist-es/submodules/protocols/serde/determineTimestampFormat.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { SCHEMA } from "@smithy/core/schema";
|
|
2
1
|
export function determineTimestampFormat(ns, settings) {
|
|
3
2
|
if (settings.timestampFormat.useTrait) {
|
|
4
3
|
if (ns.isTimestampSchema() &&
|
|
5
|
-
(ns.getSchema() ===
|
|
6
|
-
ns.getSchema() ===
|
|
7
|
-
ns.getSchema() ===
|
|
4
|
+
(ns.getSchema() === 5 ||
|
|
5
|
+
ns.getSchema() === 6 ||
|
|
6
|
+
ns.getSchema() === 7)) {
|
|
8
7
|
return ns.getSchema();
|
|
9
8
|
}
|
|
10
9
|
}
|
|
11
10
|
const { httpLabel, httpPrefixHeaders, httpHeader, httpQuery } = ns.getMergedTraits();
|
|
12
11
|
const bindingFormat = settings.httpBindings
|
|
13
12
|
? typeof httpPrefixHeaders === "string" || Boolean(httpHeader)
|
|
14
|
-
?
|
|
13
|
+
? 6
|
|
15
14
|
: Boolean(httpQuery) || Boolean(httpLabel)
|
|
16
|
-
?
|
|
15
|
+
? 5
|
|
17
16
|
: undefined
|
|
18
17
|
: undefined;
|
|
19
18
|
return bindingFormat ?? settings.timestampFormat.default;
|
|
@@ -2,9 +2,8 @@ import { deref } from "../deref";
|
|
|
2
2
|
import { ListSchema } from "./ListSchema";
|
|
3
3
|
import { MapSchema } from "./MapSchema";
|
|
4
4
|
import { Schema } from "./Schema";
|
|
5
|
-
import { SCHEMA } from "./sentinels";
|
|
6
|
-
import { SimpleSchema } from "./SimpleSchema";
|
|
7
5
|
import { StructureSchema } from "./StructureSchema";
|
|
6
|
+
import { translateTraits } from "./translateTraits";
|
|
8
7
|
export class NormalizedSchema {
|
|
9
8
|
ref;
|
|
10
9
|
memberName;
|
|
@@ -33,7 +32,7 @@ export class NormalizedSchema {
|
|
|
33
32
|
this.memberTraits = {};
|
|
34
33
|
for (let i = traitStack.length - 1; i >= 0; --i) {
|
|
35
34
|
const traitSet = traitStack[i];
|
|
36
|
-
Object.assign(this.memberTraits,
|
|
35
|
+
Object.assign(this.memberTraits, translateTraits(traitSet));
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
38
|
else {
|
|
@@ -54,8 +53,7 @@ export class NormalizedSchema {
|
|
|
54
53
|
else {
|
|
55
54
|
this.traits = 0;
|
|
56
55
|
}
|
|
57
|
-
this.name =
|
|
58
|
-
(this.schema instanceof Schema ? this.schema.getName?.() : void 0) ?? this.memberName ?? this.getSchemaName();
|
|
56
|
+
this.name = (this.schema instanceof Schema ? this.schema.getName?.() : void 0) ?? this.memberName ?? String(schema);
|
|
59
57
|
if (this._isMemberSchema && !memberName) {
|
|
60
58
|
throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`);
|
|
61
59
|
}
|
|
@@ -64,138 +62,90 @@ export class NormalizedSchema {
|
|
|
64
62
|
return Schema[Symbol.hasInstance].bind(this)(lhs);
|
|
65
63
|
}
|
|
66
64
|
static of(ref) {
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
const sc = deref(ref);
|
|
66
|
+
if (sc instanceof NormalizedSchema) {
|
|
67
|
+
return sc;
|
|
69
68
|
}
|
|
70
|
-
if (Array.isArray(
|
|
71
|
-
const [ns, traits] =
|
|
69
|
+
if (Array.isArray(sc)) {
|
|
70
|
+
const [ns, traits] = sc;
|
|
72
71
|
if (ns instanceof NormalizedSchema) {
|
|
73
|
-
Object.assign(ns.getMergedTraits(),
|
|
72
|
+
Object.assign(ns.getMergedTraits(), translateTraits(traits));
|
|
74
73
|
return ns;
|
|
75
74
|
}
|
|
76
75
|
throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(ref, null, 2)}.`);
|
|
77
76
|
}
|
|
78
|
-
return new NormalizedSchema(
|
|
79
|
-
}
|
|
80
|
-
static translateTraits(indicator) {
|
|
81
|
-
if (typeof indicator === "object") {
|
|
82
|
-
return indicator;
|
|
83
|
-
}
|
|
84
|
-
indicator = indicator | 0;
|
|
85
|
-
const traits = {};
|
|
86
|
-
let i = 0;
|
|
87
|
-
for (const trait of [
|
|
88
|
-
"httpLabel",
|
|
89
|
-
"idempotent",
|
|
90
|
-
"idempotencyToken",
|
|
91
|
-
"sensitive",
|
|
92
|
-
"httpPayload",
|
|
93
|
-
"httpResponseCode",
|
|
94
|
-
"httpQueryParams",
|
|
95
|
-
]) {
|
|
96
|
-
if (((indicator >> i++) & 1) === 1) {
|
|
97
|
-
traits[trait] = 1;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return traits;
|
|
77
|
+
return new NormalizedSchema(sc);
|
|
101
78
|
}
|
|
102
79
|
getSchema() {
|
|
103
|
-
|
|
104
|
-
Object.assign(this, { schema: this.schema.getSchema() });
|
|
105
|
-
return this.schema;
|
|
106
|
-
}
|
|
107
|
-
if (this.schema instanceof SimpleSchema) {
|
|
108
|
-
return deref(this.schema.schemaRef);
|
|
109
|
-
}
|
|
110
|
-
return deref(this.schema);
|
|
80
|
+
return deref(this.schema?.schemaRef ?? this.schema);
|
|
111
81
|
}
|
|
112
82
|
getName(withNamespace = false) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return this.name || undefined;
|
|
83
|
+
const { name } = this;
|
|
84
|
+
const short = !withNamespace && name && name.includes("#");
|
|
85
|
+
return short ? name.split("#")[1] : name || undefined;
|
|
119
86
|
}
|
|
120
87
|
getMemberName() {
|
|
121
|
-
if (!this.isMemberSchema()) {
|
|
122
|
-
throw new Error(`@smithy/core/schema - non-member schema: ${this.getName(true)}`);
|
|
123
|
-
}
|
|
124
88
|
return this.memberName;
|
|
125
89
|
}
|
|
126
90
|
isMemberSchema() {
|
|
127
91
|
return this._isMemberSchema;
|
|
128
92
|
}
|
|
129
|
-
isUnitSchema() {
|
|
130
|
-
return this.getSchema() === "unit";
|
|
131
|
-
}
|
|
132
93
|
isListSchema() {
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return inner instanceof ListSchema;
|
|
94
|
+
const sc = this.getSchema();
|
|
95
|
+
return typeof sc === "number"
|
|
96
|
+
? sc >= 64 && sc < 128
|
|
97
|
+
: sc instanceof ListSchema;
|
|
138
98
|
}
|
|
139
99
|
isMapSchema() {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return inner instanceof MapSchema;
|
|
100
|
+
const sc = this.getSchema();
|
|
101
|
+
return typeof sc === "number"
|
|
102
|
+
? sc >= 128 && sc <= 0b1111_1111
|
|
103
|
+
: sc instanceof MapSchema;
|
|
145
104
|
}
|
|
146
105
|
isStructSchema() {
|
|
147
|
-
const
|
|
148
|
-
return (
|
|
106
|
+
const sc = this.getSchema();
|
|
107
|
+
return (sc !== null && typeof sc === "object" && "members" in sc) || sc instanceof StructureSchema;
|
|
149
108
|
}
|
|
150
109
|
isBlobSchema() {
|
|
151
|
-
|
|
110
|
+
const sc = this.getSchema();
|
|
111
|
+
return sc === 21 || sc === 42;
|
|
152
112
|
}
|
|
153
113
|
isTimestampSchema() {
|
|
154
|
-
const
|
|
155
|
-
return typeof
|
|
114
|
+
const sc = this.getSchema();
|
|
115
|
+
return (typeof sc === "number" &&
|
|
116
|
+
sc >= 4 &&
|
|
117
|
+
sc <= 7);
|
|
118
|
+
}
|
|
119
|
+
isUnitSchema() {
|
|
120
|
+
return this.getSchema() === "unit";
|
|
156
121
|
}
|
|
157
122
|
isDocumentSchema() {
|
|
158
|
-
return this.getSchema() ===
|
|
123
|
+
return this.getSchema() === 15;
|
|
159
124
|
}
|
|
160
125
|
isStringSchema() {
|
|
161
|
-
return this.getSchema() ===
|
|
126
|
+
return this.getSchema() === 0;
|
|
162
127
|
}
|
|
163
128
|
isBooleanSchema() {
|
|
164
|
-
return this.getSchema() ===
|
|
129
|
+
return this.getSchema() === 2;
|
|
165
130
|
}
|
|
166
131
|
isNumericSchema() {
|
|
167
|
-
return this.getSchema() ===
|
|
132
|
+
return this.getSchema() === 1;
|
|
168
133
|
}
|
|
169
134
|
isBigIntegerSchema() {
|
|
170
|
-
return this.getSchema() ===
|
|
135
|
+
return this.getSchema() === 17;
|
|
171
136
|
}
|
|
172
137
|
isBigDecimalSchema() {
|
|
173
|
-
return this.getSchema() ===
|
|
138
|
+
return this.getSchema() === 19;
|
|
174
139
|
}
|
|
175
140
|
isStreaming() {
|
|
176
|
-
const streaming =
|
|
177
|
-
|
|
178
|
-
return true;
|
|
179
|
-
}
|
|
180
|
-
return this.getSchema() === SCHEMA.STREAMING_BLOB;
|
|
141
|
+
const { streaming } = this.getMergedTraits();
|
|
142
|
+
return !!streaming || this.getSchema() === 42;
|
|
181
143
|
}
|
|
182
144
|
isIdempotencyToken() {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (typeof traits === "number") {
|
|
188
|
-
if ((traits & 0b0100) === 0b0100) {
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
else if (typeof traits === "object") {
|
|
193
|
-
if (!!traits.idempotencyToken) {
|
|
194
|
-
return true;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return false;
|
|
145
|
+
const match = (traits) => (traits & 0b0100) === 0b0100 ||
|
|
146
|
+
!!traits?.idempotencyToken;
|
|
147
|
+
const { normalizedTraits, traits, memberTraits } = this;
|
|
148
|
+
return match(normalizedTraits) || match(traits) || match(memberTraits);
|
|
199
149
|
}
|
|
200
150
|
getMergedTraits() {
|
|
201
151
|
return (this.normalizedTraits ??
|
|
@@ -205,74 +155,48 @@ export class NormalizedSchema {
|
|
|
205
155
|
}));
|
|
206
156
|
}
|
|
207
157
|
getMemberTraits() {
|
|
208
|
-
return
|
|
158
|
+
return translateTraits(this.memberTraits);
|
|
209
159
|
}
|
|
210
160
|
getOwnTraits() {
|
|
211
|
-
return
|
|
161
|
+
return translateTraits(this.traits);
|
|
212
162
|
}
|
|
213
163
|
getKeySchema() {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
if (!this.isMapSchema()) {
|
|
164
|
+
const [isDoc, isMap] = [this.isDocumentSchema(), this.isMapSchema()];
|
|
165
|
+
if (!isDoc && !isMap) {
|
|
218
166
|
throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(true)}`);
|
|
219
167
|
}
|
|
220
168
|
const schema = this.getSchema();
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
return
|
|
169
|
+
const memberSchema = isDoc
|
|
170
|
+
? 15
|
|
171
|
+
: schema?.keySchema ?? 0;
|
|
172
|
+
return member([memberSchema, 0], "key");
|
|
225
173
|
}
|
|
226
174
|
getValueSchema() {
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
if (
|
|
237
|
-
|
|
238
|
-
throw new Error(`may not getValueSchema() on structure ${this.getName(true)}`);
|
|
239
|
-
}
|
|
240
|
-
const collection = schema;
|
|
241
|
-
if ("valueSchema" in collection) {
|
|
242
|
-
if (this.isMapSchema()) {
|
|
243
|
-
return this.memberFrom([collection.valueSchema, 0], "value");
|
|
244
|
-
}
|
|
245
|
-
else if (this.isListSchema()) {
|
|
246
|
-
return this.memberFrom([collection.valueSchema, 0], "member");
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
if (this.isDocumentSchema()) {
|
|
251
|
-
return this.memberFrom([SCHEMA.DOCUMENT, 0], "value");
|
|
175
|
+
const sc = this.getSchema();
|
|
176
|
+
const [isDoc, isMap, isList] = [this.isDocumentSchema(), this.isMapSchema(), this.isListSchema()];
|
|
177
|
+
const memberSchema = typeof sc === "number"
|
|
178
|
+
? 0b0011_1111 & sc
|
|
179
|
+
: sc && typeof sc === "object" && (isMap || isList)
|
|
180
|
+
? sc.valueSchema
|
|
181
|
+
: isDoc
|
|
182
|
+
? 15
|
|
183
|
+
: void 0;
|
|
184
|
+
if (memberSchema != null) {
|
|
185
|
+
return member([memberSchema, 0], isMap ? "value" : "member");
|
|
252
186
|
}
|
|
253
187
|
throw new Error(`@smithy/core/schema - ${this.getName(true)} has no value member.`);
|
|
254
188
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
return false;
|
|
261
|
-
}
|
|
262
|
-
getMemberSchema(member) {
|
|
263
|
-
if (this.isStructSchema()) {
|
|
264
|
-
const struct = this.getSchema();
|
|
265
|
-
if (!struct.memberNames.includes(member)) {
|
|
266
|
-
throw new Error(`@smithy/core/schema - ${this.getName(true)} has no member=${member}.`);
|
|
267
|
-
}
|
|
268
|
-
const i = struct.memberNames.indexOf(member);
|
|
189
|
+
getMemberSchema(memberName) {
|
|
190
|
+
const struct = this.getSchema();
|
|
191
|
+
if (this.isStructSchema() && struct.memberNames.includes(memberName)) {
|
|
192
|
+
const i = struct.memberNames.indexOf(memberName);
|
|
269
193
|
const memberSchema = struct.memberList[i];
|
|
270
|
-
return
|
|
194
|
+
return member(Array.isArray(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
|
|
271
195
|
}
|
|
272
196
|
if (this.isDocumentSchema()) {
|
|
273
|
-
return
|
|
197
|
+
return member([15, 0], memberName);
|
|
274
198
|
}
|
|
275
|
-
throw new Error(`@smithy/core/schema - ${this.getName(true)} has no
|
|
199
|
+
throw new Error(`@smithy/core/schema - ${this.getName(true)} has no no member=${memberName}.`);
|
|
276
200
|
}
|
|
277
201
|
getMemberSchemas() {
|
|
278
202
|
const buffer = {};
|
|
@@ -303,35 +227,17 @@ export class NormalizedSchema {
|
|
|
303
227
|
}
|
|
304
228
|
const struct = this.getSchema();
|
|
305
229
|
for (let i = 0; i < struct.memberNames.length; ++i) {
|
|
306
|
-
yield [struct.memberNames[i],
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
memberFrom(memberSchema, memberName) {
|
|
310
|
-
if (memberSchema instanceof NormalizedSchema) {
|
|
311
|
-
return Object.assign(memberSchema, {
|
|
312
|
-
memberName,
|
|
313
|
-
_isMemberSchema: true,
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
return new NormalizedSchema(memberSchema, memberName);
|
|
317
|
-
}
|
|
318
|
-
getSchemaName() {
|
|
319
|
-
const schema = this.getSchema();
|
|
320
|
-
if (typeof schema === "number") {
|
|
321
|
-
const _schema = 0b0011_1111 & schema;
|
|
322
|
-
const container = 0b1100_0000 & schema;
|
|
323
|
-
const type = Object.entries(SCHEMA).find(([, value]) => {
|
|
324
|
-
return value === _schema;
|
|
325
|
-
})?.[0] ?? "Unknown";
|
|
326
|
-
switch (container) {
|
|
327
|
-
case SCHEMA.MAP_MODIFIER:
|
|
328
|
-
return `${type}Map`;
|
|
329
|
-
case SCHEMA.LIST_MODIFIER:
|
|
330
|
-
return `${type}List`;
|
|
331
|
-
case 0:
|
|
332
|
-
return type;
|
|
333
|
-
}
|
|
230
|
+
yield [struct.memberNames[i], member([struct.memberList[i], 0], struct.memberNames[i])];
|
|
334
231
|
}
|
|
335
|
-
return "Unknown";
|
|
336
232
|
}
|
|
337
233
|
}
|
|
234
|
+
function member(memberSchema, memberName) {
|
|
235
|
+
if (memberSchema instanceof NormalizedSchema) {
|
|
236
|
+
return Object.assign(memberSchema, {
|
|
237
|
+
memberName,
|
|
238
|
+
_isMemberSchema: true,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
const internalCtorAccess = NormalizedSchema;
|
|
242
|
+
return new internalCtorAccess(memberSchema, memberName);
|
|
243
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function translateTraits(indicator) {
|
|
2
|
+
if (typeof indicator === "object") {
|
|
3
|
+
return indicator;
|
|
4
|
+
}
|
|
5
|
+
indicator = indicator | 0;
|
|
6
|
+
const traits = {};
|
|
7
|
+
let i = 0;
|
|
8
|
+
for (const trait of [
|
|
9
|
+
"httpLabel",
|
|
10
|
+
"idempotent",
|
|
11
|
+
"idempotencyToken",
|
|
12
|
+
"sensitive",
|
|
13
|
+
"httpPayload",
|
|
14
|
+
"httpResponseCode",
|
|
15
|
+
"httpQueryParams",
|
|
16
|
+
]) {
|
|
17
|
+
if (((indicator >> i++) & 1) === 1) {
|
|
18
|
+
traits[trait] = 1;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return traits;
|
|
22
|
+
}
|
|
@@ -4,6 +4,7 @@ export * from "./generateIdempotencyToken";
|
|
|
4
4
|
export * from "./lazy-json";
|
|
5
5
|
export * from "./parse-utils";
|
|
6
6
|
export * from "./quote-header";
|
|
7
|
+
export * from "./schema-serde-lib/schema-date-utils";
|
|
7
8
|
export * from "./split-every";
|
|
8
9
|
export * from "./split-header";
|
|
9
10
|
export * from "./value/NumericValue";
|