@opensearch-project/opensearch 1.1.0 → 2.1.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.
Files changed (94) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.json +31 -0
  3. package/.prettierrc.json +5 -0
  4. package/.whitesource +15 -0
  5. package/ADMINS.md +13 -31
  6. package/CHANGELOG.md +24 -0
  7. package/COMPATIBILITY.md +27 -0
  8. package/DEVELOPER_GUIDE.md +22 -5
  9. package/MAINTAINERS.md +15 -70
  10. package/Makefile +2 -12
  11. package/README.md +19 -123
  12. package/RELEASING.md +3 -3
  13. package/SECURITY.md +1 -1
  14. package/USER_GUIDE.md +197 -0
  15. package/api/api/bulk.js +54 -28
  16. package/api/api/cat.js +355 -266
  17. package/api/api/clear_scroll.js +18 -19
  18. package/api/api/cluster.js +367 -221
  19. package/api/api/count.js +56 -26
  20. package/api/api/create.js +51 -26
  21. package/api/api/dangling_indices.js +96 -53
  22. package/api/api/delete.js +50 -24
  23. package/api/api/delete_by_query.js +89 -27
  24. package/api/api/delete_by_query_rethrottle.js +34 -21
  25. package/api/api/delete_script.js +32 -19
  26. package/api/api/exists.js +56 -24
  27. package/api/api/exists_source.js +61 -29
  28. package/api/api/explain.js +61 -24
  29. package/api/api/features.js +57 -37
  30. package/api/api/field_caps.js +37 -20
  31. package/api/api/get.js +56 -24
  32. package/api/api/get_script.js +31 -19
  33. package/api/api/get_script_context.js +16 -17
  34. package/api/api/get_script_languages.js +16 -17
  35. package/api/api/get_source.js +56 -24
  36. package/api/api/index.js +61 -30
  37. package/api/api/indices.js +1069 -859
  38. package/api/api/info.js +16 -17
  39. package/api/api/ingest.js +133 -98
  40. package/api/api/mget.js +51 -28
  41. package/api/api/msearch.js +50 -28
  42. package/api/api/msearch_template.js +54 -28
  43. package/api/api/mtermvectors.js +49 -26
  44. package/api/api/nodes.js +282 -156
  45. package/api/api/ping.js +16 -17
  46. package/api/api/put_script.js +41 -27
  47. package/api/api/rank_eval.js +38 -22
  48. package/api/api/reindex.js +39 -19
  49. package/api/api/reindex_rethrottle.js +33 -21
  50. package/api/api/render_search_template.js +19 -20
  51. package/api/api/scripts_painless_execute.js +16 -17
  52. package/api/api/scroll.js +32 -19
  53. package/api/api/search.js +109 -26
  54. package/api/api/search_shards.js +37 -20
  55. package/api/api/search_template.js +65 -28
  56. package/api/api/shutdown.js +67 -56
  57. package/api/api/snapshot.js +348 -226
  58. package/api/api/tasks.js +66 -48
  59. package/api/api/terms_enum.js +18 -19
  60. package/api/api/termvectors.js +58 -28
  61. package/api/api/update.js +65 -26
  62. package/api/api/update_by_query.js +90 -25
  63. package/api/api/update_by_query_rethrottle.js +34 -21
  64. package/api/index.js +268 -181
  65. package/api/new.d.ts +2043 -531
  66. package/api/opensearch_dashboards.d.ts +240 -238
  67. package/api/requestParams.d.ts +302 -71
  68. package/api/types.d.ts +6205 -5721
  69. package/api/utils.js +23 -24
  70. package/codecov.yml +2 -2
  71. package/index.d.ts +5203 -1037
  72. package/index.js +154 -143
  73. package/index.mjs +10 -11
  74. package/jenkins/release.JenkinsFile +11 -0
  75. package/lib/Connection.d.ts +38 -28
  76. package/lib/Connection.js +166 -170
  77. package/lib/Helpers.d.ts +108 -68
  78. package/lib/Helpers.js +401 -378
  79. package/lib/Serializer.d.ts +3 -4
  80. package/lib/Serializer.js +40 -41
  81. package/lib/Transport.d.ts +39 -15
  82. package/lib/Transport.js +381 -337
  83. package/lib/aws/AwsSigv4Signer.js +167 -0
  84. package/lib/aws/errors.js +24 -0
  85. package/lib/aws/index.d.ts +39 -0
  86. package/lib/aws/index.js +19 -0
  87. package/lib/errors.d.ts +26 -9
  88. package/lib/errors.js +76 -73
  89. package/lib/pool/BaseConnectionPool.js +101 -99
  90. package/lib/pool/CloudConnectionPool.js +17 -18
  91. package/lib/pool/ConnectionPool.js +106 -107
  92. package/lib/pool/index.d.ts +9 -8
  93. package/lib/pool/index.js +7 -8
  94. package/package.json +37 -15
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -28,38 +27,76 @@
28
27
  * under the License.
