@aws-sdk/dynamodb-codec 3.973.20 → 3.973.22
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/dist-cjs/index.js +12 -14
- package/package.json +5 -5
package/dist-cjs/index.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
const { JsonCodec, JsonShapeSerializer, JsonShapeDeserializer } = require("@aws-sdk/core/protocols");
|
|
2
|
+
const { NormalizedSchema } = require("@smithy/core/schema");
|
|
3
|
+
const { toBase64, fromBase64 } = require("@smithy/core/serde");
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
var schema = require('@smithy/core/schema');
|
|
5
|
-
var serde = require('@smithy/core/serde');
|
|
6
|
-
|
|
7
|
-
class DynamoDBJsonCodec extends protocols.JsonCodec {
|
|
5
|
+
class DynamoDBJsonCodec extends JsonCodec {
|
|
8
6
|
constructor() {
|
|
9
7
|
super({
|
|
10
8
|
timestampFormat: {
|
|
@@ -26,14 +24,14 @@ class DynamoDBJsonCodec extends protocols.JsonCodec {
|
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
const ATTRIBUTE_VALUE = "com.amazonaws.dynamodb#AttributeValue";
|
|
29
|
-
class DynamoDBJsonShapeSerializer extends
|
|
30
|
-
_write(schema
|
|
31
|
-
const ns =
|
|
27
|
+
class DynamoDBJsonShapeSerializer extends JsonShapeSerializer {
|
|
28
|
+
_write(schema, value, container) {
|
|
29
|
+
const ns = NormalizedSchema.of(schema);
|
|
32
30
|
if (ns.isStructSchema() && ns.getName(true) === ATTRIBUTE_VALUE) {
|
|
33
31
|
if (value && typeof value === "object") {
|
|
34
32
|
const av = value;
|
|
35
33
|
const out = this.copyRemoveNulls(av);
|
|
36
|
-
const base64Encode = this.serdeContext?.base64Encoder ??
|
|
34
|
+
const base64Encode = this.serdeContext?.base64Encoder ?? toBase64;
|
|
37
35
|
if (av.B instanceof Uint8Array) {
|
|
38
36
|
out.B = base64Encode(av.B);
|
|
39
37
|
}
|
|
@@ -90,14 +88,14 @@ class DynamoDBJsonShapeSerializer extends protocols.JsonShapeSerializer {
|
|
|
90
88
|
return out;
|
|
91
89
|
}
|
|
92
90
|
}
|
|
93
|
-
class DynamoDBJsonShapeDeserializer extends
|
|
94
|
-
_read(schema
|
|
95
|
-
const ns =
|
|
91
|
+
class DynamoDBJsonShapeDeserializer extends JsonShapeDeserializer {
|
|
92
|
+
_read(schema, value) {
|
|
93
|
+
const ns = NormalizedSchema.of(schema);
|
|
96
94
|
if (ns.isStructSchema() && ns.getName(true) === ATTRIBUTE_VALUE) {
|
|
97
95
|
if (value && typeof value === "object") {
|
|
98
96
|
const av = value;
|
|
99
97
|
const out = av;
|
|
100
|
-
const base64Decoder = this.serdeContext?.base64Decoder ??
|
|
98
|
+
const base64Decoder = this.serdeContext?.base64Decoder ?? fromBase64;
|
|
101
99
|
if (typeof av.B === "string") {
|
|
102
100
|
out.B = base64Decoder(av.B);
|
|
103
101
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/dynamodb-codec",
|
|
3
|
-
"version": "3.973.
|
|
3
|
+
"version": "3.973.22",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "concurrently 'yarn:build:types' 'yarn:build:es' && yarn build:cjs",
|
|
6
6
|
"build:cjs": "node ../../scripts/compilation/inline",
|
|
7
|
-
"build:es": "tsc -p tsconfig.es.json",
|
|
7
|
+
"build:es": "premove dist-es && tsc -p tsconfig.es.json",
|
|
8
8
|
"build:include:deps": "yarn g:turbo run build -F=\"$npm_package_name\"",
|
|
9
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
9
|
+
"build:types": "premove dist-types && tsc -p tsconfig.types.json",
|
|
10
10
|
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
11
|
-
"clean": "premove dist-cjs dist-es dist-types
|
|
11
|
+
"clean": "premove dist-cjs dist-es dist-types",
|
|
12
12
|
"test": "yarn g:vitest run",
|
|
13
13
|
"test:watch": "yarn g:vitest watch"
|
|
14
14
|
},
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@aws-sdk/core": "^3.974.
|
|
25
|
+
"@aws-sdk/core": "^3.974.22",
|
|
26
26
|
"@smithy/core": "^3.24.6",
|
|
27
27
|
"@smithy/types": "^4.14.3",
|
|
28
28
|
"tslib": "^2.6.2"
|