data-api-client
Advanced tools
Comparing version 1.0.0 to 1.0.1
27
index.js
@@ -98,3 +98,3 @@ 'use strict' | ||
values.includes(x) ? acc : Object.assign(acc,{ [x]: obj[x] }) | ||
,{}) | ||
,{}) | ||
@@ -104,6 +104,6 @@ // Utility function for picking certain keys from an object | ||
values.includes(x) ? Object.assign(acc,{ [x]: obj[x] }) : acc | ||
,{}) | ||
,{}) | ||
// Utility function for flattening arrays - deprecated | ||
// const flatten = arr => arr.reduce((acc,x) => acc.concat(x),[]) | ||
// Utility function for flattening arrays | ||
const flatten = arr => arr.reduce((acc,x) => acc.concat(x),[]) | ||
@@ -115,14 +115,5 @@ // Normize parameters so that they are all in standard format | ||
: acc.concat(splitParams(p)) | ||
,[]) // end reduce | ||
,[]) // end reduce | ||
// // Annotate parameters with correct types | ||
// const annotateParams = params => params.reduce((acc,p) => | ||
// Array.isArray(p) ? acc.concat([annotateParams(p)]) | ||
// : Object.keys(p).length === 2 && p.name && p.value ? acc.concat(p) | ||
// : acc.concat( | ||
// formatParam(Object.keys(p)[0],Object.values(p)[0]) | ||
// ) | ||
// ,[]) // end reduce | ||
// Prepare parameters | ||
@@ -300,6 +291,6 @@ const processParams = (sql,sqlParams,params,row=0) => { | ||
// Query function (use standard form for `this` context) | ||
const query = async function(config,...args) { | ||
const query = async function(config,..._args) { | ||
// Deprecated this since it was collapsing batches | ||
// const args = flatten(_args) | ||
// Flatten array if nested arrays (fixes #30) | ||
const args = Array.isArray(_args[0]) ? flatten(_args) : _args | ||
@@ -346,4 +337,2 @@ // Parse and process sql | ||
// FOR DEBUGGING: console.log(JSON.stringify(result,null,2)) | ||
// Format and return the results | ||
@@ -350,0 +339,0 @@ return formatResults( |
{ | ||
"name": "data-api-client", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A lightweight wrapper that simplifies working with the Amazon Aurora Serverless Data API", | ||
@@ -8,2 +8,3 @@ "main": "index.js", | ||
"test": "jest", | ||
"test-ci": "eslint . && jest", | ||
"lint": "eslint ." | ||
@@ -28,4 +29,4 @@ }, | ||
"devDependencies": { | ||
"aws-sdk": "^2.466.0", | ||
"eslint": "^6.6.0", | ||
"aws-sdk": "^2.588.0", | ||
"eslint": "^6.7.2", | ||
"jest": "^25.0.0", | ||
@@ -32,0 +33,0 @@ "rewire": "^4.0.1" |
# Aurora Serverless Data API Client | ||
[![Build Status](https://travis-ci.org/jeremydaly/data-api-client.svg?branch=master)](https://travis-ci.org/jeremydaly/data-api-client) | ||
[![npm](https://img.shields.io/npm/v/data-api-client.svg)](https://www.npmjs.com/package/data-api-client) | ||
[![npm](https://img.shields.io/npm/l/data-api-client.svg)](https://www.npmjs.com/package/data-api-client) | ||
The **Data API Client** is a lightweight wrapper that simplifies working with the Amazon Aurora Serverless Data API by abstracting away the notion of field values. This abstraction annotates native JavaScript types supplied as input parameters, as well as converts annotated response data to native JavaScript types. It's basically a [DocumentClient](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html]) for the Data API. It also promisifies the `AWS.RDSDataService` client to make working with `async/await` or Promise chains easier AND dramatically simplifies **transactions**. | ||
The **Data API Client** is a lightweight wrapper that simplifies working with the Amazon Aurora Serverless Data API by abstracting away the notion of field values. This abstraction annotates native JavaScript types supplied as input parameters, as well as converts annotated response data to native JavaScript types. It's basically a [DocumentClient](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html) for the Data API. It also promisifies the `AWS.RDSDataService` client to make working with `async/await` or Promise chains easier AND dramatically simplifies **transactions**. | ||
@@ -8,0 +9,0 @@ For more information about the Aurora Serverless Data API, you can review the [official documentation](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html) or read [Aurora Serverless Data API: An (updated) First Look](https://www.jeremydaly.com/aurora-serverless-data-api-a-first-look/) for some more insights on performance. |
417
41161
430