29
28
  */
30
29
 
31
- 'use strict'
30
+ 'use strict';
32
31
 
33
32
  /* eslint camelcase: 0 */
34
33
  /* eslint no-unused-vars: 0 */
35
34
 
36
- const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
- const acceptedQuerystring = ['analyze_wildcard', 'analyzer', 'default_operator', 'df', 'stored_fields', 'lenient', 'preference', 'q', 'routing', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'analyze_wildcard',
38
+ 'analyzer',
39
+ 'default_operator',
40
+ 'df',
41
+ 'stored_fields',
42
+ 'lenient',
43
+ 'preference',
44
+ 'q',
45
+ 'routing',
46
+ '_source',
47
+ '_source_excludes',
48
+ '_source_exclude',
49
+ '_source_includes',
50
+ '_source_include',
51
+ 'pretty',
52
+ 'human',
53
+ 'error_trace',
54
+ 'source',
55
+ 'filter_path',
56
+ ];
57
+ const snakeCase = {
58
+ analyzeWildcard: 'analyze_wildcard',
59
+ defaultOperator: 'default_operator',
60
+ storedFields: 'stored_fields',
61
+ _sourceExcludes: '_source_excludes',
62
+ _sourceExclude: '_source_exclude',
63
+ _sourceIncludes: '_source_includes',
64
+ _sourceInclude: '_source_include',
65
+ errorTrace: 'error_trace',
66
+ filterPath: 'filter_path',
67
+ };
39
68
 
40
- function explainApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
69
+ function explainApi(params, options, callback) {
70
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
71
 
43
72
  // check required parameters
44
73
  if (params.id == null) {
45
- const err = new this[kConfigurationError]('Missing required parameter: id')
46
- return handleError(err, callback)
74
+ const err = new this[kConfigurationError]('Missing required parameter: id');
75
+ return handleError(err, callback);
47
76
  }
48
77
  if (params.index == null) {
49
- const err = new this[kConfigurationError]('Missing required parameter: index')
50
- return handleError(err, callback)
78
+ const err = new this[kConfigurationError]('Missing required parameter: index');
79
+ return handleError(err, callback);
51
80
  }
52
81
 
53
- let { method, body, id, index, type, ...querystring } = params
54
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
82
+ let { method, body, id, index, type, ...querystring } = params;
83
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
55
84
 
56
- let path = ''
57
- if ((index) != null && (type) != null && (id) != null) {
58
- if (method == null) method = body == null ? 'GET' : 'POST'
59
- path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_explain'
85
+ let path = '';
86
+ if (index != null && type != null && id != null) {
87
+ if (method == null) method = body == null ? 'GET' : 'POST';
88
+ path =
89
+ '/' +
90
+ encodeURIComponent(index) +
91
+ '/' +
92
+ encodeURIComponent(type) +
93
+ '/' +
94
+ encodeURIComponent(id) +
95
+ '/' +
96
+ '_explain';
60
97
  } else {
61
- if (method == null) method = body == null ? 'GET' : 'POST'
62
- path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id)
98
+ if (method == null) method = body == null ? 'GET' : 'POST';
99
+ path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id);
63
100
  }
64
101
 
65
102
  // build request object
@@ -67,10 +104,10 @@ function explainApi (params, options, callback) {
67
104
  method,
68
105
  path,
69
106
  body: body || '',
70
- querystring
71
- }
107
+ querystring,
108
+ };
72
109
 
73
- return this.transport.request(request, options, callback)
110
+ return this.transport.request(request, options, callback);
74
111
  }
75
112
 
76
- module.exports = explainApi
113
+ module.exports = explainApi;
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -28,65 +27,86 @@
28
27
  * under the License.
29
28
  */
30
29
 
31
- 'use strict'
30
+ 'use strict';
32
31
 
33
32
  /* eslint camelcase: 0 */
34
33
  /* eslint no-unused-vars: 0 */
35
34
 
