@aws-sdk/lib-dynamodb 3.503.0 → 3.504.0
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 +30 -1
- package/dist-es/commands/utils.js +28 -1
- package/package.json +3 -3
package/dist-cjs/index.js
CHANGED
|
@@ -107,9 +107,38 @@ var processAllKeysInObj = /* @__PURE__ */ __name((obj, processFunc, keyNodes) =>
|
|
|
107
107
|
return acc;
|
|
108
108
|
}, {});
|
|
109
109
|
}, "processAllKeysInObj");
|
|
110
|
+
function copyWithoutFunctions(o, depth = 0) {
|
|
111
|
+
if (depth > 1e3) {
|
|
112
|
+
throw new Error(
|
|
113
|
+
"Recursive copy depth exceeded 1000. Please set options.convertClassInstanceToMap to false and manually remove functions from your data object."
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
if (typeof o === "object" || typeof o === "function") {
|
|
117
|
+
if (Array.isArray(o)) {
|
|
118
|
+
return o.filter((item) => typeof item !== "function").map((item) => copyWithoutFunctions(item, depth + 1));
|
|
119
|
+
}
|
|
120
|
+
if (o === null) {
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
const copy = {};
|
|
124
|
+
for (const [key, value] of Object.entries(o)) {
|
|
125
|
+
if (typeof value !== "function") {
|
|
126
|
+
copy[key] = copyWithoutFunctions(value, depth + 1);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return copy;
|
|
130
|
+
} else {
|
|
131
|
+
return o;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
__name(copyWithoutFunctions, "copyWithoutFunctions");
|
|
110
135
|
var marshallInput = /* @__PURE__ */ __name((obj, keyNodes, options) => {
|
|
136
|
+
let _obj = obj;
|
|
137
|
+
if (options == null ? void 0 : options.convertClassInstanceToMap) {
|
|
138
|
+
_obj = copyWithoutFunctions(obj);
|
|
139
|
+
}
|
|
111
140
|
const marshallFunc = /* @__PURE__ */ __name((toMarshall) => (0, import_util_dynamodb.marshall)(toMarshall, options), "marshallFunc");
|
|
112
|
-
return processKeysInObj(
|
|
141
|
+
return processKeysInObj(_obj, marshallFunc, keyNodes);
|
|
113
142
|
}, "marshallInput");
|
|
114
143
|
var unmarshallOutput = /* @__PURE__ */ __name((obj, keyNodes, options) => {
|
|
115
144
|
const unmarshallFunc = /* @__PURE__ */ __name((toMarshall) => (0, import_util_dynamodb.unmarshall)(toMarshall, options), "unmarshallFunc");
|
|
@@ -57,9 +57,36 @@ const processAllKeysInObj = (obj, processFunc, keyNodes) => {
|
|
|
57
57
|
return acc;
|
|
58
58
|
}, {});
|
|
59
59
|
};
|
|
60
|
+
function copyWithoutFunctions(o, depth = 0) {
|
|
61
|
+
if (depth > 1000) {
|
|
62
|
+
throw new Error("Recursive copy depth exceeded 1000. Please set options.convertClassInstanceToMap to false and manually remove functions from your data object.");
|
|
63
|
+
}
|
|
64
|
+
if (typeof o === "object" || typeof o === "function") {
|
|
65
|
+
if (Array.isArray(o)) {
|
|
66
|
+
return o.filter((item) => typeof item !== "function").map((item) => copyWithoutFunctions(item, depth + 1));
|
|
67
|
+
}
|
|
68
|
+
if (o === null) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const copy = {};
|
|
72
|
+
for (const [key, value] of Object.entries(o)) {
|
|
73
|
+
if (typeof value !== "function") {
|
|
74
|
+
copy[key] = copyWithoutFunctions(value, depth + 1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return copy;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
return o;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
60
83
|
export const marshallInput = (obj, keyNodes, options) => {
|
|
84
|
+
let _obj = obj;
|
|
85
|
+
if (options?.convertClassInstanceToMap) {
|
|
86
|
+
_obj = copyWithoutFunctions(obj);
|
|
87
|
+
}
|
|
61
88
|
const marshallFunc = (toMarshall) => marshall(toMarshall, options);
|
|
62
|
-
return processKeysInObj(
|
|
89
|
+
return processKeysInObj(_obj, marshallFunc, keyNodes);
|
|
63
90
|
};
|
|
64
91
|
export const unmarshallOutput = (obj, keyNodes, options) => {
|
|
65
92
|
const unmarshallFunc = (toMarshall) => unmarshall(toMarshall, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-sdk/lib-dynamodb",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.504.0",
|
|
4
4
|
"description": "The document client simplifies working with items in Amazon DynamoDB by abstracting away the notion of attribute values.",
|
|
5
5
|
"main": "./dist-cjs/index.js",
|
|
6
6
|
"module": "./dist-es/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"license": "Apache-2.0",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aws-sdk/util-dynamodb": "3.
|
|
29
|
+
"@aws-sdk/util-dynamodb": "3.504.0",
|
|
30
30
|
"@smithy/smithy-client": "^2.3.1",
|
|
31
31
|
"@smithy/types": "^2.9.1",
|
|
32
32
|
"tslib": "^2.5.0"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@aws-sdk/client-dynamodb": "^3.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@aws-sdk/client-dynamodb": "3.
|
|
38
|
+
"@aws-sdk/client-dynamodb": "3.504.0",
|
|
39
39
|
"@tsconfig/recommended": "1.0.1",
|
|
40
40
|
"@types/node": "^14.14.31",
|
|
41
41
|
"concurrently": "7.0.0",
|