Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
pelias-dbclient
Advanced tools
Readme
This repository is part of the Pelias project. Pelias is an open-source, open-data geocoder originally sponsored by Mapzen. Our official user documentation is here.
This module provides a Node.js stream for bulk-inserting documents into Elasticsearch.
$ npm install
This module returns “streamFactory” —a function that produces a transforming stream. The stream puts documents into elasticsearch during import pipeline. Note: this stream triggers finish event only after all documents are stored into elasticsearch.
'use strict';
// some_importer.js
const streamify = require('stream-array');
const through = require('through2');
const Document = require('pelias-model').Document;
const dbMapper = require('pelias-model').createDocumentMapperStream;
const dbclient = require('pelias-dbclient');
const elasticsearch = require('elasticsearch');
const config = require('pelias-config').generate();
const elasticDeleteQuery = require('elastic-deletebyquery');
const timestamp = Date.now();
const stream = streamify([1, 2, 3])
.pipe(through.obj((item, enc, next) => {
const uniqueId = [ 'docType', item ].join(':'); // documents with the same id will be updated
const doc = new Document( 'sourceType', 'venue', uniqueId );
doc.timestamp = timestamp;
next(null, doc);
}))
.pipe(dbMapper())
.pipe(dbclient()); // put documents into elasticsearch
stream.on('finish', () => {
const client = new elasticsearch.Client(config.esclient);
elasticDeleteQuery(client);
const options = {
index: config.schema.indexName,
body: {
query: {
"bool": {
"must": [
{"term": { "source": "sourceType" }}
],
"must_not": [
{"term": { "timestamp": timestamp }}
]
}
}
}
};
client.deleteByQuery(options, (err, response) => {
console.log('The elements deleted are: %s', response.elements);
});
});
Please fork and pull request against upstream master on a feature branch.
Pretty please; provide unit tests and script fixtures in the test
directory.
$ npm test
CI tests every release against all currently supported Node.js versions.
FAQs
Database client for Pelias import pipelines
The npm package pelias-dbclient receives a total of 130 weekly downloads. As such, pelias-dbclient popularity was classified as not popular.
We found that pelias-dbclient demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.