36
- const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
- const acceptedQuerystring = ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' }
39
-
40
- function FeaturesApi (transport, ConfigurationError) {
41
- this.transport = transport
42
- this[kConfigurationError] = ConfigurationError
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'cluster_manager_timeout',
38
+ 'master_timeout',
39
+ 'pretty',
40
+ 'human',
41
+ 'error_trace',
42
+ 'source',
43
+ 'filter_path',
44
+ ];
45
+ const snakeCase = {
46
+ clusterManagerTimeout: 'cluster_manager_timeout',
47
+ masterTimeout: 'master_timeout',
48
+ errorTrace: 'error_trace',
49
+ filterPath: 'filter_path',
50
+ };
51
+
52
+ function FeaturesApi(transport, ConfigurationError) {
53
+ this.transport = transport;
54
+ this[kConfigurationError] = ConfigurationError;
43
55
  }
44
56
 
45
- FeaturesApi.prototype.getFeatures = function featuresGetFeaturesApi (params, options, callback) {
46
- ;[params, options, callback] = normalizeArguments(params, options, callback)
57
+ FeaturesApi.prototype.getFeatures = function featuresGetFeaturesApi(params, options, callback) {
58
+ [params, options, callback] = normalizeArguments(params, options, callback);
47
59
 
48
- let { method, body, ...querystring } = params
49
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
60
+ let { method, body, ...querystring } = params;
61
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
50
62
 
51
- let path = ''
52
- if (method == null) method = 'GET'
53
- path = '/' + '_features'
63
+ let path = '';
64
+ if (method == null) method = 'GET';
65
+ path = '/' + '_features';
54
66
 
55
67
  // build request object
56
68
  const request = {
57
69
  method,
58
70
  path,
59
71
  body: null,
60
- querystring
61
- }
72
+ querystring,
73
+ };
62
74
 
63
- return this.transport.request(request, options, callback)
64
- }
75
+ return this.transport.request(request, options, callback);
76
+ };
65
77
 
66
- FeaturesApi.prototype.resetFeatures = function featuresResetFeaturesApi (params, options, callback) {
67
- ;[params, options, callback] = normalizeArguments(params, options, callback)
78
+ FeaturesApi.prototype.resetFeatures = function featuresResetFeaturesApi(params, options, callback) {
79
+ [params, options, callback] = normalizeArguments(params, options, callback);
68
80
 
69
- let { method, body, ...querystring } = params
70
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
81
+ let { method, body, ...querystring } = params;
82
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
71
83
 
72
- let path = ''
73
- if (method == null) method = 'POST'
74
- path = '/' + '_features' + '/' + '_reset'
84
+ let path = '';
85
+ if (method == null) method = 'POST';
86
+ path = '/' + '_features' + '/' + '_reset';
75
87
 
76
88
  // build request object
77
89
  const request = {
78
90
  method,
79
91
  path,
80
92
  body: body || '',
81
- querystring
82
- }
93
+ querystring,
94
+ };
83
95
 
84
- return this.transport.request(request, options, callback)
85
- }
96
+ return this.transport.request(request, options, callback);
97
+ };
86
98
 
87
99
  Object.defineProperties(FeaturesApi.prototype, {
88
- get_features: { get () { return this.getFeatures } },
89
- reset_features: { get () { return this.resetFeatures } }
90
- })
91
-
92
- module.exports = FeaturesApi
100
+ get_features: {
101
+ get() {
102
+ return this.getFeatures;
103
+ },
104
+ },
105
+ reset_features: {
106
+ get() {
107
+ return this.resetFeatures;
108
+ },
109
+ },
110
+ });
111
+
112
+ module.exports = FeaturesApi;
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -28,28 +27,46 @@
28
27
  * under the License.
29
28
  */
30
29
 
31
- 'use strict'
30
+ 'use strict';
32
31
 
33
32
  /* eslint camelcase: 0 */
34
33
  /* eslint no-unused-vars: 0 */
35
34
 
36
- const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
- const acceptedQuerystring = ['fields', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'include_unmapped', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', includeUnmapped: 'include_unmapped', errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'fields',
38
+ 'ignore_unavailable',
39
+ 'allow_no_indices',
40
+ 'expand_wildcards',
41
+ 'include_unmapped',
42
+ 'pretty',
43
+ 'human',
44
+ 'error_trace',
45
+ 'source',
46
+ 'filter_path',
47
+ ];
48
+ const snakeCase = {
49
+ ignoreUnavailable: 'ignore_unavailable',
50
+ allowNoIndices: 'allow_no_indices',
51
+ expandWildcards: 'expand_wildcards',
52
+ includeUnmapped: 'include_unmapped',
53
+ errorTrace: 'error_trace',
54
+ filterPath: 'filter_path',
55
+ };
39
56
 
