@elastic/elasticsearch
Advanced tools
Comparing version 7.12.0 to 7.13.0
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['format', 'local', 'h', 'help', 's', 'v', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'bytes', 'master_timeout', 'fields', 'time', 'ts', 'health', 'pri', 'include_unloaded_segments', 'full_id', 'include_bootstrap', 'active_only', 'detailed', 'index', 'ignore_unavailable', 'nodes', 'actions', 'parent_task_id', 'size', 'allow_no_match', 'allow_no_datafeeds', 'allow_no_jobs', 'from'] | ||
const snakeCase = { expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', includeUnloadedSegments: 'include_unloaded_segments', fullId: 'full_id', includeBootstrap: 'include_bootstrap', activeOnly: 'active_only', ignoreUnavailable: 'ignore_unavailable', parentTaskId: 'parent_task_id', allowNoMatch: 'allow_no_match', allowNoDatafeeds: 'allow_no_datafeeds', allowNoJobs: 'allow_no_jobs' } | ||
const acceptedQuerystring = ['format', 'local', 'h', 'help', 's', 'v', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'bytes', 'master_timeout', 'fields', 'time', 'ts', 'health', 'pri', 'include_unloaded_segments', 'allow_no_match', 'allow_no_datafeeds', 'allow_no_jobs', 'from', 'size', 'full_id', 'include_bootstrap', 'active_only', 'detailed', 'index', 'ignore_unavailable', 'nodes', 'actions', 'parent_task_id'] | ||
const snakeCase = { expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', includeUnloadedSegments: 'include_unloaded_segments', allowNoMatch: 'allow_no_match', allowNoDatafeeds: 'allow_no_datafeeds', allowNoJobs: 'allow_no_jobs', fullId: 'full_id', includeBootstrap: 'include_bootstrap', activeOnly: 'active_only', ignoreUnavailable: 'ignore_unavailable', parentTaskId: 'parent_task_id' } | ||
@@ -228,11 +228,16 @@ function CatApi (transport, ConfigurationError) { | ||
CatApi.prototype.nodeattrs = function catNodeattrsApi (params, options, callback) { | ||
CatApi.prototype.mlDataFrameAnalytics = function catMlDataFrameAnalyticsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, ...querystring } = params | ||
let { method, body, id, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'nodeattrs' | ||
if ((id) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'data_frame' + '/' + 'analytics' | ||
} | ||
@@ -250,11 +255,16 @@ // build request object | ||
CatApi.prototype.nodes = function catNodesApi (params, options, callback) { | ||
CatApi.prototype.mlDatafeeds = function catMlDatafeedsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, ...querystring } = params | ||
let { method, body, datafeedId, datafeed_id, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'nodes' | ||
if ((datafeed_id || datafeedId) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'datafeeds' | ||
} | ||
@@ -272,11 +282,16 @@ // build request object | ||
CatApi.prototype.pendingTasks = function catPendingTasksApi (params, options, callback) { | ||
CatApi.prototype.mlJobs = function catMlJobsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, ...querystring } = params | ||
let { method, body, jobId, job_id, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'pending_tasks' | ||
if ((job_id || jobId) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'anomaly_detectors' | ||
} | ||
@@ -294,11 +309,16 @@ // build request object | ||
CatApi.prototype.plugins = function catPluginsApi (params, options, callback) { | ||
CatApi.prototype.mlTrainedModels = function catMlTrainedModelsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, ...querystring } = params | ||
let { method, body, modelId, model_id, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'plugins' | ||
if ((model_id || modelId) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'trained_models' + '/' + encodeURIComponent(model_id || modelId) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'trained_models' | ||
} | ||
@@ -316,16 +336,11 @@ // build request object | ||
CatApi.prototype.recovery = function catRecoveryApi (params, options, callback) { | ||
CatApi.prototype.nodeattrs = function catNodeattrsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, index, ...querystring } = params | ||
let { method, body, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((index) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'recovery' + '/' + encodeURIComponent(index) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'recovery' | ||
} | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'nodeattrs' | ||
@@ -343,3 +358,3 @@ // build request object | ||
CatApi.prototype.repositories = function catRepositoriesApi (params, options, callback) { | ||
CatApi.prototype.nodes = function catNodesApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
@@ -352,3 +367,3 @@ | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'repositories' | ||
path = '/' + '_cat' + '/' + 'nodes' | ||
@@ -366,16 +381,11 @@ // build request object | ||
CatApi.prototype.segments = function catSegmentsApi (params, options, callback) { | ||
CatApi.prototype.pendingTasks = function catPendingTasksApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, index, ...querystring } = params | ||
let { method, body, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((index) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'segments' + '/' + encodeURIComponent(index) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'segments' | ||
} | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'pending_tasks' | ||
@@ -393,16 +403,11 @@ // build request object | ||
CatApi.prototype.shards = function catShardsApi (params, options, callback) { | ||
CatApi.prototype.plugins = function catPluginsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, index, ...querystring } = params | ||
let { method, body, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((index) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'shards' + '/' + encodeURIComponent(index) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'shards' | ||
} | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'plugins' | ||
@@ -420,15 +425,15 @@ // build request object | ||
CatApi.prototype.snapshots = function catSnapshotsApi (params, options, callback) { | ||
CatApi.prototype.recovery = function catRecoveryApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, repository, ...querystring } = params | ||
let { method, body, index, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((repository) != null) { | ||
if ((index) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'snapshots' + '/' + encodeURIComponent(repository) | ||
path = '/' + '_cat' + '/' + 'recovery' + '/' + encodeURIComponent(index) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'snapshots' | ||
path = '/' + '_cat' + '/' + 'recovery' | ||
} | ||
@@ -447,3 +452,3 @@ | ||
CatApi.prototype.tasks = function catTasksApi (params, options, callback) { | ||
CatApi.prototype.repositories = function catRepositoriesApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
@@ -456,3 +461,3 @@ | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'tasks' | ||
path = '/' + '_cat' + '/' + 'repositories' | ||
@@ -470,15 +475,15 @@ // build request object | ||
CatApi.prototype.templates = function catTemplatesApi (params, options, callback) { | ||
CatApi.prototype.segments = function catSegmentsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, name, ...querystring } = params | ||
let { method, body, index, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((name) != null) { | ||
if ((index) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'templates' + '/' + encodeURIComponent(name) | ||
path = '/' + '_cat' + '/' + 'segments' + '/' + encodeURIComponent(index) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'templates' | ||
path = '/' + '_cat' + '/' + 'segments' | ||
} | ||
@@ -497,15 +502,15 @@ | ||
CatApi.prototype.threadPool = function catThreadPoolApi (params, options, callback) { | ||
CatApi.prototype.shards = function catShardsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, threadPoolPatterns, thread_pool_patterns, ...querystring } = params | ||
let { method, body, index, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((thread_pool_patterns || threadPoolPatterns) != null) { | ||
if ((index) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'thread_pool' + '/' + encodeURIComponent(thread_pool_patterns || threadPoolPatterns) | ||
path = '/' + '_cat' + '/' + 'shards' + '/' + encodeURIComponent(index) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'thread_pool' | ||
path = '/' + '_cat' + '/' + 'shards' | ||
} | ||
@@ -524,15 +529,15 @@ | ||
CatApi.prototype.mlDataFrameAnalytics = function catMlDataFrameAnalyticsApi (params, options, callback) { | ||
CatApi.prototype.snapshots = function catSnapshotsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, id, ...querystring } = params | ||
let { method, body, repository, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((id) != null) { | ||
if ((repository) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'data_frame' + '/' + 'analytics' + '/' + encodeURIComponent(id) | ||
path = '/' + '_cat' + '/' + 'snapshots' + '/' + encodeURIComponent(repository) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'data_frame' + '/' + 'analytics' | ||
path = '/' + '_cat' + '/' + 'snapshots' | ||
} | ||
@@ -551,16 +556,11 @@ | ||
CatApi.prototype.mlDatafeeds = function catMlDatafeedsApi (params, options, callback) { | ||
CatApi.prototype.tasks = function catTasksApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, datafeedId, datafeed_id, ...querystring } = params | ||
let { method, body, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((datafeed_id || datafeedId) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'datafeeds' + '/' + encodeURIComponent(datafeed_id || datafeedId) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'datafeeds' | ||
} | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'tasks' | ||
@@ -578,15 +578,15 @@ // build request object | ||
CatApi.prototype.mlJobs = function catMlJobsApi (params, options, callback) { | ||
CatApi.prototype.templates = function catTemplatesApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, jobId, job_id, ...querystring } = params | ||
let { method, body, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((job_id || jobId) != null) { | ||
if ((name) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) | ||
path = '/' + '_cat' + '/' + 'templates' + '/' + encodeURIComponent(name) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'anomaly_detectors' | ||
path = '/' + '_cat' + '/' + 'templates' | ||
} | ||
@@ -605,15 +605,15 @@ | ||
CatApi.prototype.mlTrainedModels = function catMlTrainedModelsApi (params, options, callback) { | ||
CatApi.prototype.threadPool = function catThreadPoolApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, modelId, model_id, ...querystring } = params | ||
let { method, body, threadPoolPatterns, thread_pool_patterns, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((model_id || modelId) != null) { | ||
if ((thread_pool_patterns || threadPoolPatterns) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'trained_models' + '/' + encodeURIComponent(model_id || modelId) | ||
path = '/' + '_cat' + '/' + 'thread_pool' + '/' + encodeURIComponent(thread_pool_patterns || threadPoolPatterns) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_cat' + '/' + 'ml' + '/' + 'trained_models' | ||
path = '/' + '_cat' + '/' + 'thread_pool' | ||
} | ||
@@ -659,10 +659,10 @@ | ||
Object.defineProperties(CatApi.prototype, { | ||
pending_tasks: { get () { return this.pendingTasks } }, | ||
thread_pool: { get () { return this.threadPool } }, | ||
ml_data_frame_analytics: { get () { return this.mlDataFrameAnalytics } }, | ||
ml_datafeeds: { get () { return this.mlDatafeeds } }, | ||
ml_jobs: { get () { return this.mlJobs } }, | ||
ml_trained_models: { get () { return this.mlTrainedModels } } | ||
ml_trained_models: { get () { return this.mlTrainedModels } }, | ||
pending_tasks: { get () { return this.pendingTasks } }, | ||
thread_pool: { get () { return this.threadPool } } | ||
}) | ||
module.exports = CatApi |
@@ -55,6 +55,28 @@ /* | ||
FeaturesApi.prototype.resetFeatures = function featuresResetFeaturesApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'POST' | ||
path = '/' + '_features' + '/' + '_reset' | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
Object.defineProperties(FeaturesApi.prototype, { | ||
get_features: { get () { return this.getFeatures } } | ||
get_features: { get () { return this.getFeatures } }, | ||
reset_features: { get () { return this.resetFeatures } } | ||
}) | ||
module.exports = FeaturesApi |
@@ -214,2 +214,55 @@ /* | ||
IndicesApi.prototype.createDataStream = function indicesCreateDataStreamApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.name == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: name') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'PUT' | ||
path = '/' + '_data_stream' + '/' + encodeURIComponent(name) | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.dataStreamsStats = function indicesDataStreamsStatsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((name) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_data_stream' + '/' + encodeURIComponent(name) + '/' + '_stats' | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_data_stream' + '/' + '_stats' | ||
} | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: null, | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.delete = function indicesDeleteApi (params, options, callback) { | ||
@@ -284,2 +337,29 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
IndicesApi.prototype.deleteDataStream = function indicesDeleteDataStreamApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.name == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: name') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'DELETE' | ||
path = '/' + '_data_stream' + '/' + encodeURIComponent(name) | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.deleteIndexTemplate = function indicesDeleteIndexTemplateApi (params, options, callback) { | ||
@@ -562,2 +642,29 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
IndicesApi.prototype.freeze = function indicesFreezeApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.index == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: index') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, index, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'POST' | ||
path = '/' + encodeURIComponent(index) + '/' + '_freeze' | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.get = function indicesGetApi (params, options, callback) { | ||
@@ -622,2 +729,28 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
IndicesApi.prototype.getDataStream = function indicesGetDataStreamApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((name) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_data_stream' + '/' + encodeURIComponent(name) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_data_stream' | ||
} | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: null, | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.getFieldMapping = function indicesGetFieldMappingApi (params, options, callback) { | ||
@@ -798,2 +931,29 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
IndicesApi.prototype.migrateToDataStream = function indicesMigrateToDataStreamApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.name == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: name') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'POST' | ||
path = '/' + '_data_stream' + '/' + '_migrate' + '/' + encodeURIComponent(name) | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.open = function indicesOpenApi (params, options, callback) { | ||
@@ -826,2 +986,29 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
IndicesApi.prototype.promoteDataStream = function indicesPromoteDataStreamApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.name == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: name') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'POST' | ||
path = '/' + '_data_stream' + '/' + '_promote' + '/' + encodeURIComponent(name) | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.putAlias = function indicesPutAliasApi (params, options, callback) { | ||
@@ -1065,2 +1252,29 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
IndicesApi.prototype.reloadSearchAnalyzers = function indicesReloadSearchAnalyzersApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.index == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: index') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, index, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = body == null ? 'GET' : 'POST' | ||
path = '/' + encodeURIComponent(index) + '/' + '_reload_search_analyzers' | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.resolveIndex = function indicesResolveIndexApi (params, options, callback) { | ||
@@ -1342,169 +1556,6 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
IndicesApi.prototype.updateAliases = function indicesUpdateAliasesApi (params, options, callback) { | ||
IndicesApi.prototype.unfreeze = function indicesUnfreezeApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.body == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: body') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'POST' | ||
path = '/' + '_aliases' | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.upgrade = function indicesUpgradeApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, index, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'POST' | ||
path = '/' + encodeURIComponent(index) + '/' + '_upgrade' | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.validateQuery = function indicesValidateQueryApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required url components | ||
if (params.type != null && (params.index == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: index') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, index, type, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((index) != null && (type) != null) { | ||
if (method == null) method = body == null ? 'GET' : 'POST' | ||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_validate' + '/' + 'query' | ||
} else if ((index) != null) { | ||
if (method == null) method = body == null ? 'GET' : 'POST' | ||
path = '/' + encodeURIComponent(index) + '/' + '_validate' + '/' + 'query' | ||
} else { | ||
if (method == null) method = body == null ? 'GET' : 'POST' | ||
path = '/' + '_validate' + '/' + 'query' | ||
} | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.createDataStream = function indicesCreateDataStreamApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.name == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: name') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'PUT' | ||
path = '/' + '_data_stream' + '/' + encodeURIComponent(name) | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.dataStreamsStats = function indicesDataStreamsStatsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((name) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_data_stream' + '/' + encodeURIComponent(name) + '/' + '_stats' | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_data_stream' + '/' + '_stats' | ||
} | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: null, | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.deleteDataStream = function indicesDeleteDataStreamApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.name == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: name') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'DELETE' | ||
path = '/' + '_data_stream' + '/' + encodeURIComponent(name) | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.freeze = function indicesFreezeApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.index == null) { | ||
@@ -1520,3 +1571,3 @@ const err = new this[kConfigurationError]('Missing required parameter: index') | ||
if (method == null) method = 'POST' | ||
path = '/' + encodeURIComponent(index) + '/' + '_freeze' | ||
path = '/' + encodeURIComponent(index) + '/' + '_unfreeze' | ||
@@ -1534,38 +1585,12 @@ // build request object | ||
IndicesApi.prototype.getDataStream = function indicesGetDataStreamApi (params, options, callback) { | ||
IndicesApi.prototype.updateAliases = function indicesUpdateAliasesApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((name) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_data_stream' + '/' + encodeURIComponent(name) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_data_stream' | ||
} | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: null, | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.migrateToDataStream = function indicesMigrateToDataStreamApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.name == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: name') | ||
if (params.body == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: body') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, name, ...querystring } = params | ||
let { method, body, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
@@ -1575,3 +1600,3 @@ | ||
if (method == null) method = 'POST' | ||
path = '/' + '_data_stream' + '/' + '_migrate' + '/' + encodeURIComponent(name) | ||
path = '/' + '_aliases' | ||
@@ -1589,12 +1614,6 @@ // build request object | ||
IndicesApi.prototype.promoteDataStream = function indicesPromoteDataStreamApi (params, options, callback) { | ||
IndicesApi.prototype.upgrade = function indicesUpgradeApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.name == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: name') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, name, ...querystring } = params | ||
let { method, body, index, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
@@ -1604,3 +1623,3 @@ | ||
if (method == null) method = 'POST' | ||
path = '/' + '_data_stream' + '/' + '_promote' + '/' + encodeURIComponent(name) | ||
path = '/' + encodeURIComponent(index) + '/' + '_upgrade' | ||
@@ -1618,45 +1637,26 @@ // build request object | ||
IndicesApi.prototype.reloadSearchAnalyzers = function indicesReloadSearchAnalyzersApi (params, options, callback) { | ||
IndicesApi.prototype.validateQuery = function indicesValidateQueryApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.index == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: index') | ||
// check required url components | ||
if (params.type != null && (params.index == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: index') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, index, ...querystring } = params | ||
let { method, body, index, type, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = body == null ? 'GET' : 'POST' | ||
path = '/' + encodeURIComponent(index) + '/' + '_reload_search_analyzers' | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
if ((index) != null && (type) != null) { | ||
if (method == null) method = body == null ? 'GET' : 'POST' | ||
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_validate' + '/' + 'query' | ||
} else if ((index) != null) { | ||
if (method == null) method = body == null ? 'GET' : 'POST' | ||
path = '/' + encodeURIComponent(index) + '/' + '_validate' + '/' + 'query' | ||
} else { | ||
if (method == null) method = body == null ? 'GET' : 'POST' | ||
path = '/' + '_validate' + '/' + 'query' | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IndicesApi.prototype.unfreeze = function indicesUnfreezeApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.index == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: index') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, index, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'POST' | ||
path = '/' + encodeURIComponent(index) + '/' + '_unfreeze' | ||
// build request object | ||
@@ -1676,3 +1676,6 @@ const request = { | ||
clear_cache: { get () { return this.clearCache } }, | ||
create_data_stream: { get () { return this.createDataStream } }, | ||
data_streams_stats: { get () { return this.dataStreamsStats } }, | ||
delete_alias: { get () { return this.deleteAlias } }, | ||
delete_data_stream: { get () { return this.deleteDataStream } }, | ||
delete_index_template: { get () { return this.deleteIndexTemplate } }, | ||
@@ -1686,2 +1689,3 @@ delete_template: { get () { return this.deleteTemplate } }, | ||
get_alias: { get () { return this.getAlias } }, | ||
get_data_stream: { get () { return this.getDataStream } }, | ||
get_field_mapping: { get () { return this.getFieldMapping } }, | ||
@@ -1693,2 +1697,4 @@ get_index_template: { get () { return this.getIndexTemplate } }, | ||
get_upgrade: { get () { return this.getUpgrade } }, | ||
migrate_to_data_stream: { get () { return this.migrateToDataStream } }, | ||
promote_data_stream: { get () { return this.promoteDataStream } }, | ||
put_alias: { get () { return this.putAlias } }, | ||
@@ -1699,2 +1705,3 @@ put_index_template: { get () { return this.putIndexTemplate } }, | ||
put_template: { get () { return this.putTemplate } }, | ||
reload_search_analyzers: { get () { return this.reloadSearchAnalyzers } }, | ||
resolve_index: { get () { return this.resolveIndex } }, | ||
@@ -1705,12 +1712,5 @@ shard_stores: { get () { return this.shardStores } }, | ||
update_aliases: { get () { return this.updateAliases } }, | ||
validate_query: { get () { return this.validateQuery } }, | ||
create_data_stream: { get () { return this.createDataStream } }, | ||
data_streams_stats: { get () { return this.dataStreamsStats } }, | ||
delete_data_stream: { get () { return this.deleteDataStream } }, | ||
get_data_stream: { get () { return this.getDataStream } }, | ||
migrate_to_data_stream: { get () { return this.migrateToDataStream } }, | ||
promote_data_stream: { get () { return this.promoteDataStream } }, | ||
reload_search_analyzers: { get () { return this.reloadSearchAnalyzers } } | ||
validate_query: { get () { return this.validateQuery } } | ||
}) | ||
module.exports = IndicesApi |
@@ -26,3 +26,3 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'verbose'] | ||
const acceptedQuerystring = ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'summary', 'verbose'] | ||
const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
@@ -62,2 +62,23 @@ | ||
IngestApi.prototype.geoIpStats = function ingestGeoIpStatsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'GET' | ||
path = '/' + '_ingest' + '/' + 'geoip' + '/' + 'stats' | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: null, | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
IngestApi.prototype.getPipeline = function ingestGetPipelineApi (params, options, callback) { | ||
@@ -175,2 +196,3 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
delete_pipeline: { get () { return this.deletePipeline } }, | ||
geo_ip_stats: { get () { return this.geoIpStats } }, | ||
get_pipeline: { get () { return this.getPipeline } }, | ||
@@ -177,0 +199,0 @@ processor_grok: { get () { return this.processorGrok } }, |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['interval', 'snapshots', 'threads', 'ignore_idle_threads', 'type', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'flat_settings', 'completion_fields', 'fielddata_fields', 'fields', 'groups', 'level', 'types', 'include_segment_file_sizes'] | ||
const snakeCase = { ignoreIdleThreads: 'ignore_idle_threads', errorTrace: 'error_trace', filterPath: 'filter_path', flatSettings: 'flat_settings', completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes' } | ||
const acceptedQuerystring = ['interval', 'snapshots', 'threads', 'ignore_idle_threads', 'type', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'flat_settings', 'completion_fields', 'fielddata_fields', 'fields', 'groups', 'level', 'types', 'include_segment_file_sizes', 'include_unloaded_segments'] | ||
const snakeCase = { ignoreIdleThreads: 'ignore_idle_threads', errorTrace: 'error_trace', filterPath: 'filter_path', flatSettings: 'flat_settings', completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', includeUnloadedSegments: 'include_unloaded_segments' } | ||
@@ -30,0 +30,0 @@ function NodesApi (transport, ConfigurationError) { |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'index', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'master_timeout', 'wait_for_completion', 'storage', 'level'] | ||
const snakeCase = { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout', waitForCompletion: 'wait_for_completion' } | ||
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'index', 'master_timeout', 'wait_for_completion', 'storage', 'level'] | ||
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', masterTimeout: 'master_timeout', waitForCompletion: 'wait_for_completion' } | ||
@@ -35,2 +35,28 @@ function SearchableSnapshotsApi (transport, ConfigurationError) { | ||
SearchableSnapshotsApi.prototype.cacheStats = function searchableSnapshotsCacheStatsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
let { method, body, nodeId, node_id, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((node_id || nodeId) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_searchable_snapshots' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'cache' + '/' + 'stats' | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_searchable_snapshots' + '/' + 'cache' + '/' + 'stats' | ||
} | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: null, | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SearchableSnapshotsApi.prototype.clearCache = function searchableSnapshotsClearCacheApi (params, options, callback) { | ||
@@ -157,2 +183,3 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
Object.defineProperties(SearchableSnapshotsApi.prototype, { | ||
cache_stats: { get () { return this.cacheStats } }, | ||
clear_cache: { get () { return this.clearCache } }, | ||
@@ -159,0 +186,0 @@ repository_stats: { get () { return this.repositoryStats } } |
@@ -195,2 +195,46 @@ /* | ||
SecurityApi.prototype.clearCachedServiceTokens = function securityClearCachedServiceTokensApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.namespace == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: namespace') | ||
return handleError(err, callback) | ||
} | ||
if (params.service == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: service') | ||
return handleError(err, callback) | ||
} | ||
if (params.name == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: name') | ||
return handleError(err, callback) | ||
} | ||
// check required url components | ||
if (params.name != null && (params.service == null || params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: service, namespace') | ||
return handleError(err, callback) | ||
} else if (params.service != null && (params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, namespace, service, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'POST' | ||
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential' + '/' + 'token' + '/' + encodeURIComponent(name) + '/' + '_clear_cache' | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SecurityApi.prototype.createApiKey = function securityCreateApiKeyApi (params, options, callback) { | ||
@@ -223,2 +267,47 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
SecurityApi.prototype.createServiceToken = function securityCreateServiceTokenApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.namespace == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: namespace') | ||
return handleError(err, callback) | ||
} | ||
if (params.service == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: service') | ||
return handleError(err, callback) | ||
} | ||
// check required url components | ||
if (params.name != null && (params.service == null || params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: service, namespace') | ||
return handleError(err, callback) | ||
} else if (params.service != null && (params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, namespace, service, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((namespace) != null && (service) != null && (name) != null) { | ||
if (method == null) method = 'PUT' | ||
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential' + '/' + 'token' + '/' + encodeURIComponent(name) | ||
} else { | ||
if (method == null) method = 'POST' | ||
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential' + '/' + 'token' | ||
} | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SecurityApi.prototype.deletePrivileges = function securityDeletePrivilegesApi (params, options, callback) { | ||
@@ -315,2 +404,46 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
SecurityApi.prototype.deleteServiceToken = function securityDeleteServiceTokenApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.namespace == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: namespace') | ||
return handleError(err, callback) | ||
} | ||
if (params.service == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: service') | ||
return handleError(err, callback) | ||
} | ||
if (params.name == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: name') | ||
return handleError(err, callback) | ||
} | ||
// check required url components | ||
if (params.name != null && (params.service == null || params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: service, namespace') | ||
return handleError(err, callback) | ||
} else if (params.service != null && (params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, namespace, service, name, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'DELETE' | ||
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential' + '/' + 'token' + '/' + encodeURIComponent(name) | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SecurityApi.prototype.deleteUser = function securityDeleteUserApi (params, options, callback) { | ||
@@ -526,2 +659,74 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
SecurityApi.prototype.getServiceAccounts = function securityGetServiceAccountsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required url components | ||
if (params.service != null && (params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, namespace, service, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if ((namespace) != null && (service) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) | ||
} else if ((namespace) != null) { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) | ||
} else { | ||
if (method == null) method = 'GET' | ||
path = '/' + '_security' + '/' + 'service' | ||
} | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: null, | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SecurityApi.prototype.getServiceCredentials = function securityGetServiceCredentialsApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params.namespace == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: namespace') | ||
return handleError(err, callback) | ||
} | ||
if (params.service == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: service') | ||
return handleError(err, callback) | ||
} | ||
// check required url components | ||
if (params.service != null && (params.namespace == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: namespace') | ||
return handleError(err, callback) | ||
} | ||
let { method, body, namespace, service, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
let path = '' | ||
if (method == null) method = 'GET' | ||
path = '/' + '_security' + '/' + 'service' + '/' + encodeURIComponent(namespace) + '/' + encodeURIComponent(service) + '/' + 'credential' | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: null, | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SecurityApi.prototype.getToken = function securityGetTokenApi (params, options, callback) { | ||
@@ -840,6 +1045,9 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
clear_cached_roles: { get () { return this.clearCachedRoles } }, | ||
clear_cached_service_tokens: { get () { return this.clearCachedServiceTokens } }, | ||
create_api_key: { get () { return this.createApiKey } }, | ||
create_service_token: { get () { return this.createServiceToken } }, | ||
delete_privileges: { get () { return this.deletePrivileges } }, | ||
delete_role: { get () { return this.deleteRole } }, | ||
delete_role_mapping: { get () { return this.deleteRoleMapping } }, | ||
delete_service_token: { get () { return this.deleteServiceToken } }, | ||
delete_user: { get () { return this.deleteUser } }, | ||
@@ -853,2 +1061,4 @@ disable_user: { get () { return this.disableUser } }, | ||
get_role_mapping: { get () { return this.getRoleMapping } }, | ||
get_service_accounts: { get () { return this.getServiceAccounts } }, | ||
get_service_credentials: { get () { return this.getServiceCredentials } }, | ||
get_token: { get () { return this.getToken } }, | ||
@@ -855,0 +1065,0 @@ get_user: { get () { return this.getUser } }, |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'wait_for_completion', 'verify', 'ignore_unavailable', 'verbose', 'local'] | ||
const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path', waitForCompletion: 'wait_for_completion', ignoreUnavailable: 'ignore_unavailable' } | ||
const acceptedQuerystring = ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'wait_for_completion', 'verify', 'ignore_unavailable', 'index_details', 'verbose', 'local'] | ||
const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path', waitForCompletion: 'wait_for_completion', ignoreUnavailable: 'ignore_unavailable', indexDetails: 'index_details' } | ||
@@ -30,0 +30,0 @@ function SnapshotApi (transport, ConfigurationError) { |
@@ -54,3 +54,3 @@ /* | ||
path, | ||
body: body || '', | ||
bulkBody: body, | ||
querystring | ||
@@ -57,0 +57,0 @@ } |
284
api/index.js
@@ -22,5 +22,9 @@ /* | ||
const AsyncSearchApi = require('./api/async_search') | ||
const AutoscalingApi = require('./api/autoscaling') | ||
const bulkApi = require('./api/bulk') | ||
const CatApi = require('./api/cat') | ||
const CcrApi = require('./api/ccr') | ||
const clearScrollApi = require('./api/clear_scroll') | ||
const closePointInTimeApi = require('./api/close_point_in_time') | ||
const ClusterApi = require('./api/cluster') | ||
@@ -34,2 +38,4 @@ const countApi = require('./api/count') | ||
const deleteScriptApi = require('./api/delete_script') | ||
const EnrichApi = require('./api/enrich') | ||
const EqlApi = require('./api/eql') | ||
const existsApi = require('./api/exists') | ||
@@ -40,2 +46,3 @@ const existsSourceApi = require('./api/exists_source') | ||
const fieldCapsApi = require('./api/field_caps') | ||
const FleetApi = require('./api/fleet') | ||
const getApi = require('./api/get') | ||
@@ -46,2 +53,4 @@ const getScriptApi = require('./api/get_script') | ||
const getSourceApi = require('./api/get_source') | ||
const GraphApi = require('./api/graph') | ||
const IlmApi = require('./api/ilm') | ||
const indexApi = require('./api/index') | ||
@@ -51,3 +60,8 @@ const IndicesApi = require('./api/indices') | ||
const IngestApi = require('./api/ingest') | ||
const LicenseApi = require('./api/license') | ||
const LogstashApi = require('./api/logstash') | ||
const mgetApi = require('./api/mget') | ||
const MigrationApi = require('./api/migration') | ||
const MlApi = require('./api/ml') | ||
const MonitoringApi = require('./api/monitoring') | ||
const msearchApi = require('./api/msearch') | ||
@@ -57,2 +71,3 @@ const msearchTemplateApi = require('./api/msearch_template') | ||
const NodesApi = require('./api/nodes') | ||
const openPointInTimeApi = require('./api/open_point_in_time') | ||
const pingApi = require('./api/ping') | ||
@@ -64,2 +79,3 @@ const putScriptApi = require('./api/put_script') | ||
const renderSearchTemplateApi = require('./api/render_search_template') | ||
const RollupApi = require('./api/rollup') | ||
const scriptsPainlessExecuteApi = require('./api/scripts_painless_execute') | ||
@@ -70,30 +86,16 @@ const scrollApi = require('./api/scroll') | ||
const searchTemplateApi = require('./api/search_template') | ||
const SnapshotApi = require('./api/snapshot') | ||
const TasksApi = require('./api/tasks') | ||
const termvectorsApi = require('./api/termvectors') | ||
const updateApi = require('./api/update') | ||
const updateByQueryApi = require('./api/update_by_query') | ||
const updateByQueryRethrottleApi = require('./api/update_by_query_rethrottle') | ||
const AsyncSearchApi = require('./api/async_search') | ||
const AutoscalingApi = require('./api/autoscaling') | ||
const CcrApi = require('./api/ccr') | ||
const closePointInTimeApi = require('./api/close_point_in_time') | ||
const EnrichApi = require('./api/enrich') | ||
const EqlApi = require('./api/eql') | ||
const GraphApi = require('./api/graph') | ||
const IlmApi = require('./api/ilm') | ||
const LicenseApi = require('./api/license') | ||
const LogstashApi = require('./api/logstash') | ||
const MigrationApi = require('./api/migration') | ||
const MlApi = require('./api/ml') | ||
const MonitoringApi = require('./api/monitoring') | ||
const openPointInTimeApi = require('./api/open_point_in_time') | ||
const RollupApi = require('./api/rollup') | ||
const SearchableSnapshotsApi = require('./api/searchable_snapshots') | ||
const SecurityApi = require('./api/security') | ||
const ShutdownApi = require('./api/shutdown') | ||
const SlmApi = require('./api/slm') | ||
const SnapshotApi = require('./api/snapshot') | ||
const SqlApi = require('./api/sql') | ||
const SslApi = require('./api/ssl') | ||
const TasksApi = require('./api/tasks') | ||
const termvectorsApi = require('./api/termvectors') | ||
const TextStructureApi = require('./api/text_structure') | ||
const TransformApi = require('./api/transform') | ||
const updateApi = require('./api/update') | ||
const updateByQueryApi = require('./api/update_by_query') | ||
const updateByQueryRethrottleApi = require('./api/update_by_query_rethrottle') | ||
const WatcherApi = require('./api/watcher') | ||
@@ -103,18 +105,16 @@ const XpackApi = require('./api/xpack') | ||
const { kConfigurationError } = require('./utils') | ||
const kAsyncSearch = Symbol('AsyncSearch') | ||
const kAutoscaling = Symbol('Autoscaling') | ||
const kCat = Symbol('Cat') | ||
const kCcr = Symbol('Ccr') | ||
const kCluster = Symbol('Cluster') | ||
const kDanglingIndices = Symbol('DanglingIndices') | ||
const kFeatures = Symbol('Features') | ||
const kIndices = Symbol('Indices') | ||
const kIngest = Symbol('Ingest') | ||
const kNodes = Symbol('Nodes') | ||
const kSnapshot = Symbol('Snapshot') | ||
const kTasks = Symbol('Tasks') | ||
const kAsyncSearch = Symbol('AsyncSearch') | ||
const kAutoscaling = Symbol('Autoscaling') | ||
const kCcr = Symbol('Ccr') | ||
const kEnrich = Symbol('Enrich') | ||
const kEql = Symbol('Eql') | ||
const kFeatures = Symbol('Features') | ||
const kFleet = Symbol('Fleet') | ||
const kGraph = Symbol('Graph') | ||
const kIlm = Symbol('Ilm') | ||
const kIndices = Symbol('Indices') | ||
const kIngest = Symbol('Ingest') | ||
const kLicense = Symbol('License') | ||
@@ -125,8 +125,12 @@ const kLogstash = Symbol('Logstash') | ||
const kMonitoring = Symbol('Monitoring') | ||
const kNodes = Symbol('Nodes') | ||
const kRollup = Symbol('Rollup') | ||
const kSearchableSnapshots = Symbol('SearchableSnapshots') | ||
const kSecurity = Symbol('Security') | ||
const kShutdown = Symbol('Shutdown') | ||
const kSlm = Symbol('Slm') | ||
const kSnapshot = Symbol('Snapshot') | ||
const kSql = Symbol('Sql') | ||
const kSsl = Symbol('Ssl') | ||
const kTasks = Symbol('Tasks') | ||
const kTextStructure = Symbol('TextStructure') | ||
@@ -139,18 +143,16 @@ const kTransform = Symbol('Transform') | ||
this[kConfigurationError] = opts.ConfigurationError | ||
this[kAsyncSearch] = null | ||
this[kAutoscaling] = null | ||
this[kCat] = null | ||
this[kCcr] = null | ||
this[kCluster] = null | ||
this[kDanglingIndices] = null | ||
this[kFeatures] = null | ||
this[kIndices] = null | ||
this[kIngest] = null | ||
this[kNodes] = null | ||
this[kSnapshot] = null | ||
this[kTasks] = null | ||
this[kAsyncSearch] = null | ||
this[kAutoscaling] = null | ||
this[kCcr] = null | ||
this[kEnrich] = null | ||
this[kEql] = null | ||
this[kFeatures] = null | ||
this[kFleet] = null | ||
this[kGraph] = null | ||
this[kIlm] = null | ||
this[kIndices] = null | ||
this[kIngest] = null | ||
this[kLicense] = null | ||
@@ -161,8 +163,12 @@ this[kLogstash] = null | ||
this[kMonitoring] = null | ||
this[kNodes] = null | ||
this[kRollup] = null | ||
this[kSearchableSnapshots] = null | ||
this[kSecurity] = null | ||
this[kShutdown] = null | ||
this[kSlm] = null | ||
this[kSnapshot] = null | ||
this[kSql] = null | ||
this[kSsl] = null | ||
this[kTasks] = null | ||
this[kTextStructure] = null | ||
@@ -176,2 +182,3 @@ this[kTransform] = null | ||
ESAPI.prototype.clearScroll = clearScrollApi | ||
ESAPI.prototype.closePointInTime = closePointInTimeApi | ||
ESAPI.prototype.count = countApi | ||
@@ -198,2 +205,3 @@ ESAPI.prototype.create = createApi | ||
ESAPI.prototype.mtermvectors = mtermvectorsApi | ||
ESAPI.prototype.openPointInTime = openPointInTimeApi | ||
ESAPI.prototype.ping = pingApi | ||
@@ -214,6 +222,21 @@ ESAPI.prototype.putScript = putScriptApi | ||
ESAPI.prototype.updateByQueryRethrottle = updateByQueryRethrottleApi | ||
ESAPI.prototype.closePointInTime = closePointInTimeApi | ||
ESAPI.prototype.openPointInTime = openPointInTimeApi | ||
Object.defineProperties(ESAPI.prototype, { | ||
asyncSearch: { | ||
get () { | ||
if (this[kAsyncSearch] === null) { | ||
this[kAsyncSearch] = new AsyncSearchApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kAsyncSearch] | ||
} | ||
}, | ||
async_search: { get () { return this.asyncSearch } }, | ||
autoscaling: { | ||
get () { | ||
if (this[kAutoscaling] === null) { | ||
this[kAutoscaling] = new AutoscalingApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kAutoscaling] | ||
} | ||
}, | ||
cat: { | ||
@@ -227,3 +250,12 @@ get () { | ||
}, | ||
ccr: { | ||
get () { | ||
if (this[kCcr] === null) { | ||
this[kCcr] = new CcrApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kCcr] | ||
} | ||
}, | ||
clear_scroll: { get () { return this.clearScroll } }, | ||
close_point_in_time: { get () { return this.closePointInTime } }, | ||
cluster: { | ||
@@ -249,124 +281,72 @@ get () { | ||
delete_script: { get () { return this.deleteScript } }, | ||
exists_source: { get () { return this.existsSource } }, | ||
features: { | ||
enrich: { | ||
get () { | ||
if (this[kFeatures] === null) { | ||
this[kFeatures] = new FeaturesApi(this.transport, this[kConfigurationError]) | ||
if (this[kEnrich] === null) { | ||
this[kEnrich] = new EnrichApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kFeatures] | ||
return this[kEnrich] | ||
} | ||
}, | ||
field_caps: { get () { return this.fieldCaps } }, | ||
get_script: { get () { return this.getScript } }, | ||
get_script_context: { get () { return this.getScriptContext } }, | ||
get_script_languages: { get () { return this.getScriptLanguages } }, | ||
get_source: { get () { return this.getSource } }, | ||
indices: { | ||
eql: { | ||
get () { | ||
if (this[kIndices] === null) { | ||
this[kIndices] = new IndicesApi(this.transport, this[kConfigurationError]) | ||
if (this[kEql] === null) { | ||
this[kEql] = new EqlApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kIndices] | ||
return this[kEql] | ||
} | ||
}, | ||
ingest: { | ||
exists_source: { get () { return this.existsSource } }, | ||
features: { | ||
get () { | ||
if (this[kIngest] === null) { | ||
this[kIngest] = new IngestApi(this.transport, this[kConfigurationError]) | ||
if (this[kFeatures] === null) { | ||
this[kFeatures] = new FeaturesApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kIngest] | ||
return this[kFeatures] | ||
} | ||
}, | ||
msearch_template: { get () { return this.msearchTemplate } }, | ||
nodes: { | ||
field_caps: { get () { return this.fieldCaps } }, | ||
fleet: { | ||
get () { | ||
if (this[kNodes] === null) { | ||
this[kNodes] = new NodesApi(this.transport, this[kConfigurationError]) | ||
if (this[kFleet] === null) { | ||
this[kFleet] = new FleetApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kNodes] | ||
return this[kFleet] | ||
} | ||
}, | ||
put_script: { get () { return this.putScript } }, | ||
rank_eval: { get () { return this.rankEval } }, | ||
reindex_rethrottle: { get () { return this.reindexRethrottle } }, | ||
render_search_template: { get () { return this.renderSearchTemplate } }, | ||
scripts_painless_execute: { get () { return this.scriptsPainlessExecute } }, | ||
search_shards: { get () { return this.searchShards } }, | ||
search_template: { get () { return this.searchTemplate } }, | ||
snapshot: { | ||
get_script: { get () { return this.getScript } }, | ||
get_script_context: { get () { return this.getScriptContext } }, | ||
get_script_languages: { get () { return this.getScriptLanguages } }, | ||
get_source: { get () { return this.getSource } }, | ||
graph: { | ||
get () { | ||
if (this[kSnapshot] === null) { | ||
this[kSnapshot] = new SnapshotApi(this.transport, this[kConfigurationError]) | ||
if (this[kGraph] === null) { | ||
this[kGraph] = new GraphApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kSnapshot] | ||
return this[kGraph] | ||
} | ||
}, | ||
tasks: { | ||
ilm: { | ||
get () { | ||
if (this[kTasks] === null) { | ||
this[kTasks] = new TasksApi(this.transport, this[kConfigurationError]) | ||
if (this[kIlm] === null) { | ||
this[kIlm] = new IlmApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kTasks] | ||
return this[kIlm] | ||
} | ||
}, | ||
update_by_query: { get () { return this.updateByQuery } }, | ||
update_by_query_rethrottle: { get () { return this.updateByQueryRethrottle } }, | ||
asyncSearch: { | ||
indices: { | ||
get () { | ||
if (this[kAsyncSearch] === null) { | ||
this[kAsyncSearch] = new AsyncSearchApi(this.transport, this[kConfigurationError]) | ||
if (this[kIndices] === null) { | ||
this[kIndices] = new IndicesApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kAsyncSearch] | ||
return this[kIndices] | ||
} | ||
}, | ||
async_search: { get () { return this.asyncSearch } }, | ||
autoscaling: { | ||
ingest: { | ||
get () { | ||
if (this[kAutoscaling] === null) { | ||
this[kAutoscaling] = new AutoscalingApi(this.transport, this[kConfigurationError]) | ||
if (this[kIngest] === null) { | ||
this[kIngest] = new IngestApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kAutoscaling] | ||
return this[kIngest] | ||
} | ||
}, | ||
ccr: { | ||
get () { | ||
if (this[kCcr] === null) { | ||
this[kCcr] = new CcrApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kCcr] | ||
} | ||
}, | ||
close_point_in_time: { get () { return this.closePointInTime } }, | ||
enrich: { | ||
get () { | ||
if (this[kEnrich] === null) { | ||
this[kEnrich] = new EnrichApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kEnrich] | ||
} | ||
}, | ||
eql: { | ||
get () { | ||
if (this[kEql] === null) { | ||
this[kEql] = new EqlApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kEql] | ||
} | ||
}, | ||
graph: { | ||
get () { | ||
if (this[kGraph] === null) { | ||
this[kGraph] = new GraphApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kGraph] | ||
} | ||
}, | ||
ilm: { | ||
get () { | ||
if (this[kIlm] === null) { | ||
this[kIlm] = new IlmApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kIlm] | ||
} | ||
}, | ||
license: { | ||
@@ -412,3 +392,16 @@ get () { | ||
}, | ||
msearch_template: { get () { return this.msearchTemplate } }, | ||
nodes: { | ||
get () { | ||
if (this[kNodes] === null) { | ||
this[kNodes] = new NodesApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kNodes] | ||
} | ||
}, | ||
open_point_in_time: { get () { return this.openPointInTime } }, | ||
put_script: { get () { return this.putScript } }, | ||
rank_eval: { get () { return this.rankEval } }, | ||
reindex_rethrottle: { get () { return this.reindexRethrottle } }, | ||
render_search_template: { get () { return this.renderSearchTemplate } }, | ||
rollup: { | ||
@@ -422,2 +415,5 @@ get () { | ||
}, | ||
scripts_painless_execute: { get () { return this.scriptsPainlessExecute } }, | ||
search_shards: { get () { return this.searchShards } }, | ||
search_template: { get () { return this.searchTemplate } }, | ||
searchableSnapshots: { | ||
@@ -440,2 +436,10 @@ get () { | ||
}, | ||
shutdown: { | ||
get () { | ||
if (this[kShutdown] === null) { | ||
this[kShutdown] = new ShutdownApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kShutdown] | ||
} | ||
}, | ||
slm: { | ||
@@ -449,2 +453,10 @@ get () { | ||
}, | ||
snapshot: { | ||
get () { | ||
if (this[kSnapshot] === null) { | ||
this[kSnapshot] = new SnapshotApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kSnapshot] | ||
} | ||
}, | ||
sql: { | ||
@@ -466,2 +478,10 @@ get () { | ||
}, | ||
tasks: { | ||
get () { | ||
if (this[kTasks] === null) { | ||
this[kTasks] = new TasksApi(this.transport, this[kConfigurationError]) | ||
} | ||
return this[kTasks] | ||
} | ||
}, | ||
textStructure: { | ||
@@ -484,2 +504,4 @@ get () { | ||
}, | ||
update_by_query: { get () { return this.updateByQuery } }, | ||
update_by_query_rethrottle: { get () { return this.updateByQueryRethrottle } }, | ||
watcher: { | ||
@@ -486,0 +508,0 @@ get () { |
18
index.js
@@ -22,4 +22,2 @@ /* | ||
const nodeMajor = Number(process.versions.node.split('.')[0]) | ||
const { EventEmitter } = require('events') | ||
@@ -51,11 +49,2 @@ const { URL } = require('url') | ||
/* istanbul ignore next */ | ||
if (nodeMajor >= 10 && nodeMajor < 12) { | ||
process.emitWarning('You are using a version of Node.js that will reach EOL in April 2021. ' + | ||
'The support for this version will be dropped in 7.13. ' + | ||
'Please refer to https://ela.st/nodejs-support for additional information.', | ||
'DeprecationWarning' | ||
) | ||
} | ||
class Client extends ESAPI { | ||
@@ -128,3 +117,4 @@ constructor (opts = {}) { | ||
proxy: null, | ||
enableMetaHeader: true | ||
enableMetaHeader: true, | ||
disablePrototypePoisoningProtection: false | ||
}, opts) | ||
@@ -146,3 +136,5 @@ | ||
this[kEventEmitter] = new EventEmitter() | ||
this.serializer = new options.Serializer() | ||
this.serializer = new options.Serializer({ | ||
disablePrototypePoisoningProtection: options.disablePrototypePoisoningProtection | ||
}) | ||
this.connectionPool = new options.ConnectionPool({ | ||
@@ -149,0 +141,0 @@ pingTimeout: options.pingTimeout, |
@@ -28,3 +28,3 @@ /* | ||
const debug = require('debug')('elasticsearch') | ||
const pump = require('pump') | ||
const { pipeline } = require('stream') | ||
const INVALID_PATH_REGEX = /[^\u0021-\u00ff]/ | ||
@@ -137,3 +137,3 @@ const { | ||
if (isStream(params.body) === true) { | ||
pump(params.body, request, err => { | ||
pipeline(params.body, request, err => { | ||
/* istanbul ignore if */ | ||
@@ -140,0 +140,0 @@ if (err != null && cleanedListeners === false) { |
@@ -93,3 +93,12 @@ /* | ||
this.name = 'ResponseError' | ||
this.message = (meta.body && meta.body.error && meta.body.error.type) || 'Response Error' | ||
if (meta.body && meta.body.error && meta.body.error.type) { | ||
if (Array.isArray(meta.body.error.root_cause)) { | ||
this.message = meta.body.error.type + ': ' | ||
this.message += meta.body.error.root_cause.map(entry => `[${entry.type}] Reason: ${entry.reason}`).join('; ') | ||
} else { | ||
this.message = meta.body.error.type | ||
} | ||
} else { | ||
this.message = 'Response Error' | ||
} | ||
this.meta = meta | ||
@@ -112,2 +121,6 @@ } | ||
} | ||
toString () { | ||
return JSON.stringify(this.meta.body) | ||
} | ||
} | ||
@@ -114,0 +127,0 @@ |
@@ -424,3 +424,3 @@ /* | ||
const client = this[kClient] | ||
const { serialize, deserialize } = client.serializer | ||
const { serializer } = client | ||
if (this[kMetaHeader] !== null) { | ||
@@ -509,15 +509,15 @@ reqOptions.headers = reqOptions.headers || {} | ||
if (operation === 'index' || operation === 'create') { | ||
actionBody = serialize(action) | ||
payloadBody = typeof chunk === 'string' ? chunk : serialize(chunk) | ||
actionBody = serializer.serialize(action) | ||
payloadBody = typeof chunk === 'string' ? chunk : serializer.serialize(chunk) | ||
chunkBytes += Buffer.byteLength(actionBody) + Buffer.byteLength(payloadBody) | ||
bulkBody.push(actionBody, payloadBody) | ||
} else if (operation === 'update') { | ||
actionBody = serialize(action[0]) | ||
actionBody = serializer.serialize(action[0]) | ||
payloadBody = typeof chunk === 'string' | ||
? `{"doc":${chunk}}` | ||
: serialize({ doc: chunk, ...action[1] }) | ||
: serializer.serialize({ doc: chunk, ...action[1] }) | ||
chunkBytes += Buffer.byteLength(actionBody) + Buffer.byteLength(payloadBody) | ||
bulkBody.push(actionBody, payloadBody) | ||
} else if (operation === 'delete') { | ||
actionBody = serialize(action) | ||
actionBody = serializer.serialize(action) | ||
chunkBytes += Buffer.byteLength(actionBody) | ||
@@ -674,9 +674,9 @@ bulkBody.push(actionBody) | ||
for (let i = 0, len = bulkBody.length; i < len; i = i + 2) { | ||
const operation = Object.keys(deserialize(bulkBody[i]))[0] | ||
const operation = Object.keys(serializer.deserialize(bulkBody[i]))[0] | ||
onDrop({ | ||
status: 429, | ||
error: null, | ||
operation: deserialize(bulkBody[i]), | ||
operation: serializer.deserialize(bulkBody[i]), | ||
document: operation !== 'delete' | ||
? deserialize(bulkBody[i + 1]) | ||
? serializer.deserialize(bulkBody[i + 1]) | ||
/* istanbul ignore next */ | ||
@@ -722,5 +722,5 @@ : null, | ||
error: action[operation].error, | ||
operation: deserialize(bulkBody[indexSlice]), | ||
operation: serializer.deserialize(bulkBody[indexSlice]), | ||
document: operation !== 'delete' | ||
? deserialize(bulkBody[indexSlice + 1]) | ||
? serializer.deserialize(bulkBody[indexSlice + 1]) | ||
: null, | ||
@@ -727,0 +727,0 @@ retried: isRetrying |
@@ -20,3 +20,8 @@ /* | ||
export interface SerializerOptions { | ||
disablePrototypePoisoningProtection: boolean | 'proto' | 'constructor' | ||
} | ||
export default class Serializer { | ||
constructor (opts?: SerializerOptions) | ||
serialize(object: any): string; | ||
@@ -23,0 +28,0 @@ deserialize(json: string): any; |
@@ -26,4 +26,13 @@ /* | ||
const { SerializationError, DeserializationError } = require('./errors') | ||
const kJsonOptions = Symbol('secure json parse options') | ||
class Serializer { | ||
constructor (opts = {}) { | ||
const disable = opts.disablePrototypePoisoningProtection | ||
this[kJsonOptions] = { | ||
protoAction: disable === true || disable === 'proto' ? 'ignore' : 'error', | ||
constructorAction: disable === true || disable === 'constructor' ? 'ignore' : 'error' | ||
} | ||
} | ||
serialize (object) { | ||
@@ -44,3 +53,3 @@ debug('Serializing', object) | ||
try { | ||
object = sjson.parse(json) | ||
object = sjson.parse(json, this[kJsonOptions]) | ||
} catch (err) { | ||
@@ -47,0 +56,0 @@ throw new DeserializationError(err.message, json) |
@@ -31,3 +31,3 @@ /* | ||
export type Context = Record<string, unknown> | null | ||
export type Context = unknown | ||
@@ -34,0 +34,0 @@ export interface nodeSelectorFn { |
@@ -309,4 +309,4 @@ /* | ||
} else { | ||
// cast to boolean if the request method was HEAD | ||
result.body = isHead === true ? true : payload | ||
// cast to boolean if the request method was HEAD and there was no error | ||
result.body = isHead === true && result.statusCode < 400 ? true : payload | ||
} | ||
@@ -313,0 +313,0 @@ |
@@ -14,4 +14,4 @@ { | ||
"homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html", | ||
"version": "7.12.0", | ||
"versionCanary": "7.12.0-canary.3", | ||
"version": "7.13.0", | ||
"versionCanary": "7.13.0-canary.5", | ||
"keywords": [ | ||
@@ -52,4 +52,5 @@ "elasticsearch", | ||
"@sinonjs/fake-timers": "github:sinonjs/fake-timers#0bfffc1", | ||
"@types/node": "^14.14.28", | ||
"convert-hrtime": "^3.0.0", | ||
"@types/node": "^15.3.1", | ||
"convert-hrtime": "^5.0.0", | ||
"cross-zip": "^4.0.0", | ||
"dedent": "^0.7.0", | ||
@@ -60,19 +61,20 @@ "deepmerge": "^4.2.2", | ||
"into-stream": "^6.0.0", | ||
"js-yaml": "^4.0.0", | ||
"js-yaml": "^4.1.0", | ||
"license-checker": "^25.0.1", | ||
"minimist": "^1.2.5", | ||
"ora": "^5.3.0", | ||
"node-fetch": "^2.6.1", | ||
"ora": "^5.4.0", | ||
"pretty-hrtime": "^1.0.3", | ||
"proxy": "^1.0.2", | ||
"rimraf": "^3.0.2", | ||
"semver": "^7.3.4", | ||
"simple-git": "^2.35.0", | ||
"simple-statistics": "^7.4.1", | ||
"semver": "^7.3.5", | ||
"simple-git": "^2.39.0", | ||
"simple-statistics": "^7.7.0", | ||
"split2": "^3.2.2", | ||
"standard": "^16.0.3", | ||
"stoppable": "^1.1.0", | ||
"tap": "^14.11.0", | ||
"tsd": "^0.14.0", | ||
"tap": "^15.0.9", | ||
"tsd": "^0.15.1", | ||
"workq": "^3.0.0", | ||
"xmlbuilder2": "^2.4.0" | ||
"xmlbuilder2": "^2.4.1" | ||
}, | ||
@@ -83,4 +85,3 @@ "dependencies": { | ||
"ms": "^2.1.3", | ||
"pump": "^3.0.0", | ||
"secure-json-parse": "^2.3.1" | ||
"secure-json-parse": "^2.4.0" | ||
}, | ||
@@ -96,3 +97,3 @@ "license": "Apache-2.0", | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=12" | ||
}, | ||
@@ -103,3 +104,2 @@ "tsd": { | ||
"tap": { | ||
"esm": false, | ||
"ts": false, | ||
@@ -106,0 +106,0 @@ "jsx": false, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1995873
4
102
33379
27
- Removedpump@^3.0.0
- Removedend-of-stream@1.4.4(transitive)
- Removedonce@1.4.0(transitive)
- Removedpump@3.0.2(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedsecure-json-parse@^2.4.0