Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
@sajari/sdk-node
Advanced tools
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 { Client, FieldMode, schema } = require("@sajari/sdk-node");
// create client
const client = new Client("<project>", "<collection>", {
key: "<key from console>",
secret: "<secret from console>"
});
const fields = [
schema.field.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.field.string("text")
]
client.schema().add(...fields).catch(error => {/* handle error ... */})
Adding a record
const { Client } = require("@sajari/sdk-node");
// create client
const client = new Client("<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 { Client, DefaultSession, TrackingType } = require("@sajari/sdk-node");
const client = new Client("<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 151 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.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.