@opensearch-project/opensearch 2.3.0 → 2.4.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 +39 -8
- package/COMPATIBILITY.md +8 -22
- package/MAINTAINERS.md +1 -0
- package/USER_GUIDE.md +17 -0
- package/api/api/security.js +1954 -0
- package/api/index.js +11 -0
- package/api/new.d.ts +885 -0
- package/api/utils.js +13 -1
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/lib/Serializer.d.ts +1 -0
- package/lib/Serializer.js +9 -4
- package/package.json +7 -7
package/api/utils.js
CHANGED
|
@@ -40,6 +40,11 @@ function handleError(err, callback) {
|
|
|
40
40
|
return Promise.reject(err);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
function encodePathParam(camelName, snakeName = null) {
|
|
44
|
+
if (camelName == null && snakeName == null) return null;
|
|
45
|
+
return encodeURIComponent(snakeName || camelName);
|
|
46
|
+
}
|
|
47
|
+
|
|
43
48
|
function snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) {
|
|
44
49
|
const target = {};
|
|
45
50
|
const keys = Object.keys(querystring);
|
|
@@ -65,4 +70,11 @@ function normalizeArguments(params, options, callback) {
|
|
|
65
70
|
|
|
66
71
|
function noop() {}
|
|
67
72
|
|
|
68
|
-
module.exports = {
|
|
73
|
+
module.exports = {
|
|
74
|
+
handleError,
|
|
75
|
+
snakeCaseKeys,
|
|
76
|
+
normalizeArguments,
|
|
77
|
+
noop,
|
|
78
|
+
kConfigurationError,
|
|
79
|
+
encodePathParam,
|
|
80
|
+
};
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -128,6 +128,7 @@ class Client extends OpenSearchAPI {
|
|
|
128
128
|
proxy: null,
|
|
129
129
|
enableMetaHeader: true,
|
|
130
130
|
disablePrototypePoisoningProtection: false,
|
|
131
|
+
enableLongNumeralSupport: false,
|
|
131
132
|
},
|
|
132
133
|
opts
|
|
133
134
|
);
|
|
@@ -151,6 +152,7 @@ class Client extends OpenSearchAPI {
|
|
|
151
152
|
this[kEventEmitter] = new EventEmitter();
|
|
152
153
|
this.serializer = new options.Serializer({
|
|
153
154
|
disablePrototypePoisoningProtection: options.disablePrototypePoisoningProtection,
|
|
155
|
+
enableLongNumeralSupport: options.enableLongNumeralSupport,
|
|
154
156
|
});
|
|
155
157
|
this.connectionPool = new options.ConnectionPool({
|
|
156
158
|
pingTimeout: options.pingTimeout,
|
package/lib/Serializer.d.ts
CHANGED
package/lib/Serializer.js
CHANGED
|
@@ -95,6 +95,7 @@ class Serializer {
|
|
|
95
95
|
this[kJsonOptions] = {
|
|
96
96
|
protoAction: disable === true || disable === 'proto' ? 'ignore' : 'error',
|
|
97
97
|
constructorAction: disable === true || disable === 'constructor' ? 'ignore' : 'error',
|
|
98
|
+
enableLongNumeralSupport: opts.enableLongNumeralSupport === true,
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
101
|
|
|
@@ -258,10 +259,12 @@ class Serializer {
|
|
|
258
259
|
}
|
|
259
260
|
return val;
|
|
260
261
|
};
|
|
262
|
+
const shouldHandleLongNumerals =
|
|
263
|
+
isBigIntSupported && this[kJsonOptions].enableLongNumeralSupport;
|
|
261
264
|
try {
|
|
262
|
-
json = JSON.stringify(object,
|
|
265
|
+
json = JSON.stringify(object, shouldHandleLongNumerals ? checkForBigInts : null);
|
|
263
266
|
|
|
264
|
-
if (
|
|
267
|
+
if (shouldHandleLongNumerals && !numeralsAreNumbers) {
|
|
265
268
|
const temp = this._stringifyWithBigInt(object, json);
|
|
266
269
|
if (temp) json = temp;
|
|
267
270
|
}
|
|
@@ -286,14 +289,16 @@ class Serializer {
|
|
|
286
289
|
|
|
287
290
|
return val;
|
|
288
291
|
};
|
|
292
|
+
const shouldHandleLongNumerals =
|
|
293
|
+
isBigIntSupported && this[kJsonOptions].enableLongNumeralSupport;
|
|
289
294
|
try {
|
|
290
295
|
object = sjson.parse(
|
|
291
296
|
json,
|
|
292
|
-
|
|
297
|
+
shouldHandleLongNumerals ? checkForLargeNumerals : null,
|
|
293
298
|
this[kJsonOptions]
|
|
294
299
|
);
|
|
295
300
|
|
|
296
|
-
if (
|
|
301
|
+
if (shouldHandleLongNumerals && !numeralsAreNumbers) {
|
|
297
302
|
const temp = this._parseWithBigInt(json);
|
|
298
303
|
if (temp) {
|
|
299
304
|
object = temp;
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://www.opensearch.org/",
|
|
26
|
-
"version": "2.
|
|
26
|
+
"version": "2.4.0",
|
|
27
27
|
"versionCanary": "7.10.0-canary.6",
|
|
28
28
|
"keywords": [
|
|
29
29
|
"opensearch",
|
|
@@ -59,15 +59,15 @@
|
|
|
59
59
|
"@aws-sdk/types": "^3.160.0",
|
|
60
60
|
"@babel/eslint-parser": "^7.19.1",
|
|
61
61
|
"@sinonjs/fake-timers": "github:sinonjs/fake-timers#0bfffc1",
|
|
62
|
-
"@types/node": "^
|
|
62
|
+
"@types/node": "^20.1.4",
|
|
63
63
|
"convert-hrtime": "^5.0.0",
|
|
64
64
|
"cross-zip": "^4.0.0",
|
|
65
|
-
"dedent": "^
|
|
65
|
+
"dedent": "^1.1.0",
|
|
66
66
|
"deepmerge": "^4.2.2",
|
|
67
67
|
"dezalgo": "^1.0.3",
|
|
68
68
|
"eslint": "^8.30.0",
|
|
69
|
-
"eslint-config-prettier": "^
|
|
70
|
-
"eslint-plugin-prettier": "^
|
|
69
|
+
"eslint-config-prettier": "^9.0.0",
|
|
70
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
71
71
|
"fast-deep-equal": "^3.1.3",
|
|
72
72
|
"into-stream": "^6.0.0",
|
|
73
73
|
"js-yaml": "^4.1.0",
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
"license-checker": "^25.0.1",
|
|
76
76
|
"minimist": "^1.2.5",
|
|
77
77
|
"node-fetch": "^3.2.10",
|
|
78
|
-
"ora": "^
|
|
79
|
-
"prettier": "^
|
|
78
|
+
"ora": "^7.0.1",
|
|
79
|
+
"prettier": "^3.0.1",
|
|
80
80
|
"pretty-hrtime": "^1.0.3",
|
|
81
81
|
"proxy": "^1.0.2",
|
|
82
82
|
"rimraf": "^5.0.0",
|