Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rethinkdb-elasticsearch-stream

Package Overview
Dependencies
Maintainers
4
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rethinkdb-elasticsearch-stream - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

.nyc_output/098e35de59e8c8d8e5831575143d4db6.json

7

build/backfill-table.js

@@ -25,7 +25,8 @@ 'use strict';

* @param {String} db The database in RethinkDB to duplicate
* @param {String} esType The Elasticsearch type to store the document (defaults to RedthinkDB table name)
* @param {String} table The table in RethinkDB to duplicate
*/
function backfillTable(r, _ref) {
let { db, table } = _ref,
properties = _objectWithoutProperties(_ref, ['db', 'table']);
let { db, esType, table } = _ref,
properties = _objectWithoutProperties(_ref, ['db', 'esType', 'table']);

@@ -41,3 +42,3 @@ return new Promise((resolve, reject) => {

document: chunk,
table
table: esType || table
}, properties));

@@ -44,0 +45,0 @@ } catch (e) {

@@ -11,2 +11,3 @@ 'use strict';

* @param {Object} document The document to save. This may be transformed by `transform`.
* @param {String} esType The Elasticsearch type where the document will be stored (defaults to RethinkDB table name)
* @param {String} table The table in RethinkDB the document resides in (used as Elasticsearch type)

@@ -20,2 +21,3 @@ * @param {Function} transform (optional) A function or promise to transform the document before storage in Elasticsearch

document,
esType,
idKey,

@@ -28,16 +30,8 @@ table,

if (documentToSave == null) return;
if (Object.keys(documentToSave).length === 0) return;
const path = (0, _elasticsearchPath2.default)({
db,
id: idKey ? documentToSave[idKey] : null,
table
});
if (idKey) {
return _axios2.default.put(path, documentToSave, { baseURL });
if (Array.isArray(documentToSave)) {
return Promise.all(documentToSave.map(function (d) {
return pushDocument(baseURL, db, d, idKey, esType || table);
}));
}
return _axios2.default.post(path, documentToSave, { baseURL });
return pushDocument(baseURL, db, documentToSave, idKey, esType || table);
});

@@ -62,2 +56,19 @@

function pushDocument(baseURL, db, doc, idKey, table) {
if (doc == null) return;
if (Object.keys(doc).length === 0) return;
const path = (0, _elasticsearchPath2.default)({
db,
id: idKey ? doc[idKey] : null,
table
});
if (idKey) {
return _axios2.default.put(path, doc, { baseURL });
}
return _axios2.default.post(path, doc, { baseURL });
}
exports.default = saveDocument;
{
"name": "rethinkdb-elasticsearch-stream",
"version": "1.0.0",
"version": "1.1.0",
"main": "build/index.js",

@@ -31,3 +31,3 @@ "repository": "https://github.com/gsandf/rethinkdb-elasticsearch-stream",

"scripts": {
"build": "babel src --out-dir build --ignore '**/*.test.js' --ignore 'test-helpers/'",
"build": "babel src --out-dir build --ignore *.test.js,test-helpers",
"container": "docker-compose run app",

@@ -40,3 +40,3 @@ "coverage": "nyc ava",

"start": "node .",
"test": "ava",
"test": "ava src/**/*.test.js",
"test:container": "docker-compose build && docker-compose run app yarn test -- -v; docker-compose down"

@@ -43,0 +43,0 @@ },

@@ -10,3 +10,3 @@ # rethinkdb-elasticsearch-stream

** ✨ Features: **
**✨ Features:**

@@ -78,6 +78,7 @@ - **Simple:** specify connections and tables to copy as-is to Elasticsearch

With [npm](https://npmjs.org/) installed, run
With [Yarn](https://yarnpkg.com/en/) _or_ [npm](https://npmjs.org/) installed, run:
```bash
yarn add rethinkdb-elasticsearch-stream
# ...or, if using `npm`

@@ -84,0 +85,0 @@ npm install rethinkdb-elasticsearch-stream

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