@opensearch-project/opensearch 2.10.0 → 2.12.0

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CHANGELOG
2
2
 
3
- Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
3
+ Inspired by [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
4
4
 
5
5
  ## [Unreleased]
6
6
  ### Added
@@ -11,6 +11,33 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
11
11
  ### Fixed
12
12
  ### Security
13
13
 
14
+ ## [2.12.0]
15
+ ### Dependencies
16
+ - Bumps `@babel/eslint-parser` from 7.24.8 to 7.25.1
17
+ - Bumps `@types/node` from 20.14.11 to 22.5.0
18
+ - Bumps `aws4` from 1.13.0 to 1.13.1
19
+ - Bumps `ora` from 8.0.1 to 8.1.0
20
+ - Bumps `simple-statistics` from 7.8.3 to 7.8.4
21
+ ### Fixed
22
+ - Fixed docker-compose command in Makefile ([#845](https://github.com/opensearch-project/opensearch-js/issues/845))
23
+
24
+ ## [2.11.0]
25
+ ### Changed
26
+ - Return a transport object from `AwsSigv4SignerTransport.request` that has an `.abort()` method that allows in-flight requests to be canceled
27
+ ### Dependencies
28
+ - Bumps `@aws-sdk/types` from 3.577.0 to 3.609.0
29
+ - Bumps `@babel/eslint-parser` from 7.24.7 to 7.24.8
30
+ - Bumps `@types/node` from20.14.2 to 20.14.11
31
+ - Bumps `eslint-plugin-prettier` from 5.1.3 to 5.2.1
32
+ - Bumps `faker` from 5.5.3 to 6.6.6
33
+ - Bumps `prettier` from 3.3.1 to 3.3.3
34
+ - Bumps `rimraf` from 5.0.7 to 6.0.1
35
+ - Bumps `semver` from 7.6.2 to 7.6.3
36
+ - Bumps `simple-git` from 3.24.0 to 3.25.0
37
+ - Bumps `ws` from 7.5.9 to 7.5.10
38
+ ### Fixed
39
+ - Add missing types in `package.json` for `aws-v3` ([810](https://github.com/opensearch-project/opensearch-js/pull/810))
40
+
14
41
  ## [2.10.0]
15
42
  ### Added
16
43
  - Added Rollups API ([744](https://github.com/opensearch-project/opensearch-js/issues/744))
@@ -253,4 +280,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
253
280
  - Bumps `tsd` from 0.22.0 to 0.24.1
254
281
  - Bumps `semver` from 7.3.7 to 7.3.8
255
282
  ### Fixed
256
- - Fix mutability of connection headers ([#291](https://github.com/opensearch-project/opensearch-js/issues/291))
283
+ - Fix mutability of connection headers ([#291](https://github.com/opensearch-project/opensearch-js/issues/291))
package/Makefile CHANGED
@@ -1,12 +1,12 @@
1
1
  cluster.opensearch.build:
2
- docker-compose --project-directory .ci/opensearch build;
2
+ docker compose --project-directory .ci/opensearch build;
3
3
 
4
4
  cluster.opensearch.start:
5
- docker-compose --project-directory .ci/opensearch up -d ;
6
- sleep 60;
5
+ docker compose --project-directory .ci/opensearch up -d;
6
+ bash ./scripts/wait-cluster.sh;
7
7
 
8
8
  cluster.opensearch.stop:
9
- docker-compose --project-directory .ci/opensearch down ;
9
+ docker compose --project-directory .ci/opensearch down;
10
10
 
11
11
  cluster.clean: ## Remove unused Docker volumes and networks
12
12
  @printf "\033[2m→ Cleaning up Docker assets...\033[0m\n"
@@ -14,4 +14,4 @@ cluster.clean: ## Remove unused Docker volumes and networks
14
14
  docker network prune --force
15
15
  docker system prune --volumes --force
16
16
 
17
- .PHONY: cluster.opensearch.build cluster.opensearch.start cluster.opensearch.stop cluster.clean
17
+ .PHONY: cluster.opensearch.build cluster.opensearch.start cluster.opensearch.stop cluster.clean
package/lib/aws/shared.js CHANGED
@@ -13,9 +13,12 @@ const Connection = require('../Connection');
13
13
  const Transport = require('../Transport');
14
14
  const aws4 = require('aws4');
15
15
  const AwsSigv4SignerError = require('./errors');
16
+ const { RequestAbortedError } = require('../errors');
16
17
  const crypto = require('crypto');
17
18
  const { toMs } = Transport.internals;
18
19
 
20
+ const noop = () => {};
21
+
19
22
  function giveAwsCredentialProviderLoader(getAwsSDKCredentialsProvider) {
20
23
  return function loadAwsCredentialProvider() {
21
24
  return new Promise((resolve, reject) => {
@@ -118,45 +121,88 @@ function giveAwsV4Signer(awsDefaultCredentialsProvider) {
118
121
  }
119
122
 
120
123
  if (!expired) {
121
- if (typeof callback === 'undefined') {
124
+ if (callback === undefined) {
122
125
  return super.request(params, options);
126
+ } else {
127
+ return super.request(params, options, callback);
123
128
  }
124
- super.request(params, options, callback);
125
- return;
126
129
  }
127
130
 
128
- // In AWS SDK V2 Credentials.refreshPromise should be available.
129
- if (currentCredentials && typeof currentCredentials.refreshPromise === 'function') {
130
- if (typeof callback === 'undefined') {
131
- return currentCredentials.refreshPromise().then(() => {
132
- return super.request(params, options);
133
- });
134
- } else {
131
+ let p = null;
132
+
133
+ // promises support
134
+ if (callback === undefined) {
135
+ let onFulfilled = null;
136
+ let onRejected = null;
137
+ p = new Promise((resolve, reject) => {
138
+ onFulfilled = resolve;
139
+ onRejected = reject;
140
+ });
141
+ callback = function callback(err, result) {
142
+ err ? onRejected(err) : onFulfilled(result);
143
+ };
144
+ }
145
+
146
+ const meta = {
147
+ aborted: false,
148
+ };
149
+
150
+ let request = { abort: noop };
151
+
152
+ const transportReturn = {
153
+ then(onFulfilled, onRejected) {
154
+ if (p != null) {
155
+ return p.then(onFulfilled, onRejected);
156
+ }
157
+ },
158
+ catch(onRejected) {
159
+ if (p != null) {
160
+ return p.catch(onRejected);
161
+ }
162
+ },
163
+ abort() {
164
+ meta.aborted = true;
165
+ request.abort();
166
+ return this;
167
+ },
168
+ finally(onFinally) {
169
+ if (p != null) {
170
+ return p.finally(onFinally);
171
+ }
172
+ },
173
+ };
174
+
175
+ const makeRequest = () => {
176
+ // In AWS SDK V2 Credentials.refreshPromise should be available.
177
+ if (currentCredentials && typeof currentCredentials.refreshPromise === 'function') {
135
178
  currentCredentials
136
179
  .refreshPromise()
137
180
  .then(() => {
138
- super.request(params, options, callback);
181
+ if (meta.aborted) {
182
+ return callback(new RequestAbortedError());
183
+ }
184
+ request = super.request(params, options, callback);
139
185
  })
140
186
  .catch(callback);
141
- return;
142
187
  }
143
- }
188
+ // For AWS SDK V3.
189
+ else {
190
+ opts
191
+ .getCredentials()
192
+ .then((credentials) => {
193
+ if (meta.aborted) {
194
+ return callback(new RequestAbortedError());
195
+ }
196
+ credentialsState.credentials = credentials;
197
+ request = super.request(params, options, callback);
198
+ })
199
+ .catch(callback);
200
+ }
201
+ };
144
202
 
145
- // For AWS SDK V3 or when the client has not acquired credentials yet.
146
- if (typeof callback === 'undefined') {
147
- return opts.getCredentials().then((credentials) => {
148
- credentialsState.credentials = credentials;
149
- return super.request(params, options);
150
- });
151
- } else {
152
- opts
153
- .getCredentials()
154
- .then((credentials) => {
155
- credentialsState.credentials = credentials;
156
- super.request(params, options, callback);
157
- })
158
- .catch(callback);
159
- }
203
+ makeRequest();
204
+
205
+ return transportReturn;
160
206
  }
161
207
  }
162
208
 
package/package.json CHANGED
@@ -26,11 +26,14 @@
26
26
  ],
27
27
  "aws": [
28
28
  "./lib/aws/index.d.ts"
29
+ ],
30
+ "aws-v3": [
31
+ "./lib/aws/index-v3.d.ts"
29
32
  ]
30
33
  }
31
34
  },
32
35
  "homepage": "https://www.opensearch.org/",
33
- "version": "2.10.0",
36
+ "version": "2.12.0",
34
37
  "versionCanary": "7.10.0-canary.6",
35
38
  "keywords": [
36
39
  "opensearch",
@@ -66,7 +69,7 @@
66
69
  "@aws-sdk/types": "^3.160.0",
67
70
  "@babel/eslint-parser": "^7.19.1",
68
71
  "@sinonjs/fake-timers": "github:sinonjs/fake-timers#0bfffc1",
69
- "@types/node": "^20.1.4",
72
+ "@types/node": "^22.0.0",
70
73
  "convert-hrtime": "^5.0.0",
71
74
  "cross-zip": "^4.0.0",
72
75
  "dedent": "^1.1.0",
@@ -75,7 +78,7 @@
75
78
  "eslint": "^8.30.0",
76
79
  "eslint-config-prettier": "^9.0.0",
77
80
  "eslint-plugin-prettier": "^5.0.0",
78
- "faker": "^5.5.3",
81
+ "faker": "^6.6.6",
79
82
  "fast-deep-equal": "^3.1.3",
80
83
  "into-stream": "^6.0.0",
81
84
  "js-yaml": "^4.1.0",
@@ -87,7 +90,7 @@
87
90
  "prettier": "^3.0.1",
88
91
  "pretty-hrtime": "^1.0.3",
89
92
  "proxy": "^1.0.2",
90
- "rimraf": "^5.0.0",
93
+ "rimraf": "^6.0.1",
91
94
  "semver": "^7.3.5",
92
95
  "simple-git": "^3.15.0",
93
96
  "simple-statistics": "^7.7.0",