fintalk-pkg 2.8.2 → 3.0.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.js CHANGED
@@ -1,16 +1,37 @@
1
- module.exports = {
2
-
3
- //EXTERNALS
4
- Dynamoose: require("dynamoose"),
1
+ const dynamoose = require("dynamoose");
2
+ const { DynamoDB } = require('@aws-sdk/client-dynamodb');
3
+ const { DynamoDBDocument } = require('@aws-sdk/lib-dynamodb');
4
+
5
+ const marshallOptions = {
6
+ removeUndefinedValues: true,
7
+ convertClassInstanceToMap: true
8
+ };
9
+ const dynamodb = DynamoDBDocument.from(new DynamoDB(), { marshallOptions });
10
+ dynamoose.aws.ddb.set(dynamodb);
5
11
 
6
- //SCHEMAS
7
- CustomerSchema : require("./model/Customer"),
8
- TransactionSchema : require("./model/Transaction"),
9
- AuxSchema: require("./model/AuxStructure"),
12
+ const { marshall, unmarshall } = require('@aws-sdk/util-dynamodb');
13
+ dynamoose.aws.converter = () => ({
14
+ marshall: (obj) => marshall(obj, marshallOptions),
15
+ unmarshall: (obj) => unmarshall(obj),
16
+ convertToAttr: (obj) => marshall(obj, marshallOptions),
17
+ convertToNative: (obj) => unmarshall(obj)
18
+ });
10
19
 
11
- BaseController : require("./base/BaseController"),
12
- FlowControl : require("./base/FlowControl"),
13
- Logger : require("./base/Logger")
20
+ const CustomerSchema = require("./model/Customer");
21
+ const TransactionSchema = require("./model/Transaction");
22
+ const AuxSchema = require("./model/AuxStructure");
23
+ const BaseController = require("./base/BaseController");
24
+ const FlowControl = require("./base/FlowControl");
25
+ const Logger = require("./base/Logger");
26
+
27
+ module.exports = {
28
+ Dynamoose: dynamoose,
29
+ CustomerSchema,
30
+ TransactionSchema,
31
+ AuxSchema,
32
+ BaseController,
33
+ FlowControl,
34
+ Logger,
14
35
  };
15
36
 
16
37
  console.info("Lib Exported!");
@@ -1,5 +1,15 @@
1
1
  const dynamoose = require("dynamoose");
2
- dynamoose.model.defaults.set({ create: false, waitForActive: false });
2
+ const { DynamoDB } = require('@aws-sdk/client-dynamodb');
3
+ const { DynamoDBDocument } = require('@aws-sdk/lib-dynamodb');
4
+
5
+ const marshallOptions = {
6
+ removeUndefinedValues: true,
7
+ convertClassInstanceToMap: true
8
+ };
9
+ const translateConfig = { marshallOptions };
10
+ const dynamodb = DynamoDBDocument.from(new DynamoDB(), translateConfig);
11
+ dynamoose.aws.ddb.set(dynamodb);
12
+
3
13
  var Schema = dynamoose.Schema;
4
14
 
5
15
  var AudioCacheSchema = new Schema({
@@ -9,4 +19,4 @@ var AudioCacheSchema = new Schema({
9
19
  timestamps: true
10
20
  });
11
21
 
12
- module.exports = dynamoose.model("fintalk-orchestrator-audio-cache", AudioCacheSchema, {"expires": {"ttl": (72 * (60 * 60)), "attribute": "ttl" }});
22
+ module.exports = dynamoose.model("fintalk-orchestrator-audio-cache", AudioCacheSchema, { create: false, waitForActive: false, "expires": {"ttl": (72 * (60 * 60)), "attribute": "ttl" }});
@@ -1,6 +1,15 @@
1
1
  const dynamoose = require("dynamoose");
2
+ const { DynamoDB } = require('@aws-sdk/client-dynamodb');
3
+ const { DynamoDBDocument } = require('@aws-sdk/lib-dynamodb');
4
+
5
+ const marshallOptions = {
6
+ removeUndefinedValues: true,
7
+ convertClassInstanceToMap: true
8
+ };
9
+ const translateConfig = { marshallOptions };
10
+ const dynamodb = DynamoDBDocument.from(new DynamoDB(), translateConfig);
11
+ dynamoose.aws.ddb.set(dynamodb);
2
12
 
3
- dynamoose.model.defaults.set({ create: false, waitForActive: false });
4
13
  const Schema = dynamoose.Schema;
5
14
 
6
15
  const AuxStructureSchema = new Schema(
@@ -20,4 +29,4 @@ const AuxStructureSchema = new Schema(
20
29
  },
21
30
  );
22
31
 
23
- module.exports = dynamoose.model("fintalk-orchestrator-aux-structure", AuxStructureSchema);
32
+ module.exports = dynamoose.model("fintalk-orchestrator-aux-structure", AuxStructureSchema, { create: false, waitForActive: false });
@@ -1,5 +1,15 @@
1
1
  const dynamoose = require("dynamoose");
2
- dynamoose.model.defaults.set({ create: false, waitForActive: false });
2
+ const { DynamoDB } = require('@aws-sdk/client-dynamodb');
3
+ const { DynamoDBDocument } = require('@aws-sdk/lib-dynamodb');
4
+
5
+ const marshallOptions = {
6
+ removeUndefinedValues: true,
7
+ convertClassInstanceToMap: true
8
+ };
9
+ const translateConfig = { marshallOptions };
10
+ const dynamodb = DynamoDBDocument.from(new DynamoDB(), translateConfig);
11
+ dynamoose.aws.ddb.set(dynamodb);
12
+
3
13
  var Schema = dynamoose.Schema;
4
14
 
5
15
  var ConversationSchema = new Schema({
@@ -33,4 +43,4 @@ var ConversationSchema = new Schema({
33
43
  timestamps: true
34
44
  });
35
45
 
36
- module.exports = dynamoose.model("fintalk-orchestrator-conversations", ConversationSchema, {"expires": {"ttl": 2592000000, "attribute": "expires" }});
46
+ module.exports = dynamoose.model("fintalk-orchestrator-conversations", ConversationSchema, { create: false, waitForActive: false, "expires": {"ttl": 2592000000, "attribute": "expires" }});
package/model/Customer.js CHANGED
@@ -1,6 +1,14 @@
1
1
  const dynamoose = require("dynamoose");
2
+ const { DynamoDB } = require('@aws-sdk/client-dynamodb');
3
+ const { DynamoDBDocument } = require('@aws-sdk/lib-dynamodb');
2
4
 
3
- dynamoose.model.defaults.set({ create: false, waitForActive: false });
5
+ const marshallOptions = {
6
+ removeUndefinedValues: true,
7
+ convertClassInstanceToMap: true
8
+ };
9
+ const translateConfig = { marshallOptions };
10
+ const dynamodb = DynamoDBDocument.from(new DynamoDB(), translateConfig);
11
+ dynamoose.aws.ddb.set(dynamodb);
4
12
 
5
13
  var Schema = dynamoose.Schema;
6
14
 
@@ -138,7 +146,7 @@ var CustomerSchema = new Schema({
138
146
  },
139
147
  {
140
148
  timestamps: true,
141
- saveUnknown: ['postbackHeaders.**']
149
+ saveUnknown: ["postbackHeaders.**"]
142
150
  });
143
151
 
144
152
  /* creditCards: [{ type: mongoose.Schema.Types.ObjectId, ref: "CreditCard" }],*/
@@ -1,5 +1,15 @@
1
1
  const dynamoose = require("dynamoose");
2
- dynamoose.model.defaults.set({ create: false, waitForActive: false });
2
+ const { DynamoDB } = require('@aws-sdk/client-dynamodb');
3
+ const { DynamoDBDocument } = require('@aws-sdk/lib-dynamodb');
4
+
5
+ const marshallOptions = {
6
+ removeUndefinedValues: true,
7
+ convertClassInstanceToMap: true
8
+ };
9
+ const translateConfig = { marshallOptions };
10
+ const dynamodb = DynamoDBDocument.from(new DynamoDB(), translateConfig);
11
+ dynamoose.aws.ddb.set(dynamodb);
12
+
3
13
  var Schema = dynamoose.Schema;
4
14
 
5
15
  const TransactionStatus = {
@@ -41,6 +51,6 @@ var TransactionSchema = new Schema({
41
51
  saveUnknown: true
42
52
  });
43
53
 
44
- const Transaction = dynamoose.model(`payment-get-data-${process.env.STAGE}-transaction`, TransactionSchema, {"expires": {"ttl": 3600000 }});
54
+ const Transaction = dynamoose.model(`payment-get-data-${process.env.STAGE}-transaction`, TransactionSchema, { create: false, waitForActive: false, "expires": {"ttl": 3600000 }});
45
55
 
46
56
  module.exports = { Transaction, TransactionStatus };
package/model/Vars.js CHANGED
@@ -1,5 +1,15 @@
1
1
  const dynamoose = require("dynamoose");
2
- dynamoose.model.defaults.set({ create: false, waitForActive: false });
2
+ const { DynamoDB } = require('@aws-sdk/client-dynamodb');
3
+ const { DynamoDBDocument } = require('@aws-sdk/lib-dynamodb');
4
+
5
+ const marshallOptions = {
6
+ removeUndefinedValues: true,
7
+ convertClassInstanceToMap: true
8
+ };
9
+ const translateConfig = { marshallOptions };
10
+ const dynamodb = DynamoDBDocument.from(new DynamoDB(), translateConfig);
11
+ dynamoose.aws.ddb.set(dynamodb);
12
+
3
13
  var Schema = dynamoose.Schema;
4
14
 
5
15
  var VarsSchema = new Schema({
@@ -9,4 +19,4 @@ var VarsSchema = new Schema({
9
19
  timestamps: false
10
20
  });
11
21
 
12
- module.exports = dynamoose.model(`fintalk-orchestrator-${process.env.BOT}-vars`, VarsSchema);
22
+ module.exports = dynamoose.model(`fintalk-orchestrator-${process.env.BOT}-vars`, VarsSchema, { create: false, waitForActive: false });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fintalk-pkg",
3
- "version": "2.8.2",
3
+ "version": "3.0.1",
4
4
  "description": "Common code between projects",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -24,7 +24,7 @@
24
24
  "uuid": "^8.0.0"
25
25
  },
26
26
  "dependencies": {
27
- "dynamoose": "~2.8.8",
27
+ "dynamoose": "~4.0.4",
28
28
  "fintalk-logger": "~1.1.3"
29
29
  }
30
30
  }
@@ -1,33 +0,0 @@
1
- name: Sonarqube Checks
2
-
3
- on:
4
- push:
5
- branches:
6
- - '*'
7
- pull_request:
8
- types: [opened, synchronize, reopened]
9
-
10
- jobs:
11
- build:
12
- name: Build
13
- runs-on: self-hosted
14
- permissions: read-all
15
- steps:
16
- - uses: actions/checkout@v2
17
- with:
18
- fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
19
- - uses: sonarsource/sonarqube-scan-action@master
20
- with:
21
- args: >
22
- -Dsonar.projectKey=fintalk-ai_${{ github.event.repository.name }}
23
- env:
24
- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
25
- SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
26
- # If you wish to fail your job when the Quality Gate is red, uncomment the
27
- # following lines. This would typically be used to fail a deployment.
28
- # We do not recommend to use this in a pull request. Prefer using pull request
29
- # decoration instead.
30
- # - uses: sonarsource/sonarqube-quality-gate-action@master
31
- # timeout-minutes: 5
32
- # env:
33
- # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}