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

etk

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

etk - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.npmignore

90

gulpfile.js

@@ -0,6 +1,20 @@

var fs = require('fs');
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var browserify = require('gulp-browserify');
var shell = require('gulp-shell');
var replace = require('gulp-replace');
var markdown = require('gulp-markdown');
var ghPages = require('gulp-gh-pages');
var tape = require('gulp-tape');
var tapColorize = require('tap-colorize');
gulp.task('jshint', function () {
gulp.task('test', function() {
return gulp.src('tests/*.js')
.pipe(tape({
reporter: tapColorize()
}));
});
gulp.task('lint', function () {
gulp.src('./*.js')

@@ -18,8 +32,78 @@ .pipe(jshint())

}))
.pipe(gulp.dest('./public/build'))
.pipe(gulp.dest('./public/build'));
});
// Document the API
gulp.task('api_document', shell.task([
'cp ./confs/jsdoc/jsdoc-conf.json ./node_modules/jsdoc/conf.json',
/*jshint multistr: true */
'./node_modules/jsdoc/jsdoc.js index.js\
-t ./node_modules/ink-docstrap/template\
-c ./node_modules/jsdoc/conf.json'
]));
gulp.task('annotate_document', shell.task([
'./node_modules/docco/bin/docco index.js'
]));
// Convert markdown to html for README.md
gulp.task('index_markdown_2_html', function () {
return gulp.src('README.md')
.pipe(markdown())
.pipe(gulp.dest('.'));
});
// Document main web site patches
gulp.task('patch_index_html_document', ['api_document', 'index_markdown_2_html'], function(){
var data = fs.readFileSync('README.html');
gulp.src(['out/index.html'])
.pipe(replace("</body>\n</html>",
"<style> .type-signature { font-size:50px;} .page-title {display: none;}</style>" +
"<script type='text/javascript' src='scripts/jquery-watch-element.js'></script>" +
"<script>$( document ).ready(function(){$('.toc-h1').waitUntilExists(" +
"function(){$('#toc').hide();}," +
"false, true);});" +
"</script>" +
"</body>\n</html>"
))
.pipe(replace('<div class="clearfix"></div>',
'<div class="clearfix"></div>' + data
))
.pipe(replace("Global", "API"))
.pipe(gulp.dest('out'));
});
// Document api web site patches
gulp.task('patch_api_document', ['patch_index_html_document'], function(){
gulp.src(['out/global.html'])
.pipe(replace("</body>\n</html>",
"<style> .type-signature { font-size:50px;} .page-title {display: none;}</style>" +
"<script type='text/javascript' src='scripts/jquery-watch-element.js'></script>" +
"<script>$( document ).ready(function(){$('.toc-h1').waitUntilExists(" +
"function(){$('.toc-h1').hide(); " +
"$('.toc-h2').hide()}, " +
"false, true);});" +
"</script>" +
"</body>\n</html>"))
.pipe(replace("Global", "API"))
.pipe(gulp.dest('out'));
});
// Copy addition files for project site
gulp.task('patch_files_copy', ['patch_api_document'], shell.task([
'cp ./confs/jsdoc/jquery-watch-element.js ./out/scripts'
]));
// Entry point to generate the docs/API web site.
gulp.task('document', ['patch_files_copy']);
// Deploy web site to GitHub
gulp.task('deploy', function() {
return gulp.src('./out/**/*')
.pipe(ghPages());
});
gulp.task('watch', function () {
gulp.watch('./*.js', ['jshint']);
gulp.watch('./*.js', ['lint']);
gulp.watch('./*.js', ['jsbuild']);
});

47

index.js

@@ -0,1 +1,2 @@

Esq = require('esq');

@@ -6,15 +7,22 @@ Module.exports = Etk;

this.client = client;
// Add tk namespace to elastic search object.
this.client.tk = this.client.tk || {
// Quick search of items
searchQ: function (param, cb) {
this.client.search({
index: this.index,
type: this.type,
q: param},
cb);
},
/**
* Searches the key-value pair. Return result to the callback
* function with a signature of (err obj, response obj)
*
* @example
* elastic = require('elasticsearch');
* client = Etk(elastic, {index: "myindex", type: "mytype"});
* client.tk.search("foo", "bar", function (err, resp) {
* ...
* });
* @param key Key to search
* @param value Value of the key
* @param cb Callback function
*/
search: function (key, value, cb) {
var search_text = key + ":" + value;
client.search({
this.client.search({
index: this.index,

@@ -26,2 +34,12 @@ type: this.type,

/**
* Searches the key-value pair for the last number of days.
* Return result to the callback function with with a signature
* of (err obj, response obj)
*
* @param key Key to search
* @param value Value of the key
* @param days Number of days back to search
* @param cb Callback function
*/
searchLastDays: function (key, value, days, cb) {

@@ -36,3 +54,5 @@ var esq = new Esq();

cb);
},
}
/*
,

@@ -60,9 +80,14 @@ searchBetween: function (key, value, start, end, cb) {

}
*/
};
// Store elastic search client for etk use
this.client.tk.client = this.client;
this.client.tk.time_field = opt.time_field || "@timestamp"; // Default time field is Logstash compatible
// Default time field is Logstash compatible
this.client.tk.time_field = opt.time_field || "@timestamp";
// Default searches "all" available index
this.client.tk.index = opt.index || "*";
// Default searches "all" available types
this.client.tk.type = opt.type || "*";
return this.client;
}
{
"name": "etk",
"version": "0.0.1",
"version": "0.0.2",
"description": "Elastic search tool kit. See README for details.",
"keywords": [
"Elasticsearch",
"Elastic",
"Search",
"Tool Kit"

@@ -17,3 +15,4 @@ ],

"scripts": {
"etk": "nodejs index.js"
"etk": "nodejs index.js",
"test": "gulp lint; gulp test;"
},

@@ -25,3 +24,12 @@ "devDependencies": {

"gulp-browserify": "latest",
"gulp-shell": "latest",
"gulp-replace": "latest",
"gulp-markdown": "latest",
"gulp-gh-pages": "latest",
"gulp-tape": "latest",
"tape": "latest",
"tap-colorize": "latest",
"docco": "latest",
"jsdoc": "latest",
"ink-docstrap": "latest",
"elasticsearch": "8.x.x"

@@ -28,0 +36,0 @@ },

@@ -1,5 +0,15 @@

# ElasticSearch Tool Kit
## ElasticSearch Tool Kit
[![Linux Build][travis-image]][travis-url]
Makes life easy with ElasticSearch.
Work in progress. Keep your seatbelts fastened.
## License
[MIT](LICENSE)
[travis-image]: https://travis-ci.org/saltukalakus/etk.svg?branch=master
[travis-url]: https://travis-ci.org/saltukalakus/etk

@@ -12,4 +12,4 @@ // Test for integers, strings and date-time

{"foo":9, "bar":12, "baz":38, "body":"hello", "@timestamp": "2015-09-15T18:26:53.502Z"},
{"foo":10, "bar":11, "baz":39, "body":"this", "@timestamp": "2015-09-15T18:26:53.502Z"} ]
{"foo":10, "bar":11, "baz":39, "body":"this", "@timestamp": "2015-09-15T18:26:53.502Z"} ];
module.exports = data_set_1;
var test = require('tape');
var elastic = require('elasticsearch');
var etk = require('../index');
//var etk = require('../index');
var client = etk(elastic, {index: "myindex", "type": "mytype"});
//var client = etk(elastic, {index: "myindex", "type": "mytype"});
test("Populate the data set", function(t) {
t.end();
})
});
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