Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@sajari/sdk-node
Advanced tools
Readme
Node.js SDK for Sajari APIs
This is a Node.js module available through the
npm registry. It can be installed using the
npm
or yarn
command line tools.
npm install @sajari/sdk-node --save # yarn add @sajari/sdk-node
npm install
npm test
Creating a schema
const { DefaultClient, FieldMode } = require("@sajari/sdk-node");
// create client
const client = new DefaultClient("<project>", "<collection>", {
key: "<key from console>",
secret: "<secret from console>"
});
// get schema client
const schema = client.schema()
const fields = [
schema.boolean("my-boolean-field", {
// Set this field to be required.
// FieldMode options are defined here,
// https://sajari-sdk-node.netlify.com/enums/fieldmode.html
mode: FieldMode.Required
}),
schema.string("text")
]
schema.add(...fields).catch(error => {/* handle error ... */})
Adding a record
const { DefaultClient } = require("@sajari/sdk-node");
// create client
const client = new DefaultClient("<project>", "<collection>", {
key: "<key from console>",
secret: "<secret from console>"
});
// get the pipeline client
const pipeline = client.pipeline("<your pipeline name>")
const record = {
"my-boolean-field": true,
"text": "hello"
}
pipeline.add({}, record)
.then(key => {/* handle key ... */})
.catch(error => {/* handle error ... */})
Performing a search
const { DefaultClient, DefaultSession, TrackingType } = require("@sajari/sdk-node");
const client = new DefaultClient("<project>", "<collection>", {
key: "<key from console>",
secret: "<secret from console>"
});
const session = new DefaultSession(TrackingType.None);
const pipeline = client.pipeline("<your pipeline name>");
const values = { q: "hello" };
pipeline.search(values, session.next(values))
.then(response => {/* handle response ... */})
.catch(error => {/* handle error ... */})
FAQs
[![Build status](https://github.com/sajari/sdk-node/workflows/Build/badge.svg?branch=master)](https://github.com/sajari/sdk-node/actions)
The npm package @sajari/sdk-node receives a total of 229 weekly downloads. As such, @sajari/sdk-node popularity was classified as not popular.
We found that @sajari/sdk-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.