@aws-sdk/lib-dynamodb 3.521.0 → 3.525.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 +20 -36
- package/dist-es/commands/utils.js +20 -34
- package/package.json +5 -5
package/dist-cjs/index.js
CHANGED
|
@@ -72,7 +72,9 @@ var processObj = /* @__PURE__ */ __name((obj, processFunc, keyNodes) => {
|
|
|
72
72
|
return processAllKeysInObj(obj, processFunc, SELF);
|
|
73
73
|
} else if (goToNextLevel) {
|
|
74
74
|
return Object.entries(obj ?? {}).reduce((acc, [k, v]) => {
|
|
75
|
-
|
|
75
|
+
if (typeof v !== "function") {
|
|
76
|
+
acc[k] = processObj(v, processFunc, keyNodes[NEXT_LEVEL]);
|
|
77
|
+
}
|
|
76
78
|
return acc;
|
|
77
79
|
}, Array.isArray(obj) ? [] : {});
|
|
78
80
|
}
|
|
@@ -83,13 +85,21 @@ var processObj = /* @__PURE__ */ __name((obj, processFunc, keyNodes) => {
|
|
|
83
85
|
var processKeysInObj = /* @__PURE__ */ __name((obj, processFunc, keyNodes) => {
|
|
84
86
|
let accumulator;
|
|
85
87
|
if (Array.isArray(obj)) {
|
|
86
|
-
accumulator = [...obj];
|
|
88
|
+
accumulator = [...obj].filter((item) => typeof item !== "function");
|
|
87
89
|
} else {
|
|
88
|
-
accumulator = {
|
|
90
|
+
accumulator = {};
|
|
91
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
92
|
+
if (typeof v !== "function") {
|
|
93
|
+
accumulator[k] = v;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
89
96
|
}
|
|
90
97
|
for (const [nodeKey, nodes] of Object.entries(keyNodes)) {
|
|
98
|
+
if (typeof obj[nodeKey] === "function") {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
91
101
|
const processedValue = processObj(obj[nodeKey], processFunc, nodes);
|
|
92
|
-
if (processedValue !== void 0) {
|
|
102
|
+
if (processedValue !== void 0 && typeof processedValue !== "function") {
|
|
93
103
|
accumulator[nodeKey] = processedValue;
|
|
94
104
|
}
|
|
95
105
|
}
|
|
@@ -97,48 +107,22 @@ var processKeysInObj = /* @__PURE__ */ __name((obj, processFunc, keyNodes) => {
|
|
|
97
107
|
}, "processKeysInObj");
|
|
98
108
|
var processAllKeysInObj = /* @__PURE__ */ __name((obj, processFunc, keyNodes) => {
|
|
99
109
|
if (Array.isArray(obj)) {
|
|
100
|
-
return obj.map((item) => processObj(item, processFunc, keyNodes));
|
|
110
|
+
return obj.filter((item) => typeof item !== "function").map((item) => processObj(item, processFunc, keyNodes));
|
|
101
111
|
}
|
|
102
112
|
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
113
|
+
if (typeof value === "function") {
|
|
114
|
+
return acc;
|
|
115
|
+
}
|
|
103
116
|
const processedValue = processObj(value, processFunc, keyNodes);
|
|
104
|
-
if (processedValue !== void 0) {
|
|
117
|
+
if (processedValue !== void 0 && typeof processedValue !== "function") {
|
|
105
118
|
acc[key] = processedValue;
|
|
106
119
|
}
|
|
107
120
|
return acc;
|
|
108
121
|
}, {});
|
|
109
122
|
}, "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");
|
|
135
123
|
var marshallInput = /* @__PURE__ */ __name((obj, keyNodes, options) => {
|
|
136
|
-
let _obj = obj;
|
|
137
|
-
if (options == null ? void 0 : options.convertClassInstanceToMap) {
|
|
138
|
-
_obj = copyWithoutFunctions(obj);
|
|
139
|
-
}
|
|
140
124
|
const marshallFunc = /* @__PURE__ */ __name((toMarshall) => (0, import_util_dynamodb.marshall)(toMarshall, options), "marshallFunc");
|
|
141
|
-
return processKeysInObj(
|
|
125
|
+
return processKeysInObj(obj, marshallFunc, keyNodes);
|
|
142
126
|
}, "marshallInput");
|
|
143
127
|
var unmarshallOutput = /* @__PURE__ */ __name((obj, keyNodes, options) => {
|
|
144
128
|
const unmarshallFunc = /* @__PURE__ */ __name((toMarshall) => (0, import_util_dynamodb.unmarshall)(toMarshall, options), "unmarshallFunc");
|
|
@@ -21,7 +21,9 @@ const processObj = (obj, processFunc, keyNodes) => {
|
|
|
21
21
|
}
|
|
22
22
|
else if (goToNextLevel) {
|
|
23
23
|
return Object.entries(obj ?? {}).reduce((acc, [k, v]) => {
|
|
24
|
-
|
|
24
|
+
if (typeof v !== "function") {
|
|
25
|
+
acc[k] = processObj(v, processFunc, keyNodes[NEXT_LEVEL]);
|
|
26
|
+
}
|
|
25
27
|
return acc;
|
|
26
28
|
}, (Array.isArray(obj) ? [] : {}));
|
|
27
29
|
}
|
|
@@ -32,14 +34,22 @@ const processObj = (obj, processFunc, keyNodes) => {
|
|
|
32
34
|
const processKeysInObj = (obj, processFunc, keyNodes) => {
|
|
33
35
|
let accumulator;
|
|
34
36
|
if (Array.isArray(obj)) {
|
|
35
|
-
accumulator = [...obj];
|
|
37
|
+
accumulator = [...obj].filter((item) => typeof item !== "function");
|
|
36
38
|
}
|
|
37
39
|
else {
|
|
38
|
-
accumulator = {
|
|
40
|
+
accumulator = {};
|
|
41
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
42
|
+
if (typeof v !== "function") {
|
|
43
|
+
accumulator[k] = v;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
39
46
|
}
|
|
40
47
|
for (const [nodeKey, nodes] of Object.entries(keyNodes)) {
|
|
48
|
+
if (typeof obj[nodeKey] === "function") {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
41
51
|
const processedValue = processObj(obj[nodeKey], processFunc, nodes);
|
|
42
|
-
if (processedValue !== undefined) {
|
|
52
|
+
if (processedValue !== undefined && typeof processedValue !== "function") {
|
|
43
53
|
accumulator[nodeKey] = processedValue;
|
|
44
54
|
}
|
|
45
55
|
}
|
|
@@ -47,46 +57,22 @@ const processKeysInObj = (obj, processFunc, keyNodes) => {
|
|
|
47
57
|
};
|
|
48
58
|
const processAllKeysInObj = (obj, processFunc, keyNodes) => {
|
|
49
59
|
if (Array.isArray(obj)) {
|
|
50
|
-
return obj.map((item) => processObj(item, processFunc, keyNodes));
|
|
60
|
+
return obj.filter((item) => typeof item !== "function").map((item) => processObj(item, processFunc, keyNodes));
|
|
51
61
|
}
|
|
52
62
|
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
63
|
+
if (typeof value === "function") {
|
|
64
|
+
return acc;
|
|
65
|
+
}
|
|
53
66
|
const processedValue = processObj(value, processFunc, keyNodes);
|
|
54
|
-
if (processedValue !== undefined) {
|
|
67
|
+
if (processedValue !== undefined && typeof processedValue !== "function") {
|
|
55
68
|
acc[key] = processedValue;
|
|
56
69
|
}
|
|
57
70
|
return acc;
|
|
58
71
|
}, {});
|
|
59
72
|
};
|
|
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
|
-
}
|
|
83
73
|
export const marshallInput = (obj, keyNodes, options) => {
|
|
84
|
-
let _obj = obj;
|
|
85
|
-
if (options?.convertClassInstanceToMap) {
|
|
86
|
-
_obj = copyWithoutFunctions(obj);
|
|
87
|
-
}
|
|
88
74
|
const marshallFunc = (toMarshall) => marshall(toMarshall, options);
|
|
89
|
-
return processKeysInObj(
|
|
75
|
+
return processKeysInObj(obj, marshallFunc, keyNodes);
|
|
90
76
|
};
|
|
91
77
|
export const unmarshallOutput = (obj, keyNodes, options) => {
|
|
92
78
|
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.525.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,16 +26,16 @@
|
|
|
26
26
|
},
|
|
27
27
|
"license": "Apache-2.0",
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@aws-sdk/util-dynamodb": "3.
|
|
30
|
-
"@smithy/smithy-client": "^2.4.
|
|
31
|
-
"@smithy/types": "^2.10.
|
|
29
|
+
"@aws-sdk/util-dynamodb": "3.525.0",
|
|
30
|
+
"@smithy/smithy-client": "^2.4.2",
|
|
31
|
+
"@smithy/types": "^2.10.1",
|
|
32
32
|
"tslib": "^2.5.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
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.525.0",
|
|
39
39
|
"@tsconfig/recommended": "1.0.1",
|
|
40
40
|
"@types/node": "^14.14.31",
|
|
41
41
|
"concurrently": "7.0.0",
|