@servicevic-oss/cdk-cleanup-certificate-validation-records 1.3.59 → 1.3.61
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 +4 -4
- package/lib/index.js +2 -2
- package/node_modules/@aws-sdk/client-acm/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-acm/package.json +3 -3
- package/node_modules/@aws-sdk/client-route-53/dist-cjs/index.js +1 -1
- package/node_modules/@aws-sdk/client-route-53/package.json +3 -3
- package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +181 -66
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.js +103 -0
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.js +37 -17
- package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/codec-v2/JsonShapeSerializer2.js +43 -51
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +51 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonCodec2.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +1 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonBytesStringAdapter.d.ts +27 -0
- package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/codec-v2/JsonShapeDeserializer2.d.ts +1 -0
- package/node_modules/@aws-sdk/core/package.json +1 -1
- 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 +9 -9
- package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
- 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/nested-clients/dist-cjs/submodules/cognito-identity/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +1 -1
- package/node_modules/@aws-sdk/nested-clients/package.json +2 -2
- package/node_modules/@aws-sdk/token-providers/package.json +3 -3
- package/package.json +3 -3
package/.jsii
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
]
|
|
8
8
|
},
|
|
9
9
|
"bundled": {
|
|
10
|
-
"@aws-sdk/client-acm": "^3.
|
|
11
|
-
"@aws-sdk/client-route-53": "^3.
|
|
10
|
+
"@aws-sdk/client-acm": "^3.1101.0",
|
|
11
|
+
"@aws-sdk/client-route-53": "^3.1101.0",
|
|
12
12
|
"@types/aws-lambda": "^8.10.162",
|
|
13
13
|
"async-await-retry": "^2.1.0"
|
|
14
14
|
},
|
|
@@ -8898,6 +8898,6 @@
|
|
|
8898
8898
|
"symbolId": "src/index:CertificateWithCleanup"
|
|
8899
8899
|
}
|
|
8900
8900
|
},
|
|
8901
|
-
"version": "1.3.
|
|
8902
|
-
"fingerprint": "
|
|
8901
|
+
"version": "1.3.61",
|
|
8902
|
+
"fingerprint": "bfr4x1eqX+/HuMIFEst5o+Asq1IstI48ij9O6dpPNxI="
|
|
8903
8903
|
}
|
package/lib/index.js
CHANGED
|
@@ -43,7 +43,7 @@ const constructs_1 = require("constructs");
|
|
|
43
43
|
* leave behind when deleting a DNS validated certificate
|
|
44
44
|
*/
|
|
45
45
|
class CertificateValidationRecordCleanup extends constructs_1.Construct {
|
|
46
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateValidationRecordCleanup", version: "1.3.
|
|
46
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateValidationRecordCleanup", version: "1.3.61" };
|
|
47
47
|
static HANDLER_UID = 'CertRecordsCleanupHandler-2B663BAB-7981';
|
|
48
48
|
static PROVIDER_UID = 'CertRecordsCleanupProvider-57EBF059-2E26';
|
|
49
49
|
static LOG_GROUP_UID = 'CertRecordsCleanupLogGroup-57ABF051-1E25';
|
|
@@ -109,7 +109,7 @@ exports.CertificateValidationRecordCleanup = CertificateValidationRecordCleanup;
|
|
|
109
109
|
* A wrapper class for a vanilla `Certificate` object with automatic cleanup attached
|
|
110
110
|
*/
|
|
111
111
|
class CertificateWithCleanup extends cdk.aws_certificatemanager.Certificate {
|
|
112
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup", version: "1.3.
|
|
112
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@servicevic-oss/cdk-cleanup-certificate-validation-records.CertificateWithCleanup", version: "1.3.61" };
|
|
113
113
|
constructor(scope, id, props) {
|
|
114
114
|
super(scope, id, props);
|
|
115
115
|
if (props.validation && props.validation.props.hostedZone && props.validation?.method == cdk.aws_certificatemanager.ValidationMethod.DNS) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/client-acm",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1101.0",
|
|
4
4
|
"description": "AWS SDK for JavaScript Acm Client for Node.js, Browser and React Native",
|
|
5
5
|
"homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-acm",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@aws-sdk/core": "^3.977.
|
|
52
|
-
"@aws-sdk/credential-provider-node": "^3.972.
|
|
51
|
+
"@aws-sdk/core": "^3.977.4",
|
|
52
|
+
"@aws-sdk/credential-provider-node": "^3.972.76",
|
|
53
53
|
"@aws-sdk/types": "^3.974.2",
|
|
54
54
|
"@smithy/core": "^3.31.1",
|
|
55
55
|
"@smithy/fetch-http-handler": "^5.6.13",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/client-route-53",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1101.0",
|
|
4
4
|
"description": "AWS SDK for JavaScript Route 53 Client for Node.js, Browser and React Native",
|
|
5
5
|
"homepage": "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-route-53",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"test:index": "tsc --noEmit ./test/index-types.ts && node ./test/index-objects.spec.mjs"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@aws-sdk/core": "^3.977.
|
|
56
|
-
"@aws-sdk/credential-provider-node": "^3.972.
|
|
55
|
+
"@aws-sdk/core": "^3.977.4",
|
|
56
|
+
"@aws-sdk/credential-provider-node": "^3.972.76",
|
|
57
57
|
"@aws-sdk/middleware-sdk-route53": "^3.972.23",
|
|
58
58
|
"@aws-sdk/types": "^3.974.2",
|
|
59
59
|
"@smithy/core": "^3.31.1",
|
|
@@ -1022,14 +1022,20 @@ class JsonShapeDeserializer2 extends SerdeContextConfig {
|
|
|
1022
1022
|
const reviver = needsReviver(schema) ? jsonReviver : undefined;
|
|
1023
1023
|
let parsed;
|
|
1024
1024
|
if (typeof data === "string") {
|
|
1025
|
+
if (data.length === 0) {
|
|
1026
|
+
return {};
|
|
1027
|
+
}
|
|
1025
1028
|
parsed = JSON.parse(data, reviver);
|
|
1026
1029
|
}
|
|
1027
1030
|
else if (data instanceof Uint8Array && detectBufferParsing()) {
|
|
1031
|
+
if (data.byteLength === 0) {
|
|
1032
|
+
return {};
|
|
1033
|
+
}
|
|
1028
1034
|
const buf = Buffer.isBuffer(data) ? data : Buffer.from(data.buffer, data.byteOffset, data.byteLength);
|
|
1029
1035
|
parsed = JSON.parse(buf, reviver);
|
|
1030
1036
|
}
|
|
1031
1037
|
else {
|
|
1032
|
-
parsed = await parseJsonBody(data, this.serdeContext);
|
|
1038
|
+
parsed = await parseJsonBody(data, this.serdeContext, schema);
|
|
1033
1039
|
}
|
|
1034
1040
|
return this._read(schema, parsed);
|
|
1035
1041
|
}
|
|
@@ -1045,19 +1051,23 @@ class JsonShapeDeserializer2 extends SerdeContextConfig {
|
|
|
1045
1051
|
}
|
|
1046
1052
|
if (Array.isArray(value) && ns.isListSchema()) {
|
|
1047
1053
|
const listMember = ns.getValueSchema();
|
|
1048
|
-
|
|
1049
|
-
|
|
1054
|
+
if (this.needsTransform(listMember)) {
|
|
1055
|
+
for (let i = 0; i < value.length; ++i) {
|
|
1056
|
+
value[i] = this._read(listMember, value[i]);
|
|
1057
|
+
}
|
|
1050
1058
|
}
|
|
1051
1059
|
return value;
|
|
1052
1060
|
}
|
|
1053
1061
|
if (ns.isMapSchema()) {
|
|
1054
1062
|
const mapMember = ns.getValueSchema();
|
|
1055
1063
|
const map = value;
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1064
|
+
if (this.needsTransform(mapMember)) {
|
|
1065
|
+
for (const k in map) {
|
|
1066
|
+
if (k === "__proto__") {
|
|
1067
|
+
writeKey(map);
|
|
1068
|
+
}
|
|
1069
|
+
map[k] = this._read(mapMember, map[k]);
|
|
1059
1070
|
}
|
|
1060
|
-
map[k] = this._read(mapMember, map[k]);
|
|
1061
1071
|
}
|
|
1062
1072
|
return map;
|
|
1063
1073
|
}
|
|
@@ -1133,10 +1143,6 @@ class JsonShapeDeserializer2 extends SerdeContextConfig {
|
|
|
1133
1143
|
}
|
|
1134
1144
|
}
|
|
1135
1145
|
}
|
|
1136
|
-
return value;
|
|
1137
|
-
}
|
|
1138
|
-
else {
|
|
1139
|
-
return value;
|
|
1140
1146
|
}
|
|
1141
1147
|
}
|
|
1142
1148
|
return value;
|
|
@@ -1144,9 +1150,10 @@ class JsonShapeDeserializer2 extends SerdeContextConfig {
|
|
|
1144
1150
|
_readStruct(ns, record) {
|
|
1145
1151
|
const union = ns.isUnionSchema();
|
|
1146
1152
|
const out = {};
|
|
1147
|
-
let nameMap
|
|
1153
|
+
let nameMap;
|
|
1154
|
+
const hasType = typeof record.__type === "string";
|
|
1148
1155
|
const { jsonName } = this.settings;
|
|
1149
|
-
if (jsonName) {
|
|
1156
|
+
if (jsonName && hasType) {
|
|
1150
1157
|
nameMap = {};
|
|
1151
1158
|
}
|
|
1152
1159
|
let unionSerde;
|
|
@@ -1157,7 +1164,9 @@ class JsonShapeDeserializer2 extends SerdeContextConfig {
|
|
|
1157
1164
|
let fromKey = memberName;
|
|
1158
1165
|
if (jsonName) {
|
|
1159
1166
|
fromKey = memberSchema.getMergedTraits().jsonName ?? fromKey;
|
|
1160
|
-
|
|
1167
|
+
if (hasType) {
|
|
1168
|
+
nameMap[fromKey] = memberName;
|
|
1169
|
+
}
|
|
1161
1170
|
}
|
|
1162
1171
|
if (union) {
|
|
1163
1172
|
unionSerde.mark(fromKey);
|
|
@@ -1169,7 +1178,7 @@ class JsonShapeDeserializer2 extends SerdeContextConfig {
|
|
|
1169
1178
|
if (union) {
|
|
1170
1179
|
unionSerde.writeUnknown();
|
|
1171
1180
|
}
|
|
1172
|
-
else if (
|
|
1181
|
+
else if (hasType) {
|
|
1173
1182
|
for (const k in record) {
|
|
1174
1183
|
const v = record[k];
|
|
1175
1184
|
const t = jsonName ? (nameMap[k] ?? k) : k;
|
|
@@ -1180,8 +1189,123 @@ class JsonShapeDeserializer2 extends SerdeContextConfig {
|
|
|
1180
1189
|
}
|
|
1181
1190
|
return out;
|
|
1182
1191
|
}
|
|
1192
|
+
needsTransform(ns) {
|
|
1193
|
+
if (ns.isBlobSchema() || ns.isTimestampSchema() || ns.isBigIntegerSchema() || ns.isBigDecimalSchema()) {
|
|
1194
|
+
return true;
|
|
1195
|
+
}
|
|
1196
|
+
if (ns.isDocumentSchema() || ns.isStructSchema() || ns.isListSchema() || ns.isMapSchema()) {
|
|
1197
|
+
return true;
|
|
1198
|
+
}
|
|
1199
|
+
if (ns.isStringSchema() && ns.getMergedTraits().mediaType) {
|
|
1200
|
+
return true;
|
|
1201
|
+
}
|
|
1202
|
+
return false;
|
|
1203
|
+
}
|
|
1183
1204
|
}
|
|
1184
1205
|
|
|
1206
|
+
class JsonBytesStringAdapter extends Uint8Array {
|
|
1207
|
+
string = null;
|
|
1208
|
+
static allocUnsafe(bytes) {
|
|
1209
|
+
if (typeof Buffer === "function") {
|
|
1210
|
+
const buffer = Buffer.allocUnsafe(bytes);
|
|
1211
|
+
return new JsonBytesStringAdapter(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
1212
|
+
}
|
|
1213
|
+
return new JsonBytesStringAdapter(bytes);
|
|
1214
|
+
}
|
|
1215
|
+
toString() {
|
|
1216
|
+
return this.s();
|
|
1217
|
+
}
|
|
1218
|
+
valueOf() {
|
|
1219
|
+
return this.s();
|
|
1220
|
+
}
|
|
1221
|
+
includes(searchString, position) {
|
|
1222
|
+
if (typeof searchString === "string") {
|
|
1223
|
+
return this.s().includes(searchString, position);
|
|
1224
|
+
}
|
|
1225
|
+
return Uint8Array.prototype.includes.call(this, searchString, position);
|
|
1226
|
+
}
|
|
1227
|
+
indexOf(searchString, position) {
|
|
1228
|
+
if (typeof searchString === "string") {
|
|
1229
|
+
return this.s().indexOf(searchString, position);
|
|
1230
|
+
}
|
|
1231
|
+
return Uint8Array.prototype.indexOf.call(this, searchString, position);
|
|
1232
|
+
}
|
|
1233
|
+
lastIndexOf(searchString, position) {
|
|
1234
|
+
if (typeof searchString === "string") {
|
|
1235
|
+
return this.s().lastIndexOf(searchString, position);
|
|
1236
|
+
}
|
|
1237
|
+
const fn = Uint8Array.prototype.lastIndexOf;
|
|
1238
|
+
if (position !== undefined) {
|
|
1239
|
+
return fn.call(this, searchString, position);
|
|
1240
|
+
}
|
|
1241
|
+
return fn.call(this, searchString);
|
|
1242
|
+
}
|
|
1243
|
+
startsWith(searchString, position) {
|
|
1244
|
+
return this.s().startsWith(searchString, position);
|
|
1245
|
+
}
|
|
1246
|
+
endsWith(searchString, endPosition) {
|
|
1247
|
+
return this.s().endsWith(searchString, endPosition);
|
|
1248
|
+
}
|
|
1249
|
+
match(regexp) {
|
|
1250
|
+
return this.s().match(regexp);
|
|
1251
|
+
}
|
|
1252
|
+
replace(searchValue, replaceValue) {
|
|
1253
|
+
return this.s().replace(searchValue, replaceValue);
|
|
1254
|
+
}
|
|
1255
|
+
search(regexp) {
|
|
1256
|
+
return this.s().search(regexp);
|
|
1257
|
+
}
|
|
1258
|
+
split(separator, limit) {
|
|
1259
|
+
return this.s().split(separator, limit);
|
|
1260
|
+
}
|
|
1261
|
+
substring(start, end) {
|
|
1262
|
+
return this.s().substring(start, end);
|
|
1263
|
+
}
|
|
1264
|
+
trim() {
|
|
1265
|
+
return this.s().trim();
|
|
1266
|
+
}
|
|
1267
|
+
trimStart() {
|
|
1268
|
+
return this.s().trimStart();
|
|
1269
|
+
}
|
|
1270
|
+
trimEnd() {
|
|
1271
|
+
return this.s().trimEnd();
|
|
1272
|
+
}
|
|
1273
|
+
charAt(pos) {
|
|
1274
|
+
return this.s().charAt(pos);
|
|
1275
|
+
}
|
|
1276
|
+
charCodeAt(index) {
|
|
1277
|
+
return this.s().charCodeAt(index);
|
|
1278
|
+
}
|
|
1279
|
+
padStart(maxLength, fillString) {
|
|
1280
|
+
return this.s().padStart(maxLength, fillString);
|
|
1281
|
+
}
|
|
1282
|
+
padEnd(maxLength, fillString) {
|
|
1283
|
+
return this.s().padEnd(maxLength, fillString);
|
|
1284
|
+
}
|
|
1285
|
+
repeat(count) {
|
|
1286
|
+
return this.s().repeat(count);
|
|
1287
|
+
}
|
|
1288
|
+
toUpperCase() {
|
|
1289
|
+
return this.s().toUpperCase();
|
|
1290
|
+
}
|
|
1291
|
+
toLowerCase() {
|
|
1292
|
+
return this.s().toLowerCase();
|
|
1293
|
+
}
|
|
1294
|
+
s() {
|
|
1295
|
+
if (this.string == null) {
|
|
1296
|
+
const n = Date.now();
|
|
1297
|
+
if (n > warned + 60_000) {
|
|
1298
|
+
console.warn("@aws-sdk/core/protocols - WARN - JsonCodec2: you have called a string method on a Uint8Array request body. " +
|
|
1299
|
+
"It has been automatically converted to string. In a future version this will throw an error.");
|
|
1300
|
+
warned = n;
|
|
1301
|
+
}
|
|
1302
|
+
this.string = toUtf8(this);
|
|
1303
|
+
}
|
|
1304
|
+
return this.string;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
var warned = 0;
|
|
1308
|
+
|
|
1185
1309
|
const encoder = new TextEncoder();
|
|
1186
1310
|
const OPEN_BRACE = 0x7b;
|
|
1187
1311
|
const CLOSE_BRACE = 0x7d;
|
|
@@ -1209,7 +1333,7 @@ for (let i = 0; i < 0x20; i++) {
|
|
|
1209
1333
|
}
|
|
1210
1334
|
const INITIAL_BUFFER_SIZE = 2048;
|
|
1211
1335
|
function alloc(size) {
|
|
1212
|
-
return
|
|
1336
|
+
return JsonBytesStringAdapter.allocUnsafe(size);
|
|
1213
1337
|
}
|
|
1214
1338
|
class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
1215
1339
|
settings;
|
|
@@ -1227,10 +1351,7 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
|
1227
1351
|
this.i = 0;
|
|
1228
1352
|
this.rawValue = value;
|
|
1229
1353
|
this.rootSchema = NormalizedSchema.of(schema);
|
|
1230
|
-
this.passthrough =
|
|
1231
|
-
!this.rootSchema.isStructSchema() &&
|
|
1232
|
-
!this.rootSchema.isDocumentSchema() &&
|
|
1233
|
-
(this.rootSchema.isBlobSchema() || this.rootSchema.isStringSchema());
|
|
1354
|
+
this.passthrough = this.rootSchema.isBlobSchema() || this.rootSchema.isStringSchema();
|
|
1234
1355
|
if (!this.passthrough) {
|
|
1235
1356
|
this.writeValue(this.rootSchema, value, undefined);
|
|
1236
1357
|
}
|
|
@@ -1240,30 +1361,13 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
|
1240
1361
|
this.rootSchema = NormalizedSchema.of(schema);
|
|
1241
1362
|
const ns = this.rootSchema;
|
|
1242
1363
|
if (ns.isStructSchema() && value != null && typeof value === "object") {
|
|
1243
|
-
this.
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
this.
|
|
1247
|
-
this.
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
1251
|
-
const item = value[memberName];
|
|
1252
|
-
if (item == null && !memberSchema.isIdempotencyToken()) {
|
|
1253
|
-
continue;
|
|
1254
|
-
}
|
|
1255
|
-
if (wroteAny) {
|
|
1256
|
-
this.ensure(1);
|
|
1257
|
-
this.json[this.i++] = COMMA;
|
|
1258
|
-
}
|
|
1259
|
-
const targetKey = jsonName ? (memberSchema.getMergedTraits().jsonName ?? memberName) : memberName;
|
|
1260
|
-
this.writeAsciiQuoted(targetKey);
|
|
1261
|
-
this.json[this.i++] = COLON;
|
|
1262
|
-
this.writeValue(memberSchema, item, ns);
|
|
1263
|
-
wroteAny = true;
|
|
1264
|
-
}
|
|
1265
|
-
this.ensure(1);
|
|
1266
|
-
this.json[this.i++] = CLOSE_BRACE;
|
|
1364
|
+
this.writeValue(ns, value, undefined);
|
|
1365
|
+
const prefix = `"__type":"${ns.getName(true) ?? "Unknown"}",`;
|
|
1366
|
+
const z = prefix.length;
|
|
1367
|
+
this.ensure(z);
|
|
1368
|
+
this.json.copyWithin(1 + z, 1, this.i);
|
|
1369
|
+
encoder.encodeInto(prefix, this.json.subarray(1));
|
|
1370
|
+
this.i += z;
|
|
1267
1371
|
}
|
|
1268
1372
|
else {
|
|
1269
1373
|
this.writeValue(ns, value, undefined);
|
|
@@ -1316,7 +1420,7 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
|
1316
1420
|
this.i = i;
|
|
1317
1421
|
}
|
|
1318
1422
|
writeJsonString(s) {
|
|
1319
|
-
this.ensure(s.length *
|
|
1423
|
+
this.ensure(s.length * 3 + 2);
|
|
1320
1424
|
this.json[this.i++] = QUOTE;
|
|
1321
1425
|
const z = s.length;
|
|
1322
1426
|
for (let j = 0; j < z; ++j) {
|
|
@@ -1343,7 +1447,7 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
|
1343
1447
|
this.ensure(4);
|
|
1344
1448
|
const { written } = encoder.encodeInto(s.substring(j, j + 2), this.json.subarray(this.i));
|
|
1345
1449
|
this.i += written;
|
|
1346
|
-
j
|
|
1450
|
+
++j;
|
|
1347
1451
|
}
|
|
1348
1452
|
else {
|
|
1349
1453
|
this.ensure(6);
|
|
@@ -1383,8 +1487,9 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
|
1383
1487
|
static B64 = (() => {
|
|
1384
1488
|
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1385
1489
|
const table = new Uint8Array(64);
|
|
1386
|
-
for (let i = 0; i < 64; i
|
|
1490
|
+
for (let i = 0; i < 64; ++i) {
|
|
1387
1491
|
table[i] = chars.charCodeAt(i);
|
|
1492
|
+
}
|
|
1388
1493
|
return table;
|
|
1389
1494
|
})();
|
|
1390
1495
|
writeBase64(data) {
|
|
@@ -1511,14 +1616,16 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
|
1511
1616
|
}
|
|
1512
1617
|
if (typeof value === "boolean") {
|
|
1513
1618
|
this.ensure(5);
|
|
1619
|
+
let { i, json } = this;
|
|
1514
1620
|
if (value) {
|
|
1515
|
-
|
|
1516
|
-
|
|
1621
|
+
json.set(TRUE, i);
|
|
1622
|
+
i += 4;
|
|
1517
1623
|
}
|
|
1518
1624
|
else {
|
|
1519
|
-
|
|
1520
|
-
|
|
1625
|
+
json.set(FALSE, i);
|
|
1626
|
+
i += 5;
|
|
1521
1627
|
}
|
|
1628
|
+
this.i = i;
|
|
1522
1629
|
return;
|
|
1523
1630
|
}
|
|
1524
1631
|
if (typeof value === "bigint") {
|
|
@@ -1530,7 +1637,6 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
|
1530
1637
|
writeStruct(ns, value) {
|
|
1531
1638
|
this.ensure(2);
|
|
1532
1639
|
this.json[this.i++] = OPEN_BRACE;
|
|
1533
|
-
let first = true;
|
|
1534
1640
|
let wroteAny = false;
|
|
1535
1641
|
const hasType = typeof value.__type === "string";
|
|
1536
1642
|
let writtenKeys;
|
|
@@ -1539,13 +1645,13 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
|
1539
1645
|
}
|
|
1540
1646
|
for (const [memberName, memberSchema] of ns.structIterator()) {
|
|
1541
1647
|
const item = value[memberName];
|
|
1542
|
-
if (item == null && !memberSchema.isIdempotencyToken())
|
|
1648
|
+
if (item == null && !memberSchema.isIdempotencyToken()) {
|
|
1543
1649
|
continue;
|
|
1544
|
-
|
|
1650
|
+
}
|
|
1651
|
+
if (wroteAny) {
|
|
1545
1652
|
this.ensure(1);
|
|
1546
1653
|
this.json[this.i++] = COMMA;
|
|
1547
1654
|
}
|
|
1548
|
-
first = false;
|
|
1549
1655
|
wroteAny = true;
|
|
1550
1656
|
const targetKey = this.settings.jsonName ? (memberSchema.getMergedTraits().jsonName ?? memberName) : memberName;
|
|
1551
1657
|
if (writtenKeys) {
|
|
@@ -1568,17 +1674,17 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
|
1568
1674
|
}
|
|
1569
1675
|
else if (hasType) {
|
|
1570
1676
|
for (const k in value) {
|
|
1571
|
-
|
|
1572
|
-
if (writtenKeys.has(targetKey))
|
|
1677
|
+
if (writtenKeys.has(k)) {
|
|
1573
1678
|
continue;
|
|
1574
|
-
|
|
1679
|
+
}
|
|
1680
|
+
writtenKeys.add(k);
|
|
1575
1681
|
const v = value[k];
|
|
1576
|
-
if (
|
|
1682
|
+
if (wroteAny) {
|
|
1577
1683
|
this.ensure(1);
|
|
1578
1684
|
this.json[this.i++] = COMMA;
|
|
1579
1685
|
}
|
|
1580
|
-
|
|
1581
|
-
this.writeAsciiQuoted(
|
|
1686
|
+
wroteAny = true;
|
|
1687
|
+
this.writeAsciiQuoted(k);
|
|
1582
1688
|
this.ensure(1);
|
|
1583
1689
|
this.json[this.i++] = COLON;
|
|
1584
1690
|
this.writeValue(15, v, undefined);
|
|
@@ -1588,20 +1694,30 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
|
1588
1694
|
this.json[this.i++] = CLOSE_BRACE;
|
|
1589
1695
|
}
|
|
1590
1696
|
writeList(ns, value, isDocument) {
|
|
1591
|
-
this.ensure(2);
|
|
1592
|
-
this.json[this.i++] = OPEN_BRACKET;
|
|
1593
1697
|
const sparse = !!ns.getMergedTraits().sparse;
|
|
1594
1698
|
const valueSchema = ns.getValueSchema();
|
|
1699
|
+
if (!isDocument) {
|
|
1700
|
+
if (valueSchema.isStringSchema() || valueSchema.isNumericSchema() || valueSchema.isBooleanSchema()) {
|
|
1701
|
+
const json = sparse ? JSON.stringify(value) : JSON.stringify(value.filter((_) => _ != null));
|
|
1702
|
+
this.ensure(json.length * 3);
|
|
1703
|
+
this.i += encoder.encodeInto(json, this.json.subarray(this.i)).written;
|
|
1704
|
+
return;
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
this.ensure(2);
|
|
1708
|
+
this.json[this.i++] = OPEN_BRACKET;
|
|
1709
|
+
let wroteFirstItem = false;
|
|
1595
1710
|
for (let i = 0; i < value.length; ++i) {
|
|
1596
1711
|
const item = value[i];
|
|
1597
1712
|
if (isDocument ? item === undefined : item == null && !sparse) {
|
|
1598
1713
|
continue;
|
|
1599
1714
|
}
|
|
1600
|
-
if (
|
|
1715
|
+
if (wroteFirstItem) {
|
|
1601
1716
|
this.ensure(1);
|
|
1602
1717
|
this.json[this.i++] = COMMA;
|
|
1603
1718
|
}
|
|
1604
1719
|
this.writeValue(valueSchema, item, undefined);
|
|
1720
|
+
wroteFirstItem = true;
|
|
1605
1721
|
}
|
|
1606
1722
|
this.ensure(1);
|
|
1607
1723
|
this.json[this.i++] = CLOSE_BRACKET;
|
|
@@ -1623,8 +1739,7 @@ class JsonShapeSerializer2 extends SerdeContextConfig {
|
|
|
1623
1739
|
}
|
|
1624
1740
|
const json = JSON.stringify(input);
|
|
1625
1741
|
this.ensure(json.length * 3);
|
|
1626
|
-
|
|
1627
|
-
this.i += written;
|
|
1742
|
+
this.i += encoder.encodeInto(json, this.json.subarray(this.i)).written;
|
|
1628
1743
|
return;
|
|
1629
1744
|
}
|
|
1630
1745
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { toUtf8 } from "@smithy/core/serde";
|
|
2
|
+
export class JsonBytesStringAdapter extends Uint8Array {
|
|
3
|
+
string = null;
|
|
4
|
+
static allocUnsafe(bytes) {
|
|
5
|
+
if (typeof Buffer === "function") {
|
|
6
|
+
const buffer = Buffer.allocUnsafe(bytes);
|
|
7
|
+
return new JsonBytesStringAdapter(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
8
|
+
}
|
|
9
|
+
return new JsonBytesStringAdapter(bytes);
|
|
10
|
+
}
|
|
11
|
+
toString() {
|
|
12
|
+
return this.s();
|
|
13
|
+
}
|
|
14
|
+
valueOf() {
|
|
15
|
+
return this.s();
|
|
16
|
+
}
|
|
17
|
+
includes(searchString, position) {
|
|
18
|
+
if (typeof searchString === "string") {
|
|
19
|
+
return this.s().includes(searchString, position);
|
|
20
|
+
}
|
|
21
|
+
return Uint8Array.prototype.includes.call(this, searchString, position);
|
|
22
|
+
}
|
|
23
|
+
indexOf(searchString, position) {
|
|
24
|
+
if (typeof searchString === "string") {
|
|
25
|
+
return this.s().indexOf(searchString, position);
|
|
26
|
+
}
|
|
27
|
+
return Uint8Array.prototype.indexOf.call(this, searchString, position);
|
|
28
|
+
}
|
|
29
|
+
lastIndexOf(searchString, position) {
|
|
30
|
+
if (typeof searchString === "string") {
|
|
31
|
+
return this.s().lastIndexOf(searchString, position);
|
|
32
|
+
}
|
|
33
|
+
const fn = Uint8Array.prototype.lastIndexOf;
|
|
34
|
+
if (position !== undefined) {
|
|
35
|
+
return fn.call(this, searchString, position);
|
|
36
|
+
}
|
|
37
|
+
return fn.call(this, searchString);
|
|
38
|
+
}
|
|
39
|
+
startsWith(searchString, position) {
|
|
40
|
+
return this.s().startsWith(searchString, position);
|
|
41
|
+
}
|
|
42
|
+
endsWith(searchString, endPosition) {
|
|
43
|
+
return this.s().endsWith(searchString, endPosition);
|
|
44
|
+
}
|
|
45
|
+
match(regexp) {
|
|
46
|
+
return this.s().match(regexp);
|
|
47
|
+
}
|
|
48
|
+
replace(searchValue, replaceValue) {
|
|
49
|
+
return this.s().replace(searchValue, replaceValue);
|
|
50
|
+
}
|
|
51
|
+
search(regexp) {
|
|
52
|
+
return this.s().search(regexp);
|
|
53
|
+
}
|
|
54
|
+
split(separator, limit) {
|
|
55
|
+
return this.s().split(separator, limit);
|
|
56
|
+
}
|
|
57
|
+
substring(start, end) {
|
|
58
|
+
return this.s().substring(start, end);
|
|
59
|
+
}
|
|
60
|
+
trim() {
|
|
61
|
+
return this.s().trim();
|
|
62
|
+
}
|
|
63
|
+
trimStart() {
|
|
64
|
+
return this.s().trimStart();
|
|
65
|
+
}
|
|
66
|
+
trimEnd() {
|
|
67
|
+
return this.s().trimEnd();
|
|
68
|
+
}
|
|
69
|
+
charAt(pos) {
|
|
70
|
+
return this.s().charAt(pos);
|
|
71
|
+
}
|
|
72
|
+
charCodeAt(index) {
|
|
73
|
+
return this.s().charCodeAt(index);
|
|
74
|
+
}
|
|
75
|
+
padStart(maxLength, fillString) {
|
|
76
|
+
return this.s().padStart(maxLength, fillString);
|
|
77
|
+
}
|
|
78
|
+
padEnd(maxLength, fillString) {
|
|
79
|
+
return this.s().padEnd(maxLength, fillString);
|
|
80
|
+
}
|
|
81
|
+
repeat(count) {
|
|
82
|
+
return this.s().repeat(count);
|
|
83
|
+
}
|
|
84
|
+
toUpperCase() {
|
|
85
|
+
return this.s().toUpperCase();
|
|
86
|
+
}
|
|
87
|
+
toLowerCase() {
|
|
88
|
+
return this.s().toLowerCase();
|
|
89
|
+
}
|
|
90
|
+
s() {
|
|
91
|
+
if (this.string == null) {
|
|
92
|
+
const n = Date.now();
|
|
93
|
+
if (n > warned + 60_000) {
|
|
94
|
+
console.warn("@aws-sdk/core/protocols - WARN - JsonCodec2: you have called a string method on a Uint8Array request body. " +
|
|
95
|
+
"It has been automatically converted to string. In a future version this will throw an error.");
|
|
96
|
+
warned = n;
|
|
97
|
+
}
|
|
98
|
+
this.string = toUtf8(this);
|
|
99
|
+
}
|
|
100
|
+
return this.string;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
var warned = 0;
|