lambda-toolkit 0.0.6-beta → 0.0.8-beta

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.
Files changed (2) hide show
  1. package/dist/index.js +57 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1211,6 +1211,11 @@ module.exports = createInstance( args => clientProvider( TimestreamQueryClient,
1211
1211
 
1212
1212
  const { ScalarType } = __webpack_require__( 1671 );
1213
1213
 
1214
+ const parseBigInt = value => {
1215
+ const asInt = parseInt( value, 10 );
1216
+ return asInt <= Number.MAX_SAFE_INTEGER && asInt >= Number.MIN_SAFE_INTEGER ? asInt : value;
1217
+ };
1218
+
1214
1219
  const parseScalarValue = ( type, value ) => {
1215
1220
  switch ( type ) {
1216
1221
  case ScalarType.BOOLEAN:
@@ -1223,8 +1228,9 @@ const parseScalarValue = ( type, value ) => {
1223
1228
  return parseInt( value, 10 );
1224
1229
  case ScalarType.UNKNOWN: // is NULL
1225
1230
  return null;
1226
- case ScalarType.VARCHAR:
1227
1231
  case ScalarType.BIGINT:
1232
+ return parseBigInt( value );
1233
+ case ScalarType.VARCHAR:
1228
1234
  case ScalarType.DATE:
1229
1235
  case ScalarType.TIME:
1230
1236
  case ScalarType.INTERVAL_DAY_TO_SECOND:
@@ -1440,6 +1446,7 @@ const aws = __webpack_require__( 4870 );
1440
1446
  const epoch = __webpack_require__( 3830 );
1441
1447
  const math = __webpack_require__( 943 );
1442
1448
  const object = __webpack_require__( 5762 );
1449
+ const redis = __webpack_require__( 4528 );
1443
1450
  const string = __webpack_require__( 268 );
1444
1451
  const utils = __webpack_require__( 6878 );
1445
1452
 
@@ -1450,6 +1457,7 @@ module.exports = {
1450
1457
  LambdaApi,
1451
1458
  math,
1452
1459
  object,
1460
+ redis,
1453
1461
  string,
1454
1462
  utils
1455
1463
  };
@@ -2164,6 +2172,54 @@ const change = ( obj, keepAllCaps ) =>
2164
2172
  module.exports = ( obj, { keepAllCaps = false } = {} ) => change( obj, keepAllCaps );
2165
2173
 
2166
2174
 
2175
+ /***/ }),
2176
+
2177
+ /***/ 5422:
2178
+ /***/ ((module) => {
2179
+
2180
+ global.__redisInstances = {};
2181
+
2182
+ /**
2183
+ * Create a redis client instance
2184
+ * @param {Object} redis Redis npm dependency
2185
+ * @param {String} address Redis DB address (either RW or RO)
2186
+ * @returns redisClient A new redis client instance connected to the database
2187
+ */
2188
+ module.exports = async ( { redis, address, protocol = 'rediss', port = 6379 } ) => {
2189
+ if ( global.__redisInstances[address] ) {
2190
+ try {
2191
+ const r = await global.__redisInstances[address].ping();
2192
+ if ( r === 'PONG' ) {
2193
+ return global.__redisInstances[address];
2194
+ } else {
2195
+ delete global.__redisInstances[address];
2196
+ }
2197
+ } catch {
2198
+ delete global.__redisInstances[address];
2199
+ }
2200
+ }
2201
+
2202
+ const client = redis.createClient( { url: `${protocol}://${address}:${port}`, socket: { keepAlive: 15000 } } );
2203
+
2204
+ await client.connect();
2205
+
2206
+ global.__redisInstances[address] = client;
2207
+ return client;
2208
+ };
2209
+
2210
+
2211
+ /***/ }),
2212
+
2213
+ /***/ 4528:
2214
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2215
+
2216
+ const createClient = __webpack_require__( 5422 );
2217
+
2218
+ module.exports = {
2219
+ createClient
2220
+ };
2221
+
2222
+
2167
2223
  /***/ }),
2168
2224
 
2169
2225
  /***/ 3914:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lambda-toolkit",
3
- "version": "0.0.6-beta",
3
+ "version": "0.0.8-beta",
4
4
  "description": "A set of tools to help and simplify Node Js code development for AWS Lambdas",
5
5
  "files": [
6
6
  "./license",