New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

anescli

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anescli - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0

36

bin.js

@@ -31,2 +31,3 @@ #!/usr/bin/env node

const INDEX_VERSION_REGEXP = /^v\d+\.\d+\.\d+$/;
const FIELDS_REGEXP = /((^|,)[a-z0-9]+)+$/;

@@ -98,2 +99,37 @@ prog

_runAction(logger, es.pumpToIndex, { type, version, pumpFunction });
})
.command('stats-fielddata', 'Retrieve field data usage stats.')
.argument('[fields]', 'Fields to stats', FIELDS_REGEXP)
.action(({ fields }, options, logger) => {
_runAction(logger, es.statsFieldData, { fields });
})
.command('stats-nodes', 'Retrieve the nodes stats.')
.action((unused, options, logger) => {
_runAction(logger, es.nodeStats, {});
})
.command('stats-cluster', 'Retrieve the clusters stats.')
.action((unused, options, logger) => {
_runAction(logger, es.clusterStats, {});
})
.command('pending-tasks', 'Retrieve the pending tasks.')
.action((unused, options, logger) => {
_runAction(logger, es.pendingTasks, {});
})
.command('mappings', 'Returns an index mappings.')
.argument('<type>', 'Index type', INDEX_TYPE_REGEXP)
.argument('<version>', 'New index version', INDEX_VERSION_REGEXP)
.action(({ type, version, field, text }, options, logger) => {
_runAction(logger, es.mappings, { type, version, field, text });
})
.command('settings', 'Retrieve the cluster settings.')
.action((unused, options, logger) => {
_runAction(logger, es.settings, {});
})
.command('state', 'Retrieve the cluster state.')
.action((unused, options, logger) => {
_runAction(logger, es.state, {});
})
.command('health', 'Retrieve the cluster health.')
.action((unused, options, logger) => {
_runAction(logger, es.health, {});
});

@@ -100,0 +136,0 @@

@@ -8,4 +8,12 @@ const request = require('request');

analyzeIndex,
statsFieldData,
pipeIndex,
pumpToIndex,
mappings,
nodeStats: _simpleGet.bind(null, '_nodes/stats'),
clusterStats: _simpleGet.bind(null, '_cluster/stats'),
pendingTasks: _simpleGet.bind(null, '_cluster/pending_tasks'),
settings: _simpleGet.bind(null, '_cluster/settings'),
state: _simpleGet.bind(null, '_cluster/state'),
health: _simpleGet.bind(null, '_cluster/health?level=indices'),
};

@@ -112,2 +120,22 @@

function mappings({ logger, config }, { type, version }) {
return new Promise((resolve, reject) => {
request({
url: [
config.elastic,
buildIndexName(config, type, version),
'_mappings',
].join('/'),
method: 'GET',
json: true,
}, (err, res) => {
if (err) {
reject(err);
return;
}
resolve(res.body);
});
});
}
function pipeIndex({ logger, config }, { type, from, to, transformFunction }) {

@@ -283,2 +311,44 @@ return new Promise((resolve, reject) => {

function statsFieldData({ logger, config }, { fields = '*' }) {
return new Promise((resolve, reject) => {
request({
url: [
config.elastic,
'_stats',
'fielddata',
].join('/'),
method: 'GET',
json: true,
query: {
fields,
}
}, (err, res) => {
if (err) {
reject(err);
return;
}
resolve(res.body);
});
});
}
function _simpleGet(path, { logger, config }, unused) {
return new Promise((resolve, reject) => {
request({
url: [
config.elastic,
path,
].join('/'),
method: 'GET',
json: true,
}, (err, res) => {
if (err) {
reject(err);
return;
}
resolve(res.body);
});
});
}
function buildIndexName(config, type, version) {

@@ -285,0 +355,0 @@ return [config.project, type, version].filter(identity).join('-');

2

package.json
{
"name": "anescli",
"version": "0.0.3",
"version": "0.1.0",
"description": "Simple and experimental CLI tool for Elastic Search management.",

@@ -5,0 +5,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc