
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
sequelastic
Advanced tools
in order to install sequelastic on your project just run:
npm install sequelastic
first of all import and instantiate the utility:
import Sequelastic from "sequelastic";
import { model1, model2 } from "./sequelize-typescript-models";
const sequelastic = new Sequelastic({
node: "https://elastiSearchSevice.example:9200",
models: [model1, model2],
});
then sync your database with the elasticSearch service:
sequelastic
.sync()
.then((success) => {
if (success) {
console.log("Database synced correctly");
} else {
console.log("Something went wrong");
}
})
.catch((err) => {
console.error(err);
});
now you are ready to search whatever you want with sequelastic:
sequelastic
.search("foo", "bar", { fuzzy: true, fuzziness: "AUTO" })
.then((results) => {
console.log(results);
})
.catch((err) => {
console.error(err);
});
create new Sequelastic instance
new Sequelastic(config: SequelasticContructorProps) => Sequelastic
property | type | description | default |
---|---|---|---|
config | SequelasticConstructorProps | config object | none |
Sync SQL database
this function will sync your database with the elasticSearch service using the following method:
sequelastic.sync() => void
property | type | description | default |
---|---|---|---|
options | SequelasticSyncOptions | config object | none |
Search in indices something
this function will search in elasticSearch using the search type query_string
sequelastic.search(query: string, index: string, options:SequelasticSearchOptions) => Promise<[{[key: string]: any}]> // options.wholeResponse = false
sequelastic.search(query: string, index:string, options: SequelizeSearchOptions) => Promise<elasticSearch.ApiResponse<Record<string, any>, Record<string, unknown>>> // options.wholeResponse = true
property | type | description | default |
---|---|---|---|
query | string | the elasticSearch query string | none |
index | string | the index where search for something | "*" |
options | SequelasticSearchOptions | search options | undefined |
use a custom body for the elasticSearch _search
sequelastic.customSearch(params: elasticSearch.RequestParams.Search) => Promise<
elasticSearch.ApiResponse<Record<string, any>, Record<string, unknown>>
>
property | type | description | default |
---|---|---|---|
params | elasicSearch.RequestParams.Search | the custom search parameter | none |
object
key | type | description | default |
---|---|---|---|
node | string | elasticsearch service endpoint | http://localhost:9200 |
models | (Model | SequelasticModelType)[] | list of all the models to index | [] |
exclude (optional) | string[] | list of the model's fields to globally exclude from index | undefined |
object
key | type | description |
---|---|---|
model | Model | sequelize model to be indexed |
attributes (optional) | string[] | {exclude: string[]} | fields to include or exclude in index |
include (optional) | (string | SequelasticModelType)[] | object to eventually specify models to include in index |
object
key | type | description | default |
---|---|---|---|
refresh | boolean | use refresh in elasticSearch bulk method | false |
key | type | description | default |
---|---|---|---|
fuzzy | boolean | use fuzzy search | false |
fuzziness | "AUTO" | number | search fuzziness | "AUTO" |
wholeResponse | boolean | get as return the whole search response or only the hits | false |
FAQs
bridge utility between sequelize-typescript and ElasticSearch
The npm package sequelastic receives a total of 6 weekly downloads. As such, sequelastic popularity was classified as not popular.
We found that sequelastic demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.