40
- function fieldCapsApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
57
+ function fieldCapsApi(params, options, callback) {
58
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
59
 
43
- let { method, body, index, ...querystring } = params
44
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
60
+ let { method, body, index, ...querystring } = params;
61
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
45
62
 
46
- let path = ''
47
- if ((index) != null) {
48
- if (method == null) method = body == null ? 'GET' : 'POST'
49
- path = '/' + encodeURIComponent(index) + '/' + '_field_caps'
63
+ let path = '';
64
+ if (index != null) {
65
+ if (method == null) method = body == null ? 'GET' : 'POST';
66
+ path = '/' + encodeURIComponent(index) + '/' + '_field_caps';
50
67
  } else {
51
- if (method == null) method = body == null ? 'GET' : 'POST'
52
- path = '/' + '_field_caps'
68
+ if (method == null) method = body == null ? 'GET' : 'POST';
69
+ path = '/' + '_field_caps';
53
70
  }
54
71
 
55
72
  // build request object
@@ -57,10 +74,10 @@ function fieldCapsApi (params, options, callback) {
57
74
  method,
58
75
  path,
59
76
  body: body || '',
60
- querystring
61
- }
77
+ querystring,
78
+ };
62
79
 
63
- return this.transport.request(request, options, callback)
80
+ return this.transport.request(request, options, callback);
64
81
  }
65
82
 
66
- module.exports = fieldCapsApi
83
+ module.exports = fieldCapsApi;
package/api/api/get.js CHANGED
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -28,38 +27,71 @@
28
27
  * under the License.
29
28
  */
30
29
 
31
- 'use strict'
30
+ 'use strict';
32
31
 
33
32
  /* eslint camelcase: 0 */
34
33
  /* eslint no-unused-vars: 0 */
35
34
 
36
- const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
- const acceptedQuerystring = ['stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'stored_fields',
38
+ 'preference',
39
+ 'realtime',
40
+ 'refresh',
41
+ 'routing',
42
+ '_source',
43
+ '_source_excludes',
44
+ '_source_exclude',
45
+ '_source_includes',
46
+ '_source_include',
47
+ 'version',
48
+ 'version_type',
49
+ 'pretty',
50
+ 'human',
51
+ 'error_trace',
52
+ 'source',
53
+ 'filter_path',
54
+ ];
55
+ const snakeCase = {
56
+ storedFields: 'stored_fields',
57
+ _sourceExcludes: '_source_excludes',
58
+ _sourceExclude: '_source_exclude',
59
+ _sourceIncludes: '_source_includes',
60
+ _sourceInclude: '_source_include',
61
+ versionType: 'version_type',
62
+ errorTrace: 'error_trace',
63
+ filterPath: 'filter_path',
64
+ };
39
65
 
40
- function getApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
66
+ function getApi(params, options, callback) {
67
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
68
 
43
69
  // check required parameters
44
70
  if (params.id == null) {
45
- const err = new this[kConfigurationError]('Missing required parameter: id')
46
- return handleError(err, callback)
71
+ const err = new this[kConfigurationError]('Missing required parameter: id');
72
+ return handleError(err, callback);
47
73
  }
48
74
  if (params.index == null) {
49
- const err = new this[kConfigurationError]('Missing required parameter: index')
50
- return handleError(err, callback)
75
+ const err = new this[kConfigurationError]('Missing required parameter: index');
76
+ return handleError(err, callback);
51
77
  }
52
78
 
53
- let { method, body, id, index, type, ...querystring } = params
54
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
79
+ let { method, body, id, index, type, ...querystring } = params;
80
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
55
81
 
56
- let path = ''
57
- if ((index) != null && (type) != null && (id) != null) {
58
- if (method == null) method = 'GET'
59
- path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
82
+ let path = '';
83
+ if (index != null && type != null && id != null) {
84
+ if (method == null) method = 'GET';
85
+ path =
86
+ '/' +
87
+ encodeURIComponent(index) +
88
+ '/' +
89
+ encodeURIComponent(type) +
90
+ '/' +
91
+ encodeURIComponent(id);
60
92
  } else {
61
- if (method == null) method = 'GET'
62
- path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
93
+ if (method == null) method = 'GET';
94
+ path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id);
63
95
  }
64
96
 
65
97
  // build request object
@@ -67,10 +99,10 @@ function getApi (params, options, callback) {
67
99
  method,
68
100
  path,
69
101
  body: null,
70
- querystring
71
- }
102
+ querystring,
103
+ };
72
104
 
