fintalk-pkg 2.3.13 → 2.3.17

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.
@@ -1,4 +1,4 @@
1
- const logger = require("./Logger");
1
+ const logger = require("ton-logger")
2
2
 
3
3
  let controller = null;
4
4
 
@@ -20,7 +20,6 @@ module.exports.setController = function(_c) {
20
20
 
21
21
  module.exports.success = (obj, forceBody) => {
22
22
  var statusCode = 200;
23
- logLambda(statusCode, obj, controller, forceBody);
24
23
  return {
25
24
  statusCode: statusCode,
26
25
  body: stringifyIfIsObject(obj),
@@ -65,133 +64,15 @@ module.exports.redirect = (url) => {
65
64
  };
66
65
  };
67
66
 
68
- function logLambda(statusCode, resBody, forceBody) {
69
-
70
- if(controller != null) {
71
-
72
- var start = controller.start;
73
- var method = controller.event.httpMethod != null ? controller.event.httpMethod : "";
74
- var userAgent = "";
75
- var consumerIp = "";
76
-
77
- if(controller.event != null && controller.event.headers != null) {
78
- userAgent = controller.event.headers["User-Agent"] != null ? controller.event.headers["User-Agent"] : "";
79
- }
80
-
81
- if(controller.event != null && controller.event.requestContext != null && controller.event.requestContext.identity != null && controller.event.requestContext.identity.sourceIp != null) {
82
- consumerIp = controller.event.requestContext.identity.sourceIp;
83
- }
84
-
85
- let resLength = 0;
86
- if(resBody != null) {
87
- if(typeof resBody !== "string") {
88
- resBody = JSON.stringify(resBody, Object.getOwnPropertyNames(resBody));
89
- }
90
- resLength = Buffer.byteLength(resBody);
91
- }
92
-
93
- if(resBody == null || (statusCode == 200 && !forceBody)) {
94
- resBody = {};
95
- }
96
-
97
- let logObj = {
98
- httpLog : controller.http,
99
- date : start,
100
- duration : new Date - start,
101
- method : method,
102
- statusCode : statusCode,
103
- path : controller.event.path != null ? controller.event.path : "",
104
- resBody : resBody,
105
- resLength : resLength,
106
- query : controller.event.queryStringParameters != null ? controller.event.queryStringParameters : {},
107
- body : controller.event.body != null ? controller.event.body : {},
108
- header: controller.event.headers != null ? controller.event.headers : {},
109
- userAgent: userAgent,
110
- consumerIp : consumerIp,
111
- sendToDataLake : true
112
- };
113
-
114
- if(controller.warmup) {
115
- logObj.warmup = controller.warmup;
116
- }
117
-
118
- if(controller.coldStart) {
119
- logObj.coldStart = controller.coldStart;
120
- }
121
-
122
- logger.log(JSON.stringify(logObj), true, false);
123
-
124
- }
125
-
67
+ function logLambda(statusCode, resBody, _) {
68
+ logger.info({
69
+ message: 'Lambda response',
70
+ statusCode,
71
+ response: resBody
72
+ })
126
73
  }
127
74
 
128
75
  module.exports.setEnvVariables = async function(names, paths) {
129
- // const { SSM } = require("@aws-sdk/client-ssm-node");
130
- // const ssm = new SSM({ region: "us-east-1" });
131
-
132
- // let namesToQuery = [];
133
- // let query = [];
134
- // let request;
135
- // let values;
136
-
137
- // if (names != null) {
138
-
139
- // var cache = false;
140
-
141
- // Object.keys(names).forEach(function (item) {
142
- // if (process.env[item]) {
143
- // cache = true;
144
- // }
145
- // namesToQuery.push(names[item]);
146
- // });
147
-
148
- // if (cache)
149
- // return;
150
-
151
- // let query = {
152
- // "Names": namesToQuery,
153
- // "WithDecryption": false,
154
- // };
155
-
156
- // let request = await ssm.getParameters(query);
157
- // let values = request.Parameters;
158
-
159
- // for (let i = 0; i < values.length; i++) {
160
- // const element = values[i];
161
-
162
- // for (let j = 0; j < Object.keys(names).length; j++) {
163
- // const iName = Object.keys(names)[j];
164
- // if(names[iName] == element.Name) {
165
- // process.env[iName] = element.Value;
166
- // break;
167
- // }
168
-
169
- // }
170
-
171
- // }
172
- // }
173
-
174
- // if (paths != null) {
175
- // for (let i = 0; i < Object.keys(paths).length; i++) {
176
- // const path = Object.keys(paths)[i];
177
-
178
- // //TEF_MUNDIPAGG-PK
179
- // query = {
180
- // "Path": paths[path],
181
- // "WithDecryption": false,
182
- // };
183
-
184
- // request = await ssm.getParametersByPath(query).promise();
185
- // values = request.Parameters;
186
-
187
- // for (let j = 0; j < values.length; j++) {
188
- // const element = values[j];
189
- // const name = path + "_" + element.Name.substring(element.Name.lastIndexOf("/") + 1, element.Name.length).toUpperCase();
190
- // process.env[name] = element.Value;
191
- // }
192
-
193
- // }
194
- // }
195
76
 
196
77
  }
197
78
 
package/model/Customer.js CHANGED
@@ -81,6 +81,7 @@ var CustomerSchema = new Schema({
81
81
  userData3: String,
82
82
  userData4: String,
83
83
  userData5: String,
84
+ isAudioOutputEnabled: { type: Boolean, default: false },
84
85
  optin: { type: Boolean, default: false }
85
86
  },
86
87
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fintalk-pkg",
3
- "version": "2.3.13",
3
+ "version": "2.3.17",
4
4
  "description": "Common code between projects",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -25,7 +25,8 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "dotenv": "^6.2.0",
28
- "dynamoose": "^2.3.0"
28
+ "dynamoose": "^2.3.0",
29
+ "ton-logger": "~1.1.2"
29
30
  },
30
31
  "pre-commit": {
31
32
  "run": [