data-api-client 1.3.0 → 1.3.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.
Files changed (2) hide show
  1. package/README.md +98 -94
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,9 +1,14 @@
1
1
  ![Aurora Serverless Data API Client](https://user-images.githubusercontent.com/2053544/79285017-44053500-7e8a-11ea-8515-998ccf9c2d2e.png)
2
2
 
3
- [![Build Status](https://travis-ci.org/jeremydaly/data-api-client.svg?branch=master)](https://travis-ci.org/jeremydaly/data-api-client)
4
3
  [![npm](https://img.shields.io/npm/v/data-api-client.svg)](https://www.npmjs.com/package/data-api-client)
5
4
  [![npm](https://img.shields.io/npm/l/data-api-client.svg)](https://www.npmjs.com/package/data-api-client)
6
5
 
6
+ > #### Project Update: October 7, 2024
7
+ >
8
+ > With the recent announcement that Amazon Aurora MySQL-Compatible Edition now supports a redesigned [RDS Data API for Aurora Serverless v2 and Aurora provisioned database instances](https://aws.amazon.com/about-aws/whats-new/2024/09/amazon-aurora-mysql-rds-data-api/), there have been several requests to add support to this project. The new RDS Data API also supports [Amazon Aurora PostgreSQL-Compatible Edition](https://aws.amazon.com/about-aws/whats-new/2023/12/amazon-aurora-postgresql-rds-data-api/) (more detail [here](https://aws.amazon.com/blogs/database/introducing-the-data-api-for-amazon-aurora-serverless-v2-and-amazon-aurora-provisioned-clusters/)).
9
+ >
10
+ > Star and watch the project for the 2.0 branch updates.
11
+
7
12
  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
13
 
9
14
  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.
@@ -33,34 +38,26 @@ let result = await data.query(`SELECT * FROM myTable`)
33
38
  // }
34
39
 
35
40
  // SELECT with named parameters
36
- let resultParams = await data.query(
37
- `SELECT * FROM myTable WHERE id = :id`,
38
- { id: 2 }
39
- )
41
+ let resultParams = await data.query(`SELECT * FROM myTable WHERE id = :id`, { id: 2 })
40
42
  // { records: [ { id: 2, name: 'Mike', age: 52 } ] }
41
43
 
42
44
  // INSERT with named parameters
43
- let insert = await data.query(
44
- `INSERT INTO myTable (name,age,has_curls) VALUES(:name,:age,:curls)`,
45
- { name: 'Greg', age: 18, curls: false }
46
- )
45
+ let insert = await data.query(`INSERT INTO myTable (name,age,has_curls) VALUES(:name,:age,:curls)`, {
46
+ name: 'Greg',
47
+ age: 18,
48
+ curls: false
49
+ })
47
50
 
48
51
  // BATCH INSERT with named parameters
49
- let batchInsert = await data.query(
50
- `INSERT INTO myTable (name,age,has_curls) VALUES(:name,:age,:curls)`,
51
- [
52
- [{ name: 'Marcia', age: 17, curls: false }],
53
- [{ name: 'Peter', age: 15, curls: false }],
54
- [{ name: 'Jan', age: 15, curls: false }],
55
- [{ name: 'Cindy', age: 12, curls: true }],
56
- [{ name: 'Bobby', age: 12, curls: false }]
57
- ]
58
- )
52
+ let batchInsert = await data.query(`INSERT INTO myTable (name,age,has_curls) VALUES(:name,:age,:curls)`, [
53
+ [{ name: 'Marcia', age: 17, curls: false }],
54
+ [{ name: 'Peter', age: 15, curls: false }],
55
+ [{ name: 'Jan', age: 15, curls: false }],
56
+ [{ name: 'Cindy', age: 12, curls: true }],
57
+ [{ name: 'Bobby', age: 12, curls: false }]
58
+ ])
59
59
  // Update with named parameters
60
- let update = await data.query(
61
- `UPDATE myTable SET age = :age WHERE id = :id`,
62
- { age: 13, id: 5 }
63
- )
60
+ let update = await data.query(`UPDATE myTable SET age = :age WHERE id = :id`, { age: 13, id: 5 })
64
61
 
65
62
  // Delete with named parameters
66
63
  let remove = await data.query(
@@ -73,14 +70,12 @@ let custom = data.query({
73
70
  sql: `SELECT * FROM myOtherTable WHERE id = :id AND active = :isActive`,
74
71
  continueAfterTimeout: true,
75
72
  database: 'myOtherDatabase',
76
- parameters: [
77
- { id: 123},
78
- { name: 'isActive', value: { booleanValue: true } }
79
- ]
73
+ parameters: [{ id: 123 }, { name: 'isActive', value: { booleanValue: true } }]
80
74
  })
81
75
  ```
82
76
 
83
77
  ## Why do I need this?
78
+
84
79
  The [Data API](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html) requires you to specify data types when passing in parameters. The basic `INSERT` example above would look like this using the native `AWS.RDSDataService` class:
85
80
 
86
81
  ```javascript
@@ -119,9 +114,11 @@ Specifying all of those data types in the parameters is a bit clunky. In additio
119
114
  "booleanValue": false
120
115
  }
121
116
  ```
117
+
122
118
  Not only are there no column names, but you have to pull the value from the data type field. Lots of extra work that the **Data API Client** handles automatically for you. 😀
123
119
 
124
120
  ## Installation and Setup
121
+
125
122
  ```
126
123
  npm i data-api-client
127
124
  ```
@@ -132,21 +129,22 @@ For more information on enabling Data API, see [Enabling Data API](#enabling-dat
132
129
 
133
130
  Below is a table containing all of the possible configuration options for the `data-api-client`. Additional details are provided throughout the documentation.
134
131
 
135
- | Property | Type | Description | Default |
136
- | -------- | ---- | ----------- | ------- |
137
- | AWS | `AWS` | A custom `aws-sdk` instance | |
138
- | resourceArn | `string` | The ARN of your Aurora Serverless Cluster. This value is *required*, but can be overridden when querying. | |
139
- | secretArn | `string` | The ARN of the secret associated with your database credentials. This is *required*, but can be overridden when querying. | |
140
- | database | `string` | *Optional* default database to use with queries. Can be overridden when querying. | |
141
- | engine | `mysql` or `pg` | The type of database engine you're connecting to (MySQL or Postgres). | `mysql` |
142
- | hydrateColumnNames | `boolean` | When `true`, results will be returned as objects with column names as keys. If `false`, results will be returned as an array of values. | `true` |
143
- | ~~keepAlive~~ (deprecated) | `boolean` | See [Connection Reuse](#connection-reuse) below. | |
144
- | ~~sslEnabled~~ (deprecated) | `boolean` | Set this in the `options` | `true` |
145
- | options | `object` | An *optional* configuration object that is passed directly into the RDSDataService constructor. See [here](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/RDSDataService.html#constructor-property) for available options. | `{}` |
146
- | ~~region~~ (deprecated) | `string` | Set this in the `options` | |
147
- | formatOptions | `object` | Formatting options to auto parse dates and coerce native JavaScript date objects to MySQL supported date formats. Valid keys are `deserializeDate` and `treatAsLocalDate`. Both accept boolean values. | Both `false` |
132
+ | Property | Type | Description | Default |
133
+ | --------------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
134
+ | AWS | `AWS` | A custom `aws-sdk` instance | |
135
+ | resourceArn | `string` | The ARN of your Aurora Serverless Cluster. This value is _required_, but can be overridden when querying. | |
136
+ | secretArn | `string` | The ARN of the secret associated with your database credentials. This is _required_, but can be overridden when querying. | |
137
+ | database | `string` | _Optional_ default database to use with queries. Can be overridden when querying. | |
138
+ | engine | `mysql` or `pg` | The type of database engine you're connecting to (MySQL or Postgres). | `mysql` |
139
+ | hydrateColumnNames | `boolean` | When `true`, results will be returned as objects with column names as keys. If `false`, results will be returned as an array of values. | `true` |
140
+ | ~~keepAlive~~ (deprecated) | `boolean` | See [Connection Reuse](#connection-reuse) below. | |
141
+ | ~~sslEnabled~~ (deprecated) | `boolean` | Set this in the `options` | `true` |
142
+ | options | `object` | An _optional_ configuration object that is passed directly into the RDSDataService constructor. See [here](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/RDSDataService.html#constructor-property) for available options. | `{}` |
143
+ | ~~region~~ (deprecated) | `string` | Set this in the `options` | |
144
+ | formatOptions | `object` | Formatting options to auto parse dates and coerce native JavaScript date objects to MySQL supported date formats. Valid keys are `deserializeDate` and `treatAsLocalDate`. Both accept boolean values. | Both `false` |
148
145
 
149
146
  ### Connection Reuse
147
+
150
148
  It is recommended to enable connection reuse as this dramatically decreases the latency of subsequent calls to the AWS API. This can be done by setting an environment variable
151
149
  `AWS_NODEJS_CONNECTION_REUSE_ENABLED=1`. For more information see the [AWS SDK documentation](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/node-reusing-connections.html).
152
150
 
@@ -166,6 +164,7 @@ const data = require('data-api-client')({
166
164
  ```
167
165
 
168
166
  ### Running a query
167
+
169
168
  Once initialized, running a query is super simple. Use the `query()` method and pass in your SQL statement:
170
169
 
171
170
  ```javascript
@@ -173,8 +172,9 @@ let result = await data.query(`SELECT * FROM myTable`)
173
172
  ```
174
173
 
175
174
  By default, this will return your rows as an array of objects with column names as property names:
175
+
176
176
  ```javascript
177
- [
177
+ ;[
178
178
  { id: 1, name: 'Alice', age: null },
179
179
  { id: 2, name: 'Mike', age: 52 },
180
180
  { id: 3, name: 'Carol', age: 50 }
@@ -184,7 +184,8 @@ By default, this will return your rows as an array of objects with column names
184
184
  To query with parameters, you can use named parameters in your SQL, and then provider an object containing your parameters as the second argument to the `query()` method:
185
185
 
186
186
  ```javascript
187
- let result = await data.query(`
187
+ let result = await data.query(
188
+ `
188
189
  SELECT * FROM myTable WHERE id = :id AND created > :createDate`,
189
190
  { id: 2, createDate: '2019-06-01' }
190
191
  )
@@ -193,14 +194,12 @@ let result = await data.query(`
193
194
  The Data API Client will automatically convert your parameters into the correct Data API parameter format using native JavaScript types. If you prefer to use the clunky format, or you need more control over the data type, you can just pass in the `RDSDataService` format:
194
195
 
195
196
  ```javascript
196
- let result = await data.query(
197
- `SELECT * FROM myTable WHERE id = :id AND created > :createDate`,
198
- [ // An array of objects is totally cool, too. We'll merge them for you.
199
- { id: 2 },
200
- // Data API Client just passes this straight on through
201
- { name: 'createDate', value: { blobValue: new Buffer('2019-06-01') } }
202
- ]
203
- )
197
+ let result = await data.query(`SELECT * FROM myTable WHERE id = :id AND created > :createDate`, [
198
+ // An array of objects is totally cool, too. We'll merge them for you.
199
+ { id: 2 },
200
+ // Data API Client just passes this straight on through
201
+ { name: 'createDate', value: { blobValue: new Buffer('2019-06-01') } }
202
+ ])
204
203
  ```
205
204
 
206
205
  If you want even more control, you can pass in an `object` as the first parameter. This will allow you to add additional configuration options and override defaults as well.
@@ -218,27 +217,26 @@ let result = await data.query({
218
217
  }
219
218
  ```
220
219
 
221
- Sometimes you might want to have *dynamic identifiers* in your SQL statements. Unfortunately, the `RDSDataService` doesn't do this, but the **Data API Client** does! We're using the [sqlstring](https://github.com/mysqljs/sqlstring) module under the hood, so as long as [NO_BACKSLASH_ESCAPES](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_backslash_escapes) SQL mode is disabled (which is the default state for Aurora Serverless), you're good to go. Use a double colon (`::`) prefix to create *named identifiers* and you can do cool things like this:
220
+ Sometimes you might want to have _dynamic identifiers_ in your SQL statements. Unfortunately, the `RDSDataService` doesn't do this, but the **Data API Client** does! We're using the [sqlstring](https://github.com/mysqljs/sqlstring) module under the hood, so as long as [NO_BACKSLASH_ESCAPES](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_backslash_escapes) SQL mode is disabled (which is the default state for Aurora Serverless), you're good to go. Use a double colon (`::`) prefix to create _named identifiers_ and you can do cool things like this:
222
221
 
223
222
  ```javascript
224
- let result = await data.query(
225
- `SELECT ::fields FROM ::table WHERE id > :id`,
226
- {
227
- fields: ['id','name','created'],
228
- table: 'table_' + someScaryUserInput, // someScaryUserInput = 123abc
229
- id: 1
230
- }
231
- )
223
+ let result = await data.query(`SELECT ::fields FROM ::table WHERE id > :id`, {
224
+ fields: ['id', 'name', 'created'],
225
+ table: 'table_' + someScaryUserInput, // someScaryUserInput = 123abc
226
+ id: 1
227
+ })
232
228
  ```
233
229
 
234
230
  Which will produce a query like this:
231
+
235
232
  ```sql
236
233
  SELECT `id`, `name`, `created` FROM `table_123abc` WHERE id > :id LIMIT 10
237
234
  ```
238
235
 
239
- You'll notice that we leave the *named parameters* alone. Anything that Data API and the `RDSDataService` Class currently handles, we defer to them.
236
+ You'll notice that we leave the _named parameters_ alone. Anything that Data API and the `RDSDataService` Class currently handles, we defer to them.
240
237
 
241
238
  ### Type-Casting
239
+
242
240
  The Aurora Data API can sometimes give you trouble with certain data types, such as uuid, unless you explicitly cast them. While you can certainly do this manually in your SQL string, the Data API Client offers a really easy way to handle this for you.
243
241
 
244
242
  ```javascript
@@ -268,28 +266,28 @@ const result = await data.query(
268
266
  ```
269
267
 
270
268
  ### Batch Queries
271
- The `RDSDataService` Class provides a `batchExecuteStatement` method that allows you to execute a prepared statement multiple times using different parameter sets. This is only allowed for `INSERT`, `UPDATE` and `DELETE` queries, but is much more efficient than issuing multiple `executeStatement` calls. The Data API Client handles the switching for you based on *how* you send in your parameters.
269
+
270
+ The `RDSDataService` Class provides a `batchExecuteStatement` method that allows you to execute a prepared statement multiple times using different parameter sets. This is only allowed for `INSERT`, `UPDATE` and `DELETE` queries, but is much more efficient than issuing multiple `executeStatement` calls. The Data API Client handles the switching for you based on _how_ you send in your parameters.
272
271
 
273
272
  To issue a batch query, use the `query()` method (either by passing an object or using the two arity form), and provide multiple parameter sets as nested arrays. For example, if you wanted to update multiple records at once, your query might look like this:
274
273
 
275
274
  ```javascript
276
- let result = await data.query(
277
- `UPDATE myTable SET name = :newName WHERE id = :id`,
278
- [
279
- [ { id: 1, newName: 'Alice Franklin' } ],
280
- [ { id: 7, newName: 'Jan Glass' } ]
281
- ]
282
- )
275
+ let result = await data.query(`UPDATE myTable SET name = :newName WHERE id = :id`, [
276
+ [{ id: 1, newName: 'Alice Franklin' }],
277
+ [{ id: 7, newName: 'Jan Glass' }]
278
+ ])
283
279
  ```
284
280
 
285
- You can also use *named identifiers* in batch queries, which will update and escape your SQL statement. **ONLY** parameters from the first parameter set will be used to update the query. Subsequent parameter sets will only update *named parameters* supported by the Data API.
281
+ You can also use _named identifiers_ in batch queries, which will update and escape your SQL statement. **ONLY** parameters from the first parameter set will be used to update the query. Subsequent parameter sets will only update _named parameters_ supported by the Data API.
286
282
 
287
283
  Whenever a batch query is executed, it returns an `updateResults` field. Other than for `INSERT` statements, however, there is no useful feedback provided by this field.
288
284
 
289
285
  ### Retrieving Insert IDs
286
+
290
287
  The Data API returns a `generatedFields` array that contains the value of auto-incrementing primary keys. If this value is returned, the Data API Client will parse this and return it as the `insertId`. This also works for batch queries as well.
291
288
 
292
289
  ## Transaction Support
290
+
293
291
  Transaction support in the Data API Client has been dramatically simplified. Start a new transaction using the `transaction()` method, and then chain queries using the `query()` method. The `query()` method supports all standard query options. Alternatively, you can specify a function as the only argument in a `query()` method call and return the arguments as an array of values. The function receives two arguments, the result of the last query executed, and an array containing all the previous query results. This is useful if you need values from a previous query as part of your transaction.
294
292
 
295
293
  You can specify an optional `rollback()` method in the chain. This will receive the `error` object and the `transactionStatus` object, allowing you to add additional logging or perform some other action. Call the `commit()` method when you are ready to execute the queries.
@@ -305,10 +303,13 @@ let results = await mysql.transaction()
305
303
  With a function to get the `insertId` from the previous query:
306
304
 
307
305
  ```javascript
308
- let results = await mysql.transaction()
306
+ let results = await mysql
307
+ .transaction()
309
308
  .query('INSERT INTO myTable (name) VALUES(:name)', { name: 'Tiger' })
310
- .query((r) => [ 'UPDATE myTable SET age = :age WHERE id = :id', { age: 4, id: r.insertId } ])
311
- .rollback((e,status) => { /* do something with the error */ }) // optional
309
+ .query((r) => ['UPDATE myTable SET age = :age WHERE id = :id', { age: 4, id: r.insertId }])
310
+ .rollback((e, status) => {
311
+ /* do something with the error */
312
+ }) // optional
312
313
  .commit() // execute the queries
313
314
  ```
314
315
 
@@ -318,7 +319,8 @@ By default, the `transaction()` method will use the `resourceArn`, `secretArn` a
318
319
 
319
320
  ### Using native methods directly
320
321
 
321
- The Data API Client exposes *promisified* versions of the five RDSDataService methods. These are:
322
+ The Data API Client exposes _promisified_ versions of the five RDSDataService methods. These are:
323
+
322
324
  - `batchExecuteStatement`
323
325
  - `beginTransaction`
324
326
  - `commitTransaction`
@@ -362,9 +364,11 @@ const data = require('data-api-client')({
362
364
  ```
363
365
 
364
366
  ## Data API Limitations / Wonkiness
365
- The first GA release of the Data API has *a lot* of promise, unfortunately, there are still quite a few things that make it a bit wonky and may require you to implement some workarounds. I've outlined some of my findings below.
367
+
368
+ The first GA release of the Data API has _a lot_ of promise, unfortunately, there are still quite a few things that make it a bit wonky and may require you to implement some workarounds. I've outlined some of my findings below.
366
369
 
367
370
  ### You can't send in an array of values
371
+
368
372
  The GitHub repo for RDSDataService mentions something about `arrayValues`, but I've been unable to get arrays (including TypedArrays and Buffers) to be used for parameters with `IN` clauses. For example, the following query will **NOT** work:
369
373
 
370
374
  ```javascript
@@ -382,9 +386,11 @@ let result = await data.executeStatement({
382
386
  I'm using `blobValue` because it's the only generic value field. You could send it in as a string, but then it only uses the first value. Hopefully they will add an `arrayValues` or something similar to support this in the future.
383
387
 
384
388
  ### ~~Named parameters MUST be sent in order~~
385
- ~~Read that again if you need to. So parameters have to be **BOTH** named and *in order*, otherwise the query **may** fail. I stress **may**, because if you send in two fields of compatible type in the wrong order, the query will work, just with your values flipped. 🤦🏻‍♂️ Watch out for this one.~~ 👈This was fixed!
389
+
390
+ ~~Read that again if you need to. So parameters have to be **BOTH** named and _in order_, otherwise the query **may** fail. I stress **may**, because if you send in two fields of compatible type in the wrong order, the query will work, just with your values flipped. 🤦🏻‍♂️ Watch out for this one.~~ 👈This was fixed!
386
391
 
387
392
  ### You can't parameterize identifiers
393
+
388
394
  If you want to use dynamic column or field names, there is no way to do it automatically with the Data API. The `mysql` package, for example, lets you use `??` to dynamically insert escaped identifiers. Something like the example below is currently not possible.
389
395
 
390
396
  ```javascript
@@ -403,18 +409,19 @@ let result = await data.executeStatement({
403
409
 
404
410
  No worries! The Data API Client gives you the ability to parameterize identifiers and auto escape them. Just use a double colon (`::`) to prefix your named identifiers.
405
411
 
406
-
407
412
  ### Batch statements do not give you updated record counts
413
+
408
414
  This one is a bit frustrating. If you execute a standard `executeStatement`, then it will return a `numberOfRecordsUpdated` field for `UPDATE` and `DELETE` queries. This is handy for knowing if your query succeeded. Unfortunately, a `batchExecuteStatement` does not return this field for you.
409
415
 
410
416
  ## Enabling Data API
417
+
411
418
  In order to use the Data API, you must enable it on your Aurora Serverless Cluster and create a Secret. You also must grant your execution environment a number of permission as outlined in the following sections.
412
419
 
413
420
  ### Enable Data API on your Aurora Serverless Cluster
414
421
 
415
422
  ![Enable Data API in Network & Security settings of your cluster](https://user-images.githubusercontent.com/2053544/58768968-79ee4300-8570-11e9-9266-1433182e0db2.png)
416
423
 
417
- You need to modify your Aurora Serverless cluster by clicking “ACTIONS” and then “Modify Cluster”. Just check the Data API box in the *Network & Security* section and you’re good to go. Remember that your Aurora Serverless cluster still runs in a VPC, even though you don’t need to run your Lambdas in a VPC to access it via the Data API.
424
+ You need to modify your Aurora Serverless cluster by clicking “ACTIONS” and then “Modify Cluster”. Just check the Data API box in the _Network & Security_ section and you’re good to go. Remember that your Aurora Serverless cluster still runs in a VPC, even though you don’t need to run your Lambdas in a VPC to access it via the Data API.
418
425
 
419
426
  ### Set up a secret in the Secrets Manager
420
427
 
@@ -422,7 +429,6 @@ Next you need to set up a secret in the Secrets Manager. This is actually quite
422
429
 
423
430
  ![Enter database credentials and select database to access](https://user-images.githubusercontent.com/2053544/58768974-912d3080-8570-11e9-8878-636dfb742b00.png)
424
431
 
425
-
426
432
  Next we give it a name, this is important, because this will be part of the arn when we set up permissions later. You can give it a description as well so you don’t forget what this secret is about when you look at it in a few weeks.
427
433
 
428
434
  ![Give your secret a name and add a description](https://user-images.githubusercontent.com/2053544/58768984-a7d38780-8570-11e9-8b21-199db5548c73.png)
@@ -436,24 +442,26 @@ You can then configure your rotation settings, if you want, and then you review
436
442
  In order to use the Data API, your execution environment requires several IAM permissions. Below are the minimum permissions required. **Please Note:** The `Resource: "*"` permission for `rds-data` is recommended by AWS (see [here](https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazonrdsdataapi.html#amazonrdsdataapi-resources-for-iam-policies)) because Amazon RDS Data API does not support specifying a resource ARN. The credentials specified in Secrets Manager can be used to restrict access to specific databases.
437
443
 
438
444
  **YAML:**
445
+
439
446
  ```yaml
440
447
  Statement:
441
- - Effect: "Allow"
448
+ - Effect: 'Allow'
442
449
  Action:
443
- - "rds-data:ExecuteSql"
444
- - "rds-data:ExecuteStatement"
445
- - "rds-data:BatchExecuteStatement"
446
- - "rds-data:BeginTransaction"
447
- - "rds-data:RollbackTransaction"
448
- - "rds-data:CommitTransaction"
449
- Resource: "*"
450
- - Effect: "Allow"
450
+ - 'rds-data:ExecuteSql'
451
+ - 'rds-data:ExecuteStatement'
452
+ - 'rds-data:BatchExecuteStatement'
453
+ - 'rds-data:BeginTransaction'
454
+ - 'rds-data:RollbackTransaction'
455
+ - 'rds-data:CommitTransaction'
456
+ Resource: '*'
457
+ - Effect: 'Allow'
451
458
  Action:
452
- - "secretsmanager:GetSecretValue"
453
- Resource: "arn:aws:secretsmanager:{REGION}:{ACCOUNT-ID}:secret:{PATH-TO-SECRET}/*"
459
+ - 'secretsmanager:GetSecretValue'
460
+ Resource: 'arn:aws:secretsmanager:{REGION}:{ACCOUNT-ID}:secret:{PATH-TO-SECRET}/*'
454
461
  ```
455
462
 
456
463
  **JSON:**
464
+
457
465
  ```javascript
458
466
  "Statement" : [
459
467
  {
@@ -476,10 +484,6 @@ Statement:
476
484
  ]
477
485
  ```
478
486
 
479
- ## Sponsors
480
-
481
- [![New Relic](https://user-images.githubusercontent.com/2053544/96728664-55238700-1382-11eb-93cb-82fe7cb5e043.png)](https://ad.doubleclick.net/ddm/trackclk/N1116303.3950900PODSEARCH.COM/B24770737.285235234;dc_trk_aid=479074825;dc_trk_cid=139488579;dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;gdpr=${GDPR};gdpr_consent=${GDPR_CONSENT_755})
482
- <IMG SRC="https://ad.doubleclick.net/ddm/trackimp/N1116303.3950900PODSEARCH.COM/B24770737.285235234;dc_trk_aid=479074825;dc_trk_cid=139488579;ord=[timestamp];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=;gdpr=${GDPR};gdpr_consent=${GDPR_CONSENT_755}?" BORDER="0" HEIGHT="1" WIDTH="1" ALT="Advertisement">
483
-
484
487
  ## Contributions
488
+
485
489
  Contributions, ideas and bug reports are welcome and greatly appreciated. Please add [issues](https://github.com/jeremydaly/data-api-client/issues) for suggestions and bug reports or create a pull request. You can also contact me on Twitter: [@jeremy_daly](https://twitter.com/jeremy_daly).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "data-api-client",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "A lightweight wrapper that simplifies working with the Amazon Aurora Serverless Data API",
5
5
  "main": "index.js",
6
6
  "scripts": {