@ikonintegration/ikapi 3.0.0-alpha1 → 3.0.0-alpha2
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/package.json
CHANGED
package/src/Database/DDB/IKDB.js
CHANGED
|
@@ -32,7 +32,6 @@ export default class IKDB_DDB extends IKDB {
|
|
|
32
32
|
} else {
|
|
33
33
|
// localConsole.debug("Starting remote database connection");
|
|
34
34
|
//initialize connection
|
|
35
|
-
AWS.config.update({httpOptions: sslAgent, region: this.region});
|
|
36
35
|
this.connection = new DynamoDB({
|
|
37
36
|
region: this.region,
|
|
38
37
|
requestHandler: new NodeHttpHandler({
|
|
@@ -80,19 +80,3 @@ export default class IKDBQueryPut extends IKDBBaseQuery {
|
|
|
80
80
|
} return expression;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
/*marshalling should be done
|
|
86
|
-
let unMarshalled = dbResp.Items.map((item) => {
|
|
87
|
-
let i = AWS.DynamoDB.Converter.unmarshall(item);
|
|
88
|
-
const { gsi1sk, gsi3pk,...otherProps } = i;
|
|
89
|
-
const activitydate = gsi1sk;
|
|
90
|
-
const ctid = gsi3pk;
|
|
91
|
-
const ret = { activitydate, ctid, ...otherProps };
|
|
92
|
-
console.log("um:", ret);
|
|
93
|
-
return ret;
|
|
94
|
-
});
|
|
95
|
-
unMarshalled.request_data = AWS.DynamoDB.Converter.unmarshall(unMarshalled.request_data);
|
|
96
|
-
console.log(unMarshalled);
|
|
97
|
-
return unMarshalled;
|
|
98
|
-
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import IKDBQuery from './IKDBQuery';
|
|
2
|
+
import { convertToAttr, marshall, unmarshall } from "@aws-sdk/util-dynamodb";
|
|
2
3
|
//
|
|
3
4
|
export default class IKDBQueryPut extends IKDBQuery {
|
|
4
5
|
constructor() {
|
|
@@ -17,8 +18,8 @@ export default class IKDBQueryPut extends IKDBQuery {
|
|
|
17
18
|
(source[key].length > 0))) {
|
|
18
19
|
//Check for object conversion
|
|
19
20
|
let val;
|
|
20
|
-
if (isObject) val = {"M":
|
|
21
|
-
else val =
|
|
21
|
+
if (isObject) val = {"M": marshall(source[key])};
|
|
22
|
+
else val = convertToAttr(source[key]);
|
|
22
23
|
//valid
|
|
23
24
|
if (val != undefined) { this.putItems[key]= val; }
|
|
24
25
|
// console.debug("Apppending key:", key, " val:", val);
|
|
@@ -32,7 +33,7 @@ export default class IKDBQueryPut extends IKDBQuery {
|
|
|
32
33
|
localConsole.log('Putting item: ', query);
|
|
33
34
|
const resp = await dbManager.connection.putItem(query).promise();
|
|
34
35
|
// localConsole.log('Raw result: ', resp);
|
|
35
|
-
const unmarshalled = resp.Items.map(
|
|
36
|
+
const unmarshalled = resp.Items.map(unmarshall);
|
|
36
37
|
localConsole.log('Parsed result: ', unmarshalled);
|
|
37
38
|
return unmarshalled;
|
|
38
39
|
}
|