73
- return this.transport.request(request, options, callback)
105
+ return this.transport.request(request, options, callback);
74
106
  }
75
107
 
76
- module.exports = getApi
108
+ module.exports = getApi;
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -28,40 +27,53 @@
28
27
  * under the License.
29
28
  */
30
29
 
31
- 'use strict'
30
+ 'use strict';
32
31
 
33
32
  /* eslint camelcase: 0 */
34
33
  /* eslint no-unused-vars: 0 */
35
34
 
36
- const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
- const acceptedQuerystring = ['master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = [
37
+ 'cluster_manager_timeout',
38
+ 'master_timeout',
39
+ 'pretty',
40
+ 'human',
41
+ 'error_trace',
42
+ 'source',
43
+ 'filter_path',
44
+ ];
45
+ const snakeCase = {
46
+ clusterManagerTimeout: 'cluster_manager_timeout',
47
+ masterTimeout: 'master_timeout',
48
+ errorTrace: 'error_trace',
49
+ filterPath: 'filter_path',
50
+ };
39
51
 
40
- function getScriptApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
52
+ function getScriptApi(params, options, callback) {
53
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
54
 
43
55
  // check required parameters
44
56
  if (params.id == null) {
45
- const err = new this[kConfigurationError]('Missing required parameter: id')
46
- return handleError(err, callback)
57
+ const err = new this[kConfigurationError]('Missing required parameter: id');
58
+ return handleError(err, callback);
47
59
  }
48
60
 
49
- let { method, body, id, ...querystring } = params
50
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
61
+ let { method, body, id, ...querystring } = params;
62
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
51
63
 
52
- let path = ''
53
- if (method == null) method = 'GET'
54
- path = '/' + '_scripts' + '/' + encodeURIComponent(id)
64
+ let path = '';
65
+ if (method == null) method = 'GET';
66
+ path = '/' + '_scripts' + '/' + encodeURIComponent(id);
55
67
 
56
68
  // build request object
57
69
  const request = {
58
70
  method,
59
71
  path,
60
72
  body: null,
61
- querystring
62
- }
73
+ querystring,
74
+ };
63
75
 
64
- return this.transport.request(request, options, callback)
76
+ return this.transport.request(request, options, callback);
65
77
  }
66
78
 
67
- module.exports = getScriptApi
79
+ module.exports = getScriptApi;
@@ -1,12 +1,11 @@
1
1
  /*
2
+ * Copyright OpenSearch Contributors
2
3
  * SPDX-License-Identifier: Apache-2.0
3
4
  *
4
5
  * The OpenSearch Contributors require contributions made to
5
6
  * this file be licensed under the Apache-2.0 license or a
6
7
  * compatible open source license.
7
8
  *
8
- * Modifications Copyright OpenSearch Contributors. See
9
- * GitHub history for details.
10
9
  */
11
10
 
12
11
  /*
@@ -28,34 +27,34 @@
28
27
  * under the License.
29
28
  */
30
29
 
31
- 'use strict'
30
+ 'use strict';
32
31
 
33
32
  /* eslint camelcase: 0 */
34
33
  /* eslint no-unused-vars: 0 */
35
34
 
36
- const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
- const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
35
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
36
+ const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path'];
37
+ const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' };
39
38
 
40
- function getScriptContextApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
39
+ function getScriptContextApi(params, options, callback) {
40
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
41
 
43
- let { method, body, ...querystring } = params
44
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
42
+ let { method, body, ...querystring } = params;
43
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
45
44
 
46
- let path = ''
47
- if (method == null) method = 'GET'
48
- path = '/' + '_script_context'
45
+ let path = '';
46
+ if (method == null) method = 'GET';
47
+ path = '/' + '_script_context';
49
48
 
50
49
  // build request object
51
50
  const request = {
52
51
  method,
53
52
  path,
54
53
  body: null,
55
- querystring
56
- }
54
+ querystring,
55
+ };
57
56
 
58
- return this.transport.request(request, options, callback)
57
+ return this.transport.request(request, options, callback);
59
58
  }
60
59
 
61
- module.exports = getScriptContextApi
60
+ module.exports = getScriptContextApi;