@ibm-cloud/cloudant 0.6.0 → 0.7.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.
- package/README.md +49 -22
- package/cloudant/v1.d.ts +442 -168
- package/cloudant/v1.js +208 -65
- package/cloudant/v1.js.map +1 -1
- package/package.json +15 -14
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
[](https://github.com/IBM/cloudant-node-sdk/releases/latest)
|
|
3
3
|
[](https://ibm.github.io/cloudant-node-sdk/)
|
|
4
4
|
|
|
5
|
-
# IBM Cloudant Node.js SDK Version 0.
|
|
5
|
+
# IBM Cloudant Node.js SDK Version 0.7.1
|
|
6
6
|
|
|
7
7
|
IBM Cloudant Node.js SDK is a client library that interacts with the
|
|
8
8
|
[IBM Cloudant APIs](https://cloud.ibm.com/apidocs/cloudant?code=node).
|
|
@@ -69,6 +69,7 @@ to avoid surprises.
|
|
|
69
69
|
- [Stopping the changes follower](#stopping-the-changes-follower)
|
|
70
70
|
- [Questions](#questions)
|
|
71
71
|
- [Issues](#issues)
|
|
72
|
+
- [Versioning and LTS support](#versioning-and-lts-support)
|
|
72
73
|
- [Open source at IBM](#open-source-at-ibm)
|
|
73
74
|
- [Contributing](#contributing)
|
|
74
75
|
- [License](#license)
|
|
@@ -110,11 +111,11 @@ project:
|
|
|
110
111
|
## Prerequisites
|
|
111
112
|
|
|
112
113
|
- A
|
|
113
|
-
[Cloudant](https://cloud.ibm.com/docs/Cloudant
|
|
114
|
+
[Cloudant](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-getting-started-with-cloudant)
|
|
114
115
|
service instance or a
|
|
115
116
|
[CouchDB](https://docs.couchdb.org/en/latest/install/index.html)
|
|
116
117
|
server.
|
|
117
|
-
- Node.js
|
|
118
|
+
- Node.js 18.
|
|
118
119
|
|
|
119
120
|
|
|
120
121
|
## Installation
|
|
@@ -151,6 +152,12 @@ Examples for other configuration methods are available by following the provided
|
|
|
151
152
|
[couch-jwt-auth]: https://docs.couchdb.org/en/stable/api/server/authn.html#jwt-authentication
|
|
152
153
|
[cloudant-basic-auth]: https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-work-with-your-account#basic-authentication
|
|
153
154
|
[cloudant-legacy-api-keys]: https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-work-with-your-account#api-keys
|
|
155
|
+
[core-container-auth]: https://github.com/IBM/node-sdk-core/blob/main/Authentication.md#container-authentication
|
|
156
|
+
[core-vpc-auth]: https://github.com/IBM/node-sdk-core/blob/main/Authentication.md#vpc-instance-authentication
|
|
157
|
+
[core-iam-auth]: https://github.com/IBM/node-sdk-core/blob/main/Authentication.md#identity-and-access-management-iam-authentication
|
|
158
|
+
[core-bearer-auth]: https://github.com/IBM/node-sdk-core/blob/main/Authentication.md#bearer-token-authentication
|
|
159
|
+
[core-basic-auth]: https://github.com/IBM/node-sdk-core/blob/main/Authentication.md#basic-authentication
|
|
160
|
+
[core-no-auth]: https://github.com/IBM/node-sdk-core/blob/main/Authentication.md#no-auth-authentication
|
|
154
161
|
|
|
155
162
|
This library requires credentials to authenticate with IBM Cloudant. These credentials may be:
|
|
156
163
|
* IBM Cloud IAM credentials (can be used with authentication types `CONTAINER`, `VPC` and `IAM`)
|
|
@@ -169,15 +176,15 @@ This table summarizes the available authentication types.
|
|
|
169
176
|
The authentication types are listed in order of recommendation, preferably use the authentication type
|
|
170
177
|
from the first row in the table that is compatible with your environment.
|
|
171
178
|
|
|
172
|
-
|
|
|
179
|
+
| Authentication type | Recommended for | `AUTH_TYPE` | Description |
|
|
173
180
|
| --- | --- | --- | --- |
|
|
174
|
-
| IAM Trusted Profiles compute resource ([container]
|
|
175
|
-
| IAM Trusted Profiles compute resource ([VPC]
|
|
176
|
-
| [IAM API key]
|
|
181
|
+
| IAM Trusted Profiles compute resource ([container][core-container-auth]) | Cloudant<BR>(SDK running in IBM Cloud IKS) | `CONTAINER` | Obtains a compute resource (CR) token from the container.<BR>Exchanges the CR token for an IAM `access_token`.<BR>Adds an `Authorization: Bearer <access_token>` header to each HTTP request.<BR>Automatically renews the access token when needed. |
|
|
182
|
+
| IAM Trusted Profiles compute resource ([VPC][core-vpc-auth]) | Cloudant<BR>(SDK running in IBM Cloud VPC) | `VPC` | Obtains an identity token from the VPC instance metadata.<BR>Exchanges the identity token for an IAM `access_token`.<BR>Adds an `Authorization: Bearer <access_token>` header to each HTTP request.<BR>Automatically renews the access token when needed. |
|
|
183
|
+
| [IAM API key][core-iam-auth] | Cloudant | `IAM` | Exchanges an IAM API key for an IAM `access_token`.<BR>Adds an `Authorization: Bearer <access_token>` header to each HTTP request.<BR>Automatically renews the access token when needed. |
|
|
177
184
|
| [Session cookie](#session-cookie-authentication) | [Cloudant][cloudant-cookie-auth]<BR>(legacy credentials & instances without IAM)<BR><BR>[Apache CouchDB][couch-cookie-auth] | `COUCHDB_SESSION` | Exchanges credentials with `/_session` endpoint to retrieve a cookie.<BR>Adds `Cookie` header and content to each HTTP request.<BR>Automatically renews session when needed. |
|
|
178
|
-
| [Bearer token]
|
|
179
|
-
| [Basic]
|
|
180
|
-
| [None]
|
|
185
|
+
| [Bearer token][core-bearer-auth] | [Apache CouchDB][couch-jwt-auth]<BR>(using JWT authentication) | `BEARERTOKEN` | Adds an `Authorization: Bearer <token>` to each HTTP request.<BR>No token management or renewal.<BR>Also compatible with IAM access tokens managed independently of the SDK. |
|
|
186
|
+
| [Basic][core-basic-auth] | [Apache CouchDB][couch-basic-auth]<BR>(if cookies are not enabled) | `BASIC` | Adds an `Authorization: Basic <encoded username and password>` header to each HTTP request. |
|
|
187
|
+
| [None][core-no-auth] | - | `NOAUTH` | Note that this authentication type only works for operations against a database allowing access for unauthenticated users. |
|
|
181
188
|
|
|
182
189
|
The default authentication type for the SDK is `CONTAINER` unless `APIKEY` configuration is supplied, which changes the default authentication type to `IAM`.
|
|
183
190
|
|
|
@@ -219,7 +226,7 @@ For Cloudant *IAM Trusted profile compute resource vpc authentication*, set the
|
|
|
219
226
|
replacing the `<url>` and `<id>` with your values.
|
|
220
227
|
|
|
221
228
|
```bash
|
|
222
|
-
|
|
229
|
+
CLOUDANT_AUTH_TYPE=VPC
|
|
223
230
|
CLOUDANT_URL=<url>
|
|
224
231
|
CLOUDANT_IAM_PROFILE_ID=<id>
|
|
225
232
|
```
|
|
@@ -928,7 +935,7 @@ You have deleted the document.
|
|
|
928
935
|
|
|
929
936
|
#### Further code examples
|
|
930
937
|
|
|
931
|
-
For a complete list of code examples, see the [examples directory](examples#examples-for-node).
|
|
938
|
+
For a complete list of code examples, see the [examples directory](https://github.com/IBM/cloudant-node-sdk/tree/v0.7.1/examples#examples-for-node).
|
|
932
939
|
|
|
933
940
|
### Error handling
|
|
934
941
|
|
|
@@ -1019,26 +1026,26 @@ The invalid options are:
|
|
|
1019
1026
|
based filters perform better than JavaScript backed filters. Configuring a non-selector based filter will
|
|
1020
1027
|
cause the follower to error.
|
|
1021
1028
|
|
|
1022
|
-
Note that
|
|
1029
|
+
Note that the `limit` parameter will terminate the follower at the given number of changes in either
|
|
1023
1030
|
operating mode.
|
|
1024
1031
|
|
|
1025
1032
|
The changes follower requires the client to have HTTP timeouts of at least 1 minute and will error during
|
|
1026
1033
|
instantiation if it is insufficient. The default client configuration has sufficiently long timeouts.
|
|
1027
1034
|
|
|
1028
1035
|
For use-cases where these configuration limitations are deemed too restrictive then it is recommended to
|
|
1029
|
-
write code to use the SDK's [POST `_changes` API](examples#postchanges) instead of the follower.
|
|
1036
|
+
write code to use the SDK's [POST `_changes` API](https://github.com/IBM/cloudant-node-sdk/tree/v0.7.1/examples#postchanges) instead of the follower.
|
|
1030
1037
|
|
|
1031
1038
|
#### Error suppression
|
|
1032
1039
|
|
|
1033
|
-
By default the changes follower will suppress transient errors indefinitely and attempt to run to completion or listen forever as
|
|
1034
|
-
dictated by the
|
|
1040
|
+
By default, the changes follower will suppress transient errors indefinitely and attempt to run to completion or listen forever as
|
|
1041
|
+
dictated by the operating mode.
|
|
1035
1042
|
For applications where that is not desirable an optional error tolerance duration may be specified to control the time since
|
|
1036
1043
|
the last successful response that transient errors will be suppressed. This can be used, for example, by applications as a grace period
|
|
1037
1044
|
before reporting an error and requiring intervention.
|
|
1038
1045
|
|
|
1039
1046
|
There are some additional points to consider for error suppression:
|
|
1040
1047
|
* Errors considered terminal, for example, the database not existing or invalid credentials are never suppressed and will error immediately.
|
|
1041
|
-
* The error suppression duration is not guaranteed to fire immediately after lapsing and should be considered a minimum
|
|
1048
|
+
* The error suppression duration is not guaranteed to fire immediately after lapsing and should be considered a minimum suppression time.
|
|
1042
1049
|
* The changes follower will back-off between retries and as such may remain paused for a short while after the transient errors have resolved.
|
|
1043
1050
|
* If the underlying SDK client used to initialize the follower also has retries configured then errors could be suppressed for significantly
|
|
1044
1051
|
longer than the follower's configured error tolerance duration depending on the configuration options.
|
|
@@ -1061,7 +1068,7 @@ The follower is not optimized for some use cases and it is not recommended to us
|
|
|
1061
1068
|
* The volume of changes is very high (if the rate of changes in the database exceeds the follower's rate of pulling them it will never catch-up).
|
|
1062
1069
|
|
|
1063
1070
|
In these cases use-case specific control over the number of change requests made and the content size of the responses
|
|
1064
|
-
may be
|
|
1071
|
+
may be achieved by using the SDK's [POST `_changes` API](https://github.com/IBM/cloudant-node-sdk/tree/v0.7.1/examples#postchanges).
|
|
1065
1072
|
|
|
1066
1073
|
#### Checkpointing
|
|
1067
1074
|
|
|
@@ -1078,7 +1085,7 @@ the processing of the change item by the application has completed. As indicated
|
|
|
1078
1085
|
delivered _at least once_ so application code must be able to handle repeated changes already and it is
|
|
1079
1086
|
preferable to restart from an older `since` value and receive changes again than risk missing them.
|
|
1080
1087
|
|
|
1081
|
-
The sequence IDs are available on each change item by default, but may be
|
|
1088
|
+
The sequence IDs are available on each change item by default, but may be omitted from some change items when
|
|
1082
1089
|
using the `seq_interval` configuration option. Infrequent sequence IDs may improve performance by reducing
|
|
1083
1090
|
the amount of data that needs to be transferred, but the trade-off is that more changes will be repeated if
|
|
1084
1091
|
it is necessary to resume the changes follower.
|
|
@@ -1572,18 +1579,38 @@ If you encounter an issue with the project, you are welcome to submit a
|
|
|
1572
1579
|
|
|
1573
1580
|
Before you submit a bug report, search for
|
|
1574
1581
|
[similar issues](https://github.com/IBM/cloudant-node-sdk/issues?q=is%3Aissue) and review the
|
|
1575
|
-
[KNOWN_ISSUES file](KNOWN_ISSUES.md) to verify that your issue hasn't been reported yet.
|
|
1582
|
+
[KNOWN_ISSUES file](https://github.com/IBM/cloudant-node-sdk/tree/v0.7.1/KNOWN_ISSUES.md) to verify that your issue hasn't been reported yet.
|
|
1576
1583
|
|
|
1577
1584
|
Please consult the [security policy](https://github.com/IBM/cloudant-node-sdk/security/policy) before opening security related issues.
|
|
1578
1585
|
|
|
1586
|
+
## Versioning and LTS support
|
|
1587
|
+
|
|
1588
|
+
This SDK follows semantic versioning with respect to the definition of user facing APIs.
|
|
1589
|
+
This means under some circumstances breaking changes may occur within a major or minor version
|
|
1590
|
+
of the SDK related to changes in supported language platforms.
|
|
1591
|
+
|
|
1592
|
+
The SDK is supported on the available LTS releases of the language platform.
|
|
1593
|
+
The LTS language versions are listed in the prerequisites:
|
|
1594
|
+
* [LTS versions currently supported by the SDK](https://github.com/IBM/cloudant-node-sdk/#prerequisites)
|
|
1595
|
+
* [LTS versions for this release of the SDK](#prerequisites)
|
|
1596
|
+
|
|
1597
|
+
Incompatible changes from new language versions are not added to the SDK
|
|
1598
|
+
until they are available in the minimum supported language version.
|
|
1599
|
+
|
|
1600
|
+
When language LTS versions move out of support the following will happen:
|
|
1601
|
+
* Existing SDK releases will continue to run on obsolete language versions, but will no longer be supported.
|
|
1602
|
+
* The minimum language version supported by the SDK will be updated to the next available LTS.
|
|
1603
|
+
* New language features may be added in subsequent SDK releases that will cause breaking changes
|
|
1604
|
+
if the new releases of the SDK are used with older, now unsupported, language levels.
|
|
1605
|
+
|
|
1579
1606
|
## Open source at IBM
|
|
1580
1607
|
|
|
1581
1608
|
Find more open source projects on the [IBM GitHub](http://ibm.github.io/) page.
|
|
1582
1609
|
|
|
1583
1610
|
## Contributing
|
|
1584
1611
|
|
|
1585
|
-
For more information, see [CONTRIBUTING](CONTRIBUTING.md).
|
|
1612
|
+
For more information, see [CONTRIBUTING](https://github.com/IBM/cloudant-node-sdk/tree/v0.7.1/CONTRIBUTING.md).
|
|
1586
1613
|
|
|
1587
1614
|
## License
|
|
1588
1615
|
|
|
1589
|
-
This SDK is released under the Apache 2.0 license. To read the full text of the license, see [LICENSE](LICENSE).
|
|
1616
|
+
This SDK is released under the Apache 2.0 license. To read the full text of the license, see [LICENSE](https://github.com/IBM/cloudant-node-sdk/tree/v0.7.1/LICENSE).
|