lambda-toolkit 0.0.5-beta → 0.0.7-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.
- package/dist/index.js +22 -8
- 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:
|
|
@@ -1286,16 +1292,24 @@ const { QueryCommand } = __webpack_require__( 1671 );
|
|
|
1286
1292
|
const { camelize } = __webpack_require__( 5762 );
|
|
1287
1293
|
const parseItems = __webpack_require__( 7261 );
|
|
1288
1294
|
|
|
1289
|
-
|
|
1295
|
+
const query = async ( client, queryString, { prevItems = [], recursive, paginationToken, maxRows, rawResponse } ) => {
|
|
1290
1296
|
const response = await client.send( new QueryCommand( { QueryString: queryString, NextToken: paginationToken, MaxRows: maxRows } ) );
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
+
if ( !recursive && rawResponse ) {
|
|
1298
|
+
return response;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
const nextToken = response.NextToken;
|
|
1302
|
+
if ( nextToken && recursive ) {
|
|
1303
|
+
return query( client, queryString, { prevItems: parseItems( response ), recursive, paginationToken: nextToken, maxRows } );
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
const items = prevItems.concat( parseItems( response ) );
|
|
1307
|
+
return { nextToken, count: items.length, items, queryStatus: camelize( response.QueryStatus ) };
|
|
1297
1308
|
};
|
|
1298
1309
|
|
|
1310
|
+
module.exports = async ( client, queryString, { recursive = false, paginationToken = undefined, maxRows = undefined, rawResponse = false } = {} ) =>
|
|
1311
|
+
query( client, queryString, { recursive, paginationToken, maxRows, rawResponse } );
|
|
1312
|
+
|
|
1299
1313
|
|
|
1300
1314
|
/***/ }),
|
|
1301
1315
|
|