electrodb 2.14.3 → 2.15.1
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/index.d.ts +38 -40
- package/package.json +5 -4
- package/src/client.js +14 -5
package/index.d.ts
CHANGED
|
@@ -2718,33 +2718,21 @@ type GoBatchGetTerminal<
|
|
|
2718
2718
|
? "preserveBatchOrder" extends keyof Options
|
|
2719
2719
|
? Options["preserveBatchOrder"] extends true
|
|
2720
2720
|
? Promise<{
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2721
|
+
data: Array<
|
|
2722
|
+
Resolve<
|
|
2723
|
+
| {
|
|
2724
|
+
[Name in keyof ResponseItem as Name extends Attr
|
|
2725
|
+
? Name
|
|
2726
|
+
: never]: ResponseItem[Name];
|
|
2727
|
+
}
|
|
2728
|
+
| null
|
|
2729
|
+
>
|
|
2730
|
+
>;
|
|
2731
|
+
unprocessed: Array<
|
|
2732
|
+
Resolve<AllTableIndexCompositeAttributes<A, F, C, S>>
|
|
2733
|
+
>;
|
|
2734
|
+
}>
|
|
2735
2735
|
: Promise<{
|
|
2736
|
-
data: Array<
|
|
2737
|
-
Resolve<{
|
|
2738
|
-
[Name in keyof ResponseItem as Name extends Attr
|
|
2739
|
-
? Name
|
|
2740
|
-
: never]: ResponseItem[Name];
|
|
2741
|
-
}>
|
|
2742
|
-
>;
|
|
2743
|
-
unprocessed: Array<
|
|
2744
|
-
Resolve<AllTableIndexCompositeAttributes<A, F, C, S>>
|
|
2745
|
-
>;
|
|
2746
|
-
}>
|
|
2747
|
-
: Promise<{
|
|
2748
2736
|
data: Array<
|
|
2749
2737
|
Resolve<{
|
|
2750
2738
|
[Name in keyof ResponseItem as Name extends Attr
|
|
@@ -2756,24 +2744,36 @@ type GoBatchGetTerminal<
|
|
|
2756
2744
|
Resolve<AllTableIndexCompositeAttributes<A, F, C, S>>
|
|
2757
2745
|
>;
|
|
2758
2746
|
}>
|
|
2747
|
+
: Promise<{
|
|
2748
|
+
data: Array<
|
|
2749
|
+
Resolve<{
|
|
2750
|
+
[Name in keyof ResponseItem as Name extends Attr
|
|
2751
|
+
? Name
|
|
2752
|
+
: never]: ResponseItem[Name];
|
|
2753
|
+
}>
|
|
2754
|
+
>;
|
|
2755
|
+
unprocessed: Array<
|
|
2756
|
+
Resolve<AllTableIndexCompositeAttributes<A, F, C, S>>
|
|
2757
|
+
>;
|
|
2758
|
+
}>
|
|
2759
2759
|
: "preserveBatchOrder" extends keyof Options
|
|
2760
|
-
|
|
2761
|
-
|
|
2760
|
+
? Options["preserveBatchOrder"] extends true
|
|
2761
|
+
? Promise<{
|
|
2762
2762
|
data: Array<Resolve<ResponseItem | null>>;
|
|
2763
2763
|
unprocessed: Array<
|
|
2764
2764
|
Resolve<AllTableIndexCompositeAttributes<A, F, C, S>>
|
|
2765
2765
|
>;
|
|
2766
|
-
}
|
|
2767
|
-
|
|
2766
|
+
}>
|
|
2767
|
+
: Promise<{
|
|
2768
2768
|
data: Array<Resolve<ResponseItem>>;
|
|
2769
2769
|
unprocessed: Array<
|
|
2770
2770
|
Resolve<AllTableIndexCompositeAttributes<A, F, C, S>>
|
|
2771
2771
|
>;
|
|
2772
|
-
}
|
|
2773
|
-
|
|
2772
|
+
}>
|
|
2773
|
+
: Promise<{
|
|
2774
2774
|
data: Array<Resolve<ResponseItem>>;
|
|
2775
2775
|
unprocessed: Array<Resolve<AllTableIndexCompositeAttributes<A, F, C, S>>>;
|
|
2776
|
-
}
|
|
2776
|
+
}>;
|
|
2777
2777
|
|
|
2778
2778
|
type GoGetTerminal<
|
|
2779
2779
|
A extends string,
|
|
@@ -2912,16 +2912,14 @@ export type DeleteRecordOperationGo<ResponseType, Keys> = <
|
|
|
2912
2912
|
options?: Options,
|
|
2913
2913
|
) => Options extends infer O
|
|
2914
2914
|
? "response" extends keyof O
|
|
2915
|
-
? O["response"] extends "
|
|
2916
|
-
? Promise<{ data: T }>
|
|
2917
|
-
: O["response"] extends "all_old"
|
|
2918
|
-
? Promise<{ data: T }>
|
|
2915
|
+
? O["response"] extends "all_old"
|
|
2916
|
+
? Promise<{ data: T | null }>
|
|
2919
2917
|
: O["response"] extends "default"
|
|
2920
|
-
? Promise<{ data: Keys }>
|
|
2918
|
+
? Promise<{ data: Keys | null }>
|
|
2921
2919
|
: O["response"] extends "none"
|
|
2922
2920
|
? Promise<{ data: null }>
|
|
2923
|
-
: Promise<{ data:
|
|
2924
|
-
: Promise<{ data: Keys }>
|
|
2921
|
+
: Promise<{ data: Keys | null }>
|
|
2922
|
+
: Promise<{ data: Keys | null }>
|
|
2925
2923
|
: never;
|
|
2926
2924
|
|
|
2927
2925
|
export type BatchWriteGo<ResponseType> = <O extends BulkOptions>(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electrodb",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.1",
|
|
4
4
|
"description": "A library to more easily create and interact with multiple entities and heretical relationships in dynamodb",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"@types/mocha": "^8.0.3",
|
|
56
56
|
"@types/node": "^15.14.9",
|
|
57
57
|
"@types/uuid": "^8.3.0",
|
|
58
|
+
"aws-cdk-lib": "^2.100.0",
|
|
58
59
|
"aws-sdk": "2.630.0",
|
|
59
60
|
"browserify": "^17.0.0",
|
|
60
61
|
"chai": "4.2.0",
|
|
@@ -72,8 +73,7 @@
|
|
|
72
73
|
"ts-node": "^10.9.1",
|
|
73
74
|
"tsd": "^0.28.1",
|
|
74
75
|
"typescript": "^5.2.2",
|
|
75
|
-
"uuid": "7.0.1"
|
|
76
|
-
"aws-cdk-lib": "^2.100.0"
|
|
76
|
+
"uuid": "7.0.1"
|
|
77
77
|
},
|
|
78
78
|
"keywords": [
|
|
79
79
|
"electrodb",
|
|
@@ -88,7 +88,8 @@
|
|
|
88
88
|
"directory": "test"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@aws-sdk/lib-dynamodb": "3.
|
|
91
|
+
"@aws-sdk/lib-dynamodb": "^3.654.0",
|
|
92
|
+
"@aws-sdk/util-dynamodb": "^3.654.0",
|
|
92
93
|
"jsonschema": "1.2.7"
|
|
93
94
|
}
|
|
94
95
|
}
|
package/src/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const lib = require('@aws-sdk/lib-dynamodb')
|
|
2
|
-
const util = require('@aws-sdk/
|
|
2
|
+
const util = require('@aws-sdk/util-dynamodb')
|
|
3
3
|
const { isFunction } = require("./validations");
|
|
4
4
|
const { ElectroError, ErrorCodes } = require("./errors");
|
|
5
5
|
const DocumentClientVersions = {
|
|
@@ -7,7 +7,16 @@ const DocumentClientVersions = {
|
|
|
7
7
|
v3: "v3",
|
|
8
8
|
electro: "electro",
|
|
9
9
|
};
|
|
10
|
-
const
|
|
10
|
+
const unmarshallItem = (value) => {
|
|
11
|
+
const unmarshall = util.unmarshall || ((val) => val);
|
|
12
|
+
try {
|
|
13
|
+
value.Item = unmarshall(value.Item);
|
|
14
|
+
} catch(err) {
|
|
15
|
+
console.error('Internal Error: Failed to unmarshal input', err);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
11
20
|
|
|
12
21
|
const v3Methods = ["send"];
|
|
13
22
|
const v2Methods = [
|
|
@@ -89,7 +98,7 @@ class DocumentClientV2Wrapper {
|
|
|
89
98
|
return {
|
|
90
99
|
canceled: cancellationReasons.map((reason) => {
|
|
91
100
|
if (reason.Item) {
|
|
92
|
-
return
|
|
101
|
+
return unmarshallItem(reason);
|
|
93
102
|
}
|
|
94
103
|
return reason;
|
|
95
104
|
}),
|
|
@@ -202,7 +211,7 @@ class DocumentClientV3Wrapper {
|
|
|
202
211
|
return {
|
|
203
212
|
canceled: err.CancellationReasons.map((reason) => {
|
|
204
213
|
if (reason.Item) {
|
|
205
|
-
return
|
|
214
|
+
return unmarshallItem(reason);
|
|
206
215
|
}
|
|
207
216
|
return reason;
|
|
208
217
|
}),
|
|
@@ -225,7 +234,7 @@ class DocumentClientV3Wrapper {
|
|
|
225
234
|
return {
|
|
226
235
|
canceled: err.CancellationReasons.map((reason) => {
|
|
227
236
|
if (reason.Item) {
|
|
228
|
-
return
|
|
237
|
+
return unmarshallItem(reason);
|
|
229
238
|
}
|
|
230
239
|
return reason;
|
|
231
240
|
}),
|