@jjrawlins/cdk-iam-policy-builder-helper 0.0.58 → 0.0.60
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/go.mod +1 -1
- 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/package.json +5 -5
- package/node_modules/@aws-sdk/client-sso/package.json +4 -4
- package/node_modules/@aws-sdk/core/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +1 -1
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +1 -1
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/xml/AwsRestXmlProtocol.d.ts +1 -2
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/xml/AwsRestXmlProtocol.d.ts +1 -1
- package/node_modules/@aws-sdk/core/package.json +2 -2
- 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/package.json +8 -8
- package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
- package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
- package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
- package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
- package/node_modules/@aws-sdk/middleware-user-agent/package.json +2 -2
- package/node_modules/@aws-sdk/nested-clients/package.json +4 -4
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
- package/node_modules/@aws-sdk/xml-builder/dist-es/xml-parser.browser.js +4 -1
- package/node_modules/@aws-sdk/xml-builder/package.json +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/event-streams/index.js +1 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +3 -3
- package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +171 -169
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +1 -2
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +4 -4
- package/node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js +1 -1
- package/node_modules/@smithy/core/dist-es/submodules/schema/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaDeserializationMiddleware.js +4 -6
- package/node_modules/@smithy/core/dist-es/submodules/schema/middleware/schemaSerializationMiddleware.js +4 -6
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/NormalizedSchema.js +26 -35
- package/node_modules/@smithy/core/dist-es/submodules/schema/schemas/operation.js +7 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/index.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/ErrorSchema.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/ListSchema.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/MapSchema.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/NormalizedSchema.d.ts +4 -21
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/OperationSchema.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/Schema.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/SimpleSchema.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/StructureSchema.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/submodules/schema/schemas/operation.d.ts +7 -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/ErrorSchema.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/ListSchema.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/MapSchema.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/NormalizedSchema.d.ts +4 -21
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/OperationSchema.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/Schema.d.ts +1 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/SimpleSchema.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/StructureSchema.d.ts +2 -0
- package/node_modules/@smithy/core/dist-types/ts3.4/submodules/schema/schemas/operation.d.ts +7 -0
- 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/dist-cjs/index.js +2 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-es/constants.js +1 -0
- package/node_modules/@smithy/shared-ini-file-loader/dist-es/getConfigData.js +1 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-es/loadSharedConfigFiles.js +1 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-es/parseIni.js +1 -1
- package/node_modules/@smithy/shared-ini-file-loader/dist-types/constants.d.ts +4 -0
- package/node_modules/@smithy/shared-ini-file-loader/dist-types/loadSharedConfigFiles.d.ts +1 -4
- package/node_modules/@smithy/shared-ini-file-loader/dist-types/ts3.4/constants.d.ts +4 -0
- package/node_modules/@smithy/shared-ini-file-loader/dist-types/ts3.4/loadSharedConfigFiles.d.ts +1 -4
- 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-es/index.js +1 -0
- package/node_modules/@smithy/types/dist-es/schema/schema-deprecated.js +1 -0
- package/node_modules/@smithy/types/dist-types/index.d.ts +1 -0
- package/node_modules/@smithy/types/dist-types/schema/schema-deprecated.d.ts +136 -0
- package/node_modules/@smithy/types/dist-types/schema/schema.d.ts +26 -68
- package/node_modules/@smithy/types/dist-types/schema/static-schemas.d.ts +8 -8
- package/node_modules/@smithy/types/dist-types/serde.d.ts +2 -2
- package/node_modules/@smithy/types/dist-types/ts3.4/index.d.ts +1 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema-deprecated.d.ts +142 -0
- package/node_modules/@smithy/types/dist-types/ts3.4/schema/schema.d.ts +27 -72
- package/node_modules/@smithy/types/dist-types/ts3.4/schema/static-schemas.d.ts +9 -9
- package/node_modules/@smithy/types/dist-types/ts3.4/serde.d.ts +2 -2
- 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/dist-cjs/index.js +31 -22
- package/node_modules/@smithy/util-endpoints/dist-es/utils/callFunction.js +1 -11
- package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateExpression.js +15 -2
- package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateRules.js +17 -2
- package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateTreeRule.js +1 -13
- package/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperties.js +25 -2
- package/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperty.js +1 -21
- package/node_modules/@smithy/util-endpoints/dist-types/ts3.4/utils/callFunction.d.ts +1 -2
- package/node_modules/@smithy/util-endpoints/dist-types/ts3.4/utils/evaluateExpression.d.ts +7 -2
- package/node_modules/@smithy/util-endpoints/dist-types/ts3.4/utils/evaluateRules.d.ts +6 -1
- package/node_modules/@smithy/util-endpoints/dist-types/ts3.4/utils/evaluateTreeRule.d.ts +1 -3
- package/node_modules/@smithy/util-endpoints/dist-types/ts3.4/utils/getEndpointProperties.d.ts +6 -0
- package/node_modules/@smithy/util-endpoints/dist-types/ts3.4/utils/getEndpointProperty.d.ts +1 -3
- package/node_modules/@smithy/util-endpoints/dist-types/utils/callFunction.d.ts +1 -2
- package/node_modules/@smithy/util-endpoints/dist-types/utils/evaluateExpression.d.ts +7 -2
- package/node_modules/@smithy/util-endpoints/dist-types/utils/evaluateRules.d.ts +6 -1
- package/node_modules/@smithy/util-endpoints/dist-types/utils/evaluateTreeRule.d.ts +1 -3
- package/node_modules/@smithy/util-endpoints/dist-types/utils/getEndpointProperties.d.ts +6 -0
- package/node_modules/@smithy/util-endpoints/dist-types/utils/getEndpointProperty.d.ts +1 -3
- 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/dist-cjs/index.js +8 -15
- package/node_modules/@smithy/util-stream/dist-es/blob/Uint8ArrayBlobAdapter.js +10 -3
- package/node_modules/@smithy/util-stream/package.json +4 -4
- package/node_modules/@smithy/util-waiter/package.json +3 -3
- package/package.json +3 -3
- package/node_modules/@smithy/util-stream/dist-es/blob/transforms.js +0 -15
- package/node_modules/@smithy/util-stream/dist-types/blob/transforms.d.ts +0 -9
- package/node_modules/@smithy/util-stream/dist-types/ts3.4/blob/transforms.d.ts +0 -9
|
@@ -10,6 +10,113 @@ const deref = (schemaRef) => {
|
|
|
10
10
|
return schemaRef;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
const operation = (namespace, name, traits, input, output) => ({
|
|
14
|
+
name,
|
|
15
|
+
namespace,
|
|
16
|
+
traits,
|
|
17
|
+
input,
|
|
18
|
+
output,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const schemaDeserializationMiddleware = (config) => (next, context) => async (args) => {
|
|
22
|
+
const { response } = await next(args);
|
|
23
|
+
const { operationSchema } = utilMiddleware.getSmithyContext(context);
|
|
24
|
+
const [, ns, n, t, i, o] = operationSchema ?? [];
|
|
25
|
+
try {
|
|
26
|
+
const parsed = await config.protocol.deserializeResponse(operation(ns, n, t, i, o), {
|
|
27
|
+
...config,
|
|
28
|
+
...context,
|
|
29
|
+
}, response);
|
|
30
|
+
return {
|
|
31
|
+
response,
|
|
32
|
+
output: parsed,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
Object.defineProperty(error, "$response", {
|
|
37
|
+
value: response,
|
|
38
|
+
});
|
|
39
|
+
if (!("$metadata" in error)) {
|
|
40
|
+
const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
|
|
41
|
+
try {
|
|
42
|
+
error.message += "\n " + hint;
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
|
|
46
|
+
console.warn(hint);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
context.logger?.warn?.(hint);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (typeof error.$responseBodyText !== "undefined") {
|
|
53
|
+
if (error.$response) {
|
|
54
|
+
error.$response.body = error.$responseBodyText;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
if (protocolHttp.HttpResponse.isInstance(response)) {
|
|
59
|
+
const { headers = {} } = response;
|
|
60
|
+
const headerEntries = Object.entries(headers);
|
|
61
|
+
error.$metadata = {
|
|
62
|
+
httpStatusCode: response.statusCode,
|
|
63
|
+
requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
|
|
64
|
+
extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
|
|
65
|
+
cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const findHeader = (pattern, headers) => {
|
|
76
|
+
return (headers.find(([k]) => {
|
|
77
|
+
return k.match(pattern);
|
|
78
|
+
}) || [void 0, void 0])[1];
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const schemaSerializationMiddleware = (config) => (next, context) => async (args) => {
|
|
82
|
+
const { operationSchema } = utilMiddleware.getSmithyContext(context);
|
|
83
|
+
const [, ns, n, t, i, o] = operationSchema ?? [];
|
|
84
|
+
const endpoint = context.endpointV2?.url && config.urlParser
|
|
85
|
+
? async () => config.urlParser(context.endpointV2.url)
|
|
86
|
+
: config.endpoint;
|
|
87
|
+
const request = await config.protocol.serializeRequest(operation(ns, n, t, i, o), args.input, {
|
|
88
|
+
...config,
|
|
89
|
+
...context,
|
|
90
|
+
endpoint,
|
|
91
|
+
});
|
|
92
|
+
return next({
|
|
93
|
+
...args,
|
|
94
|
+
request,
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const deserializerMiddlewareOption = {
|
|
99
|
+
name: "deserializerMiddleware",
|
|
100
|
+
step: "deserialize",
|
|
101
|
+
tags: ["DESERIALIZER"],
|
|
102
|
+
override: true,
|
|
103
|
+
};
|
|
104
|
+
const serializerMiddlewareOption = {
|
|
105
|
+
name: "serializerMiddleware",
|
|
106
|
+
step: "serialize",
|
|
107
|
+
tags: ["SERIALIZER"],
|
|
108
|
+
override: true,
|
|
109
|
+
};
|
|
110
|
+
function getSchemaSerdePlugin(config) {
|
|
111
|
+
return {
|
|
112
|
+
applyToStack: (commandStack) => {
|
|
113
|
+
commandStack.add(schemaSerializationMiddleware(config), serializerMiddlewareOption);
|
|
114
|
+
commandStack.add(schemaDeserializationMiddleware(config), deserializerMiddlewareOption);
|
|
115
|
+
config.protocol.setSerdeContext(config);
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
13
120
|
class Schema {
|
|
14
121
|
name;
|
|
15
122
|
namespace;
|
|
@@ -31,36 +138,6 @@ class Schema {
|
|
|
31
138
|
}
|
|
32
139
|
}
|
|
33
140
|
|
|
34
|
-
class StructureSchema extends Schema {
|
|
35
|
-
static symbol = Symbol.for("@smithy/str");
|
|
36
|
-
name;
|
|
37
|
-
traits;
|
|
38
|
-
memberNames;
|
|
39
|
-
memberList;
|
|
40
|
-
symbol = StructureSchema.symbol;
|
|
41
|
-
}
|
|
42
|
-
const struct = (namespace, name, traits, memberNames, memberList) => Schema.assign(new StructureSchema(), {
|
|
43
|
-
name,
|
|
44
|
-
namespace,
|
|
45
|
-
traits,
|
|
46
|
-
memberNames,
|
|
47
|
-
memberList,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
class ErrorSchema extends StructureSchema {
|
|
51
|
-
static symbol = Symbol.for("@smithy/err");
|
|
52
|
-
ctor;
|
|
53
|
-
symbol = ErrorSchema.symbol;
|
|
54
|
-
}
|
|
55
|
-
const error = (namespace, name, traits, memberNames, memberList, ctor) => Schema.assign(new ErrorSchema(), {
|
|
56
|
-
name,
|
|
57
|
-
namespace,
|
|
58
|
-
traits,
|
|
59
|
-
memberNames,
|
|
60
|
-
memberList,
|
|
61
|
-
ctor: null,
|
|
62
|
-
});
|
|
63
|
-
|
|
64
141
|
class ListSchema extends Schema {
|
|
65
142
|
static symbol = Symbol.for("@smithy/lis");
|
|
66
143
|
name;
|
|
@@ -107,24 +184,34 @@ const op = (namespace, name, traits, input, output) => Schema.assign(new Operati
|
|
|
107
184
|
output,
|
|
108
185
|
});
|
|
109
186
|
|
|
110
|
-
class
|
|
111
|
-
static symbol = Symbol.for("@smithy/
|
|
187
|
+
class StructureSchema extends Schema {
|
|
188
|
+
static symbol = Symbol.for("@smithy/str");
|
|
112
189
|
name;
|
|
113
|
-
schemaRef;
|
|
114
190
|
traits;
|
|
115
|
-
|
|
191
|
+
memberNames;
|
|
192
|
+
memberList;
|
|
193
|
+
symbol = StructureSchema.symbol;
|
|
116
194
|
}
|
|
117
|
-
const
|
|
195
|
+
const struct = (namespace, name, traits, memberNames, memberList) => Schema.assign(new StructureSchema(), {
|
|
118
196
|
name,
|
|
119
197
|
namespace,
|
|
120
198
|
traits,
|
|
121
|
-
|
|
199
|
+
memberNames,
|
|
200
|
+
memberList,
|
|
122
201
|
});
|
|
123
|
-
|
|
202
|
+
|
|
203
|
+
class ErrorSchema extends StructureSchema {
|
|
204
|
+
static symbol = Symbol.for("@smithy/err");
|
|
205
|
+
ctor;
|
|
206
|
+
symbol = ErrorSchema.symbol;
|
|
207
|
+
}
|
|
208
|
+
const error = (namespace, name, traits, memberNames, memberList, ctor) => Schema.assign(new ErrorSchema(), {
|
|
124
209
|
name,
|
|
125
210
|
namespace,
|
|
126
211
|
traits,
|
|
127
|
-
|
|
212
|
+
memberNames,
|
|
213
|
+
memberList,
|
|
214
|
+
ctor: null,
|
|
128
215
|
});
|
|
129
216
|
|
|
130
217
|
function translateTraits(indicator) {
|
|
@@ -174,8 +261,6 @@ class NormalizedSchema {
|
|
|
174
261
|
schema = deref(_ref);
|
|
175
262
|
this._isMemberSchema = true;
|
|
176
263
|
}
|
|
177
|
-
if (isStaticSchema(schema))
|
|
178
|
-
schema = hydrate(schema);
|
|
179
264
|
if (traitStack.length > 0) {
|
|
180
265
|
this.memberTraits = {};
|
|
181
266
|
for (let i = traitStack.length - 1; i >= 0; --i) {
|
|
@@ -195,19 +280,25 @@ class NormalizedSchema {
|
|
|
195
280
|
return;
|
|
196
281
|
}
|
|
197
282
|
this.schema = deref(schema);
|
|
198
|
-
if (this.schema
|
|
199
|
-
this.
|
|
283
|
+
if (isStaticSchema(this.schema)) {
|
|
284
|
+
this.name = `${this.schema[1]}#${this.schema[2]}`;
|
|
285
|
+
this.traits = this.schema[3];
|
|
200
286
|
}
|
|
201
287
|
else {
|
|
288
|
+
this.name = this.memberName ?? String(schema);
|
|
202
289
|
this.traits = 0;
|
|
203
290
|
}
|
|
204
|
-
this.name = (this.schema instanceof Schema ? this.schema.getName?.() : void 0) ?? this.memberName ?? String(schema);
|
|
205
291
|
if (this._isMemberSchema && !memberName) {
|
|
206
292
|
throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(true)} missing member name.`);
|
|
207
293
|
}
|
|
208
294
|
}
|
|
209
295
|
static [Symbol.hasInstance](lhs) {
|
|
210
|
-
|
|
296
|
+
const isPrototype = this.prototype.isPrototypeOf(lhs);
|
|
297
|
+
if (!isPrototype && typeof lhs === "object" && lhs !== null) {
|
|
298
|
+
const ns = lhs;
|
|
299
|
+
return ns.symbol === this.symbol;
|
|
300
|
+
}
|
|
301
|
+
return isPrototype;
|
|
211
302
|
}
|
|
212
303
|
static of(ref) {
|
|
213
304
|
const sc = deref(ref);
|
|
@@ -225,7 +316,11 @@ class NormalizedSchema {
|
|
|
225
316
|
return new NormalizedSchema(sc);
|
|
226
317
|
}
|
|
227
318
|
getSchema() {
|
|
228
|
-
|
|
319
|
+
const sc = this.schema;
|
|
320
|
+
if (sc[0] === 0) {
|
|
321
|
+
return sc[4];
|
|
322
|
+
}
|
|
323
|
+
return sc;
|
|
229
324
|
}
|
|
230
325
|
getName(withNamespace = false) {
|
|
231
326
|
const { name } = this;
|
|
@@ -242,17 +337,18 @@ class NormalizedSchema {
|
|
|
242
337
|
const sc = this.getSchema();
|
|
243
338
|
return typeof sc === "number"
|
|
244
339
|
? sc >= 64 && sc < 128
|
|
245
|
-
: sc
|
|
340
|
+
: sc[0] === 1;
|
|
246
341
|
}
|
|
247
342
|
isMapSchema() {
|
|
248
343
|
const sc = this.getSchema();
|
|
249
344
|
return typeof sc === "number"
|
|
250
345
|
? sc >= 128 && sc <= 0b1111_1111
|
|
251
|
-
: sc
|
|
346
|
+
: sc[0] === 2;
|
|
252
347
|
}
|
|
253
348
|
isStructSchema() {
|
|
254
349
|
const sc = this.getSchema();
|
|
255
|
-
return (sc
|
|
350
|
+
return (sc[0] === 3 ||
|
|
351
|
+
sc[0] === -3);
|
|
256
352
|
}
|
|
257
353
|
isBlobSchema() {
|
|
258
354
|
const sc = this.getSchema();
|
|
@@ -316,7 +412,7 @@ class NormalizedSchema {
|
|
|
316
412
|
const schema = this.getSchema();
|
|
317
413
|
const memberSchema = isDoc
|
|
318
414
|
? 15
|
|
319
|
-
: schema
|
|
415
|
+
: schema[4] ?? 0;
|
|
320
416
|
return member([memberSchema, 0], "key");
|
|
321
417
|
}
|
|
322
418
|
getValueSchema() {
|
|
@@ -325,7 +421,7 @@ class NormalizedSchema {
|
|
|
325
421
|
const memberSchema = typeof sc === "number"
|
|
326
422
|
? 0b0011_1111 & sc
|
|
327
423
|
: sc && typeof sc === "object" && (isMap || isList)
|
|
328
|
-
? sc
|
|
424
|
+
? sc[3 + sc[0]]
|
|
329
425
|
: isDoc
|
|
330
426
|
? 15
|
|
331
427
|
: void 0;
|
|
@@ -336,9 +432,9 @@ class NormalizedSchema {
|
|
|
336
432
|
}
|
|
337
433
|
getMemberSchema(memberName) {
|
|
338
434
|
const struct = this.getSchema();
|
|
339
|
-
if (this.isStructSchema() && struct.
|
|
340
|
-
const i = struct.
|
|
341
|
-
const memberSchema = struct
|
|
435
|
+
if (this.isStructSchema() && struct[4].includes(memberName)) {
|
|
436
|
+
const i = struct[4].indexOf(memberName);
|
|
437
|
+
const memberSchema = struct[5][i];
|
|
342
438
|
return member(isMemberSchema(memberSchema) ? memberSchema : [memberSchema, 0], memberName);
|
|
343
439
|
}
|
|
344
440
|
if (this.isDocumentSchema()) {
|
|
@@ -374,8 +470,8 @@ class NormalizedSchema {
|
|
|
374
470
|
throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");
|
|
375
471
|
}
|
|
376
472
|
const struct = this.getSchema();
|
|
377
|
-
for (let i = 0; i < struct.
|
|
378
|
-
yield [struct
|
|
473
|
+
for (let i = 0; i < struct[4].length; ++i) {
|
|
474
|
+
yield [struct[4][i], member([struct[5][i], 0], struct[4][i])];
|
|
379
475
|
}
|
|
380
476
|
}
|
|
381
477
|
}
|
|
@@ -389,122 +485,28 @@ function member(memberSchema, memberName) {
|
|
|
389
485
|
const internalCtorAccess = NormalizedSchema;
|
|
390
486
|
return new internalCtorAccess(memberSchema, memberName);
|
|
391
487
|
}
|
|
392
|
-
function hydrate(ss) {
|
|
393
|
-
const [id, ...rest] = ss;
|
|
394
|
-
return {
|
|
395
|
-
[0]: simAdapter,
|
|
396
|
-
[1]: list,
|
|
397
|
-
[2]: map,
|
|
398
|
-
[3]: struct,
|
|
399
|
-
[-3]: error,
|
|
400
|
-
[9]: op,
|
|
401
|
-
}[id].call(null, ...rest);
|
|
402
|
-
}
|
|
403
488
|
const isMemberSchema = (sc) => Array.isArray(sc) && sc.length === 2;
|
|
404
489
|
const isStaticSchema = (sc) => Array.isArray(sc) && sc.length >= 5;
|
|
405
490
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
try {
|
|
413
|
-
const parsed = await config.protocol.deserializeResponse(operationSchema, {
|
|
414
|
-
...config,
|
|
415
|
-
...context,
|
|
416
|
-
}, response);
|
|
417
|
-
return {
|
|
418
|
-
response,
|
|
419
|
-
output: parsed,
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
catch (error) {
|
|
423
|
-
Object.defineProperty(error, "$response", {
|
|
424
|
-
value: response,
|
|
425
|
-
});
|
|
426
|
-
if (!("$metadata" in error)) {
|
|
427
|
-
const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
|
|
428
|
-
try {
|
|
429
|
-
error.message += "\n " + hint;
|
|
430
|
-
}
|
|
431
|
-
catch (e) {
|
|
432
|
-
if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
|
|
433
|
-
console.warn(hint);
|
|
434
|
-
}
|
|
435
|
-
else {
|
|
436
|
-
context.logger?.warn?.(hint);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
if (typeof error.$responseBodyText !== "undefined") {
|
|
440
|
-
if (error.$response) {
|
|
441
|
-
error.$response.body = error.$responseBodyText;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
try {
|
|
445
|
-
if (protocolHttp.HttpResponse.isInstance(response)) {
|
|
446
|
-
const { headers = {} } = response;
|
|
447
|
-
const headerEntries = Object.entries(headers);
|
|
448
|
-
error.$metadata = {
|
|
449
|
-
httpStatusCode: response.statusCode,
|
|
450
|
-
requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
|
|
451
|
-
extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
|
|
452
|
-
cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries),
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
catch (e) {
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
throw error;
|
|
460
|
-
}
|
|
461
|
-
};
|
|
462
|
-
const findHeader = (pattern, headers) => {
|
|
463
|
-
return (headers.find(([k]) => {
|
|
464
|
-
return k.match(pattern);
|
|
465
|
-
}) || [void 0, void 0])[1];
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
const schemaSerializationMiddleware = (config) => (next, context) => async (args) => {
|
|
469
|
-
let { operationSchema } = utilMiddleware.getSmithyContext(context);
|
|
470
|
-
if (isStaticSchema(operationSchema)) {
|
|
471
|
-
operationSchema = hydrate(operationSchema);
|
|
472
|
-
}
|
|
473
|
-
const endpoint = context.endpointV2?.url && config.urlParser
|
|
474
|
-
? async () => config.urlParser(context.endpointV2.url)
|
|
475
|
-
: config.endpoint;
|
|
476
|
-
const request = await config.protocol.serializeRequest(operationSchema, args.input, {
|
|
477
|
-
...config,
|
|
478
|
-
...context,
|
|
479
|
-
endpoint,
|
|
480
|
-
});
|
|
481
|
-
return next({
|
|
482
|
-
...args,
|
|
483
|
-
request,
|
|
484
|
-
});
|
|
485
|
-
};
|
|
486
|
-
|
|
487
|
-
const deserializerMiddlewareOption = {
|
|
488
|
-
name: "deserializerMiddleware",
|
|
489
|
-
step: "deserialize",
|
|
490
|
-
tags: ["DESERIALIZER"],
|
|
491
|
-
override: true,
|
|
492
|
-
};
|
|
493
|
-
const serializerMiddlewareOption = {
|
|
494
|
-
name: "serializerMiddleware",
|
|
495
|
-
step: "serialize",
|
|
496
|
-
tags: ["SERIALIZER"],
|
|
497
|
-
override: true,
|
|
498
|
-
};
|
|
499
|
-
function getSchemaSerdePlugin(config) {
|
|
500
|
-
return {
|
|
501
|
-
applyToStack: (commandStack) => {
|
|
502
|
-
commandStack.add(schemaSerializationMiddleware(config), serializerMiddlewareOption);
|
|
503
|
-
commandStack.add(schemaDeserializationMiddleware(config), deserializerMiddlewareOption);
|
|
504
|
-
config.protocol.setSerdeContext(config);
|
|
505
|
-
},
|
|
506
|
-
};
|
|
491
|
+
class SimpleSchema extends Schema {
|
|
492
|
+
static symbol = Symbol.for("@smithy/sim");
|
|
493
|
+
name;
|
|
494
|
+
schemaRef;
|
|
495
|
+
traits;
|
|
496
|
+
symbol = SimpleSchema.symbol;
|
|
507
497
|
}
|
|
498
|
+
const sim = (namespace, name, schemaRef, traits) => Schema.assign(new SimpleSchema(), {
|
|
499
|
+
name,
|
|
500
|
+
namespace,
|
|
501
|
+
traits,
|
|
502
|
+
schemaRef,
|
|
503
|
+
});
|
|
504
|
+
const simAdapter = (namespace, name, traits, schemaRef) => Schema.assign(new SimpleSchema(), {
|
|
505
|
+
name,
|
|
506
|
+
namespace,
|
|
507
|
+
traits,
|
|
508
|
+
schemaRef,
|
|
509
|
+
});
|
|
508
510
|
|
|
509
511
|
const SCHEMA = {
|
|
510
512
|
BLOB: 0b0001_0101,
|
|
@@ -560,7 +562,7 @@ class TypeRegistry {
|
|
|
560
562
|
getErrorCtor(es) {
|
|
561
563
|
const $error = es;
|
|
562
564
|
const registry = TypeRegistry.for($error[1]);
|
|
563
|
-
return registry.exceptions.get(
|
|
565
|
+
return registry.exceptions.get($error);
|
|
564
566
|
}
|
|
565
567
|
getBaseException() {
|
|
566
568
|
for (const exceptionKey of this.exceptions.keys()) {
|
|
@@ -603,11 +605,11 @@ exports.deref = deref;
|
|
|
603
605
|
exports.deserializerMiddlewareOption = deserializerMiddlewareOption;
|
|
604
606
|
exports.error = error;
|
|
605
607
|
exports.getSchemaSerdePlugin = getSchemaSerdePlugin;
|
|
606
|
-
exports.hydrate = hydrate;
|
|
607
608
|
exports.isStaticSchema = isStaticSchema;
|
|
608
609
|
exports.list = list;
|
|
609
610
|
exports.map = map;
|
|
610
611
|
exports.op = op;
|
|
612
|
+
exports.operation = operation;
|
|
611
613
|
exports.serializerMiddlewareOption = serializerMiddlewareOption;
|
|
612
614
|
exports.sim = sim;
|
|
613
615
|
exports.simAdapter = simAdapter;
|
|
@@ -16,7 +16,6 @@ export class EventStreamSerde {
|
|
|
16
16
|
const marshaller = this.marshaller;
|
|
17
17
|
const eventStreamMember = requestSchema.getEventStreamMember();
|
|
18
18
|
const unionSchema = requestSchema.getMemberSchema(eventStreamMember);
|
|
19
|
-
const memberSchemas = unionSchema.getMemberSchemas();
|
|
20
19
|
const serializer = this.serializer;
|
|
21
20
|
const defaultContentType = this.defaultContentType;
|
|
22
21
|
const initialRequestMarker = Symbol("initialRequestMarker");
|
|
@@ -129,7 +128,7 @@ export class EventStreamSerde {
|
|
|
129
128
|
let explicitPayloadContentType;
|
|
130
129
|
const isKnownSchema = (() => {
|
|
131
130
|
const struct = unionSchema.getSchema();
|
|
132
|
-
return struct.
|
|
131
|
+
return struct[4].includes(unionMember);
|
|
133
132
|
})();
|
|
134
133
|
const additionalHeaders = {};
|
|
135
134
|
if (!isKnownSchema) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NormalizedSchema } from "@smithy/core/schema";
|
|
1
|
+
import { NormalizedSchema, translateTraits } from "@smithy/core/schema";
|
|
2
2
|
import { HttpRequest, HttpResponse } from "@smithy/protocol-http";
|
|
3
3
|
import { SerdeContext } from "./SerdeContext";
|
|
4
4
|
export class HttpProtocol extends SerdeContext {
|
|
@@ -50,10 +50,10 @@ export class HttpProtocol extends SerdeContext {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
setHostPrefix(request, operationSchema, input) {
|
|
53
|
-
const operationNs = NormalizedSchema.of(operationSchema);
|
|
54
53
|
const inputNs = NormalizedSchema.of(operationSchema.input);
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
const opTraits = translateTraits(operationSchema.traits ?? {});
|
|
55
|
+
if (opTraits.endpoint) {
|
|
56
|
+
let hostPrefix = opTraits.endpoint?.[0];
|
|
57
57
|
if (typeof hostPrefix === "string") {
|
|
58
58
|
const hostLabelInputs = [...inputNs.structIterator()].filter(([, member]) => member.getMergedTraits().hostLabel);
|
|
59
59
|
for (const [name] of hostLabelInputs) {
|
|
@@ -35,7 +35,7 @@ export class TypeRegistry {
|
|
|
35
35
|
getErrorCtor(es) {
|
|
36
36
|
const $error = es;
|
|
37
37
|
const registry = TypeRegistry.for($error[1]);
|
|
38
|
-
return registry.exceptions.get(
|
|
38
|
+
return registry.exceptions.get($error);
|
|
39
39
|
}
|
|
40
40
|
getBaseException() {
|
|
41
41
|
for (const exceptionKey of this.exceptions.keys()) {
|
|
@@ -3,6 +3,7 @@ export * from "./middleware/getSchemaSerdePlugin";
|
|
|
3
3
|
export * from "./schemas/ListSchema";
|
|
4
4
|
export * from "./schemas/MapSchema";
|
|
5
5
|
export * from "./schemas/OperationSchema";
|
|
6
|
+
export * from "./schemas/operation";
|
|
6
7
|
export * from "./schemas/ErrorSchema";
|
|
7
8
|
export * from "./schemas/NormalizedSchema";
|
|
8
9
|
export * from "./schemas/Schema";
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { HttpResponse } from "@smithy/protocol-http";
|
|
2
2
|
import { getSmithyContext } from "@smithy/util-middleware";
|
|
3
|
-
import {
|
|
3
|
+
import { operation } from "../schemas/operation";
|
|
4
4
|
export const schemaDeserializationMiddleware = (config) => (next, context) => async (args) => {
|
|
5
5
|
const { response } = await next(args);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
operationSchema = hydrate(operationSchema);
|
|
9
|
-
}
|
|
6
|
+
const { operationSchema } = getSmithyContext(context);
|
|
7
|
+
const [, ns, n, t, i, o] = operationSchema ?? [];
|
|
10
8
|
try {
|
|
11
|
-
const parsed = await config.protocol.deserializeResponse(
|
|
9
|
+
const parsed = await config.protocol.deserializeResponse(operation(ns, n, t, i, o), {
|
|
12
10
|
...config,
|
|
13
11
|
...context,
|
|
14
12
|
}, response);
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { getSmithyContext } from "@smithy/util-middleware";
|
|
2
|
-
import {
|
|
2
|
+
import { operation } from "../schemas/operation";
|
|
3
3
|
export const schemaSerializationMiddleware = (config) => (next, context) => async (args) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
operationSchema = hydrate(operationSchema);
|
|
7
|
-
}
|
|
4
|
+
const { operationSchema } = getSmithyContext(context);
|
|
5
|
+
const [, ns, n, t, i, o] = operationSchema ?? [];
|
|
8
6
|
const endpoint = context.endpointV2?.url && config.urlParser
|
|
9
7
|
? async () => config.urlParser(context.endpointV2.url)
|
|
10
8
|
: config.endpoint;
|
|
11
|
-
const request = await config.protocol.serializeRequest(
|
|
9
|
+
const request = await config.protocol.serializeRequest(operation(ns, n, t, i, o), args.input, {
|
|
12
10
|
...config,
|
|
13
11
|
...context,
|
|
14
12
|
endpoint,
|