Socket
Socket
Sign inDemoInstall

@sajari/sdk-node

Package Overview
Dependencies
47
Maintainers
8
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.5.2 to 4.6.2

30

build/src/generated/api/schemaApi.d.ts

@@ -72,2 +72,16 @@ /**

/**
* Deleting a schema field removes it from all records within the collection, however, references to the schema field in pipelines are not removed. > Note: This operation cannot be reversed.
* @summary Delete schema field
* @param collectionId The collection the schema field belongs to, e.g. `my-collection`.
* @param schemaFieldName The name of the schema field to delete.
*/
deleteSchemaField(collectionId: string, schemaFieldName: string, options?: {
headers: {
[name: string]: string;
};
}): Promise<{
response: http.IncomingMessage;
body: any;
}>;
/**
* Retrieve a list of schema fields in a collection.

@@ -87,2 +101,18 @@ * @summary List schema fields

}>;
/**
* Update the details of a schema field. Only `name` and `description` can be updated.
* @summary Update schema field
* @param collectionId The collection the schema field belongs to, e.g. &#x60;my-collection&#x60;.
* @param schemaFieldName The name of the schema field to update.
* @param schemaField The schema field details to update.
* @param updateMask The list of fields to update, separated by a comma, e.g. &#x60;name,description&#x60;. Each field should be in snake case. For each field that you want to update, provide a corresponding value in the schema field object containing the new value.
*/
updateSchemaField(collectionId: string, schemaFieldName: string, schemaField: SchemaField, updateMask?: string, options?: {
headers: {
[name: string]: string;
};
}): Promise<{
response: http.IncomingMessage;
body: SchemaField;
}>;
}

@@ -240,2 +240,81 @@ "use strict";

/**
* Deleting a schema field removes it from all records within the collection, however, references to the schema field in pipelines are not removed. > Note: This operation cannot be reversed.
* @summary Delete schema field
* @param collectionId The collection the schema field belongs to, e.g. &#x60;my-collection&#x60;.
* @param schemaFieldName The name of the schema field to delete.
*/
async deleteSchemaField(collectionId, schemaFieldName, options = { headers: {} }) {
const localVarPath = this.basePath +
"/v4/collections/{collection_id}/schemaFields/{schema_field_name}"
.replace("{" + "collection_id" + "}", encodeURIComponent(String(collectionId)))
.replace("{" + "schema_field_name" + "}", encodeURIComponent(String(schemaFieldName)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ["application/json"];
// give precedence to 'application/json'
if (produces.indexOf("application/json") >= 0) {
localVarHeaderParams.Accept = "application/json";
}
else {
localVarHeaderParams.Accept = produces.join(",");
}
let localVarFormParams = {};
// verify required parameter 'collectionId' is not null or undefined
if (collectionId === null || collectionId === undefined) {
throw new Error("Required parameter collectionId was null or undefined when calling deleteSchemaField.");
}
// verify required parameter 'schemaFieldName' is not null or undefined
if (schemaFieldName === null || schemaFieldName === undefined) {
throw new Error("Required parameter schemaFieldName was null or undefined when calling deleteSchemaField.");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: "DELETE",
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
};
let authenticationPromise = Promise.resolve();
if (this.authentications.BasicAuth.username &&
this.authentications.BasicAuth.password) {
authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
request_1.default(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode &&
response.statusCode >= 200 &&
response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "any");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
}
/**
* Retrieve a list of schema fields in a collection.

@@ -320,4 +399,93 @@ * @summary List schema fields

}
/**
* Update the details of a schema field. Only `name` and `description` can be updated.
* @summary Update schema field
* @param collectionId The collection the schema field belongs to, e.g. &#x60;my-collection&#x60;.
* @param schemaFieldName The name of the schema field to update.
* @param schemaField The schema field details to update.
* @param updateMask The list of fields to update, separated by a comma, e.g. &#x60;name,description&#x60;. Each field should be in snake case. For each field that you want to update, provide a corresponding value in the schema field object containing the new value.
*/
async updateSchemaField(collectionId, schemaFieldName, schemaField, updateMask, options = { headers: {} }) {
const localVarPath = this.basePath +
"/v4/collections/{collection_id}/schemaFields/{schema_field_name}"
.replace("{" + "collection_id" + "}", encodeURIComponent(String(collectionId)))
.replace("{" + "schema_field_name" + "}", encodeURIComponent(String(schemaFieldName)));
let localVarQueryParameters = {};
let localVarHeaderParams = Object.assign({}, this._defaultHeaders);
const produces = ["application/json"];
// give precedence to 'application/json'
if (produces.indexOf("application/json") >= 0) {
localVarHeaderParams.Accept = "application/json";
}
else {
localVarHeaderParams.Accept = produces.join(",");
}
let localVarFormParams = {};
// verify required parameter 'collectionId' is not null or undefined
if (collectionId === null || collectionId === undefined) {
throw new Error("Required parameter collectionId was null or undefined when calling updateSchemaField.");
}
// verify required parameter 'schemaFieldName' is not null or undefined
if (schemaFieldName === null || schemaFieldName === undefined) {
throw new Error("Required parameter schemaFieldName was null or undefined when calling updateSchemaField.");
}
// verify required parameter 'schemaField' is not null or undefined
if (schemaField === null || schemaField === undefined) {
throw new Error("Required parameter schemaField was null or undefined when calling updateSchemaField.");
}
if (updateMask !== undefined) {
localVarQueryParameters["update_mask"] = models_1.ObjectSerializer.serialize(updateMask, "string");
}
Object.assign(localVarHeaderParams, options.headers);
let localVarUseFormData = false;
let localVarRequestOptions = {
method: "PATCH",
qs: localVarQueryParameters,
headers: localVarHeaderParams,
uri: localVarPath,
useQuerystring: this._useQuerystring,
json: true,
body: models_1.ObjectSerializer.serialize(schemaField, "SchemaField"),
};
let authenticationPromise = Promise.resolve();
if (this.authentications.BasicAuth.username &&
this.authentications.BasicAuth.password) {
authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions));
}
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
let interceptorPromise = authenticationPromise;
for (const interceptor of this.interceptors) {
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
}
return interceptorPromise.then(() => {
if (Object.keys(localVarFormParams).length) {
if (localVarUseFormData) {
localVarRequestOptions.formData = localVarFormParams;
}
else {
localVarRequestOptions.form = localVarFormParams;
}
}
return new Promise((resolve, reject) => {
request_1.default(localVarRequestOptions, (error, response, body) => {
if (error) {
reject(error);
}
else {
if (response.statusCode &&
response.statusCode >= 200 &&
response.statusCode <= 299) {
body = models_1.ObjectSerializer.deserialize(body, "SchemaField");
resolve({ response: response, body: body });
}
else {
reject(new apis_1.HttpError(response, body, response.statusCode));
}
}
});
});
});
}
}
exports.SchemaApi = SchemaApi;
//# sourceMappingURL=schemaApi.js.map

2

build/src/schema.d.ts

@@ -16,2 +16,4 @@ import { Client } from "./client";

}): Promise<import("./generated/api").BatchCreateSchemaFieldsResponse>;
updateField(fieldName: string, field: SchemaField, ...options: Array<(updateMask?: Record<string, boolean>) => void>): Promise<SchemaField>;
deleteField(fieldName: string): Promise<any>;
}

@@ -54,4 +54,27 @@ "use strict";

}
async updateField(fieldName, field, ...options) {
const updateMask = {};
for (const opt of options) {
opt(updateMask);
}
const um = Object.keys(updateMask).map((field) => field);
try {
const res = await this.client.updateSchemaField(this.collectionId, fieldName, field, um.join(","));
return res.body;
}
catch (e) {
throw api_util_1.handleError(e);
}
}
async deleteField(fieldName) {
try {
const res = await this.client.deleteSchemaField(this.collectionId, fieldName);
return res.body;
}
catch (e) {
throw api_util_1.handleError(e);
}
}
}
exports.SchemaClient = SchemaClient;
//# sourceMappingURL=schema.js.map

2

build/src/version.d.ts

@@ -1,1 +0,1 @@

export declare const version = "4.5.2";
export declare const version = "4.6.2";

@@ -5,3 +5,3 @@ "use strict";

exports.version = void 0;
exports.version = "4.5.2";
exports.version = "4.6.2";
//# sourceMappingURL=version.js.map
{
"name": "@sajari/sdk-node",
"version": "4.5.2",
"version": "4.6.2",
"repository": "git@github.com:github.com/sajari/sdk-node.git",

@@ -5,0 +5,0 @@ "author": "Search.io",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc