diff --git a/.gitignore b/.gitignore index ed4f64d7..46011bc7 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ weaviate-data/ .eslintcache test.sh scratch/ -docs/ \ No newline at end of file +docs/ +dist/ \ No newline at end of file diff --git a/dist/node/cjs/backup/backupCreateStatusGetter.d.ts b/dist/node/cjs/backup/backupCreateStatusGetter.d.ts deleted file mode 100644 index 082023de..00000000 --- a/dist/node/cjs/backup/backupCreateStatusGetter.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Connection from '../connection/index.js'; -import { BackupCreateStatusResponse } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { Backend } from './index.js'; -export default class BackupCreateStatusGetter extends CommandBase { - private backend?; - private backupId?; - constructor(client: Connection); - withBackend(backend: Backend): this; - withBackupId(backupId: string): this; - validate: () => void; - do: () => Promise; - private _path; -} diff --git a/dist/node/cjs/backup/backupCreateStatusGetter.js b/dist/node/cjs/backup/backupCreateStatusGetter.js deleted file mode 100644 index 4d94a1ca..00000000 --- a/dist/node/cjs/backup/backupCreateStatusGetter.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const errors_js_1 = require('../errors.js'); -const commandBase_js_1 = require('../validation/commandBase.js'); -const validation_js_1 = require('./validation.js'); -class BackupCreateStatusGetter extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.validate = () => { - this.addErrors([ - ...(0, validation_js_1.validateBackend)(this.backend), - ...(0, validation_js_1.validateBackupId)(this.backupId), - ]); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject( - new errors_js_1.WeaviateInvalidInputError('invalid usage: ' + this.errors.join(', ')) - ); - } - return this.client.get(this._path()); - }; - this._path = () => { - return `/backups/${this.backend}/${this.backupId}`; - }; - } - withBackend(backend) { - this.backend = backend; - return this; - } - withBackupId(backupId) { - this.backupId = backupId; - return this; - } -} -exports.default = BackupCreateStatusGetter; diff --git a/dist/node/cjs/backup/backupCreator.d.ts b/dist/node/cjs/backup/backupCreator.d.ts deleted file mode 100644 index 54624043..00000000 --- a/dist/node/cjs/backup/backupCreator.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import Connection from '../connection/index.js'; -import { - BackupConfig, - BackupCreateRequest, - BackupCreateResponse, - BackupCreateStatusResponse, -} from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import BackupCreateStatusGetter from './backupCreateStatusGetter.js'; -import { Backend } from './index.js'; -export default class BackupCreator extends CommandBase { - private backend; - private backupId; - private excludeClassNames?; - private includeClassNames?; - private statusGetter; - private waitForCompletion; - private config?; - constructor(client: Connection, statusGetter: BackupCreateStatusGetter); - withIncludeClassNames(...classNames: string[]): this; - withExcludeClassNames(...classNames: string[]): this; - withBackend(backend: Backend): this; - withBackupId(backupId: string): this; - withWaitForCompletion(waitForCompletion: boolean): this; - withConfig(cfg: BackupConfig): this; - validate: () => void; - do: () => Promise; - _create: (payload: BackupCreateRequest) => Promise; - _createAndWaitForCompletion: (payload: BackupCreateRequest) => Promise; - private _path; - _merge: ( - createStatusResponse: BackupCreateStatusResponse, - createResponse: BackupCreateResponse - ) => BackupCreateResponse; -} diff --git a/dist/node/cjs/backup/backupCreator.js b/dist/node/cjs/backup/backupCreator.js deleted file mode 100644 index d7c0f37e..00000000 --- a/dist/node/cjs/backup/backupCreator.js +++ /dev/null @@ -1,121 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const errors_js_1 = require('../errors.js'); -const commandBase_js_1 = require('../validation/commandBase.js'); -const validation_js_1 = require('./validation.js'); -const WAIT_INTERVAL = 1000; -class BackupCreator extends commandBase_js_1.CommandBase { - constructor(client, statusGetter) { - super(client); - this.validate = () => { - this.addErrors([ - ...(0, validation_js_1.validateIncludeClassNames)(this.includeClassNames), - ...(0, validation_js_1.validateExcludeClassNames)(this.excludeClassNames), - ...(0, validation_js_1.validateBackend)(this.backend), - ...(0, validation_js_1.validateBackupId)(this.backupId), - ]); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject( - new errors_js_1.WeaviateInvalidInputError('invalid usage: ' + this.errors.join(', ')) - ); - } - const payload = { - id: this.backupId, - config: this.config, - include: this.includeClassNames, - exclude: this.excludeClassNames, - }; - if (this.waitForCompletion) { - return this._createAndWaitForCompletion(payload); - } - return this._create(payload); - }; - this._create = (payload) => { - return this.client.postReturn(this._path(), payload); - }; - this._createAndWaitForCompletion = (payload) => { - return new Promise((resolve, reject) => { - this._create(payload) - .then((createResponse) => { - this.statusGetter.withBackend(this.backend).withBackupId(this.backupId); - const loop = () => { - this.statusGetter - .do() - .then((createStatusResponse) => { - if (createStatusResponse.status == 'SUCCESS' || createStatusResponse.status == 'FAILED') { - resolve(this._merge(createStatusResponse, createResponse)); - } else { - setTimeout(loop, WAIT_INTERVAL); - } - }) - .catch(reject); - }; - loop(); - }) - .catch(reject); - }); - }; - this._path = () => { - return `/backups/${this.backend}`; - }; - this._merge = (createStatusResponse, createResponse) => { - const merged = {}; - if ('id' in createStatusResponse) { - merged.id = createStatusResponse.id; - } - if ('path' in createStatusResponse) { - merged.path = createStatusResponse.path; - } - if ('backend' in createStatusResponse) { - merged.backend = createStatusResponse.backend; - } - if ('status' in createStatusResponse) { - merged.status = createStatusResponse.status; - } - if ('error' in createStatusResponse) { - merged.error = createStatusResponse.error; - } - if ('classes' in createResponse) { - merged.classes = createResponse.classes; - } - return merged; - }; - this.statusGetter = statusGetter; - } - withIncludeClassNames(...classNames) { - let cls = classNames; - if (classNames.length && Array.isArray(classNames[0])) { - cls = classNames[0]; - } - this.includeClassNames = cls; - return this; - } - withExcludeClassNames(...classNames) { - let cls = classNames; - if (classNames.length && Array.isArray(classNames[0])) { - cls = classNames[0]; - } - this.excludeClassNames = cls; - return this; - } - withBackend(backend) { - this.backend = backend; - return this; - } - withBackupId(backupId) { - this.backupId = backupId; - return this; - } - withWaitForCompletion(waitForCompletion) { - this.waitForCompletion = waitForCompletion; - return this; - } - withConfig(cfg) { - this.config = cfg; - return this; - } -} -exports.default = BackupCreator; diff --git a/dist/node/cjs/backup/backupGetter.d.ts b/dist/node/cjs/backup/backupGetter.d.ts deleted file mode 100644 index 4da93dce..00000000 --- a/dist/node/cjs/backup/backupGetter.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Connection from '../connection/index.js'; -import { BackupCreateResponse } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { Backend } from './index.js'; -export default class BackupGetter extends CommandBase { - private backend?; - constructor(client: Connection); - withBackend(backend: Backend): this; - validate: () => void; - do: () => Promise; - private _path; -} diff --git a/dist/node/cjs/backup/backupGetter.js b/dist/node/cjs/backup/backupGetter.js deleted file mode 100644 index d00b4c1d..00000000 --- a/dist/node/cjs/backup/backupGetter.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const errors_js_1 = require('../errors.js'); -const commandBase_js_1 = require('../validation/commandBase.js'); -const validation_js_1 = require('./validation.js'); -class BackupGetter extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.validate = () => { - this.addErrors((0, validation_js_1.validateBackend)(this.backend)); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject( - new errors_js_1.WeaviateInvalidInputError('invalid usage: ' + this.errors.join(', ')) - ); - } - return this.client.get(this._path()); - }; - this._path = () => { - return `/backups/${this.backend}`; - }; - } - withBackend(backend) { - this.backend = backend; - return this; - } -} -exports.default = BackupGetter; diff --git a/dist/node/cjs/backup/backupRestoreStatusGetter.d.ts b/dist/node/cjs/backup/backupRestoreStatusGetter.d.ts deleted file mode 100644 index e6c964ab..00000000 --- a/dist/node/cjs/backup/backupRestoreStatusGetter.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Connection from '../connection/index.js'; -import { BackupRestoreStatusResponse } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { Backend } from './index.js'; -export default class BackupRestoreStatusGetter extends CommandBase { - private backend?; - private backupId?; - constructor(client: Connection); - withBackend(backend: Backend): this; - withBackupId(backupId: string): this; - validate: () => void; - do: () => Promise; - private _path; -} diff --git a/dist/node/cjs/backup/backupRestoreStatusGetter.js b/dist/node/cjs/backup/backupRestoreStatusGetter.js deleted file mode 100644 index 89a92860..00000000 --- a/dist/node/cjs/backup/backupRestoreStatusGetter.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const errors_js_1 = require('../errors.js'); -const commandBase_js_1 = require('../validation/commandBase.js'); -const validation_js_1 = require('./validation.js'); -class BackupRestoreStatusGetter extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.validate = () => { - this.addErrors([ - ...(0, validation_js_1.validateBackend)(this.backend), - ...(0, validation_js_1.validateBackupId)(this.backupId), - ]); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject( - new errors_js_1.WeaviateInvalidInputError('invalid usage: ' + this.errors.join(', ')) - ); - } - return this.client.get(this._path()); - }; - this._path = () => { - return `/backups/${this.backend}/${this.backupId}/restore`; - }; - } - withBackend(backend) { - this.backend = backend; - return this; - } - withBackupId(backupId) { - this.backupId = backupId; - return this; - } -} -exports.default = BackupRestoreStatusGetter; diff --git a/dist/node/cjs/backup/backupRestorer.d.ts b/dist/node/cjs/backup/backupRestorer.d.ts deleted file mode 100644 index 11ef87de..00000000 --- a/dist/node/cjs/backup/backupRestorer.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import Connection from '../connection/index.js'; -import { - BackupRestoreRequest, - BackupRestoreResponse, - BackupRestoreStatusResponse, - RestoreConfig, -} from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import BackupRestoreStatusGetter from './backupRestoreStatusGetter.js'; -import { Backend } from './index.js'; -export default class BackupRestorer extends CommandBase { - private backend; - private backupId; - private excludeClassNames?; - private includeClassNames?; - private statusGetter; - private waitForCompletion?; - private config?; - constructor(client: Connection, statusGetter: BackupRestoreStatusGetter); - withIncludeClassNames(...classNames: string[]): this; - withExcludeClassNames(...classNames: string[]): this; - withBackend(backend: Backend): this; - withBackupId(backupId: string): this; - withWaitForCompletion(waitForCompletion: boolean): this; - withConfig(cfg: RestoreConfig): this; - validate: () => void; - do: () => Promise; - _restore: (payload: BackupRestoreRequest) => Promise; - _restoreAndWaitForCompletion: (payload: BackupRestoreRequest) => Promise; - private _path; - _merge: ( - restoreStatusResponse: BackupRestoreStatusResponse, - restoreResponse: BackupRestoreResponse - ) => BackupRestoreResponse; -} diff --git a/dist/node/cjs/backup/backupRestorer.js b/dist/node/cjs/backup/backupRestorer.js deleted file mode 100644 index 39c411e2..00000000 --- a/dist/node/cjs/backup/backupRestorer.js +++ /dev/null @@ -1,120 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const errors_js_1 = require('../errors.js'); -const commandBase_js_1 = require('../validation/commandBase.js'); -const validation_js_1 = require('./validation.js'); -const WAIT_INTERVAL = 1000; -class BackupRestorer extends commandBase_js_1.CommandBase { - constructor(client, statusGetter) { - super(client); - this.validate = () => { - this.addErrors([ - ...(0, validation_js_1.validateIncludeClassNames)(this.includeClassNames || []), - ...(0, validation_js_1.validateExcludeClassNames)(this.excludeClassNames || []), - ...(0, validation_js_1.validateBackend)(this.backend), - ...(0, validation_js_1.validateBackupId)(this.backupId), - ]); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject( - new errors_js_1.WeaviateInvalidInputError('invalid usage: ' + this.errors.join(', ')) - ); - } - const payload = { - config: this.config, - include: this.includeClassNames, - exclude: this.excludeClassNames, - }; - if (this.waitForCompletion) { - return this._restoreAndWaitForCompletion(payload); - } - return this._restore(payload); - }; - this._restore = (payload) => { - return this.client.postReturn(this._path(), payload); - }; - this._restoreAndWaitForCompletion = (payload) => { - return new Promise((resolve, reject) => { - this._restore(payload) - .then((restoreResponse) => { - this.statusGetter.withBackend(this.backend).withBackupId(this.backupId); - const loop = () => { - this.statusGetter - .do() - .then((restoreStatusResponse) => { - if (restoreStatusResponse.status == 'SUCCESS' || restoreStatusResponse.status == 'FAILED') { - resolve(this._merge(restoreStatusResponse, restoreResponse)); - } else { - setTimeout(loop, WAIT_INTERVAL); - } - }) - .catch(reject); - }; - loop(); - }) - .catch(reject); - }); - }; - this._path = () => { - return `/backups/${this.backend}/${this.backupId}/restore`; - }; - this._merge = (restoreStatusResponse, restoreResponse) => { - const merged = {}; - if ('id' in restoreStatusResponse) { - merged.id = restoreStatusResponse.id; - } - if ('path' in restoreStatusResponse) { - merged.path = restoreStatusResponse.path; - } - if ('backend' in restoreStatusResponse) { - merged.backend = restoreStatusResponse.backend; - } - if ('status' in restoreStatusResponse) { - merged.status = restoreStatusResponse.status; - } - if ('error' in restoreStatusResponse) { - merged.error = restoreStatusResponse.error; - } - if ('classes' in restoreResponse) { - merged.classes = restoreResponse.classes; - } - return merged; - }; - this.statusGetter = statusGetter; - } - withIncludeClassNames(...classNames) { - let cls = classNames; - if (classNames.length && Array.isArray(classNames[0])) { - cls = classNames[0]; - } - this.includeClassNames = cls; - return this; - } - withExcludeClassNames(...classNames) { - let cls = classNames; - if (classNames.length && Array.isArray(classNames[0])) { - cls = classNames[0]; - } - this.excludeClassNames = cls; - return this; - } - withBackend(backend) { - this.backend = backend; - return this; - } - withBackupId(backupId) { - this.backupId = backupId; - return this; - } - withWaitForCompletion(waitForCompletion) { - this.waitForCompletion = waitForCompletion; - return this; - } - withConfig(cfg) { - this.config = cfg; - return this; - } -} -exports.default = BackupRestorer; diff --git a/dist/node/cjs/backup/index.d.ts b/dist/node/cjs/backup/index.d.ts deleted file mode 100644 index 3715751f..00000000 --- a/dist/node/cjs/backup/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import Connection from '../connection/index.js'; -import BackupCreateStatusGetter from './backupCreateStatusGetter.js'; -import BackupCreator from './backupCreator.js'; -import BackupRestoreStatusGetter from './backupRestoreStatusGetter.js'; -import BackupRestorer from './backupRestorer.js'; -export type Backend = 'filesystem' | 's3' | 'gcs' | 'azure'; -export type BackupStatus = 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED'; -export type BackupCompressionLevel = 'DefaultCompression' | 'BestSpeed' | 'BestCompression'; -export interface Backup { - creator: () => BackupCreator; - createStatusGetter: () => BackupCreateStatusGetter; - restorer: () => BackupRestorer; - restoreStatusGetter: () => BackupRestoreStatusGetter; -} -declare const backup: (client: Connection) => Backup; -export default backup; -export { default as BackupCreateStatusGetter } from './backupCreateStatusGetter.js'; -export { default as BackupCreator } from './backupCreator.js'; -export { default as BackupRestoreStatusGetter } from './backupRestoreStatusGetter.js'; -export { default as BackupRestorer } from './backupRestorer.js'; diff --git a/dist/node/cjs/backup/index.js b/dist/node/cjs/backup/index.js deleted file mode 100644 index 9f7ee8de..00000000 --- a/dist/node/cjs/backup/index.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.BackupRestorer = - exports.BackupRestoreStatusGetter = - exports.BackupCreator = - exports.BackupCreateStatusGetter = - void 0; -const backupCreateStatusGetter_js_1 = __importDefault(require('./backupCreateStatusGetter.js')); -const backupCreator_js_1 = __importDefault(require('./backupCreator.js')); -const backupRestoreStatusGetter_js_1 = __importDefault(require('./backupRestoreStatusGetter.js')); -const backupRestorer_js_1 = __importDefault(require('./backupRestorer.js')); -const backup = (client) => { - return { - creator: () => new backupCreator_js_1.default(client, new backupCreateStatusGetter_js_1.default(client)), - createStatusGetter: () => new backupCreateStatusGetter_js_1.default(client), - restorer: () => - new backupRestorer_js_1.default(client, new backupRestoreStatusGetter_js_1.default(client)), - restoreStatusGetter: () => new backupRestoreStatusGetter_js_1.default(client), - }; -}; -exports.default = backup; -var backupCreateStatusGetter_js_2 = require('./backupCreateStatusGetter.js'); -Object.defineProperty(exports, 'BackupCreateStatusGetter', { - enumerable: true, - get: function () { - return __importDefault(backupCreateStatusGetter_js_2).default; - }, -}); -var backupCreator_js_2 = require('./backupCreator.js'); -Object.defineProperty(exports, 'BackupCreator', { - enumerable: true, - get: function () { - return __importDefault(backupCreator_js_2).default; - }, -}); -var backupRestoreStatusGetter_js_2 = require('./backupRestoreStatusGetter.js'); -Object.defineProperty(exports, 'BackupRestoreStatusGetter', { - enumerable: true, - get: function () { - return __importDefault(backupRestoreStatusGetter_js_2).default; - }, -}); -var backupRestorer_js_2 = require('./backupRestorer.js'); -Object.defineProperty(exports, 'BackupRestorer', { - enumerable: true, - get: function () { - return __importDefault(backupRestorer_js_2).default; - }, -}); diff --git a/dist/node/cjs/backup/validation.d.ts b/dist/node/cjs/backup/validation.d.ts deleted file mode 100644 index c109b815..00000000 --- a/dist/node/cjs/backup/validation.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export declare function validateIncludeClassNames(classNames?: string[]): any[]; -export declare function validateExcludeClassNames(classNames?: string[]): any[]; -export declare function validateBackend(backend?: string): string[]; -export declare function validateBackupId(backupId?: string): string[]; diff --git a/dist/node/cjs/backup/validation.js b/dist/node/cjs/backup/validation.js deleted file mode 100644 index e0d52889..00000000 --- a/dist/node/cjs/backup/validation.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.validateBackupId = - exports.validateBackend = - exports.validateExcludeClassNames = - exports.validateIncludeClassNames = - void 0; -const string_js_1 = require('../validation/string.js'); -function validateIncludeClassNames(classNames) { - if (Array.isArray(classNames)) { - const errors = []; - classNames.forEach((className) => { - if (!(0, string_js_1.isValidStringProperty)(className)) { - errors.push('string className invalid - set with .withIncludeClassNames(...classNames)'); - } - }); - return errors; - } - if (classNames !== null && classNames !== undefined) { - return ['strings classNames invalid - set with .withIncludeClassNames(...classNames)']; - } - return []; -} -exports.validateIncludeClassNames = validateIncludeClassNames; -function validateExcludeClassNames(classNames) { - if (Array.isArray(classNames)) { - const errors = []; - classNames.forEach((className) => { - if (!(0, string_js_1.isValidStringProperty)(className)) { - errors.push('string className invalid - set with .withExcludeClassNames(...classNames)'); - } - }); - return errors; - } - if (classNames !== null && classNames !== undefined) { - return ['strings classNames invalid - set with .withExcludeClassNames(...classNames)']; - } - return []; -} -exports.validateExcludeClassNames = validateExcludeClassNames; -function validateBackend(backend) { - if (!(0, string_js_1.isValidStringProperty)(backend)) { - return ['string backend must set - set with .withBackend(backend)']; - } - return []; -} -exports.validateBackend = validateBackend; -function validateBackupId(backupId) { - if (!(0, string_js_1.isValidStringProperty)(backupId)) { - return ['string backupId must be set - set with .withBackupId(backupId)']; - } - return []; -} -exports.validateBackupId = validateBackupId; diff --git a/dist/node/cjs/batch/index.d.ts b/dist/node/cjs/batch/index.d.ts deleted file mode 100644 index 8e7e99f9..00000000 --- a/dist/node/cjs/batch/index.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import Connection from '../connection/index.js'; -import { DbVersionSupport } from '../utils/dbVersion.js'; -import ObjectsBatchDeleter from './objectsBatchDeleter.js'; -import ObjectsBatcher from './objectsBatcher.js'; -import ReferencePayloadBuilder from './referencePayloadBuilder.js'; -import ReferencesBatcher from './referencesBatcher.js'; -export type DeleteOutput = 'verbose' | 'minimal'; -export type DeleteResultStatus = 'SUCCESS' | 'FAILED' | 'DRYRUN'; -export interface Batch { - objectsBatcher: () => ObjectsBatcher; - objectsBatchDeleter: () => ObjectsBatchDeleter; - referencesBatcher: () => ReferencesBatcher; - referencePayloadBuilder: () => ReferencePayloadBuilder; -} -declare const batch: (client: Connection, dbVersionSupport: DbVersionSupport) => Batch; -export default batch; -export { default as ObjectsBatchDeleter } from './objectsBatchDeleter.js'; -export { default as ObjectsBatcher } from './objectsBatcher.js'; -export { default as ReferencesBatcher } from './referencesBatcher.js'; diff --git a/dist/node/cjs/batch/index.js b/dist/node/cjs/batch/index.js deleted file mode 100644 index d664ffb1..00000000 --- a/dist/node/cjs/batch/index.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.ReferencesBatcher = exports.ObjectsBatcher = exports.ObjectsBatchDeleter = void 0; -const beaconPath_js_1 = require('../utils/beaconPath.js'); -const objectsBatchDeleter_js_1 = __importDefault(require('./objectsBatchDeleter.js')); -const objectsBatcher_js_1 = __importDefault(require('./objectsBatcher.js')); -const referencePayloadBuilder_js_1 = __importDefault(require('./referencePayloadBuilder.js')); -const referencesBatcher_js_1 = __importDefault(require('./referencesBatcher.js')); -const batch = (client, dbVersionSupport) => { - const beaconPath = new beaconPath_js_1.BeaconPath(dbVersionSupport); - return { - objectsBatcher: () => new objectsBatcher_js_1.default(client), - objectsBatchDeleter: () => new objectsBatchDeleter_js_1.default(client), - referencesBatcher: () => new referencesBatcher_js_1.default(client, beaconPath), - referencePayloadBuilder: () => new referencePayloadBuilder_js_1.default(client), - }; -}; -exports.default = batch; -var objectsBatchDeleter_js_2 = require('./objectsBatchDeleter.js'); -Object.defineProperty(exports, 'ObjectsBatchDeleter', { - enumerable: true, - get: function () { - return __importDefault(objectsBatchDeleter_js_2).default; - }, -}); -var objectsBatcher_js_2 = require('./objectsBatcher.js'); -Object.defineProperty(exports, 'ObjectsBatcher', { - enumerable: true, - get: function () { - return __importDefault(objectsBatcher_js_2).default; - }, -}); -var referencesBatcher_js_2 = require('./referencesBatcher.js'); -Object.defineProperty(exports, 'ReferencesBatcher', { - enumerable: true, - get: function () { - return __importDefault(referencesBatcher_js_2).default; - }, -}); diff --git a/dist/node/cjs/batch/objectsBatchDeleter.d.ts b/dist/node/cjs/batch/objectsBatchDeleter.d.ts deleted file mode 100644 index ce2a1e72..00000000 --- a/dist/node/cjs/batch/objectsBatchDeleter.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import Connection from '../connection/index.js'; -import { ConsistencyLevel } from '../data/replication.js'; -import { BatchDelete, BatchDeleteResponse, WhereFilter } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { DeleteOutput } from './index.js'; -export default class ObjectsBatchDeleter extends CommandBase { - private className?; - private consistencyLevel?; - private dryRun?; - private output?; - private whereFilter?; - private tenant?; - constructor(client: Connection); - withClassName(className: string): this; - withWhere(whereFilter: WhereFilter): this; - withOutput(output: DeleteOutput): this; - withDryRun(dryRun: boolean): this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withTenant(tenant: string): this; - payload: () => BatchDelete; - validateClassName: () => void; - validateWhereFilter: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/batch/objectsBatchDeleter.js b/dist/node/cjs/batch/objectsBatchDeleter.js deleted file mode 100644 index 05d3212a..00000000 --- a/dist/node/cjs/batch/objectsBatchDeleter.js +++ /dev/null @@ -1,74 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const string_js_1 = require('../validation/string.js'); -const path_js_1 = require('./path.js'); -class ObjectsBatchDeleter extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.payload = () => { - return { - match: { - class: this.className, - where: this.whereFilter, - }, - output: this.output, - dryRun: this.dryRun, - }; - }; - this.validateClassName = () => { - if (!(0, string_js_1.isValidStringProperty)(this.className)) { - this.addError('string className must be set - set with .withClassName(className)'); - } - }; - this.validateWhereFilter = () => { - if (typeof this.whereFilter != 'object') { - this.addError('object where must be set - set with .withWhere(whereFilter)'); - } - }; - this.validate = () => { - this.validateClassName(); - this.validateWhereFilter(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const params = new URLSearchParams(); - if (this.consistencyLevel) { - params.set('consistency_level', this.consistencyLevel); - } - if (this.tenant) { - params.set('tenant', this.tenant); - } - const path = (0, path_js_1.buildObjectsPath)(params); - return this.client.delete(path, this.payload(), true); - }; - } - withClassName(className) { - this.className = className; - return this; - } - withWhere(whereFilter) { - this.whereFilter = whereFilter; - return this; - } - withOutput(output) { - this.output = output; - return this; - } - withDryRun(dryRun) { - this.dryRun = dryRun; - return this; - } - withTenant(tenant) { - this.tenant = tenant; - return this; - } -} -exports.default = ObjectsBatchDeleter; diff --git a/dist/node/cjs/batch/objectsBatcher.d.ts b/dist/node/cjs/batch/objectsBatcher.d.ts deleted file mode 100644 index 8708a6b8..00000000 --- a/dist/node/cjs/batch/objectsBatcher.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import Connection from '../connection/index.js'; -import { ConsistencyLevel } from '../data/replication.js'; -import { BatchRequest, WeaviateObject, WeaviateObjectsGet } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ObjectsBatcher extends CommandBase { - private consistencyLevel?; - objects: WeaviateObject[]; - constructor(client: Connection); - /** - * can be called as: - * - withObjects(...[obj1, obj2, obj3]) - * - withObjects(obj1, obj2, obj3) - * - withObjects(obj1) - * @param {...WeaviateObject[]} objects - */ - withObjects(...objects: WeaviateObject[]): this; - withObject(object: WeaviateObject): this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - payload: () => BatchRequest; - validateObjectCount: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/batch/objectsBatcher.js b/dist/node/cjs/batch/objectsBatcher.js deleted file mode 100644 index 66db1d9a..00000000 --- a/dist/node/cjs/batch/objectsBatcher.js +++ /dev/null @@ -1,56 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const path_js_1 = require('./path.js'); -class ObjectsBatcher extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.payload = () => ({ - objects: this.objects, - }); - this.validateObjectCount = () => { - if (this.objects.length == 0) { - this.addError('need at least one object to send a request, add one with .withObject(obj)'); - } - }; - this.validate = () => { - this.validateObjectCount(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const params = new URLSearchParams(); - if (this.consistencyLevel) { - params.set('consistency_level', this.consistencyLevel); - } - const path = (0, path_js_1.buildObjectsPath)(params); - return this.client.postReturn(path, this.payload()); - }; - this.objects = []; - } - /** - * can be called as: - * - withObjects(...[obj1, obj2, obj3]) - * - withObjects(obj1, obj2, obj3) - * - withObjects(obj1) - * @param {...WeaviateObject[]} objects - */ - withObjects(...objects) { - let objs = objects; - if (objects.length && Array.isArray(objects[0])) { - objs = objects[0]; - } - this.objects = [...this.objects, ...objs]; - return this; - } - withObject(object) { - return this.withObjects(object); - } -} -exports.default = ObjectsBatcher; diff --git a/dist/node/cjs/batch/path.d.ts b/dist/node/cjs/batch/path.d.ts deleted file mode 100644 index 86f18cf7..00000000 --- a/dist/node/cjs/batch/path.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function buildObjectsPath(queryParams: any): string; -export declare function buildRefsPath(queryParams: any): string; diff --git a/dist/node/cjs/batch/path.js b/dist/node/cjs/batch/path.js deleted file mode 100644 index e4312311..00000000 --- a/dist/node/cjs/batch/path.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.buildRefsPath = exports.buildObjectsPath = void 0; -function buildObjectsPath(queryParams) { - const path = '/batch/objects'; - return buildPath(path, queryParams); -} -exports.buildObjectsPath = buildObjectsPath; -function buildRefsPath(queryParams) { - const path = '/batch/references'; - return buildPath(path, queryParams); -} -exports.buildRefsPath = buildRefsPath; -function buildPath(path, queryParams) { - if (queryParams && queryParams.toString() != '') { - path = `${path}?${queryParams.toString()}`; - } - return path; -} diff --git a/dist/node/cjs/batch/referencePayloadBuilder.d.ts b/dist/node/cjs/batch/referencePayloadBuilder.d.ts deleted file mode 100644 index 5bd7f5a7..00000000 --- a/dist/node/cjs/batch/referencePayloadBuilder.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import Connection from '../connection/index.js'; -import { BatchReference } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ReferencesBatcher extends CommandBase { - private fromClassName?; - private fromId?; - private fromRefProp?; - private toClassName?; - private toId?; - constructor(client: Connection); - withFromId: (id: string) => this; - withToId: (id: string) => this; - withFromClassName: (className: string) => this; - withFromRefProp: (refProp: string) => this; - withToClassName(className: string): this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - payload: () => BatchReference; - do: () => Promise; -} diff --git a/dist/node/cjs/batch/referencePayloadBuilder.js b/dist/node/cjs/batch/referencePayloadBuilder.js deleted file mode 100644 index a6df45bb..00000000 --- a/dist/node/cjs/batch/referencePayloadBuilder.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const string_js_1 = require('../validation/string.js'); -class ReferencesBatcher extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withFromId = (id) => { - this.fromId = id; - return this; - }; - this.withToId = (id) => { - this.toId = id; - return this; - }; - this.withFromClassName = (className) => { - this.fromClassName = className; - return this; - }; - this.withFromRefProp = (refProp) => { - this.fromRefProp = refProp; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.fromId, 'fromId', '.withFromId(id)'); - this.validateIsSet(this.toId, 'toId', '.withToId(id)'); - this.validateIsSet(this.fromClassName, 'fromClassName', '.withFromClassName(className)'); - this.validateIsSet(this.fromRefProp, 'fromRefProp', '.withFromRefProp(refProp)'); - }; - this.payload = () => { - this.validate(); - if (this.errors.length > 0) { - throw new Error(this.errors.join(', ')); - } - let beaconTo = `weaviate://localhost`; - if ((0, string_js_1.isValidStringProperty)(this.toClassName)) { - beaconTo = `${beaconTo}/${this.toClassName}`; - } - return { - from: `weaviate://localhost/${this.fromClassName}/${this.fromId}/${this.fromRefProp}`, - to: `${beaconTo}/${this.toId}`, - }; - }; - this.do = () => { - return Promise.reject(new Error('Should never be called')); - }; - } - withToClassName(className) { - this.toClassName = className; - return this; - } -} -exports.default = ReferencesBatcher; diff --git a/dist/node/cjs/batch/referencesBatcher.d.ts b/dist/node/cjs/batch/referencesBatcher.d.ts deleted file mode 100644 index 1a3360b0..00000000 --- a/dist/node/cjs/batch/referencesBatcher.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import Connection from '../connection/index.js'; -import { ConsistencyLevel } from '../data/replication.js'; -import { BatchReference, BatchReferenceResponse } from '../openapi/types.js'; -import { BeaconPath } from '../utils/beaconPath.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ReferencesBatcher extends CommandBase { - private beaconPath; - private consistencyLevel?; - references: BatchReference[]; - constructor(client: Connection, beaconPath: BeaconPath); - /** - * can be called as: - * - withReferences(...[ref1, ref2, ref3]) - * - withReferences(ref1, ref2, ref3) - * - withReferences(ref1) - * @param {...BatchReference[]} references - */ - withReferences(...references: BatchReference[]): this; - withReference(reference: BatchReference): this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - payload: () => BatchReference[]; - validateReferenceCount: () => void; - validate: () => void; - do: () => Promise; - rebuildReferencePromise: (reference: BatchReference) => Promise; -} diff --git a/dist/node/cjs/batch/referencesBatcher.js b/dist/node/cjs/batch/referencesBatcher.js deleted file mode 100644 index 74a482e2..00000000 --- a/dist/node/cjs/batch/referencesBatcher.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const path_js_1 = require('./path.js'); -class ReferencesBatcher extends commandBase_js_1.CommandBase { - constructor(client, beaconPath) { - super(client); - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.payload = () => this.references; - this.validateReferenceCount = () => { - if (this.references.length == 0) { - this.addError('need at least one reference to send a request, add one with .withReference(obj)'); - } - }; - this.validate = () => { - this.validateReferenceCount(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const params = new URLSearchParams(); - if (this.consistencyLevel) { - params.set('consistency_level', this.consistencyLevel); - } - const path = (0, path_js_1.buildRefsPath)(params); - const payloadPromise = Promise.all(this.references.map((ref) => this.rebuildReferencePromise(ref))); - return payloadPromise.then((payload) => this.client.postReturn(path, payload)); - }; - this.rebuildReferencePromise = (reference) => { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return this.beaconPath.rebuild(reference.to).then((beaconTo) => ({ - from: reference.from, - to: beaconTo, - tenant: reference.tenant, - })); - }; - this.beaconPath = beaconPath; - this.references = []; - } - /** - * can be called as: - * - withReferences(...[ref1, ref2, ref3]) - * - withReferences(ref1, ref2, ref3) - * - withReferences(ref1) - * @param {...BatchReference[]} references - */ - withReferences(...references) { - let refs = references; - if (references.length && Array.isArray(references[0])) { - refs = references[0]; - } - this.references = [...this.references, ...refs]; - return this; - } - withReference(reference) { - return this.withReferences(reference); - } -} -exports.default = ReferencesBatcher; diff --git a/dist/node/cjs/c11y/conceptsGetter.d.ts b/dist/node/cjs/c11y/conceptsGetter.d.ts deleted file mode 100644 index 5dee9a06..00000000 --- a/dist/node/cjs/c11y/conceptsGetter.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Connection from '../connection/index.js'; -import { C11yWordsResponse } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ConceptsGetter extends CommandBase { - private concept?; - constructor(client: Connection); - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - withConcept: (concept: string) => this; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/c11y/conceptsGetter.js b/dist/node/cjs/c11y/conceptsGetter.js deleted file mode 100644 index bcdc7a22..00000000 --- a/dist/node/cjs/c11y/conceptsGetter.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class ConceptsGetter extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.withConcept = (concept) => { - this.concept = concept; - return this; - }; - this.validate = () => { - this.validateIsSet(this.concept, 'concept', 'withConcept(concept)'); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/modules/text2vec-contextionary/concepts/${this.concept}`; - return this.client.get(path); - }; - } -} -exports.default = ConceptsGetter; diff --git a/dist/node/cjs/c11y/extensionCreator.d.ts b/dist/node/cjs/c11y/extensionCreator.d.ts deleted file mode 100644 index 1e50f5f5..00000000 --- a/dist/node/cjs/c11y/extensionCreator.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import Connection from '../connection/index.js'; -import { C11yExtension } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ExtensionCreator extends CommandBase { - private concept?; - private definition?; - private weight?; - constructor(client: Connection); - withConcept: (concept: string) => this; - withDefinition: (definition: string) => this; - withWeight: (weight: number) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - payload: () => C11yExtension; - do: () => Promise; -} diff --git a/dist/node/cjs/c11y/extensionCreator.js b/dist/node/cjs/c11y/extensionCreator.js deleted file mode 100644 index 29d3baf7..00000000 --- a/dist/node/cjs/c11y/extensionCreator.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class ExtensionCreator extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withConcept = (concept) => { - this.concept = concept; - return this; - }; - this.withDefinition = (definition) => { - this.definition = definition; - return this; - }; - this.withWeight = (weight) => { - this.weight = weight; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - var _a; - this.validateIsSet(this.concept, 'concept', 'withConcept(concept)'); - this.validateIsSet(this.definition, 'definition', 'withDefinition(definition)'); - this.validateIsSet( - ((_a = this.weight) === null || _a === void 0 ? void 0 : _a.toString()) || '', - 'weight', - 'withWeight(weight)' - ); - }; - this.payload = () => ({ - concept: this.concept, - definition: this.definition, - weight: this.weight, - }); - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/modules/text2vec-contextionary/extensions`; - return this.client.postReturn(path, this.payload()); - }; - } -} -exports.default = ExtensionCreator; diff --git a/dist/node/cjs/c11y/index.d.ts b/dist/node/cjs/c11y/index.d.ts deleted file mode 100644 index 227b5e0f..00000000 --- a/dist/node/cjs/c11y/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Connection from '../connection/index.js'; -import ConceptsGetter from './conceptsGetter.js'; -import ExtensionCreator from './extensionCreator.js'; -export interface C11y { - conceptsGetter: () => ConceptsGetter; - extensionCreator: () => ExtensionCreator; -} -declare const c11y: (client: Connection) => C11y; -export default c11y; -export { default as ConceptsGetter } from './conceptsGetter.js'; -export { default as ExtensionCreator } from './extensionCreator.js'; diff --git a/dist/node/cjs/c11y/index.js b/dist/node/cjs/c11y/index.js deleted file mode 100644 index 248fc94c..00000000 --- a/dist/node/cjs/c11y/index.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.ExtensionCreator = exports.ConceptsGetter = void 0; -const conceptsGetter_js_1 = __importDefault(require('./conceptsGetter.js')); -const extensionCreator_js_1 = __importDefault(require('./extensionCreator.js')); -const c11y = (client) => { - return { - conceptsGetter: () => new conceptsGetter_js_1.default(client), - extensionCreator: () => new extensionCreator_js_1.default(client), - }; -}; -exports.default = c11y; -var conceptsGetter_js_2 = require('./conceptsGetter.js'); -Object.defineProperty(exports, 'ConceptsGetter', { - enumerable: true, - get: function () { - return __importDefault(conceptsGetter_js_2).default; - }, -}); -var extensionCreator_js_2 = require('./extensionCreator.js'); -Object.defineProperty(exports, 'ExtensionCreator', { - enumerable: true, - get: function () { - return __importDefault(extensionCreator_js_2).default; - }, -}); diff --git a/dist/node/cjs/classifications/getter.d.ts b/dist/node/cjs/classifications/getter.d.ts deleted file mode 100644 index 02aa3487..00000000 --- a/dist/node/cjs/classifications/getter.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Connection from '../connection/index.js'; -import { Classification } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassificationsGetter extends CommandBase { - private id?; - constructor(client: Connection); - withId: (id: string) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validateId: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/classifications/getter.js b/dist/node/cjs/classifications/getter.js deleted file mode 100644 index 277e5ca7..00000000 --- a/dist/node/cjs/classifications/getter.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class ClassificationsGetter extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validateId = () => { - this.validateIsSet(this.id, 'id', '.withId(id)'); - }; - this.validate = () => { - this.validateId(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/classifications/${this.id}`; - return this.client.get(path); - }; - } -} -exports.default = ClassificationsGetter; diff --git a/dist/node/cjs/classifications/index.d.ts b/dist/node/cjs/classifications/index.d.ts deleted file mode 100644 index 65606ff8..00000000 --- a/dist/node/cjs/classifications/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Connection from '../connection/index.js'; -import ClassificationsGetter from './getter.js'; -import ClassificationsScheduler from './scheduler.js'; -export interface Classifications { - scheduler: () => ClassificationsScheduler; - getter: () => ClassificationsGetter; -} -declare const data: (client: Connection) => Classifications; -export default data; -export { default as ClassificationsGetter } from './getter.js'; -export { default as ClassificationsScheduler } from './scheduler.js'; diff --git a/dist/node/cjs/classifications/index.js b/dist/node/cjs/classifications/index.js deleted file mode 100644 index bbadb27b..00000000 --- a/dist/node/cjs/classifications/index.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.ClassificationsScheduler = exports.ClassificationsGetter = void 0; -const getter_js_1 = __importDefault(require('./getter.js')); -const scheduler_js_1 = __importDefault(require('./scheduler.js')); -const data = (client) => { - return { - scheduler: () => new scheduler_js_1.default(client), - getter: () => new getter_js_1.default(client), - }; -}; -exports.default = data; -var getter_js_2 = require('./getter.js'); -Object.defineProperty(exports, 'ClassificationsGetter', { - enumerable: true, - get: function () { - return __importDefault(getter_js_2).default; - }, -}); -var scheduler_js_2 = require('./scheduler.js'); -Object.defineProperty(exports, 'ClassificationsScheduler', { - enumerable: true, - get: function () { - return __importDefault(scheduler_js_2).default; - }, -}); diff --git a/dist/node/cjs/classifications/scheduler.d.ts b/dist/node/cjs/classifications/scheduler.d.ts deleted file mode 100644 index 3538ceef..00000000 --- a/dist/node/cjs/classifications/scheduler.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import Connection from '../connection/index.js'; -import { Classification } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassificationsScheduler extends CommandBase { - private basedOnProperties?; - private classifyProperties?; - private className?; - private settings?; - private type?; - private waitForCompletion; - private waitTimeout; - constructor(client: Connection); - withType: (type: string) => this; - withSettings: (settings: any) => this; - withClassName: (className: string) => this; - withClassifyProperties: (props: string[]) => this; - withBasedOnProperties: (props: string[]) => this; - withWaitForCompletion: () => this; - withWaitTimeout: (timeout: number) => this; - validateIsSet: (prop: string | undefined | null | any[], name: string, setter: string) => void; - validateClassName: () => void; - validateBasedOnProperties: () => void; - validateClassifyProperties: () => void; - validate: () => void; - payload: () => Classification; - pollForCompletion: (id: any) => Promise; - do: () => Promise; -} diff --git a/dist/node/cjs/classifications/scheduler.js b/dist/node/cjs/classifications/scheduler.js deleted file mode 100644 index a01b354c..00000000 --- a/dist/node/cjs/classifications/scheduler.js +++ /dev/null @@ -1,118 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const getter_js_1 = __importDefault(require('./getter.js')); -class ClassificationsScheduler extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withType = (type) => { - this.type = type; - return this; - }; - this.withSettings = (settings) => { - this.settings = settings; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withClassifyProperties = (props) => { - this.classifyProperties = props; - return this; - }; - this.withBasedOnProperties = (props) => { - this.basedOnProperties = props; - return this; - }; - this.withWaitForCompletion = () => { - this.waitForCompletion = true; - return this; - }; - this.withWaitTimeout = (timeout) => { - this.waitTimeout = timeout; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validateClassName = () => { - this.validateIsSet(this.className, 'className', '.withClassName(className)'); - }; - this.validateBasedOnProperties = () => { - this.validateIsSet( - this.basedOnProperties, - 'basedOnProperties', - '.withBasedOnProperties(basedOnProperties)' - ); - }; - this.validateClassifyProperties = () => { - this.validateIsSet( - this.classifyProperties, - 'classifyProperties', - '.withClassifyProperties(classifyProperties)' - ); - }; - this.validate = () => { - this.validateClassName(); - this.validateClassifyProperties(); - this.validateBasedOnProperties(); - }; - this.payload = () => ({ - type: this.type, - settings: this.settings, - class: this.className, - classifyProperties: this.classifyProperties, - basedOnProperties: this.basedOnProperties, - }); - this.pollForCompletion = (id) => { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => { - clearInterval(interval); - clearTimeout(timeout); - reject( - new Error( - "classification didn't finish within configured timeout, " + - 'set larger timeout with .withWaitTimeout(timeout)' - ) - ); - }, this.waitTimeout); - const interval = setInterval(() => { - new getter_js_1.default(this.client) - .withId(id) - .do() - .then((res) => { - if (res.status === 'completed') { - clearInterval(interval); - clearTimeout(timeout); - resolve(res); - } - }); - }, 500); - }); - }; - this.do = () => { - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - this.validate(); - const path = `/classifications`; - return this.client.postReturn(path, this.payload()).then((res) => { - if (!this.waitForCompletion) { - return Promise.resolve(res); - } - return this.pollForCompletion(res.id); - }); - }; - this.waitTimeout = 10 * 60 * 1000; // 10 minutes - this.waitForCompletion = false; - } -} -exports.default = ClassificationsScheduler; diff --git a/dist/node/cjs/cluster/index.d.ts b/dist/node/cjs/cluster/index.d.ts deleted file mode 100644 index 7889c36c..00000000 --- a/dist/node/cjs/cluster/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Connection from '../connection/index.js'; -import NodesStatusGetter from './nodesStatusGetter.js'; -export type NodeStatus = 'HEALTHY' | 'UNHEALTHY' | 'UNAVAILABLE'; -export interface Cluster { - nodesStatusGetter: () => NodesStatusGetter; -} -declare const cluster: (client: Connection) => Cluster; -export default cluster; -export { default as NodesStatusGetter } from './nodesStatusGetter.js'; diff --git a/dist/node/cjs/cluster/index.js b/dist/node/cjs/cluster/index.js deleted file mode 100644 index 5a244280..00000000 --- a/dist/node/cjs/cluster/index.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.NodesStatusGetter = void 0; -const nodesStatusGetter_js_1 = __importDefault(require('./nodesStatusGetter.js')); -const cluster = (client) => { - return { - nodesStatusGetter: () => new nodesStatusGetter_js_1.default(client), - }; -}; -exports.default = cluster; -var nodesStatusGetter_js_2 = require('./nodesStatusGetter.js'); -Object.defineProperty(exports, 'NodesStatusGetter', { - enumerable: true, - get: function () { - return __importDefault(nodesStatusGetter_js_2).default; - }, -}); diff --git a/dist/node/cjs/cluster/nodesStatusGetter.d.ts b/dist/node/cjs/cluster/nodesStatusGetter.d.ts deleted file mode 100644 index ce425d2e..00000000 --- a/dist/node/cjs/cluster/nodesStatusGetter.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Connection from '../connection/index.js'; -import { NodesStatusResponse } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class NodesStatusGetter extends CommandBase { - private className?; - private output?; - constructor(client: Connection); - withClassName: (className: string) => this; - withOutput: (output: 'minimal' | 'verbose') => this; - validate(): void; - do: () => Promise; -} diff --git a/dist/node/cjs/cluster/nodesStatusGetter.js b/dist/node/cjs/cluster/nodesStatusGetter.js deleted file mode 100644 index 7e0cb12d..00000000 --- a/dist/node/cjs/cluster/nodesStatusGetter.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class NodesStatusGetter extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withOutput = (output) => { - this.output = output; - return this; - }; - this.do = () => { - let path = '/nodes'; - if (this.className) { - path = `${path}/${this.className}`; - } - if (this.output) { - path = `${path}?output=${this.output}`; - } else { - path = `${path}?output=verbose`; - } - return this.client.get(path); - }; - } - validate() { - // nothing to validate - } -} -exports.default = NodesStatusGetter; diff --git a/dist/node/cjs/collections/aggregate/index.d.ts b/dist/node/cjs/collections/aggregate/index.d.ts deleted file mode 100644 index 0dbe9a08..00000000 --- a/dist/node/cjs/collections/aggregate/index.d.ts +++ /dev/null @@ -1,409 +0,0 @@ -/// -import Connection from '../../connection/index.js'; -import { ConsistencyLevel } from '../../data/index.js'; -import { Aggregator } from '../../graphql/index.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { FilterValue } from '../filters/index.js'; -export type AggregateBaseOptions = { - filters?: FilterValue; - returnMetrics?: M; -}; -export type AggregateGroupByOptions = AggregateOptions & { - groupBy: (keyof T & string) | GroupByAggregate; -}; -export type GroupByAggregate = { - property: keyof T & string; - limit?: number; -}; -export type AggregateOptions = AggregateBaseOptions; -export type AggregateBaseOverAllOptions = AggregateBaseOptions; -export type AggregateNearOptions = AggregateBaseOptions & { - certainty?: number; - distance?: number; - objectLimit?: number; - targetVector?: string; -}; -export type AggregateGroupByNearOptions = AggregateNearOptions & { - groupBy: (keyof T & string) | GroupByAggregate; -}; -export type AggregateBoolean = { - count?: number; - percentageFalse?: number; - percentageTrue?: number; - totalFalse?: number; - totalTrue?: number; -}; -export type AggregateDate = { - count?: number; - maximum?: number; - median?: number; - minimum?: number; - mode?: number; -}; -export type AggregateNumber = { - count?: number; - maximum?: number; - mean?: number; - median?: number; - minimum?: number; - mode?: number; - sum?: number; -}; -export type AggregateReference = { - pointingTo?: string; -}; -export type AggregateText = { - count?: number; - topOccurrences?: { - occurs?: number; - value?: number; - }[]; -}; -export type MetricsInput = - | MetricsBoolean - | MetricsInteger - | MetricsNumber - | MetricsText - | MetricsDate; -export type PropertiesMetrics = T extends undefined - ? MetricsInput | MetricsInput[] - : MetricsInput | MetricsInput[]; -export type MetricsBase = { - kind: K; - propertyName: N; -}; -export type Option = { - [key in keyof A]: boolean; -}; -export type BooleanKeys = 'count' | 'percentageFalse' | 'percentageTrue' | 'totalFalse' | 'totalTrue'; -export type DateKeys = 'count' | 'maximum' | 'median' | 'minimum' | 'mode'; -export type NumberKeys = 'count' | 'maximum' | 'mean' | 'median' | 'minimum' | 'mode' | 'sum'; -export type MetricsBoolean = MetricsBase & - Partial<{ - [key in BooleanKeys]: boolean; - }>; -export type MetricsDate = MetricsBase & - Partial<{ - [key in DateKeys]: boolean; - }>; -export type MetricsInteger = MetricsBase & - Partial<{ - [key in NumberKeys]: boolean; - }>; -export type MetricsNumber = MetricsBase & - Partial<{ - [key in NumberKeys]: boolean; - }>; -export type MetricsText = MetricsBase & { - count?: boolean; - topOccurrences?: { - occurs?: boolean; - value?: boolean; - }; - minOccurrences?: number; -}; -export type AggregateMetrics = { - [K in keyof M]: M[K] extends true ? number : never; -}; -export type MetricsProperty = T extends undefined ? string : keyof T & string; -export declare const metrics: () => { - aggregate:

>(property: P) => MetricsManager; -}; -export interface Metrics { - /** - * Define the metrics to be returned based on a property when aggregating over a collection. - - Use this `aggregate` method to define the name to the property to be aggregated on. - Then use the `text`, `integer`, `number`, `boolean`, `date_`, or `reference` methods to define the metrics to be returned. - - See [the docs](https://weaviate.io/developers/weaviate/search/aggregate) for more details! - */ - aggregate:

>(property: P) => MetricsManager; -} -export declare class MetricsManager> { - private propertyName; - constructor(property: P); - private map; - /** - * Define the metrics to be returned for a BOOL or BOOL_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'percentageFalse' | 'percentageTrue' | 'totalFalse' | 'totalTrue')[]} metrics The metrics to return. - * @returns {MetricsBoolean

} The metrics for the property. - */ - boolean( - metrics?: ('count' | 'percentageFalse' | 'percentageTrue' | 'totalFalse' | 'totalTrue')[] - ): MetricsBoolean

; - /** - * Define the metrics to be returned for a DATE or DATE_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'maximum' | 'median' | 'minimum' | 'mode')[]} metrics The metrics to return. - * @returns {MetricsDate

} The metrics for the property. - */ - date(metrics?: ('count' | 'maximum' | 'median' | 'minimum' | 'mode')[]): MetricsDate

; - /** - * Define the metrics to be returned for an INT or INT_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'maximum' | 'mean' | 'median' | 'minimum' | 'mode' | 'sum')[]} metrics The metrics to return. - * @returns {MetricsInteger

} The metrics for the property. - */ - integer( - metrics?: ('count' | 'maximum' | 'mean' | 'median' | 'minimum' | 'mode' | 'sum')[] - ): MetricsInteger

; - /** - * Define the metrics to be returned for a NUMBER or NUMBER_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'maximum' | 'mean' | 'median' | 'minimum' | 'mode' | 'sum')[]} metrics The metrics to return. - * @returns {MetricsNumber

} The metrics for the property. - */ - number( - metrics?: ('count' | 'maximum' | 'mean' | 'median' | 'minimum' | 'mode' | 'sum')[] - ): MetricsNumber

; - /** - * Define the metrics to be returned for a TEXT or TEXT_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'topOccurrencesOccurs' | 'topOccurrencesValue')[]} metrics The metrics to return. - * @param {number} [minOccurrences] The how many top occurrences to return. - * @returns {MetricsText

} The metrics for the property. - */ - text( - metrics?: ('count' | 'topOccurrencesOccurs' | 'topOccurrencesValue')[], - minOccurrences?: number - ): MetricsText

; -} -type KindToAggregateType = K extends 'text' - ? AggregateText - : K extends 'date' - ? AggregateDate - : K extends 'integer' - ? AggregateNumber - : K extends 'number' - ? AggregateNumber - : K extends 'boolean' - ? AggregateBoolean - : K extends 'reference' - ? AggregateReference - : never; -export type AggregateType = AggregateBoolean | AggregateDate | AggregateNumber | AggregateText; -export type AggregateResult | undefined = undefined> = { - properties: T extends undefined - ? Record - : M extends MetricsInput[] - ? { - [K in M[number] as K['propertyName']]: KindToAggregateType; - } - : M extends MetricsInput - ? { - [K in M as K['propertyName']]: KindToAggregateType; - } - : undefined; - totalCount: number; -}; -export type AggregateGroupByResult< - T, - M extends PropertiesMetrics | undefined = undefined -> = AggregateResult & { - groupedBy: { - prop: string; - value: string; - }; -}; -declare class AggregateManager implements Aggregate { - connection: Connection; - groupBy: AggregateGroupBy; - name: string; - dbVersionSupport: DbVersionSupport; - consistencyLevel?: ConsistencyLevel; - tenant?: string; - private constructor(); - query(): Aggregator; - base( - metrics?: PropertiesMetrics, - filters?: FilterValue, - groupBy?: (keyof T & string) | GroupByAggregate - ): Aggregator; - metrics(metrics: MetricsInput<(keyof T & string) | string>): string; - static use( - connection: Connection, - name: string, - dbVersionSupport: DbVersionSupport, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ): AggregateManager; - nearImage>( - image: string | Buffer, - opts?: AggregateNearOptions - ): Promise>; - nearObject>( - id: string, - opts?: AggregateNearOptions - ): Promise>; - nearText>( - query: string | string[], - opts?: AggregateNearOptions - ): Promise>; - nearVector>( - vector: number[], - opts?: AggregateNearOptions - ): Promise>; - overAll>(opts?: AggregateOptions): Promise>; - do: | undefined = undefined>( - query: Aggregator - ) => Promise>; - doGroupBy: | undefined = undefined>( - query: Aggregator - ) => Promise[]>; -} -export interface Aggregate { - /** This namespace contains methods perform a group by search while aggregating metrics. */ - groupBy: AggregateGroupBy; - /** - * Aggregate metrics over the objects returned by a near image vector search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires a vectorizer capable of handling base64-encoded images, e.g. `img2vec-neural`, `multi2vec-clip`, and `multi2vec-bind`. - * - * @param {string | Buffer} image The image to search on. This can be a base64 string, a file path string, or a buffer. - * @param {AggregateNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearImage>( - image: string | Buffer, - opts?: AggregateNearOptions - ): Promise>; - /** - * Aggregate metrics over the objects returned by a near object search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires that the objects in the collection have associated vectors. - * - * @param {string} id The ID of the object to search for. - * @param {AggregateNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearObject>( - id: string, - opts?: AggregateNearOptions - ): Promise>; - /** - * Aggregate metrics over the objects returned by a near vector search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires that the objects in the collection have associated vectors. - * - * @param {number[]} query The text query to search for. - * @param {AggregateNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearText>( - query: string | string[], - opts?: AggregateNearOptions - ): Promise>; - /** - * Aggregate metrics over the objects returned by a near vector search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires that the objects in the collection have associated vectors. - * - * @param {number[]} vector The vector to search for. - * @param {AggregateNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearVector>( - vector: number[], - opts?: AggregateNearOptions - ): Promise>; - /** - * Aggregate metrics over all the objects in this collection without any vector search. - * - * @param {AggregateOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects in the collection. - */ - overAll>(opts?: AggregateOptions): Promise>; -} -export interface AggregateGroupBy { - /** - * Aggregate metrics over the objects returned by a near image vector search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires a vectorizer capable of handling base64-encoded images, e.g. `img2vec-neural`, `multi2vec-clip`, and `multi2vec-bind`. - * - * @param {string | Buffer} image The image to search on. This can be a base64 string, a file path string, or a buffer. - * @param {AggregateGroupByNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearImage>( - image: string | Buffer, - opts?: AggregateGroupByNearOptions - ): Promise[]>; - /** - * Aggregate metrics over the objects returned by a near object search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires that the objects in the collection have associated vectors. - * - * @param {string} id The ID of the object to search for. - * @param {AggregateGroupByNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearObject>( - id: string, - opts?: AggregateGroupByNearOptions - ): Promise[]>; - /** - * Aggregate metrics over the objects returned by a near text vector search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires a vectorizer capable of handling text, e.g. `text2vec-contextionary`, `text2vec-openai`, etc. - * - * @param {string | string[]} query The text to search for. - * @param {AggregateGroupByNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearText>( - query: string | string[], - opts: AggregateGroupByNearOptions - ): Promise[]>; - /** - * Aggregate metrics over the objects returned by a near vector search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires that the objects in the collection have associated vectors. - * - * @param {number[]} vector The vector to search for. - * @param {AggregateGroupByNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearVector>( - vector: number[], - opts?: AggregateGroupByNearOptions - ): Promise[]>; - /** - * Aggregate metrics over all the objects in this collection without any vector search. - * - * @param {AggregateGroupByOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects in the collection. - */ - overAll>( - opts?: AggregateGroupByOptions - ): Promise[]>; -} -declare const _default: typeof AggregateManager.use; -export default _default; diff --git a/dist/node/cjs/collections/aggregate/index.js b/dist/node/cjs/collections/aggregate/index.js deleted file mode 100644 index c7468a46..00000000 --- a/dist/node/cjs/collections/aggregate/index.js +++ /dev/null @@ -1,440 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -var __rest = - (this && this.__rest) || - function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === 'function') - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.MetricsManager = exports.metrics = void 0; -const errors_js_1 = require('../../errors.js'); -const index_js_1 = require('../../graphql/index.js'); -const index_js_2 = require('../../index.js'); -const index_js_3 = require('../serialize/index.js'); -const metrics = () => { - return { - aggregate: (property) => new MetricsManager(property), - }; -}; -exports.metrics = metrics; -class MetricsManager { - constructor(property) { - this.propertyName = property; - } - map(metrics) { - const out = {}; - metrics.forEach((metric) => { - out[metric] = true; - }); - return out; - } - /** - * Define the metrics to be returned for a BOOL or BOOL_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'percentageFalse' | 'percentageTrue' | 'totalFalse' | 'totalTrue')[]} metrics The metrics to return. - * @returns {MetricsBoolean

} The metrics for the property. - */ - boolean(metrics) { - if (metrics === undefined || metrics.length === 0) { - metrics = ['count', 'percentageFalse', 'percentageTrue', 'totalFalse', 'totalTrue']; - } - return Object.assign(Object.assign({}, this.map(metrics)), { - kind: 'boolean', - propertyName: this.propertyName, - }); - } - /** - * Define the metrics to be returned for a DATE or DATE_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'maximum' | 'median' | 'minimum' | 'mode')[]} metrics The metrics to return. - * @returns {MetricsDate

} The metrics for the property. - */ - date(metrics) { - if (metrics === undefined || metrics.length === 0) { - metrics = ['count', 'maximum', 'median', 'minimum', 'mode']; - } - return Object.assign(Object.assign({}, this.map(metrics)), { - kind: 'date', - propertyName: this.propertyName, - }); - } - /** - * Define the metrics to be returned for an INT or INT_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'maximum' | 'mean' | 'median' | 'minimum' | 'mode' | 'sum')[]} metrics The metrics to return. - * @returns {MetricsInteger

} The metrics for the property. - */ - integer(metrics) { - if (metrics === undefined || metrics.length === 0) { - metrics = ['count', 'maximum', 'mean', 'median', 'minimum', 'mode', 'sum']; - } - return Object.assign(Object.assign({}, this.map(metrics)), { - kind: 'integer', - propertyName: this.propertyName, - }); - } - /** - * Define the metrics to be returned for a NUMBER or NUMBER_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'maximum' | 'mean' | 'median' | 'minimum' | 'mode' | 'sum')[]} metrics The metrics to return. - * @returns {MetricsNumber

} The metrics for the property. - */ - number(metrics) { - if (metrics === undefined || metrics.length === 0) { - metrics = ['count', 'maximum', 'mean', 'median', 'minimum', 'mode', 'sum']; - } - return Object.assign(Object.assign({}, this.map(metrics)), { - kind: 'number', - propertyName: this.propertyName, - }); - } - // public reference(metrics: 'pointingTo'[]): MetricsReference { - // return { - // ...this.map(metrics), - // kind: 'reference', - // propertyName: this.propertyName, - // }; - // } - /** - * Define the metrics to be returned for a TEXT or TEXT_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'topOccurrencesOccurs' | 'topOccurrencesValue')[]} metrics The metrics to return. - * @param {number} [minOccurrences] The how many top occurrences to return. - * @returns {MetricsText

} The metrics for the property. - */ - text(metrics, minOccurrences) { - if (metrics === undefined || metrics.length === 0) { - metrics = ['count', 'topOccurrencesOccurs', 'topOccurrencesValue']; - } - return { - count: metrics.includes('count'), - topOccurrences: - metrics.includes('topOccurrencesOccurs') || metrics.includes('topOccurrencesValue') - ? { - occurs: metrics.includes('topOccurrencesOccurs'), - value: metrics.includes('topOccurrencesValue'), - } - : undefined, - minOccurrences, - kind: 'text', - propertyName: this.propertyName, - }; - } -} -exports.MetricsManager = MetricsManager; -class AggregateManager { - constructor(connection, name, dbVersionSupport, consistencyLevel, tenant) { - this.do = (query) => { - return query - .do() - .then(({ data }) => { - const _a = data.Aggregate[this.name][0], - { meta } = _a, - rest = __rest(_a, ['meta']); - return { - properties: rest, - totalCount: meta === null || meta === void 0 ? void 0 : meta.count, - }; - }) - .catch((err) => { - throw new errors_js_1.WeaviateQueryError(err.message, 'GraphQL'); - }); - }; - this.doGroupBy = (query) => { - return query - .do() - .then(({ data }) => - data.Aggregate[this.name].map((item) => { - const { groupedBy, meta } = item, - rest = __rest(item, ['groupedBy', 'meta']); - return { - groupedBy: { - prop: groupedBy.path[0], - value: groupedBy.value, - }, - properties: rest.length > 0 ? rest : undefined, - totalCount: meta === null || meta === void 0 ? void 0 : meta.count, - }; - }) - ) - .catch((err) => { - throw new errors_js_1.WeaviateQueryError(err.message, 'GraphQL'); - }); - }; - this.connection = connection; - this.name = name; - this.dbVersionSupport = dbVersionSupport; - this.consistencyLevel = consistencyLevel; - this.tenant = tenant; - this.groupBy = { - nearImage: (image, opts) => - __awaiter(this, void 0, void 0, function* () { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters, - opts === null || opts === void 0 ? void 0 : opts.groupBy - ).withNearImage({ - image: yield (0, index_js_2.toBase64FromMedia)(image), - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts === null || opts === void 0 ? void 0 : opts.objectLimit); - } - return this.doGroupBy(builder); - }), - nearObject: (id, opts) => { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters, - opts === null || opts === void 0 ? void 0 : opts.groupBy - ).withNearObject({ - id: id, - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts.objectLimit); - } - return this.doGroupBy(builder); - }, - nearText: (query, opts) => { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters, - opts === null || opts === void 0 ? void 0 : opts.groupBy - ).withNearText({ - concepts: Array.isArray(query) ? query : [query], - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts.objectLimit); - } - return this.doGroupBy(builder); - }, - nearVector: (vector, opts) => { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters, - opts === null || opts === void 0 ? void 0 : opts.groupBy - ).withNearVector({ - vector: vector, - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts.objectLimit); - } - return this.doGroupBy(builder); - }, - overAll: (opts) => { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters, - opts === null || opts === void 0 ? void 0 : opts.groupBy - ); - return this.doGroupBy(builder); - }, - }; - } - query() { - return new index_js_1.Aggregator(this.connection); - } - base(metrics, filters, groupBy) { - let fields = 'meta { count }'; - let builder = this.query().withClassName(this.name); - if (metrics) { - if (Array.isArray(metrics)) { - fields += metrics.map((m) => this.metrics(m)).join(' '); - } else { - fields += this.metrics(metrics); - } - } - if (groupBy) { - builder = builder.withGroupBy(typeof groupBy === 'string' ? [groupBy] : [groupBy.property]); - fields += 'groupedBy { path value }'; - if (typeof groupBy !== 'string' && (groupBy === null || groupBy === void 0 ? void 0 : groupBy.limit)) { - builder = builder.withLimit(groupBy.limit); - } - } - if (fields !== '') { - builder = builder.withFields(fields); - } - if (filters) { - builder = builder.withWhere(index_js_3.Serialize.filtersREST(filters)); - } - if (this.tenant) { - builder = builder.withTenant(this.tenant); - } - return builder; - } - metrics(metrics) { - let body = ''; - const { kind, propertyName } = metrics, - rest = __rest(metrics, ['kind', 'propertyName']); - switch (kind) { - case 'text': { - const _a = rest, - { minOccurrences } = _a, - restText = __rest(_a, ['minOccurrences']); - body = Object.entries(restText) - .map(([key, value]) => { - if (value) { - return value instanceof Object - ? `topOccurrences${minOccurrences ? `(limit: ${minOccurrences})` : ''} { ${ - value.occurs ? 'occurs' : '' - } ${value.value ? 'value' : ''} }` - : key; - } - }) - .join(' '); - break; - } - default: - body = Object.entries(rest) - .map(([key, value]) => (value ? key : '')) - .join(' '); - } - return `${propertyName} { ${body} }`; - } - static use(connection, name, dbVersionSupport, consistencyLevel, tenant) { - return new AggregateManager(connection, name, dbVersionSupport, consistencyLevel, tenant); - } - nearImage(image, opts) { - return __awaiter(this, void 0, void 0, function* () { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters - ).withNearImage({ - image: yield (0, index_js_2.toBase64FromMedia)(image), - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts === null || opts === void 0 ? void 0 : opts.objectLimit); - } - return this.do(builder); - }); - } - nearObject(id, opts) { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters - ).withNearObject({ - id: id, - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts.objectLimit); - } - return this.do(builder); - } - nearText(query, opts) { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters - ).withNearText({ - concepts: Array.isArray(query) ? query : [query], - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts.objectLimit); - } - return this.do(builder); - } - nearVector(vector, opts) { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters - ).withNearVector({ - vector: vector, - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts.objectLimit); - } - return this.do(builder); - } - overAll(opts) { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters - ); - return this.do(builder); - } -} -exports.default = AggregateManager.use; diff --git a/dist/node/cjs/collections/backup/client.d.ts b/dist/node/cjs/collections/backup/client.d.ts deleted file mode 100644 index c501f7e2..00000000 --- a/dist/node/cjs/collections/backup/client.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -import Connection from '../../connection/index.js'; -import { - BackupArgs, - BackupCancelArgs, - BackupConfigCreate, - BackupConfigRestore, - BackupReturn, - BackupStatusArgs, - BackupStatusReturn, -} from './types.js'; -export declare const backup: (connection: Connection) => { - cancel: (args: BackupCancelArgs) => Promise; - create: (args: BackupArgs) => Promise; - getCreateStatus: (args: BackupStatusArgs) => Promise; - getRestoreStatus: (args: BackupStatusArgs) => Promise; - restore: (args: BackupArgs) => Promise; -}; -export interface Backup { - /** - * Cancel a backup. - * - * @param {BackupCancelArgs} args The arguments for the request. - * @returns {Promise} Whether the backup was canceled. - * @throws {WeaviateInvalidInputError} If the input is invalid. - * @throws {WeaviateBackupCancellationError} If the backup cancellation fails. - */ - cancel(args: BackupCancelArgs): Promise; - /** - * Create a backup of the database. - * - * @param {BackupArgs} args The arguments for the request. - * @returns {Promise} The response from Weaviate. - * @throws {WeaviateInvalidInputError} If the input is invalid. - * @throws {WeaviateBackupFailed} If the backup creation fails. - * @throws {WeaviateBackupCanceled} If the backup creation is canceled. - */ - create(args: BackupArgs): Promise; - /** - * Get the status of a backup creation. - * - * @param {BackupStatusArgs} args The arguments for the request. - * @returns {Promise} The status of the backup creation. - * @throws {WeaviateInvalidInputError} If the input is invalid. - */ - getCreateStatus(args: BackupStatusArgs): Promise; - /** - * Get the status of a backup restore. - * - * @param {BackupStatusArgs} args The arguments for the request. - * @returns {Promise} The status of the backup restore. - * @throws {WeaviateInvalidInputError} If the input is invalid. - */ - getRestoreStatus(args: BackupStatusArgs): Promise; - /** - * Restore a backup of the database. - * - * @param {BackupArgs} args The arguments for the request. - * @returns {Promise} The response from Weaviate. - * @throws {WeaviateInvalidInputError} If the input is invalid. - * @throws {WeaviateBackupFailed} If the backup restoration fails. - * @throws {WeaviateBackupCanceled} If the backup restoration is canceled. - */ - restore(args: BackupArgs): Promise; -} diff --git a/dist/node/cjs/collections/backup/client.js b/dist/node/cjs/collections/backup/client.js deleted file mode 100644 index ad2c3eae..00000000 --- a/dist/node/cjs/collections/backup/client.js +++ /dev/null @@ -1,219 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.backup = void 0; -const index_js_1 = require('../../backup/index.js'); -const validation_js_1 = require('../../backup/validation.js'); -const errors_js_1 = require('../../errors.js'); -const backup = (connection) => { - const parseStatus = (res) => { - if (res.id === undefined) { - throw new errors_js_1.WeaviateUnexpectedResponseError('Backup ID is undefined in response'); - } - if (res.path === undefined) { - throw new errors_js_1.WeaviateUnexpectedResponseError('Backup path is undefined in response'); - } - if (res.status === undefined) { - throw new errors_js_1.WeaviateUnexpectedResponseError('Backup status is undefined in response'); - } - return { - id: res.id, - error: res.error, - path: res.path, - status: res.status, - }; - }; - const parseResponse = (res) => { - if (res.id === undefined) { - throw new errors_js_1.WeaviateUnexpectedResponseError('Backup ID is undefined in response'); - } - if (res.backend === undefined) { - throw new errors_js_1.WeaviateUnexpectedResponseError('Backup backend is undefined in response'); - } - if (res.path === undefined) { - throw new errors_js_1.WeaviateUnexpectedResponseError('Backup path is undefined in response'); - } - if (res.status === undefined) { - throw new errors_js_1.WeaviateUnexpectedResponseError('Backup status is undefined in response'); - } - return { - id: res.id, - backend: res.backend, - collections: res.classes ? res.classes : [], - error: res.error, - path: res.path, - status: res.status, - }; - }; - const getCreateStatus = (args) => { - return new index_js_1.BackupCreateStatusGetter(connection) - .withBackupId(args.backupId) - .withBackend(args.backend) - .do() - .then(parseStatus); - }; - const getRestoreStatus = (args) => { - return new index_js_1.BackupRestoreStatusGetter(connection) - .withBackupId(args.backupId) - .withBackend(args.backend) - .do() - .then(parseStatus); - }; - return { - cancel: (args) => - __awaiter(void 0, void 0, void 0, function* () { - let errors = []; - errors = errors - .concat((0, validation_js_1.validateBackupId)(args.backupId)) - .concat((0, validation_js_1.validateBackend)(args.backend)); - if (errors.length > 0) { - throw new errors_js_1.WeaviateInvalidInputError(errors.join(', ')); - } - try { - yield connection.delete(`/backups/${args.backend}/${args.backupId}`, undefined, false); - } catch (err) { - if (err instanceof errors_js_1.WeaviateUnexpectedStatusCodeError) { - if (err.code === 404) { - return false; - } - throw new errors_js_1.WeaviateBackupCancellationError(err.message); - } - } - return true; - }), - create: (args) => - __awaiter(void 0, void 0, void 0, function* () { - let builder = new index_js_1.BackupCreator( - connection, - new index_js_1.BackupCreateStatusGetter(connection) - ) - .withBackupId(args.backupId) - .withBackend(args.backend); - if (args.includeCollections) { - builder = builder.withIncludeClassNames(...args.includeCollections); - } - if (args.excludeCollections) { - builder = builder.withExcludeClassNames(...args.excludeCollections); - } - if (args.config) { - builder = builder.withConfig({ - ChunkSize: args.config.chunkSize, - CompressionLevel: args.config.compressionLevel, - CPUPercentage: args.config.cpuPercentage, - }); - } - let res; - try { - res = yield builder.do(); - } catch (err) { - throw new errors_js_1.WeaviateBackupFailed(`Backup creation failed: ${err}`, 'creation'); - } - if (res.status === 'FAILED') { - throw new errors_js_1.WeaviateBackupFailed(`Backup creation failed: ${res.error}`, 'creation'); - } - let status; - if (args.waitForCompletion) { - let wait = true; - while (wait) { - const ret = yield getCreateStatus(args); // eslint-disable-line no-await-in-loop - if (ret.status === 'SUCCESS') { - wait = false; - status = ret; - } - if (ret.status === 'FAILED') { - throw new errors_js_1.WeaviateBackupFailed(ret.error ? ret.error : '', 'creation'); - } - if (ret.status === 'CANCELED') { - throw new errors_js_1.WeaviateBackupCanceled('creation'); - } - yield new Promise((resolve) => setTimeout(resolve, 1000)); // eslint-disable-line no-await-in-loop - } - } - return status ? Object.assign(Object.assign({}, parseResponse(res)), status) : parseResponse(res); - }), - getCreateStatus: getCreateStatus, - getRestoreStatus: getRestoreStatus, - restore: (args) => - __awaiter(void 0, void 0, void 0, function* () { - let builder = new index_js_1.BackupRestorer( - connection, - new index_js_1.BackupRestoreStatusGetter(connection) - ) - .withBackupId(args.backupId) - .withBackend(args.backend); - if (args.includeCollections) { - builder = builder.withIncludeClassNames(...args.includeCollections); - } - if (args.excludeCollections) { - builder = builder.withExcludeClassNames(...args.excludeCollections); - } - if (args.config) { - builder = builder.withConfig({ - CPUPercentage: args.config.cpuPercentage, - }); - } - let res; - try { - res = yield builder.do(); - } catch (err) { - throw new errors_js_1.WeaviateBackupFailed(`Backup restoration failed: ${err}`, 'restoration'); - } - if (res.status === 'FAILED') { - throw new errors_js_1.WeaviateBackupFailed( - `Backup restoration failed: ${res.error}`, - 'restoration' - ); - } - let status; - if (args.waitForCompletion) { - let wait = true; - while (wait) { - const ret = yield getRestoreStatus(args); // eslint-disable-line no-await-in-loop - if (ret.status === 'SUCCESS') { - wait = false; - status = ret; - } - if (ret.status === 'FAILED') { - throw new errors_js_1.WeaviateBackupFailed(ret.error ? ret.error : '', 'restoration'); - } - if (ret.status === 'CANCELED') { - throw new errors_js_1.WeaviateBackupCanceled('restoration'); - } - yield new Promise((resolve) => setTimeout(resolve, 1000)); // eslint-disable-line no-await-in-loop - } - } - return status ? Object.assign(Object.assign({}, parseResponse(res)), status) : parseResponse(res); - }), - }; -}; -exports.backup = backup; diff --git a/dist/node/cjs/collections/backup/collection.d.ts b/dist/node/cjs/collections/backup/collection.d.ts deleted file mode 100644 index 443de94b..00000000 --- a/dist/node/cjs/collections/backup/collection.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { Backend } from '../../backup/index.js'; -import Connection from '../../connection/index.js'; -import { BackupReturn, BackupStatusArgs, BackupStatusReturn } from './types.js'; -/** The arguments required to create and restore backups. */ -export type BackupCollectionArgs = { - /** The ID of the backup. */ - backupId: string; - /** The backend to use for the backup. */ - backend: Backend; - /** The collections to include in the backup. */ - waitForCompletion?: boolean; -}; -export declare const backupCollection: ( - connection: Connection, - name: string -) => { - create: (args: BackupCollectionArgs) => Promise; - getCreateStatus: (args: BackupStatusArgs) => Promise; - getRestoreStatus: (args: BackupStatusArgs) => Promise; - restore: (args: BackupCollectionArgs) => Promise; -}; -export interface BackupCollection { - /** - * Create a backup of this collection. - * - * @param {BackupArgs} args The arguments for the request. - * @returns {Promise} The response from Weaviate. - * @throws {WeaviateInvalidInputError} If the input is invalid. - * @throws {WeaviateBackupFailed} If the backup creation fails. - * @throws {WeaviateBackupCanceled} If the backup creation is canceled. - */ - create(args: BackupCollectionArgs): Promise; - /** - * Get the status of a backup. - * - * @param {BackupStatusArgs} args The arguments for the request. - * @returns {Promise} The status of the backup. - * @throws {WeaviateInvalidInputError} If the input is invalid. - */ - getCreateStatus(args: BackupStatusArgs): Promise; - /** - * Get the status of a restore. - * - * @param {BackupStatusArgs} args The arguments for the request. - * @returns {Promise} The status of the restore. - * @throws {WeaviateInvalidInputError} If the input is invalid. - */ - getRestoreStatus(args: BackupStatusArgs): Promise; - /** - * Restore a backup of this collection. - * - * @param {BackupArgs} args The arguments for the request. - * @returns {Promise} The response from Weaviate. - * @throws {WeaviateInvalidInputError} If the input is invalid. - * @throws {WeaviateBackupFailed} If the backup restoration fails. - * @throws {WeaviateBackupCanceled} If the backup restoration is canceled. - */ - restore(args: BackupCollectionArgs): Promise; -} diff --git a/dist/node/cjs/collections/backup/collection.js b/dist/node/cjs/collections/backup/collection.js deleted file mode 100644 index 373bcc02..00000000 --- a/dist/node/cjs/collections/backup/collection.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.backupCollection = void 0; -const client_js_1 = require('./client.js'); -const backupCollection = (connection, name) => { - const handler = (0, client_js_1.backup)(connection); - return { - create: (args) => handler.create(Object.assign(Object.assign({}, args), { includeCollections: [name] })), - getCreateStatus: handler.getCreateStatus, - getRestoreStatus: handler.getRestoreStatus, - restore: (args) => - handler.restore(Object.assign(Object.assign({}, args), { includeCollections: [name] })), - }; -}; -exports.backupCollection = backupCollection; diff --git a/dist/node/cjs/collections/backup/index.d.ts b/dist/node/cjs/collections/backup/index.d.ts deleted file mode 100644 index e4c6f1b1..00000000 --- a/dist/node/cjs/collections/backup/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type { Backup } from './client.js'; -export type { BackupCollection, BackupCollectionArgs } from './collection.js'; -export type { BackupArgs, BackupConfigCreate, BackupConfigRestore, BackupStatusArgs } from './types.js'; diff --git a/dist/node/cjs/collections/backup/index.js b/dist/node/cjs/collections/backup/index.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/backup/index.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/backup/types.d.ts b/dist/node/cjs/collections/backup/types.d.ts deleted file mode 100644 index 8e509837..00000000 --- a/dist/node/cjs/collections/backup/types.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Backend, BackupCompressionLevel } from '../../index.js'; -/** The status of a backup operation */ -export type BackupStatus = 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED' | 'CANCELED'; -/** The status of a backup operation */ -export type BackupStatusReturn = { - /** The ID of the backup */ - id: string; - /** The error message if the backup failed */ - error?: string; - /** The path to the backup */ - path: string; - /** The status of the backup */ - status: BackupStatus; -}; -/** The return type of a backup creation or restoration operation */ -export type BackupReturn = BackupStatusReturn & { - /** The backend to which the backup was created or restored */ - backend: Backend; - /** The collections that were included in the backup */ - collections: string[]; -}; -/** Configuration options available when creating a backup */ -export type BackupConfigCreate = { - /** The size of the chunks to use for the backup. */ - chunkSize?: number; - /** The standard of compression to use for the backup. */ - compressionLevel?: BackupCompressionLevel; - /** The percentage of CPU to use for the backup creation job. */ - cpuPercentage?: number; -}; -/** Configuration options available when restoring a backup */ -export type BackupConfigRestore = { - /** The percentage of CPU to use for the backuop restoration job. */ - cpuPercentage?: number; -}; -/** The arguments required to create and restore backups. */ -export type BackupArgs = { - /** The ID of the backup. */ - backupId: string; - /** The backend to use for the backup. */ - backend: Backend; - /** The collections to include in the backup. */ - includeCollections?: string[]; - /** The collections to exclude from the backup. */ - excludeCollections?: string[]; - /** Whether to wait for the backup to complete. */ - waitForCompletion?: boolean; - /** The configuration options for the backup. */ - config?: C; -}; -/** The arguments required to get the status of a backup. */ -export type BackupStatusArgs = { - /** The ID of the backup. */ - backupId: string; - /** The backend to use for the backup. */ - backend: Backend; -}; -/** The arguments required to cancel a backup. */ -export type BackupCancelArgs = { - /** The ID of the backup. */ - backupId: string; - /** The backend to use for the backup. */ - backend: Backend; -}; diff --git a/dist/node/cjs/collections/backup/types.js b/dist/node/cjs/collections/backup/types.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/backup/types.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/cluster/index.d.ts b/dist/node/cjs/collections/cluster/index.d.ts deleted file mode 100644 index 4649f9ae..00000000 --- a/dist/node/cjs/collections/cluster/index.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import Connection from '../../connection/index.js'; -import { BatchStats, NodeShardStatus, NodeStats } from '../../openapi/types.js'; -export type Output = 'minimal' | 'verbose' | undefined; -export type NodesOptions = { - /** The name of the collection to get the status of. */ - collection?: string; - /** Set the desired output verbosity level. Can be `minimal | verbose | undefined` with `undefined` defaulting to `minimal`. */ - output: O; -}; -export type Node = { - name: string; - status: 'HEALTHY' | 'UNHEALTHY' | 'UNAVAILABLE'; - version: string; - gitHash: string; - stats: O extends 'minimal' | undefined ? undefined : Required; - batchStats: Required; - shards: O extends 'minimal' | undefined ? null : Required[]; -}; -declare const cluster: (connection: Connection) => { - nodes: (opts?: NodesOptions | undefined) => Promise[]>; -}; -export default cluster; -export interface Cluster { - /** - * Get the status of all nodes in the cluster. - * - * @param {NodesOptions} [opts] The options for the request. - * @returns {Promise[]>} The status of all nodes in the cluster. - */ - nodes: (opts?: NodesOptions) => Promise[]>; -} diff --git a/dist/node/cjs/collections/cluster/index.js b/dist/node/cjs/collections/cluster/index.js deleted file mode 100644 index b24f8a25..00000000 --- a/dist/node/cjs/collections/cluster/index.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const index_js_1 = require('../../cluster/index.js'); -const cluster = (connection) => { - return { - nodes: (opts) => { - let builder = new index_js_1.NodesStatusGetter(connection).withOutput( - (opts === null || opts === void 0 ? void 0 : opts.output) ? opts.output : 'minimal' - ); - if (opts === null || opts === void 0 ? void 0 : opts.collection) { - builder = builder.withClassName(opts.collection); - } - return builder.do().then((res) => res.nodes); - }, - }; -}; -exports.default = cluster; diff --git a/dist/node/cjs/collections/collection/index.d.ts b/dist/node/cjs/collections/collection/index.d.ts deleted file mode 100644 index 1ba5de99..00000000 --- a/dist/node/cjs/collections/collection/index.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -import Connection from '../../connection/grpc.js'; -import { ConsistencyLevel } from '../../data/index.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { Aggregate, Metrics } from '../aggregate/index.js'; -import { BackupCollection } from '../backup/collection.js'; -import { Config } from '../config/index.js'; -import { Data } from '../data/index.js'; -import { Filter } from '../filters/index.js'; -import { Generate } from '../generate/index.js'; -import { Iterator } from '../iterator/index.js'; -import { Query } from '../query/index.js'; -import { Sort } from '../sort/index.js'; -import { TenantBase, Tenants } from '../tenants/index.js'; -import { QueryMetadata, QueryProperty, QueryReference } from '../types/index.js'; -import { MultiTargetVector } from '../vectors/multiTargetVector.js'; -export interface Collection { - /** This namespace includes all the querying methods available to you when using Weaviate's standard aggregation capabilities. */ - aggregate: Aggregate; - /** This namespace includes all the backup methods available to you when backing up a collection in Weaviate. */ - backup: BackupCollection; - /** This namespace includes all the CRUD methods available to you when modifying the configuration of the collection in Weaviate. */ - config: Config; - /** This namespace includes all the CUD methods available to you when modifying the data of the collection in Weaviate. */ - data: Data; - /** This namespace includes the methods by which you can create the `FilterValue` values for use when filtering queries over your collection. */ - filter: Filter; - /** This namespace includes all the querying methods available to you when using Weaviate's generative capabilities. */ - generate: Generate; - /** This namespace includes the methods by which you can create the `MetricsX` values for use when aggregating over your collection. */ - metrics: Metrics; - /** The name of the collection. */ - name: N; - /** This namespace includes all the querying methods available to you when using Weaviate's standard query capabilities. */ - query: Query; - /** This namespaces includes the methods by which you can create the `Sorting` values for use when sorting queries over your collection. */ - sort: Sort; - /** This namespace includes all the CRUD methods available to you when modifying the tenants of a multi-tenancy-enabled collection in Weaviate. */ - tenants: Tenants; - /** This namespaces includes the methods by which you cna create the `MultiTargetVectorJoin` values for use when performing multi-target vector searches over your collection. */ - multiTargetVector: MultiTargetVector; - /** - * Use this method to check if the collection exists in Weaviate. - * - * @returns {Promise} A promise that resolves to `true` if the collection exists, and `false` otherwise. - */ - exists: () => Promise; - /** - * Use this method to return an iterator over the objects in the collection. - * - * This iterator keeps a record of the last object that it returned to be used in each subsequent call to Weaviate. - * Once the collection is exhausted, the iterator exits. - * - * @param {IteratorOptions} opts The options to use when fetching objects from Weaviate. - * @returns {Iterator} An iterator over the objects in the collection as an async generator. - * - * @description If `return_properties` is not provided, all the properties of each object will be - * requested from Weaviate except for its vector as this is an expensive operation. Specify `include_vector` - * to request the vector back as well. In addition, if `return_references=None` then none of the references - * are returned. Use `wvc.QueryReference` to specify which references to return. - */ - iterator: (opts?: IteratorOptions) => Iterator; - /** - * Use this method to return a collection object specific to a single consistency level. - * - * If replication is not configured for this collection then Weaviate will throw an error. - * - * This method does not send a request to Weaviate. It only returns a new collection object that is specific to the consistency level you specify. - * - * @param {ConsistencyLevel} consistencyLevel The consistency level to use. - * @returns {Collection} A new collection object specific to the consistency level you specified. - */ - withConsistency: (consistencyLevel: ConsistencyLevel) => Collection; - /** - * Use this method to return a collection object specific to a single tenant. - * - * If multi-tenancy is not configured for this collection then Weaviate will throw an error. - * - * This method does not send a request to Weaviate. It only returns a new collection object that is specific to the tenant you specify. - * - * @typedef {TenantBase} TT A type that extends TenantBase. - * @param {string | TT} tenant The tenant name or tenant object to use. - * @returns {Collection} A new collection object specific to the tenant you specified. - */ - withTenant: (tenant: string | TT) => Collection; -} -export type IteratorOptions = { - includeVector?: boolean | string[]; - returnMetadata?: QueryMetadata; - returnProperties?: QueryProperty[]; - returnReferences?: QueryReference[]; -}; -declare const collection: ( - connection: Connection, - name: N, - dbVersionSupport: DbVersionSupport, - consistencyLevel?: ConsistencyLevel, - tenant?: string -) => Collection; -export default collection; diff --git a/dist/node/cjs/collections/collection/index.js b/dist/node/cjs/collections/collection/index.js deleted file mode 100644 index fe51724c..00000000 --- a/dist/node/cjs/collections/collection/index.js +++ /dev/null @@ -1,128 +0,0 @@ -'use strict'; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, 'default', { enumerable: true, value: v }); - } - : function (o, v) { - o['default'] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) - for (var k in mod) - if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const errors_js_1 = require('../../errors.js'); -const classExists_js_1 = __importDefault(require('../../schema/classExists.js')); -const index_js_1 = __importStar(require('../aggregate/index.js')); -const collection_js_1 = require('../backup/collection.js'); -const index_js_2 = __importDefault(require('../config/index.js')); -const index_js_3 = __importDefault(require('../data/index.js')); -const index_js_4 = __importDefault(require('../filters/index.js')); -const index_js_5 = __importDefault(require('../generate/index.js')); -const index_js_6 = require('../iterator/index.js'); -const index_js_7 = __importDefault(require('../query/index.js')); -const index_js_8 = __importDefault(require('../sort/index.js')); -const index_js_9 = __importDefault(require('../tenants/index.js')); -const multiTargetVector_js_1 = __importDefault(require('../vectors/multiTargetVector.js')); -const isString = (value) => typeof value === 'string'; -const capitalizeCollectionName = (name) => name.charAt(0).toUpperCase() + name.slice(1); -const collection = (connection, name, dbVersionSupport, consistencyLevel, tenant) => { - if (!isString(name)) { - throw new errors_js_1.WeaviateInvalidInputError( - `The collection name must be a string, got: ${typeof name}` - ); - } - const capitalizedName = capitalizeCollectionName(name); - const queryCollection = (0, index_js_7.default)( - connection, - capitalizedName, - dbVersionSupport, - consistencyLevel, - tenant - ); - return { - aggregate: (0, index_js_1.default)( - connection, - capitalizedName, - dbVersionSupport, - consistencyLevel, - tenant - ), - backup: (0, collection_js_1.backupCollection)(connection, capitalizedName), - config: (0, index_js_2.default)(connection, capitalizedName, dbVersionSupport, tenant), - data: (0, index_js_3.default)(connection, capitalizedName, dbVersionSupport, consistencyLevel, tenant), - filter: (0, index_js_4.default)(), - generate: (0, index_js_5.default)( - connection, - capitalizedName, - dbVersionSupport, - consistencyLevel, - tenant - ), - metrics: (0, index_js_1.metrics)(), - multiTargetVector: (0, multiTargetVector_js_1.default)(), - name: name, - query: queryCollection, - sort: (0, index_js_8.default)(), - tenants: (0, index_js_9.default)(connection, capitalizedName, dbVersionSupport), - exists: () => new classExists_js_1.default(connection).withClassName(capitalizedName).do(), - iterator: (opts) => - new index_js_6.Iterator((limit, after) => - queryCollection - .fetchObjects({ - limit, - after, - includeVector: opts === null || opts === void 0 ? void 0 : opts.includeVector, - returnMetadata: opts === null || opts === void 0 ? void 0 : opts.returnMetadata, - returnProperties: opts === null || opts === void 0 ? void 0 : opts.returnProperties, - returnReferences: opts === null || opts === void 0 ? void 0 : opts.returnReferences, - }) - .then((res) => res.objects) - ), - withConsistency: (consistencyLevel) => - collection(connection, capitalizedName, dbVersionSupport, consistencyLevel, tenant), - withTenant: (tenant) => - collection( - connection, - capitalizedName, - dbVersionSupport, - consistencyLevel, - typeof tenant === 'string' ? tenant : tenant.name - ), - }; -}; -exports.default = collection; diff --git a/dist/node/cjs/collections/config/classes.d.ts b/dist/node/cjs/collections/config/classes.d.ts deleted file mode 100644 index 1822bb06..00000000 --- a/dist/node/cjs/collections/config/classes.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - WeaviateClass, - WeaviateInvertedIndexConfig, - WeaviateReplicationConfig, - WeaviateVectorIndexConfig, - WeaviateVectorsConfig, -} from '../../openapi/types.js'; -import { - InvertedIndexConfigUpdate, - ReplicationConfigUpdate, - VectorConfigUpdate, - VectorIndexConfigFlatUpdate, - VectorIndexConfigHNSWUpdate, -} from '../configure/types/index.js'; -import { CollectionConfigUpdate, VectorIndexType } from './types/index.js'; -export declare class MergeWithExisting { - static schema( - current: WeaviateClass, - supportsNamedVectors: boolean, - update?: CollectionConfigUpdate - ): WeaviateClass; - static invertedIndex( - current: WeaviateInvertedIndexConfig, - update?: InvertedIndexConfigUpdate - ): WeaviateInvertedIndexConfig; - static replication( - current: WeaviateReplicationConfig, - update?: ReplicationConfigUpdate - ): WeaviateReplicationConfig; - static vectors( - current: WeaviateVectorsConfig, - update?: VectorConfigUpdate[] - ): WeaviateVectorsConfig; - static flat( - current: WeaviateVectorIndexConfig, - update?: VectorIndexConfigFlatUpdate - ): WeaviateVectorIndexConfig; - static hnsw( - current: WeaviateVectorIndexConfig, - update?: VectorIndexConfigHNSWUpdate - ): WeaviateVectorIndexConfig; -} diff --git a/dist/node/cjs/collections/config/classes.js b/dist/node/cjs/collections/config/classes.js deleted file mode 100644 index 12136ab6..00000000 --- a/dist/node/cjs/collections/config/classes.js +++ /dev/null @@ -1,134 +0,0 @@ -'use strict'; -var __rest = - (this && this.__rest) || - function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === 'function') - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.MergeWithExisting = void 0; -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -const errors_js_1 = require('../../errors.js'); -const parsing_js_1 = require('../configure/parsing.js'); -class MergeWithExisting { - static schema(current, supportsNamedVectors, update) { - var _a; - if (update === undefined) return current; - if (update.description !== undefined) current.description = update.description; - if (update.invertedIndex !== undefined) - current.invertedIndexConfig = MergeWithExisting.invertedIndex( - current.invertedIndexConfig, - update.invertedIndex - ); - if (update.replication !== undefined) - current.replicationConfig = MergeWithExisting.replication( - current.replicationConfig, - update.replication - ); - if (update.vectorizers !== undefined) { - if (Array.isArray(update.vectorizers)) { - current.vectorConfig = MergeWithExisting.vectors(current.vectorConfig, update.vectorizers); - } else if (supportsNamedVectors && current.vectorConfig !== undefined) { - const updateVectorizers = Object.assign(Object.assign({}, update.vectorizers), { name: 'default' }); - current.vectorConfig = MergeWithExisting.vectors(current.vectorConfig, [updateVectorizers]); - } else { - current.vectorIndexConfig = - ((_a = update.vectorizers) === null || _a === void 0 ? void 0 : _a.vectorIndex.name) === 'hnsw' - ? MergeWithExisting.hnsw(current.vectorIndexConfig, update.vectorizers.vectorIndex.config) - : MergeWithExisting.flat(current.vectorIndexConfig, update.vectorizers.vectorIndex.config); - } - } - return current; - } - static invertedIndex(current, update) { - if (current === undefined) throw Error('Inverted index config is missing from the class schema.'); - if (update === undefined) return current; - const { bm25, stopwords } = update, - rest = __rest(update, ['bm25', 'stopwords']); - const merged = Object.assign(Object.assign({}, current), rest); - if (bm25 !== undefined) merged.bm25 = Object.assign(Object.assign({}, current.bm25), bm25); - if (stopwords !== undefined) - merged.stopwords = Object.assign(Object.assign({}, current.stopwords), stopwords); - return merged; - } - static replication(current, update) { - if (current === undefined) throw Error('Replication config is missing from the class schema.'); - if (update === undefined) return current; - return Object.assign(Object.assign({}, current), update); - } - static vectors(current, update) { - if (current === undefined) throw Error('Vector index config is missing from the class schema.'); - if (update === undefined) return current; - update.forEach((v) => { - const existing = current[v.name]; - if (existing !== undefined) { - current[v.name].vectorIndexConfig = - v.vectorIndex.name === 'hnsw' - ? MergeWithExisting.hnsw(existing.vectorIndexConfig, v.vectorIndex.config) - : MergeWithExisting.flat(existing.vectorIndexConfig, v.vectorIndex.config); - } - }); - return current; - } - static flat(current, update) { - if (update === undefined) return current; - if ( - (parsing_js_1.QuantizerGuards.isPQUpdate(update.quantizer) && - (current === null || current === void 0 ? void 0 : current.bq).enabled) || - (parsing_js_1.QuantizerGuards.isBQUpdate(update.quantizer) && - (current === null || current === void 0 ? void 0 : current.pq).enabled) - ) - throw Error(`Cannot update the quantizer type of an enabled vector index.`); - const { quantizer } = update, - rest = __rest(update, ['quantizer']); - const merged = Object.assign(Object.assign({}, current), rest); - if (parsing_js_1.QuantizerGuards.isBQUpdate(quantizer)) { - const { type } = quantizer, - quant = __rest(quantizer, ['type']); - merged.bq = Object.assign(Object.assign(Object.assign({}, current.bq), quant), { enabled: true }); - } - return merged; - } - static hnsw(current, update) { - if (update === undefined) return current; - if ( - (parsing_js_1.QuantizerGuards.isBQUpdate(update.quantizer) && - (((current === null || current === void 0 ? void 0 : current.pq) || {}).enabled || - ((current === null || current === void 0 ? void 0 : current.sq) || {}).enabled)) || - (parsing_js_1.QuantizerGuards.isPQUpdate(update.quantizer) && - (((current === null || current === void 0 ? void 0 : current.bq) || {}).enabled || - ((current === null || current === void 0 ? void 0 : current.sq) || {}).enabled)) || - (parsing_js_1.QuantizerGuards.isSQUpdate(update.quantizer) && - (((current === null || current === void 0 ? void 0 : current.pq) || {}).enabled || - ((current === null || current === void 0 ? void 0 : current.bq) || {}).enabled)) - ) - throw new errors_js_1.WeaviateInvalidInputError( - `Cannot update the quantizer type of an enabled vector index.` - ); - const { quantizer } = update, - rest = __rest(update, ['quantizer']); - const merged = Object.assign(Object.assign({}, current), rest); - if (parsing_js_1.QuantizerGuards.isBQUpdate(quantizer)) { - const { type } = quantizer, - quant = __rest(quantizer, ['type']); - merged.bq = Object.assign(Object.assign(Object.assign({}, current.bq), quant), { enabled: true }); - } - if (parsing_js_1.QuantizerGuards.isPQUpdate(quantizer)) { - const { type } = quantizer, - quant = __rest(quantizer, ['type']); - merged.pq = Object.assign(Object.assign(Object.assign({}, current.pq), quant), { enabled: true }); - } - if (parsing_js_1.QuantizerGuards.isSQUpdate(quantizer)) { - const { type } = quantizer, - quant = __rest(quantizer, ['type']); - merged.sq = Object.assign(Object.assign(Object.assign({}, current.sq), quant), { enabled: true }); - } - return merged; - } -} -exports.MergeWithExisting = MergeWithExisting; diff --git a/dist/node/cjs/collections/config/index.d.ts b/dist/node/cjs/collections/config/index.d.ts deleted file mode 100644 index 8452d1be..00000000 --- a/dist/node/cjs/collections/config/index.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -import Connection from '../../connection/index.js'; -import { WeaviateShardStatus } from '../../openapi/types.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { - PropertyConfigCreate, - ReferenceMultiTargetConfigCreate, - ReferenceSingleTargetConfigCreate, -} from '../configure/types/index.js'; -import { - BQConfig, - CollectionConfig, - CollectionConfigUpdate, - PQConfig, - QuantizerConfig, - SQConfig, - VectorIndexConfig, - VectorIndexConfigDynamic, - VectorIndexConfigFlat, - VectorIndexConfigHNSW, -} from './types/index.js'; -declare const config: ( - connection: Connection, - name: string, - dbVersionSupport: DbVersionSupport, - tenant?: string -) => Config; -export default config; -export interface Config { - /** - * Add a property to the collection in Weaviate. - * - * @param {PropertyConfigCreate} property The property configuration. - * @returns {Promise} A promise that resolves when the property has been added. - */ - addProperty: (property: PropertyConfigCreate) => Promise; - /** - * Add a reference to the collection in Weaviate. - * - * @param {ReferenceSingleTargetConfigCreate | ReferenceMultiTargetConfigCreate} reference The reference configuration. - * @returns {Promise} A promise that resolves when the reference has been added. - */ - addReference: ( - reference: ReferenceSingleTargetConfigCreate | ReferenceMultiTargetConfigCreate - ) => Promise; - /** - * Get the configuration for this collection from Weaviate. - * - * @returns {Promise>} A promise that resolves with the collection configuration. - */ - get: () => Promise; - /** - * Get the statuses of the shards of this collection. - * - * If the collection is multi-tenancy and you did not call `.with_tenant` then you - * will receive the statuses of all the tenants within the collection. Otherwise, call - * `.with_tenant` on the collection first and you will receive only that single shard. - * - * @returns {Promise[]>} A promise that resolves with the shard statuses. - */ - getShards: () => Promise[]>; - /** - * Update the status of one or all shards of this collection. - * - * @param {'READY' | 'READONLY'} status The new status of the shard(s). - * @param {string | string[]} [names] The name(s) of the shard(s) to update. If not provided, all shards will be updated. - * @returns {Promise[]>} A promise that resolves with the updated shard statuses. - */ - updateShards: ( - status: 'READY' | 'READONLY', - names?: string | string[] - ) => Promise[]>; - /** - * Update the configuration for this collection in Weaviate. - * - * Use the `weaviate.classes.Reconfigure` class to generate the necessary configuration objects for this method. - * - * @param {CollectionConfigUpdate} [config] The configuration to update. Only a subset of the actual collection configuration can be updated. - * @returns {Promise} A promise that resolves when the collection has been updated. - */ - update: (config?: CollectionConfigUpdate) => Promise; -} -export declare class VectorIndex { - static isHNSW(config?: VectorIndexConfig): config is VectorIndexConfigHNSW; - static isFlat(config?: VectorIndexConfig): config is VectorIndexConfigFlat; - static isDynamic(config?: VectorIndexConfig): config is VectorIndexConfigDynamic; -} -export declare class Quantizer { - static isPQ(config?: QuantizerConfig): config is PQConfig; - static isBQ(config?: QuantizerConfig): config is BQConfig; - static isSQ(config?: QuantizerConfig): config is SQConfig; -} -export declare const configGuards: { - quantizer: typeof Quantizer; - vectorIndex: typeof VectorIndex; -}; diff --git a/dist/node/cjs/collections/config/index.js b/dist/node/cjs/collections/config/index.js deleted file mode 100644 index c4b573c0..00000000 --- a/dist/node/cjs/collections/config/index.js +++ /dev/null @@ -1,146 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.configGuards = exports.Quantizer = exports.VectorIndex = void 0; -const errors_js_1 = require('../../errors.js'); -const classUpdater_js_1 = __importDefault(require('../../schema/classUpdater.js')); -const index_js_1 = require('../../schema/index.js'); -const shardsGetter_js_1 = __importDefault(require('../../schema/shardsGetter.js')); -const classes_js_1 = require('./classes.js'); -const utils_js_1 = require('./utils.js'); -const config = (connection, name, dbVersionSupport, tenant) => { - const getRaw = new index_js_1.ClassGetter(connection).withClassName(name).do; - return { - addProperty: (property) => - new index_js_1.PropertyCreator(connection) - .withClassName(name) - .withProperty((0, utils_js_1.resolveProperty)(property, [])) - .do() - .then(() => {}), - addReference: (reference) => - new index_js_1.PropertyCreator(connection) - .withClassName(name) - .withProperty((0, utils_js_1.resolveReference)(reference)) - .do() - .then(() => {}), - get: () => getRaw().then(utils_js_1.classToCollection), - getShards: () => { - let builder = new shardsGetter_js_1.default(connection).withClassName(name); - if (tenant) { - builder = builder.withTenant(tenant); - } - return builder.do().then((shards) => - shards.map((shard) => { - if (shard.name === undefined) - throw new errors_js_1.WeaviateDeserializationError('Shard name was not returned by Weaviate'); - if (shard.status === undefined) - throw new errors_js_1.WeaviateDeserializationError('Shard status was not returned by Weaviate'); - if (shard.vectorQueueSize === undefined) - throw new errors_js_1.WeaviateDeserializationError( - 'Shard vector queue size was not returned by Weaviate' - ); - return { name: shard.name, status: shard.status, vectorQueueSize: shard.vectorQueueSize }; - }) - ); - }, - updateShards: function (status, names) { - return __awaiter(this, void 0, void 0, function* () { - let shardNames; - if (names === undefined) { - shardNames = yield this.getShards().then((shards) => shards.map((s) => s.name)); - } else if (typeof names === 'string') { - shardNames = [names]; - } else { - shardNames = names; - } - return Promise.all( - shardNames.map((shardName) => - new index_js_1.ShardUpdater(connection) - .withClassName(name) - .withShardName(shardName) - .withStatus(status) - .do() - ) - ).then(() => this.getShards()); - }); - }, - update: (config) => { - return getRaw() - .then((current) => - __awaiter(void 0, void 0, void 0, function* () { - return classes_js_1.MergeWithExisting.schema( - current, - yield dbVersionSupport.supportsNamedVectors().then((s) => s.supports), - config - ); - }) - ) - .then((merged) => new classUpdater_js_1.default(connection).withClass(merged).do()) - .then(() => {}); - }, - }; -}; -exports.default = config; -class VectorIndex { - static isHNSW(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'hnsw'; - } - static isFlat(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'flat'; - } - static isDynamic(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'dynamic'; - } -} -exports.VectorIndex = VectorIndex; -class Quantizer { - static isPQ(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'pq'; - } - static isBQ(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'bq'; - } - static isSQ(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'sq'; - } -} -exports.Quantizer = Quantizer; -exports.configGuards = { - quantizer: Quantizer, - vectorIndex: VectorIndex, -}; diff --git a/dist/node/cjs/collections/config/types/generative.d.ts b/dist/node/cjs/collections/config/types/generative.d.ts deleted file mode 100644 index 05a627da..00000000 --- a/dist/node/cjs/collections/config/types/generative.d.ts +++ /dev/null @@ -1,144 +0,0 @@ -export type GenerativeOpenAIConfigBase = { - baseURL?: string; - frequencyPenaltyProperty?: number; - maxTokensProperty?: number; - presencePenaltyProperty?: number; - temperatureProperty?: number; - topPProperty?: number; -}; -export type GenerativeAWSConfig = { - region: string; - service: string; - model?: string; - endpoint?: string; -}; -export type GenerativeAnthropicConfig = { - maxTokens?: number; - model?: string; - stopSequences?: string[]; - temperature?: number; - topK?: number; - topP?: number; -}; -export type GenerativeAnyscaleConfig = { - model?: string; - temperature?: number; -}; -export type GenerativeCohereConfig = { - kProperty?: number; - model?: string; - maxTokensProperty?: number; - returnLikelihoodsProperty?: string; - stopSequencesProperty?: string[]; - temperatureProperty?: number; -}; -export type GenerativeDatabricksConfig = { - endpoint: string; - maxTokens?: number; - temperature?: number; - topK?: number; - topP?: number; -}; -export type GenerativeFriendliAIConfig = { - baseURL?: string; - maxTokens?: number; - model?: string; - temperature?: number; -}; -export type GenerativeMistralConfig = { - maxTokens?: number; - model?: string; - temperature?: number; -}; -export type GenerativeOctoAIConfig = { - baseURL?: string; - maxTokens?: number; - model?: string; - temperature?: number; -}; -export type GenerativeOllamaConfig = { - apiEndpoint?: string; - model?: string; -}; -export type GenerativeOpenAIConfig = GenerativeOpenAIConfigBase & { - model?: string; -}; -export type GenerativeAzureOpenAIConfig = GenerativeOpenAIConfigBase & { - resourceName: string; - deploymentId: string; -}; -/** @deprecated Use `GenerativeGoogleConfig` instead. */ -export type GenerativePaLMConfig = GenerativeGoogleConfig; -export type GenerativeGoogleConfig = { - apiEndpoint?: string; - maxOutputTokens?: number; - modelId?: string; - projectId?: string; - temperature?: number; - topK?: number; - topP?: number; -}; -export type GenerativeConfig = - | GenerativeAnthropicConfig - | GenerativeAnyscaleConfig - | GenerativeAWSConfig - | GenerativeAzureOpenAIConfig - | GenerativeCohereConfig - | GenerativeDatabricksConfig - | GenerativeGoogleConfig - | GenerativeFriendliAIConfig - | GenerativeMistralConfig - | GenerativeOctoAIConfig - | GenerativeOllamaConfig - | GenerativeOpenAIConfig - | GenerativePaLMConfig - | Record - | undefined; -export type GenerativeConfigType = G extends 'generative-anthropic' - ? GenerativeAnthropicConfig - : G extends 'generative-anyscale' - ? GenerativeAnyscaleConfig - : G extends 'generative-aws' - ? GenerativeAWSConfig - : G extends 'generative-azure-openai' - ? GenerativeAzureOpenAIConfig - : G extends 'generative-cohere' - ? GenerativeCohereConfig - : G extends 'generative-databricks' - ? GenerativeDatabricksConfig - : G extends 'generative-google' - ? GenerativeGoogleConfig - : G extends 'generative-friendliai' - ? GenerativeFriendliAIConfig - : G extends 'generative-mistral' - ? GenerativeMistralConfig - : G extends 'generative-octoai' - ? GenerativeOctoAIConfig - : G extends 'generative-ollama' - ? GenerativeOllamaConfig - : G extends 'generative-openai' - ? GenerativeOpenAIConfig - : G extends GenerativePalm - ? GenerativePaLMConfig - : G extends 'none' - ? undefined - : Record | undefined; -/** @deprecated Use `generative-google` instead. */ -type GenerativePalm = 'generative-palm'; -export type GenerativeSearch = - | 'generative-anthropic' - | 'generative-anyscale' - | 'generative-aws' - | 'generative-azure-openai' - | 'generative-cohere' - | 'generative-databricks' - | 'generative-google' - | 'generative-friendliai' - | 'generative-mistral' - | 'generative-octoai' - | 'generative-ollama' - | 'generative-openai' - | GenerativePalm - | 'none' - | string; -export {}; diff --git a/dist/node/cjs/collections/config/types/generative.js b/dist/node/cjs/collections/config/types/generative.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/config/types/generative.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/config/types/index.d.ts b/dist/node/cjs/collections/config/types/index.d.ts deleted file mode 100644 index 60faf95a..00000000 --- a/dist/node/cjs/collections/config/types/index.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -export * from './generative.js'; -export * from './reranker.js'; -export * from './vectorIndex.js'; -export * from './vectorizer.js'; -import { - InvertedIndexConfigUpdate, - ReplicationConfigUpdate, - VectorConfigUpdate, -} from '../../configure/types/index.js'; -import { GenerativeConfig } from './generative.js'; -import { RerankerConfig } from './reranker.js'; -import { VectorIndexType } from './vectorIndex.js'; -import { VectorConfig } from './vectorizer.js'; -export type ModuleConfig = { - name: N; - config: C; -}; -export type InvertedIndexConfig = { - bm25: { - k1: number; - b: number; - }; - cleanupIntervalSeconds: number; - indexTimestamps: boolean; - indexPropertyLength: boolean; - indexNullState: boolean; - stopwords: { - preset: string; - additions: string[]; - removals: string[]; - }; -}; -export type MultiTenancyConfig = { - autoTenantActivation: boolean; - autoTenantCreation: boolean; - enabled: boolean; -}; -export type ReplicationDeletionStrategy = 'DeleteOnConflict' | 'NoAutomatedResolution'; -export type ReplicationConfig = { - asyncEnabled: boolean; - deletionStrategy: ReplicationDeletionStrategy; - factor: number; -}; -export type PropertyVectorizerConfig = Record< - string, - { - skip: boolean; - vectorizePropertyName: boolean; - } ->; -export type PropertyConfig = { - name: string; - dataType: string; - description?: string; - indexInverted: boolean; - indexFilterable: boolean; - indexRangeFilters: boolean; - indexSearchable: boolean; - nestedProperties?: PropertyConfig[]; - tokenization: string; - vectorizerConfig?: PropertyVectorizerConfig; -}; -export type ReferenceConfig = { - name: string; - description?: string; - targetCollections: string[]; -}; -export type ShardingConfig = { - virtualPerPhysical: number; - desiredCount: number; - actualCount: number; - desiredVirtualCount: number; - actualVirtualCount: number; - key: '_id'; - strategy: 'hash'; - function: 'murmur3'; -}; -export type CollectionConfig = { - name: string; - description?: string; - generative?: GenerativeConfig; - invertedIndex: InvertedIndexConfig; - multiTenancy: MultiTenancyConfig; - properties: PropertyConfig[]; - references: ReferenceConfig[]; - replication: ReplicationConfig; - reranker?: RerankerConfig; - sharding: ShardingConfig; - vectorizers: VectorConfig; -}; -export type CollectionConfigUpdate = { - description?: string; - invertedIndex?: InvertedIndexConfigUpdate; - replication?: ReplicationConfigUpdate; - vectorizers?: - | VectorConfigUpdate - | VectorConfigUpdate[]; -}; diff --git a/dist/node/cjs/collections/config/types/index.js b/dist/node/cjs/collections/config/types/index.js deleted file mode 100644 index 9429d293..00000000 --- a/dist/node/cjs/collections/config/types/index.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __exportStar = - (this && this.__exportStar) || - function (m, exports) { - for (var p in m) - if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) - __createBinding(exports, m, p); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -__exportStar(require('./generative.js'), exports); -__exportStar(require('./reranker.js'), exports); -__exportStar(require('./vectorIndex.js'), exports); -__exportStar(require('./vectorizer.js'), exports); diff --git a/dist/node/cjs/collections/config/types/reranker.d.ts b/dist/node/cjs/collections/config/types/reranker.d.ts deleted file mode 100644 index 60a38f79..00000000 --- a/dist/node/cjs/collections/config/types/reranker.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -export type RerankerTransformersConfig = {}; -export type RerankerCohereConfig = { - model?: 'rerank-english-v2.0' | 'rerank-multilingual-v2.0' | string; -}; -export type RerankerVoyageAIConfig = { - model?: 'rerank-lite-1' | string; -}; -export type RerankerJinaAIConfig = { - model?: - | 'jina-reranker-v2-base-multilingual' - | 'jina-reranker-v1-base-en' - | 'jina-reranker-v1-turbo-en' - | 'jina-reranker-v1-tiny-en' - | 'jina-colbert-v1-en' - | string; -}; -export type RerankerConfig = - | RerankerCohereConfig - | RerankerJinaAIConfig - | RerankerTransformersConfig - | RerankerVoyageAIConfig - | Record - | undefined; -export type Reranker = - | 'reranker-cohere' - | 'reranker-jinaai' - | 'reranker-transformers' - | 'reranker-voyageai' - | 'none' - | string; -export type RerankerConfigType = R extends 'reranker-cohere' - ? RerankerCohereConfig - : R extends 'reranker-jinaai' - ? RerankerJinaAIConfig - : R extends 'reranker-transformers' - ? RerankerTransformersConfig - : R extends 'reranker-voyageai' - ? RerankerVoyageAIConfig - : R extends 'none' - ? undefined - : Record | undefined; diff --git a/dist/node/cjs/collections/config/types/reranker.js b/dist/node/cjs/collections/config/types/reranker.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/config/types/reranker.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/config/types/vectorIndex.d.ts b/dist/node/cjs/collections/config/types/vectorIndex.d.ts deleted file mode 100644 index 1b343cfb..00000000 --- a/dist/node/cjs/collections/config/types/vectorIndex.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -export type VectorIndexConfigHNSW = { - cleanupIntervalSeconds: number; - distance: VectorDistance; - dynamicEfMin: number; - dynamicEfMax: number; - dynamicEfFactor: number; - efConstruction: number; - ef: number; - filterStrategy: VectorIndexFilterStrategy; - flatSearchCutoff: number; - maxConnections: number; - quantizer: PQConfig | BQConfig | SQConfig | undefined; - skip: boolean; - vectorCacheMaxObjects: number; - type: 'hnsw'; -}; -export type VectorIndexConfigFlat = { - distance: VectorDistance; - vectorCacheMaxObjects: number; - quantizer: BQConfig | undefined; - type: 'flat'; -}; -export type VectorIndexConfigDynamic = { - distance: VectorDistance; - threshold: number; - hnsw: VectorIndexConfigHNSW; - flat: VectorIndexConfigFlat; - type: 'dynamic'; -}; -export type VectorIndexConfigType = I extends 'hnsw' - ? VectorIndexConfigHNSW - : I extends 'flat' - ? VectorIndexConfigFlat - : I extends 'dynamic' - ? VectorIndexConfigDynamic - : I extends string - ? Record - : never; -export type BQConfig = { - cache: boolean; - rescoreLimit: number; - type: 'bq'; -}; -export type SQConfig = { - rescoreLimit: number; - trainingLimit: number; - type: 'sq'; -}; -export type PQConfig = { - bitCompression: boolean; - centroids: number; - encoder: PQEncoderConfig; - segments: number; - trainingLimit: number; - type: 'pq'; -}; -export type PQEncoderConfig = { - type: PQEncoderType; - distribution: PQEncoderDistribution; -}; -export type VectorDistance = 'cosine' | 'dot' | 'l2-squared' | 'hamming'; -export type PQEncoderType = 'kmeans' | 'tile'; -export type PQEncoderDistribution = 'log-normal' | 'normal'; -export type VectorIndexType = 'hnsw' | 'flat' | 'dynamic' | string; -export type VectorIndexFilterStrategy = 'sweeping' | 'acorn'; -export type VectorIndexConfig = VectorIndexConfigHNSW | VectorIndexConfigFlat | VectorIndexConfigDynamic; -export type QuantizerConfig = PQConfig | BQConfig | SQConfig; diff --git a/dist/node/cjs/collections/config/types/vectorIndex.js b/dist/node/cjs/collections/config/types/vectorIndex.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/config/types/vectorIndex.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/config/types/vectorizer.d.ts b/dist/node/cjs/collections/config/types/vectorizer.d.ts deleted file mode 100644 index 53ee2d6d..00000000 --- a/dist/node/cjs/collections/config/types/vectorizer.d.ts +++ /dev/null @@ -1,439 +0,0 @@ -import { ModuleConfig } from './index.js'; -import { VectorIndexConfig, VectorIndexType } from './vectorIndex.js'; -export type VectorConfig = Record< - string, - { - properties?: string[]; - vectorizer: ModuleConfig | ModuleConfig; - indexConfig: VectorIndexConfig; - indexType: VectorIndexType; - } ->; -/** @deprecated Use `multi2vec-google` instead. */ -type Multi2VecPalmVectorizer = 'multi2vec-palm'; -/** @deprecated Use `text2vec-google` instead. */ -type Text2VecPalmVectorizer = 'text2vec-palm'; -export type Vectorizer = - | 'img2vec-neural' - | 'multi2vec-clip' - | 'multi2vec-bind' - | Multi2VecPalmVectorizer - | 'multi2vec-google' - | 'ref2vec-centroid' - | 'text2vec-aws' - | 'text2vec-azure-openai' - | 'text2vec-cohere' - | 'text2vec-contextionary' - | 'text2vec-databricks' - | 'text2vec-gpt4all' - | 'text2vec-huggingface' - | 'text2vec-jina' - | 'text2vec-mistral' - | 'text2vec-octoai' - | 'text2vec-ollama' - | 'text2vec-openai' - | Text2VecPalmVectorizer - | 'text2vec-google' - | 'text2vec-transformers' - | 'text2vec-voyageai' - | 'none'; -/** The configuration for image vectorization using a neural network module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/img2vec-neural) for detailed usage. - */ -export type Img2VecNeuralConfig = { - /** The image fields used when vectorizing. This is a required field and must match the property fields of the collection that are defined as `DataType.BLOB`. */ - imageFields: string[]; -}; -/** The field configuration for multi-media vectorization. */ -export type Multi2VecField = { - /** The name of the field to be used when performing multi-media vectorization. */ - name: string; - /** The weight of the field when performing multi-media vectorization. */ - weight?: number; -}; -/** The configuration for multi-media vectorization using the CLIP module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings-multimodal) for detailed usage. - */ -export type Multi2VecClipConfig = { - /** The image fields used when vectorizing. */ - imageFields?: string[]; - /** The URL where inference requests are sent. */ - inferenceUrl?: string; - /** The text fields used when vectorizing. */ - textFields?: string[]; - /** Whether the collection name is vectorized. */ - vectorizeCollectionName?: boolean; - /** The weights of the fields used for vectorization. */ - weights?: { - /** The weights of the image fields. */ - imageFields?: number[]; - /** The weights of the text fields. */ - textFields?: number[]; - }; -}; -/** The configuration for multi-media vectorization using the Bind module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/imagebind/embeddings-multimodal) for detailed usage. - */ -export type Multi2VecBindConfig = { - /** The audio fields used when vectorizing. */ - audioFields?: string[]; - /** The depth fields used when vectorizing. */ - depthFields?: string[]; - /** The image fields used when vectorizing. */ - imageFields?: string[]; - /** The IMU fields used when vectorizing. */ - IMUFields?: string[]; - /** The text fields used when vectorizing. */ - textFields?: string[]; - /** The thermal fields used when vectorizing. */ - thermalFields?: string[]; - /** The video fields used when vectorizing. */ - videoFields?: string[]; - /** Whether the collection name is vectorized. */ - vectorizeCollectionName?: boolean; - /** The weights of the fields used for vectorization. */ - weights?: { - /** The weights of the audio fields. */ - audioFields?: number[]; - /** The weights of the depth fields. */ - depthFields?: number[]; - /** The weights of the image fields. */ - imageFields?: number[]; - /** The weights of the IMU fields. */ - IMUFields?: number[]; - /** The weights of the text fields. */ - textFields?: number[]; - /** The weights of the thermal fields. */ - thermalFields?: number[]; - /** The weights of the video fields. */ - videoFields?: number[]; - }; -}; -/** @deprecated Use `Multi2VecGoogleConfig` instead. */ -export type Multi2VecPalmConfig = Multi2VecGoogleConfig; -/** The configuration for multi-media vectorization using the Google module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. - */ -export type Multi2VecGoogleConfig = { - /** The project ID of the model in GCP. */ - projectId: string; - /** The location where the model runs. */ - location: string; - /** The image fields used when vectorizing. */ - imageFields?: string[]; - /** The text fields used when vectorizing. */ - textFields?: string[]; - /** The video fields used when vectorizing. */ - videoFields?: string[]; - /** The model ID in use. */ - modelId?: string; - /** The number of dimensions in use. */ - dimensions?: number; - /** Whether the collection name is vectorized. */ - vectorizeCollectionName?: boolean; - /** The weights of the fields used for vectorization. */ - weights?: { - /** The weights of the image fields. */ - imageFields?: number[]; - /** The weights of the text fields. */ - textFields?: number[]; - /** The weights of the video fields. */ - videoFields?: number[]; - }; -}; -/** The configuration for reference-based vectorization using the centroid method. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/ref2vec-centroid) for detailed usage. - */ -export type Ref2VecCentroidConfig = { - /** The properties used as reference points for vectorization. */ - referenceProperties: string[]; - /** The method used to calculate the centroid. */ - method: 'mean' | string; -}; -/** The configuration for text vectorization using the AWS module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-aws) for detailed usage. - */ -export type Text2VecAWSConfig = { - /** The model to use. REQUIRED for service `sagemaker`. */ - endpoint?: string; - /** The model to use. REQUIRED for service `bedrock`. */ - model?: 'amazon.titan-embed-text-v1' | 'cohere.embed-english-v3' | 'cohere.embed-multilingual-v3' | string; - /** The AWS region where the model runs. */ - region: string; - /** The AWS service to use. */ - service: 'sagemaker' | 'bedrock' | string; - /** Whether the collection name is vectorized. */ - vectorizeCollectionName?: boolean; -}; -/** The configuration for text vectorization using the OpenAI module with Azure. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) for detailed usage. - */ -export type Text2VecAzureOpenAIConfig = { - /** The base URL to use where API requests should go. */ - baseURL?: string; - /** The deployment ID to use */ - deploymentId: string; - /** The resource name to use. */ - resourceName: string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** The configuration for text vectorization using the Cohere module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings) for detailed usage. - */ -export type Text2VecCohereConfig = { - /** The base URL to use where API requests should go. */ - baseURL?: string; - /** The model to use. */ - model?: string; - /** The truncation strategy to use. */ - truncate?: boolean; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** The configuration for text vectorization using the Contextionary module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/text2vec-contextionary) for detailed usage. - */ -export type Text2VecContextionaryConfig = { - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** The configuration for text vectorization using the Databricks module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/databricks/embeddings) for detailed usage. - */ -export type Text2VecDatabricksConfig = { - endpoint: string; - instruction?: string; - vectorizeCollectionName?: boolean; -}; -/** The configuration for text vectorization using the GPT-4-All module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/gpt4all/embeddings) for detailed usage. - */ -export type Text2VecGPT4AllConfig = { - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the HuggingFace module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/huggingface/embeddings) for detailed usage. - */ -export type Text2VecHuggingFaceConfig = { - /** The endpoint URL to use. */ - endpointURL?: string; - /** The model to use. */ - model?: string; - /** The model to use for passage vectorization. */ - passageModel?: string; - /** The model to use for query vectorization. */ - queryModel?: string; - /** Whether to use the cache. */ - useCache?: boolean; - /** Whether to use the GPU. */ - useGPU?: boolean; - /** Whether to wait for the model. */ - waitForModel?: boolean; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the Jina module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/embeddings) for detailed usage. - */ -export type Text2VecJinaConfig = { - /** The model to use. */ - model?: 'jina-embeddings-v2-base-en' | 'jina-embeddings-v2-small-en' | string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the Mistral module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/mistral/embeddings) for detailed usage. - */ -export type Text2VecMistralConfig = { - /** The model to use. */ - model?: 'mistral-embed' | string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the OctoAI module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/octoai/embeddings) for detailed usage. - */ -export type Text2VecOctoAIConfig = { - /** The base URL to use where API requests should go. */ - baseURL?: string; - /** The model to use. */ - model?: string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the Ollama module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/ollama/embeddings) for detailed usage. - */ -export type Text2VecOllamaConfig = { - /** The base URL to use where API requests should go. */ - apiEndpoint?: string; - /** The model to use. */ - model?: string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the OpenAI module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) for detailed usage. - */ -export type Text2VecOpenAIConfig = { - /** The base URL to use where API requests should go. */ - baseURL?: string; - /** The dimensions to use. */ - dimensions?: number; - /** The model to use. */ - model?: 'text-embedding-3-small' | 'text-embedding-3-large' | 'text-embedding-ada-002' | string; - /** The model version to use. */ - modelVersion?: string; - /** The type of model to use. */ - type?: 'text' | 'code' | string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** @deprecated Use `Text2VecGoogleConfig` instead. */ -export type Text2VecPalmConfig = Text2VecGoogleConfig; -/** - * The configuration for text vectorization using the Google module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. - */ -export type Text2VecGoogleConfig = { - /** The API endpoint to use without a leading scheme such as `http://`. */ - apiEndpoint?: string; - /** The model ID to use. */ - modelId?: string; - /** The project ID to use. */ - projectId?: string; - /** The Weaviate property name for the `gecko-002` or `gecko-003` model to use as the title. */ - titleProperty?: string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the Transformers module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings) for detailed usage. - */ -export type Text2VecTransformersConfig = { - /** The inference url to use where API requests should go. You can use either this OR (`passage_inference_url` & `query_inference_url`). */ - inferenceUrl?: string; - /** The inference url to use where passage API requests should go. You can use either (this AND query_inference_url) OR `inference_url`. */ - passageInferenceUrl?: string; - /** The inference url to use where query API requests should go. You can use either (this AND `passage_inference_url`) OR `inference_url`. */ - queryInferenceUrl?: string; - /** The pooling strategy to use. */ - poolingStrategy?: 'masked_mean' | 'cls' | string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the VoyageAI module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings) for detailed usage. - */ -export type Text2VecVoyageAIConfig = { - /** The base URL to use where API requests should go. */ - baseURL?: string; - /** The model to use. */ - model?: string; - /** Whether to truncate the input texts to fit within the context length. */ - truncate?: boolean; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -export type NoVectorizerConfig = {}; -export type VectorizerConfig = - | Img2VecNeuralConfig - | Multi2VecClipConfig - | Multi2VecBindConfig - | Multi2VecGoogleConfig - | Multi2VecPalmConfig - | Ref2VecCentroidConfig - | Text2VecAWSConfig - | Text2VecAzureOpenAIConfig - | Text2VecContextionaryConfig - | Text2VecCohereConfig - | Text2VecDatabricksConfig - | Text2VecGoogleConfig - | Text2VecGPT4AllConfig - | Text2VecHuggingFaceConfig - | Text2VecJinaConfig - | Text2VecOpenAIConfig - | Text2VecPalmConfig - | Text2VecTransformersConfig - | Text2VecVoyageAIConfig - | NoVectorizerConfig; -export type VectorizerConfigType = V extends 'img2vec-neural' - ? Img2VecNeuralConfig | undefined - : V extends 'multi2vec-clip' - ? Multi2VecClipConfig | undefined - : V extends 'multi2vec-bind' - ? Multi2VecBindConfig | undefined - : V extends 'multi2vec-google' - ? Multi2VecGoogleConfig - : V extends Multi2VecPalmVectorizer - ? Multi2VecPalmConfig - : V extends 'ref2vec-centroid' - ? Ref2VecCentroidConfig - : V extends 'text2vec-aws' - ? Text2VecAWSConfig - : V extends 'text2vec-contextionary' - ? Text2VecContextionaryConfig | undefined - : V extends 'text2vec-cohere' - ? Text2VecCohereConfig | undefined - : V extends 'text2vec-databricks' - ? Text2VecDatabricksConfig - : V extends 'text2vec-google' - ? Text2VecGoogleConfig | undefined - : V extends 'text2vec-gpt4all' - ? Text2VecGPT4AllConfig | undefined - : V extends 'text2vec-huggingface' - ? Text2VecHuggingFaceConfig | undefined - : V extends 'text2vec-jina' - ? Text2VecJinaConfig | undefined - : V extends 'text2vec-mistral' - ? Text2VecMistralConfig | undefined - : V extends 'text2vec-octoai' - ? Text2VecOctoAIConfig | undefined - : V extends 'text2vec-ollama' - ? Text2VecOllamaConfig | undefined - : V extends 'text2vec-openai' - ? Text2VecOpenAIConfig | undefined - : V extends 'text2vec-azure-openai' - ? Text2VecAzureOpenAIConfig - : V extends Text2VecPalmVectorizer - ? Text2VecPalmConfig | undefined - : V extends 'text2vec-transformers' - ? Text2VecTransformersConfig | undefined - : V extends 'text2vec-voyageai' - ? Text2VecVoyageAIConfig | undefined - : V extends 'none' - ? {} - : V extends undefined - ? undefined - : never; -export {}; diff --git a/dist/node/cjs/collections/config/types/vectorizer.js b/dist/node/cjs/collections/config/types/vectorizer.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/config/types/vectorizer.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/config/utils.d.ts b/dist/node/cjs/collections/config/utils.d.ts deleted file mode 100644 index 6cc1d7cf..00000000 --- a/dist/node/cjs/collections/config/utils.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { WeaviateClass, WeaviateProperty } from '../../openapi/types.js'; -import { - PropertyConfigCreate, - ReferenceConfigCreate, - ReferenceMultiTargetConfigCreate, - ReferenceSingleTargetConfigCreate, -} from '../configure/types/index.js'; -import { CollectionConfig } from './types/index.js'; -export declare class ReferenceTypeGuards { - static isSingleTarget(ref: ReferenceConfigCreate): ref is ReferenceSingleTargetConfigCreate; - static isMultiTarget(ref: ReferenceConfigCreate): ref is ReferenceMultiTargetConfigCreate; -} -export declare const resolveProperty: ( - prop: PropertyConfigCreate, - vectorizers?: string[] -) => WeaviateProperty; -export declare const resolveReference: ( - ref: ReferenceSingleTargetConfigCreate | ReferenceMultiTargetConfigCreate -) => WeaviateProperty; -export declare const classToCollection: (cls: WeaviateClass) => CollectionConfig; diff --git a/dist/node/cjs/collections/config/utils.js b/dist/node/cjs/collections/config/utils.js deleted file mode 100644 index f91b6fcf..00000000 --- a/dist/node/cjs/collections/config/utils.js +++ /dev/null @@ -1,536 +0,0 @@ -'use strict'; -var __rest = - (this && this.__rest) || - function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === 'function') - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.classToCollection = - exports.resolveReference = - exports.resolveProperty = - exports.ReferenceTypeGuards = - void 0; -const errors_js_1 = require('../../errors.js'); -class ReferenceTypeGuards { - static isSingleTarget(ref) { - return ref.targetCollection !== undefined; - } - static isMultiTarget(ref) { - return ref.targetCollections !== undefined; - } -} -exports.ReferenceTypeGuards = ReferenceTypeGuards; -const resolveProperty = (prop, vectorizers) => { - const { dataType, nestedProperties, skipVectorization, vectorizePropertyName } = prop, - rest = __rest(prop, ['dataType', 'nestedProperties', 'skipVectorization', 'vectorizePropertyName']); - const moduleConfig = {}; - vectorizers === null || vectorizers === void 0 - ? void 0 - : vectorizers.forEach((vectorizer) => { - moduleConfig[vectorizer] = { - skip: skipVectorization === undefined ? false : skipVectorization, - vectorizePropertyName: vectorizePropertyName === undefined ? true : vectorizePropertyName, - }; - }); - return Object.assign(Object.assign({}, rest), { - dataType: [dataType], - nestedProperties: nestedProperties - ? nestedProperties.map((prop) => resolveNestedProperty(prop)) - : undefined, - moduleConfig: Object.keys(moduleConfig).length > 0 ? moduleConfig : undefined, - }); -}; -exports.resolveProperty = resolveProperty; -const resolveNestedProperty = (prop) => { - const { dataType, nestedProperties } = prop, - rest = __rest(prop, ['dataType', 'nestedProperties']); - return Object.assign(Object.assign({}, rest), { - dataType: [dataType], - nestedProperties: nestedProperties ? nestedProperties.map(resolveNestedProperty) : undefined, - }); -}; -const resolveReference = (ref) => { - if (ReferenceTypeGuards.isSingleTarget(ref)) { - const { targetCollection } = ref, - rest = __rest(ref, ['targetCollection']); - return Object.assign(Object.assign({}, rest), { dataType: [targetCollection] }); - } else { - const { targetCollections } = ref, - rest = __rest(ref, ['targetCollections']); - return Object.assign(Object.assign({}, rest), { dataType: targetCollections }); - } -}; -exports.resolveReference = resolveReference; -const classToCollection = (cls) => { - return { - name: ConfigMapping._name(cls.class), - description: cls.description, - generative: ConfigMapping.generative(cls.moduleConfig), - invertedIndex: ConfigMapping.invertedIndex(cls.invertedIndexConfig), - multiTenancy: ConfigMapping.multiTenancy(cls.multiTenancyConfig), - properties: ConfigMapping.properties(cls.properties), - references: ConfigMapping.references(cls.properties), - replication: ConfigMapping.replication(cls.replicationConfig), - reranker: ConfigMapping.reranker(cls.moduleConfig), - sharding: ConfigMapping.sharding(cls.shardingConfig), - vectorizers: ConfigMapping.vectorizer(cls), - }; -}; -exports.classToCollection = classToCollection; -function populated(v) { - return v !== undefined && v !== null; -} -function exists(v) { - return v !== undefined && v !== null; -} -class ConfigMapping { - static _name(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('Collection name was not returned by Weaviate'); - return v; - } - static bm25(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('BM25 was not returned by Weaviate'); - if (!populated(v.b)) - throw new errors_js_1.WeaviateDeserializationError('BM25 b was not returned by Weaviate'); - if (!populated(v.k1)) - throw new errors_js_1.WeaviateDeserializationError('BM25 k1 was not returned by Weaviate'); - return { - b: v.b, - k1: v.k1, - }; - } - static stopwords(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('Stopwords were not returned by Weaviate'); - return { - additions: v.additions ? v.additions : [], - preset: v.preset ? v.preset : 'none', - removals: v.removals ? v.removals : [], - }; - } - static generative(v) { - if (!populated(v)) return undefined; - const generativeKey = Object.keys(v).find((k) => k.includes('generative')); - if (generativeKey === undefined) return undefined; - if (!generativeKey) - throw new errors_js_1.WeaviateDeserializationError('Generative config was not returned by Weaviate'); - return { - name: generativeKey, - config: v[generativeKey], - }; - } - static reranker(v) { - if (!populated(v)) return undefined; - const rerankerKey = Object.keys(v).find((k) => k.includes('reranker')); - if (rerankerKey === undefined) return undefined; - return { - name: rerankerKey, - config: v[rerankerKey], - }; - } - static namedVectors(v) { - if (!populated(v)) - throw new errors_js_1.WeaviateDeserializationError('Vector config was not returned by Weaviate'); - const out = {}; - Object.keys(v).forEach((key) => { - const vectorizer = v[key].vectorizer; - if (!populated(vectorizer)) - throw new errors_js_1.WeaviateDeserializationError( - `Vectorizer was not returned by Weaviate for ${key} named vector` - ); - const vectorizerNames = Object.keys(vectorizer); - if (vectorizerNames.length !== 1) - throw new errors_js_1.WeaviateDeserializationError( - `Expected exactly one vectorizer for ${key} named vector, got ${vectorizerNames.length}` - ); - const vectorizerName = vectorizerNames[0]; - const _a = vectorizer[vectorizerName], - { properties } = _a, - restA = __rest(_a, ['properties']); - const { vectorizeClassName } = restA, - restB = __rest(restA, ['vectorizeClassName']); - out[key] = { - vectorizer: { - name: vectorizerName, - config: Object.assign({ vectorizeCollectionName: vectorizeClassName }, restB), - }, - properties: properties, - indexConfig: ConfigMapping.vectorIndex(v[key].vectorIndexConfig, v[key].vectorIndexType), - indexType: ConfigMapping.vectorIndexType(v[key].vectorIndexType), - }; - }); - return out; - } - static vectorizer(v) { - if (!populated(v)) - throw new errors_js_1.WeaviateDeserializationError('Schema was not returned by Weaviate'); - if (populated(v.vectorConfig)) { - return ConfigMapping.namedVectors(v.vectorConfig); - } - if (!populated(v.vectorizer)) - throw new errors_js_1.WeaviateDeserializationError('Vectorizer was not returned by Weaviate'); - return { - default: { - vectorizer: - v.vectorizer === 'none' - ? { - name: 'none', - config: undefined, - } - : { - name: v.vectorizer, - config: v.moduleConfig - ? Object.assign(Object.assign({}, v.moduleConfig[v.vectorizer]), { - vectorizeCollectionName: v.moduleConfig[v.vectorizer].vectorizeClassName, - }) - : undefined, - }, - indexConfig: ConfigMapping.vectorIndex(v.vectorIndexConfig, v.vectorIndexType), - indexType: ConfigMapping.vectorIndexType(v.vectorIndexType), - }, - }; - } - static invertedIndex(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('Inverted index was not returned by Weaviate'); - if (!populated(v.cleanupIntervalSeconds)) - throw new errors_js_1.WeaviateDeserializationError( - 'Inverted index cleanup interval was not returned by Weaviate' - ); - return { - bm25: ConfigMapping.bm25(v.bm25), - cleanupIntervalSeconds: v.cleanupIntervalSeconds, - stopwords: ConfigMapping.stopwords(v.stopwords), - indexNullState: v.indexNullState ? v.indexNullState : false, - indexPropertyLength: v.indexPropertyLength ? v.indexPropertyLength : false, - indexTimestamps: v.indexTimestamps ? v.indexTimestamps : false, - }; - } - static multiTenancy(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('Multi tenancy was not returned by Weaviate'); - return { - autoTenantActivation: v.autoTenantActivation ? v.autoTenantActivation : false, - autoTenantCreation: v.autoTenantCreation ? v.autoTenantCreation : false, - enabled: v.enabled ? v.enabled : false, - }; - } - static replication(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('Replication was not returned by Weaviate'); - if (!populated(v.factor)) - throw new errors_js_1.WeaviateDeserializationError('Replication factor was not returned by Weaviate'); - return { - factor: v.factor, - asyncEnabled: v.asyncEnabled ? v.asyncEnabled : false, - deletionStrategy: v.deletionStrategy ? v.deletionStrategy : 'NoAutomatedResolution', - }; - } - static sharding(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('Sharding was not returned by Weaviate'); - if (!exists(v.virtualPerPhysical)) - throw new errors_js_1.WeaviateDeserializationError('Sharding enabled was not returned by Weaviate'); - if (!exists(v.desiredCount)) - throw new errors_js_1.WeaviateDeserializationError( - 'Sharding desired count was not returned by Weaviate' - ); - if (!exists(v.actualCount)) - throw new errors_js_1.WeaviateDeserializationError( - 'Sharding actual count was not returned by Weaviate' - ); - if (!exists(v.desiredVirtualCount)) - throw new errors_js_1.WeaviateDeserializationError( - 'Sharding desired virtual count was not returned by Weaviate' - ); - if (!exists(v.actualVirtualCount)) - throw new errors_js_1.WeaviateDeserializationError( - 'Sharding actual virtual count was not returned by Weaviate' - ); - if (!exists(v.key)) - throw new errors_js_1.WeaviateDeserializationError('Sharding key was not returned by Weaviate'); - if (!exists(v.strategy)) - throw new errors_js_1.WeaviateDeserializationError('Sharding strategy was not returned by Weaviate'); - if (!exists(v.function)) - throw new errors_js_1.WeaviateDeserializationError('Sharding function was not returned by Weaviate'); - return { - virtualPerPhysical: v.virtualPerPhysical, - desiredCount: v.desiredCount, - actualCount: v.actualCount, - desiredVirtualCount: v.desiredVirtualCount, - actualVirtualCount: v.actualVirtualCount, - key: v.key, - strategy: v.strategy, - function: v.function, - }; - } - static pqEncoder(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('PQ encoder was not returned by Weaviate'); - if (!exists(v.type)) - throw new errors_js_1.WeaviateDeserializationError('PQ encoder name was not returned by Weaviate'); - if (!exists(v.distribution)) - throw new errors_js_1.WeaviateDeserializationError( - 'PQ encoder distribution was not returned by Weaviate' - ); - return { - type: v.type, - distribution: v.distribution, - }; - } - static pq(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('PQ was not returned by Weaviate'); - if (!exists(v.enabled)) - throw new errors_js_1.WeaviateDeserializationError('PQ enabled was not returned by Weaviate'); - if (v.enabled === false) return undefined; - if (!exists(v.bitCompression)) - throw new errors_js_1.WeaviateDeserializationError('PQ bit compression was not returned by Weaviate'); - if (!exists(v.segments)) - throw new errors_js_1.WeaviateDeserializationError('PQ segments was not returned by Weaviate'); - if (!exists(v.trainingLimit)) - throw new errors_js_1.WeaviateDeserializationError('PQ training limit was not returned by Weaviate'); - if (!exists(v.centroids)) - throw new errors_js_1.WeaviateDeserializationError('PQ centroids was not returned by Weaviate'); - if (!exists(v.encoder)) - throw new errors_js_1.WeaviateDeserializationError('PQ encoder was not returned by Weaviate'); - return { - bitCompression: v.bitCompression, - segments: v.segments, - centroids: v.centroids, - trainingLimit: v.trainingLimit, - encoder: ConfigMapping.pqEncoder(v.encoder), - type: 'pq', - }; - } - static vectorIndexHNSW(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('Vector index was not returned by Weaviate'); - if (!exists(v.cleanupIntervalSeconds)) - throw new errors_js_1.WeaviateDeserializationError( - 'Vector index cleanup interval was not returned by Weaviate' - ); - if (!exists(v.distance)) - throw new errors_js_1.WeaviateDeserializationError( - 'Vector index distance was not returned by Weaviate' - ); - if (!exists(v.dynamicEfMin)) - throw new errors_js_1.WeaviateDeserializationError( - 'Vector index dynamic ef min was not returned by Weaviate' - ); - if (!exists(v.dynamicEfMax)) - throw new errors_js_1.WeaviateDeserializationError( - 'Vector index dynamic ef max was not returned by Weaviate' - ); - if (!exists(v.dynamicEfFactor)) - throw new errors_js_1.WeaviateDeserializationError( - 'Vector index dynamic ef factor was not returned by Weaviate' - ); - if (!exists(v.ef)) - throw new errors_js_1.WeaviateDeserializationError('Vector index ef was not returned by Weaviate'); - if (!exists(v.efConstruction)) - throw new errors_js_1.WeaviateDeserializationError( - 'Vector index ef construction was not returned by Weaviate' - ); - if (!exists(v.flatSearchCutoff)) - throw new errors_js_1.WeaviateDeserializationError( - 'Vector index flat search cut off was not returned by Weaviate' - ); - if (!exists(v.maxConnections)) - throw new errors_js_1.WeaviateDeserializationError( - 'Vector index max connections was not returned by Weaviate' - ); - if (!exists(v.skip)) - throw new errors_js_1.WeaviateDeserializationError('Vector index skip was not returned by Weaviate'); - if (!exists(v.vectorCacheMaxObjects)) - throw new errors_js_1.WeaviateDeserializationError( - 'Vector index vector cache max objects was not returned by Weaviate' - ); - let quantizer; - if (exists(v.pq) && v.pq.enabled === true) { - quantizer = ConfigMapping.pq(v.pq); - } else if (exists(v.bq) && v.bq.enabled === true) { - quantizer = ConfigMapping.bq(v.bq); - } else if (exists(v.sq) && v.sq.enabled === true) { - quantizer = ConfigMapping.sq(v.sq); - } else { - quantizer = undefined; - } - return { - cleanupIntervalSeconds: v.cleanupIntervalSeconds, - distance: v.distance, - dynamicEfMin: v.dynamicEfMin, - dynamicEfMax: v.dynamicEfMax, - dynamicEfFactor: v.dynamicEfFactor, - ef: v.ef, - efConstruction: v.efConstruction, - filterStrategy: exists(v.filterStrategy) ? v.filterStrategy : 'sweeping', - flatSearchCutoff: v.flatSearchCutoff, - maxConnections: v.maxConnections, - quantizer: quantizer, - skip: v.skip, - vectorCacheMaxObjects: v.vectorCacheMaxObjects, - type: 'hnsw', - }; - } - static bq(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('BQ was not returned by Weaviate'); - if (!exists(v.enabled)) - throw new errors_js_1.WeaviateDeserializationError('BQ enabled was not returned by Weaviate'); - if (v.enabled === false) return undefined; - const cache = v.cache === undefined ? false : v.cache; - const rescoreLimit = v.rescoreLimit === undefined ? 1000 : v.rescoreLimit; - return { - cache, - rescoreLimit, - type: 'bq', - }; - } - static sq(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('SQ was not returned by Weaviate'); - if (!exists(v.enabled)) - throw new errors_js_1.WeaviateDeserializationError('SQ enabled was not returned by Weaviate'); - if (v.enabled === false) return undefined; - const rescoreLimit = v.rescoreLimit === undefined ? 1000 : v.rescoreLimit; - const trainingLimit = v.trainingLimit === undefined ? 100000 : v.trainingLimit; - return { - rescoreLimit, - trainingLimit, - type: 'sq', - }; - } - static vectorIndexFlat(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('Vector index was not returned by Weaviate'); - if (!exists(v.vectorCacheMaxObjects)) - throw new errors_js_1.WeaviateDeserializationError( - 'Vector index vector cache max objects was not returned by Weaviate' - ); - if (!exists(v.distance)) - throw new errors_js_1.WeaviateDeserializationError( - 'Vector index distance was not returned by Weaviate' - ); - if (!exists(v.bq)) - throw new errors_js_1.WeaviateDeserializationError('Vector index bq was not returned by Weaviate'); - return { - vectorCacheMaxObjects: v.vectorCacheMaxObjects, - distance: v.distance, - quantizer: ConfigMapping.bq(v.bq), - type: 'flat', - }; - } - static vectorIndexDynamic(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('Vector index was not returned by Weaviate'); - if (!exists(v.threshold)) - throw new errors_js_1.WeaviateDeserializationError( - 'Vector index threshold was not returned by Weaviate' - ); - if (!exists(v.distance)) - throw new errors_js_1.WeaviateDeserializationError( - 'Vector index distance was not returned by Weaviate' - ); - if (!exists(v.hnsw)) - throw new errors_js_1.WeaviateDeserializationError('Vector index hnsw was not returned by Weaviate'); - if (!exists(v.flat)) - throw new errors_js_1.WeaviateDeserializationError('Vector index flat was not returned by Weaviate'); - return { - distance: v.distance, - hnsw: ConfigMapping.vectorIndexHNSW(v.hnsw), - flat: ConfigMapping.vectorIndexFlat(v.flat), - threshold: v.threshold, - type: 'dynamic', - }; - } - static vectorIndex(v, t) { - if (t === 'hnsw') { - return ConfigMapping.vectorIndexHNSW(v); - } else if (t === 'flat') { - return ConfigMapping.vectorIndexFlat(v); - } else if (t === 'dynamic') { - return ConfigMapping.vectorIndexDynamic(v); - } else { - return v; - } - } - static vectorIndexType(v) { - if (!populated(v)) - throw new errors_js_1.WeaviateDeserializationError('Vector index type was not returned by Weaviate'); - return v; - } - static properties(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('Properties were not returned by Weaviate'); - if (v === null) return []; - return v - .filter((prop) => { - if (!populated(prop.dataType)) - throw new errors_js_1.WeaviateDeserializationError( - 'Property data type was not returned by Weaviate' - ); - return prop.dataType[0][0].toLowerCase() === prop.dataType[0][0]; // primitive property, e.g. text - }) - .map((prop) => { - if (!populated(prop.name)) - throw new errors_js_1.WeaviateDeserializationError('Property name was not returned by Weaviate'); - if (!populated(prop.dataType)) - throw new errors_js_1.WeaviateDeserializationError( - 'Property data type was not returned by Weaviate' - ); - return { - name: prop.name, - dataType: prop.dataType[0], - description: prop.description, - indexFilterable: prop.indexFilterable ? prop.indexFilterable : false, - indexInverted: prop.indexInverted ? prop.indexInverted : false, - indexRangeFilters: prop.indexRangeFilters ? prop.indexRangeFilters : false, - indexSearchable: prop.indexSearchable ? prop.indexSearchable : false, - vectorizerConfig: prop.moduleConfig - ? 'none' in prop.moduleConfig - ? undefined - : prop.moduleConfig - : undefined, - nestedProperties: prop.nestedProperties - ? ConfigMapping.properties(prop.nestedProperties) - : undefined, - tokenization: prop.tokenization ? prop.tokenization : 'none', - }; - }); - } - static references(v) { - if (v === undefined) - throw new errors_js_1.WeaviateDeserializationError('Properties were not returned by Weaviate'); - if (v === null) return []; - return v - .filter((prop) => { - if (!populated(prop.dataType)) - throw new errors_js_1.WeaviateDeserializationError( - 'Reference data type was not returned by Weaviate' - ); - return prop.dataType[0][0].toLowerCase() !== prop.dataType[0][0]; // reference property, e.g. Myclass - }) - .map((prop) => { - if (!populated(prop.name)) - throw new errors_js_1.WeaviateDeserializationError('Reference name was not returned by Weaviate'); - if (!populated(prop.dataType)) - throw new errors_js_1.WeaviateDeserializationError( - 'Reference data type was not returned by Weaviate' - ); - return { - name: prop.name, - description: prop.description, - targetCollections: prop.dataType, - }; - }); - } -} diff --git a/dist/node/cjs/collections/configure/generative.d.ts b/dist/node/cjs/collections/configure/generative.d.ts deleted file mode 100644 index 69ac1012..00000000 --- a/dist/node/cjs/collections/configure/generative.d.ts +++ /dev/null @@ -1,172 +0,0 @@ -import { - GenerativeAWSConfig, - GenerativeAnthropicConfig, - GenerativeAnyscaleConfig, - GenerativeAzureOpenAIConfig, - GenerativeCohereConfig, - GenerativeDatabricksConfig, - GenerativeFriendliAIConfig, - GenerativeGoogleConfig, - GenerativeMistralConfig, - GenerativeOctoAIConfig, - GenerativeOllamaConfig, - GenerativeOpenAIConfig, - GenerativePaLMConfig, - ModuleConfig, -} from '../config/types/index.js'; -import { - GenerativeAWSConfigCreate, - GenerativeAnthropicConfigCreate, - GenerativeAnyscaleConfigCreate, - GenerativeAzureOpenAIConfigCreate, - GenerativeCohereConfigCreate, - GenerativeDatabricksConfigCreate, - GenerativeFriendliAIConfigCreate, - GenerativeMistralConfigCreate, - GenerativeOctoAIConfigCreate, - GenerativeOllamaConfigCreate, - GenerativeOpenAIConfigCreate, - GenerativePaLMConfigCreate, -} from '../index.js'; -declare const _default: { - /** - * Create a `ModuleConfig<'generative-anthropic', GenerativeAnthropicConfig | undefined>` object for use when performing AI generation using the `generative-anthropic` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/anthropic/generative) for detailed usage. - * - * @param {GenerativeAnthropicConfigCreate} [config] The configuration for the `generative-anthropic` module. - * @returns {ModuleConfig<'generative-anthropic', GenerativeAnthropicConfig | undefined>} The configuration object. - */ - anthropic( - config?: GenerativeAnthropicConfigCreate - ): ModuleConfig<'generative-anthropic', GenerativeAnthropicConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-anyscale', GenerativeAnyscaleConfig | undefined>` object for use when performing AI generation using the `generative-anyscale` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/anyscale/generative) for detailed usage. - * - * @param {GenerativeAnyscaleConfigCreate} [config] The configuration for the `generative-aws` module. - * @returns {ModuleConfig<'generative-anyscale', GenerativeAnyscaleConfig | undefined>} The configuration object. - */ - anyscale( - config?: GenerativeAnyscaleConfigCreate - ): ModuleConfig<'generative-anyscale', GenerativeAnyscaleConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-aws', GenerativeAWSConfig>` object for use when performing AI generation using the `generative-aws` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/aws/generative) for detailed usage. - * - * @param {GenerativeAWSConfigCreate} config The configuration for the `generative-aws` module. - * @returns {ModuleConfig<'generative-aws', GenerativeAWSConfig>} The configuration object. - */ - aws(config: GenerativeAWSConfigCreate): ModuleConfig<'generative-aws', GenerativeAWSConfig>; - /** - * Create a `ModuleConfig<'generative-openai', GenerativeAzureOpenAIConfig>` object for use when performing AI generation using the `generative-openai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/generative) for detailed usage. - * - * @param {GenerativeAzureOpenAIConfigCreate} config The configuration for the `generative-openai` module. - * @returns {ModuleConfig<'generative-openai', GenerativeAzureOpenAIConfig>} The configuration object. - */ - azureOpenAI: ( - config: GenerativeAzureOpenAIConfigCreate - ) => ModuleConfig<'generative-openai', GenerativeAzureOpenAIConfig>; - /** - * Create a `ModuleConfig<'generative-cohere', GenerativeCohereConfig>` object for use when performing AI generation using the `generative-cohere` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/generative) for detailed usage. - * - * @param {GenerativeCohereConfigCreate} [config] The configuration for the `generative-cohere` module. - * @returns {ModuleConfig<'generative-cohere', GenerativeCohereConfig | undefined>} The configuration object. - */ - cohere: ( - config?: GenerativeCohereConfigCreate - ) => ModuleConfig<'generative-cohere', GenerativeCohereConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-databricks', GenerativeDatabricksConfig>` object for use when performing AI generation using the `generative-databricks` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/databricks/generative) for detailed usage. - * - * @param {GenerativeDatabricksConfigCreate} config The configuration for the `generative-databricks` module. - * @returns {ModuleConfig<'generative-databricks', GenerativeDatabricksConfig>} The configuration object. - */ - databricks: ( - config: GenerativeDatabricksConfigCreate - ) => ModuleConfig<'generative-databricks', GenerativeDatabricksConfig>; - /** - * Create a `ModuleConfig<'generative-friendliai', GenerativeFriendliAIConfig | undefined>` object for use when performing AI generation using the `generative-friendliai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/friendliai/generative) for detailed usage. - */ - friendliai( - config?: GenerativeFriendliAIConfigCreate - ): ModuleConfig<'generative-friendliai', GenerativeFriendliAIConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-mistral', GenerativeMistralConfig | undefined>` object for use when performing AI generation using the `generative-mistral` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/mistral/generative) for detailed usage. - * - * @param {GenerativeMistralConfigCreate} [config] The configuration for the `generative-mistral` module. - * @returns {ModuleConfig<'generative-mistral', GenerativeMistralConfig | undefined>} The configuration object. - */ - mistral( - config?: GenerativeMistralConfigCreate - ): ModuleConfig<'generative-mistral', GenerativeMistralConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-octoai', GenerativeOpenAIConfig | undefined>` object for use when performing AI generation using the `generative-octoai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/octoai/generative) for detailed usage. - * - * @param {GenerativeOctoAIConfigCreate} [config] The configuration for the `generative-octoai` module. - * @returns {ModuleConfig<'generative-octoai', GenerativeOctoAIConfig | undefined>} The configuration object. - */ - octoai( - config?: GenerativeOctoAIConfigCreate - ): ModuleConfig<'generative-octoai', GenerativeOctoAIConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-ollama', GenerativeOllamaConfig | undefined>` object for use when performing AI generation using the `generative-ollama` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/ollama/generative) for detailed usage. - * - * @param {GenerativeOllamaConfigCreate} [config] The configuration for the `generative-openai` module. - * @returns {ModuleConfig<'generative-ollama', GenerativeOllamaConfig | undefined>} The configuration object. - */ - ollama( - config?: GenerativeOllamaConfigCreate - ): ModuleConfig<'generative-ollama', GenerativeOllamaConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-openai', GenerativeOpenAIConfig | undefined>` object for use when performing AI generation using the `generative-openai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/generative) for detailed usage. - * - * @param {GenerativeOpenAIConfigCreate} [config] The configuration for the `generative-openai` module. - * @returns {ModuleConfig<'generative-openai', GenerativeOpenAIConfig | undefined>} The configuration object. - */ - openAI: ( - config?: GenerativeOpenAIConfigCreate - ) => ModuleConfig<'generative-openai', GenerativeOpenAIConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-palm', GenerativePaLMConfig>` object for use when performing AI generation using the `generative-palm` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/generative) for detailed usage. - * - * @param {GenerativePaLMConfigCreate} [config] The configuration for the `generative-palm` module. - * @returns {ModuleConfig<'generative-palm', GenerativePaLMConfig>} The configuration object. - * @deprecated Use `google` instead. - */ - palm: ( - config?: GenerativePaLMConfigCreate - ) => ModuleConfig<'generative-palm', GenerativePaLMConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-google', GenerativeGoogleConfig>` object for use when performing AI generation using the `generative-google` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/generative) for detailed usage. - * - * @param {GenerativePaLMConfigCreate} [config] The configuration for the `generative-palm` module. - * @returns {ModuleConfig<'generative-palm', GenerativePaLMConfig>} The configuration object. - */ - google: ( - config?: GenerativePaLMConfigCreate - ) => ModuleConfig<'generative-google', GenerativeGoogleConfig | undefined>; -}; -export default _default; diff --git a/dist/node/cjs/collections/configure/generative.js b/dist/node/cjs/collections/configure/generative.js deleted file mode 100644 index 12d6cee5..00000000 --- a/dist/node/cjs/collections/configure/generative.js +++ /dev/null @@ -1,213 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.default = { - /** - * Create a `ModuleConfig<'generative-anthropic', GenerativeAnthropicConfig | undefined>` object for use when performing AI generation using the `generative-anthropic` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/anthropic/generative) for detailed usage. - * - * @param {GenerativeAnthropicConfigCreate} [config] The configuration for the `generative-anthropic` module. - * @returns {ModuleConfig<'generative-anthropic', GenerativeAnthropicConfig | undefined>} The configuration object. - */ - anthropic(config) { - return { - name: 'generative-anthropic', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-anyscale', GenerativeAnyscaleConfig | undefined>` object for use when performing AI generation using the `generative-anyscale` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/anyscale/generative) for detailed usage. - * - * @param {GenerativeAnyscaleConfigCreate} [config] The configuration for the `generative-aws` module. - * @returns {ModuleConfig<'generative-anyscale', GenerativeAnyscaleConfig | undefined>} The configuration object. - */ - anyscale(config) { - return { - name: 'generative-anyscale', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-aws', GenerativeAWSConfig>` object for use when performing AI generation using the `generative-aws` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/aws/generative) for detailed usage. - * - * @param {GenerativeAWSConfigCreate} config The configuration for the `generative-aws` module. - * @returns {ModuleConfig<'generative-aws', GenerativeAWSConfig>} The configuration object. - */ - aws(config) { - return { - name: 'generative-aws', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-openai', GenerativeAzureOpenAIConfig>` object for use when performing AI generation using the `generative-openai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/generative) for detailed usage. - * - * @param {GenerativeAzureOpenAIConfigCreate} config The configuration for the `generative-openai` module. - * @returns {ModuleConfig<'generative-openai', GenerativeAzureOpenAIConfig>} The configuration object. - */ - azureOpenAI: (config) => { - return { - name: 'generative-openai', - config: { - deploymentId: config.deploymentId, - resourceName: config.resourceName, - baseURL: config.baseURL, - frequencyPenaltyProperty: config.frequencyPenalty, - maxTokensProperty: config.maxTokens, - presencePenaltyProperty: config.presencePenalty, - temperatureProperty: config.temperature, - topPProperty: config.topP, - }, - }; - }, - /** - * Create a `ModuleConfig<'generative-cohere', GenerativeCohereConfig>` object for use when performing AI generation using the `generative-cohere` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/generative) for detailed usage. - * - * @param {GenerativeCohereConfigCreate} [config] The configuration for the `generative-cohere` module. - * @returns {ModuleConfig<'generative-cohere', GenerativeCohereConfig | undefined>} The configuration object. - */ - cohere: (config) => { - return { - name: 'generative-cohere', - config: config - ? { - kProperty: config.k, - maxTokensProperty: config.maxTokens, - model: config.model, - returnLikelihoodsProperty: config.returnLikelihoods, - stopSequencesProperty: config.stopSequences, - temperatureProperty: config.temperature, - } - : undefined, - }; - }, - /** - * Create a `ModuleConfig<'generative-databricks', GenerativeDatabricksConfig>` object for use when performing AI generation using the `generative-databricks` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/databricks/generative) for detailed usage. - * - * @param {GenerativeDatabricksConfigCreate} config The configuration for the `generative-databricks` module. - * @returns {ModuleConfig<'generative-databricks', GenerativeDatabricksConfig>} The configuration object. - */ - databricks: (config) => { - return { - name: 'generative-databricks', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-friendliai', GenerativeFriendliAIConfig | undefined>` object for use when performing AI generation using the `generative-friendliai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/friendliai/generative) for detailed usage. - */ - friendliai(config) { - return { - name: 'generative-friendliai', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-mistral', GenerativeMistralConfig | undefined>` object for use when performing AI generation using the `generative-mistral` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/mistral/generative) for detailed usage. - * - * @param {GenerativeMistralConfigCreate} [config] The configuration for the `generative-mistral` module. - * @returns {ModuleConfig<'generative-mistral', GenerativeMistralConfig | undefined>} The configuration object. - */ - mistral(config) { - return { - name: 'generative-mistral', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-octoai', GenerativeOpenAIConfig | undefined>` object for use when performing AI generation using the `generative-octoai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/octoai/generative) for detailed usage. - * - * @param {GenerativeOctoAIConfigCreate} [config] The configuration for the `generative-octoai` module. - * @returns {ModuleConfig<'generative-octoai', GenerativeOctoAIConfig | undefined>} The configuration object. - */ - octoai(config) { - return { - name: 'generative-octoai', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-ollama', GenerativeOllamaConfig | undefined>` object for use when performing AI generation using the `generative-ollama` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/ollama/generative) for detailed usage. - * - * @param {GenerativeOllamaConfigCreate} [config] The configuration for the `generative-openai` module. - * @returns {ModuleConfig<'generative-ollama', GenerativeOllamaConfig | undefined>} The configuration object. - */ - ollama(config) { - return { - name: 'generative-ollama', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-openai', GenerativeOpenAIConfig | undefined>` object for use when performing AI generation using the `generative-openai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/generative) for detailed usage. - * - * @param {GenerativeOpenAIConfigCreate} [config] The configuration for the `generative-openai` module. - * @returns {ModuleConfig<'generative-openai', GenerativeOpenAIConfig | undefined>} The configuration object. - */ - openAI: (config) => { - return { - name: 'generative-openai', - config: config - ? { - baseURL: config.baseURL, - frequencyPenaltyProperty: config.frequencyPenalty, - maxTokensProperty: config.maxTokens, - model: config.model, - presencePenaltyProperty: config.presencePenalty, - temperatureProperty: config.temperature, - topPProperty: config.topP, - } - : undefined, - }; - }, - /** - * Create a `ModuleConfig<'generative-palm', GenerativePaLMConfig>` object for use when performing AI generation using the `generative-palm` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/generative) for detailed usage. - * - * @param {GenerativePaLMConfigCreate} [config] The configuration for the `generative-palm` module. - * @returns {ModuleConfig<'generative-palm', GenerativePaLMConfig>} The configuration object. - * @deprecated Use `google` instead. - */ - palm: (config) => { - console.warn('The `generative-palm` module is deprecated. Use `generative-google` instead.'); - return { - name: 'generative-palm', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-google', GenerativeGoogleConfig>` object for use when performing AI generation using the `generative-google` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/generative) for detailed usage. - * - * @param {GenerativePaLMConfigCreate} [config] The configuration for the `generative-palm` module. - * @returns {ModuleConfig<'generative-palm', GenerativePaLMConfig>} The configuration object. - */ - google: (config) => { - return { - name: 'generative-google', - config, - }; - }, -}; diff --git a/dist/node/cjs/collections/configure/index.d.ts b/dist/node/cjs/collections/configure/index.d.ts deleted file mode 100644 index d75f0b04..00000000 --- a/dist/node/cjs/collections/configure/index.d.ts +++ /dev/null @@ -1,889 +0,0 @@ -import { - InvertedIndexConfigCreate, - InvertedIndexConfigUpdate, - MultiTenancyConfigCreate, - ReplicationConfigCreate, - ReplicationConfigUpdate, - ReplicationDeletionStrategy, - ShardingConfigCreate, - VectorConfigUpdate, - VectorizerUpdateOptions, -} from '../types/index.js'; -import generative from './generative.js'; -import reranker from './reranker.js'; -import { configure as configureVectorIndex } from './vectorIndex.js'; -import { vectorizer } from './vectorizer.js'; -declare const dataType: { - INT: 'int'; - INT_ARRAY: 'int[]'; - NUMBER: 'number'; - NUMBER_ARRAY: 'number[]'; - TEXT: 'text'; - TEXT_ARRAY: 'text[]'; - UUID: 'uuid'; - UUID_ARRAY: 'uuid[]'; - BOOLEAN: 'boolean'; - BOOLEAN_ARRAY: 'boolean[]'; - DATE: 'date'; - DATE_ARRAY: 'date[]'; - OBJECT: 'object'; - OBJECT_ARRAY: 'object[]'; - BLOB: 'blob'; - GEO_COORDINATES: 'geoCoordinates'; - PHONE_NUMBER: 'phoneNumber'; -}; -declare const tokenization: { - WORD: 'word'; - LOWERCASE: 'lowercase'; - WHITESPACE: 'whitespace'; - FIELD: 'field'; - TRIGRAM: 'trigram'; - GSE: 'gse'; - KAGOME_KR: 'kagome_kr'; -}; -declare const vectorDistances: { - COSINE: 'cosine'; - DOT: 'dot'; - HAMMING: 'hamming'; - L2_SQUARED: 'l2-squared'; -}; -declare const configure: { - generative: { - anthropic( - config?: import('../types/index.js').GenerativeAnthropicConfig | undefined - ): import('../types/index.js').ModuleConfig< - 'generative-anthropic', - import('../types/index.js').GenerativeAnthropicConfig | undefined - >; - anyscale( - config?: import('../types/index.js').GenerativeAnyscaleConfig | undefined - ): import('../types/index.js').ModuleConfig< - 'generative-anyscale', - import('../types/index.js').GenerativeAnyscaleConfig | undefined - >; - aws( - config: import('../types/index.js').GenerativeAWSConfig - ): import('../types/index.js').ModuleConfig< - 'generative-aws', - import('../types/index.js').GenerativeAWSConfig - >; - azureOpenAI: ( - config: import('./types/generative.js').GenerativeAzureOpenAIConfigCreate - ) => import('../types/index.js').ModuleConfig< - 'generative-openai', - import('../types/index.js').GenerativeAzureOpenAIConfig - >; - cohere: ( - config?: import('./types/generative.js').GenerativeCohereConfigCreate | undefined - ) => import('../types/index.js').ModuleConfig< - 'generative-cohere', - import('../types/index.js').GenerativeCohereConfig | undefined - >; - databricks: ( - config: import('../types/index.js').GenerativeDatabricksConfig - ) => import('../types/index.js').ModuleConfig< - 'generative-databricks', - import('../types/index.js').GenerativeDatabricksConfig - >; - friendliai( - config?: import('../types/index.js').GenerativeFriendliAIConfig | undefined - ): import('../types/index.js').ModuleConfig< - 'generative-friendliai', - import('../types/index.js').GenerativeFriendliAIConfig | undefined - >; - mistral( - config?: import('../types/index.js').GenerativeMistralConfig | undefined - ): import('../types/index.js').ModuleConfig< - 'generative-mistral', - import('../types/index.js').GenerativeMistralConfig | undefined - >; - octoai( - config?: import('../types/index.js').GenerativeOctoAIConfig | undefined - ): import('../types/index.js').ModuleConfig< - 'generative-octoai', - import('../types/index.js').GenerativeOctoAIConfig | undefined - >; - ollama( - config?: import('../types/index.js').GenerativeOllamaConfig | undefined - ): import('../types/index.js').ModuleConfig< - 'generative-ollama', - import('../types/index.js').GenerativeOllamaConfig | undefined - >; - openAI: ( - config?: import('./types/generative.js').GenerativeOpenAIConfigCreate | undefined - ) => import('../types/index.js').ModuleConfig< - 'generative-openai', - import('../types/index.js').GenerativeOpenAIConfig | undefined - >; - palm: ( - config?: import('../types/index.js').GenerativeGoogleConfig | undefined - ) => import('../types/index.js').ModuleConfig< - 'generative-palm', - import('../types/index.js').GenerativeGoogleConfig | undefined - >; - google: ( - config?: import('../types/index.js').GenerativeGoogleConfig | undefined - ) => import('../types/index.js').ModuleConfig< - 'generative-google', - import('../types/index.js').GenerativeGoogleConfig | undefined - >; - }; - reranker: { - cohere: ( - config?: import('../types/index.js').RerankerCohereConfig | undefined - ) => import('../types/index.js').ModuleConfig< - 'reranker-cohere', - import('../types/index.js').RerankerCohereConfig | undefined - >; - jinaai: ( - config?: import('../types/index.js').RerankerJinaAIConfig | undefined - ) => import('../types/index.js').ModuleConfig< - 'reranker-jinaai', - import('../types/index.js').RerankerJinaAIConfig | undefined - >; - transformers: () => import('../types/index.js').ModuleConfig< - 'reranker-transformers', - Record - >; - voyageAI: ( - config?: import('../types/index.js').RerankerVoyageAIConfig | undefined - ) => import('../types/index.js').ModuleConfig< - 'reranker-voyageai', - import('../types/index.js').RerankerVoyageAIConfig | undefined - >; - }; - vectorizer: { - none: ( - opts?: - | { - name?: N | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - } - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate; - img2VecNeural: ( - opts: import('../types/index.js').Img2VecNeuralConfig & { - name?: N_1 | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_1, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - } - ) => import('./types/vectorizer.js').VectorConfigCreate; - multi2VecBind: ( - opts?: - | (import('./types/vectorizer.js').Multi2VecBindConfigCreate & { - name?: N_2 | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_2, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate; - multi2VecClip: ( - opts?: - | (import('./types/vectorizer.js').Multi2VecClipConfigCreate & { - name?: N_3 | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_3, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate; - multi2VecPalm: ( - opts: import('./types/vectorizer.js').ConfigureNonTextVectorizerOptions - ) => import('./types/vectorizer.js').VectorConfigCreate; - multi2VecGoogle: ( - opts: import('./types/vectorizer.js').ConfigureNonTextVectorizerOptions - ) => import('./types/vectorizer.js').VectorConfigCreate; - ref2VecCentroid: ( - opts: import('./types/vectorizer.js').ConfigureNonTextVectorizerOptions - ) => import('./types/vectorizer.js').VectorConfigCreate; - text2VecAWS: ( - opts: import('./types/vectorizer.js').ConfigureTextVectorizerOptions - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_7, - I_7, - 'text2vec-aws' - >; - text2VecAzureOpenAI: ( - opts: import('./types/vectorizer.js').ConfigureTextVectorizerOptions< - T_1, - N_8, - I_8, - 'text2vec-azure-openai' - > - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_8, - I_8, - 'text2vec-azure-openai' - >; - text2VecCohere: ( - opts?: - | (import('../types/index.js').Text2VecCohereConfig & { - name?: N_9 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_9, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_9, - I_9, - 'text2vec-cohere' - >; - text2VecContextionary: ( - opts?: - | (import('../types/index.js').Text2VecContextionaryConfig & { - name?: N_10 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_10, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_10, - I_10, - 'text2vec-contextionary' - >; - text2VecDatabricks: ( - opts: import('./types/vectorizer.js').ConfigureTextVectorizerOptions< - T_4, - N_11, - I_11, - 'text2vec-databricks' - > - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_11, - I_11, - 'text2vec-databricks' - >; - text2VecGPT4All: ( - opts?: - | (import('../types/index.js').Text2VecGPT4AllConfig & { - name?: N_12 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_12, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_12, - I_12, - 'text2vec-gpt4all' - >; - text2VecHuggingFace: ( - opts?: - | (import('../types/index.js').Text2VecHuggingFaceConfig & { - name?: N_13 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_13, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_13, - I_13, - 'text2vec-huggingface' - >; - text2VecJina: ( - opts?: - | (import('../types/index.js').Text2VecJinaConfig & { - name?: N_14 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_14, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_14, - I_14, - 'text2vec-jina' - >; - text2VecMistral: ( - opts?: - | (import('../types/index.js').Text2VecMistralConfig & { - name?: N_15 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_15, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_15, - I_15, - 'text2vec-mistral' - >; - text2VecOctoAI: ( - opts?: - | (import('../types/index.js').Text2VecOctoAIConfig & { - name?: N_16 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_16, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_16, - I_16, - 'text2vec-octoai' - >; - text2VecOpenAI: ( - opts?: - | (import('../types/index.js').Text2VecOpenAIConfig & { - name?: N_17 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_17, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_17, - I_17, - 'text2vec-openai' - >; - text2VecOllama: ( - opts?: - | (import('../types/index.js').Text2VecOllamaConfig & { - name?: N_18 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_18, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_18, - I_18, - 'text2vec-ollama' - >; - text2VecPalm: ( - opts?: - | (import('../types/index.js').Text2VecGoogleConfig & { - name?: N_19 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_19, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_19, - I_19, - 'text2vec-palm' - >; - text2VecGoogle: ( - opts?: - | (import('../types/index.js').Text2VecGoogleConfig & { - name?: N_20 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_20, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_20, - I_20, - 'text2vec-google' - >; - text2VecTransformers: ( - opts?: - | (import('../types/index.js').Text2VecTransformersConfig & { - name?: N_21 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_21, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_21, - I_21, - 'text2vec-transformers' - >; - text2VecVoyageAI: ( - opts?: - | (import('../types/index.js').Text2VecVoyageAIConfig & { - name?: N_22 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_22, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_22, - I_22, - 'text2vec-voyageai' - >; - }; - vectorIndex: { - flat: ( - opts?: import('./types/vectorIndex.js').VectorIndexConfigFlatCreateOptions | undefined - ) => import('../types/index.js').ModuleConfig< - 'flat', - | { - distance?: import('../types/index.js').VectorDistance | undefined; - vectorCacheMaxObjects?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | undefined; - type?: 'flat' | undefined; - } - | undefined - >; - hnsw: ( - opts?: import('./types/vectorIndex.js').VectorIndexConfigHNSWCreateOptions | undefined - ) => import('../types/index.js').ModuleConfig< - 'hnsw', - | { - cleanupIntervalSeconds?: number | undefined; - distance?: import('../types/index.js').VectorDistance | undefined; - dynamicEfMin?: number | undefined; - dynamicEfMax?: number | undefined; - dynamicEfFactor?: number | undefined; - efConstruction?: number | undefined; - ef?: number | undefined; - filterStrategy?: import('../types/index.js').VectorIndexFilterStrategy | undefined; - flatSearchCutoff?: number | undefined; - maxConnections?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | { - bitCompression?: boolean | undefined; - centroids?: number | undefined; - encoder?: - | { - type?: import('../types/index.js').PQEncoderType | undefined; - distribution?: import('../types/index.js').PQEncoderDistribution | undefined; - } - | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - type?: 'pq' | undefined; - } - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - type?: 'sq' | undefined; - } - | undefined; - skip?: boolean | undefined; - vectorCacheMaxObjects?: number | undefined; - type?: 'hnsw' | undefined; - } - | undefined - >; - dynamic: ( - opts?: import('./types/vectorIndex.js').VectorIndexConfigDynamicCreateOptions | undefined - ) => import('../types/index.js').ModuleConfig< - 'dynamic', - | { - distance?: import('../types/index.js').VectorDistance | undefined; - threshold?: number | undefined; - hnsw?: - | { - cleanupIntervalSeconds?: number | undefined; - distance?: import('../types/index.js').VectorDistance | undefined; - dynamicEfMin?: number | undefined; - dynamicEfMax?: number | undefined; - dynamicEfFactor?: number | undefined; - efConstruction?: number | undefined; - ef?: number | undefined; - filterStrategy?: import('../types/index.js').VectorIndexFilterStrategy | undefined; - flatSearchCutoff?: number | undefined; - maxConnections?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | { - bitCompression?: boolean | undefined; - centroids?: number | undefined; - encoder?: - | { - type?: import('../types/index.js').PQEncoderType | undefined; - distribution?: import('../types/index.js').PQEncoderDistribution | undefined; - } - | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - type?: 'pq' | undefined; - } - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - type?: 'sq' | undefined; - } - | undefined; - skip?: boolean | undefined; - vectorCacheMaxObjects?: number | undefined; - type?: 'hnsw' | undefined; - } - | undefined; - flat?: - | { - distance?: import('../types/index.js').VectorDistance | undefined; - vectorCacheMaxObjects?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | undefined; - type?: 'flat' | undefined; - } - | undefined; - type?: 'dynamic' | undefined; - } - | undefined - >; - quantizer: { - bq: ( - options?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - } - | undefined - ) => import('./types/vectorIndex.js').QuantizerRecursivePartial; - pq: ( - options?: - | { - bitCompression?: boolean | undefined; - centroids?: number | undefined; - encoder?: - | { - distribution?: import('../types/index.js').PQEncoderDistribution | undefined; - type?: import('../types/index.js').PQEncoderType | undefined; - } - | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./types/vectorIndex.js').QuantizerRecursivePartial; - sq: ( - options?: - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./types/vectorIndex.js').QuantizerRecursivePartial; - }; - }; - dataType: { - INT: 'int'; - INT_ARRAY: 'int[]'; - NUMBER: 'number'; - NUMBER_ARRAY: 'number[]'; - TEXT: 'text'; - TEXT_ARRAY: 'text[]'; - UUID: 'uuid'; - UUID_ARRAY: 'uuid[]'; - BOOLEAN: 'boolean'; - BOOLEAN_ARRAY: 'boolean[]'; - DATE: 'date'; - DATE_ARRAY: 'date[]'; - OBJECT: 'object'; - OBJECT_ARRAY: 'object[]'; - BLOB: 'blob'; - GEO_COORDINATES: 'geoCoordinates'; - PHONE_NUMBER: 'phoneNumber'; - }; - tokenization: { - WORD: 'word'; - LOWERCASE: 'lowercase'; - WHITESPACE: 'whitespace'; - FIELD: 'field'; - TRIGRAM: 'trigram'; - GSE: 'gse'; - KAGOME_KR: 'kagome_kr'; - }; - vectorDistances: { - COSINE: 'cosine'; - DOT: 'dot'; - HAMMING: 'hamming'; - L2_SQUARED: 'l2-squared'; - }; - /** - * Create an `InvertedIndexConfigCreate` object to be used when defining the configuration of the keyword searching algorithm of your collection. - * - * See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#configure-the-inverted-index) for details! - * - * @param {number} [options.bm25b] The BM25 b parameter. - * @param {number} [options.bm25k1] The BM25 k1 parameter. - * @param {number} [options.cleanupIntervalSeconds] The interval in seconds at which the inverted index is cleaned up. - * @param {boolean} [options.indexTimestamps] Whether to index timestamps. - * @param {boolean} [options.indexPropertyLength] Whether to index the length of properties. - * @param {boolean} [options.indexNullState] Whether to index the null state of properties. - * @param {'en' | 'none'} [options.stopwordsPreset] The stopwords preset to use. - * @param {string[]} [options.stopwordsAdditions] Additional stopwords to add. - * @param {string[]} [options.stopwordsRemovals] Stopwords to remove. - */ - invertedIndex: (options: { - bm25b?: number; - bm25k1?: number; - cleanupIntervalSeconds?: number; - indexTimestamps?: boolean; - indexPropertyLength?: boolean; - indexNullState?: boolean; - stopwordsPreset?: 'en' | 'none'; - stopwordsAdditions?: string[]; - stopwordsRemovals?: string[]; - }) => InvertedIndexConfigCreate; - /** - * Create a `MultiTenancyConfigCreate` object to be used when defining the multi-tenancy configuration of your collection. - * - * @param {boolean} [options.autoTenantActivation] Whether auto-tenant activation is enabled. Default is false. - * @param {boolean} [options.autoTenantCreation] Whether auto-tenant creation is enabled. Default is false. - * @param {boolean} [options.enabled] Whether multi-tenancy is enabled. Default is true. - */ - multiTenancy: (options?: { - autoTenantActivation?: boolean; - autoTenantCreation?: boolean; - enabled?: boolean; - }) => MultiTenancyConfigCreate; - /** - * Create a `ReplicationConfigCreate` object to be used when defining the replication configuration of your collection. - * - * NOTE: You can only use one of Sharding or Replication, not both. - * - * See [the docs](https://weaviate.io/developers/weaviate/concepts/replication-architecture#replication-vs-sharding) for more details. - * - * @param {boolean} [options.asyncEnabled] Whether asynchronous replication is enabled. Default is false. - * @param {ReplicationDeletionStrategy} [options.deletionStrategy] The deletion strategy when replication conflicts are detected between deletes and reads. - * @param {number} [options.factor] The replication factor. Default is 1. - */ - replication: (options: { - asyncEnabled?: boolean; - deletionStrategy?: ReplicationDeletionStrategy; - factor?: number; - }) => ReplicationConfigCreate; - /** - * Create a `ShardingConfigCreate` object to be used when defining the sharding configuration of your collection. - * - * NOTE: You can only use one of Sharding or Replication, not both. - * - * See [the docs](https://weaviate.io/developers/weaviate/concepts/replication-architecture#replication-vs-sharding) for more details. - * - * @param {number} [options.virtualPerPhysical] The number of virtual shards per physical shard. - * @param {number} [options.desiredCount] The desired number of physical shards. - * @param {number} [options.desiredVirtualCount] The desired number of virtual shards. - */ - sharding: (options: { - virtualPerPhysical?: number; - desiredCount?: number; - desiredVirtualCount?: number; - }) => ShardingConfigCreate; -}; -declare const reconfigure: { - vectorIndex: { - flat: (options: { - vectorCacheMaxObjects?: number | undefined; - quantizer?: import('./types/vectorIndex.js').BQConfigUpdate | undefined; - }) => import('../types/index.js').ModuleConfig< - 'flat', - import('./types/vectorIndex.js').VectorIndexConfigFlatUpdate - >; - hnsw: (options: { - dynamicEfFactor?: number | undefined; - dynamicEfMax?: number | undefined; - dynamicEfMin?: number | undefined; - ef?: number | undefined; - flatSearchCutoff?: number | undefined; - quantizer?: - | import('./types/vectorIndex.js').PQConfigUpdate - | import('./types/vectorIndex.js').BQConfigUpdate - | import('./types/vectorIndex.js').SQConfigUpdate - | undefined; - vectorCacheMaxObjects?: number | undefined; - /** - * Create a `ReplicationConfigUpdate` object to be used when defining the replication configuration of Weaviate. - * - * See [the docs](https://weaviate.io/developers/weaviate/concepts/replication-architecture#replication-vs-sharding) for more details. - * - * @param {boolean} [options.asyncEnabled] Whether asynchronous replication is enabled. - * @param {ReplicationDeletionStrategy} [options.deletionStrategy] The deletion strategy when replication conflicts are detected between deletes and reads. - * @param {number} [options.factor] The replication factor. - */ - }) => import('../types/index.js').ModuleConfig< - 'hnsw', - import('./types/vectorIndex.js').VectorIndexConfigHNSWUpdate - >; - quantizer: { - bq: ( - options?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - } - | undefined - ) => import('./types/vectorIndex.js').BQConfigUpdate; - pq: ( - options?: - | { - centroids?: number | undefined; - pqEncoderDistribution?: import('../types/index.js').PQEncoderDistribution | undefined; - pqEncoderType?: import('../types/index.js').PQEncoderType | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./types/vectorIndex.js').PQConfigUpdate; - sq: ( - options?: - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./types/vectorIndex.js').SQConfigUpdate; - }; - }; - /** - * Create an `InvertedIndexConfigUpdate` object to be used when updating the configuration of the keyword searching algorithm of your collection. - * - * See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#configure-the-inverted-index) for details! - * - * @param {number} [options.bm25b] The BM25 b parameter. - * @param {number} [options.bm25k1] The BM25 k1 parameter. - * @param {number} [options.cleanupIntervalSeconds] The interval in seconds at which the inverted index is cleaned up. - * @param {'en' | 'none'} [options.stopwordsPreset] The stopwords preset to use. - * @param {string[]} [options.stopwordsAdditions] Additional stopwords to add. - * @param {string[]} [options.stopwordsRemovals] Stopwords to remove. - */ - invertedIndex: (options: { - bm25b?: number; - bm25k1?: number; - cleanupIntervalSeconds?: number; - stopwordsPreset?: 'en' | 'none'; - stopwordsAdditions?: string[]; - stopwordsRemovals?: string[]; - }) => InvertedIndexConfigUpdate; - vectorizer: { - /** - * Create a `VectorConfigUpdate` object to be used when updating the named vector configuration of Weaviate. - * - * @param {string} name The name of the vector. - * @param {VectorizerOptions} options The options for the named vector. - */ - update: ( - options: VectorizerUpdateOptions - ) => VectorConfigUpdate; - }; - /** - * Create a `ReplicationConfigUpdate` object to be used when defining the replication configuration of Weaviate. - * - * See [the docs](https://weaviate.io/developers/weaviate/concepts/replication-architecture#replication-vs-sharding) for more details. - * - * @param {boolean} [options.asyncEnabled] Whether asynchronous replication is enabled. - * @param {ReplicationDeletionStrategy} [options.deletionStrategy] The deletion strategy when replication conflicts are detected between deletes and reads. - * @param {number} [options.factor] The replication factor. - */ - replication: (options: { - asyncEnabled?: boolean; - deletionStrategy?: ReplicationDeletionStrategy; - factor?: number; - }) => ReplicationConfigUpdate; -}; -export { - configure, - dataType, - generative, - reconfigure, - reranker, - tokenization, - vectorDistances, - configureVectorIndex as vectorIndex, - vectorizer, -}; diff --git a/dist/node/cjs/collections/configure/index.js b/dist/node/cjs/collections/configure/index.js deleted file mode 100644 index b0a98b10..00000000 --- a/dist/node/cjs/collections/configure/index.js +++ /dev/null @@ -1,227 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.vectorizer = - exports.vectorIndex = - exports.vectorDistances = - exports.tokenization = - exports.reranker = - exports.reconfigure = - exports.generative = - exports.dataType = - exports.configure = - void 0; -const generative_js_1 = __importDefault(require('./generative.js')); -exports.generative = generative_js_1.default; -const reranker_js_1 = __importDefault(require('./reranker.js')); -exports.reranker = reranker_js_1.default; -const vectorIndex_js_1 = require('./vectorIndex.js'); -Object.defineProperty(exports, 'vectorIndex', { - enumerable: true, - get: function () { - return vectorIndex_js_1.configure; - }, -}); -const vectorizer_js_1 = require('./vectorizer.js'); -Object.defineProperty(exports, 'vectorizer', { - enumerable: true, - get: function () { - return vectorizer_js_1.vectorizer; - }, -}); -const parsing_js_1 = require('./parsing.js'); -const dataType = { - INT: 'int', - INT_ARRAY: 'int[]', - NUMBER: 'number', - NUMBER_ARRAY: 'number[]', - TEXT: 'text', - TEXT_ARRAY: 'text[]', - UUID: 'uuid', - UUID_ARRAY: 'uuid[]', - BOOLEAN: 'boolean', - BOOLEAN_ARRAY: 'boolean[]', - DATE: 'date', - DATE_ARRAY: 'date[]', - OBJECT: 'object', - OBJECT_ARRAY: 'object[]', - BLOB: 'blob', - GEO_COORDINATES: 'geoCoordinates', - PHONE_NUMBER: 'phoneNumber', -}; -exports.dataType = dataType; -const tokenization = { - WORD: 'word', - LOWERCASE: 'lowercase', - WHITESPACE: 'whitespace', - FIELD: 'field', - TRIGRAM: 'trigram', - GSE: 'gse', - KAGOME_KR: 'kagome_kr', -}; -exports.tokenization = tokenization; -const vectorDistances = { - COSINE: 'cosine', - DOT: 'dot', - HAMMING: 'hamming', - L2_SQUARED: 'l2-squared', -}; -exports.vectorDistances = vectorDistances; -const configure = { - generative: generative_js_1.default, - reranker: reranker_js_1.default, - vectorizer: vectorizer_js_1.vectorizer, - vectorIndex: vectorIndex_js_1.configure, - dataType, - tokenization, - vectorDistances, - /** - * Create an `InvertedIndexConfigCreate` object to be used when defining the configuration of the keyword searching algorithm of your collection. - * - * See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#configure-the-inverted-index) for details! - * - * @param {number} [options.bm25b] The BM25 b parameter. - * @param {number} [options.bm25k1] The BM25 k1 parameter. - * @param {number} [options.cleanupIntervalSeconds] The interval in seconds at which the inverted index is cleaned up. - * @param {boolean} [options.indexTimestamps] Whether to index timestamps. - * @param {boolean} [options.indexPropertyLength] Whether to index the length of properties. - * @param {boolean} [options.indexNullState] Whether to index the null state of properties. - * @param {'en' | 'none'} [options.stopwordsPreset] The stopwords preset to use. - * @param {string[]} [options.stopwordsAdditions] Additional stopwords to add. - * @param {string[]} [options.stopwordsRemovals] Stopwords to remove. - */ - invertedIndex: (options) => { - return { - bm25: { - b: options.bm25b, - k1: options.bm25k1, - }, - cleanupIntervalSeconds: options.cleanupIntervalSeconds, - indexTimestamps: options.indexTimestamps, - indexPropertyLength: options.indexPropertyLength, - indexNullState: options.indexNullState, - stopwords: { - preset: options.stopwordsPreset, - additions: options.stopwordsAdditions, - removals: options.stopwordsRemovals, - }, - }; - }, - /** - * Create a `MultiTenancyConfigCreate` object to be used when defining the multi-tenancy configuration of your collection. - * - * @param {boolean} [options.autoTenantActivation] Whether auto-tenant activation is enabled. Default is false. - * @param {boolean} [options.autoTenantCreation] Whether auto-tenant creation is enabled. Default is false. - * @param {boolean} [options.enabled] Whether multi-tenancy is enabled. Default is true. - */ - multiTenancy: (options) => { - return options - ? { - autoTenantActivation: (0, parsing_js_1.parseWithDefault)(options.autoTenantActivation, false), - autoTenantCreation: (0, parsing_js_1.parseWithDefault)(options.autoTenantCreation, false), - enabled: (0, parsing_js_1.parseWithDefault)(options.enabled, true), - } - : { autoTenantActivation: false, autoTenantCreation: false, enabled: true }; - }, - /** - * Create a `ReplicationConfigCreate` object to be used when defining the replication configuration of your collection. - * - * NOTE: You can only use one of Sharding or Replication, not both. - * - * See [the docs](https://weaviate.io/developers/weaviate/concepts/replication-architecture#replication-vs-sharding) for more details. - * - * @param {boolean} [options.asyncEnabled] Whether asynchronous replication is enabled. Default is false. - * @param {ReplicationDeletionStrategy} [options.deletionStrategy] The deletion strategy when replication conflicts are detected between deletes and reads. - * @param {number} [options.factor] The replication factor. Default is 1. - */ - replication: (options) => { - return { - asyncEnabled: options.asyncEnabled, - deletionStrategy: options.deletionStrategy, - factor: options.factor, - }; - }, - /** - * Create a `ShardingConfigCreate` object to be used when defining the sharding configuration of your collection. - * - * NOTE: You can only use one of Sharding or Replication, not both. - * - * See [the docs](https://weaviate.io/developers/weaviate/concepts/replication-architecture#replication-vs-sharding) for more details. - * - * @param {number} [options.virtualPerPhysical] The number of virtual shards per physical shard. - * @param {number} [options.desiredCount] The desired number of physical shards. - * @param {number} [options.desiredVirtualCount] The desired number of virtual shards. - */ - sharding: (options) => { - return { - virtualPerPhysical: options.virtualPerPhysical, - desiredCount: options.desiredCount, - desiredVirtualCount: options.desiredVirtualCount, - }; - }, -}; -exports.configure = configure; -const reconfigure = { - vectorIndex: vectorIndex_js_1.reconfigure, - /** - * Create an `InvertedIndexConfigUpdate` object to be used when updating the configuration of the keyword searching algorithm of your collection. - * - * See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#configure-the-inverted-index) for details! - * - * @param {number} [options.bm25b] The BM25 b parameter. - * @param {number} [options.bm25k1] The BM25 k1 parameter. - * @param {number} [options.cleanupIntervalSeconds] The interval in seconds at which the inverted index is cleaned up. - * @param {'en' | 'none'} [options.stopwordsPreset] The stopwords preset to use. - * @param {string[]} [options.stopwordsAdditions] Additional stopwords to add. - * @param {string[]} [options.stopwordsRemovals] Stopwords to remove. - */ - invertedIndex: (options) => { - return { - bm25: { - b: options.bm25b, - k1: options.bm25k1, - }, - cleanupIntervalSeconds: options.cleanupIntervalSeconds, - stopwords: { - preset: options.stopwordsPreset, - additions: options.stopwordsAdditions, - removals: options.stopwordsRemovals, - }, - }; - }, - vectorizer: { - /** - * Create a `VectorConfigUpdate` object to be used when updating the named vector configuration of Weaviate. - * - * @param {string} name The name of the vector. - * @param {VectorizerOptions} options The options for the named vector. - */ - update: (options) => { - return { - name: options === null || options === void 0 ? void 0 : options.name, - vectorIndex: options.vectorIndexConfig, - }; - }, - }, - /** - * Create a `ReplicationConfigUpdate` object to be used when defining the replication configuration of Weaviate. - * - * See [the docs](https://weaviate.io/developers/weaviate/concepts/replication-architecture#replication-vs-sharding) for more details. - * - * @param {boolean} [options.asyncEnabled] Whether asynchronous replication is enabled. - * @param {ReplicationDeletionStrategy} [options.deletionStrategy] The deletion strategy when replication conflicts are detected between deletes and reads. - * @param {number} [options.factor] The replication factor. - */ - replication: (options) => { - return { - asyncEnabled: options.asyncEnabled, - deletionStrategy: options.deletionStrategy, - factor: options.factor, - }; - }, -}; -exports.reconfigure = reconfigure; diff --git a/dist/node/cjs/collections/configure/parsing.d.ts b/dist/node/cjs/collections/configure/parsing.d.ts deleted file mode 100644 index 3cbebe27..00000000 --- a/dist/node/cjs/collections/configure/parsing.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { - BQConfigCreate, - BQConfigUpdate, - PQConfigCreate, - PQConfigUpdate, - SQConfigCreate, - SQConfigUpdate, -} from './types/index.js'; -type QuantizerConfig = - | PQConfigCreate - | PQConfigUpdate - | BQConfigCreate - | BQConfigUpdate - | SQConfigCreate - | SQConfigUpdate; -export declare class QuantizerGuards { - static isPQCreate(config?: QuantizerConfig): config is PQConfigCreate; - static isPQUpdate(config?: QuantizerConfig): config is PQConfigUpdate; - static isBQCreate(config?: QuantizerConfig): config is BQConfigCreate; - static isBQUpdate(config?: QuantizerConfig): config is BQConfigUpdate; - static isSQCreate(config?: QuantizerConfig): config is SQConfigCreate; - static isSQUpdate(config?: QuantizerConfig): config is SQConfigUpdate; -} -export declare function parseWithDefault(value: D | undefined, defaultValue: D): D; -export {}; diff --git a/dist/node/cjs/collections/configure/parsing.js b/dist/node/cjs/collections/configure/parsing.js deleted file mode 100644 index 66e90d86..00000000 --- a/dist/node/cjs/collections/configure/parsing.js +++ /dev/null @@ -1,28 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.parseWithDefault = exports.QuantizerGuards = void 0; -class QuantizerGuards { - static isPQCreate(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'pq'; - } - static isPQUpdate(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'pq'; - } - static isBQCreate(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'bq'; - } - static isBQUpdate(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'bq'; - } - static isSQCreate(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'sq'; - } - static isSQUpdate(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'sq'; - } -} -exports.QuantizerGuards = QuantizerGuards; -function parseWithDefault(value, defaultValue) { - return value !== undefined ? value : defaultValue; -} -exports.parseWithDefault = parseWithDefault; diff --git a/dist/node/cjs/collections/configure/reranker.d.ts b/dist/node/cjs/collections/configure/reranker.d.ts deleted file mode 100644 index ad457a8c..00000000 --- a/dist/node/cjs/collections/configure/reranker.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { - ModuleConfig, - RerankerCohereConfig, - RerankerJinaAIConfig, - RerankerVoyageAIConfig, -} from '../config/types/index.js'; -declare const _default: { - /** - * Create a `ModuleConfig<'reranker-cohere', RerankerCohereConfig>` object for use when reranking using the `reranker-cohere` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/reranker) for detailed usage. - * - * @param {RerankerCohereConfig} [config] The configuration for the `reranker-cohere` module. - * @returns {ModuleConfig<'reranker-cohere', RerankerCohereConfig>} The configuration object. - */ - cohere: ( - config?: RerankerCohereConfig - ) => ModuleConfig<'reranker-cohere', RerankerCohereConfig | undefined>; - /** - * Create a `ModuleConfig<'reranker-jinaai', RerankerJinaAIConfig>` object for use when reranking using the `reranker-jinaai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/reranker) for detailed usage. - * - * @param {RerankerJinaAIConfig} [config] The configuration for the `reranker-jinaai` module. - * @returns {ModuleConfig<'reranker-jinaai', RerankerJinaAIConfig | undefined>} The configuration object. - */ - jinaai: ( - config?: RerankerJinaAIConfig - ) => ModuleConfig<'reranker-jinaai', RerankerJinaAIConfig | undefined>; - /** - * Create a `ModuleConfig<'reranker-transformers', Record>` object for use when reranking using the `reranker-transformers` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/reranker) for detailed usage. - * - * @returns {ModuleConfig<'reranker-transformers', Record>} The configuration object. - */ - transformers: () => ModuleConfig<'reranker-transformers', Record>; - /** - * Create a `ModuleConfig<'reranker-voyageai', RerankerVoyageAIConfig>` object for use when reranking using the `reranker-voyageai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/reranker) for detailed usage. - * - * @param {RerankerVoyageAIConfig} [config] The configuration for the `reranker-voyage-ai` module. - * @returns {ModuleConfig<'reranker-voyage-ai', RerankerVoyageAIConfig | undefined>} The configuration object. - */ - voyageAI: ( - config?: RerankerVoyageAIConfig - ) => ModuleConfig<'reranker-voyageai', RerankerVoyageAIConfig | undefined>; -}; -export default _default; diff --git a/dist/node/cjs/collections/configure/reranker.js b/dist/node/cjs/collections/configure/reranker.js deleted file mode 100644 index 388a1c35..00000000 --- a/dist/node/cjs/collections/configure/reranker.js +++ /dev/null @@ -1,59 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.default = { - /** - * Create a `ModuleConfig<'reranker-cohere', RerankerCohereConfig>` object for use when reranking using the `reranker-cohere` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/reranker) for detailed usage. - * - * @param {RerankerCohereConfig} [config] The configuration for the `reranker-cohere` module. - * @returns {ModuleConfig<'reranker-cohere', RerankerCohereConfig>} The configuration object. - */ - cohere: (config) => { - return { - name: 'reranker-cohere', - config: config, - }; - }, - /** - * Create a `ModuleConfig<'reranker-jinaai', RerankerJinaAIConfig>` object for use when reranking using the `reranker-jinaai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/reranker) for detailed usage. - * - * @param {RerankerJinaAIConfig} [config] The configuration for the `reranker-jinaai` module. - * @returns {ModuleConfig<'reranker-jinaai', RerankerJinaAIConfig | undefined>} The configuration object. - */ - jinaai: (config) => { - return { - name: 'reranker-jinaai', - config: config, - }; - }, - /** - * Create a `ModuleConfig<'reranker-transformers', Record>` object for use when reranking using the `reranker-transformers` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/reranker) for detailed usage. - * - * @returns {ModuleConfig<'reranker-transformers', Record>} The configuration object. - */ - transformers: () => { - return { - name: 'reranker-transformers', - config: {}, - }; - }, - /** - * Create a `ModuleConfig<'reranker-voyageai', RerankerVoyageAIConfig>` object for use when reranking using the `reranker-voyageai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/reranker) for detailed usage. - * - * @param {RerankerVoyageAIConfig} [config] The configuration for the `reranker-voyage-ai` module. - * @returns {ModuleConfig<'reranker-voyage-ai', RerankerVoyageAIConfig | undefined>} The configuration object. - */ - voyageAI: (config) => { - return { - name: 'reranker-voyageai', - config: config, - }; - }, -}; diff --git a/dist/node/cjs/collections/configure/types/base.d.ts b/dist/node/cjs/collections/configure/types/base.d.ts deleted file mode 100644 index b9748366..00000000 --- a/dist/node/cjs/collections/configure/types/base.d.ts +++ /dev/null @@ -1,134 +0,0 @@ -import { WeaviateNestedProperty, WeaviateProperty } from '../../../openapi/types.js'; -import { - InvertedIndexConfig, - MultiTenancyConfig, - ReplicationConfig, - ReplicationDeletionStrategy, -} from '../../config/types/index.js'; -import { DataType } from '../../types/index.js'; -import { NonRefKeys, RefKeys } from '../../types/internal.js'; -export type RecursivePartial = T extends object - ? { - [P in keyof T]?: RecursivePartial; - } - : T; -export type InvertedIndexConfigCreate = RecursivePartial; -export type InvertedIndexConfigUpdate = { - bm25?: { - b?: number; - k1?: number; - }; - cleanupIntervalSeconds?: number; - stopwords?: { - preset?: string; - additions?: string[]; - removals?: string[]; - }; -}; -export type MultiTenancyConfigCreate = RecursivePartial; -export type NestedPropertyCreate = T extends undefined - ? { - name: string; - dataType: DataType; - description?: string; - nestedProperties?: NestedPropertyConfigCreate[]; - indexInverted?: boolean; - indexFilterable?: boolean; - indexSearchable?: boolean; - tokenization?: WeaviateNestedProperty['tokenization']; - } - : { - [K in NonRefKeys]: RequiresNested> extends true - ? { - name: K; - dataType: DataType; - nestedProperties: NestedPropertyConfigCreate>[]; - } & NestedPropertyConfigCreateBase - : { - name: K; - dataType: DataType; - nestedProperties?: NestedPropertyConfigCreate>[]; - } & NestedPropertyConfigCreateBase; - }[NonRefKeys]; -export type NestedPropertyConfigCreate = D extends 'object' | 'object[]' - ? T extends (infer U)[] - ? NestedPropertyCreate - : NestedPropertyCreate - : never; -export type RequiresNested = T extends 'object' | 'object[]' ? true : false; -export type PropertyConfigCreateBase = { - description?: string; - indexInverted?: boolean; - indexFilterable?: boolean; - indexRangeFilters?: boolean; - indexSearchable?: boolean; - tokenization?: WeaviateProperty['tokenization']; - skipVectorization?: boolean; - vectorizePropertyName?: boolean; -}; -export type NestedPropertyConfigCreateBase = { - description?: string; - indexInverted?: boolean; - indexFilterable?: boolean; - indexRangeFilters?: boolean; - indexSearchable?: boolean; - tokenization?: WeaviateNestedProperty['tokenization']; -}; -export type PropertyConfigCreate = T extends undefined - ? { - name: string; - dataType: DataType; - description?: string; - nestedProperties?: NestedPropertyConfigCreate[]; - indexInverted?: boolean; - indexFilterable?: boolean; - indexRangeFilters?: boolean; - indexSearchable?: boolean; - tokenization?: WeaviateProperty['tokenization']; - skipVectorization?: boolean; - vectorizePropertyName?: boolean; - } - : { - [K in NonRefKeys]: RequiresNested> extends true - ? { - name: K; - dataType: DataType; - nestedProperties: NestedPropertyConfigCreate>[]; - } & PropertyConfigCreateBase - : { - name: K; - dataType: DataType; - nestedProperties?: NestedPropertyConfigCreate>[]; - } & PropertyConfigCreateBase; - }[NonRefKeys]; -/** The base class for creating a reference configuration. */ -export type ReferenceConfigBaseCreate = { - /** The name of the reference. If no generic passed, the type is string. If a generic is passed, the type is a union of the keys labelled as CrossReference. */ - name: T extends undefined ? string : RefKeys; - /** The description of the reference. */ - description?: string; -}; -/** Use this type when defining a single-target reference for your collection. */ -export type ReferenceSingleTargetConfigCreate = ReferenceConfigBaseCreate & { - /** The collection that this reference points to. */ - targetCollection: string; -}; -/** Use this type when defining a multi-target reference for your collection. */ -export type ReferenceMultiTargetConfigCreate = ReferenceConfigBaseCreate & { - /** The collection(s) that this reference points to. */ - targetCollections: string[]; -}; -export type ReferenceConfigCreate = - | ReferenceSingleTargetConfigCreate - | ReferenceMultiTargetConfigCreate; -export type ReplicationConfigCreate = RecursivePartial; -export type ReplicationConfigUpdate = { - asyncEnabled?: boolean; - deletionStrategy?: ReplicationDeletionStrategy; - factor?: number; -}; -export type ShardingConfigCreate = { - virtualPerPhysical?: number; - desiredCount?: number; - desiredVirtualCount?: number; -}; diff --git a/dist/node/cjs/collections/configure/types/base.js b/dist/node/cjs/collections/configure/types/base.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/configure/types/base.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/configure/types/generative.d.ts b/dist/node/cjs/collections/configure/types/generative.d.ts deleted file mode 100644 index b35d95f5..00000000 --- a/dist/node/cjs/collections/configure/types/generative.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { - GenerativeAWSConfig, - GenerativeAnthropicConfig, - GenerativeAnyscaleConfig, - GenerativeDatabricksConfig, - GenerativeFriendliAIConfig, - GenerativeMistralConfig, - GenerativeOctoAIConfig, - GenerativeOllamaConfig, - GenerativePaLMConfig, -} from '../../index.js'; -export type GenerativeOpenAIConfigBaseCreate = { - baseURL?: string; - frequencyPenalty?: number; - maxTokens?: number; - presencePenalty?: number; - temperature?: number; - topP?: number; -}; -export type GenerativeAnthropicConfigCreate = GenerativeAnthropicConfig; -export type GenerativeAnyscaleConfigCreate = GenerativeAnyscaleConfig; -export type GenerativeAWSConfigCreate = GenerativeAWSConfig; -export type GenerativeAzureOpenAIConfigCreate = GenerativeOpenAIConfigBaseCreate & { - resourceName: string; - deploymentId: string; -}; -export type GenerativeCohereConfigCreate = { - k?: number; - maxTokens?: number; - model?: string; - returnLikelihoods?: string; - stopSequences?: string[]; - temperature?: number; -}; -export type GenerativeDatabricksConfigCreate = GenerativeDatabricksConfig; -export type GenerativeFriendliAIConfigCreate = GenerativeFriendliAIConfig; -export type GenerativeMistralConfigCreate = GenerativeMistralConfig; -export type GenerativeOctoAIConfigCreate = GenerativeOctoAIConfig; -export type GenerativeOllamaConfigCreate = GenerativeOllamaConfig; -export type GenerativeOpenAIConfigCreate = GenerativeOpenAIConfigBaseCreate & { - model?: string; -}; -export type GenerativePaLMConfigCreate = GenerativePaLMConfig; -export type GenerativeConfigCreate = - | GenerativeAnthropicConfigCreate - | GenerativeAnyscaleConfigCreate - | GenerativeAWSConfigCreate - | GenerativeAzureOpenAIConfigCreate - | GenerativeCohereConfigCreate - | GenerativeDatabricksConfigCreate - | GenerativeFriendliAIConfigCreate - | GenerativeMistralConfigCreate - | GenerativeOctoAIConfigCreate - | GenerativeOllamaConfigCreate - | GenerativeOpenAIConfigCreate - | GenerativePaLMConfigCreate - | Record - | undefined; -export type GenerativeConfigCreateType = G extends 'generative-anthropic' - ? GenerativeAnthropicConfigCreate - : G extends 'generative-aws' - ? GenerativeAWSConfigCreate - : G extends 'generative-azure-openai' - ? GenerativeAzureOpenAIConfigCreate - : G extends 'generative-cohere' - ? GenerativeCohereConfigCreate - : G extends 'generative-databricks' - ? GenerativeDatabricksConfigCreate - : G extends 'generative-friendliai' - ? GenerativeFriendliAIConfigCreate - : G extends 'generative-mistral' - ? GenerativeMistralConfigCreate - : G extends 'generative-octoai' - ? GenerativeOctoAIConfigCreate - : G extends 'generative-ollama' - ? GenerativeOllamaConfigCreate - : G extends 'generative-openai' - ? GenerativeOpenAIConfigCreate - : G extends 'generative-palm' - ? GenerativePaLMConfigCreate - : G extends 'none' - ? undefined - : Record | undefined; diff --git a/dist/node/cjs/collections/configure/types/generative.js b/dist/node/cjs/collections/configure/types/generative.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/configure/types/generative.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/configure/types/index.d.ts b/dist/node/cjs/collections/configure/types/index.d.ts deleted file mode 100644 index 4a00d3cf..00000000 --- a/dist/node/cjs/collections/configure/types/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './base.js'; -export * from './generative.js'; -export * from './vectorIndex.js'; -export * from './vectorizer.js'; diff --git a/dist/node/cjs/collections/configure/types/index.js b/dist/node/cjs/collections/configure/types/index.js deleted file mode 100644 index 063fb710..00000000 --- a/dist/node/cjs/collections/configure/types/index.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __exportStar = - (this && this.__exportStar) || - function (m, exports) { - for (var p in m) - if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) - __createBinding(exports, m, p); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -__exportStar(require('./base.js'), exports); -__exportStar(require('./generative.js'), exports); -__exportStar(require('./vectorIndex.js'), exports); -__exportStar(require('./vectorizer.js'), exports); diff --git a/dist/node/cjs/collections/configure/types/vectorIndex.d.ts b/dist/node/cjs/collections/configure/types/vectorIndex.d.ts deleted file mode 100644 index 31ec77b5..00000000 --- a/dist/node/cjs/collections/configure/types/vectorIndex.d.ts +++ /dev/null @@ -1,136 +0,0 @@ -import { - BQConfig, - ModuleConfig, - PQConfig, - PQEncoderDistribution, - PQEncoderType, - SQConfig, - VectorDistance, - VectorIndexConfigDynamic, - VectorIndexConfigFlat, - VectorIndexConfigHNSW, - VectorIndexFilterStrategy, -} from '../../config/types/index.js'; -import { RecursivePartial } from './base.js'; -export type QuantizerRecursivePartial = { - [P in keyof T]: P extends 'type' ? T[P] : RecursivePartial | undefined; -}; -export type PQConfigCreate = QuantizerRecursivePartial; -export type PQConfigUpdate = { - centroids?: number; - enabled?: boolean; - segments?: number; - trainingLimit?: number; - encoder?: { - type?: PQEncoderType; - distribution?: PQEncoderDistribution; - }; - type: 'pq'; -}; -export type BQConfigCreate = QuantizerRecursivePartial; -export type BQConfigUpdate = { - rescoreLimit?: number; - type: 'bq'; -}; -export type SQConfigCreate = QuantizerRecursivePartial; -export type SQConfigUpdate = { - rescoreLimit?: number; - trainingLimit?: number; - type: 'sq'; -}; -export type VectorIndexConfigHNSWCreate = RecursivePartial; -export type VectorIndexConfigDynamicCreate = RecursivePartial; -export type VectorIndexConfigDymamicUpdate = RecursivePartial; -export type VectorIndexConfigHNSWUpdate = { - dynamicEfMin?: number; - dynamicEfMax?: number; - dynamicEfFactor?: number; - ef?: number; - filterStrategy?: VectorIndexFilterStrategy; - flatSearchCutoff?: number; - quantizer?: PQConfigUpdate | BQConfigUpdate | SQConfigUpdate; - vectorCacheMaxObjects?: number; -}; -export type VectorIndexConfigCreateType = I extends 'hnsw' - ? VectorIndexConfigHNSWCreate | undefined - : I extends 'flat' - ? VectorIndexConfigFlatCreate | undefined - : I extends 'dynamic' - ? VectorIndexConfigDynamicCreate | undefined - : I extends string - ? Record - : never; -export type VectorIndexConfigFlatCreate = RecursivePartial; -export type VectorIndexConfigFlatUpdate = { - quantizer?: BQConfigUpdate; - vectorCacheMaxObjects?: number; -}; -export type VectorIndexConfigCreate = - | VectorIndexConfigFlatCreate - | VectorIndexConfigHNSWCreate - | VectorIndexConfigDynamicCreate - | Record - | undefined; -export type VectorIndexConfigUpdate = - | VectorIndexConfigFlatUpdate - | VectorIndexConfigHNSWUpdate - | VectorIndexConfigDymamicUpdate - | Record - | undefined; -export type VectorIndexConfigUpdateType = I extends 'hnsw' - ? VectorIndexConfigHNSWUpdate - : I extends 'flat' - ? VectorIndexConfigFlatUpdate - : I extends 'dynamic' - ? VectorIndexConfigDymamicUpdate - : I extends string - ? Record - : never; -export type LegacyVectorizerConfigUpdate = - | ModuleConfig<'flat', VectorIndexConfigFlatUpdate> - | ModuleConfig<'hnsw', VectorIndexConfigHNSWUpdate> - | ModuleConfig>; -export type VectorIndexConfigHNSWCreateOptions = { - /** The interval in seconds at which to clean up the index. Default is 300. */ - cleanupIntervalSeconds?: number; - /** The distance metric to use. Default is 'cosine'. */ - distanceMetric?: VectorDistance; - /** The dynamic ef factor. Default is 8. */ - dynamicEfFactor?: number; - /** The dynamic ef max. Default is 500. */ - dynamicEfMax?: number; - /** The dynamic ef min. Default is 100. */ - dynamicEfMin?: number; - /** The ef parameter. Default is -1. */ - ef?: number; - /** The ef construction parameter. Default is 128. */ - efConstruction?: number; - /** The flat search cutoff. Default is 40000. */ - flatSearchCutoff?: number; - /** The maximum number of connections. Default is 64. */ - maxConnections?: number; - /** The quantizer configuration to use. Use `vectorIndex.quantizer.bq` or `vectorIndex.quantizer.pq` to make one. */ - quantizer?: PQConfigCreate | BQConfigCreate | SQConfigCreate; - /** Whether to skip the index. Default is false. */ - skip?: boolean; - /** The maximum number of objects to cache in the vector cache. Default is 1000000000000. */ - vectorCacheMaxObjects?: number; -}; -export type VectorIndexConfigFlatCreateOptions = { - /** The distance metric to use. Default is 'cosine'. */ - distanceMetric?: VectorDistance; - /** The maximum number of objects to cache in the vector cache. Default is 1000000000000. */ - vectorCacheMaxObjects?: number; - /** The quantizer configuration to use. Default is `bq`. */ - quantizer?: BQConfigCreate; -}; -export type VectorIndexConfigDynamicCreateOptions = { - /** The distance metric to use. Default is 'cosine'. */ - distanceMetric?: VectorDistance; - /** The threshold at which to . Default is 0. */ - threshold?: number; - /** The HNSW configuration of the dynamic index. Use `configure.vectorIndex.hnsw` to make one or supply the type directly. */ - hnsw?: ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate | undefined> | VectorIndexConfigHNSWCreateOptions; - /** The flat configuration of the dynamic index. Use `configure.vectorIndex.flat` to make one or supply the type directly. */ - flat?: ModuleConfig<'flat', VectorIndexConfigFlatCreate | undefined> | VectorIndexConfigFlatCreateOptions; -}; diff --git a/dist/node/cjs/collections/configure/types/vectorIndex.js b/dist/node/cjs/collections/configure/types/vectorIndex.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/configure/types/vectorIndex.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/configure/types/vectorizer.d.ts b/dist/node/cjs/collections/configure/types/vectorizer.d.ts deleted file mode 100644 index 97168816..00000000 --- a/dist/node/cjs/collections/configure/types/vectorizer.d.ts +++ /dev/null @@ -1,190 +0,0 @@ -import { - Img2VecNeuralConfig, - ModuleConfig, - Multi2VecField, - Ref2VecCentroidConfig, - Text2VecAWSConfig, - Text2VecAzureOpenAIConfig, - Text2VecCohereConfig, - Text2VecContextionaryConfig, - Text2VecDatabricksConfig, - Text2VecGPT4AllConfig, - Text2VecGoogleConfig, - Text2VecHuggingFaceConfig, - Text2VecJinaConfig, - Text2VecMistralConfig, - Text2VecOctoAIConfig, - Text2VecOllamaConfig, - Text2VecOpenAIConfig, - Text2VecTransformersConfig, - Text2VecVoyageAIConfig, - VectorIndexType, - Vectorizer, - VectorizerConfigType, -} from '../../config/types/index.js'; -import { PrimitiveKeys } from '../../types/internal.js'; -import { VectorIndexConfigCreateType, VectorIndexConfigUpdateType } from './vectorIndex.js'; -export type VectorizerCreateOptions = { - sourceProperties?: P; - vectorIndexConfig?: ModuleConfig>; - vectorizerConfig?: ModuleConfig>; -}; -export type VectorizerUpdateOptions = { - name?: N; - vectorIndexConfig: ModuleConfig>; -}; -export type VectorConfigCreate< - P, - N extends string | undefined, - I extends VectorIndexType, - V extends Vectorizer -> = { - name: N; - properties?: P[]; - vectorizer: ModuleConfig>; - vectorIndex: ModuleConfig>; -}; -export type VectorConfigUpdate = { - name: N; - vectorIndex: ModuleConfig>; -}; -export type VectorizersConfigCreate = - | VectorConfigCreate, undefined, VectorIndexType, Vectorizer> - | VectorConfigCreate, string, VectorIndexType, Vectorizer>[]; -export type ConfigureNonTextVectorizerOptions< - N extends string | undefined, - I extends VectorIndexType, - V extends Vectorizer -> = VectorizerConfigCreateType & { - name?: N; - vectorIndexConfig?: ModuleConfig>; -}; -export type ConfigureTextVectorizerOptions< - T, - N extends string | undefined, - I extends VectorIndexType, - V extends Vectorizer -> = VectorizerConfigCreateType & { - name?: N; - sourceProperties?: PrimitiveKeys[]; - vectorIndexConfig?: ModuleConfig>; -}; -export type Img2VecNeuralConfigCreate = Img2VecNeuralConfig; -/** The configuration for the `multi2vec-clip` vectorizer. */ -export type Multi2VecClipConfigCreate = { - /** The image fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - imageFields?: string[] | Multi2VecField[]; - /** The inference url to use where API requests should go. */ - inferenceUrl?: string; - /** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - textFields?: string[] | Multi2VecField[]; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** The configuration for the `multi2vec-bind` vectorizer. */ -export type Multi2VecBindConfigCreate = { - /** The audio fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - audioFields?: string[] | Multi2VecField[]; - /** The depth fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - depthFields?: string[] | Multi2VecField[]; - /** The image fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - imageFields?: string[] | Multi2VecField[]; - /** The IMU fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - IMUFields?: string[] | Multi2VecField[]; - /** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - textFields?: string[] | Multi2VecField[]; - /** The thermal fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - thermalFields?: string[] | Multi2VecField[]; - /** The video fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - videoFields?: string[] | Multi2VecField[]; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** @deprecated Use `Multi2VecGoogleConfigCreate` instead.*/ -export type Multi2VecPalmConfigCreate = Multi2VecGoogleConfigCreate; -/** The configuration for the `multi2vec-google` vectorizer. */ -export type Multi2VecGoogleConfigCreate = { - /** The project id of the model in GCP. */ - projectId: string; - /** Where the model runs */ - location: string; - /** The image fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - imageFields?: string[] | Multi2VecField[]; - /** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - textFields?: string[] | Multi2VecField[]; - /** The video fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - videoFields?: string[] | Multi2VecField[]; - /** The model ID to use. */ - modelId?: string; - /** The number of dimensions to use. */ - dimensions?: number; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -export type Ref2VecCentroidConfigCreate = Ref2VecCentroidConfig; -export type Text2VecAWSConfigCreate = Text2VecAWSConfig; -export type Text2VecAzureOpenAIConfigCreate = Text2VecAzureOpenAIConfig; -export type Text2VecCohereConfigCreate = Text2VecCohereConfig; -export type Text2VecContextionaryConfigCreate = Text2VecContextionaryConfig; -export type Text2VecDatabricksConfigCreate = Text2VecDatabricksConfig; -export type Text2VecGPT4AllConfigCreate = Text2VecGPT4AllConfig; -export type Text2VecHuggingFaceConfigCreate = Text2VecHuggingFaceConfig; -export type Text2VecJinaConfigCreate = Text2VecJinaConfig; -export type Text2VecMistralConfigCreate = Text2VecMistralConfig; -export type Text2VecOctoAIConfigCreate = Text2VecOctoAIConfig; -export type Text2VecOllamaConfigCreate = Text2VecOllamaConfig; -export type Text2VecOpenAIConfigCreate = Text2VecOpenAIConfig; -/** @deprecated Use `Text2VecGoogleConfigCreate` instead. */ -export type Text2VecPalmConfigCreate = Text2VecGoogleConfig; -export type Text2VecGoogleConfigCreate = Text2VecGoogleConfig; -export type Text2VecTransformersConfigCreate = Text2VecTransformersConfig; -export type Text2VecVoyageAIConfigCreate = Text2VecVoyageAIConfig; -export type VectorizerConfigCreateType = V extends 'img2vec-neural' - ? Img2VecNeuralConfigCreate | undefined - : V extends 'multi2vec-clip' - ? Multi2VecClipConfigCreate | undefined - : V extends 'multi2vec-bind' - ? Multi2VecBindConfigCreate | undefined - : V extends 'multi2vec-palm' - ? Multi2VecPalmConfigCreate - : V extends 'multi2vec-google' - ? Multi2VecGoogleConfigCreate - : V extends 'ref2vec-centroid' - ? Ref2VecCentroidConfigCreate - : V extends 'text2vec-aws' - ? Text2VecAWSConfigCreate - : V extends 'text2vec-contextionary' - ? Text2VecContextionaryConfigCreate | undefined - : V extends 'text2vec-cohere' - ? Text2VecCohereConfigCreate | undefined - : V extends 'text2vec-databricks' - ? Text2VecDatabricksConfigCreate - : V extends 'text2vec-gpt4all' - ? Text2VecGPT4AllConfigCreate | undefined - : V extends 'text2vec-huggingface' - ? Text2VecHuggingFaceConfigCreate | undefined - : V extends 'text2vec-jina' - ? Text2VecJinaConfigCreate | undefined - : V extends 'text2vec-mistral' - ? Text2VecMistralConfigCreate | undefined - : V extends 'text2vec-octoai' - ? Text2VecOctoAIConfigCreate | undefined - : V extends 'text2vec-ollama' - ? Text2VecOllamaConfigCreate | undefined - : V extends 'text2vec-openai' - ? Text2VecOpenAIConfigCreate | undefined - : V extends 'text2vec-azure-openai' - ? Text2VecAzureOpenAIConfigCreate - : V extends 'text2vec-palm' - ? Text2VecPalmConfigCreate | undefined - : V extends 'text2vec-google' - ? Text2VecGoogleConfigCreate | undefined - : V extends 'text2vec-transformers' - ? Text2VecTransformersConfigCreate | undefined - : V extends 'text2vec-voyageai' - ? Text2VecVoyageAIConfigCreate | undefined - : V extends 'none' - ? {} - : V extends undefined - ? undefined - : never; diff --git a/dist/node/cjs/collections/configure/types/vectorizer.js b/dist/node/cjs/collections/configure/types/vectorizer.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/configure/types/vectorizer.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/configure/vectorIndex.d.ts b/dist/node/cjs/collections/configure/vectorIndex.d.ts deleted file mode 100644 index 4145e7be..00000000 --- a/dist/node/cjs/collections/configure/vectorIndex.d.ts +++ /dev/null @@ -1,181 +0,0 @@ -import { ModuleConfig, PQEncoderDistribution, PQEncoderType } from '../config/types/index.js'; -import { - BQConfigCreate, - BQConfigUpdate, - PQConfigCreate, - PQConfigUpdate, - SQConfigCreate, - SQConfigUpdate, - VectorIndexConfigDynamicCreate, - VectorIndexConfigDynamicCreateOptions, - VectorIndexConfigFlatCreate, - VectorIndexConfigFlatCreateOptions, - VectorIndexConfigFlatUpdate, - VectorIndexConfigHNSWCreate, - VectorIndexConfigHNSWCreateOptions, - VectorIndexConfigHNSWUpdate, -} from './types/index.js'; -declare const configure: { - /** - * Create a `ModuleConfig<'flat', VectorIndexConfigFlatCreate | undefined>` object when defining the configuration of the FLAT vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `configure.vectorizer` method. - * - * @param {VectorIndexConfigFlatCreateOptions} [opts] The options available for configuring the flat vector index. - * @returns {ModuleConfig<'flat', VectorIndexConfigFlatCreate | undefined>} The configuration object. - */ - flat: ( - opts?: VectorIndexConfigFlatCreateOptions - ) => ModuleConfig<'flat', VectorIndexConfigFlatCreate | undefined>; - /** - * Create a `ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate | undefined>` object when defining the configuration of the HNSW vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `configure.vectorizer` method. - * - * @param {VectorIndexConfigHNSWCreateOptions} [opts] The options available for configuring the HNSW vector index. - * @returns {ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate | undefined>} The configuration object. - */ - hnsw: ( - opts?: VectorIndexConfigHNSWCreateOptions - ) => ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate | undefined>; - /** - * Create a `ModuleConfig<'dynamic', VectorIndexConfigDynamicCreate | undefined>` object when defining the configuration of the dynamic vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `configure.vectorizer` method. - * - * @param {VectorIndexConfigDynamicCreateOptions} [opts] The options available for configuring the dynamic vector index. - * @returns {ModuleConfig<'dynamic', VectorIndexConfigDynamicCreate | undefined>} The configuration object. - */ - dynamic: ( - opts?: VectorIndexConfigDynamicCreateOptions - ) => ModuleConfig<'dynamic', VectorIndexConfigDynamicCreate | undefined>; - /** - * Define the quantizer configuration to use when creating a vector index. - */ - quantizer: { - /** - * Create an object of type `BQConfigCreate` to be used when defining the quantizer configuration of a vector index. - * - * @param {boolean} [options.cache] Whether to cache the quantizer. Default is false. - * @param {number} [options.rescoreLimit] The rescore limit. Default is 1000. - * @returns {BQConfigCreate} The object of type `BQConfigCreate`. - */ - bq: (options?: { cache?: boolean; rescoreLimit?: number }) => BQConfigCreate; - /** - * Create an object of type `PQConfigCreate` to be used when defining the quantizer configuration of a vector index. - * - * @param {boolean} [options.bitCompression] Whether to use bit compression. - * @param {number} [options.centroids] The number of centroids[. - * @param {PQEncoderDistribution} ]options.encoder.distribution The encoder distribution. - * @param {PQEncoderType} [options.encoder.type] The encoder type. - * @param {number} [options.segments] The number of segments. - * @param {number} [options.trainingLimit] The training limit. - * @returns {PQConfigCreate} The object of type `PQConfigCreate`. - */ - pq: (options?: { - bitCompression?: boolean; - centroids?: number; - encoder?: { - distribution?: PQEncoderDistribution; - type?: PQEncoderType; - }; - segments?: number; - trainingLimit?: number; - }) => PQConfigCreate; - /** - * Create an object of type `SQConfigCreate` to be used when defining the quantizer configuration of a vector index. - * - * @param {number} [options.rescoreLimit] The rescore limit. - * @param {number} [options.trainingLimit] The training limit. - * @returns {SQConfigCreate} The object of type `SQConfigCreate`. - */ - sq: (options?: { rescoreLimit?: number; trainingLimit?: number }) => SQConfigCreate; - }; -}; -declare const reconfigure: { - /** - * Create a `ModuleConfig<'flat', VectorIndexConfigFlatUpdate>` object to update the configuration of the FLAT vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `reconfigure.vectorizer` method. - * - * @param {VectorDistance} [options.distanceMetric] The distance metric to use. Default is 'cosine'. - * @param {number} [options.vectorCacheMaxObjects] The maximum number of objects to cache in the vector cache. Default is 1000000000000. - * @param {BQConfigCreate} [options.quantizer] The quantizer configuration to use. Default is `bq`. - * @returns {ModuleConfig<'flat', VectorIndexConfigFlatCreate>} The configuration object. - */ - flat: (options: { - vectorCacheMaxObjects?: number; - quantizer?: BQConfigUpdate; - }) => ModuleConfig<'flat', VectorIndexConfigFlatUpdate>; - /** - * Create a `ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate>` object to update the configuration of the HNSW vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `reconfigure.vectorizer` method. - * - * @param {number} [options.dynamicEfFactor] The dynamic ef factor. Default is 8. - * @param {number} [options.dynamicEfMax] The dynamic ef max. Default is 500. - * @param {number} [options.dynamicEfMin] The dynamic ef min. Default is 100. - * @param {number} [options.ef] The ef parameter. Default is -1. - * @param {number} [options.flatSearchCutoff] The flat search cutoff. Default is 40000. - * @param {PQConfigUpdate | BQConfigUpdate} [options.quantizer] The quantizer configuration to use. Use `vectorIndex.quantizer.bq` or `vectorIndex.quantizer.pq` to make one. - * @param {number} [options.vectorCacheMaxObjects] The maximum number of objects to cache in the vector cache. Default is 1000000000000. - * @returns {ModuleConfig<'hnsw', VectorIndexConfigHNSWUpdate>} The configuration object. - */ - hnsw: (options: { - dynamicEfFactor?: number; - dynamicEfMax?: number; - dynamicEfMin?: number; - ef?: number; - flatSearchCutoff?: number; - quantizer?: PQConfigUpdate | BQConfigUpdate | SQConfigUpdate; - vectorCacheMaxObjects?: number; - }) => ModuleConfig<'hnsw', VectorIndexConfigHNSWUpdate>; - /** - * Define the quantizer configuration to use when creating a vector index. - */ - quantizer: { - /** - * Create an object of type `BQConfigUpdate` to be used when updating the quantizer configuration of a vector index. - * - * NOTE: If the vector index already has a quantizer configured, you cannot change its quantizer type; only its values. - * So if you want to change the quantizer type, you must recreate the collection. - * - * @param {boolean} [options.cache] Whether to cache the quantizer. - * @param {number} [options.rescoreLimit] The new rescore limit. - * @returns {BQConfigCreate} The configuration object. - */ - bq: (options?: { cache?: boolean; rescoreLimit?: number }) => BQConfigUpdate; - /** - * Create an object of type `PQConfigUpdate` to be used when updating the quantizer configuration of a vector index. - * - * NOTE: If the vector index already has a quantizer configured, you cannot change its quantizer type; only its values. - * So if you want to change the quantizer type, you must recreate the collection. - * - * @param {number} [options.centroids] The new number of centroids. - * @param {PQEncoderDistribution} [options.pqEncoderDistribution] The new encoder distribution. - * @param {PQEncoderType} [options.pqEncoderType] The new encoder type. - * @param {number} [options.segments] The new number of segments. - * @param {number} [options.trainingLimit] The new training limit. - * @returns {PQConfigUpdate} The configuration object. - */ - pq: (options?: { - centroids?: number; - pqEncoderDistribution?: PQEncoderDistribution; - pqEncoderType?: PQEncoderType; - segments?: number; - trainingLimit?: number; - }) => PQConfigUpdate; - /** - * Create an object of type `SQConfigUpdate` to be used when updating the quantizer configuration of a vector index. - * - * NOTE: If the vector index already has a quantizer configured, you cannot change its quantizer type; only its values. - * So if you want to change the quantizer type, you must recreate the collection. - * - * @param {number} [options.rescoreLimit] The rescore limit. - * @param {number} [options.trainingLimit] The training limit. - * @returns {SQConfigUpdate} The configuration object. - */ - sq: (options?: { rescoreLimit?: number; trainingLimit?: number }) => SQConfigUpdate; - }; -}; -export { configure, reconfigure }; diff --git a/dist/node/cjs/collections/configure/vectorIndex.js b/dist/node/cjs/collections/configure/vectorIndex.js deleted file mode 100644 index df43148f..00000000 --- a/dist/node/cjs/collections/configure/vectorIndex.js +++ /dev/null @@ -1,236 +0,0 @@ -'use strict'; -var __rest = - (this && this.__rest) || - function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === 'function') - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.reconfigure = exports.configure = void 0; -const isModuleConfig = (config) => { - return config && typeof config === 'object' && 'name' in config && 'config' in config; -}; -const configure = { - /** - * Create a `ModuleConfig<'flat', VectorIndexConfigFlatCreate | undefined>` object when defining the configuration of the FLAT vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `configure.vectorizer` method. - * - * @param {VectorIndexConfigFlatCreateOptions} [opts] The options available for configuring the flat vector index. - * @returns {ModuleConfig<'flat', VectorIndexConfigFlatCreate | undefined>} The configuration object. - */ - flat: (opts) => { - const { distanceMetric: distance, vectorCacheMaxObjects, quantizer } = opts || {}; - return { - name: 'flat', - config: { - distance, - vectorCacheMaxObjects, - quantizer: quantizer, - }, - }; - }, - /** - * Create a `ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate | undefined>` object when defining the configuration of the HNSW vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `configure.vectorizer` method. - * - * @param {VectorIndexConfigHNSWCreateOptions} [opts] The options available for configuring the HNSW vector index. - * @returns {ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate | undefined>} The configuration object. - */ - hnsw: (opts) => { - const _a = opts || {}, - { distanceMetric } = _a, - rest = __rest(_a, ['distanceMetric']); - return { - name: 'hnsw', - config: rest - ? Object.assign(Object.assign({}, rest), { distance: distanceMetric, quantizer: rest.quantizer }) - : undefined, - }; - }, - /** - * Create a `ModuleConfig<'dynamic', VectorIndexConfigDynamicCreate | undefined>` object when defining the configuration of the dynamic vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `configure.vectorizer` method. - * - * @param {VectorIndexConfigDynamicCreateOptions} [opts] The options available for configuring the dynamic vector index. - * @returns {ModuleConfig<'dynamic', VectorIndexConfigDynamicCreate | undefined>} The configuration object. - */ - dynamic: (opts) => { - return { - name: 'dynamic', - config: opts - ? { - distance: opts.distanceMetric, - threshold: opts.threshold, - hnsw: isModuleConfig(opts.hnsw) ? opts.hnsw.config : configure.hnsw(opts.hnsw).config, - flat: isModuleConfig(opts.flat) ? opts.flat.config : configure.flat(opts.flat).config, - } - : undefined, - }; - }, - /** - * Define the quantizer configuration to use when creating a vector index. - */ - quantizer: { - /** - * Create an object of type `BQConfigCreate` to be used when defining the quantizer configuration of a vector index. - * - * @param {boolean} [options.cache] Whether to cache the quantizer. Default is false. - * @param {number} [options.rescoreLimit] The rescore limit. Default is 1000. - * @returns {BQConfigCreate} The object of type `BQConfigCreate`. - */ - bq: (options) => { - return { - cache: options === null || options === void 0 ? void 0 : options.cache, - rescoreLimit: options === null || options === void 0 ? void 0 : options.rescoreLimit, - type: 'bq', - }; - }, - /** - * Create an object of type `PQConfigCreate` to be used when defining the quantizer configuration of a vector index. - * - * @param {boolean} [options.bitCompression] Whether to use bit compression. - * @param {number} [options.centroids] The number of centroids[. - * @param {PQEncoderDistribution} ]options.encoder.distribution The encoder distribution. - * @param {PQEncoderType} [options.encoder.type] The encoder type. - * @param {number} [options.segments] The number of segments. - * @param {number} [options.trainingLimit] The training limit. - * @returns {PQConfigCreate} The object of type `PQConfigCreate`. - */ - pq: (options) => { - return { - bitCompression: options === null || options === void 0 ? void 0 : options.bitCompression, - centroids: options === null || options === void 0 ? void 0 : options.centroids, - encoder: (options === null || options === void 0 ? void 0 : options.encoder) - ? { - distribution: options.encoder.distribution, - type: options.encoder.type, - } - : undefined, - segments: options === null || options === void 0 ? void 0 : options.segments, - trainingLimit: options === null || options === void 0 ? void 0 : options.trainingLimit, - type: 'pq', - }; - }, - /** - * Create an object of type `SQConfigCreate` to be used when defining the quantizer configuration of a vector index. - * - * @param {number} [options.rescoreLimit] The rescore limit. - * @param {number} [options.trainingLimit] The training limit. - * @returns {SQConfigCreate} The object of type `SQConfigCreate`. - */ - sq: (options) => { - return { - rescoreLimit: options === null || options === void 0 ? void 0 : options.rescoreLimit, - trainingLimit: options === null || options === void 0 ? void 0 : options.trainingLimit, - type: 'sq', - }; - }, - }, -}; -exports.configure = configure; -const reconfigure = { - /** - * Create a `ModuleConfig<'flat', VectorIndexConfigFlatUpdate>` object to update the configuration of the FLAT vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `reconfigure.vectorizer` method. - * - * @param {VectorDistance} [options.distanceMetric] The distance metric to use. Default is 'cosine'. - * @param {number} [options.vectorCacheMaxObjects] The maximum number of objects to cache in the vector cache. Default is 1000000000000. - * @param {BQConfigCreate} [options.quantizer] The quantizer configuration to use. Default is `bq`. - * @returns {ModuleConfig<'flat', VectorIndexConfigFlatCreate>} The configuration object. - */ - flat: (options) => { - return { - name: 'flat', - config: options, - }; - }, - /** - * Create a `ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate>` object to update the configuration of the HNSW vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `reconfigure.vectorizer` method. - * - * @param {number} [options.dynamicEfFactor] The dynamic ef factor. Default is 8. - * @param {number} [options.dynamicEfMax] The dynamic ef max. Default is 500. - * @param {number} [options.dynamicEfMin] The dynamic ef min. Default is 100. - * @param {number} [options.ef] The ef parameter. Default is -1. - * @param {number} [options.flatSearchCutoff] The flat search cutoff. Default is 40000. - * @param {PQConfigUpdate | BQConfigUpdate} [options.quantizer] The quantizer configuration to use. Use `vectorIndex.quantizer.bq` or `vectorIndex.quantizer.pq` to make one. - * @param {number} [options.vectorCacheMaxObjects] The maximum number of objects to cache in the vector cache. Default is 1000000000000. - * @returns {ModuleConfig<'hnsw', VectorIndexConfigHNSWUpdate>} The configuration object. - */ - hnsw: (options) => { - return { - name: 'hnsw', - config: options, - }; - }, - /** - * Define the quantizer configuration to use when creating a vector index. - */ - quantizer: { - /** - * Create an object of type `BQConfigUpdate` to be used when updating the quantizer configuration of a vector index. - * - * NOTE: If the vector index already has a quantizer configured, you cannot change its quantizer type; only its values. - * So if you want to change the quantizer type, you must recreate the collection. - * - * @param {boolean} [options.cache] Whether to cache the quantizer. - * @param {number} [options.rescoreLimit] The new rescore limit. - * @returns {BQConfigCreate} The configuration object. - */ - bq: (options) => { - return Object.assign(Object.assign({}, options), { type: 'bq' }); - }, - /** - * Create an object of type `PQConfigUpdate` to be used when updating the quantizer configuration of a vector index. - * - * NOTE: If the vector index already has a quantizer configured, you cannot change its quantizer type; only its values. - * So if you want to change the quantizer type, you must recreate the collection. - * - * @param {number} [options.centroids] The new number of centroids. - * @param {PQEncoderDistribution} [options.pqEncoderDistribution] The new encoder distribution. - * @param {PQEncoderType} [options.pqEncoderType] The new encoder type. - * @param {number} [options.segments] The new number of segments. - * @param {number} [options.trainingLimit] The new training limit. - * @returns {PQConfigUpdate} The configuration object. - */ - pq: (options) => { - const _a = options || {}, - { pqEncoderDistribution, pqEncoderType } = _a, - rest = __rest(_a, ['pqEncoderDistribution', 'pqEncoderType']); - return Object.assign(Object.assign({}, rest), { - encoder: - pqEncoderDistribution || pqEncoderType - ? { - distribution: pqEncoderDistribution, - type: pqEncoderType, - } - : undefined, - type: 'pq', - }); - }, - /** - * Create an object of type `SQConfigUpdate` to be used when updating the quantizer configuration of a vector index. - * - * NOTE: If the vector index already has a quantizer configured, you cannot change its quantizer type; only its values. - * So if you want to change the quantizer type, you must recreate the collection. - * - * @param {number} [options.rescoreLimit] The rescore limit. - * @param {number} [options.trainingLimit] The training limit. - * @returns {SQConfigUpdate} The configuration object. - */ - sq: (options) => { - return Object.assign(Object.assign({}, options), { type: 'sq' }); - }, - }, -}; -exports.reconfigure = reconfigure; diff --git a/dist/node/cjs/collections/configure/vectorizer.d.ts b/dist/node/cjs/collections/configure/vectorizer.d.ts deleted file mode 100644 index 02dcb737..00000000 --- a/dist/node/cjs/collections/configure/vectorizer.d.ts +++ /dev/null @@ -1,388 +0,0 @@ -import { VectorConfigCreate, VectorIndexConfigCreateType } from '../index.js'; -import { PrimitiveKeys } from '../types/internal.js'; -import { ConfigureNonTextVectorizerOptions, ConfigureTextVectorizerOptions } from './types/index.js'; -export declare const vectorizer: { - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'none'`. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `none` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'none'>} The configuration object. - */ - none: ( - opts?: - | { - name?: N | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - } - | undefined - ) => VectorConfigCreate; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'img2vec-neural'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/img2vec-neural) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `img2vec-neural` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'img2vec-neural'>} The configuration object. - */ - img2VecNeural: ( - opts: import('../index.js').Img2VecNeuralConfig & { - name?: N_1 | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - } - ) => VectorConfigCreate; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-bind'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/imagebind/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `multi2vec-bind` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-bind'>} The configuration object. - */ - multi2VecBind: ( - opts?: - | (import('./types/vectorizer.js').Multi2VecBindConfigCreate & { - name?: N_2 | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-clip'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `multi2vec-clip` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-clip'>} The configuration object. - */ - multi2VecClip: ( - opts?: - | (import('./types/vectorizer.js').Multi2VecClipConfigCreate & { - name?: N_3 | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-palm'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} opts The configuration options for the `multi2vec-palm` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-palm'>} The configuration object. - * @deprecated Use `multi2VecGoogle` instead. - */ - multi2VecPalm: ( - opts: ConfigureNonTextVectorizerOptions - ) => VectorConfigCreate; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-google'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} opts The configuration options for the `multi2vec-google` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-google'>} The configuration object. - */ - multi2VecGoogle: ( - opts: ConfigureNonTextVectorizerOptions - ) => VectorConfigCreate; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'ref2vec-centroid'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/ref2vec-centroid) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} opts The configuration options for the `ref2vec-centroid` vectorizer. - * @returns {VectorConfigCreate} The configuration object. - */ - ref2VecCentroid: ( - opts: ConfigureNonTextVectorizerOptions - ) => VectorConfigCreate; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-aws'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/aws/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration options for the `text2vec-aws` vectorizer. - * @returns { VectorConfigCreate, N, I, 'text2vec-aws'>} The configuration object. - */ - text2VecAWS: ( - opts: ConfigureTextVectorizerOptions - ) => VectorConfigCreate, N_7, I_7, 'text2vec-aws'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-azure-openai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration options for the `text2vec-azure-openai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-azure-openai'>} The configuration object. - */ - text2VecAzureOpenAI: ( - opts: ConfigureTextVectorizerOptions - ) => VectorConfigCreate, N_8, I_8, 'text2vec-azure-openai'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-cohere'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration options for the `text2vec-cohere` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-cohere'>} The configuration object. - */ - text2VecCohere: ( - opts?: - | (import('../index.js').Text2VecCohereConfig & { - name?: N_9 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_9, I_9, 'text2vec-cohere'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-contextionary'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/text2vec-contextionary) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-contextionary` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-contextionary'>} The configuration object. - */ - text2VecContextionary: ( - opts?: - | (import('../index.js').Text2VecContextionaryConfig & { - name?: N_10 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_10, I_10, 'text2vec-contextionary'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-databricks'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/databricks/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration for the `text2vec-databricks` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-databricks'>} The configuration object. - */ - text2VecDatabricks: ( - opts: ConfigureTextVectorizerOptions - ) => VectorConfigCreate, N_11, I_11, 'text2vec-databricks'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-gpt4all'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/gpt4all/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-contextionary` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-gpt4all'>} The configuration object. - */ - text2VecGPT4All: ( - opts?: - | (import('../index.js').Text2VecGPT4AllConfig & { - name?: N_12 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_12, I_12, 'text2vec-gpt4all'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-huggingface'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/huggingface/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-contextionary` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-huggingface'>} The configuration object. - */ - text2VecHuggingFace: ( - opts?: - | (import('../index.js').Text2VecHuggingFaceConfig & { - name?: N_13 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_13, I_13, 'text2vec-huggingface'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-jina'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-jina` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-jina'>} The configuration object. - */ - text2VecJina: ( - opts?: - | (import('../index.js').Text2VecJinaConfig & { - name?: N_14 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_14, I_14, 'text2vec-jina'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-mistral'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/mistral/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-mistral` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-mistral'>} The configuration object. - */ - text2VecMistral: ( - opts?: - | (import('../index.js').Text2VecMistralConfig & { - name?: N_15 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_15, I_15, 'text2vec-mistral'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-octoai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/octoai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-octoai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-octoai'>} The configuration object. - */ - text2VecOctoAI: ( - opts?: - | (import('../index.js').Text2VecOctoAIConfig & { - name?: N_16 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_16, I_16, 'text2vec-octoai'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-openai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-openai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-openai'>} The configuration object. - */ - text2VecOpenAI: ( - opts?: - | (import('../index.js').Text2VecOpenAIConfig & { - name?: N_17 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_17, I_17, 'text2vec-openai'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-ollama'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/ollama/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-ollama` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-ollama'>} The configuration object. - */ - text2VecOllama: ( - opts?: - | (import('../index.js').Text2VecOllamaConfig & { - name?: N_18 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_18, I_18, 'text2vec-ollama'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-palm'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration for the `text2vec-palm` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-palm'>} The configuration object. - * @deprecated Use `text2VecGoogle` instead. - */ - text2VecPalm: ( - opts?: - | (import('../index.js').Text2VecGoogleConfig & { - name?: N_19 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_19, I_19, 'text2vec-palm'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-google'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration for the `text2vec-palm` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-google'>} The configuration object. - */ - text2VecGoogle: ( - opts?: - | (import('../index.js').Text2VecGoogleConfig & { - name?: N_20 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_20, I_20, 'text2vec-google'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-transformers'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-transformers` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-transformers'>} The configuration object. - */ - text2VecTransformers: ( - opts?: - | (import('../index.js').Text2VecTransformersConfig & { - name?: N_21 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_21, I_21, 'text2vec-transformers'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-voyageai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-voyageai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-voyageai'>} The configuration object. - */ - text2VecVoyageAI: ( - opts?: - | (import('../index.js').Text2VecVoyageAIConfig & { - name?: N_22 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_22, I_22, 'text2vec-voyageai'>; -}; diff --git a/dist/node/cjs/collections/configure/vectorizer.js b/dist/node/cjs/collections/configure/vectorizer.js deleted file mode 100644 index 6998cafe..00000000 --- a/dist/node/cjs/collections/configure/vectorizer.js +++ /dev/null @@ -1,601 +0,0 @@ -'use strict'; -var __rest = - (this && this.__rest) || - function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === 'function') - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.vectorizer = void 0; -const makeVectorizer = (name, options) => { - return { - name: name, - properties: options === null || options === void 0 ? void 0 : options.sourceProperties, - vectorIndex: (options === null || options === void 0 ? void 0 : options.vectorIndexConfig) - ? options.vectorIndexConfig - : { name: 'hnsw', config: undefined }, - vectorizer: (options === null || options === void 0 ? void 0 : options.vectorizerConfig) - ? options.vectorizerConfig - : { name: 'none', config: undefined }, - }; -}; -const mapMulti2VecField = (field) => { - if (typeof field === 'string') { - return { name: field }; - } - return field; -}; -const formatMulti2VecFields = (weights, key, fields) => { - if (fields !== undefined && fields.length > 0) { - weights[key] = fields.filter((f) => f.weight !== undefined).map((f) => f.weight); - if (weights[key].length === 0) { - delete weights[key]; - } - } - return weights; -}; -exports.vectorizer = { - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'none'`. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `none` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'none'>} The configuration object. - */ - none: (opts) => { - const { name, vectorIndexConfig } = opts || {}; - return makeVectorizer(name, { vectorIndexConfig }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'img2vec-neural'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/img2vec-neural) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `img2vec-neural` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'img2vec-neural'>} The configuration object. - */ - img2VecNeural: (opts) => { - const { name, vectorIndexConfig } = opts, - config = __rest(opts, ['name', 'vectorIndexConfig']); - return makeVectorizer(name, { - vectorIndexConfig, - vectorizerConfig: { - name: 'img2vec-neural', - config: config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-bind'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/imagebind/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `multi2vec-bind` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-bind'>} The configuration object. - */ - multi2VecBind: (opts) => { - var _a, _b, _c, _d, _e, _f, _g; - const _h = opts || {}, - { name, vectorIndexConfig } = _h, - config = __rest(_h, ['name', 'vectorIndexConfig']); - const audioFields = - (_a = config.audioFields) === null || _a === void 0 ? void 0 : _a.map(mapMulti2VecField); - const depthFields = - (_b = config.depthFields) === null || _b === void 0 ? void 0 : _b.map(mapMulti2VecField); - const imageFields = - (_c = config.imageFields) === null || _c === void 0 ? void 0 : _c.map(mapMulti2VecField); - const IMUFields = (_d = config.IMUFields) === null || _d === void 0 ? void 0 : _d.map(mapMulti2VecField); - const textFields = - (_e = config.textFields) === null || _e === void 0 ? void 0 : _e.map(mapMulti2VecField); - const thermalFields = - (_f = config.thermalFields) === null || _f === void 0 ? void 0 : _f.map(mapMulti2VecField); - const videoFields = - (_g = config.videoFields) === null || _g === void 0 ? void 0 : _g.map(mapMulti2VecField); - let weights = {}; - weights = formatMulti2VecFields(weights, 'audioFields', audioFields); - weights = formatMulti2VecFields(weights, 'depthFields', depthFields); - weights = formatMulti2VecFields(weights, 'imageFields', imageFields); - weights = formatMulti2VecFields(weights, 'IMUFields', IMUFields); - weights = formatMulti2VecFields(weights, 'textFields', textFields); - weights = formatMulti2VecFields(weights, 'thermalFields', thermalFields); - weights = formatMulti2VecFields(weights, 'videoFields', videoFields); - return makeVectorizer(name, { - vectorIndexConfig, - vectorizerConfig: { - name: 'multi2vec-bind', - config: - Object.keys(config).length === 0 - ? undefined - : Object.assign(Object.assign({}, config), { - audioFields: - audioFields === null || audioFields === void 0 ? void 0 : audioFields.map((f) => f.name), - depthFields: - depthFields === null || depthFields === void 0 ? void 0 : depthFields.map((f) => f.name), - imageFields: - imageFields === null || imageFields === void 0 ? void 0 : imageFields.map((f) => f.name), - IMUFields: IMUFields === null || IMUFields === void 0 ? void 0 : IMUFields.map((f) => f.name), - textFields: - textFields === null || textFields === void 0 ? void 0 : textFields.map((f) => f.name), - thermalFields: - thermalFields === null || thermalFields === void 0 - ? void 0 - : thermalFields.map((f) => f.name), - videoFields: - videoFields === null || videoFields === void 0 ? void 0 : videoFields.map((f) => f.name), - weights: Object.keys(weights).length === 0 ? undefined : weights, - }), - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-clip'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `multi2vec-clip` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-clip'>} The configuration object. - */ - multi2VecClip: (opts) => { - var _a, _b; - const _c = opts || {}, - { name, vectorIndexConfig } = _c, - config = __rest(_c, ['name', 'vectorIndexConfig']); - const imageFields = - (_a = config.imageFields) === null || _a === void 0 ? void 0 : _a.map(mapMulti2VecField); - const textFields = - (_b = config.textFields) === null || _b === void 0 ? void 0 : _b.map(mapMulti2VecField); - let weights = {}; - weights = formatMulti2VecFields(weights, 'imageFields', imageFields); - weights = formatMulti2VecFields(weights, 'textFields', textFields); - return makeVectorizer(name, { - vectorIndexConfig, - vectorizerConfig: { - name: 'multi2vec-clip', - config: - Object.keys(config).length === 0 - ? undefined - : Object.assign(Object.assign({}, config), { - imageFields: - imageFields === null || imageFields === void 0 ? void 0 : imageFields.map((f) => f.name), - textFields: - textFields === null || textFields === void 0 ? void 0 : textFields.map((f) => f.name), - weights: Object.keys(weights).length === 0 ? undefined : weights, - }), - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-palm'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} opts The configuration options for the `multi2vec-palm` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-palm'>} The configuration object. - * @deprecated Use `multi2VecGoogle` instead. - */ - multi2VecPalm: (opts) => { - var _a, _b, _c; - console.warn('The `multi2vec-palm` vectorizer is deprecated. Use `multi2vec-google` instead.'); - const { name, vectorIndexConfig } = opts, - config = __rest(opts, ['name', 'vectorIndexConfig']); - const imageFields = - (_a = config.imageFields) === null || _a === void 0 ? void 0 : _a.map(mapMulti2VecField); - const textFields = - (_b = config.textFields) === null || _b === void 0 ? void 0 : _b.map(mapMulti2VecField); - const videoFields = - (_c = config.videoFields) === null || _c === void 0 ? void 0 : _c.map(mapMulti2VecField); - let weights = {}; - weights = formatMulti2VecFields(weights, 'imageFields', imageFields); - weights = formatMulti2VecFields(weights, 'textFields', textFields); - weights = formatMulti2VecFields(weights, 'videoFields', videoFields); - return makeVectorizer(name, { - vectorIndexConfig, - vectorizerConfig: { - name: 'multi2vec-palm', - config: Object.assign(Object.assign({}, config), { - imageFields: - imageFields === null || imageFields === void 0 ? void 0 : imageFields.map((f) => f.name), - textFields: textFields === null || textFields === void 0 ? void 0 : textFields.map((f) => f.name), - videoFields: - videoFields === null || videoFields === void 0 ? void 0 : videoFields.map((f) => f.name), - weights: Object.keys(weights).length === 0 ? undefined : weights, - }), - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-google'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} opts The configuration options for the `multi2vec-google` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-google'>} The configuration object. - */ - multi2VecGoogle: (opts) => { - var _a, _b, _c; - const { name, vectorIndexConfig } = opts, - config = __rest(opts, ['name', 'vectorIndexConfig']); - const imageFields = - (_a = config.imageFields) === null || _a === void 0 ? void 0 : _a.map(mapMulti2VecField); - const textFields = - (_b = config.textFields) === null || _b === void 0 ? void 0 : _b.map(mapMulti2VecField); - const videoFields = - (_c = config.videoFields) === null || _c === void 0 ? void 0 : _c.map(mapMulti2VecField); - let weights = {}; - weights = formatMulti2VecFields(weights, 'imageFields', imageFields); - weights = formatMulti2VecFields(weights, 'textFields', textFields); - weights = formatMulti2VecFields(weights, 'videoFields', videoFields); - return makeVectorizer(name, { - vectorIndexConfig, - vectorizerConfig: { - name: 'multi2vec-google', - config: Object.assign(Object.assign({}, config), { - imageFields: - imageFields === null || imageFields === void 0 ? void 0 : imageFields.map((f) => f.name), - textFields: textFields === null || textFields === void 0 ? void 0 : textFields.map((f) => f.name), - videoFields: - videoFields === null || videoFields === void 0 ? void 0 : videoFields.map((f) => f.name), - weights: Object.keys(weights).length === 0 ? undefined : weights, - }), - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'ref2vec-centroid'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/ref2vec-centroid) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} opts The configuration options for the `ref2vec-centroid` vectorizer. - * @returns {VectorConfigCreate} The configuration object. - */ - ref2VecCentroid: (opts) => { - const { name, vectorIndexConfig } = opts, - config = __rest(opts, ['name', 'vectorIndexConfig']); - return makeVectorizer(name, { - vectorIndexConfig, - vectorizerConfig: { - name: 'ref2vec-centroid', - config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-aws'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/aws/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration options for the `text2vec-aws` vectorizer. - * @returns { VectorConfigCreate, N, I, 'text2vec-aws'>} The configuration object. - */ - text2VecAWS: (opts) => { - const { name, sourceProperties, vectorIndexConfig } = opts, - config = __rest(opts, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-aws', - config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-azure-openai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration options for the `text2vec-azure-openai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-azure-openai'>} The configuration object. - */ - text2VecAzureOpenAI: (opts) => { - const { name, sourceProperties, vectorIndexConfig } = opts, - config = __rest(opts, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-azure-openai', - config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-cohere'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration options for the `text2vec-cohere` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-cohere'>} The configuration object. - */ - text2VecCohere: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-cohere', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-contextionary'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/text2vec-contextionary) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-contextionary` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-contextionary'>} The configuration object. - */ - text2VecContextionary: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-contextionary', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-databricks'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/databricks/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration for the `text2vec-databricks` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-databricks'>} The configuration object. - */ - text2VecDatabricks: (opts) => { - const { name, sourceProperties, vectorIndexConfig } = opts, - config = __rest(opts, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-databricks', - config: config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-gpt4all'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/gpt4all/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-contextionary` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-gpt4all'>} The configuration object. - */ - text2VecGPT4All: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-gpt4all', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-huggingface'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/huggingface/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-contextionary` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-huggingface'>} The configuration object. - */ - text2VecHuggingFace: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-huggingface', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-jina'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-jina` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-jina'>} The configuration object. - */ - text2VecJina: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-jina', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-mistral'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/mistral/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-mistral` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-mistral'>} The configuration object. - */ - text2VecMistral: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-mistral', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-octoai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/octoai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-octoai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-octoai'>} The configuration object. - */ - text2VecOctoAI: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-octoai', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-openai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-openai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-openai'>} The configuration object. - */ - text2VecOpenAI: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-openai', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-ollama'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/ollama/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-ollama` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-ollama'>} The configuration object. - */ - text2VecOllama: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-ollama', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-palm'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration for the `text2vec-palm` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-palm'>} The configuration object. - * @deprecated Use `text2VecGoogle` instead. - */ - text2VecPalm: (opts) => { - console.warn('The `text2VecPalm` vectorizer is deprecated. Use `text2VecGoogle` instead.'); - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-palm', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-google'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration for the `text2vec-palm` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-google'>} The configuration object. - */ - text2VecGoogle: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-google', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-transformers'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-transformers` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-transformers'>} The configuration object. - */ - text2VecTransformers: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-transformers', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-voyageai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-voyageai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-voyageai'>} The configuration object. - */ - text2VecVoyageAI: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-voyageai', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, -}; diff --git a/dist/node/cjs/collections/data/index.d.ts b/dist/node/cjs/collections/data/index.d.ts deleted file mode 100644 index 16ec86e5..00000000 --- a/dist/node/cjs/collections/data/index.d.ts +++ /dev/null @@ -1,144 +0,0 @@ -import Connection from '../../connection/grpc.js'; -import { ConsistencyLevel } from '../../data/index.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { FilterValue } from '../filters/index.js'; -import { - BatchObjectsReturn, - BatchReferencesReturn, - DataObject, - DeleteManyReturn, - NonReferenceInputs, - Properties, - ReferenceInput, - ReferenceInputs, - Vectors, -} from '../types/index.js'; -/** The available options to the `data.deleteMany` method. */ -export type DeleteManyOptions = { - /** Whether to return verbose information about the operation */ - verbose?: V; - /** Whether to perform a dry run of the operation */ - dryRun?: boolean; -}; -/** The available options to the `data.insert` method. */ -export type InsertObject = { - /** The ID of the object to be inserted. If not provided, a new ID will be generated. */ - id?: string; - /** The properties of the object to be inserted */ - properties?: NonReferenceInputs; - /** The references of the object to be inserted */ - references?: ReferenceInputs; - /** The vector(s) of the object to be inserted */ - vectors?: number[] | Vectors; -}; -/** The arguments of the `data.referenceX` methods */ -export type ReferenceArgs = { - /** The ID of the object that will have the reference */ - fromUuid: string; - /** The property of the object that will have the reference */ - fromProperty: string; - /** The object(s) to reference */ - to: ReferenceInput; -}; -/** The available options to the `data.replace` method. */ -export type ReplaceObject = { - /** The ID of the object to be replaced */ - id: string; - /** The properties of the object to be replaced */ - properties?: NonReferenceInputs; - /** The references of the object to be replaced */ - references?: ReferenceInputs; - vectors?: number[] | Vectors; -}; -/** The available options to the `data.update` method. */ -export type UpdateObject = { - /** The ID of the object to be updated */ - id: string; - /** The properties of the object to be updated */ - properties?: NonReferenceInputs; - /** The references of the object to be updated */ - references?: ReferenceInputs; - vectors?: number[] | Vectors; -}; -export interface Data { - deleteById: (id: string) => Promise; - deleteMany: ( - where: FilterValue, - opts?: DeleteManyOptions - ) => Promise>; - exists: (id: string) => Promise; - /** - * Insert a single object into the collection. - * - * If you don't provide any options to the function, then an empty object will be created. - * - * @param {InsertArgs | NonReferenceInputs} [args] The object to insert. If an `id` is provided, it will be used as the object's ID. If not, a new ID will be generated. - * @returns {Promise} The ID of the inserted object. - */ - insert: (obj?: InsertObject | NonReferenceInputs) => Promise; - /** - * Insert multiple objects into the collection. - * - * This object does not perform any batching for you. It sends all objects in a single request to Weaviate. - * - * @param {(DataObject | NonReferenceInputs)[]} objects The objects to insert. - * @returns {Promise>} The result of the batch insert. - */ - insertMany: (objects: (DataObject | NonReferenceInputs)[]) => Promise>; - /** - * Create a reference between an object in this collection and any other object in Weaviate. - * - * @param {ReferenceArgs

} args The reference to create. - * @returns {Promise} - */ - referenceAdd:

(args: ReferenceArgs

) => Promise; - /** - * Create multiple references between an object in this collection and any other object in Weaviate. - * - * This method is optimized for performance and sends all references in a single request. - * - * @param {ReferenceArgs

[]} refs The references to create. - * @returns {Promise} The result of the batch reference creation. - */ - referenceAddMany:

(refs: ReferenceArgs

[]) => Promise; - /** - * Delete a reference between an object in this collection and any other object in Weaviate. - * - * @param {ReferenceArgs

} args The reference to delete. - * @returns {Promise} - */ - referenceDelete:

(args: ReferenceArgs

) => Promise; - /** - * Replace a reference between an object in this collection and any other object in Weaviate. - * - * @param {ReferenceArgs

} args The reference to replace. - * @returns {Promise} - */ - referenceReplace:

(args: ReferenceArgs

) => Promise; - /** - * Replace an object in the collection. - * - * This is equivalent to a PUT operation. - * - * @param {ReplaceOptions} [opts] The object attributes to replace. - * @returns {Promise} - */ - replace: (obj: ReplaceObject) => Promise; - /** - * Update an object in the collection. - * - * This is equivalent to a PATCH operation. - * - * @param {UpdateArgs} [opts] The object attributes to replace. - * @returns {Promise} - */ - update: (obj: UpdateObject) => Promise; -} -declare const data: ( - connection: Connection, - name: string, - dbVersionSupport: DbVersionSupport, - consistencyLevel?: ConsistencyLevel, - tenant?: string -) => Data; -export default data; diff --git a/dist/node/cjs/collections/data/index.js b/dist/node/cjs/collections/data/index.js deleted file mode 100644 index f5945b9d..00000000 --- a/dist/node/cjs/collections/data/index.js +++ /dev/null @@ -1,210 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const path_js_1 = require('../../batch/path.js'); -const index_js_1 = require('../../data/index.js'); -const path_js_2 = require('../../data/path.js'); -const index_js_2 = require('../deserialize/index.js'); -const utils_js_1 = require('../references/utils.js'); -const index_js_3 = require('../serialize/index.js'); -const addContext = (builder, consistencyLevel, tenant) => { - if (consistencyLevel) { - builder = builder.withConsistencyLevel(consistencyLevel); - } - if (tenant) { - builder = builder.withTenant(tenant); - } - return builder; -}; -const data = (connection, name, dbVersionSupport, consistencyLevel, tenant) => { - const objectsPath = new path_js_2.ObjectsPath(dbVersionSupport); - const referencesPath = new path_js_2.ReferencesPath(dbVersionSupport); - const parseObject = (object) => - __awaiter(void 0, void 0, void 0, function* () { - if (!object) { - return {}; - } - const obj = { - id: object.id, - properties: object.properties - ? index_js_3.Serialize.restProperties(object.properties, object.references) - : undefined, - }; - if (Array.isArray(object.vectors)) { - const supportsNamedVectors = yield dbVersionSupport.supportsNamedVectors(); - if (supportsNamedVectors.supports) { - obj.vector = object.vectors; - obj.vectors = { default: object.vectors }; - } else { - obj.vector = object.vectors; - } - } else if (object.vectors) { - obj.vectors = object.vectors; - } - return obj; - }); - return { - deleteById: (id) => - objectsPath - .buildDelete(id, name, consistencyLevel, tenant) - .then((path) => connection.delete(path, undefined, false)) - .then(() => true), - deleteMany: (where, opts) => - connection - .batch(name, consistencyLevel, tenant) - .then((batch) => - batch.withDelete({ - filters: index_js_3.Serialize.filtersGRPC(where), - dryRun: opts === null || opts === void 0 ? void 0 : opts.dryRun, - verbose: opts === null || opts === void 0 ? void 0 : opts.verbose, - }) - ) - .then((reply) => - index_js_2.Deserialize.deleteMany(reply, opts === null || opts === void 0 ? void 0 : opts.verbose) - ), - exists: (id) => - addContext( - new index_js_1.Checker(connection, objectsPath).withId(id).withClassName(name), - consistencyLevel, - tenant - ).do(), - insert: (obj) => - Promise.all([ - objectsPath.buildCreate(consistencyLevel), - parseObject(obj ? (index_js_3.DataGuards.isDataObject(obj) ? obj : { properties: obj }) : obj), - ]).then(([path, object]) => - connection - .postReturn(path, Object.assign({ class: name, tenant: tenant }, object)) - .then((obj) => obj.id) - ), - insertMany: (objects) => - connection.batch(name, consistencyLevel).then((batch) => - __awaiter(void 0, void 0, void 0, function* () { - const supportsNamedVectors = yield dbVersionSupport.supportsNamedVectors(); - const serialized = yield index_js_3.Serialize.batchObjects( - name, - objects, - supportsNamedVectors.supports, - tenant - ); - const start = Date.now(); - const reply = yield batch.withObjects({ objects: serialized.mapped }); - const end = Date.now(); - return index_js_2.Deserialize.batchObjects(reply, serialized.batch, serialized.mapped, end - start); - }) - ), - referenceAdd: (args) => - referencesPath - .build(args.fromUuid, name, args.fromProperty, consistencyLevel, tenant) - .then((path) => - Promise.all( - (0, utils_js_1.referenceToBeacons)(args.to).map((beacon) => connection.postEmpty(path, beacon)) - ) - ) - .then(() => {}), - referenceAddMany: (refs) => { - const path = (0, path_js_1.buildRefsPath)( - new URLSearchParams(consistencyLevel ? { consistency_level: consistencyLevel } : {}) - ); - const references = []; - refs.forEach((ref) => { - (0, utils_js_1.referenceToBeacons)(ref.to).forEach((beacon) => { - references.push({ - from: `weaviate://localhost/${name}/${ref.fromUuid}/${ref.fromProperty}`, - to: beacon.beacon, - tenant: tenant, - }); - }); - }); - const start = Date.now(); - return connection.postReturn(path, references).then((res) => { - const end = Date.now(); - const errors = {}; - res.forEach((entry, idx) => { - var _a, _b, _c, _d, _e, _f, _g; - if (((_a = entry.result) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED') { - errors[idx] = { - message: ( - (_d = - (_c = (_b = entry.result) === null || _b === void 0 ? void 0 : _b.errors) === null || - _c === void 0 - ? void 0 - : _c.error) === null || _d === void 0 - ? void 0 - : _d[0].message - ) - ? (_g = - (_f = (_e = entry.result) === null || _e === void 0 ? void 0 : _e.errors) === null || - _f === void 0 - ? void 0 - : _f.error) === null || _g === void 0 - ? void 0 - : _g[0].message - : 'unknown error', - reference: references[idx], - }; - } - }); - return { - elapsedSeconds: end - start, - errors: errors, - hasErrors: Object.keys(errors).length > 0, - }; - }); - }, - referenceDelete: (args) => - referencesPath - .build(args.fromUuid, name, args.fromProperty, consistencyLevel, tenant) - .then((path) => - Promise.all( - (0, utils_js_1.referenceToBeacons)(args.to).map((beacon) => - connection.delete(path, beacon, false) - ) - ) - ) - .then(() => {}), - referenceReplace: (args) => - referencesPath - .build(args.fromUuid, name, args.fromProperty, consistencyLevel, tenant) - .then((path) => connection.put(path, (0, utils_js_1.referenceToBeacons)(args.to), false)), - replace: (obj) => - Promise.all([objectsPath.buildUpdate(obj.id, name, consistencyLevel), parseObject(obj)]).then( - ([path, object]) => connection.put(path, Object.assign({ class: name, tenant: tenant }, object)) - ), - update: (obj) => - Promise.all([objectsPath.buildUpdate(obj.id, name, consistencyLevel), parseObject(obj)]).then( - ([path, object]) => connection.patch(path, Object.assign({ class: name, tenant: tenant }, object)) - ), - }; -}; -exports.default = data; diff --git a/dist/node/cjs/collections/deserialize/index.d.ts b/dist/node/cjs/collections/deserialize/index.d.ts deleted file mode 100644 index 19f8a3f1..00000000 --- a/dist/node/cjs/collections/deserialize/index.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Tenant as TenantREST } from '../../openapi/types.js'; -import { BatchObject as BatchObjectGRPC, BatchObjectsReply } from '../../proto/v1/batch.js'; -import { BatchDeleteReply } from '../../proto/v1/batch_delete.js'; -import { SearchReply } from '../../proto/v1/search_get.js'; -import { TenantsGetReply } from '../../proto/v1/tenants.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { Tenant } from '../tenants/index.js'; -import { - BatchObject, - BatchObjectsReturn, - DeleteManyReturn, - GenerativeGroupByReturn, - GenerativeReturn, - GroupByReturn, - WeaviateReturn, -} from '../types/index.js'; -export declare class Deserialize { - private supports125ListValue; - private constructor(); - static use(support: DbVersionSupport): Promise; - query(reply: SearchReply): WeaviateReturn; - generate(reply: SearchReply): GenerativeReturn; - groupBy(reply: SearchReply): GroupByReturn; - generateGroupBy(reply: SearchReply): GenerativeGroupByReturn; - private properties; - private references; - private parsePropertyValue; - private parseListValue; - private objectProperties; - private static metadata; - private static uuid; - private static vectorFromBytes; - private static intsFromBytes; - private static numbersFromBytes; - private static vectors; - static batchObjects( - reply: BatchObjectsReply, - originalObjs: BatchObject[], - mappedObjs: BatchObjectGRPC[], - elapsed: number - ): BatchObjectsReturn; - static deleteMany(reply: BatchDeleteReply, verbose?: V): DeleteManyReturn; - private static activityStatusGRPC; - static activityStatusREST(status: TenantREST['activityStatus']): Tenant['activityStatus']; - static tenantsGet(reply: TenantsGetReply): Record; -} diff --git a/dist/node/cjs/collections/deserialize/index.js b/dist/node/cjs/collections/deserialize/index.js deleted file mode 100644 index 11097d08..00000000 --- a/dist/node/cjs/collections/deserialize/index.js +++ /dev/null @@ -1,346 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.Deserialize = void 0; -const errors_js_1 = require('../../errors.js'); -const tenants_js_1 = require('../../proto/v1/tenants.js'); -const utils_js_1 = require('../references/utils.js'); -class Deserialize { - constructor(supports125ListValue) { - this.supports125ListValue = supports125ListValue; - } - static use(support) { - return __awaiter(this, void 0, void 0, function* () { - const supports125ListValue = yield support.supports125ListValue().then((res) => res.supports); - return new Deserialize(supports125ListValue); - }); - } - query(reply) { - return { - objects: reply.results.map((result) => { - return { - metadata: Deserialize.metadata(result.metadata), - properties: this.properties(result.properties), - references: this.references(result.properties), - uuid: Deserialize.uuid(result.metadata), - vectors: Deserialize.vectors(result.metadata), - }; - }), - }; - } - generate(reply) { - return { - objects: reply.results.map((result) => { - var _a, _b; - return { - generated: ((_a = result.metadata) === null || _a === void 0 ? void 0 : _a.generativePresent) - ? (_b = result.metadata) === null || _b === void 0 - ? void 0 - : _b.generative - : undefined, - metadata: Deserialize.metadata(result.metadata), - properties: this.properties(result.properties), - references: this.references(result.properties), - uuid: Deserialize.uuid(result.metadata), - vectors: Deserialize.vectors(result.metadata), - }; - }), - generated: reply.generativeGroupedResult, - }; - } - groupBy(reply) { - const objects = []; - const groups = {}; - reply.groupByResults.forEach((result) => { - const objs = result.objects.map((object) => { - return { - belongsToGroup: result.name, - metadata: Deserialize.metadata(object.metadata), - properties: this.properties(object.properties), - references: this.references(object.properties), - uuid: Deserialize.uuid(object.metadata), - vectors: Deserialize.vectors(object.metadata), - }; - }); - groups[result.name] = { - maxDistance: result.maxDistance, - minDistance: result.minDistance, - name: result.name, - numberOfObjects: result.numberOfObjects, - objects: objs, - }; - objects.push(...objs); - }); - return { - objects: objects, - groups: groups, - }; - } - generateGroupBy(reply) { - const objects = []; - const groups = {}; - reply.groupByResults.forEach((result) => { - var _a; - const objs = result.objects.map((object) => { - return { - belongsToGroup: result.name, - metadata: Deserialize.metadata(object.metadata), - properties: this.properties(object.properties), - references: this.references(object.properties), - uuid: Deserialize.uuid(object.metadata), - vectors: Deserialize.vectors(object.metadata), - }; - }); - groups[result.name] = { - maxDistance: result.maxDistance, - minDistance: result.minDistance, - name: result.name, - numberOfObjects: result.numberOfObjects, - objects: objs, - generated: (_a = result.generative) === null || _a === void 0 ? void 0 : _a.result, - }; - objects.push(...objs); - }); - return { - objects: objects, - groups: groups, - generated: reply.generativeGroupedResult, - }; - } - properties(properties) { - if (!properties) return {}; - return this.objectProperties(properties.nonRefProps); - } - references(properties) { - if (!properties) return undefined; - if (properties.refProps.length === 0) return properties.refPropsRequested ? {} : undefined; - const out = {}; - properties.refProps.forEach((property) => { - const uuids = []; - out[property.propName] = (0, utils_js_1.referenceFromObjects)( - property.properties.map((property) => { - const uuid = Deserialize.uuid(property.metadata); - uuids.push(uuid); - return { - metadata: Deserialize.metadata(property.metadata), - properties: this.properties(property), - references: this.references(property), - uuid: uuid, - vectors: Deserialize.vectors(property.metadata), - }; - }), - property.properties.length > 0 ? property.properties[0].targetCollection : '', - uuids - ); - }); - return out; - } - parsePropertyValue(value) { - if (value.boolValue !== undefined) return value.boolValue; - if (value.dateValue !== undefined) return new Date(value.dateValue); - if (value.intValue !== undefined) return value.intValue; - if (value.listValue !== undefined) - return this.supports125ListValue - ? this.parseListValue(value.listValue) - : value.listValue.values.map((v) => this.parsePropertyValue(v)); - if (value.numberValue !== undefined) return value.numberValue; - if (value.objectValue !== undefined) return this.objectProperties(value.objectValue); - if (value.stringValue !== undefined) return value.stringValue; - if (value.textValue !== undefined) return value.textValue; - if (value.uuidValue !== undefined) return value.uuidValue; - if (value.blobValue !== undefined) return value.blobValue; - if (value.geoValue !== undefined) return value.geoValue; - if (value.phoneValue !== undefined) return value.phoneValue; - if (value.nullValue !== undefined) return undefined; - throw new errors_js_1.WeaviateDeserializationError( - `Unknown value type: ${JSON.stringify(value, null, 2)}` - ); - } - parseListValue(value) { - if (value.boolValues !== undefined) return value.boolValues.values; - if (value.dateValues !== undefined) return value.dateValues.values.map((date) => new Date(date)); - if (value.intValues !== undefined) return Deserialize.intsFromBytes(value.intValues.values); - if (value.numberValues !== undefined) return Deserialize.numbersFromBytes(value.numberValues.values); - if (value.objectValues !== undefined) - return value.objectValues.values.map((v) => this.objectProperties(v)); - if (value.textValues !== undefined) return value.textValues.values; - if (value.uuidValues !== undefined) return value.uuidValues.values; - throw new Error(`Unknown list value type: ${JSON.stringify(value, null, 2)}`); - } - objectProperties(properties) { - const out = {}; - if (properties) { - Object.entries(properties.fields).forEach(([key, value]) => { - out[key] = this.parsePropertyValue(value); - }); - } - return out; - } - static metadata(metadata) { - const out = {}; - if (!metadata) return undefined; - if (metadata.creationTimeUnixPresent) out.creationTime = new Date(metadata.creationTimeUnix); - if (metadata.lastUpdateTimeUnixPresent) out.updateTime = new Date(metadata.lastUpdateTimeUnix); - if (metadata.distancePresent) out.distance = metadata.distance; - if (metadata.certaintyPresent) out.certainty = metadata.certainty; - if (metadata.scorePresent) out.score = metadata.score; - if (metadata.explainScorePresent) out.explainScore = metadata.explainScore; - if (metadata.rerankScorePresent) out.rerankScore = metadata.rerankScore; - if (metadata.isConsistent) out.isConsistent = metadata.isConsistent; - return out; - } - static uuid(metadata) { - if (!metadata || !(metadata.id.length > 0)) - throw new errors_js_1.WeaviateDeserializationError('No uuid returned from server'); - return metadata.id; - } - static vectorFromBytes(bytes) { - const buffer = Buffer.from(bytes); - const view = new Float32Array(buffer.buffer, buffer.byteOffset, buffer.byteLength / 4); // vector is float32 in weaviate - return Array.from(view); - } - static intsFromBytes(bytes) { - const buffer = Buffer.from(bytes); - const view = new BigInt64Array(buffer.buffer, buffer.byteOffset, buffer.byteLength / 8); // ints are float64 in weaviate - return Array.from(view).map(Number); - } - static numbersFromBytes(bytes) { - const buffer = Buffer.from(bytes); - const view = new Float64Array(buffer.buffer, buffer.byteOffset, buffer.byteLength / 8); // numbers are float64 in weaviate - return Array.from(view); - } - static vectors(metadata) { - if (!metadata) return {}; - if (metadata.vectorBytes.length === 0 && metadata.vector.length === 0 && metadata.vectors.length === 0) - return {}; - if (metadata.vectorBytes.length > 0) - return { default: Deserialize.vectorFromBytes(metadata.vectorBytes) }; - return Object.fromEntries( - metadata.vectors.map((vector) => [vector.name, Deserialize.vectorFromBytes(vector.vectorBytes)]) - ); - } - static batchObjects(reply, originalObjs, mappedObjs, elapsed) { - const allResponses = []; - const errors = {}; - const successes = {}; - const batchErrors = {}; - reply.errors.forEach((error) => { - batchErrors[error.index] = error.error; - }); - for (const [index, object] of originalObjs.entries()) { - if (index in batchErrors) { - const error = { - message: batchErrors[index], - object: object, - originalUuid: object.id, - }; - errors[index] = error; - allResponses[index] = error; - } else { - const mappedObj = mappedObjs[index]; - successes[index] = mappedObj.uuid; - allResponses[index] = mappedObj.uuid; - } - } - return { - uuids: successes, - errors: errors, - hasErrors: reply.errors.length > 0, - allResponses: allResponses, - elapsedSeconds: elapsed, - }; - } - static deleteMany(reply, verbose) { - return Object.assign(Object.assign({}, reply), { - objects: verbose - ? reply.objects.map((obj) => { - return { - id: obj.uuid.toString(), - successful: obj.successful, - error: obj.error, - }; - }) - : undefined, - }); - } - static activityStatusGRPC(status) { - switch (status) { - case tenants_js_1.TenantActivityStatus.TENANT_ACTIVITY_STATUS_COLD: - case tenants_js_1.TenantActivityStatus.TENANT_ACTIVITY_STATUS_INACTIVE: - return 'INACTIVE'; - case tenants_js_1.TenantActivityStatus.TENANT_ACTIVITY_STATUS_HOT: - case tenants_js_1.TenantActivityStatus.TENANT_ACTIVITY_STATUS_ACTIVE: - return 'ACTIVE'; - case tenants_js_1.TenantActivityStatus.TENANT_ACTIVITY_STATUS_FROZEN: - case tenants_js_1.TenantActivityStatus.TENANT_ACTIVITY_STATUS_OFFLOADED: - return 'OFFLOADED'; - case tenants_js_1.TenantActivityStatus.TENANT_ACTIVITY_STATUS_FREEZING: - case tenants_js_1.TenantActivityStatus.TENANT_ACTIVITY_STATUS_OFFLOADING: - return 'OFFLOADING'; - case tenants_js_1.TenantActivityStatus.TENANT_ACTIVITY_STATUS_UNFREEZING: - case tenants_js_1.TenantActivityStatus.TENANT_ACTIVITY_STATUS_ONLOADING: - return 'ONLOADING'; - default: - throw new Error(`Unsupported tenant activity status: ${status}`); - } - } - static activityStatusREST(status) { - switch (status) { - case 'COLD': - return 'INACTIVE'; - case 'HOT': - return 'ACTIVE'; - case 'FROZEN': - return 'OFFLOADED'; - case 'FREEZING': - return 'OFFLOADING'; - case 'UNFREEZING': - return 'ONLOADING'; - case undefined: - return 'ACTIVE'; - default: - return status; - } - } - static tenantsGet(reply) { - const tenants = {}; - reply.tenants.forEach((t) => { - tenants[t.name] = { - name: t.name, - activityStatus: Deserialize.activityStatusGRPC(t.activityStatus), - }; - }); - return tenants; - } -} -exports.Deserialize = Deserialize; diff --git a/dist/node/cjs/collections/filters/classes.d.ts b/dist/node/cjs/collections/filters/classes.d.ts deleted file mode 100644 index 83119423..00000000 --- a/dist/node/cjs/collections/filters/classes.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { FilterTarget } from '../../proto/v1/base.js'; -import { ExtractCrossReferenceType, NonRefKeys, RefKeys } from '../types/internal.js'; -import { - ContainsValue, - CountRef, - Filter, - FilterByProperty, - FilterValue, - GeoRangeFilter, - TargetRefs, -} from './types.js'; -/** - * Use this class when you want to chain filters together using logical operators. - * - * Since JS/TS has no native support for & and | as logical operators, you must use these methods and nest - * the filters you want to combine. - * - * ANDs and ORs can be nested an arbitrary number of times. - * - * @example - * ```ts - * const filter = Filters.and( - * collection.filter.byProperty('name').equal('John'), - * collection.filter.byProperty('age').greaterThan(18), - * ); - * ``` - */ -export declare class Filters { - /** - * Combine filters using the logical AND operator. - * - * @param {FilterValue[]} filters The filters to combine. - */ - static and(...filters: FilterValue[]): FilterValue; - /** - * Combine filters using the logical OR operator. - * - * @param {FilterValue[]} filters The filters to combine. - */ - static or(...filters: FilterValue[]): FilterValue; -} -export declare class FilterBase { - protected target?: TargetRefs; - protected property: string | CountRef; - constructor(property: string | CountRef, target?: TargetRefs); - protected targetPath(): FilterTarget; - private resolveTargets; -} -export declare class FilterProperty extends FilterBase implements FilterByProperty { - constructor(property: string, length: boolean, target?: TargetRefs); - isNull(value: boolean): FilterValue; - containsAny>(value: U[]): FilterValue; - containsAll>(value: U[]): FilterValue; - equal(value: V): FilterValue; - notEqual(value: V): FilterValue; - lessThan(value: U): FilterValue; - lessOrEqual(value: U): FilterValue; - greaterThan(value: U): FilterValue; - greaterOrEqual(value: U): FilterValue; - like(value: string): FilterValue; - withinGeoRange(value: GeoRangeFilter): FilterValue; -} -export declare class FilterRef implements Filter { - private target; - constructor(target: TargetRefs); - byRef & string>(linkOn: K): Filter>; - byRefMultiTarget & string>( - linkOn: K, - targetCollection: string - ): FilterRef>; - byProperty & string>(name: K, length?: boolean): FilterProperty; - byRefCount & string>(linkOn: K): FilterCount; - byId(): FilterId; - byCreationTime(): FilterCreationTime; - byUpdateTime(): FilterUpdateTime; -} -export declare class FilterCount extends FilterBase { - constructor(linkOn: string, target?: TargetRefs); - equal(value: number): FilterValue; - notEqual(value: number): FilterValue; - lessThan(value: number): FilterValue; - lessOrEqual(value: number): FilterValue; - greaterThan(value: number): FilterValue; - greaterOrEqual(value: number): FilterValue; -} -export declare class FilterId extends FilterBase { - constructor(target?: TargetRefs); - equal(value: string): FilterValue; - notEqual(value: string): FilterValue; - containsAny(value: string[]): FilterValue; -} -export declare class FilterTime extends FilterBase { - containsAny(value: (string | Date)[]): FilterValue; - equal(value: string | Date): FilterValue; - notEqual(value: string | Date): FilterValue; - lessThan(value: string | Date): FilterValue; - lessOrEqual(value: string | Date): FilterValue; - greaterThan(value: string | Date): FilterValue; - greaterOrEqual(value: string | Date): FilterValue; - private toValue; -} -export declare class FilterCreationTime extends FilterTime { - constructor(target?: TargetRefs); -} -export declare class FilterUpdateTime extends FilterTime { - constructor(target?: TargetRefs); -} diff --git a/dist/node/cjs/collections/filters/classes.js b/dist/node/cjs/collections/filters/classes.js deleted file mode 100644 index f022ebfe..00000000 --- a/dist/node/cjs/collections/filters/classes.js +++ /dev/null @@ -1,364 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.FilterUpdateTime = - exports.FilterCreationTime = - exports.FilterTime = - exports.FilterId = - exports.FilterCount = - exports.FilterRef = - exports.FilterProperty = - exports.FilterBase = - exports.Filters = - void 0; -const errors_js_1 = require('../../errors.js'); -const base_js_1 = require('../../proto/v1/base.js'); -const utils_js_1 = require('./utils.js'); -/** - * Use this class when you want to chain filters together using logical operators. - * - * Since JS/TS has no native support for & and | as logical operators, you must use these methods and nest - * the filters you want to combine. - * - * ANDs and ORs can be nested an arbitrary number of times. - * - * @example - * ```ts - * const filter = Filters.and( - * collection.filter.byProperty('name').equal('John'), - * collection.filter.byProperty('age').greaterThan(18), - * ); - * ``` - */ -class Filters { - /** - * Combine filters using the logical AND operator. - * - * @param {FilterValue[]} filters The filters to combine. - */ - static and(...filters) { - return { - operator: 'And', - filters: filters, - value: null, - }; - } - /** - * Combine filters using the logical OR operator. - * - * @param {FilterValue[]} filters The filters to combine. - */ - static or(...filters) { - return { - operator: 'Or', - filters: filters, - value: null, - }; - } -} -exports.Filters = Filters; -class FilterBase { - constructor(property, target) { - this.property = property; - this.target = target; - } - targetPath() { - if (!this.target) { - return base_js_1.FilterTarget.fromPartial({ - property: utils_js_1.TargetGuards.isProperty(this.property) ? this.property : undefined, - count: utils_js_1.TargetGuards.isCountRef(this.property) - ? base_js_1.FilterReferenceCount.fromPartial({ - on: this.property.linkOn, - }) - : undefined, - }); - } - let target = this.target; - while (target.target !== undefined) { - if (utils_js_1.TargetGuards.isTargetRef(target.target)) { - target = target.target; - } else { - throw new errors_js_1.WeaviateInvalidInputError('Invalid target reference'); - } - } - target.target = this.property; - return this.resolveTargets(this.target); - } - resolveTargets(internal) { - return base_js_1.FilterTarget.fromPartial({ - property: utils_js_1.TargetGuards.isProperty(internal) ? internal : undefined, - singleTarget: utils_js_1.TargetGuards.isSingleTargetRef(internal) - ? base_js_1.FilterReferenceSingleTarget.fromPartial({ - on: internal.linkOn, - target: this.resolveTargets(internal.target), - }) - : undefined, - multiTarget: utils_js_1.TargetGuards.isMultiTargetRef(internal) - ? base_js_1.FilterReferenceMultiTarget.fromPartial({ - on: internal.linkOn, - targetCollection: internal.targetCollection, - target: this.resolveTargets(internal.target), - }) - : undefined, - count: utils_js_1.TargetGuards.isCountRef(internal) - ? base_js_1.FilterReferenceCount.fromPartial({ - on: internal.linkOn, - }) - : undefined, - }); - } -} -exports.FilterBase = FilterBase; -class FilterProperty extends FilterBase { - constructor(property, length, target) { - super(length ? `len(${property})` : property, target); - } - isNull(value) { - return { - operator: 'IsNull', - target: this.targetPath(), - value: value, - }; - } - containsAny(value) { - return { - operator: 'ContainsAny', - target: this.targetPath(), - value: value, - }; - } - containsAll(value) { - return { - operator: 'ContainsAll', - target: this.targetPath(), - value: value, - }; - } - equal(value) { - return { - operator: 'Equal', - target: this.targetPath(), - value: value, - }; - } - notEqual(value) { - return { - operator: 'NotEqual', - target: this.targetPath(), - value: value, - }; - } - lessThan(value) { - return { - operator: 'LessThan', - target: this.targetPath(), - value: value, - }; - } - lessOrEqual(value) { - return { - operator: 'LessThanEqual', - target: this.targetPath(), - value: value, - }; - } - greaterThan(value) { - return { - operator: 'GreaterThan', - target: this.targetPath(), - value: value, - }; - } - greaterOrEqual(value) { - return { - operator: 'GreaterThanEqual', - target: this.targetPath(), - value: value, - }; - } - like(value) { - return { - operator: 'Like', - target: this.targetPath(), - value: value, - }; - } - withinGeoRange(value) { - return { - operator: 'WithinGeoRange', - target: this.targetPath(), - value: value, - }; - } -} -exports.FilterProperty = FilterProperty; -class FilterRef { - constructor(target) { - this.target = target; - } - byRef(linkOn) { - this.target.target = { type_: 'single', linkOn: linkOn }; - return new FilterRef(this.target); - } - byRefMultiTarget(linkOn, targetCollection) { - this.target.target = { type_: 'multi', linkOn: linkOn, targetCollection: targetCollection }; - return new FilterRef(this.target); - } - byProperty(name, length = false) { - return new FilterProperty(name, length, this.target); - } - byRefCount(linkOn) { - return new FilterCount(linkOn, this.target); - } - byId() { - return new FilterId(this.target); - } - byCreationTime() { - return new FilterCreationTime(this.target); - } - byUpdateTime() { - return new FilterUpdateTime(this.target); - } -} -exports.FilterRef = FilterRef; -class FilterCount extends FilterBase { - constructor(linkOn, target) { - super({ type_: 'count', linkOn }, target); - } - equal(value) { - return { - operator: 'Equal', - target: this.targetPath(), - value: value, - }; - } - notEqual(value) { - return { - operator: 'NotEqual', - target: this.targetPath(), - value: value, - }; - } - lessThan(value) { - return { - operator: 'LessThan', - target: this.targetPath(), - value: value, - }; - } - lessOrEqual(value) { - return { - operator: 'LessThanEqual', - target: this.targetPath(), - value: value, - }; - } - greaterThan(value) { - return { - operator: 'GreaterThan', - target: this.targetPath(), - value: value, - }; - } - greaterOrEqual(value) { - return { - operator: 'GreaterThanEqual', - target: this.targetPath(), - value: value, - }; - } -} -exports.FilterCount = FilterCount; -class FilterId extends FilterBase { - constructor(target) { - super('_id', target); - } - equal(value) { - return { - operator: 'Equal', - target: this.targetPath(), - value: value, - }; - } - notEqual(value) { - return { - operator: 'NotEqual', - target: this.targetPath(), - value: value, - }; - } - containsAny(value) { - return { - operator: 'ContainsAny', - target: this.targetPath(), - value: value, - }; - } -} -exports.FilterId = FilterId; -class FilterTime extends FilterBase { - containsAny(value) { - return { - operator: 'ContainsAny', - target: this.targetPath(), - value: value.map(this.toValue), - }; - } - equal(value) { - return { - operator: 'Equal', - target: this.targetPath(), - value: this.toValue(value), - }; - } - notEqual(value) { - return { - operator: 'NotEqual', - target: this.targetPath(), - value: this.toValue(value), - }; - } - lessThan(value) { - return { - operator: 'LessThan', - target: this.targetPath(), - value: this.toValue(value), - }; - } - lessOrEqual(value) { - return { - operator: 'LessThanEqual', - target: this.targetPath(), - value: this.toValue(value), - }; - } - greaterThan(value) { - return { - operator: 'GreaterThan', - target: this.targetPath(), - value: this.toValue(value), - }; - } - greaterOrEqual(value) { - return { - operator: 'GreaterThanEqual', - target: this.targetPath(), - value: this.toValue(value), - }; - } - toValue(value) { - return value instanceof Date ? value.toISOString() : value; - } -} -exports.FilterTime = FilterTime; -class FilterCreationTime extends FilterTime { - constructor(target) { - super('_creationTimeUnix', target); - } -} -exports.FilterCreationTime = FilterCreationTime; -class FilterUpdateTime extends FilterTime { - constructor(target) { - super('_lastUpdateTimeUnix', target); - } -} -exports.FilterUpdateTime = FilterUpdateTime; diff --git a/dist/node/cjs/collections/filters/index.d.ts b/dist/node/cjs/collections/filters/index.d.ts deleted file mode 100644 index 952d5e83..00000000 --- a/dist/node/cjs/collections/filters/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -export { Filters } from './classes.js'; -export type { - Filter, - FilterByCount, - FilterById, - FilterByProperty, - FilterByTime, - FilterValue, - GeoRangeFilter, - Operator, -} from './types.js'; -import { Filter } from './types.js'; -declare const filter: () => Filter; -export default filter; diff --git a/dist/node/cjs/collections/filters/index.js b/dist/node/cjs/collections/filters/index.js deleted file mode 100644 index 80bfe280..00000000 --- a/dist/node/cjs/collections/filters/index.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.Filters = void 0; -var classes_js_1 = require('./classes.js'); -Object.defineProperty(exports, 'Filters', { - enumerable: true, - get: function () { - return classes_js_1.Filters; - }, -}); -const classes_js_2 = require('./classes.js'); -const filter = () => { - return { - byProperty: (name, length = false) => { - return new classes_js_2.FilterProperty(name, length); - }, - byRef: (linkOn) => { - return new classes_js_2.FilterRef({ type_: 'single', linkOn: linkOn }); - }, - byRefMultiTarget: (linkOn, targetCollection) => { - return new classes_js_2.FilterRef({ - type_: 'multi', - linkOn: linkOn, - targetCollection: targetCollection, - }); - }, - byRefCount: (linkOn) => { - return new classes_js_2.FilterCount(linkOn); - }, - byId: () => { - return new classes_js_2.FilterId(); - }, - byCreationTime: () => { - return new classes_js_2.FilterCreationTime(); - }, - byUpdateTime: () => { - return new classes_js_2.FilterUpdateTime(); - }, - }; -}; -exports.default = filter; diff --git a/dist/node/cjs/collections/filters/types.d.ts b/dist/node/cjs/collections/filters/types.d.ts deleted file mode 100644 index 2dbe3b0e..00000000 --- a/dist/node/cjs/collections/filters/types.d.ts +++ /dev/null @@ -1,303 +0,0 @@ -import { FilterTarget } from '../../proto/v1/base.js'; -import { ExtractCrossReferenceType, NonRefKeys, RefKeys } from '../types/internal.js'; -export type Operator = - | 'Equal' - | 'NotEqual' - | 'GreaterThan' - | 'GreaterThanEqual' - | 'LessThan' - | 'LessThanEqual' - | 'Like' - | 'IsNull' - | 'WithinGeoRange' - | 'ContainsAny' - | 'ContainsAll' - | 'And' - | 'Or'; -export type FilterValue = { - filters?: FilterValue[]; - operator: Operator; - target?: FilterTarget; - value: V; -}; -export type SingleTargetRef = { - type_: 'single'; - linkOn: string; - target?: FilterTargetInternal; -}; -export type MultiTargetRef = { - type_: 'multi'; - linkOn: string; - targetCollection: string; - target?: FilterTargetInternal; -}; -export type CountRef = { - type_: 'count'; - linkOn: string; -}; -export type FilterTargetInternal = SingleTargetRef | MultiTargetRef | CountRef | string; -export type TargetRefs = SingleTargetRef | MultiTargetRef; -export type GeoRangeFilter = { - latitude: number; - longitude: number; - distance: number; -}; -export type FilterValueType = PrimitiveFilterValueType | PrimitiveListFilterValueType; -export type PrimitiveFilterValueType = number | string | boolean | Date | GeoRangeFilter; -export type PrimitiveListFilterValueType = number[] | string[] | boolean[] | Date[]; -export type ContainsValue = V extends (infer U)[] ? U : V; -export interface Filter { - /** - * Define a filter based on a property to be used when querying and deleting from a collection. - * - * @param {K} name The name of the property to filter on. - * @param {boolean} [length] Whether to filter on the length of the property or not, defaults to false. - * @returns {FilterByProperty} An interface exposing methods to filter on the property. - */ - byProperty: & string>(name: K, length?: boolean) => FilterByProperty; - /** - * Define a filter based on a single-target reference to be used when querying and deleting from a collection. - * - * @param {K} linkOn The name of the property to filter on. - * @returns {Filter>} An interface exposing methods to filter on the reference. - */ - byRef: & string>(linkOn: K) => Filter>; - /** - * Define a filter based on a multi-target reference to be used when querying and deleting from a collection. - * - * @param {K} linkOn The name of the property to filter on. - * @param {string} targetCollection The name of the target collection to filter on. - * @returns {Filter>} An interface exposing methods to filter on the reference. - */ - byRefMultiTarget: & string>( - linkOn: K, - targetCollection: string - ) => Filter>; - /** - * Define a filter based on the number of objects in a cross-reference to be used when querying and deleting from a collection. - * - * @param {K} linkOn The name of the property to filter on. - * @returns {FilterByCount} An interface exposing methods to filter on the count. - */ - byRefCount: & string>(linkOn: K) => FilterByCount; - /** - * Define a filter based on the ID to be used when querying and deleting from a collection. - * - * @returns {FilterById} An interface exposing methods to filter on the ID. - */ - byId: () => FilterById; - /** - * Define a filter based on the creation time to be used when querying and deleting from a collection. - * - * @returns {FilterByTime} An interface exposing methods to filter on the creation time. - */ - byCreationTime: () => FilterByTime; - /** - * Define a filter based on the update time to be used when querying and deleting from a collection. - * - * @returns {FilterByTime} An interface exposing methods to filter on the update time. - */ - byUpdateTime: () => FilterByTime; -} -export interface FilterByProperty { - /** - * Filter on whether the property is `null`. - * - * @param {boolean} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - isNull: (value: boolean) => FilterValue; - /** - * Filter on whether the property contains any of the given values. - * - * @param {U[]} value The values to filter on. - * @returns {FilterValue} The filter value. - */ - containsAny: >(value: U[]) => FilterValue; - /** - * Filter on whether the property contains all of the given values. - * - * @param {U[]} value The values to filter on. - * @returns {FilterValue} The filter value. - */ - containsAll: >(value: U[]) => FilterValue; - /** - * Filter on whether the property is equal to the given value. - * - * @param {V} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - equal: (value: T) => FilterValue; - /** - * Filter on whether the property is not equal to the given value. - * - * @param {V} value The value to filter on. - * @returns {FilterValue} The filter value. - * */ - notEqual: (value: T) => FilterValue; - /** - * Filter on whether the property is less than the given value. - * - * @param {number | Date} value The value to filter on. - * @returns {FilterValue | FilterValue} The filter value. - */ - lessThan: (value: U) => FilterValue; - /** - * Filter on whether the property is less than or equal to the given value. - * - * @param {number | Date} value The value to filter on. - * @returns {FilterValue | FilterValue} The filter value. - */ - lessOrEqual: (value: U) => FilterValue; - /** - * Filter on whether the property is greater than the given value. - * - * @param {number | Date} value The value to filter on. - * @returns {FilterValue | FilterValue} The filter value. - */ - greaterThan: (value: U) => FilterValue; - /** - * Filter on whether the property is greater than or equal to the given value. - * - * @param {number | Date} value The value to filter on. - * @returns {FilterValue | FilterValue} The filter value. - */ - greaterOrEqual: (value: U) => FilterValue; - /** - * Filter on whether the property is like the given value. - * - * This filter can make use of `*` and `?` as wildcards. - * See [the docs](https://weaviate.io/developers/weaviate/search/filters#by-partial-matches-text) for more details. - * - * @param {string} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - like: (value: string) => FilterValue; - /** - * Filter on whether the property is within a given range of a geo-coordinate. - * - * See [the docs](https://weaviate.io/developers/weaviate/search/filters##by-geo-coordinates) for more details. - * - * @param {GeoRangeFilter} value The geo-coordinate range to filter on. - * @returns {FilterValue} The filter value. - */ - withinGeoRange: (value: GeoRangeFilter) => FilterValue; -} -export interface FilterByCount { - /** - * Filter on whether the number of references is equal to the given integer. - * - * @param {number} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - equal: (value: number) => FilterValue; - /** - * Filter on whether the number of references is not equal to the given integer. - * - * @param {number} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - notEqual: (value: number) => FilterValue; - /** - * Filter on whether the number of references is less than the given integer. - * - * @param {number} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - lessThan: (value: number) => FilterValue; - /** - * Filter on whether the number of references is less than or equal to the given integer. - * - * @param {number} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - lessOrEqual: (value: number) => FilterValue; - /** - * Filter on whether the number of references is greater than the given integer. - * - * @param {number} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - greaterThan: (value: number) => FilterValue; - /** - * Filter on whether the number of references is greater than or equal to the given integer. - * - * @param {number} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - greaterOrEqual: (value: number) => FilterValue; -} -export interface FilterById { - /** - * Filter on whether the ID is equal to the given string. - * - * @param {string} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - equal: (value: string) => FilterValue; - /** - * Filter on whether the ID is not equal to the given string. - * - * @param {string} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - notEqual: (value: string) => FilterValue; - /** - * Filter on whether the ID is any one of the given strings. - * - * @param {string[]} value The values to filter on. - * @returns {FilterValue} The filter value. - */ - containsAny: (value: string[]) => FilterValue; -} -export interface FilterByTime { - /** - * Filter on whether the time is any one of the given strings or Dates. - * - * @param {(string | Date)[]} value The values to filter on. - * @returns {FilterValue} The filter value. - */ - containsAny: (value: (string | Date)[]) => FilterValue; - /** - * Filter on whether the time is equal to the given string or Date. - * - * @param {string | Date} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - equal: (value: string | Date) => FilterValue; - /** - * Filter on whether the time is not equal to the given string or Date. - * - * @param {string | Date} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - notEqual: (value: string | Date) => FilterValue; - /** - * Filter on whether the time is less than the given string or Date. - * - * @param {string | Date} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - lessThan: (value: string | Date) => FilterValue; - /** - * Filter on whether the time is less than or equal to the given string or Date. - * - * @param {string | Date} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - lessOrEqual: (value: string | Date) => FilterValue; - /** - * Filter on whether the time is greater than the given string or Date. - * - * @param {string | Date} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - greaterThan: (value: string | Date) => FilterValue; - /** - * Filter on whether the time is greater than or equal to the given string or Date. - * - * @param {string | Date} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - greaterOrEqual: (value: string | Date) => FilterValue; -} diff --git a/dist/node/cjs/collections/filters/types.js b/dist/node/cjs/collections/filters/types.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/filters/types.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/filters/utils.d.ts b/dist/node/cjs/collections/filters/utils.d.ts deleted file mode 100644 index 45f1371d..00000000 --- a/dist/node/cjs/collections/filters/utils.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { CountRef, FilterTargetInternal, MultiTargetRef, SingleTargetRef } from './types.js'; -export declare class TargetGuards { - static isSingleTargetRef(target?: FilterTargetInternal): target is SingleTargetRef; - static isMultiTargetRef(target?: FilterTargetInternal): target is MultiTargetRef; - static isCountRef(target?: FilterTargetInternal): target is CountRef; - static isProperty(target?: FilterTargetInternal): target is string; - static isTargetRef(target?: FilterTargetInternal): target is SingleTargetRef | MultiTargetRef; -} diff --git a/dist/node/cjs/collections/filters/utils.js b/dist/node/cjs/collections/filters/utils.js deleted file mode 100644 index 898bdb57..00000000 --- a/dist/node/cjs/collections/filters/utils.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.TargetGuards = void 0; -class TargetGuards { - static isSingleTargetRef(target) { - if (!target) return false; - return target.type_ === 'single'; - } - static isMultiTargetRef(target) { - if (!target) return false; - return target.type_ === 'multi'; - } - static isCountRef(target) { - if (!target) return false; - return target.type_ === 'count'; - } - static isProperty(target) { - if (!target) return false; - return typeof target === 'string'; - } - static isTargetRef(target) { - if (!target) return false; - return TargetGuards.isSingleTargetRef(target) || TargetGuards.isMultiTargetRef(target); - } -} -exports.TargetGuards = TargetGuards; diff --git a/dist/node/cjs/collections/generate/index.d.ts b/dist/node/cjs/collections/generate/index.d.ts deleted file mode 100644 index 125b1dca..00000000 --- a/dist/node/cjs/collections/generate/index.d.ts +++ /dev/null @@ -1,103 +0,0 @@ -/// -import Connection from '../../connection/grpc.js'; -import { ConsistencyLevel } from '../../data/index.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { - BaseBm25Options, - BaseHybridOptions, - BaseNearOptions, - BaseNearTextOptions, - FetchObjectsOptions, - GroupByBm25Options, - GroupByHybridOptions, - GroupByNearOptions, - GroupByNearTextOptions, - NearMediaType, -} from '../query/types.js'; -import { GenerateOptions, GenerativeGroupByReturn, GenerativeReturn } from '../types/index.js'; -import { Generate } from './types.js'; -declare class GenerateManager implements Generate { - private check; - private constructor(); - static use( - connection: Connection, - name: string, - dbVersionSupport: DbVersionSupport, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ): GenerateManager; - private parseReply; - private parseGroupByReply; - fetchObjects(generate: GenerateOptions, opts?: FetchObjectsOptions): Promise>; - bm25(query: string, generate: GenerateOptions, opts?: BaseBm25Options): Promise>; - bm25( - query: string, - generate: GenerateOptions, - opts: GroupByBm25Options - ): Promise>; - hybrid( - query: string, - generate: GenerateOptions, - opts?: BaseHybridOptions - ): Promise>; - hybrid( - query: string, - generate: GenerateOptions, - opts: GroupByHybridOptions - ): Promise>; - nearImage( - image: string | Buffer, - generate: GenerateOptions, - opts?: BaseNearOptions - ): Promise>; - nearImage( - image: string | Buffer, - generate: GenerateOptions, - opts: GroupByNearOptions - ): Promise>; - nearObject( - id: string, - generate: GenerateOptions, - opts?: BaseNearOptions - ): Promise>; - nearObject( - id: string, - generate: GenerateOptions, - opts: GroupByNearOptions - ): Promise>; - nearText( - query: string | string[], - generate: GenerateOptions, - opts?: BaseNearTextOptions - ): Promise>; - nearText( - query: string | string[], - generate: GenerateOptions, - opts: GroupByNearTextOptions - ): Promise>; - nearVector( - vector: number[], - generate: GenerateOptions, - opts?: BaseNearOptions - ): Promise>; - nearVector( - vector: number[], - generate: GenerateOptions, - opts: GroupByNearOptions - ): Promise>; - nearMedia( - media: string | Buffer, - type: NearMediaType, - generate: GenerateOptions, - opts?: BaseNearOptions - ): Promise>; - nearMedia( - media: string | Buffer, - type: NearMediaType, - generate: GenerateOptions, - opts: GroupByNearOptions - ): Promise>; -} -declare const _default: typeof GenerateManager.use; -export default _default; -export { Generate } from './types.js'; diff --git a/dist/node/cjs/collections/generate/index.js b/dist/node/cjs/collections/generate/index.js deleted file mode 100644 index f4d25d4a..00000000 --- a/dist/node/cjs/collections/generate/index.js +++ /dev/null @@ -1,294 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const errors_js_1 = require('../../errors.js'); -const index_js_1 = require('../../index.js'); -const index_js_2 = require('../deserialize/index.js'); -const check_js_1 = require('../query/check.js'); -const index_js_3 = require('../serialize/index.js'); -class GenerateManager { - constructor(check) { - this.check = check; - } - static use(connection, name, dbVersionSupport, consistencyLevel, tenant) { - return new GenerateManager( - new check_js_1.Check(connection, name, dbVersionSupport, consistencyLevel, tenant) - ); - } - parseReply(reply) { - return __awaiter(this, void 0, void 0, function* () { - const deserialize = yield index_js_2.Deserialize.use(this.check.dbVersionSupport); - return deserialize.generate(reply); - }); - } - parseGroupByReply(opts, reply) { - return __awaiter(this, void 0, void 0, function* () { - const deserialize = yield index_js_2.Deserialize.use(this.check.dbVersionSupport); - return index_js_3.Serialize.isGroupBy(opts) - ? deserialize.generateGroupBy(reply) - : deserialize.generate(reply); - }); - } - fetchObjects(generate, opts) { - return this.check - .fetchObjects(opts) - .then(({ search }) => - search.withFetch( - Object.assign(Object.assign({}, index_js_3.Serialize.fetchObjects(opts)), { - generative: index_js_3.Serialize.generative(generate), - }) - ) - ) - .then((reply) => this.parseReply(reply)); - } - bm25(query, generate, opts) { - return this.check - .bm25(opts) - .then(({ search }) => - search.withBm25( - Object.assign(Object.assign({}, index_js_3.Serialize.bm25(Object.assign({ query }, opts))), { - generative: index_js_3.Serialize.generative(generate), - groupBy: index_js_3.Serialize.isGroupBy(opts) - ? index_js_3.Serialize.groupBy(opts.groupBy) - : undefined, - }) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - hybrid(query, generate, opts) { - return this.check - .hybridSearch(opts) - .then(({ search, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets }) => - search.withHybrid( - Object.assign( - Object.assign( - {}, - index_js_3.Serialize.hybrid( - Object.assign( - { query, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets }, - opts - ) - ) - ), - { - generative: index_js_3.Serialize.generative(generate), - groupBy: index_js_3.Serialize.isGroupBy(opts) - ? index_js_3.Serialize.groupBy(opts.groupBy) - : undefined, - } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearImage(image, generate, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => - (0, index_js_1.toBase64FromMedia)(image).then((image) => - search.withNearImage( - Object.assign( - Object.assign( - {}, - index_js_3.Serialize.nearImage( - Object.assign({ image, supportsTargets, supportsWeightsForTargets }, opts ? opts : {}) - ) - ), - { - generative: index_js_3.Serialize.generative(generate), - groupBy: index_js_3.Serialize.isGroupBy(opts) - ? index_js_3.Serialize.groupBy(opts.groupBy) - : undefined, - } - ) - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearObject(id, generate, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => - search.withNearObject( - Object.assign( - Object.assign( - {}, - index_js_3.Serialize.nearObject( - Object.assign({ id, supportsTargets, supportsWeightsForTargets }, opts ? opts : {}) - ) - ), - { - generative: index_js_3.Serialize.generative(generate), - groupBy: index_js_3.Serialize.isGroupBy(opts) - ? index_js_3.Serialize.groupBy(opts.groupBy) - : undefined, - } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearText(query, generate, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => - search.withNearText( - Object.assign( - Object.assign( - {}, - index_js_3.Serialize.nearText( - Object.assign({ query, supportsTargets, supportsWeightsForTargets }, opts ? opts : {}) - ) - ), - { - generative: index_js_3.Serialize.generative(generate), - groupBy: index_js_3.Serialize.isGroupBy(opts) - ? index_js_3.Serialize.groupBy(opts.groupBy) - : undefined, - } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearVector(vector, generate, opts) { - return this.check - .nearVector(vector, opts) - .then(({ search, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets }) => - search.withNearVector( - Object.assign( - Object.assign( - {}, - index_js_3.Serialize.nearVector( - Object.assign( - { vector, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets }, - opts ? opts : {} - ) - ) - ), - { - generative: index_js_3.Serialize.generative(generate), - groupBy: index_js_3.Serialize.isGroupBy(opts) - ? index_js_3.Serialize.groupBy(opts.groupBy) - : undefined, - } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearMedia(media, type, generate, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => { - let reply; - const args = Object.assign({ supportsTargets, supportsWeightsForTargets }, opts ? opts : {}); - const generative = index_js_3.Serialize.generative(generate); - const groupBy = index_js_3.Serialize.isGroupBy(opts) - ? index_js_3.Serialize.groupBy(opts.groupBy) - : undefined; - switch (type) { - case 'audio': - reply = (0, index_js_1.toBase64FromMedia)(media).then((media) => - search.withNearAudio( - Object.assign( - Object.assign({}, index_js_3.Serialize.nearAudio(Object.assign({ audio: media }, args))), - { generative, groupBy } - ) - ) - ); - break; - case 'depth': - reply = (0, index_js_1.toBase64FromMedia)(media).then((media) => - search.withNearDepth( - Object.assign( - Object.assign({}, index_js_3.Serialize.nearDepth(Object.assign({ depth: media }, args))), - { generative, groupBy } - ) - ) - ); - break; - case 'image': - reply = (0, index_js_1.toBase64FromMedia)(media).then((media) => - search.withNearImage( - Object.assign( - Object.assign({}, index_js_3.Serialize.nearImage(Object.assign({ image: media }, args))), - { generative, groupBy } - ) - ) - ); - break; - case 'imu': - reply = (0, index_js_1.toBase64FromMedia)(media).then((media) => - search.withNearIMU( - Object.assign( - Object.assign({}, index_js_3.Serialize.nearIMU(Object.assign({ imu: media }, args))), - { generative, groupBy } - ) - ) - ); - break; - case 'thermal': - reply = (0, index_js_1.toBase64FromMedia)(media).then((media) => - search.withNearThermal( - Object.assign( - Object.assign( - {}, - index_js_3.Serialize.nearThermal(Object.assign({ thermal: media }, args)) - ), - { generative, groupBy } - ) - ) - ); - break; - case 'video': - reply = (0, index_js_1.toBase64FromMedia)(media).then((media) => - search.withNearVideo( - Object.assign( - Object.assign({}, index_js_3.Serialize.nearVideo(Object.assign({ video: media }, args))), - { generative, groupBy } - ) - ) - ); - break; - default: - throw new errors_js_1.WeaviateInvalidInputError(`Invalid media type: ${type}`); - } - return reply; - }) - .then((reply) => this.parseGroupByReply(opts, reply)); - } -} -exports.default = GenerateManager.use; diff --git a/dist/node/cjs/collections/generate/types.d.ts b/dist/node/cjs/collections/generate/types.d.ts deleted file mode 100644 index 9f41e30c..00000000 --- a/dist/node/cjs/collections/generate/types.d.ts +++ /dev/null @@ -1,354 +0,0 @@ -/// -import { - BaseBm25Options, - BaseHybridOptions, - BaseNearOptions, - BaseNearTextOptions, - Bm25Options, - FetchObjectsOptions, - GroupByBm25Options, - GroupByHybridOptions, - GroupByNearOptions, - GroupByNearTextOptions, - HybridOptions, - NearMediaType, - NearOptions, - NearTextOptions, - NearVectorInputType, -} from '../query/types.js'; -import { - GenerateOptions, - GenerateReturn, - GenerativeGroupByReturn, - GenerativeReturn, -} from '../types/index.js'; -interface Bm25 { - /** - * Perform retrieval-augmented generation (RaG) on the results of a keyword-based BM25 search of objects in this collection. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/bm25) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {BaseBm25Options} [opts] - The available options for performing the BM25 search. - * @return {Promise>} - The results of the search including the generated data. - */ - bm25(query: string, generate: GenerateOptions, opts?: BaseBm25Options): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a keyword-based BM25 search of objects in this collection. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/bm25) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {GroupByBm25Options} opts - The available options for performing the BM25 search. - * @return {Promise>} - The results of the search including the generated data grouped by the specified properties. - */ - bm25( - query: string, - generate: GenerateOptions, - opts: GroupByBm25Options - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a keyword-based BM25 search of objects in this collection. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/bm25) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {Bm25Options} [opts] - The available options for performing the BM25 search. - * @return {GenerateReturn} - The results of the search including the generated data. - */ - bm25(query: string, generate: GenerateOptions, opts?: Bm25Options): GenerateReturn; -} -interface Hybrid { - /** - * Perform retrieval-augmented generation (RaG) on the results of an object search in this collection using the hybrid algorithm blending keyword-based BM25 and vector-based similarity. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/hybrid) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {BaseHybridOptions} [opts] - The available options for performing the hybrid search. - * @return {Promise>} - The results of the search including the generated data. - */ - hybrid( - query: string, - generate: GenerateOptions, - opts?: BaseHybridOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of an object search in this collection using the hybrid algorithm blending keyword-based BM25 and vector-based similarity. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/hybrid) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {GroupByHybridOptions} opts - The available options for performing the hybrid search. - * @return {Promise>} - The results of the search including the generated data grouped by the specified properties. - */ - hybrid( - query: string, - generate: GenerateOptions, - opts: GroupByHybridOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of an object search in this collection using the hybrid algorithm blending keyword-based BM25 and vector-based similarity. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/hybrid) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {HybridOptions} [opts] - The available options for performing the hybrid search. - * @return {GenerateReturn} - The results of the search including the generated data. - */ - hybrid(query: string, generate: GenerateOptions, opts?: HybridOptions): GenerateReturn; -} -interface NearMedia { - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-audio object search in this collection using an audio-capable vectorization module and vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/multi2vec-bind) for a more detailed explanation. - * - * NOTE: You must have a multi-media-capable vectorization module installed in order to use this method, e.g. `multi2vec-bind`. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string | Buffer} media - The media file to search on. This can be a base64 string, a file path string, or a buffer. - * @param {NearMediaType} type - The type of media to search on. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {BaseNearOptions} [opts] - The available options for performing the near-media search. - * @return {Promise>} - The results of the search including the generated data. - */ - nearMedia( - media: string | Buffer, - type: NearMediaType, - generate: GenerateOptions, - opts?: BaseNearOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-audio object search in this collection using an audio-capable vectorization module and vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/multi2vec-bind) for a more detailed explanation. - * - * NOTE: You must have a multi-media-capable vectorization module installed in order to use this method, e.g. `multi2vec-bind`. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string | Buffer} media - The media file to search on. This can be a base64 string, a file path string, or a buffer. - * @param {NearMediaType} type - The type of media to search on. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {GroupByNearOptions} opts - The available options for performing the near-media search. - * @return {Promise>} - The results of the search including the generated data grouped by the specified properties. - */ - nearMedia( - media: string | Buffer, - type: NearMediaType, - generate: GenerateOptions, - opts: GroupByNearOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-audio object search in this collection using an audio-capable vectorization module and vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/multi2vec-bind) for a more detailed explanation. - * - * NOTE: You must have a multi-media-capable vectorization module installed in order to use this method, e.g. `multi2vec-bind`. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string | Buffer} media - The media to search on. This can be a base64 string, a file path string, or a buffer. - * @param {NearMediaType} type - The type of media to search on. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {NearOptions} [opts] - The available options for performing the near-media search. - * @return {GenerateReturn} - The results of the search including the generated data. - */ - nearMedia( - media: string | Buffer, - type: NearMediaType, - generate: GenerateOptions, - opts?: NearOptions - ): GenerateReturn; -} -interface NearObject { - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-object object search in this collection using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#nearobject) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string} id - The ID of the object to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {BaseNearOptions} [opts] - The available options for performing the near-object search. - * @return {Promise>} - The results of the search including the generated data. - */ - nearObject( - id: string, - generate: GenerateOptions, - opts?: BaseNearOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-object object search in this collection using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#nearobject) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string} id - The ID of the object to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {GroupByNearOptions} opts - The available options for performing the near-object search. - * @return {Promise>} - The results of the search including the generated data grouped by the specified properties. - */ - nearObject( - id: string, - generate: GenerateOptions, - opts: GroupByNearOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-object object search in this collection using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#nearobject) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string} id - The ID of the object to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {NearOptions} [opts] - The available options for performing the near-object search. - * @return {GenerateReturn} - The results of the search including the generated data. - */ - nearObject(id: string, generate: GenerateOptions, opts?: NearOptions): GenerateReturn; -} -interface NearText { - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-image object search in this collection using the image-capable vectorization module and vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#neartext) for a more detailed explanation. - * - * NOTE: You must have a text-capable vectorization module installed in order to use this method, e.g. any of the `text2vec-` and `multi2vec-` modules. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string | string[]} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {BaseNearTextOptions} [opts] - The available options for performing the near-text search. - * @return {Promise>} - The results of the search including the generated data. - */ - nearText( - query: string | string[], - generate: GenerateOptions, - opts?: BaseNearTextOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-image object search in this collection using the image-capable vectorization module and vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#neartext) for a more detailed explanation. - * - * NOTE: You must have a text-capable vectorization module installed in order to use this method, e.g. any of the `text2vec-` and `multi2vec-` modules. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string | string[]} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {GroupByNearTextOptions} opts - The available options for performing the near-text search. - * @return {Promise>} - The results of the search including the generated data grouped by the specified properties. - */ - nearText( - query: string | string[], - generate: GenerateOptions, - opts: GroupByNearTextOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-image object search in this collection using the image-capable vectorization module and vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#neartext) for a more detailed explanation. - * - * NOTE: You must have a text-capable vectorization module installed in order to use this method, e.g. any of the `text2vec-` and `multi2vec-` modules. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string | string[]} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {NearTextOptions} [opts] - The available options for performing the near-text search. - * @return {GenerateReturn} - The results of the search including the generated data. - */ - nearText( - query: string | string[], - generate: GenerateOptions, - opts?: NearTextOptions - ): GenerateReturn; -} -interface NearVector { - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-vector object search in this collection using vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {NearVectorInputType} vector - The vector(s) to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {BaseNearOptions} [opts] - The available options for performing the near-vector search. - * @return {Promise>} - The results of the search including the generated data. - */ - nearVector( - vector: NearVectorInputType, - generate: GenerateOptions, - opts?: BaseNearOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-vector object search in this collection using vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {NearVectorInputType} vector - The vector(s) to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {GroupByNearOptions} opts - The available options for performing the near-vector search. - * @return {Promise>} - The results of the search including the generated data grouped by the specified properties. - */ - nearVector( - vector: NearVectorInputType, - generate: GenerateOptions, - opts: GroupByNearOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-vector object search in this collection using vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {NearVectorInputType} vector - The vector(s) to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {NearOptions} [opts] - The available options for performing the near-vector search. - * @return {GenerateReturn} - The results of the search including the generated data. - */ - nearVector( - vector: NearVectorInputType, - generate: GenerateOptions, - opts?: NearOptions - ): GenerateReturn; -} -export interface Generate - extends Bm25, - Hybrid, - NearMedia, - NearObject, - NearText, - NearVector { - fetchObjects: (generate: GenerateOptions, opts?: FetchObjectsOptions) => Promise>; -} -export {}; diff --git a/dist/node/cjs/collections/generate/types.js b/dist/node/cjs/collections/generate/types.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/generate/types.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/index.d.ts b/dist/node/cjs/collections/index.d.ts deleted file mode 100644 index 3405a255..00000000 --- a/dist/node/cjs/collections/index.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -import Connection from '../connection/grpc.js'; -import { WeaviateClass } from '../openapi/types.js'; -import { DbVersionSupport } from '../utils/dbVersion.js'; -import { Collection } from './collection/index.js'; -import { - CollectionConfig, - GenerativeConfig, - GenerativeSearch, - InvertedIndexConfigCreate, - ModuleConfig, - MultiTenancyConfigCreate, - Properties, - PropertyConfigCreate, - ReferenceConfigCreate, - ReplicationConfigCreate, - Reranker, - RerankerConfig, - ShardingConfigCreate, - VectorizersConfigCreate, -} from './types/index.js'; -/** - * All the options available when creating a new collection. - * - * Inspect [the docs](https://weaviate.io/developers/weaviate/configuration) for more information on the - * different configuration options and how they affect the behavior of your collection. - */ -export type CollectionConfigCreate = { - /** The name of the collection. */ - name: N; - /** The description of the collection. */ - description?: string; - /** The configuration for Weaviate's generative capabilities. */ - generative?: ModuleConfig; - /** The configuration for Weaviate's inverted index. */ - invertedIndex?: InvertedIndexConfigCreate; - /** The configuration for Weaviate's multi-tenancy capabilities. */ - multiTenancy?: MultiTenancyConfigCreate; - /** The properties of the objects in the collection. */ - properties?: PropertyConfigCreate[]; - /** The references of the objects in the collection. */ - references?: ReferenceConfigCreate[]; - /** The configuration for Weaviate's replication strategy. Is mutually exclusive with `sharding`. */ - replication?: ReplicationConfigCreate; - /** The configuration for Weaviate's reranking capabilities. */ - reranker?: ModuleConfig; - /** The configuration for Weaviate's sharding strategy. Is mutually exclusive with `replication`. */ - sharding?: ShardingConfigCreate; - /** The configuration for Weaviate's vectorizer(s) capabilities. */ - vectorizers?: VectorizersConfigCreate; -}; -declare const collections: ( - connection: Connection, - dbVersionSupport: DbVersionSupport -) => { - create: ( - config: CollectionConfigCreate - ) => Promise>; - createFromSchema: (config: WeaviateClass) => Promise>; - delete: (name: string) => Promise; - deleteAll: () => Promise; - exists: (name: string) => Promise; - export: (name: string) => Promise; - listAll: () => Promise; - get: ( - name: TName_1 - ) => Collection; -}; -export interface Collections { - create( - config: CollectionConfigCreate - ): Promise>; - createFromSchema(config: WeaviateClass): Promise>; - delete(collection: string): Promise; - deleteAll(): Promise; - exists(name: string): Promise; - export(name: string): Promise; - get( - name: TName - ): Collection; - listAll(): Promise; -} -export default collections; -export * from './aggregate/index.js'; -export * from './backup/index.js'; -export * from './cluster/index.js'; -export * from './collection/index.js'; -export * from './config/index.js'; -export * from './configure/index.js'; -export * from './data/index.js'; -export * from './filters/index.js'; -export * from './generate/index.js'; -export * from './iterator/index.js'; -export * from './query/index.js'; -export * from './references/index.js'; -export * from './sort/index.js'; -export * from './tenants/index.js'; -export * from './types/index.js'; -export * from './vectors/multiTargetVector.js'; diff --git a/dist/node/cjs/collections/index.js b/dist/node/cjs/collections/index.js deleted file mode 100644 index 036b8cfe..00000000 --- a/dist/node/cjs/collections/index.js +++ /dev/null @@ -1,287 +0,0 @@ -'use strict'; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __exportStar = - (this && this.__exportStar) || - function (m, exports) { - for (var p in m) - if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) - __createBinding(exports, m, p); - }; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -var __rest = - (this && this.__rest) || - function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === 'function') - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; - }; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const errors_js_1 = require('../errors.js'); -const classExists_js_1 = __importDefault(require('../schema/classExists.js')); -const index_js_1 = require('../schema/index.js'); -const index_js_2 = __importDefault(require('./collection/index.js')); -const utils_js_1 = require('./config/utils.js'); -const parsing_js_1 = require('./configure/parsing.js'); -const index_js_3 = require('./index.js'); -const parseVectorIndex = (module) => { - if (module.config === undefined) return undefined; - if (module.name === 'dynamic') { - const _a = module.config, - { hnsw, flat } = _a, - conf = __rest(_a, ['hnsw', 'flat']); - return Object.assign(Object.assign({}, conf), { - hnsw: parseVectorIndex({ name: 'hnsw', config: hnsw }), - flat: parseVectorIndex({ name: 'flat', config: flat }), - }); - } - const _b = module.config, - { quantizer } = _b, - conf = __rest(_b, ['quantizer']); - if (quantizer === undefined) return conf; - if (parsing_js_1.QuantizerGuards.isBQCreate(quantizer)) { - const { type } = quantizer, - quant = __rest(quantizer, ['type']); - return Object.assign(Object.assign({}, conf), { - bq: Object.assign(Object.assign({}, quant), { enabled: true }), - }); - } - if (parsing_js_1.QuantizerGuards.isPQCreate(quantizer)) { - const { type } = quantizer, - quant = __rest(quantizer, ['type']); - return Object.assign(Object.assign({}, conf), { - pq: Object.assign(Object.assign({}, quant), { enabled: true }), - }); - } -}; -const parseVectorizerConfig = (config) => { - if (config === undefined) return {}; - const _a = config, - { vectorizeCollectionName } = _a, - rest = __rest(_a, ['vectorizeCollectionName']); - return Object.assign(Object.assign({}, rest), { vectorizeClassName: vectorizeCollectionName }); -}; -const collections = (connection, dbVersionSupport) => { - const listAll = () => - new index_js_1.SchemaGetter(connection) - .do() - .then((schema) => (schema.classes ? schema.classes.map(utils_js_1.classToCollection) : [])); - const deleteCollection = (name) => new index_js_1.ClassDeleter(connection).withClassName(name).do(); - return { - create: function (config) { - return __awaiter(this, void 0, void 0, function* () { - const { name, invertedIndex, multiTenancy, replication, sharding } = config, - rest = __rest(config, ['name', 'invertedIndex', 'multiTenancy', 'replication', 'sharding']); - const supportsDynamicVectorIndex = yield dbVersionSupport.supportsDynamicVectorIndex(); - const supportsNamedVectors = yield dbVersionSupport.supportsNamedVectors(); - const supportsHNSWAndBQ = yield dbVersionSupport.supportsHNSWAndBQ(); - const moduleConfig = {}; - if (config.generative) { - const generative = - config.generative.name === 'generative-azure-openai' - ? 'generative-openai' - : config.generative.name; - moduleConfig[generative] = config.generative.config ? config.generative.config : {}; - } - if (config.reranker) { - moduleConfig[config.reranker.name] = config.reranker.config ? config.reranker.config : {}; - } - const makeVectorsConfig = (configVectorizers) => { - let vectorizers = []; - const vectorsConfig = {}; - const vectorizersConfig = Array.isArray(configVectorizers) - ? configVectorizers - : [Object.assign(Object.assign({}, configVectorizers), { name: 'default' })]; - vectorizersConfig.forEach((v) => { - if (v.vectorIndex.name === 'dynamic' && !supportsDynamicVectorIndex.supports) { - throw new errors_js_1.WeaviateUnsupportedFeatureError(supportsDynamicVectorIndex.message); - } - const vectorConfig = { - vectorIndexConfig: parseVectorIndex(v.vectorIndex), - vectorIndexType: v.vectorIndex.name, - vectorizer: {}, - }; - const vectorizer = - v.vectorizer.name === 'text2vec-azure-openai' ? 'text2vec-openai' : v.vectorizer.name; - vectorizers = [...vectorizers, vectorizer]; - vectorConfig.vectorizer[vectorizer] = Object.assign( - { properties: v.properties }, - parseVectorizerConfig(v.vectorizer.config) - ); - if (v.name === undefined) { - throw new errors_js_1.WeaviateInvalidInputError( - 'vectorName is required for each vectorizer when specifying more than one vectorizer' - ); - } - vectorsConfig[v.name] = vectorConfig; - }); - return { vectorsConfig, vectorizers }; - }; - const makeLegacyVectorizer = (configVectorizers) => { - const vectorizer = - configVectorizers.vectorizer.name === 'text2vec-azure-openai' - ? 'text2vec-openai' - : configVectorizers.vectorizer.name; - const moduleConfig = {}; - moduleConfig[vectorizer] = parseVectorizerConfig(configVectorizers.vectorizer.config); - const vectorIndexConfig = parseVectorIndex(configVectorizers.vectorIndex); - const vectorIndexType = configVectorizers.vectorIndex.name; - if ( - vectorIndexType === 'hnsw' && - configVectorizers.vectorIndex.config !== undefined && - index_js_3.configGuards.quantizer.isBQ(configVectorizers.vectorIndex.config.quantizer) - ) { - if (!supportsHNSWAndBQ.supports) { - throw new errors_js_1.WeaviateUnsupportedFeatureError(supportsHNSWAndBQ.message); - } - } - if (vectorIndexType === 'dynamic' && !supportsDynamicVectorIndex.supports) { - throw new errors_js_1.WeaviateUnsupportedFeatureError(supportsDynamicVectorIndex.message); - } - return { - vectorizer, - moduleConfig, - vectorIndexConfig, - vectorIndexType, - }; - }; - let schema = Object.assign(Object.assign({}, rest), { - class: name, - invertedIndexConfig: invertedIndex, - moduleConfig: moduleConfig, - multiTenancyConfig: multiTenancy, - replicationConfig: replication, - shardingConfig: sharding, - }); - let vectorizers = []; - if (supportsNamedVectors.supports) { - const { vectorsConfig, vectorizers: vecs } = config.vectorizers - ? makeVectorsConfig(config.vectorizers) - : { vectorsConfig: undefined, vectorizers: [] }; - schema.vectorConfig = vectorsConfig; - vectorizers = [...vecs]; - } else { - if (config.vectorizers !== undefined && Array.isArray(config.vectorizers)) { - throw new errors_js_1.WeaviateUnsupportedFeatureError(supportsNamedVectors.message); - } - const configs = config.vectorizers - ? makeLegacyVectorizer(config.vectorizers) - : { - vectorizer: undefined, - moduleConfig: undefined, - vectorIndexConfig: undefined, - vectorIndexType: undefined, - }; - schema = Object.assign(Object.assign({}, schema), { - moduleConfig: Object.assign(Object.assign({}, schema.moduleConfig), configs.moduleConfig), - vectorizer: configs.vectorizer, - vectorIndexConfig: configs.vectorIndexConfig, - vectorIndexType: configs.vectorIndexType, - }); - if (configs.vectorizer !== undefined) { - vectorizers = [configs.vectorizer]; - } - } - const properties = config.properties - ? config.properties.map((prop) => (0, utils_js_1.resolveProperty)(prop, vectorizers)) - : []; - const references = config.references ? config.references.map(utils_js_1.resolveReference) : []; - schema.properties = [...properties, ...references]; - yield new index_js_1.ClassCreator(connection).withClass(schema).do(); - return (0, index_js_2.default)(connection, name, dbVersionSupport); - }); - }, - createFromSchema: function (config) { - return __awaiter(this, void 0, void 0, function* () { - const { class: name } = yield new index_js_1.ClassCreator(connection).withClass(config).do(); - return (0, index_js_2.default)(connection, name, dbVersionSupport); - }); - }, - delete: deleteCollection, - deleteAll: () => - listAll().then((configs) => - Promise.all( - configs === null || configs === void 0 ? void 0 : configs.map((c) => deleteCollection(c.name)) - ) - ), - exists: (name) => new classExists_js_1.default(connection).withClassName(name).do(), - export: (name) => - new index_js_1.ClassGetter(connection).withClassName(name).do().then(utils_js_1.classToCollection), - listAll: listAll, - get: (name) => (0, index_js_2.default)(connection, name, dbVersionSupport), - }; -}; -exports.default = collections; -__exportStar(require('./aggregate/index.js'), exports); -__exportStar(require('./backup/index.js'), exports); -__exportStar(require('./cluster/index.js'), exports); -__exportStar(require('./collection/index.js'), exports); -__exportStar(require('./config/index.js'), exports); -__exportStar(require('./configure/index.js'), exports); -__exportStar(require('./data/index.js'), exports); -__exportStar(require('./filters/index.js'), exports); -__exportStar(require('./generate/index.js'), exports); -__exportStar(require('./iterator/index.js'), exports); -__exportStar(require('./query/index.js'), exports); -__exportStar(require('./references/index.js'), exports); -__exportStar(require('./sort/index.js'), exports); -__exportStar(require('./tenants/index.js'), exports); -__exportStar(require('./types/index.js'), exports); -__exportStar(require('./vectors/multiTargetVector.js'), exports); diff --git a/dist/node/cjs/collections/iterator/index.d.ts b/dist/node/cjs/collections/iterator/index.d.ts deleted file mode 100644 index 09429315..00000000 --- a/dist/node/cjs/collections/iterator/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { WeaviateObject } from '../types/index.js'; -export declare class Iterator { - private query; - private cache; - private last; - constructor(query: (limit: number, after?: string) => Promise[]>); - [Symbol.asyncIterator](): { - next: () => Promise>>; - }; -} diff --git a/dist/node/cjs/collections/iterator/index.js b/dist/node/cjs/collections/iterator/index.js deleted file mode 100644 index 52ea7924..00000000 --- a/dist/node/cjs/collections/iterator/index.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.Iterator = void 0; -const errors_js_1 = require('../../errors.js'); -const ITERATOR_CACHE_SIZE = 100; -class Iterator { - constructor(query) { - this.query = query; - this.cache = []; - this.last = undefined; - this.query = query; - } - [Symbol.asyncIterator]() { - return { - next: () => - __awaiter(this, void 0, void 0, function* () { - const objects = yield this.query(ITERATOR_CACHE_SIZE, this.last); - this.cache = objects; - if (this.cache.length == 0) { - return { - done: true, - value: undefined, - }; - } - const obj = this.cache.shift(); - if (obj === undefined) { - throw new errors_js_1.WeaviateDeserializationError( - 'Object iterator returned an object that is undefined' - ); - } - this.last = obj === null || obj === void 0 ? void 0 : obj.uuid; - if (this.last === undefined) { - throw new errors_js_1.WeaviateDeserializationError( - 'Object iterator returned an object without a UUID' - ); - } - return { - done: false, - value: obj, - }; - }), - }; - } -} -exports.Iterator = Iterator; diff --git a/dist/node/cjs/collections/query/check.d.ts b/dist/node/cjs/collections/query/check.d.ts deleted file mode 100644 index ddd9790f..00000000 --- a/dist/node/cjs/collections/query/check.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -import Connection from '../../connection/grpc.js'; -import { ConsistencyLevel } from '../../index.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { - BaseBm25Options, - BaseHybridOptions, - BaseNearOptions, - FetchObjectByIdOptions, - FetchObjectsOptions, - NearVectorInputType, -} from './types.js'; -export declare class Check { - private connection; - private name; - dbVersionSupport: DbVersionSupport; - private consistencyLevel?; - private tenant?; - constructor( - connection: Connection, - name: string, - dbVersionSupport: DbVersionSupport, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ); - private getSearcher; - private checkSupportForNamedVectors; - private checkSupportForBm25AndHybridGroupByQueries; - private checkSupportForHybridNearTextAndNearVectorSubSearches; - private checkSupportForMultiTargetSearch; - private checkSupportForMultiVectorSearch; - private checkSupportForMultiWeightPerTargetSearch; - private checkSupportForMultiVectorPerTargetSearch; - nearSearch: (opts?: BaseNearOptions) => Promise<{ - search: import('../../grpc/searcher.js').Search; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - }>; - nearVector: ( - vec: NearVectorInputType, - opts?: BaseNearOptions - ) => Promise<{ - search: import('../../grpc/searcher.js').Search; - supportsTargets: boolean; - supportsVectorsForTargets: boolean; - supportsWeightsForTargets: boolean; - }>; - hybridSearch: (opts?: BaseHybridOptions) => Promise<{ - search: import('../../grpc/searcher.js').Search; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - supportsVectorsForTargets: boolean; - }>; - fetchObjects: (opts?: FetchObjectsOptions) => Promise<{ - search: import('../../grpc/searcher.js').Search; - }>; - fetchObjectById: (opts?: FetchObjectByIdOptions) => Promise<{ - search: import('../../grpc/searcher.js').Search; - }>; - bm25: (opts?: BaseBm25Options) => Promise<{ - search: import('../../grpc/searcher.js').Search; - }>; -} diff --git a/dist/node/cjs/collections/query/check.js b/dist/node/cjs/collections/query/check.js deleted file mode 100644 index 57f0757a..00000000 --- a/dist/node/cjs/collections/query/check.js +++ /dev/null @@ -1,203 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.Check = void 0; -const errors_js_1 = require('../../errors.js'); -const index_js_1 = require('../serialize/index.js'); -class Check { - constructor(connection, name, dbVersionSupport, consistencyLevel, tenant) { - this.getSearcher = () => this.connection.search(this.name, this.consistencyLevel, this.tenant); - this.checkSupportForNamedVectors = (opts) => - __awaiter(this, void 0, void 0, function* () { - if (!index_js_1.Serialize.isNamedVectors(opts)) return; - const check = yield this.dbVersionSupport.supportsNamedVectors(); - if (!check.supports) throw new errors_js_1.WeaviateUnsupportedFeatureError(check.message); - }); - this.checkSupportForBm25AndHybridGroupByQueries = (query, opts) => - __awaiter(this, void 0, void 0, function* () { - if (!index_js_1.Serialize.isGroupBy(opts)) return; - const check = yield this.dbVersionSupport.supportsBm25AndHybridGroupByQueries(); - if (!check.supports) throw new errors_js_1.WeaviateUnsupportedFeatureError(check.message(query)); - }); - this.checkSupportForHybridNearTextAndNearVectorSubSearches = (opts) => - __awaiter(this, void 0, void 0, function* () { - if ( - (opts === null || opts === void 0 ? void 0 : opts.vector) === undefined || - Array.isArray(opts.vector) - ) - return; - const check = yield this.dbVersionSupport.supportsHybridNearTextAndNearVectorSubsearchQueries(); - if (!check.supports) throw new errors_js_1.WeaviateUnsupportedFeatureError(check.message); - }); - this.checkSupportForMultiTargetSearch = (opts) => - __awaiter(this, void 0, void 0, function* () { - if (!index_js_1.Serialize.isMultiTarget(opts)) return false; - const check = yield this.dbVersionSupport.supportsMultiTargetVectorSearch(); - if (!check.supports) throw new errors_js_1.WeaviateUnsupportedFeatureError(check.message); - return check.supports; - }); - this.checkSupportForMultiVectorSearch = (vec) => - __awaiter(this, void 0, void 0, function* () { - if (vec === undefined || index_js_1.Serialize.isHybridNearTextSearch(vec)) return false; - if ( - index_js_1.Serialize.isHybridNearVectorSearch(vec) && - !index_js_1.Serialize.isMultiVector(vec.vector) - ) - return false; - if (index_js_1.Serialize.isHybridVectorSearch(vec) && !index_js_1.Serialize.isMultiVector(vec)) - return false; - const check = yield this.dbVersionSupport.supportsMultiVectorSearch(); - if (!check.supports) throw new errors_js_1.WeaviateUnsupportedFeatureError(check.message); - return check.supports; - }); - this.checkSupportForMultiWeightPerTargetSearch = (opts) => - __awaiter(this, void 0, void 0, function* () { - if (!index_js_1.Serialize.isMultiWeightPerTarget(opts)) return false; - const check = yield this.dbVersionSupport.supportsMultiWeightsPerTargetSearch(); - if (!check.supports) throw new errors_js_1.WeaviateUnsupportedFeatureError(check.message); - return check.supports; - }); - this.checkSupportForMultiVectorPerTargetSearch = (vec) => - __awaiter(this, void 0, void 0, function* () { - if (vec === undefined || index_js_1.Serialize.isHybridNearTextSearch(vec)) return false; - if ( - index_js_1.Serialize.isHybridNearVectorSearch(vec) && - !index_js_1.Serialize.isMultiVectorPerTarget(vec.vector) - ) - return false; - if ( - index_js_1.Serialize.isHybridVectorSearch(vec) && - !index_js_1.Serialize.isMultiVectorPerTarget(vec) - ) - return false; - const check = yield this.dbVersionSupport.supportsMultiVectorPerTargetSearch(); - if (!check.supports) throw new errors_js_1.WeaviateUnsupportedFeatureError(check.message); - return check.supports; - }); - this.nearSearch = (opts) => { - return Promise.all([ - this.getSearcher(), - this.checkSupportForMultiTargetSearch(opts), - this.checkSupportForMultiWeightPerTargetSearch(opts), - this.checkSupportForNamedVectors(opts), - ]).then(([search, supportsTargets, supportsWeightsForTargets]) => { - const is126 = supportsTargets; - const is127 = supportsWeightsForTargets; - return { search, supportsTargets: is126 || is127, supportsWeightsForTargets: is127 }; - }); - }; - this.nearVector = (vec, opts) => { - return Promise.all([ - this.getSearcher(), - this.checkSupportForMultiTargetSearch(opts), - this.checkSupportForMultiVectorSearch(vec), - this.checkSupportForMultiVectorPerTargetSearch(vec), - this.checkSupportForMultiWeightPerTargetSearch(opts), - this.checkSupportForNamedVectors(opts), - ]).then( - ([ - search, - supportsMultiTarget, - supportsMultiVector, - supportsVectorsForTargets, - supportsWeightsForTargets, - ]) => { - const is126 = supportsMultiTarget || supportsMultiVector; - const is127 = supportsVectorsForTargets || supportsWeightsForTargets; - return { - search, - supportsTargets: is126 || is127, - supportsVectorsForTargets: is127, - supportsWeightsForTargets: is127, - }; - } - ); - }; - this.hybridSearch = (opts) => { - return Promise.all([ - this.getSearcher(), - this.checkSupportForMultiTargetSearch(opts), - this.checkSupportForMultiVectorSearch(opts === null || opts === void 0 ? void 0 : opts.vector), - this.checkSupportForMultiVectorPerTargetSearch( - opts === null || opts === void 0 ? void 0 : opts.vector - ), - this.checkSupportForMultiWeightPerTargetSearch(opts), - this.checkSupportForNamedVectors(opts), - this.checkSupportForBm25AndHybridGroupByQueries('Hybrid', opts), - this.checkSupportForHybridNearTextAndNearVectorSubSearches(opts), - ]).then( - ([ - search, - supportsMultiTarget, - supportsMultiVector, - supportsWeightsForTargets, - supportsVectorsForTargets, - ]) => { - const is126 = supportsMultiTarget || supportsMultiVector; - const is127 = supportsVectorsForTargets || supportsWeightsForTargets; - return { - search, - supportsTargets: is126 || is127, - supportsWeightsForTargets: is127, - supportsVectorsForTargets: is127, - }; - } - ); - }; - this.fetchObjects = (opts) => { - return Promise.all([this.getSearcher(), this.checkSupportForNamedVectors(opts)]).then(([search]) => { - return { search }; - }); - }; - this.fetchObjectById = (opts) => { - return Promise.all([this.getSearcher(), this.checkSupportForNamedVectors(opts)]).then(([search]) => { - return { search }; - }); - }; - this.bm25 = (opts) => { - return Promise.all([ - this.getSearcher(), - this.checkSupportForNamedVectors(opts), - this.checkSupportForBm25AndHybridGroupByQueries('Bm25', opts), - ]).then(([search]) => { - return { search }; - }); - }; - this.connection = connection; - this.name = name; - this.dbVersionSupport = dbVersionSupport; - this.consistencyLevel = consistencyLevel; - this.tenant = tenant; - } -} -exports.Check = Check; diff --git a/dist/node/cjs/collections/query/index.d.ts b/dist/node/cjs/collections/query/index.d.ts deleted file mode 100644 index 25fa06d0..00000000 --- a/dist/node/cjs/collections/query/index.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -/// -import Connection from '../../connection/grpc.js'; -import { ConsistencyLevel } from '../../data/index.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { GroupByReturn, WeaviateObject, WeaviateReturn } from '../types/index.js'; -import { - BaseBm25Options, - BaseHybridOptions, - BaseNearOptions, - BaseNearTextOptions, - FetchObjectByIdOptions, - FetchObjectsOptions, - GroupByBm25Options, - GroupByHybridOptions, - GroupByNearOptions, - GroupByNearTextOptions, - NearMediaType, - NearVectorInputType, - Query, -} from './types.js'; -declare class QueryManager implements Query { - private check; - private constructor(); - static use( - connection: Connection, - name: string, - dbVersionSupport: DbVersionSupport, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ): QueryManager; - private parseReply; - private parseGroupByReply; - fetchObjectById(id: string, opts?: FetchObjectByIdOptions): Promise | null>; - fetchObjects(opts?: FetchObjectsOptions): Promise>; - bm25(query: string, opts?: BaseBm25Options): Promise>; - bm25(query: string, opts: GroupByBm25Options): Promise>; - hybrid(query: string, opts?: BaseHybridOptions): Promise>; - hybrid(query: string, opts: GroupByHybridOptions): Promise>; - nearImage(image: string | Buffer, opts?: BaseNearOptions): Promise>; - nearImage(image: string | Buffer, opts: GroupByNearOptions): Promise>; - nearMedia( - media: string | Buffer, - type: NearMediaType, - opts?: BaseNearOptions - ): Promise>; - nearMedia( - media: string | Buffer, - type: NearMediaType, - opts: GroupByNearOptions - ): Promise>; - nearObject(id: string, opts?: BaseNearOptions): Promise>; - nearObject(id: string, opts: GroupByNearOptions): Promise>; - nearText(query: string | string[], opts?: BaseNearTextOptions): Promise>; - nearText(query: string | string[], opts: GroupByNearTextOptions): Promise>; - nearVector(vector: NearVectorInputType, opts?: BaseNearOptions): Promise>; - nearVector(vector: NearVectorInputType, opts: GroupByNearOptions): Promise>; -} -declare const _default: typeof QueryManager.use; -export default _default; -export { - BaseBm25Options, - BaseHybridOptions, - BaseNearOptions, - BaseNearTextOptions, - Bm25Options, - FetchObjectByIdOptions, - FetchObjectsOptions, - GroupByBm25Options, - GroupByHybridOptions, - GroupByNearOptions, - GroupByNearTextOptions, - HybridNearTextSubSearch, - HybridNearVectorSubSearch, - HybridOptions, - HybridSubSearchBase, - MoveOptions, - NearMediaType, - NearOptions, - NearTextOptions, - Query, - QueryReturn, - SearchOptions, -} from './types.js'; diff --git a/dist/node/cjs/collections/query/index.js b/dist/node/cjs/collections/query/index.js deleted file mode 100644 index c37556b3..00000000 --- a/dist/node/cjs/collections/query/index.js +++ /dev/null @@ -1,254 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const base64_js_1 = require('../../utils/base64.js'); -const index_js_1 = require('../deserialize/index.js'); -const index_js_2 = require('../serialize/index.js'); -const errors_js_1 = require('../../errors.js'); -const check_js_1 = require('./check.js'); -class QueryManager { - constructor(check) { - this.check = check; - } - static use(connection, name, dbVersionSupport, consistencyLevel, tenant) { - return new QueryManager( - new check_js_1.Check(connection, name, dbVersionSupport, consistencyLevel, tenant) - ); - } - parseReply(reply) { - return __awaiter(this, void 0, void 0, function* () { - const deserialize = yield index_js_1.Deserialize.use(this.check.dbVersionSupport); - return deserialize.query(reply); - }); - } - parseGroupByReply(opts, reply) { - return __awaiter(this, void 0, void 0, function* () { - const deserialize = yield index_js_1.Deserialize.use(this.check.dbVersionSupport); - return index_js_2.Serialize.isGroupBy(opts) ? deserialize.groupBy(reply) : deserialize.query(reply); - }); - } - fetchObjectById(id, opts) { - return this.check - .fetchObjectById(opts) - .then(({ search }) => - search.withFetch(index_js_2.Serialize.fetchObjectById(Object.assign({ id }, opts))) - ) - .then((reply) => this.parseReply(reply)) - .then((ret) => (ret.objects.length === 1 ? ret.objects[0] : null)); - } - fetchObjects(opts) { - return this.check - .fetchObjects(opts) - .then(({ search }) => search.withFetch(index_js_2.Serialize.fetchObjects(opts))) - .then((reply) => this.parseReply(reply)); - } - bm25(query, opts) { - return this.check - .bm25(opts) - .then(({ search }) => - search.withBm25( - Object.assign(Object.assign({}, index_js_2.Serialize.bm25(Object.assign({ query }, opts))), { - groupBy: index_js_2.Serialize.isGroupBy(opts) - ? index_js_2.Serialize.groupBy(opts.groupBy) - : undefined, - }) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - hybrid(query, opts) { - return this.check - .hybridSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets, supportsVectorsForTargets }) => - search.withHybrid( - Object.assign( - Object.assign( - {}, - index_js_2.Serialize.hybrid( - Object.assign( - { query, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets }, - opts - ) - ) - ), - { - groupBy: index_js_2.Serialize.isGroupBy(opts) - ? index_js_2.Serialize.groupBy(opts.groupBy) - : undefined, - } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearImage(image, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => { - return (0, base64_js_1.toBase64FromMedia)(image).then((image) => - search.withNearImage( - Object.assign( - Object.assign( - {}, - index_js_2.Serialize.nearImage( - Object.assign({ image, supportsTargets, supportsWeightsForTargets }, opts ? opts : {}) - ) - ), - { - groupBy: index_js_2.Serialize.isGroupBy(opts) - ? index_js_2.Serialize.groupBy(opts.groupBy) - : undefined, - } - ) - ) - ); - }) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearMedia(media, type, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => { - const args = Object.assign({ supportsTargets, supportsWeightsForTargets }, opts ? opts : {}); - let reply; - switch (type) { - case 'audio': - reply = (0, base64_js_1.toBase64FromMedia)(media).then((media) => - search.withNearAudio(index_js_2.Serialize.nearAudio(Object.assign({ audio: media }, args))) - ); - break; - case 'depth': - reply = (0, base64_js_1.toBase64FromMedia)(media).then((media) => - search.withNearDepth(index_js_2.Serialize.nearDepth(Object.assign({ depth: media }, args))) - ); - break; - case 'image': - reply = (0, base64_js_1.toBase64FromMedia)(media).then((media) => - search.withNearImage(index_js_2.Serialize.nearImage(Object.assign({ image: media }, args))) - ); - break; - case 'imu': - reply = (0, base64_js_1.toBase64FromMedia)(media).then((media) => - search.withNearIMU(index_js_2.Serialize.nearIMU(Object.assign({ imu: media }, args))) - ); - break; - case 'thermal': - reply = (0, base64_js_1.toBase64FromMedia)(media).then((media) => - search.withNearThermal( - index_js_2.Serialize.nearThermal(Object.assign({ thermal: media }, args)) - ) - ); - break; - case 'video': - reply = (0, base64_js_1.toBase64FromMedia)(media).then((media) => - search.withNearVideo(index_js_2.Serialize.nearVideo(Object.assign({ video: media }, args))) - ); - break; - default: - throw new errors_js_1.WeaviateInvalidInputError(`Invalid media type: ${type}`); - } - return reply; - }) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearObject(id, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => - search.withNearObject( - Object.assign( - Object.assign( - {}, - index_js_2.Serialize.nearObject( - Object.assign({ id, supportsTargets, supportsWeightsForTargets }, opts ? opts : {}) - ) - ), - { - groupBy: index_js_2.Serialize.isGroupBy(opts) - ? index_js_2.Serialize.groupBy(opts.groupBy) - : undefined, - } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearText(query, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => - search.withNearText( - Object.assign( - Object.assign( - {}, - index_js_2.Serialize.nearText( - Object.assign({ query, supportsTargets, supportsWeightsForTargets }, opts ? opts : {}) - ) - ), - { - groupBy: index_js_2.Serialize.isGroupBy(opts) - ? index_js_2.Serialize.groupBy(opts.groupBy) - : undefined, - } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearVector(vector, opts) { - return this.check - .nearVector(vector, opts) - .then(({ search, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets }) => - search.withNearVector( - Object.assign( - Object.assign( - {}, - index_js_2.Serialize.nearVector( - Object.assign( - { vector, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets }, - opts ? opts : {} - ) - ) - ), - { - groupBy: index_js_2.Serialize.isGroupBy(opts) - ? index_js_2.Serialize.groupBy(opts.groupBy) - : undefined, - } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } -} -exports.default = QueryManager.use; diff --git a/dist/node/cjs/collections/query/types.d.ts b/dist/node/cjs/collections/query/types.d.ts deleted file mode 100644 index 333a94b4..00000000 --- a/dist/node/cjs/collections/query/types.d.ts +++ /dev/null @@ -1,494 +0,0 @@ -/// -import { FilterValue } from '../filters/index.js'; -import { MultiTargetVectorJoin } from '../index.js'; -import { Sorting } from '../sort/classes.js'; -import { - GroupByOptions, - GroupByReturn, - QueryMetadata, - QueryProperty, - QueryReference, - RerankOptions, - WeaviateObject, - WeaviateReturn, -} from '../types/index.js'; -import { PrimitiveKeys } from '../types/internal.js'; -/** Options available in the `query.fetchObjectById` method */ -export type FetchObjectByIdOptions = { - /** Whether to include the vector of the object in the response. If using named vectors, pass an array of strings to include only specific vectors. */ - includeVector?: boolean | string[]; - /** - * Which properties of the object to return. Can be primitive, in which case specify their names, or nested, in which case - * use the QueryNested type. If not specified, all properties are returned. - */ - returnProperties?: QueryProperty[]; - /** Which references of the object to return. If not specified, no references are returned. */ - returnReferences?: QueryReference[]; -}; -/** Options available in the `query.fetchObjects` method */ -export type FetchObjectsOptions = { - /** How many objects to return in the query */ - limit?: number; - /** How many objects to skip in the query. Incompatible with the `after` cursor */ - offset?: number; - /** The cursor to start the query from. Incompatible with the `offset` param */ - after?: string; - /** The filters to be applied to the query. Use `weaviate.filter.*` to create filters */ - filters?: FilterValue; - /** The sorting to be applied to the query. Use `weaviate.sort.*` to create sorting */ - sort?: Sorting; - /** Whether to include the vector of the object in the response. If using named vectors, pass an array of strings to include only specific vectors. */ - includeVector?: boolean | string[]; - /** Which metadata of the object to return. If not specified, no metadata is returned. */ - returnMetadata?: QueryMetadata; - /** - * Which properties of the object to return. Can be primitive, in which case specify their names, or nested, in which case - * use the QueryNested type. If not specified, all properties are returned. - */ - returnProperties?: QueryProperty[]; - /** Which references of the object to return. If not specified, no references are returned. */ - returnReferences?: QueryReference[]; -}; -/** Base options available to all the query methods that involve searching. */ -export type SearchOptions = { - /** How many objects to return in the query */ - limit?: number; - /** How many objects to skip in the query. Incompatible with the `after` cursor */ - offset?: number; - /** The [autocut](https://weaviate.io/developers/weaviate/api/graphql/additional-operators#autocut) parameter */ - autoLimit?: number; - /** The filters to be applied to the query. Use `weaviate.filter.*` to create filters */ - filters?: FilterValue; - /** How to rerank the query results. Requires a configured [reranking](https://weaviate.io/developers/weaviate/concepts/reranking) module. */ - rerank?: RerankOptions; - /** Whether to include the vector of the object in the response. If using named vectors, pass an array of strings to include only specific vectors. */ - includeVector?: boolean | string[]; - /** Which metadata of the object to return. If not specified, no metadata is returned. */ - returnMetadata?: QueryMetadata; - /** - * Which properties of the object to return. Can be primitive, in which case specify their names, or nested, in which case - * use the QueryNested type. If not specified, all properties are returned. - */ - returnProperties?: QueryProperty[]; - /** Which references of the object to return. If not specified, no references are returned. */ - returnReferences?: QueryReference[]; -}; -/** Which property of the collection to perform the keyword search on. */ -export type Bm25QueryProperty = { - /** The property name to search on. */ - name: PrimitiveKeys; - /** The weight to provide to the keyword search for this property. */ - weight: number; -}; -/** Base options available in the `query.bm25` method */ -export type BaseBm25Options = SearchOptions & { - /** Which properties of the collection to perform the keyword search on. */ - queryProperties?: (PrimitiveKeys | Bm25QueryProperty)[]; -}; -/** Options available in the `query.bm25` method when specifying the `groupBy` parameter. */ -export type GroupByBm25Options = BaseBm25Options & { - /** The group by options to apply to the search. */ - groupBy: GroupByOptions; -}; -/** Options available in the `query.bm25` method */ -export type Bm25Options = BaseBm25Options | GroupByBm25Options | undefined; -/** Base options available in the `query.hybrid` method */ -export type BaseHybridOptions = SearchOptions & { - /** The weight of the BM25 score. If not specified, the default weight specified by the server is used. */ - alpha?: number; - /** The specific vector to search for or a specific vector subsearch. If not specified, the query is vectorized and used in the similarity search. */ - vector?: NearVectorInputType | HybridNearTextSubSearch | HybridNearVectorSubSearch; - /** The properties to search in. If not specified, all properties are searched. */ - queryProperties?: (PrimitiveKeys | Bm25QueryProperty)[]; - /** The type of fusion to apply. If not specified, the default fusion type specified by the server is used. */ - fusionType?: 'Ranked' | 'RelativeScore'; - /** Specify which vector(s) to search on if using named vectors. */ - targetVector?: TargetVectorInputType; -}; -export type HybridSubSearchBase = { - certainty?: number; - distance?: number; -}; -export type HybridNearTextSubSearch = HybridSubSearchBase & { - query: string | string[]; - moveTo?: MoveOptions; - moveAway?: MoveOptions; -}; -export type HybridNearVectorSubSearch = HybridSubSearchBase & { - vector: NearVectorInputType; -}; -/** Options available in the `query.hybrid` method when specifying the `groupBy` parameter. */ -export type GroupByHybridOptions = BaseHybridOptions & { - /** The group by options to apply to the search. */ - groupBy: GroupByOptions; -}; -/** Options available in the `query.hybrid` method */ -export type HybridOptions = BaseHybridOptions | GroupByHybridOptions | undefined; -/** Base options for the near search queries. */ -export type BaseNearOptions = SearchOptions & { - /** The minimum similarity score to return. Incompatible with the `distance` param. */ - certainty?: number; - /** The maximum distance to search. Incompatible with the `certainty` param. */ - distance?: number; - /** Specify which vector to search on if using named vectors. */ - targetVector?: TargetVectorInputType; -}; -/** Options available in the near search queries when specifying the `groupBy` parameter. */ -export type GroupByNearOptions = BaseNearOptions & { - /** The group by options to apply to the search. */ - groupBy: GroupByOptions; -}; -/** Options available when specifying `moveTo` and `moveAway` in the `query.nearText` method. */ -export type MoveOptions = { - force: number; - objects?: string[]; - concepts?: string[]; -}; -/** Base options for the `query.nearText` method. */ -export type BaseNearTextOptions = BaseNearOptions & { - moveTo?: MoveOptions; - moveAway?: MoveOptions; -}; -/** Options available in the near text search queries when specifying the `groupBy` parameter. */ -export type GroupByNearTextOptions = BaseNearTextOptions & { - groupBy: GroupByOptions; -}; -/** The type of the media to search for in the `query.nearMedia` method */ -export type NearMediaType = 'audio' | 'depth' | 'image' | 'imu' | 'thermal' | 'video'; -/** - * The vector(s) to search for in the `query/generate.nearVector` and `query/generate.hybrid` methods. One of: - * - a single vector, in which case pass a single number array. - * - multiple named vectors, in which case pass an object of type `Record`. - */ -export type NearVectorInputType = number[] | Record; -/** - * Over which vector spaces to perform the vector search query in the `nearX` search method. One of: - * - a single vector space search, in which case pass a string with the name of the vector space to search in. - * - a multi-vector space search, in which case pass an array of strings with the names of the vector spaces to search in. - * - a weighted multi-vector space search, in which case pass an object of type `MultiTargetVectorJoin` detailing the vector spaces to search in. - */ -export type TargetVectorInputType = string | string[] | MultiTargetVectorJoin; -interface Bm25 { - /** - * Search for objects in this collection using the keyword-based BM25 algorithm. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/bm25) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string} query - The query to search for. - * @param {BaseBm25Options} [opts] - The available options for the search excluding the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - bm25(query: string, opts?: BaseBm25Options): Promise>; - /** - * Search for objects in this collection using the keyword-based BM25 algorithm. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/bm25) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string} query - The query to search for. - * @param {GroupByBm25Options} opts - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - bm25(query: string, opts: GroupByBm25Options): Promise>; - /** - * Search for objects in this collection using the keyword-based BM25 algorithm. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/bm25) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string} query - The query to search for. - * @param {Bm25Options} [opts] - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - bm25(query: string, opts?: Bm25Options): QueryReturn; -} -interface Hybrid { - /** - * Search for objects in this collection using the hybrid algorithm blending keyword-based BM25 and vector-based similarity. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/hybrid) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string} query - The query to search for in the BM25 keyword search.. - * @param {BaseHybridOptions} [opts] - The available options for the search excluding the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - hybrid(query: string, opts?: BaseHybridOptions): Promise>; - /** - * Search for objects in this collection using the hybrid algorithm blending keyword-based BM25 and vector-based similarity. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/hybrid) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string} query - The query to search for in the BM25 keyword search.. - * @param {GroupByHybridOptions} opts - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - hybrid(query: string, opts: GroupByHybridOptions): Promise>; - /** - * Search for objects in this collection using the hybrid algorithm blending keyword-based BM25 and vector-based similarity. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/hybrid) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string} query - The query to search for in the BM25 keyword search.. - * @param {HybridOptions} [opts] - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - hybrid(query: string, opts?: HybridOptions): QueryReturn; -} -interface NearImage { - /** - * Search for objects by image in this collection using an image-capable vectorization module and vector-based similarity search. - * You must have an image-capable vectorization module installed in order to use this method, - * e.g. `img2vec-neural`, `multi2vec-clip`, or `multi2vec-bind. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/image) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string | Buffer} image - The image to search on. This can be a base64 string, a file path string, or a buffer. - * @param {BaseNearOptions} [opts] - The available options for the search excluding the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - nearImage(image: string | Buffer, opts?: BaseNearOptions): Promise>; - /** - * Search for objects by image in this collection using an image-capable vectorization module and vector-based similarity search. - * You must have an image-capable vectorization module installed in order to use this method, - * e.g. `img2vec-neural`, `multi2vec-clip`, or `multi2vec-bind. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string | Buffer} image - The image to search on. This can be a base64 string, a file path string, or a buffer. - * @param {GroupByNearOptions} opts - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The group by result of the search within the fetched collection. - */ - nearImage(image: string | Buffer, opts: GroupByNearOptions): Promise>; - /** - * Search for objects by image in this collection using an image-capable vectorization module and vector-based similarity search. - * You must have an image-capable vectorization module installed in order to use this method, - * e.g. `img2vec-neural`, `multi2vec-clip`, or `multi2vec-bind. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string | Buffer} image - The image to search on. This can be a base64 string, a file path string, or a buffer. - * @param {NearOptions} [opts] - The available options for the search. - * @returns {QueryReturn} - The result of the search within the fetched collection. - */ - nearImage(image: string | Buffer, opts?: NearOptions): QueryReturn; -} -interface NearMedia { - /** - * Search for objects by image in this collection using an image-capable vectorization module and vector-based similarity search. - * You must have a multi-media-capable vectorization module installed in order to use this method, e.g. `multi2vec-bind` or `multi2vec-palm`. - * - * See the [docs](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/multi2vec-bind) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string | Buffer} media - The media to search on. This can be a base64 string, a file path string, or a buffer. - * @param {NearMediaType} type - The type of media to search for, e.g. 'audio'. - * @param {BaseNearOptions} [opts] - The available options for the search excluding the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - nearMedia( - media: string | Buffer, - type: NearMediaType, - opts?: BaseNearOptions - ): Promise>; - /** - * Search for objects by image in this collection using an image-capable vectorization module and vector-based similarity search. - * You must have a multi-media-capable vectorization module installed in order to use this method, e.g. `multi2vec-bind` or `multi2vec-palm`. - * - * See the [docs](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/multi2vec-bind) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string | Buffer} media - The media to search on. This can be a base64 string, a file path string, or a buffer. - * @param {NearMediaType} type - The type of media to search for, e.g. 'audio'. - * @param {GroupByNearOptions} opts - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The group by result of the search within the fetched collection. - */ - nearMedia( - media: string | Buffer, - type: NearMediaType, - opts: GroupByNearOptions - ): Promise>; - /** - * Search for objects by image in this collection using an image-capable vectorization module and vector-based similarity search. - * You must have a multi-media-capable vectorization module installed in order to use this method, e.g. `multi2vec-bind` or `multi2vec-palm`. - * - * See the [docs](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/multi2vec-bind) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string | Buffer} media - The media to search on. This can be a base64 string, a file path string, or a buffer. - * @param {NearMediaType} type - The type of media to search for, e.g. 'audio'. - * @param {NearOptions} [opts] - The available options for the search. - * @returns {QueryReturn} - The result of the search within the fetched collection. - */ - nearMedia(media: string | Buffer, type: NearMediaType, opts?: NearOptions): QueryReturn; -} -interface NearObject { - /** - * Search for objects in this collection by another object using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#nearobject) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string} id - The UUID of the object to search for. - * @param {BaseNearOptions} [opts] - The available options for the search excluding the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - nearObject(id: string, opts?: BaseNearOptions): Promise>; - /** - * Search for objects in this collection by another object using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#nearobject) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string} id - The UUID of the object to search for. - * @param {GroupByNearOptions} opts - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The group by result of the search within the fetched collection. - */ - nearObject(id: string, opts: GroupByNearOptions): Promise>; - /** - * Search for objects in this collection by another object using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {number[]} id - The UUID of the object to search for. - * @param {NearOptions} [opts] - The available options for the search. - * @returns {QueryReturn} - The result of the search within the fetched collection. - */ - nearObject(id: string, opts?: NearOptions): QueryReturn; -} -interface NearText { - /** - * Search for objects in this collection by text using text-capable vectorization module and vector-based similarity search. - * You must have a text-capable vectorization module installed in order to use this method, - * e.g. any of the `text2vec-` and `multi2vec-` modules. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#neartext) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string | string[]} query - The text query to search for. - * @param {BaseNearTextOptions} [opts] - The available options for the search excluding the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - nearText(query: string | string[], opts?: BaseNearTextOptions): Promise>; - /** - * Search for objects in this collection by text using text-capable vectorization module and vector-based similarity search. - * You must have a text-capable vectorization module installed in order to use this method, - * e.g. any of the `text2vec-` and `multi2vec-` modules. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#neartext) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string | string[]} query - The text query to search for. - * @param {GroupByNearTextOptions} opts - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The group by result of the search within the fetched collection. - */ - nearText(query: string | string[], opts: GroupByNearTextOptions): Promise>; - /** - * Search for objects in this collection by text using text-capable vectorization module and vector-based similarity search. - * You must have a text-capable vectorization module installed in order to use this method, - * e.g. any of the `text2vec-` and `multi2vec-` modules. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#neartext) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string | string[]} query - The text query to search for. - * @param {NearTextOptions} [opts] - The available options for the search. - * @returns {QueryReturn} - The result of the search within the fetched collection. - */ - nearText(query: string | string[], opts?: NearTextOptions): QueryReturn; -} -interface NearVector { - /** - * Search for objects by vector in this collection using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {NearVectorInputType} vector - The vector(s) to search on. - * @param {BaseNearOptions} [opts] - The available options for the search excluding the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - nearVector(vector: NearVectorInputType, opts?: BaseNearOptions): Promise>; - /** - * Search for objects by vector in this collection using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {NearVectorInputType} vector - The vector(s) to search for. - * @param {GroupByNearOptions} opts - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The group by result of the search within the fetched collection. - */ - nearVector(vector: NearVectorInputType, opts: GroupByNearOptions): Promise>; - /** - * Search for objects by vector in this collection using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {NearVectorInputType} vector - The vector(s) to search for. - * @param {NearOptions} [opts] - The available options for the search. - * @returns {QueryReturn} - The result of the search within the fetched collection. - */ - nearVector(vector: NearVectorInputType, opts?: NearOptions): QueryReturn; -} -/** All the available methods on the `.query` namespace. */ -export interface Query - extends Bm25, - Hybrid, - NearImage, - NearMedia, - NearObject, - NearText, - NearVector { - /** - * Retrieve an object from the server by its UUID. - * - * @param {string} id - The UUID of the object to retrieve. - * @param {FetchObjectByIdOptions} [opts] - The available options for fetching the object. - * @returns {Promise | null>} - The object with the given UUID, or null if it does not exist. - */ - fetchObjectById: (id: string, opts?: FetchObjectByIdOptions) => Promise | null>; - /** - * Retrieve objects from the server without searching. - * - * @param {FetchObjectsOptions} [opts] - The available options for fetching the objects. - * @returns {Promise>} - The objects within the fetched collection. - */ - fetchObjects: (opts?: FetchObjectsOptions) => Promise>; -} -/** Options available in the `query.nearImage`, `query.nearMedia`, `query.nearObject`, and `query.nearVector` methods */ -export type NearOptions = BaseNearOptions | GroupByNearOptions | undefined; -/** Options available in the `query.nearText` method */ -export type NearTextOptions = BaseNearTextOptions | GroupByNearTextOptions | undefined; -/** The return type of the `query` methods. It is a union of a standard query and a group by query due to function overloading. */ -export type QueryReturn = Promise> | Promise>; -export {}; diff --git a/dist/node/cjs/collections/query/types.js b/dist/node/cjs/collections/query/types.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/query/types.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/query/utils.d.ts b/dist/node/cjs/collections/query/utils.d.ts deleted file mode 100644 index 958a6dfd..00000000 --- a/dist/node/cjs/collections/query/utils.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { MultiTargetVectorJoin } from '../index.js'; -import { NearVectorInputType, TargetVectorInputType } from './types.js'; -export declare class NearVectorInputGuards { - static is1DArray(input: NearVectorInputType): input is number[]; - static isObject(input: NearVectorInputType): input is Record; -} -export declare class ArrayInputGuards { - static is1DArray(input: U | T): input is T; - static is2DArray(input: U | T): input is T; -} -export declare class TargetVectorInputGuards { - static isSingle(input: TargetVectorInputType): input is string; - static isMulti(input: TargetVectorInputType): input is string[]; - static isMultiJoin(input: TargetVectorInputType): input is MultiTargetVectorJoin; -} diff --git a/dist/node/cjs/collections/query/utils.js b/dist/node/cjs/collections/query/utils.js deleted file mode 100644 index da4eaa73..00000000 --- a/dist/node/cjs/collections/query/utils.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.TargetVectorInputGuards = exports.ArrayInputGuards = exports.NearVectorInputGuards = void 0; -class NearVectorInputGuards { - static is1DArray(input) { - return Array.isArray(input) && input.length > 0 && !Array.isArray(input[0]); - } - static isObject(input) { - return !Array.isArray(input); - } -} -exports.NearVectorInputGuards = NearVectorInputGuards; -class ArrayInputGuards { - static is1DArray(input) { - return Array.isArray(input) && input.length > 0 && !Array.isArray(input[0]); - } - static is2DArray(input) { - return Array.isArray(input) && input.length > 0 && Array.isArray(input[0]); - } -} -exports.ArrayInputGuards = ArrayInputGuards; -class TargetVectorInputGuards { - static isSingle(input) { - return typeof input === 'string'; - } - static isMulti(input) { - return Array.isArray(input); - } - static isMultiJoin(input) { - const i = input; - return i.combination !== undefined && i.targetVectors !== undefined; - } -} -exports.TargetVectorInputGuards = TargetVectorInputGuards; diff --git a/dist/node/cjs/collections/references/classes.d.ts b/dist/node/cjs/collections/references/classes.d.ts deleted file mode 100644 index 31384fb8..00000000 --- a/dist/node/cjs/collections/references/classes.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Properties, ReferenceInput, ReferenceToMultiTarget, WeaviateObject } from '../types/index.js'; -import { Beacon } from './types.js'; -export declare class ReferenceManager { - objects: WeaviateObject[]; - targetCollection: string; - uuids?: string[]; - constructor(targetCollection: string, objects?: WeaviateObject[], uuids?: string[]); - toBeaconObjs(): Beacon[]; - toBeaconStrings(): string[]; - isMultiTarget(): boolean; -} -/** - * A factory class to create references from objects to other objects. - */ -export declare class Reference { - /** - * Create a single-target reference with given UUID(s). - * - * @param {string | string[]} uuids The UUID(s) of the target object(s). - * @returns {ReferenceManager} The reference manager object. - */ - static to( - uuids: string | string[] - ): ReferenceManager; - /** - * Create a multi-target reference with given UUID(s) pointing to a specific target collection. - * - * @param {string | string[]} uuids The UUID(s) of the target object(s). - * @param {string} targetCollection The target collection name. - * @returns {ReferenceManager} The reference manager object. - */ - static toMultiTarget( - uuids: string | string[], - targetCollection: string - ): ReferenceManager; -} -export declare class ReferenceGuards { - static isReferenceManager(arg: ReferenceInput): arg is ReferenceManager; - static isUuid(arg: ReferenceInput): arg is string; - static isUuids(arg: ReferenceInput): arg is string[]; - static isMultiTarget(arg: ReferenceInput): arg is ReferenceToMultiTarget; -} diff --git a/dist/node/cjs/collections/references/classes.js b/dist/node/cjs/collections/references/classes.js deleted file mode 100644 index 4bd2b66d..00000000 --- a/dist/node/cjs/collections/references/classes.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.ReferenceGuards = exports.Reference = exports.ReferenceManager = void 0; -const utils_js_1 = require('./utils.js'); -class ReferenceManager { - constructor(targetCollection, objects, uuids) { - this.objects = objects !== null && objects !== void 0 ? objects : []; - this.targetCollection = targetCollection; - this.uuids = uuids; - } - toBeaconObjs() { - return this.uuids - ? this.uuids.map((uuid) => (0, utils_js_1.uuidToBeacon)(uuid, this.targetCollection)) - : []; - } - toBeaconStrings() { - return this.uuids - ? this.uuids.map((uuid) => (0, utils_js_1.uuidToBeacon)(uuid, this.targetCollection).beacon) - : []; - } - isMultiTarget() { - return this.targetCollection !== ''; - } -} -exports.ReferenceManager = ReferenceManager; -/** - * A factory class to create references from objects to other objects. - */ -class Reference { - /** - * Create a single-target reference with given UUID(s). - * - * @param {string | string[]} uuids The UUID(s) of the target object(s). - * @returns {ReferenceManager} The reference manager object. - */ - static to(uuids) { - return new ReferenceManager('', undefined, Array.isArray(uuids) ? uuids : [uuids]); - } - /** - * Create a multi-target reference with given UUID(s) pointing to a specific target collection. - * - * @param {string | string[]} uuids The UUID(s) of the target object(s). - * @param {string} targetCollection The target collection name. - * @returns {ReferenceManager} The reference manager object. - */ - static toMultiTarget(uuids, targetCollection) { - return new ReferenceManager(targetCollection, undefined, Array.isArray(uuids) ? uuids : [uuids]); - } -} -exports.Reference = Reference; -class ReferenceGuards { - static isReferenceManager(arg) { - return arg instanceof ReferenceManager; - } - static isUuid(arg) { - return typeof arg === 'string'; - } - static isUuids(arg) { - return Array.isArray(arg); - } - static isMultiTarget(arg) { - return arg.targetCollection !== undefined; - } -} -exports.ReferenceGuards = ReferenceGuards; diff --git a/dist/node/cjs/collections/references/index.d.ts b/dist/node/cjs/collections/references/index.d.ts deleted file mode 100644 index 58295777..00000000 --- a/dist/node/cjs/collections/references/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { Reference, ReferenceManager } from './classes.js'; -export type { Beacon, CrossReference, CrossReferenceDefault, CrossReferences, UnionOf } from './types.js'; diff --git a/dist/node/cjs/collections/references/index.js b/dist/node/cjs/collections/references/index.js deleted file mode 100644 index 27a437de..00000000 --- a/dist/node/cjs/collections/references/index.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.ReferenceManager = exports.Reference = void 0; -var classes_js_1 = require('./classes.js'); -Object.defineProperty(exports, 'Reference', { - enumerable: true, - get: function () { - return classes_js_1.Reference; - }, -}); -Object.defineProperty(exports, 'ReferenceManager', { - enumerable: true, - get: function () { - return classes_js_1.ReferenceManager; - }, -}); diff --git a/dist/node/cjs/collections/references/types.d.ts b/dist/node/cjs/collections/references/types.d.ts deleted file mode 100644 index 9df567b3..00000000 --- a/dist/node/cjs/collections/references/types.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Properties, WeaviateNonGenericObject } from '../types/index.js'; -import { ReferenceManager } from './classes.js'; -export type CrossReference = ReferenceManager; -export type CrossReferenceDefault = { - objects: WeaviateNonGenericObject[]; -}; -export type CrossReferences = ReferenceManager>; -export type UnionOf = T extends (infer U)[] ? U : never; -export type Beacon = { - beacon: string; -}; diff --git a/dist/node/cjs/collections/references/types.js b/dist/node/cjs/collections/references/types.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/references/types.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/references/utils.d.ts b/dist/node/cjs/collections/references/utils.d.ts deleted file mode 100644 index 80db3459..00000000 --- a/dist/node/cjs/collections/references/utils.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ReferenceInput } from '../types/index.js'; -import { ReferenceManager } from './classes.js'; -import { Beacon } from './types.js'; -export declare function uuidToBeacon(uuid: string, targetCollection?: string): Beacon; -export declare const referenceFromObjects: ( - objects: any[], - targetCollection: string, - uuids: string[] -) => ReferenceManager; -export declare const referenceToBeacons: (ref: ReferenceInput) => Beacon[]; diff --git a/dist/node/cjs/collections/references/utils.js b/dist/node/cjs/collections/references/utils.js deleted file mode 100644 index b1035b53..00000000 --- a/dist/node/cjs/collections/references/utils.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.referenceToBeacons = exports.referenceFromObjects = exports.uuidToBeacon = void 0; -const classes_js_1 = require('./classes.js'); -function uuidToBeacon(uuid, targetCollection) { - return { - beacon: `weaviate://localhost/${targetCollection ? `${targetCollection}/` : ''}${uuid}`, - }; -} -exports.uuidToBeacon = uuidToBeacon; -const referenceFromObjects = (objects, targetCollection, uuids) => { - return new classes_js_1.ReferenceManager(targetCollection, objects, uuids); -}; -exports.referenceFromObjects = referenceFromObjects; -const referenceToBeacons = (ref) => { - if (classes_js_1.ReferenceGuards.isReferenceManager(ref)) { - return ref.toBeaconObjs(); - } else if (classes_js_1.ReferenceGuards.isUuid(ref)) { - return [uuidToBeacon(ref)]; - } else if (classes_js_1.ReferenceGuards.isUuids(ref)) { - return ref.map((uuid) => uuidToBeacon(uuid)); - } else if (classes_js_1.ReferenceGuards.isMultiTarget(ref)) { - return typeof ref.uuids === 'string' - ? [uuidToBeacon(ref.uuids, ref.targetCollection)] - : ref.uuids.map((uuid) => uuidToBeacon(uuid, ref.targetCollection)); - } - return []; -}; -exports.referenceToBeacons = referenceToBeacons; diff --git a/dist/node/cjs/collections/serialize/index.d.ts b/dist/node/cjs/collections/serialize/index.d.ts deleted file mode 100644 index 9706b9f9..00000000 --- a/dist/node/cjs/collections/serialize/index.d.ts +++ /dev/null @@ -1,224 +0,0 @@ -import { - SearchBm25Args, - SearchFetchArgs, - SearchHybridArgs, - SearchNearAudioArgs, - SearchNearDepthArgs, - SearchNearIMUArgs, - SearchNearImageArgs, - SearchNearObjectArgs, - SearchNearTextArgs, - SearchNearThermalArgs, - SearchNearVectorArgs, - SearchNearVideoArgs, -} from '../../grpc/searcher.js'; -import { WhereFilter } from '../../openapi/types.js'; -import { Filters as FiltersGRPC } from '../../proto/v1/base.js'; -import { GenerativeSearch } from '../../proto/v1/generative.js'; -import { GroupBy, Rerank, Targets } from '../../proto/v1/search_get.js'; -import { FilterValue } from '../filters/index.js'; -import { - BaseNearOptions, - Bm25Options, - FetchObjectByIdOptions, - FetchObjectsOptions, - HybridNearTextSubSearch, - HybridNearVectorSubSearch, - HybridOptions, - NearOptions, - NearTextOptions, - NearVectorInputType, - TargetVectorInputType, -} from '../query/types.js'; -import { TenantBC, TenantCreate, TenantUpdate } from '../tenants/types.js'; -import { - BatchObjects, - DataObject, - GenerateOptions, - GroupByOptions, - MetadataKeys, - NestedProperties, - NonReferenceInputs, - PhoneNumberInput, - QueryMetadata, - ReferenceInput, - RerankOptions, - WeaviateField, -} from '../types/index.js'; -export declare class DataGuards { - static isText: (argument?: WeaviateField) => argument is string; - static isTextArray: (argument?: WeaviateField) => argument is string[]; - static isInt: (argument?: WeaviateField) => argument is number; - static isIntArray: (argument?: WeaviateField) => argument is number[]; - static isFloat: (argument?: WeaviateField) => argument is number; - static isFloatArray: (argument?: WeaviateField) => argument is number[]; - static isBoolean: (argument?: WeaviateField) => argument is boolean; - static isBooleanArray: (argument?: WeaviateField) => argument is boolean[]; - static isDate: (argument?: WeaviateField) => argument is Date; - static isDateArray: (argument?: WeaviateField) => argument is Date[]; - static isGeoCoordinate: ( - argument?: WeaviateField - ) => argument is Required; - static isPhoneNumber: (argument?: WeaviateField) => argument is PhoneNumberInput; - static isNested: (argument?: WeaviateField) => argument is NestedProperties; - static isNestedArray: (argument?: WeaviateField) => argument is NestedProperties[]; - static isEmptyArray: (argument?: WeaviateField) => argument is []; - static isDataObject: (obj: DataObject | NonReferenceInputs) => obj is DataObject; -} -export declare class MetadataGuards { - static isKeys: (argument?: QueryMetadata) => argument is MetadataKeys; - static isAll: (argument?: QueryMetadata) => argument is 'all'; - static isUndefined: (argument?: QueryMetadata) => argument is undefined; -} -export declare class Serialize { - static isNamedVectors: (opts?: BaseNearOptions | undefined) => boolean; - static isMultiTarget: (opts?: BaseNearOptions | undefined) => boolean; - static isMultiWeightPerTarget: (opts?: BaseNearOptions | undefined) => boolean; - static isMultiVector: (vec?: NearVectorInputType) => boolean; - static isMultiVectorPerTarget: (vec?: NearVectorInputType) => boolean; - private static common; - static fetchObjects: (args?: FetchObjectsOptions | undefined) => SearchFetchArgs; - static fetchObjectById: ( - args: { - id: string; - } & FetchObjectByIdOptions - ) => SearchFetchArgs; - private static bm25QueryProperties; - static bm25: ( - args: { - query: string; - } & Bm25Options - ) => SearchBm25Args; - static isHybridVectorSearch: ( - vector: NearVectorInputType | HybridNearTextSubSearch | HybridNearVectorSubSearch | undefined - ) => vector is number[] | Record; - static isHybridNearTextSearch: ( - vector: NearVectorInputType | HybridNearTextSubSearch | HybridNearVectorSubSearch | undefined - ) => vector is HybridNearTextSubSearch; - static isHybridNearVectorSearch: ( - vector: NearVectorInputType | HybridNearTextSubSearch | HybridNearVectorSubSearch | undefined - ) => vector is HybridNearVectorSubSearch; - private static hybridVector; - static hybrid: ( - args: { - query: string; - supportsTargets: boolean; - supportsVectorsForTargets: boolean; - supportsWeightsForTargets: boolean; - } & HybridOptions - ) => SearchHybridArgs; - static nearAudio: ( - args: { - audio: string; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearAudioArgs; - static nearDepth: ( - args: { - depth: string; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearDepthArgs; - static nearImage: ( - args: { - image: string; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearImageArgs; - static nearIMU: ( - args: { - imu: string; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearIMUArgs; - static nearObject: ( - args: { - id: string; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearObjectArgs; - private static nearTextSearch; - static nearText: ( - args: { - query: string | string[]; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearTextOptions - ) => SearchNearTextArgs; - static nearThermal: ( - args: { - thermal: string; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearThermalArgs; - private static vectorToBytes; - private static nearVectorSearch; - static targetVector: (args: { - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - targetVector?: TargetVectorInputType; - }) => { - targets?: Targets; - targetVectors?: string[]; - }; - private static vectors; - private static targets; - static nearVector: ( - args: { - vector: NearVectorInputType; - supportsTargets: boolean; - supportsVectorsForTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearVectorArgs; - static nearVideo: ( - args: { - video: string; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearVideoArgs; - static filtersGRPC: (filters: FilterValue) => FiltersGRPC; - private static filtersGRPCValueText; - private static filtersGRPCValueTextArray; - private static filterTargetToREST; - static filtersREST: (filters: FilterValue) => WhereFilter; - private static operator; - private static queryProperties; - private static metadata; - private static sortBy; - static rerank: (rerank: RerankOptions) => Rerank; - static generative: (generative?: GenerateOptions | undefined) => GenerativeSearch; - static groupBy: (groupBy?: GroupByOptions | undefined) => GroupBy; - static isGroupBy: (args: any) => args is T; - static restProperties: ( - properties: Record, - references?: Record> - ) => Record; - private static batchProperties; - static batchObjects: ( - collection: string, - objects: (DataObject | NonReferenceInputs)[], - usesNamedVectors: boolean, - tenant?: string - ) => Promise>; - static tenants(tenants: T[], mapper: (tenant: T) => M): M[][]; - static tenantCreate( - tenant: T - ): { - name: string; - activityStatus?: 'HOT' | 'COLD'; - }; - static tenantUpdate( - tenant: T - ): { - name: string; - activityStatus: 'HOT' | 'COLD' | 'FROZEN'; - }; -} diff --git a/dist/node/cjs/collections/serialize/index.js b/dist/node/cjs/collections/serialize/index.js deleted file mode 100644 index b6a75b08..00000000 --- a/dist/node/cjs/collections/serialize/index.js +++ /dev/null @@ -1,1209 +0,0 @@ -'use strict'; -var _a; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.Serialize = exports.MetadataGuards = exports.DataGuards = void 0; -const uuid_1 = require('uuid'); -const batch_js_1 = require('../../proto/v1/batch.js'); -const generative_js_1 = require('../../proto/v1/generative.js'); -const search_get_js_1 = require('../../proto/v1/search_get.js'); -const errors_js_1 = require('../../errors.js'); -const base_js_1 = require('../../proto/v1/base.js'); -const classes_js_1 = require('../filters/classes.js'); -const index_js_1 = require('../filters/index.js'); -const utils_js_1 = require('../query/utils.js'); -const classes_js_2 = require('../references/classes.js'); -const utils_js_2 = require('../references/utils.js'); -class FilterGuards {} -FilterGuards.isFilters = (argument) => { - return argument instanceof index_js_1.Filters; -}; -FilterGuards.isText = (argument) => { - return typeof argument === 'string'; -}; -FilterGuards.isTextArray = (argument) => { - return argument instanceof Array && argument.every((arg) => typeof arg === 'string'); -}; -FilterGuards.isInt = (argument) => { - return typeof argument === 'number' && Number.isInteger(argument); -}; -FilterGuards.isIntArray = (argument) => { - return ( - argument instanceof Array && argument.every((arg) => typeof arg === 'number' && Number.isInteger(arg)) - ); -}; -FilterGuards.isFloat = (argument) => { - return typeof argument === 'number' && !Number.isInteger(argument); -}; -FilterGuards.isFloatArray = (argument) => { - return ( - argument instanceof Array && argument.every((arg) => typeof arg === 'number' && !Number.isInteger(arg)) - ); -}; -FilterGuards.isBoolean = (argument) => { - return typeof argument === 'boolean'; -}; -FilterGuards.isBooleanArray = (argument) => { - return argument instanceof Array && argument.every((arg) => typeof arg === 'boolean'); -}; -FilterGuards.isDate = (argument) => { - return argument instanceof Date; -}; -FilterGuards.isDateArray = (argument) => { - return argument instanceof Array && argument.every((arg) => arg instanceof Date); -}; -FilterGuards.isGeoRange = (argument) => { - const arg = argument; - return arg.latitude !== undefined && arg.longitude !== undefined && arg.distance !== undefined; -}; -class DataGuards {} -exports.DataGuards = DataGuards; -DataGuards.isText = (argument) => { - return typeof argument === 'string'; -}; -DataGuards.isTextArray = (argument) => { - return argument instanceof Array && argument.length > 0 && argument.every(DataGuards.isText); -}; -DataGuards.isInt = (argument) => { - return ( - typeof argument === 'number' && - Number.isInteger(argument) && - !Number.isNaN(argument) && - Number.isFinite(argument) - ); -}; -DataGuards.isIntArray = (argument) => { - return argument instanceof Array && argument.length > 0 && argument.every(DataGuards.isInt); -}; -DataGuards.isFloat = (argument) => { - return ( - typeof argument === 'number' && - !Number.isInteger(argument) && - !Number.isNaN(argument) && - Number.isFinite(argument) - ); -}; -DataGuards.isFloatArray = (argument) => { - return argument instanceof Array && argument.length > 0 && argument.every(DataGuards.isFloat); -}; -DataGuards.isBoolean = (argument) => { - return typeof argument === 'boolean'; -}; -DataGuards.isBooleanArray = (argument) => { - return argument instanceof Array && argument.length > 0 && argument.every(DataGuards.isBoolean); -}; -DataGuards.isDate = (argument) => { - return argument instanceof Date; -}; -DataGuards.isDateArray = (argument) => { - return argument instanceof Array && argument.length > 0 && argument.every(DataGuards.isDate); -}; -DataGuards.isGeoCoordinate = (argument) => { - return ( - argument instanceof Object && - argument.latitude !== undefined && - argument.longitude !== undefined && - Object.keys(argument).length === 2 - ); -}; -DataGuards.isPhoneNumber = (argument) => { - return ( - argument instanceof Object && - argument.number !== undefined && - (Object.keys(argument).length === 1 || - (Object.keys(argument).length === 2 && argument.defaultCountry !== undefined)) - ); -}; -DataGuards.isNested = (argument) => { - return ( - argument instanceof Object && - !(argument instanceof Array) && - !DataGuards.isDate(argument) && - !DataGuards.isGeoCoordinate(argument) && - !DataGuards.isPhoneNumber(argument) - ); -}; -DataGuards.isNestedArray = (argument) => { - return argument instanceof Array && argument.length > 0 && argument.every(DataGuards.isNested); -}; -DataGuards.isEmptyArray = (argument) => { - return argument instanceof Array && argument.length === 0; -}; -DataGuards.isDataObject = (obj) => { - return ( - obj.id !== undefined || - obj.properties !== undefined || - obj.references !== undefined || - obj.vectors !== undefined - ); -}; -class MetadataGuards {} -exports.MetadataGuards = MetadataGuards; -MetadataGuards.isKeys = (argument) => { - return argument instanceof Array && argument.length > 0; -}; -MetadataGuards.isAll = (argument) => { - return argument === 'all'; -}; -MetadataGuards.isUndefined = (argument) => { - return argument === undefined; -}; -class Serialize { - static tenants(tenants, mapper) { - const mapped = []; - const batches = Math.ceil(tenants.length / 100); - for (let i = 0; i < batches; i++) { - const batch = tenants.slice(i * 100, (i + 1) * 100); - mapped.push(batch.map(mapper)); - } - return mapped; - } - static tenantCreate(tenant) { - let activityStatus; - switch (tenant.activityStatus) { - case 'ACTIVE': - activityStatus = 'HOT'; - break; - case 'INACTIVE': - activityStatus = 'COLD'; - break; - case 'HOT': - case 'COLD': - case undefined: - activityStatus = tenant.activityStatus; - break; - case 'FROZEN': - throw new errors_js_1.WeaviateInvalidInputError( - 'Invalid activity status. Please provide one of the following: ACTIVE, INACTIVE, HOT, COLD.' - ); - default: - throw new errors_js_1.WeaviateInvalidInputError( - 'Invalid activity status. Please provide one of the following: ACTIVE, INACTIVE, HOT, COLD.' - ); - } - return { - name: tenant.name, - activityStatus, - }; - } - static tenantUpdate(tenant) { - let activityStatus; - switch (tenant.activityStatus) { - case 'ACTIVE': - activityStatus = 'HOT'; - break; - case 'INACTIVE': - activityStatus = 'COLD'; - break; - case 'OFFLOADED': - activityStatus = 'FROZEN'; - break; - case 'HOT': - case 'COLD': - case 'FROZEN': - activityStatus = tenant.activityStatus; - break; - default: - throw new errors_js_1.WeaviateInvalidInputError( - 'Invalid activity status. Please provide one of the following: ACTIVE, INACTIVE, HOT, COLD, OFFLOADED.' - ); - } - return { - name: tenant.name, - activityStatus, - }; - } -} -exports.Serialize = Serialize; -_a = Serialize; -Serialize.isNamedVectors = (opts) => { - return ( - Array.isArray(opts === null || opts === void 0 ? void 0 : opts.includeVector) || - (opts === null || opts === void 0 ? void 0 : opts.targetVector) !== undefined - ); -}; -Serialize.isMultiTarget = (opts) => { - return ( - (opts === null || opts === void 0 ? void 0 : opts.targetVector) !== undefined && - !utils_js_1.TargetVectorInputGuards.isSingle(opts.targetVector) - ); -}; -Serialize.isMultiWeightPerTarget = (opts) => { - return ( - (opts === null || opts === void 0 ? void 0 : opts.targetVector) !== undefined && - utils_js_1.TargetVectorInputGuards.isMultiJoin(opts.targetVector) && - opts.targetVector.weights !== undefined && - Object.values(opts.targetVector.weights).some(utils_js_1.ArrayInputGuards.is1DArray) - ); -}; -Serialize.isMultiVector = (vec) => { - return ( - vec !== undefined && - !Array.isArray(vec) && - Object.values(vec).some(utils_js_1.ArrayInputGuards.is1DArray || utils_js_1.ArrayInputGuards.is2DArray) - ); -}; -Serialize.isMultiVectorPerTarget = (vec) => { - return ( - vec !== undefined && !Array.isArray(vec) && Object.values(vec).some(utils_js_1.ArrayInputGuards.is2DArray) - ); -}; -Serialize.common = (args) => { - const out = { - limit: args === null || args === void 0 ? void 0 : args.limit, - offset: args === null || args === void 0 ? void 0 : args.offset, - filters: (args === null || args === void 0 ? void 0 : args.filters) - ? Serialize.filtersGRPC(args.filters) - : undefined, - properties: - (args === null || args === void 0 ? void 0 : args.returnProperties) || - (args === null || args === void 0 ? void 0 : args.returnReferences) - ? Serialize.queryProperties(args.returnProperties, args.returnReferences) - : undefined, - metadata: Serialize.metadata( - args === null || args === void 0 ? void 0 : args.includeVector, - args === null || args === void 0 ? void 0 : args.returnMetadata - ), - }; - if (args === null || args === void 0 ? void 0 : args.rerank) { - out.rerank = Serialize.rerank(args.rerank); - } - return out; -}; -Serialize.fetchObjects = (args) => { - return Object.assign(Object.assign({}, Serialize.common(args)), { - after: args === null || args === void 0 ? void 0 : args.after, - sortBy: (args === null || args === void 0 ? void 0 : args.sort) - ? Serialize.sortBy(args.sort.sorts) - : undefined, - }); -}; -Serialize.fetchObjectById = (args) => { - return Object.assign( - {}, - Serialize.common({ - filters: new classes_js_1.FilterId().equal(args.id), - includeVector: args.includeVector, - returnMetadata: ['creationTime', 'updateTime', 'isConsistent'], - returnProperties: args.returnProperties, - returnReferences: args.returnReferences, - }) - ); -}; -Serialize.bm25QueryProperties = (properties) => { - return properties === null || properties === void 0 - ? void 0 - : properties.map((property) => { - if (typeof property === 'string') { - return property; - } else { - return `${property.name}^${property.weight}`; - } - }); -}; -Serialize.bm25 = (args) => { - return Object.assign(Object.assign({}, Serialize.common(args)), { - bm25Search: search_get_js_1.BM25.fromPartial({ - query: args.query, - properties: _a.bm25QueryProperties(args.queryProperties), - }), - autocut: args.autoLimit, - }); -}; -Serialize.isHybridVectorSearch = (vector) => { - return ( - vector !== undefined && - !Serialize.isHybridNearTextSearch(vector) && - !Serialize.isHybridNearVectorSearch(vector) - ); -}; -Serialize.isHybridNearTextSearch = (vector) => { - return (vector === null || vector === void 0 ? void 0 : vector.query) !== undefined; -}; -Serialize.isHybridNearVectorSearch = (vector) => { - return (vector === null || vector === void 0 ? void 0 : vector.vector) !== undefined; -}; -Serialize.hybridVector = (args) => { - const vector = args.vector; - if (Serialize.isHybridVectorSearch(vector)) { - const { targets, targetVectors, vectorBytes, vectorPerTarget, vectorForTargets } = Serialize.vectors( - Object.assign(Object.assign({}, args), { argumentName: 'vector', vector: vector }) - ); - return vectorBytes !== undefined - ? { vectorBytes, targetVectors, targets } - : { - targetVectors, - targets, - nearVector: search_get_js_1.NearVector.fromPartial({ - vectorForTargets, - vectorPerTarget, - }), - }; - } else if (Serialize.isHybridNearTextSearch(vector)) { - const { targetVectors, targets } = Serialize.targetVector(args); - return { - targets, - targetVectors, - nearText: search_get_js_1.NearTextSearch.fromPartial({ - query: typeof vector.query === 'string' ? [vector.query] : vector.query, - certainty: vector.certainty, - distance: vector.distance, - moveAway: vector.moveAway - ? search_get_js_1.NearTextSearch_Move.fromPartial(vector.moveAway) - : undefined, - moveTo: vector.moveTo ? search_get_js_1.NearTextSearch_Move.fromPartial(vector.moveTo) : undefined, - }), - }; - } else if (Serialize.isHybridNearVectorSearch(vector)) { - const { targetVectors, targets, vectorBytes, vectorPerTarget, vectorForTargets } = Serialize.vectors( - Object.assign(Object.assign({}, args), { argumentName: 'vector', vector: vector.vector }) - ); - return { - targetVectors, - targets, - nearVector: search_get_js_1.NearVector.fromPartial({ - certainty: vector.certainty, - distance: vector.distance, - vectorBytes, - vectorPerTarget, - vectorForTargets, - }), - }; - } else { - const { targets, targetVectors } = Serialize.targetVector(args); - return { targets, targetVectors }; - } -}; -Serialize.hybrid = (args) => { - const fusionType = (fusionType) => { - switch (fusionType) { - case 'Ranked': - return search_get_js_1.Hybrid_FusionType.FUSION_TYPE_RANKED; - case 'RelativeScore': - return search_get_js_1.Hybrid_FusionType.FUSION_TYPE_RELATIVE_SCORE; - default: - return search_get_js_1.Hybrid_FusionType.FUSION_TYPE_UNSPECIFIED; - } - }; - const { targets, targetVectors, vectorBytes, nearText, nearVector } = Serialize.hybridVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - hybridSearch: search_get_js_1.Hybrid.fromPartial({ - query: args.query, - alpha: args.alpha ? args.alpha : 0.5, - properties: _a.bm25QueryProperties(args.queryProperties), - vectorBytes: vectorBytes, - fusionType: fusionType(args.fusionType), - targetVectors, - targets, - nearText, - nearVector, - }), - autocut: args.autoLimit, - }); -}; -Serialize.nearAudio = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearAudio: search_get_js_1.NearAudioSearch.fromPartial({ - audio: args.audio, - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - }), - autocut: args.autoLimit, - }); -}; -Serialize.nearDepth = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearDepth: search_get_js_1.NearDepthSearch.fromPartial({ - depth: args.depth, - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - }), - autocut: args.autoLimit, - }); -}; -Serialize.nearImage = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearImage: search_get_js_1.NearImageSearch.fromPartial({ - image: args.image, - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - }), - autocut: args.autoLimit, - }); -}; -Serialize.nearIMU = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearIMU: search_get_js_1.NearIMUSearch.fromPartial({ - imu: args.imu, - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - }), - autocut: args.autoLimit, - }); -}; -Serialize.nearObject = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearObject: search_get_js_1.NearObject.fromPartial({ - id: args.id, - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - }), - autocut: args.autoLimit, - }); -}; -Serialize.nearTextSearch = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return search_get_js_1.NearTextSearch.fromPartial({ - query: typeof args.query === 'string' ? [args.query] : args.query, - certainty: args.certainty, - distance: args.distance, - targets, - targetVectors, - moveAway: args.moveAway - ? search_get_js_1.NearTextSearch_Move.fromPartial({ - concepts: args.moveAway.concepts, - force: args.moveAway.force, - uuids: args.moveAway.objects, - }) - : undefined, - moveTo: args.moveTo - ? search_get_js_1.NearTextSearch_Move.fromPartial({ - concepts: args.moveTo.concepts, - force: args.moveTo.force, - uuids: args.moveTo.objects, - }) - : undefined, - }); -}; -Serialize.nearText = (args) => { - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearText: _a.nearTextSearch(args), - autocut: args.autoLimit, - }); -}; -Serialize.nearThermal = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearThermal: search_get_js_1.NearThermalSearch.fromPartial({ - thermal: args.thermal, - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - }), - autocut: args.autoLimit, - }); -}; -Serialize.vectorToBytes = (vector) => { - return new Uint8Array(new Float32Array(vector).buffer); -}; -Serialize.nearVectorSearch = (args) => { - const { targetVectors, targets, vectorBytes, vectorPerTarget, vectorForTargets } = Serialize.vectors( - Object.assign(Object.assign({}, args), { argumentName: 'nearVector' }) - ); - return search_get_js_1.NearVector.fromPartial({ - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - vectorPerTarget, - vectorBytes, - vectorForTargets, - }); -}; -Serialize.targetVector = (args) => { - if (args.targetVector === undefined) { - return {}; - } else if (utils_js_1.TargetVectorInputGuards.isSingle(args.targetVector)) { - return args.supportsTargets - ? { - targets: search_get_js_1.Targets.fromPartial({ - targetVectors: [args.targetVector], - }), - } - : { targetVectors: [args.targetVector] }; - } else if (utils_js_1.TargetVectorInputGuards.isMulti(args.targetVector)) { - return args.supportsTargets - ? { - targets: search_get_js_1.Targets.fromPartial({ - targetVectors: args.targetVector, - }), - } - : { targetVectors: args.targetVector }; - } else { - return { targets: Serialize.targets(args.targetVector, args.supportsWeightsForTargets) }; - } -}; -Serialize.vectors = (args) => { - const invalidVectorError = - new errors_js_1.WeaviateInvalidInputError(`${args.argumentName} argument must be populated and: - - an array of numbers (number[]) - - an object with target names as keys and 1D and/or 2D arrays of numbers (number[] or number[][]) as values - received: ${args.vector} and ${args.targetVector}`); - if (args.vector === undefined) { - return Serialize.targetVector(args); - } - if (utils_js_1.NearVectorInputGuards.isObject(args.vector)) { - if (Object.keys(args.vector).length === 0) { - throw invalidVectorError; - } - if (args.supportsVectorsForTargets) { - const vectorForTargets = Object.entries(args.vector) - .map(([target, vector]) => { - return { - target, - vector: vector, - }; - }) - .reduce((acc, { target, vector }) => { - return utils_js_1.ArrayInputGuards.is2DArray(vector) - ? acc.concat(vector.map((v) => ({ name: target, vectorBytes: Serialize.vectorToBytes(v) }))) - : acc.concat([{ name: target, vectorBytes: Serialize.vectorToBytes(vector) }]); - }, []); - return args.targetVector !== undefined - ? Object.assign(Object.assign({}, Serialize.targetVector(args)), { vectorForTargets }) - : { - targetVectors: undefined, - targets: search_get_js_1.Targets.fromPartial({ - targetVectors: vectorForTargets.map((v) => v.name), - }), - vectorForTargets, - }; - } else { - const vectorPerTarget = {}; - Object.entries(args.vector).forEach(([k, v]) => { - if (utils_js_1.ArrayInputGuards.is2DArray(v)) { - return; - } - vectorPerTarget[k] = Serialize.vectorToBytes(v); - }); - if (args.targetVector !== undefined) { - const { targets, targetVectors } = Serialize.targetVector(args); - return { - targetVectors, - targets, - vectorPerTarget, - }; - } else { - return args.supportsTargets - ? { - targets: search_get_js_1.Targets.fromPartial({ - targetVectors: Object.keys(vectorPerTarget), - }), - vectorPerTarget, - } - : { - targetVectors: Object.keys(vectorPerTarget), - vectorPerTarget, - }; - } - } - } else { - if (args.vector.length === 0) { - throw invalidVectorError; - } - if (utils_js_1.NearVectorInputGuards.is1DArray(args.vector)) { - const { targetVectors, targets } = Serialize.targetVector(args); - const vectorBytes = Serialize.vectorToBytes(args.vector); - return { - targetVectors, - targets, - vectorBytes, - }; - } - throw invalidVectorError; - } -}; -Serialize.targets = (targets, supportsWeightsForTargets) => { - let combination; - switch (targets.combination) { - case 'sum': - combination = search_get_js_1.CombinationMethod.COMBINATION_METHOD_TYPE_SUM; - break; - case 'average': - combination = search_get_js_1.CombinationMethod.COMBINATION_METHOD_TYPE_AVERAGE; - break; - case 'minimum': - combination = search_get_js_1.CombinationMethod.COMBINATION_METHOD_TYPE_MIN; - break; - case 'relative-score': - combination = search_get_js_1.CombinationMethod.COMBINATION_METHOD_TYPE_RELATIVE_SCORE; - break; - case 'manual-weights': - combination = search_get_js_1.CombinationMethod.COMBINATION_METHOD_TYPE_MANUAL; - break; - default: - throw new Error('Invalid combination method'); - } - if (targets.weights !== undefined && supportsWeightsForTargets) { - const weightsForTargets = Object.entries(targets.weights) - .map(([target, weight]) => { - return { - target, - weight, - }; - }) - .reduce((acc, { target, weight }) => { - return Array.isArray(weight) - ? acc.concat(weight.map((w) => ({ target, weight: w }))) - : acc.concat([{ target, weight }]); - }, []); - return { - combination, - targetVectors: weightsForTargets.map((w) => w.target), - weights: {}, - weightsForTargets, - }; - } else if (targets.weights !== undefined && !supportsWeightsForTargets) { - if (Object.values(targets.weights).some((v) => Array.isArray(v))) { - throw new errors_js_1.WeaviateUnsupportedFeatureError( - 'Multiple weights per target are not supported in this Weaviate version. Please upgrade to at least Weaviate 1.27.0.' - ); - } - return { - combination, - targetVectors: targets.targetVectors, - weights: targets.weights, - weightsForTargets: [], - }; - } else { - return { - combination, - targetVectors: targets.targetVectors, - weights: {}, - weightsForTargets: [], - }; - } -}; -Serialize.nearVector = (args) => { - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearVector: Serialize.nearVectorSearch(args), - autocut: args.autoLimit, - }); -}; -Serialize.nearVideo = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearVideo: search_get_js_1.NearVideoSearch.fromPartial({ - video: args.video, - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - }), - autocut: args.autoLimit, - }); -}; -Serialize.filtersGRPC = (filters) => { - const resolveFilters = (filters) => { - var _b; - const out = []; - (_b = filters.filters) === null || _b === void 0 - ? void 0 - : _b.forEach((val) => out.push(Serialize.filtersGRPC(val))); - return out; - }; - const { value } = filters; - switch (filters.operator) { - case 'And': - return base_js_1.Filters.fromPartial({ - operator: base_js_1.Filters_Operator.OPERATOR_AND, - filters: resolveFilters(filters), - }); - case 'Or': - return base_js_1.Filters.fromPartial({ - operator: base_js_1.Filters_Operator.OPERATOR_OR, - filters: resolveFilters(filters), - }); - default: - return base_js_1.Filters.fromPartial({ - operator: Serialize.operator(filters.operator), - target: filters.target, - valueText: _a.filtersGRPCValueText(value), - valueTextArray: _a.filtersGRPCValueTextArray(value), - valueInt: FilterGuards.isInt(value) ? value : undefined, - valueIntArray: FilterGuards.isIntArray(value) ? { values: value } : undefined, - valueNumber: FilterGuards.isFloat(value) ? value : undefined, - valueNumberArray: FilterGuards.isFloatArray(value) ? { values: value } : undefined, - valueBoolean: FilterGuards.isBoolean(value) ? value : undefined, - valueBooleanArray: FilterGuards.isBooleanArray(value) ? { values: value } : undefined, - valueGeo: FilterGuards.isGeoRange(value) ? value : undefined, - }); - } -}; -Serialize.filtersGRPCValueText = (value) => { - if (FilterGuards.isText(value)) { - return value; - } else if (FilterGuards.isDate(value)) { - return value.toISOString(); - } else { - return undefined; - } -}; -Serialize.filtersGRPCValueTextArray = (value) => { - if (FilterGuards.isTextArray(value)) { - return { values: value }; - } else if (FilterGuards.isDateArray(value)) { - return { values: value.map((v) => v.toISOString()) }; - } else { - return undefined; - } -}; -Serialize.filterTargetToREST = (target) => { - if (target.property) { - return [target.property]; - } else if (target.singleTarget) { - throw new errors_js_1.WeaviateSerializationError( - 'Cannot use Filter.byRef() in the aggregate API currently. Instead use Filter.byRefMultiTarget() and specify the target collection explicitly.' - ); - } else if (target.multiTarget) { - if (target.multiTarget.target === undefined) { - throw new errors_js_1.WeaviateSerializationError( - `target of multiTarget filter was unexpectedly undefined: ${target}` - ); - } - return [ - target.multiTarget.on, - target.multiTarget.targetCollection, - ...Serialize.filterTargetToREST(target.multiTarget.target), - ]; - } else if (target.count) { - return [target.count.on]; - } else { - return []; - } -}; -Serialize.filtersREST = (filters) => { - var _b; - const { value } = filters; - if (filters.operator === 'And' || filters.operator === 'Or') { - return { - operator: filters.operator, - operands: (_b = filters.filters) === null || _b === void 0 ? void 0 : _b.map(Serialize.filtersREST), - }; - } else { - if (filters.target === undefined) { - throw new errors_js_1.WeaviateSerializationError( - `target of filter was unexpectedly undefined: ${filters}` - ); - } - const out = { - path: Serialize.filterTargetToREST(filters.target), - operator: filters.operator, - }; - if (FilterGuards.isText(value)) { - return Object.assign(Object.assign({}, out), { valueText: value }); - } else if (FilterGuards.isTextArray(value)) { - return Object.assign(Object.assign({}, out), { valueTextArray: value }); - } else if (FilterGuards.isInt(value)) { - return Object.assign(Object.assign({}, out), { valueInt: value }); - } else if (FilterGuards.isIntArray(value)) { - return Object.assign(Object.assign({}, out), { valueIntArray: value }); - } else if (FilterGuards.isBoolean(value)) { - return Object.assign(Object.assign({}, out), { valueBoolean: value }); - } else if (FilterGuards.isBooleanArray(value)) { - return Object.assign(Object.assign({}, out), { valueBooleanArray: value }); - } else if (FilterGuards.isFloat(value)) { - return Object.assign(Object.assign({}, out), { valueNumber: value }); - } else if (FilterGuards.isFloatArray(value)) { - return Object.assign(Object.assign({}, out), { valueNumberArray: value }); - } else if (FilterGuards.isDate(value)) { - return Object.assign(Object.assign({}, out), { valueDate: value.toISOString() }); - } else if (FilterGuards.isDateArray(value)) { - return Object.assign(Object.assign({}, out), { valueDateArray: value.map((v) => v.toISOString()) }); - } else if (FilterGuards.isGeoRange(value)) { - return Object.assign(Object.assign({}, out), { - valueGeoRange: { - geoCoordinates: { - latitude: value.latitude, - longitude: value.longitude, - }, - distance: { - max: value.distance, - }, - }, - }); - } else { - throw new errors_js_1.WeaviateInvalidInputError('Invalid filter value type'); - } - } -}; -Serialize.operator = (operator) => { - switch (operator) { - case 'Equal': - return base_js_1.Filters_Operator.OPERATOR_EQUAL; - case 'NotEqual': - return base_js_1.Filters_Operator.OPERATOR_NOT_EQUAL; - case 'ContainsAny': - return base_js_1.Filters_Operator.OPERATOR_CONTAINS_ANY; - case 'ContainsAll': - return base_js_1.Filters_Operator.OPERATOR_CONTAINS_ALL; - case 'GreaterThan': - return base_js_1.Filters_Operator.OPERATOR_GREATER_THAN; - case 'GreaterThanEqual': - return base_js_1.Filters_Operator.OPERATOR_GREATER_THAN_EQUAL; - case 'LessThan': - return base_js_1.Filters_Operator.OPERATOR_LESS_THAN; - case 'LessThanEqual': - return base_js_1.Filters_Operator.OPERATOR_LESS_THAN_EQUAL; - case 'Like': - return base_js_1.Filters_Operator.OPERATOR_LIKE; - case 'WithinGeoRange': - return base_js_1.Filters_Operator.OPERATOR_WITHIN_GEO_RANGE; - case 'IsNull': - return base_js_1.Filters_Operator.OPERATOR_IS_NULL; - default: - return base_js_1.Filters_Operator.OPERATOR_UNSPECIFIED; - } -}; -Serialize.queryProperties = (properties, references) => { - const nonRefProperties = - properties === null || properties === void 0 - ? void 0 - : properties.filter((property) => typeof property === 'string'); - const refProperties = references; - const objectProperties = - properties === null || properties === void 0 - ? void 0 - : properties.filter((property) => typeof property === 'object'); - const resolveObjectProperty = (property) => { - const objProps = property.properties.filter((property) => typeof property !== 'string'); // cannot get types to work currently :( - return { - propName: property.name, - primitiveProperties: property.properties.filter((property) => typeof property === 'string'), - objectProperties: objProps.map(resolveObjectProperty), - }; - }; - return { - nonRefProperties: nonRefProperties === undefined ? [] : nonRefProperties, - returnAllNonrefProperties: nonRefProperties === undefined, - refProperties: refProperties - ? refProperties.map((property) => { - return { - referenceProperty: property.linkOn, - properties: Serialize.queryProperties(property.returnProperties), - metadata: Serialize.metadata(property.includeVector, property.returnMetadata), - targetCollection: property.targetCollection ? property.targetCollection : '', - }; - }) - : [], - objectProperties: objectProperties - ? objectProperties.map((property) => { - const objProps = property.properties.filter((property) => typeof property !== 'string'); // cannot get types to work currently :( - return { - propName: property.name, - primitiveProperties: property.properties.filter((property) => typeof property === 'string'), - objectProperties: objProps.map(resolveObjectProperty), - }; - }) - : [], - }; -}; -Serialize.metadata = (includeVector, metadata) => { - const out = { - uuid: true, - vector: typeof includeVector === 'boolean' ? includeVector : false, - vectors: Array.isArray(includeVector) ? includeVector : [], - }; - if (MetadataGuards.isAll(metadata)) { - return Object.assign(Object.assign({}, out), { - creationTimeUnix: true, - lastUpdateTimeUnix: true, - distance: true, - certainty: true, - score: true, - explainScore: true, - isConsistent: true, - }); - } - metadata === null || metadata === void 0 - ? void 0 - : metadata.forEach((key) => { - let weaviateKey; - if (key === 'creationTime') { - weaviateKey = 'creationTimeUnix'; - } else if (key === 'updateTime') { - weaviateKey = 'lastUpdateTimeUnix'; - } else { - weaviateKey = key; - } - out[weaviateKey] = true; - }); - return search_get_js_1.MetadataRequest.fromPartial(out); -}; -Serialize.sortBy = (sort) => { - return sort.map((sort) => { - return { - ascending: !!sort.ascending, - path: [sort.property], - }; - }); -}; -Serialize.rerank = (rerank) => { - return search_get_js_1.Rerank.fromPartial({ - property: rerank.property, - query: rerank.query, - }); -}; -Serialize.generative = (generative) => { - return generative_js_1.GenerativeSearch.fromPartial({ - singleResponsePrompt: generative === null || generative === void 0 ? void 0 : generative.singlePrompt, - groupedResponseTask: generative === null || generative === void 0 ? void 0 : generative.groupedTask, - groupedProperties: generative === null || generative === void 0 ? void 0 : generative.groupedProperties, - }); -}; -Serialize.groupBy = (groupBy) => { - return search_get_js_1.GroupBy.fromPartial({ - path: (groupBy === null || groupBy === void 0 ? void 0 : groupBy.property) - ? [groupBy.property] - : undefined, - numberOfGroups: groupBy === null || groupBy === void 0 ? void 0 : groupBy.numberOfGroups, - objectsPerGroup: groupBy === null || groupBy === void 0 ? void 0 : groupBy.objectsPerGroup, - }); -}; -Serialize.isGroupBy = (args) => { - if (args === undefined) return false; - return args.groupBy !== undefined; -}; -Serialize.restProperties = (properties, references) => { - const parsedProperties = {}; - Object.keys(properties).forEach((key) => { - const value = properties[key]; - if (DataGuards.isDate(value)) { - parsedProperties[key] = value.toISOString(); - } else if (DataGuards.isDateArray(value)) { - parsedProperties[key] = value.map((v) => v.toISOString()); - } else if (DataGuards.isPhoneNumber(value)) { - parsedProperties[key] = { - input: value.number, - defaultCountry: value.defaultCountry, - }; - } else if (DataGuards.isNestedArray(value)) { - parsedProperties[key] = value.map((v) => Serialize.restProperties(v)); - } else if (DataGuards.isNested(value)) { - parsedProperties[key] = Serialize.restProperties(value); - } else { - parsedProperties[key] = value; - } - }); - if (!references) return parsedProperties; - for (const [key, value] of Object.entries(references)) { - if (classes_js_2.ReferenceGuards.isReferenceManager(value)) { - parsedProperties[key] = value.toBeaconObjs(); - } else if (classes_js_2.ReferenceGuards.isUuid(value)) { - parsedProperties[key] = [(0, utils_js_2.uuidToBeacon)(value)]; - } else if (classes_js_2.ReferenceGuards.isMultiTarget(value)) { - parsedProperties[key] = - typeof value.uuids === 'string' - ? [(0, utils_js_2.uuidToBeacon)(value.uuids, value.targetCollection)] - : value.uuids.map((uuid) => (0, utils_js_2.uuidToBeacon)(uuid, value.targetCollection)); - } else { - let out = []; - value.forEach((v) => { - if (classes_js_2.ReferenceGuards.isReferenceManager(v)) { - out = out.concat(v.toBeaconObjs()); - } else if (classes_js_2.ReferenceGuards.isUuid(v)) { - out.push((0, utils_js_2.uuidToBeacon)(v)); - } else { - out = out.concat( - (classes_js_2.ReferenceGuards.isUuid(v.uuids) ? [v.uuids] : v.uuids).map((uuid) => - (0, utils_js_2.uuidToBeacon)(uuid, v.targetCollection) - ) - ); - } - }); - parsedProperties[key] = out; - } - } - return parsedProperties; -}; -Serialize.batchProperties = (properties, references) => { - const multiTarget = []; - const singleTarget = []; - const nonRefProperties = {}; - const emptyArray = []; - const boolArray = []; - const textArray = []; - const intArray = []; - const floatArray = []; - const objectProperties = []; - const objectArrayProperties = []; - const resolveProps = (key, value) => { - if (DataGuards.isEmptyArray(value)) { - emptyArray.push(key); - } else if (DataGuards.isBooleanArray(value)) { - boolArray.push({ - propName: key, - values: value, - }); - } else if (DataGuards.isDateArray(value)) { - textArray.push({ - propName: key, - values: value.map((v) => v.toISOString()), - }); - } else if (DataGuards.isTextArray(value)) { - textArray.push({ - propName: key, - values: value, - }); - } else if (DataGuards.isIntArray(value)) { - intArray.push({ - propName: key, - values: value, - }); - } else if (DataGuards.isFloatArray(value)) { - floatArray.push({ - propName: key, - values: [], - valuesBytes: new Uint8Array(new Float64Array(value).buffer), // is double in proto => f64 in go - }); - } else if (DataGuards.isDate(value)) { - nonRefProperties[key] = value.toISOString(); - } else if (DataGuards.isPhoneNumber(value)) { - nonRefProperties[key] = { - input: value.number, - defaultCountry: value.defaultCountry, - }; - } else if (DataGuards.isGeoCoordinate(value)) { - nonRefProperties[key] = value; - } else if (DataGuards.isNestedArray(value)) { - objectArrayProperties.push({ - propName: key, - values: value.map((v) => base_js_1.ObjectPropertiesValue.fromPartial(Serialize.batchProperties(v))), - }); - } else if (DataGuards.isNested(value)) { - const parsed = Serialize.batchProperties(value); - objectProperties.push({ - propName: key, - value: base_js_1.ObjectPropertiesValue.fromPartial(parsed), - }); - } else { - nonRefProperties[key] = value; - } - }; - const resolveRefs = (key, value) => { - if (classes_js_2.ReferenceGuards.isReferenceManager(value)) { - if (value.isMultiTarget()) { - multiTarget.push({ - propName: key, - targetCollection: value.targetCollection, - uuids: value.toBeaconStrings(), - }); - } else { - singleTarget.push({ - propName: key, - uuids: value.toBeaconStrings(), - }); - } - } else if (classes_js_2.ReferenceGuards.isUuid(value)) { - singleTarget.push({ - propName: key, - uuids: [value], - }); - } else if (classes_js_2.ReferenceGuards.isMultiTarget(value)) { - multiTarget.push({ - propName: key, - targetCollection: value.targetCollection, - uuids: typeof value.uuids === 'string' ? [value.uuids] : value.uuids, - }); - } else { - value.forEach((v) => resolveRefs(key, v)); - } - }; - if (properties) { - Object.entries(properties).forEach(([key, value]) => resolveProps(key, value)); - } - if (references) { - Object.entries(references).forEach(([key, value]) => resolveRefs(key, value)); - } - return { - nonRefProperties: nonRefProperties, - multiTargetRefProps: multiTarget, - singleTargetRefProps: singleTarget, - textArrayProperties: textArray, - intArrayProperties: intArray, - numberArrayProperties: floatArray, - booleanArrayProperties: boolArray, - objectProperties: objectProperties, - objectArrayProperties: objectArrayProperties, - emptyListProps: emptyArray, - }; -}; -Serialize.batchObjects = (collection, objects, usesNamedVectors, tenant) => { - const objs = []; - const batch = []; - const iterate = (index) => { - // This allows the potentially CPU-intensive work to be done in chunks - // releasing control to the event loop after every object so that other - // events can be processed without blocking completely. - if (index < objects.length) { - setTimeout(() => iterate(index + 1)); - } else { - return; - } - const object = objects[index]; - const obj = DataGuards.isDataObject(object) - ? object - : { id: undefined, properties: object, references: undefined, vectors: undefined }; - let vectorBytes; - let vectors; - if (obj.vectors !== undefined && !Array.isArray(obj.vectors)) { - vectors = Object.entries(obj.vectors).map(([k, v]) => - base_js_1.Vectors.fromPartial({ - vectorBytes: Serialize.vectorToBytes(v), - name: k, - }) - ); - } else if (Array.isArray(obj.vectors) && usesNamedVectors) { - vectors = [ - base_js_1.Vectors.fromPartial({ - vectorBytes: Serialize.vectorToBytes(obj.vectors), - name: 'default', - }), - ]; - vectorBytes = Serialize.vectorToBytes(obj.vectors); - // required in case collection was made with <1.24.0 and has since been migrated to >=1.24.0 - } else if (obj.vectors !== undefined) { - vectorBytes = Serialize.vectorToBytes(obj.vectors); - } - objs.push( - batch_js_1.BatchObject.fromPartial({ - collection: collection, - properties: Serialize.batchProperties(obj.properties, obj.references), - tenant: tenant, - uuid: obj.id ? obj.id : (0, uuid_1.v4)(), - vectorBytes, - vectors, - }) - ); - batch.push(Object.assign(Object.assign({}, obj), { collection: collection, tenant: tenant })); - }; - const waitFor = () => { - const poll = (resolve) => { - if (objs.length < objects.length) { - setTimeout(() => poll(resolve), 500); - } else { - resolve(null); - } - }; - return new Promise(poll); - }; - iterate(0); - return waitFor().then(() => { - return { batch: batch, mapped: objs }; - }); -}; diff --git a/dist/node/cjs/collections/sort/classes.d.ts b/dist/node/cjs/collections/sort/classes.d.ts deleted file mode 100644 index 3a1eb4ed..00000000 --- a/dist/node/cjs/collections/sort/classes.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { SortBy } from '../types/index.js'; -import { NonRefKeys } from '../types/internal.js'; -export declare class Sorting { - sorts: SortBy[]; - constructor(); - /** Sort by the objects' property. */ - byProperty>(property: K, ascending?: boolean): this; - /** Sort by the objects' ID. */ - byId(ascending?: boolean): this; - /** Sort by the objects' creation time. */ - byCreationTime(ascending?: boolean): this; - /** Sort by the objects' last update time. */ - byUpdateTime(ascending?: boolean): this; -} diff --git a/dist/node/cjs/collections/sort/classes.js b/dist/node/cjs/collections/sort/classes.js deleted file mode 100644 index ec132fd7..00000000 --- a/dist/node/cjs/collections/sort/classes.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.Sorting = void 0; -class Sorting { - constructor() { - this.sorts = []; - } - /** Sort by the objects' property. */ - byProperty(property, ascending = true) { - this.sorts.push({ property, ascending }); - return this; - } - /** Sort by the objects' ID. */ - byId(ascending = true) { - this.sorts.push({ property: '_id', ascending }); - return this; - } - /** Sort by the objects' creation time. */ - byCreationTime(ascending = true) { - this.sorts.push({ property: '_creationTimeUnix', ascending }); - return this; - } - /** Sort by the objects' last update time. */ - byUpdateTime(ascending = true) { - this.sorts.push({ property: '_lastUpdateTimeUnix', ascending }); - return this; - } -} -exports.Sorting = Sorting; diff --git a/dist/node/cjs/collections/sort/index.d.ts b/dist/node/cjs/collections/sort/index.d.ts deleted file mode 100644 index bf33457c..00000000 --- a/dist/node/cjs/collections/sort/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type { Sort } from './types.js'; -export { Sorting }; -import { Sorting } from './classes.js'; -import { Sort } from './types.js'; -declare const sort: () => Sort; -export default sort; diff --git a/dist/node/cjs/collections/sort/index.js b/dist/node/cjs/collections/sort/index.js deleted file mode 100644 index cf852b2e..00000000 --- a/dist/node/cjs/collections/sort/index.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.Sorting = void 0; -const classes_js_1 = require('./classes.js'); -Object.defineProperty(exports, 'Sorting', { - enumerable: true, - get: function () { - return classes_js_1.Sorting; - }, -}); -const sort = () => { - return { - byProperty(property, ascending = true) { - return new classes_js_1.Sorting().byProperty(property, ascending); - }, - byId(ascending = true) { - return new classes_js_1.Sorting().byId(ascending); - }, - byCreationTime(ascending = true) { - return new classes_js_1.Sorting().byCreationTime(ascending); - }, - byUpdateTime(ascending = true) { - return new classes_js_1.Sorting().byUpdateTime(ascending); - }, - }; -}; -exports.default = sort; diff --git a/dist/node/cjs/collections/sort/types.d.ts b/dist/node/cjs/collections/sort/types.d.ts deleted file mode 100644 index 26c7b1ca..00000000 --- a/dist/node/cjs/collections/sort/types.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { NonRefKeys } from '../types/internal.js'; -import { Sorting } from './classes.js'; -/** - * Define how the query's sort operation should be performed using the available methods. - */ -export interface Sort { - /** Sort by an object property. */ - byProperty>(property: K, ascending?: boolean): Sorting; - /** Sort by the objects' ID. */ - byId(ascending?: boolean): Sorting; - /** Sort by the objects' creation time. */ - byCreationTime(ascending?: boolean): Sorting; - /** Sort by the objects' last update time. */ - byUpdateTime(ascending?: boolean): Sorting; -} diff --git a/dist/node/cjs/collections/sort/types.js b/dist/node/cjs/collections/sort/types.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/sort/types.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/tenants/index.d.ts b/dist/node/cjs/collections/tenants/index.d.ts deleted file mode 100644 index c0a343fe..00000000 --- a/dist/node/cjs/collections/tenants/index.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { ConnectionGRPC } from '../../connection/index.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { Tenant, TenantBC, TenantBase, TenantCreate, TenantUpdate } from './types.js'; -declare const tenants: ( - connection: ConnectionGRPC, - collection: string, - dbVersionSupport: DbVersionSupport -) => Tenants; -export default tenants; -export { Tenant, TenantBase, TenantCreate, TenantUpdate }; -/** - * Represents all the CRUD methods available on a collection's multi-tenancy specification within Weaviate. - - * The collection must have been created with multi-tenancy enabled in order to use any of these methods. This class - * should not be instantiated directly, but is available as a property of the `Collection` class under - * the `collection.tenants` class attribute. - * - * Starting from Weaviate v1.26, the naming convention around tenant activitiy statuses is changing. - * The changing nomenclature is as follows: - * - `HOT` is now `ACTIVE`, which means loaded fully into memory and ready for use. - * - `COLD` is now `INACTIVE`, which means not loaded into memory with files stored on disk. - * - * With this change, new statuses are being added. One is mutable and the other two are immutable. They are: - * - `OFFLOADED`, which means the tenant is not loaded into memory with files stored on the cloud. - * - `OFFLOADING`, which means the tenant is transitioning to the `OFFLOADED` status. - * - `ONLOADING`, which means the tenant is transitioning from the `OFFLOADED` status. - */ -export interface Tenants { - /** - * Create the specified tenants for a collection in Weaviate. - * The collection must have been created with multi-tenancy enabled. - * - * For details on the new activity statuses, see the docstring for the `Tenants` interface type. - * - * @param {TenantCreate | TenantCreate[]} tenants The tenant or tenants to create. - * @returns {Promise} The created tenant(s) as a list of Tenant. - */ - create: (tenants: TenantBC | TenantCreate | (TenantBC | TenantCreate)[]) => Promise; - /** - * Return all tenants currently associated with a collection in Weaviate. - * The collection must have been created with multi-tenancy enabled. - * - * For details on the new activity statuses, see the docstring for the `Tenants` interface type. - * - * @returns {Promise>} A list of tenants as an object of Tenant types, where the key is the tenant name. - */ - get: () => Promise>; - /** - * Return the specified tenants from a collection in Weaviate. - * The collection must have been created with multi-tenancy enabled. - * - * For details on the new activity statuses, see the docstring for the `Tenants` interface type. - * - * @typedef {TenantBase} T A type that extends TenantBase. - * @param {(string | T)[]} names The tenants to retrieve. - * @returns {Promise} The list of tenants. If the tenant does not exist, it will not be included in the list. - */ - getByNames: (names: (string | T)[]) => Promise>; - /** - * Return the specified tenant from a collection in Weaviate. - * The collection must have been created with multi-tenancy enabled. - * - * For details on the new activity statuses, see the docstring for the `Tenants` interface type. - * - * @typedef {TenantBase} T A type that extends TenantBase. - * @param {string | T} name The name of the tenant to retrieve. - * @returns {Promise} The tenant as a Tenant type, or null if the tenant does not exist. - */ - getByName: (name: string | T) => Promise; - /** - * Remove the specified tenants from a collection in Weaviate. - * The collection must have been created with multi-tenancy enabled. - * - * For details on the new activity statuses, see the docstring for the `Tenants` interface type. - * - * @typedef {TenantBase} T A type that extends TenantBase. - * @param {Tenant | Tenant[]} tenants The tenant or tenants to remove. - * @returns {Promise} An empty promise. - */ - remove: (tenants: string | T | (string | T)[]) => Promise; - /** - * Update the specified tenants for a collection in Weaviate. - * The collection must have been created with multi-tenancy enabled. - * - * For details on the new activity statuses, see the docstring for the `Tenants` interface type. - * - * @param {TenantInput | TenantInput[]} tenants The tenant or tenants to update. - * @returns {Promise} The updated tenant(s) as a list of Tenant. - */ - update: (tenants: TenantBC | TenantUpdate | (TenantBC | TenantUpdate)[]) => Promise; -} diff --git a/dist/node/cjs/collections/tenants/index.js b/dist/node/cjs/collections/tenants/index.js deleted file mode 100644 index 5ce73387..00000000 --- a/dist/node/cjs/collections/tenants/index.js +++ /dev/null @@ -1,163 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -var __asyncValues = - (this && this.__asyncValues) || - function (o) { - if (!Symbol.asyncIterator) throw new TypeError('Symbol.asyncIterator is not defined.'); - var m = o[Symbol.asyncIterator], - i; - return m - ? m.call(o) - : ((o = typeof __values === 'function' ? __values(o) : o[Symbol.iterator]()), - (i = {}), - verb('next'), - verb('throw'), - verb('return'), - (i[Symbol.asyncIterator] = function () { - return this; - }), - i); - function verb(n) { - i[n] = - o[n] && - function (v) { - return new Promise(function (resolve, reject) { - (v = o[n](v)), settle(resolve, reject, v.done, v.value); - }); - }; - } - function settle(resolve, reject, d, v) { - Promise.resolve(v).then(function (v) { - resolve({ value: v, done: d }); - }, reject); - } - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const errors_js_1 = require('../../errors.js'); -const index_js_1 = require('../../schema/index.js'); -const index_js_2 = require('../deserialize/index.js'); -const index_js_3 = require('../serialize/index.js'); -const checkSupportForGRPCTenantsGetEndpoint = (dbVersionSupport) => - __awaiter(void 0, void 0, void 0, function* () { - const check = yield dbVersionSupport.supportsTenantsGetGRPCMethod(); - if (!check.supports) throw new errors_js_1.WeaviateUnsupportedFeatureError(check.message); - }); -const parseValueOrValueArray = (value) => (Array.isArray(value) ? value : [value]); -const parseStringOrTenant = (tenant) => (typeof tenant === 'string' ? tenant : tenant.name); -const parseTenantREST = (tenant) => { - return { - name: tenant.name, - activityStatus: index_js_2.Deserialize.activityStatusREST(tenant.activityStatus), - }; -}; -const tenants = (connection, collection, dbVersionSupport) => { - const getGRPC = (names) => - checkSupportForGRPCTenantsGetEndpoint(dbVersionSupport) - .then(() => connection.tenants(collection)) - .then((builder) => builder.withGet({ names })) - .then(index_js_2.Deserialize.tenantsGet); - const getREST = () => - new index_js_1.TenantsGetter(connection, collection).do().then((tenants) => { - const result = {}; - tenants.forEach((tenant) => { - if (!tenant.name) return; - result[tenant.name] = parseTenantREST(tenant); - }); - return result; - }); - return { - create: (tenants) => - new index_js_1.TenantsCreator( - connection, - collection, - parseValueOrValueArray(tenants).map(index_js_3.Serialize.tenantCreate) - ) - .do() - .then((res) => res.map(parseTenantREST)), - get: function () { - return __awaiter(this, void 0, void 0, function* () { - const check = yield dbVersionSupport.supportsTenantsGetGRPCMethod(); - return check.supports ? getGRPC() : getREST(); - }); - }, - getByNames: (tenants) => getGRPC(tenants.map(parseStringOrTenant)), - getByName: (tenant) => { - const tenantName = parseStringOrTenant(tenant); - return getGRPC([tenantName]).then((tenants) => tenants[tenantName] || null); - }, - remove: (tenants) => - new index_js_1.TenantsDeleter( - connection, - collection, - parseValueOrValueArray(tenants).map(parseStringOrTenant) - ).do(), - update: (tenants) => - __awaiter(void 0, void 0, void 0, function* () { - var _a, e_1, _b, _c; - const out = []; - try { - for ( - var _d = true, - _e = __asyncValues( - index_js_3.Serialize.tenants( - parseValueOrValueArray(tenants), - index_js_3.Serialize.tenantUpdate - ).map((tenants) => - new index_js_1.TenantsUpdater(connection, collection, tenants) - .do() - .then((res) => res.map(parseTenantREST)) - ) - ), - _f; - (_f = yield _e.next()), (_a = _f.done), !_a; - _d = true - ) { - _c = _f.value; - _d = false; - const res = _c; - out.push(...res); - } - } catch (e_1_1) { - e_1 = { error: e_1_1 }; - } finally { - try { - if (!_d && !_a && (_b = _e.return)) yield _b.call(_e); - } finally { - if (e_1) throw e_1.error; - } - } - return out; - }), - }; -}; -exports.default = tenants; diff --git a/dist/node/cjs/collections/tenants/types.d.ts b/dist/node/cjs/collections/tenants/types.d.ts deleted file mode 100644 index ad8c7da7..00000000 --- a/dist/node/cjs/collections/tenants/types.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** The base type for a tenant. Only the name is required. */ -export type TenantBase = { - /** The name of the tenant. */ - name: string; -}; -/** The expected type when creating a tenant. */ -export type TenantCreate = TenantBase & { - /** The activity status of the tenant. Defaults to 'ACTIVE' if not provided. */ - activityStatus?: 'ACTIVE' | 'INACTIVE'; -}; -/** The expected type when updating a tenant. */ -export type TenantUpdate = TenantBase & { - /** The activity status of the tenant. Must be set to one of the options. */ - activityStatus: 'ACTIVE' | 'INACTIVE' | 'OFFLOADED'; -}; -/** The expected type when getting tenants. */ -export type TenantsGetOptions = { - tenants?: string; -}; -/** - * The expected type returned by all tenant methods. - */ -export type Tenant = TenantBase & { - /** There are two statuses that are immutable: `OFFLOADED` and `ONLOADING, which are set by the server: - * - `ONLOADING`, which means the tenant is transitioning from the `OFFLOADED` status to `ACTIVE/INACTIVE`. - * - `OFFLOADING`, which means the tenant is transitioning from `ACTIVE/INACTIVE` to the `OFFLOADED` status. - * The other three statuses are mutable within the `.create` and `.update`, methods: - * - `ACTIVE`, which means loaded fully into memory and ready for use. - * - `INACTIVE`, which means not loaded into memory with files stored on disk. - * - `OFFLOADED`, which means not loaded into memory with files stored on the cloud. - */ - activityStatus: 'ACTIVE' | 'INACTIVE' | 'OFFLOADED' | 'OFFLOADING' | 'ONLOADING'; -}; -/** This is the type of the Tenant as defined in Weaviate's OpenAPI schema. It is included here for Backwards Compatibility. */ -export type TenantBC = TenantBase & { - activityStatus?: 'HOT' | 'COLD' | 'FROZEN'; -}; diff --git a/dist/node/cjs/collections/tenants/types.js b/dist/node/cjs/collections/tenants/types.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/tenants/types.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/types/batch.d.ts b/dist/node/cjs/collections/types/batch.d.ts deleted file mode 100644 index a3a9194c..00000000 --- a/dist/node/cjs/collections/types/batch.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { BatchReference } from '../../openapi/types.js'; -import { BatchObject as BatchObjectGRPC } from '../../proto/v1/batch.js'; -import { NonReferenceInputs, ReferenceInputs, Vectors } from '../index.js'; -export type BatchObjectsReturn = { - allResponses: (string | ErrorObject)[]; - elapsedSeconds: number; - errors: Record>; - hasErrors: boolean; - uuids: Record; -}; -export type ErrorObject = { - code?: number; - message: string; - object: BatchObject; - originalUuid?: string; -}; -export type BatchObject = { - collection: string; - properties?: NonReferenceInputs; - references?: ReferenceInputs; - id?: string; - vectors?: number[] | Vectors; - tenant?: string; -}; -export type BatchObjects = { - batch: BatchObject[]; - mapped: BatchObjectGRPC[]; -}; -export type ErrorReference = { - message: string; - reference: BatchReference; -}; -export type BatchReferencesReturn = { - elapsedSeconds: number; - errors: Record; - hasErrors: boolean; -}; diff --git a/dist/node/cjs/collections/types/batch.js b/dist/node/cjs/collections/types/batch.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/types/batch.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/types/data.d.ts b/dist/node/cjs/collections/types/data.d.ts deleted file mode 100644 index 81bdaf06..00000000 --- a/dist/node/cjs/collections/types/data.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NonReferenceInputs, ReferenceInputs } from './internal.js'; -import { Vectors } from './query.js'; -export type DataObject = { - id?: string; - properties?: NonReferenceInputs; - references?: ReferenceInputs; - vectors?: number[] | Vectors; -}; -export type DeleteManyObject = { - id: string; - successful: boolean; - error?: string; -}; -export type DeleteManyReturn = { - failed: number; - matches: number; - objects: V extends true ? DeleteManyObject[] : undefined; - successful: number; -}; -export type ReferenceToMultiTarget = { - targetCollection: string; - uuids: string | string[]; -}; diff --git a/dist/node/cjs/collections/types/data.js b/dist/node/cjs/collections/types/data.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/types/data.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/types/generate.d.ts b/dist/node/cjs/collections/types/generate.d.ts deleted file mode 100644 index 2a3dec01..00000000 --- a/dist/node/cjs/collections/types/generate.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { GroupByObject, GroupByResult, WeaviateGenericObject, WeaviateNonGenericObject } from './query.js'; -export type GenerativeGenericObject = WeaviateGenericObject & { - /** The LLM-generated output applicable to this single object. */ - generated?: string; -}; -export type GenerativeNonGenericObject = WeaviateNonGenericObject & { - /** The LLM-generated output applicable to this single object. */ - generated?: string; -}; -/** An object belonging to a collection as returned by the methods in the `collection.generate` namespace. - * - * Depending on the generic type `T`, the object will have subfields that map from `T`'s specific type definition. - * If not, then the object will be non-generic and have a `properties` field that maps from a generic string to a `WeaviateField`. - */ -export type GenerativeObject = T extends undefined - ? GenerativeNonGenericObject - : GenerativeGenericObject; -/** The return of a query method in the `collection.generate` namespace. */ -export type GenerativeReturn = { - /** The objects that were found by the query. */ - objects: GenerativeObject[]; - /** The LLM-generated output applicable to this query as a whole. */ - generated?: string; -}; -export type GenerativeGroupByResult = GroupByResult & { - generated?: string; -}; -/** The return of a query method in the `collection.generate` namespace where the `groupBy` argument was specified. */ -export type GenerativeGroupByReturn = { - /** The objects that were found by the query. */ - objects: GroupByObject[]; - /** The groups that were created by the query. */ - groups: Record>; - /** The LLM-generated output applicable to this query as a whole. */ - generated?: string; -}; -/** Options available when defining queries using methods in the `collection.generate` namespace. */ -export type GenerateOptions = { - /** The prompt to use when generating content relevant to each object of the collection individually. */ - singlePrompt?: string; - /** The prompt to use when generating content relevant to objects returned by the query as a whole. */ - groupedTask?: string; - /** The properties to use as context to be injected into the `groupedTask` prompt when performing the grouped generation. */ - groupedProperties?: T extends undefined ? string[] : (keyof T)[]; -}; -export type GenerateReturn = Promise> | Promise>; diff --git a/dist/node/cjs/collections/types/generate.js b/dist/node/cjs/collections/types/generate.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/types/generate.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/types/index.d.ts b/dist/node/cjs/collections/types/index.d.ts deleted file mode 100644 index 82993e23..00000000 --- a/dist/node/cjs/collections/types/index.d.ts +++ /dev/null @@ -1,84 +0,0 @@ -export * from '../config/types/index.js'; -export * from '../configure/types/index.js'; -export type { CollectionConfigCreate } from '../index.js'; -export * from './batch.js'; -export * from './data.js'; -export * from './generate.js'; -export type { - IsEmptyType, - IsNestedField, - IsPrimitiveField, - IsWeaviateField, - NestedKeys, - NonRefKeys, - NonReferenceInputs, - PrimitiveKeys, - QueryNested, - QueryProperty, - QueryReference, - RefKeys, - ReferenceInput, - ReferenceInputs, -} from './internal.js'; -export * from './query.js'; -import { - GeoCoordinate as GeoCoordinateGRPC, - PhoneNumber as PhoneNumberGRPC, -} from '../../proto/v1/properties.js'; -import { CrossReference } from '../references/index.js'; -export type DataType = T extends infer U | undefined - ? U extends string - ? 'text' | 'uuid' | 'blob' - : U extends number - ? 'number' | 'int' - : U extends boolean - ? 'boolean' - : U extends Date - ? 'date' - : U extends string[] - ? 'text[]' | 'uuid[]' - : U extends number[] - ? 'number[]' | 'int[]' - : U extends boolean[] - ? 'boolean[]' - : U extends Date[] - ? 'date[]' - : U extends GeoCoordinate - ? 'geoCoordinates' - : U extends PhoneNumber - ? 'phoneNumber' - : U extends object[] - ? 'object[]' - : U extends object - ? 'object' - : never - : never; -export type GeoCoordinate = Required; -export type PhoneNumber = Required; -export type PrimitiveField = - | string - | string[] - | boolean - | boolean[] - | number - | number[] - | Date - | Date[] - | Blob - | GeoCoordinate - | PhoneNumber - | PhoneNumberInput - | null; -export type NestedField = NestedProperties | NestedProperties[]; -export type WeaviateField = PrimitiveField | NestedField; -export type Property = WeaviateField | CrossReference | undefined; -export interface Properties { - [k: string]: Property; -} -export interface NestedProperties { - [k: string]: WeaviateField; -} -export type PhoneNumberInput = { - number: string; - defaultCountry?: string; -}; diff --git a/dist/node/cjs/collections/types/index.js b/dist/node/cjs/collections/types/index.js deleted file mode 100644 index eb18cf8d..00000000 --- a/dist/node/cjs/collections/types/index.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __exportStar = - (this && this.__exportStar) || - function (m, exports) { - for (var p in m) - if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) - __createBinding(exports, m, p); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -__exportStar(require('../config/types/index.js'), exports); -__exportStar(require('../configure/types/index.js'), exports); -__exportStar(require('./batch.js'), exports); -__exportStar(require('./data.js'), exports); -__exportStar(require('./generate.js'), exports); -__exportStar(require('./query.js'), exports); diff --git a/dist/node/cjs/collections/types/internal.d.ts b/dist/node/cjs/collections/types/internal.d.ts deleted file mode 100644 index a5b1d189..00000000 --- a/dist/node/cjs/collections/types/internal.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { - NestedProperties, - PhoneNumber, - PhoneNumberInput, - PrimitiveField, - RefProperty, - RefPropertyDefault, - ReferenceToMultiTarget, - WeaviateField, -} from '../index.js'; -import { ReferenceManager } from '../references/classes.js'; -import { CrossReference } from '../references/index.js'; -export type ExtractCrossReferenceType = T extends CrossReference ? U : never; -type ExtractNestedType = T extends (infer U)[] - ? U extends NestedProperties - ? U - : never - : T extends NestedProperties - ? T - : never; -export type QueryNested = { - [K in NestedKeys]: { - name: K; - properties: QueryProperty>[]; - }; -}[NestedKeys]; -export type QueryNestedDefault = { - name: string; - properties: (string | QueryNestedDefault)[]; -}; -export type QueryProperty = T extends undefined - ? string | QueryNestedDefault - : PrimitiveKeys | QueryNested; -export type QueryReference = T extends undefined ? RefPropertyDefault : RefProperty; -export type NonRefProperty = keyof T | QueryNested; -export type NonPrimitiveProperty = RefProperty | QueryNested; -export type IsEmptyType = keyof T extends never ? true : false; -export type ReferenceInput = - | string - | ReferenceToMultiTarget - | ReferenceManager - | (string | ReferenceToMultiTarget | ReferenceManager)[]; -export type ReferenceInputs = Obj extends undefined - ? Record> - : { - [Key in keyof Obj as Key extends RefKeys ? Key : never]: ReferenceInput< - ExtractCrossReferenceType - >; - }; -export type IsPrimitiveField = T extends PrimitiveField ? T : never; -export type IsWeaviateField = T extends WeaviateField ? T : never; -export type IsNestedField = T extends NestedProperties | NestedProperties[] ? T : never; -/** - * This is an internal type that is used to extract the keys of a user-provided generic type that are primitive fields, e.g. non-nested and non-reference. - */ -export type PrimitiveKeys = Obj extends undefined - ? string - : { - [Key in keyof Obj]-?: undefined extends Obj[Key] - ? IsPrimitiveField> extends never - ? never - : Key - : IsPrimitiveField extends never - ? never - : Key; - }[keyof Obj] & - string; -/** - * This is an internal type that is used to extract the keys of a user-provided generic type that are references. - */ -export type RefKeys = { - [Key in keyof Obj]: Obj[Key] extends CrossReference | undefined ? Key : never; -}[keyof Obj] & - string; -/** - * This is an internal type that is used to extract the keys of a user-provided generic type that are not references. - */ -export type NonRefKeys = { - [Key in keyof Obj]-?: undefined extends Obj[Key] - ? IsWeaviateField> extends never - ? never - : Key - : IsWeaviateField extends never - ? never - : Key; -}[keyof Obj] & - string; -/** - * This is an internal type that is used to extract the keys of a user-provided generic type that are nested properties. - */ -export type NestedKeys = { - [Key in keyof Obj]-?: undefined extends Obj[Key] - ? IsNestedField> extends never - ? never - : Key - : IsNestedField extends never - ? never - : Key; -}[keyof Obj] & - string; -/** - * This is an internal type that is used to extract the allowed inputs for a non-generic type that is not a reference. - */ -export type NonReferenceInputs = Obj extends undefined - ? Record - : { - [Key in keyof Obj as Key extends NonRefKeys ? Key : never]: MapPhoneNumberType; - }; -export type MapPhoneNumberType = T extends PhoneNumber ? PhoneNumberInput : T; -export {}; diff --git a/dist/node/cjs/collections/types/internal.js b/dist/node/cjs/collections/types/internal.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/types/internal.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/types/query.d.ts b/dist/node/cjs/collections/types/query.d.ts deleted file mode 100644 index 7be5c4f7..00000000 --- a/dist/node/cjs/collections/types/query.d.ts +++ /dev/null @@ -1,136 +0,0 @@ -import { WeaviateField } from '../index.js'; -import { CrossReferenceDefault } from '../references/index.js'; -import { - ExtractCrossReferenceType, - NonRefKeys, - QueryNestedDefault, - QueryProperty, - QueryReference, - RefKeys, -} from './internal.js'; -export type Metadata = { - creationTime: Date; - updateTime: Date; - distance: number; - certainty: number; - score: number; - explainScore: string; - rerankScore: number; - isConsistent: boolean; -}; -export type MetadataKeys = (keyof Metadata)[]; -export type QueryMetadata = 'all' | MetadataKeys | undefined; -export type ReturnMetadata = Partial; -export type WeaviateGenericObject = { - /** The generic returned properties of the object derived from the type `T`. */ - properties: ReturnProperties; - /** The returned metadata of the object. */ - metadata: ReturnMetadata | undefined; - /** The returned references of the object derived from the type `T`. */ - references: ReturnReferences | undefined; - /** The UUID of the object. */ - uuid: string; - /** The returned vectors of the object. */ - vectors: Vectors; -}; -export type WeaviateNonGenericObject = { - /** The returned properties of the object. */ - properties: Record; - /** The returned metadata of the object. */ - metadata: ReturnMetadata | undefined; - /** The returned references of the object. */ - references: Record | undefined; - /** The UUID of the object. */ - uuid: string; - /** The returned vectors of the object. */ - vectors: Vectors; -}; -export type ReturnProperties = Pick>; -export type ReturnReferences = Pick>; -export type Vectors = Record; -export type ReturnVectors = V extends string[] - ? { - [Key in V[number]]: number[]; - } - : Record; -/** An object belonging to a collection as returned by the methods in the `collection.query` namespace. - * - * Depending on the generic type `T`, the object will have subfields that map from `T`'s specific type definition. - * If not, then the object will be non-generic and have a `properties` field that maps from a generic string to a `WeaviateField`. - */ -export type WeaviateObject = T extends undefined ? WeaviateNonGenericObject : WeaviateGenericObject; -/** The return of a query method in the `collection.query` namespace. */ -export type WeaviateReturn = { - /** The objects that were found by the query. */ - objects: WeaviateObject[]; -}; -export type GroupByObject = WeaviateObject & { - belongsToGroup: string; -}; -export type GroupByResult = { - name: string; - minDistance: number; - maxDistance: number; - numberOfObjects: number; - objects: WeaviateObject[]; -}; -/** The return of a query method in the `collection.query` namespace where the `groupBy` argument was specified. */ -export type GroupByReturn = { - /** The objects that were found by the query. */ - objects: GroupByObject[]; - /** The groups that were created by the query. */ - groups: Record>; -}; -export type GroupByOptions = T extends undefined - ? { - property: string; - numberOfGroups: number; - objectsPerGroup: number; - } - : { - property: keyof T; - numberOfGroups: number; - objectsPerGroup: number; - }; -export type RerankOptions = T extends undefined - ? { - property: string; - query: string; - } - : { - property: keyof T; - query?: string; - }; -export interface BaseRefProperty { - /** The property to link on when defining the references traversal. */ - linkOn: RefKeys; - /** Whether to return the vector(s) of the referenced objects in the query. */ - includeVector?: boolean | string[]; - /** The metadata to return for the referenced objects. */ - returnMetadata?: QueryMetadata; - /** The properties to return for the referenced objects. */ - returnProperties?: QueryProperty[]; - /** The references to return for the referenced objects. */ - returnReferences?: QueryReference>[]; - /** The collection to target when traversing the references. Required for multi-target references. */ - targetCollection?: string; -} -export type RefProperty = BaseRefProperty; -export type RefPropertyDefault = { - /** The property to link on when defining the references traversal. */ - linkOn: string; - /** Whether to return the vector(s) of the referenced objects in the query. */ - includeVector?: boolean | string[]; - /** The metadata to return for the referenced objects. */ - returnMetadata?: QueryMetadata; - /** The properties to return for the referenced objects. */ - returnProperties?: (string | QueryNestedDefault)[]; - /** The references to return for the referenced objects. */ - returnReferences?: RefPropertyDefault[]; - /** The collection to target when traversing the references. Required for multi-target references. */ - targetCollection?: string; -}; -export type SortBy = { - property: string; - ascending?: boolean; -}; diff --git a/dist/node/cjs/collections/types/query.js b/dist/node/cjs/collections/types/query.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/collections/types/query.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/collections/vectors/multiTargetVector.d.ts b/dist/node/cjs/collections/vectors/multiTargetVector.d.ts deleted file mode 100644 index fb034780..00000000 --- a/dist/node/cjs/collections/vectors/multiTargetVector.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** The allowed combination methods for multi-target vector joins */ -export type MultiTargetVectorJoinCombination = - | 'sum' - | 'average' - | 'minimum' - | 'relative-score' - | 'manual-weights'; -/** Weights for each target vector in a multi-target vector join */ -export type MultiTargetVectorWeights = Record; -/** A multi-target vector join used when specifying a vector-based query */ -export type MultiTargetVectorJoin = { - /** The combination method to use for the target vectors */ - combination: MultiTargetVectorJoinCombination; - /** The target vectors to combine */ - targetVectors: string[]; - /** The weights to use for each target vector */ - weights?: MultiTargetVectorWeights; -}; -declare const _default: () => { - sum: (targetVectors: string[]) => MultiTargetVectorJoin; - average: (targetVectors: string[]) => MultiTargetVectorJoin; - minimum: (targetVectors: string[]) => MultiTargetVectorJoin; - relativeScore: (weights: MultiTargetVectorWeights) => MultiTargetVectorJoin; - manualWeights: (weights: MultiTargetVectorWeights) => MultiTargetVectorJoin; -}; -export default _default; -export interface MultiTargetVector { - /** Create a multi-target vector join that sums the vector scores over the target vectors */ - sum: (targetVectors: string[]) => MultiTargetVectorJoin; - /** Create a multi-target vector join that averages the vector scores over the target vectors */ - average: (targetVectors: string[]) => MultiTargetVectorJoin; - /** Create a multi-target vector join that takes the minimum vector score over the target vectors */ - minimum: (targetVectors: string[]) => MultiTargetVectorJoin; - /** Create a multi-target vector join that uses relative weights for each target vector */ - relativeScore: (weights: MultiTargetVectorWeights) => MultiTargetVectorJoin; - /** Create a multi-target vector join that uses manual weights for each target vector */ - manualWeights: (weights: MultiTargetVectorWeights) => MultiTargetVectorJoin; -} diff --git a/dist/node/cjs/collections/vectors/multiTargetVector.js b/dist/node/cjs/collections/vectors/multiTargetVector.js deleted file mode 100644 index 235bbcfc..00000000 --- a/dist/node/cjs/collections/vectors/multiTargetVector.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.default = () => { - return { - sum: (targetVectors) => { - return { combination: 'sum', targetVectors }; - }, - average: (targetVectors) => { - return { combination: 'average', targetVectors }; - }, - minimum: (targetVectors) => { - return { combination: 'minimum', targetVectors }; - }, - relativeScore: (weights) => { - return { - combination: 'relative-score', - targetVectors: Object.keys(weights), - weights, - }; - }, - manualWeights: (weights) => { - return { - combination: 'manual-weights', - targetVectors: Object.keys(weights), - weights, - }; - }, - }; -}; diff --git a/dist/node/cjs/connection/auth.d.ts b/dist/node/cjs/connection/auth.d.ts deleted file mode 100644 index ce24ab33..00000000 --- a/dist/node/cjs/connection/auth.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { HttpClient } from './http.js'; -/** - * The allowed authentication credentials. See [the docs](https://weaviate.io/developers/weaviate/configuration/authentication) for more information. - * - * The following types are allowed: - * - `AuthUserPasswordCredentials` - * - `AuthAccessTokenCredentials` - * - `AuthClientCredentials` - * - `ApiKey` - * - `string` - * - * A string is interpreted as an API key. - */ -export type AuthCredentials = - | AuthUserPasswordCredentials - | AuthAccessTokenCredentials - | AuthClientCredentials - | ApiKey - | string; -export declare const isApiKey: (creds?: AuthCredentials) => creds is string | ApiKey; -export declare const mapApiKey: (creds: ApiKey | string) => ApiKey; -interface AuthenticatorResult { - accessToken: string; - expiresAt: number; - refreshToken: string; -} -interface OidcCredentials { - silentRefresh: boolean; -} -export interface OidcAuthFlow { - refresh: () => Promise; -} -export declare class OidcAuthenticator { - private readonly http; - private readonly creds; - private accessToken; - private refreshToken?; - private expiresAt; - private refreshRunning; - private refreshInterval; - constructor(http: HttpClient, creds: any); - refresh: (localConfig: any) => Promise; - getOpenidConfig: (localConfig: any) => Promise<{ - clientId: any; - provider: any; - scopes: any; - }>; - startTokenRefresh: (authenticator: { refresh: () => any }) => void; - stopTokenRefresh: () => void; - refreshTokenProvided: () => boolean | '' | undefined; - getAccessToken: () => string; - getExpiresAt: () => number; - resetExpiresAt(): void; -} -export interface UserPasswordCredentialsInput { - username: string; - password?: string; - scopes?: any[]; - silentRefresh?: boolean; -} -export declare class AuthUserPasswordCredentials implements OidcCredentials { - private username; - private password?; - private scopes?; - readonly silentRefresh: boolean; - constructor(creds: UserPasswordCredentialsInput); -} -export interface AccessTokenCredentialsInput { - accessToken: string; - expiresIn: number; - refreshToken?: string; - silentRefresh?: boolean; -} -export declare class AuthAccessTokenCredentials implements OidcCredentials { - readonly accessToken: string; - readonly expiresAt: number; - readonly refreshToken?: string; - readonly silentRefresh: boolean; - constructor(creds: AccessTokenCredentialsInput); - validate: (creds: AccessTokenCredentialsInput) => void; -} -export interface ClientCredentialsInput { - clientSecret: string; - scopes?: any[]; - silentRefresh?: boolean; -} -export declare class AuthClientCredentials implements OidcCredentials { - private clientSecret; - private scopes?; - readonly silentRefresh: boolean; - constructor(creds: ClientCredentialsInput); -} -export declare class ApiKey { - readonly apiKey: string; - constructor(apiKey: string); -} -export {}; diff --git a/dist/node/cjs/connection/auth.js b/dist/node/cjs/connection/auth.js deleted file mode 100644 index 4ebc5cd0..00000000 --- a/dist/node/cjs/connection/auth.js +++ /dev/null @@ -1,328 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.ApiKey = - exports.AuthClientCredentials = - exports.AuthAccessTokenCredentials = - exports.AuthUserPasswordCredentials = - exports.OidcAuthenticator = - exports.mapApiKey = - exports.isApiKey = - void 0; -const isApiKey = (creds) => { - return typeof creds === 'string' || creds instanceof ApiKey; -}; -exports.isApiKey = isApiKey; -const mapApiKey = (creds) => { - return creds instanceof ApiKey ? creds : new ApiKey(creds); -}; -exports.mapApiKey = mapApiKey; -class OidcAuthenticator { - constructor(http, creds) { - this.refresh = (localConfig) => - __awaiter(this, void 0, void 0, function* () { - const config = yield this.getOpenidConfig(localConfig); - let authenticator; - switch (this.creds.constructor) { - case AuthUserPasswordCredentials: - authenticator = new UserPasswordAuthenticator(this.http, this.creds, config); - break; - case AuthAccessTokenCredentials: - authenticator = new AccessTokenAuthenticator(this.http, this.creds, config); - break; - case AuthClientCredentials: - authenticator = new ClientCredentialsAuthenticator(this.http, this.creds, config); - break; - default: - throw new Error('unsupported credential type'); - } - return authenticator.refresh().then((resp) => { - this.accessToken = resp.accessToken; - this.expiresAt = resp.expiresAt; - this.refreshToken = resp.refreshToken; - this.startTokenRefresh(authenticator); - }); - }); - this.getOpenidConfig = (localConfig) => { - return this.http.externalGet(localConfig.href).then((openidProviderConfig) => { - const scopes = localConfig.scopes || []; - return { - clientId: localConfig.clientId, - provider: openidProviderConfig, - scopes: scopes, - }; - }); - }; - this.startTokenRefresh = (authenticator) => { - if (this.creds.silentRefresh && !this.refreshRunning && this.refreshTokenProvided()) { - this.refreshInterval = setInterval( - () => - __awaiter(this, void 0, void 0, function* () { - // check every 30s if the token will expire in <= 1m, - // if so, refresh - if (this.expiresAt - Date.now() <= 60000) { - const resp = yield authenticator.refresh(); - this.accessToken = resp.accessToken; - this.expiresAt = resp.expiresAt; - this.refreshToken = resp.refreshToken; - } - }), - 30000 - ); - this.refreshRunning = true; - } - }; - this.stopTokenRefresh = () => { - clearInterval(this.refreshInterval); - this.refreshRunning = false; - }; - this.refreshTokenProvided = () => { - return this.refreshToken && this.refreshToken != ''; - }; - this.getAccessToken = () => { - return this.accessToken; - }; - this.getExpiresAt = () => { - return this.expiresAt; - }; - this.http = http; - this.creds = creds; - this.accessToken = ''; - this.refreshToken = ''; - this.expiresAt = 0; - this.refreshRunning = false; - // If the authentication method is access token, - // our bearer token is already available for use - if (this.creds instanceof AuthAccessTokenCredentials) { - this.accessToken = this.creds.accessToken; - this.expiresAt = this.creds.expiresAt; - this.refreshToken = this.creds.refreshToken; - } - } - resetExpiresAt() { - this.expiresAt = 0; - } -} -exports.OidcAuthenticator = OidcAuthenticator; -class AuthUserPasswordCredentials { - constructor(creds) { - this.username = creds.username; - this.password = creds.password; - this.scopes = creds.scopes; - this.silentRefresh = parseSilentRefresh(creds.silentRefresh); - } -} -exports.AuthUserPasswordCredentials = AuthUserPasswordCredentials; -class UserPasswordAuthenticator { - constructor(http, creds, config) { - this.refresh = () => { - this.validateOpenidConfig(); - return this.requestAccessToken() - .then((tokenResp) => { - return { - accessToken: tokenResp.access_token, - expiresAt: calcExpirationEpoch(tokenResp.expires_in), - refreshToken: tokenResp.refresh_token, - }; - }) - .catch((err) => { - return Promise.reject(new Error(`failed to refresh access token: ${err}`)); - }); - }; - this.validateOpenidConfig = () => { - if ( - this.openidConfig.provider.grant_types_supported !== undefined && - !this.openidConfig.provider.grant_types_supported.includes('password') - ) { - throw new Error('grant_type password not supported'); - } - if (this.openidConfig.provider.token_endpoint.includes('https://login.microsoftonline.com')) { - throw new Error( - 'microsoft/azure recommends to avoid authentication using ' + - 'username and password, so this method is not supported by this client' - ); - } - this.openidConfig.scopes.push('offline_access'); - }; - this.requestAccessToken = () => { - const url = this.openidConfig.provider.token_endpoint; - const params = new URLSearchParams({ - grant_type: 'password', - client_id: this.openidConfig.clientId, - username: this.creds.username, - password: this.creds.password, - scope: this.openidConfig.scopes.join(' '), - }); - const contentType = 'application/x-www-form-urlencoded;charset=UTF-8'; - return this.http.externalPost(url, params, contentType); - }; - this.http = http; - this.creds = creds; - this.openidConfig = config; - if (creds.scopes) { - this.openidConfig.scopes.push(creds.scopes); - } - } -} -class AuthAccessTokenCredentials { - constructor(creds) { - this.validate = (creds) => { - if (creds.expiresIn === undefined) { - throw new Error('AuthAccessTokenCredentials: expiresIn is required'); - } - if (!Number.isInteger(creds.expiresIn) || creds.expiresIn <= 0) { - throw new Error('AuthAccessTokenCredentials: expiresIn must be int > 0'); - } - }; - this.validate(creds); - this.accessToken = creds.accessToken; - this.expiresAt = calcExpirationEpoch(creds.expiresIn); - this.refreshToken = creds.refreshToken; - this.silentRefresh = parseSilentRefresh(creds.silentRefresh); - } -} -exports.AuthAccessTokenCredentials = AuthAccessTokenCredentials; -class AccessTokenAuthenticator { - constructor(http, creds, config) { - this.refresh = () => { - if (this.creds.refreshToken === undefined || this.creds.refreshToken == '') { - console.warn('AuthAccessTokenCredentials not provided with refreshToken, cannot refresh'); - return Promise.resolve({ - accessToken: this.creds.accessToken, - expiresAt: this.creds.expiresAt, - }); - } - this.validateOpenidConfig(); - return this.requestAccessToken() - .then((tokenResp) => { - return { - accessToken: tokenResp.access_token, - expiresAt: calcExpirationEpoch(tokenResp.expires_in), - refreshToken: tokenResp.refresh_token, - }; - }) - .catch((err) => { - return Promise.reject(new Error(`failed to refresh access token: ${err}`)); - }); - }; - this.validateOpenidConfig = () => { - if ( - this.openidConfig.provider.grant_types_supported === undefined || - !this.openidConfig.provider.grant_types_supported.includes('refresh_token') - ) { - throw new Error('grant_type refresh_token not supported'); - } - }; - this.requestAccessToken = () => { - const url = this.openidConfig.provider.token_endpoint; - const params = new URLSearchParams({ - grant_type: 'refresh_token', - client_id: this.openidConfig.clientId, - refresh_token: this.creds.refreshToken, - }); - const contentType = 'application/x-www-form-urlencoded;charset=UTF-8'; - return this.http.externalPost(url, params, contentType); - }; - this.http = http; - this.creds = creds; - this.openidConfig = config; - } -} -class AuthClientCredentials { - constructor(creds) { - this.clientSecret = creds.clientSecret; - this.scopes = creds.scopes; - this.silentRefresh = parseSilentRefresh(creds.silentRefresh); - } -} -exports.AuthClientCredentials = AuthClientCredentials; -class ClientCredentialsAuthenticator { - constructor(http, creds, config) { - this.refresh = () => { - this.validateOpenidConfig(); - return this.requestAccessToken() - .then((tokenResp) => { - return { - accessToken: tokenResp.access_token, - expiresAt: calcExpirationEpoch(tokenResp.expires_in), - refreshToken: tokenResp.refresh_token, - }; - }) - .catch((err) => { - return Promise.reject(new Error(`failed to refresh access token: ${err}`)); - }); - }; - this.validateOpenidConfig = () => { - if (this.openidConfig.scopes.length > 0) { - return; - } - if (this.openidConfig.provider.token_endpoint.includes('https://login.microsoftonline.com')) { - this.openidConfig.scopes.push(this.openidConfig.clientId + '/.default'); - } - }; - this.requestAccessToken = () => { - const url = this.openidConfig.provider.token_endpoint; - const params = new URLSearchParams({ - grant_type: 'client_credentials', - client_id: this.openidConfig.clientId, - client_secret: this.creds.clientSecret, - scope: this.openidConfig.scopes.join(' '), - }); - const contentType = 'application/x-www-form-urlencoded;charset=UTF-8'; - return this.http.externalPost(url, params, contentType); - }; - this.http = http; - this.creds = creds; - this.openidConfig = config; - if (creds.scopes) { - this.openidConfig.scopes.push(creds.scopes); - } - } -} -class ApiKey { - constructor(apiKey) { - this.apiKey = apiKey; - } -} -exports.ApiKey = ApiKey; -function calcExpirationEpoch(expiresIn) { - return Date.now() + (expiresIn - 2) * 1000; // -2 for some lag -} -function parseSilentRefresh(silentRefresh) { - // Silent token refresh by default - if (silentRefresh === undefined) { - return true; - } else { - return silentRefresh; - } -} diff --git a/dist/node/cjs/connection/gql.d.ts b/dist/node/cjs/connection/gql.d.ts deleted file mode 100644 index ee57dd4e..00000000 --- a/dist/node/cjs/connection/gql.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Variables } from 'graphql-request'; -import ConnectionREST, { InternalConnectionParams } from './http.js'; -export default class ConnectionGQL extends ConnectionREST { - private gql; - constructor(params: InternalConnectionParams); - query: ( - query: any, - variables?: V | undefined - ) => Promise<{ - data: T; - }>; - close: () => void; -} -export * from './auth.js'; -export type TQuery = any; -export interface GraphQLClient { - query: ( - query: TQuery, - variables?: V, - headers?: HeadersInit - ) => Promise<{ - data: T; - }>; -} -export declare const gqlClient: (config: InternalConnectionParams) => GraphQLClient; diff --git a/dist/node/cjs/connection/gql.js b/dist/node/cjs/connection/gql.js deleted file mode 100644 index 21ec0964..00000000 --- a/dist/node/cjs/connection/gql.js +++ /dev/null @@ -1,72 +0,0 @@ -'use strict'; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __exportStar = - (this && this.__exportStar) || - function (m, exports) { - for (var p in m) - if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) - __createBinding(exports, m, p); - }; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.gqlClient = void 0; -const graphql_request_1 = require('graphql-request'); -const http_js_1 = __importDefault(require('./http.js')); -class ConnectionGQL extends http_js_1.default { - constructor(params) { - super(params); - this.query = (query, variables) => { - if (this.authEnabled) { - return this.login().then((token) => { - const headers = { Authorization: `Bearer ${token}` }; - return this.gql.query(query, variables, headers); - }); - } - return this.gql.query(query, variables); - }; - this.close = () => this.http.close(); - this.gql = (0, exports.gqlClient)(params); - } -} -exports.default = ConnectionGQL; -__exportStar(require('./auth.js'), exports); -const gqlClient = (config) => { - const version = '/v1/graphql'; - const baseUri = `${config.host}${version}`; - const defaultHeaders = config.headers; - return { - // for backward compatibility with replaced graphql-client lib, - // results are wrapped into { data: data } - query: (query, variables, headers) => { - return new graphql_request_1.GraphQLClient(baseUri, { - headers: Object.assign(Object.assign({}, defaultHeaders), headers), - }) - .request(query, variables, headers) - .then((data) => ({ data })); - }, - }; -}; -exports.gqlClient = gqlClient; diff --git a/dist/node/cjs/connection/grpc.d.ts b/dist/node/cjs/connection/grpc.d.ts deleted file mode 100644 index ab94b175..00000000 --- a/dist/node/cjs/connection/grpc.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { ConsistencyLevel } from '../data/index.js'; -import { Batch } from '../grpc/batcher.js'; -import { Search } from '../grpc/searcher.js'; -import { Tenants } from '../grpc/tenantsManager.js'; -import { DbVersionSupport } from '../utils/dbVersion.js'; -import ConnectionGQL from './gql.js'; -import { InternalConnectionParams } from './http.js'; -export interface GrpcConnectionParams extends InternalConnectionParams { - grpcAddress: string; - grpcSecure: boolean; -} -export default class ConnectionGRPC extends ConnectionGQL { - private grpc; - private grpcAddress; - private constructor(); - static use: (params: GrpcConnectionParams) => Promise<{ - connection: ConnectionGRPC; - dbVersionProvider: import('../utils/dbVersion.js').DbVersionProvider; - dbVersionSupport: DbVersionSupport; - }>; - private connect; - search: (collection: string, consistencyLevel?: ConsistencyLevel, tenant?: string) => Promise; - batch: (collection: string, consistencyLevel?: ConsistencyLevel, tenant?: string) => Promise; - tenants: (collection: string) => Promise; - close: () => void; -} -export interface GrpcClient { - close: () => void; - batch: ( - collection: string, - consistencyLevel?: ConsistencyLevel, - tenant?: string, - bearerToken?: string - ) => Batch; - health: () => Promise; - search: ( - collection: string, - consistencyLevel?: ConsistencyLevel, - tenant?: string, - bearerToken?: string - ) => Search; - tenants: (collection: string, bearerToken?: string) => Tenants; -} -export declare const grpcClient: (config: GrpcConnectionParams) => GrpcClient; diff --git a/dist/node/cjs/connection/grpc.js b/dist/node/cjs/connection/grpc.js deleted file mode 100644 index a9375b37..00000000 --- a/dist/node/cjs/connection/grpc.js +++ /dev/null @@ -1,207 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -var _a; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.grpcClient = void 0; -const abort_controller_x_1 = require('abort-controller-x'); -const gql_js_1 = __importDefault(require('./gql.js')); -const nice_grpc_1 = require('nice-grpc'); -const nice_grpc_client_middleware_retry_1 = require('nice-grpc-client-middleware-retry'); -const health_js_1 = require('../proto/google/health/v1/health.js'); -const weaviate_js_1 = require('../proto/v1/weaviate.js'); -const batcher_js_1 = __importDefault(require('../grpc/batcher.js')); -const searcher_js_1 = __importDefault(require('../grpc/searcher.js')); -const tenantsManager_js_1 = __importDefault(require('../grpc/tenantsManager.js')); -const dbVersion_js_1 = require('../utils/dbVersion.js'); -const errors_js_1 = require('../errors.js'); -const clientFactory = (0, nice_grpc_1.createClientFactory)().use( - nice_grpc_client_middleware_retry_1.retryMiddleware -); -const MAX_GRPC_MESSAGE_LENGTH = 104858000; // 10mb, needs to be synchronized with GRPC server -// Must extend from ConnectionGQL so that it can be passed to all the builder methods, -// which are tightly coupled to ConnectionGQL -class ConnectionGRPC extends gql_js_1.default { - constructor(params) { - super(params); - this.search = (collection, consistencyLevel, tenant) => { - if (this.authEnabled) { - return this.login().then((token) => - this.grpc.search(collection, consistencyLevel, tenant, `Bearer ${token}`) - ); - } - return new Promise((resolve) => resolve(this.grpc.search(collection, consistencyLevel, tenant))); - }; - this.batch = (collection, consistencyLevel, tenant) => { - if (this.authEnabled) { - return this.login().then((token) => - this.grpc.batch(collection, consistencyLevel, tenant, `Bearer ${token}`) - ); - } - return new Promise((resolve) => resolve(this.grpc.batch(collection, consistencyLevel, tenant))); - }; - this.tenants = (collection) => { - if (this.authEnabled) { - return this.login().then((token) => this.grpc.tenants(collection, `Bearer ${token}`)); - } - return new Promise((resolve) => resolve(this.grpc.tenants(collection))); - }; - this.close = () => { - this.grpc.close(); - this.http.close(); - }; - this.grpc = (0, exports.grpcClient)(params); - this.grpcAddress = params.grpcAddress; - } - connect() { - return __awaiter(this, void 0, void 0, function* () { - const isHealthy = yield this.grpc.health(); - if (!isHealthy) { - yield this.close(); - throw new errors_js_1.WeaviateGRPCUnavailableError(this.grpcAddress); - } - }); - } -} -_a = ConnectionGRPC; -ConnectionGRPC.use = (params) => - __awaiter(void 0, void 0, void 0, function* () { - const connection = new ConnectionGRPC(params); - const dbVersionProvider = (0, dbVersion_js_1.initDbVersionProvider)(connection); - const dbVersionSupport = new dbVersion_js_1.DbVersionSupport(dbVersionProvider); - if (params.skipInitChecks) { - return { connection, dbVersionProvider, dbVersionSupport }; - } - yield Promise.all([ - dbVersionSupport.supportsCompatibleGrpcService().then((check) => { - if (!check.supports) { - throw new errors_js_1.WeaviateUnsupportedFeatureError( - `Checking for gRPC compatibility failed with message: ${check.message}` - ); - } - }), - connection.connect(), - ]); - return { connection, dbVersionProvider, dbVersionSupport }; - }); -exports.default = ConnectionGRPC; -const grpcClient = (config) => { - const channelOptions = { - 'grpc.max_send_message_length': MAX_GRPC_MESSAGE_LENGTH, - 'grpc.max_receive_message_length': MAX_GRPC_MESSAGE_LENGTH, - }; - if (config.grpcProxyUrl) { - // grpc.http_proxy is not used by grpc.js under-the-hood - // only uses the env var and whether http_proxy is enabled - process.env.grpc_proxy = config.grpcProxyUrl; - channelOptions['grpc.enabled_http_proxy'] = true; - } - const channel = (0, nice_grpc_1.createChannel)( - config.grpcAddress, - config.grpcSecure - ? nice_grpc_1.ChannelCredentials.createSsl() - : nice_grpc_1.ChannelCredentials.createInsecure(), - channelOptions - ); - const client = clientFactory.create(weaviate_js_1.WeaviateDefinition, channel); - const health = clientFactory.create(health_js_1.HealthDefinition, channel); - return { - close: () => channel.close(), - batch: (collection, consistencyLevel, tenant, bearerToken) => { - var _b; - return batcher_js_1.default.use( - client, - collection, - new nice_grpc_1.Metadata( - bearerToken - ? Object.assign(Object.assign({}, config.headers), { authorization: bearerToken }) - : config.headers - ), - ((_b = config.timeout) === null || _b === void 0 ? void 0 : _b.insert) || 90, - consistencyLevel, - tenant - ); - }, - health: () => { - var _b; - const controller = new AbortController(); - const timeoutId = setTimeout( - () => controller.abort(), - (((_b = config.timeout) === null || _b === void 0 ? void 0 : _b.init) || 2) * 1000 - ); - return health - .check({ service: '/grpc.health.v1.Health/Check' }, { signal: controller.signal }) - .then((res) => res.status === health_js_1.HealthCheckResponse_ServingStatus.SERVING) - .catch((err) => { - if ((0, abort_controller_x_1.isAbortError)(err)) { - throw new errors_js_1.WeaviateGRPCUnavailableError(config.grpcAddress); - } - throw err; - }) - .finally(() => clearTimeout(timeoutId)); - }, - search: (collection, consistencyLevel, tenant, bearerToken) => { - var _b; - return searcher_js_1.default.use( - client, - collection, - new nice_grpc_1.Metadata( - bearerToken - ? Object.assign(Object.assign({}, config.headers), { authorization: bearerToken }) - : config.headers - ), - ((_b = config.timeout) === null || _b === void 0 ? void 0 : _b.query) || 30, - consistencyLevel, - tenant - ); - }, - tenants: (collection, bearerToken) => { - var _b; - return tenantsManager_js_1.default.use( - client, - collection, - new nice_grpc_1.Metadata( - bearerToken - ? Object.assign(Object.assign({}, config.headers), { authorization: bearerToken }) - : config.headers - ), - ((_b = config.timeout) === null || _b === void 0 ? void 0 : _b.query) || 30 - ); - }, - }; -}; -exports.grpcClient = grpcClient; diff --git a/dist/node/cjs/connection/helpers.d.ts b/dist/node/cjs/connection/helpers.d.ts deleted file mode 100644 index d26c3dd2..00000000 --- a/dist/node/cjs/connection/helpers.d.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { ClientParams, WeaviateClient } from '../index.js'; -import { AuthCredentials } from './auth.js'; -import { ProxiesParams, TimeoutParams } from './http.js'; -/** The options available to the `weaviate.connectToWeaviateCloud` method. */ -export type ConnectToWeaviateCloudOptions = { - /** The authentication credentials to use when connecting to Weaviate, e.g. API key */ - authCredentials?: AuthCredentials; - /** Additional headers to include in the request */ - headers?: Record; - /** The timeouts to use when making requests to Weaviate */ - timeout?: TimeoutParams; - /** Whether to skip the initialization checks */ - skipInitChecks?: boolean; -}; -/** @deprecated Use `ConnectToWeaviateCloudOptions` instead. */ -export type ConnectToWCDOptions = ConnectToWeaviateCloudOptions; -/** @deprecated Use `ConnectToWeaviateCloudOptions` instead. */ -export type ConnectToWCSOptions = ConnectToWeaviateCloudOptions; -export type ConnectToLocalOptions = { - /** The host where Weaviate is served. Assumes that the HTTP/1.1 and HTTP/2 servers are served on the same host */ - host?: string; - /** The port of the HTTP/1.1 server */ - port?: number; - /** The port of the HTTP/2 server */ - grpcPort?: number; - /** The authentication credentials to use when connecting to Weaviate, e.g. API key */ - authCredentials?: AuthCredentials; - /** Additional headers to include in the request */ - headers?: Record; - /** The timeouts to use when making requests to Weaviate */ - timeout?: TimeoutParams; - /** Whether to skip the initialization checks */ - skipInitChecks?: boolean; -}; -export type ConnectToCustomOptions = { - /** The hostname of the HTTP/1.1 server */ - httpHost?: string; - /** An additional path of the HTTP/1.1 server, e.g. `http://proxy.net/weaviate` */ - httpPath?: string; - /** The port of the HTTP/1.1 server */ - httpPort?: number; - /** Whether to use a secure connection to the HTTP/1.1 server */ - httpSecure?: boolean; - /** The hostname of the HTTP/2 server */ - grpcHost?: string; - /** The port of the HTTP/2 server */ - grpcPort?: number; - /** Whether to use a secure connection to the HTTP/2 server */ - grpcSecure?: boolean; - /** The authentication credentials to use when connecting to Weaviate, e.g. API key */ - authCredentials?: AuthCredentials; - /** Additional headers to include in the request */ - headers?: Record; - /** The proxy configuration to use */ - proxies?: ProxiesParams; - /** The timeouts to use when making requests to Weaviate */ - timeout?: TimeoutParams; - /** Whether to skip the initialization checks */ - skipInitChecks?: boolean; -}; -export declare function connectToWeaviateCloud( - clusterURL: string, - clientMaker: (params: ClientParams) => Promise, - options?: ConnectToWeaviateCloudOptions -): Promise; -export declare function connectToLocal( - clientMaker: (params: ClientParams) => Promise, - options?: ConnectToLocalOptions -): Promise; -export declare function connectToCustom( - clientMaker: (params: ClientParams) => Promise, - options?: ConnectToCustomOptions -): Promise; diff --git a/dist/node/cjs/connection/helpers.js b/dist/node/cjs/connection/helpers.js deleted file mode 100644 index 6fe3c8f2..00000000 --- a/dist/node/cjs/connection/helpers.js +++ /dev/null @@ -1,82 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.connectToCustom = exports.connectToLocal = exports.connectToWeaviateCloud = void 0; -const errors_js_1 = require('../errors.js'); -function connectToWeaviateCloud(clusterURL, clientMaker, options) { - // check if the URL is set - if (!clusterURL) throw new Error('Missing `clusterURL` parameter'); - if (!clusterURL.startsWith('http')) { - clusterURL = `https://${clusterURL}`; - } - const url = new URL(clusterURL); - let grpcHost; - if (url.hostname.endsWith('.weaviate.network')) { - const [ident, ...rest] = url.hostname.split('.'); - grpcHost = `${ident}.grpc.${rest.join('.')}`; - } else { - grpcHost = `grpc-${url.hostname}`; - } - return clientMaker({ - connectionParams: { - http: { - secure: true, - host: url.hostname, - port: 443, - }, - grpc: { - secure: true, - host: grpcHost, - port: 443, - }, - }, - auth: options === null || options === void 0 ? void 0 : options.authCredentials, - headers: options === null || options === void 0 ? void 0 : options.headers, - }).catch((e) => { - throw new errors_js_1.WeaviateStartUpError(`Weaviate failed to startup with message: ${e.message}`); - }); -} -exports.connectToWeaviateCloud = connectToWeaviateCloud; -function connectToLocal(clientMaker, options) { - return clientMaker({ - connectionParams: { - http: { - secure: false, - host: (options === null || options === void 0 ? void 0 : options.host) || 'localhost', - port: (options === null || options === void 0 ? void 0 : options.port) || 8080, - }, - grpc: { - secure: false, - host: (options === null || options === void 0 ? void 0 : options.host) || 'localhost', - port: (options === null || options === void 0 ? void 0 : options.grpcPort) || 50051, - }, - }, - auth: options === null || options === void 0 ? void 0 : options.authCredentials, - headers: options === null || options === void 0 ? void 0 : options.headers, - }).catch((e) => { - throw new errors_js_1.WeaviateStartUpError(`Weaviate failed to startup with message: ${e.message}`); - }); -} -exports.connectToLocal = connectToLocal; -function connectToCustom(clientMaker, options) { - return clientMaker({ - connectionParams: { - http: { - secure: (options === null || options === void 0 ? void 0 : options.httpSecure) || false, - host: (options === null || options === void 0 ? void 0 : options.httpHost) || 'localhost', - path: (options === null || options === void 0 ? void 0 : options.httpPath) || '', - port: (options === null || options === void 0 ? void 0 : options.httpPort) || 8080, - }, - grpc: { - secure: (options === null || options === void 0 ? void 0 : options.grpcSecure) || false, - host: (options === null || options === void 0 ? void 0 : options.grpcHost) || 'localhost', - port: (options === null || options === void 0 ? void 0 : options.grpcPort) || 50051, - }, - }, - auth: options === null || options === void 0 ? void 0 : options.authCredentials, - headers: options === null || options === void 0 ? void 0 : options.headers, - proxies: options === null || options === void 0 ? void 0 : options.proxies, - }).catch((e) => { - throw new errors_js_1.WeaviateStartUpError(`Weaviate failed to startup with message: ${e.message}`); - }); -} -exports.connectToCustom = connectToCustom; diff --git a/dist/node/cjs/connection/http.d.ts b/dist/node/cjs/connection/http.d.ts deleted file mode 100644 index 79b26a66..00000000 --- a/dist/node/cjs/connection/http.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -/// -import { Agent } from 'http'; -import { - ApiKey, - AuthAccessTokenCredentials, - AuthClientCredentials, - AuthUserPasswordCredentials, - OidcAuthenticator, -} from './auth.js'; -/** - * You can only specify the gRPC proxy URL at this point in time. This is because ProxiesParams should be used to define tunnelling proxies - * and Weaviate does not support tunnelling proxies over HTTP/1.1 at this time. - * - * To use a forwarding proxy you should instead specify its URL as if it were the Weaviate instance itself. - */ -export type ProxiesParams = { - grpc?: string; -}; -export type TimeoutParams = { - /** Define the configured timeout when querying data from Weaviate */ - query?: number; - /** Define the configured timeout when mutating data to Weaviate */ - insert?: number; - /** Define the configured timeout when initially connecting to Weaviate */ - init?: number; -}; -export type InternalConnectionParams = { - authClientSecret?: AuthClientCredentials | AuthAccessTokenCredentials | AuthUserPasswordCredentials; - apiKey?: ApiKey; - host: string; - scheme?: string; - headers?: HeadersInit; - grpcProxyUrl?: string; - agent?: Agent; - timeout?: TimeoutParams; - skipInitChecks?: boolean; -}; -export default class ConnectionREST { - private apiKey?; - protected authEnabled: boolean; - readonly host: string; - readonly http: HttpClient; - oidcAuth?: OidcAuthenticator; - constructor(params: InternalConnectionParams); - private parseAuthParams; - private sanitizeParams; - postReturn: (path: string, payload: B) => Promise; - postEmpty: (path: string, payload: B) => Promise; - put: (path: string, payload: any, expectReturnContent?: boolean) => any; - patch: (path: string, payload: any) => any; - delete: (path: string, payload: any, expectReturnContent?: boolean) => any; - head: (path: string, payload: any) => any; - get: (path: string, expectReturnContent?: boolean) => any; - login: () => Promise; -} -export * from './auth.js'; -export interface HttpClient { - close: () => void; - patch: (path: string, payload: any, bearerToken?: string) => any; - head: (path: string, payload: any, bearerToken?: string) => any; - post: ( - path: string, - payload: B, - expectReturnContent: boolean, - bearerToken: string - ) => Promise; - get: (path: string, expectReturnContent?: boolean, bearerToken?: string) => any; - externalPost: (externalUrl: string, body: any, contentType: any) => any; - getRaw: (path: string, bearerToken?: string) => any; - delete: (path: string, payload: any, expectReturnContent?: boolean, bearerToken?: string) => any; - put: (path: string, payload: any, expectReturnContent?: boolean, bearerToken?: string) => any; - externalGet: (externalUrl: string) => Promise; -} -export declare const httpClient: (config: InternalConnectionParams) => HttpClient; diff --git a/dist/node/cjs/connection/http.js b/dist/node/cjs/connection/http.js deleted file mode 100644 index 47e7c532..00000000 --- a/dist/node/cjs/connection/http.js +++ /dev/null @@ -1,362 +0,0 @@ -'use strict'; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __exportStar = - (this && this.__exportStar) || - function (m, exports) { - for (var p in m) - if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) - __createBinding(exports, m, p); - }; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.httpClient = void 0; -const abort_controller_x_1 = require('abort-controller-x'); -const openidConfigurationGetter_js_1 = __importDefault(require('../misc/openidConfigurationGetter.js')); -const errors_js_1 = require('../errors.js'); -const auth_js_1 = require('./auth.js'); -class ConnectionREST { - constructor(params) { - this.postReturn = (path, payload) => { - if (this.authEnabled) { - return this.login().then((token) => this.http.post(path, payload, true, token).then((res) => res)); - } - return this.http.post(path, payload, true, '').then((res) => res); - }; - this.postEmpty = (path, payload) => { - if (this.authEnabled) { - return this.login().then((token) => this.http.post(path, payload, false, token)); - } - return this.http.post(path, payload, false, ''); - }; - this.put = (path, payload, expectReturnContent = true) => { - if (this.authEnabled) { - return this.login().then((token) => this.http.put(path, payload, expectReturnContent, token)); - } - return this.http.put(path, payload, expectReturnContent); - }; - this.patch = (path, payload) => { - if (this.authEnabled) { - return this.login().then((token) => this.http.patch(path, payload, token)); - } - return this.http.patch(path, payload); - }; - this.delete = (path, payload, expectReturnContent = false) => { - if (this.authEnabled) { - return this.login().then((token) => this.http.delete(path, payload, expectReturnContent, token)); - } - return this.http.delete(path, payload, expectReturnContent); - }; - this.head = (path, payload) => { - if (this.authEnabled) { - return this.login().then((token) => this.http.head(path, payload, token)); - } - return this.http.head(path, payload); - }; - this.get = (path, expectReturnContent = true) => { - if (this.authEnabled) { - return this.login().then((token) => this.http.get(path, expectReturnContent, token)); - } - return this.http.get(path, expectReturnContent); - }; - this.login = () => - __awaiter(this, void 0, void 0, function* () { - if (this.apiKey) { - return this.apiKey; - } - if (!this.oidcAuth) { - return ''; - } - const localConfig = yield new openidConfigurationGetter_js_1.default(this.http).do(); - if (localConfig === undefined) { - console.warn('client is configured for authentication, but server is not'); - return ''; - } - if (Date.now() >= this.oidcAuth.getExpiresAt()) { - yield this.oidcAuth.refresh(localConfig); - } - return this.oidcAuth.getAccessToken(); - }); - params = this.sanitizeParams(params); - this.host = params.host; - this.http = (0, exports.httpClient)(params); - this.authEnabled = this.parseAuthParams(params); - } - parseAuthParams(params) { - var _a; - if (params.authClientSecret && params.apiKey) { - throw new errors_js_1.WeaviateInvalidInputError( - 'must provide one of authClientSecret (OIDC) or apiKey, cannot provide both' - ); - } - if (params.authClientSecret) { - this.oidcAuth = new auth_js_1.OidcAuthenticator(this.http, params.authClientSecret); - return true; - } - if (params.apiKey) { - this.apiKey = (_a = params.apiKey) === null || _a === void 0 ? void 0 : _a.apiKey; - return true; - } - return false; - } - sanitizeParams(params) { - // Remove trailing slashes from the host - while (params.host.endsWith('/')) { - params.host = params.host.slice(0, -1); - } - const protocolPattern = /^(https?|ftp|file)(?::\/\/)/; - const extractedSchemeMatch = params.host.match(protocolPattern); - // Check for the existence of scheme in params - if (params.scheme) { - // If the host contains a scheme different than provided scheme, replace it and throw a warning - if (extractedSchemeMatch && extractedSchemeMatch[1] !== `${params.scheme}`) { - throw new errors_js_1.WeaviateInvalidInputError( - `The host contains a different protocol than specified in the scheme (scheme: ${params.scheme} != host: ${extractedSchemeMatch[1]})` - ); - } else if (!extractedSchemeMatch) { - // If no scheme in the host, simply prefix with the provided scheme - params.host = `${params.scheme}://${params.host}`; - } - // If there's no scheme in params, ensure the host starts with a recognized protocol - } else if (!extractedSchemeMatch) { - throw new errors_js_1.WeaviateInvalidInputError( - 'The host must start with a recognized protocol (e.g., http or https) if no scheme is provided.' - ); - } - return params; - } -} -exports.default = ConnectionREST; -__exportStar(require('./auth.js'), exports); -const fetchWithTimeout = (input, timeout, init) => { - const controller = new AbortController(); - // Set a timeout to abort the request - const timeoutId = setTimeout(() => controller.abort(), timeout * 1000); - return fetch(input, Object.assign(Object.assign({}, init), { signal: controller.signal })) - .catch((error) => { - if ((0, abort_controller_x_1.isAbortError)(error)) { - throw new errors_js_1.WeaviateRequestTimeoutError(`Request timed out after ${timeout}ms`); - } - throw error; // For other errors, rethrow them - }) - .finally(() => clearTimeout(timeoutId)); -}; -const httpClient = (config) => { - const version = '/v1'; - const baseUri = `${config.host}${version}`; - const url = makeUrl(baseUri); - return { - close: () => { - var _a; - return (_a = config.agent) === null || _a === void 0 ? void 0 : _a.destroy(); - }, - post: (path, payload, expectReturnContent, bearerToken) => { - var _a; - const request = { - method: 'POST', - headers: Object.assign(Object.assign({}, config.headers), { 'content-type': 'application/json' }), - body: JSON.stringify(payload), - agent: config.agent, - }; - addAuthHeaderIfNeeded(request, bearerToken); - return fetchWithTimeout( - url(path), - ((_a = config.timeout) === null || _a === void 0 ? void 0 : _a.insert) || 90, - request - ).then(checkStatus(expectReturnContent)); - }, - put: (path, payload, expectReturnContent = true, bearerToken = '') => { - var _a; - const request = { - method: 'PUT', - headers: Object.assign(Object.assign({}, config.headers), { 'content-type': 'application/json' }), - body: JSON.stringify(payload), - agent: config.agent, - }; - addAuthHeaderIfNeeded(request, bearerToken); - return fetchWithTimeout( - url(path), - ((_a = config.timeout) === null || _a === void 0 ? void 0 : _a.insert) || 90, - request - ).then(checkStatus(expectReturnContent)); - }, - patch: (path, payload, bearerToken = '') => { - var _a; - const request = { - method: 'PATCH', - headers: Object.assign(Object.assign({}, config.headers), { 'content-type': 'application/json' }), - body: JSON.stringify(payload), - agent: config.agent, - }; - addAuthHeaderIfNeeded(request, bearerToken); - return fetchWithTimeout( - url(path), - ((_a = config.timeout) === null || _a === void 0 ? void 0 : _a.insert) || 90, - request - ).then(checkStatus(false)); - }, - delete: (path, payload = null, expectReturnContent = false, bearerToken = '') => { - var _a; - const request = { - method: 'DELETE', - headers: Object.assign(Object.assign({}, config.headers), { 'content-type': 'application/json' }), - body: payload ? JSON.stringify(payload) : undefined, - agent: config.agent, - }; - addAuthHeaderIfNeeded(request, bearerToken); - return fetchWithTimeout( - url(path), - ((_a = config.timeout) === null || _a === void 0 ? void 0 : _a.insert) || 90, - request - ).then(checkStatus(expectReturnContent)); - }, - head: (path, payload = null, bearerToken = '') => { - var _a; - const request = { - method: 'HEAD', - headers: Object.assign(Object.assign({}, config.headers), { 'content-type': 'application/json' }), - body: payload ? JSON.stringify(payload) : undefined, - agent: config.agent, - }; - addAuthHeaderIfNeeded(request, bearerToken); - return fetchWithTimeout( - url(path), - ((_a = config.timeout) === null || _a === void 0 ? void 0 : _a.query) || 30, - request - ).then(handleHeadResponse(false)); - }, - get: (path, expectReturnContent = true, bearerToken = '') => { - var _a; - const request = { - method: 'GET', - headers: Object.assign({}, config.headers), - agent: config.agent, - }; - addAuthHeaderIfNeeded(request, bearerToken); - return fetchWithTimeout( - url(path), - ((_a = config.timeout) === null || _a === void 0 ? void 0 : _a.query) || 30, - request - ).then(checkStatus(expectReturnContent)); - }, - getRaw: (path, bearerToken = '') => { - var _a; - // getRaw does not handle the status leaving this to the caller - const request = { - method: 'GET', - headers: Object.assign({}, config.headers), - agent: config.agent, - }; - addAuthHeaderIfNeeded(request, bearerToken); - return fetchWithTimeout( - url(path), - ((_a = config.timeout) === null || _a === void 0 ? void 0 : _a.query) || 30, - request - ); - }, - externalGet: (externalUrl) => { - return fetch(externalUrl, { - method: 'GET', - headers: Object.assign({}, config.headers), - }).then(checkStatus(true)); - }, - externalPost: (externalUrl, body, contentType) => { - if (contentType == undefined || contentType == '') { - contentType = 'application/json'; - } - const request = { - body: undefined, - method: 'POST', - headers: Object.assign(Object.assign({}, config.headers), { 'content-type': contentType }), - }; - if (body != null) { - request.body = body; - } - return fetch(externalUrl, request).then(checkStatus(true)); - }, - }; -}; -exports.httpClient = httpClient; -const makeUrl = (basePath) => (path) => basePath + path; -const checkStatus = (expectResponseBody) => (res) => { - if (res.status >= 400) { - return res.text().then((errText) => { - let err; - try { - // in case of invalid json response (like empty string) - err = JSON.stringify(JSON.parse(errText)); - } catch (e) { - err = errText; - } - return Promise.reject(new errors_js_1.WeaviateUnexpectedStatusCodeError(res.status, err)); - }); - } - if (expectResponseBody) { - return res.json(); - } - return Promise.resolve(undefined); -}; -const handleHeadResponse = (expectResponseBody) => (res) => { - if (res.status == 200 || res.status == 204 || res.status == 404) { - return Promise.resolve(res.status == 200 || res.status == 204); - } - return checkStatus(expectResponseBody)(res); -}; -function addAuthHeaderIfNeeded(request, bearerToken) { - if (bearerToken !== '') { - request.headers.Authorization = `Bearer ${bearerToken}`; - } -} diff --git a/dist/node/cjs/connection/index.d.ts b/dist/node/cjs/connection/index.d.ts deleted file mode 100644 index c71e2176..00000000 --- a/dist/node/cjs/connection/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import ConnectionGQL from './gql.js'; -import ConnectionGRPC from './grpc.js'; -import ConnectionREST from './http.js'; -export default ConnectionGQL; -export type { - ConnectToCustomOptions, - ConnectToLocalOptions, - ConnectToWCDOptions, - ConnectToWCSOptions, - ConnectToWeaviateCloudOptions, -} from './helpers.js'; -export type { InternalConnectionParams } from './http.js'; -export { ConnectionGQL, ConnectionGRPC, ConnectionREST }; diff --git a/dist/node/cjs/connection/index.js b/dist/node/cjs/connection/index.js deleted file mode 100644 index bd3ba179..00000000 --- a/dist/node/cjs/connection/index.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.ConnectionREST = exports.ConnectionGRPC = exports.ConnectionGQL = void 0; -const gql_js_1 = __importDefault(require('./gql.js')); -exports.ConnectionGQL = gql_js_1.default; -const grpc_js_1 = __importDefault(require('./grpc.js')); -exports.ConnectionGRPC = grpc_js_1.default; -const http_js_1 = __importDefault(require('./http.js')); -exports.ConnectionREST = http_js_1.default; -exports.default = gql_js_1.default; diff --git a/dist/node/cjs/data/checker.d.ts b/dist/node/cjs/data/checker.d.ts deleted file mode 100644 index 59e4744d..00000000 --- a/dist/node/cjs/data/checker.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ObjectsPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class Checker extends CommandBase { - private className; - private consistencyLevel?; - private id; - private tenant?; - private objectsPath; - constructor(client: Connection, objectsPath: ObjectsPath); - withId: (id: string) => this; - withClassName: (className: string) => this; - withTenant: (tenant: string) => this; - withConsistencyLevel: (consistencyLevel: ConsistencyLevel) => this; - buildPath: () => Promise; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validateId: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/data/checker.js b/dist/node/cjs/data/checker.js deleted file mode 100644 index 84fe4a68..00000000 --- a/dist/node/cjs/data/checker.js +++ /dev/null @@ -1,47 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class Checker extends commandBase_js_1.CommandBase { - constructor(client, objectsPath) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.withConsistencyLevel = (consistencyLevel) => { - this.consistencyLevel = consistencyLevel; - return this; - }; - this.buildPath = () => { - return this.objectsPath.buildCheck(this.id, this.className, this.consistencyLevel, this.tenant); - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validateId = () => { - this.validateIsSet(this.id, 'id', '.withId(id)'); - }; - this.validate = () => { - this.validateId(); - }; - this.do = () => { - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - this.validate(); - return this.buildPath().then((path) => this.client.head(path, undefined)); - }; - this.objectsPath = objectsPath; - } -} -exports.default = Checker; diff --git a/dist/node/cjs/data/creator.d.ts b/dist/node/cjs/data/creator.d.ts deleted file mode 100644 index ebddc382..00000000 --- a/dist/node/cjs/data/creator.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import Connection from '../connection/index.js'; -import { Properties, WeaviateObject } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ObjectsPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class Creator extends CommandBase { - private className?; - private consistencyLevel?; - private id?; - private objectsPath; - private properties?; - private vector?; - private vectors?; - private tenant?; - constructor(client: Connection, objectsPath: ObjectsPath); - withVector: (vector: number[]) => this; - withVectors: (vectors: Record) => this; - withClassName: (className: string) => this; - withProperties: (properties: Properties) => this; - withId: (id: string) => this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withTenant: (tenant: string) => this; - validateClassName: () => void; - payload: () => WeaviateObject; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/data/creator.js b/dist/node/cjs/data/creator.js deleted file mode 100644 index debc009b..00000000 --- a/dist/node/cjs/data/creator.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const string_js_1 = require('../validation/string.js'); -class Creator extends commandBase_js_1.CommandBase { - constructor(client, objectsPath) { - super(client); - this.withVector = (vector) => { - this.vector = vector; - return this; - }; - this.withVectors = (vectors) => { - this.vectors = vectors; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withProperties = (properties) => { - this.properties = properties; - return this; - }; - this.withId = (id) => { - this.id = id; - return this; - }; - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateClassName = () => { - if (!(0, string_js_1.isValidStringProperty)(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.payload = () => ({ - tenant: this.tenant, - vector: this.vector, - properties: this.properties, - class: this.className, - id: this.id, - vectors: this.vectors, - }); - this.validate = () => { - this.validateClassName(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - return this.objectsPath - .buildCreate(this.consistencyLevel) - .then((path) => this.client.postReturn(path, this.payload())); - }; - this.objectsPath = objectsPath; - } -} -exports.default = Creator; diff --git a/dist/node/cjs/data/deleter.d.ts b/dist/node/cjs/data/deleter.d.ts deleted file mode 100644 index e1a4633a..00000000 --- a/dist/node/cjs/data/deleter.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ObjectsPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class Deleter extends CommandBase { - private className; - private consistencyLevel?; - private id; - private tenant?; - private objectsPath; - constructor(client: Connection, objectsPath: ObjectsPath); - withId: (id: string) => this; - withClassName: (className: string) => this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withTenant: (tenant: string) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validateId: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/data/deleter.js b/dist/node/cjs/data/deleter.js deleted file mode 100644 index 5b33948d..00000000 --- a/dist/node/cjs/data/deleter.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class Deleter extends commandBase_js_1.CommandBase { - constructor(client, objectsPath) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validateId = () => { - this.validateIsSet(this.id, 'id', '.withId(id)'); - }; - this.validate = () => { - this.validateId(); - }; - this.do = () => { - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - this.validate(); - return this.objectsPath - .buildDelete(this.id, this.className, this.consistencyLevel, this.tenant) - .then((path) => { - return this.client.delete(path, undefined, false); - }); - }; - this.objectsPath = objectsPath; - } -} -exports.default = Deleter; diff --git a/dist/node/cjs/data/getter.d.ts b/dist/node/cjs/data/getter.d.ts deleted file mode 100644 index 3c144d74..00000000 --- a/dist/node/cjs/data/getter.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import Connection from '../connection/index.js'; -import { WeaviateObjectsList } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ObjectsPath } from './path.js'; -export default class Getter extends CommandBase { - private additional; - private after; - private className?; - private limit?; - private tenant?; - private objectsPath; - constructor(client: Connection, objectsPath: ObjectsPath); - withClassName: (className: string) => this; - withAfter: (id: string) => this; - withLimit: (limit: number) => this; - withTenant: (tenant: string) => this; - extendAdditional: (prop: string) => this; - withAdditional: (additionalFlag: any) => this; - withVector: () => this; - validate(): void; - do: () => Promise; -} diff --git a/dist/node/cjs/data/getter.js b/dist/node/cjs/data/getter.js deleted file mode 100644 index 6661bbba..00000000 --- a/dist/node/cjs/data/getter.js +++ /dev/null @@ -1,46 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class Getter extends commandBase_js_1.CommandBase { - constructor(client, objectsPath) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withAfter = (id) => { - this.after = id; - return this; - }; - this.withLimit = (limit) => { - this.limit = limit; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.extendAdditional = (prop) => { - this.additional = [...this.additional, prop]; - return this; - }; - this.withAdditional = (additionalFlag) => this.extendAdditional(additionalFlag); - this.withVector = () => this.extendAdditional('vector'); - this.do = () => { - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - return this.objectsPath - .buildGet(this.className, this.limit, this.additional, this.after, this.tenant) - .then((path) => { - return this.client.get(path); - }); - }; - this.objectsPath = objectsPath; - this.additional = []; - } - validate() { - // nothing to validate - } -} -exports.default = Getter; diff --git a/dist/node/cjs/data/getterById.d.ts b/dist/node/cjs/data/getterById.d.ts deleted file mode 100644 index ec45df61..00000000 --- a/dist/node/cjs/data/getterById.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import Connection from '../connection/index.js'; -import { WeaviateObject } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ObjectsPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class GetterById extends CommandBase { - private additional; - private className; - private id; - private consistencyLevel?; - private nodeName?; - private tenant?; - private objectsPath; - constructor(client: Connection, objectsPath: ObjectsPath); - withId: (id: string) => this; - withClassName: (className: string) => this; - withTenant: (tenant: string) => this; - extendAdditional: (prop: string) => this; - withAdditional: (additionalFlag: string) => this; - withVector: () => this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withNodeName: (nodeName: string) => this; - validateId: () => void; - validate: () => void; - buildPath: () => Promise; - do: () => Promise; -} diff --git a/dist/node/cjs/data/getterById.js b/dist/node/cjs/data/getterById.js deleted file mode 100644 index 8d4b0f05..00000000 --- a/dist/node/cjs/data/getterById.js +++ /dev/null @@ -1,64 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class GetterById extends commandBase_js_1.CommandBase { - constructor(client, objectsPath) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.extendAdditional = (prop) => { - this.additional = [...this.additional, prop]; - return this; - }; - this.withAdditional = (additionalFlag) => this.extendAdditional(additionalFlag); - this.withVector = () => this.extendAdditional('vector'); - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.withNodeName = (nodeName) => { - this.nodeName = nodeName; - return this; - }; - this.validateId = () => { - if (this.id == undefined || this.id == null || this.id.length == 0) { - this.addError('id must be set - initialize with getterById(id)'); - } - }; - this.validate = () => { - this.validateId(); - }; - this.buildPath = () => { - return this.objectsPath.buildGetOne( - this.id, - this.className, - this.additional, - this.consistencyLevel, - this.nodeName, - this.tenant - ); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - return this.buildPath().then((path) => { - return this.client.get(path); - }); - }; - this.objectsPath = objectsPath; - this.additional = []; - } -} -exports.default = GetterById; diff --git a/dist/node/cjs/data/index.d.ts b/dist/node/cjs/data/index.d.ts deleted file mode 100644 index 275e4cc7..00000000 --- a/dist/node/cjs/data/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import Connection from '../connection/index.js'; -import { DbVersionSupport } from '../utils/dbVersion.js'; -import Checker from './checker.js'; -import Creator from './creator.js'; -import Deleter from './deleter.js'; -import Getter from './getter.js'; -import GetterById from './getterById.js'; -import Merger from './merger.js'; -import ReferenceCreator from './referenceCreator.js'; -import ReferenceDeleter from './referenceDeleter.js'; -import ReferencePayloadBuilder from './referencePayloadBuilder.js'; -import ReferenceReplacer from './referenceReplacer.js'; -import Updater from './updater.js'; -import Validator from './validator.js'; -export interface Data { - creator: () => Creator; - validator: () => Validator; - updater: () => Updater; - merger: () => Merger; - getter: () => Getter; - getterById: () => GetterById; - deleter: () => Deleter; - checker: () => Checker; - referenceCreator: () => ReferenceCreator; - referenceReplacer: () => ReferenceReplacer; - referenceDeleter: () => ReferenceDeleter; - referencePayloadBuilder: () => ReferencePayloadBuilder; -} -declare const data: (client: Connection, dbVersionSupport: DbVersionSupport) => Data; -export default data; -export { default as Checker } from './checker.js'; -export { default as Creator } from './creator.js'; -export { default as Deleter } from './deleter.js'; -export { default as Getter } from './getter.js'; -export { default as GetterById } from './getterById.js'; -export { default as Merger } from './merger.js'; -export { default as ReferenceCreator } from './referenceCreator.js'; -export { default as ReferenceDeleter } from './referenceDeleter.js'; -export { default as ReferencePayloadBuilder } from './referencePayloadBuilder.js'; -export { default as ReferenceReplacer } from './referenceReplacer.js'; -export type { ConsistencyLevel } from './replication.js'; -export { default as Updater } from './updater.js'; -export { default as Validator } from './validator.js'; diff --git a/dist/node/cjs/data/index.js b/dist/node/cjs/data/index.js deleted file mode 100644 index e3c235a6..00000000 --- a/dist/node/cjs/data/index.js +++ /dev/null @@ -1,138 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.Validator = - exports.Updater = - exports.ReferenceReplacer = - exports.ReferencePayloadBuilder = - exports.ReferenceDeleter = - exports.ReferenceCreator = - exports.Merger = - exports.GetterById = - exports.Getter = - exports.Deleter = - exports.Creator = - exports.Checker = - void 0; -const beaconPath_js_1 = require('../utils/beaconPath.js'); -const checker_js_1 = __importDefault(require('./checker.js')); -const creator_js_1 = __importDefault(require('./creator.js')); -const deleter_js_1 = __importDefault(require('./deleter.js')); -const getter_js_1 = __importDefault(require('./getter.js')); -const getterById_js_1 = __importDefault(require('./getterById.js')); -const merger_js_1 = __importDefault(require('./merger.js')); -const path_js_1 = require('./path.js'); -const referenceCreator_js_1 = __importDefault(require('./referenceCreator.js')); -const referenceDeleter_js_1 = __importDefault(require('./referenceDeleter.js')); -const referencePayloadBuilder_js_1 = __importDefault(require('./referencePayloadBuilder.js')); -const referenceReplacer_js_1 = __importDefault(require('./referenceReplacer.js')); -const updater_js_1 = __importDefault(require('./updater.js')); -const validator_js_1 = __importDefault(require('./validator.js')); -const data = (client, dbVersionSupport) => { - const objectsPath = new path_js_1.ObjectsPath(dbVersionSupport); - const referencesPath = new path_js_1.ReferencesPath(dbVersionSupport); - const beaconPath = new beaconPath_js_1.BeaconPath(dbVersionSupport); - return { - creator: () => new creator_js_1.default(client, objectsPath), - validator: () => new validator_js_1.default(client), - updater: () => new updater_js_1.default(client, objectsPath), - merger: () => new merger_js_1.default(client, objectsPath), - getter: () => new getter_js_1.default(client, objectsPath), - getterById: () => new getterById_js_1.default(client, objectsPath), - deleter: () => new deleter_js_1.default(client, objectsPath), - checker: () => new checker_js_1.default(client, objectsPath), - referenceCreator: () => new referenceCreator_js_1.default(client, referencesPath, beaconPath), - referenceReplacer: () => new referenceReplacer_js_1.default(client, referencesPath, beaconPath), - referenceDeleter: () => new referenceDeleter_js_1.default(client, referencesPath, beaconPath), - referencePayloadBuilder: () => new referencePayloadBuilder_js_1.default(client), - }; -}; -exports.default = data; -var checker_js_2 = require('./checker.js'); -Object.defineProperty(exports, 'Checker', { - enumerable: true, - get: function () { - return __importDefault(checker_js_2).default; - }, -}); -var creator_js_2 = require('./creator.js'); -Object.defineProperty(exports, 'Creator', { - enumerable: true, - get: function () { - return __importDefault(creator_js_2).default; - }, -}); -var deleter_js_2 = require('./deleter.js'); -Object.defineProperty(exports, 'Deleter', { - enumerable: true, - get: function () { - return __importDefault(deleter_js_2).default; - }, -}); -var getter_js_2 = require('./getter.js'); -Object.defineProperty(exports, 'Getter', { - enumerable: true, - get: function () { - return __importDefault(getter_js_2).default; - }, -}); -var getterById_js_2 = require('./getterById.js'); -Object.defineProperty(exports, 'GetterById', { - enumerable: true, - get: function () { - return __importDefault(getterById_js_2).default; - }, -}); -var merger_js_2 = require('./merger.js'); -Object.defineProperty(exports, 'Merger', { - enumerable: true, - get: function () { - return __importDefault(merger_js_2).default; - }, -}); -var referenceCreator_js_2 = require('./referenceCreator.js'); -Object.defineProperty(exports, 'ReferenceCreator', { - enumerable: true, - get: function () { - return __importDefault(referenceCreator_js_2).default; - }, -}); -var referenceDeleter_js_2 = require('./referenceDeleter.js'); -Object.defineProperty(exports, 'ReferenceDeleter', { - enumerable: true, - get: function () { - return __importDefault(referenceDeleter_js_2).default; - }, -}); -var referencePayloadBuilder_js_2 = require('./referencePayloadBuilder.js'); -Object.defineProperty(exports, 'ReferencePayloadBuilder', { - enumerable: true, - get: function () { - return __importDefault(referencePayloadBuilder_js_2).default; - }, -}); -var referenceReplacer_js_2 = require('./referenceReplacer.js'); -Object.defineProperty(exports, 'ReferenceReplacer', { - enumerable: true, - get: function () { - return __importDefault(referenceReplacer_js_2).default; - }, -}); -var updater_js_2 = require('./updater.js'); -Object.defineProperty(exports, 'Updater', { - enumerable: true, - get: function () { - return __importDefault(updater_js_2).default; - }, -}); -var validator_js_2 = require('./validator.js'); -Object.defineProperty(exports, 'Validator', { - enumerable: true, - get: function () { - return __importDefault(validator_js_2).default; - }, -}); diff --git a/dist/node/cjs/data/merger.d.ts b/dist/node/cjs/data/merger.d.ts deleted file mode 100644 index fdbb7f97..00000000 --- a/dist/node/cjs/data/merger.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import Connection from '../connection/index.js'; -import { Properties, WeaviateObject } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ObjectsPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class Merger extends CommandBase { - private className; - private consistencyLevel?; - private id; - private objectsPath; - private properties?; - private tenant?; - constructor(client: Connection, objectsPath: ObjectsPath); - withProperties: (properties: Properties) => this; - withClassName: (className: string) => this; - withId: (id: string) => this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withTenant: (tenant: string) => this; - validateClassName: () => void; - validateId: () => void; - payload: () => WeaviateObject; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/data/merger.js b/dist/node/cjs/data/merger.js deleted file mode 100644 index 4119416b..00000000 --- a/dist/node/cjs/data/merger.js +++ /dev/null @@ -1,60 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const string_js_1 = require('../validation/string.js'); -class Merger extends commandBase_js_1.CommandBase { - constructor(client, objectsPath) { - super(client); - this.withProperties = (properties) => { - this.properties = properties; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withId = (id) => { - this.id = id; - return this; - }; - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateClassName = () => { - if (!(0, string_js_1.isValidStringProperty)(this.className)) { - this.addError('className must be set - set with withClassName(className)'); - } - }; - this.validateId = () => { - if (this.id == undefined || this.id == null || this.id.length == 0) { - this.addError('id must be set - set with withId(id)'); - } - }; - this.payload = () => ({ - tenant: this.tenant, - properties: this.properties, - class: this.className, - id: this.id, - }); - this.validate = () => { - this.validateClassName(); - this.validateId(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - return this.objectsPath - .buildMerge(this.id, this.className, this.consistencyLevel) - .then((path) => this.client.patch(path, this.payload())); - }; - this.objectsPath = objectsPath; - } -} -exports.default = Merger; diff --git a/dist/node/cjs/data/path.d.ts b/dist/node/cjs/data/path.d.ts deleted file mode 100644 index 36943fb7..00000000 --- a/dist/node/cjs/data/path.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { DbVersionSupport } from '../utils/dbVersion.js'; -import { ConsistencyLevel } from './replication.js'; -export declare class ObjectsPath { - private dbVersionSupport; - constructor(dbVersionSupport: DbVersionSupport); - buildCreate(consistencyLevel?: string): Promise; - buildDelete(id: string, className: string, consistencyLevel?: string, tenant?: string): Promise; - buildCheck( - id: string, - className: string, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ): Promise; - buildGetOne( - id: string, - className: string, - additional: string[], - consistencyLevel?: ConsistencyLevel, - nodeName?: string, - tenant?: string - ): Promise; - buildGet( - className?: string, - limit?: number, - additional?: string[], - after?: string, - tenant?: string - ): Promise; - buildUpdate(id: string, className: string, consistencyLevel?: string): Promise; - buildMerge(id: string, className: string, consistencyLevel?: string): Promise; - build(params: any, modifiers: any): Promise; - addClassNameDeprecatedNotSupportedCheck(params: any, path: string, support: any): string; - addClassNameDeprecatedCheck(params: any, path: string, support: any): string; - addId(params: any, path: string): string; - addQueryParams(params: any, path: string): string; - addQueryParamsForGet(params: any, path: string, support: any): string; -} -export declare class ReferencesPath { - private dbVersionSupport; - constructor(dbVersionSupport: DbVersionSupport); - build( - id: string, - className: string, - property: string, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ): Promise; -} diff --git a/dist/node/cjs/data/path.js b/dist/node/cjs/data/path.js deleted file mode 100644 index 11bf445d..00000000 --- a/dist/node/cjs/data/path.js +++ /dev/null @@ -1,178 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.ReferencesPath = exports.ObjectsPath = void 0; -const string_js_1 = require('../validation/string.js'); -const version_js_1 = require('../validation/version.js'); -const objectsPathPrefix = '/objects'; -class ObjectsPath { - constructor(dbVersionSupport) { - this.dbVersionSupport = dbVersionSupport; - } - buildCreate(consistencyLevel) { - return this.build({ consistencyLevel }, [this.addQueryParams]); - } - buildDelete(id, className, consistencyLevel, tenant) { - return this.build({ id, className, consistencyLevel, tenant: tenant }, [ - this.addClassNameDeprecatedNotSupportedCheck, - this.addId, - this.addQueryParams, - ]); - } - buildCheck(id, className, consistencyLevel, tenant) { - return this.build({ id, className, consistencyLevel, tenant }, [ - this.addClassNameDeprecatedNotSupportedCheck, - this.addId, - this.addQueryParams, - ]); - } - buildGetOne(id, className, additional, consistencyLevel, nodeName, tenant) { - return this.build({ id, className, additional: additional, consistencyLevel, nodeName, tenant: tenant }, [ - this.addClassNameDeprecatedNotSupportedCheck, - this.addId, - this.addQueryParams, - ]); - } - buildGet(className, limit, additional, after, tenant) { - return this.build({ className, limit, additional, after, tenant: tenant }, [this.addQueryParamsForGet]); - } - buildUpdate(id, className, consistencyLevel) { - return this.build({ id, className, consistencyLevel }, [ - this.addClassNameDeprecatedCheck, - this.addId, - this.addQueryParams, - ]); - } - buildMerge(id, className, consistencyLevel) { - return this.build({ id, className, consistencyLevel }, [ - this.addClassNameDeprecatedCheck, - this.addId, - this.addQueryParams, - ]); - } - build(params, modifiers) { - return this.dbVersionSupport.supportsClassNameNamespacedEndpointsPromise().then((support) => { - let path = objectsPathPrefix; - modifiers.forEach((modifier) => { - path = modifier(params, path, support); - }); - return path; - }); - } - addClassNameDeprecatedNotSupportedCheck(params, path, support) { - if (support.supports) { - if ((0, string_js_1.isValidStringProperty)(params.className)) { - return `${path}/${params.className}`; - } else { - support.warns.deprecatedNonClassNameNamespacedEndpointsForObjects(); - } - } else { - support.warns.notSupportedClassNamespacedEndpointsForObjects(); - } - return path; - } - addClassNameDeprecatedCheck(params, path, support) { - if (support.supports) { - if ((0, string_js_1.isValidStringProperty)(params.className)) { - return `${path}/${params.className}`; - } else { - support.warns.deprecatedNonClassNameNamespacedEndpointsForObjects(); - } - } - return path; - } - addId(params, path) { - if ((0, string_js_1.isValidStringProperty)(params.id)) { - return `${path}/${params.id}`; - } - return path; - } - addQueryParams(params, path) { - const queryParams = []; - if (Array.isArray(params.additional) && params.additional.length > 0) { - queryParams.push(`include=${params.additional.join(',')}`); - } - if ((0, string_js_1.isValidStringProperty)(params.nodeName)) { - queryParams.push(`node_name=${params.nodeName}`); - } - if ((0, string_js_1.isValidStringProperty)(params.consistencyLevel)) { - queryParams.push(`consistency_level=${params.consistencyLevel}`); - } - if ((0, string_js_1.isValidStringProperty)(params.tenant)) { - queryParams.push(`tenant=${params.tenant}`); - } - if (queryParams.length > 0) { - return `${path}?${queryParams.join('&')}`; - } - return path; - } - addQueryParamsForGet(params, path, support) { - const queryParams = []; - if (Array.isArray(params.additional) && params.additional.length > 0) { - queryParams.push(`include=${params.additional.join(',')}`); - } - if (typeof params.limit == 'number' && params.limit > 0) { - queryParams.push(`limit=${params.limit}`); - } - if ((0, string_js_1.isValidStringProperty)(params.className)) { - if (support.supports) { - queryParams.push(`class=${params.className}`); - } else { - support.warns.notSupportedClassParameterInEndpointsForObjects(); - } - } - if ((0, string_js_1.isValidStringProperty)(params.after)) { - queryParams.push(`after=${params.after}`); - } - if ((0, string_js_1.isValidStringProperty)(params.tenant)) { - queryParams.push(`tenant=${params.tenant}`); - } - if (queryParams.length > 0) { - return `${path}?${queryParams.join('&')}`; - } - return path; - } -} -exports.ObjectsPath = ObjectsPath; -class ReferencesPath { - constructor(dbVersionSupport) { - this.dbVersionSupport = dbVersionSupport; - } - build(id, className, property, consistencyLevel, tenant) { - return this.dbVersionSupport.supportsClassNameNamespacedEndpointsPromise().then((support) => { - let path = objectsPathPrefix; - if (support.supports) { - if ((0, string_js_1.isValidStringProperty)(className)) { - path = `${path}/${className}`; - } else { - support.warns.deprecatedNonClassNameNamespacedEndpointsForReferences(); - } - } else { - support.warns.notSupportedClassNamespacedEndpointsForReferences(); - } - if (support.version) { - if (!(0, version_js_1.isValidWeaviateVersion)(support.version)) { - support.warns.deprecatedWeaviateTooOld(); - } - } - if ((0, string_js_1.isValidStringProperty)(id)) { - path = `${path}/${id}`; - } - path = `${path}/references`; - if ((0, string_js_1.isValidStringProperty)(property)) { - path = `${path}/${property}`; - } - const queryParams = []; - if ((0, string_js_1.isValidStringProperty)(consistencyLevel)) { - queryParams.push(`consistency_level=${consistencyLevel}`); - } - if ((0, string_js_1.isValidStringProperty)(tenant)) { - queryParams.push(`tenant=${tenant}`); - } - if (queryParams.length > 0) { - path = `${path}?${queryParams.join('&')}`; - } - return path; - }); - } -} -exports.ReferencesPath = ReferencesPath; diff --git a/dist/node/cjs/data/referenceCreator.d.ts b/dist/node/cjs/data/referenceCreator.d.ts deleted file mode 100644 index c8dd1015..00000000 --- a/dist/node/cjs/data/referenceCreator.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import Connection from '../connection/index.js'; -import { Reference } from '../openapi/types.js'; -import { BeaconPath } from '../utils/beaconPath.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ReferencesPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class ReferenceCreator extends CommandBase { - private beaconPath; - private className; - private consistencyLevel?; - private id; - private reference; - private referencesPath; - private refProp; - private tenant?; - constructor(client: Connection, referencesPath: ReferencesPath, beaconPath: BeaconPath); - withId: (id: string) => this; - withClassName(className: string): this; - withReference: (ref: Reference) => this; - withReferenceProperty: (refProp: string) => this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withTenant: (tenant: string) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - payload: () => { - class?: string | undefined; - schema?: - | { - [key: string]: unknown; - } - | undefined; - beacon?: string | undefined; - href?: string | undefined; - classification?: - | { - overallCount?: number | undefined; - winningCount?: number | undefined; - losingCount?: number | undefined; - closestOverallDistance?: number | undefined; - winningDistance?: number | undefined; - meanWinningDistance?: number | undefined; - closestWinningDistance?: number | undefined; - closestLosingDistance?: number | undefined; - losingDistance?: number | undefined; - meanLosingDistance?: number | undefined; - } - | undefined; - }; - do: () => Promise; -} diff --git a/dist/node/cjs/data/referenceCreator.js b/dist/node/cjs/data/referenceCreator.js deleted file mode 100644 index 35b5b467..00000000 --- a/dist/node/cjs/data/referenceCreator.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class ReferenceCreator extends commandBase_js_1.CommandBase { - constructor(client, referencesPath, beaconPath) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.withReference = (ref) => { - this.reference = ref; - return this; - }; - this.withReferenceProperty = (refProp) => { - this.refProp = refProp; - return this; - }; - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.id, 'id', '.withId(id)'); - this.validateIsSet(this.refProp, 'referenceProperty', '.withReferenceProperty(refProp)'); - }; - this.payload = () => this.reference; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - if (!this.reference.beacon) { - throw new Error('reference beacon must be set'); - } - return Promise.all([ - this.referencesPath.build(this.id, this.className, this.refProp, this.consistencyLevel, this.tenant), - this.beaconPath.rebuild(this.reference.beacon), - ]).then((results) => { - const path = results[0]; - const beacon = results[1]; - return this.client.postEmpty(path, { beacon }); - }); - }; - this.referencesPath = referencesPath; - this.beaconPath = beaconPath; - } - withClassName(className) { - this.className = className; - return this; - } -} -exports.default = ReferenceCreator; diff --git a/dist/node/cjs/data/referenceDeleter.d.ts b/dist/node/cjs/data/referenceDeleter.d.ts deleted file mode 100644 index 9de2f9d3..00000000 --- a/dist/node/cjs/data/referenceDeleter.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import Connection from '../connection/index.js'; -import { Reference } from '../openapi/types.js'; -import { BeaconPath } from '../utils/beaconPath.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ReferencesPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class ReferenceDeleter extends CommandBase { - private beaconPath; - private className; - private consistencyLevel?; - private id; - private reference; - private referencesPath; - private refProp; - private tenant?; - constructor(client: Connection, referencesPath: ReferencesPath, beaconPath: BeaconPath); - withId: (id: string) => this; - withClassName(className: string): this; - withReference: (ref: Reference) => this; - withReferenceProperty: (refProp: string) => this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withTenant: (tenant: string) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - payload: () => { - class?: string | undefined; - schema?: - | { - [key: string]: unknown; - } - | undefined; - beacon?: string | undefined; - href?: string | undefined; - classification?: - | { - overallCount?: number | undefined; - winningCount?: number | undefined; - losingCount?: number | undefined; - closestOverallDistance?: number | undefined; - winningDistance?: number | undefined; - meanWinningDistance?: number | undefined; - closestWinningDistance?: number | undefined; - closestLosingDistance?: number | undefined; - losingDistance?: number | undefined; - meanLosingDistance?: number | undefined; - } - | undefined; - }; - do: () => Promise; -} diff --git a/dist/node/cjs/data/referenceDeleter.js b/dist/node/cjs/data/referenceDeleter.js deleted file mode 100644 index 3f50a7b9..00000000 --- a/dist/node/cjs/data/referenceDeleter.js +++ /dev/null @@ -1,62 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class ReferenceDeleter extends commandBase_js_1.CommandBase { - constructor(client, referencesPath, beaconPath) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.withReference = (ref) => { - this.reference = ref; - return this; - }; - this.withReferenceProperty = (refProp) => { - this.refProp = refProp; - return this; - }; - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.id, 'id', '.withId(id)'); - this.validateIsSet(this.refProp, 'referenceProperty', '.withReferenceProperty(refProp)'); - }; - this.payload = () => this.reference; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - if (!this.reference.beacon) { - throw new Error('reference beacon must be set'); - } - return Promise.all([ - this.referencesPath.build(this.id, this.className, this.refProp, this.consistencyLevel, this.tenant), - this.beaconPath.rebuild(this.reference.beacon), - ]).then((results) => { - const path = results[0]; - const beacon = results[1]; - return this.client.delete(path, { beacon }, false); - }); - }; - this.referencesPath = referencesPath; - this.beaconPath = beaconPath; - } - withClassName(className) { - this.className = className; - return this; - } -} -exports.default = ReferenceDeleter; diff --git a/dist/node/cjs/data/referencePayloadBuilder.d.ts b/dist/node/cjs/data/referencePayloadBuilder.d.ts deleted file mode 100644 index f0ad91be..00000000 --- a/dist/node/cjs/data/referencePayloadBuilder.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Connection from '../connection/index.js'; -import { Reference } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ReferencePayloadBuilder extends CommandBase { - private className?; - private id?; - constructor(client: Connection); - withId: (id: string) => this; - withClassName(className: string): this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - payload: () => Reference; - do(): Promise; -} diff --git a/dist/node/cjs/data/referencePayloadBuilder.js b/dist/node/cjs/data/referencePayloadBuilder.js deleted file mode 100644 index 5636f9eb..00000000 --- a/dist/node/cjs/data/referencePayloadBuilder.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const string_js_1 = require('../validation/string.js'); -class ReferencePayloadBuilder extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.id, 'id', '.withId(id)'); - }; - this.payload = () => { - this.validate(); - if (this.errors.length > 0) { - throw new Error(this.errors.join(', ')); - } - let beacon = `weaviate://localhost`; - if ((0, string_js_1.isValidStringProperty)(this.className)) { - beacon = `${beacon}/${this.className}`; - } - return { - beacon: `${beacon}/${this.id}`, - }; - }; - } - withClassName(className) { - this.className = className; - return this; - } - do() { - return Promise.reject(new Error('Should never be called')); - } -} -exports.default = ReferencePayloadBuilder; diff --git a/dist/node/cjs/data/referenceReplacer.d.ts b/dist/node/cjs/data/referenceReplacer.d.ts deleted file mode 100644 index 855f6299..00000000 --- a/dist/node/cjs/data/referenceReplacer.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -import Connection from '../connection/index.js'; -import { BeaconPath } from '../utils/beaconPath.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ReferencesPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class ReferenceReplacer extends CommandBase { - private beaconPath; - private className; - private consistencyLevel?; - private id; - private references; - private referencesPath; - private refProp; - private tenant?; - constructor(client: Connection, referencesPath: ReferencesPath, beaconPath: BeaconPath); - withId: (id: string) => this; - withClassName(className: string): this; - withReferences: (refs: any) => this; - withReferenceProperty: (refProp: string) => this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withTenant: (tenant: string) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - payload: () => { - class?: string | undefined; - schema?: - | { - [key: string]: unknown; - } - | undefined; - beacon?: string | undefined; - href?: string | undefined; - classification?: - | { - overallCount?: number | undefined; - winningCount?: number | undefined; - losingCount?: number | undefined; - closestOverallDistance?: number | undefined; - winningDistance?: number | undefined; - meanWinningDistance?: number | undefined; - closestWinningDistance?: number | undefined; - closestLosingDistance?: number | undefined; - losingDistance?: number | undefined; - meanLosingDistance?: number | undefined; - } - | undefined; - }[]; - do: () => Promise; - rebuildReferencePromise(reference: any): Promise<{ - beacon: any; - }>; -} diff --git a/dist/node/cjs/data/referenceReplacer.js b/dist/node/cjs/data/referenceReplacer.js deleted file mode 100644 index 6a3a6e1a..00000000 --- a/dist/node/cjs/data/referenceReplacer.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class ReferenceReplacer extends commandBase_js_1.CommandBase { - constructor(client, referencesPath, beaconPath) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.withReferences = (refs) => { - this.references = refs; - return this; - }; - this.withReferenceProperty = (refProp) => { - this.refProp = refProp; - return this; - }; - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.id, 'id', '.withId(id)'); - this.validateIsSet(this.refProp, 'referenceProperty', '.withReferenceProperty(refProp)'); - }; - this.payload = () => this.references; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const payloadPromise = Array.isArray(this.references) - ? Promise.all(this.references.map((ref) => this.rebuildReferencePromise(ref))) - : Promise.resolve([]); - return Promise.all([ - this.referencesPath.build(this.id, this.className, this.refProp, this.consistencyLevel, this.tenant), - payloadPromise, - ]).then((results) => { - const path = results[0]; - const payload = results[1]; - return this.client.put(path, payload, false); - }); - }; - this.beaconPath = beaconPath; - this.referencesPath = referencesPath; - } - withClassName(className) { - this.className = className; - return this; - } - rebuildReferencePromise(reference) { - return this.beaconPath.rebuild(reference.beacon).then((beacon) => ({ beacon })); - } -} -exports.default = ReferenceReplacer; diff --git a/dist/node/cjs/data/replication.d.ts b/dist/node/cjs/data/replication.d.ts deleted file mode 100644 index 67600eb6..00000000 --- a/dist/node/cjs/data/replication.d.ts +++ /dev/null @@ -1 +0,0 @@ -export type ConsistencyLevel = 'ALL' | 'ONE' | 'QUORUM'; diff --git a/dist/node/cjs/data/replication.js b/dist/node/cjs/data/replication.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/data/replication.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/data/updater.d.ts b/dist/node/cjs/data/updater.d.ts deleted file mode 100644 index 2ed24b15..00000000 --- a/dist/node/cjs/data/updater.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import Connection from '../connection/index.js'; -import { Properties, WeaviateObject } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ObjectsPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class Updater extends CommandBase { - private className; - private consistencyLevel?; - private id; - private objectsPath; - private properties?; - private tenant?; - private vector?; - private vectors?; - constructor(client: Connection, objectsPath: ObjectsPath); - withVector: (vector: number[]) => this; - withVectors: (vectors: Record) => this; - withProperties: (properties: Properties) => this; - withId: (id: string) => this; - withClassName: (className: string) => this; - withTenant: (tenant: string) => this; - validateClassName: () => void; - validateId: () => void; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - payload: () => WeaviateObject; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/data/updater.js b/dist/node/cjs/data/updater.js deleted file mode 100644 index 1568c423..00000000 --- a/dist/node/cjs/data/updater.js +++ /dev/null @@ -1,70 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const string_js_1 = require('../validation/string.js'); -class Updater extends commandBase_js_1.CommandBase { - constructor(client, objectsPath) { - super(client); - this.withVector = (vector) => { - this.vector = vector; - return this; - }; - this.withVectors = (vectors) => { - this.vectors = vectors; - return this; - }; - this.withProperties = (properties) => { - this.properties = properties; - return this; - }; - this.withId = (id) => { - this.id = id; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateClassName = () => { - if (!(0, string_js_1.isValidStringProperty)(this.className)) { - this.addError('className must be set - use withClassName(className)'); - } - }; - this.validateId = () => { - if (this.id == undefined || this.id == null || this.id.length == 0) { - this.addError('id must be set - initialize with updater(id)'); - } - }; - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.payload = () => ({ - tenant: this.tenant, - properties: this.properties, - class: this.className, - id: this.id, - vector: this.vector, - vectors: this.vectors, - }); - this.validate = () => { - this.validateClassName(); - this.validateId(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - return this.objectsPath - .buildUpdate(this.id, this.className, this.consistencyLevel) - .then((path) => this.client.put(path, this.payload())); - }; - this.objectsPath = objectsPath; - } -} -exports.default = Updater; diff --git a/dist/node/cjs/data/validator.d.ts b/dist/node/cjs/data/validator.d.ts deleted file mode 100644 index b1b07d56..00000000 --- a/dist/node/cjs/data/validator.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import Connection from '../connection/index.js'; -import { Properties } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class Validator extends CommandBase { - private className?; - private id?; - private properties?; - constructor(client: Connection); - withClassName: (className: string) => this; - withProperties: (properties: Properties) => this; - withId: (id: string) => this; - validateClassName: () => void; - payload: () => { - properties: - | { - [key: string]: unknown; - } - | undefined; - class: string | undefined; - id: string | undefined; - }; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/data/validator.js b/dist/node/cjs/data/validator.js deleted file mode 100644 index ce73b576..00000000 --- a/dist/node/cjs/data/validator.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const string_js_1 = require('../validation/string.js'); -class Validator extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withProperties = (properties) => { - this.properties = properties; - return this; - }; - this.withId = (id) => { - this.id = id; - return this; - }; - this.validateClassName = () => { - if (!(0, string_js_1.isValidStringProperty)(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.payload = () => ({ - properties: this.properties, - class: this.className, - id: this.id, - }); - this.validate = () => { - this.validateClassName(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/objects/validate`; - return this.client.postEmpty(path, this.payload()).then(() => true); - }; - } -} -exports.default = Validator; diff --git a/dist/node/cjs/errors.d.ts b/dist/node/cjs/errors.d.ts deleted file mode 100644 index ef91426d..00000000 --- a/dist/node/cjs/errors.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -declare class WeaviateError extends Error { - message: string; - constructor(message: string); -} -/** - * Is thrown if the input to a function is invalid. - */ -export declare class WeaviateInvalidInputError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown if a query (either gRPC or GraphQL) to Weaviate fails in any way. - */ -export declare class WeaviateQueryError extends WeaviateError { - constructor(message: string, protocolType: 'GraphQL' | 'gRPC'); -} -/** - * Is thrown if a gRPC delete many request to Weaviate fails in any way. - */ -export declare class WeaviateDeleteManyError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown if a gRPC batch query to Weaviate fails in any way. - */ -export declare class WeaviateBatchError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown if the gRPC health check against Weaviate fails. - */ -export declare class WeaviateGRPCUnavailableError extends WeaviateError { - constructor(address: string); -} -/** - * Is thrown if data returned by Weaviate cannot be processed by the client. - */ -export declare class WeaviateDeserializationError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown if data to be sent to Weaviate cannot be processed by the client. - */ -export declare class WeaviateSerializationError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown if Weaviate returns an unexpected status code. - */ -export declare class WeaviateUnexpectedStatusCodeError extends WeaviateError { - code: number; - constructor(code: number, message: string); -} -export declare class WeaviateUnexpectedResponseError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown when a backup creation or restoration fails. - */ -export declare class WeaviateBackupFailed extends WeaviateError { - constructor(message: string, kind: 'creation' | 'restoration'); -} -/** - * Is thrown when a backup creation or restoration fails. - */ -export declare class WeaviateBackupCanceled extends WeaviateError { - constructor(kind: 'creation' | 'restoration'); -} -export declare class WeaviateBackupCancellationError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown if the Weaviate server does not support a feature that the client is trying to use. - */ -export declare class WeaviateUnsupportedFeatureError extends WeaviateError {} -/** - * Is thrown if the Weaviate server was not able to start up. - */ -export declare class WeaviateStartUpError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown if a request to Weaviate times out. - */ -export declare class WeaviateRequestTimeoutError extends WeaviateError { - constructor(message: string); -} -export {}; diff --git a/dist/node/cjs/errors.js b/dist/node/cjs/errors.js deleted file mode 100644 index ebdf90da..00000000 --- a/dist/node/cjs/errors.js +++ /dev/null @@ -1,166 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.WeaviateRequestTimeoutError = - exports.WeaviateStartUpError = - exports.WeaviateUnsupportedFeatureError = - exports.WeaviateBackupCancellationError = - exports.WeaviateBackupCanceled = - exports.WeaviateBackupFailed = - exports.WeaviateUnexpectedResponseError = - exports.WeaviateUnexpectedStatusCodeError = - exports.WeaviateSerializationError = - exports.WeaviateDeserializationError = - exports.WeaviateGRPCUnavailableError = - exports.WeaviateBatchError = - exports.WeaviateDeleteManyError = - exports.WeaviateQueryError = - exports.WeaviateInvalidInputError = - void 0; -class WeaviateError extends Error { - constructor(message) { - super(message); - this.message = message; - this.name = this.constructor.name; - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, this.constructor); - } - } -} -/** - * Is thrown if the input to a function is invalid. - */ -class WeaviateInvalidInputError extends WeaviateError { - constructor(message) { - super(`Invalid input provided: ${message}`); - } -} -exports.WeaviateInvalidInputError = WeaviateInvalidInputError; -/** - * Is thrown if a query (either gRPC or GraphQL) to Weaviate fails in any way. - */ -class WeaviateQueryError extends WeaviateError { - constructor(message, protocolType) { - super(`Query call with protocol ${protocolType} failed with message: ${message}`); - } -} -exports.WeaviateQueryError = WeaviateQueryError; -/** - * Is thrown if a gRPC delete many request to Weaviate fails in any way. - */ -class WeaviateDeleteManyError extends WeaviateError { - constructor(message) { - super(`Delete many failed with message: ${message}`); - } -} -exports.WeaviateDeleteManyError = WeaviateDeleteManyError; -/** - * Is thrown if a gRPC batch query to Weaviate fails in any way. - */ -class WeaviateBatchError extends WeaviateError { - constructor(message) { - super(`Batch objects insert failed with message: ${message}`); - } -} -exports.WeaviateBatchError = WeaviateBatchError; -/** - * Is thrown if the gRPC health check against Weaviate fails. - */ -class WeaviateGRPCUnavailableError extends WeaviateError { - constructor(address) { - const grpcMsg = `Please check that the server address and port: ${address} are correct.`; - const msg = `Weaviate makes use of a high-speed gRPC API as well as a REST API. - Unfortunately, the gRPC health check against Weaviate could not be completed. - - This error could be due to one of several reasons: - - The gRPC traffic at the specified port is blocked by a firewall. - - gRPC is not enabled or incorrectly configured on the server or the client. - - ${grpcMsg} - - your connection is unstable or has a high latency. In this case you can: - - increase init-timeout in weaviate.connectToLocal({timeout: {init: X}})' - - disable startup checks by connecting using 'skipInitChecks=true' - `; - super(msg); - } -} -exports.WeaviateGRPCUnavailableError = WeaviateGRPCUnavailableError; -/** - * Is thrown if data returned by Weaviate cannot be processed by the client. - */ -class WeaviateDeserializationError extends WeaviateError { - constructor(message) { - super(`Converting data from Weaviate failed with message: ${message}`); - } -} -exports.WeaviateDeserializationError = WeaviateDeserializationError; -/** - * Is thrown if data to be sent to Weaviate cannot be processed by the client. - */ -class WeaviateSerializationError extends WeaviateError { - constructor(message) { - super(`Converting data to Weaviate failed with message: ${message}`); - } -} -exports.WeaviateSerializationError = WeaviateSerializationError; -/** - * Is thrown if Weaviate returns an unexpected status code. - */ -class WeaviateUnexpectedStatusCodeError extends WeaviateError { - constructor(code, message) { - super(`The request to Weaviate failed with status code: ${code} and message: ${message}`); - this.code = code; - } -} -exports.WeaviateUnexpectedStatusCodeError = WeaviateUnexpectedStatusCodeError; -class WeaviateUnexpectedResponseError extends WeaviateError { - constructor(message) { - super(`The response from Weaviate was unexpected: ${message}`); - } -} -exports.WeaviateUnexpectedResponseError = WeaviateUnexpectedResponseError; -/** - * Is thrown when a backup creation or restoration fails. - */ -class WeaviateBackupFailed extends WeaviateError { - constructor(message, kind) { - super(`Backup ${kind} failed with message: ${message}`); - } -} -exports.WeaviateBackupFailed = WeaviateBackupFailed; -/** - * Is thrown when a backup creation or restoration fails. - */ -class WeaviateBackupCanceled extends WeaviateError { - constructor(kind) { - super(`Backup ${kind} was canceled`); - } -} -exports.WeaviateBackupCanceled = WeaviateBackupCanceled; -class WeaviateBackupCancellationError extends WeaviateError { - constructor(message) { - super(`Backup cancellation failed with message: ${message}`); - } -} -exports.WeaviateBackupCancellationError = WeaviateBackupCancellationError; -/** - * Is thrown if the Weaviate server does not support a feature that the client is trying to use. - */ -class WeaviateUnsupportedFeatureError extends WeaviateError {} -exports.WeaviateUnsupportedFeatureError = WeaviateUnsupportedFeatureError; -/** - * Is thrown if the Weaviate server was not able to start up. - */ -class WeaviateStartUpError extends WeaviateError { - constructor(message) { - super(`Weaviate startup failed with message: ${message}`); - } -} -exports.WeaviateStartUpError = WeaviateStartUpError; -/** - * Is thrown if a request to Weaviate times out. - */ -class WeaviateRequestTimeoutError extends WeaviateError { - constructor(message) { - super(`Weaviate request timed out with message: ${message}`); - } -} -exports.WeaviateRequestTimeoutError = WeaviateRequestTimeoutError; diff --git a/dist/node/cjs/graphql/aggregator.d.ts b/dist/node/cjs/graphql/aggregator.d.ts deleted file mode 100644 index 46a96044..00000000 --- a/dist/node/cjs/graphql/aggregator.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -import Connection from '../connection/index.js'; -import { WhereFilter } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { NearAudioArgs, NearDepthArgs, NearIMUArgs, NearMediaBase, NearVideoArgs } from './nearMedia.js'; -import { NearObjectArgs } from './nearObject.js'; -import { NearTextArgs } from './nearText.js'; -import { NearVectorArgs } from './nearVector.js'; -interface NearImageArgs extends NearMediaBase { - image: string; -} -export default class Aggregator extends CommandBase { - private className?; - private fields?; - private groupBy?; - private includesNearMediaFilter; - private limit?; - private nearMediaString?; - private nearMediaType?; - private nearObjectString?; - private nearTextString?; - private nearVectorString?; - private objectLimit?; - private whereString?; - private tenant?; - constructor(client: Connection); - withFields: (fields: string) => this; - withClassName: (className: string) => this; - withWhere: (where: WhereFilter) => this; - private withNearMedia; - withNearImage: (args: NearImageArgs) => this; - withNearAudio: (args: NearAudioArgs) => this; - withNearVideo: (args: NearVideoArgs) => this; - withNearDepth: (args: NearDepthArgs) => this; - withNearIMU: (args: NearIMUArgs) => this; - withNearText: (args: NearTextArgs) => this; - withNearObject: (args: NearObjectArgs) => this; - withNearVector: (args: NearVectorArgs) => this; - withObjectLimit: (objectLimit: number) => this; - withLimit: (limit: number) => this; - withGroupBy: (groupBy: string[]) => this; - withTenant: (tenant: string) => this; - validateGroup: () => void; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - do: () => Promise<{ - data: any; - }>; -} -export {}; diff --git a/dist/node/cjs/graphql/aggregator.js b/dist/node/cjs/graphql/aggregator.js deleted file mode 100644 index ef2d89a5..00000000 --- a/dist/node/cjs/graphql/aggregator.js +++ /dev/null @@ -1,248 +0,0 @@ -'use strict'; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, 'default', { enumerable: true, value: v }); - } - : function (o, v) { - o['default'] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) - for (var k in mod) - if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const number_js_1 = require('../validation/number.js'); -const nearMedia_js_1 = __importStar(require('./nearMedia.js')); -const nearObject_js_1 = __importDefault(require('./nearObject.js')); -const nearText_js_1 = __importDefault(require('./nearText.js')); -const nearVector_js_1 = __importDefault(require('./nearVector.js')); -const where_js_1 = __importDefault(require('./where.js')); -class Aggregator extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withFields = (fields) => { - this.fields = fields; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withWhere = (where) => { - try { - this.whereString = new where_js_1.default(where).toString(); - } catch (e) { - this.addError(e); - } - return this; - }; - this.withNearMedia = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearMediaString = new nearMedia_js_1.default(args).toString(); - this.nearMediaType = args.type; - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearImage = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { - media: args.image, - type: nearMedia_js_1.NearMediaType.Image, - }) - ); - }; - this.withNearAudio = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { - media: args.audio, - type: nearMedia_js_1.NearMediaType.Audio, - }) - ); - }; - this.withNearVideo = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { - media: args.video, - type: nearMedia_js_1.NearMediaType.Video, - }) - ); - }; - this.withNearDepth = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { - media: args.depth, - type: nearMedia_js_1.NearMediaType.Depth, - }) - ); - }; - this.withNearIMU = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { media: args.imu, type: nearMedia_js_1.NearMediaType.IMU }) - ); - }; - this.withNearText = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearTextString = new nearText_js_1.default(args).toString(); - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearObject = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearObjectString = new nearObject_js_1.default(args).toString(); - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearVector = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearVectorString = new nearVector_js_1.default(args).toString(); - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withObjectLimit = (objectLimit) => { - if (!(0, number_js_1.isValidPositiveIntProperty)(objectLimit)) { - throw new Error('objectLimit must be a non-negative integer'); - } - this.objectLimit = objectLimit; - return this; - }; - this.withLimit = (limit) => { - this.limit = limit; - return this; - }; - this.withGroupBy = (groupBy) => { - this.groupBy = groupBy; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateGroup = () => { - if (!this.groupBy) { - // nothing to check if this optional parameter is not set - return; - } - if (!Array.isArray(this.groupBy)) { - throw new Error('groupBy must be an array'); - } - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateGroup(); - this.validateIsSet(this.className, 'className', '.withClassName(className)'); - this.validateIsSet(this.fields, 'fields', '.withFields(fields)'); - }; - this.do = () => { - let params = ''; - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - if ( - this.whereString || - this.nearTextString || - this.nearObjectString || - this.nearVectorString || - this.limit || - this.groupBy || - this.tenant - ) { - let args = []; - if (this.whereString) { - args = [...args, `where:${this.whereString}`]; - } - if (this.nearTextString) { - args = [...args, `nearText:${this.nearTextString}`]; - } - if (this.nearObjectString) { - args = [...args, `nearObject:${this.nearObjectString}`]; - } - if (this.nearVectorString) { - args = [...args, `nearVector:${this.nearVectorString}`]; - } - if (this.nearMediaString) { - args = [...args, `${this.nearMediaType}:${this.nearMediaString}`]; - } - if (this.groupBy) { - args = [...args, `groupBy:${JSON.stringify(this.groupBy)}`]; - } - if (this.limit) { - args = [...args, `limit:${this.limit}`]; - } - if (this.objectLimit) { - args = [...args, `objectLimit:${this.objectLimit}`]; - } - if (this.tenant) { - args = [...args, `tenant:"${this.tenant}"`]; - } - params = `(${args.join(',')})`; - } - return this.client.query(`{Aggregate{${this.className}${params}{${this.fields}}}}`); - }; - this.includesNearMediaFilter = false; - } -} -exports.default = Aggregator; diff --git a/dist/node/cjs/graphql/ask.d.ts b/dist/node/cjs/graphql/ask.d.ts deleted file mode 100644 index 888bde59..00000000 --- a/dist/node/cjs/graphql/ask.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export interface AskArgs { - autocorrect?: boolean; - certainty?: number; - distance?: number; - properties?: string[]; - question?: string; - rerank?: boolean; -} -export default class GraphQLAsk { - private autocorrect?; - private certainty?; - private distance?; - private properties?; - private question?; - private rerank?; - constructor(args: AskArgs); - toString(wrap?: boolean): string; - validate(): void; -} diff --git a/dist/node/cjs/graphql/ask.js b/dist/node/cjs/graphql/ask.js deleted file mode 100644 index 39a57324..00000000 --- a/dist/node/cjs/graphql/ask.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -class GraphQLAsk { - constructor(args) { - this.autocorrect = args.autocorrect; - this.certainty = args.certainty; - this.distance = args.distance; - this.properties = args.properties; - this.question = args.question; - this.rerank = args.rerank; - } - toString(wrap = true) { - this.validate(); - let args = []; - if (this.question) { - args = [...args, `question:${JSON.stringify(this.question)}`]; - } - if (this.properties) { - args = [...args, `properties:${JSON.stringify(this.properties)}`]; - } - if (this.certainty) { - args = [...args, `certainty:${this.certainty}`]; - } - if (this.distance) { - args = [...args, `distance:${this.distance}`]; - } - if (this.autocorrect !== undefined) { - args = [...args, `autocorrect:${this.autocorrect}`]; - } - if (this.rerank !== undefined) { - args = [...args, `rerank:${this.rerank}`]; - } - if (!wrap) { - return `${args.join(',')}`; - } - return `{${args.join(',')}}`; - } - validate() { - if (!this.question) { - throw new Error('ask filter: question needs to be set'); - } - } -} -exports.default = GraphQLAsk; diff --git a/dist/node/cjs/graphql/bm25.d.ts b/dist/node/cjs/graphql/bm25.d.ts deleted file mode 100644 index ffbe1ac9..00000000 --- a/dist/node/cjs/graphql/bm25.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface Bm25Args { - properties?: string[]; - query: string; -} -export default class GraphQLBm25 { - private properties?; - private query; - constructor(args: Bm25Args); - toString(): string; -} diff --git a/dist/node/cjs/graphql/bm25.js b/dist/node/cjs/graphql/bm25.js deleted file mode 100644 index d361bcb1..00000000 --- a/dist/node/cjs/graphql/bm25.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -class GraphQLBm25 { - constructor(args) { - this.properties = args.properties; - this.query = args.query; - } - toString() { - let args = [`query:${JSON.stringify(this.query)}`]; // query must always be set - if (this.properties !== undefined) { - args = [...args, `properties:${JSON.stringify(this.properties)}`]; - } - return `{${args.join(',')}}`; - } -} -exports.default = GraphQLBm25; diff --git a/dist/node/cjs/graphql/explorer.d.ts b/dist/node/cjs/graphql/explorer.d.ts deleted file mode 100644 index 9bb646b1..00000000 --- a/dist/node/cjs/graphql/explorer.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { AskArgs } from './ask.js'; -import { NearImageArgs } from './nearImage.js'; -import { NearAudioArgs, NearDepthArgs, NearIMUArgs, NearThermalArgs, NearVideoArgs } from './nearMedia.js'; -import { NearObjectArgs } from './nearObject.js'; -import { NearTextArgs } from './nearText.js'; -import { NearVectorArgs } from './nearVector.js'; -export default class Explorer extends CommandBase { - private askString?; - private fields?; - private group?; - private limit?; - private includesNearMediaFilter; - private nearMediaString?; - private nearMediaType?; - private nearObjectString?; - private nearTextString?; - private nearVectorString?; - private params; - constructor(client: Connection); - withFields: (fields: string) => this; - withLimit: (limit: number) => this; - withNearText: (args: NearTextArgs) => this; - withNearObject: (args: NearObjectArgs) => this; - withAsk: (args: AskArgs) => this; - private withNearMedia; - withNearImage: (args: NearImageArgs) => this; - withNearAudio: (args: NearAudioArgs) => this; - withNearVideo: (args: NearVideoArgs) => this; - withNearDepth: (args: NearDepthArgs) => this; - withNearThermal: (args: NearThermalArgs) => this; - withNearIMU: (args: NearIMUArgs) => this; - withNearVector: (args: NearVectorArgs) => this; - validateGroup: () => void; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/graphql/explorer.js b/dist/node/cjs/graphql/explorer.js deleted file mode 100644 index 623ac8aa..00000000 --- a/dist/node/cjs/graphql/explorer.js +++ /dev/null @@ -1,222 +0,0 @@ -'use strict'; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, 'default', { enumerable: true, value: v }); - } - : function (o, v) { - o['default'] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) - for (var k in mod) - if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const ask_js_1 = __importDefault(require('./ask.js')); -const nearImage_js_1 = __importDefault(require('./nearImage.js')); -const nearMedia_js_1 = __importStar(require('./nearMedia.js')); -const nearObject_js_1 = __importDefault(require('./nearObject.js')); -const nearText_js_1 = __importDefault(require('./nearText.js')); -const nearVector_js_1 = __importDefault(require('./nearVector.js')); -class Explorer extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withFields = (fields) => { - this.fields = fields; - return this; - }; - this.withLimit = (limit) => { - this.limit = limit; - return this; - }; - this.withNearText = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearTextString = new nearText_js_1.default(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearObject = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearObjectString = new nearObject_js_1.default(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withAsk = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.askString = new ask_js_1.default(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearMedia = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearMediaString = new nearMedia_js_1.default(args).toString(); - this.nearMediaType = args.type; - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearImage = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearMediaString = new nearImage_js_1.default(args).toString(); - this.nearMediaType = nearMedia_js_1.NearMediaType.Image; - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearAudio = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { - media: args.audio, - type: nearMedia_js_1.NearMediaType.Audio, - }) - ); - }; - this.withNearVideo = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { - media: args.video, - type: nearMedia_js_1.NearMediaType.Video, - }) - ); - }; - this.withNearDepth = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { - media: args.depth, - type: nearMedia_js_1.NearMediaType.Depth, - }) - ); - }; - this.withNearThermal = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { - media: args.thermal, - type: nearMedia_js_1.NearMediaType.Thermal, - }) - ); - }; - this.withNearIMU = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { media: args.imu, type: nearMedia_js_1.NearMediaType.IMU }) - ); - }; - this.withNearVector = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearVectorString = new nearVector_js_1.default(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.validateGroup = () => { - if (!this.group) { - // nothing to check if this optional parameter is not set - return; - } - if (!Array.isArray(this.group)) { - throw new Error('groupBy must be an array'); - } - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.fields, 'fields', '.withFields(fields)'); - }; - this.do = () => { - let params = ''; - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - let args = []; - if (this.nearTextString) { - args = [...args, `nearText:${this.nearTextString}`]; - } - if (this.nearObjectString) { - args = [...args, `nearObject:${this.nearObjectString}`]; - } - if (this.askString) { - args = [...args, `ask:${this.askString}`]; - } - if (this.nearMediaString) { - args = [...args, `${this.nearMediaType}:${this.nearMediaString}`]; - } - if (this.nearVectorString) { - args = [...args, `nearVector:${this.nearVectorString}`]; - } - if (this.limit) { - args = [...args, `limit:${this.limit}`]; - } - params = `(${args.join(',')})`; - return this.client.query(`{Explore${params}{${this.fields}}}`); - }; - this.params = {}; - this.includesNearMediaFilter = false; - } -} -exports.default = Explorer; diff --git a/dist/node/cjs/graphql/generate.d.ts b/dist/node/cjs/graphql/generate.d.ts deleted file mode 100644 index cbce8897..00000000 --- a/dist/node/cjs/graphql/generate.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export interface GenerateArgs { - groupedTask?: string; - groupedProperties?: string[]; - singlePrompt?: string; -} -export interface GenerateParts { - singleResult?: string; - groupedResult?: string; - results: string[]; -} -export declare class GraphQLGenerate { - private groupedTask?; - private groupedProperties?; - private singlePrompt?; - constructor(args: GenerateArgs); - toString(): string; - private validate; -} diff --git a/dist/node/cjs/graphql/generate.js b/dist/node/cjs/graphql/generate.js deleted file mode 100644 index fb1de403..00000000 --- a/dist/node/cjs/graphql/generate.js +++ /dev/null @@ -1,44 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.GraphQLGenerate = void 0; -class GraphQLGenerate { - constructor(args) { - this.groupedTask = args.groupedTask; - this.groupedProperties = args.groupedProperties; - this.singlePrompt = args.singlePrompt; - } - toString() { - this.validate(); - let str = 'generate('; - const results = ['error']; - if (this.singlePrompt) { - str += `singleResult:{prompt:"${this.singlePrompt.replace(/[\n\r]+/g, '')}"}`; - results.push('singleResult'); - } - if (this.groupedTask || (this.groupedProperties !== undefined && this.groupedProperties.length > 0)) { - const args = []; - if (this.groupedTask) { - args.push(`task:"${this.groupedTask.replace(/[\n\r]+/g, '')}"`); - } - if (this.groupedProperties !== undefined && this.groupedProperties.length > 0) { - args.push(`properties:${JSON.stringify(this.groupedProperties)}`); - } - str += `groupedResult:{${args.join(',')}}`; - results.push('groupedResult'); - } - str += `){${results.join(' ')}}`; - return str; - } - validate() { - if (!this.groupedTask && !this.singlePrompt) { - throw new Error('must provide at least one of `singlePrompt` or `groupTask`'); - } - if (this.groupedTask !== undefined && this.groupedTask == '') { - throw new Error('groupedTask must not be empty'); - } - if (this.singlePrompt !== undefined && this.singlePrompt == '') { - throw new Error('singlePrompt must not be empty'); - } - } -} -exports.GraphQLGenerate = GraphQLGenerate; diff --git a/dist/node/cjs/graphql/getter.d.ts b/dist/node/cjs/graphql/getter.d.ts deleted file mode 100644 index c31fe66c..00000000 --- a/dist/node/cjs/graphql/getter.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -import Connection from '../connection/index.js'; -import { ConsistencyLevel } from '../data/index.js'; -import { WhereFilter } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { AskArgs } from './ask.js'; -import { Bm25Args } from './bm25.js'; -import { GenerateArgs } from './generate.js'; -import { GroupArgs } from './group.js'; -import { GroupByArgs } from './groupBy.js'; -import { HybridArgs } from './hybrid.js'; -import { NearImageArgs } from './nearImage.js'; -import { NearAudioArgs, NearDepthArgs, NearIMUArgs, NearThermalArgs, NearVideoArgs } from './nearMedia.js'; -import { NearObjectArgs } from './nearObject.js'; -import { NearTextArgs } from './nearText.js'; -import { NearVectorArgs } from './nearVector.js'; -import { SortArgs } from './sort.js'; -export { FusionType } from './hybrid.js'; -export default class GraphQLGetter extends CommandBase { - private after?; - private askString?; - private bm25String?; - private className?; - private fields?; - private groupString?; - private hybridString?; - private includesNearMediaFilter; - private limit?; - private nearImageNotSet?; - private nearMediaString?; - private nearMediaType?; - private nearObjectString?; - private nearTextString?; - private nearVectorString?; - private offset?; - private sortString?; - private whereString?; - private generateString?; - private consistencyLevel?; - private groupByString?; - private tenant?; - private autocut?; - constructor(client: Connection); - withFields: (fields: string) => this; - withClassName: (className: string) => this; - withAfter: (id: string) => this; - withGroup: (args: GroupArgs) => this; - withWhere: (whereObj: WhereFilter) => this; - withNearText: (args: NearTextArgs) => this; - withBm25: (args: Bm25Args) => this; - withHybrid: (args: HybridArgs) => this; - withNearObject: (args: NearObjectArgs) => this; - withAsk: (askObj: AskArgs) => this; - private withNearMedia; - withNearImage: (args: NearImageArgs) => this; - withNearAudio: (args: NearAudioArgs) => this; - withNearVideo: (args: NearVideoArgs) => this; - withNearThermal: (args: NearThermalArgs) => this; - withNearDepth: (args: NearDepthArgs) => this; - withNearIMU: (args: NearIMUArgs) => this; - withNearVector: (args: NearVectorArgs) => this; - withLimit: (limit: number) => this; - withOffset: (offset: number) => this; - withAutocut: (autocut: number) => this; - withSort: (args: SortArgs[]) => this; - withGenerate: (args: GenerateArgs) => this; - withConsistencyLevel: (level: ConsistencyLevel) => this; - withGroupBy: (args: GroupByArgs) => this; - withTenant: (tenant: string) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - do: () => Promise<{ - data: any; - }>; -} diff --git a/dist/node/cjs/graphql/getter.js b/dist/node/cjs/graphql/getter.js deleted file mode 100644 index 6845cfca..00000000 --- a/dist/node/cjs/graphql/getter.js +++ /dev/null @@ -1,342 +0,0 @@ -'use strict'; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __setModuleDefault = - (this && this.__setModuleDefault) || - (Object.create - ? function (o, v) { - Object.defineProperty(o, 'default', { enumerable: true, value: v }); - } - : function (o, v) { - o['default'] = v; - }); -var __importStar = - (this && this.__importStar) || - function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) - for (var k in mod) - if (k !== 'default' && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; - }; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.FusionType = void 0; -const commandBase_js_1 = require('../validation/commandBase.js'); -const ask_js_1 = __importDefault(require('./ask.js')); -const bm25_js_1 = __importDefault(require('./bm25.js')); -const generate_js_1 = require('./generate.js'); -const group_js_1 = __importDefault(require('./group.js')); -const groupBy_js_1 = __importDefault(require('./groupBy.js')); -const hybrid_js_1 = __importDefault(require('./hybrid.js')); -const nearImage_js_1 = __importDefault(require('./nearImage.js')); -const nearMedia_js_1 = __importStar(require('./nearMedia.js')); -const nearObject_js_1 = __importDefault(require('./nearObject.js')); -const nearText_js_1 = __importDefault(require('./nearText.js')); -const nearVector_js_1 = __importDefault(require('./nearVector.js')); -const sort_js_1 = __importDefault(require('./sort.js')); -const where_js_1 = __importDefault(require('./where.js')); -var hybrid_js_2 = require('./hybrid.js'); -Object.defineProperty(exports, 'FusionType', { - enumerable: true, - get: function () { - return hybrid_js_2.FusionType; - }, -}); -class GraphQLGetter extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withFields = (fields) => { - this.fields = fields; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withAfter = (id) => { - this.after = id; - return this; - }; - this.withGroup = (args) => { - try { - this.groupString = new group_js_1.default(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withWhere = (whereObj) => { - try { - this.whereString = new where_js_1.default(whereObj).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearText = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - this.nearTextString = new nearText_js_1.default(args).toString(); - this.includesNearMediaFilter = true; - return this; - }; - this.withBm25 = (args) => { - try { - this.bm25String = new bm25_js_1.default(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withHybrid = (args) => { - try { - this.hybridString = new hybrid_js_1.default(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearObject = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearObjectString = new nearObject_js_1.default(args).toString(); - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withAsk = (askObj) => { - try { - this.askString = new ask_js_1.default(askObj).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearMedia = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearMediaString = new nearMedia_js_1.default(args).toString(); - this.nearMediaType = args.type; - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearImage = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearMediaString = new nearImage_js_1.default(args).toString(); - this.nearMediaType = nearMedia_js_1.NearMediaType.Image; - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearAudio = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { - type: nearMedia_js_1.NearMediaType.Audio, - media: args.audio, - }) - ); - }; - this.withNearVideo = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { - type: nearMedia_js_1.NearMediaType.Video, - media: args.video, - }) - ); - }; - this.withNearThermal = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { - type: nearMedia_js_1.NearMediaType.Thermal, - media: args.thermal, - }) - ); - }; - this.withNearDepth = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { - type: nearMedia_js_1.NearMediaType.Depth, - media: args.depth, - }) - ); - }; - this.withNearIMU = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { type: nearMedia_js_1.NearMediaType.IMU, media: args.imu }) - ); - }; - this.withNearVector = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearVectorString = new nearVector_js_1.default(args).toString(); - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withLimit = (limit) => { - this.limit = limit; - return this; - }; - this.withOffset = (offset) => { - this.offset = offset; - return this; - }; - this.withAutocut = (autocut) => { - this.autocut = autocut; - return this; - }; - this.withSort = (args) => { - this.sortString = new sort_js_1.default(args).toString(); - return this; - }; - this.withGenerate = (args) => { - this.generateString = new generate_js_1.GraphQLGenerate(args).toString(); - return this; - }; - this.withConsistencyLevel = (level) => { - this.consistencyLevel = level; - return this; - }; - this.withGroupBy = (args) => { - try { - this.groupByString = new groupBy_js_1.default(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.className, 'className', '.withClassName(className)'); - this.validateIsSet(this.fields, 'fields', '.withFields(fields)'); - }; - this.do = () => { - var _a, _b; - let params = ''; - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - let args = []; - if (this.whereString) { - args = [...args, `where:${this.whereString}`]; - } - if (this.nearTextString) { - args = [...args, `nearText:${this.nearTextString}`]; - } - if (this.nearObjectString) { - args = [...args, `nearObject:${this.nearObjectString}`]; - } - if (this.askString) { - args = [...args, `ask:${this.askString}`]; - } - if (this.nearMediaString) { - args = [...args, `near${this.nearMediaType}:${this.nearMediaString}`]; - } - if (this.nearVectorString) { - args = [...args, `nearVector:${this.nearVectorString}`]; - } - if (this.bm25String) { - args = [...args, `bm25:${this.bm25String}`]; - } - if (this.hybridString) { - args = [...args, `hybrid:${this.hybridString}`]; - } - if (this.groupString) { - args = [...args, `group:${this.groupString}`]; - } - if (this.limit) { - args = [...args, `limit:${this.limit}`]; - } - if (this.offset) { - args = [...args, `offset:${this.offset}`]; - } - if (this.autocut) { - args = [...args, `autocut:${this.autocut}`]; - } - if (this.sortString) { - args = [...args, `sort:[${this.sortString}]`]; - } - if (this.after) { - args = [...args, `after:"${this.after}"`]; - } - if (this.generateString) { - if ((_a = this.fields) === null || _a === void 0 ? void 0 : _a.includes('_additional')) { - this.fields.replace('_additional{', `_additional{${this.generateString}`); - } else { - this.fields = - (_b = this.fields) === null || _b === void 0 - ? void 0 - : _b.concat(` _additional{${this.generateString}}`); - } - } - if (this.consistencyLevel) { - args = [...args, `consistencyLevel:${this.consistencyLevel}`]; - } - if (this.groupByString) { - args = [...args, `groupBy:${this.groupByString}`]; - } - if (this.tenant) { - args = [...args, `tenant:"${this.tenant}"`]; - } - if (args.length > 0) { - params = `(${args.join(',')})`; - } - return this.client.query(`{Get{${this.className}${params}{${this.fields}}}}`); - }; - this.includesNearMediaFilter = false; - } -} -exports.default = GraphQLGetter; diff --git a/dist/node/cjs/graphql/group.d.ts b/dist/node/cjs/graphql/group.d.ts deleted file mode 100644 index ddd1b3bd..00000000 --- a/dist/node/cjs/graphql/group.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export interface GroupArgs { - type: string; - force: number; -} -export default class GraphQLGroup { - private args; - constructor(args: GroupArgs); - toString(): string; -} diff --git a/dist/node/cjs/graphql/group.js b/dist/node/cjs/graphql/group.js deleted file mode 100644 index 7ac0d0b3..00000000 --- a/dist/node/cjs/graphql/group.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -class GraphQLGroup { - constructor(args) { - this.args = args; - } - toString() { - let parts = []; - if (this.args.type) { - // value is a graphQL enum, so doesn't need to be quoted - parts = [...parts, `type:${this.args.type}`]; - } - if (this.args.force) { - parts = [...parts, `force:${this.args.force}`]; - } - return `{${parts.join(',')}}`; - } -} -exports.default = GraphQLGroup; diff --git a/dist/node/cjs/graphql/groupBy.d.ts b/dist/node/cjs/graphql/groupBy.d.ts deleted file mode 100644 index 0dfdacaf..00000000 --- a/dist/node/cjs/graphql/groupBy.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface GroupByArgs { - path: string[]; - groups: number; - objectsPerGroup: number; -} -export default class GraphQLGroupBy { - private args; - constructor(args: GroupByArgs); - toString(): string; -} diff --git a/dist/node/cjs/graphql/groupBy.js b/dist/node/cjs/graphql/groupBy.js deleted file mode 100644 index ae063312..00000000 --- a/dist/node/cjs/graphql/groupBy.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -class GraphQLGroupBy { - constructor(args) { - this.args = args; - } - toString() { - let parts = []; - if (this.args.path) { - parts = [...parts, `path:${JSON.stringify(this.args.path)}`]; - } - if (this.args.groups) { - parts = [...parts, `groups:${this.args.groups}`]; - } - if (this.args.objectsPerGroup) { - parts = [...parts, `objectsPerGroup:${this.args.objectsPerGroup}`]; - } - return `{${parts.join(',')}}`; - } -} -exports.default = GraphQLGroupBy; diff --git a/dist/node/cjs/graphql/hybrid.d.ts b/dist/node/cjs/graphql/hybrid.d.ts deleted file mode 100644 index 7769abb2..00000000 --- a/dist/node/cjs/graphql/hybrid.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Move } from './nearText.js'; -export interface HybridArgs { - alpha?: number; - query: string; - vector?: number[]; - properties?: string[]; - targetVectors?: string[]; - fusionType?: FusionType; - searches?: HybridSubSearch[]; -} -export interface NearTextSubSearch { - concepts: string[]; - certainty?: number; - distance?: number; - moveAwayFrom?: Move; - moveTo?: Move; -} -export interface NearVectorSubSearch { - vector: number[]; - certainty?: number; - distance?: number; - targetVectors?: string[]; -} -export interface HybridSubSearch { - nearText?: NearTextSubSearch; - nearVector?: NearVectorSubSearch; -} -export declare enum FusionType { - rankedFusion = 'rankedFusion', - relativeScoreFusion = 'relativeScoreFusion', -} -export default class GraphQLHybrid { - private alpha?; - private query; - private vector?; - private properties?; - private targetVectors?; - private fusionType?; - private searches?; - constructor(args: HybridArgs); - toString(): string; -} diff --git a/dist/node/cjs/graphql/hybrid.js b/dist/node/cjs/graphql/hybrid.js deleted file mode 100644 index 059ea07b..00000000 --- a/dist/node/cjs/graphql/hybrid.js +++ /dev/null @@ -1,86 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.FusionType = void 0; -const nearText_js_1 = require('./nearText.js'); -var FusionType; -(function (FusionType) { - FusionType['rankedFusion'] = 'rankedFusion'; - FusionType['relativeScoreFusion'] = 'relativeScoreFusion'; -})(FusionType || (exports.FusionType = FusionType = {})); -class GraphQLHybridSubSearch { - constructor(args) { - this.nearText = args.nearText; - this.nearVector = args.nearVector; - } - toString() { - let outer = []; - if (this.nearText !== undefined) { - let inner = [`concepts:${JSON.stringify(this.nearText.concepts)}`]; - if (this.nearText.certainty) { - inner = [...inner, `certainty:${this.nearText.certainty}`]; - } - if (this.nearText.distance) { - inner = [...inner, `distance:${this.nearText.distance}`]; - } - if (this.nearText.moveTo) { - inner = [...inner, (0, nearText_js_1.parseMove)('moveTo', this.nearText.moveTo)]; - } - if (this.nearText.moveAwayFrom) { - inner = [...inner, (0, nearText_js_1.parseMove)('moveAwayFrom', this.nearText.moveAwayFrom)]; - } - outer = [...outer, `nearText:{${inner.join(',')}}`]; - } - if (this.nearVector !== undefined) { - let inner = [`vector:${JSON.stringify(this.nearVector.vector)}`]; - if (this.nearVector.certainty) { - inner = [...inner, `certainty:${this.nearVector.certainty}`]; - } - if (this.nearVector.distance) { - inner = [...inner, `distance:${this.nearVector.distance}`]; - } - if (this.nearVector.targetVectors && this.nearVector.targetVectors.length > 0) { - inner = [...inner, `targetVectors:${JSON.stringify(this.nearVector.targetVectors)}`]; - } - outer = [...outer, `nearVector:{${inner.join(',')}}`]; - } - return `{${outer.join(',')}}`; - } -} -class GraphQLHybrid { - constructor(args) { - var _a; - this.alpha = args.alpha; - this.query = args.query; - this.vector = args.vector; - this.properties = args.properties; - this.targetVectors = args.targetVectors; - this.fusionType = args.fusionType; - this.searches = - (_a = args.searches) === null || _a === void 0 - ? void 0 - : _a.map((search) => new GraphQLHybridSubSearch(search)); - } - toString() { - let args = [`query:${JSON.stringify(this.query)}`]; // query must always be set - if (this.alpha !== undefined) { - args = [...args, `alpha:${JSON.stringify(this.alpha)}`]; - } - if (this.vector !== undefined) { - args = [...args, `vector:${JSON.stringify(this.vector)}`]; - } - if (this.properties && this.properties.length > 0) { - args = [...args, `properties:${JSON.stringify(this.properties)}`]; - } - if (this.targetVectors && this.targetVectors.length > 0) { - args = [...args, `targetVectors:${JSON.stringify(this.targetVectors)}`]; - } - if (this.fusionType !== undefined) { - args = [...args, `fusionType:${this.fusionType}`]; - } - if (this.searches !== undefined) { - args = [...args, `searches:[${this.searches.map((search) => search.toString()).join(',')}]`]; - } - return `{${args.join(',')}}`; - } -} -exports.default = GraphQLHybrid; diff --git a/dist/node/cjs/graphql/index.d.ts b/dist/node/cjs/graphql/index.d.ts deleted file mode 100644 index 5af5ffe5..00000000 --- a/dist/node/cjs/graphql/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import Connection from '../connection/index.js'; -import Aggregator from './aggregator.js'; -import Explorer from './explorer.js'; -import GraphQLGetter from './getter.js'; -import Raw from './raw.js'; -export interface GraphQL { - get: () => GraphQLGetter; - aggregate: () => Aggregator; - explore: () => Explorer; - raw: () => Raw; -} -declare const graphql: (client: Connection) => GraphQL; -export default graphql; -export { default as Aggregator } from './aggregator.js'; -export { default as Explorer } from './explorer.js'; -export { FusionType, default as GraphQLGetter } from './getter.js'; -export { default as Raw } from './raw.js'; diff --git a/dist/node/cjs/graphql/index.js b/dist/node/cjs/graphql/index.js deleted file mode 100644 index 8e77faa3..00000000 --- a/dist/node/cjs/graphql/index.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.Raw = exports.GraphQLGetter = exports.FusionType = exports.Explorer = exports.Aggregator = void 0; -const aggregator_js_1 = __importDefault(require('./aggregator.js')); -const explorer_js_1 = __importDefault(require('./explorer.js')); -const getter_js_1 = __importDefault(require('./getter.js')); -const raw_js_1 = __importDefault(require('./raw.js')); -const graphql = (client) => { - return { - get: () => new getter_js_1.default(client), - aggregate: () => new aggregator_js_1.default(client), - explore: () => new explorer_js_1.default(client), - raw: () => new raw_js_1.default(client), - }; -}; -exports.default = graphql; -var aggregator_js_2 = require('./aggregator.js'); -Object.defineProperty(exports, 'Aggregator', { - enumerable: true, - get: function () { - return __importDefault(aggregator_js_2).default; - }, -}); -var explorer_js_2 = require('./explorer.js'); -Object.defineProperty(exports, 'Explorer', { - enumerable: true, - get: function () { - return __importDefault(explorer_js_2).default; - }, -}); -var getter_js_2 = require('./getter.js'); -Object.defineProperty(exports, 'FusionType', { - enumerable: true, - get: function () { - return getter_js_2.FusionType; - }, -}); -Object.defineProperty(exports, 'GraphQLGetter', { - enumerable: true, - get: function () { - return __importDefault(getter_js_2).default; - }, -}); -var raw_js_2 = require('./raw.js'); -Object.defineProperty(exports, 'Raw', { - enumerable: true, - get: function () { - return __importDefault(raw_js_2).default; - }, -}); diff --git a/dist/node/cjs/graphql/nearImage.d.ts b/dist/node/cjs/graphql/nearImage.d.ts deleted file mode 100644 index 7abd4c5f..00000000 --- a/dist/node/cjs/graphql/nearImage.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { NearMediaBase } from './nearMedia.js'; -export interface NearImageArgs extends NearMediaBase { - image?: string; - targetVectors?: string[]; -} -export default class GraphQLNearImage { - private certainty?; - private distance?; - private image?; - private targetVectors?; - constructor(args: NearImageArgs); - toString(wrap?: boolean): string; - validate(): void; -} diff --git a/dist/node/cjs/graphql/nearImage.js b/dist/node/cjs/graphql/nearImage.js deleted file mode 100644 index d40043a1..00000000 --- a/dist/node/cjs/graphql/nearImage.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -class GraphQLNearImage { - constructor(args) { - this.certainty = args.certainty; - this.distance = args.distance; - this.image = args.image; - this.targetVectors = args.targetVectors; - } - toString(wrap = true) { - this.validate(); - let args = []; - if (this.image) { - let img = this.image; - if (img.startsWith('data:')) { - const base64part = ';base64,'; - img = img.substring(img.indexOf(base64part) + base64part.length); - } - args = [...args, `image:${JSON.stringify(img)}`]; - } - if (this.certainty) { - args = [...args, `certainty:${this.certainty}`]; - } - if (this.distance) { - args = [...args, `distance:${this.distance}`]; - } - if (this.targetVectors && this.targetVectors.length > 0) { - args = [...args, `targetVectors:${JSON.stringify(this.targetVectors)}`]; - } - if (!wrap) { - return `${args.join(',')}`; - } - return `{${args.join(',')}}`; - } - validate() { - if (!this.image) { - throw new Error('nearImage filter: image field must be present'); - } - } -} -exports.default = GraphQLNearImage; diff --git a/dist/node/cjs/graphql/nearMedia.d.ts b/dist/node/cjs/graphql/nearMedia.d.ts deleted file mode 100644 index 51faeed4..00000000 --- a/dist/node/cjs/graphql/nearMedia.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -export interface NearMediaBase { - certainty?: number; - distance?: number; - targetVectors?: string[]; -} -export interface NearMediaArgs extends NearMediaBase { - media: string; - type: NearMediaType; -} -export interface NearImageArgs extends NearMediaBase { - image: string; -} -export interface NearAudioArgs extends NearMediaBase { - audio: string; -} -export interface NearVideoArgs extends NearMediaBase { - video: string; -} -export interface NearThermalArgs extends NearMediaBase { - thermal: string; -} -export interface NearDepthArgs extends NearMediaBase { - depth: string; -} -export interface NearIMUArgs extends NearMediaBase { - imu: string; -} -export declare enum NearMediaType { - Image = 'Image', - Audio = 'Audio', - Video = 'Video', - Thermal = 'Thermal', - Depth = 'Depth', - IMU = 'IMU', -} -export default class GraphQLNearMedia { - private certainty?; - private distance?; - private media; - private type; - private targetVectors?; - constructor(args: NearMediaArgs); - toString(wrap?: boolean): string; -} diff --git a/dist/node/cjs/graphql/nearMedia.js b/dist/node/cjs/graphql/nearMedia.js deleted file mode 100644 index 1b5c2e52..00000000 --- a/dist/node/cjs/graphql/nearMedia.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.NearMediaType = void 0; -var NearMediaType; -(function (NearMediaType) { - NearMediaType['Image'] = 'Image'; - NearMediaType['Audio'] = 'Audio'; - NearMediaType['Video'] = 'Video'; - NearMediaType['Thermal'] = 'Thermal'; - NearMediaType['Depth'] = 'Depth'; - NearMediaType['IMU'] = 'IMU'; -})(NearMediaType || (exports.NearMediaType = NearMediaType = {})); -class GraphQLNearMedia { - constructor(args) { - this.certainty = args.certainty; - this.distance = args.distance; - this.media = args.media; - this.type = args.type; - this.targetVectors = args.targetVectors; - } - toString(wrap = true) { - let args = []; - if (this.media.startsWith('data:')) { - const base64part = ';base64,'; - this.media = this.media.substring(this.media.indexOf(base64part) + base64part.length); - } - args = [...args, `${this.type.toLowerCase()}:${JSON.stringify(this.media)}`]; - if (this.certainty) { - args = [...args, `certainty:${this.certainty}`]; - } - if (this.distance) { - args = [...args, `distance:${this.distance}`]; - } - if (this.targetVectors && this.targetVectors.length > 0) { - args = [...args, `targetVectors:${JSON.stringify(this.targetVectors)}`]; - } - if (!wrap) { - return `${args.join(',')}`; - } - return `{${args.join(',')}}`; - } -} -exports.default = GraphQLNearMedia; diff --git a/dist/node/cjs/graphql/nearObject.d.ts b/dist/node/cjs/graphql/nearObject.d.ts deleted file mode 100644 index 08d855ae..00000000 --- a/dist/node/cjs/graphql/nearObject.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export interface NearObjectArgs { - beacon?: string; - certainty?: number; - distance?: number; - id?: string; - targetVectors?: string[]; -} -export default class GraphQLNearObject { - private beacon?; - private certainty?; - private distance?; - private id?; - private targetVectors?; - constructor(args: NearObjectArgs); - toString(wrap?: boolean): string; - validate(): void; -} diff --git a/dist/node/cjs/graphql/nearObject.js b/dist/node/cjs/graphql/nearObject.js deleted file mode 100644 index 07c695fe..00000000 --- a/dist/node/cjs/graphql/nearObject.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -class GraphQLNearObject { - constructor(args) { - this.beacon = args.beacon; - this.certainty = args.certainty; - this.distance = args.distance; - this.id = args.id; - this.targetVectors = args.targetVectors; - } - toString(wrap = true) { - this.validate(); - let args = []; - if (this.id) { - args = [...args, `id:${JSON.stringify(this.id)}`]; - } - if (this.beacon) { - args = [...args, `beacon:${JSON.stringify(this.beacon)}`]; - } - if (this.certainty) { - args = [...args, `certainty:${this.certainty}`]; - } - if (this.distance) { - args = [...args, `distance:${this.distance}`]; - } - if (this.targetVectors && this.targetVectors.length > 0) { - args = [...args, `targetVectors:${JSON.stringify(this.targetVectors)}`]; - } - if (!wrap) { - return `${args.join(',')}`; - } - return `{${args.join(',')}}`; - } - validate() { - if (!this.id && !this.beacon) { - throw new Error('nearObject filter: id or beacon needs to be set'); - } - } -} -exports.default = GraphQLNearObject; diff --git a/dist/node/cjs/graphql/nearText.d.ts b/dist/node/cjs/graphql/nearText.d.ts deleted file mode 100644 index ce753ad7..00000000 --- a/dist/node/cjs/graphql/nearText.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -export interface NearTextArgs { - autocorrect?: boolean; - certainty?: number; - concepts: string[]; - distance?: number; - moveAwayFrom?: Move; - moveTo?: Move; - targetVectors?: string[]; -} -export interface Move { - objects?: MoveObject[]; - concepts?: string[]; - force?: number; -} -export interface MoveObject { - beacon?: string; - id?: string; -} -export default class GraphQLNearText { - private autocorrect?; - private certainty?; - private concepts; - private distance?; - private moveAwayFrom?; - private moveTo?; - private targetVectors?; - constructor(args: NearTextArgs); - toString(): string; - validate(): void; -} -type MoveType = 'moveTo' | 'moveAwayFrom'; -export declare function parseMoveObjects(move: MoveType, objects: MoveObject[]): string; -export declare function parseMove(move: MoveType, args: Move): string; -export {}; diff --git a/dist/node/cjs/graphql/nearText.js b/dist/node/cjs/graphql/nearText.js deleted file mode 100644 index 3d3a1a5a..00000000 --- a/dist/node/cjs/graphql/nearText.js +++ /dev/null @@ -1,88 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.parseMove = exports.parseMoveObjects = void 0; -class GraphQLNearText { - constructor(args) { - this.autocorrect = args.autocorrect; - this.certainty = args.certainty; - this.concepts = args.concepts; - this.distance = args.distance; - this.moveAwayFrom = args.moveAwayFrom; - this.moveTo = args.moveTo; - this.targetVectors = args.targetVectors; - } - toString() { - this.validate(); - let args = [`concepts:${JSON.stringify(this.concepts)}`]; - if (this.certainty) { - args = [...args, `certainty:${this.certainty}`]; - } - if (this.distance) { - args = [...args, `distance:${this.distance}`]; - } - if (this.targetVectors && this.targetVectors.length > 0) { - args = [...args, `targetVectors:${JSON.stringify(this.targetVectors)}`]; - } - if (this.moveTo) { - args = [...args, parseMove('moveTo', this.moveTo)]; - } - if (this.moveAwayFrom) { - args = [...args, parseMove('moveAwayFrom', this.moveAwayFrom)]; - } - if (this.autocorrect !== undefined) { - args = [...args, `autocorrect:${this.autocorrect}`]; - } - return `{${args.join(',')}}`; - } - validate() { - if (this.moveTo) { - if (!this.moveTo.concepts && !this.moveTo.objects) { - throw new Error('nearText filter: moveTo.concepts or moveTo.objects must be present'); - } - if (!this.moveTo.force || (!this.moveTo.concepts && !this.moveTo.objects)) { - throw new Error("nearText filter: moveTo must have fields 'concepts' or 'objects' and 'force'"); - } - } - if (this.moveAwayFrom) { - if (!this.moveAwayFrom.concepts && !this.moveAwayFrom.objects) { - throw new Error('nearText filter: moveAwayFrom.concepts or moveAwayFrom.objects must be present'); - } - if (!this.moveAwayFrom.force || (!this.moveAwayFrom.concepts && !this.moveAwayFrom.objects)) { - throw new Error("nearText filter: moveAwayFrom must have fields 'concepts' or 'objects' and 'force'"); - } - } - } -} -exports.default = GraphQLNearText; -function parseMoveObjects(move, objects) { - const moveObjects = []; - for (const i in objects) { - if (!objects[i].id && !objects[i].beacon) { - throw new Error(`nearText: ${move}.objects[${i}].id or ${move}.objects[${i}].beacon must be present`); - } - const objs = []; - if (objects[i].id) { - objs.push(`id:"${objects[i].id}"`); - } - if (objects[i].beacon) { - objs.push(`beacon:"${objects[i].beacon}"`); - } - moveObjects.push(`{${objs.join(',')}}`); - } - return `[${moveObjects.join(',')}]`; -} -exports.parseMoveObjects = parseMoveObjects; -function parseMove(move, args) { - let moveArgs = []; - if (args.concepts) { - moveArgs = [...moveArgs, `concepts:${JSON.stringify(args.concepts)}`]; - } - if (args.objects) { - moveArgs = [...moveArgs, `objects:${parseMoveObjects(move, args.objects)}`]; - } - if (args.force) { - moveArgs = [...moveArgs, `force:${args.force}`]; - } - return `${move}:{${moveArgs.join(',')}}`; -} -exports.parseMove = parseMove; diff --git a/dist/node/cjs/graphql/nearVector.d.ts b/dist/node/cjs/graphql/nearVector.d.ts deleted file mode 100644 index 9e79d448..00000000 --- a/dist/node/cjs/graphql/nearVector.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -export interface NearVectorArgs { - certainty?: number; - distance?: number; - vector: number[]; - targetVectors?: string[]; -} -export default class GraphQLNearVector { - private certainty?; - private distance?; - private vector; - private targetVectors?; - constructor(args: NearVectorArgs); - toString(wrap?: boolean): string; -} diff --git a/dist/node/cjs/graphql/nearVector.js b/dist/node/cjs/graphql/nearVector.js deleted file mode 100644 index 505d3be4..00000000 --- a/dist/node/cjs/graphql/nearVector.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -class GraphQLNearVector { - constructor(args) { - this.certainty = args.certainty; - this.distance = args.distance; - this.vector = args.vector; - this.targetVectors = args.targetVectors; - } - toString(wrap = true) { - let args = [`vector:${JSON.stringify(this.vector)}`]; // vector must always be set - if (this.certainty) { - args = [...args, `certainty:${this.certainty}`]; - } - if (this.distance) { - args = [...args, `distance:${this.distance}`]; - } - if (this.targetVectors && this.targetVectors.length > 0) { - args = [...args, `targetVectors:${JSON.stringify(this.targetVectors)}`]; - } - if (!wrap) { - return `${args.join(',')}`; - } - return `{${args.join(',')}}`; - } -} -exports.default = GraphQLNearVector; diff --git a/dist/node/cjs/graphql/raw.d.ts b/dist/node/cjs/graphql/raw.d.ts deleted file mode 100644 index e5cc42cd..00000000 --- a/dist/node/cjs/graphql/raw.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class RawGraphQL extends CommandBase { - private query?; - constructor(client: Connection); - withQuery: (query: string) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/graphql/raw.js b/dist/node/cjs/graphql/raw.js deleted file mode 100644 index f054988e..00000000 --- a/dist/node/cjs/graphql/raw.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class RawGraphQL extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withQuery = (query) => { - this.query = query; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.query, 'query', '.raw().withQuery(query)'); - }; - this.do = () => { - const params = ''; - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - if (this.query) { - return this.client.query(this.query); - } - return Promise.resolve(undefined); - }; - } -} -exports.default = RawGraphQL; diff --git a/dist/node/cjs/graphql/sort.d.ts b/dist/node/cjs/graphql/sort.d.ts deleted file mode 100644 index 78ac62c2..00000000 --- a/dist/node/cjs/graphql/sort.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface SortArgs { - path: string[]; - order?: string; -} -export type SortOrder = 'asc' | 'desc'; -export default class GraphQLSort { - private args; - constructor(args: SortArgs[]); - toString(): string; -} diff --git a/dist/node/cjs/graphql/sort.js b/dist/node/cjs/graphql/sort.js deleted file mode 100644 index f384b5ad..00000000 --- a/dist/node/cjs/graphql/sort.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -class GraphQLSort { - constructor(args) { - this.args = args; - } - toString() { - const parts = []; - for (const arg of this.args) { - let part = `{path:${JSON.stringify(arg.path)}`; - if (arg.order) { - part = part.concat(`,order:${arg.order}}`); - } else { - part = part.concat('}'); - } - parts.push(part); - } - return parts.join(','); - } -} -exports.default = GraphQLSort; diff --git a/dist/node/cjs/graphql/where.d.ts b/dist/node/cjs/graphql/where.d.ts deleted file mode 100644 index c48be8a8..00000000 --- a/dist/node/cjs/graphql/where.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { WhereFilter } from '../openapi/types.js'; -export default class GraphQLWhere { - private operands?; - private operator?; - private path?; - private readonly source; - private valueContent; - private valueType?; - constructor(whereObj: WhereFilter); - toString(): string; - marshalValueContent(): string; - getValueType(): string | undefined; - marshalValueGeoRange(): string; - validate(): void; - parse(): void; - parseOperator(op: string): void; - parsePath(path: string[]): void; - parseValue(key: string, value: any): void; - parseOperands(ops: any[]): void; -} diff --git a/dist/node/cjs/graphql/where.js b/dist/node/cjs/graphql/where.js deleted file mode 100644 index 57c20c99..00000000 --- a/dist/node/cjs/graphql/where.js +++ /dev/null @@ -1,157 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -class GraphQLWhere { - constructor(whereObj) { - this.source = whereObj; - } - toString() { - this.parse(); - this.validate(); - if (this.operands) { - return `{operator:${this.operator},operands:[${this.operands}]}`; - } else { - // this is an on-value filter - const valueType = this.getValueType(); - const valueContent = this.marshalValueContent(); - return ( - `{` + - `operator:${this.operator},` + - `${valueType}:${valueContent},` + - `path:${JSON.stringify(this.path)}` + - `}` - ); - } - } - marshalValueContent() { - if (this.valueType == 'valueGeoRange') { - return this.marshalValueGeoRange(); - } - return JSON.stringify(this.valueContent); - } - getValueType() { - switch (this.valueType) { - case 'valueStringArray': { - return 'valueString'; - } - case 'valueTextArray': { - return 'valueText'; - } - case 'valueIntArray': { - return 'valueInt'; - } - case 'valueNumberArray': { - return 'valueNumber'; - } - case 'valueDateArray': { - return 'valueDate'; - } - case 'valueBooleanArray': { - return 'valueBoolean'; - } - default: { - return this.valueType; - } - } - } - marshalValueGeoRange() { - let parts = []; - const gc = this.valueContent.geoCoordinates; - if (gc) { - let gcParts = []; - if (gc.latitude) { - gcParts = [...gcParts, `latitude:${gc.latitude}`]; - } - if (gc.longitude) { - gcParts = [...gcParts, `longitude:${gc.longitude}`]; - } - parts = [...parts, `geoCoordinates:{${gcParts.join(',')}}`]; - } - const d = this.valueContent.distance; - if (d) { - let dParts = []; - if (d.max) { - dParts = [...dParts, `max:${d.max}`]; - } - parts = [...parts, `distance:{${dParts.join(',')}}`]; - } - return `{${parts.join(',')}}`; - } - validate() { - if (!this.operator) { - throw new Error('where filter: operator cannot be empty'); - } - if (!this.operands) { - if (!this.valueType) { - throw new Error('where filter: value cannot be empty'); - } - if (!this.path) { - throw new Error('where filter: path cannot be empty'); - } - } - } - parse() { - for (const key in this.source) { - switch (key) { - case 'operator': - this.parseOperator(this.source[key]); - break; - case 'operands': - this.parseOperands(this.source[key]); - break; - case 'path': - this.parsePath(this.source[key]); - break; - default: - if (key.indexOf('value') != 0) { - throw new Error("where filter: unrecognized key '" + key + "'"); - } - this.parseValue(key, this.source[key]); - } - } - } - parseOperator(op) { - if (typeof op !== 'string') { - throw new Error('where filter: operator must be a string'); - } - this.operator = op; - } - parsePath(path) { - if (!Array.isArray(path)) { - throw new Error('where filter: path must be an array'); - } - this.path = path; - } - parseValue(key, value) { - switch (key) { - case 'valueString': - case 'valueText': - case 'valueInt': - case 'valueNumber': - case 'valueDate': - case 'valueBoolean': - case 'valueStringArray': - case 'valueTextArray': - case 'valueIntArray': - case 'valueNumberArray': - case 'valueDateArray': - case 'valueBooleanArray': - case 'valueGeoRange': - break; - default: - throw new Error("where filter: unrecognized value prop '" + key + "'"); - } - this.valueType = key; - this.valueContent = value; - } - parseOperands(ops) { - if (!Array.isArray(ops)) { - throw new Error('where filter: operands must be an array'); - } - this.operands = ops - .map((element) => { - return new GraphQLWhere(element).toString(); - }) - .join(','); - } -} -exports.default = GraphQLWhere; diff --git a/dist/node/cjs/grpc/base.d.ts b/dist/node/cjs/grpc/base.d.ts deleted file mode 100644 index 8b82dff2..00000000 --- a/dist/node/cjs/grpc/base.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Metadata } from 'nice-grpc'; -import { RetryOptions } from 'nice-grpc-client-middleware-retry'; -import { ConsistencyLevel } from '../data/index.js'; -import { ConsistencyLevel as ConsistencyLevelGRPC } from '../proto/v1/base.js'; -import { WeaviateClient } from '../proto/v1/weaviate.js'; -export default class Base { - protected connection: WeaviateClient; - protected collection: string; - protected timeout: number; - protected consistencyLevel?: ConsistencyLevelGRPC; - protected tenant?: string; - protected metadata?: Metadata; - protected constructor( - connection: WeaviateClient, - collection: string, - metadata: Metadata, - timeout: number, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ); - private mapConsistencyLevel; - protected sendWithTimeout: (send: (signal: AbortSignal) => Promise) => Promise; -} diff --git a/dist/node/cjs/grpc/base.js b/dist/node/cjs/grpc/base.js deleted file mode 100644 index a4d132c8..00000000 --- a/dist/node/cjs/grpc/base.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const abort_controller_x_1 = require('abort-controller-x'); -const errors_js_1 = require('../errors.js'); -const base_js_1 = require('../proto/v1/base.js'); -class Base { - constructor(connection, collection, metadata, timeout, consistencyLevel, tenant) { - this.sendWithTimeout = (send) => { - const controller = new AbortController(); - const timeoutId = setTimeout(() => controller.abort(), this.timeout * 1000); - return send(controller.signal) - .catch((error) => { - if ((0, abort_controller_x_1.isAbortError)(error)) { - throw new errors_js_1.WeaviateRequestTimeoutError(`timed out after ${this.timeout}ms`); - } - throw error; - }) - .finally(() => clearTimeout(timeoutId)); - }; - this.connection = connection; - this.collection = collection; - this.metadata = metadata; - this.timeout = timeout; - this.consistencyLevel = this.mapConsistencyLevel(consistencyLevel); - this.tenant = tenant; - } - mapConsistencyLevel(consistencyLevel) { - switch (consistencyLevel) { - case 'ALL': - return base_js_1.ConsistencyLevel.CONSISTENCY_LEVEL_ALL; - case 'QUORUM': - return base_js_1.ConsistencyLevel.CONSISTENCY_LEVEL_QUORUM; - case 'ONE': - return base_js_1.ConsistencyLevel.CONSISTENCY_LEVEL_ONE; - default: - return base_js_1.ConsistencyLevel.CONSISTENCY_LEVEL_UNSPECIFIED; - } - } -} -exports.default = Base; diff --git a/dist/node/cjs/grpc/batcher.d.ts b/dist/node/cjs/grpc/batcher.d.ts deleted file mode 100644 index 979373e1..00000000 --- a/dist/node/cjs/grpc/batcher.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Metadata } from 'nice-grpc'; -import { RetryOptions } from 'nice-grpc-client-middleware-retry'; -import { ConsistencyLevel } from '../data/index.js'; -import { Filters } from '../proto/v1/base.js'; -import { BatchObject, BatchObjectsReply } from '../proto/v1/batch.js'; -import { BatchDeleteReply } from '../proto/v1/batch_delete.js'; -import { WeaviateClient } from '../proto/v1/weaviate.js'; -import Base from './base.js'; -export interface Batch { - withDelete: (args: BatchDeleteArgs) => Promise; - withObjects: (args: BatchObjectsArgs) => Promise; -} -export interface BatchObjectsArgs { - objects: BatchObject[]; -} -export interface BatchDeleteArgs { - filters: Filters | undefined; - verbose?: boolean; - dryRun?: boolean; -} -export default class Batcher extends Base implements Batch { - static use( - connection: WeaviateClient, - collection: string, - metadata: Metadata, - timeout: number, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ): Batch; - withDelete: (args: BatchDeleteArgs) => Promise; - withObjects: (args: BatchObjectsArgs) => Promise; - private callDelete; - private callObjects; -} diff --git a/dist/node/cjs/grpc/batcher.js b/dist/node/cjs/grpc/batcher.js deleted file mode 100644 index 29f60519..00000000 --- a/dist/node/cjs/grpc/batcher.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const batch_js_1 = require('../proto/v1/batch.js'); -const errors_js_1 = require('../errors.js'); -const batch_delete_js_1 = require('../proto/v1/batch_delete.js'); -const base_js_1 = __importDefault(require('./base.js')); -const retry_js_1 = require('./retry.js'); -class Batcher extends base_js_1.default { - constructor() { - super(...arguments); - this.withDelete = (args) => this.callDelete(batch_delete_js_1.BatchDeleteRequest.fromPartial(args)); - this.withObjects = (args) => this.callObjects(batch_js_1.BatchObjectsRequest.fromPartial(args)); - } - static use(connection, collection, metadata, timeout, consistencyLevel, tenant) { - return new Batcher(connection, collection, metadata, timeout, consistencyLevel, tenant); - } - callDelete(message) { - return this.sendWithTimeout((signal) => - this.connection.batchDelete( - Object.assign(Object.assign({}, message), { - collection: this.collection, - consistencyLevel: this.consistencyLevel, - tenant: this.tenant, - }), - { - metadata: this.metadata, - signal, - } - ) - ).catch((err) => { - throw new errors_js_1.WeaviateDeleteManyError(err.message); - }); - } - callObjects(message) { - return this.sendWithTimeout((signal) => - this.connection - .batchObjects( - Object.assign(Object.assign({}, message), { consistencyLevel: this.consistencyLevel }), - Object.assign({ metadata: this.metadata, signal }, retry_js_1.retryOptions) - ) - .catch((err) => { - throw new errors_js_1.WeaviateBatchError(err.message); - }) - ); - } -} -exports.default = Batcher; diff --git a/dist/node/cjs/grpc/retry.d.ts b/dist/node/cjs/grpc/retry.d.ts deleted file mode 100644 index 92ffdf04..00000000 --- a/dist/node/cjs/grpc/retry.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { RetryOptions } from 'nice-grpc-client-middleware-retry'; -export declare const retryOptions: RetryOptions; diff --git a/dist/node/cjs/grpc/retry.js b/dist/node/cjs/grpc/retry.js deleted file mode 100644 index 519eec65..00000000 --- a/dist/node/cjs/grpc/retry.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.retryOptions = void 0; -const nice_grpc_1 = require('nice-grpc'); -exports.retryOptions = { - retry: true, - retryMaxAttempts: 5, - retryableStatuses: [nice_grpc_1.Status.UNAVAILABLE], - onRetryableError(error, attempt, delayMs) { - console.warn(error, `Attempt ${attempt} failed. Retrying in ${delayMs}ms.`); - }, -}; diff --git a/dist/node/cjs/grpc/searcher.d.ts b/dist/node/cjs/grpc/searcher.d.ts deleted file mode 100644 index ce229e05..00000000 --- a/dist/node/cjs/grpc/searcher.d.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { Metadata } from 'nice-grpc'; -import { RetryOptions } from 'nice-grpc-client-middleware-retry'; -import { ConsistencyLevel } from '../data/index.js'; -import { Filters } from '../proto/v1/base.js'; -import { GenerativeSearch } from '../proto/v1/generative.js'; -import { - BM25, - GroupBy, - Hybrid, - MetadataRequest, - NearAudioSearch, - NearDepthSearch, - NearImageSearch, - NearIMUSearch, - NearObject, - NearTextSearch, - NearThermalSearch, - NearVector, - NearVideoSearch, - PropertiesRequest, - Rerank, - SearchReply, - SortBy, -} from '../proto/v1/search_get.js'; -import { WeaviateClient } from '../proto/v1/weaviate.js'; -import Base from './base.js'; -export type SearchFetchArgs = { - limit?: number; - offset?: number; - after?: string; - filters?: Filters; - sortBy?: SortBy[]; - metadata?: MetadataRequest; - properties?: PropertiesRequest; - generative?: GenerativeSearch; - groupBy?: GroupBy; -}; -export type BaseSearchArgs = { - limit?: number; - offset?: number; - autocut?: number; - filters?: Filters; - rerank?: Rerank; - metadata?: MetadataRequest; - properties?: PropertiesRequest; - generative?: GenerativeSearch; - groupBy?: GroupBy; -}; -export type SearchBm25Args = BaseSearchArgs & { - bm25Search: BM25; -}; -export type SearchHybridArgs = BaseSearchArgs & { - hybridSearch: Hybrid; -}; -export type SearchNearAudioArgs = BaseSearchArgs & { - nearAudio: NearAudioSearch; -}; -export type SearchNearDepthArgs = BaseSearchArgs & { - nearDepth: NearDepthSearch; -}; -export type SearchNearImageArgs = BaseSearchArgs & { - nearImage: NearImageSearch; -}; -export type SearchNearIMUArgs = BaseSearchArgs & { - nearIMU: NearIMUSearch; -}; -export type SearchNearObjectArgs = BaseSearchArgs & { - nearObject: NearObject; -}; -export type SearchNearTextArgs = BaseSearchArgs & { - nearText: NearTextSearch; -}; -export type SearchNearThermalArgs = BaseSearchArgs & { - nearThermal: NearThermalSearch; -}; -export type SearchNearVectorArgs = BaseSearchArgs & { - nearVector: NearVector; -}; -export type SearchNearVideoArgs = BaseSearchArgs & { - nearVideo: NearVideoSearch; -}; -export interface Search { - withFetch: (args: SearchFetchArgs) => Promise; - withBm25: (args: SearchBm25Args) => Promise; - withHybrid: (args: SearchHybridArgs) => Promise; - withNearAudio: (args: SearchNearAudioArgs) => Promise; - withNearDepth: (args: SearchNearDepthArgs) => Promise; - withNearImage: (args: SearchNearImageArgs) => Promise; - withNearIMU: (args: SearchNearIMUArgs) => Promise; - withNearObject: (args: SearchNearObjectArgs) => Promise; - withNearText: (args: SearchNearTextArgs) => Promise; - withNearThermal: (args: SearchNearThermalArgs) => Promise; - withNearVector: (args: SearchNearVectorArgs) => Promise; - withNearVideo: (args: SearchNearVideoArgs) => Promise; -} -export default class Searcher extends Base implements Search { - static use( - connection: WeaviateClient, - collection: string, - metadata: Metadata, - timeout: number, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ): Search; - withFetch: (args: SearchFetchArgs) => Promise; - withBm25: (args: SearchBm25Args) => Promise; - withHybrid: (args: SearchHybridArgs) => Promise; - withNearAudio: (args: SearchNearAudioArgs) => Promise; - withNearDepth: (args: SearchNearDepthArgs) => Promise; - withNearImage: (args: SearchNearImageArgs) => Promise; - withNearIMU: (args: SearchNearIMUArgs) => Promise; - withNearObject: (args: SearchNearObjectArgs) => Promise; - withNearText: (args: SearchNearTextArgs) => Promise; - withNearThermal: (args: SearchNearThermalArgs) => Promise; - withNearVector: (args: SearchNearVectorArgs) => Promise; - withNearVideo: (args: SearchNearVideoArgs) => Promise; - private call; -} diff --git a/dist/node/cjs/grpc/searcher.js b/dist/node/cjs/grpc/searcher.js deleted file mode 100644 index fc91cdd2..00000000 --- a/dist/node/cjs/grpc/searcher.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const search_get_js_1 = require('../proto/v1/search_get.js'); -const errors_js_1 = require('../errors.js'); -const base_js_1 = __importDefault(require('./base.js')); -const retry_js_1 = require('./retry.js'); -class Searcher extends base_js_1.default { - constructor() { - super(...arguments); - this.withFetch = (args) => this.call(search_get_js_1.SearchRequest.fromPartial(args)); - this.withBm25 = (args) => this.call(search_get_js_1.SearchRequest.fromPartial(args)); - this.withHybrid = (args) => this.call(search_get_js_1.SearchRequest.fromPartial(args)); - this.withNearAudio = (args) => this.call(search_get_js_1.SearchRequest.fromPartial(args)); - this.withNearDepth = (args) => this.call(search_get_js_1.SearchRequest.fromPartial(args)); - this.withNearImage = (args) => this.call(search_get_js_1.SearchRequest.fromPartial(args)); - this.withNearIMU = (args) => this.call(search_get_js_1.SearchRequest.fromPartial(args)); - this.withNearObject = (args) => this.call(search_get_js_1.SearchRequest.fromPartial(args)); - this.withNearText = (args) => this.call(search_get_js_1.SearchRequest.fromPartial(args)); - this.withNearThermal = (args) => this.call(search_get_js_1.SearchRequest.fromPartial(args)); - this.withNearVector = (args) => this.call(search_get_js_1.SearchRequest.fromPartial(args)); - this.withNearVideo = (args) => this.call(search_get_js_1.SearchRequest.fromPartial(args)); - this.call = (message) => - this.sendWithTimeout((signal) => - this.connection - .search( - Object.assign(Object.assign({}, message), { - collection: this.collection, - consistencyLevel: this.consistencyLevel, - tenant: this.tenant, - uses123Api: true, - uses125Api: true, - }), - Object.assign({ metadata: this.metadata, signal }, retry_js_1.retryOptions) - ) - .catch((err) => { - throw new errors_js_1.WeaviateQueryError(err.message, 'gRPC'); - }) - ); - } - static use(connection, collection, metadata, timeout, consistencyLevel, tenant) { - return new Searcher(connection, collection, metadata, timeout, consistencyLevel, tenant); - } -} -exports.default = Searcher; diff --git a/dist/node/cjs/grpc/tenantsManager.d.ts b/dist/node/cjs/grpc/tenantsManager.d.ts deleted file mode 100644 index 4b838464..00000000 --- a/dist/node/cjs/grpc/tenantsManager.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Metadata } from 'nice-grpc'; -import { RetryOptions } from 'nice-grpc-client-middleware-retry'; -import { TenantsGetReply } from '../proto/v1/tenants.js'; -import { WeaviateClient } from '../proto/v1/weaviate.js'; -import Base from './base.js'; -export type TenantsGetArgs = { - names?: string[]; -}; -export interface Tenants { - withGet: (args: TenantsGetArgs) => Promise; -} -export default class TenantsManager extends Base implements Tenants { - static use( - connection: WeaviateClient, - collection: string, - metadata: Metadata, - timeout: number - ): Tenants; - withGet: (args: TenantsGetArgs) => Promise; - private call; -} diff --git a/dist/node/cjs/grpc/tenantsManager.js b/dist/node/cjs/grpc/tenantsManager.js deleted file mode 100644 index d2e4f519..00000000 --- a/dist/node/cjs/grpc/tenantsManager.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const tenants_js_1 = require('../proto/v1/tenants.js'); -const base_js_1 = __importDefault(require('./base.js')); -const retry_js_1 = require('./retry.js'); -class TenantsManager extends base_js_1.default { - constructor() { - super(...arguments); - this.withGet = (args) => - this.call( - tenants_js_1.TenantsGetRequest.fromPartial({ names: args.names ? { values: args.names } : undefined }) - ); - } - static use(connection, collection, metadata, timeout) { - return new TenantsManager(connection, collection, metadata, timeout); - } - call(message) { - return this.sendWithTimeout((signal) => - this.connection.tenantsGet( - Object.assign(Object.assign({}, message), { collection: this.collection }), - Object.assign({ metadata: this.metadata, signal }, retry_js_1.retryOptions) - ) - ); - } -} -exports.default = TenantsManager; diff --git a/dist/node/cjs/index.d.ts b/dist/node/cjs/index.d.ts deleted file mode 100644 index e867bcc9..00000000 --- a/dist/node/cjs/index.d.ts +++ /dev/null @@ -1,960 +0,0 @@ -import { Backend, BackupCompressionLevel, BackupStatus } from './backup/index.js'; -import { Backup } from './collections/backup/client.js'; -import { Cluster } from './collections/cluster/index.js'; -import { Collections } from './collections/index.js'; -import { - AccessTokenCredentialsInput, - ApiKey, - AuthAccessTokenCredentials, - AuthClientCredentials, - AuthCredentials, - AuthUserPasswordCredentials, - ClientCredentialsInput, - OidcAuthenticator, - UserPasswordCredentialsInput, -} from './connection/auth.js'; -import { - ConnectToCustomOptions, - ConnectToLocalOptions, - ConnectToWCDOptions, - ConnectToWCSOptions, - ConnectToWeaviateCloudOptions, -} from './connection/helpers.js'; -import { ProxiesParams, TimeoutParams } from './connection/http.js'; -import { ConsistencyLevel } from './data/replication.js'; -import { Meta } from './openapi/types.js'; -import { DbVersion } from './utils/dbVersion.js'; -import weaviateV2 from './v2/index.js'; -export type ProtocolParams = { - /** - * The host to connect to. E.g., `localhost` or `example.com`. - */ - host: string; - /** - * The port to connect to. E.g., `8080` or `80`. - */ - port: number; - /** - * Whether to use a secure connection (https). - */ - secure: boolean; - /** - * An optional path in the case that you are using a forwarding proxy. - * - * E.g., http://localhost:8080/weaviate - */ - path?: string; -}; -export type ConnectionParams = { - /** - * The connection parameters for the REST and GraphQL APIs (http/1.1). - */ - http: ProtocolParams; - /** - * The connection paramaters for the gRPC API (http/2). - */ - grpc: ProtocolParams; -}; -export type ClientParams = { - /** - * The connection parameters for Weaviate's public APIs. - */ - connectionParams: ConnectionParams; - /** - * The credentials used to authenticate with Weaviate. - * - * Can be any of `AuthUserPasswordCredentials`, `AuthAccessTokenCredentials`, `AuthClientCredentials`, and `ApiKey`. - */ - auth?: AuthCredentials; - /** - * Additional headers that should be passed to Weaviate in the underlying requests. E.g., X-OpenAI-Api-Key - */ - headers?: HeadersInit; - /** - * The connection parameters for any tunnelling proxies that should be used. - * - * Note, if your proxy is a forwarding proxy then supply its configuration as if it were the Weaviate server itself using `rest` and `grpc`. - */ - proxies?: ProxiesParams; - /** The timeouts to use when making requests to Weaviate */ - timeout?: TimeoutParams; - /** Whether to skip the initialization checks */ - skipInitChecks?: boolean; -}; -export interface WeaviateClient { - backup: Backup; - cluster: Cluster; - collections: Collections; - oidcAuth?: OidcAuthenticator; - close: () => Promise; - getMeta: () => Promise; - getOpenIDConfig?: () => Promise; - getWeaviateVersion: () => Promise; - isLive: () => Promise; - isReady: () => Promise; -} -declare const app: { - /** - * Connect to a custom Weaviate deployment, e.g. your own self-hosted Kubernetes cluster. - * - * @param {ConnectToCustomOptions} options Options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your custom Weaviate deployment. - */ - connectToCustom: (options: ConnectToCustomOptions) => Promise; - /** - * Connect to a locally-deployed Weaviate instance, e.g. as a Docker compose stack. - * - * @param {ConnectToLocalOptions} [options] Options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your local Weaviate instance. - */ - connectToLocal: (options?: ConnectToLocalOptions) => Promise; - /** - * Connect to your own Weaviate Cloud (WCD) instance. - * - * @deprecated Use `connectToWeaviateCloud` instead. - * - * @param {string} clusterURL The URL of your WCD instance. E.g., `https://example.weaviate.network`. - * @param {ConnectToWCDOptions} [options] Additional options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your WCD instance. - */ - connectToWCD: (clusterURL: string, options?: ConnectToWCDOptions) => Promise; - /** - * Connect to your own Weaviate Cloud Service (WCS) instance. - * - * @deprecated Use `connectToWeaviateCloud` instead. - * - * @param {string} clusterURL The URL of your WCD instance. E.g., `https://example.weaviate.network`. - * @param {ConnectToWCSOptions} [options] Additional options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your WCS instance. - */ - connectToWCS: (clusterURL: string, options?: ConnectToWCSOptions) => Promise; - /** - * Connect to your own Weaviate Cloud (WCD) instance. - * - * @param {string} clusterURL The URL of your WCD instance. E.g., `https://example.weaviate.network`. - * @param {ConnectToWeaviateCloudOptions} [options] Additional options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your WCD instance. - */ - connectToWeaviateCloud: ( - clusterURL: string, - options?: ConnectToWeaviateCloudOptions - ) => Promise; - client: (params: ClientParams) => Promise; - ApiKey: typeof ApiKey; - AuthUserPasswordCredentials: typeof AuthUserPasswordCredentials; - AuthAccessTokenCredentials: typeof AuthAccessTokenCredentials; - AuthClientCredentials: typeof AuthClientCredentials; - configure: { - generative: { - anthropic( - config?: import('./collections/index.js').GenerativeAnthropicConfig | undefined - ): import('./collections/index.js').ModuleConfig< - 'generative-anthropic', - import('./collections/index.js').GenerativeAnthropicConfig | undefined - >; - anyscale( - config?: import('./collections/index.js').GenerativeAnyscaleConfig | undefined - ): import('./collections/index.js').ModuleConfig< - 'generative-anyscale', - import('./collections/index.js').GenerativeAnyscaleConfig | undefined - >; - aws( - config: import('./collections/index.js').GenerativeAWSConfig - ): import('./collections/index.js').ModuleConfig< - 'generative-aws', - import('./collections/index.js').GenerativeAWSConfig - >; - azureOpenAI: ( - config: import('./collections/index.js').GenerativeAzureOpenAIConfigCreate - ) => import('./collections/index.js').ModuleConfig< - 'generative-openai', - import('./collections/index.js').GenerativeAzureOpenAIConfig - >; - cohere: ( - config?: import('./collections/index.js').GenerativeCohereConfigCreate | undefined - ) => import('./collections/index.js').ModuleConfig< - 'generative-cohere', - import('./collections/index.js').GenerativeCohereConfig | undefined - >; - databricks: ( - config: import('./collections/index.js').GenerativeDatabricksConfig - ) => import('./collections/index.js').ModuleConfig< - 'generative-databricks', - import('./collections/index.js').GenerativeDatabricksConfig - >; - friendliai( - config?: import('./collections/index.js').GenerativeFriendliAIConfig | undefined - ): import('./collections/index.js').ModuleConfig< - 'generative-friendliai', - import('./collections/index.js').GenerativeFriendliAIConfig | undefined - >; - mistral( - config?: import('./collections/index.js').GenerativeMistralConfig | undefined - ): import('./collections/index.js').ModuleConfig< - 'generative-mistral', - import('./collections/index.js').GenerativeMistralConfig | undefined - >; - octoai( - config?: import('./collections/index.js').GenerativeOctoAIConfig | undefined - ): import('./collections/index.js').ModuleConfig< - 'generative-octoai', - import('./collections/index.js').GenerativeOctoAIConfig | undefined - >; - ollama( - config?: import('./collections/index.js').GenerativeOllamaConfig | undefined - ): import('./collections/index.js').ModuleConfig< - 'generative-ollama', - import('./collections/index.js').GenerativeOllamaConfig | undefined - >; - openAI: ( - config?: import('./collections/index.js').GenerativeOpenAIConfigCreate | undefined - ) => import('./collections/index.js').ModuleConfig< - 'generative-openai', - import('./collections/index.js').GenerativeOpenAIConfig | undefined - >; - palm: ( - config?: import('./collections/index.js').GenerativeGoogleConfig | undefined - ) => import('./collections/index.js').ModuleConfig< - 'generative-palm', - import('./collections/index.js').GenerativeGoogleConfig | undefined - >; - google: ( - config?: import('./collections/index.js').GenerativeGoogleConfig | undefined - ) => import('./collections/index.js').ModuleConfig< - 'generative-google', - import('./collections/index.js').GenerativeGoogleConfig | undefined - >; - }; - reranker: { - cohere: ( - config?: import('./collections/index.js').RerankerCohereConfig | undefined - ) => import('./collections/index.js').ModuleConfig< - 'reranker-cohere', - import('./collections/index.js').RerankerCohereConfig | undefined - >; - jinaai: ( - config?: import('./collections/index.js').RerankerJinaAIConfig | undefined - ) => import('./collections/index.js').ModuleConfig< - 'reranker-jinaai', - import('./collections/index.js').RerankerJinaAIConfig | undefined - >; - transformers: () => import('./collections/index.js').ModuleConfig< - 'reranker-transformers', - Record - >; - voyageAI: ( - config?: import('./collections/index.js').RerankerVoyageAIConfig | undefined - ) => import('./collections/index.js').ModuleConfig< - 'reranker-voyageai', - import('./collections/index.js').RerankerVoyageAIConfig | undefined - >; - }; - vectorizer: { - none: ( - opts?: - | { - name?: N | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - } - | undefined - ) => import('./collections/index.js').VectorConfigCreate; - img2VecNeural: ( - opts: import('./collections/index.js').Img2VecNeuralConfig & { - name?: N_1 | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_1, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - } - ) => import('./collections/index.js').VectorConfigCreate; - multi2VecBind: ( - opts?: - | (import('./collections/index.js').Multi2VecBindConfigCreate & { - name?: N_2 | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_2, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate; - multi2VecClip: ( - opts?: - | (import('./collections/index.js').Multi2VecClipConfigCreate & { - name?: N_3 | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_3, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate; - multi2VecPalm: ( - opts: import('./collections/index.js').ConfigureNonTextVectorizerOptions - ) => import('./collections/index.js').VectorConfigCreate; - multi2VecGoogle: ( - opts: import('./collections/index.js').ConfigureNonTextVectorizerOptions - ) => import('./collections/index.js').VectorConfigCreate; - ref2VecCentroid: ( - opts: import('./collections/index.js').ConfigureNonTextVectorizerOptions - ) => import('./collections/index.js').VectorConfigCreate; - text2VecAWS: ( - opts: import('./collections/index.js').ConfigureTextVectorizerOptions - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_7, - I_7, - 'text2vec-aws' - >; - text2VecAzureOpenAI: ( - opts: import('./collections/index.js').ConfigureTextVectorizerOptions< - T_1, - N_8, - I_8, - 'text2vec-azure-openai' - > - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_8, - I_8, - 'text2vec-azure-openai' - >; - text2VecCohere: ( - opts?: - | (import('./collections/index.js').Text2VecCohereConfig & { - name?: N_9 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_9, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_9, - I_9, - 'text2vec-cohere' - >; - text2VecContextionary: ( - opts?: - | (import('./collections/index.js').Text2VecContextionaryConfig & { - name?: N_10 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_10, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_10, - I_10, - 'text2vec-contextionary' - >; - text2VecDatabricks: ( - opts: import('./collections/index.js').ConfigureTextVectorizerOptions< - T_4, - N_11, - I_11, - 'text2vec-databricks' - > - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_11, - I_11, - 'text2vec-databricks' - >; - text2VecGPT4All: ( - opts?: - | (import('./collections/index.js').Text2VecGPT4AllConfig & { - name?: N_12 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_12, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_12, - I_12, - 'text2vec-gpt4all' - >; - text2VecHuggingFace: ( - opts?: - | (import('./collections/index.js').Text2VecHuggingFaceConfig & { - name?: N_13 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_13, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_13, - I_13, - 'text2vec-huggingface' - >; - text2VecJina: ( - opts?: - | (import('./collections/index.js').Text2VecJinaConfig & { - name?: N_14 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_14, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_14, - I_14, - 'text2vec-jina' - >; - text2VecMistral: ( - opts?: - | (import('./collections/index.js').Text2VecMistralConfig & { - name?: N_15 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_15, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_15, - I_15, - 'text2vec-mistral' - >; - text2VecOctoAI: ( - opts?: - | (import('./collections/index.js').Text2VecOctoAIConfig & { - name?: N_16 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_16, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_16, - I_16, - 'text2vec-octoai' - >; - text2VecOpenAI: ( - opts?: - | (import('./collections/index.js').Text2VecOpenAIConfig & { - name?: N_17 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_17, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_17, - I_17, - 'text2vec-openai' - >; - text2VecOllama: ( - opts?: - | (import('./collections/index.js').Text2VecOllamaConfig & { - name?: N_18 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_18, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_18, - I_18, - 'text2vec-ollama' - >; - text2VecPalm: ( - opts?: - | (import('./collections/index.js').Text2VecGoogleConfig & { - name?: N_19 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_19, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_19, - I_19, - 'text2vec-palm' - >; - text2VecGoogle: ( - opts?: - | (import('./collections/index.js').Text2VecGoogleConfig & { - name?: N_20 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_20, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_20, - I_20, - 'text2vec-google' - >; - text2VecTransformers: ( - opts?: - | (import('./collections/index.js').Text2VecTransformersConfig & { - name?: N_21 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_21, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_21, - I_21, - 'text2vec-transformers' - >; - text2VecVoyageAI: ( - opts?: - | (import('./collections/index.js').Text2VecVoyageAIConfig & { - name?: N_22 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_22, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_22, - I_22, - 'text2vec-voyageai' - >; - }; - vectorIndex: { - flat: ( - opts?: import('./collections/index.js').VectorIndexConfigFlatCreateOptions | undefined - ) => import('./collections/index.js').ModuleConfig< - 'flat', - | { - distance?: import('./collections/index.js').VectorDistance | undefined; - vectorCacheMaxObjects?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | undefined; - type?: 'flat' | undefined; - } - | undefined - >; - hnsw: ( - opts?: import('./collections/index.js').VectorIndexConfigHNSWCreateOptions | undefined - ) => import('./collections/index.js').ModuleConfig< - 'hnsw', - | { - cleanupIntervalSeconds?: number | undefined; - distance?: import('./collections/index.js').VectorDistance | undefined; - dynamicEfMin?: number | undefined; - dynamicEfMax?: number | undefined; - dynamicEfFactor?: number | undefined; - efConstruction?: number | undefined; - ef?: number | undefined; - filterStrategy?: import('./collections/index.js').VectorIndexFilterStrategy | undefined; - flatSearchCutoff?: number | undefined; - maxConnections?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | { - bitCompression?: boolean | undefined; - centroids?: number | undefined; - encoder?: - | { - type?: import('./collections/index.js').PQEncoderType | undefined; - distribution?: import('./collections/index.js').PQEncoderDistribution | undefined; - } - | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - type?: 'pq' | undefined; - } - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - type?: 'sq' | undefined; - } - | undefined; - skip?: boolean | undefined; - vectorCacheMaxObjects?: number | undefined; - type?: 'hnsw' | undefined; - } - | undefined - >; - dynamic: ( - opts?: import('./collections/index.js').VectorIndexConfigDynamicCreateOptions | undefined - ) => import('./collections/index.js').ModuleConfig< - 'dynamic', - | { - distance?: import('./collections/index.js').VectorDistance | undefined; - threshold?: number | undefined; - hnsw?: - | { - cleanupIntervalSeconds?: number | undefined; - distance?: import('./collections/index.js').VectorDistance | undefined; - dynamicEfMin?: number | undefined; - dynamicEfMax?: number | undefined; - dynamicEfFactor?: number | undefined; - efConstruction?: number | undefined; - ef?: number | undefined; - filterStrategy?: import('./collections/index.js').VectorIndexFilterStrategy | undefined; - flatSearchCutoff?: number | undefined; - maxConnections?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | { - bitCompression?: boolean | undefined; - centroids?: number | undefined; - encoder?: - | { - type?: import('./collections/index.js').PQEncoderType | undefined; - distribution?: - | import('./collections/index.js').PQEncoderDistribution - | undefined; - } - | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - type?: 'pq' | undefined; - } - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - type?: 'sq' | undefined; - } - | undefined; - skip?: boolean | undefined; - vectorCacheMaxObjects?: number | undefined; - type?: 'hnsw' | undefined; - } - | undefined; - flat?: - | { - distance?: import('./collections/index.js').VectorDistance | undefined; - vectorCacheMaxObjects?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | undefined; - type?: 'flat' | undefined; - } - | undefined; - type?: 'dynamic' | undefined; - } - | undefined - >; - quantizer: { - bq: ( - options?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - } - | undefined - ) => import('./collections/index.js').QuantizerRecursivePartial< - import('./collections/index.js').BQConfig - >; - pq: ( - options?: - | { - bitCompression?: boolean | undefined; - centroids?: number | undefined; - encoder?: - | { - distribution?: import('./collections/index.js').PQEncoderDistribution | undefined; - type?: import('./collections/index.js').PQEncoderType | undefined; - } - | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./collections/index.js').QuantizerRecursivePartial< - import('./collections/index.js').PQConfig - >; - sq: ( - options?: - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./collections/index.js').QuantizerRecursivePartial< - import('./collections/index.js').SQConfig - >; - }; - }; - dataType: { - INT: 'int'; - INT_ARRAY: 'int[]'; - NUMBER: 'number'; - NUMBER_ARRAY: 'number[]'; - TEXT: 'text'; - TEXT_ARRAY: 'text[]'; - UUID: 'uuid'; - UUID_ARRAY: 'uuid[]'; - BOOLEAN: 'boolean'; - BOOLEAN_ARRAY: 'boolean[]'; - DATE: 'date'; - DATE_ARRAY: 'date[]'; - OBJECT: 'object'; - OBJECT_ARRAY: 'object[]'; - BLOB: 'blob'; - GEO_COORDINATES: 'geoCoordinates'; - PHONE_NUMBER: 'phoneNumber'; - }; - tokenization: { - WORD: 'word'; - LOWERCASE: 'lowercase'; - WHITESPACE: 'whitespace'; - FIELD: 'field'; - TRIGRAM: 'trigram'; - GSE: 'gse'; - KAGOME_KR: 'kagome_kr'; - }; - vectorDistances: { - COSINE: 'cosine'; - DOT: 'dot'; - HAMMING: 'hamming'; - L2_SQUARED: 'l2-squared'; - }; - invertedIndex: (options: { - bm25b?: number | undefined; - bm25k1?: number | undefined; - cleanupIntervalSeconds?: number | undefined; - indexTimestamps?: boolean | undefined; - indexPropertyLength?: boolean | undefined; - indexNullState?: boolean | undefined; - stopwordsPreset?: 'none' | 'en' | undefined; - stopwordsAdditions?: string[] | undefined; - stopwordsRemovals?: string[] | undefined; - }) => { - bm25?: - | { - k1?: number | undefined; - b?: number | undefined; - } - | undefined; - cleanupIntervalSeconds?: number | undefined; - indexTimestamps?: boolean | undefined; - indexPropertyLength?: boolean | undefined; - indexNullState?: boolean | undefined; - stopwords?: - | { - preset?: string | undefined; - additions?: (string | undefined)[] | undefined; - removals?: (string | undefined)[] | undefined; - } - | undefined; - }; - multiTenancy: ( - options?: - | { - autoTenantActivation?: boolean | undefined; - autoTenantCreation?: boolean | undefined; - enabled?: boolean | undefined; - } - | undefined - ) => { - autoTenantActivation?: boolean | undefined; - autoTenantCreation?: boolean | undefined; - enabled?: boolean | undefined; - }; - replication: (options: { - asyncEnabled?: boolean | undefined; - deletionStrategy?: import('./collections/index.js').ReplicationDeletionStrategy | undefined; - factor?: number | undefined; - }) => { - asyncEnabled?: boolean | undefined; - deletionStrategy?: import('./collections/index.js').ReplicationDeletionStrategy | undefined; - factor?: number | undefined; - }; - sharding: (options: { - virtualPerPhysical?: number | undefined; - desiredCount?: number | undefined; - desiredVirtualCount?: number | undefined; - }) => import('./collections/index.js').ShardingConfigCreate; - }; - configGuards: { - quantizer: typeof import('./collections/index.js').Quantizer; - vectorIndex: typeof import('./collections/index.js').VectorIndex; - }; - reconfigure: { - vectorIndex: { - flat: (options: { - vectorCacheMaxObjects?: number | undefined; - quantizer?: import('./collections/index.js').BQConfigUpdate | undefined; - }) => import('./collections/index.js').ModuleConfig< - 'flat', - import('./collections/index.js').VectorIndexConfigFlatUpdate - >; - hnsw: (options: { - dynamicEfFactor?: number | undefined; - dynamicEfMax?: number | undefined; - dynamicEfMin?: number | undefined; - ef?: number | undefined; - flatSearchCutoff?: number | undefined; - quantizer?: - | import('./collections/index.js').PQConfigUpdate - | import('./collections/index.js').BQConfigUpdate - | import('./collections/index.js').SQConfigUpdate - | undefined; - vectorCacheMaxObjects?: number | undefined; - }) => import('./collections/index.js').ModuleConfig< - 'hnsw', - import('./collections/index.js').VectorIndexConfigHNSWUpdate - >; - quantizer: { - bq: ( - options?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - } - | undefined - ) => import('./collections/index.js').BQConfigUpdate; - pq: ( - options?: - | { - centroids?: number | undefined; - pqEncoderDistribution?: import('./collections/index.js').PQEncoderDistribution | undefined; - pqEncoderType?: import('./collections/index.js').PQEncoderType | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./collections/index.js').PQConfigUpdate; - sq: ( - options?: - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./collections/index.js').SQConfigUpdate; - }; - }; - invertedIndex: (options: { - bm25b?: number | undefined; - bm25k1?: number | undefined; - cleanupIntervalSeconds?: number | undefined; - stopwordsPreset?: 'none' | 'en' | undefined; - stopwordsAdditions?: string[] | undefined; - stopwordsRemovals?: string[] | undefined; - }) => import('./collections/index.js').InvertedIndexConfigUpdate; - vectorizer: { - update: ( - options: import('./collections/index.js').VectorizerUpdateOptions - ) => import('./collections/index.js').VectorConfigUpdate; - }; - replication: (options: { - asyncEnabled?: boolean | undefined; - deletionStrategy?: import('./collections/index.js').ReplicationDeletionStrategy | undefined; - factor?: number | undefined; - }) => import('./collections/index.js').ReplicationConfigUpdate; - }; -}; -export default app; -export * from './collections/index.js'; -export * from './connection/index.js'; -export * from './utils/base64.js'; -export * from './utils/uuid.js'; -export { - AccessTokenCredentialsInput, - ApiKey, - AuthAccessTokenCredentials, - AuthClientCredentials, - AuthCredentials, - AuthUserPasswordCredentials, - Backend, - BackupCompressionLevel, - BackupStatus, - ClientCredentialsInput, - ConsistencyLevel, - ProxiesParams, - TimeoutParams, - UserPasswordCredentialsInput, - weaviateV2, -}; diff --git a/dist/node/cjs/index.js b/dist/node/cjs/index.js deleted file mode 100644 index cc183f99..00000000 --- a/dist/node/cjs/index.js +++ /dev/null @@ -1,232 +0,0 @@ -'use strict'; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __exportStar = - (this && this.__exportStar) || - function (m, exports) { - for (var p in m) - if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) - __createBinding(exports, m, p); - }; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.weaviateV2 = - exports.AuthUserPasswordCredentials = - exports.AuthClientCredentials = - exports.AuthAccessTokenCredentials = - exports.ApiKey = - void 0; -const client_js_1 = require('./collections/backup/client.js'); -const index_js_1 = __importDefault(require('./collections/cluster/index.js')); -const index_js_2 = require('./collections/config/index.js'); -const index_js_3 = require('./collections/configure/index.js'); -const index_js_4 = __importDefault(require('./collections/index.js')); -const auth_js_1 = require('./connection/auth.js'); -Object.defineProperty(exports, 'ApiKey', { - enumerable: true, - get: function () { - return auth_js_1.ApiKey; - }, -}); -Object.defineProperty(exports, 'AuthAccessTokenCredentials', { - enumerable: true, - get: function () { - return auth_js_1.AuthAccessTokenCredentials; - }, -}); -Object.defineProperty(exports, 'AuthClientCredentials', { - enumerable: true, - get: function () { - return auth_js_1.AuthClientCredentials; - }, -}); -Object.defineProperty(exports, 'AuthUserPasswordCredentials', { - enumerable: true, - get: function () { - return auth_js_1.AuthUserPasswordCredentials; - }, -}); -const helpers_js_1 = require('./connection/helpers.js'); -const index_js_5 = require('./connection/index.js'); -const metaGetter_js_1 = __importDefault(require('./misc/metaGetter.js')); -const http_1 = require('http'); -const https_1 = require('https'); -const index_js_6 = require('./misc/index.js'); -const index_js_7 = __importDefault(require('./v2/index.js')); -exports.weaviateV2 = index_js_7.default; -const cleanHost = (host, protocol) => { - if (host.includes('http')) { - console.warn(`The ${protocol}.host parameter should not include the protocol. Please remove the http:// or https:// from the ${protocol}.host parameter.\ - To specify a secure connection, set the secure parameter to true. The protocol will be inferred from the secure parameter instead.`); - return host.replace('http://', '').replace('https://', ''); - } - return host; -}; -const app = { - /** - * Connect to a custom Weaviate deployment, e.g. your own self-hosted Kubernetes cluster. - * - * @param {ConnectToCustomOptions} options Options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your custom Weaviate deployment. - */ - connectToCustom: function (options) { - return (0, helpers_js_1.connectToCustom)(this.client, options); - }, - /** - * Connect to a locally-deployed Weaviate instance, e.g. as a Docker compose stack. - * - * @param {ConnectToLocalOptions} [options] Options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your local Weaviate instance. - */ - connectToLocal: function (options) { - return (0, helpers_js_1.connectToLocal)(this.client, options); - }, - /** - * Connect to your own Weaviate Cloud (WCD) instance. - * - * @deprecated Use `connectToWeaviateCloud` instead. - * - * @param {string} clusterURL The URL of your WCD instance. E.g., `https://example.weaviate.network`. - * @param {ConnectToWCDOptions} [options] Additional options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your WCD instance. - */ - connectToWCD: function (clusterURL, options) { - console.warn( - 'The `connectToWCD` method is deprecated. Please use `connectToWeaviateCloud` instead. This method will be removed in a future release.' - ); - return (0, helpers_js_1.connectToWeaviateCloud)(clusterURL, this.client, options); - }, - /** - * Connect to your own Weaviate Cloud Service (WCS) instance. - * - * @deprecated Use `connectToWeaviateCloud` instead. - * - * @param {string} clusterURL The URL of your WCD instance. E.g., `https://example.weaviate.network`. - * @param {ConnectToWCSOptions} [options] Additional options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your WCS instance. - */ - connectToWCS: function (clusterURL, options) { - console.warn( - 'The `connectToWCS` method is deprecated. Please use `connectToWeaviateCloud` instead. This method will be removed in a future release.' - ); - return (0, helpers_js_1.connectToWeaviateCloud)(clusterURL, this.client, options); - }, - /** - * Connect to your own Weaviate Cloud (WCD) instance. - * - * @param {string} clusterURL The URL of your WCD instance. E.g., `https://example.weaviate.network`. - * @param {ConnectToWeaviateCloudOptions} [options] Additional options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your WCD instance. - */ - connectToWeaviateCloud: function (clusterURL, options) { - return (0, helpers_js_1.connectToWeaviateCloud)(clusterURL, this.client, options); - }, - client: function (params) { - var _a; - return __awaiter(this, void 0, void 0, function* () { - let { host: httpHost } = params.connectionParams.http; - let { host: grpcHost } = params.connectionParams.grpc; - const { port: httpPort, secure: httpSecure, path: httpPath } = params.connectionParams.http; - const { port: grpcPort, secure: grpcSecure } = params.connectionParams.grpc; - httpHost = cleanHost(httpHost, 'rest'); - grpcHost = cleanHost(grpcHost, 'grpc'); - // check if headers are set - if (!params.headers) params.headers = {}; - const scheme = httpSecure ? 'https' : 'http'; - const agent = httpSecure - ? new https_1.Agent({ keepAlive: true }) - : new http_1.Agent({ keepAlive: true }); - const { connection, dbVersionProvider, dbVersionSupport } = yield index_js_5.ConnectionGRPC.use({ - host: `${scheme}://${httpHost}:${httpPort}${httpPath || ''}`, - scheme: scheme, - headers: params.headers, - grpcAddress: `${grpcHost}:${grpcPort}`, - grpcSecure: grpcSecure, - grpcProxyUrl: (_a = params.proxies) === null || _a === void 0 ? void 0 : _a.grpc, - apiKey: (0, auth_js_1.isApiKey)(params.auth) ? (0, auth_js_1.mapApiKey)(params.auth) : undefined, - authClientSecret: (0, auth_js_1.isApiKey)(params.auth) ? undefined : params.auth, - agent, - timeout: params.timeout, - skipInitChecks: params.skipInitChecks, - }); - const ifc = { - backup: (0, client_js_1.backup)(connection), - cluster: (0, index_js_1.default)(connection), - collections: (0, index_js_4.default)(connection, dbVersionSupport), - close: () => Promise.resolve(connection.close()), - getMeta: () => new metaGetter_js_1.default(connection).do(), - getOpenIDConfig: () => new index_js_6.OpenidConfigurationGetter(connection.http).do(), - getWeaviateVersion: () => dbVersionSupport.getVersion(), - isLive: () => new index_js_6.LiveChecker(connection, dbVersionProvider).do(), - isReady: () => new index_js_6.ReadyChecker(connection, dbVersionProvider).do(), - }; - if (connection.oidcAuth) ifc.oidcAuth = connection.oidcAuth; - return ifc; - }); - }, - ApiKey: auth_js_1.ApiKey, - AuthUserPasswordCredentials: auth_js_1.AuthUserPasswordCredentials, - AuthAccessTokenCredentials: auth_js_1.AuthAccessTokenCredentials, - AuthClientCredentials: auth_js_1.AuthClientCredentials, - configure: index_js_3.configure, - configGuards: index_js_2.configGuards, - reconfigure: index_js_3.reconfigure, -}; -exports.default = app; -__exportStar(require('./collections/index.js'), exports); -__exportStar(require('./connection/index.js'), exports); -__exportStar(require('./utils/base64.js'), exports); -__exportStar(require('./utils/uuid.js'), exports); diff --git a/dist/node/cjs/misc/index.d.ts b/dist/node/cjs/misc/index.d.ts deleted file mode 100644 index 42313024..00000000 --- a/dist/node/cjs/misc/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import Connection from '../connection/index.js'; -import { DbVersionProvider } from '../utils/dbVersion.js'; -import LiveChecker from './liveChecker.js'; -import MetaGetter from './metaGetter.js'; -import OpenidConfigurationGetter from './openidConfigurationGetter.js'; -import ReadyChecker from './readyChecker.js'; -export interface Misc { - liveChecker: () => LiveChecker; - readyChecker: () => ReadyChecker; - metaGetter: () => MetaGetter; - openidConfigurationGetter: () => OpenidConfigurationGetter; -} -declare const misc: (client: Connection, dbVersionProvider: DbVersionProvider) => Misc; -export default misc; -export { default as LiveChecker } from './liveChecker.js'; -export { default as MetaGetter } from './metaGetter.js'; -export { default as OpenidConfigurationGetter } from './openidConfigurationGetter.js'; -export { default as ReadyChecker } from './readyChecker.js'; diff --git a/dist/node/cjs/misc/index.js b/dist/node/cjs/misc/index.js deleted file mode 100644 index 99b754f3..00000000 --- a/dist/node/cjs/misc/index.js +++ /dev/null @@ -1,49 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.ReadyChecker = exports.OpenidConfigurationGetter = exports.MetaGetter = exports.LiveChecker = void 0; -const liveChecker_js_1 = __importDefault(require('./liveChecker.js')); -const metaGetter_js_1 = __importDefault(require('./metaGetter.js')); -const openidConfigurationGetter_js_1 = __importDefault(require('./openidConfigurationGetter.js')); -const readyChecker_js_1 = __importDefault(require('./readyChecker.js')); -const misc = (client, dbVersionProvider) => { - return { - liveChecker: () => new liveChecker_js_1.default(client, dbVersionProvider), - readyChecker: () => new readyChecker_js_1.default(client, dbVersionProvider), - metaGetter: () => new metaGetter_js_1.default(client), - openidConfigurationGetter: () => new openidConfigurationGetter_js_1.default(client.http), - }; -}; -exports.default = misc; -var liveChecker_js_2 = require('./liveChecker.js'); -Object.defineProperty(exports, 'LiveChecker', { - enumerable: true, - get: function () { - return __importDefault(liveChecker_js_2).default; - }, -}); -var metaGetter_js_2 = require('./metaGetter.js'); -Object.defineProperty(exports, 'MetaGetter', { - enumerable: true, - get: function () { - return __importDefault(metaGetter_js_2).default; - }, -}); -var openidConfigurationGetter_js_2 = require('./openidConfigurationGetter.js'); -Object.defineProperty(exports, 'OpenidConfigurationGetter', { - enumerable: true, - get: function () { - return __importDefault(openidConfigurationGetter_js_2).default; - }, -}); -var readyChecker_js_2 = require('./readyChecker.js'); -Object.defineProperty(exports, 'ReadyChecker', { - enumerable: true, - get: function () { - return __importDefault(readyChecker_js_2).default; - }, -}); diff --git a/dist/node/cjs/misc/liveChecker.d.ts b/dist/node/cjs/misc/liveChecker.d.ts deleted file mode 100644 index 434105df..00000000 --- a/dist/node/cjs/misc/liveChecker.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Connection from '../connection/index.js'; -import { DbVersionProvider } from '../utils/dbVersion.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class LiveChecker extends CommandBase { - private dbVersionProvider; - constructor(client: Connection, dbVersionProvider: DbVersionProvider); - validate(): void; - do: () => any; -} diff --git a/dist/node/cjs/misc/liveChecker.js b/dist/node/cjs/misc/liveChecker.js deleted file mode 100644 index a932a90a..00000000 --- a/dist/node/cjs/misc/liveChecker.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class LiveChecker extends commandBase_js_1.CommandBase { - constructor(client, dbVersionProvider) { - super(client); - this.do = () => { - return this.client - .get('/.well-known/live', false) - .then(() => { - setTimeout(() => this.dbVersionProvider.refresh()); - return Promise.resolve(true); - }) - .catch(() => Promise.resolve(false)); - }; - this.dbVersionProvider = dbVersionProvider; - } - validate() { - // nothing to validate - } -} -exports.default = LiveChecker; diff --git a/dist/node/cjs/misc/metaGetter.d.ts b/dist/node/cjs/misc/metaGetter.d.ts deleted file mode 100644 index 2bb8d773..00000000 --- a/dist/node/cjs/misc/metaGetter.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import Connection from '../connection/index.js'; -import { Meta } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class MetaGetter extends CommandBase { - constructor(client: Connection); - validate(): void; - do: () => Promise; -} diff --git a/dist/node/cjs/misc/metaGetter.js b/dist/node/cjs/misc/metaGetter.js deleted file mode 100644 index fa6fbf51..00000000 --- a/dist/node/cjs/misc/metaGetter.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class MetaGetter extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.do = () => { - return this.client.get('/meta', true); - }; - } - validate() { - // nothing to validate - } -} -exports.default = MetaGetter; diff --git a/dist/node/cjs/misc/openidConfigurationGetter.d.ts b/dist/node/cjs/misc/openidConfigurationGetter.d.ts deleted file mode 100644 index f2db85ab..00000000 --- a/dist/node/cjs/misc/openidConfigurationGetter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { HttpClient } from '../connection/http.js'; -export default class OpenidConfigurationGetterGetter { - private client; - constructor(client: HttpClient); - do: () => any; -} diff --git a/dist/node/cjs/misc/openidConfigurationGetter.js b/dist/node/cjs/misc/openidConfigurationGetter.js deleted file mode 100644 index f35684bc..00000000 --- a/dist/node/cjs/misc/openidConfigurationGetter.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -class OpenidConfigurationGetterGetter { - constructor(client) { - this.do = () => { - return this.client.getRaw('/.well-known/openid-configuration').then((res) => { - if (res.status < 400) { - return res.json(); - } - if (res.status == 404) { - // OIDC is not configured - return Promise.resolve(undefined); - } - return Promise.reject(new Error(`unexpected status code: ${res.status}`)); - }); - }; - this.client = client; - } -} -exports.default = OpenidConfigurationGetterGetter; diff --git a/dist/node/cjs/misc/readyChecker.d.ts b/dist/node/cjs/misc/readyChecker.d.ts deleted file mode 100644 index e83d4d1c..00000000 --- a/dist/node/cjs/misc/readyChecker.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Connection from '../connection/index.js'; -import { DbVersionProvider } from '../utils/dbVersion.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ReadyChecker extends CommandBase { - private dbVersionProvider; - constructor(client: Connection, dbVersionProvider: DbVersionProvider); - validate(): void; - do: () => any; -} diff --git a/dist/node/cjs/misc/readyChecker.js b/dist/node/cjs/misc/readyChecker.js deleted file mode 100644 index df7e8456..00000000 --- a/dist/node/cjs/misc/readyChecker.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class ReadyChecker extends commandBase_js_1.CommandBase { - constructor(client, dbVersionProvider) { - super(client); - this.do = () => { - return this.client - .get('/.well-known/ready', false) - .then(() => { - setTimeout(() => this.dbVersionProvider.refresh()); - return Promise.resolve(true); - }) - .catch(() => Promise.resolve(false)); - }; - this.dbVersionProvider = dbVersionProvider; - } - validate() { - // nothing to validate - } -} -exports.default = ReadyChecker; diff --git a/dist/node/cjs/openapi/schema.d.ts b/dist/node/cjs/openapi/schema.d.ts deleted file mode 100644 index 7de49fcd..00000000 --- a/dist/node/cjs/openapi/schema.d.ts +++ /dev/null @@ -1,3100 +0,0 @@ -/** - * This file was auto-generated by openapi-typescript. - * Do not make direct changes to the file. - */ -export interface paths { - '/': { - /** Home. Discover the REST API */ - get: operations['weaviate.root']; - }; - '/.well-known/live': { - /** Determines whether the application is alive. Can be used for kubernetes liveness probe */ - get: operations['weaviate.wellknown.liveness']; - }; - '/.well-known/ready': { - /** Determines whether the application is ready to receive traffic. Can be used for kubernetes readiness probe. */ - get: operations['weaviate.wellknown.readiness']; - }; - '/.well-known/openid-configuration': { - /** OIDC Discovery page, redirects to the token issuer if one is configured */ - get: { - responses: { - /** Successful response, inspect body */ - 200: { - schema: { - /** @description The Location to redirect to */ - href?: string; - /** @description OAuth Client ID */ - clientId?: string; - /** @description OAuth Scopes */ - scopes?: string[]; - }; - }; - /** Not found, no oidc provider present */ - 404: unknown; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - }; - '/objects': { - /** Lists all Objects in reverse order of creation, owned by the user that belongs to the used token. */ - get: operations['objects.list']; - /** Registers a new Object. Provided meta-data and schema values are validated. */ - post: operations['objects.create']; - }; - '/objects/{id}': { - /** Lists Objects. */ - get: operations['objects.get']; - /** Updates an Object's data. Given meta-data and schema values are validated. LastUpdateTime is set to the time this function is called. */ - put: operations['objects.update']; - /** Deletes an Object from the system. */ - delete: operations['objects.delete']; - /** Checks if an Object exists in the system. */ - head: operations['objects.head']; - /** Updates an Object. This method supports json-merge style patch semantics (RFC 7396). Provided meta-data and schema values are validated. LastUpdateTime is set to the time this function is called. */ - patch: operations['objects.patch']; - }; - '/objects/{className}/{id}': { - /** Get a single data object */ - get: operations['objects.class.get']; - /** Update an individual data object based on its class and uuid. */ - put: operations['objects.class.put']; - /** Delete a single data object. */ - delete: operations['objects.class.delete']; - /** Checks if a data object exists without retrieving it. */ - head: operations['objects.class.head']; - /** Update an individual data object based on its class and uuid. This method supports json-merge style patch semantics (RFC 7396). Provided meta-data and schema values are validated. LastUpdateTime is set to the time this function is called. */ - patch: operations['objects.class.patch']; - }; - '/objects/{id}/references/{propertyName}': { - /** Replace all references to a class-property. */ - put: operations['objects.references.update']; - /** Add a single reference to a class-property. */ - post: operations['objects.references.create']; - /** Delete the single reference that is given in the body from the list of references that this property has. */ - delete: operations['objects.references.delete']; - }; - '/objects/{className}/{id}/references/{propertyName}': { - /** Update all references of a property of a data object. */ - put: operations['objects.class.references.put']; - /** Add a single reference to a class-property. */ - post: operations['objects.class.references.create']; - /** Delete the single reference that is given in the body from the list of references that this property of a data object has */ - delete: operations['objects.class.references.delete']; - }; - '/objects/validate': { - /** Validate an Object's schema and meta-data. It has to be based on a schema, which is related to the given Object to be accepted by this validation. */ - post: operations['objects.validate']; - }; - '/batch/objects': { - /** Register new Objects in bulk. Provided meta-data and schema values are validated. */ - post: operations['batch.objects.create']; - /** Delete Objects in bulk that match a certain filter. */ - delete: operations['batch.objects.delete']; - }; - '/batch/references': { - /** Register cross-references between any class items (objects or objects) in bulk. */ - post: operations['batch.references.create']; - }; - '/graphql': { - /** Get an object based on GraphQL */ - post: operations['graphql.post']; - }; - '/graphql/batch': { - /** Perform a batched GraphQL query */ - post: operations['graphql.batch']; - }; - '/meta': { - /** Gives meta information about the server and can be used to provide information to another Weaviate instance that wants to interact with the current instance. */ - get: operations['meta.get']; - }; - '/schema': { - get: operations['schema.dump']; - post: operations['schema.objects.create']; - }; - '/schema/{className}': { - get: operations['schema.objects.get']; - /** Use this endpoint to alter an existing class in the schema. Note that not all settings are mutable. If an error about immutable fields is returned and you still need to update this particular setting, you will have to delete the class (and the underlying data) and recreate. This endpoint cannot be used to modify properties. Instead use POST /v1/schema/{className}/properties. A typical use case for this endpoint is to update configuration, such as the vectorIndexConfig. Note that even in mutable sections, such as vectorIndexConfig, some fields may be immutable. */ - put: operations['schema.objects.update']; - delete: operations['schema.objects.delete']; - }; - '/schema/{className}/properties': { - post: operations['schema.objects.properties.add']; - }; - '/schema/{className}/shards': { - get: operations['schema.objects.shards.get']; - }; - '/schema/{className}/shards/{shardName}': { - /** Update shard status of an Object Class */ - put: operations['schema.objects.shards.update']; - }; - '/schema/{className}/tenants': { - /** get all tenants from a specific class */ - get: operations['tenants.get']; - /** Update tenant of a specific class */ - put: operations['tenants.update']; - /** Create a new tenant for a specific class */ - post: operations['tenants.create']; - /** delete tenants from a specific class */ - delete: operations['tenants.delete']; - }; - '/schema/{className}/tenants/{tenantName}': { - /** Check if a tenant exists for a specific class */ - head: operations['tenant.exists']; - }; - '/backups/{backend}': { - /** [Coming soon] List all backups in progress not implemented yet. */ - get: operations['backups.list']; - /** Starts a process of creating a backup for a set of classes */ - post: operations['backups.create']; - }; - '/backups/{backend}/{id}': { - /** Returns status of backup creation attempt for a set of classes */ - get: operations['backups.create.status']; - /** Cancel created backup with specified ID */ - delete: operations['backups.cancel']; - }; - '/backups/{backend}/{id}/restore': { - /** Returns status of a backup restoration attempt for a set of classes */ - get: operations['backups.restore.status']; - /** Starts a process of restoring a backup for a set of classes */ - post: operations['backups.restore']; - }; - '/cluster/statistics': { - /** Returns Raft cluster statistics of Weaviate DB. */ - get: operations['cluster.get.statistics']; - }; - '/nodes': { - /** Returns status of Weaviate DB. */ - get: operations['nodes.get']; - }; - '/nodes/{className}': { - /** Returns status of Weaviate DB. */ - get: operations['nodes.get.class']; - }; - '/classifications/': { - /** Trigger a classification based on the specified params. Classifications will run in the background, use GET /classifications/ to retrieve the status of your classification. */ - post: operations['classifications.post']; - }; - '/classifications/{id}': { - /** Get status, results and metadata of a previously created classification */ - get: operations['classifications.get']; - }; -} -export interface definitions { - Link: { - /** @description target of the link */ - href?: string; - /** @description relationship if both resources are related, e.g. 'next', 'previous', 'parent', etc. */ - rel?: string; - /** @description human readable name of the resource group */ - name?: string; - /** @description weaviate documentation about this resource group */ - documentationHref?: string; - }; - Principal: { - /** @description The username that was extracted either from the authentication information */ - username?: string; - groups?: string[]; - }; - /** @description An array of available words and contexts. */ - C11yWordsResponse: { - /** @description Weighted results for all words */ - concatenatedWord?: { - concatenatedWord?: string; - singleWords?: unknown[]; - concatenatedVector?: definitions['C11yVector']; - concatenatedNearestNeighbors?: definitions['C11yNearestNeighbors']; - }; - /** @description Weighted results for per individual word */ - individualWords?: { - word?: string; - present?: boolean; - info?: { - vector?: definitions['C11yVector']; - nearestNeighbors?: definitions['C11yNearestNeighbors']; - }; - }[]; - }; - /** @description A resource describing an extension to the contextinoary, containing both the identifier and the definition of the extension */ - C11yExtension: { - /** - * @description The new concept you want to extend. Must be an all-lowercase single word, or a space delimited compound word. Examples: 'foobarium', 'my custom concept' - * @example foobarium - */ - concept?: string; - /** @description A list of space-delimited words or a sentence describing what the custom concept is about. Avoid using the custom concept itself. An Example definition for the custom concept 'foobarium': would be 'a naturally occurring element which can only be seen by programmers' */ - definition?: string; - /** - * Format: float - * @description Weight of the definition of the new concept where 1='override existing definition entirely' and 0='ignore custom definition'. Note that if the custom concept is not present in the contextionary yet, the weight cannot be less than 1. - */ - weight?: number; - }; - /** @description C11y function to show the nearest neighbors to a word. */ - C11yNearestNeighbors: { - word?: string; - /** Format: float */ - distance?: number; - }[]; - /** @description A Vector in the Contextionary */ - C11yVector: number[]; - /** @description A Vector object */ - Vector: number[]; - /** @description A Multi Vector map of named vectors */ - Vectors: { - [key: string]: definitions['Vector']; - }; - /** @description Receive question based on array of classes, properties and values. */ - C11yVectorBasedQuestion: { - /** @description Vectorized classname. */ - classVectors?: number[]; - /** @description Vectorized properties. */ - classProps?: { - propsVectors?: number[]; - /** @description String with valuename. */ - value?: string; - }[]; - }[]; - Deprecation: { - /** @description The id that uniquely identifies this particular deprecations (mostly used internally) */ - id?: string; - /** @description Whether the problematic API functionality is deprecated (planned to be removed) or already removed */ - status?: string; - /** @description Describes which API is effected, usually one of: REST, GraphQL */ - apiType?: string; - /** @description What this deprecation is about */ - msg?: string; - /** @description User-required object to not be affected by the (planned) removal */ - mitigation?: string; - /** @description The deprecation was introduced in this version */ - sinceVersion?: string; - /** @description A best-effort guess of which upcoming version will remove the feature entirely */ - plannedRemovalVersion?: string; - /** @description If the feature has already been removed, it was removed in this version */ - removedIn?: string; - /** - * Format: date-time - * @description If the feature has already been removed, it was removed at this timestamp - */ - removedTime?: string; - /** - * Format: date-time - * @description The deprecation was introduced in this version - */ - sinceTime?: string; - /** @description The locations within the specified API affected by this deprecation */ - locations?: string[]; - }; - /** @description An error response given by Weaviate end-points. */ - ErrorResponse: { - error?: { - message?: string; - }[]; - }; - /** @description An error response caused by a GraphQL query. */ - GraphQLError: { - locations?: { - /** Format: int64 */ - column?: number; - /** Format: int64 */ - line?: number; - }[]; - message?: string; - path?: string[]; - }; - /** @description GraphQL query based on: http://facebook.github.io/graphql/. */ - GraphQLQuery: { - /** @description The name of the operation if multiple exist in the query. */ - operationName?: string; - /** @description Query based on GraphQL syntax. */ - query?: string; - /** @description Additional variables for the query. */ - variables?: { - [key: string]: unknown; - }; - }; - /** @description A list of GraphQL queries. */ - GraphQLQueries: definitions['GraphQLQuery'][]; - /** @description GraphQL based response: http://facebook.github.io/graphql/. */ - GraphQLResponse: { - /** @description GraphQL data object. */ - data?: { - [key: string]: definitions['JsonObject']; - }; - /** @description Array with errors. */ - errors?: definitions['GraphQLError'][]; - }; - /** @description A list of GraphQL responses. */ - GraphQLResponses: definitions['GraphQLResponse'][]; - /** @description Configure the inverted index built into Weaviate */ - InvertedIndexConfig: { - /** - * Format: int - * @description Asynchronous index clean up happens every n seconds - */ - cleanupIntervalSeconds?: number; - bm25?: definitions['BM25Config']; - stopwords?: definitions['StopwordConfig']; - /** @description Index each object by its internal timestamps */ - indexTimestamps?: boolean; - /** @description Index each object with the null state */ - indexNullState?: boolean; - /** @description Index length of properties */ - indexPropertyLength?: boolean; - }; - /** @description Configure how replication is executed in a cluster */ - ReplicationConfig: { - /** @description Number of times a class is replicated */ - factor?: number; - /** @description Enable asynchronous replication */ - asyncEnabled?: boolean; - /** - * @description Conflict resolution strategy for deleted objects - * @enum {string} - */ - deletionStrategy?: 'NoAutomatedResolution' | 'DeleteOnConflict'; - }; - /** @description tuning parameters for the BM25 algorithm */ - BM25Config: { - /** - * Format: float - * @description calibrates term-weight scaling based on the term frequency within a document - */ - k1?: number; - /** - * Format: float - * @description calibrates term-weight scaling based on the document length - */ - b?: number; - }; - /** @description fine-grained control over stopword list usage */ - StopwordConfig: { - /** @description pre-existing list of common words by language */ - preset?: string; - /** @description stopwords to be considered additionally */ - additions?: string[]; - /** @description stopwords to be removed from consideration */ - removals?: string[]; - }; - /** @description Configuration related to multi-tenancy within a class */ - MultiTenancyConfig: { - /** @description Whether or not multi-tenancy is enabled for this class */ - enabled?: boolean; - /** @description Nonexistent tenants should (not) be created implicitly */ - autoTenantCreation?: boolean; - /** @description Existing tenants should (not) be turned HOT implicitly when they are accessed and in another activity status */ - autoTenantActivation?: boolean; - }; - /** @description JSON object value. */ - JsonObject: { - [key: string]: unknown; - }; - /** @description Contains meta information of the current Weaviate instance. */ - Meta: { - /** - * Format: url - * @description The url of the host. - */ - hostname?: string; - /** @description Version of weaviate you are currently running */ - version?: string; - /** @description Module-specific meta information */ - modules?: { - [key: string]: unknown; - }; - }; - /** @description Multiple instances of references to other objects. */ - MultipleRef: definitions['SingleRef'][]; - /** @description Either a JSONPatch document as defined by RFC 6902 (from, op, path, value), or a merge document (RFC 7396). */ - PatchDocumentObject: { - /** @description A string containing a JSON Pointer value. */ - from?: string; - /** - * @description The operation to be performed. - * @enum {string} - */ - op: 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test'; - /** @description A JSON-Pointer. */ - path: string; - /** @description The value to be used within the operations. */ - value?: { - [key: string]: unknown; - }; - merge?: definitions['Object']; - }; - /** @description Either a JSONPatch document as defined by RFC 6902 (from, op, path, value), or a merge document (RFC 7396). */ - PatchDocumentAction: { - /** @description A string containing a JSON Pointer value. */ - from?: string; - /** - * @description The operation to be performed. - * @enum {string} - */ - op: 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test'; - /** @description A JSON-Pointer. */ - path: string; - /** @description The value to be used within the operations. */ - value?: { - [key: string]: unknown; - }; - merge?: definitions['Object']; - }; - /** @description A single peer in the network. */ - PeerUpdate: { - /** - * Format: uuid - * @description The session ID of the peer. - */ - id?: string; - /** @description Human readable name. */ - name?: string; - /** - * Format: uri - * @description The location where the peer is exposed to the internet. - */ - uri?: string; - /** @description The latest known hash of the peer's schema. */ - schemaHash?: string; - }; - /** @description List of known peers. */ - PeerUpdateList: definitions['PeerUpdate'][]; - /** @description Allow custom overrides of vector weights as math expressions. E.g. "pancake": "7" will set the weight for the word pancake to 7 in the vectorization, whereas "w * 3" would triple the originally calculated word. This is an open object, with OpenAPI Specification 3.0 this will be more detailed. See Weaviate docs for more info. In the future this will become a key/value (string/string) object. */ - VectorWeights: { - [key: string]: unknown; - }; - /** @description This is an open object, with OpenAPI Specification 3.0 this will be more detailed. See Weaviate docs for more info. In the future this will become a key/value OR a SingleRef definition. */ - PropertySchema: { - [key: string]: unknown; - }; - /** @description This is an open object, with OpenAPI Specification 3.0 this will be more detailed. See Weaviate docs for more info. In the future this will become a key/value OR a SingleRef definition. */ - SchemaHistory: { - [key: string]: unknown; - }; - /** @description Definitions of semantic schemas (also see: https://github.com/weaviate/weaviate-semantic-schemas). */ - Schema: { - /** @description Semantic classes that are available. */ - classes?: definitions['Class'][]; - /** - * Format: email - * @description Email of the maintainer. - */ - maintainer?: string; - /** @description Name of the schema. */ - name?: string; - }; - /** @description Indicates the health of the schema in a cluster. */ - SchemaClusterStatus: { - /** @description True if the cluster is in sync, false if there is an issue (see error). */ - healthy?: boolean; - /** @description Contains the sync check error if one occurred */ - error?: string; - /** @description Hostname of the coordinating node, i.e. the one that received the cluster. This can be useful information if the error message contains phrases such as 'other nodes agree, but local does not', etc. */ - hostname?: string; - /** - * Format: int - * @description Number of nodes that participated in the sync check - */ - nodeCount?: number; - /** @description The cluster check at startup can be ignored (to recover from an out-of-sync situation). */ - ignoreSchemaSync?: boolean; - }; - Class: { - /** @description Name of the class as URI relative to the schema URL. */ - class?: string; - vectorConfig?: { - [key: string]: definitions['VectorConfig']; - }; - /** @description Name of the vector index to use, eg. (HNSW) */ - vectorIndexType?: string; - /** @description Vector-index config, that is specific to the type of index selected in vectorIndexType */ - vectorIndexConfig?: { - [key: string]: unknown; - }; - /** @description Manage how the index should be sharded and distributed in the cluster */ - shardingConfig?: { - [key: string]: unknown; - }; - replicationConfig?: definitions['ReplicationConfig']; - invertedIndexConfig?: definitions['InvertedIndexConfig']; - multiTenancyConfig?: definitions['MultiTenancyConfig']; - /** @description Specify how the vectors for this class should be determined. The options are either 'none' - this means you have to import a vector with each object yourself - or the name of a module that provides vectorization capabilities, such as 'text2vec-contextionary'. If left empty, it will use the globally configured default which can itself either be 'none' or a specific module. */ - vectorizer?: string; - /** @description Configuration specific to modules this Weaviate instance has installed */ - moduleConfig?: { - [key: string]: unknown; - }; - /** @description Description of the class. */ - description?: string; - /** @description The properties of the class. */ - properties?: definitions['Property'][]; - }; - Property: { - /** @description Can be a reference to another type when it starts with a capital (for example Person), otherwise "string" or "int". */ - dataType?: string[]; - /** @description Description of the property. */ - description?: string; - /** @description Configuration specific to modules this Weaviate instance has installed */ - moduleConfig?: { - [key: string]: unknown; - }; - /** @description Name of the property as URI relative to the schema URL. */ - name?: string; - /** @description Optional. Should this property be indexed in the inverted index. Defaults to true. If you choose false, you will not be able to use this property in where filters, bm25 or hybrid search. This property has no affect on vectorization decisions done by modules (deprecated as of v1.19; use indexFilterable or/and indexSearchable instead) */ - indexInverted?: boolean; - /** @description Optional. Should this property be indexed in the inverted index. Defaults to true. If you choose false, you will not be able to use this property in where filters. This property has no affect on vectorization decisions done by modules */ - indexFilterable?: boolean; - /** @description Optional. Should this property be indexed in the inverted index. Defaults to true. Applicable only to properties of data type text and text[]. If you choose false, you will not be able to use this property in bm25 or hybrid search. This property has no affect on vectorization decisions done by modules */ - indexSearchable?: boolean; - /** @description Optional. Should this property be indexed in the inverted index. Defaults to false. Provides better performance for range queries compared to filterable index in large datasets. Applicable only to properties of data type int, number, date. */ - indexRangeFilters?: boolean; - /** - * @description Determines tokenization of the property as separate words or whole field. Optional. Applies to text and text[] data types. Allowed values are `word` (default; splits on any non-alphanumerical, lowercases), `lowercase` (splits on white spaces, lowercases), `whitespace` (splits on white spaces), `field` (trims). Not supported for remaining data types - * @enum {string} - */ - tokenization?: 'word' | 'lowercase' | 'whitespace' | 'field' | 'trigram' | 'gse' | 'kagome_kr'; - /** @description The properties of the nested object(s). Applies to object and object[] data types. */ - nestedProperties?: definitions['NestedProperty'][]; - }; - VectorConfig: { - /** @description Configuration of a specific vectorizer used by this vector */ - vectorizer?: { - [key: string]: unknown; - }; - /** @description Name of the vector index to use, eg. (HNSW) */ - vectorIndexType?: string; - /** @description Vector-index config, that is specific to the type of index selected in vectorIndexType */ - vectorIndexConfig?: { - [key: string]: unknown; - }; - }; - NestedProperty: { - dataType?: string[]; - description?: string; - name?: string; - indexFilterable?: boolean; - indexSearchable?: boolean; - indexRangeFilters?: boolean; - /** @enum {string} */ - tokenization?: 'word' | 'lowercase' | 'whitespace' | 'field'; - nestedProperties?: definitions['NestedProperty'][]; - }; - /** @description The status of all the shards of a Class */ - ShardStatusList: definitions['ShardStatusGetResponse'][]; - /** @description Response body of shard status get request */ - ShardStatusGetResponse: { - /** @description Name of the shard */ - name?: string; - /** @description Status of the shard */ - status?: string; - /** @description Size of the vector queue of the shard */ - vectorQueueSize?: number; - }; - /** @description The status of a single shard */ - ShardStatus: { - /** @description Status of the shard */ - status?: string; - }; - /** @description The definition of a backup create metadata */ - BackupCreateStatusResponse: { - /** @description The ID of the backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id?: string; - /** @description Backup backend name e.g. filesystem, gcs, s3. */ - backend?: string; - /** @description destination path of backup files proper to selected backend */ - path?: string; - /** @description error message if creation failed */ - error?: string; - /** - * @description phase of backup creation process - * @default STARTED - * @enum {string} - */ - status?: 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED' | 'CANCELED'; - }; - /** @description The definition of a backup restore metadata */ - BackupRestoreStatusResponse: { - /** @description The ID of the backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id?: string; - /** @description Backup backend name e.g. filesystem, gcs, s3. */ - backend?: string; - /** @description destination path of backup files proper to selected backup backend */ - path?: string; - /** @description error message if restoration failed */ - error?: string; - /** - * @description phase of backup restoration process - * @default STARTED - * @enum {string} - */ - status?: 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED' | 'CANCELED'; - }; - /** @description Backup custom configuration */ - BackupConfig: { - /** - * @description Desired CPU core utilization ranging from 1%-80% - * @default 50 - */ - CPUPercentage?: number; - /** - * @description Weaviate will attempt to come close the specified size, with a minimum of 2MB, default of 128MB, and a maximum of 512MB - * @default 128 - */ - ChunkSize?: number; - /** - * @description compression level used by compression algorithm - * @default DefaultCompression - * @enum {string} - */ - CompressionLevel?: 'DefaultCompression' | 'BestSpeed' | 'BestCompression'; - }; - /** @description Backup custom configuration */ - RestoreConfig: { - /** - * @description Desired CPU core utilization ranging from 1%-80% - * @default 50 - */ - CPUPercentage?: number; - }; - /** @description Request body for creating a backup of a set of classes */ - BackupCreateRequest: { - /** @description The ID of the backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id?: string; - /** @description Custom configuration for the backup creation process */ - config?: definitions['BackupConfig']; - /** @description List of classes to include in the backup creation process */ - include?: string[]; - /** @description List of classes to exclude from the backup creation process */ - exclude?: string[]; - }; - /** @description The definition of a backup create response body */ - BackupCreateResponse: { - /** @description The ID of the backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id?: string; - /** @description The list of classes for which the backup creation process was started */ - classes?: string[]; - /** @description Backup backend name e.g. filesystem, gcs, s3. */ - backend?: string; - /** @description destination path of backup files proper to selected backend */ - path?: string; - /** @description error message if creation failed */ - error?: string; - /** - * @description phase of backup creation process - * @default STARTED - * @enum {string} - */ - status?: 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED' | 'CANCELED'; - }; - /** @description The definition of a backup create response body */ - BackupListResponse: { - /** @description The ID of the backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id?: string; - /** @description destination path of backup files proper to selected backend */ - path?: string; - /** @description The list of classes for which the existed backup process */ - classes?: string[]; - /** - * @description status of backup process - * @enum {string} - */ - status?: 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED' | 'CANCELED'; - }[]; - /** @description Request body for restoring a backup for a set of classes */ - BackupRestoreRequest: { - /** @description Custom configuration for the backup restoration process */ - config?: definitions['RestoreConfig']; - /** @description List of classes to include in the backup restoration process */ - include?: string[]; - /** @description List of classes to exclude from the backup restoration process */ - exclude?: string[]; - /** @description Allows overriding the node names stored in the backup with different ones. Useful when restoring backups to a different environment. */ - node_mapping?: { - [key: string]: string; - }; - }; - /** @description The definition of a backup restore response body */ - BackupRestoreResponse: { - /** @description The ID of the backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id?: string; - /** @description The list of classes for which the backup restoration process was started */ - classes?: string[]; - /** @description Backup backend name e.g. filesystem, gcs, s3. */ - backend?: string; - /** @description destination path of backup files proper to selected backend */ - path?: string; - /** @description error message if restoration failed */ - error?: string; - /** - * @description phase of backup restoration process - * @default STARTED - * @enum {string} - */ - status?: 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED' | 'CANCELED'; - }; - /** @description The summary of Weaviate's statistics. */ - NodeStats: { - /** - * Format: int - * @description The count of Weaviate's shards. - */ - shardCount?: number; - /** - * Format: int64 - * @description The total number of objects in DB. - */ - objectCount?: number; - }; - /** @description The summary of a nodes batch queue congestion status. */ - BatchStats: { - /** - * Format: int - * @description How many objects are currently in the batch queue. - */ - queueLength?: number; - /** - * Format: int - * @description How many objects are approximately processed from the batch queue per second. - */ - ratePerSecond?: number; - }; - /** @description The definition of a node shard status response body */ - NodeShardStatus: { - /** @description The name of the shard. */ - name?: string; - /** @description The name of shard's class. */ - class?: string; - /** - * Format: int64 - * @description The number of objects in shard. - */ - objectCount?: number; - /** - * Format: string - * @description The status of the vector indexing process. - */ - vectorIndexingStatus?: unknown; - /** - * Format: boolean - * @description The status of vector compression/quantization. - */ - compressed?: unknown; - /** - * Format: int64 - * @description The length of the vector indexing queue. - */ - vectorQueueLength?: number; - /** @description The load status of the shard. */ - loaded?: boolean; - }; - /** @description The definition of a backup node status response body */ - NodeStatus: { - /** @description The name of the node. */ - name?: string; - /** - * @description Node's status. - * @default HEALTHY - * @enum {string} - */ - status?: 'HEALTHY' | 'UNHEALTHY' | 'UNAVAILABLE' | 'TIMEOUT'; - /** @description The version of Weaviate. */ - version?: string; - /** @description The gitHash of Weaviate. */ - gitHash?: string; - /** @description Weaviate overall statistics. */ - stats?: definitions['NodeStats']; - /** @description Weaviate batch statistics. */ - batchStats?: definitions['BatchStats']; - /** @description The list of the shards with it's statistics. */ - shards?: definitions['NodeShardStatus'][]; - }; - /** @description The status of all of the Weaviate nodes */ - NodesStatusResponse: { - nodes?: definitions['NodeStatus'][]; - }; - /** @description The definition of Raft statistics. */ - RaftStatistics: { - appliedIndex?: string; - commitIndex?: string; - fsmPending?: string; - lastContact?: string; - lastLogIndex?: string; - lastLogTerm?: string; - lastSnapshotIndex?: string; - lastSnapshotTerm?: string; - /** @description Weaviate Raft nodes. */ - latestConfiguration?: { - [key: string]: unknown; - }; - latestConfigurationIndex?: string; - numPeers?: string; - protocolVersion?: string; - protocolVersionMax?: string; - protocolVersionMin?: string; - snapshotVersionMax?: string; - snapshotVersionMin?: string; - state?: string; - term?: string; - }; - /** @description The definition of node statistics. */ - Statistics: { - /** @description The name of the node. */ - name?: string; - /** - * @description Node's status. - * @default HEALTHY - * @enum {string} - */ - status?: 'HEALTHY' | 'UNHEALTHY' | 'UNAVAILABLE' | 'TIMEOUT'; - bootstrapped?: boolean; - dbLoaded?: boolean; - /** Format: uint64 */ - initialLastAppliedIndex?: number; - lastAppliedIndex?: number; - isVoter?: boolean; - leaderId?: { - [key: string]: unknown; - }; - leaderAddress?: { - [key: string]: unknown; - }; - open?: boolean; - ready?: boolean; - candidates?: { - [key: string]: unknown; - }; - /** @description Weaviate Raft statistics. */ - raft?: definitions['RaftStatistics']; - }; - /** @description The cluster statistics of all of the Weaviate nodes */ - ClusterStatisticsResponse: { - statistics?: definitions['Statistics'][]; - synchronized?: boolean; - }; - /** @description Either set beacon (direct reference) or set class and schema (concept reference) */ - SingleRef: { - /** - * Format: uri - * @description If using a concept reference (rather than a direct reference), specify the desired class name here - */ - class?: string; - /** @description If using a concept reference (rather than a direct reference), specify the desired properties here */ - schema?: definitions['PropertySchema']; - /** - * Format: uri - * @description If using a direct reference, specify the URI to point to the cross-ref here. Should be in the form of weaviate://localhost/ for the example of a local cross-ref to an object - */ - beacon?: string; - /** - * Format: uri - * @description If using a direct reference, this read-only fields provides a link to the referenced resource. If 'origin' is globally configured, an absolute URI is shown - a relative URI otherwise. - */ - href?: string; - /** @description Additional Meta information about classifications if the item was part of one */ - classification?: definitions['ReferenceMetaClassification']; - }; - /** @description Additional Meta information about a single object object. */ - AdditionalProperties: { - [key: string]: { - [key: string]: unknown; - }; - }; - /** @description This meta field contains additional info about the classified reference property */ - ReferenceMetaClassification: { - /** - * Format: int64 - * @description overall neighbors checked as part of the classification. In most cases this will equal k, but could be lower than k - for example if not enough data was present - */ - overallCount?: number; - /** - * Format: int64 - * @description size of the winning group, a number between 1..k - */ - winningCount?: number; - /** - * Format: int64 - * @description size of the losing group, can be 0 if the winning group size equals k - */ - losingCount?: number; - /** - * Format: float32 - * @description The lowest distance of any neighbor, regardless of whether they were in the winning or losing group - */ - closestOverallDistance?: number; - /** - * Format: float32 - * @description deprecated - do not use, to be removed in 0.23.0 - */ - winningDistance?: number; - /** - * Format: float32 - * @description Mean distance of all neighbors from the winning group - */ - meanWinningDistance?: number; - /** - * Format: float32 - * @description Closest distance of a neighbor from the winning group - */ - closestWinningDistance?: number; - /** - * Format: float32 - * @description The lowest distance of a neighbor in the losing group. Optional. If k equals the size of the winning group, there is no losing group - */ - closestLosingDistance?: number; - /** - * Format: float32 - * @description deprecated - do not use, to be removed in 0.23.0 - */ - losingDistance?: number; - /** - * Format: float32 - * @description Mean distance of all neighbors from the losing group. Optional. If k equals the size of the winning group, there is no losing group. - */ - meanLosingDistance?: number; - }; - BatchReference: { - /** - * Format: uri - * @description Long-form beacon-style URI to identify the source of the cross-ref including the property name. Should be in the form of weaviate://localhost////, where must be one of 'objects', 'objects' and and must represent the cross-ref property of source class to be used. - * @example weaviate://localhost/Zoo/a5d09582-4239-4702-81c9-92a6e0122bb4/hasAnimals - */ - from?: string; - /** - * Format: uri - * @description Short-form URI to point to the cross-ref. Should be in the form of weaviate://localhost/ for the example of a local cross-ref to an object - * @example weaviate://localhost/97525810-a9a5-4eb0-858a-71449aeb007f - */ - to?: string; - /** @description Name of the reference tenant. */ - tenant?: string; - }; - BatchReferenceResponse: definitions['BatchReference'] & { - /** - * Format: object - * @description Results for this specific reference. - */ - result?: { - /** - * @default SUCCESS - * @enum {string} - */ - status?: 'SUCCESS' | 'PENDING' | 'FAILED'; - errors?: definitions['ErrorResponse']; - }; - }; - GeoCoordinates: { - /** - * Format: float - * @description The latitude of the point on earth in decimal form - */ - latitude?: number; - /** - * Format: float - * @description The longitude of the point on earth in decimal form - */ - longitude?: number; - }; - PhoneNumber: { - /** @description The raw input as the phone number is present in your raw data set. It will be parsed into the standardized formats if valid. */ - input?: string; - /** @description Read-only. Parsed result in the international format (e.g. +49 123 ...) */ - internationalFormatted?: string; - /** @description Optional. The ISO 3166-1 alpha-2 country code. This is used to figure out the correct countryCode and international format if only a national number (e.g. 0123 4567) is provided */ - defaultCountry?: string; - /** - * Format: uint64 - * @description Read-only. The numerical country code (e.g. 49) - */ - countryCode?: number; - /** - * Format: uint64 - * @description Read-only. The numerical representation of the national part - */ - national?: number; - /** @description Read-only. Parsed result in the national format (e.g. 0123 456789) */ - nationalFormatted?: string; - /** @description Read-only. Indicates whether the parsed number is a valid phone number */ - valid?: boolean; - }; - Object: { - /** @description Class of the Object, defined in the schema. */ - class?: string; - vectorWeights?: definitions['VectorWeights']; - properties?: definitions['PropertySchema']; - /** - * Format: uuid - * @description ID of the Object. - */ - id?: string; - /** - * Format: int64 - * @description Timestamp of creation of this Object in milliseconds since epoch UTC. - */ - creationTimeUnix?: number; - /** - * Format: int64 - * @description Timestamp of the last Object update in milliseconds since epoch UTC. - */ - lastUpdateTimeUnix?: number; - /** @description This field returns vectors associated with the Object. C11yVector, Vector or Vectors values are possible. */ - vector?: definitions['C11yVector']; - /** @description This field returns vectors associated with the Object. */ - vectors?: definitions['Vectors']; - /** @description Name of the Objects tenant. */ - tenant?: string; - additional?: definitions['AdditionalProperties']; - }; - ObjectsGetResponse: definitions['Object'] & { - deprecations?: definitions['Deprecation'][]; - } & { - /** - * Format: object - * @description Results for this specific Object. - */ - result?: { - /** - * @default SUCCESS - * @enum {string} - */ - status?: 'SUCCESS' | 'PENDING' | 'FAILED'; - errors?: definitions['ErrorResponse']; - }; - }; - BatchDelete: { - /** @description Outlines how to find the objects to be deleted. */ - match?: { - /** - * @description Class (name) which objects will be deleted. - * @example City - */ - class?: string; - /** @description Filter to limit the objects to be deleted. */ - where?: definitions['WhereFilter']; - }; - /** - * @description Controls the verbosity of the output, possible values are: "minimal", "verbose". Defaults to "minimal". - * @default minimal - */ - output?: string; - /** - * @description If true, objects will not be deleted yet, but merely listed. Defaults to false. - * @default false - */ - dryRun?: boolean; - }; - /** @description Delete Objects response. */ - BatchDeleteResponse: { - /** @description Outlines how to find the objects to be deleted. */ - match?: { - /** - * @description Class (name) which objects will be deleted. - * @example City - */ - class?: string; - /** @description Filter to limit the objects to be deleted. */ - where?: definitions['WhereFilter']; - }; - /** - * @description Controls the verbosity of the output, possible values are: "minimal", "verbose". Defaults to "minimal". - * @default minimal - */ - output?: string; - /** - * @description If true, objects will not be deleted yet, but merely listed. Defaults to false. - * @default false - */ - dryRun?: boolean; - results?: { - /** - * Format: int64 - * @description How many objects were matched by the filter. - */ - matches?: number; - /** - * Format: int64 - * @description The most amount of objects that can be deleted in a single query, equals QUERY_MAXIMUM_RESULTS. - */ - limit?: number; - /** - * Format: int64 - * @description How many objects were successfully deleted in this round. - */ - successful?: number; - /** - * Format: int64 - * @description How many objects should have been deleted but could not be deleted. - */ - failed?: number; - /** @description With output set to "minimal" only objects with error occurred will the be described. Successfully deleted objects would be omitted. Output set to "verbose" will list all of the objets with their respective statuses. */ - objects?: { - /** - * Format: uuid - * @description ID of the Object. - */ - id?: string; - /** - * @default SUCCESS - * @enum {string} - */ - status?: 'SUCCESS' | 'DRYRUN' | 'FAILED'; - errors?: definitions['ErrorResponse']; - }[]; - }; - }; - /** @description List of Objects. */ - ObjectsListResponse: { - /** @description The actual list of Objects. */ - objects?: definitions['Object'][]; - deprecations?: definitions['Deprecation'][]; - /** - * Format: int64 - * @description The total number of Objects for the query. The number of items in a response may be smaller due to paging. - */ - totalResults?: number; - }; - /** @description Manage classifications, trigger them and view status of past classifications. */ - Classification: { - /** - * Format: uuid - * @description ID to uniquely identify this classification run - * @example ee722219-b8ec-4db1-8f8d-5150bb1a9e0c - */ - id?: string; - /** - * @description class (name) which is used in this classification - * @example City - */ - class?: string; - /** - * @description which ref-property to set as part of the classification - * @example [ - * "inCountry" - * ] - */ - classifyProperties?: string[]; - /** - * @description base the text-based classification on these fields (of type text) - * @example [ - * "description" - * ] - */ - basedOnProperties?: string[]; - /** - * @description status of this classification - * @example running - * @enum {string} - */ - status?: 'running' | 'completed' | 'failed'; - /** @description additional meta information about the classification */ - meta?: definitions['ClassificationMeta']; - /** @description which algorithm to use for classifications */ - type?: string; - /** @description classification-type specific settings */ - settings?: { - [key: string]: unknown; - }; - /** - * @description error message if status == failed - * @default - * @example classify xzy: something went wrong - */ - error?: string; - filters?: { - /** @description limit the objects to be classified */ - sourceWhere?: definitions['WhereFilter']; - /** @description Limit the training objects to be considered during the classification. Can only be used on types with explicit training sets, such as 'knn' */ - trainingSetWhere?: definitions['WhereFilter']; - /** @description Limit the possible sources when using an algorithm which doesn't really on training data, e.g. 'contextual'. When using an algorithm with a training set, such as 'knn', limit the training set instead */ - targetWhere?: definitions['WhereFilter']; - }; - }; - /** @description Additional information to a specific classification */ - ClassificationMeta: { - /** - * Format: date-time - * @description time when this classification was started - * @example 2017-07-21T17:32:28Z - */ - started?: string; - /** - * Format: date-time - * @description time when this classification finished - * @example 2017-07-21T17:32:28Z - */ - completed?: string; - /** - * @description number of objects which were taken into consideration for classification - * @example 147 - */ - count?: number; - /** - * @description number of objects successfully classified - * @example 140 - */ - countSucceeded?: number; - /** - * @description number of objects which could not be classified - see error message for details - * @example 7 - */ - countFailed?: number; - }; - /** @description Filter search results using a where filter */ - WhereFilter: { - /** @description combine multiple where filters, requires 'And' or 'Or' operator */ - operands?: definitions['WhereFilter'][]; - /** - * @description operator to use - * @example GreaterThanEqual - * @enum {string} - */ - operator?: - | 'And' - | 'Or' - | 'Equal' - | 'Like' - | 'NotEqual' - | 'GreaterThan' - | 'GreaterThanEqual' - | 'LessThan' - | 'LessThanEqual' - | 'WithinGeoRange' - | 'IsNull' - | 'ContainsAny' - | 'ContainsAll'; - /** - * @description path to the property currently being filtered - * @example [ - * "inCity", - * "City", - * "name" - * ] - */ - path?: string[]; - /** - * Format: int64 - * @description value as integer - * @example 2000 - */ - valueInt?: number; - /** - * Format: float64 - * @description value as number/float - * @example 3.14 - */ - valueNumber?: number; - /** - * @description value as boolean - * @example false - */ - valueBoolean?: boolean; - /** - * @description value as text (deprecated as of v1.19; alias for valueText) - * @example my search term - */ - valueString?: string; - /** - * @description value as text - * @example my search term - */ - valueText?: string; - /** - * @description value as date (as string) - * @example TODO - */ - valueDate?: string; - /** - * @description value as integer - * @example [100, 200] - */ - valueIntArray?: number[]; - /** - * @description value as number/float - * @example [ - * 3.14 - * ] - */ - valueNumberArray?: number[]; - /** - * @description value as boolean - * @example [ - * true, - * false - * ] - */ - valueBooleanArray?: boolean[]; - /** - * @description value as text (deprecated as of v1.19; alias for valueText) - * @example [ - * "my search term" - * ] - */ - valueStringArray?: string[]; - /** - * @description value as text - * @example [ - * "my search term" - * ] - */ - valueTextArray?: string[]; - /** - * @description value as date (as string) - * @example TODO - */ - valueDateArray?: string[]; - /** @description value as geo coordinates and distance */ - valueGeoRange?: definitions['WhereFilterGeoRange']; - }; - /** @description filter within a distance of a georange */ - WhereFilterGeoRange: { - geoCoordinates?: definitions['GeoCoordinates']; - distance?: { - /** Format: float64 */ - max?: number; - }; - }; - /** @description attributes representing a single tenant within weaviate */ - Tenant: { - /** @description name of the tenant */ - name?: string; - /** - * @description activity status of the tenant's shard. Optional for creating tenant (implicit `ACTIVE`) and required for updating tenant. For creation, allowed values are `ACTIVE` - tenant is fully active and `INACTIVE` - tenant is inactive; no actions can be performed on tenant, tenant's files are stored locally. For updating, `ACTIVE`, `INACTIVE` and also `OFFLOADED` - as INACTIVE, but files are stored on cloud storage. The following values are read-only and are set by the server for internal use: `OFFLOADING` - tenant is transitioning from ACTIVE/INACTIVE to OFFLOADED, `ONLOADING` - tenant is transitioning from OFFLOADED to ACTIVE/INACTIVE. We still accept deprecated names `HOT` (now `ACTIVE`), `COLD` (now `INACTIVE`), `FROZEN` (now `OFFLOADED`), `FREEZING` (now `OFFLOADING`), `UNFREEZING` (now `ONLOADING`). - * @enum {string} - */ - activityStatus?: - | 'ACTIVE' - | 'INACTIVE' - | 'OFFLOADED' - | 'OFFLOADING' - | 'ONLOADING' - | 'HOT' - | 'COLD' - | 'FROZEN' - | 'FREEZING' - | 'UNFREEZING'; - }; -} -export interface parameters { - /** @description The starting ID of the result window. */ - CommonAfterParameterQuery: string; - /** - * Format: int64 - * @description The starting index of the result window. Default value is 0. - * @default 0 - */ - CommonOffsetParameterQuery: number; - /** - * Format: int64 - * @description The maximum number of items to be returned per page. Default value is set in Weaviate config. - */ - CommonLimitParameterQuery: number; - /** @description Include additional information, such as classification infos. Allowed values include: classification, vector, interpretation */ - CommonIncludeParameterQuery: string; - /** @description Determines how many replicas must acknowledge a request before it is considered successful */ - CommonConsistencyLevelParameterQuery: string; - /** @description Specifies the tenant in a request targeting a multi-tenant class */ - CommonTenantParameterQuery: string; - /** @description The target node which should fulfill the request */ - CommonNodeNameParameterQuery: string; - /** @description Sort parameter to pass an information about the names of the sort fields */ - CommonSortParameterQuery: string; - /** @description Order parameter to tell how to order (asc or desc) data within given field */ - CommonOrderParameterQuery: string; - /** @description Class parameter specifies the class from which to query objects */ - CommonClassParameterQuery: string; - /** - * @description Controls the verbosity of the output, possible values are: "minimal", "verbose". Defaults to "minimal". - * @default minimal - */ - CommonOutputVerbosityParameterQuery: string; -} -export interface operations { - /** Home. Discover the REST API */ - 'weaviate.root': { - responses: { - /** Weaviate is alive and ready to serve content */ - 200: { - schema: { - links?: definitions['Link'][]; - }; - }; - }; - }; - /** Determines whether the application is alive. Can be used for kubernetes liveness probe */ - 'weaviate.wellknown.liveness': { - responses: { - /** The application is able to respond to HTTP requests */ - 200: unknown; - }; - }; - /** Determines whether the application is ready to receive traffic. Can be used for kubernetes readiness probe. */ - 'weaviate.wellknown.readiness': { - responses: { - /** The application has completed its start-up routine and is ready to accept traffic. */ - 200: unknown; - /** The application is currently not able to serve traffic. If other horizontal replicas of weaviate are available and they are capable of receiving traffic, all traffic should be redirected there instead. */ - 503: unknown; - }; - }; - /** Lists all Objects in reverse order of creation, owned by the user that belongs to the used token. */ - 'objects.list': { - parameters: { - query: { - /** The starting ID of the result window. */ - after?: parameters['CommonAfterParameterQuery']; - /** The starting index of the result window. Default value is 0. */ - offset?: parameters['CommonOffsetParameterQuery']; - /** The maximum number of items to be returned per page. Default value is set in Weaviate config. */ - limit?: parameters['CommonLimitParameterQuery']; - /** Include additional information, such as classification infos. Allowed values include: classification, vector, interpretation */ - include?: parameters['CommonIncludeParameterQuery']; - /** Sort parameter to pass an information about the names of the sort fields */ - sort?: parameters['CommonSortParameterQuery']; - /** Order parameter to tell how to order (asc or desc) data within given field */ - order?: parameters['CommonOrderParameterQuery']; - /** Class parameter specifies the class from which to query objects */ - class?: parameters['CommonClassParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successful response. */ - 200: { - schema: definitions['ObjectsListResponse']; - }; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Registers a new Object. Provided meta-data and schema values are validated. */ - 'objects.create': { - parameters: { - body: { - body: definitions['Object']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - }; - }; - responses: { - /** Object created. */ - 200: { - schema: definitions['Object']; - }; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Lists Objects. */ - 'objects.get': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - }; - query: { - /** Include additional information, such as classification infos. Allowed values include: classification, vector, interpretation */ - include?: parameters['CommonIncludeParameterQuery']; - }; - }; - responses: { - /** Successful response. */ - 200: { - schema: definitions['Object']; - }; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Updates an Object's data. Given meta-data and schema values are validated. LastUpdateTime is set to the time this function is called. */ - 'objects.update': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - }; - body: { - body: definitions['Object']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - }; - }; - responses: { - /** Successfully received. */ - 200: { - schema: definitions['Object']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Deletes an Object from the system. */ - 'objects.delete': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully deleted. */ - 204: never; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Checks if an Object exists in the system. */ - 'objects.head': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - }; - }; - responses: { - /** Object exists. */ - 204: never; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Object doesn't exist. */ - 404: unknown; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Updates an Object. This method supports json-merge style patch semantics (RFC 7396). Provided meta-data and schema values are validated. LastUpdateTime is set to the time this function is called. */ - 'objects.patch': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - }; - body: { - /** RFC 7396-style patch, the body contains the object to merge into the existing object. */ - body?: definitions['Object']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - }; - }; - responses: { - /** Successfully applied. No content provided. */ - 204: never; - /** The patch-JSON is malformed. */ - 400: unknown; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** The patch-JSON is valid but unprocessable. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Get a single data object */ - 'objects.class.get': { - parameters: { - path: { - className: string; - /** Unique ID of the Object. */ - id: string; - }; - query: { - /** Include additional information, such as classification infos. Allowed values include: classification, vector, interpretation */ - include?: parameters['CommonIncludeParameterQuery']; - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** The target node which should fulfill the request */ - node_name?: parameters['CommonNodeNameParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successful response. */ - 200: { - schema: definitions['Object']; - }; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** Request is well-formed (i.e., syntactically correct), but erroneous. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Update an individual data object based on its class and uuid. */ - 'objects.class.put': { - parameters: { - path: { - className: string; - /** The uuid of the data object to update. */ - id: string; - }; - body: { - body: definitions['Object']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - }; - }; - responses: { - /** Successfully received. */ - 200: { - schema: definitions['Object']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Delete a single data object. */ - 'objects.class.delete': { - parameters: { - path: { - className: string; - /** Unique ID of the Object. */ - id: string; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully deleted. */ - 204: never; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** Request is well-formed (i.e., syntactically correct), but erroneous. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Checks if a data object exists without retrieving it. */ - 'objects.class.head': { - parameters: { - path: { - /** The class name as defined in the schema */ - className: string; - /** The uuid of the data object */ - id: string; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Object exists. */ - 204: never; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Object doesn't exist. */ - 404: unknown; - /** Request is well-formed (i.e., syntactically correct), but erroneous. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Update an individual data object based on its class and uuid. This method supports json-merge style patch semantics (RFC 7396). Provided meta-data and schema values are validated. LastUpdateTime is set to the time this function is called. */ - 'objects.class.patch': { - parameters: { - path: { - /** The class name as defined in the schema */ - className: string; - /** The uuid of the data object to update. */ - id: string; - }; - body: { - /** RFC 7396-style patch, the body contains the object to merge into the existing object. */ - body?: definitions['Object']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - }; - }; - responses: { - /** Successfully applied. No content provided. */ - 204: never; - /** The patch-JSON is malformed. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** The patch-JSON is valid but unprocessable. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Replace all references to a class-property. */ - 'objects.references.update': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - /** Unique name of the property related to the Object. */ - propertyName: string; - }; - body: { - body: definitions['MultipleRef']; - }; - query: { - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully replaced all the references. */ - 200: unknown; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the property exists or that it is a class? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Add a single reference to a class-property. */ - 'objects.references.create': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - /** Unique name of the property related to the Object. */ - propertyName: string; - }; - body: { - body: definitions['SingleRef']; - }; - query: { - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully added the reference. */ - 200: unknown; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the property exists or that it is a class? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Delete the single reference that is given in the body from the list of references that this property has. */ - 'objects.references.delete': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - /** Unique name of the property related to the Object. */ - propertyName: string; - }; - body: { - body: definitions['SingleRef']; - }; - query: { - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully deleted. */ - 204: never; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Update all references of a property of a data object. */ - 'objects.class.references.put': { - parameters: { - path: { - /** The class name as defined in the schema */ - className: string; - /** Unique ID of the Object. */ - id: string; - /** Unique name of the property related to the Object. */ - propertyName: string; - }; - body: { - body: definitions['MultipleRef']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully replaced all the references. */ - 200: unknown; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Source object doesn't exist. */ - 404: unknown; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the property exists or that it is a class? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Add a single reference to a class-property. */ - 'objects.class.references.create': { - parameters: { - path: { - /** The class name as defined in the schema */ - className: string; - /** Unique ID of the Object. */ - id: string; - /** Unique name of the property related to the Object. */ - propertyName: string; - }; - body: { - body: definitions['SingleRef']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully added the reference. */ - 200: unknown; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Source object doesn't exist. */ - 404: unknown; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the property exists or that it is a class? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Delete the single reference that is given in the body from the list of references that this property of a data object has */ - 'objects.class.references.delete': { - parameters: { - path: { - /** The class name as defined in the schema */ - className: string; - /** Unique ID of the Object. */ - id: string; - /** Unique name of the property related to the Object. */ - propertyName: string; - }; - body: { - body: definitions['SingleRef']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully deleted. */ - 204: never; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the property exists or that it is a class? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Validate an Object's schema and meta-data. It has to be based on a schema, which is related to the given Object to be accepted by this validation. */ - 'objects.validate': { - parameters: { - body: { - body: definitions['Object']; - }; - }; - responses: { - /** Successfully validated. */ - 200: unknown; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Register new Objects in bulk. Provided meta-data and schema values are validated. */ - 'batch.objects.create': { - parameters: { - body: { - body: { - /** @description Define which fields need to be returned. Default value is ALL */ - fields?: ('ALL' | 'class' | 'schema' | 'id' | 'creationTimeUnix')[]; - objects?: definitions['Object'][]; - }; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - }; - }; - responses: { - /** Request succeeded, see response body to get detailed information about each batched item. */ - 200: { - schema: definitions['ObjectsGetResponse'][]; - }; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Delete Objects in bulk that match a certain filter. */ - 'batch.objects.delete': { - parameters: { - body: { - body: definitions['BatchDelete']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Request succeeded, see response body to get detailed information about each batched item. */ - 200: { - schema: definitions['BatchDeleteResponse']; - }; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Register cross-references between any class items (objects or objects) in bulk. */ - 'batch.references.create': { - parameters: { - body: { - /** A list of references to be batched. The ideal size depends on the used database connector. Please see the documentation of the used connector for help */ - body: definitions['BatchReference'][]; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - }; - }; - responses: { - /** Request Successful. Warning: A successful request does not guarantee that every batched reference was successfully created. Inspect the response body to see which references succeeded and which failed. */ - 200: { - schema: definitions['BatchReferenceResponse'][]; - }; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Get an object based on GraphQL */ - 'graphql.post': { - parameters: { - body: { - /** The GraphQL query request parameters. */ - body: definitions['GraphQLQuery']; - }; - }; - responses: { - /** Successful query (with select). */ - 200: { - schema: definitions['GraphQLResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Perform a batched GraphQL query */ - 'graphql.batch': { - parameters: { - body: { - /** The GraphQL queries. */ - body: definitions['GraphQLQueries']; - }; - }; - responses: { - /** Successful query (with select). */ - 200: { - schema: definitions['GraphQLResponses']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Gives meta information about the server and can be used to provide information to another Weaviate instance that wants to interact with the current instance. */ - 'meta.get': { - responses: { - /** Successful response. */ - 200: { - schema: definitions['Meta']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - 'schema.dump': { - parameters: { - header: { - /** If consistency is true, the request will be proxied to the leader to ensure strong schema consistency */ - consistency?: boolean; - }; - }; - responses: { - /** Successfully dumped the database schema. */ - 200: { - schema: definitions['Schema']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - 'schema.objects.create': { - parameters: { - body: { - objectClass: definitions['Class']; - }; - }; - responses: { - /** Added the new Object class to the schema. */ - 200: { - schema: definitions['Class']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid Object class */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - 'schema.objects.get': { - parameters: { - path: { - className: string; - }; - header: { - /** If consistency is true, the request will be proxied to the leader to ensure strong schema consistency */ - consistency?: boolean; - }; - }; - responses: { - /** Found the Class, returned as body */ - 200: { - schema: definitions['Class']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** This class does not exist */ - 404: unknown; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Use this endpoint to alter an existing class in the schema. Note that not all settings are mutable. If an error about immutable fields is returned and you still need to update this particular setting, you will have to delete the class (and the underlying data) and recreate. This endpoint cannot be used to modify properties. Instead use POST /v1/schema/{className}/properties. A typical use case for this endpoint is to update configuration, such as the vectorIndexConfig. Note that even in mutable sections, such as vectorIndexConfig, some fields may be immutable. */ - 'schema.objects.update': { - parameters: { - path: { - className: string; - }; - body: { - objectClass: definitions['Class']; - }; - }; - responses: { - /** Class was updated successfully */ - 200: { - schema: definitions['Class']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Class to be updated does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** Invalid update attempt */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - 'schema.objects.delete': { - parameters: { - path: { - className: string; - }; - }; - responses: { - /** Removed the Object class from the schema. */ - 200: unknown; - /** Could not delete the Object class. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - 'schema.objects.properties.add': { - parameters: { - path: { - className: string; - }; - body: { - body: definitions['Property']; - }; - }; - responses: { - /** Added the property. */ - 200: { - schema: definitions['Property']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid property. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - 'schema.objects.shards.get': { - parameters: { - path: { - className: string; - }; - query: { - tenant?: string; - }; - }; - responses: { - /** Found the status of the shards, returned as body */ - 200: { - schema: definitions['ShardStatusList']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** This class does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Update shard status of an Object Class */ - 'schema.objects.shards.update': { - parameters: { - path: { - className: string; - shardName: string; - }; - body: { - body: definitions['ShardStatus']; - }; - }; - responses: { - /** Shard status was updated successfully */ - 200: { - schema: definitions['ShardStatus']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Shard to be updated does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** Invalid update attempt */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** get all tenants from a specific class */ - 'tenants.get': { - parameters: { - path: { - className: string; - }; - header: { - /** If consistency is true, the request will be proxied to the leader to ensure strong schema consistency */ - consistency?: boolean; - }; - }; - responses: { - /** tenants from specified class. */ - 200: { - schema: definitions['Tenant'][]; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid Tenant class */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Update tenant of a specific class */ - 'tenants.update': { - parameters: { - path: { - className: string; - }; - body: { - body: definitions['Tenant'][]; - }; - }; - responses: { - /** Updated tenants of the specified class */ - 200: { - schema: definitions['Tenant'][]; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid Tenant class */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Create a new tenant for a specific class */ - 'tenants.create': { - parameters: { - path: { - className: string; - }; - body: { - body: definitions['Tenant'][]; - }; - }; - responses: { - /** Added new tenants to the specified class */ - 200: { - schema: definitions['Tenant'][]; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid Tenant class */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** delete tenants from a specific class */ - 'tenants.delete': { - parameters: { - path: { - className: string; - }; - body: { - tenants: string[]; - }; - }; - responses: { - /** Deleted tenants from specified class. */ - 200: unknown; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid Tenant class */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Check if a tenant exists for a specific class */ - 'tenant.exists': { - parameters: { - path: { - className: string; - tenantName: string; - }; - header: { - /** If consistency is true, the request will be proxied to the leader to ensure strong schema consistency */ - consistency?: boolean; - }; - }; - responses: { - /** The tenant exists in the specified class */ - 200: unknown; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** The tenant not found */ - 404: unknown; - /** Invalid Tenant class */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** [Coming soon] List all backups in progress not implemented yet. */ - 'backups.list': { - parameters: { - path: { - /** Backup backend name e.g. filesystem, gcs, s3. */ - backend: string; - }; - }; - responses: { - /** Existed backups */ - 200: { - schema: definitions['BackupListResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup list. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Starts a process of creating a backup for a set of classes */ - 'backups.create': { - parameters: { - path: { - /** Backup backend name e.g. filesystem, gcs, s3. */ - backend: string; - }; - body: { - body: definitions['BackupCreateRequest']; - }; - }; - responses: { - /** Backup create process successfully started. */ - 200: { - schema: definitions['BackupCreateResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup creation attempt. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Returns status of backup creation attempt for a set of classes */ - 'backups.create.status': { - parameters: { - path: { - /** Backup backend name e.g. filesystem, gcs, s3. */ - backend: string; - /** The ID of a backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id: string; - }; - }; - responses: { - /** Backup creation status successfully returned */ - 200: { - schema: definitions['BackupCreateStatusResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Not Found - Backup does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup restoration status attempt. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Cancel created backup with specified ID */ - 'backups.cancel': { - parameters: { - path: { - /** Backup backend name e.g. filesystem, gcs, s3. */ - backend: string; - /** The ID of a backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id: string; - }; - }; - responses: { - /** Successfully deleted. */ - 204: never; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup cancellation attempt. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Returns status of a backup restoration attempt for a set of classes */ - 'backups.restore.status': { - parameters: { - path: { - /** Backup backend name e.g. filesystem, gcs, s3. */ - backend: string; - /** The ID of a backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id: string; - }; - }; - responses: { - /** Backup restoration status successfully returned */ - 200: { - schema: definitions['BackupRestoreStatusResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Not Found - Backup does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Starts a process of restoring a backup for a set of classes */ - 'backups.restore': { - parameters: { - path: { - /** Backup backend name e.g. filesystem, gcs, s3. */ - backend: string; - /** The ID of a backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id: string; - }; - body: { - body: definitions['BackupRestoreRequest']; - }; - }; - responses: { - /** Backup restoration process successfully started. */ - 200: { - schema: definitions['BackupRestoreResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Not Found - Backup does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup restoration attempt. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Returns Raft cluster statistics of Weaviate DB. */ - 'cluster.get.statistics': { - responses: { - /** Cluster statistics successfully returned */ - 200: { - schema: definitions['ClusterStatisticsResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup restoration status attempt. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Returns status of Weaviate DB. */ - 'nodes.get': { - parameters: { - query: { - /** Controls the verbosity of the output, possible values are: "minimal", "verbose". Defaults to "minimal". */ - output?: parameters['CommonOutputVerbosityParameterQuery']; - }; - }; - responses: { - /** Nodes status successfully returned */ - 200: { - schema: definitions['NodesStatusResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Not Found - Backup does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup restoration status attempt. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Returns status of Weaviate DB. */ - 'nodes.get.class': { - parameters: { - path: { - className: string; - }; - query: { - /** Controls the verbosity of the output, possible values are: "minimal", "verbose". Defaults to "minimal". */ - output?: parameters['CommonOutputVerbosityParameterQuery']; - }; - }; - responses: { - /** Nodes status successfully returned */ - 200: { - schema: definitions['NodesStatusResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Not Found - Backup does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup restoration status attempt. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Trigger a classification based on the specified params. Classifications will run in the background, use GET /classifications/ to retrieve the status of your classification. */ - 'classifications.post': { - parameters: { - body: { - /** parameters to start a classification */ - params: definitions['Classification']; - }; - }; - responses: { - /** Successfully started classification. */ - 201: { - schema: definitions['Classification']; - }; - /** Incorrect request */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Get status, results and metadata of a previously created classification */ - 'classifications.get': { - parameters: { - path: { - /** classification id */ - id: string; - }; - }; - responses: { - /** Found the classification, returned as body */ - 200: { - schema: definitions['Classification']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Not Found - Classification does not exist */ - 404: unknown; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; -} -export interface external {} diff --git a/dist/node/cjs/openapi/schema.js b/dist/node/cjs/openapi/schema.js deleted file mode 100644 index 89c8c37d..00000000 --- a/dist/node/cjs/openapi/schema.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; -/** - * This file was auto-generated by openapi-typescript. - * Do not make direct changes to the file. - */ -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/openapi/types.d.ts b/dist/node/cjs/openapi/types.d.ts deleted file mode 100644 index 4ab8f2a9..00000000 --- a/dist/node/cjs/openapi/types.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { definitions } from './schema.js'; -type Override = Omit & T2; -type DefaultProperties = { - [key: string]: unknown; -}; -export type WeaviateObject = Override< - definitions['Object'], - { - properties?: T; - } ->; -export type WeaviateObjectsList = definitions['ObjectsListResponse']; -export type WeaviateObjectsGet = definitions['ObjectsGetResponse']; -export type Reference = definitions['SingleRef']; -export type WeaviateError = definitions['ErrorResponse']; -export type Properties = definitions['PropertySchema']; -export type Property = definitions['Property']; -export type DataObject = definitions['Object']; -export type BackupCreateRequest = definitions['BackupCreateRequest']; -export type BackupCreateResponse = definitions['BackupCreateResponse']; -export type BackupCreateStatusResponse = definitions['BackupCreateStatusResponse']; -export type BackupRestoreRequest = definitions['BackupRestoreRequest']; -export type BackupRestoreResponse = definitions['BackupRestoreResponse']; -export type BackupRestoreStatusResponse = definitions['BackupRestoreStatusResponse']; -export type BackupConfig = definitions['BackupConfig']; -export type RestoreConfig = definitions['RestoreConfig']; -export type BatchDelete = definitions['BatchDelete']; -export type BatchDeleteResponse = definitions['BatchDeleteResponse']; -export type BatchRequest = { - fields?: ('ALL' | 'class' | 'schema' | 'id' | 'creationTimeUnix')[]; - objects?: WeaviateObject[]; -}; -export type BatchReference = definitions['BatchReference']; -export type BatchReferenceResponse = definitions['BatchReferenceResponse']; -export type C11yWordsResponse = definitions['C11yWordsResponse']; -export type C11yExtension = definitions['C11yExtension']; -export type Classification = definitions['Classification']; -export type WhereFilter = definitions['WhereFilter']; -export type WeaviateSchema = definitions['Schema']; -export type WeaviateClass = definitions['Class']; -export type WeaviateProperty = definitions['Property']; -export type WeaviateNestedProperty = definitions['NestedProperty']; -export type ShardStatus = definitions['ShardStatus']; -export type ShardStatusList = definitions['ShardStatusList']; -export type Tenant = definitions['Tenant']; -export type TenantActivityStatus = Tenant['activityStatus']; -export type SchemaClusterStatus = definitions['SchemaClusterStatus']; -export type WeaviateModuleConfig = WeaviateClass['moduleConfig']; -export type WeaviateInvertedIndexConfig = WeaviateClass['invertedIndexConfig']; -export type WeaviateBM25Config = definitions['BM25Config']; -export type WeaviateStopwordConfig = definitions['StopwordConfig']; -export type WeaviateMultiTenancyConfig = WeaviateClass['multiTenancyConfig']; -export type WeaviateReplicationConfig = WeaviateClass['replicationConfig']; -export type WeaviateShardingConfig = WeaviateClass['shardingConfig']; -export type WeaviateShardStatus = definitions['ShardStatusGetResponse']; -export type WeaviateVectorIndexConfig = WeaviateClass['vectorIndexConfig']; -export type WeaviateVectorsConfig = WeaviateClass['vectorConfig']; -export type WeaviateVectorConfig = definitions['VectorConfig']; -export type NodesStatusResponse = definitions['NodesStatusResponse']; -export type NodeStats = definitions['NodeStats']; -export type BatchStats = definitions['BatchStats']; -export type NodeShardStatus = definitions['NodeShardStatus']; -export type Meta = definitions['Meta']; -export {}; diff --git a/dist/node/cjs/openapi/types.js b/dist/node/cjs/openapi/types.js deleted file mode 100644 index db8b17d5..00000000 --- a/dist/node/cjs/openapi/types.js +++ /dev/null @@ -1,2 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/node/cjs/package.json b/dist/node/cjs/package.json deleted file mode 100644 index b731bd61..00000000 --- a/dist/node/cjs/package.json +++ /dev/null @@ -1 +0,0 @@ -{"type": "commonjs"} diff --git a/dist/node/cjs/proto/google/health/v1/health.d.ts b/dist/node/cjs/proto/google/health/v1/health.d.ts deleted file mode 100644 index c70d64a3..00000000 --- a/dist/node/cjs/proto/google/health/v1/health.d.ts +++ /dev/null @@ -1,189 +0,0 @@ -import { type CallContext, type CallOptions } from 'nice-grpc-common'; -import _m0 from 'protobufjs/minimal.js'; -export declare const protobufPackage = 'grpc.health.v1'; -export interface HealthCheckRequest { - service: string; -} -export interface HealthCheckResponse { - status: HealthCheckResponse_ServingStatus; -} -export declare enum HealthCheckResponse_ServingStatus { - UNKNOWN = 0, - SERVING = 1, - NOT_SERVING = 2, - /** SERVICE_UNKNOWN - Used only by the Watch method. */ - SERVICE_UNKNOWN = 3, - UNRECOGNIZED = -1, -} -export declare function healthCheckResponse_ServingStatusFromJSON( - object: any -): HealthCheckResponse_ServingStatus; -export declare function healthCheckResponse_ServingStatusToJSON( - object: HealthCheckResponse_ServingStatus -): string; -export declare const HealthCheckRequest: { - encode(message: HealthCheckRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): HealthCheckRequest; - fromJSON(object: any): HealthCheckRequest; - toJSON(message: HealthCheckRequest): unknown; - create(base?: DeepPartial): HealthCheckRequest; - fromPartial(object: DeepPartial): HealthCheckRequest; -}; -export declare const HealthCheckResponse: { - encode(message: HealthCheckResponse, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): HealthCheckResponse; - fromJSON(object: any): HealthCheckResponse; - toJSON(message: HealthCheckResponse): unknown; - create(base?: DeepPartial): HealthCheckResponse; - fromPartial(object: DeepPartial): HealthCheckResponse; -}; -export type HealthDefinition = typeof HealthDefinition; -export declare const HealthDefinition: { - readonly name: 'Health'; - readonly fullName: 'grpc.health.v1.Health'; - readonly methods: { - /** - * If the requested service is unknown, the call will fail with status - * NOT_FOUND. - */ - readonly check: { - readonly name: 'Check'; - readonly requestType: { - encode(message: HealthCheckRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): HealthCheckRequest; - fromJSON(object: any): HealthCheckRequest; - toJSON(message: HealthCheckRequest): unknown; - create(base?: DeepPartial): HealthCheckRequest; - fromPartial(object: DeepPartial): HealthCheckRequest; - }; - readonly requestStream: false; - readonly responseType: { - encode(message: HealthCheckResponse, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): HealthCheckResponse; - fromJSON(object: any): HealthCheckResponse; - toJSON(message: HealthCheckResponse): unknown; - create(base?: DeepPartial): HealthCheckResponse; - fromPartial(object: DeepPartial): HealthCheckResponse; - }; - readonly responseStream: false; - readonly options: {}; - }; - /** - * Performs a watch for the serving status of the requested service. - * The server will immediately send back a message indicating the current - * serving status. It will then subsequently send a new message whenever - * the service's serving status changes. - * - * If the requested service is unknown when the call is received, the - * server will send a message setting the serving status to - * SERVICE_UNKNOWN but will *not* terminate the call. If at some - * future point, the serving status of the service becomes known, the - * server will send a new message with the service's serving status. - * - * If the call terminates with status UNIMPLEMENTED, then clients - * should assume this method is not supported and should not retry the - * call. If the call terminates with any other status (including OK), - * clients should retry the call with appropriate exponential backoff. - */ - readonly watch: { - readonly name: 'Watch'; - readonly requestType: { - encode(message: HealthCheckRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): HealthCheckRequest; - fromJSON(object: any): HealthCheckRequest; - toJSON(message: HealthCheckRequest): unknown; - create(base?: DeepPartial): HealthCheckRequest; - fromPartial(object: DeepPartial): HealthCheckRequest; - }; - readonly requestStream: false; - readonly responseType: { - encode(message: HealthCheckResponse, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): HealthCheckResponse; - fromJSON(object: any): HealthCheckResponse; - toJSON(message: HealthCheckResponse): unknown; - create(base?: DeepPartial): HealthCheckResponse; - fromPartial(object: DeepPartial): HealthCheckResponse; - }; - readonly responseStream: true; - readonly options: {}; - }; - }; -}; -export interface HealthServiceImplementation { - /** - * If the requested service is unknown, the call will fail with status - * NOT_FOUND. - */ - check( - request: HealthCheckRequest, - context: CallContext & CallContextExt - ): Promise>; - /** - * Performs a watch for the serving status of the requested service. - * The server will immediately send back a message indicating the current - * serving status. It will then subsequently send a new message whenever - * the service's serving status changes. - * - * If the requested service is unknown when the call is received, the - * server will send a message setting the serving status to - * SERVICE_UNKNOWN but will *not* terminate the call. If at some - * future point, the serving status of the service becomes known, the - * server will send a new message with the service's serving status. - * - * If the call terminates with status UNIMPLEMENTED, then clients - * should assume this method is not supported and should not retry the - * call. If the call terminates with any other status (including OK), - * clients should retry the call with appropriate exponential backoff. - */ - watch( - request: HealthCheckRequest, - context: CallContext & CallContextExt - ): ServerStreamingMethodResult>; -} -export interface HealthClient { - /** - * If the requested service is unknown, the call will fail with status - * NOT_FOUND. - */ - check( - request: DeepPartial, - options?: CallOptions & CallOptionsExt - ): Promise; - /** - * Performs a watch for the serving status of the requested service. - * The server will immediately send back a message indicating the current - * serving status. It will then subsequently send a new message whenever - * the service's serving status changes. - * - * If the requested service is unknown when the call is received, the - * server will send a message setting the serving status to - * SERVICE_UNKNOWN but will *not* terminate the call. If at some - * future point, the serving status of the service becomes known, the - * server will send a new message with the service's serving status. - * - * If the call terminates with status UNIMPLEMENTED, then clients - * should assume this method is not supported and should not retry the - * call. If the call terminates with any other status (including OK), - * clients should retry the call with appropriate exponential backoff. - */ - watch( - request: DeepPartial, - options?: CallOptions & CallOptionsExt - ): AsyncIterable; -} -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export type ServerStreamingMethodResult = { - [Symbol.asyncIterator](): AsyncIterator; -}; -export {}; diff --git a/dist/node/cjs/proto/google/health/v1/health.js b/dist/node/cjs/proto/google/health/v1/health.js deleted file mode 100644 index d97b152d..00000000 --- a/dist/node/cjs/proto/google/health/v1/health.js +++ /dev/null @@ -1,223 +0,0 @@ -'use strict'; -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: health.proto -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.HealthDefinition = - exports.HealthCheckResponse = - exports.HealthCheckRequest = - exports.healthCheckResponse_ServingStatusToJSON = - exports.healthCheckResponse_ServingStatusFromJSON = - exports.HealthCheckResponse_ServingStatus = - exports.protobufPackage = - void 0; -const minimal_js_1 = __importDefault(require('protobufjs/minimal.js')); -exports.protobufPackage = 'grpc.health.v1'; -var HealthCheckResponse_ServingStatus; -(function (HealthCheckResponse_ServingStatus) { - HealthCheckResponse_ServingStatus[(HealthCheckResponse_ServingStatus['UNKNOWN'] = 0)] = 'UNKNOWN'; - HealthCheckResponse_ServingStatus[(HealthCheckResponse_ServingStatus['SERVING'] = 1)] = 'SERVING'; - HealthCheckResponse_ServingStatus[(HealthCheckResponse_ServingStatus['NOT_SERVING'] = 2)] = 'NOT_SERVING'; - /** SERVICE_UNKNOWN - Used only by the Watch method. */ - HealthCheckResponse_ServingStatus[(HealthCheckResponse_ServingStatus['SERVICE_UNKNOWN'] = 3)] = - 'SERVICE_UNKNOWN'; - HealthCheckResponse_ServingStatus[(HealthCheckResponse_ServingStatus['UNRECOGNIZED'] = -1)] = - 'UNRECOGNIZED'; -})( - HealthCheckResponse_ServingStatus || - (exports.HealthCheckResponse_ServingStatus = HealthCheckResponse_ServingStatus = {}) -); -function healthCheckResponse_ServingStatusFromJSON(object) { - switch (object) { - case 0: - case 'UNKNOWN': - return HealthCheckResponse_ServingStatus.UNKNOWN; - case 1: - case 'SERVING': - return HealthCheckResponse_ServingStatus.SERVING; - case 2: - case 'NOT_SERVING': - return HealthCheckResponse_ServingStatus.NOT_SERVING; - case 3: - case 'SERVICE_UNKNOWN': - return HealthCheckResponse_ServingStatus.SERVICE_UNKNOWN; - case -1: - case 'UNRECOGNIZED': - default: - return HealthCheckResponse_ServingStatus.UNRECOGNIZED; - } -} -exports.healthCheckResponse_ServingStatusFromJSON = healthCheckResponse_ServingStatusFromJSON; -function healthCheckResponse_ServingStatusToJSON(object) { - switch (object) { - case HealthCheckResponse_ServingStatus.UNKNOWN: - return 'UNKNOWN'; - case HealthCheckResponse_ServingStatus.SERVING: - return 'SERVING'; - case HealthCheckResponse_ServingStatus.NOT_SERVING: - return 'NOT_SERVING'; - case HealthCheckResponse_ServingStatus.SERVICE_UNKNOWN: - return 'SERVICE_UNKNOWN'; - case HealthCheckResponse_ServingStatus.UNRECOGNIZED: - default: - return 'UNRECOGNIZED'; - } -} -exports.healthCheckResponse_ServingStatusToJSON = healthCheckResponse_ServingStatusToJSON; -function createBaseHealthCheckRequest() { - return { service: '' }; -} -exports.HealthCheckRequest = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.service !== '') { - writer.uint32(10).string(message.service); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseHealthCheckRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.service = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { service: isSet(object.service) ? globalThis.String(object.service) : '' }; - }, - toJSON(message) { - const obj = {}; - if (message.service !== '') { - obj.service = message.service; - } - return obj; - }, - create(base) { - return exports.HealthCheckRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseHealthCheckRequest(); - message.service = (_a = object.service) !== null && _a !== void 0 ? _a : ''; - return message; - }, -}; -function createBaseHealthCheckResponse() { - return { status: 0 }; -} -exports.HealthCheckResponse = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.status !== 0) { - writer.uint32(8).int32(message.status); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseHealthCheckResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.status = reader.int32(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { status: isSet(object.status) ? healthCheckResponse_ServingStatusFromJSON(object.status) : 0 }; - }, - toJSON(message) { - const obj = {}; - if (message.status !== 0) { - obj.status = healthCheckResponse_ServingStatusToJSON(message.status); - } - return obj; - }, - create(base) { - return exports.HealthCheckResponse.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseHealthCheckResponse(); - message.status = (_a = object.status) !== null && _a !== void 0 ? _a : 0; - return message; - }, -}; -exports.HealthDefinition = { - name: 'Health', - fullName: 'grpc.health.v1.Health', - methods: { - /** - * If the requested service is unknown, the call will fail with status - * NOT_FOUND. - */ - check: { - name: 'Check', - requestType: exports.HealthCheckRequest, - requestStream: false, - responseType: exports.HealthCheckResponse, - responseStream: false, - options: {}, - }, - /** - * Performs a watch for the serving status of the requested service. - * The server will immediately send back a message indicating the current - * serving status. It will then subsequently send a new message whenever - * the service's serving status changes. - * - * If the requested service is unknown when the call is received, the - * server will send a message setting the serving status to - * SERVICE_UNKNOWN but will *not* terminate the call. If at some - * future point, the serving status of the service becomes known, the - * server will send a new message with the service's serving status. - * - * If the call terminates with status UNIMPLEMENTED, then clients - * should assume this method is not supported and should not retry the - * call. If the call terminates with any other status (including OK), - * clients should retry the call with appropriate exponential backoff. - */ - watch: { - name: 'Watch', - requestType: exports.HealthCheckRequest, - requestStream: false, - responseType: exports.HealthCheckResponse, - responseStream: true, - options: {}, - }, - }, -}; -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/cjs/proto/google/protobuf/struct.d.ts b/dist/node/cjs/proto/google/protobuf/struct.d.ts deleted file mode 100644 index 124c3e6e..00000000 --- a/dist/node/cjs/proto/google/protobuf/struct.d.ts +++ /dev/null @@ -1,129 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -export declare const protobufPackage = 'google.protobuf'; -/** - * `NullValue` is a singleton enumeration to represent the null value for the - * `Value` type union. - * - * The JSON representation for `NullValue` is JSON `null`. - */ -export declare enum NullValue { - /** NULL_VALUE - Null value. */ - NULL_VALUE = 0, - UNRECOGNIZED = -1, -} -export declare function nullValueFromJSON(object: any): NullValue; -export declare function nullValueToJSON(object: NullValue): string; -/** - * `Struct` represents a structured data value, consisting of fields - * which map to dynamically typed values. In some languages, `Struct` - * might be supported by a native representation. For example, in - * scripting languages like JS a struct is represented as an - * object. The details of that representation are described together - * with the proto support for the language. - * - * The JSON representation for `Struct` is JSON object. - */ -export interface Struct { - /** Unordered map of dynamically typed values. */ - fields: { - [key: string]: any | undefined; - }; -} -export interface Struct_FieldsEntry { - key: string; - value: any | undefined; -} -/** - * `Value` represents a dynamically typed value which can be either - * null, a number, a string, a boolean, a recursive struct value, or a - * list of values. A producer of value is expected to set one of these - * variants. Absence of any variant indicates an error. - * - * The JSON representation for `Value` is JSON value. - */ -export interface Value { - /** Represents a null value. */ - nullValue?: NullValue | undefined; - /** Represents a double value. */ - numberValue?: number | undefined; - /** Represents a string value. */ - stringValue?: string | undefined; - /** Represents a boolean value. */ - boolValue?: boolean | undefined; - /** Represents a structured value. */ - structValue?: - | { - [key: string]: any; - } - | undefined; - /** Represents a repeated `Value`. */ - listValue?: Array | undefined; -} -/** - * `ListValue` is a wrapper around a repeated field of values. - * - * The JSON representation for `ListValue` is JSON array. - */ -export interface ListValue { - /** Repeated field of dynamically typed values. */ - values: any[]; -} -export declare const Struct: { - encode(message: Struct, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Struct; - fromJSON(object: any): Struct; - toJSON(message: Struct): unknown; - create(base?: DeepPartial): Struct; - fromPartial(object: DeepPartial): Struct; - wrap( - object: - | { - [key: string]: any; - } - | undefined - ): Struct; - unwrap(message: Struct): { - [key: string]: any; - }; -}; -export declare const Struct_FieldsEntry: { - encode(message: Struct_FieldsEntry, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Struct_FieldsEntry; - fromJSON(object: any): Struct_FieldsEntry; - toJSON(message: Struct_FieldsEntry): unknown; - create(base?: DeepPartial): Struct_FieldsEntry; - fromPartial(object: DeepPartial): Struct_FieldsEntry; -}; -export declare const Value: { - encode(message: Value, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Value; - fromJSON(object: any): Value; - toJSON(message: Value): unknown; - create(base?: DeepPartial): Value; - fromPartial(object: DeepPartial): Value; - wrap(value: any): Value; - unwrap(message: any): string | number | boolean | Object | null | Array | undefined; -}; -export declare const ListValue: { - encode(message: ListValue, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): ListValue; - fromJSON(object: any): ListValue; - toJSON(message: ListValue): unknown; - create(base?: DeepPartial): ListValue; - fromPartial(object: DeepPartial): ListValue; - wrap(array: Array | undefined): ListValue; - unwrap(message: ListValue): Array; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/cjs/proto/google/protobuf/struct.js b/dist/node/cjs/proto/google/protobuf/struct.js deleted file mode 100644 index 5eda9404..00000000 --- a/dist/node/cjs/proto/google/protobuf/struct.js +++ /dev/null @@ -1,466 +0,0 @@ -'use strict'; -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: google/protobuf/struct.proto -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.ListValue = - exports.Value = - exports.Struct_FieldsEntry = - exports.Struct = - exports.nullValueToJSON = - exports.nullValueFromJSON = - exports.NullValue = - exports.protobufPackage = - void 0; -/* eslint-disable */ -const minimal_js_1 = __importDefault(require('protobufjs/minimal.js')); -exports.protobufPackage = 'google.protobuf'; -/** - * `NullValue` is a singleton enumeration to represent the null value for the - * `Value` type union. - * - * The JSON representation for `NullValue` is JSON `null`. - */ -var NullValue; -(function (NullValue) { - /** NULL_VALUE - Null value. */ - NullValue[(NullValue['NULL_VALUE'] = 0)] = 'NULL_VALUE'; - NullValue[(NullValue['UNRECOGNIZED'] = -1)] = 'UNRECOGNIZED'; -})(NullValue || (exports.NullValue = NullValue = {})); -function nullValueFromJSON(object) { - switch (object) { - case 0: - case 'NULL_VALUE': - return NullValue.NULL_VALUE; - case -1: - case 'UNRECOGNIZED': - default: - return NullValue.UNRECOGNIZED; - } -} -exports.nullValueFromJSON = nullValueFromJSON; -function nullValueToJSON(object) { - switch (object) { - case NullValue.NULL_VALUE: - return 'NULL_VALUE'; - case NullValue.UNRECOGNIZED: - default: - return 'UNRECOGNIZED'; - } -} -exports.nullValueToJSON = nullValueToJSON; -function createBaseStruct() { - return { fields: {} }; -} -exports.Struct = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - Object.entries(message.fields).forEach(([key, value]) => { - if (value !== undefined) { - exports.Struct_FieldsEntry.encode({ key: key, value }, writer.uint32(10).fork()).ldelim(); - } - }); - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseStruct(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - const entry1 = exports.Struct_FieldsEntry.decode(reader, reader.uint32()); - if (entry1.value !== undefined) { - message.fields[entry1.key] = entry1.value; - } - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - fields: isObject(object.fields) - ? Object.entries(object.fields).reduce((acc, [key, value]) => { - acc[key] = value; - return acc; - }, {}) - : {}, - }; - }, - toJSON(message) { - const obj = {}; - if (message.fields) { - const entries = Object.entries(message.fields); - if (entries.length > 0) { - obj.fields = {}; - entries.forEach(([k, v]) => { - obj.fields[k] = v; - }); - } - } - return obj; - }, - create(base) { - return exports.Struct.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseStruct(); - message.fields = Object.entries((_a = object.fields) !== null && _a !== void 0 ? _a : {}).reduce( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = value; - } - return acc; - }, - {} - ); - return message; - }, - wrap(object) { - const struct = createBaseStruct(); - if (object !== undefined) { - for (const key of Object.keys(object)) { - struct.fields[key] = object[key]; - } - } - return struct; - }, - unwrap(message) { - const object = {}; - if (message.fields) { - for (const key of Object.keys(message.fields)) { - object[key] = message.fields[key]; - } - } - return object; - }, -}; -function createBaseStruct_FieldsEntry() { - return { key: '', value: undefined }; -} -exports.Struct_FieldsEntry = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.key !== '') { - writer.uint32(10).string(message.key); - } - if (message.value !== undefined) { - exports.Value.encode(exports.Value.wrap(message.value), writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseStruct_FieldsEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.key = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.value = exports.Value.unwrap(exports.Value.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - key: isSet(object.key) ? globalThis.String(object.key) : '', - value: isSet(object === null || object === void 0 ? void 0 : object.value) ? object.value : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.key !== '') { - obj.key = message.key; - } - if (message.value !== undefined) { - obj.value = message.value; - } - return obj; - }, - create(base) { - return exports.Struct_FieldsEntry.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseStruct_FieldsEntry(); - message.key = (_a = object.key) !== null && _a !== void 0 ? _a : ''; - message.value = (_b = object.value) !== null && _b !== void 0 ? _b : undefined; - return message; - }, -}; -function createBaseValue() { - return { - nullValue: undefined, - numberValue: undefined, - stringValue: undefined, - boolValue: undefined, - structValue: undefined, - listValue: undefined, - }; -} -exports.Value = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.nullValue !== undefined) { - writer.uint32(8).int32(message.nullValue); - } - if (message.numberValue !== undefined) { - writer.uint32(17).double(message.numberValue); - } - if (message.stringValue !== undefined) { - writer.uint32(26).string(message.stringValue); - } - if (message.boolValue !== undefined) { - writer.uint32(32).bool(message.boolValue); - } - if (message.structValue !== undefined) { - exports.Struct.encode(exports.Struct.wrap(message.structValue), writer.uint32(42).fork()).ldelim(); - } - if (message.listValue !== undefined) { - exports.ListValue.encode(exports.ListValue.wrap(message.listValue), writer.uint32(50).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseValue(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.nullValue = reader.int32(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.numberValue = reader.double(); - continue; - case 3: - if (tag !== 26) { - break; - } - message.stringValue = reader.string(); - continue; - case 4: - if (tag !== 32) { - break; - } - message.boolValue = reader.bool(); - continue; - case 5: - if (tag !== 42) { - break; - } - message.structValue = exports.Struct.unwrap(exports.Struct.decode(reader, reader.uint32())); - continue; - case 6: - if (tag !== 50) { - break; - } - message.listValue = exports.ListValue.unwrap(exports.ListValue.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : undefined, - numberValue: isSet(object.numberValue) ? globalThis.Number(object.numberValue) : undefined, - stringValue: isSet(object.stringValue) ? globalThis.String(object.stringValue) : undefined, - boolValue: isSet(object.boolValue) ? globalThis.Boolean(object.boolValue) : undefined, - structValue: isObject(object.structValue) ? object.structValue : undefined, - listValue: globalThis.Array.isArray(object.listValue) ? [...object.listValue] : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.nullValue !== undefined) { - obj.nullValue = nullValueToJSON(message.nullValue); - } - if (message.numberValue !== undefined) { - obj.numberValue = message.numberValue; - } - if (message.stringValue !== undefined) { - obj.stringValue = message.stringValue; - } - if (message.boolValue !== undefined) { - obj.boolValue = message.boolValue; - } - if (message.structValue !== undefined) { - obj.structValue = message.structValue; - } - if (message.listValue !== undefined) { - obj.listValue = message.listValue; - } - return obj; - }, - create(base) { - return exports.Value.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f; - const message = createBaseValue(); - message.nullValue = (_a = object.nullValue) !== null && _a !== void 0 ? _a : undefined; - message.numberValue = (_b = object.numberValue) !== null && _b !== void 0 ? _b : undefined; - message.stringValue = (_c = object.stringValue) !== null && _c !== void 0 ? _c : undefined; - message.boolValue = (_d = object.boolValue) !== null && _d !== void 0 ? _d : undefined; - message.structValue = (_e = object.structValue) !== null && _e !== void 0 ? _e : undefined; - message.listValue = (_f = object.listValue) !== null && _f !== void 0 ? _f : undefined; - return message; - }, - wrap(value) { - const result = createBaseValue(); - if (value === null) { - result.nullValue = NullValue.NULL_VALUE; - } else if (typeof value === 'boolean') { - result.boolValue = value; - } else if (typeof value === 'number') { - result.numberValue = value; - } else if (typeof value === 'string') { - result.stringValue = value; - } else if (globalThis.Array.isArray(value)) { - result.listValue = value; - } else if (typeof value === 'object') { - result.structValue = value; - } else if (typeof value !== 'undefined') { - throw new globalThis.Error('Unsupported any value type: ' + typeof value); - } - return result; - }, - unwrap(message) { - if (message.stringValue !== undefined) { - return message.stringValue; - } else if ((message === null || message === void 0 ? void 0 : message.numberValue) !== undefined) { - return message.numberValue; - } else if ((message === null || message === void 0 ? void 0 : message.boolValue) !== undefined) { - return message.boolValue; - } else if ((message === null || message === void 0 ? void 0 : message.structValue) !== undefined) { - return message.structValue; - } else if ((message === null || message === void 0 ? void 0 : message.listValue) !== undefined) { - return message.listValue; - } else if ((message === null || message === void 0 ? void 0 : message.nullValue) !== undefined) { - return null; - } - return undefined; - }, -}; -function createBaseListValue() { - return { values: [] }; -} -exports.ListValue = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.values) { - exports.Value.encode(exports.Value.wrap(v), writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListValue(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(exports.Value.unwrap(exports.Value.decode(reader, reader.uint32()))); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? [...object.values] - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return exports.ListValue.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseListValue(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, - wrap(array) { - const result = createBaseListValue(); - result.values = array !== null && array !== void 0 ? array : []; - return result; - }, - unwrap(message) { - if ( - (message === null || message === void 0 ? void 0 : message.hasOwnProperty('values')) && - globalThis.Array.isArray(message.values) - ) { - return message.values; - } else { - return message; - } - }, -}; -function isObject(value) { - return typeof value === 'object' && value !== null; -} -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/cjs/proto/v1/base.d.ts b/dist/node/cjs/proto/v1/base.d.ts deleted file mode 100644 index 37f25b14..00000000 --- a/dist/node/cjs/proto/v1/base.d.ts +++ /dev/null @@ -1,293 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -export declare const protobufPackage = 'weaviate.v1'; -export declare enum ConsistencyLevel { - CONSISTENCY_LEVEL_UNSPECIFIED = 0, - CONSISTENCY_LEVEL_ONE = 1, - CONSISTENCY_LEVEL_QUORUM = 2, - CONSISTENCY_LEVEL_ALL = 3, - UNRECOGNIZED = -1, -} -export declare function consistencyLevelFromJSON(object: any): ConsistencyLevel; -export declare function consistencyLevelToJSON(object: ConsistencyLevel): string; -export interface NumberArrayProperties { - /** - * will be removed in the future, use vector_bytes - * - * @deprecated - */ - values: number[]; - propName: string; - valuesBytes: Uint8Array; -} -export interface IntArrayProperties { - values: number[]; - propName: string; -} -export interface TextArrayProperties { - values: string[]; - propName: string; -} -export interface BooleanArrayProperties { - values: boolean[]; - propName: string; -} -export interface ObjectPropertiesValue { - nonRefProperties: - | { - [key: string]: any; - } - | undefined; - numberArrayProperties: NumberArrayProperties[]; - intArrayProperties: IntArrayProperties[]; - textArrayProperties: TextArrayProperties[]; - booleanArrayProperties: BooleanArrayProperties[]; - objectProperties: ObjectProperties[]; - objectArrayProperties: ObjectArrayProperties[]; - emptyListProps: string[]; -} -export interface ObjectArrayProperties { - values: ObjectPropertiesValue[]; - propName: string; -} -export interface ObjectProperties { - value: ObjectPropertiesValue | undefined; - propName: string; -} -export interface TextArray { - values: string[]; -} -export interface IntArray { - values: number[]; -} -export interface NumberArray { - values: number[]; -} -export interface BooleanArray { - values: boolean[]; -} -export interface Filters { - operator: Filters_Operator; - /** - * protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED - * - * @deprecated - */ - on: string[]; - filters: Filters[]; - valueText?: string | undefined; - valueInt?: number | undefined; - valueBoolean?: boolean | undefined; - valueNumber?: number | undefined; - valueTextArray?: TextArray | undefined; - valueIntArray?: IntArray | undefined; - valueBooleanArray?: BooleanArray | undefined; - valueNumberArray?: NumberArray | undefined; - valueGeo?: GeoCoordinatesFilter | undefined; - /** leave space for more filter values */ - target: FilterTarget | undefined; -} -export declare enum Filters_Operator { - OPERATOR_UNSPECIFIED = 0, - OPERATOR_EQUAL = 1, - OPERATOR_NOT_EQUAL = 2, - OPERATOR_GREATER_THAN = 3, - OPERATOR_GREATER_THAN_EQUAL = 4, - OPERATOR_LESS_THAN = 5, - OPERATOR_LESS_THAN_EQUAL = 6, - OPERATOR_AND = 7, - OPERATOR_OR = 8, - OPERATOR_WITHIN_GEO_RANGE = 9, - OPERATOR_LIKE = 10, - OPERATOR_IS_NULL = 11, - OPERATOR_CONTAINS_ANY = 12, - OPERATOR_CONTAINS_ALL = 13, - UNRECOGNIZED = -1, -} -export declare function filters_OperatorFromJSON(object: any): Filters_Operator; -export declare function filters_OperatorToJSON(object: Filters_Operator): string; -export interface FilterReferenceSingleTarget { - on: string; - target: FilterTarget | undefined; -} -export interface FilterReferenceMultiTarget { - on: string; - target: FilterTarget | undefined; - targetCollection: string; -} -export interface FilterReferenceCount { - on: string; -} -export interface FilterTarget { - property?: string | undefined; - singleTarget?: FilterReferenceSingleTarget | undefined; - multiTarget?: FilterReferenceMultiTarget | undefined; - count?: FilterReferenceCount | undefined; -} -export interface GeoCoordinatesFilter { - latitude: number; - longitude: number; - distance: number; -} -export interface Vectors { - name: string; - /** for multi-vec */ - index: number; - vectorBytes: Uint8Array; -} -export declare const NumberArrayProperties: { - encode(message: NumberArrayProperties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NumberArrayProperties; - fromJSON(object: any): NumberArrayProperties; - toJSON(message: NumberArrayProperties): unknown; - create(base?: DeepPartial): NumberArrayProperties; - fromPartial(object: DeepPartial): NumberArrayProperties; -}; -export declare const IntArrayProperties: { - encode(message: IntArrayProperties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): IntArrayProperties; - fromJSON(object: any): IntArrayProperties; - toJSON(message: IntArrayProperties): unknown; - create(base?: DeepPartial): IntArrayProperties; - fromPartial(object: DeepPartial): IntArrayProperties; -}; -export declare const TextArrayProperties: { - encode(message: TextArrayProperties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): TextArrayProperties; - fromJSON(object: any): TextArrayProperties; - toJSON(message: TextArrayProperties): unknown; - create(base?: DeepPartial): TextArrayProperties; - fromPartial(object: DeepPartial): TextArrayProperties; -}; -export declare const BooleanArrayProperties: { - encode(message: BooleanArrayProperties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BooleanArrayProperties; - fromJSON(object: any): BooleanArrayProperties; - toJSON(message: BooleanArrayProperties): unknown; - create(base?: DeepPartial): BooleanArrayProperties; - fromPartial(object: DeepPartial): BooleanArrayProperties; -}; -export declare const ObjectPropertiesValue: { - encode(message: ObjectPropertiesValue, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): ObjectPropertiesValue; - fromJSON(object: any): ObjectPropertiesValue; - toJSON(message: ObjectPropertiesValue): unknown; - create(base?: DeepPartial): ObjectPropertiesValue; - fromPartial(object: DeepPartial): ObjectPropertiesValue; -}; -export declare const ObjectArrayProperties: { - encode(message: ObjectArrayProperties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): ObjectArrayProperties; - fromJSON(object: any): ObjectArrayProperties; - toJSON(message: ObjectArrayProperties): unknown; - create(base?: DeepPartial): ObjectArrayProperties; - fromPartial(object: DeepPartial): ObjectArrayProperties; -}; -export declare const ObjectProperties: { - encode(message: ObjectProperties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): ObjectProperties; - fromJSON(object: any): ObjectProperties; - toJSON(message: ObjectProperties): unknown; - create(base?: DeepPartial): ObjectProperties; - fromPartial(object: DeepPartial): ObjectProperties; -}; -export declare const TextArray: { - encode(message: TextArray, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): TextArray; - fromJSON(object: any): TextArray; - toJSON(message: TextArray): unknown; - create(base?: DeepPartial): TextArray; - fromPartial(object: DeepPartial): TextArray; -}; -export declare const IntArray: { - encode(message: IntArray, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): IntArray; - fromJSON(object: any): IntArray; - toJSON(message: IntArray): unknown; - create(base?: DeepPartial): IntArray; - fromPartial(object: DeepPartial): IntArray; -}; -export declare const NumberArray: { - encode(message: NumberArray, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NumberArray; - fromJSON(object: any): NumberArray; - toJSON(message: NumberArray): unknown; - create(base?: DeepPartial): NumberArray; - fromPartial(object: DeepPartial): NumberArray; -}; -export declare const BooleanArray: { - encode(message: BooleanArray, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BooleanArray; - fromJSON(object: any): BooleanArray; - toJSON(message: BooleanArray): unknown; - create(base?: DeepPartial): BooleanArray; - fromPartial(object: DeepPartial): BooleanArray; -}; -export declare const Filters: { - encode(message: Filters, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Filters; - fromJSON(object: any): Filters; - toJSON(message: Filters): unknown; - create(base?: DeepPartial): Filters; - fromPartial(object: DeepPartial): Filters; -}; -export declare const FilterReferenceSingleTarget: { - encode(message: FilterReferenceSingleTarget, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): FilterReferenceSingleTarget; - fromJSON(object: any): FilterReferenceSingleTarget; - toJSON(message: FilterReferenceSingleTarget): unknown; - create(base?: DeepPartial): FilterReferenceSingleTarget; - fromPartial(object: DeepPartial): FilterReferenceSingleTarget; -}; -export declare const FilterReferenceMultiTarget: { - encode(message: FilterReferenceMultiTarget, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): FilterReferenceMultiTarget; - fromJSON(object: any): FilterReferenceMultiTarget; - toJSON(message: FilterReferenceMultiTarget): unknown; - create(base?: DeepPartial): FilterReferenceMultiTarget; - fromPartial(object: DeepPartial): FilterReferenceMultiTarget; -}; -export declare const FilterReferenceCount: { - encode(message: FilterReferenceCount, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): FilterReferenceCount; - fromJSON(object: any): FilterReferenceCount; - toJSON(message: FilterReferenceCount): unknown; - create(base?: DeepPartial): FilterReferenceCount; - fromPartial(object: DeepPartial): FilterReferenceCount; -}; -export declare const FilterTarget: { - encode(message: FilterTarget, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): FilterTarget; - fromJSON(object: any): FilterTarget; - toJSON(message: FilterTarget): unknown; - create(base?: DeepPartial): FilterTarget; - fromPartial(object: DeepPartial): FilterTarget; -}; -export declare const GeoCoordinatesFilter: { - encode(message: GeoCoordinatesFilter, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GeoCoordinatesFilter; - fromJSON(object: any): GeoCoordinatesFilter; - toJSON(message: GeoCoordinatesFilter): unknown; - create(base?: DeepPartial): GeoCoordinatesFilter; - fromPartial(object: DeepPartial): GeoCoordinatesFilter; -}; -export declare const Vectors: { - encode(message: Vectors, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Vectors; - fromJSON(object: any): Vectors; - toJSON(message: Vectors): unknown; - create(base?: DeepPartial): Vectors; - fromPartial(object: DeepPartial): Vectors; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/cjs/proto/v1/base.js b/dist/node/cjs/proto/v1/base.js deleted file mode 100644 index dc75cd65..00000000 --- a/dist/node/cjs/proto/v1/base.js +++ /dev/null @@ -1,1928 +0,0 @@ -'use strict'; -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/base.proto -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.Vectors = - exports.GeoCoordinatesFilter = - exports.FilterTarget = - exports.FilterReferenceCount = - exports.FilterReferenceMultiTarget = - exports.FilterReferenceSingleTarget = - exports.Filters = - exports.BooleanArray = - exports.NumberArray = - exports.IntArray = - exports.TextArray = - exports.ObjectProperties = - exports.ObjectArrayProperties = - exports.ObjectPropertiesValue = - exports.BooleanArrayProperties = - exports.TextArrayProperties = - exports.IntArrayProperties = - exports.NumberArrayProperties = - exports.filters_OperatorToJSON = - exports.filters_OperatorFromJSON = - exports.Filters_Operator = - exports.consistencyLevelToJSON = - exports.consistencyLevelFromJSON = - exports.ConsistencyLevel = - exports.protobufPackage = - void 0; -/* eslint-disable */ -const long_1 = __importDefault(require('long')); -const minimal_js_1 = __importDefault(require('protobufjs/minimal.js')); -const struct_js_1 = require('../google/protobuf/struct.js'); -exports.protobufPackage = 'weaviate.v1'; -var ConsistencyLevel; -(function (ConsistencyLevel) { - ConsistencyLevel[(ConsistencyLevel['CONSISTENCY_LEVEL_UNSPECIFIED'] = 0)] = 'CONSISTENCY_LEVEL_UNSPECIFIED'; - ConsistencyLevel[(ConsistencyLevel['CONSISTENCY_LEVEL_ONE'] = 1)] = 'CONSISTENCY_LEVEL_ONE'; - ConsistencyLevel[(ConsistencyLevel['CONSISTENCY_LEVEL_QUORUM'] = 2)] = 'CONSISTENCY_LEVEL_QUORUM'; - ConsistencyLevel[(ConsistencyLevel['CONSISTENCY_LEVEL_ALL'] = 3)] = 'CONSISTENCY_LEVEL_ALL'; - ConsistencyLevel[(ConsistencyLevel['UNRECOGNIZED'] = -1)] = 'UNRECOGNIZED'; -})(ConsistencyLevel || (exports.ConsistencyLevel = ConsistencyLevel = {})); -function consistencyLevelFromJSON(object) { - switch (object) { - case 0: - case 'CONSISTENCY_LEVEL_UNSPECIFIED': - return ConsistencyLevel.CONSISTENCY_LEVEL_UNSPECIFIED; - case 1: - case 'CONSISTENCY_LEVEL_ONE': - return ConsistencyLevel.CONSISTENCY_LEVEL_ONE; - case 2: - case 'CONSISTENCY_LEVEL_QUORUM': - return ConsistencyLevel.CONSISTENCY_LEVEL_QUORUM; - case 3: - case 'CONSISTENCY_LEVEL_ALL': - return ConsistencyLevel.CONSISTENCY_LEVEL_ALL; - case -1: - case 'UNRECOGNIZED': - default: - return ConsistencyLevel.UNRECOGNIZED; - } -} -exports.consistencyLevelFromJSON = consistencyLevelFromJSON; -function consistencyLevelToJSON(object) { - switch (object) { - case ConsistencyLevel.CONSISTENCY_LEVEL_UNSPECIFIED: - return 'CONSISTENCY_LEVEL_UNSPECIFIED'; - case ConsistencyLevel.CONSISTENCY_LEVEL_ONE: - return 'CONSISTENCY_LEVEL_ONE'; - case ConsistencyLevel.CONSISTENCY_LEVEL_QUORUM: - return 'CONSISTENCY_LEVEL_QUORUM'; - case ConsistencyLevel.CONSISTENCY_LEVEL_ALL: - return 'CONSISTENCY_LEVEL_ALL'; - case ConsistencyLevel.UNRECOGNIZED: - default: - return 'UNRECOGNIZED'; - } -} -exports.consistencyLevelToJSON = consistencyLevelToJSON; -var Filters_Operator; -(function (Filters_Operator) { - Filters_Operator[(Filters_Operator['OPERATOR_UNSPECIFIED'] = 0)] = 'OPERATOR_UNSPECIFIED'; - Filters_Operator[(Filters_Operator['OPERATOR_EQUAL'] = 1)] = 'OPERATOR_EQUAL'; - Filters_Operator[(Filters_Operator['OPERATOR_NOT_EQUAL'] = 2)] = 'OPERATOR_NOT_EQUAL'; - Filters_Operator[(Filters_Operator['OPERATOR_GREATER_THAN'] = 3)] = 'OPERATOR_GREATER_THAN'; - Filters_Operator[(Filters_Operator['OPERATOR_GREATER_THAN_EQUAL'] = 4)] = 'OPERATOR_GREATER_THAN_EQUAL'; - Filters_Operator[(Filters_Operator['OPERATOR_LESS_THAN'] = 5)] = 'OPERATOR_LESS_THAN'; - Filters_Operator[(Filters_Operator['OPERATOR_LESS_THAN_EQUAL'] = 6)] = 'OPERATOR_LESS_THAN_EQUAL'; - Filters_Operator[(Filters_Operator['OPERATOR_AND'] = 7)] = 'OPERATOR_AND'; - Filters_Operator[(Filters_Operator['OPERATOR_OR'] = 8)] = 'OPERATOR_OR'; - Filters_Operator[(Filters_Operator['OPERATOR_WITHIN_GEO_RANGE'] = 9)] = 'OPERATOR_WITHIN_GEO_RANGE'; - Filters_Operator[(Filters_Operator['OPERATOR_LIKE'] = 10)] = 'OPERATOR_LIKE'; - Filters_Operator[(Filters_Operator['OPERATOR_IS_NULL'] = 11)] = 'OPERATOR_IS_NULL'; - Filters_Operator[(Filters_Operator['OPERATOR_CONTAINS_ANY'] = 12)] = 'OPERATOR_CONTAINS_ANY'; - Filters_Operator[(Filters_Operator['OPERATOR_CONTAINS_ALL'] = 13)] = 'OPERATOR_CONTAINS_ALL'; - Filters_Operator[(Filters_Operator['UNRECOGNIZED'] = -1)] = 'UNRECOGNIZED'; -})(Filters_Operator || (exports.Filters_Operator = Filters_Operator = {})); -function filters_OperatorFromJSON(object) { - switch (object) { - case 0: - case 'OPERATOR_UNSPECIFIED': - return Filters_Operator.OPERATOR_UNSPECIFIED; - case 1: - case 'OPERATOR_EQUAL': - return Filters_Operator.OPERATOR_EQUAL; - case 2: - case 'OPERATOR_NOT_EQUAL': - return Filters_Operator.OPERATOR_NOT_EQUAL; - case 3: - case 'OPERATOR_GREATER_THAN': - return Filters_Operator.OPERATOR_GREATER_THAN; - case 4: - case 'OPERATOR_GREATER_THAN_EQUAL': - return Filters_Operator.OPERATOR_GREATER_THAN_EQUAL; - case 5: - case 'OPERATOR_LESS_THAN': - return Filters_Operator.OPERATOR_LESS_THAN; - case 6: - case 'OPERATOR_LESS_THAN_EQUAL': - return Filters_Operator.OPERATOR_LESS_THAN_EQUAL; - case 7: - case 'OPERATOR_AND': - return Filters_Operator.OPERATOR_AND; - case 8: - case 'OPERATOR_OR': - return Filters_Operator.OPERATOR_OR; - case 9: - case 'OPERATOR_WITHIN_GEO_RANGE': - return Filters_Operator.OPERATOR_WITHIN_GEO_RANGE; - case 10: - case 'OPERATOR_LIKE': - return Filters_Operator.OPERATOR_LIKE; - case 11: - case 'OPERATOR_IS_NULL': - return Filters_Operator.OPERATOR_IS_NULL; - case 12: - case 'OPERATOR_CONTAINS_ANY': - return Filters_Operator.OPERATOR_CONTAINS_ANY; - case 13: - case 'OPERATOR_CONTAINS_ALL': - return Filters_Operator.OPERATOR_CONTAINS_ALL; - case -1: - case 'UNRECOGNIZED': - default: - return Filters_Operator.UNRECOGNIZED; - } -} -exports.filters_OperatorFromJSON = filters_OperatorFromJSON; -function filters_OperatorToJSON(object) { - switch (object) { - case Filters_Operator.OPERATOR_UNSPECIFIED: - return 'OPERATOR_UNSPECIFIED'; - case Filters_Operator.OPERATOR_EQUAL: - return 'OPERATOR_EQUAL'; - case Filters_Operator.OPERATOR_NOT_EQUAL: - return 'OPERATOR_NOT_EQUAL'; - case Filters_Operator.OPERATOR_GREATER_THAN: - return 'OPERATOR_GREATER_THAN'; - case Filters_Operator.OPERATOR_GREATER_THAN_EQUAL: - return 'OPERATOR_GREATER_THAN_EQUAL'; - case Filters_Operator.OPERATOR_LESS_THAN: - return 'OPERATOR_LESS_THAN'; - case Filters_Operator.OPERATOR_LESS_THAN_EQUAL: - return 'OPERATOR_LESS_THAN_EQUAL'; - case Filters_Operator.OPERATOR_AND: - return 'OPERATOR_AND'; - case Filters_Operator.OPERATOR_OR: - return 'OPERATOR_OR'; - case Filters_Operator.OPERATOR_WITHIN_GEO_RANGE: - return 'OPERATOR_WITHIN_GEO_RANGE'; - case Filters_Operator.OPERATOR_LIKE: - return 'OPERATOR_LIKE'; - case Filters_Operator.OPERATOR_IS_NULL: - return 'OPERATOR_IS_NULL'; - case Filters_Operator.OPERATOR_CONTAINS_ANY: - return 'OPERATOR_CONTAINS_ANY'; - case Filters_Operator.OPERATOR_CONTAINS_ALL: - return 'OPERATOR_CONTAINS_ALL'; - case Filters_Operator.UNRECOGNIZED: - default: - return 'UNRECOGNIZED'; - } -} -exports.filters_OperatorToJSON = filters_OperatorToJSON; -function createBaseNumberArrayProperties() { - return { values: [], propName: '', valuesBytes: new Uint8Array(0) }; -} -exports.NumberArrayProperties = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.values) { - writer.double(v); - } - writer.ldelim(); - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - if (message.valuesBytes.length !== 0) { - writer.uint32(26).bytes(message.valuesBytes); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNumberArrayProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 9) { - message.values.push(reader.double()); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.values.push(reader.double()); - } - continue; - } - break; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - case 3: - if (tag !== 26) { - break; - } - message.valuesBytes = reader.bytes(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.Number(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - valuesBytes: isSet(object.valuesBytes) ? bytesFromBase64(object.valuesBytes) : new Uint8Array(0), - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - if (message.propName !== '') { - obj.propName = message.propName; - } - if (message.valuesBytes.length !== 0) { - obj.valuesBytes = base64FromBytes(message.valuesBytes); - } - return obj; - }, - create(base) { - return exports.NumberArrayProperties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseNumberArrayProperties(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - message.valuesBytes = (_c = object.valuesBytes) !== null && _c !== void 0 ? _c : new Uint8Array(0); - return message; - }, -}; -function createBaseIntArrayProperties() { - return { values: [], propName: '' }; -} -exports.IntArrayProperties = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.values) { - writer.int64(v); - } - writer.ldelim(); - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseIntArrayProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 8) { - message.values.push(longToNumber(reader.int64())); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.values.push(longToNumber(reader.int64())); - } - continue; - } - break; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.Number(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values.map((e) => Math.round(e)); - } - if (message.propName !== '') { - obj.propName = message.propName; - } - return obj; - }, - create(base) { - return exports.IntArrayProperties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseIntArrayProperties(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function createBaseTextArrayProperties() { - return { values: [], propName: '' }; -} -exports.TextArrayProperties = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.values) { - writer.uint32(10).string(v); - } - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTextArrayProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(reader.string()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.String(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - if (message.propName !== '') { - obj.propName = message.propName; - } - return obj; - }, - create(base) { - return exports.TextArrayProperties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseTextArrayProperties(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function createBaseBooleanArrayProperties() { - return { values: [], propName: '' }; -} -exports.BooleanArrayProperties = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.values) { - writer.bool(v); - } - writer.ldelim(); - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBooleanArrayProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 8) { - message.values.push(reader.bool()); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.values.push(reader.bool()); - } - continue; - } - break; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.Boolean(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - if (message.propName !== '') { - obj.propName = message.propName; - } - return obj; - }, - create(base) { - return exports.BooleanArrayProperties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseBooleanArrayProperties(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function createBaseObjectPropertiesValue() { - return { - nonRefProperties: undefined, - numberArrayProperties: [], - intArrayProperties: [], - textArrayProperties: [], - booleanArrayProperties: [], - objectProperties: [], - objectArrayProperties: [], - emptyListProps: [], - }; -} -exports.ObjectPropertiesValue = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.nonRefProperties !== undefined) { - struct_js_1.Struct.encode( - struct_js_1.Struct.wrap(message.nonRefProperties), - writer.uint32(10).fork() - ).ldelim(); - } - for (const v of message.numberArrayProperties) { - exports.NumberArrayProperties.encode(v, writer.uint32(18).fork()).ldelim(); - } - for (const v of message.intArrayProperties) { - exports.IntArrayProperties.encode(v, writer.uint32(26).fork()).ldelim(); - } - for (const v of message.textArrayProperties) { - exports.TextArrayProperties.encode(v, writer.uint32(34).fork()).ldelim(); - } - for (const v of message.booleanArrayProperties) { - exports.BooleanArrayProperties.encode(v, writer.uint32(42).fork()).ldelim(); - } - for (const v of message.objectProperties) { - exports.ObjectProperties.encode(v, writer.uint32(50).fork()).ldelim(); - } - for (const v of message.objectArrayProperties) { - exports.ObjectArrayProperties.encode(v, writer.uint32(58).fork()).ldelim(); - } - for (const v of message.emptyListProps) { - writer.uint32(82).string(v); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseObjectPropertiesValue(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.nonRefProperties = struct_js_1.Struct.unwrap( - struct_js_1.Struct.decode(reader, reader.uint32()) - ); - continue; - case 2: - if (tag !== 18) { - break; - } - message.numberArrayProperties.push(exports.NumberArrayProperties.decode(reader, reader.uint32())); - continue; - case 3: - if (tag !== 26) { - break; - } - message.intArrayProperties.push(exports.IntArrayProperties.decode(reader, reader.uint32())); - continue; - case 4: - if (tag !== 34) { - break; - } - message.textArrayProperties.push(exports.TextArrayProperties.decode(reader, reader.uint32())); - continue; - case 5: - if (tag !== 42) { - break; - } - message.booleanArrayProperties.push(exports.BooleanArrayProperties.decode(reader, reader.uint32())); - continue; - case 6: - if (tag !== 50) { - break; - } - message.objectProperties.push(exports.ObjectProperties.decode(reader, reader.uint32())); - continue; - case 7: - if (tag !== 58) { - break; - } - message.objectArrayProperties.push(exports.ObjectArrayProperties.decode(reader, reader.uint32())); - continue; - case 10: - if (tag !== 82) { - break; - } - message.emptyListProps.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - nonRefProperties: isObject(object.nonRefProperties) ? object.nonRefProperties : undefined, - numberArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.numberArrayProperties - ) - ? object.numberArrayProperties.map((e) => exports.NumberArrayProperties.fromJSON(e)) - : [], - intArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.intArrayProperties - ) - ? object.intArrayProperties.map((e) => exports.IntArrayProperties.fromJSON(e)) - : [], - textArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.textArrayProperties - ) - ? object.textArrayProperties.map((e) => exports.TextArrayProperties.fromJSON(e)) - : [], - booleanArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.booleanArrayProperties - ) - ? object.booleanArrayProperties.map((e) => exports.BooleanArrayProperties.fromJSON(e)) - : [], - objectProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectProperties - ) - ? object.objectProperties.map((e) => exports.ObjectProperties.fromJSON(e)) - : [], - objectArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectArrayProperties - ) - ? object.objectArrayProperties.map((e) => exports.ObjectArrayProperties.fromJSON(e)) - : [], - emptyListProps: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.emptyListProps - ) - ? object.emptyListProps.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b, _c, _d, _e, _f, _g; - const obj = {}; - if (message.nonRefProperties !== undefined) { - obj.nonRefProperties = message.nonRefProperties; - } - if ((_a = message.numberArrayProperties) === null || _a === void 0 ? void 0 : _a.length) { - obj.numberArrayProperties = message.numberArrayProperties.map((e) => - exports.NumberArrayProperties.toJSON(e) - ); - } - if ((_b = message.intArrayProperties) === null || _b === void 0 ? void 0 : _b.length) { - obj.intArrayProperties = message.intArrayProperties.map((e) => exports.IntArrayProperties.toJSON(e)); - } - if ((_c = message.textArrayProperties) === null || _c === void 0 ? void 0 : _c.length) { - obj.textArrayProperties = message.textArrayProperties.map((e) => exports.TextArrayProperties.toJSON(e)); - } - if ((_d = message.booleanArrayProperties) === null || _d === void 0 ? void 0 : _d.length) { - obj.booleanArrayProperties = message.booleanArrayProperties.map((e) => - exports.BooleanArrayProperties.toJSON(e) - ); - } - if ((_e = message.objectProperties) === null || _e === void 0 ? void 0 : _e.length) { - obj.objectProperties = message.objectProperties.map((e) => exports.ObjectProperties.toJSON(e)); - } - if ((_f = message.objectArrayProperties) === null || _f === void 0 ? void 0 : _f.length) { - obj.objectArrayProperties = message.objectArrayProperties.map((e) => - exports.ObjectArrayProperties.toJSON(e) - ); - } - if ((_g = message.emptyListProps) === null || _g === void 0 ? void 0 : _g.length) { - obj.emptyListProps = message.emptyListProps; - } - return obj; - }, - create(base) { - return exports.ObjectPropertiesValue.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h; - const message = createBaseObjectPropertiesValue(); - message.nonRefProperties = (_a = object.nonRefProperties) !== null && _a !== void 0 ? _a : undefined; - message.numberArrayProperties = - ((_b = object.numberArrayProperties) === null || _b === void 0 - ? void 0 - : _b.map((e) => exports.NumberArrayProperties.fromPartial(e))) || []; - message.intArrayProperties = - ((_c = object.intArrayProperties) === null || _c === void 0 - ? void 0 - : _c.map((e) => exports.IntArrayProperties.fromPartial(e))) || []; - message.textArrayProperties = - ((_d = object.textArrayProperties) === null || _d === void 0 - ? void 0 - : _d.map((e) => exports.TextArrayProperties.fromPartial(e))) || []; - message.booleanArrayProperties = - ((_e = object.booleanArrayProperties) === null || _e === void 0 - ? void 0 - : _e.map((e) => exports.BooleanArrayProperties.fromPartial(e))) || []; - message.objectProperties = - ((_f = object.objectProperties) === null || _f === void 0 - ? void 0 - : _f.map((e) => exports.ObjectProperties.fromPartial(e))) || []; - message.objectArrayProperties = - ((_g = object.objectArrayProperties) === null || _g === void 0 - ? void 0 - : _g.map((e) => exports.ObjectArrayProperties.fromPartial(e))) || []; - message.emptyListProps = - ((_h = object.emptyListProps) === null || _h === void 0 ? void 0 : _h.map((e) => e)) || []; - return message; - }, -}; -function createBaseObjectArrayProperties() { - return { values: [], propName: '' }; -} -exports.ObjectArrayProperties = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.values) { - exports.ObjectPropertiesValue.encode(v, writer.uint32(10).fork()).ldelim(); - } - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseObjectArrayProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(exports.ObjectPropertiesValue.decode(reader, reader.uint32())); - continue; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => exports.ObjectPropertiesValue.fromJSON(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values.map((e) => exports.ObjectPropertiesValue.toJSON(e)); - } - if (message.propName !== '') { - obj.propName = message.propName; - } - return obj; - }, - create(base) { - return exports.ObjectArrayProperties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseObjectArrayProperties(); - message.values = - ((_a = object.values) === null || _a === void 0 - ? void 0 - : _a.map((e) => exports.ObjectPropertiesValue.fromPartial(e))) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function createBaseObjectProperties() { - return { value: undefined, propName: '' }; -} -exports.ObjectProperties = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.value !== undefined) { - exports.ObjectPropertiesValue.encode(message.value, writer.uint32(10).fork()).ldelim(); - } - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseObjectProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.value = exports.ObjectPropertiesValue.decode(reader, reader.uint32()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - value: isSet(object.value) ? exports.ObjectPropertiesValue.fromJSON(object.value) : undefined, - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - }; - }, - toJSON(message) { - const obj = {}; - if (message.value !== undefined) { - obj.value = exports.ObjectPropertiesValue.toJSON(message.value); - } - if (message.propName !== '') { - obj.propName = message.propName; - } - return obj; - }, - create(base) { - return exports.ObjectProperties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseObjectProperties(); - message.value = - object.value !== undefined && object.value !== null - ? exports.ObjectPropertiesValue.fromPartial(object.value) - : undefined; - message.propName = (_a = object.propName) !== null && _a !== void 0 ? _a : ''; - return message; - }, -}; -function createBaseTextArray() { - return { values: [] }; -} -exports.TextArray = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.values) { - writer.uint32(10).string(v); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTextArray(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return exports.TextArray.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseTextArray(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseIntArray() { - return { values: [] }; -} -exports.IntArray = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.values) { - writer.int64(v); - } - writer.ldelim(); - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseIntArray(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 8) { - message.values.push(longToNumber(reader.int64())); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.values.push(longToNumber(reader.int64())); - } - continue; - } - break; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.Number(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values.map((e) => Math.round(e)); - } - return obj; - }, - create(base) { - return exports.IntArray.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseIntArray(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseNumberArray() { - return { values: [] }; -} -exports.NumberArray = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.values) { - writer.double(v); - } - writer.ldelim(); - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNumberArray(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 9) { - message.values.push(reader.double()); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.values.push(reader.double()); - } - continue; - } - break; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.Number(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return exports.NumberArray.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseNumberArray(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseBooleanArray() { - return { values: [] }; -} -exports.BooleanArray = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.values) { - writer.bool(v); - } - writer.ldelim(); - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBooleanArray(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 8) { - message.values.push(reader.bool()); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.values.push(reader.bool()); - } - continue; - } - break; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.Boolean(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return exports.BooleanArray.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseBooleanArray(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseFilters() { - return { - operator: 0, - on: [], - filters: [], - valueText: undefined, - valueInt: undefined, - valueBoolean: undefined, - valueNumber: undefined, - valueTextArray: undefined, - valueIntArray: undefined, - valueBooleanArray: undefined, - valueNumberArray: undefined, - valueGeo: undefined, - target: undefined, - }; -} -exports.Filters = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.operator !== 0) { - writer.uint32(8).int32(message.operator); - } - for (const v of message.on) { - writer.uint32(18).string(v); - } - for (const v of message.filters) { - exports.Filters.encode(v, writer.uint32(26).fork()).ldelim(); - } - if (message.valueText !== undefined) { - writer.uint32(34).string(message.valueText); - } - if (message.valueInt !== undefined) { - writer.uint32(40).int64(message.valueInt); - } - if (message.valueBoolean !== undefined) { - writer.uint32(48).bool(message.valueBoolean); - } - if (message.valueNumber !== undefined) { - writer.uint32(57).double(message.valueNumber); - } - if (message.valueTextArray !== undefined) { - exports.TextArray.encode(message.valueTextArray, writer.uint32(74).fork()).ldelim(); - } - if (message.valueIntArray !== undefined) { - exports.IntArray.encode(message.valueIntArray, writer.uint32(82).fork()).ldelim(); - } - if (message.valueBooleanArray !== undefined) { - exports.BooleanArray.encode(message.valueBooleanArray, writer.uint32(90).fork()).ldelim(); - } - if (message.valueNumberArray !== undefined) { - exports.NumberArray.encode(message.valueNumberArray, writer.uint32(98).fork()).ldelim(); - } - if (message.valueGeo !== undefined) { - exports.GeoCoordinatesFilter.encode(message.valueGeo, writer.uint32(106).fork()).ldelim(); - } - if (message.target !== undefined) { - exports.FilterTarget.encode(message.target, writer.uint32(162).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFilters(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.operator = reader.int32(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.on.push(reader.string()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.filters.push(exports.Filters.decode(reader, reader.uint32())); - continue; - case 4: - if (tag !== 34) { - break; - } - message.valueText = reader.string(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.valueInt = longToNumber(reader.int64()); - continue; - case 6: - if (tag !== 48) { - break; - } - message.valueBoolean = reader.bool(); - continue; - case 7: - if (tag !== 57) { - break; - } - message.valueNumber = reader.double(); - continue; - case 9: - if (tag !== 74) { - break; - } - message.valueTextArray = exports.TextArray.decode(reader, reader.uint32()); - continue; - case 10: - if (tag !== 82) { - break; - } - message.valueIntArray = exports.IntArray.decode(reader, reader.uint32()); - continue; - case 11: - if (tag !== 90) { - break; - } - message.valueBooleanArray = exports.BooleanArray.decode(reader, reader.uint32()); - continue; - case 12: - if (tag !== 98) { - break; - } - message.valueNumberArray = exports.NumberArray.decode(reader, reader.uint32()); - continue; - case 13: - if (tag !== 106) { - break; - } - message.valueGeo = exports.GeoCoordinatesFilter.decode(reader, reader.uint32()); - continue; - case 20: - if (tag !== 162) { - break; - } - message.target = exports.FilterTarget.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - operator: isSet(object.operator) ? filters_OperatorFromJSON(object.operator) : 0, - on: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.on) - ? object.on.map((e) => globalThis.String(e)) - : [], - filters: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.filters) - ? object.filters.map((e) => exports.Filters.fromJSON(e)) - : [], - valueText: isSet(object.valueText) ? globalThis.String(object.valueText) : undefined, - valueInt: isSet(object.valueInt) ? globalThis.Number(object.valueInt) : undefined, - valueBoolean: isSet(object.valueBoolean) ? globalThis.Boolean(object.valueBoolean) : undefined, - valueNumber: isSet(object.valueNumber) ? globalThis.Number(object.valueNumber) : undefined, - valueTextArray: isSet(object.valueTextArray) - ? exports.TextArray.fromJSON(object.valueTextArray) - : undefined, - valueIntArray: isSet(object.valueIntArray) - ? exports.IntArray.fromJSON(object.valueIntArray) - : undefined, - valueBooleanArray: isSet(object.valueBooleanArray) - ? exports.BooleanArray.fromJSON(object.valueBooleanArray) - : undefined, - valueNumberArray: isSet(object.valueNumberArray) - ? exports.NumberArray.fromJSON(object.valueNumberArray) - : undefined, - valueGeo: isSet(object.valueGeo) ? exports.GeoCoordinatesFilter.fromJSON(object.valueGeo) : undefined, - target: isSet(object.target) ? exports.FilterTarget.fromJSON(object.target) : undefined, - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if (message.operator !== 0) { - obj.operator = filters_OperatorToJSON(message.operator); - } - if ((_a = message.on) === null || _a === void 0 ? void 0 : _a.length) { - obj.on = message.on; - } - if ((_b = message.filters) === null || _b === void 0 ? void 0 : _b.length) { - obj.filters = message.filters.map((e) => exports.Filters.toJSON(e)); - } - if (message.valueText !== undefined) { - obj.valueText = message.valueText; - } - if (message.valueInt !== undefined) { - obj.valueInt = Math.round(message.valueInt); - } - if (message.valueBoolean !== undefined) { - obj.valueBoolean = message.valueBoolean; - } - if (message.valueNumber !== undefined) { - obj.valueNumber = message.valueNumber; - } - if (message.valueTextArray !== undefined) { - obj.valueTextArray = exports.TextArray.toJSON(message.valueTextArray); - } - if (message.valueIntArray !== undefined) { - obj.valueIntArray = exports.IntArray.toJSON(message.valueIntArray); - } - if (message.valueBooleanArray !== undefined) { - obj.valueBooleanArray = exports.BooleanArray.toJSON(message.valueBooleanArray); - } - if (message.valueNumberArray !== undefined) { - obj.valueNumberArray = exports.NumberArray.toJSON(message.valueNumberArray); - } - if (message.valueGeo !== undefined) { - obj.valueGeo = exports.GeoCoordinatesFilter.toJSON(message.valueGeo); - } - if (message.target !== undefined) { - obj.target = exports.FilterTarget.toJSON(message.target); - } - return obj; - }, - create(base) { - return exports.Filters.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g; - const message = createBaseFilters(); - message.operator = (_a = object.operator) !== null && _a !== void 0 ? _a : 0; - message.on = ((_b = object.on) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - message.filters = - ((_c = object.filters) === null || _c === void 0 - ? void 0 - : _c.map((e) => exports.Filters.fromPartial(e))) || []; - message.valueText = (_d = object.valueText) !== null && _d !== void 0 ? _d : undefined; - message.valueInt = (_e = object.valueInt) !== null && _e !== void 0 ? _e : undefined; - message.valueBoolean = (_f = object.valueBoolean) !== null && _f !== void 0 ? _f : undefined; - message.valueNumber = (_g = object.valueNumber) !== null && _g !== void 0 ? _g : undefined; - message.valueTextArray = - object.valueTextArray !== undefined && object.valueTextArray !== null - ? exports.TextArray.fromPartial(object.valueTextArray) - : undefined; - message.valueIntArray = - object.valueIntArray !== undefined && object.valueIntArray !== null - ? exports.IntArray.fromPartial(object.valueIntArray) - : undefined; - message.valueBooleanArray = - object.valueBooleanArray !== undefined && object.valueBooleanArray !== null - ? exports.BooleanArray.fromPartial(object.valueBooleanArray) - : undefined; - message.valueNumberArray = - object.valueNumberArray !== undefined && object.valueNumberArray !== null - ? exports.NumberArray.fromPartial(object.valueNumberArray) - : undefined; - message.valueGeo = - object.valueGeo !== undefined && object.valueGeo !== null - ? exports.GeoCoordinatesFilter.fromPartial(object.valueGeo) - : undefined; - message.target = - object.target !== undefined && object.target !== null - ? exports.FilterTarget.fromPartial(object.target) - : undefined; - return message; - }, -}; -function createBaseFilterReferenceSingleTarget() { - return { on: '', target: undefined }; -} -exports.FilterReferenceSingleTarget = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.on !== '') { - writer.uint32(10).string(message.on); - } - if (message.target !== undefined) { - exports.FilterTarget.encode(message.target, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFilterReferenceSingleTarget(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.on = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.target = exports.FilterTarget.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - on: isSet(object.on) ? globalThis.String(object.on) : '', - target: isSet(object.target) ? exports.FilterTarget.fromJSON(object.target) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.on !== '') { - obj.on = message.on; - } - if (message.target !== undefined) { - obj.target = exports.FilterTarget.toJSON(message.target); - } - return obj; - }, - create(base) { - return exports.FilterReferenceSingleTarget.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseFilterReferenceSingleTarget(); - message.on = (_a = object.on) !== null && _a !== void 0 ? _a : ''; - message.target = - object.target !== undefined && object.target !== null - ? exports.FilterTarget.fromPartial(object.target) - : undefined; - return message; - }, -}; -function createBaseFilterReferenceMultiTarget() { - return { on: '', target: undefined, targetCollection: '' }; -} -exports.FilterReferenceMultiTarget = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.on !== '') { - writer.uint32(10).string(message.on); - } - if (message.target !== undefined) { - exports.FilterTarget.encode(message.target, writer.uint32(18).fork()).ldelim(); - } - if (message.targetCollection !== '') { - writer.uint32(26).string(message.targetCollection); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFilterReferenceMultiTarget(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.on = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.target = exports.FilterTarget.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.targetCollection = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - on: isSet(object.on) ? globalThis.String(object.on) : '', - target: isSet(object.target) ? exports.FilterTarget.fromJSON(object.target) : undefined, - targetCollection: isSet(object.targetCollection) ? globalThis.String(object.targetCollection) : '', - }; - }, - toJSON(message) { - const obj = {}; - if (message.on !== '') { - obj.on = message.on; - } - if (message.target !== undefined) { - obj.target = exports.FilterTarget.toJSON(message.target); - } - if (message.targetCollection !== '') { - obj.targetCollection = message.targetCollection; - } - return obj; - }, - create(base) { - return exports.FilterReferenceMultiTarget.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseFilterReferenceMultiTarget(); - message.on = (_a = object.on) !== null && _a !== void 0 ? _a : ''; - message.target = - object.target !== undefined && object.target !== null - ? exports.FilterTarget.fromPartial(object.target) - : undefined; - message.targetCollection = (_b = object.targetCollection) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function createBaseFilterReferenceCount() { - return { on: '' }; -} -exports.FilterReferenceCount = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.on !== '') { - writer.uint32(10).string(message.on); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFilterReferenceCount(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.on = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { on: isSet(object.on) ? globalThis.String(object.on) : '' }; - }, - toJSON(message) { - const obj = {}; - if (message.on !== '') { - obj.on = message.on; - } - return obj; - }, - create(base) { - return exports.FilterReferenceCount.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseFilterReferenceCount(); - message.on = (_a = object.on) !== null && _a !== void 0 ? _a : ''; - return message; - }, -}; -function createBaseFilterTarget() { - return { property: undefined, singleTarget: undefined, multiTarget: undefined, count: undefined }; -} -exports.FilterTarget = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.property !== undefined) { - writer.uint32(10).string(message.property); - } - if (message.singleTarget !== undefined) { - exports.FilterReferenceSingleTarget.encode(message.singleTarget, writer.uint32(18).fork()).ldelim(); - } - if (message.multiTarget !== undefined) { - exports.FilterReferenceMultiTarget.encode(message.multiTarget, writer.uint32(26).fork()).ldelim(); - } - if (message.count !== undefined) { - exports.FilterReferenceCount.encode(message.count, writer.uint32(34).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFilterTarget(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.property = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.singleTarget = exports.FilterReferenceSingleTarget.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.multiTarget = exports.FilterReferenceMultiTarget.decode(reader, reader.uint32()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.count = exports.FilterReferenceCount.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - property: isSet(object.property) ? globalThis.String(object.property) : undefined, - singleTarget: isSet(object.singleTarget) - ? exports.FilterReferenceSingleTarget.fromJSON(object.singleTarget) - : undefined, - multiTarget: isSet(object.multiTarget) - ? exports.FilterReferenceMultiTarget.fromJSON(object.multiTarget) - : undefined, - count: isSet(object.count) ? exports.FilterReferenceCount.fromJSON(object.count) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.property !== undefined) { - obj.property = message.property; - } - if (message.singleTarget !== undefined) { - obj.singleTarget = exports.FilterReferenceSingleTarget.toJSON(message.singleTarget); - } - if (message.multiTarget !== undefined) { - obj.multiTarget = exports.FilterReferenceMultiTarget.toJSON(message.multiTarget); - } - if (message.count !== undefined) { - obj.count = exports.FilterReferenceCount.toJSON(message.count); - } - return obj; - }, - create(base) { - return exports.FilterTarget.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseFilterTarget(); - message.property = (_a = object.property) !== null && _a !== void 0 ? _a : undefined; - message.singleTarget = - object.singleTarget !== undefined && object.singleTarget !== null - ? exports.FilterReferenceSingleTarget.fromPartial(object.singleTarget) - : undefined; - message.multiTarget = - object.multiTarget !== undefined && object.multiTarget !== null - ? exports.FilterReferenceMultiTarget.fromPartial(object.multiTarget) - : undefined; - message.count = - object.count !== undefined && object.count !== null - ? exports.FilterReferenceCount.fromPartial(object.count) - : undefined; - return message; - }, -}; -function createBaseGeoCoordinatesFilter() { - return { latitude: 0, longitude: 0, distance: 0 }; -} -exports.GeoCoordinatesFilter = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.latitude !== 0) { - writer.uint32(13).float(message.latitude); - } - if (message.longitude !== 0) { - writer.uint32(21).float(message.longitude); - } - if (message.distance !== 0) { - writer.uint32(29).float(message.distance); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGeoCoordinatesFilter(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 13) { - break; - } - message.latitude = reader.float(); - continue; - case 2: - if (tag !== 21) { - break; - } - message.longitude = reader.float(); - continue; - case 3: - if (tag !== 29) { - break; - } - message.distance = reader.float(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - latitude: isSet(object.latitude) ? globalThis.Number(object.latitude) : 0, - longitude: isSet(object.longitude) ? globalThis.Number(object.longitude) : 0, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : 0, - }; - }, - toJSON(message) { - const obj = {}; - if (message.latitude !== 0) { - obj.latitude = message.latitude; - } - if (message.longitude !== 0) { - obj.longitude = message.longitude; - } - if (message.distance !== 0) { - obj.distance = message.distance; - } - return obj; - }, - create(base) { - return exports.GeoCoordinatesFilter.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGeoCoordinatesFilter(); - message.latitude = (_a = object.latitude) !== null && _a !== void 0 ? _a : 0; - message.longitude = (_b = object.longitude) !== null && _b !== void 0 ? _b : 0; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : 0; - return message; - }, -}; -function createBaseVectors() { - return { name: '', index: 0, vectorBytes: new Uint8Array(0) }; -} -exports.Vectors = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.name !== '') { - writer.uint32(10).string(message.name); - } - if (message.index !== 0) { - writer.uint32(16).uint64(message.index); - } - if (message.vectorBytes.length !== 0) { - writer.uint32(26).bytes(message.vectorBytes); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseVectors(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.name = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.index = longToNumber(reader.uint64()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.vectorBytes = reader.bytes(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - name: isSet(object.name) ? globalThis.String(object.name) : '', - index: isSet(object.index) ? globalThis.Number(object.index) : 0, - vectorBytes: isSet(object.vectorBytes) ? bytesFromBase64(object.vectorBytes) : new Uint8Array(0), - }; - }, - toJSON(message) { - const obj = {}; - if (message.name !== '') { - obj.name = message.name; - } - if (message.index !== 0) { - obj.index = Math.round(message.index); - } - if (message.vectorBytes.length !== 0) { - obj.vectorBytes = base64FromBytes(message.vectorBytes); - } - return obj; - }, - create(base) { - return exports.Vectors.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseVectors(); - message.name = (_a = object.name) !== null && _a !== void 0 ? _a : ''; - message.index = (_b = object.index) !== null && _b !== void 0 ? _b : 0; - message.vectorBytes = (_c = object.vectorBytes) !== null && _c !== void 0 ? _c : new Uint8Array(0); - return message; - }, -}; -function bytesFromBase64(b64) { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} -function base64FromBytes(arr) { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString('base64'); - } else { - const bin = []; - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join('')); - } -} -function longToNumber(long) { - if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { - throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); - } - return long.toNumber(); -} -if (minimal_js_1.default.util.Long !== long_1.default) { - minimal_js_1.default.util.Long = long_1.default; - minimal_js_1.default.configure(); -} -function isObject(value) { - return typeof value === 'object' && value !== null; -} -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/cjs/proto/v1/batch.d.ts b/dist/node/cjs/proto/v1/batch.d.ts deleted file mode 100644 index 4fca61ea..00000000 --- a/dist/node/cjs/proto/v1/batch.d.ts +++ /dev/null @@ -1,137 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -import { - BooleanArrayProperties, - ConsistencyLevel, - IntArrayProperties, - NumberArrayProperties, - ObjectArrayProperties, - ObjectProperties, - TextArrayProperties, - Vectors, -} from './base.js'; -export declare const protobufPackage = 'weaviate.v1'; -export interface BatchObjectsRequest { - objects: BatchObject[]; - consistencyLevel?: ConsistencyLevel | undefined; -} -export interface BatchObject { - uuid: string; - /** - * protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED - * - * @deprecated - */ - vector: number[]; - properties: BatchObject_Properties | undefined; - collection: string; - tenant: string; - vectorBytes: Uint8Array; - /** protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED */ - vectors: Vectors[]; -} -export interface BatchObject_Properties { - nonRefProperties: - | { - [key: string]: any; - } - | undefined; - singleTargetRefProps: BatchObject_SingleTargetRefProps[]; - multiTargetRefProps: BatchObject_MultiTargetRefProps[]; - numberArrayProperties: NumberArrayProperties[]; - intArrayProperties: IntArrayProperties[]; - textArrayProperties: TextArrayProperties[]; - booleanArrayProperties: BooleanArrayProperties[]; - objectProperties: ObjectProperties[]; - objectArrayProperties: ObjectArrayProperties[]; - /** - * empty lists do not have a type in many languages and clients do not know which datatype the property has. - * Weaviate can get the datatype from its schema - */ - emptyListProps: string[]; -} -export interface BatchObject_SingleTargetRefProps { - uuids: string[]; - propName: string; -} -export interface BatchObject_MultiTargetRefProps { - uuids: string[]; - propName: string; - targetCollection: string; -} -export interface BatchObjectsReply { - took: number; - errors: BatchObjectsReply_BatchError[]; -} -export interface BatchObjectsReply_BatchError { - index: number; - error: string; -} -export declare const BatchObjectsRequest: { - encode(message: BatchObjectsRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchObjectsRequest; - fromJSON(object: any): BatchObjectsRequest; - toJSON(message: BatchObjectsRequest): unknown; - create(base?: DeepPartial): BatchObjectsRequest; - fromPartial(object: DeepPartial): BatchObjectsRequest; -}; -export declare const BatchObject: { - encode(message: BatchObject, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchObject; - fromJSON(object: any): BatchObject; - toJSON(message: BatchObject): unknown; - create(base?: DeepPartial): BatchObject; - fromPartial(object: DeepPartial): BatchObject; -}; -export declare const BatchObject_Properties: { - encode(message: BatchObject_Properties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchObject_Properties; - fromJSON(object: any): BatchObject_Properties; - toJSON(message: BatchObject_Properties): unknown; - create(base?: DeepPartial): BatchObject_Properties; - fromPartial(object: DeepPartial): BatchObject_Properties; -}; -export declare const BatchObject_SingleTargetRefProps: { - encode(message: BatchObject_SingleTargetRefProps, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchObject_SingleTargetRefProps; - fromJSON(object: any): BatchObject_SingleTargetRefProps; - toJSON(message: BatchObject_SingleTargetRefProps): unknown; - create(base?: DeepPartial): BatchObject_SingleTargetRefProps; - fromPartial(object: DeepPartial): BatchObject_SingleTargetRefProps; -}; -export declare const BatchObject_MultiTargetRefProps: { - encode(message: BatchObject_MultiTargetRefProps, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchObject_MultiTargetRefProps; - fromJSON(object: any): BatchObject_MultiTargetRefProps; - toJSON(message: BatchObject_MultiTargetRefProps): unknown; - create(base?: DeepPartial): BatchObject_MultiTargetRefProps; - fromPartial(object: DeepPartial): BatchObject_MultiTargetRefProps; -}; -export declare const BatchObjectsReply: { - encode(message: BatchObjectsReply, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchObjectsReply; - fromJSON(object: any): BatchObjectsReply; - toJSON(message: BatchObjectsReply): unknown; - create(base?: DeepPartial): BatchObjectsReply; - fromPartial(object: DeepPartial): BatchObjectsReply; -}; -export declare const BatchObjectsReply_BatchError: { - encode(message: BatchObjectsReply_BatchError, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchObjectsReply_BatchError; - fromJSON(object: any): BatchObjectsReply_BatchError; - toJSON(message: BatchObjectsReply_BatchError): unknown; - create(base?: DeepPartial): BatchObjectsReply_BatchError; - fromPartial(object: DeepPartial): BatchObjectsReply_BatchError; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/cjs/proto/v1/batch.js b/dist/node/cjs/proto/v1/batch.js deleted file mode 100644 index fdd653cb..00000000 --- a/dist/node/cjs/proto/v1/batch.js +++ /dev/null @@ -1,873 +0,0 @@ -'use strict'; -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/batch.proto -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.BatchObjectsReply_BatchError = - exports.BatchObjectsReply = - exports.BatchObject_MultiTargetRefProps = - exports.BatchObject_SingleTargetRefProps = - exports.BatchObject_Properties = - exports.BatchObject = - exports.BatchObjectsRequest = - exports.protobufPackage = - void 0; -/* eslint-disable */ -const minimal_js_1 = __importDefault(require('protobufjs/minimal.js')); -const struct_js_1 = require('../google/protobuf/struct.js'); -const base_js_1 = require('./base.js'); -exports.protobufPackage = 'weaviate.v1'; -function createBaseBatchObjectsRequest() { - return { objects: [], consistencyLevel: undefined }; -} -exports.BatchObjectsRequest = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.objects) { - exports.BatchObject.encode(v, writer.uint32(10).fork()).ldelim(); - } - if (message.consistencyLevel !== undefined) { - writer.uint32(16).int32(message.consistencyLevel); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchObjectsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.objects.push(exports.BatchObject.decode(reader, reader.uint32())); - continue; - case 2: - if (tag !== 16) { - break; - } - message.consistencyLevel = reader.int32(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - objects: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.objects) - ? object.objects.map((e) => exports.BatchObject.fromJSON(e)) - : [], - consistencyLevel: isSet(object.consistencyLevel) - ? (0, base_js_1.consistencyLevelFromJSON)(object.consistencyLevel) - : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.objects) === null || _a === void 0 ? void 0 : _a.length) { - obj.objects = message.objects.map((e) => exports.BatchObject.toJSON(e)); - } - if (message.consistencyLevel !== undefined) { - obj.consistencyLevel = (0, base_js_1.consistencyLevelToJSON)(message.consistencyLevel); - } - return obj; - }, - create(base) { - return exports.BatchObjectsRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseBatchObjectsRequest(); - message.objects = - ((_a = object.objects) === null || _a === void 0 - ? void 0 - : _a.map((e) => exports.BatchObject.fromPartial(e))) || []; - message.consistencyLevel = (_b = object.consistencyLevel) !== null && _b !== void 0 ? _b : undefined; - return message; - }, -}; -function createBaseBatchObject() { - return { - uuid: '', - vector: [], - properties: undefined, - collection: '', - tenant: '', - vectorBytes: new Uint8Array(0), - vectors: [], - }; -} -exports.BatchObject = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.uuid !== '') { - writer.uint32(10).string(message.uuid); - } - writer.uint32(18).fork(); - for (const v of message.vector) { - writer.float(v); - } - writer.ldelim(); - if (message.properties !== undefined) { - exports.BatchObject_Properties.encode(message.properties, writer.uint32(26).fork()).ldelim(); - } - if (message.collection !== '') { - writer.uint32(34).string(message.collection); - } - if (message.tenant !== '') { - writer.uint32(42).string(message.tenant); - } - if (message.vectorBytes.length !== 0) { - writer.uint32(50).bytes(message.vectorBytes); - } - for (const v of message.vectors) { - base_js_1.Vectors.encode(v, writer.uint32(186).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchObject(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.uuid = reader.string(); - continue; - case 2: - if (tag === 21) { - message.vector.push(reader.float()); - continue; - } - if (tag === 18) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.vector.push(reader.float()); - } - continue; - } - break; - case 3: - if (tag !== 26) { - break; - } - message.properties = exports.BatchObject_Properties.decode(reader, reader.uint32()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.collection = reader.string(); - continue; - case 5: - if (tag !== 42) { - break; - } - message.tenant = reader.string(); - continue; - case 6: - if (tag !== 50) { - break; - } - message.vectorBytes = reader.bytes(); - continue; - case 23: - if (tag !== 186) { - break; - } - message.vectors.push(base_js_1.Vectors.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - uuid: isSet(object.uuid) ? globalThis.String(object.uuid) : '', - vector: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.vector) - ? object.vector.map((e) => globalThis.Number(e)) - : [], - properties: isSet(object.properties) - ? exports.BatchObject_Properties.fromJSON(object.properties) - : undefined, - collection: isSet(object.collection) ? globalThis.String(object.collection) : '', - tenant: isSet(object.tenant) ? globalThis.String(object.tenant) : '', - vectorBytes: isSet(object.vectorBytes) ? bytesFromBase64(object.vectorBytes) : new Uint8Array(0), - vectors: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.vectors) - ? object.vectors.map((e) => base_js_1.Vectors.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if (message.uuid !== '') { - obj.uuid = message.uuid; - } - if ((_a = message.vector) === null || _a === void 0 ? void 0 : _a.length) { - obj.vector = message.vector; - } - if (message.properties !== undefined) { - obj.properties = exports.BatchObject_Properties.toJSON(message.properties); - } - if (message.collection !== '') { - obj.collection = message.collection; - } - if (message.tenant !== '') { - obj.tenant = message.tenant; - } - if (message.vectorBytes.length !== 0) { - obj.vectorBytes = base64FromBytes(message.vectorBytes); - } - if ((_b = message.vectors) === null || _b === void 0 ? void 0 : _b.length) { - obj.vectors = message.vectors.map((e) => base_js_1.Vectors.toJSON(e)); - } - return obj; - }, - create(base) { - return exports.BatchObject.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f; - const message = createBaseBatchObject(); - message.uuid = (_a = object.uuid) !== null && _a !== void 0 ? _a : ''; - message.vector = ((_b = object.vector) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - message.properties = - object.properties !== undefined && object.properties !== null - ? exports.BatchObject_Properties.fromPartial(object.properties) - : undefined; - message.collection = (_c = object.collection) !== null && _c !== void 0 ? _c : ''; - message.tenant = (_d = object.tenant) !== null && _d !== void 0 ? _d : ''; - message.vectorBytes = (_e = object.vectorBytes) !== null && _e !== void 0 ? _e : new Uint8Array(0); - message.vectors = - ((_f = object.vectors) === null || _f === void 0 - ? void 0 - : _f.map((e) => base_js_1.Vectors.fromPartial(e))) || []; - return message; - }, -}; -function createBaseBatchObject_Properties() { - return { - nonRefProperties: undefined, - singleTargetRefProps: [], - multiTargetRefProps: [], - numberArrayProperties: [], - intArrayProperties: [], - textArrayProperties: [], - booleanArrayProperties: [], - objectProperties: [], - objectArrayProperties: [], - emptyListProps: [], - }; -} -exports.BatchObject_Properties = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.nonRefProperties !== undefined) { - struct_js_1.Struct.encode( - struct_js_1.Struct.wrap(message.nonRefProperties), - writer.uint32(10).fork() - ).ldelim(); - } - for (const v of message.singleTargetRefProps) { - exports.BatchObject_SingleTargetRefProps.encode(v, writer.uint32(18).fork()).ldelim(); - } - for (const v of message.multiTargetRefProps) { - exports.BatchObject_MultiTargetRefProps.encode(v, writer.uint32(26).fork()).ldelim(); - } - for (const v of message.numberArrayProperties) { - base_js_1.NumberArrayProperties.encode(v, writer.uint32(34).fork()).ldelim(); - } - for (const v of message.intArrayProperties) { - base_js_1.IntArrayProperties.encode(v, writer.uint32(42).fork()).ldelim(); - } - for (const v of message.textArrayProperties) { - base_js_1.TextArrayProperties.encode(v, writer.uint32(50).fork()).ldelim(); - } - for (const v of message.booleanArrayProperties) { - base_js_1.BooleanArrayProperties.encode(v, writer.uint32(58).fork()).ldelim(); - } - for (const v of message.objectProperties) { - base_js_1.ObjectProperties.encode(v, writer.uint32(66).fork()).ldelim(); - } - for (const v of message.objectArrayProperties) { - base_js_1.ObjectArrayProperties.encode(v, writer.uint32(74).fork()).ldelim(); - } - for (const v of message.emptyListProps) { - writer.uint32(82).string(v); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchObject_Properties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.nonRefProperties = struct_js_1.Struct.unwrap( - struct_js_1.Struct.decode(reader, reader.uint32()) - ); - continue; - case 2: - if (tag !== 18) { - break; - } - message.singleTargetRefProps.push( - exports.BatchObject_SingleTargetRefProps.decode(reader, reader.uint32()) - ); - continue; - case 3: - if (tag !== 26) { - break; - } - message.multiTargetRefProps.push( - exports.BatchObject_MultiTargetRefProps.decode(reader, reader.uint32()) - ); - continue; - case 4: - if (tag !== 34) { - break; - } - message.numberArrayProperties.push(base_js_1.NumberArrayProperties.decode(reader, reader.uint32())); - continue; - case 5: - if (tag !== 42) { - break; - } - message.intArrayProperties.push(base_js_1.IntArrayProperties.decode(reader, reader.uint32())); - continue; - case 6: - if (tag !== 50) { - break; - } - message.textArrayProperties.push(base_js_1.TextArrayProperties.decode(reader, reader.uint32())); - continue; - case 7: - if (tag !== 58) { - break; - } - message.booleanArrayProperties.push( - base_js_1.BooleanArrayProperties.decode(reader, reader.uint32()) - ); - continue; - case 8: - if (tag !== 66) { - break; - } - message.objectProperties.push(base_js_1.ObjectProperties.decode(reader, reader.uint32())); - continue; - case 9: - if (tag !== 74) { - break; - } - message.objectArrayProperties.push(base_js_1.ObjectArrayProperties.decode(reader, reader.uint32())); - continue; - case 10: - if (tag !== 82) { - break; - } - message.emptyListProps.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - nonRefProperties: isObject(object.nonRefProperties) ? object.nonRefProperties : undefined, - singleTargetRefProps: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.singleTargetRefProps - ) - ? object.singleTargetRefProps.map((e) => exports.BatchObject_SingleTargetRefProps.fromJSON(e)) - : [], - multiTargetRefProps: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.multiTargetRefProps - ) - ? object.multiTargetRefProps.map((e) => exports.BatchObject_MultiTargetRefProps.fromJSON(e)) - : [], - numberArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.numberArrayProperties - ) - ? object.numberArrayProperties.map((e) => base_js_1.NumberArrayProperties.fromJSON(e)) - : [], - intArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.intArrayProperties - ) - ? object.intArrayProperties.map((e) => base_js_1.IntArrayProperties.fromJSON(e)) - : [], - textArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.textArrayProperties - ) - ? object.textArrayProperties.map((e) => base_js_1.TextArrayProperties.fromJSON(e)) - : [], - booleanArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.booleanArrayProperties - ) - ? object.booleanArrayProperties.map((e) => base_js_1.BooleanArrayProperties.fromJSON(e)) - : [], - objectProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectProperties - ) - ? object.objectProperties.map((e) => base_js_1.ObjectProperties.fromJSON(e)) - : [], - objectArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectArrayProperties - ) - ? object.objectArrayProperties.map((e) => base_js_1.ObjectArrayProperties.fromJSON(e)) - : [], - emptyListProps: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.emptyListProps - ) - ? object.emptyListProps.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - const obj = {}; - if (message.nonRefProperties !== undefined) { - obj.nonRefProperties = message.nonRefProperties; - } - if ((_a = message.singleTargetRefProps) === null || _a === void 0 ? void 0 : _a.length) { - obj.singleTargetRefProps = message.singleTargetRefProps.map((e) => - exports.BatchObject_SingleTargetRefProps.toJSON(e) - ); - } - if ((_b = message.multiTargetRefProps) === null || _b === void 0 ? void 0 : _b.length) { - obj.multiTargetRefProps = message.multiTargetRefProps.map((e) => - exports.BatchObject_MultiTargetRefProps.toJSON(e) - ); - } - if ((_c = message.numberArrayProperties) === null || _c === void 0 ? void 0 : _c.length) { - obj.numberArrayProperties = message.numberArrayProperties.map((e) => - base_js_1.NumberArrayProperties.toJSON(e) - ); - } - if ((_d = message.intArrayProperties) === null || _d === void 0 ? void 0 : _d.length) { - obj.intArrayProperties = message.intArrayProperties.map((e) => base_js_1.IntArrayProperties.toJSON(e)); - } - if ((_e = message.textArrayProperties) === null || _e === void 0 ? void 0 : _e.length) { - obj.textArrayProperties = message.textArrayProperties.map((e) => - base_js_1.TextArrayProperties.toJSON(e) - ); - } - if ((_f = message.booleanArrayProperties) === null || _f === void 0 ? void 0 : _f.length) { - obj.booleanArrayProperties = message.booleanArrayProperties.map((e) => - base_js_1.BooleanArrayProperties.toJSON(e) - ); - } - if ((_g = message.objectProperties) === null || _g === void 0 ? void 0 : _g.length) { - obj.objectProperties = message.objectProperties.map((e) => base_js_1.ObjectProperties.toJSON(e)); - } - if ((_h = message.objectArrayProperties) === null || _h === void 0 ? void 0 : _h.length) { - obj.objectArrayProperties = message.objectArrayProperties.map((e) => - base_js_1.ObjectArrayProperties.toJSON(e) - ); - } - if ((_j = message.emptyListProps) === null || _j === void 0 ? void 0 : _j.length) { - obj.emptyListProps = message.emptyListProps; - } - return obj; - }, - create(base) { - return exports.BatchObject_Properties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - const message = createBaseBatchObject_Properties(); - message.nonRefProperties = (_a = object.nonRefProperties) !== null && _a !== void 0 ? _a : undefined; - message.singleTargetRefProps = - ((_b = object.singleTargetRefProps) === null || _b === void 0 - ? void 0 - : _b.map((e) => exports.BatchObject_SingleTargetRefProps.fromPartial(e))) || []; - message.multiTargetRefProps = - ((_c = object.multiTargetRefProps) === null || _c === void 0 - ? void 0 - : _c.map((e) => exports.BatchObject_MultiTargetRefProps.fromPartial(e))) || []; - message.numberArrayProperties = - ((_d = object.numberArrayProperties) === null || _d === void 0 - ? void 0 - : _d.map((e) => base_js_1.NumberArrayProperties.fromPartial(e))) || []; - message.intArrayProperties = - ((_e = object.intArrayProperties) === null || _e === void 0 - ? void 0 - : _e.map((e) => base_js_1.IntArrayProperties.fromPartial(e))) || []; - message.textArrayProperties = - ((_f = object.textArrayProperties) === null || _f === void 0 - ? void 0 - : _f.map((e) => base_js_1.TextArrayProperties.fromPartial(e))) || []; - message.booleanArrayProperties = - ((_g = object.booleanArrayProperties) === null || _g === void 0 - ? void 0 - : _g.map((e) => base_js_1.BooleanArrayProperties.fromPartial(e))) || []; - message.objectProperties = - ((_h = object.objectProperties) === null || _h === void 0 - ? void 0 - : _h.map((e) => base_js_1.ObjectProperties.fromPartial(e))) || []; - message.objectArrayProperties = - ((_j = object.objectArrayProperties) === null || _j === void 0 - ? void 0 - : _j.map((e) => base_js_1.ObjectArrayProperties.fromPartial(e))) || []; - message.emptyListProps = - ((_k = object.emptyListProps) === null || _k === void 0 ? void 0 : _k.map((e) => e)) || []; - return message; - }, -}; -function createBaseBatchObject_SingleTargetRefProps() { - return { uuids: [], propName: '' }; -} -exports.BatchObject_SingleTargetRefProps = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.uuids) { - writer.uint32(10).string(v); - } - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchObject_SingleTargetRefProps(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.uuids.push(reader.string()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - uuids: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.uuids) - ? object.uuids.map((e) => globalThis.String(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.uuids) === null || _a === void 0 ? void 0 : _a.length) { - obj.uuids = message.uuids; - } - if (message.propName !== '') { - obj.propName = message.propName; - } - return obj; - }, - create(base) { - return exports.BatchObject_SingleTargetRefProps.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseBatchObject_SingleTargetRefProps(); - message.uuids = ((_a = object.uuids) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function createBaseBatchObject_MultiTargetRefProps() { - return { uuids: [], propName: '', targetCollection: '' }; -} -exports.BatchObject_MultiTargetRefProps = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.uuids) { - writer.uint32(10).string(v); - } - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - if (message.targetCollection !== '') { - writer.uint32(26).string(message.targetCollection); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchObject_MultiTargetRefProps(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.uuids.push(reader.string()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - case 3: - if (tag !== 26) { - break; - } - message.targetCollection = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - uuids: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.uuids) - ? object.uuids.map((e) => globalThis.String(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - targetCollection: isSet(object.targetCollection) ? globalThis.String(object.targetCollection) : '', - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.uuids) === null || _a === void 0 ? void 0 : _a.length) { - obj.uuids = message.uuids; - } - if (message.propName !== '') { - obj.propName = message.propName; - } - if (message.targetCollection !== '') { - obj.targetCollection = message.targetCollection; - } - return obj; - }, - create(base) { - return exports.BatchObject_MultiTargetRefProps.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseBatchObject_MultiTargetRefProps(); - message.uuids = ((_a = object.uuids) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - message.targetCollection = (_c = object.targetCollection) !== null && _c !== void 0 ? _c : ''; - return message; - }, -}; -function createBaseBatchObjectsReply() { - return { took: 0, errors: [] }; -} -exports.BatchObjectsReply = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.took !== 0) { - writer.uint32(13).float(message.took); - } - for (const v of message.errors) { - exports.BatchObjectsReply_BatchError.encode(v, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchObjectsReply(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 13) { - break; - } - message.took = reader.float(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.errors.push(exports.BatchObjectsReply_BatchError.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - took: isSet(object.took) ? globalThis.Number(object.took) : 0, - errors: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.errors) - ? object.errors.map((e) => exports.BatchObjectsReply_BatchError.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.took !== 0) { - obj.took = message.took; - } - if ((_a = message.errors) === null || _a === void 0 ? void 0 : _a.length) { - obj.errors = message.errors.map((e) => exports.BatchObjectsReply_BatchError.toJSON(e)); - } - return obj; - }, - create(base) { - return exports.BatchObjectsReply.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseBatchObjectsReply(); - message.took = (_a = object.took) !== null && _a !== void 0 ? _a : 0; - message.errors = - ((_b = object.errors) === null || _b === void 0 - ? void 0 - : _b.map((e) => exports.BatchObjectsReply_BatchError.fromPartial(e))) || []; - return message; - }, -}; -function createBaseBatchObjectsReply_BatchError() { - return { index: 0, error: '' }; -} -exports.BatchObjectsReply_BatchError = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.index !== 0) { - writer.uint32(8).int32(message.index); - } - if (message.error !== '') { - writer.uint32(18).string(message.error); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchObjectsReply_BatchError(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.index = reader.int32(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.error = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - index: isSet(object.index) ? globalThis.Number(object.index) : 0, - error: isSet(object.error) ? globalThis.String(object.error) : '', - }; - }, - toJSON(message) { - const obj = {}; - if (message.index !== 0) { - obj.index = Math.round(message.index); - } - if (message.error !== '') { - obj.error = message.error; - } - return obj; - }, - create(base) { - return exports.BatchObjectsReply_BatchError.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseBatchObjectsReply_BatchError(); - message.index = (_a = object.index) !== null && _a !== void 0 ? _a : 0; - message.error = (_b = object.error) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function bytesFromBase64(b64) { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} -function base64FromBytes(arr) { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString('base64'); - } else { - const bin = []; - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join('')); - } -} -function isObject(value) { - return typeof value === 'object' && value !== null; -} -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/cjs/proto/v1/batch_delete.d.ts b/dist/node/cjs/proto/v1/batch_delete.d.ts deleted file mode 100644 index 33f03c57..00000000 --- a/dist/node/cjs/proto/v1/batch_delete.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -import { ConsistencyLevel, Filters } from './base.js'; -export declare const protobufPackage = 'weaviate.v1'; -export interface BatchDeleteRequest { - collection: string; - filters: Filters | undefined; - verbose: boolean; - dryRun: boolean; - consistencyLevel?: ConsistencyLevel | undefined; - tenant?: string | undefined; -} -export interface BatchDeleteReply { - took: number; - failed: number; - matches: number; - successful: number; - objects: BatchDeleteObject[]; -} -export interface BatchDeleteObject { - uuid: Uint8Array; - successful: boolean; - /** empty string means no error */ - error?: string | undefined; -} -export declare const BatchDeleteRequest: { - encode(message: BatchDeleteRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchDeleteRequest; - fromJSON(object: any): BatchDeleteRequest; - toJSON(message: BatchDeleteRequest): unknown; - create(base?: DeepPartial): BatchDeleteRequest; - fromPartial(object: DeepPartial): BatchDeleteRequest; -}; -export declare const BatchDeleteReply: { - encode(message: BatchDeleteReply, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchDeleteReply; - fromJSON(object: any): BatchDeleteReply; - toJSON(message: BatchDeleteReply): unknown; - create(base?: DeepPartial): BatchDeleteReply; - fromPartial(object: DeepPartial): BatchDeleteReply; -}; -export declare const BatchDeleteObject: { - encode(message: BatchDeleteObject, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchDeleteObject; - fromJSON(object: any): BatchDeleteObject; - toJSON(message: BatchDeleteObject): unknown; - create(base?: DeepPartial): BatchDeleteObject; - fromPartial(object: DeepPartial): BatchDeleteObject; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/cjs/proto/v1/batch_delete.js b/dist/node/cjs/proto/v1/batch_delete.js deleted file mode 100644 index 1867e4be..00000000 --- a/dist/node/cjs/proto/v1/batch_delete.js +++ /dev/null @@ -1,392 +0,0 @@ -'use strict'; -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/batch_delete.proto -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.BatchDeleteObject = - exports.BatchDeleteReply = - exports.BatchDeleteRequest = - exports.protobufPackage = - void 0; -/* eslint-disable */ -const long_1 = __importDefault(require('long')); -const minimal_js_1 = __importDefault(require('protobufjs/minimal.js')); -const base_js_1 = require('./base.js'); -exports.protobufPackage = 'weaviate.v1'; -function createBaseBatchDeleteRequest() { - return { - collection: '', - filters: undefined, - verbose: false, - dryRun: false, - consistencyLevel: undefined, - tenant: undefined, - }; -} -exports.BatchDeleteRequest = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.collection !== '') { - writer.uint32(10).string(message.collection); - } - if (message.filters !== undefined) { - base_js_1.Filters.encode(message.filters, writer.uint32(18).fork()).ldelim(); - } - if (message.verbose !== false) { - writer.uint32(24).bool(message.verbose); - } - if (message.dryRun !== false) { - writer.uint32(32).bool(message.dryRun); - } - if (message.consistencyLevel !== undefined) { - writer.uint32(40).int32(message.consistencyLevel); - } - if (message.tenant !== undefined) { - writer.uint32(50).string(message.tenant); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchDeleteRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.collection = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.filters = base_js_1.Filters.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 24) { - break; - } - message.verbose = reader.bool(); - continue; - case 4: - if (tag !== 32) { - break; - } - message.dryRun = reader.bool(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.consistencyLevel = reader.int32(); - continue; - case 6: - if (tag !== 50) { - break; - } - message.tenant = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - collection: isSet(object.collection) ? globalThis.String(object.collection) : '', - filters: isSet(object.filters) ? base_js_1.Filters.fromJSON(object.filters) : undefined, - verbose: isSet(object.verbose) ? globalThis.Boolean(object.verbose) : false, - dryRun: isSet(object.dryRun) ? globalThis.Boolean(object.dryRun) : false, - consistencyLevel: isSet(object.consistencyLevel) - ? (0, base_js_1.consistencyLevelFromJSON)(object.consistencyLevel) - : undefined, - tenant: isSet(object.tenant) ? globalThis.String(object.tenant) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.collection !== '') { - obj.collection = message.collection; - } - if (message.filters !== undefined) { - obj.filters = base_js_1.Filters.toJSON(message.filters); - } - if (message.verbose !== false) { - obj.verbose = message.verbose; - } - if (message.dryRun !== false) { - obj.dryRun = message.dryRun; - } - if (message.consistencyLevel !== undefined) { - obj.consistencyLevel = (0, base_js_1.consistencyLevelToJSON)(message.consistencyLevel); - } - if (message.tenant !== undefined) { - obj.tenant = message.tenant; - } - return obj; - }, - create(base) { - return exports.BatchDeleteRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e; - const message = createBaseBatchDeleteRequest(); - message.collection = (_a = object.collection) !== null && _a !== void 0 ? _a : ''; - message.filters = - object.filters !== undefined && object.filters !== null - ? base_js_1.Filters.fromPartial(object.filters) - : undefined; - message.verbose = (_b = object.verbose) !== null && _b !== void 0 ? _b : false; - message.dryRun = (_c = object.dryRun) !== null && _c !== void 0 ? _c : false; - message.consistencyLevel = (_d = object.consistencyLevel) !== null && _d !== void 0 ? _d : undefined; - message.tenant = (_e = object.tenant) !== null && _e !== void 0 ? _e : undefined; - return message; - }, -}; -function createBaseBatchDeleteReply() { - return { took: 0, failed: 0, matches: 0, successful: 0, objects: [] }; -} -exports.BatchDeleteReply = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.took !== 0) { - writer.uint32(13).float(message.took); - } - if (message.failed !== 0) { - writer.uint32(16).int64(message.failed); - } - if (message.matches !== 0) { - writer.uint32(24).int64(message.matches); - } - if (message.successful !== 0) { - writer.uint32(32).int64(message.successful); - } - for (const v of message.objects) { - exports.BatchDeleteObject.encode(v, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchDeleteReply(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 13) { - break; - } - message.took = reader.float(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.failed = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 24) { - break; - } - message.matches = longToNumber(reader.int64()); - continue; - case 4: - if (tag !== 32) { - break; - } - message.successful = longToNumber(reader.int64()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.objects.push(exports.BatchDeleteObject.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - took: isSet(object.took) ? globalThis.Number(object.took) : 0, - failed: isSet(object.failed) ? globalThis.Number(object.failed) : 0, - matches: isSet(object.matches) ? globalThis.Number(object.matches) : 0, - successful: isSet(object.successful) ? globalThis.Number(object.successful) : 0, - objects: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.objects) - ? object.objects.map((e) => exports.BatchDeleteObject.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.took !== 0) { - obj.took = message.took; - } - if (message.failed !== 0) { - obj.failed = Math.round(message.failed); - } - if (message.matches !== 0) { - obj.matches = Math.round(message.matches); - } - if (message.successful !== 0) { - obj.successful = Math.round(message.successful); - } - if ((_a = message.objects) === null || _a === void 0 ? void 0 : _a.length) { - obj.objects = message.objects.map((e) => exports.BatchDeleteObject.toJSON(e)); - } - return obj; - }, - create(base) { - return exports.BatchDeleteReply.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e; - const message = createBaseBatchDeleteReply(); - message.took = (_a = object.took) !== null && _a !== void 0 ? _a : 0; - message.failed = (_b = object.failed) !== null && _b !== void 0 ? _b : 0; - message.matches = (_c = object.matches) !== null && _c !== void 0 ? _c : 0; - message.successful = (_d = object.successful) !== null && _d !== void 0 ? _d : 0; - message.objects = - ((_e = object.objects) === null || _e === void 0 - ? void 0 - : _e.map((e) => exports.BatchDeleteObject.fromPartial(e))) || []; - return message; - }, -}; -function createBaseBatchDeleteObject() { - return { uuid: new Uint8Array(0), successful: false, error: undefined }; -} -exports.BatchDeleteObject = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.uuid.length !== 0) { - writer.uint32(10).bytes(message.uuid); - } - if (message.successful !== false) { - writer.uint32(16).bool(message.successful); - } - if (message.error !== undefined) { - writer.uint32(26).string(message.error); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchDeleteObject(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.uuid = reader.bytes(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.successful = reader.bool(); - continue; - case 3: - if (tag !== 26) { - break; - } - message.error = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - uuid: isSet(object.uuid) ? bytesFromBase64(object.uuid) : new Uint8Array(0), - successful: isSet(object.successful) ? globalThis.Boolean(object.successful) : false, - error: isSet(object.error) ? globalThis.String(object.error) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.uuid.length !== 0) { - obj.uuid = base64FromBytes(message.uuid); - } - if (message.successful !== false) { - obj.successful = message.successful; - } - if (message.error !== undefined) { - obj.error = message.error; - } - return obj; - }, - create(base) { - return exports.BatchDeleteObject.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseBatchDeleteObject(); - message.uuid = (_a = object.uuid) !== null && _a !== void 0 ? _a : new Uint8Array(0); - message.successful = (_b = object.successful) !== null && _b !== void 0 ? _b : false; - message.error = (_c = object.error) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function bytesFromBase64(b64) { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} -function base64FromBytes(arr) { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString('base64'); - } else { - const bin = []; - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join('')); - } -} -function longToNumber(long) { - if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { - throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); - } - return long.toNumber(); -} -if (minimal_js_1.default.util.Long !== long_1.default) { - minimal_js_1.default.util.Long = long_1.default; - minimal_js_1.default.configure(); -} -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/cjs/proto/v1/generative.d.ts b/dist/node/cjs/proto/v1/generative.d.ts deleted file mode 100644 index fee6ca3c..00000000 --- a/dist/node/cjs/proto/v1/generative.d.ts +++ /dev/null @@ -1,538 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -import { TextArray } from './base.js'; -export declare const protobufPackage = 'weaviate.v1'; -export interface GenerativeSearch { - /** @deprecated */ - singleResponsePrompt: string; - /** @deprecated */ - groupedResponseTask: string; - /** @deprecated */ - groupedProperties: string[]; - single: GenerativeSearch_Single | undefined; - grouped: GenerativeSearch_Grouped | undefined; -} -export interface GenerativeSearch_Single { - prompt: string; - debug: boolean; - /** only allow one at the beginning, but multiple in the future */ - queries: GenerativeProvider[]; -} -export interface GenerativeSearch_Grouped { - task: string; - properties?: TextArray | undefined; -} -export interface GenerativeProvider { - returnMetadata: boolean; - anthropic?: GenerativeAnthropic | undefined; - anyscale?: GenerativeAnyscale | undefined; - aws?: GenerativeAWS | undefined; - cohere?: GenerativeCohere | undefined; - dummy?: GenerativeDummy | undefined; - mistral?: GenerativeMistral | undefined; - octoai?: GenerativeOctoAI | undefined; - ollama?: GenerativeOllama | undefined; - openai?: GenerativeOpenAI | undefined; - google?: GenerativeGoogle | undefined; -} -export interface GenerativeAnthropic { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - temperature?: number | undefined; - topK?: number | undefined; - topP?: number | undefined; - stopSequences?: TextArray | undefined; -} -export interface GenerativeAnyscale { - baseUrl?: string | undefined; - model?: string | undefined; - temperature?: number | undefined; -} -export interface GenerativeAWS { - model?: string | undefined; - temperature?: number | undefined; -} -export interface GenerativeCohere { - baseUrl?: string | undefined; - frequencyPenalty?: number | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - k?: number | undefined; - p?: number | undefined; - presencePenalty?: number | undefined; - stopSequences?: TextArray | undefined; - temperature?: number | undefined; -} -export interface GenerativeDummy {} -export interface GenerativeMistral { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - temperature?: number | undefined; - topP?: number | undefined; -} -export interface GenerativeOctoAI { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - n?: number | undefined; - temperature?: number | undefined; - topP?: number | undefined; -} -export interface GenerativeOllama { - apiEndpoint?: string | undefined; - model?: string | undefined; - temperature?: number | undefined; -} -export interface GenerativeOpenAI { - frequencyPenalty?: number | undefined; - logProbs?: boolean | undefined; - maxTokens?: number | undefined; - model: string; - n?: number | undefined; - presencePenalty?: number | undefined; - stop?: TextArray | undefined; - temperature?: number | undefined; - topP?: number | undefined; - topLogProbs?: number | undefined; -} -export interface GenerativeGoogle { - frequencyPenalty?: number | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - presencePenalty?: number | undefined; - temperature?: number | undefined; - topK?: number | undefined; - topP?: number | undefined; - stopSequences?: TextArray | undefined; -} -export interface GenerativeAnthropicMetadata { - usage: GenerativeAnthropicMetadata_Usage | undefined; -} -export interface GenerativeAnthropicMetadata_Usage { - inputTokens: number; - outputTokens: number; -} -export interface GenerativeAnyscaleMetadata {} -export interface GenerativeAWSMetadata {} -export interface GenerativeCohereMetadata { - apiVersion?: GenerativeCohereMetadata_ApiVersion | undefined; - billedUnits?: GenerativeCohereMetadata_BilledUnits | undefined; - tokens?: GenerativeCohereMetadata_Tokens | undefined; - warnings?: TextArray | undefined; -} -export interface GenerativeCohereMetadata_ApiVersion { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; -} -export interface GenerativeCohereMetadata_BilledUnits { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; -} -export interface GenerativeCohereMetadata_Tokens { - inputTokens?: number | undefined; - outputTokens?: number | undefined; -} -export interface GenerativeDummyMetadata {} -export interface GenerativeMistralMetadata { - usage?: GenerativeMistralMetadata_Usage | undefined; -} -export interface GenerativeMistralMetadata_Usage { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; -} -export interface GenerativeOctoAIMetadata { - usage?: GenerativeOctoAIMetadata_Usage | undefined; -} -export interface GenerativeOctoAIMetadata_Usage { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; -} -export interface GenerativeOllamaMetadata {} -export interface GenerativeOpenAIMetadata { - usage?: GenerativeOpenAIMetadata_Usage | undefined; -} -export interface GenerativeOpenAIMetadata_Usage { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; -} -export interface GenerativeGoogleMetadata { - metadata?: GenerativeGoogleMetadata_Metadata | undefined; - usageMetadata?: GenerativeGoogleMetadata_UsageMetadata | undefined; -} -export interface GenerativeGoogleMetadata_TokenCount { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; -} -export interface GenerativeGoogleMetadata_TokenMetadata { - inputTokenCount?: GenerativeGoogleMetadata_TokenCount | undefined; - outputTokenCount?: GenerativeGoogleMetadata_TokenCount | undefined; -} -export interface GenerativeGoogleMetadata_Metadata { - tokenMetadata?: GenerativeGoogleMetadata_TokenMetadata | undefined; -} -export interface GenerativeGoogleMetadata_UsageMetadata { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; -} -export interface GenerativeMetadata { - anthropic?: GenerativeAnthropicMetadata | undefined; - anyscale?: GenerativeAnyscaleMetadata | undefined; - aws?: GenerativeAWSMetadata | undefined; - cohere?: GenerativeCohereMetadata | undefined; - dummy?: GenerativeDummyMetadata | undefined; - mistral?: GenerativeMistralMetadata | undefined; - octoai?: GenerativeOctoAIMetadata | undefined; - ollama?: GenerativeOllamaMetadata | undefined; - openai?: GenerativeOpenAIMetadata | undefined; - google?: GenerativeGoogleMetadata | undefined; -} -export interface GenerativeReply { - result: string; - debug?: GenerativeDebug | undefined; - metadata?: GenerativeMetadata | undefined; -} -export interface GenerativeResult { - values: GenerativeReply[]; -} -export interface GenerativeDebug { - fullPrompt?: string | undefined; -} -export declare const GenerativeSearch: { - encode(message: GenerativeSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeSearch; - fromJSON(object: any): GenerativeSearch; - toJSON(message: GenerativeSearch): unknown; - create(base?: DeepPartial): GenerativeSearch; - fromPartial(object: DeepPartial): GenerativeSearch; -}; -export declare const GenerativeSearch_Single: { - encode(message: GenerativeSearch_Single, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeSearch_Single; - fromJSON(object: any): GenerativeSearch_Single; - toJSON(message: GenerativeSearch_Single): unknown; - create(base?: DeepPartial): GenerativeSearch_Single; - fromPartial(object: DeepPartial): GenerativeSearch_Single; -}; -export declare const GenerativeSearch_Grouped: { - encode(message: GenerativeSearch_Grouped, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeSearch_Grouped; - fromJSON(object: any): GenerativeSearch_Grouped; - toJSON(message: GenerativeSearch_Grouped): unknown; - create(base?: DeepPartial): GenerativeSearch_Grouped; - fromPartial(object: DeepPartial): GenerativeSearch_Grouped; -}; -export declare const GenerativeProvider: { - encode(message: GenerativeProvider, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeProvider; - fromJSON(object: any): GenerativeProvider; - toJSON(message: GenerativeProvider): unknown; - create(base?: DeepPartial): GenerativeProvider; - fromPartial(object: DeepPartial): GenerativeProvider; -}; -export declare const GenerativeAnthropic: { - encode(message: GenerativeAnthropic, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeAnthropic; - fromJSON(object: any): GenerativeAnthropic; - toJSON(message: GenerativeAnthropic): unknown; - create(base?: DeepPartial): GenerativeAnthropic; - fromPartial(object: DeepPartial): GenerativeAnthropic; -}; -export declare const GenerativeAnyscale: { - encode(message: GenerativeAnyscale, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeAnyscale; - fromJSON(object: any): GenerativeAnyscale; - toJSON(message: GenerativeAnyscale): unknown; - create(base?: DeepPartial): GenerativeAnyscale; - fromPartial(object: DeepPartial): GenerativeAnyscale; -}; -export declare const GenerativeAWS: { - encode(message: GenerativeAWS, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeAWS; - fromJSON(object: any): GenerativeAWS; - toJSON(message: GenerativeAWS): unknown; - create(base?: DeepPartial): GenerativeAWS; - fromPartial(object: DeepPartial): GenerativeAWS; -}; -export declare const GenerativeCohere: { - encode(message: GenerativeCohere, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeCohere; - fromJSON(object: any): GenerativeCohere; - toJSON(message: GenerativeCohere): unknown; - create(base?: DeepPartial): GenerativeCohere; - fromPartial(object: DeepPartial): GenerativeCohere; -}; -export declare const GenerativeDummy: { - encode(_: GenerativeDummy, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeDummy; - fromJSON(_: any): GenerativeDummy; - toJSON(_: GenerativeDummy): unknown; - create(base?: DeepPartial): GenerativeDummy; - fromPartial(_: DeepPartial): GenerativeDummy; -}; -export declare const GenerativeMistral: { - encode(message: GenerativeMistral, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeMistral; - fromJSON(object: any): GenerativeMistral; - toJSON(message: GenerativeMistral): unknown; - create(base?: DeepPartial): GenerativeMistral; - fromPartial(object: DeepPartial): GenerativeMistral; -}; -export declare const GenerativeOctoAI: { - encode(message: GenerativeOctoAI, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOctoAI; - fromJSON(object: any): GenerativeOctoAI; - toJSON(message: GenerativeOctoAI): unknown; - create(base?: DeepPartial): GenerativeOctoAI; - fromPartial(object: DeepPartial): GenerativeOctoAI; -}; -export declare const GenerativeOllama: { - encode(message: GenerativeOllama, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOllama; - fromJSON(object: any): GenerativeOllama; - toJSON(message: GenerativeOllama): unknown; - create(base?: DeepPartial): GenerativeOllama; - fromPartial(object: DeepPartial): GenerativeOllama; -}; -export declare const GenerativeOpenAI: { - encode(message: GenerativeOpenAI, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOpenAI; - fromJSON(object: any): GenerativeOpenAI; - toJSON(message: GenerativeOpenAI): unknown; - create(base?: DeepPartial): GenerativeOpenAI; - fromPartial(object: DeepPartial): GenerativeOpenAI; -}; -export declare const GenerativeGoogle: { - encode(message: GenerativeGoogle, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeGoogle; - fromJSON(object: any): GenerativeGoogle; - toJSON(message: GenerativeGoogle): unknown; - create(base?: DeepPartial): GenerativeGoogle; - fromPartial(object: DeepPartial): GenerativeGoogle; -}; -export declare const GenerativeAnthropicMetadata: { - encode(message: GenerativeAnthropicMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeAnthropicMetadata; - fromJSON(object: any): GenerativeAnthropicMetadata; - toJSON(message: GenerativeAnthropicMetadata): unknown; - create(base?: DeepPartial): GenerativeAnthropicMetadata; - fromPartial(object: DeepPartial): GenerativeAnthropicMetadata; -}; -export declare const GenerativeAnthropicMetadata_Usage: { - encode(message: GenerativeAnthropicMetadata_Usage, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeAnthropicMetadata_Usage; - fromJSON(object: any): GenerativeAnthropicMetadata_Usage; - toJSON(message: GenerativeAnthropicMetadata_Usage): unknown; - create(base?: DeepPartial): GenerativeAnthropicMetadata_Usage; - fromPartial(object: DeepPartial): GenerativeAnthropicMetadata_Usage; -}; -export declare const GenerativeAnyscaleMetadata: { - encode(_: GenerativeAnyscaleMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeAnyscaleMetadata; - fromJSON(_: any): GenerativeAnyscaleMetadata; - toJSON(_: GenerativeAnyscaleMetadata): unknown; - create(base?: DeepPartial): GenerativeAnyscaleMetadata; - fromPartial(_: DeepPartial): GenerativeAnyscaleMetadata; -}; -export declare const GenerativeAWSMetadata: { - encode(_: GenerativeAWSMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeAWSMetadata; - fromJSON(_: any): GenerativeAWSMetadata; - toJSON(_: GenerativeAWSMetadata): unknown; - create(base?: DeepPartial): GenerativeAWSMetadata; - fromPartial(_: DeepPartial): GenerativeAWSMetadata; -}; -export declare const GenerativeCohereMetadata: { - encode(message: GenerativeCohereMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeCohereMetadata; - fromJSON(object: any): GenerativeCohereMetadata; - toJSON(message: GenerativeCohereMetadata): unknown; - create(base?: DeepPartial): GenerativeCohereMetadata; - fromPartial(object: DeepPartial): GenerativeCohereMetadata; -}; -export declare const GenerativeCohereMetadata_ApiVersion: { - encode(message: GenerativeCohereMetadata_ApiVersion, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeCohereMetadata_ApiVersion; - fromJSON(object: any): GenerativeCohereMetadata_ApiVersion; - toJSON(message: GenerativeCohereMetadata_ApiVersion): unknown; - create(base?: DeepPartial): GenerativeCohereMetadata_ApiVersion; - fromPartial(object: DeepPartial): GenerativeCohereMetadata_ApiVersion; -}; -export declare const GenerativeCohereMetadata_BilledUnits: { - encode(message: GenerativeCohereMetadata_BilledUnits, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeCohereMetadata_BilledUnits; - fromJSON(object: any): GenerativeCohereMetadata_BilledUnits; - toJSON(message: GenerativeCohereMetadata_BilledUnits): unknown; - create(base?: DeepPartial): GenerativeCohereMetadata_BilledUnits; - fromPartial( - object: DeepPartial - ): GenerativeCohereMetadata_BilledUnits; -}; -export declare const GenerativeCohereMetadata_Tokens: { - encode(message: GenerativeCohereMetadata_Tokens, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeCohereMetadata_Tokens; - fromJSON(object: any): GenerativeCohereMetadata_Tokens; - toJSON(message: GenerativeCohereMetadata_Tokens): unknown; - create(base?: DeepPartial): GenerativeCohereMetadata_Tokens; - fromPartial(object: DeepPartial): GenerativeCohereMetadata_Tokens; -}; -export declare const GenerativeDummyMetadata: { - encode(_: GenerativeDummyMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeDummyMetadata; - fromJSON(_: any): GenerativeDummyMetadata; - toJSON(_: GenerativeDummyMetadata): unknown; - create(base?: DeepPartial): GenerativeDummyMetadata; - fromPartial(_: DeepPartial): GenerativeDummyMetadata; -}; -export declare const GenerativeMistralMetadata: { - encode(message: GenerativeMistralMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeMistralMetadata; - fromJSON(object: any): GenerativeMistralMetadata; - toJSON(message: GenerativeMistralMetadata): unknown; - create(base?: DeepPartial): GenerativeMistralMetadata; - fromPartial(object: DeepPartial): GenerativeMistralMetadata; -}; -export declare const GenerativeMistralMetadata_Usage: { - encode(message: GenerativeMistralMetadata_Usage, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeMistralMetadata_Usage; - fromJSON(object: any): GenerativeMistralMetadata_Usage; - toJSON(message: GenerativeMistralMetadata_Usage): unknown; - create(base?: DeepPartial): GenerativeMistralMetadata_Usage; - fromPartial(object: DeepPartial): GenerativeMistralMetadata_Usage; -}; -export declare const GenerativeOctoAIMetadata: { - encode(message: GenerativeOctoAIMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOctoAIMetadata; - fromJSON(object: any): GenerativeOctoAIMetadata; - toJSON(message: GenerativeOctoAIMetadata): unknown; - create(base?: DeepPartial): GenerativeOctoAIMetadata; - fromPartial(object: DeepPartial): GenerativeOctoAIMetadata; -}; -export declare const GenerativeOctoAIMetadata_Usage: { - encode(message: GenerativeOctoAIMetadata_Usage, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOctoAIMetadata_Usage; - fromJSON(object: any): GenerativeOctoAIMetadata_Usage; - toJSON(message: GenerativeOctoAIMetadata_Usage): unknown; - create(base?: DeepPartial): GenerativeOctoAIMetadata_Usage; - fromPartial(object: DeepPartial): GenerativeOctoAIMetadata_Usage; -}; -export declare const GenerativeOllamaMetadata: { - encode(_: GenerativeOllamaMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOllamaMetadata; - fromJSON(_: any): GenerativeOllamaMetadata; - toJSON(_: GenerativeOllamaMetadata): unknown; - create(base?: DeepPartial): GenerativeOllamaMetadata; - fromPartial(_: DeepPartial): GenerativeOllamaMetadata; -}; -export declare const GenerativeOpenAIMetadata: { - encode(message: GenerativeOpenAIMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOpenAIMetadata; - fromJSON(object: any): GenerativeOpenAIMetadata; - toJSON(message: GenerativeOpenAIMetadata): unknown; - create(base?: DeepPartial): GenerativeOpenAIMetadata; - fromPartial(object: DeepPartial): GenerativeOpenAIMetadata; -}; -export declare const GenerativeOpenAIMetadata_Usage: { - encode(message: GenerativeOpenAIMetadata_Usage, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOpenAIMetadata_Usage; - fromJSON(object: any): GenerativeOpenAIMetadata_Usage; - toJSON(message: GenerativeOpenAIMetadata_Usage): unknown; - create(base?: DeepPartial): GenerativeOpenAIMetadata_Usage; - fromPartial(object: DeepPartial): GenerativeOpenAIMetadata_Usage; -}; -export declare const GenerativeGoogleMetadata: { - encode(message: GenerativeGoogleMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeGoogleMetadata; - fromJSON(object: any): GenerativeGoogleMetadata; - toJSON(message: GenerativeGoogleMetadata): unknown; - create(base?: DeepPartial): GenerativeGoogleMetadata; - fromPartial(object: DeepPartial): GenerativeGoogleMetadata; -}; -export declare const GenerativeGoogleMetadata_TokenCount: { - encode(message: GenerativeGoogleMetadata_TokenCount, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeGoogleMetadata_TokenCount; - fromJSON(object: any): GenerativeGoogleMetadata_TokenCount; - toJSON(message: GenerativeGoogleMetadata_TokenCount): unknown; - create(base?: DeepPartial): GenerativeGoogleMetadata_TokenCount; - fromPartial(object: DeepPartial): GenerativeGoogleMetadata_TokenCount; -}; -export declare const GenerativeGoogleMetadata_TokenMetadata: { - encode(message: GenerativeGoogleMetadata_TokenMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeGoogleMetadata_TokenMetadata; - fromJSON(object: any): GenerativeGoogleMetadata_TokenMetadata; - toJSON(message: GenerativeGoogleMetadata_TokenMetadata): unknown; - create(base?: DeepPartial): GenerativeGoogleMetadata_TokenMetadata; - fromPartial( - object: DeepPartial - ): GenerativeGoogleMetadata_TokenMetadata; -}; -export declare const GenerativeGoogleMetadata_Metadata: { - encode(message: GenerativeGoogleMetadata_Metadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeGoogleMetadata_Metadata; - fromJSON(object: any): GenerativeGoogleMetadata_Metadata; - toJSON(message: GenerativeGoogleMetadata_Metadata): unknown; - create(base?: DeepPartial): GenerativeGoogleMetadata_Metadata; - fromPartial(object: DeepPartial): GenerativeGoogleMetadata_Metadata; -}; -export declare const GenerativeGoogleMetadata_UsageMetadata: { - encode(message: GenerativeGoogleMetadata_UsageMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeGoogleMetadata_UsageMetadata; - fromJSON(object: any): GenerativeGoogleMetadata_UsageMetadata; - toJSON(message: GenerativeGoogleMetadata_UsageMetadata): unknown; - create(base?: DeepPartial): GenerativeGoogleMetadata_UsageMetadata; - fromPartial( - object: DeepPartial - ): GenerativeGoogleMetadata_UsageMetadata; -}; -export declare const GenerativeMetadata: { - encode(message: GenerativeMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeMetadata; - fromJSON(object: any): GenerativeMetadata; - toJSON(message: GenerativeMetadata): unknown; - create(base?: DeepPartial): GenerativeMetadata; - fromPartial(object: DeepPartial): GenerativeMetadata; -}; -export declare const GenerativeReply: { - encode(message: GenerativeReply, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeReply; - fromJSON(object: any): GenerativeReply; - toJSON(message: GenerativeReply): unknown; - create(base?: DeepPartial): GenerativeReply; - fromPartial(object: DeepPartial): GenerativeReply; -}; -export declare const GenerativeResult: { - encode(message: GenerativeResult, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeResult; - fromJSON(object: any): GenerativeResult; - toJSON(message: GenerativeResult): unknown; - create(base?: DeepPartial): GenerativeResult; - fromPartial(object: DeepPartial): GenerativeResult; -}; -export declare const GenerativeDebug: { - encode(message: GenerativeDebug, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeDebug; - fromJSON(object: any): GenerativeDebug; - toJSON(message: GenerativeDebug): unknown; - create(base?: DeepPartial): GenerativeDebug; - fromPartial(object: DeepPartial): GenerativeDebug; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/cjs/proto/v1/generative.js b/dist/node/cjs/proto/v1/generative.js deleted file mode 100644 index e7cdbfc5..00000000 --- a/dist/node/cjs/proto/v1/generative.js +++ /dev/null @@ -1,3713 +0,0 @@ -'use strict'; -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/generative.proto -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.GenerativeDebug = - exports.GenerativeResult = - exports.GenerativeReply = - exports.GenerativeMetadata = - exports.GenerativeGoogleMetadata_UsageMetadata = - exports.GenerativeGoogleMetadata_Metadata = - exports.GenerativeGoogleMetadata_TokenMetadata = - exports.GenerativeGoogleMetadata_TokenCount = - exports.GenerativeGoogleMetadata = - exports.GenerativeOpenAIMetadata_Usage = - exports.GenerativeOpenAIMetadata = - exports.GenerativeOllamaMetadata = - exports.GenerativeOctoAIMetadata_Usage = - exports.GenerativeOctoAIMetadata = - exports.GenerativeMistralMetadata_Usage = - exports.GenerativeMistralMetadata = - exports.GenerativeDummyMetadata = - exports.GenerativeCohereMetadata_Tokens = - exports.GenerativeCohereMetadata_BilledUnits = - exports.GenerativeCohereMetadata_ApiVersion = - exports.GenerativeCohereMetadata = - exports.GenerativeAWSMetadata = - exports.GenerativeAnyscaleMetadata = - exports.GenerativeAnthropicMetadata_Usage = - exports.GenerativeAnthropicMetadata = - exports.GenerativeGoogle = - exports.GenerativeOpenAI = - exports.GenerativeOllama = - exports.GenerativeOctoAI = - exports.GenerativeMistral = - exports.GenerativeDummy = - exports.GenerativeCohere = - exports.GenerativeAWS = - exports.GenerativeAnyscale = - exports.GenerativeAnthropic = - exports.GenerativeProvider = - exports.GenerativeSearch_Grouped = - exports.GenerativeSearch_Single = - exports.GenerativeSearch = - exports.protobufPackage = - void 0; -/* eslint-disable */ -const long_1 = __importDefault(require('long')); -const minimal_js_1 = __importDefault(require('protobufjs/minimal.js')); -const base_js_1 = require('./base.js'); -exports.protobufPackage = 'weaviate.v1'; -function createBaseGenerativeSearch() { - return { - singleResponsePrompt: '', - groupedResponseTask: '', - groupedProperties: [], - single: undefined, - grouped: undefined, - }; -} -exports.GenerativeSearch = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.singleResponsePrompt !== '') { - writer.uint32(10).string(message.singleResponsePrompt); - } - if (message.groupedResponseTask !== '') { - writer.uint32(18).string(message.groupedResponseTask); - } - for (const v of message.groupedProperties) { - writer.uint32(26).string(v); - } - if (message.single !== undefined) { - exports.GenerativeSearch_Single.encode(message.single, writer.uint32(34).fork()).ldelim(); - } - if (message.grouped !== undefined) { - exports.GenerativeSearch_Grouped.encode(message.grouped, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.singleResponsePrompt = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.groupedResponseTask = reader.string(); - continue; - case 3: - if (tag !== 26) { - break; - } - message.groupedProperties.push(reader.string()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.single = exports.GenerativeSearch_Single.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.grouped = exports.GenerativeSearch_Grouped.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - singleResponsePrompt: isSet(object.singleResponsePrompt) - ? globalThis.String(object.singleResponsePrompt) - : '', - groupedResponseTask: isSet(object.groupedResponseTask) - ? globalThis.String(object.groupedResponseTask) - : '', - groupedProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.groupedProperties - ) - ? object.groupedProperties.map((e) => globalThis.String(e)) - : [], - single: isSet(object.single) ? exports.GenerativeSearch_Single.fromJSON(object.single) : undefined, - grouped: isSet(object.grouped) ? exports.GenerativeSearch_Grouped.fromJSON(object.grouped) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.singleResponsePrompt !== '') { - obj.singleResponsePrompt = message.singleResponsePrompt; - } - if (message.groupedResponseTask !== '') { - obj.groupedResponseTask = message.groupedResponseTask; - } - if ((_a = message.groupedProperties) === null || _a === void 0 ? void 0 : _a.length) { - obj.groupedProperties = message.groupedProperties; - } - if (message.single !== undefined) { - obj.single = exports.GenerativeSearch_Single.toJSON(message.single); - } - if (message.grouped !== undefined) { - obj.grouped = exports.GenerativeSearch_Grouped.toJSON(message.grouped); - } - return obj; - }, - create(base) { - return exports.GenerativeSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeSearch(); - message.singleResponsePrompt = (_a = object.singleResponsePrompt) !== null && _a !== void 0 ? _a : ''; - message.groupedResponseTask = (_b = object.groupedResponseTask) !== null && _b !== void 0 ? _b : ''; - message.groupedProperties = - ((_c = object.groupedProperties) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || []; - message.single = - object.single !== undefined && object.single !== null - ? exports.GenerativeSearch_Single.fromPartial(object.single) - : undefined; - message.grouped = - object.grouped !== undefined && object.grouped !== null - ? exports.GenerativeSearch_Grouped.fromPartial(object.grouped) - : undefined; - return message; - }, -}; -function createBaseGenerativeSearch_Single() { - return { prompt: '', debug: false, queries: [] }; -} -exports.GenerativeSearch_Single = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.prompt !== '') { - writer.uint32(10).string(message.prompt); - } - if (message.debug !== false) { - writer.uint32(16).bool(message.debug); - } - for (const v of message.queries) { - exports.GenerativeProvider.encode(v, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeSearch_Single(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.prompt = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.debug = reader.bool(); - continue; - case 3: - if (tag !== 26) { - break; - } - message.queries.push(exports.GenerativeProvider.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - prompt: isSet(object.prompt) ? globalThis.String(object.prompt) : '', - debug: isSet(object.debug) ? globalThis.Boolean(object.debug) : false, - queries: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.queries) - ? object.queries.map((e) => exports.GenerativeProvider.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.prompt !== '') { - obj.prompt = message.prompt; - } - if (message.debug !== false) { - obj.debug = message.debug; - } - if ((_a = message.queries) === null || _a === void 0 ? void 0 : _a.length) { - obj.queries = message.queries.map((e) => exports.GenerativeProvider.toJSON(e)); - } - return obj; - }, - create(base) { - return exports.GenerativeSearch_Single.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeSearch_Single(); - message.prompt = (_a = object.prompt) !== null && _a !== void 0 ? _a : ''; - message.debug = (_b = object.debug) !== null && _b !== void 0 ? _b : false; - message.queries = - ((_c = object.queries) === null || _c === void 0 - ? void 0 - : _c.map((e) => exports.GenerativeProvider.fromPartial(e))) || []; - return message; - }, -}; -function createBaseGenerativeSearch_Grouped() { - return { task: '', properties: undefined }; -} -exports.GenerativeSearch_Grouped = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.task !== '') { - writer.uint32(10).string(message.task); - } - if (message.properties !== undefined) { - base_js_1.TextArray.encode(message.properties, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeSearch_Grouped(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.task = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.properties = base_js_1.TextArray.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - task: isSet(object.task) ? globalThis.String(object.task) : '', - properties: isSet(object.properties) ? base_js_1.TextArray.fromJSON(object.properties) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.task !== '') { - obj.task = message.task; - } - if (message.properties !== undefined) { - obj.properties = base_js_1.TextArray.toJSON(message.properties); - } - return obj; - }, - create(base) { - return exports.GenerativeSearch_Grouped.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseGenerativeSearch_Grouped(); - message.task = (_a = object.task) !== null && _a !== void 0 ? _a : ''; - message.properties = - object.properties !== undefined && object.properties !== null - ? base_js_1.TextArray.fromPartial(object.properties) - : undefined; - return message; - }, -}; -function createBaseGenerativeProvider() { - return { - returnMetadata: false, - anthropic: undefined, - anyscale: undefined, - aws: undefined, - cohere: undefined, - dummy: undefined, - mistral: undefined, - octoai: undefined, - ollama: undefined, - openai: undefined, - google: undefined, - }; -} -exports.GenerativeProvider = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.returnMetadata !== false) { - writer.uint32(8).bool(message.returnMetadata); - } - if (message.anthropic !== undefined) { - exports.GenerativeAnthropic.encode(message.anthropic, writer.uint32(18).fork()).ldelim(); - } - if (message.anyscale !== undefined) { - exports.GenerativeAnyscale.encode(message.anyscale, writer.uint32(26).fork()).ldelim(); - } - if (message.aws !== undefined) { - exports.GenerativeAWS.encode(message.aws, writer.uint32(34).fork()).ldelim(); - } - if (message.cohere !== undefined) { - exports.GenerativeCohere.encode(message.cohere, writer.uint32(42).fork()).ldelim(); - } - if (message.dummy !== undefined) { - exports.GenerativeDummy.encode(message.dummy, writer.uint32(50).fork()).ldelim(); - } - if (message.mistral !== undefined) { - exports.GenerativeMistral.encode(message.mistral, writer.uint32(58).fork()).ldelim(); - } - if (message.octoai !== undefined) { - exports.GenerativeOctoAI.encode(message.octoai, writer.uint32(66).fork()).ldelim(); - } - if (message.ollama !== undefined) { - exports.GenerativeOllama.encode(message.ollama, writer.uint32(74).fork()).ldelim(); - } - if (message.openai !== undefined) { - exports.GenerativeOpenAI.encode(message.openai, writer.uint32(82).fork()).ldelim(); - } - if (message.google !== undefined) { - exports.GenerativeGoogle.encode(message.google, writer.uint32(90).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeProvider(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.returnMetadata = reader.bool(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.anthropic = exports.GenerativeAnthropic.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.anyscale = exports.GenerativeAnyscale.decode(reader, reader.uint32()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.aws = exports.GenerativeAWS.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.cohere = exports.GenerativeCohere.decode(reader, reader.uint32()); - continue; - case 6: - if (tag !== 50) { - break; - } - message.dummy = exports.GenerativeDummy.decode(reader, reader.uint32()); - continue; - case 7: - if (tag !== 58) { - break; - } - message.mistral = exports.GenerativeMistral.decode(reader, reader.uint32()); - continue; - case 8: - if (tag !== 66) { - break; - } - message.octoai = exports.GenerativeOctoAI.decode(reader, reader.uint32()); - continue; - case 9: - if (tag !== 74) { - break; - } - message.ollama = exports.GenerativeOllama.decode(reader, reader.uint32()); - continue; - case 10: - if (tag !== 82) { - break; - } - message.openai = exports.GenerativeOpenAI.decode(reader, reader.uint32()); - continue; - case 11: - if (tag !== 90) { - break; - } - message.google = exports.GenerativeGoogle.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - returnMetadata: isSet(object.returnMetadata) ? globalThis.Boolean(object.returnMetadata) : false, - anthropic: isSet(object.anthropic) ? exports.GenerativeAnthropic.fromJSON(object.anthropic) : undefined, - anyscale: isSet(object.anyscale) ? exports.GenerativeAnyscale.fromJSON(object.anyscale) : undefined, - aws: isSet(object.aws) ? exports.GenerativeAWS.fromJSON(object.aws) : undefined, - cohere: isSet(object.cohere) ? exports.GenerativeCohere.fromJSON(object.cohere) : undefined, - dummy: isSet(object.dummy) ? exports.GenerativeDummy.fromJSON(object.dummy) : undefined, - mistral: isSet(object.mistral) ? exports.GenerativeMistral.fromJSON(object.mistral) : undefined, - octoai: isSet(object.octoai) ? exports.GenerativeOctoAI.fromJSON(object.octoai) : undefined, - ollama: isSet(object.ollama) ? exports.GenerativeOllama.fromJSON(object.ollama) : undefined, - openai: isSet(object.openai) ? exports.GenerativeOpenAI.fromJSON(object.openai) : undefined, - google: isSet(object.google) ? exports.GenerativeGoogle.fromJSON(object.google) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.returnMetadata !== false) { - obj.returnMetadata = message.returnMetadata; - } - if (message.anthropic !== undefined) { - obj.anthropic = exports.GenerativeAnthropic.toJSON(message.anthropic); - } - if (message.anyscale !== undefined) { - obj.anyscale = exports.GenerativeAnyscale.toJSON(message.anyscale); - } - if (message.aws !== undefined) { - obj.aws = exports.GenerativeAWS.toJSON(message.aws); - } - if (message.cohere !== undefined) { - obj.cohere = exports.GenerativeCohere.toJSON(message.cohere); - } - if (message.dummy !== undefined) { - obj.dummy = exports.GenerativeDummy.toJSON(message.dummy); - } - if (message.mistral !== undefined) { - obj.mistral = exports.GenerativeMistral.toJSON(message.mistral); - } - if (message.octoai !== undefined) { - obj.octoai = exports.GenerativeOctoAI.toJSON(message.octoai); - } - if (message.ollama !== undefined) { - obj.ollama = exports.GenerativeOllama.toJSON(message.ollama); - } - if (message.openai !== undefined) { - obj.openai = exports.GenerativeOpenAI.toJSON(message.openai); - } - if (message.google !== undefined) { - obj.google = exports.GenerativeGoogle.toJSON(message.google); - } - return obj; - }, - create(base) { - return exports.GenerativeProvider.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseGenerativeProvider(); - message.returnMetadata = (_a = object.returnMetadata) !== null && _a !== void 0 ? _a : false; - message.anthropic = - object.anthropic !== undefined && object.anthropic !== null - ? exports.GenerativeAnthropic.fromPartial(object.anthropic) - : undefined; - message.anyscale = - object.anyscale !== undefined && object.anyscale !== null - ? exports.GenerativeAnyscale.fromPartial(object.anyscale) - : undefined; - message.aws = - object.aws !== undefined && object.aws !== null - ? exports.GenerativeAWS.fromPartial(object.aws) - : undefined; - message.cohere = - object.cohere !== undefined && object.cohere !== null - ? exports.GenerativeCohere.fromPartial(object.cohere) - : undefined; - message.dummy = - object.dummy !== undefined && object.dummy !== null - ? exports.GenerativeDummy.fromPartial(object.dummy) - : undefined; - message.mistral = - object.mistral !== undefined && object.mistral !== null - ? exports.GenerativeMistral.fromPartial(object.mistral) - : undefined; - message.octoai = - object.octoai !== undefined && object.octoai !== null - ? exports.GenerativeOctoAI.fromPartial(object.octoai) - : undefined; - message.ollama = - object.ollama !== undefined && object.ollama !== null - ? exports.GenerativeOllama.fromPartial(object.ollama) - : undefined; - message.openai = - object.openai !== undefined && object.openai !== null - ? exports.GenerativeOpenAI.fromPartial(object.openai) - : undefined; - message.google = - object.google !== undefined && object.google !== null - ? exports.GenerativeGoogle.fromPartial(object.google) - : undefined; - return message; - }, -}; -function createBaseGenerativeAnthropic() { - return { - baseUrl: undefined, - maxTokens: undefined, - model: undefined, - temperature: undefined, - topK: undefined, - topP: undefined, - stopSequences: undefined, - }; -} -exports.GenerativeAnthropic = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.baseUrl !== undefined) { - writer.uint32(10).string(message.baseUrl); - } - if (message.maxTokens !== undefined) { - writer.uint32(16).int64(message.maxTokens); - } - if (message.model !== undefined) { - writer.uint32(26).string(message.model); - } - if (message.temperature !== undefined) { - writer.uint32(33).double(message.temperature); - } - if (message.topK !== undefined) { - writer.uint32(40).int64(message.topK); - } - if (message.topP !== undefined) { - writer.uint32(49).double(message.topP); - } - if (message.stopSequences !== undefined) { - base_js_1.TextArray.encode(message.stopSequences, writer.uint32(58).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeAnthropic(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.baseUrl = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.maxTokens = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.model = reader.string(); - continue; - case 4: - if (tag !== 33) { - break; - } - message.temperature = reader.double(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.topK = longToNumber(reader.int64()); - continue; - case 6: - if (tag !== 49) { - break; - } - message.topP = reader.double(); - continue; - case 7: - if (tag !== 58) { - break; - } - message.stopSequences = base_js_1.TextArray.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - baseUrl: isSet(object.baseUrl) ? globalThis.String(object.baseUrl) : undefined, - maxTokens: isSet(object.maxTokens) ? globalThis.Number(object.maxTokens) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - topK: isSet(object.topK) ? globalThis.Number(object.topK) : undefined, - topP: isSet(object.topP) ? globalThis.Number(object.topP) : undefined, - stopSequences: isSet(object.stopSequences) - ? base_js_1.TextArray.fromJSON(object.stopSequences) - : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.baseUrl !== undefined) { - obj.baseUrl = message.baseUrl; - } - if (message.maxTokens !== undefined) { - obj.maxTokens = Math.round(message.maxTokens); - } - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - if (message.topK !== undefined) { - obj.topK = Math.round(message.topK); - } - if (message.topP !== undefined) { - obj.topP = message.topP; - } - if (message.stopSequences !== undefined) { - obj.stopSequences = base_js_1.TextArray.toJSON(message.stopSequences); - } - return obj; - }, - create(base) { - return exports.GenerativeAnthropic.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f; - const message = createBaseGenerativeAnthropic(); - message.baseUrl = (_a = object.baseUrl) !== null && _a !== void 0 ? _a : undefined; - message.maxTokens = (_b = object.maxTokens) !== null && _b !== void 0 ? _b : undefined; - message.model = (_c = object.model) !== null && _c !== void 0 ? _c : undefined; - message.temperature = (_d = object.temperature) !== null && _d !== void 0 ? _d : undefined; - message.topK = (_e = object.topK) !== null && _e !== void 0 ? _e : undefined; - message.topP = (_f = object.topP) !== null && _f !== void 0 ? _f : undefined; - message.stopSequences = - object.stopSequences !== undefined && object.stopSequences !== null - ? base_js_1.TextArray.fromPartial(object.stopSequences) - : undefined; - return message; - }, -}; -function createBaseGenerativeAnyscale() { - return { baseUrl: undefined, model: undefined, temperature: undefined }; -} -exports.GenerativeAnyscale = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.baseUrl !== undefined) { - writer.uint32(10).string(message.baseUrl); - } - if (message.model !== undefined) { - writer.uint32(18).string(message.model); - } - if (message.temperature !== undefined) { - writer.uint32(25).double(message.temperature); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeAnyscale(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.baseUrl = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.model = reader.string(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.temperature = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - baseUrl: isSet(object.baseUrl) ? globalThis.String(object.baseUrl) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.baseUrl !== undefined) { - obj.baseUrl = message.baseUrl; - } - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - return obj; - }, - create(base) { - return exports.GenerativeAnyscale.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeAnyscale(); - message.baseUrl = (_a = object.baseUrl) !== null && _a !== void 0 ? _a : undefined; - message.model = (_b = object.model) !== null && _b !== void 0 ? _b : undefined; - message.temperature = (_c = object.temperature) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function createBaseGenerativeAWS() { - return { model: undefined, temperature: undefined }; -} -exports.GenerativeAWS = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.model !== undefined) { - writer.uint32(26).string(message.model); - } - if (message.temperature !== undefined) { - writer.uint32(65).double(message.temperature); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeAWS(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 3: - if (tag !== 26) { - break; - } - message.model = reader.string(); - continue; - case 8: - if (tag !== 65) { - break; - } - message.temperature = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - return obj; - }, - create(base) { - return exports.GenerativeAWS.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseGenerativeAWS(); - message.model = (_a = object.model) !== null && _a !== void 0 ? _a : undefined; - message.temperature = (_b = object.temperature) !== null && _b !== void 0 ? _b : undefined; - return message; - }, -}; -function createBaseGenerativeCohere() { - return { - baseUrl: undefined, - frequencyPenalty: undefined, - maxTokens: undefined, - model: undefined, - k: undefined, - p: undefined, - presencePenalty: undefined, - stopSequences: undefined, - temperature: undefined, - }; -} -exports.GenerativeCohere = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.baseUrl !== undefined) { - writer.uint32(10).string(message.baseUrl); - } - if (message.frequencyPenalty !== undefined) { - writer.uint32(17).double(message.frequencyPenalty); - } - if (message.maxTokens !== undefined) { - writer.uint32(24).int64(message.maxTokens); - } - if (message.model !== undefined) { - writer.uint32(34).string(message.model); - } - if (message.k !== undefined) { - writer.uint32(40).int64(message.k); - } - if (message.p !== undefined) { - writer.uint32(49).double(message.p); - } - if (message.presencePenalty !== undefined) { - writer.uint32(57).double(message.presencePenalty); - } - if (message.stopSequences !== undefined) { - base_js_1.TextArray.encode(message.stopSequences, writer.uint32(66).fork()).ldelim(); - } - if (message.temperature !== undefined) { - writer.uint32(73).double(message.temperature); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeCohere(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.baseUrl = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.frequencyPenalty = reader.double(); - continue; - case 3: - if (tag !== 24) { - break; - } - message.maxTokens = longToNumber(reader.int64()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.model = reader.string(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.k = longToNumber(reader.int64()); - continue; - case 6: - if (tag !== 49) { - break; - } - message.p = reader.double(); - continue; - case 7: - if (tag !== 57) { - break; - } - message.presencePenalty = reader.double(); - continue; - case 8: - if (tag !== 66) { - break; - } - message.stopSequences = base_js_1.TextArray.decode(reader, reader.uint32()); - continue; - case 9: - if (tag !== 73) { - break; - } - message.temperature = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - baseUrl: isSet(object.baseUrl) ? globalThis.String(object.baseUrl) : undefined, - frequencyPenalty: isSet(object.frequencyPenalty) - ? globalThis.Number(object.frequencyPenalty) - : undefined, - maxTokens: isSet(object.maxTokens) ? globalThis.Number(object.maxTokens) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - k: isSet(object.k) ? globalThis.Number(object.k) : undefined, - p: isSet(object.p) ? globalThis.Number(object.p) : undefined, - presencePenalty: isSet(object.presencePenalty) ? globalThis.Number(object.presencePenalty) : undefined, - stopSequences: isSet(object.stopSequences) - ? base_js_1.TextArray.fromJSON(object.stopSequences) - : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.baseUrl !== undefined) { - obj.baseUrl = message.baseUrl; - } - if (message.frequencyPenalty !== undefined) { - obj.frequencyPenalty = message.frequencyPenalty; - } - if (message.maxTokens !== undefined) { - obj.maxTokens = Math.round(message.maxTokens); - } - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.k !== undefined) { - obj.k = Math.round(message.k); - } - if (message.p !== undefined) { - obj.p = message.p; - } - if (message.presencePenalty !== undefined) { - obj.presencePenalty = message.presencePenalty; - } - if (message.stopSequences !== undefined) { - obj.stopSequences = base_js_1.TextArray.toJSON(message.stopSequences); - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - return obj; - }, - create(base) { - return exports.GenerativeCohere.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h; - const message = createBaseGenerativeCohere(); - message.baseUrl = (_a = object.baseUrl) !== null && _a !== void 0 ? _a : undefined; - message.frequencyPenalty = (_b = object.frequencyPenalty) !== null && _b !== void 0 ? _b : undefined; - message.maxTokens = (_c = object.maxTokens) !== null && _c !== void 0 ? _c : undefined; - message.model = (_d = object.model) !== null && _d !== void 0 ? _d : undefined; - message.k = (_e = object.k) !== null && _e !== void 0 ? _e : undefined; - message.p = (_f = object.p) !== null && _f !== void 0 ? _f : undefined; - message.presencePenalty = (_g = object.presencePenalty) !== null && _g !== void 0 ? _g : undefined; - message.stopSequences = - object.stopSequences !== undefined && object.stopSequences !== null - ? base_js_1.TextArray.fromPartial(object.stopSequences) - : undefined; - message.temperature = (_h = object.temperature) !== null && _h !== void 0 ? _h : undefined; - return message; - }, -}; -function createBaseGenerativeDummy() { - return {}; -} -exports.GenerativeDummy = { - encode(_, writer = minimal_js_1.default.Writer.create()) { - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeDummy(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(_) { - return {}; - }, - toJSON(_) { - const obj = {}; - return obj; - }, - create(base) { - return exports.GenerativeDummy.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(_) { - const message = createBaseGenerativeDummy(); - return message; - }, -}; -function createBaseGenerativeMistral() { - return { - baseUrl: undefined, - maxTokens: undefined, - model: undefined, - temperature: undefined, - topP: undefined, - }; -} -exports.GenerativeMistral = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.baseUrl !== undefined) { - writer.uint32(10).string(message.baseUrl); - } - if (message.maxTokens !== undefined) { - writer.uint32(16).int64(message.maxTokens); - } - if (message.model !== undefined) { - writer.uint32(26).string(message.model); - } - if (message.temperature !== undefined) { - writer.uint32(33).double(message.temperature); - } - if (message.topP !== undefined) { - writer.uint32(41).double(message.topP); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeMistral(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.baseUrl = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.maxTokens = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.model = reader.string(); - continue; - case 4: - if (tag !== 33) { - break; - } - message.temperature = reader.double(); - continue; - case 5: - if (tag !== 41) { - break; - } - message.topP = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - baseUrl: isSet(object.baseUrl) ? globalThis.String(object.baseUrl) : undefined, - maxTokens: isSet(object.maxTokens) ? globalThis.Number(object.maxTokens) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - topP: isSet(object.topP) ? globalThis.Number(object.topP) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.baseUrl !== undefined) { - obj.baseUrl = message.baseUrl; - } - if (message.maxTokens !== undefined) { - obj.maxTokens = Math.round(message.maxTokens); - } - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - if (message.topP !== undefined) { - obj.topP = message.topP; - } - return obj; - }, - create(base) { - return exports.GenerativeMistral.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e; - const message = createBaseGenerativeMistral(); - message.baseUrl = (_a = object.baseUrl) !== null && _a !== void 0 ? _a : undefined; - message.maxTokens = (_b = object.maxTokens) !== null && _b !== void 0 ? _b : undefined; - message.model = (_c = object.model) !== null && _c !== void 0 ? _c : undefined; - message.temperature = (_d = object.temperature) !== null && _d !== void 0 ? _d : undefined; - message.topP = (_e = object.topP) !== null && _e !== void 0 ? _e : undefined; - return message; - }, -}; -function createBaseGenerativeOctoAI() { - return { - baseUrl: undefined, - maxTokens: undefined, - model: undefined, - n: undefined, - temperature: undefined, - topP: undefined, - }; -} -exports.GenerativeOctoAI = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.baseUrl !== undefined) { - writer.uint32(10).string(message.baseUrl); - } - if (message.maxTokens !== undefined) { - writer.uint32(16).int64(message.maxTokens); - } - if (message.model !== undefined) { - writer.uint32(26).string(message.model); - } - if (message.n !== undefined) { - writer.uint32(32).int64(message.n); - } - if (message.temperature !== undefined) { - writer.uint32(41).double(message.temperature); - } - if (message.topP !== undefined) { - writer.uint32(49).double(message.topP); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOctoAI(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.baseUrl = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.maxTokens = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.model = reader.string(); - continue; - case 4: - if (tag !== 32) { - break; - } - message.n = longToNumber(reader.int64()); - continue; - case 5: - if (tag !== 41) { - break; - } - message.temperature = reader.double(); - continue; - case 6: - if (tag !== 49) { - break; - } - message.topP = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - baseUrl: isSet(object.baseUrl) ? globalThis.String(object.baseUrl) : undefined, - maxTokens: isSet(object.maxTokens) ? globalThis.Number(object.maxTokens) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - n: isSet(object.n) ? globalThis.Number(object.n) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - topP: isSet(object.topP) ? globalThis.Number(object.topP) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.baseUrl !== undefined) { - obj.baseUrl = message.baseUrl; - } - if (message.maxTokens !== undefined) { - obj.maxTokens = Math.round(message.maxTokens); - } - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.n !== undefined) { - obj.n = Math.round(message.n); - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - if (message.topP !== undefined) { - obj.topP = message.topP; - } - return obj; - }, - create(base) { - return exports.GenerativeOctoAI.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f; - const message = createBaseGenerativeOctoAI(); - message.baseUrl = (_a = object.baseUrl) !== null && _a !== void 0 ? _a : undefined; - message.maxTokens = (_b = object.maxTokens) !== null && _b !== void 0 ? _b : undefined; - message.model = (_c = object.model) !== null && _c !== void 0 ? _c : undefined; - message.n = (_d = object.n) !== null && _d !== void 0 ? _d : undefined; - message.temperature = (_e = object.temperature) !== null && _e !== void 0 ? _e : undefined; - message.topP = (_f = object.topP) !== null && _f !== void 0 ? _f : undefined; - return message; - }, -}; -function createBaseGenerativeOllama() { - return { apiEndpoint: undefined, model: undefined, temperature: undefined }; -} -exports.GenerativeOllama = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.apiEndpoint !== undefined) { - writer.uint32(10).string(message.apiEndpoint); - } - if (message.model !== undefined) { - writer.uint32(18).string(message.model); - } - if (message.temperature !== undefined) { - writer.uint32(25).double(message.temperature); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOllama(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.apiEndpoint = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.model = reader.string(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.temperature = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - apiEndpoint: isSet(object.apiEndpoint) ? globalThis.String(object.apiEndpoint) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.apiEndpoint !== undefined) { - obj.apiEndpoint = message.apiEndpoint; - } - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - return obj; - }, - create(base) { - return exports.GenerativeOllama.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeOllama(); - message.apiEndpoint = (_a = object.apiEndpoint) !== null && _a !== void 0 ? _a : undefined; - message.model = (_b = object.model) !== null && _b !== void 0 ? _b : undefined; - message.temperature = (_c = object.temperature) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function createBaseGenerativeOpenAI() { - return { - frequencyPenalty: undefined, - logProbs: undefined, - maxTokens: undefined, - model: '', - n: undefined, - presencePenalty: undefined, - stop: undefined, - temperature: undefined, - topP: undefined, - topLogProbs: undefined, - }; -} -exports.GenerativeOpenAI = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.frequencyPenalty !== undefined) { - writer.uint32(9).double(message.frequencyPenalty); - } - if (message.logProbs !== undefined) { - writer.uint32(16).bool(message.logProbs); - } - if (message.maxTokens !== undefined) { - writer.uint32(24).int64(message.maxTokens); - } - if (message.model !== '') { - writer.uint32(34).string(message.model); - } - if (message.n !== undefined) { - writer.uint32(40).int64(message.n); - } - if (message.presencePenalty !== undefined) { - writer.uint32(49).double(message.presencePenalty); - } - if (message.stop !== undefined) { - base_js_1.TextArray.encode(message.stop, writer.uint32(58).fork()).ldelim(); - } - if (message.temperature !== undefined) { - writer.uint32(65).double(message.temperature); - } - if (message.topP !== undefined) { - writer.uint32(73).double(message.topP); - } - if (message.topLogProbs !== undefined) { - writer.uint32(80).int64(message.topLogProbs); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOpenAI(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 9) { - break; - } - message.frequencyPenalty = reader.double(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.logProbs = reader.bool(); - continue; - case 3: - if (tag !== 24) { - break; - } - message.maxTokens = longToNumber(reader.int64()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.model = reader.string(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.n = longToNumber(reader.int64()); - continue; - case 6: - if (tag !== 49) { - break; - } - message.presencePenalty = reader.double(); - continue; - case 7: - if (tag !== 58) { - break; - } - message.stop = base_js_1.TextArray.decode(reader, reader.uint32()); - continue; - case 8: - if (tag !== 65) { - break; - } - message.temperature = reader.double(); - continue; - case 9: - if (tag !== 73) { - break; - } - message.topP = reader.double(); - continue; - case 10: - if (tag !== 80) { - break; - } - message.topLogProbs = longToNumber(reader.int64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - frequencyPenalty: isSet(object.frequencyPenalty) - ? globalThis.Number(object.frequencyPenalty) - : undefined, - logProbs: isSet(object.logProbs) ? globalThis.Boolean(object.logProbs) : undefined, - maxTokens: isSet(object.maxTokens) ? globalThis.Number(object.maxTokens) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : '', - n: isSet(object.n) ? globalThis.Number(object.n) : undefined, - presencePenalty: isSet(object.presencePenalty) ? globalThis.Number(object.presencePenalty) : undefined, - stop: isSet(object.stop) ? base_js_1.TextArray.fromJSON(object.stop) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - topP: isSet(object.topP) ? globalThis.Number(object.topP) : undefined, - topLogProbs: isSet(object.topLogProbs) ? globalThis.Number(object.topLogProbs) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.frequencyPenalty !== undefined) { - obj.frequencyPenalty = message.frequencyPenalty; - } - if (message.logProbs !== undefined) { - obj.logProbs = message.logProbs; - } - if (message.maxTokens !== undefined) { - obj.maxTokens = Math.round(message.maxTokens); - } - if (message.model !== '') { - obj.model = message.model; - } - if (message.n !== undefined) { - obj.n = Math.round(message.n); - } - if (message.presencePenalty !== undefined) { - obj.presencePenalty = message.presencePenalty; - } - if (message.stop !== undefined) { - obj.stop = base_js_1.TextArray.toJSON(message.stop); - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - if (message.topP !== undefined) { - obj.topP = message.topP; - } - if (message.topLogProbs !== undefined) { - obj.topLogProbs = Math.round(message.topLogProbs); - } - return obj; - }, - create(base) { - return exports.GenerativeOpenAI.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - const message = createBaseGenerativeOpenAI(); - message.frequencyPenalty = (_a = object.frequencyPenalty) !== null && _a !== void 0 ? _a : undefined; - message.logProbs = (_b = object.logProbs) !== null && _b !== void 0 ? _b : undefined; - message.maxTokens = (_c = object.maxTokens) !== null && _c !== void 0 ? _c : undefined; - message.model = (_d = object.model) !== null && _d !== void 0 ? _d : ''; - message.n = (_e = object.n) !== null && _e !== void 0 ? _e : undefined; - message.presencePenalty = (_f = object.presencePenalty) !== null && _f !== void 0 ? _f : undefined; - message.stop = - object.stop !== undefined && object.stop !== null - ? base_js_1.TextArray.fromPartial(object.stop) - : undefined; - message.temperature = (_g = object.temperature) !== null && _g !== void 0 ? _g : undefined; - message.topP = (_h = object.topP) !== null && _h !== void 0 ? _h : undefined; - message.topLogProbs = (_j = object.topLogProbs) !== null && _j !== void 0 ? _j : undefined; - return message; - }, -}; -function createBaseGenerativeGoogle() { - return { - frequencyPenalty: undefined, - maxTokens: undefined, - model: undefined, - presencePenalty: undefined, - temperature: undefined, - topK: undefined, - topP: undefined, - stopSequences: undefined, - }; -} -exports.GenerativeGoogle = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.frequencyPenalty !== undefined) { - writer.uint32(9).double(message.frequencyPenalty); - } - if (message.maxTokens !== undefined) { - writer.uint32(16).int64(message.maxTokens); - } - if (message.model !== undefined) { - writer.uint32(26).string(message.model); - } - if (message.presencePenalty !== undefined) { - writer.uint32(33).double(message.presencePenalty); - } - if (message.temperature !== undefined) { - writer.uint32(41).double(message.temperature); - } - if (message.topK !== undefined) { - writer.uint32(48).int64(message.topK); - } - if (message.topP !== undefined) { - writer.uint32(57).double(message.topP); - } - if (message.stopSequences !== undefined) { - base_js_1.TextArray.encode(message.stopSequences, writer.uint32(66).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeGoogle(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 9) { - break; - } - message.frequencyPenalty = reader.double(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.maxTokens = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.model = reader.string(); - continue; - case 4: - if (tag !== 33) { - break; - } - message.presencePenalty = reader.double(); - continue; - case 5: - if (tag !== 41) { - break; - } - message.temperature = reader.double(); - continue; - case 6: - if (tag !== 48) { - break; - } - message.topK = longToNumber(reader.int64()); - continue; - case 7: - if (tag !== 57) { - break; - } - message.topP = reader.double(); - continue; - case 8: - if (tag !== 66) { - break; - } - message.stopSequences = base_js_1.TextArray.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - frequencyPenalty: isSet(object.frequencyPenalty) - ? globalThis.Number(object.frequencyPenalty) - : undefined, - maxTokens: isSet(object.maxTokens) ? globalThis.Number(object.maxTokens) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - presencePenalty: isSet(object.presencePenalty) ? globalThis.Number(object.presencePenalty) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - topK: isSet(object.topK) ? globalThis.Number(object.topK) : undefined, - topP: isSet(object.topP) ? globalThis.Number(object.topP) : undefined, - stopSequences: isSet(object.stopSequences) - ? base_js_1.TextArray.fromJSON(object.stopSequences) - : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.frequencyPenalty !== undefined) { - obj.frequencyPenalty = message.frequencyPenalty; - } - if (message.maxTokens !== undefined) { - obj.maxTokens = Math.round(message.maxTokens); - } - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.presencePenalty !== undefined) { - obj.presencePenalty = message.presencePenalty; - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - if (message.topK !== undefined) { - obj.topK = Math.round(message.topK); - } - if (message.topP !== undefined) { - obj.topP = message.topP; - } - if (message.stopSequences !== undefined) { - obj.stopSequences = base_js_1.TextArray.toJSON(message.stopSequences); - } - return obj; - }, - create(base) { - return exports.GenerativeGoogle.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g; - const message = createBaseGenerativeGoogle(); - message.frequencyPenalty = (_a = object.frequencyPenalty) !== null && _a !== void 0 ? _a : undefined; - message.maxTokens = (_b = object.maxTokens) !== null && _b !== void 0 ? _b : undefined; - message.model = (_c = object.model) !== null && _c !== void 0 ? _c : undefined; - message.presencePenalty = (_d = object.presencePenalty) !== null && _d !== void 0 ? _d : undefined; - message.temperature = (_e = object.temperature) !== null && _e !== void 0 ? _e : undefined; - message.topK = (_f = object.topK) !== null && _f !== void 0 ? _f : undefined; - message.topP = (_g = object.topP) !== null && _g !== void 0 ? _g : undefined; - message.stopSequences = - object.stopSequences !== undefined && object.stopSequences !== null - ? base_js_1.TextArray.fromPartial(object.stopSequences) - : undefined; - return message; - }, -}; -function createBaseGenerativeAnthropicMetadata() { - return { usage: undefined }; -} -exports.GenerativeAnthropicMetadata = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.usage !== undefined) { - exports.GenerativeAnthropicMetadata_Usage.encode(message.usage, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeAnthropicMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.usage = exports.GenerativeAnthropicMetadata_Usage.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - usage: isSet(object.usage) - ? exports.GenerativeAnthropicMetadata_Usage.fromJSON(object.usage) - : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.usage !== undefined) { - obj.usage = exports.GenerativeAnthropicMetadata_Usage.toJSON(message.usage); - } - return obj; - }, - create(base) { - return exports.GenerativeAnthropicMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeAnthropicMetadata(); - message.usage = - object.usage !== undefined && object.usage !== null - ? exports.GenerativeAnthropicMetadata_Usage.fromPartial(object.usage) - : undefined; - return message; - }, -}; -function createBaseGenerativeAnthropicMetadata_Usage() { - return { inputTokens: 0, outputTokens: 0 }; -} -exports.GenerativeAnthropicMetadata_Usage = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.inputTokens !== 0) { - writer.uint32(8).int64(message.inputTokens); - } - if (message.outputTokens !== 0) { - writer.uint32(16).int64(message.outputTokens); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeAnthropicMetadata_Usage(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.inputTokens = longToNumber(reader.int64()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.outputTokens = longToNumber(reader.int64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - inputTokens: isSet(object.inputTokens) ? globalThis.Number(object.inputTokens) : 0, - outputTokens: isSet(object.outputTokens) ? globalThis.Number(object.outputTokens) : 0, - }; - }, - toJSON(message) { - const obj = {}; - if (message.inputTokens !== 0) { - obj.inputTokens = Math.round(message.inputTokens); - } - if (message.outputTokens !== 0) { - obj.outputTokens = Math.round(message.outputTokens); - } - return obj; - }, - create(base) { - return exports.GenerativeAnthropicMetadata_Usage.fromPartial( - base !== null && base !== void 0 ? base : {} - ); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseGenerativeAnthropicMetadata_Usage(); - message.inputTokens = (_a = object.inputTokens) !== null && _a !== void 0 ? _a : 0; - message.outputTokens = (_b = object.outputTokens) !== null && _b !== void 0 ? _b : 0; - return message; - }, -}; -function createBaseGenerativeAnyscaleMetadata() { - return {}; -} -exports.GenerativeAnyscaleMetadata = { - encode(_, writer = minimal_js_1.default.Writer.create()) { - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeAnyscaleMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(_) { - return {}; - }, - toJSON(_) { - const obj = {}; - return obj; - }, - create(base) { - return exports.GenerativeAnyscaleMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(_) { - const message = createBaseGenerativeAnyscaleMetadata(); - return message; - }, -}; -function createBaseGenerativeAWSMetadata() { - return {}; -} -exports.GenerativeAWSMetadata = { - encode(_, writer = minimal_js_1.default.Writer.create()) { - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeAWSMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(_) { - return {}; - }, - toJSON(_) { - const obj = {}; - return obj; - }, - create(base) { - return exports.GenerativeAWSMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(_) { - const message = createBaseGenerativeAWSMetadata(); - return message; - }, -}; -function createBaseGenerativeCohereMetadata() { - return { apiVersion: undefined, billedUnits: undefined, tokens: undefined, warnings: undefined }; -} -exports.GenerativeCohereMetadata = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.apiVersion !== undefined) { - exports.GenerativeCohereMetadata_ApiVersion.encode( - message.apiVersion, - writer.uint32(10).fork() - ).ldelim(); - } - if (message.billedUnits !== undefined) { - exports.GenerativeCohereMetadata_BilledUnits.encode( - message.billedUnits, - writer.uint32(18).fork() - ).ldelim(); - } - if (message.tokens !== undefined) { - exports.GenerativeCohereMetadata_Tokens.encode(message.tokens, writer.uint32(26).fork()).ldelim(); - } - if (message.warnings !== undefined) { - base_js_1.TextArray.encode(message.warnings, writer.uint32(34).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeCohereMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.apiVersion = exports.GenerativeCohereMetadata_ApiVersion.decode(reader, reader.uint32()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.billedUnits = exports.GenerativeCohereMetadata_BilledUnits.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.tokens = exports.GenerativeCohereMetadata_Tokens.decode(reader, reader.uint32()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.warnings = base_js_1.TextArray.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - apiVersion: isSet(object.apiVersion) - ? exports.GenerativeCohereMetadata_ApiVersion.fromJSON(object.apiVersion) - : undefined, - billedUnits: isSet(object.billedUnits) - ? exports.GenerativeCohereMetadata_BilledUnits.fromJSON(object.billedUnits) - : undefined, - tokens: isSet(object.tokens) - ? exports.GenerativeCohereMetadata_Tokens.fromJSON(object.tokens) - : undefined, - warnings: isSet(object.warnings) ? base_js_1.TextArray.fromJSON(object.warnings) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.apiVersion !== undefined) { - obj.apiVersion = exports.GenerativeCohereMetadata_ApiVersion.toJSON(message.apiVersion); - } - if (message.billedUnits !== undefined) { - obj.billedUnits = exports.GenerativeCohereMetadata_BilledUnits.toJSON(message.billedUnits); - } - if (message.tokens !== undefined) { - obj.tokens = exports.GenerativeCohereMetadata_Tokens.toJSON(message.tokens); - } - if (message.warnings !== undefined) { - obj.warnings = base_js_1.TextArray.toJSON(message.warnings); - } - return obj; - }, - create(base) { - return exports.GenerativeCohereMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeCohereMetadata(); - message.apiVersion = - object.apiVersion !== undefined && object.apiVersion !== null - ? exports.GenerativeCohereMetadata_ApiVersion.fromPartial(object.apiVersion) - : undefined; - message.billedUnits = - object.billedUnits !== undefined && object.billedUnits !== null - ? exports.GenerativeCohereMetadata_BilledUnits.fromPartial(object.billedUnits) - : undefined; - message.tokens = - object.tokens !== undefined && object.tokens !== null - ? exports.GenerativeCohereMetadata_Tokens.fromPartial(object.tokens) - : undefined; - message.warnings = - object.warnings !== undefined && object.warnings !== null - ? base_js_1.TextArray.fromPartial(object.warnings) - : undefined; - return message; - }, -}; -function createBaseGenerativeCohereMetadata_ApiVersion() { - return { version: undefined, isDeprecated: undefined, isExperimental: undefined }; -} -exports.GenerativeCohereMetadata_ApiVersion = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.version !== undefined) { - writer.uint32(10).string(message.version); - } - if (message.isDeprecated !== undefined) { - writer.uint32(16).bool(message.isDeprecated); - } - if (message.isExperimental !== undefined) { - writer.uint32(24).bool(message.isExperimental); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeCohereMetadata_ApiVersion(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.version = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.isDeprecated = reader.bool(); - continue; - case 3: - if (tag !== 24) { - break; - } - message.isExperimental = reader.bool(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - version: isSet(object.version) ? globalThis.String(object.version) : undefined, - isDeprecated: isSet(object.isDeprecated) ? globalThis.Boolean(object.isDeprecated) : undefined, - isExperimental: isSet(object.isExperimental) ? globalThis.Boolean(object.isExperimental) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.version !== undefined) { - obj.version = message.version; - } - if (message.isDeprecated !== undefined) { - obj.isDeprecated = message.isDeprecated; - } - if (message.isExperimental !== undefined) { - obj.isExperimental = message.isExperimental; - } - return obj; - }, - create(base) { - return exports.GenerativeCohereMetadata_ApiVersion.fromPartial( - base !== null && base !== void 0 ? base : {} - ); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeCohereMetadata_ApiVersion(); - message.version = (_a = object.version) !== null && _a !== void 0 ? _a : undefined; - message.isDeprecated = (_b = object.isDeprecated) !== null && _b !== void 0 ? _b : undefined; - message.isExperimental = (_c = object.isExperimental) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function createBaseGenerativeCohereMetadata_BilledUnits() { - return { - inputTokens: undefined, - outputTokens: undefined, - searchUnits: undefined, - classifications: undefined, - }; -} -exports.GenerativeCohereMetadata_BilledUnits = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.inputTokens !== undefined) { - writer.uint32(9).double(message.inputTokens); - } - if (message.outputTokens !== undefined) { - writer.uint32(17).double(message.outputTokens); - } - if (message.searchUnits !== undefined) { - writer.uint32(25).double(message.searchUnits); - } - if (message.classifications !== undefined) { - writer.uint32(33).double(message.classifications); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeCohereMetadata_BilledUnits(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 9) { - break; - } - message.inputTokens = reader.double(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.outputTokens = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.searchUnits = reader.double(); - continue; - case 4: - if (tag !== 33) { - break; - } - message.classifications = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - inputTokens: isSet(object.inputTokens) ? globalThis.Number(object.inputTokens) : undefined, - outputTokens: isSet(object.outputTokens) ? globalThis.Number(object.outputTokens) : undefined, - searchUnits: isSet(object.searchUnits) ? globalThis.Number(object.searchUnits) : undefined, - classifications: isSet(object.classifications) ? globalThis.Number(object.classifications) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.inputTokens !== undefined) { - obj.inputTokens = message.inputTokens; - } - if (message.outputTokens !== undefined) { - obj.outputTokens = message.outputTokens; - } - if (message.searchUnits !== undefined) { - obj.searchUnits = message.searchUnits; - } - if (message.classifications !== undefined) { - obj.classifications = message.classifications; - } - return obj; - }, - create(base) { - return exports.GenerativeCohereMetadata_BilledUnits.fromPartial( - base !== null && base !== void 0 ? base : {} - ); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseGenerativeCohereMetadata_BilledUnits(); - message.inputTokens = (_a = object.inputTokens) !== null && _a !== void 0 ? _a : undefined; - message.outputTokens = (_b = object.outputTokens) !== null && _b !== void 0 ? _b : undefined; - message.searchUnits = (_c = object.searchUnits) !== null && _c !== void 0 ? _c : undefined; - message.classifications = (_d = object.classifications) !== null && _d !== void 0 ? _d : undefined; - return message; - }, -}; -function createBaseGenerativeCohereMetadata_Tokens() { - return { inputTokens: undefined, outputTokens: undefined }; -} -exports.GenerativeCohereMetadata_Tokens = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.inputTokens !== undefined) { - writer.uint32(9).double(message.inputTokens); - } - if (message.outputTokens !== undefined) { - writer.uint32(17).double(message.outputTokens); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeCohereMetadata_Tokens(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 9) { - break; - } - message.inputTokens = reader.double(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.outputTokens = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - inputTokens: isSet(object.inputTokens) ? globalThis.Number(object.inputTokens) : undefined, - outputTokens: isSet(object.outputTokens) ? globalThis.Number(object.outputTokens) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.inputTokens !== undefined) { - obj.inputTokens = message.inputTokens; - } - if (message.outputTokens !== undefined) { - obj.outputTokens = message.outputTokens; - } - return obj; - }, - create(base) { - return exports.GenerativeCohereMetadata_Tokens.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseGenerativeCohereMetadata_Tokens(); - message.inputTokens = (_a = object.inputTokens) !== null && _a !== void 0 ? _a : undefined; - message.outputTokens = (_b = object.outputTokens) !== null && _b !== void 0 ? _b : undefined; - return message; - }, -}; -function createBaseGenerativeDummyMetadata() { - return {}; -} -exports.GenerativeDummyMetadata = { - encode(_, writer = minimal_js_1.default.Writer.create()) { - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeDummyMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(_) { - return {}; - }, - toJSON(_) { - const obj = {}; - return obj; - }, - create(base) { - return exports.GenerativeDummyMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(_) { - const message = createBaseGenerativeDummyMetadata(); - return message; - }, -}; -function createBaseGenerativeMistralMetadata() { - return { usage: undefined }; -} -exports.GenerativeMistralMetadata = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.usage !== undefined) { - exports.GenerativeMistralMetadata_Usage.encode(message.usage, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeMistralMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.usage = exports.GenerativeMistralMetadata_Usage.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - usage: isSet(object.usage) ? exports.GenerativeMistralMetadata_Usage.fromJSON(object.usage) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.usage !== undefined) { - obj.usage = exports.GenerativeMistralMetadata_Usage.toJSON(message.usage); - } - return obj; - }, - create(base) { - return exports.GenerativeMistralMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeMistralMetadata(); - message.usage = - object.usage !== undefined && object.usage !== null - ? exports.GenerativeMistralMetadata_Usage.fromPartial(object.usage) - : undefined; - return message; - }, -}; -function createBaseGenerativeMistralMetadata_Usage() { - return { promptTokens: undefined, completionTokens: undefined, totalTokens: undefined }; -} -exports.GenerativeMistralMetadata_Usage = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.promptTokens !== undefined) { - writer.uint32(8).int64(message.promptTokens); - } - if (message.completionTokens !== undefined) { - writer.uint32(16).int64(message.completionTokens); - } - if (message.totalTokens !== undefined) { - writer.uint32(24).int64(message.totalTokens); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeMistralMetadata_Usage(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.promptTokens = longToNumber(reader.int64()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.completionTokens = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 24) { - break; - } - message.totalTokens = longToNumber(reader.int64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - promptTokens: isSet(object.promptTokens) ? globalThis.Number(object.promptTokens) : undefined, - completionTokens: isSet(object.completionTokens) - ? globalThis.Number(object.completionTokens) - : undefined, - totalTokens: isSet(object.totalTokens) ? globalThis.Number(object.totalTokens) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.promptTokens !== undefined) { - obj.promptTokens = Math.round(message.promptTokens); - } - if (message.completionTokens !== undefined) { - obj.completionTokens = Math.round(message.completionTokens); - } - if (message.totalTokens !== undefined) { - obj.totalTokens = Math.round(message.totalTokens); - } - return obj; - }, - create(base) { - return exports.GenerativeMistralMetadata_Usage.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeMistralMetadata_Usage(); - message.promptTokens = (_a = object.promptTokens) !== null && _a !== void 0 ? _a : undefined; - message.completionTokens = (_b = object.completionTokens) !== null && _b !== void 0 ? _b : undefined; - message.totalTokens = (_c = object.totalTokens) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function createBaseGenerativeOctoAIMetadata() { - return { usage: undefined }; -} -exports.GenerativeOctoAIMetadata = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.usage !== undefined) { - exports.GenerativeOctoAIMetadata_Usage.encode(message.usage, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOctoAIMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.usage = exports.GenerativeOctoAIMetadata_Usage.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - usage: isSet(object.usage) ? exports.GenerativeOctoAIMetadata_Usage.fromJSON(object.usage) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.usage !== undefined) { - obj.usage = exports.GenerativeOctoAIMetadata_Usage.toJSON(message.usage); - } - return obj; - }, - create(base) { - return exports.GenerativeOctoAIMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeOctoAIMetadata(); - message.usage = - object.usage !== undefined && object.usage !== null - ? exports.GenerativeOctoAIMetadata_Usage.fromPartial(object.usage) - : undefined; - return message; - }, -}; -function createBaseGenerativeOctoAIMetadata_Usage() { - return { promptTokens: undefined, completionTokens: undefined, totalTokens: undefined }; -} -exports.GenerativeOctoAIMetadata_Usage = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.promptTokens !== undefined) { - writer.uint32(8).int64(message.promptTokens); - } - if (message.completionTokens !== undefined) { - writer.uint32(16).int64(message.completionTokens); - } - if (message.totalTokens !== undefined) { - writer.uint32(24).int64(message.totalTokens); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOctoAIMetadata_Usage(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.promptTokens = longToNumber(reader.int64()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.completionTokens = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 24) { - break; - } - message.totalTokens = longToNumber(reader.int64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - promptTokens: isSet(object.promptTokens) ? globalThis.Number(object.promptTokens) : undefined, - completionTokens: isSet(object.completionTokens) - ? globalThis.Number(object.completionTokens) - : undefined, - totalTokens: isSet(object.totalTokens) ? globalThis.Number(object.totalTokens) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.promptTokens !== undefined) { - obj.promptTokens = Math.round(message.promptTokens); - } - if (message.completionTokens !== undefined) { - obj.completionTokens = Math.round(message.completionTokens); - } - if (message.totalTokens !== undefined) { - obj.totalTokens = Math.round(message.totalTokens); - } - return obj; - }, - create(base) { - return exports.GenerativeOctoAIMetadata_Usage.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeOctoAIMetadata_Usage(); - message.promptTokens = (_a = object.promptTokens) !== null && _a !== void 0 ? _a : undefined; - message.completionTokens = (_b = object.completionTokens) !== null && _b !== void 0 ? _b : undefined; - message.totalTokens = (_c = object.totalTokens) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function createBaseGenerativeOllamaMetadata() { - return {}; -} -exports.GenerativeOllamaMetadata = { - encode(_, writer = minimal_js_1.default.Writer.create()) { - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOllamaMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(_) { - return {}; - }, - toJSON(_) { - const obj = {}; - return obj; - }, - create(base) { - return exports.GenerativeOllamaMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(_) { - const message = createBaseGenerativeOllamaMetadata(); - return message; - }, -}; -function createBaseGenerativeOpenAIMetadata() { - return { usage: undefined }; -} -exports.GenerativeOpenAIMetadata = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.usage !== undefined) { - exports.GenerativeOpenAIMetadata_Usage.encode(message.usage, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOpenAIMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.usage = exports.GenerativeOpenAIMetadata_Usage.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - usage: isSet(object.usage) ? exports.GenerativeOpenAIMetadata_Usage.fromJSON(object.usage) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.usage !== undefined) { - obj.usage = exports.GenerativeOpenAIMetadata_Usage.toJSON(message.usage); - } - return obj; - }, - create(base) { - return exports.GenerativeOpenAIMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeOpenAIMetadata(); - message.usage = - object.usage !== undefined && object.usage !== null - ? exports.GenerativeOpenAIMetadata_Usage.fromPartial(object.usage) - : undefined; - return message; - }, -}; -function createBaseGenerativeOpenAIMetadata_Usage() { - return { promptTokens: undefined, completionTokens: undefined, totalTokens: undefined }; -} -exports.GenerativeOpenAIMetadata_Usage = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.promptTokens !== undefined) { - writer.uint32(8).int64(message.promptTokens); - } - if (message.completionTokens !== undefined) { - writer.uint32(16).int64(message.completionTokens); - } - if (message.totalTokens !== undefined) { - writer.uint32(24).int64(message.totalTokens); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOpenAIMetadata_Usage(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.promptTokens = longToNumber(reader.int64()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.completionTokens = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 24) { - break; - } - message.totalTokens = longToNumber(reader.int64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - promptTokens: isSet(object.promptTokens) ? globalThis.Number(object.promptTokens) : undefined, - completionTokens: isSet(object.completionTokens) - ? globalThis.Number(object.completionTokens) - : undefined, - totalTokens: isSet(object.totalTokens) ? globalThis.Number(object.totalTokens) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.promptTokens !== undefined) { - obj.promptTokens = Math.round(message.promptTokens); - } - if (message.completionTokens !== undefined) { - obj.completionTokens = Math.round(message.completionTokens); - } - if (message.totalTokens !== undefined) { - obj.totalTokens = Math.round(message.totalTokens); - } - return obj; - }, - create(base) { - return exports.GenerativeOpenAIMetadata_Usage.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeOpenAIMetadata_Usage(); - message.promptTokens = (_a = object.promptTokens) !== null && _a !== void 0 ? _a : undefined; - message.completionTokens = (_b = object.completionTokens) !== null && _b !== void 0 ? _b : undefined; - message.totalTokens = (_c = object.totalTokens) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function createBaseGenerativeGoogleMetadata() { - return { metadata: undefined, usageMetadata: undefined }; -} -exports.GenerativeGoogleMetadata = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.metadata !== undefined) { - exports.GenerativeGoogleMetadata_Metadata.encode(message.metadata, writer.uint32(10).fork()).ldelim(); - } - if (message.usageMetadata !== undefined) { - exports.GenerativeGoogleMetadata_UsageMetadata.encode( - message.usageMetadata, - writer.uint32(18).fork() - ).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeGoogleMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.metadata = exports.GenerativeGoogleMetadata_Metadata.decode(reader, reader.uint32()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.usageMetadata = exports.GenerativeGoogleMetadata_UsageMetadata.decode( - reader, - reader.uint32() - ); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - metadata: isSet(object.metadata) - ? exports.GenerativeGoogleMetadata_Metadata.fromJSON(object.metadata) - : undefined, - usageMetadata: isSet(object.usageMetadata) - ? exports.GenerativeGoogleMetadata_UsageMetadata.fromJSON(object.usageMetadata) - : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.metadata !== undefined) { - obj.metadata = exports.GenerativeGoogleMetadata_Metadata.toJSON(message.metadata); - } - if (message.usageMetadata !== undefined) { - obj.usageMetadata = exports.GenerativeGoogleMetadata_UsageMetadata.toJSON(message.usageMetadata); - } - return obj; - }, - create(base) { - return exports.GenerativeGoogleMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeGoogleMetadata(); - message.metadata = - object.metadata !== undefined && object.metadata !== null - ? exports.GenerativeGoogleMetadata_Metadata.fromPartial(object.metadata) - : undefined; - message.usageMetadata = - object.usageMetadata !== undefined && object.usageMetadata !== null - ? exports.GenerativeGoogleMetadata_UsageMetadata.fromPartial(object.usageMetadata) - : undefined; - return message; - }, -}; -function createBaseGenerativeGoogleMetadata_TokenCount() { - return { totalBillableCharacters: undefined, totalTokens: undefined }; -} -exports.GenerativeGoogleMetadata_TokenCount = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.totalBillableCharacters !== undefined) { - writer.uint32(8).int64(message.totalBillableCharacters); - } - if (message.totalTokens !== undefined) { - writer.uint32(16).int64(message.totalTokens); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeGoogleMetadata_TokenCount(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.totalBillableCharacters = longToNumber(reader.int64()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.totalTokens = longToNumber(reader.int64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - totalBillableCharacters: isSet(object.totalBillableCharacters) - ? globalThis.Number(object.totalBillableCharacters) - : undefined, - totalTokens: isSet(object.totalTokens) ? globalThis.Number(object.totalTokens) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.totalBillableCharacters !== undefined) { - obj.totalBillableCharacters = Math.round(message.totalBillableCharacters); - } - if (message.totalTokens !== undefined) { - obj.totalTokens = Math.round(message.totalTokens); - } - return obj; - }, - create(base) { - return exports.GenerativeGoogleMetadata_TokenCount.fromPartial( - base !== null && base !== void 0 ? base : {} - ); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseGenerativeGoogleMetadata_TokenCount(); - message.totalBillableCharacters = - (_a = object.totalBillableCharacters) !== null && _a !== void 0 ? _a : undefined; - message.totalTokens = (_b = object.totalTokens) !== null && _b !== void 0 ? _b : undefined; - return message; - }, -}; -function createBaseGenerativeGoogleMetadata_TokenMetadata() { - return { inputTokenCount: undefined, outputTokenCount: undefined }; -} -exports.GenerativeGoogleMetadata_TokenMetadata = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.inputTokenCount !== undefined) { - exports.GenerativeGoogleMetadata_TokenCount.encode( - message.inputTokenCount, - writer.uint32(10).fork() - ).ldelim(); - } - if (message.outputTokenCount !== undefined) { - exports.GenerativeGoogleMetadata_TokenCount.encode( - message.outputTokenCount, - writer.uint32(18).fork() - ).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeGoogleMetadata_TokenMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.inputTokenCount = exports.GenerativeGoogleMetadata_TokenCount.decode( - reader, - reader.uint32() - ); - continue; - case 2: - if (tag !== 18) { - break; - } - message.outputTokenCount = exports.GenerativeGoogleMetadata_TokenCount.decode( - reader, - reader.uint32() - ); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - inputTokenCount: isSet(object.inputTokenCount) - ? exports.GenerativeGoogleMetadata_TokenCount.fromJSON(object.inputTokenCount) - : undefined, - outputTokenCount: isSet(object.outputTokenCount) - ? exports.GenerativeGoogleMetadata_TokenCount.fromJSON(object.outputTokenCount) - : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.inputTokenCount !== undefined) { - obj.inputTokenCount = exports.GenerativeGoogleMetadata_TokenCount.toJSON(message.inputTokenCount); - } - if (message.outputTokenCount !== undefined) { - obj.outputTokenCount = exports.GenerativeGoogleMetadata_TokenCount.toJSON(message.outputTokenCount); - } - return obj; - }, - create(base) { - return exports.GenerativeGoogleMetadata_TokenMetadata.fromPartial( - base !== null && base !== void 0 ? base : {} - ); - }, - fromPartial(object) { - const message = createBaseGenerativeGoogleMetadata_TokenMetadata(); - message.inputTokenCount = - object.inputTokenCount !== undefined && object.inputTokenCount !== null - ? exports.GenerativeGoogleMetadata_TokenCount.fromPartial(object.inputTokenCount) - : undefined; - message.outputTokenCount = - object.outputTokenCount !== undefined && object.outputTokenCount !== null - ? exports.GenerativeGoogleMetadata_TokenCount.fromPartial(object.outputTokenCount) - : undefined; - return message; - }, -}; -function createBaseGenerativeGoogleMetadata_Metadata() { - return { tokenMetadata: undefined }; -} -exports.GenerativeGoogleMetadata_Metadata = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.tokenMetadata !== undefined) { - exports.GenerativeGoogleMetadata_TokenMetadata.encode( - message.tokenMetadata, - writer.uint32(10).fork() - ).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeGoogleMetadata_Metadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.tokenMetadata = exports.GenerativeGoogleMetadata_TokenMetadata.decode( - reader, - reader.uint32() - ); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - tokenMetadata: isSet(object.tokenMetadata) - ? exports.GenerativeGoogleMetadata_TokenMetadata.fromJSON(object.tokenMetadata) - : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.tokenMetadata !== undefined) { - obj.tokenMetadata = exports.GenerativeGoogleMetadata_TokenMetadata.toJSON(message.tokenMetadata); - } - return obj; - }, - create(base) { - return exports.GenerativeGoogleMetadata_Metadata.fromPartial( - base !== null && base !== void 0 ? base : {} - ); - }, - fromPartial(object) { - const message = createBaseGenerativeGoogleMetadata_Metadata(); - message.tokenMetadata = - object.tokenMetadata !== undefined && object.tokenMetadata !== null - ? exports.GenerativeGoogleMetadata_TokenMetadata.fromPartial(object.tokenMetadata) - : undefined; - return message; - }, -}; -function createBaseGenerativeGoogleMetadata_UsageMetadata() { - return { promptTokenCount: undefined, candidatesTokenCount: undefined, totalTokenCount: undefined }; -} -exports.GenerativeGoogleMetadata_UsageMetadata = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.promptTokenCount !== undefined) { - writer.uint32(8).int64(message.promptTokenCount); - } - if (message.candidatesTokenCount !== undefined) { - writer.uint32(16).int64(message.candidatesTokenCount); - } - if (message.totalTokenCount !== undefined) { - writer.uint32(24).int64(message.totalTokenCount); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeGoogleMetadata_UsageMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.promptTokenCount = longToNumber(reader.int64()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.candidatesTokenCount = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 24) { - break; - } - message.totalTokenCount = longToNumber(reader.int64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - promptTokenCount: isSet(object.promptTokenCount) - ? globalThis.Number(object.promptTokenCount) - : undefined, - candidatesTokenCount: isSet(object.candidatesTokenCount) - ? globalThis.Number(object.candidatesTokenCount) - : undefined, - totalTokenCount: isSet(object.totalTokenCount) ? globalThis.Number(object.totalTokenCount) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.promptTokenCount !== undefined) { - obj.promptTokenCount = Math.round(message.promptTokenCount); - } - if (message.candidatesTokenCount !== undefined) { - obj.candidatesTokenCount = Math.round(message.candidatesTokenCount); - } - if (message.totalTokenCount !== undefined) { - obj.totalTokenCount = Math.round(message.totalTokenCount); - } - return obj; - }, - create(base) { - return exports.GenerativeGoogleMetadata_UsageMetadata.fromPartial( - base !== null && base !== void 0 ? base : {} - ); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeGoogleMetadata_UsageMetadata(); - message.promptTokenCount = (_a = object.promptTokenCount) !== null && _a !== void 0 ? _a : undefined; - message.candidatesTokenCount = - (_b = object.candidatesTokenCount) !== null && _b !== void 0 ? _b : undefined; - message.totalTokenCount = (_c = object.totalTokenCount) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function createBaseGenerativeMetadata() { - return { - anthropic: undefined, - anyscale: undefined, - aws: undefined, - cohere: undefined, - dummy: undefined, - mistral: undefined, - octoai: undefined, - ollama: undefined, - openai: undefined, - google: undefined, - }; -} -exports.GenerativeMetadata = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.anthropic !== undefined) { - exports.GenerativeAnthropicMetadata.encode(message.anthropic, writer.uint32(10).fork()).ldelim(); - } - if (message.anyscale !== undefined) { - exports.GenerativeAnyscaleMetadata.encode(message.anyscale, writer.uint32(18).fork()).ldelim(); - } - if (message.aws !== undefined) { - exports.GenerativeAWSMetadata.encode(message.aws, writer.uint32(26).fork()).ldelim(); - } - if (message.cohere !== undefined) { - exports.GenerativeCohereMetadata.encode(message.cohere, writer.uint32(34).fork()).ldelim(); - } - if (message.dummy !== undefined) { - exports.GenerativeDummyMetadata.encode(message.dummy, writer.uint32(42).fork()).ldelim(); - } - if (message.mistral !== undefined) { - exports.GenerativeMistralMetadata.encode(message.mistral, writer.uint32(50).fork()).ldelim(); - } - if (message.octoai !== undefined) { - exports.GenerativeOctoAIMetadata.encode(message.octoai, writer.uint32(58).fork()).ldelim(); - } - if (message.ollama !== undefined) { - exports.GenerativeOllamaMetadata.encode(message.ollama, writer.uint32(66).fork()).ldelim(); - } - if (message.openai !== undefined) { - exports.GenerativeOpenAIMetadata.encode(message.openai, writer.uint32(74).fork()).ldelim(); - } - if (message.google !== undefined) { - exports.GenerativeGoogleMetadata.encode(message.google, writer.uint32(82).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.anthropic = exports.GenerativeAnthropicMetadata.decode(reader, reader.uint32()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.anyscale = exports.GenerativeAnyscaleMetadata.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.aws = exports.GenerativeAWSMetadata.decode(reader, reader.uint32()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.cohere = exports.GenerativeCohereMetadata.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.dummy = exports.GenerativeDummyMetadata.decode(reader, reader.uint32()); - continue; - case 6: - if (tag !== 50) { - break; - } - message.mistral = exports.GenerativeMistralMetadata.decode(reader, reader.uint32()); - continue; - case 7: - if (tag !== 58) { - break; - } - message.octoai = exports.GenerativeOctoAIMetadata.decode(reader, reader.uint32()); - continue; - case 8: - if (tag !== 66) { - break; - } - message.ollama = exports.GenerativeOllamaMetadata.decode(reader, reader.uint32()); - continue; - case 9: - if (tag !== 74) { - break; - } - message.openai = exports.GenerativeOpenAIMetadata.decode(reader, reader.uint32()); - continue; - case 10: - if (tag !== 82) { - break; - } - message.google = exports.GenerativeGoogleMetadata.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - anthropic: isSet(object.anthropic) - ? exports.GenerativeAnthropicMetadata.fromJSON(object.anthropic) - : undefined, - anyscale: isSet(object.anyscale) - ? exports.GenerativeAnyscaleMetadata.fromJSON(object.anyscale) - : undefined, - aws: isSet(object.aws) ? exports.GenerativeAWSMetadata.fromJSON(object.aws) : undefined, - cohere: isSet(object.cohere) ? exports.GenerativeCohereMetadata.fromJSON(object.cohere) : undefined, - dummy: isSet(object.dummy) ? exports.GenerativeDummyMetadata.fromJSON(object.dummy) : undefined, - mistral: isSet(object.mistral) ? exports.GenerativeMistralMetadata.fromJSON(object.mistral) : undefined, - octoai: isSet(object.octoai) ? exports.GenerativeOctoAIMetadata.fromJSON(object.octoai) : undefined, - ollama: isSet(object.ollama) ? exports.GenerativeOllamaMetadata.fromJSON(object.ollama) : undefined, - openai: isSet(object.openai) ? exports.GenerativeOpenAIMetadata.fromJSON(object.openai) : undefined, - google: isSet(object.google) ? exports.GenerativeGoogleMetadata.fromJSON(object.google) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.anthropic !== undefined) { - obj.anthropic = exports.GenerativeAnthropicMetadata.toJSON(message.anthropic); - } - if (message.anyscale !== undefined) { - obj.anyscale = exports.GenerativeAnyscaleMetadata.toJSON(message.anyscale); - } - if (message.aws !== undefined) { - obj.aws = exports.GenerativeAWSMetadata.toJSON(message.aws); - } - if (message.cohere !== undefined) { - obj.cohere = exports.GenerativeCohereMetadata.toJSON(message.cohere); - } - if (message.dummy !== undefined) { - obj.dummy = exports.GenerativeDummyMetadata.toJSON(message.dummy); - } - if (message.mistral !== undefined) { - obj.mistral = exports.GenerativeMistralMetadata.toJSON(message.mistral); - } - if (message.octoai !== undefined) { - obj.octoai = exports.GenerativeOctoAIMetadata.toJSON(message.octoai); - } - if (message.ollama !== undefined) { - obj.ollama = exports.GenerativeOllamaMetadata.toJSON(message.ollama); - } - if (message.openai !== undefined) { - obj.openai = exports.GenerativeOpenAIMetadata.toJSON(message.openai); - } - if (message.google !== undefined) { - obj.google = exports.GenerativeGoogleMetadata.toJSON(message.google); - } - return obj; - }, - create(base) { - return exports.GenerativeMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeMetadata(); - message.anthropic = - object.anthropic !== undefined && object.anthropic !== null - ? exports.GenerativeAnthropicMetadata.fromPartial(object.anthropic) - : undefined; - message.anyscale = - object.anyscale !== undefined && object.anyscale !== null - ? exports.GenerativeAnyscaleMetadata.fromPartial(object.anyscale) - : undefined; - message.aws = - object.aws !== undefined && object.aws !== null - ? exports.GenerativeAWSMetadata.fromPartial(object.aws) - : undefined; - message.cohere = - object.cohere !== undefined && object.cohere !== null - ? exports.GenerativeCohereMetadata.fromPartial(object.cohere) - : undefined; - message.dummy = - object.dummy !== undefined && object.dummy !== null - ? exports.GenerativeDummyMetadata.fromPartial(object.dummy) - : undefined; - message.mistral = - object.mistral !== undefined && object.mistral !== null - ? exports.GenerativeMistralMetadata.fromPartial(object.mistral) - : undefined; - message.octoai = - object.octoai !== undefined && object.octoai !== null - ? exports.GenerativeOctoAIMetadata.fromPartial(object.octoai) - : undefined; - message.ollama = - object.ollama !== undefined && object.ollama !== null - ? exports.GenerativeOllamaMetadata.fromPartial(object.ollama) - : undefined; - message.openai = - object.openai !== undefined && object.openai !== null - ? exports.GenerativeOpenAIMetadata.fromPartial(object.openai) - : undefined; - message.google = - object.google !== undefined && object.google !== null - ? exports.GenerativeGoogleMetadata.fromPartial(object.google) - : undefined; - return message; - }, -}; -function createBaseGenerativeReply() { - return { result: '', debug: undefined, metadata: undefined }; -} -exports.GenerativeReply = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.result !== '') { - writer.uint32(10).string(message.result); - } - if (message.debug !== undefined) { - exports.GenerativeDebug.encode(message.debug, writer.uint32(18).fork()).ldelim(); - } - if (message.metadata !== undefined) { - exports.GenerativeMetadata.encode(message.metadata, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeReply(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.result = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.debug = exports.GenerativeDebug.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.metadata = exports.GenerativeMetadata.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - result: isSet(object.result) ? globalThis.String(object.result) : '', - debug: isSet(object.debug) ? exports.GenerativeDebug.fromJSON(object.debug) : undefined, - metadata: isSet(object.metadata) ? exports.GenerativeMetadata.fromJSON(object.metadata) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.result !== '') { - obj.result = message.result; - } - if (message.debug !== undefined) { - obj.debug = exports.GenerativeDebug.toJSON(message.debug); - } - if (message.metadata !== undefined) { - obj.metadata = exports.GenerativeMetadata.toJSON(message.metadata); - } - return obj; - }, - create(base) { - return exports.GenerativeReply.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseGenerativeReply(); - message.result = (_a = object.result) !== null && _a !== void 0 ? _a : ''; - message.debug = - object.debug !== undefined && object.debug !== null - ? exports.GenerativeDebug.fromPartial(object.debug) - : undefined; - message.metadata = - object.metadata !== undefined && object.metadata !== null - ? exports.GenerativeMetadata.fromPartial(object.metadata) - : undefined; - return message; - }, -}; -function createBaseGenerativeResult() { - return { values: [] }; -} -exports.GenerativeResult = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.values) { - exports.GenerativeReply.encode(v, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeResult(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(exports.GenerativeReply.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => exports.GenerativeReply.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values.map((e) => exports.GenerativeReply.toJSON(e)); - } - return obj; - }, - create(base) { - return exports.GenerativeResult.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseGenerativeResult(); - message.values = - ((_a = object.values) === null || _a === void 0 - ? void 0 - : _a.map((e) => exports.GenerativeReply.fromPartial(e))) || []; - return message; - }, -}; -function createBaseGenerativeDebug() { - return { fullPrompt: undefined }; -} -exports.GenerativeDebug = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.fullPrompt !== undefined) { - writer.uint32(10).string(message.fullPrompt); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeDebug(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.fullPrompt = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { fullPrompt: isSet(object.fullPrompt) ? globalThis.String(object.fullPrompt) : undefined }; - }, - toJSON(message) { - const obj = {}; - if (message.fullPrompt !== undefined) { - obj.fullPrompt = message.fullPrompt; - } - return obj; - }, - create(base) { - return exports.GenerativeDebug.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseGenerativeDebug(); - message.fullPrompt = (_a = object.fullPrompt) !== null && _a !== void 0 ? _a : undefined; - return message; - }, -}; -function longToNumber(long) { - if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { - throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); - } - return long.toNumber(); -} -if (minimal_js_1.default.util.Long !== long_1.default) { - minimal_js_1.default.util.Long = long_1.default; - minimal_js_1.default.configure(); -} -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/cjs/proto/v1/properties.d.ts b/dist/node/cjs/proto/v1/properties.d.ts deleted file mode 100644 index 6829c255..00000000 --- a/dist/node/cjs/proto/v1/properties.d.ts +++ /dev/null @@ -1,198 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -import { NullValue } from '../google/protobuf/struct.js'; -export declare const protobufPackage = 'weaviate.v1'; -export interface Properties { - fields: { - [key: string]: Value; - }; -} -export interface Properties_FieldsEntry { - key: string; - value: Value | undefined; -} -export interface Value { - numberValue?: number | undefined; - /** @deprecated */ - stringValue?: string | undefined; - boolValue?: boolean | undefined; - objectValue?: Properties | undefined; - listValue?: ListValue | undefined; - dateValue?: string | undefined; - uuidValue?: string | undefined; - intValue?: number | undefined; - geoValue?: GeoCoordinate | undefined; - blobValue?: string | undefined; - phoneValue?: PhoneNumber | undefined; - nullValue?: NullValue | undefined; - textValue?: string | undefined; -} -export interface ListValue { - /** @deprecated */ - values: Value[]; - numberValues?: NumberValues | undefined; - boolValues?: BoolValues | undefined; - objectValues?: ObjectValues | undefined; - dateValues?: DateValues | undefined; - uuidValues?: UuidValues | undefined; - intValues?: IntValues | undefined; - textValues?: TextValues | undefined; -} -export interface NumberValues { - /** - * The values are stored as a byte array, where each 8 bytes represent a single float64 value. - * The byte array is stored in little-endian order using uint64 encoding. - */ - values: Uint8Array; -} -export interface TextValues { - values: string[]; -} -export interface BoolValues { - values: boolean[]; -} -export interface ObjectValues { - values: Properties[]; -} -export interface DateValues { - values: string[]; -} -export interface UuidValues { - values: string[]; -} -export interface IntValues { - /** - * The values are stored as a byte array, where each 8 bytes represent a single int64 value. - * The byte array is stored in little-endian order using uint64 encoding. - */ - values: Uint8Array; -} -export interface GeoCoordinate { - longitude: number; - latitude: number; -} -export interface PhoneNumber { - countryCode: number; - defaultCountry: string; - input: string; - internationalFormatted: string; - national: number; - nationalFormatted: string; - valid: boolean; -} -export declare const Properties: { - encode(message: Properties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Properties; - fromJSON(object: any): Properties; - toJSON(message: Properties): unknown; - create(base?: DeepPartial): Properties; - fromPartial(object: DeepPartial): Properties; -}; -export declare const Properties_FieldsEntry: { - encode(message: Properties_FieldsEntry, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Properties_FieldsEntry; - fromJSON(object: any): Properties_FieldsEntry; - toJSON(message: Properties_FieldsEntry): unknown; - create(base?: DeepPartial): Properties_FieldsEntry; - fromPartial(object: DeepPartial): Properties_FieldsEntry; -}; -export declare const Value: { - encode(message: Value, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Value; - fromJSON(object: any): Value; - toJSON(message: Value): unknown; - create(base?: DeepPartial): Value; - fromPartial(object: DeepPartial): Value; -}; -export declare const ListValue: { - encode(message: ListValue, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): ListValue; - fromJSON(object: any): ListValue; - toJSON(message: ListValue): unknown; - create(base?: DeepPartial): ListValue; - fromPartial(object: DeepPartial): ListValue; -}; -export declare const NumberValues: { - encode(message: NumberValues, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NumberValues; - fromJSON(object: any): NumberValues; - toJSON(message: NumberValues): unknown; - create(base?: DeepPartial): NumberValues; - fromPartial(object: DeepPartial): NumberValues; -}; -export declare const TextValues: { - encode(message: TextValues, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): TextValues; - fromJSON(object: any): TextValues; - toJSON(message: TextValues): unknown; - create(base?: DeepPartial): TextValues; - fromPartial(object: DeepPartial): TextValues; -}; -export declare const BoolValues: { - encode(message: BoolValues, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BoolValues; - fromJSON(object: any): BoolValues; - toJSON(message: BoolValues): unknown; - create(base?: DeepPartial): BoolValues; - fromPartial(object: DeepPartial): BoolValues; -}; -export declare const ObjectValues: { - encode(message: ObjectValues, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): ObjectValues; - fromJSON(object: any): ObjectValues; - toJSON(message: ObjectValues): unknown; - create(base?: DeepPartial): ObjectValues; - fromPartial(object: DeepPartial): ObjectValues; -}; -export declare const DateValues: { - encode(message: DateValues, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): DateValues; - fromJSON(object: any): DateValues; - toJSON(message: DateValues): unknown; - create(base?: DeepPartial): DateValues; - fromPartial(object: DeepPartial): DateValues; -}; -export declare const UuidValues: { - encode(message: UuidValues, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): UuidValues; - fromJSON(object: any): UuidValues; - toJSON(message: UuidValues): unknown; - create(base?: DeepPartial): UuidValues; - fromPartial(object: DeepPartial): UuidValues; -}; -export declare const IntValues: { - encode(message: IntValues, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): IntValues; - fromJSON(object: any): IntValues; - toJSON(message: IntValues): unknown; - create(base?: DeepPartial): IntValues; - fromPartial(object: DeepPartial): IntValues; -}; -export declare const GeoCoordinate: { - encode(message: GeoCoordinate, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GeoCoordinate; - fromJSON(object: any): GeoCoordinate; - toJSON(message: GeoCoordinate): unknown; - create(base?: DeepPartial): GeoCoordinate; - fromPartial(object: DeepPartial): GeoCoordinate; -}; -export declare const PhoneNumber: { - encode(message: PhoneNumber, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): PhoneNumber; - fromJSON(object: any): PhoneNumber; - toJSON(message: PhoneNumber): unknown; - create(base?: DeepPartial): PhoneNumber; - fromPartial(object: DeepPartial): PhoneNumber; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/cjs/proto/v1/properties.js b/dist/node/cjs/proto/v1/properties.js deleted file mode 100644 index 903b93ef..00000000 --- a/dist/node/cjs/proto/v1/properties.js +++ /dev/null @@ -1,1275 +0,0 @@ -'use strict'; -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/properties.proto -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.PhoneNumber = - exports.GeoCoordinate = - exports.IntValues = - exports.UuidValues = - exports.DateValues = - exports.ObjectValues = - exports.BoolValues = - exports.TextValues = - exports.NumberValues = - exports.ListValue = - exports.Value = - exports.Properties_FieldsEntry = - exports.Properties = - exports.protobufPackage = - void 0; -/* eslint-disable */ -const long_1 = __importDefault(require('long')); -const minimal_js_1 = __importDefault(require('protobufjs/minimal.js')); -const struct_js_1 = require('../google/protobuf/struct.js'); -exports.protobufPackage = 'weaviate.v1'; -function createBaseProperties() { - return { fields: {} }; -} -exports.Properties = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - Object.entries(message.fields).forEach(([key, value]) => { - exports.Properties_FieldsEntry.encode({ key: key, value }, writer.uint32(10).fork()).ldelim(); - }); - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - const entry1 = exports.Properties_FieldsEntry.decode(reader, reader.uint32()); - if (entry1.value !== undefined) { - message.fields[entry1.key] = entry1.value; - } - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - fields: isObject(object.fields) - ? Object.entries(object.fields).reduce((acc, [key, value]) => { - acc[key] = exports.Value.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - toJSON(message) { - const obj = {}; - if (message.fields) { - const entries = Object.entries(message.fields); - if (entries.length > 0) { - obj.fields = {}; - entries.forEach(([k, v]) => { - obj.fields[k] = exports.Value.toJSON(v); - }); - } - } - return obj; - }, - create(base) { - return exports.Properties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseProperties(); - message.fields = Object.entries((_a = object.fields) !== null && _a !== void 0 ? _a : {}).reduce( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = exports.Value.fromPartial(value); - } - return acc; - }, - {} - ); - return message; - }, -}; -function createBaseProperties_FieldsEntry() { - return { key: '', value: undefined }; -} -exports.Properties_FieldsEntry = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.key !== '') { - writer.uint32(10).string(message.key); - } - if (message.value !== undefined) { - exports.Value.encode(message.value, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseProperties_FieldsEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.key = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.value = exports.Value.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - key: isSet(object.key) ? globalThis.String(object.key) : '', - value: isSet(object.value) ? exports.Value.fromJSON(object.value) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.key !== '') { - obj.key = message.key; - } - if (message.value !== undefined) { - obj.value = exports.Value.toJSON(message.value); - } - return obj; - }, - create(base) { - return exports.Properties_FieldsEntry.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseProperties_FieldsEntry(); - message.key = (_a = object.key) !== null && _a !== void 0 ? _a : ''; - message.value = - object.value !== undefined && object.value !== null - ? exports.Value.fromPartial(object.value) - : undefined; - return message; - }, -}; -function createBaseValue() { - return { - numberValue: undefined, - stringValue: undefined, - boolValue: undefined, - objectValue: undefined, - listValue: undefined, - dateValue: undefined, - uuidValue: undefined, - intValue: undefined, - geoValue: undefined, - blobValue: undefined, - phoneValue: undefined, - nullValue: undefined, - textValue: undefined, - }; -} -exports.Value = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.numberValue !== undefined) { - writer.uint32(9).double(message.numberValue); - } - if (message.stringValue !== undefined) { - writer.uint32(18).string(message.stringValue); - } - if (message.boolValue !== undefined) { - writer.uint32(24).bool(message.boolValue); - } - if (message.objectValue !== undefined) { - exports.Properties.encode(message.objectValue, writer.uint32(34).fork()).ldelim(); - } - if (message.listValue !== undefined) { - exports.ListValue.encode(message.listValue, writer.uint32(42).fork()).ldelim(); - } - if (message.dateValue !== undefined) { - writer.uint32(50).string(message.dateValue); - } - if (message.uuidValue !== undefined) { - writer.uint32(58).string(message.uuidValue); - } - if (message.intValue !== undefined) { - writer.uint32(64).int64(message.intValue); - } - if (message.geoValue !== undefined) { - exports.GeoCoordinate.encode(message.geoValue, writer.uint32(74).fork()).ldelim(); - } - if (message.blobValue !== undefined) { - writer.uint32(82).string(message.blobValue); - } - if (message.phoneValue !== undefined) { - exports.PhoneNumber.encode(message.phoneValue, writer.uint32(90).fork()).ldelim(); - } - if (message.nullValue !== undefined) { - writer.uint32(96).int32(message.nullValue); - } - if (message.textValue !== undefined) { - writer.uint32(106).string(message.textValue); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseValue(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 9) { - break; - } - message.numberValue = reader.double(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.stringValue = reader.string(); - continue; - case 3: - if (tag !== 24) { - break; - } - message.boolValue = reader.bool(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.objectValue = exports.Properties.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.listValue = exports.ListValue.decode(reader, reader.uint32()); - continue; - case 6: - if (tag !== 50) { - break; - } - message.dateValue = reader.string(); - continue; - case 7: - if (tag !== 58) { - break; - } - message.uuidValue = reader.string(); - continue; - case 8: - if (tag !== 64) { - break; - } - message.intValue = longToNumber(reader.int64()); - continue; - case 9: - if (tag !== 74) { - break; - } - message.geoValue = exports.GeoCoordinate.decode(reader, reader.uint32()); - continue; - case 10: - if (tag !== 82) { - break; - } - message.blobValue = reader.string(); - continue; - case 11: - if (tag !== 90) { - break; - } - message.phoneValue = exports.PhoneNumber.decode(reader, reader.uint32()); - continue; - case 12: - if (tag !== 96) { - break; - } - message.nullValue = reader.int32(); - continue; - case 13: - if (tag !== 106) { - break; - } - message.textValue = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - numberValue: isSet(object.numberValue) ? globalThis.Number(object.numberValue) : undefined, - stringValue: isSet(object.stringValue) ? globalThis.String(object.stringValue) : undefined, - boolValue: isSet(object.boolValue) ? globalThis.Boolean(object.boolValue) : undefined, - objectValue: isSet(object.objectValue) ? exports.Properties.fromJSON(object.objectValue) : undefined, - listValue: isSet(object.listValue) ? exports.ListValue.fromJSON(object.listValue) : undefined, - dateValue: isSet(object.dateValue) ? globalThis.String(object.dateValue) : undefined, - uuidValue: isSet(object.uuidValue) ? globalThis.String(object.uuidValue) : undefined, - intValue: isSet(object.intValue) ? globalThis.Number(object.intValue) : undefined, - geoValue: isSet(object.geoValue) ? exports.GeoCoordinate.fromJSON(object.geoValue) : undefined, - blobValue: isSet(object.blobValue) ? globalThis.String(object.blobValue) : undefined, - phoneValue: isSet(object.phoneValue) ? exports.PhoneNumber.fromJSON(object.phoneValue) : undefined, - nullValue: isSet(object.nullValue) ? (0, struct_js_1.nullValueFromJSON)(object.nullValue) : undefined, - textValue: isSet(object.textValue) ? globalThis.String(object.textValue) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.numberValue !== undefined) { - obj.numberValue = message.numberValue; - } - if (message.stringValue !== undefined) { - obj.stringValue = message.stringValue; - } - if (message.boolValue !== undefined) { - obj.boolValue = message.boolValue; - } - if (message.objectValue !== undefined) { - obj.objectValue = exports.Properties.toJSON(message.objectValue); - } - if (message.listValue !== undefined) { - obj.listValue = exports.ListValue.toJSON(message.listValue); - } - if (message.dateValue !== undefined) { - obj.dateValue = message.dateValue; - } - if (message.uuidValue !== undefined) { - obj.uuidValue = message.uuidValue; - } - if (message.intValue !== undefined) { - obj.intValue = Math.round(message.intValue); - } - if (message.geoValue !== undefined) { - obj.geoValue = exports.GeoCoordinate.toJSON(message.geoValue); - } - if (message.blobValue !== undefined) { - obj.blobValue = message.blobValue; - } - if (message.phoneValue !== undefined) { - obj.phoneValue = exports.PhoneNumber.toJSON(message.phoneValue); - } - if (message.nullValue !== undefined) { - obj.nullValue = (0, struct_js_1.nullValueToJSON)(message.nullValue); - } - if (message.textValue !== undefined) { - obj.textValue = message.textValue; - } - return obj; - }, - create(base) { - return exports.Value.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - const message = createBaseValue(); - message.numberValue = (_a = object.numberValue) !== null && _a !== void 0 ? _a : undefined; - message.stringValue = (_b = object.stringValue) !== null && _b !== void 0 ? _b : undefined; - message.boolValue = (_c = object.boolValue) !== null && _c !== void 0 ? _c : undefined; - message.objectValue = - object.objectValue !== undefined && object.objectValue !== null - ? exports.Properties.fromPartial(object.objectValue) - : undefined; - message.listValue = - object.listValue !== undefined && object.listValue !== null - ? exports.ListValue.fromPartial(object.listValue) - : undefined; - message.dateValue = (_d = object.dateValue) !== null && _d !== void 0 ? _d : undefined; - message.uuidValue = (_e = object.uuidValue) !== null && _e !== void 0 ? _e : undefined; - message.intValue = (_f = object.intValue) !== null && _f !== void 0 ? _f : undefined; - message.geoValue = - object.geoValue !== undefined && object.geoValue !== null - ? exports.GeoCoordinate.fromPartial(object.geoValue) - : undefined; - message.blobValue = (_g = object.blobValue) !== null && _g !== void 0 ? _g : undefined; - message.phoneValue = - object.phoneValue !== undefined && object.phoneValue !== null - ? exports.PhoneNumber.fromPartial(object.phoneValue) - : undefined; - message.nullValue = (_h = object.nullValue) !== null && _h !== void 0 ? _h : undefined; - message.textValue = (_j = object.textValue) !== null && _j !== void 0 ? _j : undefined; - return message; - }, -}; -function createBaseListValue() { - return { - values: [], - numberValues: undefined, - boolValues: undefined, - objectValues: undefined, - dateValues: undefined, - uuidValues: undefined, - intValues: undefined, - textValues: undefined, - }; -} -exports.ListValue = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.values) { - exports.Value.encode(v, writer.uint32(10).fork()).ldelim(); - } - if (message.numberValues !== undefined) { - exports.NumberValues.encode(message.numberValues, writer.uint32(18).fork()).ldelim(); - } - if (message.boolValues !== undefined) { - exports.BoolValues.encode(message.boolValues, writer.uint32(26).fork()).ldelim(); - } - if (message.objectValues !== undefined) { - exports.ObjectValues.encode(message.objectValues, writer.uint32(34).fork()).ldelim(); - } - if (message.dateValues !== undefined) { - exports.DateValues.encode(message.dateValues, writer.uint32(42).fork()).ldelim(); - } - if (message.uuidValues !== undefined) { - exports.UuidValues.encode(message.uuidValues, writer.uint32(50).fork()).ldelim(); - } - if (message.intValues !== undefined) { - exports.IntValues.encode(message.intValues, writer.uint32(58).fork()).ldelim(); - } - if (message.textValues !== undefined) { - exports.TextValues.encode(message.textValues, writer.uint32(66).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListValue(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(exports.Value.decode(reader, reader.uint32())); - continue; - case 2: - if (tag !== 18) { - break; - } - message.numberValues = exports.NumberValues.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.boolValues = exports.BoolValues.decode(reader, reader.uint32()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.objectValues = exports.ObjectValues.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.dateValues = exports.DateValues.decode(reader, reader.uint32()); - continue; - case 6: - if (tag !== 50) { - break; - } - message.uuidValues = exports.UuidValues.decode(reader, reader.uint32()); - continue; - case 7: - if (tag !== 58) { - break; - } - message.intValues = exports.IntValues.decode(reader, reader.uint32()); - continue; - case 8: - if (tag !== 66) { - break; - } - message.textValues = exports.TextValues.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => exports.Value.fromJSON(e)) - : [], - numberValues: isSet(object.numberValues) - ? exports.NumberValues.fromJSON(object.numberValues) - : undefined, - boolValues: isSet(object.boolValues) ? exports.BoolValues.fromJSON(object.boolValues) : undefined, - objectValues: isSet(object.objectValues) - ? exports.ObjectValues.fromJSON(object.objectValues) - : undefined, - dateValues: isSet(object.dateValues) ? exports.DateValues.fromJSON(object.dateValues) : undefined, - uuidValues: isSet(object.uuidValues) ? exports.UuidValues.fromJSON(object.uuidValues) : undefined, - intValues: isSet(object.intValues) ? exports.IntValues.fromJSON(object.intValues) : undefined, - textValues: isSet(object.textValues) ? exports.TextValues.fromJSON(object.textValues) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values.map((e) => exports.Value.toJSON(e)); - } - if (message.numberValues !== undefined) { - obj.numberValues = exports.NumberValues.toJSON(message.numberValues); - } - if (message.boolValues !== undefined) { - obj.boolValues = exports.BoolValues.toJSON(message.boolValues); - } - if (message.objectValues !== undefined) { - obj.objectValues = exports.ObjectValues.toJSON(message.objectValues); - } - if (message.dateValues !== undefined) { - obj.dateValues = exports.DateValues.toJSON(message.dateValues); - } - if (message.uuidValues !== undefined) { - obj.uuidValues = exports.UuidValues.toJSON(message.uuidValues); - } - if (message.intValues !== undefined) { - obj.intValues = exports.IntValues.toJSON(message.intValues); - } - if (message.textValues !== undefined) { - obj.textValues = exports.TextValues.toJSON(message.textValues); - } - return obj; - }, - create(base) { - return exports.ListValue.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseListValue(); - message.values = - ((_a = object.values) === null || _a === void 0 - ? void 0 - : _a.map((e) => exports.Value.fromPartial(e))) || []; - message.numberValues = - object.numberValues !== undefined && object.numberValues !== null - ? exports.NumberValues.fromPartial(object.numberValues) - : undefined; - message.boolValues = - object.boolValues !== undefined && object.boolValues !== null - ? exports.BoolValues.fromPartial(object.boolValues) - : undefined; - message.objectValues = - object.objectValues !== undefined && object.objectValues !== null - ? exports.ObjectValues.fromPartial(object.objectValues) - : undefined; - message.dateValues = - object.dateValues !== undefined && object.dateValues !== null - ? exports.DateValues.fromPartial(object.dateValues) - : undefined; - message.uuidValues = - object.uuidValues !== undefined && object.uuidValues !== null - ? exports.UuidValues.fromPartial(object.uuidValues) - : undefined; - message.intValues = - object.intValues !== undefined && object.intValues !== null - ? exports.IntValues.fromPartial(object.intValues) - : undefined; - message.textValues = - object.textValues !== undefined && object.textValues !== null - ? exports.TextValues.fromPartial(object.textValues) - : undefined; - return message; - }, -}; -function createBaseNumberValues() { - return { values: new Uint8Array(0) }; -} -exports.NumberValues = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.values.length !== 0) { - writer.uint32(10).bytes(message.values); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNumberValues(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values = reader.bytes(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { values: isSet(object.values) ? bytesFromBase64(object.values) : new Uint8Array(0) }; - }, - toJSON(message) { - const obj = {}; - if (message.values.length !== 0) { - obj.values = base64FromBytes(message.values); - } - return obj; - }, - create(base) { - return exports.NumberValues.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseNumberValues(); - message.values = (_a = object.values) !== null && _a !== void 0 ? _a : new Uint8Array(0); - return message; - }, -}; -function createBaseTextValues() { - return { values: [] }; -} -exports.TextValues = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.values) { - writer.uint32(10).string(v); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTextValues(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return exports.TextValues.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseTextValues(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseBoolValues() { - return { values: [] }; -} -exports.BoolValues = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.values) { - writer.bool(v); - } - writer.ldelim(); - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBoolValues(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 8) { - message.values.push(reader.bool()); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.values.push(reader.bool()); - } - continue; - } - break; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.Boolean(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return exports.BoolValues.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseBoolValues(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseObjectValues() { - return { values: [] }; -} -exports.ObjectValues = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.values) { - exports.Properties.encode(v, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseObjectValues(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(exports.Properties.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => exports.Properties.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values.map((e) => exports.Properties.toJSON(e)); - } - return obj; - }, - create(base) { - return exports.ObjectValues.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseObjectValues(); - message.values = - ((_a = object.values) === null || _a === void 0 - ? void 0 - : _a.map((e) => exports.Properties.fromPartial(e))) || []; - return message; - }, -}; -function createBaseDateValues() { - return { values: [] }; -} -exports.DateValues = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.values) { - writer.uint32(10).string(v); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDateValues(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return exports.DateValues.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseDateValues(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseUuidValues() { - return { values: [] }; -} -exports.UuidValues = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.values) { - writer.uint32(10).string(v); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUuidValues(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return exports.UuidValues.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseUuidValues(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseIntValues() { - return { values: new Uint8Array(0) }; -} -exports.IntValues = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.values.length !== 0) { - writer.uint32(10).bytes(message.values); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseIntValues(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values = reader.bytes(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { values: isSet(object.values) ? bytesFromBase64(object.values) : new Uint8Array(0) }; - }, - toJSON(message) { - const obj = {}; - if (message.values.length !== 0) { - obj.values = base64FromBytes(message.values); - } - return obj; - }, - create(base) { - return exports.IntValues.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseIntValues(); - message.values = (_a = object.values) !== null && _a !== void 0 ? _a : new Uint8Array(0); - return message; - }, -}; -function createBaseGeoCoordinate() { - return { longitude: 0, latitude: 0 }; -} -exports.GeoCoordinate = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.longitude !== 0) { - writer.uint32(13).float(message.longitude); - } - if (message.latitude !== 0) { - writer.uint32(21).float(message.latitude); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGeoCoordinate(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 13) { - break; - } - message.longitude = reader.float(); - continue; - case 2: - if (tag !== 21) { - break; - } - message.latitude = reader.float(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - longitude: isSet(object.longitude) ? globalThis.Number(object.longitude) : 0, - latitude: isSet(object.latitude) ? globalThis.Number(object.latitude) : 0, - }; - }, - toJSON(message) { - const obj = {}; - if (message.longitude !== 0) { - obj.longitude = message.longitude; - } - if (message.latitude !== 0) { - obj.latitude = message.latitude; - } - return obj; - }, - create(base) { - return exports.GeoCoordinate.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseGeoCoordinate(); - message.longitude = (_a = object.longitude) !== null && _a !== void 0 ? _a : 0; - message.latitude = (_b = object.latitude) !== null && _b !== void 0 ? _b : 0; - return message; - }, -}; -function createBasePhoneNumber() { - return { - countryCode: 0, - defaultCountry: '', - input: '', - internationalFormatted: '', - national: 0, - nationalFormatted: '', - valid: false, - }; -} -exports.PhoneNumber = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.countryCode !== 0) { - writer.uint32(8).uint64(message.countryCode); - } - if (message.defaultCountry !== '') { - writer.uint32(18).string(message.defaultCountry); - } - if (message.input !== '') { - writer.uint32(26).string(message.input); - } - if (message.internationalFormatted !== '') { - writer.uint32(34).string(message.internationalFormatted); - } - if (message.national !== 0) { - writer.uint32(40).uint64(message.national); - } - if (message.nationalFormatted !== '') { - writer.uint32(50).string(message.nationalFormatted); - } - if (message.valid !== false) { - writer.uint32(56).bool(message.valid); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePhoneNumber(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.countryCode = longToNumber(reader.uint64()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.defaultCountry = reader.string(); - continue; - case 3: - if (tag !== 26) { - break; - } - message.input = reader.string(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.internationalFormatted = reader.string(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.national = longToNumber(reader.uint64()); - continue; - case 6: - if (tag !== 50) { - break; - } - message.nationalFormatted = reader.string(); - continue; - case 7: - if (tag !== 56) { - break; - } - message.valid = reader.bool(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - countryCode: isSet(object.countryCode) ? globalThis.Number(object.countryCode) : 0, - defaultCountry: isSet(object.defaultCountry) ? globalThis.String(object.defaultCountry) : '', - input: isSet(object.input) ? globalThis.String(object.input) : '', - internationalFormatted: isSet(object.internationalFormatted) - ? globalThis.String(object.internationalFormatted) - : '', - national: isSet(object.national) ? globalThis.Number(object.national) : 0, - nationalFormatted: isSet(object.nationalFormatted) ? globalThis.String(object.nationalFormatted) : '', - valid: isSet(object.valid) ? globalThis.Boolean(object.valid) : false, - }; - }, - toJSON(message) { - const obj = {}; - if (message.countryCode !== 0) { - obj.countryCode = Math.round(message.countryCode); - } - if (message.defaultCountry !== '') { - obj.defaultCountry = message.defaultCountry; - } - if (message.input !== '') { - obj.input = message.input; - } - if (message.internationalFormatted !== '') { - obj.internationalFormatted = message.internationalFormatted; - } - if (message.national !== 0) { - obj.national = Math.round(message.national); - } - if (message.nationalFormatted !== '') { - obj.nationalFormatted = message.nationalFormatted; - } - if (message.valid !== false) { - obj.valid = message.valid; - } - return obj; - }, - create(base) { - return exports.PhoneNumber.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g; - const message = createBasePhoneNumber(); - message.countryCode = (_a = object.countryCode) !== null && _a !== void 0 ? _a : 0; - message.defaultCountry = (_b = object.defaultCountry) !== null && _b !== void 0 ? _b : ''; - message.input = (_c = object.input) !== null && _c !== void 0 ? _c : ''; - message.internationalFormatted = (_d = object.internationalFormatted) !== null && _d !== void 0 ? _d : ''; - message.national = (_e = object.national) !== null && _e !== void 0 ? _e : 0; - message.nationalFormatted = (_f = object.nationalFormatted) !== null && _f !== void 0 ? _f : ''; - message.valid = (_g = object.valid) !== null && _g !== void 0 ? _g : false; - return message; - }, -}; -function bytesFromBase64(b64) { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} -function base64FromBytes(arr) { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString('base64'); - } else { - const bin = []; - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join('')); - } -} -function longToNumber(long) { - if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { - throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); - } - return long.toNumber(); -} -if (minimal_js_1.default.util.Long !== long_1.default) { - minimal_js_1.default.util.Long = long_1.default; - minimal_js_1.default.configure(); -} -function isObject(value) { - return typeof value === 'object' && value !== null; -} -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/cjs/proto/v1/search_get.d.ts b/dist/node/cjs/proto/v1/search_get.d.ts deleted file mode 100644 index 2bbe25cb..00000000 --- a/dist/node/cjs/proto/v1/search_get.d.ts +++ /dev/null @@ -1,671 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -import { - BooleanArrayProperties, - ConsistencyLevel, - Filters, - IntArrayProperties, - NumberArrayProperties, - ObjectArrayProperties, - ObjectProperties, - TextArrayProperties, - Vectors, -} from './base.js'; -import { GenerativeReply, GenerativeResult, GenerativeSearch } from './generative.js'; -import { Properties } from './properties.js'; -export declare const protobufPackage = 'weaviate.v1'; -export declare enum CombinationMethod { - COMBINATION_METHOD_UNSPECIFIED = 0, - COMBINATION_METHOD_TYPE_SUM = 1, - COMBINATION_METHOD_TYPE_MIN = 2, - COMBINATION_METHOD_TYPE_AVERAGE = 3, - COMBINATION_METHOD_TYPE_RELATIVE_SCORE = 4, - COMBINATION_METHOD_TYPE_MANUAL = 5, - UNRECOGNIZED = -1, -} -export declare function combinationMethodFromJSON(object: any): CombinationMethod; -export declare function combinationMethodToJSON(object: CombinationMethod): string; -export interface SearchRequest { - /** required */ - collection: string; - /** parameters */ - tenant: string; - consistencyLevel?: ConsistencyLevel | undefined; - /** what is returned */ - properties?: PropertiesRequest | undefined; - metadata?: MetadataRequest | undefined; - groupBy?: GroupBy | undefined; - /** affects order and length of results. 0/empty (default value) means disabled */ - limit: number; - offset: number; - autocut: number; - after: string; - /** protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED */ - sortBy: SortBy[]; - /** matches/searches for objects */ - filters?: Filters | undefined; - hybridSearch?: Hybrid | undefined; - bm25Search?: BM25 | undefined; - nearVector?: NearVector | undefined; - nearObject?: NearObject | undefined; - nearText?: NearTextSearch | undefined; - nearImage?: NearImageSearch | undefined; - nearAudio?: NearAudioSearch | undefined; - nearVideo?: NearVideoSearch | undefined; - nearDepth?: NearDepthSearch | undefined; - nearThermal?: NearThermalSearch | undefined; - nearImu?: NearIMUSearch | undefined; - generative?: GenerativeSearch | undefined; - rerank?: Rerank | undefined; - /** @deprecated */ - uses123Api: boolean; - /** @deprecated */ - uses125Api: boolean; - uses127Api: boolean; -} -export interface GroupBy { - /** - * currently only supports one entry (eg just properties, no refs). But might - * be extended in the future. - * protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED - */ - path: string[]; - numberOfGroups: number; - objectsPerGroup: number; -} -export interface SortBy { - ascending: boolean; - /** - * currently only supports one entry (eg just properties, no refs). But the - * weaviate datastructure already has paths in it and this makes it easily - * extendable in the future - * protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED - */ - path: string[]; -} -export interface MetadataRequest { - uuid: boolean; - vector: boolean; - creationTimeUnix: boolean; - lastUpdateTimeUnix: boolean; - distance: boolean; - certainty: boolean; - score: boolean; - explainScore: boolean; - isConsistent: boolean; - vectors: string[]; -} -export interface PropertiesRequest { - nonRefProperties: string[]; - refProperties: RefPropertiesRequest[]; - objectProperties: ObjectPropertiesRequest[]; - returnAllNonrefProperties: boolean; -} -export interface ObjectPropertiesRequest { - propName: string; - primitiveProperties: string[]; - objectProperties: ObjectPropertiesRequest[]; -} -export interface WeightsForTarget { - target: string; - weight: number; -} -export interface Targets { - targetVectors: string[]; - combination: CombinationMethod; - /** - * deprecated in 1.26.2 - use weights_for_targets - * - * @deprecated - */ - weights: { - [key: string]: number; - }; - weightsForTargets: WeightsForTarget[]; -} -export interface Targets_WeightsEntry { - key: string; - value: number; -} -export interface Hybrid { - query: string; - properties: string[]; - /** - * protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED - * - * @deprecated - */ - vector: number[]; - alpha: number; - fusionType: Hybrid_FusionType; - vectorBytes: Uint8Array; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - /** targets in msg is ignored and should not be set for hybrid */ - nearText: NearTextSearch | undefined; - /** same as above. Use the target vector in the hybrid message */ - nearVector: NearVector | undefined; - targets: Targets | undefined; - vectorDistance?: number | undefined; -} -export declare enum Hybrid_FusionType { - FUSION_TYPE_UNSPECIFIED = 0, - FUSION_TYPE_RANKED = 1, - FUSION_TYPE_RELATIVE_SCORE = 2, - UNRECOGNIZED = -1, -} -export declare function hybrid_FusionTypeFromJSON(object: any): Hybrid_FusionType; -export declare function hybrid_FusionTypeToJSON(object: Hybrid_FusionType): string; -export interface NearTextSearch { - /** protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED */ - query: string[]; - certainty?: number | undefined; - distance?: number | undefined; - moveTo?: NearTextSearch_Move | undefined; - moveAway?: NearTextSearch_Move | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface NearTextSearch_Move { - force: number; - concepts: string[]; - uuids: string[]; -} -export interface NearImageSearch { - image: string; - certainty?: number | undefined; - distance?: number | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface NearAudioSearch { - audio: string; - certainty?: number | undefined; - distance?: number | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface NearVideoSearch { - video: string; - certainty?: number | undefined; - distance?: number | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface NearDepthSearch { - depth: string; - certainty?: number | undefined; - distance?: number | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface NearThermalSearch { - thermal: string; - certainty?: number | undefined; - distance?: number | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface NearIMUSearch { - imu: string; - certainty?: number | undefined; - distance?: number | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface BM25 { - query: string; - properties: string[]; -} -export interface RefPropertiesRequest { - referenceProperty: string; - properties: PropertiesRequest | undefined; - metadata: MetadataRequest | undefined; - targetCollection: string; -} -export interface VectorForTarget { - name: string; - vectorBytes: Uint8Array; -} -export interface NearVector { - /** - * protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED - * - * @deprecated - */ - vector: number[]; - certainty?: number | undefined; - distance?: number | undefined; - vectorBytes: Uint8Array; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; - /** - * deprecated in 1.26.2 - use vector_for_targets - * - * @deprecated - */ - vectorPerTarget: { - [key: string]: Uint8Array; - }; - vectorForTargets: VectorForTarget[]; -} -export interface NearVector_VectorPerTargetEntry { - key: string; - value: Uint8Array; -} -export interface NearObject { - id: string; - certainty?: number | undefined; - distance?: number | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface Rerank { - property: string; - query?: string | undefined; -} -export interface SearchReply { - took: number; - results: SearchResult[]; - /** @deprecated */ - generativeGroupedResult?: string | undefined; - groupByResults: GroupByResult[]; - generativeGroupedResults?: GenerativeResult | undefined; -} -export interface RerankReply { - score: number; -} -export interface GroupByResult { - name: string; - minDistance: number; - maxDistance: number; - numberOfObjects: number; - objects: SearchResult[]; - rerank?: RerankReply | undefined; - /** @deprecated */ - generative?: GenerativeReply | undefined; - generativeResult?: GenerativeResult | undefined; -} -export interface SearchResult { - properties: PropertiesResult | undefined; - metadata: MetadataResult | undefined; - generative?: GenerativeResult | undefined; -} -export interface MetadataResult { - id: string; - /** - * protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED - * - * @deprecated - */ - vector: number[]; - creationTimeUnix: number; - creationTimeUnixPresent: boolean; - lastUpdateTimeUnix: number; - lastUpdateTimeUnixPresent: boolean; - distance: number; - distancePresent: boolean; - certainty: number; - certaintyPresent: boolean; - score: number; - scorePresent: boolean; - explainScore: string; - explainScorePresent: boolean; - isConsistent?: boolean | undefined; - /** @deprecated */ - generative: string; - /** @deprecated */ - generativePresent: boolean; - isConsistentPresent: boolean; - vectorBytes: Uint8Array; - idAsBytes: Uint8Array; - rerankScore: number; - rerankScorePresent: boolean; - vectors: Vectors[]; -} -export interface PropertiesResult { - /** @deprecated */ - nonRefProperties: - | { - [key: string]: any; - } - | undefined; - refProps: RefPropertiesResult[]; - targetCollection: string; - metadata: MetadataResult | undefined; - /** @deprecated */ - numberArrayProperties: NumberArrayProperties[]; - /** @deprecated */ - intArrayProperties: IntArrayProperties[]; - /** @deprecated */ - textArrayProperties: TextArrayProperties[]; - /** @deprecated */ - booleanArrayProperties: BooleanArrayProperties[]; - /** @deprecated */ - objectProperties: ObjectProperties[]; - /** @deprecated */ - objectArrayProperties: ObjectArrayProperties[]; - nonRefProps: Properties | undefined; - refPropsRequested: boolean; -} -export interface RefPropertiesResult { - properties: PropertiesResult[]; - propName: string; -} -export declare const SearchRequest: { - encode(message: SearchRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): SearchRequest; - fromJSON(object: any): SearchRequest; - toJSON(message: SearchRequest): unknown; - create(base?: DeepPartial): SearchRequest; - fromPartial(object: DeepPartial): SearchRequest; -}; -export declare const GroupBy: { - encode(message: GroupBy, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GroupBy; - fromJSON(object: any): GroupBy; - toJSON(message: GroupBy): unknown; - create(base?: DeepPartial): GroupBy; - fromPartial(object: DeepPartial): GroupBy; -}; -export declare const SortBy: { - encode(message: SortBy, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): SortBy; - fromJSON(object: any): SortBy; - toJSON(message: SortBy): unknown; - create(base?: DeepPartial): SortBy; - fromPartial(object: DeepPartial): SortBy; -}; -export declare const MetadataRequest: { - encode(message: MetadataRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): MetadataRequest; - fromJSON(object: any): MetadataRequest; - toJSON(message: MetadataRequest): unknown; - create(base?: DeepPartial): MetadataRequest; - fromPartial(object: DeepPartial): MetadataRequest; -}; -export declare const PropertiesRequest: { - encode(message: PropertiesRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): PropertiesRequest; - fromJSON(object: any): PropertiesRequest; - toJSON(message: PropertiesRequest): unknown; - create(base?: DeepPartial): PropertiesRequest; - fromPartial(object: DeepPartial): PropertiesRequest; -}; -export declare const ObjectPropertiesRequest: { - encode(message: ObjectPropertiesRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): ObjectPropertiesRequest; - fromJSON(object: any): ObjectPropertiesRequest; - toJSON(message: ObjectPropertiesRequest): unknown; - create(base?: DeepPartial): ObjectPropertiesRequest; - fromPartial(object: DeepPartial): ObjectPropertiesRequest; -}; -export declare const WeightsForTarget: { - encode(message: WeightsForTarget, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): WeightsForTarget; - fromJSON(object: any): WeightsForTarget; - toJSON(message: WeightsForTarget): unknown; - create(base?: DeepPartial): WeightsForTarget; - fromPartial(object: DeepPartial): WeightsForTarget; -}; -export declare const Targets: { - encode(message: Targets, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Targets; - fromJSON(object: any): Targets; - toJSON(message: Targets): unknown; - create(base?: DeepPartial): Targets; - fromPartial(object: DeepPartial): Targets; -}; -export declare const Targets_WeightsEntry: { - encode(message: Targets_WeightsEntry, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Targets_WeightsEntry; - fromJSON(object: any): Targets_WeightsEntry; - toJSON(message: Targets_WeightsEntry): unknown; - create(base?: DeepPartial): Targets_WeightsEntry; - fromPartial(object: DeepPartial): Targets_WeightsEntry; -}; -export declare const Hybrid: { - encode(message: Hybrid, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Hybrid; - fromJSON(object: any): Hybrid; - toJSON(message: Hybrid): unknown; - create(base?: DeepPartial): Hybrid; - fromPartial(object: DeepPartial): Hybrid; -}; -export declare const NearTextSearch: { - encode(message: NearTextSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearTextSearch; - fromJSON(object: any): NearTextSearch; - toJSON(message: NearTextSearch): unknown; - create(base?: DeepPartial): NearTextSearch; - fromPartial(object: DeepPartial): NearTextSearch; -}; -export declare const NearTextSearch_Move: { - encode(message: NearTextSearch_Move, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearTextSearch_Move; - fromJSON(object: any): NearTextSearch_Move; - toJSON(message: NearTextSearch_Move): unknown; - create(base?: DeepPartial): NearTextSearch_Move; - fromPartial(object: DeepPartial): NearTextSearch_Move; -}; -export declare const NearImageSearch: { - encode(message: NearImageSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearImageSearch; - fromJSON(object: any): NearImageSearch; - toJSON(message: NearImageSearch): unknown; - create(base?: DeepPartial): NearImageSearch; - fromPartial(object: DeepPartial): NearImageSearch; -}; -export declare const NearAudioSearch: { - encode(message: NearAudioSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearAudioSearch; - fromJSON(object: any): NearAudioSearch; - toJSON(message: NearAudioSearch): unknown; - create(base?: DeepPartial): NearAudioSearch; - fromPartial(object: DeepPartial): NearAudioSearch; -}; -export declare const NearVideoSearch: { - encode(message: NearVideoSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearVideoSearch; - fromJSON(object: any): NearVideoSearch; - toJSON(message: NearVideoSearch): unknown; - create(base?: DeepPartial): NearVideoSearch; - fromPartial(object: DeepPartial): NearVideoSearch; -}; -export declare const NearDepthSearch: { - encode(message: NearDepthSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearDepthSearch; - fromJSON(object: any): NearDepthSearch; - toJSON(message: NearDepthSearch): unknown; - create(base?: DeepPartial): NearDepthSearch; - fromPartial(object: DeepPartial): NearDepthSearch; -}; -export declare const NearThermalSearch: { - encode(message: NearThermalSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearThermalSearch; - fromJSON(object: any): NearThermalSearch; - toJSON(message: NearThermalSearch): unknown; - create(base?: DeepPartial): NearThermalSearch; - fromPartial(object: DeepPartial): NearThermalSearch; -}; -export declare const NearIMUSearch: { - encode(message: NearIMUSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearIMUSearch; - fromJSON(object: any): NearIMUSearch; - toJSON(message: NearIMUSearch): unknown; - create(base?: DeepPartial): NearIMUSearch; - fromPartial(object: DeepPartial): NearIMUSearch; -}; -export declare const BM25: { - encode(message: BM25, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BM25; - fromJSON(object: any): BM25; - toJSON(message: BM25): unknown; - create(base?: DeepPartial): BM25; - fromPartial(object: DeepPartial): BM25; -}; -export declare const RefPropertiesRequest: { - encode(message: RefPropertiesRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): RefPropertiesRequest; - fromJSON(object: any): RefPropertiesRequest; - toJSON(message: RefPropertiesRequest): unknown; - create(base?: DeepPartial): RefPropertiesRequest; - fromPartial(object: DeepPartial): RefPropertiesRequest; -}; -export declare const VectorForTarget: { - encode(message: VectorForTarget, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): VectorForTarget; - fromJSON(object: any): VectorForTarget; - toJSON(message: VectorForTarget): unknown; - create(base?: DeepPartial): VectorForTarget; - fromPartial(object: DeepPartial): VectorForTarget; -}; -export declare const NearVector: { - encode(message: NearVector, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearVector; - fromJSON(object: any): NearVector; - toJSON(message: NearVector): unknown; - create(base?: DeepPartial): NearVector; - fromPartial(object: DeepPartial): NearVector; -}; -export declare const NearVector_VectorPerTargetEntry: { - encode(message: NearVector_VectorPerTargetEntry, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearVector_VectorPerTargetEntry; - fromJSON(object: any): NearVector_VectorPerTargetEntry; - toJSON(message: NearVector_VectorPerTargetEntry): unknown; - create(base?: DeepPartial): NearVector_VectorPerTargetEntry; - fromPartial(object: DeepPartial): NearVector_VectorPerTargetEntry; -}; -export declare const NearObject: { - encode(message: NearObject, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearObject; - fromJSON(object: any): NearObject; - toJSON(message: NearObject): unknown; - create(base?: DeepPartial): NearObject; - fromPartial(object: DeepPartial): NearObject; -}; -export declare const Rerank: { - encode(message: Rerank, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Rerank; - fromJSON(object: any): Rerank; - toJSON(message: Rerank): unknown; - create(base?: DeepPartial): Rerank; - fromPartial(object: DeepPartial): Rerank; -}; -export declare const SearchReply: { - encode(message: SearchReply, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): SearchReply; - fromJSON(object: any): SearchReply; - toJSON(message: SearchReply): unknown; - create(base?: DeepPartial): SearchReply; - fromPartial(object: DeepPartial): SearchReply; -}; -export declare const RerankReply: { - encode(message: RerankReply, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): RerankReply; - fromJSON(object: any): RerankReply; - toJSON(message: RerankReply): unknown; - create(base?: DeepPartial): RerankReply; - fromPartial(object: DeepPartial): RerankReply; -}; -export declare const GroupByResult: { - encode(message: GroupByResult, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GroupByResult; - fromJSON(object: any): GroupByResult; - toJSON(message: GroupByResult): unknown; - create(base?: DeepPartial): GroupByResult; - fromPartial(object: DeepPartial): GroupByResult; -}; -export declare const SearchResult: { - encode(message: SearchResult, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): SearchResult; - fromJSON(object: any): SearchResult; - toJSON(message: SearchResult): unknown; - create(base?: DeepPartial): SearchResult; - fromPartial(object: DeepPartial): SearchResult; -}; -export declare const MetadataResult: { - encode(message: MetadataResult, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): MetadataResult; - fromJSON(object: any): MetadataResult; - toJSON(message: MetadataResult): unknown; - create(base?: DeepPartial): MetadataResult; - fromPartial(object: DeepPartial): MetadataResult; -}; -export declare const PropertiesResult: { - encode(message: PropertiesResult, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): PropertiesResult; - fromJSON(object: any): PropertiesResult; - toJSON(message: PropertiesResult): unknown; - create(base?: DeepPartial): PropertiesResult; - fromPartial(object: DeepPartial): PropertiesResult; -}; -export declare const RefPropertiesResult: { - encode(message: RefPropertiesResult, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): RefPropertiesResult; - fromJSON(object: any): RefPropertiesResult; - toJSON(message: RefPropertiesResult): unknown; - create(base?: DeepPartial): RefPropertiesResult; - fromPartial(object: DeepPartial): RefPropertiesResult; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/cjs/proto/v1/search_get.js b/dist/node/cjs/proto/v1/search_get.js deleted file mode 100644 index bbcfdec3..00000000 --- a/dist/node/cjs/proto/v1/search_get.js +++ /dev/null @@ -1,4716 +0,0 @@ -'use strict'; -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/search_get.proto -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.RefPropertiesResult = - exports.PropertiesResult = - exports.MetadataResult = - exports.SearchResult = - exports.GroupByResult = - exports.RerankReply = - exports.SearchReply = - exports.Rerank = - exports.NearObject = - exports.NearVector_VectorPerTargetEntry = - exports.NearVector = - exports.VectorForTarget = - exports.RefPropertiesRequest = - exports.BM25 = - exports.NearIMUSearch = - exports.NearThermalSearch = - exports.NearDepthSearch = - exports.NearVideoSearch = - exports.NearAudioSearch = - exports.NearImageSearch = - exports.NearTextSearch_Move = - exports.NearTextSearch = - exports.Hybrid = - exports.Targets_WeightsEntry = - exports.Targets = - exports.WeightsForTarget = - exports.ObjectPropertiesRequest = - exports.PropertiesRequest = - exports.MetadataRequest = - exports.SortBy = - exports.GroupBy = - exports.SearchRequest = - exports.hybrid_FusionTypeToJSON = - exports.hybrid_FusionTypeFromJSON = - exports.Hybrid_FusionType = - exports.combinationMethodToJSON = - exports.combinationMethodFromJSON = - exports.CombinationMethod = - exports.protobufPackage = - void 0; -/* eslint-disable */ -const long_1 = __importDefault(require('long')); -const minimal_js_1 = __importDefault(require('protobufjs/minimal.js')); -const struct_js_1 = require('../google/protobuf/struct.js'); -const base_js_1 = require('./base.js'); -const generative_js_1 = require('./generative.js'); -const properties_js_1 = require('./properties.js'); -exports.protobufPackage = 'weaviate.v1'; -var CombinationMethod; -(function (CombinationMethod) { - CombinationMethod[(CombinationMethod['COMBINATION_METHOD_UNSPECIFIED'] = 0)] = - 'COMBINATION_METHOD_UNSPECIFIED'; - CombinationMethod[(CombinationMethod['COMBINATION_METHOD_TYPE_SUM'] = 1)] = 'COMBINATION_METHOD_TYPE_SUM'; - CombinationMethod[(CombinationMethod['COMBINATION_METHOD_TYPE_MIN'] = 2)] = 'COMBINATION_METHOD_TYPE_MIN'; - CombinationMethod[(CombinationMethod['COMBINATION_METHOD_TYPE_AVERAGE'] = 3)] = - 'COMBINATION_METHOD_TYPE_AVERAGE'; - CombinationMethod[(CombinationMethod['COMBINATION_METHOD_TYPE_RELATIVE_SCORE'] = 4)] = - 'COMBINATION_METHOD_TYPE_RELATIVE_SCORE'; - CombinationMethod[(CombinationMethod['COMBINATION_METHOD_TYPE_MANUAL'] = 5)] = - 'COMBINATION_METHOD_TYPE_MANUAL'; - CombinationMethod[(CombinationMethod['UNRECOGNIZED'] = -1)] = 'UNRECOGNIZED'; -})(CombinationMethod || (exports.CombinationMethod = CombinationMethod = {})); -function combinationMethodFromJSON(object) { - switch (object) { - case 0: - case 'COMBINATION_METHOD_UNSPECIFIED': - return CombinationMethod.COMBINATION_METHOD_UNSPECIFIED; - case 1: - case 'COMBINATION_METHOD_TYPE_SUM': - return CombinationMethod.COMBINATION_METHOD_TYPE_SUM; - case 2: - case 'COMBINATION_METHOD_TYPE_MIN': - return CombinationMethod.COMBINATION_METHOD_TYPE_MIN; - case 3: - case 'COMBINATION_METHOD_TYPE_AVERAGE': - return CombinationMethod.COMBINATION_METHOD_TYPE_AVERAGE; - case 4: - case 'COMBINATION_METHOD_TYPE_RELATIVE_SCORE': - return CombinationMethod.COMBINATION_METHOD_TYPE_RELATIVE_SCORE; - case 5: - case 'COMBINATION_METHOD_TYPE_MANUAL': - return CombinationMethod.COMBINATION_METHOD_TYPE_MANUAL; - case -1: - case 'UNRECOGNIZED': - default: - return CombinationMethod.UNRECOGNIZED; - } -} -exports.combinationMethodFromJSON = combinationMethodFromJSON; -function combinationMethodToJSON(object) { - switch (object) { - case CombinationMethod.COMBINATION_METHOD_UNSPECIFIED: - return 'COMBINATION_METHOD_UNSPECIFIED'; - case CombinationMethod.COMBINATION_METHOD_TYPE_SUM: - return 'COMBINATION_METHOD_TYPE_SUM'; - case CombinationMethod.COMBINATION_METHOD_TYPE_MIN: - return 'COMBINATION_METHOD_TYPE_MIN'; - case CombinationMethod.COMBINATION_METHOD_TYPE_AVERAGE: - return 'COMBINATION_METHOD_TYPE_AVERAGE'; - case CombinationMethod.COMBINATION_METHOD_TYPE_RELATIVE_SCORE: - return 'COMBINATION_METHOD_TYPE_RELATIVE_SCORE'; - case CombinationMethod.COMBINATION_METHOD_TYPE_MANUAL: - return 'COMBINATION_METHOD_TYPE_MANUAL'; - case CombinationMethod.UNRECOGNIZED: - default: - return 'UNRECOGNIZED'; - } -} -exports.combinationMethodToJSON = combinationMethodToJSON; -var Hybrid_FusionType; -(function (Hybrid_FusionType) { - Hybrid_FusionType[(Hybrid_FusionType['FUSION_TYPE_UNSPECIFIED'] = 0)] = 'FUSION_TYPE_UNSPECIFIED'; - Hybrid_FusionType[(Hybrid_FusionType['FUSION_TYPE_RANKED'] = 1)] = 'FUSION_TYPE_RANKED'; - Hybrid_FusionType[(Hybrid_FusionType['FUSION_TYPE_RELATIVE_SCORE'] = 2)] = 'FUSION_TYPE_RELATIVE_SCORE'; - Hybrid_FusionType[(Hybrid_FusionType['UNRECOGNIZED'] = -1)] = 'UNRECOGNIZED'; -})(Hybrid_FusionType || (exports.Hybrid_FusionType = Hybrid_FusionType = {})); -function hybrid_FusionTypeFromJSON(object) { - switch (object) { - case 0: - case 'FUSION_TYPE_UNSPECIFIED': - return Hybrid_FusionType.FUSION_TYPE_UNSPECIFIED; - case 1: - case 'FUSION_TYPE_RANKED': - return Hybrid_FusionType.FUSION_TYPE_RANKED; - case 2: - case 'FUSION_TYPE_RELATIVE_SCORE': - return Hybrid_FusionType.FUSION_TYPE_RELATIVE_SCORE; - case -1: - case 'UNRECOGNIZED': - default: - return Hybrid_FusionType.UNRECOGNIZED; - } -} -exports.hybrid_FusionTypeFromJSON = hybrid_FusionTypeFromJSON; -function hybrid_FusionTypeToJSON(object) { - switch (object) { - case Hybrid_FusionType.FUSION_TYPE_UNSPECIFIED: - return 'FUSION_TYPE_UNSPECIFIED'; - case Hybrid_FusionType.FUSION_TYPE_RANKED: - return 'FUSION_TYPE_RANKED'; - case Hybrid_FusionType.FUSION_TYPE_RELATIVE_SCORE: - return 'FUSION_TYPE_RELATIVE_SCORE'; - case Hybrid_FusionType.UNRECOGNIZED: - default: - return 'UNRECOGNIZED'; - } -} -exports.hybrid_FusionTypeToJSON = hybrid_FusionTypeToJSON; -function createBaseSearchRequest() { - return { - collection: '', - tenant: '', - consistencyLevel: undefined, - properties: undefined, - metadata: undefined, - groupBy: undefined, - limit: 0, - offset: 0, - autocut: 0, - after: '', - sortBy: [], - filters: undefined, - hybridSearch: undefined, - bm25Search: undefined, - nearVector: undefined, - nearObject: undefined, - nearText: undefined, - nearImage: undefined, - nearAudio: undefined, - nearVideo: undefined, - nearDepth: undefined, - nearThermal: undefined, - nearImu: undefined, - generative: undefined, - rerank: undefined, - uses123Api: false, - uses125Api: false, - uses127Api: false, - }; -} -exports.SearchRequest = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.collection !== '') { - writer.uint32(10).string(message.collection); - } - if (message.tenant !== '') { - writer.uint32(82).string(message.tenant); - } - if (message.consistencyLevel !== undefined) { - writer.uint32(88).int32(message.consistencyLevel); - } - if (message.properties !== undefined) { - exports.PropertiesRequest.encode(message.properties, writer.uint32(162).fork()).ldelim(); - } - if (message.metadata !== undefined) { - exports.MetadataRequest.encode(message.metadata, writer.uint32(170).fork()).ldelim(); - } - if (message.groupBy !== undefined) { - exports.GroupBy.encode(message.groupBy, writer.uint32(178).fork()).ldelim(); - } - if (message.limit !== 0) { - writer.uint32(240).uint32(message.limit); - } - if (message.offset !== 0) { - writer.uint32(248).uint32(message.offset); - } - if (message.autocut !== 0) { - writer.uint32(256).uint32(message.autocut); - } - if (message.after !== '') { - writer.uint32(266).string(message.after); - } - for (const v of message.sortBy) { - exports.SortBy.encode(v, writer.uint32(274).fork()).ldelim(); - } - if (message.filters !== undefined) { - base_js_1.Filters.encode(message.filters, writer.uint32(322).fork()).ldelim(); - } - if (message.hybridSearch !== undefined) { - exports.Hybrid.encode(message.hybridSearch, writer.uint32(330).fork()).ldelim(); - } - if (message.bm25Search !== undefined) { - exports.BM25.encode(message.bm25Search, writer.uint32(338).fork()).ldelim(); - } - if (message.nearVector !== undefined) { - exports.NearVector.encode(message.nearVector, writer.uint32(346).fork()).ldelim(); - } - if (message.nearObject !== undefined) { - exports.NearObject.encode(message.nearObject, writer.uint32(354).fork()).ldelim(); - } - if (message.nearText !== undefined) { - exports.NearTextSearch.encode(message.nearText, writer.uint32(362).fork()).ldelim(); - } - if (message.nearImage !== undefined) { - exports.NearImageSearch.encode(message.nearImage, writer.uint32(370).fork()).ldelim(); - } - if (message.nearAudio !== undefined) { - exports.NearAudioSearch.encode(message.nearAudio, writer.uint32(378).fork()).ldelim(); - } - if (message.nearVideo !== undefined) { - exports.NearVideoSearch.encode(message.nearVideo, writer.uint32(386).fork()).ldelim(); - } - if (message.nearDepth !== undefined) { - exports.NearDepthSearch.encode(message.nearDepth, writer.uint32(394).fork()).ldelim(); - } - if (message.nearThermal !== undefined) { - exports.NearThermalSearch.encode(message.nearThermal, writer.uint32(402).fork()).ldelim(); - } - if (message.nearImu !== undefined) { - exports.NearIMUSearch.encode(message.nearImu, writer.uint32(410).fork()).ldelim(); - } - if (message.generative !== undefined) { - generative_js_1.GenerativeSearch.encode(message.generative, writer.uint32(482).fork()).ldelim(); - } - if (message.rerank !== undefined) { - exports.Rerank.encode(message.rerank, writer.uint32(490).fork()).ldelim(); - } - if (message.uses123Api !== false) { - writer.uint32(800).bool(message.uses123Api); - } - if (message.uses125Api !== false) { - writer.uint32(808).bool(message.uses125Api); - } - if (message.uses127Api !== false) { - writer.uint32(816).bool(message.uses127Api); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSearchRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.collection = reader.string(); - continue; - case 10: - if (tag !== 82) { - break; - } - message.tenant = reader.string(); - continue; - case 11: - if (tag !== 88) { - break; - } - message.consistencyLevel = reader.int32(); - continue; - case 20: - if (tag !== 162) { - break; - } - message.properties = exports.PropertiesRequest.decode(reader, reader.uint32()); - continue; - case 21: - if (tag !== 170) { - break; - } - message.metadata = exports.MetadataRequest.decode(reader, reader.uint32()); - continue; - case 22: - if (tag !== 178) { - break; - } - message.groupBy = exports.GroupBy.decode(reader, reader.uint32()); - continue; - case 30: - if (tag !== 240) { - break; - } - message.limit = reader.uint32(); - continue; - case 31: - if (tag !== 248) { - break; - } - message.offset = reader.uint32(); - continue; - case 32: - if (tag !== 256) { - break; - } - message.autocut = reader.uint32(); - continue; - case 33: - if (tag !== 266) { - break; - } - message.after = reader.string(); - continue; - case 34: - if (tag !== 274) { - break; - } - message.sortBy.push(exports.SortBy.decode(reader, reader.uint32())); - continue; - case 40: - if (tag !== 322) { - break; - } - message.filters = base_js_1.Filters.decode(reader, reader.uint32()); - continue; - case 41: - if (tag !== 330) { - break; - } - message.hybridSearch = exports.Hybrid.decode(reader, reader.uint32()); - continue; - case 42: - if (tag !== 338) { - break; - } - message.bm25Search = exports.BM25.decode(reader, reader.uint32()); - continue; - case 43: - if (tag !== 346) { - break; - } - message.nearVector = exports.NearVector.decode(reader, reader.uint32()); - continue; - case 44: - if (tag !== 354) { - break; - } - message.nearObject = exports.NearObject.decode(reader, reader.uint32()); - continue; - case 45: - if (tag !== 362) { - break; - } - message.nearText = exports.NearTextSearch.decode(reader, reader.uint32()); - continue; - case 46: - if (tag !== 370) { - break; - } - message.nearImage = exports.NearImageSearch.decode(reader, reader.uint32()); - continue; - case 47: - if (tag !== 378) { - break; - } - message.nearAudio = exports.NearAudioSearch.decode(reader, reader.uint32()); - continue; - case 48: - if (tag !== 386) { - break; - } - message.nearVideo = exports.NearVideoSearch.decode(reader, reader.uint32()); - continue; - case 49: - if (tag !== 394) { - break; - } - message.nearDepth = exports.NearDepthSearch.decode(reader, reader.uint32()); - continue; - case 50: - if (tag !== 402) { - break; - } - message.nearThermal = exports.NearThermalSearch.decode(reader, reader.uint32()); - continue; - case 51: - if (tag !== 410) { - break; - } - message.nearImu = exports.NearIMUSearch.decode(reader, reader.uint32()); - continue; - case 60: - if (tag !== 482) { - break; - } - message.generative = generative_js_1.GenerativeSearch.decode(reader, reader.uint32()); - continue; - case 61: - if (tag !== 490) { - break; - } - message.rerank = exports.Rerank.decode(reader, reader.uint32()); - continue; - case 100: - if (tag !== 800) { - break; - } - message.uses123Api = reader.bool(); - continue; - case 101: - if (tag !== 808) { - break; - } - message.uses125Api = reader.bool(); - continue; - case 102: - if (tag !== 816) { - break; - } - message.uses127Api = reader.bool(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - collection: isSet(object.collection) ? globalThis.String(object.collection) : '', - tenant: isSet(object.tenant) ? globalThis.String(object.tenant) : '', - consistencyLevel: isSet(object.consistencyLevel) - ? (0, base_js_1.consistencyLevelFromJSON)(object.consistencyLevel) - : undefined, - properties: isSet(object.properties) - ? exports.PropertiesRequest.fromJSON(object.properties) - : undefined, - metadata: isSet(object.metadata) ? exports.MetadataRequest.fromJSON(object.metadata) : undefined, - groupBy: isSet(object.groupBy) ? exports.GroupBy.fromJSON(object.groupBy) : undefined, - limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, - offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, - autocut: isSet(object.autocut) ? globalThis.Number(object.autocut) : 0, - after: isSet(object.after) ? globalThis.String(object.after) : '', - sortBy: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sortBy) - ? object.sortBy.map((e) => exports.SortBy.fromJSON(e)) - : [], - filters: isSet(object.filters) ? base_js_1.Filters.fromJSON(object.filters) : undefined, - hybridSearch: isSet(object.hybridSearch) ? exports.Hybrid.fromJSON(object.hybridSearch) : undefined, - bm25Search: isSet(object.bm25Search) ? exports.BM25.fromJSON(object.bm25Search) : undefined, - nearVector: isSet(object.nearVector) ? exports.NearVector.fromJSON(object.nearVector) : undefined, - nearObject: isSet(object.nearObject) ? exports.NearObject.fromJSON(object.nearObject) : undefined, - nearText: isSet(object.nearText) ? exports.NearTextSearch.fromJSON(object.nearText) : undefined, - nearImage: isSet(object.nearImage) ? exports.NearImageSearch.fromJSON(object.nearImage) : undefined, - nearAudio: isSet(object.nearAudio) ? exports.NearAudioSearch.fromJSON(object.nearAudio) : undefined, - nearVideo: isSet(object.nearVideo) ? exports.NearVideoSearch.fromJSON(object.nearVideo) : undefined, - nearDepth: isSet(object.nearDepth) ? exports.NearDepthSearch.fromJSON(object.nearDepth) : undefined, - nearThermal: isSet(object.nearThermal) - ? exports.NearThermalSearch.fromJSON(object.nearThermal) - : undefined, - nearImu: isSet(object.nearImu) ? exports.NearIMUSearch.fromJSON(object.nearImu) : undefined, - generative: isSet(object.generative) - ? generative_js_1.GenerativeSearch.fromJSON(object.generative) - : undefined, - rerank: isSet(object.rerank) ? exports.Rerank.fromJSON(object.rerank) : undefined, - uses123Api: isSet(object.uses123Api) ? globalThis.Boolean(object.uses123Api) : false, - uses125Api: isSet(object.uses125Api) ? globalThis.Boolean(object.uses125Api) : false, - uses127Api: isSet(object.uses127Api) ? globalThis.Boolean(object.uses127Api) : false, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.collection !== '') { - obj.collection = message.collection; - } - if (message.tenant !== '') { - obj.tenant = message.tenant; - } - if (message.consistencyLevel !== undefined) { - obj.consistencyLevel = (0, base_js_1.consistencyLevelToJSON)(message.consistencyLevel); - } - if (message.properties !== undefined) { - obj.properties = exports.PropertiesRequest.toJSON(message.properties); - } - if (message.metadata !== undefined) { - obj.metadata = exports.MetadataRequest.toJSON(message.metadata); - } - if (message.groupBy !== undefined) { - obj.groupBy = exports.GroupBy.toJSON(message.groupBy); - } - if (message.limit !== 0) { - obj.limit = Math.round(message.limit); - } - if (message.offset !== 0) { - obj.offset = Math.round(message.offset); - } - if (message.autocut !== 0) { - obj.autocut = Math.round(message.autocut); - } - if (message.after !== '') { - obj.after = message.after; - } - if ((_a = message.sortBy) === null || _a === void 0 ? void 0 : _a.length) { - obj.sortBy = message.sortBy.map((e) => exports.SortBy.toJSON(e)); - } - if (message.filters !== undefined) { - obj.filters = base_js_1.Filters.toJSON(message.filters); - } - if (message.hybridSearch !== undefined) { - obj.hybridSearch = exports.Hybrid.toJSON(message.hybridSearch); - } - if (message.bm25Search !== undefined) { - obj.bm25Search = exports.BM25.toJSON(message.bm25Search); - } - if (message.nearVector !== undefined) { - obj.nearVector = exports.NearVector.toJSON(message.nearVector); - } - if (message.nearObject !== undefined) { - obj.nearObject = exports.NearObject.toJSON(message.nearObject); - } - if (message.nearText !== undefined) { - obj.nearText = exports.NearTextSearch.toJSON(message.nearText); - } - if (message.nearImage !== undefined) { - obj.nearImage = exports.NearImageSearch.toJSON(message.nearImage); - } - if (message.nearAudio !== undefined) { - obj.nearAudio = exports.NearAudioSearch.toJSON(message.nearAudio); - } - if (message.nearVideo !== undefined) { - obj.nearVideo = exports.NearVideoSearch.toJSON(message.nearVideo); - } - if (message.nearDepth !== undefined) { - obj.nearDepth = exports.NearDepthSearch.toJSON(message.nearDepth); - } - if (message.nearThermal !== undefined) { - obj.nearThermal = exports.NearThermalSearch.toJSON(message.nearThermal); - } - if (message.nearImu !== undefined) { - obj.nearImu = exports.NearIMUSearch.toJSON(message.nearImu); - } - if (message.generative !== undefined) { - obj.generative = generative_js_1.GenerativeSearch.toJSON(message.generative); - } - if (message.rerank !== undefined) { - obj.rerank = exports.Rerank.toJSON(message.rerank); - } - if (message.uses123Api !== false) { - obj.uses123Api = message.uses123Api; - } - if (message.uses125Api !== false) { - obj.uses125Api = message.uses125Api; - } - if (message.uses127Api !== false) { - obj.uses127Api = message.uses127Api; - } - return obj; - }, - create(base) { - return exports.SearchRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; - const message = createBaseSearchRequest(); - message.collection = (_a = object.collection) !== null && _a !== void 0 ? _a : ''; - message.tenant = (_b = object.tenant) !== null && _b !== void 0 ? _b : ''; - message.consistencyLevel = (_c = object.consistencyLevel) !== null && _c !== void 0 ? _c : undefined; - message.properties = - object.properties !== undefined && object.properties !== null - ? exports.PropertiesRequest.fromPartial(object.properties) - : undefined; - message.metadata = - object.metadata !== undefined && object.metadata !== null - ? exports.MetadataRequest.fromPartial(object.metadata) - : undefined; - message.groupBy = - object.groupBy !== undefined && object.groupBy !== null - ? exports.GroupBy.fromPartial(object.groupBy) - : undefined; - message.limit = (_d = object.limit) !== null && _d !== void 0 ? _d : 0; - message.offset = (_e = object.offset) !== null && _e !== void 0 ? _e : 0; - message.autocut = (_f = object.autocut) !== null && _f !== void 0 ? _f : 0; - message.after = (_g = object.after) !== null && _g !== void 0 ? _g : ''; - message.sortBy = - ((_h = object.sortBy) === null || _h === void 0 - ? void 0 - : _h.map((e) => exports.SortBy.fromPartial(e))) || []; - message.filters = - object.filters !== undefined && object.filters !== null - ? base_js_1.Filters.fromPartial(object.filters) - : undefined; - message.hybridSearch = - object.hybridSearch !== undefined && object.hybridSearch !== null - ? exports.Hybrid.fromPartial(object.hybridSearch) - : undefined; - message.bm25Search = - object.bm25Search !== undefined && object.bm25Search !== null - ? exports.BM25.fromPartial(object.bm25Search) - : undefined; - message.nearVector = - object.nearVector !== undefined && object.nearVector !== null - ? exports.NearVector.fromPartial(object.nearVector) - : undefined; - message.nearObject = - object.nearObject !== undefined && object.nearObject !== null - ? exports.NearObject.fromPartial(object.nearObject) - : undefined; - message.nearText = - object.nearText !== undefined && object.nearText !== null - ? exports.NearTextSearch.fromPartial(object.nearText) - : undefined; - message.nearImage = - object.nearImage !== undefined && object.nearImage !== null - ? exports.NearImageSearch.fromPartial(object.nearImage) - : undefined; - message.nearAudio = - object.nearAudio !== undefined && object.nearAudio !== null - ? exports.NearAudioSearch.fromPartial(object.nearAudio) - : undefined; - message.nearVideo = - object.nearVideo !== undefined && object.nearVideo !== null - ? exports.NearVideoSearch.fromPartial(object.nearVideo) - : undefined; - message.nearDepth = - object.nearDepth !== undefined && object.nearDepth !== null - ? exports.NearDepthSearch.fromPartial(object.nearDepth) - : undefined; - message.nearThermal = - object.nearThermal !== undefined && object.nearThermal !== null - ? exports.NearThermalSearch.fromPartial(object.nearThermal) - : undefined; - message.nearImu = - object.nearImu !== undefined && object.nearImu !== null - ? exports.NearIMUSearch.fromPartial(object.nearImu) - : undefined; - message.generative = - object.generative !== undefined && object.generative !== null - ? generative_js_1.GenerativeSearch.fromPartial(object.generative) - : undefined; - message.rerank = - object.rerank !== undefined && object.rerank !== null - ? exports.Rerank.fromPartial(object.rerank) - : undefined; - message.uses123Api = (_j = object.uses123Api) !== null && _j !== void 0 ? _j : false; - message.uses125Api = (_k = object.uses125Api) !== null && _k !== void 0 ? _k : false; - message.uses127Api = (_l = object.uses127Api) !== null && _l !== void 0 ? _l : false; - return message; - }, -}; -function createBaseGroupBy() { - return { path: [], numberOfGroups: 0, objectsPerGroup: 0 }; -} -exports.GroupBy = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.path) { - writer.uint32(10).string(v); - } - if (message.numberOfGroups !== 0) { - writer.uint32(16).int32(message.numberOfGroups); - } - if (message.objectsPerGroup !== 0) { - writer.uint32(24).int32(message.objectsPerGroup); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGroupBy(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.path.push(reader.string()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.numberOfGroups = reader.int32(); - continue; - case 3: - if (tag !== 24) { - break; - } - message.objectsPerGroup = reader.int32(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - path: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.path) - ? object.path.map((e) => globalThis.String(e)) - : [], - numberOfGroups: isSet(object.numberOfGroups) ? globalThis.Number(object.numberOfGroups) : 0, - objectsPerGroup: isSet(object.objectsPerGroup) ? globalThis.Number(object.objectsPerGroup) : 0, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.path) === null || _a === void 0 ? void 0 : _a.length) { - obj.path = message.path; - } - if (message.numberOfGroups !== 0) { - obj.numberOfGroups = Math.round(message.numberOfGroups); - } - if (message.objectsPerGroup !== 0) { - obj.objectsPerGroup = Math.round(message.objectsPerGroup); - } - return obj; - }, - create(base) { - return exports.GroupBy.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGroupBy(); - message.path = ((_a = object.path) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.numberOfGroups = (_b = object.numberOfGroups) !== null && _b !== void 0 ? _b : 0; - message.objectsPerGroup = (_c = object.objectsPerGroup) !== null && _c !== void 0 ? _c : 0; - return message; - }, -}; -function createBaseSortBy() { - return { ascending: false, path: [] }; -} -exports.SortBy = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.ascending !== false) { - writer.uint32(8).bool(message.ascending); - } - for (const v of message.path) { - writer.uint32(18).string(v); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSortBy(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.ascending = reader.bool(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.path.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - ascending: isSet(object.ascending) ? globalThis.Boolean(object.ascending) : false, - path: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.path) - ? object.path.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.ascending !== false) { - obj.ascending = message.ascending; - } - if ((_a = message.path) === null || _a === void 0 ? void 0 : _a.length) { - obj.path = message.path; - } - return obj; - }, - create(base) { - return exports.SortBy.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseSortBy(); - message.ascending = (_a = object.ascending) !== null && _a !== void 0 ? _a : false; - message.path = ((_b = object.path) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - return message; - }, -}; -function createBaseMetadataRequest() { - return { - uuid: false, - vector: false, - creationTimeUnix: false, - lastUpdateTimeUnix: false, - distance: false, - certainty: false, - score: false, - explainScore: false, - isConsistent: false, - vectors: [], - }; -} -exports.MetadataRequest = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.uuid !== false) { - writer.uint32(8).bool(message.uuid); - } - if (message.vector !== false) { - writer.uint32(16).bool(message.vector); - } - if (message.creationTimeUnix !== false) { - writer.uint32(24).bool(message.creationTimeUnix); - } - if (message.lastUpdateTimeUnix !== false) { - writer.uint32(32).bool(message.lastUpdateTimeUnix); - } - if (message.distance !== false) { - writer.uint32(40).bool(message.distance); - } - if (message.certainty !== false) { - writer.uint32(48).bool(message.certainty); - } - if (message.score !== false) { - writer.uint32(56).bool(message.score); - } - if (message.explainScore !== false) { - writer.uint32(64).bool(message.explainScore); - } - if (message.isConsistent !== false) { - writer.uint32(72).bool(message.isConsistent); - } - for (const v of message.vectors) { - writer.uint32(82).string(v); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMetadataRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.uuid = reader.bool(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.vector = reader.bool(); - continue; - case 3: - if (tag !== 24) { - break; - } - message.creationTimeUnix = reader.bool(); - continue; - case 4: - if (tag !== 32) { - break; - } - message.lastUpdateTimeUnix = reader.bool(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.distance = reader.bool(); - continue; - case 6: - if (tag !== 48) { - break; - } - message.certainty = reader.bool(); - continue; - case 7: - if (tag !== 56) { - break; - } - message.score = reader.bool(); - continue; - case 8: - if (tag !== 64) { - break; - } - message.explainScore = reader.bool(); - continue; - case 9: - if (tag !== 72) { - break; - } - message.isConsistent = reader.bool(); - continue; - case 10: - if (tag !== 82) { - break; - } - message.vectors.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - uuid: isSet(object.uuid) ? globalThis.Boolean(object.uuid) : false, - vector: isSet(object.vector) ? globalThis.Boolean(object.vector) : false, - creationTimeUnix: isSet(object.creationTimeUnix) ? globalThis.Boolean(object.creationTimeUnix) : false, - lastUpdateTimeUnix: isSet(object.lastUpdateTimeUnix) - ? globalThis.Boolean(object.lastUpdateTimeUnix) - : false, - distance: isSet(object.distance) ? globalThis.Boolean(object.distance) : false, - certainty: isSet(object.certainty) ? globalThis.Boolean(object.certainty) : false, - score: isSet(object.score) ? globalThis.Boolean(object.score) : false, - explainScore: isSet(object.explainScore) ? globalThis.Boolean(object.explainScore) : false, - isConsistent: isSet(object.isConsistent) ? globalThis.Boolean(object.isConsistent) : false, - vectors: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.vectors) - ? object.vectors.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.uuid !== false) { - obj.uuid = message.uuid; - } - if (message.vector !== false) { - obj.vector = message.vector; - } - if (message.creationTimeUnix !== false) { - obj.creationTimeUnix = message.creationTimeUnix; - } - if (message.lastUpdateTimeUnix !== false) { - obj.lastUpdateTimeUnix = message.lastUpdateTimeUnix; - } - if (message.distance !== false) { - obj.distance = message.distance; - } - if (message.certainty !== false) { - obj.certainty = message.certainty; - } - if (message.score !== false) { - obj.score = message.score; - } - if (message.explainScore !== false) { - obj.explainScore = message.explainScore; - } - if (message.isConsistent !== false) { - obj.isConsistent = message.isConsistent; - } - if ((_a = message.vectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.vectors = message.vectors; - } - return obj; - }, - create(base) { - return exports.MetadataRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - const message = createBaseMetadataRequest(); - message.uuid = (_a = object.uuid) !== null && _a !== void 0 ? _a : false; - message.vector = (_b = object.vector) !== null && _b !== void 0 ? _b : false; - message.creationTimeUnix = (_c = object.creationTimeUnix) !== null && _c !== void 0 ? _c : false; - message.lastUpdateTimeUnix = (_d = object.lastUpdateTimeUnix) !== null && _d !== void 0 ? _d : false; - message.distance = (_e = object.distance) !== null && _e !== void 0 ? _e : false; - message.certainty = (_f = object.certainty) !== null && _f !== void 0 ? _f : false; - message.score = (_g = object.score) !== null && _g !== void 0 ? _g : false; - message.explainScore = (_h = object.explainScore) !== null && _h !== void 0 ? _h : false; - message.isConsistent = (_j = object.isConsistent) !== null && _j !== void 0 ? _j : false; - message.vectors = ((_k = object.vectors) === null || _k === void 0 ? void 0 : _k.map((e) => e)) || []; - return message; - }, -}; -function createBasePropertiesRequest() { - return { nonRefProperties: [], refProperties: [], objectProperties: [], returnAllNonrefProperties: false }; -} -exports.PropertiesRequest = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.nonRefProperties) { - writer.uint32(10).string(v); - } - for (const v of message.refProperties) { - exports.RefPropertiesRequest.encode(v, writer.uint32(18).fork()).ldelim(); - } - for (const v of message.objectProperties) { - exports.ObjectPropertiesRequest.encode(v, writer.uint32(26).fork()).ldelim(); - } - if (message.returnAllNonrefProperties !== false) { - writer.uint32(88).bool(message.returnAllNonrefProperties); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePropertiesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.nonRefProperties.push(reader.string()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.refProperties.push(exports.RefPropertiesRequest.decode(reader, reader.uint32())); - continue; - case 3: - if (tag !== 26) { - break; - } - message.objectProperties.push(exports.ObjectPropertiesRequest.decode(reader, reader.uint32())); - continue; - case 11: - if (tag !== 88) { - break; - } - message.returnAllNonrefProperties = reader.bool(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - nonRefProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.nonRefProperties - ) - ? object.nonRefProperties.map((e) => globalThis.String(e)) - : [], - refProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.refProperties - ) - ? object.refProperties.map((e) => exports.RefPropertiesRequest.fromJSON(e)) - : [], - objectProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectProperties - ) - ? object.objectProperties.map((e) => exports.ObjectPropertiesRequest.fromJSON(e)) - : [], - returnAllNonrefProperties: isSet(object.returnAllNonrefProperties) - ? globalThis.Boolean(object.returnAllNonrefProperties) - : false, - }; - }, - toJSON(message) { - var _a, _b, _c; - const obj = {}; - if ((_a = message.nonRefProperties) === null || _a === void 0 ? void 0 : _a.length) { - obj.nonRefProperties = message.nonRefProperties; - } - if ((_b = message.refProperties) === null || _b === void 0 ? void 0 : _b.length) { - obj.refProperties = message.refProperties.map((e) => exports.RefPropertiesRequest.toJSON(e)); - } - if ((_c = message.objectProperties) === null || _c === void 0 ? void 0 : _c.length) { - obj.objectProperties = message.objectProperties.map((e) => exports.ObjectPropertiesRequest.toJSON(e)); - } - if (message.returnAllNonrefProperties !== false) { - obj.returnAllNonrefProperties = message.returnAllNonrefProperties; - } - return obj; - }, - create(base) { - return exports.PropertiesRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBasePropertiesRequest(); - message.nonRefProperties = - ((_a = object.nonRefProperties) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.refProperties = - ((_b = object.refProperties) === null || _b === void 0 - ? void 0 - : _b.map((e) => exports.RefPropertiesRequest.fromPartial(e))) || []; - message.objectProperties = - ((_c = object.objectProperties) === null || _c === void 0 - ? void 0 - : _c.map((e) => exports.ObjectPropertiesRequest.fromPartial(e))) || []; - message.returnAllNonrefProperties = - (_d = object.returnAllNonrefProperties) !== null && _d !== void 0 ? _d : false; - return message; - }, -}; -function createBaseObjectPropertiesRequest() { - return { propName: '', primitiveProperties: [], objectProperties: [] }; -} -exports.ObjectPropertiesRequest = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.propName !== '') { - writer.uint32(10).string(message.propName); - } - for (const v of message.primitiveProperties) { - writer.uint32(18).string(v); - } - for (const v of message.objectProperties) { - exports.ObjectPropertiesRequest.encode(v, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseObjectPropertiesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.propName = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.primitiveProperties.push(reader.string()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.objectProperties.push(exports.ObjectPropertiesRequest.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - primitiveProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.primitiveProperties - ) - ? object.primitiveProperties.map((e) => globalThis.String(e)) - : [], - objectProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectProperties - ) - ? object.objectProperties.map((e) => exports.ObjectPropertiesRequest.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if (message.propName !== '') { - obj.propName = message.propName; - } - if ((_a = message.primitiveProperties) === null || _a === void 0 ? void 0 : _a.length) { - obj.primitiveProperties = message.primitiveProperties; - } - if ((_b = message.objectProperties) === null || _b === void 0 ? void 0 : _b.length) { - obj.objectProperties = message.objectProperties.map((e) => exports.ObjectPropertiesRequest.toJSON(e)); - } - return obj; - }, - create(base) { - return exports.ObjectPropertiesRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseObjectPropertiesRequest(); - message.propName = (_a = object.propName) !== null && _a !== void 0 ? _a : ''; - message.primitiveProperties = - ((_b = object.primitiveProperties) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - message.objectProperties = - ((_c = object.objectProperties) === null || _c === void 0 - ? void 0 - : _c.map((e) => exports.ObjectPropertiesRequest.fromPartial(e))) || []; - return message; - }, -}; -function createBaseWeightsForTarget() { - return { target: '', weight: 0 }; -} -exports.WeightsForTarget = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.target !== '') { - writer.uint32(10).string(message.target); - } - if (message.weight !== 0) { - writer.uint32(21).float(message.weight); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseWeightsForTarget(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.target = reader.string(); - continue; - case 2: - if (tag !== 21) { - break; - } - message.weight = reader.float(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - target: isSet(object.target) ? globalThis.String(object.target) : '', - weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, - }; - }, - toJSON(message) { - const obj = {}; - if (message.target !== '') { - obj.target = message.target; - } - if (message.weight !== 0) { - obj.weight = message.weight; - } - return obj; - }, - create(base) { - return exports.WeightsForTarget.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseWeightsForTarget(); - message.target = (_a = object.target) !== null && _a !== void 0 ? _a : ''; - message.weight = (_b = object.weight) !== null && _b !== void 0 ? _b : 0; - return message; - }, -}; -function createBaseTargets() { - return { targetVectors: [], combination: 0, weights: {}, weightsForTargets: [] }; -} -exports.Targets = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.targetVectors) { - writer.uint32(10).string(v); - } - if (message.combination !== 0) { - writer.uint32(16).int32(message.combination); - } - Object.entries(message.weights).forEach(([key, value]) => { - exports.Targets_WeightsEntry.encode({ key: key, value }, writer.uint32(26).fork()).ldelim(); - }); - for (const v of message.weightsForTargets) { - exports.WeightsForTarget.encode(v, writer.uint32(34).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTargets(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.combination = reader.int32(); - continue; - case 3: - if (tag !== 26) { - break; - } - const entry3 = exports.Targets_WeightsEntry.decode(reader, reader.uint32()); - if (entry3.value !== undefined) { - message.weights[entry3.key] = entry3.value; - } - continue; - case 4: - if (tag !== 34) { - break; - } - message.weightsForTargets.push(exports.WeightsForTarget.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - combination: isSet(object.combination) ? combinationMethodFromJSON(object.combination) : 0, - weights: isObject(object.weights) - ? Object.entries(object.weights).reduce((acc, [key, value]) => { - acc[key] = Number(value); - return acc; - }, {}) - : {}, - weightsForTargets: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.weightsForTargets - ) - ? object.weightsForTargets.map((e) => exports.WeightsForTarget.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.combination !== 0) { - obj.combination = combinationMethodToJSON(message.combination); - } - if (message.weights) { - const entries = Object.entries(message.weights); - if (entries.length > 0) { - obj.weights = {}; - entries.forEach(([k, v]) => { - obj.weights[k] = v; - }); - } - } - if ((_b = message.weightsForTargets) === null || _b === void 0 ? void 0 : _b.length) { - obj.weightsForTargets = message.weightsForTargets.map((e) => exports.WeightsForTarget.toJSON(e)); - } - return obj; - }, - create(base) { - return exports.Targets.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseTargets(); - message.targetVectors = - ((_a = object.targetVectors) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.combination = (_b = object.combination) !== null && _b !== void 0 ? _b : 0; - message.weights = Object.entries((_c = object.weights) !== null && _c !== void 0 ? _c : {}).reduce( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = globalThis.Number(value); - } - return acc; - }, - {} - ); - message.weightsForTargets = - ((_d = object.weightsForTargets) === null || _d === void 0 - ? void 0 - : _d.map((e) => exports.WeightsForTarget.fromPartial(e))) || []; - return message; - }, -}; -function createBaseTargets_WeightsEntry() { - return { key: '', value: 0 }; -} -exports.Targets_WeightsEntry = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.key !== '') { - writer.uint32(10).string(message.key); - } - if (message.value !== 0) { - writer.uint32(21).float(message.value); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTargets_WeightsEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.key = reader.string(); - continue; - case 2: - if (tag !== 21) { - break; - } - message.value = reader.float(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - key: isSet(object.key) ? globalThis.String(object.key) : '', - value: isSet(object.value) ? globalThis.Number(object.value) : 0, - }; - }, - toJSON(message) { - const obj = {}; - if (message.key !== '') { - obj.key = message.key; - } - if (message.value !== 0) { - obj.value = message.value; - } - return obj; - }, - create(base) { - return exports.Targets_WeightsEntry.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseTargets_WeightsEntry(); - message.key = (_a = object.key) !== null && _a !== void 0 ? _a : ''; - message.value = (_b = object.value) !== null && _b !== void 0 ? _b : 0; - return message; - }, -}; -function createBaseHybrid() { - return { - query: '', - properties: [], - vector: [], - alpha: 0, - fusionType: 0, - vectorBytes: new Uint8Array(0), - targetVectors: [], - nearText: undefined, - nearVector: undefined, - targets: undefined, - vectorDistance: undefined, - }; -} -exports.Hybrid = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.query !== '') { - writer.uint32(10).string(message.query); - } - for (const v of message.properties) { - writer.uint32(18).string(v); - } - writer.uint32(26).fork(); - for (const v of message.vector) { - writer.float(v); - } - writer.ldelim(); - if (message.alpha !== 0) { - writer.uint32(37).float(message.alpha); - } - if (message.fusionType !== 0) { - writer.uint32(40).int32(message.fusionType); - } - if (message.vectorBytes.length !== 0) { - writer.uint32(50).bytes(message.vectorBytes); - } - for (const v of message.targetVectors) { - writer.uint32(58).string(v); - } - if (message.nearText !== undefined) { - exports.NearTextSearch.encode(message.nearText, writer.uint32(66).fork()).ldelim(); - } - if (message.nearVector !== undefined) { - exports.NearVector.encode(message.nearVector, writer.uint32(74).fork()).ldelim(); - } - if (message.targets !== undefined) { - exports.Targets.encode(message.targets, writer.uint32(82).fork()).ldelim(); - } - if (message.vectorDistance !== undefined) { - writer.uint32(165).float(message.vectorDistance); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseHybrid(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.query = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.properties.push(reader.string()); - continue; - case 3: - if (tag === 29) { - message.vector.push(reader.float()); - continue; - } - if (tag === 26) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.vector.push(reader.float()); - } - continue; - } - break; - case 4: - if (tag !== 37) { - break; - } - message.alpha = reader.float(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.fusionType = reader.int32(); - continue; - case 6: - if (tag !== 50) { - break; - } - message.vectorBytes = reader.bytes(); - continue; - case 7: - if (tag !== 58) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 8: - if (tag !== 66) { - break; - } - message.nearText = exports.NearTextSearch.decode(reader, reader.uint32()); - continue; - case 9: - if (tag !== 74) { - break; - } - message.nearVector = exports.NearVector.decode(reader, reader.uint32()); - continue; - case 10: - if (tag !== 82) { - break; - } - message.targets = exports.Targets.decode(reader, reader.uint32()); - continue; - case 20: - if (tag !== 165) { - break; - } - message.vectorDistance = reader.float(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - query: isSet(object.query) ? globalThis.String(object.query) : '', - properties: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.properties) - ? object.properties.map((e) => globalThis.String(e)) - : [], - vector: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.vector) - ? object.vector.map((e) => globalThis.Number(e)) - : [], - alpha: isSet(object.alpha) ? globalThis.Number(object.alpha) : 0, - fusionType: isSet(object.fusionType) ? hybrid_FusionTypeFromJSON(object.fusionType) : 0, - vectorBytes: isSet(object.vectorBytes) ? bytesFromBase64(object.vectorBytes) : new Uint8Array(0), - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - nearText: isSet(object.nearText) ? exports.NearTextSearch.fromJSON(object.nearText) : undefined, - nearVector: isSet(object.nearVector) ? exports.NearVector.fromJSON(object.nearVector) : undefined, - targets: isSet(object.targets) ? exports.Targets.fromJSON(object.targets) : undefined, - vectorDistance: isSet(object.vectorDistance) ? globalThis.Number(object.vectorDistance) : undefined, - }; - }, - toJSON(message) { - var _a, _b, _c; - const obj = {}; - if (message.query !== '') { - obj.query = message.query; - } - if ((_a = message.properties) === null || _a === void 0 ? void 0 : _a.length) { - obj.properties = message.properties; - } - if ((_b = message.vector) === null || _b === void 0 ? void 0 : _b.length) { - obj.vector = message.vector; - } - if (message.alpha !== 0) { - obj.alpha = message.alpha; - } - if (message.fusionType !== 0) { - obj.fusionType = hybrid_FusionTypeToJSON(message.fusionType); - } - if (message.vectorBytes.length !== 0) { - obj.vectorBytes = base64FromBytes(message.vectorBytes); - } - if ((_c = message.targetVectors) === null || _c === void 0 ? void 0 : _c.length) { - obj.targetVectors = message.targetVectors; - } - if (message.nearText !== undefined) { - obj.nearText = exports.NearTextSearch.toJSON(message.nearText); - } - if (message.nearVector !== undefined) { - obj.nearVector = exports.NearVector.toJSON(message.nearVector); - } - if (message.targets !== undefined) { - obj.targets = exports.Targets.toJSON(message.targets); - } - if (message.vectorDistance !== undefined) { - obj.vectorDistance = message.vectorDistance; - } - return obj; - }, - create(base) { - return exports.Hybrid.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h; - const message = createBaseHybrid(); - message.query = (_a = object.query) !== null && _a !== void 0 ? _a : ''; - message.properties = - ((_b = object.properties) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - message.vector = ((_c = object.vector) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || []; - message.alpha = (_d = object.alpha) !== null && _d !== void 0 ? _d : 0; - message.fusionType = (_e = object.fusionType) !== null && _e !== void 0 ? _e : 0; - message.vectorBytes = (_f = object.vectorBytes) !== null && _f !== void 0 ? _f : new Uint8Array(0); - message.targetVectors = - ((_g = object.targetVectors) === null || _g === void 0 ? void 0 : _g.map((e) => e)) || []; - message.nearText = - object.nearText !== undefined && object.nearText !== null - ? exports.NearTextSearch.fromPartial(object.nearText) - : undefined; - message.nearVector = - object.nearVector !== undefined && object.nearVector !== null - ? exports.NearVector.fromPartial(object.nearVector) - : undefined; - message.targets = - object.targets !== undefined && object.targets !== null - ? exports.Targets.fromPartial(object.targets) - : undefined; - message.vectorDistance = (_h = object.vectorDistance) !== null && _h !== void 0 ? _h : undefined; - return message; - }, -}; -function createBaseNearTextSearch() { - return { - query: [], - certainty: undefined, - distance: undefined, - moveTo: undefined, - moveAway: undefined, - targetVectors: [], - targets: undefined, - }; -} -exports.NearTextSearch = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.query) { - writer.uint32(10).string(v); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - if (message.moveTo !== undefined) { - exports.NearTextSearch_Move.encode(message.moveTo, writer.uint32(34).fork()).ldelim(); - } - if (message.moveAway !== undefined) { - exports.NearTextSearch_Move.encode(message.moveAway, writer.uint32(42).fork()).ldelim(); - } - for (const v of message.targetVectors) { - writer.uint32(50).string(v); - } - if (message.targets !== undefined) { - exports.Targets.encode(message.targets, writer.uint32(58).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearTextSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.query.push(reader.string()); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.moveTo = exports.NearTextSearch_Move.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.moveAway = exports.NearTextSearch_Move.decode(reader, reader.uint32()); - continue; - case 6: - if (tag !== 50) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 7: - if (tag !== 58) { - break; - } - message.targets = exports.Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - query: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.query) - ? object.query.map((e) => globalThis.String(e)) - : [], - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - moveTo: isSet(object.moveTo) ? exports.NearTextSearch_Move.fromJSON(object.moveTo) : undefined, - moveAway: isSet(object.moveAway) ? exports.NearTextSearch_Move.fromJSON(object.moveAway) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? exports.Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if ((_a = message.query) === null || _a === void 0 ? void 0 : _a.length) { - obj.query = message.query; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if (message.moveTo !== undefined) { - obj.moveTo = exports.NearTextSearch_Move.toJSON(message.moveTo); - } - if (message.moveAway !== undefined) { - obj.moveAway = exports.NearTextSearch_Move.toJSON(message.moveAway); - } - if ((_b = message.targetVectors) === null || _b === void 0 ? void 0 : _b.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = exports.Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return exports.NearTextSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearTextSearch(); - message.query = ((_a = object.query) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.moveTo = - object.moveTo !== undefined && object.moveTo !== null - ? exports.NearTextSearch_Move.fromPartial(object.moveTo) - : undefined; - message.moveAway = - object.moveAway !== undefined && object.moveAway !== null - ? exports.NearTextSearch_Move.fromPartial(object.moveAway) - : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? exports.Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseNearTextSearch_Move() { - return { force: 0, concepts: [], uuids: [] }; -} -exports.NearTextSearch_Move = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.force !== 0) { - writer.uint32(13).float(message.force); - } - for (const v of message.concepts) { - writer.uint32(18).string(v); - } - for (const v of message.uuids) { - writer.uint32(26).string(v); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearTextSearch_Move(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 13) { - break; - } - message.force = reader.float(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.concepts.push(reader.string()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.uuids.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - force: isSet(object.force) ? globalThis.Number(object.force) : 0, - concepts: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.concepts) - ? object.concepts.map((e) => globalThis.String(e)) - : [], - uuids: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.uuids) - ? object.uuids.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if (message.force !== 0) { - obj.force = message.force; - } - if ((_a = message.concepts) === null || _a === void 0 ? void 0 : _a.length) { - obj.concepts = message.concepts; - } - if ((_b = message.uuids) === null || _b === void 0 ? void 0 : _b.length) { - obj.uuids = message.uuids; - } - return obj; - }, - create(base) { - return exports.NearTextSearch_Move.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseNearTextSearch_Move(); - message.force = (_a = object.force) !== null && _a !== void 0 ? _a : 0; - message.concepts = ((_b = object.concepts) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - message.uuids = ((_c = object.uuids) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || []; - return message; - }, -}; -function createBaseNearImageSearch() { - return { image: '', certainty: undefined, distance: undefined, targetVectors: [], targets: undefined }; -} -exports.NearImageSearch = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.image !== '') { - writer.uint32(10).string(message.image); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - for (const v of message.targetVectors) { - writer.uint32(34).string(v); - } - if (message.targets !== undefined) { - exports.Targets.encode(message.targets, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearImageSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.image = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targets = exports.Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - image: isSet(object.image) ? globalThis.String(object.image) : '', - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? exports.Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.image !== '') { - obj.image = message.image; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = exports.Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return exports.NearImageSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearImageSearch(); - message.image = (_a = object.image) !== null && _a !== void 0 ? _a : ''; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? exports.Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseNearAudioSearch() { - return { audio: '', certainty: undefined, distance: undefined, targetVectors: [], targets: undefined }; -} -exports.NearAudioSearch = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.audio !== '') { - writer.uint32(10).string(message.audio); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - for (const v of message.targetVectors) { - writer.uint32(34).string(v); - } - if (message.targets !== undefined) { - exports.Targets.encode(message.targets, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearAudioSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.audio = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targets = exports.Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - audio: isSet(object.audio) ? globalThis.String(object.audio) : '', - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? exports.Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.audio !== '') { - obj.audio = message.audio; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = exports.Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return exports.NearAudioSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearAudioSearch(); - message.audio = (_a = object.audio) !== null && _a !== void 0 ? _a : ''; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? exports.Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseNearVideoSearch() { - return { video: '', certainty: undefined, distance: undefined, targetVectors: [], targets: undefined }; -} -exports.NearVideoSearch = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.video !== '') { - writer.uint32(10).string(message.video); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - for (const v of message.targetVectors) { - writer.uint32(34).string(v); - } - if (message.targets !== undefined) { - exports.Targets.encode(message.targets, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearVideoSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.video = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targets = exports.Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - video: isSet(object.video) ? globalThis.String(object.video) : '', - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? exports.Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.video !== '') { - obj.video = message.video; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = exports.Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return exports.NearVideoSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearVideoSearch(); - message.video = (_a = object.video) !== null && _a !== void 0 ? _a : ''; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? exports.Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseNearDepthSearch() { - return { depth: '', certainty: undefined, distance: undefined, targetVectors: [], targets: undefined }; -} -exports.NearDepthSearch = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.depth !== '') { - writer.uint32(10).string(message.depth); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - for (const v of message.targetVectors) { - writer.uint32(34).string(v); - } - if (message.targets !== undefined) { - exports.Targets.encode(message.targets, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearDepthSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.depth = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targets = exports.Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - depth: isSet(object.depth) ? globalThis.String(object.depth) : '', - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? exports.Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.depth !== '') { - obj.depth = message.depth; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = exports.Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return exports.NearDepthSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearDepthSearch(); - message.depth = (_a = object.depth) !== null && _a !== void 0 ? _a : ''; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? exports.Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseNearThermalSearch() { - return { thermal: '', certainty: undefined, distance: undefined, targetVectors: [], targets: undefined }; -} -exports.NearThermalSearch = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.thermal !== '') { - writer.uint32(10).string(message.thermal); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - for (const v of message.targetVectors) { - writer.uint32(34).string(v); - } - if (message.targets !== undefined) { - exports.Targets.encode(message.targets, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearThermalSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.thermal = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targets = exports.Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - thermal: isSet(object.thermal) ? globalThis.String(object.thermal) : '', - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? exports.Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.thermal !== '') { - obj.thermal = message.thermal; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = exports.Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return exports.NearThermalSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearThermalSearch(); - message.thermal = (_a = object.thermal) !== null && _a !== void 0 ? _a : ''; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? exports.Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseNearIMUSearch() { - return { imu: '', certainty: undefined, distance: undefined, targetVectors: [], targets: undefined }; -} -exports.NearIMUSearch = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.imu !== '') { - writer.uint32(10).string(message.imu); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - for (const v of message.targetVectors) { - writer.uint32(34).string(v); - } - if (message.targets !== undefined) { - exports.Targets.encode(message.targets, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearIMUSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.imu = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targets = exports.Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - imu: isSet(object.imu) ? globalThis.String(object.imu) : '', - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? exports.Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.imu !== '') { - obj.imu = message.imu; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = exports.Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return exports.NearIMUSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearIMUSearch(); - message.imu = (_a = object.imu) !== null && _a !== void 0 ? _a : ''; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? exports.Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseBM25() { - return { query: '', properties: [] }; -} -exports.BM25 = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.query !== '') { - writer.uint32(10).string(message.query); - } - for (const v of message.properties) { - writer.uint32(18).string(v); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBM25(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.query = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.properties.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - query: isSet(object.query) ? globalThis.String(object.query) : '', - properties: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.properties) - ? object.properties.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.query !== '') { - obj.query = message.query; - } - if ((_a = message.properties) === null || _a === void 0 ? void 0 : _a.length) { - obj.properties = message.properties; - } - return obj; - }, - create(base) { - return exports.BM25.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseBM25(); - message.query = (_a = object.query) !== null && _a !== void 0 ? _a : ''; - message.properties = - ((_b = object.properties) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - return message; - }, -}; -function createBaseRefPropertiesRequest() { - return { referenceProperty: '', properties: undefined, metadata: undefined, targetCollection: '' }; -} -exports.RefPropertiesRequest = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.referenceProperty !== '') { - writer.uint32(10).string(message.referenceProperty); - } - if (message.properties !== undefined) { - exports.PropertiesRequest.encode(message.properties, writer.uint32(18).fork()).ldelim(); - } - if (message.metadata !== undefined) { - exports.MetadataRequest.encode(message.metadata, writer.uint32(26).fork()).ldelim(); - } - if (message.targetCollection !== '') { - writer.uint32(34).string(message.targetCollection); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRefPropertiesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.referenceProperty = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.properties = exports.PropertiesRequest.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.metadata = exports.MetadataRequest.decode(reader, reader.uint32()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetCollection = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - referenceProperty: isSet(object.referenceProperty) ? globalThis.String(object.referenceProperty) : '', - properties: isSet(object.properties) - ? exports.PropertiesRequest.fromJSON(object.properties) - : undefined, - metadata: isSet(object.metadata) ? exports.MetadataRequest.fromJSON(object.metadata) : undefined, - targetCollection: isSet(object.targetCollection) ? globalThis.String(object.targetCollection) : '', - }; - }, - toJSON(message) { - const obj = {}; - if (message.referenceProperty !== '') { - obj.referenceProperty = message.referenceProperty; - } - if (message.properties !== undefined) { - obj.properties = exports.PropertiesRequest.toJSON(message.properties); - } - if (message.metadata !== undefined) { - obj.metadata = exports.MetadataRequest.toJSON(message.metadata); - } - if (message.targetCollection !== '') { - obj.targetCollection = message.targetCollection; - } - return obj; - }, - create(base) { - return exports.RefPropertiesRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseRefPropertiesRequest(); - message.referenceProperty = (_a = object.referenceProperty) !== null && _a !== void 0 ? _a : ''; - message.properties = - object.properties !== undefined && object.properties !== null - ? exports.PropertiesRequest.fromPartial(object.properties) - : undefined; - message.metadata = - object.metadata !== undefined && object.metadata !== null - ? exports.MetadataRequest.fromPartial(object.metadata) - : undefined; - message.targetCollection = (_b = object.targetCollection) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function createBaseVectorForTarget() { - return { name: '', vectorBytes: new Uint8Array(0) }; -} -exports.VectorForTarget = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.name !== '') { - writer.uint32(10).string(message.name); - } - if (message.vectorBytes.length !== 0) { - writer.uint32(18).bytes(message.vectorBytes); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseVectorForTarget(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.name = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.vectorBytes = reader.bytes(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - name: isSet(object.name) ? globalThis.String(object.name) : '', - vectorBytes: isSet(object.vectorBytes) ? bytesFromBase64(object.vectorBytes) : new Uint8Array(0), - }; - }, - toJSON(message) { - const obj = {}; - if (message.name !== '') { - obj.name = message.name; - } - if (message.vectorBytes.length !== 0) { - obj.vectorBytes = base64FromBytes(message.vectorBytes); - } - return obj; - }, - create(base) { - return exports.VectorForTarget.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseVectorForTarget(); - message.name = (_a = object.name) !== null && _a !== void 0 ? _a : ''; - message.vectorBytes = (_b = object.vectorBytes) !== null && _b !== void 0 ? _b : new Uint8Array(0); - return message; - }, -}; -function createBaseNearVector() { - return { - vector: [], - certainty: undefined, - distance: undefined, - vectorBytes: new Uint8Array(0), - targetVectors: [], - targets: undefined, - vectorPerTarget: {}, - vectorForTargets: [], - }; -} -exports.NearVector = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.vector) { - writer.float(v); - } - writer.ldelim(); - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - if (message.vectorBytes.length !== 0) { - writer.uint32(34).bytes(message.vectorBytes); - } - for (const v of message.targetVectors) { - writer.uint32(42).string(v); - } - if (message.targets !== undefined) { - exports.Targets.encode(message.targets, writer.uint32(50).fork()).ldelim(); - } - Object.entries(message.vectorPerTarget).forEach(([key, value]) => { - exports.NearVector_VectorPerTargetEntry.encode({ key: key, value }, writer.uint32(58).fork()).ldelim(); - }); - for (const v of message.vectorForTargets) { - exports.VectorForTarget.encode(v, writer.uint32(66).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearVector(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 13) { - message.vector.push(reader.float()); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.vector.push(reader.float()); - } - continue; - } - break; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.vectorBytes = reader.bytes(); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 6: - if (tag !== 50) { - break; - } - message.targets = exports.Targets.decode(reader, reader.uint32()); - continue; - case 7: - if (tag !== 58) { - break; - } - const entry7 = exports.NearVector_VectorPerTargetEntry.decode(reader, reader.uint32()); - if (entry7.value !== undefined) { - message.vectorPerTarget[entry7.key] = entry7.value; - } - continue; - case 8: - if (tag !== 66) { - break; - } - message.vectorForTargets.push(exports.VectorForTarget.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - vector: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.vector) - ? object.vector.map((e) => globalThis.Number(e)) - : [], - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - vectorBytes: isSet(object.vectorBytes) ? bytesFromBase64(object.vectorBytes) : new Uint8Array(0), - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? exports.Targets.fromJSON(object.targets) : undefined, - vectorPerTarget: isObject(object.vectorPerTarget) - ? Object.entries(object.vectorPerTarget).reduce((acc, [key, value]) => { - acc[key] = bytesFromBase64(value); - return acc; - }, {}) - : {}, - vectorForTargets: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.vectorForTargets - ) - ? object.vectorForTargets.map((e) => exports.VectorForTarget.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b, _c; - const obj = {}; - if ((_a = message.vector) === null || _a === void 0 ? void 0 : _a.length) { - obj.vector = message.vector; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if (message.vectorBytes.length !== 0) { - obj.vectorBytes = base64FromBytes(message.vectorBytes); - } - if ((_b = message.targetVectors) === null || _b === void 0 ? void 0 : _b.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = exports.Targets.toJSON(message.targets); - } - if (message.vectorPerTarget) { - const entries = Object.entries(message.vectorPerTarget); - if (entries.length > 0) { - obj.vectorPerTarget = {}; - entries.forEach(([k, v]) => { - obj.vectorPerTarget[k] = base64FromBytes(v); - }); - } - } - if ((_c = message.vectorForTargets) === null || _c === void 0 ? void 0 : _c.length) { - obj.vectorForTargets = message.vectorForTargets.map((e) => exports.VectorForTarget.toJSON(e)); - } - return obj; - }, - create(base) { - return exports.NearVector.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g; - const message = createBaseNearVector(); - message.vector = ((_a = object.vector) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.vectorBytes = (_d = object.vectorBytes) !== null && _d !== void 0 ? _d : new Uint8Array(0); - message.targetVectors = - ((_e = object.targetVectors) === null || _e === void 0 ? void 0 : _e.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? exports.Targets.fromPartial(object.targets) - : undefined; - message.vectorPerTarget = Object.entries( - (_f = object.vectorPerTarget) !== null && _f !== void 0 ? _f : {} - ).reduce((acc, [key, value]) => { - if (value !== undefined) { - acc[key] = value; - } - return acc; - }, {}); - message.vectorForTargets = - ((_g = object.vectorForTargets) === null || _g === void 0 - ? void 0 - : _g.map((e) => exports.VectorForTarget.fromPartial(e))) || []; - return message; - }, -}; -function createBaseNearVector_VectorPerTargetEntry() { - return { key: '', value: new Uint8Array(0) }; -} -exports.NearVector_VectorPerTargetEntry = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.key !== '') { - writer.uint32(10).string(message.key); - } - if (message.value.length !== 0) { - writer.uint32(18).bytes(message.value); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearVector_VectorPerTargetEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.key = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.value = reader.bytes(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - key: isSet(object.key) ? globalThis.String(object.key) : '', - value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), - }; - }, - toJSON(message) { - const obj = {}; - if (message.key !== '') { - obj.key = message.key; - } - if (message.value.length !== 0) { - obj.value = base64FromBytes(message.value); - } - return obj; - }, - create(base) { - return exports.NearVector_VectorPerTargetEntry.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseNearVector_VectorPerTargetEntry(); - message.key = (_a = object.key) !== null && _a !== void 0 ? _a : ''; - message.value = (_b = object.value) !== null && _b !== void 0 ? _b : new Uint8Array(0); - return message; - }, -}; -function createBaseNearObject() { - return { id: '', certainty: undefined, distance: undefined, targetVectors: [], targets: undefined }; -} -exports.NearObject = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.id !== '') { - writer.uint32(10).string(message.id); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - for (const v of message.targetVectors) { - writer.uint32(34).string(v); - } - if (message.targets !== undefined) { - exports.Targets.encode(message.targets, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearObject(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.id = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targets = exports.Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - id: isSet(object.id) ? globalThis.String(object.id) : '', - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? exports.Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.id !== '') { - obj.id = message.id; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = exports.Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return exports.NearObject.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearObject(); - message.id = (_a = object.id) !== null && _a !== void 0 ? _a : ''; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? exports.Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseRerank() { - return { property: '', query: undefined }; -} -exports.Rerank = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.property !== '') { - writer.uint32(10).string(message.property); - } - if (message.query !== undefined) { - writer.uint32(18).string(message.query); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRerank(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.property = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.query = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - property: isSet(object.property) ? globalThis.String(object.property) : '', - query: isSet(object.query) ? globalThis.String(object.query) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.property !== '') { - obj.property = message.property; - } - if (message.query !== undefined) { - obj.query = message.query; - } - return obj; - }, - create(base) { - return exports.Rerank.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseRerank(); - message.property = (_a = object.property) !== null && _a !== void 0 ? _a : ''; - message.query = (_b = object.query) !== null && _b !== void 0 ? _b : undefined; - return message; - }, -}; -function createBaseSearchReply() { - return { - took: 0, - results: [], - generativeGroupedResult: undefined, - groupByResults: [], - generativeGroupedResults: undefined, - }; -} -exports.SearchReply = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.took !== 0) { - writer.uint32(13).float(message.took); - } - for (const v of message.results) { - exports.SearchResult.encode(v, writer.uint32(18).fork()).ldelim(); - } - if (message.generativeGroupedResult !== undefined) { - writer.uint32(26).string(message.generativeGroupedResult); - } - for (const v of message.groupByResults) { - exports.GroupByResult.encode(v, writer.uint32(34).fork()).ldelim(); - } - if (message.generativeGroupedResults !== undefined) { - generative_js_1.GenerativeResult.encode( - message.generativeGroupedResults, - writer.uint32(42).fork() - ).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSearchReply(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 13) { - break; - } - message.took = reader.float(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.results.push(exports.SearchResult.decode(reader, reader.uint32())); - continue; - case 3: - if (tag !== 26) { - break; - } - message.generativeGroupedResult = reader.string(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.groupByResults.push(exports.GroupByResult.decode(reader, reader.uint32())); - continue; - case 5: - if (tag !== 42) { - break; - } - message.generativeGroupedResults = generative_js_1.GenerativeResult.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - took: isSet(object.took) ? globalThis.Number(object.took) : 0, - results: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.results) - ? object.results.map((e) => exports.SearchResult.fromJSON(e)) - : [], - generativeGroupedResult: isSet(object.generativeGroupedResult) - ? globalThis.String(object.generativeGroupedResult) - : undefined, - groupByResults: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.groupByResults - ) - ? object.groupByResults.map((e) => exports.GroupByResult.fromJSON(e)) - : [], - generativeGroupedResults: isSet(object.generativeGroupedResults) - ? generative_js_1.GenerativeResult.fromJSON(object.generativeGroupedResults) - : undefined, - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if (message.took !== 0) { - obj.took = message.took; - } - if ((_a = message.results) === null || _a === void 0 ? void 0 : _a.length) { - obj.results = message.results.map((e) => exports.SearchResult.toJSON(e)); - } - if (message.generativeGroupedResult !== undefined) { - obj.generativeGroupedResult = message.generativeGroupedResult; - } - if ((_b = message.groupByResults) === null || _b === void 0 ? void 0 : _b.length) { - obj.groupByResults = message.groupByResults.map((e) => exports.GroupByResult.toJSON(e)); - } - if (message.generativeGroupedResults !== undefined) { - obj.generativeGroupedResults = generative_js_1.GenerativeResult.toJSON( - message.generativeGroupedResults - ); - } - return obj; - }, - create(base) { - return exports.SearchReply.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseSearchReply(); - message.took = (_a = object.took) !== null && _a !== void 0 ? _a : 0; - message.results = - ((_b = object.results) === null || _b === void 0 - ? void 0 - : _b.map((e) => exports.SearchResult.fromPartial(e))) || []; - message.generativeGroupedResult = - (_c = object.generativeGroupedResult) !== null && _c !== void 0 ? _c : undefined; - message.groupByResults = - ((_d = object.groupByResults) === null || _d === void 0 - ? void 0 - : _d.map((e) => exports.GroupByResult.fromPartial(e))) || []; - message.generativeGroupedResults = - object.generativeGroupedResults !== undefined && object.generativeGroupedResults !== null - ? generative_js_1.GenerativeResult.fromPartial(object.generativeGroupedResults) - : undefined; - return message; - }, -}; -function createBaseRerankReply() { - return { score: 0 }; -} -exports.RerankReply = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.score !== 0) { - writer.uint32(9).double(message.score); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRerankReply(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 9) { - break; - } - message.score = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { score: isSet(object.score) ? globalThis.Number(object.score) : 0 }; - }, - toJSON(message) { - const obj = {}; - if (message.score !== 0) { - obj.score = message.score; - } - return obj; - }, - create(base) { - return exports.RerankReply.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseRerankReply(); - message.score = (_a = object.score) !== null && _a !== void 0 ? _a : 0; - return message; - }, -}; -function createBaseGroupByResult() { - return { - name: '', - minDistance: 0, - maxDistance: 0, - numberOfObjects: 0, - objects: [], - rerank: undefined, - generative: undefined, - generativeResult: undefined, - }; -} -exports.GroupByResult = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.name !== '') { - writer.uint32(10).string(message.name); - } - if (message.minDistance !== 0) { - writer.uint32(21).float(message.minDistance); - } - if (message.maxDistance !== 0) { - writer.uint32(29).float(message.maxDistance); - } - if (message.numberOfObjects !== 0) { - writer.uint32(32).int64(message.numberOfObjects); - } - for (const v of message.objects) { - exports.SearchResult.encode(v, writer.uint32(42).fork()).ldelim(); - } - if (message.rerank !== undefined) { - exports.RerankReply.encode(message.rerank, writer.uint32(50).fork()).ldelim(); - } - if (message.generative !== undefined) { - generative_js_1.GenerativeReply.encode(message.generative, writer.uint32(58).fork()).ldelim(); - } - if (message.generativeResult !== undefined) { - generative_js_1.GenerativeResult.encode(message.generativeResult, writer.uint32(66).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGroupByResult(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.name = reader.string(); - continue; - case 2: - if (tag !== 21) { - break; - } - message.minDistance = reader.float(); - continue; - case 3: - if (tag !== 29) { - break; - } - message.maxDistance = reader.float(); - continue; - case 4: - if (tag !== 32) { - break; - } - message.numberOfObjects = longToNumber(reader.int64()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.objects.push(exports.SearchResult.decode(reader, reader.uint32())); - continue; - case 6: - if (tag !== 50) { - break; - } - message.rerank = exports.RerankReply.decode(reader, reader.uint32()); - continue; - case 7: - if (tag !== 58) { - break; - } - message.generative = generative_js_1.GenerativeReply.decode(reader, reader.uint32()); - continue; - case 8: - if (tag !== 66) { - break; - } - message.generativeResult = generative_js_1.GenerativeResult.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - name: isSet(object.name) ? globalThis.String(object.name) : '', - minDistance: isSet(object.minDistance) ? globalThis.Number(object.minDistance) : 0, - maxDistance: isSet(object.maxDistance) ? globalThis.Number(object.maxDistance) : 0, - numberOfObjects: isSet(object.numberOfObjects) ? globalThis.Number(object.numberOfObjects) : 0, - objects: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.objects) - ? object.objects.map((e) => exports.SearchResult.fromJSON(e)) - : [], - rerank: isSet(object.rerank) ? exports.RerankReply.fromJSON(object.rerank) : undefined, - generative: isSet(object.generative) - ? generative_js_1.GenerativeReply.fromJSON(object.generative) - : undefined, - generativeResult: isSet(object.generativeResult) - ? generative_js_1.GenerativeResult.fromJSON(object.generativeResult) - : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.name !== '') { - obj.name = message.name; - } - if (message.minDistance !== 0) { - obj.minDistance = message.minDistance; - } - if (message.maxDistance !== 0) { - obj.maxDistance = message.maxDistance; - } - if (message.numberOfObjects !== 0) { - obj.numberOfObjects = Math.round(message.numberOfObjects); - } - if ((_a = message.objects) === null || _a === void 0 ? void 0 : _a.length) { - obj.objects = message.objects.map((e) => exports.SearchResult.toJSON(e)); - } - if (message.rerank !== undefined) { - obj.rerank = exports.RerankReply.toJSON(message.rerank); - } - if (message.generative !== undefined) { - obj.generative = generative_js_1.GenerativeReply.toJSON(message.generative); - } - if (message.generativeResult !== undefined) { - obj.generativeResult = generative_js_1.GenerativeResult.toJSON(message.generativeResult); - } - return obj; - }, - create(base) { - return exports.GroupByResult.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e; - const message = createBaseGroupByResult(); - message.name = (_a = object.name) !== null && _a !== void 0 ? _a : ''; - message.minDistance = (_b = object.minDistance) !== null && _b !== void 0 ? _b : 0; - message.maxDistance = (_c = object.maxDistance) !== null && _c !== void 0 ? _c : 0; - message.numberOfObjects = (_d = object.numberOfObjects) !== null && _d !== void 0 ? _d : 0; - message.objects = - ((_e = object.objects) === null || _e === void 0 - ? void 0 - : _e.map((e) => exports.SearchResult.fromPartial(e))) || []; - message.rerank = - object.rerank !== undefined && object.rerank !== null - ? exports.RerankReply.fromPartial(object.rerank) - : undefined; - message.generative = - object.generative !== undefined && object.generative !== null - ? generative_js_1.GenerativeReply.fromPartial(object.generative) - : undefined; - message.generativeResult = - object.generativeResult !== undefined && object.generativeResult !== null - ? generative_js_1.GenerativeResult.fromPartial(object.generativeResult) - : undefined; - return message; - }, -}; -function createBaseSearchResult() { - return { properties: undefined, metadata: undefined, generative: undefined }; -} -exports.SearchResult = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.properties !== undefined) { - exports.PropertiesResult.encode(message.properties, writer.uint32(10).fork()).ldelim(); - } - if (message.metadata !== undefined) { - exports.MetadataResult.encode(message.metadata, writer.uint32(18).fork()).ldelim(); - } - if (message.generative !== undefined) { - generative_js_1.GenerativeResult.encode(message.generative, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSearchResult(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.properties = exports.PropertiesResult.decode(reader, reader.uint32()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.metadata = exports.MetadataResult.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.generative = generative_js_1.GenerativeResult.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - properties: isSet(object.properties) ? exports.PropertiesResult.fromJSON(object.properties) : undefined, - metadata: isSet(object.metadata) ? exports.MetadataResult.fromJSON(object.metadata) : undefined, - generative: isSet(object.generative) - ? generative_js_1.GenerativeResult.fromJSON(object.generative) - : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.properties !== undefined) { - obj.properties = exports.PropertiesResult.toJSON(message.properties); - } - if (message.metadata !== undefined) { - obj.metadata = exports.MetadataResult.toJSON(message.metadata); - } - if (message.generative !== undefined) { - obj.generative = generative_js_1.GenerativeResult.toJSON(message.generative); - } - return obj; - }, - create(base) { - return exports.SearchResult.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseSearchResult(); - message.properties = - object.properties !== undefined && object.properties !== null - ? exports.PropertiesResult.fromPartial(object.properties) - : undefined; - message.metadata = - object.metadata !== undefined && object.metadata !== null - ? exports.MetadataResult.fromPartial(object.metadata) - : undefined; - message.generative = - object.generative !== undefined && object.generative !== null - ? generative_js_1.GenerativeResult.fromPartial(object.generative) - : undefined; - return message; - }, -}; -function createBaseMetadataResult() { - return { - id: '', - vector: [], - creationTimeUnix: 0, - creationTimeUnixPresent: false, - lastUpdateTimeUnix: 0, - lastUpdateTimeUnixPresent: false, - distance: 0, - distancePresent: false, - certainty: 0, - certaintyPresent: false, - score: 0, - scorePresent: false, - explainScore: '', - explainScorePresent: false, - isConsistent: undefined, - generative: '', - generativePresent: false, - isConsistentPresent: false, - vectorBytes: new Uint8Array(0), - idAsBytes: new Uint8Array(0), - rerankScore: 0, - rerankScorePresent: false, - vectors: [], - }; -} -exports.MetadataResult = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.id !== '') { - writer.uint32(10).string(message.id); - } - writer.uint32(18).fork(); - for (const v of message.vector) { - writer.float(v); - } - writer.ldelim(); - if (message.creationTimeUnix !== 0) { - writer.uint32(24).int64(message.creationTimeUnix); - } - if (message.creationTimeUnixPresent !== false) { - writer.uint32(32).bool(message.creationTimeUnixPresent); - } - if (message.lastUpdateTimeUnix !== 0) { - writer.uint32(40).int64(message.lastUpdateTimeUnix); - } - if (message.lastUpdateTimeUnixPresent !== false) { - writer.uint32(48).bool(message.lastUpdateTimeUnixPresent); - } - if (message.distance !== 0) { - writer.uint32(61).float(message.distance); - } - if (message.distancePresent !== false) { - writer.uint32(64).bool(message.distancePresent); - } - if (message.certainty !== 0) { - writer.uint32(77).float(message.certainty); - } - if (message.certaintyPresent !== false) { - writer.uint32(80).bool(message.certaintyPresent); - } - if (message.score !== 0) { - writer.uint32(93).float(message.score); - } - if (message.scorePresent !== false) { - writer.uint32(96).bool(message.scorePresent); - } - if (message.explainScore !== '') { - writer.uint32(106).string(message.explainScore); - } - if (message.explainScorePresent !== false) { - writer.uint32(112).bool(message.explainScorePresent); - } - if (message.isConsistent !== undefined) { - writer.uint32(120).bool(message.isConsistent); - } - if (message.generative !== '') { - writer.uint32(130).string(message.generative); - } - if (message.generativePresent !== false) { - writer.uint32(136).bool(message.generativePresent); - } - if (message.isConsistentPresent !== false) { - writer.uint32(144).bool(message.isConsistentPresent); - } - if (message.vectorBytes.length !== 0) { - writer.uint32(154).bytes(message.vectorBytes); - } - if (message.idAsBytes.length !== 0) { - writer.uint32(162).bytes(message.idAsBytes); - } - if (message.rerankScore !== 0) { - writer.uint32(169).double(message.rerankScore); - } - if (message.rerankScorePresent !== false) { - writer.uint32(176).bool(message.rerankScorePresent); - } - for (const v of message.vectors) { - base_js_1.Vectors.encode(v, writer.uint32(186).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMetadataResult(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.id = reader.string(); - continue; - case 2: - if (tag === 21) { - message.vector.push(reader.float()); - continue; - } - if (tag === 18) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.vector.push(reader.float()); - } - continue; - } - break; - case 3: - if (tag !== 24) { - break; - } - message.creationTimeUnix = longToNumber(reader.int64()); - continue; - case 4: - if (tag !== 32) { - break; - } - message.creationTimeUnixPresent = reader.bool(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.lastUpdateTimeUnix = longToNumber(reader.int64()); - continue; - case 6: - if (tag !== 48) { - break; - } - message.lastUpdateTimeUnixPresent = reader.bool(); - continue; - case 7: - if (tag !== 61) { - break; - } - message.distance = reader.float(); - continue; - case 8: - if (tag !== 64) { - break; - } - message.distancePresent = reader.bool(); - continue; - case 9: - if (tag !== 77) { - break; - } - message.certainty = reader.float(); - continue; - case 10: - if (tag !== 80) { - break; - } - message.certaintyPresent = reader.bool(); - continue; - case 11: - if (tag !== 93) { - break; - } - message.score = reader.float(); - continue; - case 12: - if (tag !== 96) { - break; - } - message.scorePresent = reader.bool(); - continue; - case 13: - if (tag !== 106) { - break; - } - message.explainScore = reader.string(); - continue; - case 14: - if (tag !== 112) { - break; - } - message.explainScorePresent = reader.bool(); - continue; - case 15: - if (tag !== 120) { - break; - } - message.isConsistent = reader.bool(); - continue; - case 16: - if (tag !== 130) { - break; - } - message.generative = reader.string(); - continue; - case 17: - if (tag !== 136) { - break; - } - message.generativePresent = reader.bool(); - continue; - case 18: - if (tag !== 144) { - break; - } - message.isConsistentPresent = reader.bool(); - continue; - case 19: - if (tag !== 154) { - break; - } - message.vectorBytes = reader.bytes(); - continue; - case 20: - if (tag !== 162) { - break; - } - message.idAsBytes = reader.bytes(); - continue; - case 21: - if (tag !== 169) { - break; - } - message.rerankScore = reader.double(); - continue; - case 22: - if (tag !== 176) { - break; - } - message.rerankScorePresent = reader.bool(); - continue; - case 23: - if (tag !== 186) { - break; - } - message.vectors.push(base_js_1.Vectors.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - id: isSet(object.id) ? globalThis.String(object.id) : '', - vector: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.vector) - ? object.vector.map((e) => globalThis.Number(e)) - : [], - creationTimeUnix: isSet(object.creationTimeUnix) ? globalThis.Number(object.creationTimeUnix) : 0, - creationTimeUnixPresent: isSet(object.creationTimeUnixPresent) - ? globalThis.Boolean(object.creationTimeUnixPresent) - : false, - lastUpdateTimeUnix: isSet(object.lastUpdateTimeUnix) ? globalThis.Number(object.lastUpdateTimeUnix) : 0, - lastUpdateTimeUnixPresent: isSet(object.lastUpdateTimeUnixPresent) - ? globalThis.Boolean(object.lastUpdateTimeUnixPresent) - : false, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : 0, - distancePresent: isSet(object.distancePresent) ? globalThis.Boolean(object.distancePresent) : false, - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : 0, - certaintyPresent: isSet(object.certaintyPresent) ? globalThis.Boolean(object.certaintyPresent) : false, - score: isSet(object.score) ? globalThis.Number(object.score) : 0, - scorePresent: isSet(object.scorePresent) ? globalThis.Boolean(object.scorePresent) : false, - explainScore: isSet(object.explainScore) ? globalThis.String(object.explainScore) : '', - explainScorePresent: isSet(object.explainScorePresent) - ? globalThis.Boolean(object.explainScorePresent) - : false, - isConsistent: isSet(object.isConsistent) ? globalThis.Boolean(object.isConsistent) : undefined, - generative: isSet(object.generative) ? globalThis.String(object.generative) : '', - generativePresent: isSet(object.generativePresent) - ? globalThis.Boolean(object.generativePresent) - : false, - isConsistentPresent: isSet(object.isConsistentPresent) - ? globalThis.Boolean(object.isConsistentPresent) - : false, - vectorBytes: isSet(object.vectorBytes) ? bytesFromBase64(object.vectorBytes) : new Uint8Array(0), - idAsBytes: isSet(object.idAsBytes) ? bytesFromBase64(object.idAsBytes) : new Uint8Array(0), - rerankScore: isSet(object.rerankScore) ? globalThis.Number(object.rerankScore) : 0, - rerankScorePresent: isSet(object.rerankScorePresent) - ? globalThis.Boolean(object.rerankScorePresent) - : false, - vectors: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.vectors) - ? object.vectors.map((e) => base_js_1.Vectors.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if (message.id !== '') { - obj.id = message.id; - } - if ((_a = message.vector) === null || _a === void 0 ? void 0 : _a.length) { - obj.vector = message.vector; - } - if (message.creationTimeUnix !== 0) { - obj.creationTimeUnix = Math.round(message.creationTimeUnix); - } - if (message.creationTimeUnixPresent !== false) { - obj.creationTimeUnixPresent = message.creationTimeUnixPresent; - } - if (message.lastUpdateTimeUnix !== 0) { - obj.lastUpdateTimeUnix = Math.round(message.lastUpdateTimeUnix); - } - if (message.lastUpdateTimeUnixPresent !== false) { - obj.lastUpdateTimeUnixPresent = message.lastUpdateTimeUnixPresent; - } - if (message.distance !== 0) { - obj.distance = message.distance; - } - if (message.distancePresent !== false) { - obj.distancePresent = message.distancePresent; - } - if (message.certainty !== 0) { - obj.certainty = message.certainty; - } - if (message.certaintyPresent !== false) { - obj.certaintyPresent = message.certaintyPresent; - } - if (message.score !== 0) { - obj.score = message.score; - } - if (message.scorePresent !== false) { - obj.scorePresent = message.scorePresent; - } - if (message.explainScore !== '') { - obj.explainScore = message.explainScore; - } - if (message.explainScorePresent !== false) { - obj.explainScorePresent = message.explainScorePresent; - } - if (message.isConsistent !== undefined) { - obj.isConsistent = message.isConsistent; - } - if (message.generative !== '') { - obj.generative = message.generative; - } - if (message.generativePresent !== false) { - obj.generativePresent = message.generativePresent; - } - if (message.isConsistentPresent !== false) { - obj.isConsistentPresent = message.isConsistentPresent; - } - if (message.vectorBytes.length !== 0) { - obj.vectorBytes = base64FromBytes(message.vectorBytes); - } - if (message.idAsBytes.length !== 0) { - obj.idAsBytes = base64FromBytes(message.idAsBytes); - } - if (message.rerankScore !== 0) { - obj.rerankScore = message.rerankScore; - } - if (message.rerankScorePresent !== false) { - obj.rerankScorePresent = message.rerankScorePresent; - } - if ((_b = message.vectors) === null || _b === void 0 ? void 0 : _b.length) { - obj.vectors = message.vectors.map((e) => base_js_1.Vectors.toJSON(e)); - } - return obj; - }, - create(base) { - return exports.MetadataResult.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y; - const message = createBaseMetadataResult(); - message.id = (_a = object.id) !== null && _a !== void 0 ? _a : ''; - message.vector = ((_b = object.vector) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - message.creationTimeUnix = (_c = object.creationTimeUnix) !== null && _c !== void 0 ? _c : 0; - message.creationTimeUnixPresent = - (_d = object.creationTimeUnixPresent) !== null && _d !== void 0 ? _d : false; - message.lastUpdateTimeUnix = (_e = object.lastUpdateTimeUnix) !== null && _e !== void 0 ? _e : 0; - message.lastUpdateTimeUnixPresent = - (_f = object.lastUpdateTimeUnixPresent) !== null && _f !== void 0 ? _f : false; - message.distance = (_g = object.distance) !== null && _g !== void 0 ? _g : 0; - message.distancePresent = (_h = object.distancePresent) !== null && _h !== void 0 ? _h : false; - message.certainty = (_j = object.certainty) !== null && _j !== void 0 ? _j : 0; - message.certaintyPresent = (_k = object.certaintyPresent) !== null && _k !== void 0 ? _k : false; - message.score = (_l = object.score) !== null && _l !== void 0 ? _l : 0; - message.scorePresent = (_m = object.scorePresent) !== null && _m !== void 0 ? _m : false; - message.explainScore = (_o = object.explainScore) !== null && _o !== void 0 ? _o : ''; - message.explainScorePresent = (_p = object.explainScorePresent) !== null && _p !== void 0 ? _p : false; - message.isConsistent = (_q = object.isConsistent) !== null && _q !== void 0 ? _q : undefined; - message.generative = (_r = object.generative) !== null && _r !== void 0 ? _r : ''; - message.generativePresent = (_s = object.generativePresent) !== null && _s !== void 0 ? _s : false; - message.isConsistentPresent = (_t = object.isConsistentPresent) !== null && _t !== void 0 ? _t : false; - message.vectorBytes = (_u = object.vectorBytes) !== null && _u !== void 0 ? _u : new Uint8Array(0); - message.idAsBytes = (_v = object.idAsBytes) !== null && _v !== void 0 ? _v : new Uint8Array(0); - message.rerankScore = (_w = object.rerankScore) !== null && _w !== void 0 ? _w : 0; - message.rerankScorePresent = (_x = object.rerankScorePresent) !== null && _x !== void 0 ? _x : false; - message.vectors = - ((_y = object.vectors) === null || _y === void 0 - ? void 0 - : _y.map((e) => base_js_1.Vectors.fromPartial(e))) || []; - return message; - }, -}; -function createBasePropertiesResult() { - return { - nonRefProperties: undefined, - refProps: [], - targetCollection: '', - metadata: undefined, - numberArrayProperties: [], - intArrayProperties: [], - textArrayProperties: [], - booleanArrayProperties: [], - objectProperties: [], - objectArrayProperties: [], - nonRefProps: undefined, - refPropsRequested: false, - }; -} -exports.PropertiesResult = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.nonRefProperties !== undefined) { - struct_js_1.Struct.encode( - struct_js_1.Struct.wrap(message.nonRefProperties), - writer.uint32(10).fork() - ).ldelim(); - } - for (const v of message.refProps) { - exports.RefPropertiesResult.encode(v, writer.uint32(18).fork()).ldelim(); - } - if (message.targetCollection !== '') { - writer.uint32(26).string(message.targetCollection); - } - if (message.metadata !== undefined) { - exports.MetadataResult.encode(message.metadata, writer.uint32(34).fork()).ldelim(); - } - for (const v of message.numberArrayProperties) { - base_js_1.NumberArrayProperties.encode(v, writer.uint32(42).fork()).ldelim(); - } - for (const v of message.intArrayProperties) { - base_js_1.IntArrayProperties.encode(v, writer.uint32(50).fork()).ldelim(); - } - for (const v of message.textArrayProperties) { - base_js_1.TextArrayProperties.encode(v, writer.uint32(58).fork()).ldelim(); - } - for (const v of message.booleanArrayProperties) { - base_js_1.BooleanArrayProperties.encode(v, writer.uint32(66).fork()).ldelim(); - } - for (const v of message.objectProperties) { - base_js_1.ObjectProperties.encode(v, writer.uint32(74).fork()).ldelim(); - } - for (const v of message.objectArrayProperties) { - base_js_1.ObjectArrayProperties.encode(v, writer.uint32(82).fork()).ldelim(); - } - if (message.nonRefProps !== undefined) { - properties_js_1.Properties.encode(message.nonRefProps, writer.uint32(90).fork()).ldelim(); - } - if (message.refPropsRequested !== false) { - writer.uint32(96).bool(message.refPropsRequested); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePropertiesResult(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.nonRefProperties = struct_js_1.Struct.unwrap( - struct_js_1.Struct.decode(reader, reader.uint32()) - ); - continue; - case 2: - if (tag !== 18) { - break; - } - message.refProps.push(exports.RefPropertiesResult.decode(reader, reader.uint32())); - continue; - case 3: - if (tag !== 26) { - break; - } - message.targetCollection = reader.string(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.metadata = exports.MetadataResult.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.numberArrayProperties.push(base_js_1.NumberArrayProperties.decode(reader, reader.uint32())); - continue; - case 6: - if (tag !== 50) { - break; - } - message.intArrayProperties.push(base_js_1.IntArrayProperties.decode(reader, reader.uint32())); - continue; - case 7: - if (tag !== 58) { - break; - } - message.textArrayProperties.push(base_js_1.TextArrayProperties.decode(reader, reader.uint32())); - continue; - case 8: - if (tag !== 66) { - break; - } - message.booleanArrayProperties.push( - base_js_1.BooleanArrayProperties.decode(reader, reader.uint32()) - ); - continue; - case 9: - if (tag !== 74) { - break; - } - message.objectProperties.push(base_js_1.ObjectProperties.decode(reader, reader.uint32())); - continue; - case 10: - if (tag !== 82) { - break; - } - message.objectArrayProperties.push(base_js_1.ObjectArrayProperties.decode(reader, reader.uint32())); - continue; - case 11: - if (tag !== 90) { - break; - } - message.nonRefProps = properties_js_1.Properties.decode(reader, reader.uint32()); - continue; - case 12: - if (tag !== 96) { - break; - } - message.refPropsRequested = reader.bool(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - nonRefProperties: isObject(object.nonRefProperties) ? object.nonRefProperties : undefined, - refProps: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.refProps) - ? object.refProps.map((e) => exports.RefPropertiesResult.fromJSON(e)) - : [], - targetCollection: isSet(object.targetCollection) ? globalThis.String(object.targetCollection) : '', - metadata: isSet(object.metadata) ? exports.MetadataResult.fromJSON(object.metadata) : undefined, - numberArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.numberArrayProperties - ) - ? object.numberArrayProperties.map((e) => base_js_1.NumberArrayProperties.fromJSON(e)) - : [], - intArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.intArrayProperties - ) - ? object.intArrayProperties.map((e) => base_js_1.IntArrayProperties.fromJSON(e)) - : [], - textArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.textArrayProperties - ) - ? object.textArrayProperties.map((e) => base_js_1.TextArrayProperties.fromJSON(e)) - : [], - booleanArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.booleanArrayProperties - ) - ? object.booleanArrayProperties.map((e) => base_js_1.BooleanArrayProperties.fromJSON(e)) - : [], - objectProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectProperties - ) - ? object.objectProperties.map((e) => base_js_1.ObjectProperties.fromJSON(e)) - : [], - objectArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectArrayProperties - ) - ? object.objectArrayProperties.map((e) => base_js_1.ObjectArrayProperties.fromJSON(e)) - : [], - nonRefProps: isSet(object.nonRefProps) - ? properties_js_1.Properties.fromJSON(object.nonRefProps) - : undefined, - refPropsRequested: isSet(object.refPropsRequested) - ? globalThis.Boolean(object.refPropsRequested) - : false, - }; - }, - toJSON(message) { - var _a, _b, _c, _d, _e, _f, _g; - const obj = {}; - if (message.nonRefProperties !== undefined) { - obj.nonRefProperties = message.nonRefProperties; - } - if ((_a = message.refProps) === null || _a === void 0 ? void 0 : _a.length) { - obj.refProps = message.refProps.map((e) => exports.RefPropertiesResult.toJSON(e)); - } - if (message.targetCollection !== '') { - obj.targetCollection = message.targetCollection; - } - if (message.metadata !== undefined) { - obj.metadata = exports.MetadataResult.toJSON(message.metadata); - } - if ((_b = message.numberArrayProperties) === null || _b === void 0 ? void 0 : _b.length) { - obj.numberArrayProperties = message.numberArrayProperties.map((e) => - base_js_1.NumberArrayProperties.toJSON(e) - ); - } - if ((_c = message.intArrayProperties) === null || _c === void 0 ? void 0 : _c.length) { - obj.intArrayProperties = message.intArrayProperties.map((e) => base_js_1.IntArrayProperties.toJSON(e)); - } - if ((_d = message.textArrayProperties) === null || _d === void 0 ? void 0 : _d.length) { - obj.textArrayProperties = message.textArrayProperties.map((e) => - base_js_1.TextArrayProperties.toJSON(e) - ); - } - if ((_e = message.booleanArrayProperties) === null || _e === void 0 ? void 0 : _e.length) { - obj.booleanArrayProperties = message.booleanArrayProperties.map((e) => - base_js_1.BooleanArrayProperties.toJSON(e) - ); - } - if ((_f = message.objectProperties) === null || _f === void 0 ? void 0 : _f.length) { - obj.objectProperties = message.objectProperties.map((e) => base_js_1.ObjectProperties.toJSON(e)); - } - if ((_g = message.objectArrayProperties) === null || _g === void 0 ? void 0 : _g.length) { - obj.objectArrayProperties = message.objectArrayProperties.map((e) => - base_js_1.ObjectArrayProperties.toJSON(e) - ); - } - if (message.nonRefProps !== undefined) { - obj.nonRefProps = properties_js_1.Properties.toJSON(message.nonRefProps); - } - if (message.refPropsRequested !== false) { - obj.refPropsRequested = message.refPropsRequested; - } - return obj; - }, - create(base) { - return exports.PropertiesResult.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - const message = createBasePropertiesResult(); - message.nonRefProperties = (_a = object.nonRefProperties) !== null && _a !== void 0 ? _a : undefined; - message.refProps = - ((_b = object.refProps) === null || _b === void 0 - ? void 0 - : _b.map((e) => exports.RefPropertiesResult.fromPartial(e))) || []; - message.targetCollection = (_c = object.targetCollection) !== null && _c !== void 0 ? _c : ''; - message.metadata = - object.metadata !== undefined && object.metadata !== null - ? exports.MetadataResult.fromPartial(object.metadata) - : undefined; - message.numberArrayProperties = - ((_d = object.numberArrayProperties) === null || _d === void 0 - ? void 0 - : _d.map((e) => base_js_1.NumberArrayProperties.fromPartial(e))) || []; - message.intArrayProperties = - ((_e = object.intArrayProperties) === null || _e === void 0 - ? void 0 - : _e.map((e) => base_js_1.IntArrayProperties.fromPartial(e))) || []; - message.textArrayProperties = - ((_f = object.textArrayProperties) === null || _f === void 0 - ? void 0 - : _f.map((e) => base_js_1.TextArrayProperties.fromPartial(e))) || []; - message.booleanArrayProperties = - ((_g = object.booleanArrayProperties) === null || _g === void 0 - ? void 0 - : _g.map((e) => base_js_1.BooleanArrayProperties.fromPartial(e))) || []; - message.objectProperties = - ((_h = object.objectProperties) === null || _h === void 0 - ? void 0 - : _h.map((e) => base_js_1.ObjectProperties.fromPartial(e))) || []; - message.objectArrayProperties = - ((_j = object.objectArrayProperties) === null || _j === void 0 - ? void 0 - : _j.map((e) => base_js_1.ObjectArrayProperties.fromPartial(e))) || []; - message.nonRefProps = - object.nonRefProps !== undefined && object.nonRefProps !== null - ? properties_js_1.Properties.fromPartial(object.nonRefProps) - : undefined; - message.refPropsRequested = (_k = object.refPropsRequested) !== null && _k !== void 0 ? _k : false; - return message; - }, -}; -function createBaseRefPropertiesResult() { - return { properties: [], propName: '' }; -} -exports.RefPropertiesResult = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.properties) { - exports.PropertiesResult.encode(v, writer.uint32(10).fork()).ldelim(); - } - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRefPropertiesResult(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.properties.push(exports.PropertiesResult.decode(reader, reader.uint32())); - continue; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - properties: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.properties) - ? object.properties.map((e) => exports.PropertiesResult.fromJSON(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.properties) === null || _a === void 0 ? void 0 : _a.length) { - obj.properties = message.properties.map((e) => exports.PropertiesResult.toJSON(e)); - } - if (message.propName !== '') { - obj.propName = message.propName; - } - return obj; - }, - create(base) { - return exports.RefPropertiesResult.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseRefPropertiesResult(); - message.properties = - ((_a = object.properties) === null || _a === void 0 - ? void 0 - : _a.map((e) => exports.PropertiesResult.fromPartial(e))) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function bytesFromBase64(b64) { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} -function base64FromBytes(arr) { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString('base64'); - } else { - const bin = []; - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join('')); - } -} -function longToNumber(long) { - if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { - throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); - } - return long.toNumber(); -} -if (minimal_js_1.default.util.Long !== long_1.default) { - minimal_js_1.default.util.Long = long_1.default; - minimal_js_1.default.configure(); -} -function isObject(value) { - return typeof value === 'object' && value !== null; -} -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/cjs/proto/v1/tenants.d.ts b/dist/node/cjs/proto/v1/tenants.d.ts deleted file mode 100644 index 6ac14095..00000000 --- a/dist/node/cjs/proto/v1/tenants.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -export declare const protobufPackage = 'weaviate.v1'; -export declare enum TenantActivityStatus { - TENANT_ACTIVITY_STATUS_UNSPECIFIED = 0, - TENANT_ACTIVITY_STATUS_HOT = 1, - TENANT_ACTIVITY_STATUS_COLD = 2, - TENANT_ACTIVITY_STATUS_FROZEN = 4, - TENANT_ACTIVITY_STATUS_UNFREEZING = 5, - TENANT_ACTIVITY_STATUS_FREEZING = 6, - /** TENANT_ACTIVITY_STATUS_ACTIVE - not used yet - added to let the clients already add code to handle this in the future */ - TENANT_ACTIVITY_STATUS_ACTIVE = 7, - TENANT_ACTIVITY_STATUS_INACTIVE = 8, - TENANT_ACTIVITY_STATUS_OFFLOADED = 9, - TENANT_ACTIVITY_STATUS_OFFLOADING = 10, - TENANT_ACTIVITY_STATUS_ONLOADING = 11, - UNRECOGNIZED = -1, -} -export declare function tenantActivityStatusFromJSON(object: any): TenantActivityStatus; -export declare function tenantActivityStatusToJSON(object: TenantActivityStatus): string; -export interface TenantsGetRequest { - collection: string; - names?: TenantNames | undefined; -} -export interface TenantNames { - values: string[]; -} -export interface TenantsGetReply { - took: number; - tenants: Tenant[]; -} -export interface Tenant { - name: string; - activityStatus: TenantActivityStatus; -} -export declare const TenantsGetRequest: { - encode(message: TenantsGetRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): TenantsGetRequest; - fromJSON(object: any): TenantsGetRequest; - toJSON(message: TenantsGetRequest): unknown; - create(base?: DeepPartial): TenantsGetRequest; - fromPartial(object: DeepPartial): TenantsGetRequest; -}; -export declare const TenantNames: { - encode(message: TenantNames, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): TenantNames; - fromJSON(object: any): TenantNames; - toJSON(message: TenantNames): unknown; - create(base?: DeepPartial): TenantNames; - fromPartial(object: DeepPartial): TenantNames; -}; -export declare const TenantsGetReply: { - encode(message: TenantsGetReply, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): TenantsGetReply; - fromJSON(object: any): TenantsGetReply; - toJSON(message: TenantsGetReply): unknown; - create(base?: DeepPartial): TenantsGetReply; - fromPartial(object: DeepPartial): TenantsGetReply; -}; -export declare const Tenant: { - encode(message: Tenant, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Tenant; - fromJSON(object: any): Tenant; - toJSON(message: Tenant): unknown; - create(base?: DeepPartial): Tenant; - fromPartial(object: DeepPartial): Tenant; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/cjs/proto/v1/tenants.js b/dist/node/cjs/proto/v1/tenants.js deleted file mode 100644 index 0eb2ca42..00000000 --- a/dist/node/cjs/proto/v1/tenants.js +++ /dev/null @@ -1,396 +0,0 @@ -'use strict'; -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/tenants.proto -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.Tenant = - exports.TenantsGetReply = - exports.TenantNames = - exports.TenantsGetRequest = - exports.tenantActivityStatusToJSON = - exports.tenantActivityStatusFromJSON = - exports.TenantActivityStatus = - exports.protobufPackage = - void 0; -/* eslint-disable */ -const minimal_js_1 = __importDefault(require('protobufjs/minimal.js')); -exports.protobufPackage = 'weaviate.v1'; -var TenantActivityStatus; -(function (TenantActivityStatus) { - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_UNSPECIFIED'] = 0)] = - 'TENANT_ACTIVITY_STATUS_UNSPECIFIED'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_HOT'] = 1)] = - 'TENANT_ACTIVITY_STATUS_HOT'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_COLD'] = 2)] = - 'TENANT_ACTIVITY_STATUS_COLD'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_FROZEN'] = 4)] = - 'TENANT_ACTIVITY_STATUS_FROZEN'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_UNFREEZING'] = 5)] = - 'TENANT_ACTIVITY_STATUS_UNFREEZING'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_FREEZING'] = 6)] = - 'TENANT_ACTIVITY_STATUS_FREEZING'; - /** TENANT_ACTIVITY_STATUS_ACTIVE - not used yet - added to let the clients already add code to handle this in the future */ - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_ACTIVE'] = 7)] = - 'TENANT_ACTIVITY_STATUS_ACTIVE'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_INACTIVE'] = 8)] = - 'TENANT_ACTIVITY_STATUS_INACTIVE'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_OFFLOADED'] = 9)] = - 'TENANT_ACTIVITY_STATUS_OFFLOADED'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_OFFLOADING'] = 10)] = - 'TENANT_ACTIVITY_STATUS_OFFLOADING'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_ONLOADING'] = 11)] = - 'TENANT_ACTIVITY_STATUS_ONLOADING'; - TenantActivityStatus[(TenantActivityStatus['UNRECOGNIZED'] = -1)] = 'UNRECOGNIZED'; -})(TenantActivityStatus || (exports.TenantActivityStatus = TenantActivityStatus = {})); -function tenantActivityStatusFromJSON(object) { - switch (object) { - case 0: - case 'TENANT_ACTIVITY_STATUS_UNSPECIFIED': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_UNSPECIFIED; - case 1: - case 'TENANT_ACTIVITY_STATUS_HOT': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_HOT; - case 2: - case 'TENANT_ACTIVITY_STATUS_COLD': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_COLD; - case 4: - case 'TENANT_ACTIVITY_STATUS_FROZEN': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_FROZEN; - case 5: - case 'TENANT_ACTIVITY_STATUS_UNFREEZING': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_UNFREEZING; - case 6: - case 'TENANT_ACTIVITY_STATUS_FREEZING': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_FREEZING; - case 7: - case 'TENANT_ACTIVITY_STATUS_ACTIVE': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_ACTIVE; - case 8: - case 'TENANT_ACTIVITY_STATUS_INACTIVE': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_INACTIVE; - case 9: - case 'TENANT_ACTIVITY_STATUS_OFFLOADED': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_OFFLOADED; - case 10: - case 'TENANT_ACTIVITY_STATUS_OFFLOADING': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_OFFLOADING; - case 11: - case 'TENANT_ACTIVITY_STATUS_ONLOADING': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_ONLOADING; - case -1: - case 'UNRECOGNIZED': - default: - return TenantActivityStatus.UNRECOGNIZED; - } -} -exports.tenantActivityStatusFromJSON = tenantActivityStatusFromJSON; -function tenantActivityStatusToJSON(object) { - switch (object) { - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_UNSPECIFIED: - return 'TENANT_ACTIVITY_STATUS_UNSPECIFIED'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_HOT: - return 'TENANT_ACTIVITY_STATUS_HOT'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_COLD: - return 'TENANT_ACTIVITY_STATUS_COLD'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_FROZEN: - return 'TENANT_ACTIVITY_STATUS_FROZEN'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_UNFREEZING: - return 'TENANT_ACTIVITY_STATUS_UNFREEZING'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_FREEZING: - return 'TENANT_ACTIVITY_STATUS_FREEZING'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_ACTIVE: - return 'TENANT_ACTIVITY_STATUS_ACTIVE'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_INACTIVE: - return 'TENANT_ACTIVITY_STATUS_INACTIVE'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_OFFLOADED: - return 'TENANT_ACTIVITY_STATUS_OFFLOADED'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_OFFLOADING: - return 'TENANT_ACTIVITY_STATUS_OFFLOADING'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_ONLOADING: - return 'TENANT_ACTIVITY_STATUS_ONLOADING'; - case TenantActivityStatus.UNRECOGNIZED: - default: - return 'UNRECOGNIZED'; - } -} -exports.tenantActivityStatusToJSON = tenantActivityStatusToJSON; -function createBaseTenantsGetRequest() { - return { collection: '', names: undefined }; -} -exports.TenantsGetRequest = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.collection !== '') { - writer.uint32(10).string(message.collection); - } - if (message.names !== undefined) { - exports.TenantNames.encode(message.names, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTenantsGetRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.collection = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.names = exports.TenantNames.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - collection: isSet(object.collection) ? globalThis.String(object.collection) : '', - names: isSet(object.names) ? exports.TenantNames.fromJSON(object.names) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.collection !== '') { - obj.collection = message.collection; - } - if (message.names !== undefined) { - obj.names = exports.TenantNames.toJSON(message.names); - } - return obj; - }, - create(base) { - return exports.TenantsGetRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseTenantsGetRequest(); - message.collection = (_a = object.collection) !== null && _a !== void 0 ? _a : ''; - message.names = - object.names !== undefined && object.names !== null - ? exports.TenantNames.fromPartial(object.names) - : undefined; - return message; - }, -}; -function createBaseTenantNames() { - return { values: [] }; -} -exports.TenantNames = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - for (const v of message.values) { - writer.uint32(10).string(v); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTenantNames(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return exports.TenantNames.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseTenantNames(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseTenantsGetReply() { - return { took: 0, tenants: [] }; -} -exports.TenantsGetReply = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.took !== 0) { - writer.uint32(13).float(message.took); - } - for (const v of message.tenants) { - exports.Tenant.encode(v, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTenantsGetReply(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 13) { - break; - } - message.took = reader.float(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.tenants.push(exports.Tenant.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - took: isSet(object.took) ? globalThis.Number(object.took) : 0, - tenants: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.tenants) - ? object.tenants.map((e) => exports.Tenant.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.took !== 0) { - obj.took = message.took; - } - if ((_a = message.tenants) === null || _a === void 0 ? void 0 : _a.length) { - obj.tenants = message.tenants.map((e) => exports.Tenant.toJSON(e)); - } - return obj; - }, - create(base) { - return exports.TenantsGetReply.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseTenantsGetReply(); - message.took = (_a = object.took) !== null && _a !== void 0 ? _a : 0; - message.tenants = - ((_b = object.tenants) === null || _b === void 0 - ? void 0 - : _b.map((e) => exports.Tenant.fromPartial(e))) || []; - return message; - }, -}; -function createBaseTenant() { - return { name: '', activityStatus: 0 }; -} -exports.Tenant = { - encode(message, writer = minimal_js_1.default.Writer.create()) { - if (message.name !== '') { - writer.uint32(10).string(message.name); - } - if (message.activityStatus !== 0) { - writer.uint32(16).int32(message.activityStatus); - } - return writer; - }, - decode(input, length) { - const reader = - input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTenant(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.name = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.activityStatus = reader.int32(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - name: isSet(object.name) ? globalThis.String(object.name) : '', - activityStatus: isSet(object.activityStatus) ? tenantActivityStatusFromJSON(object.activityStatus) : 0, - }; - }, - toJSON(message) { - const obj = {}; - if (message.name !== '') { - obj.name = message.name; - } - if (message.activityStatus !== 0) { - obj.activityStatus = tenantActivityStatusToJSON(message.activityStatus); - } - return obj; - }, - create(base) { - return exports.Tenant.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseTenant(); - message.name = (_a = object.name) !== null && _a !== void 0 ? _a : ''; - message.activityStatus = (_b = object.activityStatus) !== null && _b !== void 0 ? _b : 0; - return message; - }, -}; -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/cjs/proto/v1/weaviate.d.ts b/dist/node/cjs/proto/v1/weaviate.d.ts deleted file mode 100644 index 811cc998..00000000 --- a/dist/node/cjs/proto/v1/weaviate.d.ts +++ /dev/null @@ -1,4427 +0,0 @@ -import { type CallContext, type CallOptions } from 'nice-grpc-common'; -import { BatchObjectsReply, BatchObjectsRequest } from './batch.js'; -import { BatchDeleteReply, BatchDeleteRequest } from './batch_delete.js'; -import { SearchReply, SearchRequest } from './search_get.js'; -import { TenantsGetReply, TenantsGetRequest } from './tenants.js'; -export declare const protobufPackage = 'weaviate.v1'; -export type WeaviateDefinition = typeof WeaviateDefinition; -export declare const WeaviateDefinition: { - readonly name: 'Weaviate'; - readonly fullName: 'weaviate.v1.Weaviate'; - readonly methods: { - readonly search: { - readonly name: 'Search'; - readonly requestType: { - encode(message: SearchRequest, writer?: import('protobufjs').Writer): import('protobufjs').Writer; - decode(input: Uint8Array | import('protobufjs').Reader, length?: number | undefined): SearchRequest; - fromJSON(object: any): SearchRequest; - toJSON(message: SearchRequest): unknown; - create( - base?: - | { - collection?: string | undefined; - tenant?: string | undefined; - consistencyLevel?: import('./base.js').ConsistencyLevel | undefined; - properties?: - | { - nonRefProperties?: string[] | undefined; - refProperties?: - | { - referenceProperty?: string | undefined; - properties?: any | undefined; - metadata?: - | { - uuid?: boolean | undefined; - vector?: boolean | undefined; - creationTimeUnix?: boolean | undefined; - lastUpdateTimeUnix?: boolean | undefined; - distance?: boolean | undefined; - certainty?: boolean | undefined; - score?: boolean | undefined; - explainScore?: boolean | undefined; - isConsistent?: boolean | undefined; - vectors?: string[] | undefined; - } - | undefined; - targetCollection?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - propName?: string | undefined; - primitiveProperties?: string[] | undefined; - objectProperties?: any[] | undefined; - }[] - | undefined; - returnAllNonrefProperties?: boolean | undefined; - } - | undefined; - metadata?: - | { - uuid?: boolean | undefined; - vector?: boolean | undefined; - creationTimeUnix?: boolean | undefined; - lastUpdateTimeUnix?: boolean | undefined; - distance?: boolean | undefined; - certainty?: boolean | undefined; - score?: boolean | undefined; - explainScore?: boolean | undefined; - isConsistent?: boolean | undefined; - vectors?: string[] | undefined; - } - | undefined; - groupBy?: - | { - path?: string[] | undefined; - numberOfGroups?: number | undefined; - objectsPerGroup?: number | undefined; - } - | undefined; - limit?: number | undefined; - offset?: number | undefined; - autocut?: number | undefined; - after?: string | undefined; - sortBy?: - | { - ascending?: boolean | undefined; - path?: string[] | undefined; - }[] - | undefined; - filters?: - | { - operator?: import('./base.js').Filters_Operator | undefined; - on?: string[] | undefined; - filters?: any[] | undefined; - valueText?: string | undefined; - valueInt?: number | undefined; - valueBoolean?: boolean | undefined; - valueNumber?: number | undefined; - valueTextArray?: - | { - values?: string[] | undefined; - } - | undefined; - valueIntArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueBooleanArray?: - | { - values?: boolean[] | undefined; - } - | undefined; - valueNumberArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueGeo?: - | { - latitude?: number | undefined; - longitude?: number | undefined; - distance?: number | undefined; - } - | undefined; - target?: - | { - property?: string | undefined; - singleTarget?: - | { - on?: string | undefined; - target?: any | undefined; - } - | undefined; - multiTarget?: - | { - on?: string | undefined; - target?: any | undefined; - targetCollection?: string | undefined; - } - | undefined; - count?: - | { - on?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - hybridSearch?: - | { - query?: string | undefined; - properties?: string[] | undefined; - vector?: number[] | undefined; - alpha?: number | undefined; - fusionType?: import('./search_get.js').Hybrid_FusionType | undefined; - vectorBytes?: Uint8Array | undefined; - targetVectors?: string[] | undefined; - nearText?: - | { - query?: string[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - moveTo?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - moveAway?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearVector?: - | { - vector?: number[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - vectorBytes?: Uint8Array | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - vectorPerTarget?: - | { - [x: string]: Uint8Array | undefined; - } - | undefined; - vectorForTargets?: - | { - name?: string | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - vectorDistance?: number | undefined; - } - | undefined; - bm25Search?: - | { - query?: string | undefined; - properties?: string[] | undefined; - } - | undefined; - nearVector?: - | { - vector?: number[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - vectorBytes?: Uint8Array | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - vectorPerTarget?: - | { - [x: string]: Uint8Array | undefined; - } - | undefined; - vectorForTargets?: - | { - name?: string | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - nearObject?: - | { - id?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearText?: - | { - query?: string[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - moveTo?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - moveAway?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearImage?: - | { - image?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearAudio?: - | { - audio?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearVideo?: - | { - video?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearDepth?: - | { - depth?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearThermal?: - | { - thermal?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearImu?: - | { - imu?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - generative?: - | { - singleResponsePrompt?: string | undefined; - groupedResponseTask?: string | undefined; - groupedProperties?: string[] | undefined; - single?: - | { - prompt?: string | undefined; - debug?: boolean | undefined; - queries?: - | { - returnMetadata?: boolean | undefined; - anthropic?: - | { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - temperature?: number | undefined; - topK?: number | undefined; - topP?: number | undefined; - stopSequences?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - anyscale?: - | { - baseUrl?: string | undefined; - model?: string | undefined; - temperature?: number | undefined; - } - | undefined; - aws?: - | { - model?: string | undefined; - temperature?: number | undefined; - } - | undefined; - cohere?: - | { - baseUrl?: string | undefined; - frequencyPenalty?: number | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - k?: number | undefined; - p?: number | undefined; - presencePenalty?: number | undefined; - stopSequences?: - | { - values?: string[] | undefined; - } - | undefined; - temperature?: number | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - temperature?: number | undefined; - topP?: number | undefined; - } - | undefined; - octoai?: - | { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - n?: number | undefined; - temperature?: number | undefined; - topP?: number | undefined; - } - | undefined; - ollama?: - | { - apiEndpoint?: string | undefined; - model?: string | undefined; - temperature?: number | undefined; - } - | undefined; - openai?: - | { - frequencyPenalty?: number | undefined; - logProbs?: boolean | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - n?: number | undefined; - presencePenalty?: number | undefined; - stop?: - | { - values?: string[] | undefined; - } - | undefined; - temperature?: number | undefined; - topP?: number | undefined; - topLogProbs?: number | undefined; - } - | undefined; - google?: - | { - frequencyPenalty?: number | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - presencePenalty?: number | undefined; - temperature?: number | undefined; - topK?: number | undefined; - topP?: number | undefined; - stopSequences?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - grouped?: - | { - task?: string | undefined; - properties?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - rerank?: - | { - property?: string | undefined; - query?: string | undefined; - } - | undefined; - uses123Api?: boolean | undefined; - uses125Api?: boolean | undefined; - uses127Api?: boolean | undefined; - } - | undefined - ): SearchRequest; - fromPartial(object: { - collection?: string | undefined; - tenant?: string | undefined; - consistencyLevel?: import('./base.js').ConsistencyLevel | undefined; - properties?: - | { - nonRefProperties?: string[] | undefined; - refProperties?: - | { - referenceProperty?: string | undefined; - properties?: any | undefined; - metadata?: - | { - uuid?: boolean | undefined; - vector?: boolean | undefined; - creationTimeUnix?: boolean | undefined; - lastUpdateTimeUnix?: boolean | undefined; - distance?: boolean | undefined; - certainty?: boolean | undefined; - score?: boolean | undefined; - explainScore?: boolean | undefined; - isConsistent?: boolean | undefined; - vectors?: string[] | undefined; - } - | undefined; - targetCollection?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - propName?: string | undefined; - primitiveProperties?: string[] | undefined; - objectProperties?: any[] | undefined; - }[] - | undefined; - returnAllNonrefProperties?: boolean | undefined; - } - | undefined; - metadata?: - | { - uuid?: boolean | undefined; - vector?: boolean | undefined; - creationTimeUnix?: boolean | undefined; - lastUpdateTimeUnix?: boolean | undefined; - distance?: boolean | undefined; - certainty?: boolean | undefined; - score?: boolean | undefined; - explainScore?: boolean | undefined; - isConsistent?: boolean | undefined; - vectors?: string[] | undefined; - } - | undefined; - groupBy?: - | { - path?: string[] | undefined; - numberOfGroups?: number | undefined; - objectsPerGroup?: number | undefined; - } - | undefined; - limit?: number | undefined; - offset?: number | undefined; - autocut?: number | undefined; - after?: string | undefined; - sortBy?: - | { - ascending?: boolean | undefined; - path?: string[] | undefined; - }[] - | undefined; - filters?: - | { - operator?: import('./base.js').Filters_Operator | undefined; - on?: string[] | undefined; - filters?: any[] | undefined; - valueText?: string | undefined; - valueInt?: number | undefined; - valueBoolean?: boolean | undefined; - valueNumber?: number | undefined; - valueTextArray?: - | { - values?: string[] | undefined; - } - | undefined; - valueIntArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueBooleanArray?: - | { - values?: boolean[] | undefined; - } - | undefined; - valueNumberArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueGeo?: - | { - latitude?: number | undefined; - longitude?: number | undefined; - distance?: number | undefined; - } - | undefined; - target?: - | { - property?: string | undefined; - singleTarget?: - | { - on?: string | undefined; - target?: any | undefined; - } - | undefined; - multiTarget?: - | { - on?: string | undefined; - target?: any | undefined; - targetCollection?: string | undefined; - } - | undefined; - count?: - | { - on?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - hybridSearch?: - | { - query?: string | undefined; - properties?: string[] | undefined; - vector?: number[] | undefined; - alpha?: number | undefined; - fusionType?: import('./search_get.js').Hybrid_FusionType | undefined; - vectorBytes?: Uint8Array | undefined; - targetVectors?: string[] | undefined; - nearText?: - | { - query?: string[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - moveTo?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - moveAway?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearVector?: - | { - vector?: number[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - vectorBytes?: Uint8Array | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - vectorPerTarget?: - | { - [x: string]: Uint8Array | undefined; - } - | undefined; - vectorForTargets?: - | { - name?: string | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - vectorDistance?: number | undefined; - } - | undefined; - bm25Search?: - | { - query?: string | undefined; - properties?: string[] | undefined; - } - | undefined; - nearVector?: - | { - vector?: number[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - vectorBytes?: Uint8Array | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - vectorPerTarget?: - | { - [x: string]: Uint8Array | undefined; - } - | undefined; - vectorForTargets?: - | { - name?: string | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - nearObject?: - | { - id?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearText?: - | { - query?: string[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - moveTo?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - moveAway?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearImage?: - | { - image?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearAudio?: - | { - audio?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearVideo?: - | { - video?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearDepth?: - | { - depth?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearThermal?: - | { - thermal?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearImu?: - | { - imu?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - generative?: - | { - singleResponsePrompt?: string | undefined; - groupedResponseTask?: string | undefined; - groupedProperties?: string[] | undefined; - single?: - | { - prompt?: string | undefined; - debug?: boolean | undefined; - queries?: - | { - returnMetadata?: boolean | undefined; - anthropic?: - | { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - temperature?: number | undefined; - topK?: number | undefined; - topP?: number | undefined; - stopSequences?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - anyscale?: - | { - baseUrl?: string | undefined; - model?: string | undefined; - temperature?: number | undefined; - } - | undefined; - aws?: - | { - model?: string | undefined; - temperature?: number | undefined; - } - | undefined; - cohere?: - | { - baseUrl?: string | undefined; - frequencyPenalty?: number | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - k?: number | undefined; - p?: number | undefined; - presencePenalty?: number | undefined; - stopSequences?: - | { - values?: string[] | undefined; - } - | undefined; - temperature?: number | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - temperature?: number | undefined; - topP?: number | undefined; - } - | undefined; - octoai?: - | { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - n?: number | undefined; - temperature?: number | undefined; - topP?: number | undefined; - } - | undefined; - ollama?: - | { - apiEndpoint?: string | undefined; - model?: string | undefined; - temperature?: number | undefined; - } - | undefined; - openai?: - | { - frequencyPenalty?: number | undefined; - logProbs?: boolean | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - n?: number | undefined; - presencePenalty?: number | undefined; - stop?: - | { - values?: string[] | undefined; - } - | undefined; - temperature?: number | undefined; - topP?: number | undefined; - topLogProbs?: number | undefined; - } - | undefined; - google?: - | { - frequencyPenalty?: number | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - presencePenalty?: number | undefined; - temperature?: number | undefined; - topK?: number | undefined; - topP?: number | undefined; - stopSequences?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - grouped?: - | { - task?: string | undefined; - properties?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - rerank?: - | { - property?: string | undefined; - query?: string | undefined; - } - | undefined; - uses123Api?: boolean | undefined; - uses125Api?: boolean | undefined; - uses127Api?: boolean | undefined; - }): SearchRequest; - }; - readonly requestStream: false; - readonly responseType: { - encode(message: SearchReply, writer?: import('protobufjs').Writer): import('protobufjs').Writer; - decode(input: Uint8Array | import('protobufjs').Reader, length?: number | undefined): SearchReply; - fromJSON(object: any): SearchReply; - toJSON(message: SearchReply): unknown; - create( - base?: - | { - took?: number | undefined; - results?: - | { - properties?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - refProps?: - | { - properties?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - targetCollection?: string | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: any[] | undefined; - objectArrayProperties?: - | { - values?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: - | { - values?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: any | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: any[] | undefined; - emptyListProps?: string[] | undefined; - }[] - | undefined; - propName?: string | undefined; - }[] - | undefined; - nonRefProps?: - | { - fields?: - | { - [x: string]: - | { - numberValue?: number | undefined; - stringValue?: string | undefined; - boolValue?: boolean | undefined; - objectValue?: any | undefined; - listValue?: - | { - values?: any[] | undefined; - numberValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - boolValues?: - | { - values?: boolean[] | undefined; - } - | undefined; - objectValues?: - | { - values?: any[] | undefined; - } - | undefined; - dateValues?: - | { - values?: string[] | undefined; - } - | undefined; - uuidValues?: - | { - values?: string[] | undefined; - } - | undefined; - intValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - textValues?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dateValue?: string | undefined; - uuidValue?: string | undefined; - intValue?: number | undefined; - geoValue?: - | { - longitude?: number | undefined; - latitude?: number | undefined; - } - | undefined; - blobValue?: string | undefined; - phoneValue?: - | { - countryCode?: number | undefined; - defaultCountry?: string | undefined; - input?: string | undefined; - internationalFormatted?: string | undefined; - national?: number | undefined; - nationalFormatted?: string | undefined; - valid?: boolean | undefined; - } - | undefined; - nullValue?: - | import('../google/protobuf/struct.js').NullValue - | undefined; - textValue?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - refPropsRequested?: boolean | undefined; - } - | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - generative?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - }[] - | undefined; - generativeGroupedResult?: string | undefined; - groupByResults?: - | { - name?: string | undefined; - minDistance?: number | undefined; - maxDistance?: number | undefined; - numberOfObjects?: number | undefined; - objects?: - | { - properties?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - refProps?: - | { - properties?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - targetCollection?: string | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: any[] | undefined; - objectArrayProperties?: - | { - values?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: - | { - values?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: any | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: any[] | undefined; - emptyListProps?: string[] | undefined; - }[] - | undefined; - propName?: string | undefined; - }[] - | undefined; - nonRefProps?: - | { - fields?: - | { - [x: string]: - | { - numberValue?: number | undefined; - stringValue?: string | undefined; - boolValue?: boolean | undefined; - objectValue?: any | undefined; - listValue?: - | { - values?: any[] | undefined; - numberValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - boolValues?: - | { - values?: boolean[] | undefined; - } - | undefined; - objectValues?: - | { - values?: any[] | undefined; - } - | undefined; - dateValues?: - | { - values?: string[] | undefined; - } - | undefined; - uuidValues?: - | { - values?: string[] | undefined; - } - | undefined; - intValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - textValues?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dateValue?: string | undefined; - uuidValue?: string | undefined; - intValue?: number | undefined; - geoValue?: - | { - longitude?: number | undefined; - latitude?: number | undefined; - } - | undefined; - blobValue?: string | undefined; - phoneValue?: - | { - countryCode?: number | undefined; - defaultCountry?: string | undefined; - input?: string | undefined; - internationalFormatted?: string | undefined; - national?: number | undefined; - nationalFormatted?: string | undefined; - valid?: boolean | undefined; - } - | undefined; - nullValue?: - | import('../google/protobuf/struct.js').NullValue - | undefined; - textValue?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - refPropsRequested?: boolean | undefined; - } - | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - generative?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: - | number - | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: - | number - | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - }[] - | undefined; - rerank?: - | { - score?: number | undefined; - } - | undefined; - generative?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - generativeResult?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - }[] - | undefined; - generativeGroupedResults?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined - ): SearchReply; - fromPartial(object: { - took?: number | undefined; - results?: - | { - properties?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - refProps?: - | { - properties?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - targetCollection?: string | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: any[] | undefined; - objectArrayProperties?: - | { - values?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: - | { - values?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: any | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: any[] | undefined; - emptyListProps?: string[] | undefined; - }[] - | undefined; - propName?: string | undefined; - }[] - | undefined; - nonRefProps?: - | { - fields?: - | { - [x: string]: - | { - numberValue?: number | undefined; - stringValue?: string | undefined; - boolValue?: boolean | undefined; - objectValue?: any | undefined; - listValue?: - | { - values?: any[] | undefined; - numberValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - boolValues?: - | { - values?: boolean[] | undefined; - } - | undefined; - objectValues?: - | { - values?: any[] | undefined; - } - | undefined; - dateValues?: - | { - values?: string[] | undefined; - } - | undefined; - uuidValues?: - | { - values?: string[] | undefined; - } - | undefined; - intValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - textValues?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dateValue?: string | undefined; - uuidValue?: string | undefined; - intValue?: number | undefined; - geoValue?: - | { - longitude?: number | undefined; - latitude?: number | undefined; - } - | undefined; - blobValue?: string | undefined; - phoneValue?: - | { - countryCode?: number | undefined; - defaultCountry?: string | undefined; - input?: string | undefined; - internationalFormatted?: string | undefined; - national?: number | undefined; - nationalFormatted?: string | undefined; - valid?: boolean | undefined; - } - | undefined; - nullValue?: - | import('../google/protobuf/struct.js').NullValue - | undefined; - textValue?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - refPropsRequested?: boolean | undefined; - } - | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - generative?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - }[] - | undefined; - generativeGroupedResult?: string | undefined; - groupByResults?: - | { - name?: string | undefined; - minDistance?: number | undefined; - maxDistance?: number | undefined; - numberOfObjects?: number | undefined; - objects?: - | { - properties?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - refProps?: - | { - properties?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - targetCollection?: string | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: any[] | undefined; - objectArrayProperties?: - | { - values?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: - | { - values?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: any | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: any[] | undefined; - emptyListProps?: string[] | undefined; - }[] - | undefined; - propName?: string | undefined; - }[] - | undefined; - nonRefProps?: - | { - fields?: - | { - [x: string]: - | { - numberValue?: number | undefined; - stringValue?: string | undefined; - boolValue?: boolean | undefined; - objectValue?: any | undefined; - listValue?: - | { - values?: any[] | undefined; - numberValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - boolValues?: - | { - values?: boolean[] | undefined; - } - | undefined; - objectValues?: - | { - values?: any[] | undefined; - } - | undefined; - dateValues?: - | { - values?: string[] | undefined; - } - | undefined; - uuidValues?: - | { - values?: string[] | undefined; - } - | undefined; - intValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - textValues?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dateValue?: string | undefined; - uuidValue?: string | undefined; - intValue?: number | undefined; - geoValue?: - | { - longitude?: number | undefined; - latitude?: number | undefined; - } - | undefined; - blobValue?: string | undefined; - phoneValue?: - | { - countryCode?: number | undefined; - defaultCountry?: string | undefined; - input?: string | undefined; - internationalFormatted?: string | undefined; - national?: number | undefined; - nationalFormatted?: string | undefined; - valid?: boolean | undefined; - } - | undefined; - nullValue?: - | import('../google/protobuf/struct.js').NullValue - | undefined; - textValue?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - refPropsRequested?: boolean | undefined; - } - | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - generative?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - }[] - | undefined; - rerank?: - | { - score?: number | undefined; - } - | undefined; - generative?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - generativeResult?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - }[] - | undefined; - generativeGroupedResults?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - }): SearchReply; - }; - readonly responseStream: false; - readonly options: {}; - }; - readonly batchObjects: { - readonly name: 'BatchObjects'; - readonly requestType: { - encode( - message: BatchObjectsRequest, - writer?: import('protobufjs').Writer - ): import('protobufjs').Writer; - decode( - input: Uint8Array | import('protobufjs').Reader, - length?: number | undefined - ): BatchObjectsRequest; - fromJSON(object: any): BatchObjectsRequest; - toJSON(message: BatchObjectsRequest): unknown; - create( - base?: - | { - objects?: - | { - uuid?: string | undefined; - vector?: number[] | undefined; - properties?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - singleTargetRefProps?: - | { - uuids?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - multiTargetRefProps?: - | { - uuids?: string[] | undefined; - propName?: string | undefined; - targetCollection?: string | undefined; - }[] - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: any[] | undefined; - objectArrayProperties?: - | { - values?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: - | { - values?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: any | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: any[] | undefined; - emptyListProps?: string[] | undefined; - }[] - | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - collection?: string | undefined; - tenant?: string | undefined; - vectorBytes?: Uint8Array | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - }[] - | undefined; - consistencyLevel?: import('./base.js').ConsistencyLevel | undefined; - } - | undefined - ): BatchObjectsRequest; - fromPartial(object: { - objects?: - | { - uuid?: string | undefined; - vector?: number[] | undefined; - properties?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - singleTargetRefProps?: - | { - uuids?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - multiTargetRefProps?: - | { - uuids?: string[] | undefined; - propName?: string | undefined; - targetCollection?: string | undefined; - }[] - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: any[] | undefined; - objectArrayProperties?: - | { - values?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: - | { - values?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: any | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: any[] | undefined; - emptyListProps?: string[] | undefined; - }[] - | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - collection?: string | undefined; - tenant?: string | undefined; - vectorBytes?: Uint8Array | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - }[] - | undefined; - consistencyLevel?: import('./base.js').ConsistencyLevel | undefined; - }): BatchObjectsRequest; - }; - readonly requestStream: false; - readonly responseType: { - encode(message: BatchObjectsReply, writer?: import('protobufjs').Writer): import('protobufjs').Writer; - decode( - input: Uint8Array | import('protobufjs').Reader, - length?: number | undefined - ): BatchObjectsReply; - fromJSON(object: any): BatchObjectsReply; - toJSON(message: BatchObjectsReply): unknown; - create( - base?: - | { - took?: number | undefined; - errors?: - | { - index?: number | undefined; - error?: string | undefined; - }[] - | undefined; - } - | undefined - ): BatchObjectsReply; - fromPartial(object: { - took?: number | undefined; - errors?: - | { - index?: number | undefined; - error?: string | undefined; - }[] - | undefined; - }): BatchObjectsReply; - }; - readonly responseStream: false; - readonly options: {}; - }; - readonly batchDelete: { - readonly name: 'BatchDelete'; - readonly requestType: { - encode( - message: BatchDeleteRequest, - writer?: import('protobufjs').Writer - ): import('protobufjs').Writer; - decode( - input: Uint8Array | import('protobufjs').Reader, - length?: number | undefined - ): BatchDeleteRequest; - fromJSON(object: any): BatchDeleteRequest; - toJSON(message: BatchDeleteRequest): unknown; - create( - base?: - | { - collection?: string | undefined; - filters?: - | { - operator?: import('./base.js').Filters_Operator | undefined; - on?: string[] | undefined; - filters?: any[] | undefined; - valueText?: string | undefined; - valueInt?: number | undefined; - valueBoolean?: boolean | undefined; - valueNumber?: number | undefined; - valueTextArray?: - | { - values?: string[] | undefined; - } - | undefined; - valueIntArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueBooleanArray?: - | { - values?: boolean[] | undefined; - } - | undefined; - valueNumberArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueGeo?: - | { - latitude?: number | undefined; - longitude?: number | undefined; - distance?: number | undefined; - } - | undefined; - target?: - | { - property?: string | undefined; - singleTarget?: - | { - on?: string | undefined; - target?: any | undefined; - } - | undefined; - multiTarget?: - | { - on?: string | undefined; - target?: any | undefined; - targetCollection?: string | undefined; - } - | undefined; - count?: - | { - on?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - verbose?: boolean | undefined; - dryRun?: boolean | undefined; - consistencyLevel?: import('./base.js').ConsistencyLevel | undefined; - tenant?: string | undefined; - } - | undefined - ): BatchDeleteRequest; - fromPartial(object: { - collection?: string | undefined; - filters?: - | { - operator?: import('./base.js').Filters_Operator | undefined; - on?: string[] | undefined; - filters?: any[] | undefined; - valueText?: string | undefined; - valueInt?: number | undefined; - valueBoolean?: boolean | undefined; - valueNumber?: number | undefined; - valueTextArray?: - | { - values?: string[] | undefined; - } - | undefined; - valueIntArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueBooleanArray?: - | { - values?: boolean[] | undefined; - } - | undefined; - valueNumberArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueGeo?: - | { - latitude?: number | undefined; - longitude?: number | undefined; - distance?: number | undefined; - } - | undefined; - target?: - | { - property?: string | undefined; - singleTarget?: - | { - on?: string | undefined; - target?: any | undefined; - } - | undefined; - multiTarget?: - | { - on?: string | undefined; - target?: any | undefined; - targetCollection?: string | undefined; - } - | undefined; - count?: - | { - on?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - verbose?: boolean | undefined; - dryRun?: boolean | undefined; - consistencyLevel?: import('./base.js').ConsistencyLevel | undefined; - tenant?: string | undefined; - }): BatchDeleteRequest; - }; - readonly requestStream: false; - readonly responseType: { - encode(message: BatchDeleteReply, writer?: import('protobufjs').Writer): import('protobufjs').Writer; - decode( - input: Uint8Array | import('protobufjs').Reader, - length?: number | undefined - ): BatchDeleteReply; - fromJSON(object: any): BatchDeleteReply; - toJSON(message: BatchDeleteReply): unknown; - create( - base?: - | { - took?: number | undefined; - failed?: number | undefined; - matches?: number | undefined; - successful?: number | undefined; - objects?: - | { - uuid?: Uint8Array | undefined; - successful?: boolean | undefined; - error?: string | undefined; - }[] - | undefined; - } - | undefined - ): BatchDeleteReply; - fromPartial(object: { - took?: number | undefined; - failed?: number | undefined; - matches?: number | undefined; - successful?: number | undefined; - objects?: - | { - uuid?: Uint8Array | undefined; - successful?: boolean | undefined; - error?: string | undefined; - }[] - | undefined; - }): BatchDeleteReply; - }; - readonly responseStream: false; - readonly options: {}; - }; - readonly tenantsGet: { - readonly name: 'TenantsGet'; - readonly requestType: { - encode(message: TenantsGetRequest, writer?: import('protobufjs').Writer): import('protobufjs').Writer; - decode( - input: Uint8Array | import('protobufjs').Reader, - length?: number | undefined - ): TenantsGetRequest; - fromJSON(object: any): TenantsGetRequest; - toJSON(message: TenantsGetRequest): unknown; - create( - base?: - | { - collection?: string | undefined; - names?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined - ): TenantsGetRequest; - fromPartial(object: { - collection?: string | undefined; - names?: - | { - values?: string[] | undefined; - } - | undefined; - }): TenantsGetRequest; - }; - readonly requestStream: false; - readonly responseType: { - encode(message: TenantsGetReply, writer?: import('protobufjs').Writer): import('protobufjs').Writer; - decode(input: Uint8Array | import('protobufjs').Reader, length?: number | undefined): TenantsGetReply; - fromJSON(object: any): TenantsGetReply; - toJSON(message: TenantsGetReply): unknown; - create( - base?: - | { - took?: number | undefined; - tenants?: - | { - name?: string | undefined; - activityStatus?: import('./tenants.js').TenantActivityStatus | undefined; - }[] - | undefined; - } - | undefined - ): TenantsGetReply; - fromPartial(object: { - took?: number | undefined; - tenants?: - | { - name?: string | undefined; - activityStatus?: import('./tenants.js').TenantActivityStatus | undefined; - }[] - | undefined; - }): TenantsGetReply; - }; - readonly responseStream: false; - readonly options: {}; - }; - }; -}; -export interface WeaviateServiceImplementation { - search(request: SearchRequest, context: CallContext & CallContextExt): Promise>; - batchObjects( - request: BatchObjectsRequest, - context: CallContext & CallContextExt - ): Promise>; - batchDelete( - request: BatchDeleteRequest, - context: CallContext & CallContextExt - ): Promise>; - tenantsGet( - request: TenantsGetRequest, - context: CallContext & CallContextExt - ): Promise>; -} -export interface WeaviateClient { - search(request: DeepPartial, options?: CallOptions & CallOptionsExt): Promise; - batchObjects( - request: DeepPartial, - options?: CallOptions & CallOptionsExt - ): Promise; - batchDelete( - request: DeepPartial, - options?: CallOptions & CallOptionsExt - ): Promise; - tenantsGet( - request: DeepPartial, - options?: CallOptions & CallOptionsExt - ): Promise; -} -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/cjs/proto/v1/weaviate.js b/dist/node/cjs/proto/v1/weaviate.js deleted file mode 100644 index 826f703b..00000000 --- a/dist/node/cjs/proto/v1/weaviate.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict'; -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/weaviate.proto -Object.defineProperty(exports, '__esModule', { value: true }); -exports.WeaviateDefinition = exports.protobufPackage = void 0; -const batch_js_1 = require('./batch.js'); -const batch_delete_js_1 = require('./batch_delete.js'); -const search_get_js_1 = require('./search_get.js'); -const tenants_js_1 = require('./tenants.js'); -exports.protobufPackage = 'weaviate.v1'; -exports.WeaviateDefinition = { - name: 'Weaviate', - fullName: 'weaviate.v1.Weaviate', - methods: { - search: { - name: 'Search', - requestType: search_get_js_1.SearchRequest, - requestStream: false, - responseType: search_get_js_1.SearchReply, - responseStream: false, - options: {}, - }, - batchObjects: { - name: 'BatchObjects', - requestType: batch_js_1.BatchObjectsRequest, - requestStream: false, - responseType: batch_js_1.BatchObjectsReply, - responseStream: false, - options: {}, - }, - batchDelete: { - name: 'BatchDelete', - requestType: batch_delete_js_1.BatchDeleteRequest, - requestStream: false, - responseType: batch_delete_js_1.BatchDeleteReply, - responseStream: false, - options: {}, - }, - tenantsGet: { - name: 'TenantsGet', - requestType: tenants_js_1.TenantsGetRequest, - requestStream: false, - responseType: tenants_js_1.TenantsGetReply, - responseStream: false, - options: {}, - }, - }, -}; diff --git a/dist/node/cjs/schema/classCreator.d.ts b/dist/node/cjs/schema/classCreator.d.ts deleted file mode 100644 index d1f1f16d..00000000 --- a/dist/node/cjs/schema/classCreator.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Connection from '../connection/index.js'; -import { WeaviateClass } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassCreator extends CommandBase { - private class; - constructor(client: Connection); - withClass: (classObj: object) => this; - validateClass: () => void; - validate(): void; - do: () => Promise; -} diff --git a/dist/node/cjs/schema/classCreator.js b/dist/node/cjs/schema/classCreator.js deleted file mode 100644 index cbdad4b5..00000000 --- a/dist/node/cjs/schema/classCreator.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class ClassCreator extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withClass = (classObj) => { - this.class = classObj; - return this; - }; - this.validateClass = () => { - if (this.class == undefined || this.class == null) { - this.addError('class object must be set - set with .withClass(class)'); - } - }; - this.do = () => { - this.validateClass(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/schema`; - return this.client.postReturn(path, this.class); - }; - } - validate() { - this.validateClass(); - } -} -exports.default = ClassCreator; diff --git a/dist/node/cjs/schema/classDeleter.d.ts b/dist/node/cjs/schema/classDeleter.d.ts deleted file mode 100644 index 6ed553be..00000000 --- a/dist/node/cjs/schema/classDeleter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassDeleter extends CommandBase { - private className?; - constructor(client: Connection); - withClassName: (className: string) => this; - validateClassName: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/schema/classDeleter.js b/dist/node/cjs/schema/classDeleter.js deleted file mode 100644 index 44f79599..00000000 --- a/dist/node/cjs/schema/classDeleter.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const string_js_1 = require('../validation/string.js'); -class ClassDeleter extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.validateClassName = () => { - if (!(0, string_js_1.isValidStringProperty)(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.validate = () => { - this.validateClassName(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/schema/${this.className}`; - return this.client.delete(path, undefined, false); - }; - } -} -exports.default = ClassDeleter; diff --git a/dist/node/cjs/schema/classExists.d.ts b/dist/node/cjs/schema/classExists.d.ts deleted file mode 100644 index 17f936ac..00000000 --- a/dist/node/cjs/schema/classExists.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassExists extends CommandBase { - private className?; - constructor(client: Connection); - withClassName: (className: string) => this; - validateClassName: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/schema/classExists.js b/dist/node/cjs/schema/classExists.js deleted file mode 100644 index 5b34a18c..00000000 --- a/dist/node/cjs/schema/classExists.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const string_js_1 = require('../validation/string.js'); -class ClassExists extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.validateClassName = () => { - if (!(0, string_js_1.isValidStringProperty)(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.validate = () => { - this.validateClassName(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/schema`; - return this.client.get(path).then((res) => { - var _a; - return (_a = res.classes) === null || _a === void 0 - ? void 0 - : _a.some((c) => c.class === this.className); - }); - }; - } -} -exports.default = ClassExists; diff --git a/dist/node/cjs/schema/classGetter.d.ts b/dist/node/cjs/schema/classGetter.d.ts deleted file mode 100644 index eed46f7f..00000000 --- a/dist/node/cjs/schema/classGetter.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Connection from '../connection/index.js'; -import { WeaviateClass } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassGetter extends CommandBase { - private className?; - constructor(client: Connection); - withClassName: (className: string) => this; - validateClassName: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/schema/classGetter.js b/dist/node/cjs/schema/classGetter.js deleted file mode 100644 index c0f42e0f..00000000 --- a/dist/node/cjs/schema/classGetter.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const string_js_1 = require('../validation/string.js'); -class ClassGetter extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.validateClassName = () => { - if (!(0, string_js_1.isValidStringProperty)(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.validate = () => { - this.validateClassName(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/schema/${this.className}`; - return this.client.get(path); - }; - } -} -exports.default = ClassGetter; diff --git a/dist/node/cjs/schema/classUpdater.d.ts b/dist/node/cjs/schema/classUpdater.d.ts deleted file mode 100644 index 78417a17..00000000 --- a/dist/node/cjs/schema/classUpdater.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Connection from '../connection/index.js'; -import { WeaviateClass } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassUpdater extends CommandBase { - private class; - constructor(client: Connection); - withClass: (classObj: WeaviateClass) => this; - validateClass: () => void; - validate(): void; - do: () => Promise; -} diff --git a/dist/node/cjs/schema/classUpdater.js b/dist/node/cjs/schema/classUpdater.js deleted file mode 100644 index 51dac878..00000000 --- a/dist/node/cjs/schema/classUpdater.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class ClassUpdater extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withClass = (classObj) => { - this.class = classObj; - return this; - }; - this.validateClass = () => { - if (this.class == undefined || this.class == null) { - this.addError('class object must be set - set with .withClass(class)'); - } - }; - this.do = () => { - this.validateClass(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/schema/${this.class.class}`; - return this.client.put(path, this.class, false); - }; - } - validate() { - this.validateClass(); - } -} -exports.default = ClassUpdater; diff --git a/dist/node/cjs/schema/deleteAll.d.ts b/dist/node/cjs/schema/deleteAll.d.ts deleted file mode 100644 index 1aa13713..00000000 --- a/dist/node/cjs/schema/deleteAll.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Connection from '../connection/index.js'; -declare const _default: (client: Connection) => Promise; -export default _default; diff --git a/dist/node/cjs/schema/deleteAll.js b/dist/node/cjs/schema/deleteAll.js deleted file mode 100644 index 931b7aba..00000000 --- a/dist/node/cjs/schema/deleteAll.js +++ /dev/null @@ -1,53 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const classDeleter_js_1 = __importDefault(require('./classDeleter.js')); -const getter_js_1 = __importDefault(require('./getter.js')); -exports.default = (client) => - __awaiter(void 0, void 0, void 0, function* () { - const getter = new getter_js_1.default(client); - const schema = yield getter.do(); - yield Promise.all( - schema.classes - ? schema.classes.map((c) => { - const deleter = new classDeleter_js_1.default(client); - return deleter.withClassName(c.class).do(); - }) - : [] - ); - }); diff --git a/dist/node/cjs/schema/getter.d.ts b/dist/node/cjs/schema/getter.d.ts deleted file mode 100644 index 123cd761..00000000 --- a/dist/node/cjs/schema/getter.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import Connection from '../connection/index.js'; -import { WeaviateSchema } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class SchemaGetter extends CommandBase { - constructor(client: Connection); - validate(): void; - do: () => Promise; -} diff --git a/dist/node/cjs/schema/getter.js b/dist/node/cjs/schema/getter.js deleted file mode 100644 index f20c2ac1..00000000 --- a/dist/node/cjs/schema/getter.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class SchemaGetter extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.do = () => { - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/schema`; - return this.client.get(path); - }; - } - validate() { - // nothing to validate - } -} -exports.default = SchemaGetter; diff --git a/dist/node/cjs/schema/index.d.ts b/dist/node/cjs/schema/index.d.ts deleted file mode 100644 index f567bb05..00000000 --- a/dist/node/cjs/schema/index.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -import Connection from '../connection/index.js'; -import { Tenant } from '../openapi/types.js'; -import ClassCreator from './classCreator.js'; -import ClassDeleter from './classDeleter.js'; -import ClassGetter from './classGetter.js'; -import ClassUpdater from './classUpdater.js'; -import SchemaGetter from './getter.js'; -import PropertyCreator from './propertyCreator.js'; -import ShardUpdater from './shardUpdater.js'; -import ShardsGetter from './shardsGetter.js'; -import ShardsUpdater from './shardsUpdater.js'; -import TenantsCreator from './tenantsCreator.js'; -import TenantsDeleter from './tenantsDeleter.js'; -import TenantsExists from './tenantsExists.js'; -import TenantsGetter from './tenantsGetter.js'; -import TenantsUpdater from './tenantsUpdater.js'; -export interface Schema { - classCreator: () => ClassCreator; - classDeleter: () => ClassDeleter; - classGetter: () => ClassGetter; - classUpdater: () => ClassUpdater; - exists: (className: string) => Promise; - getter: () => SchemaGetter; - propertyCreator: () => PropertyCreator; - deleteAll: () => Promise; - shardsGetter: () => ShardsGetter; - shardUpdater: () => ShardUpdater; - shardsUpdater: () => ShardsUpdater; - tenantsCreator: (className: string, tenants: Array) => TenantsCreator; - tenantsGetter: (className: string) => TenantsGetter; - tenantsUpdater: (className: string, tenants: Array) => TenantsUpdater; - tenantsDeleter: (className: string, tenants: Array) => TenantsDeleter; - tenantsExists: (className: string, tenant: string) => TenantsExists; -} -declare const schema: (client: Connection) => Schema; -export default schema; -export { default as ClassCreator } from './classCreator.js'; -export { default as ClassDeleter } from './classDeleter.js'; -export { default as ClassGetter } from './classGetter.js'; -export { default as SchemaGetter } from './getter.js'; -export { default as PropertyCreator } from './propertyCreator.js'; -export { default as ShardUpdater } from './shardUpdater.js'; -export { default as ShardsUpdater } from './shardsUpdater.js'; -export { default as TenantsCreator } from './tenantsCreator.js'; -export { default as TenantsDeleter } from './tenantsDeleter.js'; -export { default as TenantsExists } from './tenantsExists.js'; -export { default as TenantsGetter } from './tenantsGetter.js'; -export { default as TenantsUpdater } from './tenantsUpdater.js'; diff --git a/dist/node/cjs/schema/index.js b/dist/node/cjs/schema/index.js deleted file mode 100644 index eec6e2a3..00000000 --- a/dist/node/cjs/schema/index.js +++ /dev/null @@ -1,141 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.TenantsUpdater = - exports.TenantsGetter = - exports.TenantsExists = - exports.TenantsDeleter = - exports.TenantsCreator = - exports.ShardsUpdater = - exports.ShardUpdater = - exports.PropertyCreator = - exports.SchemaGetter = - exports.ClassGetter = - exports.ClassDeleter = - exports.ClassCreator = - void 0; -const classCreator_js_1 = __importDefault(require('./classCreator.js')); -const classDeleter_js_1 = __importDefault(require('./classDeleter.js')); -const classExists_js_1 = __importDefault(require('./classExists.js')); -const classGetter_js_1 = __importDefault(require('./classGetter.js')); -const classUpdater_js_1 = __importDefault(require('./classUpdater.js')); -const deleteAll_js_1 = __importDefault(require('./deleteAll.js')); -const getter_js_1 = __importDefault(require('./getter.js')); -const propertyCreator_js_1 = __importDefault(require('./propertyCreator.js')); -const shardUpdater_js_1 = __importDefault(require('./shardUpdater.js')); -const shardsGetter_js_1 = __importDefault(require('./shardsGetter.js')); -const shardsUpdater_js_1 = __importDefault(require('./shardsUpdater.js')); -const tenantsCreator_js_1 = __importDefault(require('./tenantsCreator.js')); -const tenantsDeleter_js_1 = __importDefault(require('./tenantsDeleter.js')); -const tenantsExists_js_1 = __importDefault(require('./tenantsExists.js')); -const tenantsGetter_js_1 = __importDefault(require('./tenantsGetter.js')); -const tenantsUpdater_js_1 = __importDefault(require('./tenantsUpdater.js')); -const schema = (client) => { - return { - classCreator: () => new classCreator_js_1.default(client), - classDeleter: () => new classDeleter_js_1.default(client), - classGetter: () => new classGetter_js_1.default(client), - classUpdater: () => new classUpdater_js_1.default(client), - exists: (className) => new classExists_js_1.default(client).withClassName(className).do(), - getter: () => new getter_js_1.default(client), - propertyCreator: () => new propertyCreator_js_1.default(client), - deleteAll: () => (0, deleteAll_js_1.default)(client), - shardsGetter: () => new shardsGetter_js_1.default(client), - shardUpdater: () => new shardUpdater_js_1.default(client), - shardsUpdater: () => new shardsUpdater_js_1.default(client), - tenantsCreator: (className, tenants) => new tenantsCreator_js_1.default(client, className, tenants), - tenantsGetter: (className) => new tenantsGetter_js_1.default(client, className), - tenantsUpdater: (className, tenants) => new tenantsUpdater_js_1.default(client, className, tenants), - tenantsDeleter: (className, tenants) => new tenantsDeleter_js_1.default(client, className, tenants), - tenantsExists: (className, tenant) => new tenantsExists_js_1.default(client, className, tenant), - }; -}; -exports.default = schema; -var classCreator_js_2 = require('./classCreator.js'); -Object.defineProperty(exports, 'ClassCreator', { - enumerable: true, - get: function () { - return __importDefault(classCreator_js_2).default; - }, -}); -var classDeleter_js_2 = require('./classDeleter.js'); -Object.defineProperty(exports, 'ClassDeleter', { - enumerable: true, - get: function () { - return __importDefault(classDeleter_js_2).default; - }, -}); -var classGetter_js_2 = require('./classGetter.js'); -Object.defineProperty(exports, 'ClassGetter', { - enumerable: true, - get: function () { - return __importDefault(classGetter_js_2).default; - }, -}); -var getter_js_2 = require('./getter.js'); -Object.defineProperty(exports, 'SchemaGetter', { - enumerable: true, - get: function () { - return __importDefault(getter_js_2).default; - }, -}); -var propertyCreator_js_2 = require('./propertyCreator.js'); -Object.defineProperty(exports, 'PropertyCreator', { - enumerable: true, - get: function () { - return __importDefault(propertyCreator_js_2).default; - }, -}); -var shardUpdater_js_2 = require('./shardUpdater.js'); -Object.defineProperty(exports, 'ShardUpdater', { - enumerable: true, - get: function () { - return __importDefault(shardUpdater_js_2).default; - }, -}); -var shardsUpdater_js_2 = require('./shardsUpdater.js'); -Object.defineProperty(exports, 'ShardsUpdater', { - enumerable: true, - get: function () { - return __importDefault(shardsUpdater_js_2).default; - }, -}); -var tenantsCreator_js_2 = require('./tenantsCreator.js'); -Object.defineProperty(exports, 'TenantsCreator', { - enumerable: true, - get: function () { - return __importDefault(tenantsCreator_js_2).default; - }, -}); -var tenantsDeleter_js_2 = require('./tenantsDeleter.js'); -Object.defineProperty(exports, 'TenantsDeleter', { - enumerable: true, - get: function () { - return __importDefault(tenantsDeleter_js_2).default; - }, -}); -var tenantsExists_js_2 = require('./tenantsExists.js'); -Object.defineProperty(exports, 'TenantsExists', { - enumerable: true, - get: function () { - return __importDefault(tenantsExists_js_2).default; - }, -}); -var tenantsGetter_js_2 = require('./tenantsGetter.js'); -Object.defineProperty(exports, 'TenantsGetter', { - enumerable: true, - get: function () { - return __importDefault(tenantsGetter_js_2).default; - }, -}); -var tenantsUpdater_js_2 = require('./tenantsUpdater.js'); -Object.defineProperty(exports, 'TenantsUpdater', { - enumerable: true, - get: function () { - return __importDefault(tenantsUpdater_js_2).default; - }, -}); diff --git a/dist/node/cjs/schema/propertyCreator.d.ts b/dist/node/cjs/schema/propertyCreator.d.ts deleted file mode 100644 index 7b368df7..00000000 --- a/dist/node/cjs/schema/propertyCreator.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Connection from '../connection/index.js'; -import { Property } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class PropertyCreator extends CommandBase { - private className; - private property; - constructor(client: Connection); - withClassName: (className: string) => this; - withProperty: (property: Property) => this; - validateClassName: () => void; - validateProperty: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/schema/propertyCreator.js b/dist/node/cjs/schema/propertyCreator.js deleted file mode 100644 index edd9852b..00000000 --- a/dist/node/cjs/schema/propertyCreator.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const string_js_1 = require('../validation/string.js'); -class PropertyCreator extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withProperty = (property) => { - this.property = property; - return this; - }; - this.validateClassName = () => { - if (!(0, string_js_1.isValidStringProperty)(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.validateProperty = () => { - if (this.property == undefined || this.property == null) { - this.addError('property must be set - set with .withProperty(property)'); - } - }; - this.validate = () => { - this.validateClassName(); - this.validateProperty(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/schema/${this.className}/properties`; - return this.client.postReturn(path, this.property); - }; - } -} -exports.default = PropertyCreator; diff --git a/dist/node/cjs/schema/shardUpdater.d.ts b/dist/node/cjs/schema/shardUpdater.d.ts deleted file mode 100644 index 2d618fed..00000000 --- a/dist/node/cjs/schema/shardUpdater.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ShardUpdater extends CommandBase { - private className; - private shardName; - private status; - constructor(client: Connection); - withClassName: (className: string) => this; - validateClassName: () => void; - withShardName: (shardName: string) => this; - validateShardName: () => void; - withStatus: (status: string) => this; - validateStatus: () => void; - validate: () => void; - do: () => any; -} -export declare function updateShard( - client: Connection, - className: string, - shardName: string, - status: string -): any; diff --git a/dist/node/cjs/schema/shardUpdater.js b/dist/node/cjs/schema/shardUpdater.js deleted file mode 100644 index d2b36dee..00000000 --- a/dist/node/cjs/schema/shardUpdater.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.updateShard = void 0; -const commandBase_js_1 = require('../validation/commandBase.js'); -const string_js_1 = require('../validation/string.js'); -class ShardUpdater extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.validateClassName = () => { - if (!(0, string_js_1.isValidStringProperty)(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.withShardName = (shardName) => { - this.shardName = shardName; - return this; - }; - this.validateShardName = () => { - if (!(0, string_js_1.isValidStringProperty)(this.shardName)) { - this.addError('shardName must be set - set with .withShardName(shardName)'); - } - }; - this.withStatus = (status) => { - this.status = status; - return this; - }; - this.validateStatus = () => { - if (!(0, string_js_1.isValidStringProperty)(this.status)) { - this.addError('status must be set - set with .withStatus(status)'); - } - }; - this.validate = () => { - this.validateClassName(); - this.validateShardName(); - this.validateStatus(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error(`invalid usage: ${this.errors.join(', ')}`)); - } - return updateShard(this.client, this.className, this.shardName, this.status); - }; - } -} -exports.default = ShardUpdater; -function updateShard(client, className, shardName, status) { - const path = `/schema/${className}/shards/${shardName}`; - return client.put(path, { status: status }, true); -} -exports.updateShard = updateShard; diff --git a/dist/node/cjs/schema/shardsGetter.d.ts b/dist/node/cjs/schema/shardsGetter.d.ts deleted file mode 100644 index 604a1407..00000000 --- a/dist/node/cjs/schema/shardsGetter.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Connection from '../connection/index.js'; -import { ShardStatusList } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ShardsGetter extends CommandBase { - private className?; - private tenant?; - constructor(client: Connection); - withClassName: (className: string) => this; - withTenant: (tenant: string) => this; - validateClassName: () => void; - validate: () => void; - do: () => Promise; -} -export declare function getShards(client: Connection, className: any, tenant?: string): any; diff --git a/dist/node/cjs/schema/shardsGetter.js b/dist/node/cjs/schema/shardsGetter.js deleted file mode 100644 index 90ebf784..00000000 --- a/dist/node/cjs/schema/shardsGetter.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.getShards = void 0; -const commandBase_js_1 = require('../validation/commandBase.js'); -const string_js_1 = require('../validation/string.js'); -class ShardsGetter extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateClassName = () => { - if (!(0, string_js_1.isValidStringProperty)(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.validate = () => { - this.validateClassName(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error(`invalid usage: ${this.errors.join(', ')}`)); - } - return getShards(this.client, this.className, this.tenant); - }; - } -} -exports.default = ShardsGetter; -function getShards(client, className, tenant) { - const path = `/schema/${className}/shards${tenant ? `?tenant=${tenant}` : ''}`; - return client.get(path); -} -exports.getShards = getShards; diff --git a/dist/node/cjs/schema/shardsUpdater.d.ts b/dist/node/cjs/schema/shardsUpdater.d.ts deleted file mode 100644 index 533b0b32..00000000 --- a/dist/node/cjs/schema/shardsUpdater.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import Connection from '../connection/index.js'; -import { ShardStatusList } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ShardsUpdater extends CommandBase { - private className; - private shards; - private status; - constructor(client: Connection); - withClassName: (className: string) => this; - validateClassName: () => void; - withStatus: (status: string) => this; - validateStatus: () => void; - validate: () => void; - updateShards: () => Promise; - do: () => Promise; -} diff --git a/dist/node/cjs/schema/shardsUpdater.js b/dist/node/cjs/schema/shardsUpdater.js deleted file mode 100644 index c30ab2c0..00000000 --- a/dist/node/cjs/schema/shardsUpdater.js +++ /dev/null @@ -1,104 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -const string_js_1 = require('../validation/string.js'); -const shardUpdater_js_1 = require('./shardUpdater.js'); -const shardsGetter_js_1 = require('./shardsGetter.js'); -class ShardsUpdater extends commandBase_js_1.CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.validateClassName = () => { - if (!(0, string_js_1.isValidStringProperty)(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.withStatus = (status) => { - this.status = status; - return this; - }; - this.validateStatus = () => { - if (!(0, string_js_1.isValidStringProperty)(this.status)) { - this.addError('status must be set - set with .withStatus(status)'); - } - }; - this.validate = () => { - this.validateClassName(); - this.validateStatus(); - }; - this.updateShards = () => - __awaiter(this, void 0, void 0, function* () { - const payload = yield Promise.all( - Array.from({ length: this.shards.length }, (_, i) => - (0, shardUpdater_js_1.updateShard)( - this.client, - this.className, - this.shards[i].name || '', - this.status - ) - .then((res) => { - return { name: this.shards[i].name, status: res.status }; - }) - .catch((err) => this.addError(err.toString())) - ) - ); - if (this.errors.length > 0) { - return Promise.reject(new Error(`failed to update shards: ${this.errors.join(', ')}`)); - } - return Promise.resolve(payload); - }); - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error(`invalid usage: ${this.errors.join(', ')}`)); - } - return (0, shardsGetter_js_1.getShards)(this.client, this.className) - .then((shards) => (this.shards = shards)) - .then(() => { - return this.updateShards(); - }) - .then((payload) => { - return payload; - }) - .catch((err) => { - return Promise.reject(err); - }); - }; - this.shards = []; - } -} -exports.default = ShardsUpdater; diff --git a/dist/node/cjs/schema/tenantsCreator.d.ts b/dist/node/cjs/schema/tenantsCreator.d.ts deleted file mode 100644 index 88f702f8..00000000 --- a/dist/node/cjs/schema/tenantsCreator.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import Connection from '../connection/index.js'; -import { Tenant } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsCreator extends CommandBase { - private className; - private tenants; - constructor(client: Connection, className: string, tenants: Array); - validate: () => void; - do: () => Promise>; -} diff --git a/dist/node/cjs/schema/tenantsCreator.js b/dist/node/cjs/schema/tenantsCreator.js deleted file mode 100644 index 6599b0fe..00000000 --- a/dist/node/cjs/schema/tenantsCreator.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class TenantsCreator extends commandBase_js_1.CommandBase { - constructor(client, className, tenants) { - super(client); - this.validate = () => { - // nothing to validate - }; - this.do = () => { - return this.client.postReturn(`/schema/${this.className}/tenants`, this.tenants); - }; - this.className = className; - this.tenants = tenants; - } -} -exports.default = TenantsCreator; diff --git a/dist/node/cjs/schema/tenantsDeleter.d.ts b/dist/node/cjs/schema/tenantsDeleter.d.ts deleted file mode 100644 index 2df19490..00000000 --- a/dist/node/cjs/schema/tenantsDeleter.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsDeleter extends CommandBase { - private className; - private tenants; - constructor(client: Connection, className: string, tenants: Array); - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/schema/tenantsDeleter.js b/dist/node/cjs/schema/tenantsDeleter.js deleted file mode 100644 index 39eb409d..00000000 --- a/dist/node/cjs/schema/tenantsDeleter.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class TenantsDeleter extends commandBase_js_1.CommandBase { - constructor(client, className, tenants) { - super(client); - this.validate = () => { - // nothing to validate - }; - this.do = () => { - return this.client.delete(`/schema/${this.className}/tenants`, this.tenants, false); - }; - this.className = className; - this.tenants = tenants; - } -} -exports.default = TenantsDeleter; diff --git a/dist/node/cjs/schema/tenantsExists.d.ts b/dist/node/cjs/schema/tenantsExists.d.ts deleted file mode 100644 index 4f9adcac..00000000 --- a/dist/node/cjs/schema/tenantsExists.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsExists extends CommandBase { - private className; - private tenant; - constructor(client: Connection, className: string, tenant: string); - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/cjs/schema/tenantsExists.js b/dist/node/cjs/schema/tenantsExists.js deleted file mode 100644 index 34e7b43d..00000000 --- a/dist/node/cjs/schema/tenantsExists.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class TenantsExists extends commandBase_js_1.CommandBase { - constructor(client, className, tenant) { - super(client); - this.validate = () => { - // nothing to validate - }; - this.do = () => { - return this.client.head(`/schema/${this.className}/tenants/${this.tenant}`, undefined); - }; - this.className = className; - this.tenant = tenant; - } -} -exports.default = TenantsExists; diff --git a/dist/node/cjs/schema/tenantsGetter.d.ts b/dist/node/cjs/schema/tenantsGetter.d.ts deleted file mode 100644 index 23437227..00000000 --- a/dist/node/cjs/schema/tenantsGetter.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Connection from '../connection/index.js'; -import { Tenant } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsGetter extends CommandBase { - private className; - constructor(client: Connection, className: string); - validate: () => void; - do: () => Promise>; -} diff --git a/dist/node/cjs/schema/tenantsGetter.js b/dist/node/cjs/schema/tenantsGetter.js deleted file mode 100644 index ad71a351..00000000 --- a/dist/node/cjs/schema/tenantsGetter.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class TenantsGetter extends commandBase_js_1.CommandBase { - constructor(client, className) { - super(client); - this.validate = () => { - // nothing to validate - }; - this.do = () => { - return this.client.get(`/schema/${this.className}/tenants`); - }; - this.className = className; - } -} -exports.default = TenantsGetter; diff --git a/dist/node/cjs/schema/tenantsUpdater.d.ts b/dist/node/cjs/schema/tenantsUpdater.d.ts deleted file mode 100644 index 7e3e6d3a..00000000 --- a/dist/node/cjs/schema/tenantsUpdater.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import Connection from '../connection/index.js'; -import { Tenant } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsUpdater extends CommandBase { - private className; - private tenants; - constructor(client: Connection, className: string, tenants: Array); - validate: () => void; - do: () => Promise>; -} diff --git a/dist/node/cjs/schema/tenantsUpdater.js b/dist/node/cjs/schema/tenantsUpdater.js deleted file mode 100644 index 3a06fa10..00000000 --- a/dist/node/cjs/schema/tenantsUpdater.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -const commandBase_js_1 = require('../validation/commandBase.js'); -class TenantsUpdater extends commandBase_js_1.CommandBase { - constructor(client, className, tenants) { - super(client); - this.validate = () => { - // nothing to validate - }; - this.do = () => { - return this.client.put(`/schema/${this.className}/tenants`, this.tenants); - }; - this.className = className; - this.tenants = tenants; - } -} -exports.default = TenantsUpdater; diff --git a/dist/node/cjs/utils/base64.d.ts b/dist/node/cjs/utils/base64.d.ts deleted file mode 100644 index 3090d225..00000000 --- a/dist/node/cjs/utils/base64.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// -/** - * This function converts a file buffer into a base64 string so that it can be - * sent to Weaviate and stored as a media field. - * - * @param {string | Buffer} file The media to convert either as a base64 string, a file path string, or as a buffer. If you passed a base64 string, the function does nothing and returns the string as is. - * @returns {string} The base64 string - */ -export declare const toBase64FromMedia: (media: string | Buffer) => Promise; diff --git a/dist/node/cjs/utils/base64.js b/dist/node/cjs/utils/base64.js deleted file mode 100644 index 79e66bf8..00000000 --- a/dist/node/cjs/utils/base64.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.toBase64FromMedia = void 0; -const fs_1 = __importDefault(require('fs')); -const isFilePromise = (file) => - new Promise((resolve, reject) => { - if (file instanceof Buffer) { - resolve(false); - } - fs_1.default.stat(file, (err, stats) => { - if (err) { - if (err.code == 'ENAMETOOLONG') { - resolve(false); - return; - } - reject(err); - return; - } - if (stats === undefined) { - resolve(false); - return; - } - resolve(stats.isFile()); - }); - }); -const isBuffer = (file) => file instanceof Buffer; -const fileToBase64 = (file) => - isFilePromise(file).then((isFile) => - isFile - ? new Promise((resolve, reject) => { - fs_1.default.readFile(file, (err, data) => { - if (err) { - reject(err); - } - resolve(data.toString('base64')); - }); - }) - : isBuffer(file) - ? Promise.resolve(file.toString('base64')) - : Promise.resolve(file) - ); -/** - * This function converts a file buffer into a base64 string so that it can be - * sent to Weaviate and stored as a media field. - * - * @param {string | Buffer} file The media to convert either as a base64 string, a file path string, or as a buffer. If you passed a base64 string, the function does nothing and returns the string as is. - * @returns {string} The base64 string - */ -const toBase64FromMedia = (media) => fileToBase64(media); -exports.toBase64FromMedia = toBase64FromMedia; diff --git a/dist/node/cjs/utils/beaconPath.d.ts b/dist/node/cjs/utils/beaconPath.d.ts deleted file mode 100644 index 0da700a7..00000000 --- a/dist/node/cjs/utils/beaconPath.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { DbVersionSupport } from './dbVersion.js'; -export declare class BeaconPath { - private dbVersionSupport; - private beaconRegExp; - constructor(dbVersionSupport: DbVersionSupport); - rebuild(beacon: string): Promise; -} diff --git a/dist/node/cjs/utils/beaconPath.js b/dist/node/cjs/utils/beaconPath.js deleted file mode 100644 index 759067df..00000000 --- a/dist/node/cjs/utils/beaconPath.js +++ /dev/null @@ -1,85 +0,0 @@ -'use strict'; -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.BeaconPath = void 0; -const string_js_1 = require('../validation/string.js'); -const version_js_1 = require('../validation/version.js'); -const beaconPathPrefix = 'weaviate://localhost'; -class BeaconPath { - constructor(dbVersionSupport) { - this.dbVersionSupport = dbVersionSupport; - // matches - // weaviate://localhost/class/id => match[2] = class, match[4] = id - // weaviate://localhost/class/id/ => match[2] = class, match[4] = id - // weaviate://localhost/id => match[2] = id, match[4] = undefined - // weaviate://localhost/id/ => match[2] = id, match[4] = undefined - this.beaconRegExp = /^weaviate:\/\/localhost(\/([^\\/]+))?(\/([^\\/]+))?[\\/]?$/gi; - } - rebuild(beacon) { - return __awaiter(this, void 0, void 0, function* () { - const support = yield this.dbVersionSupport.supportsClassNameNamespacedEndpointsPromise(); - const match = new RegExp(this.beaconRegExp).exec(beacon); - if (!match) { - return beacon; - } - let className; - let id; - if (match[4] !== undefined) { - id = match[4]; - className = match[2]; - } else { - id = match[2]; - } - let beaconPath = beaconPathPrefix; - if (support.supports) { - if ((0, string_js_1.isValidStringProperty)(className)) { - beaconPath = `${beaconPath}/${className}`; - } else { - support.warns.deprecatedNonClassNameNamespacedEndpointsForBeacons(); - } - } else { - support.warns.notSupportedClassNamespacedEndpointsForBeacons(); - } - if (support.version) { - if (!(0, version_js_1.isValidWeaviateVersion)(support.version)) { - support.warns.deprecatedWeaviateTooOld(); - } - } - if ((0, string_js_1.isValidStringProperty)(id)) { - beaconPath = `${beaconPath}/${id}`; - } - return beaconPath; - }); - } -} -exports.BeaconPath = BeaconPath; diff --git a/dist/node/cjs/utils/dbVersion.d.ts b/dist/node/cjs/utils/dbVersion.d.ts deleted file mode 100644 index 01e72b28..00000000 --- a/dist/node/cjs/utils/dbVersion.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -import ConnectionGRPC from '../connection/grpc.js'; -export declare class DbVersionSupport { - private dbVersionProvider; - constructor(dbVersionProvider: VersionProvider); - getVersion: () => Promise; - supportsClassNameNamespacedEndpointsPromise(): Promise<{ - version: string; - supports: boolean; - warns: { - deprecatedNonClassNameNamespacedEndpointsForObjects: () => void; - deprecatedNonClassNameNamespacedEndpointsForReferences: () => void; - deprecatedNonClassNameNamespacedEndpointsForBeacons: () => void; - deprecatedWeaviateTooOld: () => void; - notSupportedClassNamespacedEndpointsForObjects: () => void; - notSupportedClassNamespacedEndpointsForReferences: () => void; - notSupportedClassNamespacedEndpointsForBeacons: () => void; - notSupportedClassParameterInEndpointsForObjects: () => void; - }; - }>; - supportsClassNameNamespacedEndpoints(version?: string): boolean; - private errorMessage; - supportsCompatibleGrpcService: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsHNSWAndBQ: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsBm25AndHybridGroupByQueries: () => Promise<{ - version: DbVersion; - supports: boolean; - message: (query: 'Bm25' | 'Hybrid') => string; - }>; - supportsHybridNearTextAndNearVectorSubsearchQueries: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supports125ListValue: () => Promise<{ - version: DbVersion; - supports: boolean; - message: undefined; - }>; - supportsNamedVectors: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsTenantsGetGRPCMethod: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsDynamicVectorIndex: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsMultiTargetVectorSearch: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsMultiVectorSearch: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsMultiVectorPerTargetSearch: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsMultiWeightsPerTargetSearch: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; -} -export interface VersionProvider { - getVersionString(): Promise; - getVersion(): Promise; -} -export declare class DbVersionProvider implements VersionProvider { - private versionPromise?; - private versionStringGetter; - constructor(versionStringGetter: () => Promise); - getVersionString(): Promise; - getVersion(): Promise; - refresh(force?: boolean): Promise; - cache(version: string): Promise; -} -export declare function initDbVersionProvider(conn: ConnectionGRPC): DbVersionProvider; -export declare class DbVersion { - private major; - private minor; - private patch?; - constructor(major: number, minor: number, patch?: number); - static fromString: (version: string) => DbVersion; - private checkNumber; - show: () => string; - isAtLeast: (major: number, minor: number, patch?: number) => boolean; - isLowerThan: (major: number, minor: number, patch: number) => boolean; -} diff --git a/dist/node/cjs/utils/dbVersion.js b/dist/node/cjs/utils/dbVersion.js deleted file mode 100644 index bae0009b..00000000 --- a/dist/node/cjs/utils/dbVersion.js +++ /dev/null @@ -1,273 +0,0 @@ -'use strict'; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.DbVersion = - exports.initDbVersionProvider = - exports.DbVersionProvider = - exports.DbVersionSupport = - void 0; -const metaGetter_js_1 = __importDefault(require('../misc/metaGetter.js')); -class DbVersionSupport { - constructor(dbVersionProvider) { - this.getVersion = () => this.dbVersionProvider.getVersion(); - this.errorMessage = (feature, current, required) => - `${feature} is not supported with Weaviate version v${current}. Please use version v${required} or higher.`; - this.supportsCompatibleGrpcService = () => - this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 23, 7), - message: this.errorMessage('The gRPC API', version.show(), '1.23.7'), - }; - }); - this.supportsHNSWAndBQ = () => - this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 24, 0), - message: this.errorMessage('HNSW index and BQ quantizer', version.show(), '1.24.0'), - }; - }); - this.supportsBm25AndHybridGroupByQueries = () => - this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 25, 0), - message: (query) => this.errorMessage(`GroupBy with ${query}`, version.show(), '1.25.0'), - }; - }); - this.supportsHybridNearTextAndNearVectorSubsearchQueries = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 25, 0), - message: this.errorMessage('Hybrid nearText/nearVector subsearching', version.show(), '1.25.0'), - }; - }); - }; - this.supports125ListValue = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 25, 0), - message: undefined, - }; - }); - }; - this.supportsNamedVectors = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 24, 0), - message: this.errorMessage('Named vectors', version.show(), '1.24.0'), - }; - }); - }; - this.supportsTenantsGetGRPCMethod = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 25, 0), - message: this.errorMessage('Tenants get method', version.show(), '1.25.0'), - }; - }); - }; - this.supportsDynamicVectorIndex = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 25, 0), - message: this.errorMessage('Dynamic vector index', version.show(), '1.25.0'), - }; - }); - }; - this.supportsMultiTargetVectorSearch = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 26, 0), - message: this.errorMessage('Multi-target vector search', version.show(), '1.26.0'), - }; - }); - }; - this.supportsMultiVectorSearch = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 26, 0), - message: this.errorMessage('Multi-vector search', version.show(), '1.26.0'), - }; - }); - }; - this.supportsMultiVectorPerTargetSearch = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 27, 0), - message: this.errorMessage('Multi-vector-per-target search', version.show(), '1.27.0'), - }; - }); - }; - this.supportsMultiWeightsPerTargetSearch = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 27, 0), - message: this.errorMessage( - 'Multi-target vector search with multiple weights', - version.show(), - '1.27.0' - ), - }; - }); - }; - this.dbVersionProvider = dbVersionProvider; - } - supportsClassNameNamespacedEndpointsPromise() { - return this.dbVersionProvider - .getVersion() - .then((version) => version.show()) - .then((version) => ({ - version: version, - supports: this.supportsClassNameNamespacedEndpoints(version), - warns: { - deprecatedNonClassNameNamespacedEndpointsForObjects: () => - console.warn( - `Usage of objects paths without className is deprecated in Weaviate ${version}. Please provide className parameter` - ), - deprecatedNonClassNameNamespacedEndpointsForReferences: () => - console.warn( - `Usage of references paths without className is deprecated in Weaviate ${version}. Please provide className parameter` - ), - deprecatedNonClassNameNamespacedEndpointsForBeacons: () => - console.warn( - `Usage of beacons paths without className is deprecated in Weaviate ${version}. Please provide className parameter` - ), - deprecatedWeaviateTooOld: () => - console.warn( - `Usage of weaviate ${version} is deprecated. Please consider upgrading to the latest version. See https://www.weaviate.io/developers/weaviate for details.` - ), - notSupportedClassNamespacedEndpointsForObjects: () => - console.warn( - `Usage of objects paths with className is not supported in Weaviate ${version}. className parameter is ignored` - ), - notSupportedClassNamespacedEndpointsForReferences: () => - console.warn( - `Usage of references paths with className is not supported in Weaviate ${version}. className parameter is ignored` - ), - notSupportedClassNamespacedEndpointsForBeacons: () => - console.warn( - `Usage of beacons paths with className is not supported in Weaviate ${version}. className parameter is ignored` - ), - notSupportedClassParameterInEndpointsForObjects: () => - console.warn( - `Usage of objects paths with class query parameter is not supported in Weaviate ${version}. class query parameter is ignored` - ), - }, - })); - } - // >= 1.14 - supportsClassNameNamespacedEndpoints(version) { - if (typeof version === 'string') { - const versionNumbers = version.split('.'); - if (versionNumbers.length >= 2) { - const major = parseInt(versionNumbers[0], 10); - const minor = parseInt(versionNumbers[1], 10); - return (major == 1 && minor >= 14) || major >= 2; - } - } - return false; - } -} -exports.DbVersionSupport = DbVersionSupport; -const EMPTY_VERSION = ''; -class DbVersionProvider { - constructor(versionStringGetter) { - this.versionStringGetter = versionStringGetter; - this.versionPromise = undefined; - } - getVersionString() { - return this.getVersion().then((version) => version.show()); - } - getVersion() { - if (this.versionPromise) { - return this.versionPromise; - } - return this.versionStringGetter().then((version) => this.cache(version)); - } - refresh(force = false) { - if (force || !this.versionPromise) { - this.versionPromise = undefined; - return this.versionStringGetter() - .then((version) => this.cache(version)) - .then(() => Promise.resolve(true)); - } - return Promise.resolve(false); - } - cache(version) { - if (version === EMPTY_VERSION) { - return Promise.resolve(new DbVersion(0, 0, 0)); - } - this.versionPromise = Promise.resolve(DbVersion.fromString(version)); - return this.versionPromise; - } -} -exports.DbVersionProvider = DbVersionProvider; -function initDbVersionProvider(conn) { - const metaGetter = new metaGetter_js_1.default(conn); - const versionGetter = () => { - return metaGetter.do().then((result) => (result.version ? result.version : '')); - }; - return new DbVersionProvider(versionGetter); -} -exports.initDbVersionProvider = initDbVersionProvider; -class DbVersion { - constructor(major, minor, patch) { - this.checkNumber = (num) => { - if (!Number.isSafeInteger(num)) { - throw new Error(`Invalid number: ${num}`); - } - }; - this.show = () => - this.major === 0 && this.major === this.minor && this.minor === this.patch - ? '' - : `${this.major}.${this.minor}${this.patch !== undefined ? `.${this.patch}` : ''}`; - this.isAtLeast = (major, minor, patch) => { - this.checkNumber(major); - this.checkNumber(minor); - if (this.major > major) return true; - if (this.major < major) return false; - if (this.minor > minor) return true; - if (this.minor < minor) return false; - if (this.patch !== undefined && patch !== undefined && this.patch >= patch) { - this.checkNumber(patch); - return true; - } - return false; - }; - this.isLowerThan = (major, minor, patch) => !this.isAtLeast(major, minor, patch); - this.major = major; - this.minor = minor; - this.patch = patch; - } -} -exports.DbVersion = DbVersion; -DbVersion.fromString = (version) => { - let regex = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/; - let match = version.match(regex); - if (match) { - const [_, major, minor, patch] = match; - return new DbVersion(parseInt(major, 10), parseInt(minor, 10), parseInt(patch, 10)); - } - regex = /^v?(\d+)\.(\d+)$/; - match = version.match(regex); - if (match) { - const [_, major, minor] = match; - return new DbVersion(parseInt(major, 10), parseInt(minor, 10)); - } - throw new Error(`Invalid version string: ${version}`); -}; diff --git a/dist/node/cjs/utils/testData.d.ts b/dist/node/cjs/utils/testData.d.ts deleted file mode 100644 index 7024a4e3..00000000 --- a/dist/node/cjs/utils/testData.d.ts +++ /dev/null @@ -1,354 +0,0 @@ -import { WeaviateClient } from '../v2/index.js'; -export declare const PIZZA_CLASS_NAME = 'Pizza'; -export declare const SOUP_CLASS_NAME = 'Soup'; -export declare function createTestFoodSchema(client: WeaviateClient): Promise< - [ - { - class?: string | undefined; - vectorConfig?: - | { - [key: string]: { - vectorizer?: - | { - [key: string]: unknown; - } - | undefined; - vectorIndexType?: string | undefined; - vectorIndexConfig?: - | { - [key: string]: unknown; - } - | undefined; - }; - } - | undefined; - vectorIndexType?: string | undefined; - vectorIndexConfig?: - | { - [key: string]: unknown; - } - | undefined; - shardingConfig?: - | { - [key: string]: unknown; - } - | undefined; - replicationConfig?: - | { - factor?: number | undefined; - asyncEnabled?: boolean | undefined; - deletionStrategy?: 'NoAutomatedResolution' | 'DeleteOnConflict' | undefined; - } - | undefined; - invertedIndexConfig?: - | { - cleanupIntervalSeconds?: number | undefined; - bm25?: - | { - k1?: number | undefined; - b?: number | undefined; - } - | undefined; - stopwords?: - | { - preset?: string | undefined; - additions?: string[] | undefined; - removals?: string[] | undefined; - } - | undefined; - indexTimestamps?: boolean | undefined; - indexNullState?: boolean | undefined; - indexPropertyLength?: boolean | undefined; - } - | undefined; - multiTenancyConfig?: - | { - enabled?: boolean | undefined; - autoTenantCreation?: boolean | undefined; - autoTenantActivation?: boolean | undefined; - } - | undefined; - vectorizer?: string | undefined; - moduleConfig?: - | { - [key: string]: unknown; - } - | undefined; - description?: string | undefined; - properties?: - | { - dataType?: string[] | undefined; - description?: string | undefined; - moduleConfig?: - | { - [key: string]: unknown; - } - | undefined; - name?: string | undefined; - indexInverted?: boolean | undefined; - indexFilterable?: boolean | undefined; - indexSearchable?: boolean | undefined; - indexRangeFilters?: boolean | undefined; - tokenization?: - | 'word' - | 'lowercase' - | 'whitespace' - | 'field' - | 'trigram' - | 'gse' - | 'kagome_kr' - | undefined; - nestedProperties?: - | { - dataType?: string[] | undefined; - description?: string | undefined; - name?: string | undefined; - indexFilterable?: boolean | undefined; - indexSearchable?: boolean | undefined; - indexRangeFilters?: boolean | undefined; - tokenization?: 'word' | 'lowercase' | 'whitespace' | 'field' | undefined; - nestedProperties?: any[] | undefined; - }[] - | undefined; - }[] - | undefined; - }, - { - class?: string | undefined; - vectorConfig?: - | { - [key: string]: { - vectorizer?: - | { - [key: string]: unknown; - } - | undefined; - vectorIndexType?: string | undefined; - vectorIndexConfig?: - | { - [key: string]: unknown; - } - | undefined; - }; - } - | undefined; - vectorIndexType?: string | undefined; - vectorIndexConfig?: - | { - [key: string]: unknown; - } - | undefined; - shardingConfig?: - | { - [key: string]: unknown; - } - | undefined; - replicationConfig?: - | { - factor?: number | undefined; - asyncEnabled?: boolean | undefined; - deletionStrategy?: 'NoAutomatedResolution' | 'DeleteOnConflict' | undefined; - } - | undefined; - invertedIndexConfig?: - | { - cleanupIntervalSeconds?: number | undefined; - bm25?: - | { - k1?: number | undefined; - b?: number | undefined; - } - | undefined; - stopwords?: - | { - preset?: string | undefined; - additions?: string[] | undefined; - removals?: string[] | undefined; - } - | undefined; - indexTimestamps?: boolean | undefined; - indexNullState?: boolean | undefined; - indexPropertyLength?: boolean | undefined; - } - | undefined; - multiTenancyConfig?: - | { - enabled?: boolean | undefined; - autoTenantCreation?: boolean | undefined; - autoTenantActivation?: boolean | undefined; - } - | undefined; - vectorizer?: string | undefined; - moduleConfig?: - | { - [key: string]: unknown; - } - | undefined; - description?: string | undefined; - properties?: - | { - dataType?: string[] | undefined; - description?: string | undefined; - moduleConfig?: - | { - [key: string]: unknown; - } - | undefined; - name?: string | undefined; - indexInverted?: boolean | undefined; - indexFilterable?: boolean | undefined; - indexSearchable?: boolean | undefined; - indexRangeFilters?: boolean | undefined; - tokenization?: - | 'word' - | 'lowercase' - | 'whitespace' - | 'field' - | 'trigram' - | 'gse' - | 'kagome_kr' - | undefined; - nestedProperties?: - | { - dataType?: string[] | undefined; - description?: string | undefined; - name?: string | undefined; - indexFilterable?: boolean | undefined; - indexSearchable?: boolean | undefined; - indexRangeFilters?: boolean | undefined; - tokenization?: 'word' | 'lowercase' | 'whitespace' | 'field' | undefined; - nestedProperties?: any[] | undefined; - }[] - | undefined; - }[] - | undefined; - } - ] ->; -export declare function createTestFoodData(client: WeaviateClient): Promise< - ({ - class?: string | undefined; - vectorWeights?: - | { - [key: string]: unknown; - } - | undefined; - properties?: - | { - [key: string]: unknown; - } - | undefined; - id?: string | undefined; - creationTimeUnix?: number | undefined; - lastUpdateTimeUnix?: number | undefined; - vector?: number[] | undefined; - vectors?: - | { - [key: string]: number[]; - } - | undefined; - tenant?: string | undefined; - additional?: - | { - [key: string]: { - [key: string]: unknown; - }; - } - | undefined; - } & { - deprecations?: - | { - id?: string | undefined; - status?: string | undefined; - apiType?: string | undefined; - msg?: string | undefined; - mitigation?: string | undefined; - sinceVersion?: string | undefined; - plannedRemovalVersion?: string | undefined; - removedIn?: string | undefined; - removedTime?: string | undefined; - sinceTime?: string | undefined; - locations?: string[] | undefined; - }[] - | undefined; - } & { - result?: - | { - status?: 'SUCCESS' | 'FAILED' | 'PENDING' | undefined; - errors?: - | { - error?: - | { - message?: string | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - })[] ->; -export declare function createTestFoodSchemaAndData(client: WeaviateClient): Promise< - ({ - class?: string | undefined; - vectorWeights?: - | { - [key: string]: unknown; - } - | undefined; - properties?: - | { - [key: string]: unknown; - } - | undefined; - id?: string | undefined; - creationTimeUnix?: number | undefined; - lastUpdateTimeUnix?: number | undefined; - vector?: number[] | undefined; - vectors?: - | { - [key: string]: number[]; - } - | undefined; - tenant?: string | undefined; - additional?: - | { - [key: string]: { - [key: string]: unknown; - }; - } - | undefined; - } & { - deprecations?: - | { - id?: string | undefined; - status?: string | undefined; - apiType?: string | undefined; - msg?: string | undefined; - mitigation?: string | undefined; - sinceVersion?: string | undefined; - plannedRemovalVersion?: string | undefined; - removedIn?: string | undefined; - removedTime?: string | undefined; - sinceTime?: string | undefined; - locations?: string[] | undefined; - }[] - | undefined; - } & { - result?: - | { - status?: 'SUCCESS' | 'FAILED' | 'PENDING' | undefined; - errors?: - | { - error?: - | { - message?: string | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - })[] ->; -export declare function cleanupTestFood(client: WeaviateClient): Promise<[void, void]>; diff --git a/dist/node/cjs/utils/testData.js b/dist/node/cjs/utils/testData.js deleted file mode 100644 index 22187e1e..00000000 --- a/dist/node/cjs/utils/testData.js +++ /dev/null @@ -1,129 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.cleanupTestFood = - exports.createTestFoodSchemaAndData = - exports.createTestFoodData = - exports.createTestFoodSchema = - exports.SOUP_CLASS_NAME = - exports.PIZZA_CLASS_NAME = - void 0; -exports.PIZZA_CLASS_NAME = 'Pizza'; -exports.SOUP_CLASS_NAME = 'Soup'; -const foodProperties = [ - { - name: 'name', - dataType: ['string'], - description: 'name', - tokenization: 'field', - }, - { - name: 'description', - dataType: ['text'], - description: 'description', - tokenization: 'word', - }, - { - name: 'bestBefore', - dataType: ['date'], - description: 'best before', - }, -]; -const pizzaClass = { - class: exports.PIZZA_CLASS_NAME, - description: 'A delicious religion like food and arguably the best export of Italy.', - invertedIndexConfig: { - indexTimestamps: true, - }, - properties: foodProperties, -}; -const soupClass = { - class: exports.SOUP_CLASS_NAME, - description: 'Mostly water based brew of sustenance for humans.', - properties: foodProperties, -}; -const pizzaObjects = [ - { - class: exports.PIZZA_CLASS_NAME, - id: '10523cdd-15a2-42f4-81fa-267fe92f7cd6', - properties: { - name: 'Quattro Formaggi', - description: - "Pizza quattro formaggi Italian: ['kwattro for'maddÊ’i] (four cheese pizza) is a variety of pizza in Italian cuisine that is topped with a combination of four kinds of cheese, usually melted together, with (rossa, red) or without (bianca, white) tomato sauce. It is popular worldwide, including in Italy,[1] and is one of the iconic items from pizzerias's menus.", - bestBefore: '2022-01-02T03:04:05+01:00', - }, - }, - { - class: exports.PIZZA_CLASS_NAME, - id: '927dd3ac-e012-4093-8007-7799cc7e81e4', - properties: { - name: 'Frutti di Mare', - description: - 'Frutti di Mare is an Italian type of pizza that may be served with scampi, mussels or squid. It typically lacks cheese, with the seafood being served atop a tomato sauce.', - bestBefore: '2022-02-03T04:05:06+02:00', - }, - }, - { - class: exports.PIZZA_CLASS_NAME, - id: 'f824a18e-c430-4475-9bef-847673fbb54e', - properties: { - name: 'Hawaii', - description: 'Universally accepted to be the best pizza ever created.', - bestBefore: '2022-03-04T05:06:07+03:00', - }, - }, - { - class: exports.PIZZA_CLASS_NAME, - id: 'd2b393ff-4b26-48c7-b554-218d970a9e17', - properties: { - name: 'Doener', - description: 'A innovation, some say revolution, in the pizza industry.', - bestBefore: '2022-04-05T06:07:08+04:00', - }, - }, -]; -const soupObjects = [ - { - class: exports.SOUP_CLASS_NAME, - id: '8c156d37-81aa-4ce9-a811-621e2702b825', - properties: { - name: 'ChickenSoup', - description: 'Used by humans when their inferior genetics are attacked by microscopic organisms.', - bestBefore: '2022-05-06T07:08:09+05:00', - }, - }, - { - class: exports.SOUP_CLASS_NAME, - id: '27351361-2898-4d1a-aad7-1ca48253eb0b', - properties: { - name: 'Beautiful', - description: 'Putting the game of letter soups to a whole new level.', - bestBefore: '2022-06-07T08:09:10+06:00', - }, - }, -]; -function createTestFoodSchema(client) { - return Promise.all([ - client.schema.classCreator().withClass(pizzaClass).do(), - client.schema.classCreator().withClass(soupClass).do(), - ]); -} -exports.createTestFoodSchema = createTestFoodSchema; -function createTestFoodData(client) { - return client.batch - .objectsBatcher() - .withObjects(...pizzaObjects) - .withObjects(...soupObjects) - .do(); -} -exports.createTestFoodData = createTestFoodData; -function createTestFoodSchemaAndData(client) { - return createTestFoodSchema(client).then(() => createTestFoodData(client)); -} -exports.createTestFoodSchemaAndData = createTestFoodSchemaAndData; -function cleanupTestFood(client) { - return Promise.all([ - client.schema.classDeleter().withClassName(exports.PIZZA_CLASS_NAME).do(), - client.schema.classDeleter().withClassName(exports.SOUP_CLASS_NAME).do(), - ]); -} -exports.cleanupTestFood = cleanupTestFood; diff --git a/dist/node/cjs/utils/uuid.d.ts b/dist/node/cjs/utils/uuid.d.ts deleted file mode 100644 index eeb2e494..00000000 --- a/dist/node/cjs/utils/uuid.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function generateUuid5(identifier: string | number, namespace?: string | number): string; diff --git a/dist/node/cjs/utils/uuid.js b/dist/node/cjs/utils/uuid.js deleted file mode 100644 index 16614e41..00000000 --- a/dist/node/cjs/utils/uuid.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.generateUuid5 = void 0; -const uuid_1 = require('uuid'); -// Generates UUIDv5, used to consistently generate the same UUID for -// a specific identifier and namespace -function generateUuid5(identifier, namespace = '') { - const stringified = identifier.toString() + namespace.toString(); - return (0, uuid_1.v5)(stringified, uuid_1.v5.DNS).toString(); -} -exports.generateUuid5 = generateUuid5; diff --git a/dist/node/cjs/v2/index.d.ts b/dist/node/cjs/v2/index.d.ts deleted file mode 100644 index aa763abe..00000000 --- a/dist/node/cjs/v2/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { Backup } from '../backup/index.js'; -import { Batch } from '../batch/index.js'; -import { C11y } from '../c11y/index.js'; -import { Classifications } from '../classifications/index.js'; -import { Cluster } from '../cluster/index.js'; -import { - ApiKey, - AuthAccessTokenCredentials, - AuthClientCredentials, - AuthUserPasswordCredentials, - OidcAuthenticator, -} from '../connection/auth.js'; -import { InternalConnectionParams as ConnectionParams } from '../connection/index.js'; -import { Data } from '../data/index.js'; -import { GraphQL } from '../graphql/index.js'; -import { Misc } from '../misc/index.js'; -import { Schema } from '../schema/index.js'; -export interface WeaviateClient { - graphql: GraphQL; - schema: Schema; - data: Data; - classifications: Classifications; - batch: Batch; - misc: Misc; - c11y: C11y; - backup: Backup; - cluster: Cluster; - oidcAuth?: OidcAuthenticator; -} -declare const app: { - client: (params: ConnectionParams) => WeaviateClient; - ApiKey: typeof ApiKey; - AuthUserPasswordCredentials: typeof AuthUserPasswordCredentials; - AuthAccessTokenCredentials: typeof AuthAccessTokenCredentials; - AuthClientCredentials: typeof AuthClientCredentials; -}; -export default app; -export * from '../backup/index.js'; -export * from '../batch/index.js'; -export * from '../c11y/index.js'; -export * from '../classifications/index.js'; -export * from '../cluster/index.js'; -export * from '../connection/index.js'; -export * from '../data/index.js'; -export * from '../graphql/index.js'; -export * from '../misc/index.js'; -export * from '../openapi/types.js'; -export * from '../schema/index.js'; -export * from '../utils/base64.js'; -export * from '../utils/uuid.js'; diff --git a/dist/node/cjs/v2/index.js b/dist/node/cjs/v2/index.js deleted file mode 100644 index 32d36d6e..00000000 --- a/dist/node/cjs/v2/index.js +++ /dev/null @@ -1,101 +0,0 @@ -'use strict'; -var __createBinding = - (this && this.__createBinding) || - (Object.create - ? function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { - enumerable: true, - get: function () { - return m[k]; - }, - }; - } - Object.defineProperty(o, k2, desc); - } - : function (o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; - }); -var __exportStar = - (this && this.__exportStar) || - function (m, exports) { - for (var p in m) - if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p)) - __createBinding(exports, m, p); - }; -var __importDefault = - (this && this.__importDefault) || - function (mod) { - return mod && mod.__esModule ? mod : { default: mod }; - }; -Object.defineProperty(exports, '__esModule', { value: true }); -const index_js_1 = __importDefault(require('../backup/index.js')); -const index_js_2 = __importDefault(require('../batch/index.js')); -const index_js_3 = __importDefault(require('../c11y/index.js')); -const index_js_4 = __importDefault(require('../classifications/index.js')); -const index_js_5 = __importDefault(require('../cluster/index.js')); -const auth_js_1 = require('../connection/auth.js'); -const index_js_6 = require('../connection/index.js'); -const index_js_7 = __importDefault(require('../data/index.js')); -const index_js_8 = __importDefault(require('../graphql/index.js')); -const index_js_9 = __importDefault(require('../misc/index.js')); -const metaGetter_js_1 = __importDefault(require('../misc/metaGetter.js')); -const index_js_10 = __importDefault(require('../schema/index.js')); -const dbVersion_js_1 = require('../utils/dbVersion.js'); -const app = { - client: function (params) { - // check if the URL is set - if (!params.host) throw new Error('Missing `host` parameter'); - // check if headers are set - if (!params.headers) params.headers = {}; - const conn = new index_js_6.ConnectionGQL(params); - const dbVersionProvider = initDbVersionProvider(conn); - const dbVersionSupport = new dbVersion_js_1.DbVersionSupport(dbVersionProvider); - const ifc = { - graphql: (0, index_js_8.default)(conn), - schema: (0, index_js_10.default)(conn), - data: (0, index_js_7.default)(conn, dbVersionSupport), - classifications: (0, index_js_4.default)(conn), - batch: (0, index_js_2.default)(conn, dbVersionSupport), - misc: (0, index_js_9.default)(conn, dbVersionProvider), - c11y: (0, index_js_3.default)(conn), - backup: (0, index_js_1.default)(conn), - cluster: (0, index_js_5.default)(conn), - }; - if (conn.oidcAuth) ifc.oidcAuth = conn.oidcAuth; - return ifc; - }, - ApiKey: auth_js_1.ApiKey, - AuthUserPasswordCredentials: auth_js_1.AuthUserPasswordCredentials, - AuthAccessTokenCredentials: auth_js_1.AuthAccessTokenCredentials, - AuthClientCredentials: auth_js_1.AuthClientCredentials, -}; -function initDbVersionProvider(conn) { - const metaGetter = new metaGetter_js_1.default(conn); - const versionGetter = () => { - return metaGetter - .do() - .then((result) => result.version) - .catch(() => Promise.resolve('')); - }; - const dbVersionProvider = new dbVersion_js_1.DbVersionProvider(versionGetter); - dbVersionProvider.refresh(); - return dbVersionProvider; -} -exports.default = app; -__exportStar(require('../backup/index.js'), exports); -__exportStar(require('../batch/index.js'), exports); -__exportStar(require('../c11y/index.js'), exports); -__exportStar(require('../classifications/index.js'), exports); -__exportStar(require('../cluster/index.js'), exports); -__exportStar(require('../connection/index.js'), exports); -__exportStar(require('../data/index.js'), exports); -__exportStar(require('../graphql/index.js'), exports); -__exportStar(require('../misc/index.js'), exports); -__exportStar(require('../openapi/types.js'), exports); -__exportStar(require('../schema/index.js'), exports); -__exportStar(require('../utils/base64.js'), exports); -__exportStar(require('../utils/uuid.js'), exports); diff --git a/dist/node/cjs/validation/commandBase.d.ts b/dist/node/cjs/validation/commandBase.d.ts deleted file mode 100644 index 2c457099..00000000 --- a/dist/node/cjs/validation/commandBase.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import Connection from '../connection/index.js'; -export interface ICommandBase { - /** - * The client's connection - */ - client: Connection; - /** - * An array of validation errors - */ - errors: string[]; - /** - * Execute the command - */ - do: () => Promise; - /** - * Optional method to build the payload of an actual call - */ - payload?: () => any; - /** - * validate that all the required parameters were feed to the builder - */ - validate: () => void; -} -export declare abstract class CommandBase implements ICommandBase { - private _errors; - readonly client: Connection; - protected constructor(client: Connection); - get errors(): string[]; - addError(error: string): void; - addErrors(errors: string[]): void; - abstract do(): Promise; - abstract validate(): void; -} diff --git a/dist/node/cjs/validation/commandBase.js b/dist/node/cjs/validation/commandBase.js deleted file mode 100644 index 3338a3ca..00000000 --- a/dist/node/cjs/validation/commandBase.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.CommandBase = void 0; -class CommandBase { - constructor(client) { - this.client = client; - this._errors = []; - } - get errors() { - return this._errors; - } - addError(error) { - this._errors = [...this.errors, error]; - } - addErrors(errors) { - this._errors = [...this.errors, ...errors]; - } -} -exports.CommandBase = CommandBase; diff --git a/dist/node/cjs/validation/number.d.ts b/dist/node/cjs/validation/number.d.ts deleted file mode 100644 index 0a89171c..00000000 --- a/dist/node/cjs/validation/number.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export declare function isValidIntProperty(input: any): boolean; -export declare function isValidPositiveIntProperty(input: any): boolean; -export declare function isValidNumber(input: any): boolean; -export declare function isValidNumberArray(input: any): boolean; diff --git a/dist/node/cjs/validation/number.js b/dist/node/cjs/validation/number.js deleted file mode 100644 index 48fd8954..00000000 --- a/dist/node/cjs/validation/number.js +++ /dev/null @@ -1,31 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.isValidNumberArray = - exports.isValidNumber = - exports.isValidPositiveIntProperty = - exports.isValidIntProperty = - void 0; -function isValidIntProperty(input) { - return Number.isInteger(input); -} -exports.isValidIntProperty = isValidIntProperty; -function isValidPositiveIntProperty(input) { - return isValidIntProperty(input) && input >= 0; -} -exports.isValidPositiveIntProperty = isValidPositiveIntProperty; -function isValidNumber(input) { - return typeof input == 'number'; -} -exports.isValidNumber = isValidNumber; -function isValidNumberArray(input) { - if (Array.isArray(input)) { - for (const i in input) { - if (!isValidNumber(input[i])) { - return false; - } - } - return true; - } - return false; -} -exports.isValidNumberArray = isValidNumberArray; diff --git a/dist/node/cjs/validation/string.d.ts b/dist/node/cjs/validation/string.d.ts deleted file mode 100644 index b9638ca8..00000000 --- a/dist/node/cjs/validation/string.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function isValidStringProperty(input: any): boolean; -export declare function isValidStringArray(input: any): boolean; diff --git a/dist/node/cjs/validation/string.js b/dist/node/cjs/validation/string.js deleted file mode 100644 index 5a08fc00..00000000 --- a/dist/node/cjs/validation/string.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.isValidStringArray = exports.isValidStringProperty = void 0; -function isValidStringProperty(input) { - return typeof input == 'string' && input.length > 0; -} -exports.isValidStringProperty = isValidStringProperty; -function isValidStringArray(input) { - if (Array.isArray(input)) { - for (const i in input) { - if (!isValidStringProperty(input[i])) { - return false; - } - } - return true; - } - return false; -} -exports.isValidStringArray = isValidStringArray; diff --git a/dist/node/cjs/validation/version.d.ts b/dist/node/cjs/validation/version.d.ts deleted file mode 100644 index c08b161d..00000000 --- a/dist/node/cjs/validation/version.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function isValidWeaviateVersion(version: string): boolean; diff --git a/dist/node/cjs/validation/version.js b/dist/node/cjs/validation/version.js deleted file mode 100644 index 03714de4..00000000 --- a/dist/node/cjs/validation/version.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -exports.isValidWeaviateVersion = void 0; -function isValidWeaviateVersion(version) { - if (typeof version === 'string') { - const versionNumbers = version.split('.'); - if (versionNumbers.length >= 2) { - const major = parseInt(versionNumbers[0], 10); - const minor = parseInt(versionNumbers[1], 10); - return !(major <= 1 && minor < 16); - } - } - return true; -} -exports.isValidWeaviateVersion = isValidWeaviateVersion; diff --git a/dist/node/esm/backup/backupCreateStatusGetter.d.ts b/dist/node/esm/backup/backupCreateStatusGetter.d.ts deleted file mode 100644 index 082023de..00000000 --- a/dist/node/esm/backup/backupCreateStatusGetter.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Connection from '../connection/index.js'; -import { BackupCreateStatusResponse } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { Backend } from './index.js'; -export default class BackupCreateStatusGetter extends CommandBase { - private backend?; - private backupId?; - constructor(client: Connection); - withBackend(backend: Backend): this; - withBackupId(backupId: string): this; - validate: () => void; - do: () => Promise; - private _path; -} diff --git a/dist/node/esm/backup/backupCreateStatusGetter.js b/dist/node/esm/backup/backupCreateStatusGetter.js deleted file mode 100644 index 3a06f968..00000000 --- a/dist/node/esm/backup/backupCreateStatusGetter.js +++ /dev/null @@ -1,29 +0,0 @@ -import { WeaviateInvalidInputError } from '../errors.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { validateBackend, validateBackupId } from './validation.js'; -export default class BackupCreateStatusGetter extends CommandBase { - constructor(client) { - super(client); - this.validate = () => { - this.addErrors([...validateBackend(this.backend), ...validateBackupId(this.backupId)]); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new WeaviateInvalidInputError('invalid usage: ' + this.errors.join(', '))); - } - return this.client.get(this._path()); - }; - this._path = () => { - return `/backups/${this.backend}/${this.backupId}`; - }; - } - withBackend(backend) { - this.backend = backend; - return this; - } - withBackupId(backupId) { - this.backupId = backupId; - return this; - } -} diff --git a/dist/node/esm/backup/backupCreator.d.ts b/dist/node/esm/backup/backupCreator.d.ts deleted file mode 100644 index 54624043..00000000 --- a/dist/node/esm/backup/backupCreator.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import Connection from '../connection/index.js'; -import { - BackupConfig, - BackupCreateRequest, - BackupCreateResponse, - BackupCreateStatusResponse, -} from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import BackupCreateStatusGetter from './backupCreateStatusGetter.js'; -import { Backend } from './index.js'; -export default class BackupCreator extends CommandBase { - private backend; - private backupId; - private excludeClassNames?; - private includeClassNames?; - private statusGetter; - private waitForCompletion; - private config?; - constructor(client: Connection, statusGetter: BackupCreateStatusGetter); - withIncludeClassNames(...classNames: string[]): this; - withExcludeClassNames(...classNames: string[]): this; - withBackend(backend: Backend): this; - withBackupId(backupId: string): this; - withWaitForCompletion(waitForCompletion: boolean): this; - withConfig(cfg: BackupConfig): this; - validate: () => void; - do: () => Promise; - _create: (payload: BackupCreateRequest) => Promise; - _createAndWaitForCompletion: (payload: BackupCreateRequest) => Promise; - private _path; - _merge: ( - createStatusResponse: BackupCreateStatusResponse, - createResponse: BackupCreateResponse - ) => BackupCreateResponse; -} diff --git a/dist/node/esm/backup/backupCreator.js b/dist/node/esm/backup/backupCreator.js deleted file mode 100644 index 7f28f6d9..00000000 --- a/dist/node/esm/backup/backupCreator.js +++ /dev/null @@ -1,121 +0,0 @@ -import { WeaviateInvalidInputError } from '../errors.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { - validateBackend, - validateBackupId, - validateExcludeClassNames, - validateIncludeClassNames, -} from './validation.js'; -const WAIT_INTERVAL = 1000; -export default class BackupCreator extends CommandBase { - constructor(client, statusGetter) { - super(client); - this.validate = () => { - this.addErrors([ - ...validateIncludeClassNames(this.includeClassNames), - ...validateExcludeClassNames(this.excludeClassNames), - ...validateBackend(this.backend), - ...validateBackupId(this.backupId), - ]); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new WeaviateInvalidInputError('invalid usage: ' + this.errors.join(', '))); - } - const payload = { - id: this.backupId, - config: this.config, - include: this.includeClassNames, - exclude: this.excludeClassNames, - }; - if (this.waitForCompletion) { - return this._createAndWaitForCompletion(payload); - } - return this._create(payload); - }; - this._create = (payload) => { - return this.client.postReturn(this._path(), payload); - }; - this._createAndWaitForCompletion = (payload) => { - return new Promise((resolve, reject) => { - this._create(payload) - .then((createResponse) => { - this.statusGetter.withBackend(this.backend).withBackupId(this.backupId); - const loop = () => { - this.statusGetter - .do() - .then((createStatusResponse) => { - if (createStatusResponse.status == 'SUCCESS' || createStatusResponse.status == 'FAILED') { - resolve(this._merge(createStatusResponse, createResponse)); - } else { - setTimeout(loop, WAIT_INTERVAL); - } - }) - .catch(reject); - }; - loop(); - }) - .catch(reject); - }); - }; - this._path = () => { - return `/backups/${this.backend}`; - }; - this._merge = (createStatusResponse, createResponse) => { - const merged = {}; - if ('id' in createStatusResponse) { - merged.id = createStatusResponse.id; - } - if ('path' in createStatusResponse) { - merged.path = createStatusResponse.path; - } - if ('backend' in createStatusResponse) { - merged.backend = createStatusResponse.backend; - } - if ('status' in createStatusResponse) { - merged.status = createStatusResponse.status; - } - if ('error' in createStatusResponse) { - merged.error = createStatusResponse.error; - } - if ('classes' in createResponse) { - merged.classes = createResponse.classes; - } - return merged; - }; - this.statusGetter = statusGetter; - } - withIncludeClassNames(...classNames) { - let cls = classNames; - if (classNames.length && Array.isArray(classNames[0])) { - cls = classNames[0]; - } - this.includeClassNames = cls; - return this; - } - withExcludeClassNames(...classNames) { - let cls = classNames; - if (classNames.length && Array.isArray(classNames[0])) { - cls = classNames[0]; - } - this.excludeClassNames = cls; - return this; - } - withBackend(backend) { - this.backend = backend; - return this; - } - withBackupId(backupId) { - this.backupId = backupId; - return this; - } - withWaitForCompletion(waitForCompletion) { - this.waitForCompletion = waitForCompletion; - return this; - } - withConfig(cfg) { - this.config = cfg; - return this; - } -} diff --git a/dist/node/esm/backup/backupGetter.d.ts b/dist/node/esm/backup/backupGetter.d.ts deleted file mode 100644 index 4da93dce..00000000 --- a/dist/node/esm/backup/backupGetter.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Connection from '../connection/index.js'; -import { BackupCreateResponse } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { Backend } from './index.js'; -export default class BackupGetter extends CommandBase { - private backend?; - constructor(client: Connection); - withBackend(backend: Backend): this; - validate: () => void; - do: () => Promise; - private _path; -} diff --git a/dist/node/esm/backup/backupGetter.js b/dist/node/esm/backup/backupGetter.js deleted file mode 100644 index f28ef26d..00000000 --- a/dist/node/esm/backup/backupGetter.js +++ /dev/null @@ -1,25 +0,0 @@ -import { WeaviateInvalidInputError } from '../errors.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { validateBackend } from './validation.js'; -export default class BackupGetter extends CommandBase { - constructor(client) { - super(client); - this.validate = () => { - this.addErrors(validateBackend(this.backend)); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new WeaviateInvalidInputError('invalid usage: ' + this.errors.join(', '))); - } - return this.client.get(this._path()); - }; - this._path = () => { - return `/backups/${this.backend}`; - }; - } - withBackend(backend) { - this.backend = backend; - return this; - } -} diff --git a/dist/node/esm/backup/backupRestoreStatusGetter.d.ts b/dist/node/esm/backup/backupRestoreStatusGetter.d.ts deleted file mode 100644 index e6c964ab..00000000 --- a/dist/node/esm/backup/backupRestoreStatusGetter.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Connection from '../connection/index.js'; -import { BackupRestoreStatusResponse } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { Backend } from './index.js'; -export default class BackupRestoreStatusGetter extends CommandBase { - private backend?; - private backupId?; - constructor(client: Connection); - withBackend(backend: Backend): this; - withBackupId(backupId: string): this; - validate: () => void; - do: () => Promise; - private _path; -} diff --git a/dist/node/esm/backup/backupRestoreStatusGetter.js b/dist/node/esm/backup/backupRestoreStatusGetter.js deleted file mode 100644 index aea7de82..00000000 --- a/dist/node/esm/backup/backupRestoreStatusGetter.js +++ /dev/null @@ -1,29 +0,0 @@ -import { WeaviateInvalidInputError } from '../errors.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { validateBackend, validateBackupId } from './validation.js'; -export default class BackupRestoreStatusGetter extends CommandBase { - constructor(client) { - super(client); - this.validate = () => { - this.addErrors([...validateBackend(this.backend), ...validateBackupId(this.backupId)]); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new WeaviateInvalidInputError('invalid usage: ' + this.errors.join(', '))); - } - return this.client.get(this._path()); - }; - this._path = () => { - return `/backups/${this.backend}/${this.backupId}/restore`; - }; - } - withBackend(backend) { - this.backend = backend; - return this; - } - withBackupId(backupId) { - this.backupId = backupId; - return this; - } -} diff --git a/dist/node/esm/backup/backupRestorer.d.ts b/dist/node/esm/backup/backupRestorer.d.ts deleted file mode 100644 index 11ef87de..00000000 --- a/dist/node/esm/backup/backupRestorer.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -import Connection from '../connection/index.js'; -import { - BackupRestoreRequest, - BackupRestoreResponse, - BackupRestoreStatusResponse, - RestoreConfig, -} from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import BackupRestoreStatusGetter from './backupRestoreStatusGetter.js'; -import { Backend } from './index.js'; -export default class BackupRestorer extends CommandBase { - private backend; - private backupId; - private excludeClassNames?; - private includeClassNames?; - private statusGetter; - private waitForCompletion?; - private config?; - constructor(client: Connection, statusGetter: BackupRestoreStatusGetter); - withIncludeClassNames(...classNames: string[]): this; - withExcludeClassNames(...classNames: string[]): this; - withBackend(backend: Backend): this; - withBackupId(backupId: string): this; - withWaitForCompletion(waitForCompletion: boolean): this; - withConfig(cfg: RestoreConfig): this; - validate: () => void; - do: () => Promise; - _restore: (payload: BackupRestoreRequest) => Promise; - _restoreAndWaitForCompletion: (payload: BackupRestoreRequest) => Promise; - private _path; - _merge: ( - restoreStatusResponse: BackupRestoreStatusResponse, - restoreResponse: BackupRestoreResponse - ) => BackupRestoreResponse; -} diff --git a/dist/node/esm/backup/backupRestorer.js b/dist/node/esm/backup/backupRestorer.js deleted file mode 100644 index 35092774..00000000 --- a/dist/node/esm/backup/backupRestorer.js +++ /dev/null @@ -1,120 +0,0 @@ -import { WeaviateInvalidInputError } from '../errors.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { - validateBackend, - validateBackupId, - validateExcludeClassNames, - validateIncludeClassNames, -} from './validation.js'; -const WAIT_INTERVAL = 1000; -export default class BackupRestorer extends CommandBase { - constructor(client, statusGetter) { - super(client); - this.validate = () => { - this.addErrors([ - ...validateIncludeClassNames(this.includeClassNames || []), - ...validateExcludeClassNames(this.excludeClassNames || []), - ...validateBackend(this.backend), - ...validateBackupId(this.backupId), - ]); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new WeaviateInvalidInputError('invalid usage: ' + this.errors.join(', '))); - } - const payload = { - config: this.config, - include: this.includeClassNames, - exclude: this.excludeClassNames, - }; - if (this.waitForCompletion) { - return this._restoreAndWaitForCompletion(payload); - } - return this._restore(payload); - }; - this._restore = (payload) => { - return this.client.postReturn(this._path(), payload); - }; - this._restoreAndWaitForCompletion = (payload) => { - return new Promise((resolve, reject) => { - this._restore(payload) - .then((restoreResponse) => { - this.statusGetter.withBackend(this.backend).withBackupId(this.backupId); - const loop = () => { - this.statusGetter - .do() - .then((restoreStatusResponse) => { - if (restoreStatusResponse.status == 'SUCCESS' || restoreStatusResponse.status == 'FAILED') { - resolve(this._merge(restoreStatusResponse, restoreResponse)); - } else { - setTimeout(loop, WAIT_INTERVAL); - } - }) - .catch(reject); - }; - loop(); - }) - .catch(reject); - }); - }; - this._path = () => { - return `/backups/${this.backend}/${this.backupId}/restore`; - }; - this._merge = (restoreStatusResponse, restoreResponse) => { - const merged = {}; - if ('id' in restoreStatusResponse) { - merged.id = restoreStatusResponse.id; - } - if ('path' in restoreStatusResponse) { - merged.path = restoreStatusResponse.path; - } - if ('backend' in restoreStatusResponse) { - merged.backend = restoreStatusResponse.backend; - } - if ('status' in restoreStatusResponse) { - merged.status = restoreStatusResponse.status; - } - if ('error' in restoreStatusResponse) { - merged.error = restoreStatusResponse.error; - } - if ('classes' in restoreResponse) { - merged.classes = restoreResponse.classes; - } - return merged; - }; - this.statusGetter = statusGetter; - } - withIncludeClassNames(...classNames) { - let cls = classNames; - if (classNames.length && Array.isArray(classNames[0])) { - cls = classNames[0]; - } - this.includeClassNames = cls; - return this; - } - withExcludeClassNames(...classNames) { - let cls = classNames; - if (classNames.length && Array.isArray(classNames[0])) { - cls = classNames[0]; - } - this.excludeClassNames = cls; - return this; - } - withBackend(backend) { - this.backend = backend; - return this; - } - withBackupId(backupId) { - this.backupId = backupId; - return this; - } - withWaitForCompletion(waitForCompletion) { - this.waitForCompletion = waitForCompletion; - return this; - } - withConfig(cfg) { - this.config = cfg; - return this; - } -} diff --git a/dist/node/esm/backup/index.d.ts b/dist/node/esm/backup/index.d.ts deleted file mode 100644 index 3715751f..00000000 --- a/dist/node/esm/backup/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import Connection from '../connection/index.js'; -import BackupCreateStatusGetter from './backupCreateStatusGetter.js'; -import BackupCreator from './backupCreator.js'; -import BackupRestoreStatusGetter from './backupRestoreStatusGetter.js'; -import BackupRestorer from './backupRestorer.js'; -export type Backend = 'filesystem' | 's3' | 'gcs' | 'azure'; -export type BackupStatus = 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED'; -export type BackupCompressionLevel = 'DefaultCompression' | 'BestSpeed' | 'BestCompression'; -export interface Backup { - creator: () => BackupCreator; - createStatusGetter: () => BackupCreateStatusGetter; - restorer: () => BackupRestorer; - restoreStatusGetter: () => BackupRestoreStatusGetter; -} -declare const backup: (client: Connection) => Backup; -export default backup; -export { default as BackupCreateStatusGetter } from './backupCreateStatusGetter.js'; -export { default as BackupCreator } from './backupCreator.js'; -export { default as BackupRestoreStatusGetter } from './backupRestoreStatusGetter.js'; -export { default as BackupRestorer } from './backupRestorer.js'; diff --git a/dist/node/esm/backup/index.js b/dist/node/esm/backup/index.js deleted file mode 100644 index 8b6e9081..00000000 --- a/dist/node/esm/backup/index.js +++ /dev/null @@ -1,17 +0,0 @@ -import BackupCreateStatusGetter from './backupCreateStatusGetter.js'; -import BackupCreator from './backupCreator.js'; -import BackupRestoreStatusGetter from './backupRestoreStatusGetter.js'; -import BackupRestorer from './backupRestorer.js'; -const backup = (client) => { - return { - creator: () => new BackupCreator(client, new BackupCreateStatusGetter(client)), - createStatusGetter: () => new BackupCreateStatusGetter(client), - restorer: () => new BackupRestorer(client, new BackupRestoreStatusGetter(client)), - restoreStatusGetter: () => new BackupRestoreStatusGetter(client), - }; -}; -export default backup; -export { default as BackupCreateStatusGetter } from './backupCreateStatusGetter.js'; -export { default as BackupCreator } from './backupCreator.js'; -export { default as BackupRestoreStatusGetter } from './backupRestoreStatusGetter.js'; -export { default as BackupRestorer } from './backupRestorer.js'; diff --git a/dist/node/esm/backup/validation.d.ts b/dist/node/esm/backup/validation.d.ts deleted file mode 100644 index c109b815..00000000 --- a/dist/node/esm/backup/validation.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export declare function validateIncludeClassNames(classNames?: string[]): any[]; -export declare function validateExcludeClassNames(classNames?: string[]): any[]; -export declare function validateBackend(backend?: string): string[]; -export declare function validateBackupId(backupId?: string): string[]; diff --git a/dist/node/esm/backup/validation.js b/dist/node/esm/backup/validation.js deleted file mode 100644 index e09c97f3..00000000 --- a/dist/node/esm/backup/validation.js +++ /dev/null @@ -1,43 +0,0 @@ -import { isValidStringProperty } from '../validation/string.js'; -export function validateIncludeClassNames(classNames) { - if (Array.isArray(classNames)) { - const errors = []; - classNames.forEach((className) => { - if (!isValidStringProperty(className)) { - errors.push('string className invalid - set with .withIncludeClassNames(...classNames)'); - } - }); - return errors; - } - if (classNames !== null && classNames !== undefined) { - return ['strings classNames invalid - set with .withIncludeClassNames(...classNames)']; - } - return []; -} -export function validateExcludeClassNames(classNames) { - if (Array.isArray(classNames)) { - const errors = []; - classNames.forEach((className) => { - if (!isValidStringProperty(className)) { - errors.push('string className invalid - set with .withExcludeClassNames(...classNames)'); - } - }); - return errors; - } - if (classNames !== null && classNames !== undefined) { - return ['strings classNames invalid - set with .withExcludeClassNames(...classNames)']; - } - return []; -} -export function validateBackend(backend) { - if (!isValidStringProperty(backend)) { - return ['string backend must set - set with .withBackend(backend)']; - } - return []; -} -export function validateBackupId(backupId) { - if (!isValidStringProperty(backupId)) { - return ['string backupId must be set - set with .withBackupId(backupId)']; - } - return []; -} diff --git a/dist/node/esm/batch/index.d.ts b/dist/node/esm/batch/index.d.ts deleted file mode 100644 index 8e7e99f9..00000000 --- a/dist/node/esm/batch/index.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import Connection from '../connection/index.js'; -import { DbVersionSupport } from '../utils/dbVersion.js'; -import ObjectsBatchDeleter from './objectsBatchDeleter.js'; -import ObjectsBatcher from './objectsBatcher.js'; -import ReferencePayloadBuilder from './referencePayloadBuilder.js'; -import ReferencesBatcher from './referencesBatcher.js'; -export type DeleteOutput = 'verbose' | 'minimal'; -export type DeleteResultStatus = 'SUCCESS' | 'FAILED' | 'DRYRUN'; -export interface Batch { - objectsBatcher: () => ObjectsBatcher; - objectsBatchDeleter: () => ObjectsBatchDeleter; - referencesBatcher: () => ReferencesBatcher; - referencePayloadBuilder: () => ReferencePayloadBuilder; -} -declare const batch: (client: Connection, dbVersionSupport: DbVersionSupport) => Batch; -export default batch; -export { default as ObjectsBatchDeleter } from './objectsBatchDeleter.js'; -export { default as ObjectsBatcher } from './objectsBatcher.js'; -export { default as ReferencesBatcher } from './referencesBatcher.js'; diff --git a/dist/node/esm/batch/index.js b/dist/node/esm/batch/index.js deleted file mode 100644 index db3faec1..00000000 --- a/dist/node/esm/batch/index.js +++ /dev/null @@ -1,18 +0,0 @@ -import { BeaconPath } from '../utils/beaconPath.js'; -import ObjectsBatchDeleter from './objectsBatchDeleter.js'; -import ObjectsBatcher from './objectsBatcher.js'; -import ReferencePayloadBuilder from './referencePayloadBuilder.js'; -import ReferencesBatcher from './referencesBatcher.js'; -const batch = (client, dbVersionSupport) => { - const beaconPath = new BeaconPath(dbVersionSupport); - return { - objectsBatcher: () => new ObjectsBatcher(client), - objectsBatchDeleter: () => new ObjectsBatchDeleter(client), - referencesBatcher: () => new ReferencesBatcher(client, beaconPath), - referencePayloadBuilder: () => new ReferencePayloadBuilder(client), - }; -}; -export default batch; -export { default as ObjectsBatchDeleter } from './objectsBatchDeleter.js'; -export { default as ObjectsBatcher } from './objectsBatcher.js'; -export { default as ReferencesBatcher } from './referencesBatcher.js'; diff --git a/dist/node/esm/batch/objectsBatchDeleter.d.ts b/dist/node/esm/batch/objectsBatchDeleter.d.ts deleted file mode 100644 index ce2a1e72..00000000 --- a/dist/node/esm/batch/objectsBatchDeleter.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import Connection from '../connection/index.js'; -import { ConsistencyLevel } from '../data/replication.js'; -import { BatchDelete, BatchDeleteResponse, WhereFilter } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { DeleteOutput } from './index.js'; -export default class ObjectsBatchDeleter extends CommandBase { - private className?; - private consistencyLevel?; - private dryRun?; - private output?; - private whereFilter?; - private tenant?; - constructor(client: Connection); - withClassName(className: string): this; - withWhere(whereFilter: WhereFilter): this; - withOutput(output: DeleteOutput): this; - withDryRun(dryRun: boolean): this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withTenant(tenant: string): this; - payload: () => BatchDelete; - validateClassName: () => void; - validateWhereFilter: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/batch/objectsBatchDeleter.js b/dist/node/esm/batch/objectsBatchDeleter.js deleted file mode 100644 index ca57d9ca..00000000 --- a/dist/node/esm/batch/objectsBatchDeleter.js +++ /dev/null @@ -1,71 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { isValidStringProperty } from '../validation/string.js'; -import { buildObjectsPath } from './path.js'; -export default class ObjectsBatchDeleter extends CommandBase { - constructor(client) { - super(client); - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.payload = () => { - return { - match: { - class: this.className, - where: this.whereFilter, - }, - output: this.output, - dryRun: this.dryRun, - }; - }; - this.validateClassName = () => { - if (!isValidStringProperty(this.className)) { - this.addError('string className must be set - set with .withClassName(className)'); - } - }; - this.validateWhereFilter = () => { - if (typeof this.whereFilter != 'object') { - this.addError('object where must be set - set with .withWhere(whereFilter)'); - } - }; - this.validate = () => { - this.validateClassName(); - this.validateWhereFilter(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const params = new URLSearchParams(); - if (this.consistencyLevel) { - params.set('consistency_level', this.consistencyLevel); - } - if (this.tenant) { - params.set('tenant', this.tenant); - } - const path = buildObjectsPath(params); - return this.client.delete(path, this.payload(), true); - }; - } - withClassName(className) { - this.className = className; - return this; - } - withWhere(whereFilter) { - this.whereFilter = whereFilter; - return this; - } - withOutput(output) { - this.output = output; - return this; - } - withDryRun(dryRun) { - this.dryRun = dryRun; - return this; - } - withTenant(tenant) { - this.tenant = tenant; - return this; - } -} diff --git a/dist/node/esm/batch/objectsBatcher.d.ts b/dist/node/esm/batch/objectsBatcher.d.ts deleted file mode 100644 index 8708a6b8..00000000 --- a/dist/node/esm/batch/objectsBatcher.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import Connection from '../connection/index.js'; -import { ConsistencyLevel } from '../data/replication.js'; -import { BatchRequest, WeaviateObject, WeaviateObjectsGet } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ObjectsBatcher extends CommandBase { - private consistencyLevel?; - objects: WeaviateObject[]; - constructor(client: Connection); - /** - * can be called as: - * - withObjects(...[obj1, obj2, obj3]) - * - withObjects(obj1, obj2, obj3) - * - withObjects(obj1) - * @param {...WeaviateObject[]} objects - */ - withObjects(...objects: WeaviateObject[]): this; - withObject(object: WeaviateObject): this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - payload: () => BatchRequest; - validateObjectCount: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/batch/objectsBatcher.js b/dist/node/esm/batch/objectsBatcher.js deleted file mode 100644 index e7a28ca4..00000000 --- a/dist/node/esm/batch/objectsBatcher.js +++ /dev/null @@ -1,53 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { buildObjectsPath } from './path.js'; -export default class ObjectsBatcher extends CommandBase { - constructor(client) { - super(client); - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.payload = () => ({ - objects: this.objects, - }); - this.validateObjectCount = () => { - if (this.objects.length == 0) { - this.addError('need at least one object to send a request, add one with .withObject(obj)'); - } - }; - this.validate = () => { - this.validateObjectCount(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const params = new URLSearchParams(); - if (this.consistencyLevel) { - params.set('consistency_level', this.consistencyLevel); - } - const path = buildObjectsPath(params); - return this.client.postReturn(path, this.payload()); - }; - this.objects = []; - } - /** - * can be called as: - * - withObjects(...[obj1, obj2, obj3]) - * - withObjects(obj1, obj2, obj3) - * - withObjects(obj1) - * @param {...WeaviateObject[]} objects - */ - withObjects(...objects) { - let objs = objects; - if (objects.length && Array.isArray(objects[0])) { - objs = objects[0]; - } - this.objects = [...this.objects, ...objs]; - return this; - } - withObject(object) { - return this.withObjects(object); - } -} diff --git a/dist/node/esm/batch/path.d.ts b/dist/node/esm/batch/path.d.ts deleted file mode 100644 index 86f18cf7..00000000 --- a/dist/node/esm/batch/path.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function buildObjectsPath(queryParams: any): string; -export declare function buildRefsPath(queryParams: any): string; diff --git a/dist/node/esm/batch/path.js b/dist/node/esm/batch/path.js deleted file mode 100644 index dafd6987..00000000 --- a/dist/node/esm/batch/path.js +++ /dev/null @@ -1,14 +0,0 @@ -export function buildObjectsPath(queryParams) { - const path = '/batch/objects'; - return buildPath(path, queryParams); -} -export function buildRefsPath(queryParams) { - const path = '/batch/references'; - return buildPath(path, queryParams); -} -function buildPath(path, queryParams) { - if (queryParams && queryParams.toString() != '') { - path = `${path}?${queryParams.toString()}`; - } - return path; -} diff --git a/dist/node/esm/batch/referencePayloadBuilder.d.ts b/dist/node/esm/batch/referencePayloadBuilder.d.ts deleted file mode 100644 index 5bd7f5a7..00000000 --- a/dist/node/esm/batch/referencePayloadBuilder.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import Connection from '../connection/index.js'; -import { BatchReference } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ReferencesBatcher extends CommandBase { - private fromClassName?; - private fromId?; - private fromRefProp?; - private toClassName?; - private toId?; - constructor(client: Connection); - withFromId: (id: string) => this; - withToId: (id: string) => this; - withFromClassName: (className: string) => this; - withFromRefProp: (refProp: string) => this; - withToClassName(className: string): this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - payload: () => BatchReference; - do: () => Promise; -} diff --git a/dist/node/esm/batch/referencePayloadBuilder.js b/dist/node/esm/batch/referencePayloadBuilder.js deleted file mode 100644 index 58c0ba93..00000000 --- a/dist/node/esm/batch/referencePayloadBuilder.js +++ /dev/null @@ -1,55 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { isValidStringProperty } from '../validation/string.js'; -export default class ReferencesBatcher extends CommandBase { - constructor(client) { - super(client); - this.withFromId = (id) => { - this.fromId = id; - return this; - }; - this.withToId = (id) => { - this.toId = id; - return this; - }; - this.withFromClassName = (className) => { - this.fromClassName = className; - return this; - }; - this.withFromRefProp = (refProp) => { - this.fromRefProp = refProp; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.fromId, 'fromId', '.withFromId(id)'); - this.validateIsSet(this.toId, 'toId', '.withToId(id)'); - this.validateIsSet(this.fromClassName, 'fromClassName', '.withFromClassName(className)'); - this.validateIsSet(this.fromRefProp, 'fromRefProp', '.withFromRefProp(refProp)'); - }; - this.payload = () => { - this.validate(); - if (this.errors.length > 0) { - throw new Error(this.errors.join(', ')); - } - let beaconTo = `weaviate://localhost`; - if (isValidStringProperty(this.toClassName)) { - beaconTo = `${beaconTo}/${this.toClassName}`; - } - return { - from: `weaviate://localhost/${this.fromClassName}/${this.fromId}/${this.fromRefProp}`, - to: `${beaconTo}/${this.toId}`, - }; - }; - this.do = () => { - return Promise.reject(new Error('Should never be called')); - }; - } - withToClassName(className) { - this.toClassName = className; - return this; - } -} diff --git a/dist/node/esm/batch/referencesBatcher.d.ts b/dist/node/esm/batch/referencesBatcher.d.ts deleted file mode 100644 index 1a3360b0..00000000 --- a/dist/node/esm/batch/referencesBatcher.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import Connection from '../connection/index.js'; -import { ConsistencyLevel } from '../data/replication.js'; -import { BatchReference, BatchReferenceResponse } from '../openapi/types.js'; -import { BeaconPath } from '../utils/beaconPath.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ReferencesBatcher extends CommandBase { - private beaconPath; - private consistencyLevel?; - references: BatchReference[]; - constructor(client: Connection, beaconPath: BeaconPath); - /** - * can be called as: - * - withReferences(...[ref1, ref2, ref3]) - * - withReferences(ref1, ref2, ref3) - * - withReferences(ref1) - * @param {...BatchReference[]} references - */ - withReferences(...references: BatchReference[]): this; - withReference(reference: BatchReference): this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - payload: () => BatchReference[]; - validateReferenceCount: () => void; - validate: () => void; - do: () => Promise; - rebuildReferencePromise: (reference: BatchReference) => Promise; -} diff --git a/dist/node/esm/batch/referencesBatcher.js b/dist/node/esm/batch/referencesBatcher.js deleted file mode 100644 index 63efd646..00000000 --- a/dist/node/esm/batch/referencesBatcher.js +++ /dev/null @@ -1,61 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { buildRefsPath } from './path.js'; -export default class ReferencesBatcher extends CommandBase { - constructor(client, beaconPath) { - super(client); - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.payload = () => this.references; - this.validateReferenceCount = () => { - if (this.references.length == 0) { - this.addError('need at least one reference to send a request, add one with .withReference(obj)'); - } - }; - this.validate = () => { - this.validateReferenceCount(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const params = new URLSearchParams(); - if (this.consistencyLevel) { - params.set('consistency_level', this.consistencyLevel); - } - const path = buildRefsPath(params); - const payloadPromise = Promise.all(this.references.map((ref) => this.rebuildReferencePromise(ref))); - return payloadPromise.then((payload) => this.client.postReturn(path, payload)); - }; - this.rebuildReferencePromise = (reference) => { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return this.beaconPath.rebuild(reference.to).then((beaconTo) => ({ - from: reference.from, - to: beaconTo, - tenant: reference.tenant, - })); - }; - this.beaconPath = beaconPath; - this.references = []; - } - /** - * can be called as: - * - withReferences(...[ref1, ref2, ref3]) - * - withReferences(ref1, ref2, ref3) - * - withReferences(ref1) - * @param {...BatchReference[]} references - */ - withReferences(...references) { - let refs = references; - if (references.length && Array.isArray(references[0])) { - refs = references[0]; - } - this.references = [...this.references, ...refs]; - return this; - } - withReference(reference) { - return this.withReferences(reference); - } -} diff --git a/dist/node/esm/c11y/conceptsGetter.d.ts b/dist/node/esm/c11y/conceptsGetter.d.ts deleted file mode 100644 index 5dee9a06..00000000 --- a/dist/node/esm/c11y/conceptsGetter.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Connection from '../connection/index.js'; -import { C11yWordsResponse } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ConceptsGetter extends CommandBase { - private concept?; - constructor(client: Connection); - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - withConcept: (concept: string) => this; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/c11y/conceptsGetter.js b/dist/node/esm/c11y/conceptsGetter.js deleted file mode 100644 index 0c0271af..00000000 --- a/dist/node/esm/c11y/conceptsGetter.js +++ /dev/null @@ -1,26 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class ConceptsGetter extends CommandBase { - constructor(client) { - super(client); - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.withConcept = (concept) => { - this.concept = concept; - return this; - }; - this.validate = () => { - this.validateIsSet(this.concept, 'concept', 'withConcept(concept)'); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/modules/text2vec-contextionary/concepts/${this.concept}`; - return this.client.get(path); - }; - } -} diff --git a/dist/node/esm/c11y/extensionCreator.d.ts b/dist/node/esm/c11y/extensionCreator.d.ts deleted file mode 100644 index 1e50f5f5..00000000 --- a/dist/node/esm/c11y/extensionCreator.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import Connection from '../connection/index.js'; -import { C11yExtension } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ExtensionCreator extends CommandBase { - private concept?; - private definition?; - private weight?; - constructor(client: Connection); - withConcept: (concept: string) => this; - withDefinition: (definition: string) => this; - withWeight: (weight: number) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - payload: () => C11yExtension; - do: () => Promise; -} diff --git a/dist/node/esm/c11y/extensionCreator.js b/dist/node/esm/c11y/extensionCreator.js deleted file mode 100644 index 07e4994f..00000000 --- a/dist/node/esm/c11y/extensionCreator.js +++ /dev/null @@ -1,46 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class ExtensionCreator extends CommandBase { - constructor(client) { - super(client); - this.withConcept = (concept) => { - this.concept = concept; - return this; - }; - this.withDefinition = (definition) => { - this.definition = definition; - return this; - }; - this.withWeight = (weight) => { - this.weight = weight; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - var _a; - this.validateIsSet(this.concept, 'concept', 'withConcept(concept)'); - this.validateIsSet(this.definition, 'definition', 'withDefinition(definition)'); - this.validateIsSet( - ((_a = this.weight) === null || _a === void 0 ? void 0 : _a.toString()) || '', - 'weight', - 'withWeight(weight)' - ); - }; - this.payload = () => ({ - concept: this.concept, - definition: this.definition, - weight: this.weight, - }); - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/modules/text2vec-contextionary/extensions`; - return this.client.postReturn(path, this.payload()); - }; - } -} diff --git a/dist/node/esm/c11y/index.d.ts b/dist/node/esm/c11y/index.d.ts deleted file mode 100644 index 227b5e0f..00000000 --- a/dist/node/esm/c11y/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Connection from '../connection/index.js'; -import ConceptsGetter from './conceptsGetter.js'; -import ExtensionCreator from './extensionCreator.js'; -export interface C11y { - conceptsGetter: () => ConceptsGetter; - extensionCreator: () => ExtensionCreator; -} -declare const c11y: (client: Connection) => C11y; -export default c11y; -export { default as ConceptsGetter } from './conceptsGetter.js'; -export { default as ExtensionCreator } from './extensionCreator.js'; diff --git a/dist/node/esm/c11y/index.js b/dist/node/esm/c11y/index.js deleted file mode 100644 index 475e3c18..00000000 --- a/dist/node/esm/c11y/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import ConceptsGetter from './conceptsGetter.js'; -import ExtensionCreator from './extensionCreator.js'; -const c11y = (client) => { - return { - conceptsGetter: () => new ConceptsGetter(client), - extensionCreator: () => new ExtensionCreator(client), - }; -}; -export default c11y; -export { default as ConceptsGetter } from './conceptsGetter.js'; -export { default as ExtensionCreator } from './extensionCreator.js'; diff --git a/dist/node/esm/classifications/getter.d.ts b/dist/node/esm/classifications/getter.d.ts deleted file mode 100644 index 02aa3487..00000000 --- a/dist/node/esm/classifications/getter.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Connection from '../connection/index.js'; -import { Classification } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassificationsGetter extends CommandBase { - private id?; - constructor(client: Connection); - withId: (id: string) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validateId: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/classifications/getter.js b/dist/node/esm/classifications/getter.js deleted file mode 100644 index 60287872..00000000 --- a/dist/node/esm/classifications/getter.js +++ /dev/null @@ -1,29 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassificationsGetter extends CommandBase { - constructor(client) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validateId = () => { - this.validateIsSet(this.id, 'id', '.withId(id)'); - }; - this.validate = () => { - this.validateId(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/classifications/${this.id}`; - return this.client.get(path); - }; - } -} diff --git a/dist/node/esm/classifications/index.d.ts b/dist/node/esm/classifications/index.d.ts deleted file mode 100644 index 65606ff8..00000000 --- a/dist/node/esm/classifications/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Connection from '../connection/index.js'; -import ClassificationsGetter from './getter.js'; -import ClassificationsScheduler from './scheduler.js'; -export interface Classifications { - scheduler: () => ClassificationsScheduler; - getter: () => ClassificationsGetter; -} -declare const data: (client: Connection) => Classifications; -export default data; -export { default as ClassificationsGetter } from './getter.js'; -export { default as ClassificationsScheduler } from './scheduler.js'; diff --git a/dist/node/esm/classifications/index.js b/dist/node/esm/classifications/index.js deleted file mode 100644 index 9f5db48a..00000000 --- a/dist/node/esm/classifications/index.js +++ /dev/null @@ -1,11 +0,0 @@ -import ClassificationsGetter from './getter.js'; -import ClassificationsScheduler from './scheduler.js'; -const data = (client) => { - return { - scheduler: () => new ClassificationsScheduler(client), - getter: () => new ClassificationsGetter(client), - }; -}; -export default data; -export { default as ClassificationsGetter } from './getter.js'; -export { default as ClassificationsScheduler } from './scheduler.js'; diff --git a/dist/node/esm/classifications/scheduler.d.ts b/dist/node/esm/classifications/scheduler.d.ts deleted file mode 100644 index 3538ceef..00000000 --- a/dist/node/esm/classifications/scheduler.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import Connection from '../connection/index.js'; -import { Classification } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassificationsScheduler extends CommandBase { - private basedOnProperties?; - private classifyProperties?; - private className?; - private settings?; - private type?; - private waitForCompletion; - private waitTimeout; - constructor(client: Connection); - withType: (type: string) => this; - withSettings: (settings: any) => this; - withClassName: (className: string) => this; - withClassifyProperties: (props: string[]) => this; - withBasedOnProperties: (props: string[]) => this; - withWaitForCompletion: () => this; - withWaitTimeout: (timeout: number) => this; - validateIsSet: (prop: string | undefined | null | any[], name: string, setter: string) => void; - validateClassName: () => void; - validateBasedOnProperties: () => void; - validateClassifyProperties: () => void; - validate: () => void; - payload: () => Classification; - pollForCompletion: (id: any) => Promise; - do: () => Promise; -} diff --git a/dist/node/esm/classifications/scheduler.js b/dist/node/esm/classifications/scheduler.js deleted file mode 100644 index c29dacb6..00000000 --- a/dist/node/esm/classifications/scheduler.js +++ /dev/null @@ -1,110 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import ClassificationsGetter from './getter.js'; -export default class ClassificationsScheduler extends CommandBase { - constructor(client) { - super(client); - this.withType = (type) => { - this.type = type; - return this; - }; - this.withSettings = (settings) => { - this.settings = settings; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withClassifyProperties = (props) => { - this.classifyProperties = props; - return this; - }; - this.withBasedOnProperties = (props) => { - this.basedOnProperties = props; - return this; - }; - this.withWaitForCompletion = () => { - this.waitForCompletion = true; - return this; - }; - this.withWaitTimeout = (timeout) => { - this.waitTimeout = timeout; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validateClassName = () => { - this.validateIsSet(this.className, 'className', '.withClassName(className)'); - }; - this.validateBasedOnProperties = () => { - this.validateIsSet( - this.basedOnProperties, - 'basedOnProperties', - '.withBasedOnProperties(basedOnProperties)' - ); - }; - this.validateClassifyProperties = () => { - this.validateIsSet( - this.classifyProperties, - 'classifyProperties', - '.withClassifyProperties(classifyProperties)' - ); - }; - this.validate = () => { - this.validateClassName(); - this.validateClassifyProperties(); - this.validateBasedOnProperties(); - }; - this.payload = () => ({ - type: this.type, - settings: this.settings, - class: this.className, - classifyProperties: this.classifyProperties, - basedOnProperties: this.basedOnProperties, - }); - this.pollForCompletion = (id) => { - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => { - clearInterval(interval); - clearTimeout(timeout); - reject( - new Error( - "classification didn't finish within configured timeout, " + - 'set larger timeout with .withWaitTimeout(timeout)' - ) - ); - }, this.waitTimeout); - const interval = setInterval(() => { - new ClassificationsGetter(this.client) - .withId(id) - .do() - .then((res) => { - if (res.status === 'completed') { - clearInterval(interval); - clearTimeout(timeout); - resolve(res); - } - }); - }, 500); - }); - }; - this.do = () => { - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - this.validate(); - const path = `/classifications`; - return this.client.postReturn(path, this.payload()).then((res) => { - if (!this.waitForCompletion) { - return Promise.resolve(res); - } - return this.pollForCompletion(res.id); - }); - }; - this.waitTimeout = 10 * 60 * 1000; // 10 minutes - this.waitForCompletion = false; - } -} diff --git a/dist/node/esm/cluster/index.d.ts b/dist/node/esm/cluster/index.d.ts deleted file mode 100644 index 7889c36c..00000000 --- a/dist/node/esm/cluster/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Connection from '../connection/index.js'; -import NodesStatusGetter from './nodesStatusGetter.js'; -export type NodeStatus = 'HEALTHY' | 'UNHEALTHY' | 'UNAVAILABLE'; -export interface Cluster { - nodesStatusGetter: () => NodesStatusGetter; -} -declare const cluster: (client: Connection) => Cluster; -export default cluster; -export { default as NodesStatusGetter } from './nodesStatusGetter.js'; diff --git a/dist/node/esm/cluster/index.js b/dist/node/esm/cluster/index.js deleted file mode 100644 index df86907f..00000000 --- a/dist/node/esm/cluster/index.js +++ /dev/null @@ -1,8 +0,0 @@ -import NodesStatusGetter from './nodesStatusGetter.js'; -const cluster = (client) => { - return { - nodesStatusGetter: () => new NodesStatusGetter(client), - }; -}; -export default cluster; -export { default as NodesStatusGetter } from './nodesStatusGetter.js'; diff --git a/dist/node/esm/cluster/nodesStatusGetter.d.ts b/dist/node/esm/cluster/nodesStatusGetter.d.ts deleted file mode 100644 index ce425d2e..00000000 --- a/dist/node/esm/cluster/nodesStatusGetter.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Connection from '../connection/index.js'; -import { NodesStatusResponse } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class NodesStatusGetter extends CommandBase { - private className?; - private output?; - constructor(client: Connection); - withClassName: (className: string) => this; - withOutput: (output: 'minimal' | 'verbose') => this; - validate(): void; - do: () => Promise; -} diff --git a/dist/node/esm/cluster/nodesStatusGetter.js b/dist/node/esm/cluster/nodesStatusGetter.js deleted file mode 100644 index b5873916..00000000 --- a/dist/node/esm/cluster/nodesStatusGetter.js +++ /dev/null @@ -1,29 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class NodesStatusGetter extends CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withOutput = (output) => { - this.output = output; - return this; - }; - this.do = () => { - let path = '/nodes'; - if (this.className) { - path = `${path}/${this.className}`; - } - if (this.output) { - path = `${path}?output=${this.output}`; - } else { - path = `${path}?output=verbose`; - } - return this.client.get(path); - }; - } - validate() { - // nothing to validate - } -} diff --git a/dist/node/esm/collections/aggregate/index.d.ts b/dist/node/esm/collections/aggregate/index.d.ts deleted file mode 100644 index 0dbe9a08..00000000 --- a/dist/node/esm/collections/aggregate/index.d.ts +++ /dev/null @@ -1,409 +0,0 @@ -/// -import Connection from '../../connection/index.js'; -import { ConsistencyLevel } from '../../data/index.js'; -import { Aggregator } from '../../graphql/index.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { FilterValue } from '../filters/index.js'; -export type AggregateBaseOptions = { - filters?: FilterValue; - returnMetrics?: M; -}; -export type AggregateGroupByOptions = AggregateOptions & { - groupBy: (keyof T & string) | GroupByAggregate; -}; -export type GroupByAggregate = { - property: keyof T & string; - limit?: number; -}; -export type AggregateOptions = AggregateBaseOptions; -export type AggregateBaseOverAllOptions = AggregateBaseOptions; -export type AggregateNearOptions = AggregateBaseOptions & { - certainty?: number; - distance?: number; - objectLimit?: number; - targetVector?: string; -}; -export type AggregateGroupByNearOptions = AggregateNearOptions & { - groupBy: (keyof T & string) | GroupByAggregate; -}; -export type AggregateBoolean = { - count?: number; - percentageFalse?: number; - percentageTrue?: number; - totalFalse?: number; - totalTrue?: number; -}; -export type AggregateDate = { - count?: number; - maximum?: number; - median?: number; - minimum?: number; - mode?: number; -}; -export type AggregateNumber = { - count?: number; - maximum?: number; - mean?: number; - median?: number; - minimum?: number; - mode?: number; - sum?: number; -}; -export type AggregateReference = { - pointingTo?: string; -}; -export type AggregateText = { - count?: number; - topOccurrences?: { - occurs?: number; - value?: number; - }[]; -}; -export type MetricsInput = - | MetricsBoolean - | MetricsInteger - | MetricsNumber - | MetricsText - | MetricsDate; -export type PropertiesMetrics = T extends undefined - ? MetricsInput | MetricsInput[] - : MetricsInput | MetricsInput[]; -export type MetricsBase = { - kind: K; - propertyName: N; -}; -export type Option = { - [key in keyof A]: boolean; -}; -export type BooleanKeys = 'count' | 'percentageFalse' | 'percentageTrue' | 'totalFalse' | 'totalTrue'; -export type DateKeys = 'count' | 'maximum' | 'median' | 'minimum' | 'mode'; -export type NumberKeys = 'count' | 'maximum' | 'mean' | 'median' | 'minimum' | 'mode' | 'sum'; -export type MetricsBoolean = MetricsBase & - Partial<{ - [key in BooleanKeys]: boolean; - }>; -export type MetricsDate = MetricsBase & - Partial<{ - [key in DateKeys]: boolean; - }>; -export type MetricsInteger = MetricsBase & - Partial<{ - [key in NumberKeys]: boolean; - }>; -export type MetricsNumber = MetricsBase & - Partial<{ - [key in NumberKeys]: boolean; - }>; -export type MetricsText = MetricsBase & { - count?: boolean; - topOccurrences?: { - occurs?: boolean; - value?: boolean; - }; - minOccurrences?: number; -}; -export type AggregateMetrics = { - [K in keyof M]: M[K] extends true ? number : never; -}; -export type MetricsProperty = T extends undefined ? string : keyof T & string; -export declare const metrics: () => { - aggregate:

>(property: P) => MetricsManager; -}; -export interface Metrics { - /** - * Define the metrics to be returned based on a property when aggregating over a collection. - - Use this `aggregate` method to define the name to the property to be aggregated on. - Then use the `text`, `integer`, `number`, `boolean`, `date_`, or `reference` methods to define the metrics to be returned. - - See [the docs](https://weaviate.io/developers/weaviate/search/aggregate) for more details! - */ - aggregate:

>(property: P) => MetricsManager; -} -export declare class MetricsManager> { - private propertyName; - constructor(property: P); - private map; - /** - * Define the metrics to be returned for a BOOL or BOOL_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'percentageFalse' | 'percentageTrue' | 'totalFalse' | 'totalTrue')[]} metrics The metrics to return. - * @returns {MetricsBoolean

} The metrics for the property. - */ - boolean( - metrics?: ('count' | 'percentageFalse' | 'percentageTrue' | 'totalFalse' | 'totalTrue')[] - ): MetricsBoolean

; - /** - * Define the metrics to be returned for a DATE or DATE_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'maximum' | 'median' | 'minimum' | 'mode')[]} metrics The metrics to return. - * @returns {MetricsDate

} The metrics for the property. - */ - date(metrics?: ('count' | 'maximum' | 'median' | 'minimum' | 'mode')[]): MetricsDate

; - /** - * Define the metrics to be returned for an INT or INT_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'maximum' | 'mean' | 'median' | 'minimum' | 'mode' | 'sum')[]} metrics The metrics to return. - * @returns {MetricsInteger

} The metrics for the property. - */ - integer( - metrics?: ('count' | 'maximum' | 'mean' | 'median' | 'minimum' | 'mode' | 'sum')[] - ): MetricsInteger

; - /** - * Define the metrics to be returned for a NUMBER or NUMBER_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'maximum' | 'mean' | 'median' | 'minimum' | 'mode' | 'sum')[]} metrics The metrics to return. - * @returns {MetricsNumber

} The metrics for the property. - */ - number( - metrics?: ('count' | 'maximum' | 'mean' | 'median' | 'minimum' | 'mode' | 'sum')[] - ): MetricsNumber

; - /** - * Define the metrics to be returned for a TEXT or TEXT_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'topOccurrencesOccurs' | 'topOccurrencesValue')[]} metrics The metrics to return. - * @param {number} [minOccurrences] The how many top occurrences to return. - * @returns {MetricsText

} The metrics for the property. - */ - text( - metrics?: ('count' | 'topOccurrencesOccurs' | 'topOccurrencesValue')[], - minOccurrences?: number - ): MetricsText

; -} -type KindToAggregateType = K extends 'text' - ? AggregateText - : K extends 'date' - ? AggregateDate - : K extends 'integer' - ? AggregateNumber - : K extends 'number' - ? AggregateNumber - : K extends 'boolean' - ? AggregateBoolean - : K extends 'reference' - ? AggregateReference - : never; -export type AggregateType = AggregateBoolean | AggregateDate | AggregateNumber | AggregateText; -export type AggregateResult | undefined = undefined> = { - properties: T extends undefined - ? Record - : M extends MetricsInput[] - ? { - [K in M[number] as K['propertyName']]: KindToAggregateType; - } - : M extends MetricsInput - ? { - [K in M as K['propertyName']]: KindToAggregateType; - } - : undefined; - totalCount: number; -}; -export type AggregateGroupByResult< - T, - M extends PropertiesMetrics | undefined = undefined -> = AggregateResult & { - groupedBy: { - prop: string; - value: string; - }; -}; -declare class AggregateManager implements Aggregate { - connection: Connection; - groupBy: AggregateGroupBy; - name: string; - dbVersionSupport: DbVersionSupport; - consistencyLevel?: ConsistencyLevel; - tenant?: string; - private constructor(); - query(): Aggregator; - base( - metrics?: PropertiesMetrics, - filters?: FilterValue, - groupBy?: (keyof T & string) | GroupByAggregate - ): Aggregator; - metrics(metrics: MetricsInput<(keyof T & string) | string>): string; - static use( - connection: Connection, - name: string, - dbVersionSupport: DbVersionSupport, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ): AggregateManager; - nearImage>( - image: string | Buffer, - opts?: AggregateNearOptions - ): Promise>; - nearObject>( - id: string, - opts?: AggregateNearOptions - ): Promise>; - nearText>( - query: string | string[], - opts?: AggregateNearOptions - ): Promise>; - nearVector>( - vector: number[], - opts?: AggregateNearOptions - ): Promise>; - overAll>(opts?: AggregateOptions): Promise>; - do: | undefined = undefined>( - query: Aggregator - ) => Promise>; - doGroupBy: | undefined = undefined>( - query: Aggregator - ) => Promise[]>; -} -export interface Aggregate { - /** This namespace contains methods perform a group by search while aggregating metrics. */ - groupBy: AggregateGroupBy; - /** - * Aggregate metrics over the objects returned by a near image vector search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires a vectorizer capable of handling base64-encoded images, e.g. `img2vec-neural`, `multi2vec-clip`, and `multi2vec-bind`. - * - * @param {string | Buffer} image The image to search on. This can be a base64 string, a file path string, or a buffer. - * @param {AggregateNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearImage>( - image: string | Buffer, - opts?: AggregateNearOptions - ): Promise>; - /** - * Aggregate metrics over the objects returned by a near object search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires that the objects in the collection have associated vectors. - * - * @param {string} id The ID of the object to search for. - * @param {AggregateNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearObject>( - id: string, - opts?: AggregateNearOptions - ): Promise>; - /** - * Aggregate metrics over the objects returned by a near vector search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires that the objects in the collection have associated vectors. - * - * @param {number[]} query The text query to search for. - * @param {AggregateNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearText>( - query: string | string[], - opts?: AggregateNearOptions - ): Promise>; - /** - * Aggregate metrics over the objects returned by a near vector search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires that the objects in the collection have associated vectors. - * - * @param {number[]} vector The vector to search for. - * @param {AggregateNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearVector>( - vector: number[], - opts?: AggregateNearOptions - ): Promise>; - /** - * Aggregate metrics over all the objects in this collection without any vector search. - * - * @param {AggregateOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects in the collection. - */ - overAll>(opts?: AggregateOptions): Promise>; -} -export interface AggregateGroupBy { - /** - * Aggregate metrics over the objects returned by a near image vector search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires a vectorizer capable of handling base64-encoded images, e.g. `img2vec-neural`, `multi2vec-clip`, and `multi2vec-bind`. - * - * @param {string | Buffer} image The image to search on. This can be a base64 string, a file path string, or a buffer. - * @param {AggregateGroupByNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearImage>( - image: string | Buffer, - opts?: AggregateGroupByNearOptions - ): Promise[]>; - /** - * Aggregate metrics over the objects returned by a near object search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires that the objects in the collection have associated vectors. - * - * @param {string} id The ID of the object to search for. - * @param {AggregateGroupByNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearObject>( - id: string, - opts?: AggregateGroupByNearOptions - ): Promise[]>; - /** - * Aggregate metrics over the objects returned by a near text vector search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires a vectorizer capable of handling text, e.g. `text2vec-contextionary`, `text2vec-openai`, etc. - * - * @param {string | string[]} query The text to search for. - * @param {AggregateGroupByNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearText>( - query: string | string[], - opts: AggregateGroupByNearOptions - ): Promise[]>; - /** - * Aggregate metrics over the objects returned by a near vector search on this collection. - * - * At least one of `certainty`, `distance`, or `object_limit` must be specified here for the vector search. - * - * This method requires that the objects in the collection have associated vectors. - * - * @param {number[]} vector The vector to search for. - * @param {AggregateGroupByNearOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects returned by the vector search. - */ - nearVector>( - vector: number[], - opts?: AggregateGroupByNearOptions - ): Promise[]>; - /** - * Aggregate metrics over all the objects in this collection without any vector search. - * - * @param {AggregateGroupByOptions} [opts] The options for the request. - * @returns {Promise[]>} The aggregated metrics for the objects in the collection. - */ - overAll>( - opts?: AggregateGroupByOptions - ): Promise[]>; -} -declare const _default: typeof AggregateManager.use; -export default _default; diff --git a/dist/node/esm/collections/aggregate/index.js b/dist/node/esm/collections/aggregate/index.js deleted file mode 100644 index 7d69dc77..00000000 --- a/dist/node/esm/collections/aggregate/index.js +++ /dev/null @@ -1,435 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -var __rest = - (this && this.__rest) || - function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === 'function') - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; - }; -import { WeaviateQueryError } from '../../errors.js'; -import { Aggregator } from '../../graphql/index.js'; -import { toBase64FromMedia } from '../../index.js'; -import { Serialize } from '../serialize/index.js'; -export const metrics = () => { - return { - aggregate: (property) => new MetricsManager(property), - }; -}; -export class MetricsManager { - constructor(property) { - this.propertyName = property; - } - map(metrics) { - const out = {}; - metrics.forEach((metric) => { - out[metric] = true; - }); - return out; - } - /** - * Define the metrics to be returned for a BOOL or BOOL_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'percentageFalse' | 'percentageTrue' | 'totalFalse' | 'totalTrue')[]} metrics The metrics to return. - * @returns {MetricsBoolean

} The metrics for the property. - */ - boolean(metrics) { - if (metrics === undefined || metrics.length === 0) { - metrics = ['count', 'percentageFalse', 'percentageTrue', 'totalFalse', 'totalTrue']; - } - return Object.assign(Object.assign({}, this.map(metrics)), { - kind: 'boolean', - propertyName: this.propertyName, - }); - } - /** - * Define the metrics to be returned for a DATE or DATE_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'maximum' | 'median' | 'minimum' | 'mode')[]} metrics The metrics to return. - * @returns {MetricsDate

} The metrics for the property. - */ - date(metrics) { - if (metrics === undefined || metrics.length === 0) { - metrics = ['count', 'maximum', 'median', 'minimum', 'mode']; - } - return Object.assign(Object.assign({}, this.map(metrics)), { - kind: 'date', - propertyName: this.propertyName, - }); - } - /** - * Define the metrics to be returned for an INT or INT_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'maximum' | 'mean' | 'median' | 'minimum' | 'mode' | 'sum')[]} metrics The metrics to return. - * @returns {MetricsInteger

} The metrics for the property. - */ - integer(metrics) { - if (metrics === undefined || metrics.length === 0) { - metrics = ['count', 'maximum', 'mean', 'median', 'minimum', 'mode', 'sum']; - } - return Object.assign(Object.assign({}, this.map(metrics)), { - kind: 'integer', - propertyName: this.propertyName, - }); - } - /** - * Define the metrics to be returned for a NUMBER or NUMBER_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'maximum' | 'mean' | 'median' | 'minimum' | 'mode' | 'sum')[]} metrics The metrics to return. - * @returns {MetricsNumber

} The metrics for the property. - */ - number(metrics) { - if (metrics === undefined || metrics.length === 0) { - metrics = ['count', 'maximum', 'mean', 'median', 'minimum', 'mode', 'sum']; - } - return Object.assign(Object.assign({}, this.map(metrics)), { - kind: 'number', - propertyName: this.propertyName, - }); - } - // public reference(metrics: 'pointingTo'[]): MetricsReference { - // return { - // ...this.map(metrics), - // kind: 'reference', - // propertyName: this.propertyName, - // }; - // } - /** - * Define the metrics to be returned for a TEXT or TEXT_ARRAY property when aggregating over a collection. - * - * If none of the arguments are provided then all metrics will be returned. - * - * @param {('count' | 'topOccurrencesOccurs' | 'topOccurrencesValue')[]} metrics The metrics to return. - * @param {number} [minOccurrences] The how many top occurrences to return. - * @returns {MetricsText

} The metrics for the property. - */ - text(metrics, minOccurrences) { - if (metrics === undefined || metrics.length === 0) { - metrics = ['count', 'topOccurrencesOccurs', 'topOccurrencesValue']; - } - return { - count: metrics.includes('count'), - topOccurrences: - metrics.includes('topOccurrencesOccurs') || metrics.includes('topOccurrencesValue') - ? { - occurs: metrics.includes('topOccurrencesOccurs'), - value: metrics.includes('topOccurrencesValue'), - } - : undefined, - minOccurrences, - kind: 'text', - propertyName: this.propertyName, - }; - } -} -class AggregateManager { - constructor(connection, name, dbVersionSupport, consistencyLevel, tenant) { - this.do = (query) => { - return query - .do() - .then(({ data }) => { - const _a = data.Aggregate[this.name][0], - { meta } = _a, - rest = __rest(_a, ['meta']); - return { - properties: rest, - totalCount: meta === null || meta === void 0 ? void 0 : meta.count, - }; - }) - .catch((err) => { - throw new WeaviateQueryError(err.message, 'GraphQL'); - }); - }; - this.doGroupBy = (query) => { - return query - .do() - .then(({ data }) => - data.Aggregate[this.name].map((item) => { - const { groupedBy, meta } = item, - rest = __rest(item, ['groupedBy', 'meta']); - return { - groupedBy: { - prop: groupedBy.path[0], - value: groupedBy.value, - }, - properties: rest.length > 0 ? rest : undefined, - totalCount: meta === null || meta === void 0 ? void 0 : meta.count, - }; - }) - ) - .catch((err) => { - throw new WeaviateQueryError(err.message, 'GraphQL'); - }); - }; - this.connection = connection; - this.name = name; - this.dbVersionSupport = dbVersionSupport; - this.consistencyLevel = consistencyLevel; - this.tenant = tenant; - this.groupBy = { - nearImage: (image, opts) => - __awaiter(this, void 0, void 0, function* () { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters, - opts === null || opts === void 0 ? void 0 : opts.groupBy - ).withNearImage({ - image: yield toBase64FromMedia(image), - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts === null || opts === void 0 ? void 0 : opts.objectLimit); - } - return this.doGroupBy(builder); - }), - nearObject: (id, opts) => { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters, - opts === null || opts === void 0 ? void 0 : opts.groupBy - ).withNearObject({ - id: id, - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts.objectLimit); - } - return this.doGroupBy(builder); - }, - nearText: (query, opts) => { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters, - opts === null || opts === void 0 ? void 0 : opts.groupBy - ).withNearText({ - concepts: Array.isArray(query) ? query : [query], - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts.objectLimit); - } - return this.doGroupBy(builder); - }, - nearVector: (vector, opts) => { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters, - opts === null || opts === void 0 ? void 0 : opts.groupBy - ).withNearVector({ - vector: vector, - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts.objectLimit); - } - return this.doGroupBy(builder); - }, - overAll: (opts) => { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters, - opts === null || opts === void 0 ? void 0 : opts.groupBy - ); - return this.doGroupBy(builder); - }, - }; - } - query() { - return new Aggregator(this.connection); - } - base(metrics, filters, groupBy) { - let fields = 'meta { count }'; - let builder = this.query().withClassName(this.name); - if (metrics) { - if (Array.isArray(metrics)) { - fields += metrics.map((m) => this.metrics(m)).join(' '); - } else { - fields += this.metrics(metrics); - } - } - if (groupBy) { - builder = builder.withGroupBy(typeof groupBy === 'string' ? [groupBy] : [groupBy.property]); - fields += 'groupedBy { path value }'; - if (typeof groupBy !== 'string' && (groupBy === null || groupBy === void 0 ? void 0 : groupBy.limit)) { - builder = builder.withLimit(groupBy.limit); - } - } - if (fields !== '') { - builder = builder.withFields(fields); - } - if (filters) { - builder = builder.withWhere(Serialize.filtersREST(filters)); - } - if (this.tenant) { - builder = builder.withTenant(this.tenant); - } - return builder; - } - metrics(metrics) { - let body = ''; - const { kind, propertyName } = metrics, - rest = __rest(metrics, ['kind', 'propertyName']); - switch (kind) { - case 'text': { - const _a = rest, - { minOccurrences } = _a, - restText = __rest(_a, ['minOccurrences']); - body = Object.entries(restText) - .map(([key, value]) => { - if (value) { - return value instanceof Object - ? `topOccurrences${minOccurrences ? `(limit: ${minOccurrences})` : ''} { ${ - value.occurs ? 'occurs' : '' - } ${value.value ? 'value' : ''} }` - : key; - } - }) - .join(' '); - break; - } - default: - body = Object.entries(rest) - .map(([key, value]) => (value ? key : '')) - .join(' '); - } - return `${propertyName} { ${body} }`; - } - static use(connection, name, dbVersionSupport, consistencyLevel, tenant) { - return new AggregateManager(connection, name, dbVersionSupport, consistencyLevel, tenant); - } - nearImage(image, opts) { - return __awaiter(this, void 0, void 0, function* () { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters - ).withNearImage({ - image: yield toBase64FromMedia(image), - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts === null || opts === void 0 ? void 0 : opts.objectLimit); - } - return this.do(builder); - }); - } - nearObject(id, opts) { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters - ).withNearObject({ - id: id, - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts.objectLimit); - } - return this.do(builder); - } - nearText(query, opts) { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters - ).withNearText({ - concepts: Array.isArray(query) ? query : [query], - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts.objectLimit); - } - return this.do(builder); - } - nearVector(vector, opts) { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters - ).withNearVector({ - vector: vector, - certainty: opts === null || opts === void 0 ? void 0 : opts.certainty, - distance: opts === null || opts === void 0 ? void 0 : opts.distance, - targetVectors: (opts === null || opts === void 0 ? void 0 : opts.targetVector) - ? [opts.targetVector] - : undefined, - }); - if (opts === null || opts === void 0 ? void 0 : opts.objectLimit) { - builder.withObjectLimit(opts.objectLimit); - } - return this.do(builder); - } - overAll(opts) { - const builder = this.base( - opts === null || opts === void 0 ? void 0 : opts.returnMetrics, - opts === null || opts === void 0 ? void 0 : opts.filters - ); - return this.do(builder); - } -} -export default AggregateManager.use; diff --git a/dist/node/esm/collections/backup/client.d.ts b/dist/node/esm/collections/backup/client.d.ts deleted file mode 100644 index c501f7e2..00000000 --- a/dist/node/esm/collections/backup/client.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -import Connection from '../../connection/index.js'; -import { - BackupArgs, - BackupCancelArgs, - BackupConfigCreate, - BackupConfigRestore, - BackupReturn, - BackupStatusArgs, - BackupStatusReturn, -} from './types.js'; -export declare const backup: (connection: Connection) => { - cancel: (args: BackupCancelArgs) => Promise; - create: (args: BackupArgs) => Promise; - getCreateStatus: (args: BackupStatusArgs) => Promise; - getRestoreStatus: (args: BackupStatusArgs) => Promise; - restore: (args: BackupArgs) => Promise; -}; -export interface Backup { - /** - * Cancel a backup. - * - * @param {BackupCancelArgs} args The arguments for the request. - * @returns {Promise} Whether the backup was canceled. - * @throws {WeaviateInvalidInputError} If the input is invalid. - * @throws {WeaviateBackupCancellationError} If the backup cancellation fails. - */ - cancel(args: BackupCancelArgs): Promise; - /** - * Create a backup of the database. - * - * @param {BackupArgs} args The arguments for the request. - * @returns {Promise} The response from Weaviate. - * @throws {WeaviateInvalidInputError} If the input is invalid. - * @throws {WeaviateBackupFailed} If the backup creation fails. - * @throws {WeaviateBackupCanceled} If the backup creation is canceled. - */ - create(args: BackupArgs): Promise; - /** - * Get the status of a backup creation. - * - * @param {BackupStatusArgs} args The arguments for the request. - * @returns {Promise} The status of the backup creation. - * @throws {WeaviateInvalidInputError} If the input is invalid. - */ - getCreateStatus(args: BackupStatusArgs): Promise; - /** - * Get the status of a backup restore. - * - * @param {BackupStatusArgs} args The arguments for the request. - * @returns {Promise} The status of the backup restore. - * @throws {WeaviateInvalidInputError} If the input is invalid. - */ - getRestoreStatus(args: BackupStatusArgs): Promise; - /** - * Restore a backup of the database. - * - * @param {BackupArgs} args The arguments for the request. - * @returns {Promise} The response from Weaviate. - * @throws {WeaviateInvalidInputError} If the input is invalid. - * @throws {WeaviateBackupFailed} If the backup restoration fails. - * @throws {WeaviateBackupCanceled} If the backup restoration is canceled. - */ - restore(args: BackupArgs): Promise; -} diff --git a/dist/node/esm/collections/backup/client.js b/dist/node/esm/collections/backup/client.js deleted file mode 100644 index 90683843..00000000 --- a/dist/node/esm/collections/backup/client.js +++ /dev/null @@ -1,216 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -import { - BackupCreateStatusGetter, - BackupCreator, - BackupRestoreStatusGetter, - BackupRestorer, -} from '../../backup/index.js'; -import { validateBackend, validateBackupId } from '../../backup/validation.js'; -import { - WeaviateBackupCanceled, - WeaviateBackupCancellationError, - WeaviateBackupFailed, - WeaviateInvalidInputError, - WeaviateUnexpectedResponseError, - WeaviateUnexpectedStatusCodeError, -} from '../../errors.js'; -export const backup = (connection) => { - const parseStatus = (res) => { - if (res.id === undefined) { - throw new WeaviateUnexpectedResponseError('Backup ID is undefined in response'); - } - if (res.path === undefined) { - throw new WeaviateUnexpectedResponseError('Backup path is undefined in response'); - } - if (res.status === undefined) { - throw new WeaviateUnexpectedResponseError('Backup status is undefined in response'); - } - return { - id: res.id, - error: res.error, - path: res.path, - status: res.status, - }; - }; - const parseResponse = (res) => { - if (res.id === undefined) { - throw new WeaviateUnexpectedResponseError('Backup ID is undefined in response'); - } - if (res.backend === undefined) { - throw new WeaviateUnexpectedResponseError('Backup backend is undefined in response'); - } - if (res.path === undefined) { - throw new WeaviateUnexpectedResponseError('Backup path is undefined in response'); - } - if (res.status === undefined) { - throw new WeaviateUnexpectedResponseError('Backup status is undefined in response'); - } - return { - id: res.id, - backend: res.backend, - collections: res.classes ? res.classes : [], - error: res.error, - path: res.path, - status: res.status, - }; - }; - const getCreateStatus = (args) => { - return new BackupCreateStatusGetter(connection) - .withBackupId(args.backupId) - .withBackend(args.backend) - .do() - .then(parseStatus); - }; - const getRestoreStatus = (args) => { - return new BackupRestoreStatusGetter(connection) - .withBackupId(args.backupId) - .withBackend(args.backend) - .do() - .then(parseStatus); - }; - return { - cancel: (args) => - __awaiter(void 0, void 0, void 0, function* () { - let errors = []; - errors = errors.concat(validateBackupId(args.backupId)).concat(validateBackend(args.backend)); - if (errors.length > 0) { - throw new WeaviateInvalidInputError(errors.join(', ')); - } - try { - yield connection.delete(`/backups/${args.backend}/${args.backupId}`, undefined, false); - } catch (err) { - if (err instanceof WeaviateUnexpectedStatusCodeError) { - if (err.code === 404) { - return false; - } - throw new WeaviateBackupCancellationError(err.message); - } - } - return true; - }), - create: (args) => - __awaiter(void 0, void 0, void 0, function* () { - let builder = new BackupCreator(connection, new BackupCreateStatusGetter(connection)) - .withBackupId(args.backupId) - .withBackend(args.backend); - if (args.includeCollections) { - builder = builder.withIncludeClassNames(...args.includeCollections); - } - if (args.excludeCollections) { - builder = builder.withExcludeClassNames(...args.excludeCollections); - } - if (args.config) { - builder = builder.withConfig({ - ChunkSize: args.config.chunkSize, - CompressionLevel: args.config.compressionLevel, - CPUPercentage: args.config.cpuPercentage, - }); - } - let res; - try { - res = yield builder.do(); - } catch (err) { - throw new WeaviateBackupFailed(`Backup creation failed: ${err}`, 'creation'); - } - if (res.status === 'FAILED') { - throw new WeaviateBackupFailed(`Backup creation failed: ${res.error}`, 'creation'); - } - let status; - if (args.waitForCompletion) { - let wait = true; - while (wait) { - const ret = yield getCreateStatus(args); // eslint-disable-line no-await-in-loop - if (ret.status === 'SUCCESS') { - wait = false; - status = ret; - } - if (ret.status === 'FAILED') { - throw new WeaviateBackupFailed(ret.error ? ret.error : '', 'creation'); - } - if (ret.status === 'CANCELED') { - throw new WeaviateBackupCanceled('creation'); - } - yield new Promise((resolve) => setTimeout(resolve, 1000)); // eslint-disable-line no-await-in-loop - } - } - return status ? Object.assign(Object.assign({}, parseResponse(res)), status) : parseResponse(res); - }), - getCreateStatus: getCreateStatus, - getRestoreStatus: getRestoreStatus, - restore: (args) => - __awaiter(void 0, void 0, void 0, function* () { - let builder = new BackupRestorer(connection, new BackupRestoreStatusGetter(connection)) - .withBackupId(args.backupId) - .withBackend(args.backend); - if (args.includeCollections) { - builder = builder.withIncludeClassNames(...args.includeCollections); - } - if (args.excludeCollections) { - builder = builder.withExcludeClassNames(...args.excludeCollections); - } - if (args.config) { - builder = builder.withConfig({ - CPUPercentage: args.config.cpuPercentage, - }); - } - let res; - try { - res = yield builder.do(); - } catch (err) { - throw new WeaviateBackupFailed(`Backup restoration failed: ${err}`, 'restoration'); - } - if (res.status === 'FAILED') { - throw new WeaviateBackupFailed(`Backup restoration failed: ${res.error}`, 'restoration'); - } - let status; - if (args.waitForCompletion) { - let wait = true; - while (wait) { - const ret = yield getRestoreStatus(args); // eslint-disable-line no-await-in-loop - if (ret.status === 'SUCCESS') { - wait = false; - status = ret; - } - if (ret.status === 'FAILED') { - throw new WeaviateBackupFailed(ret.error ? ret.error : '', 'restoration'); - } - if (ret.status === 'CANCELED') { - throw new WeaviateBackupCanceled('restoration'); - } - yield new Promise((resolve) => setTimeout(resolve, 1000)); // eslint-disable-line no-await-in-loop - } - } - return status ? Object.assign(Object.assign({}, parseResponse(res)), status) : parseResponse(res); - }), - }; -}; diff --git a/dist/node/esm/collections/backup/collection.d.ts b/dist/node/esm/collections/backup/collection.d.ts deleted file mode 100644 index 443de94b..00000000 --- a/dist/node/esm/collections/backup/collection.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { Backend } from '../../backup/index.js'; -import Connection from '../../connection/index.js'; -import { BackupReturn, BackupStatusArgs, BackupStatusReturn } from './types.js'; -/** The arguments required to create and restore backups. */ -export type BackupCollectionArgs = { - /** The ID of the backup. */ - backupId: string; - /** The backend to use for the backup. */ - backend: Backend; - /** The collections to include in the backup. */ - waitForCompletion?: boolean; -}; -export declare const backupCollection: ( - connection: Connection, - name: string -) => { - create: (args: BackupCollectionArgs) => Promise; - getCreateStatus: (args: BackupStatusArgs) => Promise; - getRestoreStatus: (args: BackupStatusArgs) => Promise; - restore: (args: BackupCollectionArgs) => Promise; -}; -export interface BackupCollection { - /** - * Create a backup of this collection. - * - * @param {BackupArgs} args The arguments for the request. - * @returns {Promise} The response from Weaviate. - * @throws {WeaviateInvalidInputError} If the input is invalid. - * @throws {WeaviateBackupFailed} If the backup creation fails. - * @throws {WeaviateBackupCanceled} If the backup creation is canceled. - */ - create(args: BackupCollectionArgs): Promise; - /** - * Get the status of a backup. - * - * @param {BackupStatusArgs} args The arguments for the request. - * @returns {Promise} The status of the backup. - * @throws {WeaviateInvalidInputError} If the input is invalid. - */ - getCreateStatus(args: BackupStatusArgs): Promise; - /** - * Get the status of a restore. - * - * @param {BackupStatusArgs} args The arguments for the request. - * @returns {Promise} The status of the restore. - * @throws {WeaviateInvalidInputError} If the input is invalid. - */ - getRestoreStatus(args: BackupStatusArgs): Promise; - /** - * Restore a backup of this collection. - * - * @param {BackupArgs} args The arguments for the request. - * @returns {Promise} The response from Weaviate. - * @throws {WeaviateInvalidInputError} If the input is invalid. - * @throws {WeaviateBackupFailed} If the backup restoration fails. - * @throws {WeaviateBackupCanceled} If the backup restoration is canceled. - */ - restore(args: BackupCollectionArgs): Promise; -} diff --git a/dist/node/esm/collections/backup/collection.js b/dist/node/esm/collections/backup/collection.js deleted file mode 100644 index 8d507480..00000000 --- a/dist/node/esm/collections/backup/collection.js +++ /dev/null @@ -1,11 +0,0 @@ -import { backup } from './client.js'; -export const backupCollection = (connection, name) => { - const handler = backup(connection); - return { - create: (args) => handler.create(Object.assign(Object.assign({}, args), { includeCollections: [name] })), - getCreateStatus: handler.getCreateStatus, - getRestoreStatus: handler.getRestoreStatus, - restore: (args) => - handler.restore(Object.assign(Object.assign({}, args), { includeCollections: [name] })), - }; -}; diff --git a/dist/node/esm/collections/backup/index.d.ts b/dist/node/esm/collections/backup/index.d.ts deleted file mode 100644 index e4c6f1b1..00000000 --- a/dist/node/esm/collections/backup/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type { Backup } from './client.js'; -export type { BackupCollection, BackupCollectionArgs } from './collection.js'; -export type { BackupArgs, BackupConfigCreate, BackupConfigRestore, BackupStatusArgs } from './types.js'; diff --git a/dist/node/esm/collections/backup/index.js b/dist/node/esm/collections/backup/index.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/backup/index.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/backup/types.d.ts b/dist/node/esm/collections/backup/types.d.ts deleted file mode 100644 index 8e509837..00000000 --- a/dist/node/esm/collections/backup/types.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { Backend, BackupCompressionLevel } from '../../index.js'; -/** The status of a backup operation */ -export type BackupStatus = 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED' | 'CANCELED'; -/** The status of a backup operation */ -export type BackupStatusReturn = { - /** The ID of the backup */ - id: string; - /** The error message if the backup failed */ - error?: string; - /** The path to the backup */ - path: string; - /** The status of the backup */ - status: BackupStatus; -}; -/** The return type of a backup creation or restoration operation */ -export type BackupReturn = BackupStatusReturn & { - /** The backend to which the backup was created or restored */ - backend: Backend; - /** The collections that were included in the backup */ - collections: string[]; -}; -/** Configuration options available when creating a backup */ -export type BackupConfigCreate = { - /** The size of the chunks to use for the backup. */ - chunkSize?: number; - /** The standard of compression to use for the backup. */ - compressionLevel?: BackupCompressionLevel; - /** The percentage of CPU to use for the backup creation job. */ - cpuPercentage?: number; -}; -/** Configuration options available when restoring a backup */ -export type BackupConfigRestore = { - /** The percentage of CPU to use for the backuop restoration job. */ - cpuPercentage?: number; -}; -/** The arguments required to create and restore backups. */ -export type BackupArgs = { - /** The ID of the backup. */ - backupId: string; - /** The backend to use for the backup. */ - backend: Backend; - /** The collections to include in the backup. */ - includeCollections?: string[]; - /** The collections to exclude from the backup. */ - excludeCollections?: string[]; - /** Whether to wait for the backup to complete. */ - waitForCompletion?: boolean; - /** The configuration options for the backup. */ - config?: C; -}; -/** The arguments required to get the status of a backup. */ -export type BackupStatusArgs = { - /** The ID of the backup. */ - backupId: string; - /** The backend to use for the backup. */ - backend: Backend; -}; -/** The arguments required to cancel a backup. */ -export type BackupCancelArgs = { - /** The ID of the backup. */ - backupId: string; - /** The backend to use for the backup. */ - backend: Backend; -}; diff --git a/dist/node/esm/collections/backup/types.js b/dist/node/esm/collections/backup/types.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/backup/types.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/cluster/index.d.ts b/dist/node/esm/collections/cluster/index.d.ts deleted file mode 100644 index 4649f9ae..00000000 --- a/dist/node/esm/collections/cluster/index.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import Connection from '../../connection/index.js'; -import { BatchStats, NodeShardStatus, NodeStats } from '../../openapi/types.js'; -export type Output = 'minimal' | 'verbose' | undefined; -export type NodesOptions = { - /** The name of the collection to get the status of. */ - collection?: string; - /** Set the desired output verbosity level. Can be `minimal | verbose | undefined` with `undefined` defaulting to `minimal`. */ - output: O; -}; -export type Node = { - name: string; - status: 'HEALTHY' | 'UNHEALTHY' | 'UNAVAILABLE'; - version: string; - gitHash: string; - stats: O extends 'minimal' | undefined ? undefined : Required; - batchStats: Required; - shards: O extends 'minimal' | undefined ? null : Required[]; -}; -declare const cluster: (connection: Connection) => { - nodes: (opts?: NodesOptions | undefined) => Promise[]>; -}; -export default cluster; -export interface Cluster { - /** - * Get the status of all nodes in the cluster. - * - * @param {NodesOptions} [opts] The options for the request. - * @returns {Promise[]>} The status of all nodes in the cluster. - */ - nodes: (opts?: NodesOptions) => Promise[]>; -} diff --git a/dist/node/esm/collections/cluster/index.js b/dist/node/esm/collections/cluster/index.js deleted file mode 100644 index 7be9de3c..00000000 --- a/dist/node/esm/collections/cluster/index.js +++ /dev/null @@ -1,15 +0,0 @@ -import { NodesStatusGetter } from '../../cluster/index.js'; -const cluster = (connection) => { - return { - nodes: (opts) => { - let builder = new NodesStatusGetter(connection).withOutput( - (opts === null || opts === void 0 ? void 0 : opts.output) ? opts.output : 'minimal' - ); - if (opts === null || opts === void 0 ? void 0 : opts.collection) { - builder = builder.withClassName(opts.collection); - } - return builder.do().then((res) => res.nodes); - }, - }; -}; -export default cluster; diff --git a/dist/node/esm/collections/collection/index.d.ts b/dist/node/esm/collections/collection/index.d.ts deleted file mode 100644 index 1ba5de99..00000000 --- a/dist/node/esm/collections/collection/index.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -import Connection from '../../connection/grpc.js'; -import { ConsistencyLevel } from '../../data/index.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { Aggregate, Metrics } from '../aggregate/index.js'; -import { BackupCollection } from '../backup/collection.js'; -import { Config } from '../config/index.js'; -import { Data } from '../data/index.js'; -import { Filter } from '../filters/index.js'; -import { Generate } from '../generate/index.js'; -import { Iterator } from '../iterator/index.js'; -import { Query } from '../query/index.js'; -import { Sort } from '../sort/index.js'; -import { TenantBase, Tenants } from '../tenants/index.js'; -import { QueryMetadata, QueryProperty, QueryReference } from '../types/index.js'; -import { MultiTargetVector } from '../vectors/multiTargetVector.js'; -export interface Collection { - /** This namespace includes all the querying methods available to you when using Weaviate's standard aggregation capabilities. */ - aggregate: Aggregate; - /** This namespace includes all the backup methods available to you when backing up a collection in Weaviate. */ - backup: BackupCollection; - /** This namespace includes all the CRUD methods available to you when modifying the configuration of the collection in Weaviate. */ - config: Config; - /** This namespace includes all the CUD methods available to you when modifying the data of the collection in Weaviate. */ - data: Data; - /** This namespace includes the methods by which you can create the `FilterValue` values for use when filtering queries over your collection. */ - filter: Filter; - /** This namespace includes all the querying methods available to you when using Weaviate's generative capabilities. */ - generate: Generate; - /** This namespace includes the methods by which you can create the `MetricsX` values for use when aggregating over your collection. */ - metrics: Metrics; - /** The name of the collection. */ - name: N; - /** This namespace includes all the querying methods available to you when using Weaviate's standard query capabilities. */ - query: Query; - /** This namespaces includes the methods by which you can create the `Sorting` values for use when sorting queries over your collection. */ - sort: Sort; - /** This namespace includes all the CRUD methods available to you when modifying the tenants of a multi-tenancy-enabled collection in Weaviate. */ - tenants: Tenants; - /** This namespaces includes the methods by which you cna create the `MultiTargetVectorJoin` values for use when performing multi-target vector searches over your collection. */ - multiTargetVector: MultiTargetVector; - /** - * Use this method to check if the collection exists in Weaviate. - * - * @returns {Promise} A promise that resolves to `true` if the collection exists, and `false` otherwise. - */ - exists: () => Promise; - /** - * Use this method to return an iterator over the objects in the collection. - * - * This iterator keeps a record of the last object that it returned to be used in each subsequent call to Weaviate. - * Once the collection is exhausted, the iterator exits. - * - * @param {IteratorOptions} opts The options to use when fetching objects from Weaviate. - * @returns {Iterator} An iterator over the objects in the collection as an async generator. - * - * @description If `return_properties` is not provided, all the properties of each object will be - * requested from Weaviate except for its vector as this is an expensive operation. Specify `include_vector` - * to request the vector back as well. In addition, if `return_references=None` then none of the references - * are returned. Use `wvc.QueryReference` to specify which references to return. - */ - iterator: (opts?: IteratorOptions) => Iterator; - /** - * Use this method to return a collection object specific to a single consistency level. - * - * If replication is not configured for this collection then Weaviate will throw an error. - * - * This method does not send a request to Weaviate. It only returns a new collection object that is specific to the consistency level you specify. - * - * @param {ConsistencyLevel} consistencyLevel The consistency level to use. - * @returns {Collection} A new collection object specific to the consistency level you specified. - */ - withConsistency: (consistencyLevel: ConsistencyLevel) => Collection; - /** - * Use this method to return a collection object specific to a single tenant. - * - * If multi-tenancy is not configured for this collection then Weaviate will throw an error. - * - * This method does not send a request to Weaviate. It only returns a new collection object that is specific to the tenant you specify. - * - * @typedef {TenantBase} TT A type that extends TenantBase. - * @param {string | TT} tenant The tenant name or tenant object to use. - * @returns {Collection} A new collection object specific to the tenant you specified. - */ - withTenant: (tenant: string | TT) => Collection; -} -export type IteratorOptions = { - includeVector?: boolean | string[]; - returnMetadata?: QueryMetadata; - returnProperties?: QueryProperty[]; - returnReferences?: QueryReference[]; -}; -declare const collection: ( - connection: Connection, - name: N, - dbVersionSupport: DbVersionSupport, - consistencyLevel?: ConsistencyLevel, - tenant?: string -) => Collection; -export default collection; diff --git a/dist/node/esm/collections/collection/index.js b/dist/node/esm/collections/collection/index.js deleted file mode 100644 index 670c016f..00000000 --- a/dist/node/esm/collections/collection/index.js +++ /dev/null @@ -1,61 +0,0 @@ -import { WeaviateInvalidInputError } from '../../errors.js'; -import ClassExists from '../../schema/classExists.js'; -import aggregate, { metrics } from '../aggregate/index.js'; -import { backupCollection } from '../backup/collection.js'; -import config from '../config/index.js'; -import data from '../data/index.js'; -import filter from '../filters/index.js'; -import generate from '../generate/index.js'; -import { Iterator } from '../iterator/index.js'; -import query from '../query/index.js'; -import sort from '../sort/index.js'; -import tenants from '../tenants/index.js'; -import multiTargetVector from '../vectors/multiTargetVector.js'; -const isString = (value) => typeof value === 'string'; -const capitalizeCollectionName = (name) => name.charAt(0).toUpperCase() + name.slice(1); -const collection = (connection, name, dbVersionSupport, consistencyLevel, tenant) => { - if (!isString(name)) { - throw new WeaviateInvalidInputError(`The collection name must be a string, got: ${typeof name}`); - } - const capitalizedName = capitalizeCollectionName(name); - const queryCollection = query(connection, capitalizedName, dbVersionSupport, consistencyLevel, tenant); - return { - aggregate: aggregate(connection, capitalizedName, dbVersionSupport, consistencyLevel, tenant), - backup: backupCollection(connection, capitalizedName), - config: config(connection, capitalizedName, dbVersionSupport, tenant), - data: data(connection, capitalizedName, dbVersionSupport, consistencyLevel, tenant), - filter: filter(), - generate: generate(connection, capitalizedName, dbVersionSupport, consistencyLevel, tenant), - metrics: metrics(), - multiTargetVector: multiTargetVector(), - name: name, - query: queryCollection, - sort: sort(), - tenants: tenants(connection, capitalizedName, dbVersionSupport), - exists: () => new ClassExists(connection).withClassName(capitalizedName).do(), - iterator: (opts) => - new Iterator((limit, after) => - queryCollection - .fetchObjects({ - limit, - after, - includeVector: opts === null || opts === void 0 ? void 0 : opts.includeVector, - returnMetadata: opts === null || opts === void 0 ? void 0 : opts.returnMetadata, - returnProperties: opts === null || opts === void 0 ? void 0 : opts.returnProperties, - returnReferences: opts === null || opts === void 0 ? void 0 : opts.returnReferences, - }) - .then((res) => res.objects) - ), - withConsistency: (consistencyLevel) => - collection(connection, capitalizedName, dbVersionSupport, consistencyLevel, tenant), - withTenant: (tenant) => - collection( - connection, - capitalizedName, - dbVersionSupport, - consistencyLevel, - typeof tenant === 'string' ? tenant : tenant.name - ), - }; -}; -export default collection; diff --git a/dist/node/esm/collections/config/classes.d.ts b/dist/node/esm/collections/config/classes.d.ts deleted file mode 100644 index 1822bb06..00000000 --- a/dist/node/esm/collections/config/classes.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { - WeaviateClass, - WeaviateInvertedIndexConfig, - WeaviateReplicationConfig, - WeaviateVectorIndexConfig, - WeaviateVectorsConfig, -} from '../../openapi/types.js'; -import { - InvertedIndexConfigUpdate, - ReplicationConfigUpdate, - VectorConfigUpdate, - VectorIndexConfigFlatUpdate, - VectorIndexConfigHNSWUpdate, -} from '../configure/types/index.js'; -import { CollectionConfigUpdate, VectorIndexType } from './types/index.js'; -export declare class MergeWithExisting { - static schema( - current: WeaviateClass, - supportsNamedVectors: boolean, - update?: CollectionConfigUpdate - ): WeaviateClass; - static invertedIndex( - current: WeaviateInvertedIndexConfig, - update?: InvertedIndexConfigUpdate - ): WeaviateInvertedIndexConfig; - static replication( - current: WeaviateReplicationConfig, - update?: ReplicationConfigUpdate - ): WeaviateReplicationConfig; - static vectors( - current: WeaviateVectorsConfig, - update?: VectorConfigUpdate[] - ): WeaviateVectorsConfig; - static flat( - current: WeaviateVectorIndexConfig, - update?: VectorIndexConfigFlatUpdate - ): WeaviateVectorIndexConfig; - static hnsw( - current: WeaviateVectorIndexConfig, - update?: VectorIndexConfigHNSWUpdate - ): WeaviateVectorIndexConfig; -} diff --git a/dist/node/esm/collections/config/classes.js b/dist/node/esm/collections/config/classes.js deleted file mode 100644 index 86857b5b..00000000 --- a/dist/node/esm/collections/config/classes.js +++ /dev/null @@ -1,128 +0,0 @@ -var __rest = - (this && this.__rest) || - function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === 'function') - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; - }; -/* eslint-disable @typescript-eslint/no-non-null-assertion */ -import { WeaviateInvalidInputError } from '../../errors.js'; -import { QuantizerGuards } from '../configure/parsing.js'; -export class MergeWithExisting { - static schema(current, supportsNamedVectors, update) { - var _a; - if (update === undefined) return current; - if (update.description !== undefined) current.description = update.description; - if (update.invertedIndex !== undefined) - current.invertedIndexConfig = MergeWithExisting.invertedIndex( - current.invertedIndexConfig, - update.invertedIndex - ); - if (update.replication !== undefined) - current.replicationConfig = MergeWithExisting.replication( - current.replicationConfig, - update.replication - ); - if (update.vectorizers !== undefined) { - if (Array.isArray(update.vectorizers)) { - current.vectorConfig = MergeWithExisting.vectors(current.vectorConfig, update.vectorizers); - } else if (supportsNamedVectors && current.vectorConfig !== undefined) { - const updateVectorizers = Object.assign(Object.assign({}, update.vectorizers), { name: 'default' }); - current.vectorConfig = MergeWithExisting.vectors(current.vectorConfig, [updateVectorizers]); - } else { - current.vectorIndexConfig = - ((_a = update.vectorizers) === null || _a === void 0 ? void 0 : _a.vectorIndex.name) === 'hnsw' - ? MergeWithExisting.hnsw(current.vectorIndexConfig, update.vectorizers.vectorIndex.config) - : MergeWithExisting.flat(current.vectorIndexConfig, update.vectorizers.vectorIndex.config); - } - } - return current; - } - static invertedIndex(current, update) { - if (current === undefined) throw Error('Inverted index config is missing from the class schema.'); - if (update === undefined) return current; - const { bm25, stopwords } = update, - rest = __rest(update, ['bm25', 'stopwords']); - const merged = Object.assign(Object.assign({}, current), rest); - if (bm25 !== undefined) merged.bm25 = Object.assign(Object.assign({}, current.bm25), bm25); - if (stopwords !== undefined) - merged.stopwords = Object.assign(Object.assign({}, current.stopwords), stopwords); - return merged; - } - static replication(current, update) { - if (current === undefined) throw Error('Replication config is missing from the class schema.'); - if (update === undefined) return current; - return Object.assign(Object.assign({}, current), update); - } - static vectors(current, update) { - if (current === undefined) throw Error('Vector index config is missing from the class schema.'); - if (update === undefined) return current; - update.forEach((v) => { - const existing = current[v.name]; - if (existing !== undefined) { - current[v.name].vectorIndexConfig = - v.vectorIndex.name === 'hnsw' - ? MergeWithExisting.hnsw(existing.vectorIndexConfig, v.vectorIndex.config) - : MergeWithExisting.flat(existing.vectorIndexConfig, v.vectorIndex.config); - } - }); - return current; - } - static flat(current, update) { - if (update === undefined) return current; - if ( - (QuantizerGuards.isPQUpdate(update.quantizer) && - (current === null || current === void 0 ? void 0 : current.bq).enabled) || - (QuantizerGuards.isBQUpdate(update.quantizer) && - (current === null || current === void 0 ? void 0 : current.pq).enabled) - ) - throw Error(`Cannot update the quantizer type of an enabled vector index.`); - const { quantizer } = update, - rest = __rest(update, ['quantizer']); - const merged = Object.assign(Object.assign({}, current), rest); - if (QuantizerGuards.isBQUpdate(quantizer)) { - const { type } = quantizer, - quant = __rest(quantizer, ['type']); - merged.bq = Object.assign(Object.assign(Object.assign({}, current.bq), quant), { enabled: true }); - } - return merged; - } - static hnsw(current, update) { - if (update === undefined) return current; - if ( - (QuantizerGuards.isBQUpdate(update.quantizer) && - (((current === null || current === void 0 ? void 0 : current.pq) || {}).enabled || - ((current === null || current === void 0 ? void 0 : current.sq) || {}).enabled)) || - (QuantizerGuards.isPQUpdate(update.quantizer) && - (((current === null || current === void 0 ? void 0 : current.bq) || {}).enabled || - ((current === null || current === void 0 ? void 0 : current.sq) || {}).enabled)) || - (QuantizerGuards.isSQUpdate(update.quantizer) && - (((current === null || current === void 0 ? void 0 : current.pq) || {}).enabled || - ((current === null || current === void 0 ? void 0 : current.bq) || {}).enabled)) - ) - throw new WeaviateInvalidInputError(`Cannot update the quantizer type of an enabled vector index.`); - const { quantizer } = update, - rest = __rest(update, ['quantizer']); - const merged = Object.assign(Object.assign({}, current), rest); - if (QuantizerGuards.isBQUpdate(quantizer)) { - const { type } = quantizer, - quant = __rest(quantizer, ['type']); - merged.bq = Object.assign(Object.assign(Object.assign({}, current.bq), quant), { enabled: true }); - } - if (QuantizerGuards.isPQUpdate(quantizer)) { - const { type } = quantizer, - quant = __rest(quantizer, ['type']); - merged.pq = Object.assign(Object.assign(Object.assign({}, current.pq), quant), { enabled: true }); - } - if (QuantizerGuards.isSQUpdate(quantizer)) { - const { type } = quantizer, - quant = __rest(quantizer, ['type']); - merged.sq = Object.assign(Object.assign(Object.assign({}, current.sq), quant), { enabled: true }); - } - return merged; - } -} diff --git a/dist/node/esm/collections/config/index.d.ts b/dist/node/esm/collections/config/index.d.ts deleted file mode 100644 index 8452d1be..00000000 --- a/dist/node/esm/collections/config/index.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -import Connection from '../../connection/index.js'; -import { WeaviateShardStatus } from '../../openapi/types.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { - PropertyConfigCreate, - ReferenceMultiTargetConfigCreate, - ReferenceSingleTargetConfigCreate, -} from '../configure/types/index.js'; -import { - BQConfig, - CollectionConfig, - CollectionConfigUpdate, - PQConfig, - QuantizerConfig, - SQConfig, - VectorIndexConfig, - VectorIndexConfigDynamic, - VectorIndexConfigFlat, - VectorIndexConfigHNSW, -} from './types/index.js'; -declare const config: ( - connection: Connection, - name: string, - dbVersionSupport: DbVersionSupport, - tenant?: string -) => Config; -export default config; -export interface Config { - /** - * Add a property to the collection in Weaviate. - * - * @param {PropertyConfigCreate} property The property configuration. - * @returns {Promise} A promise that resolves when the property has been added. - */ - addProperty: (property: PropertyConfigCreate) => Promise; - /** - * Add a reference to the collection in Weaviate. - * - * @param {ReferenceSingleTargetConfigCreate | ReferenceMultiTargetConfigCreate} reference The reference configuration. - * @returns {Promise} A promise that resolves when the reference has been added. - */ - addReference: ( - reference: ReferenceSingleTargetConfigCreate | ReferenceMultiTargetConfigCreate - ) => Promise; - /** - * Get the configuration for this collection from Weaviate. - * - * @returns {Promise>} A promise that resolves with the collection configuration. - */ - get: () => Promise; - /** - * Get the statuses of the shards of this collection. - * - * If the collection is multi-tenancy and you did not call `.with_tenant` then you - * will receive the statuses of all the tenants within the collection. Otherwise, call - * `.with_tenant` on the collection first and you will receive only that single shard. - * - * @returns {Promise[]>} A promise that resolves with the shard statuses. - */ - getShards: () => Promise[]>; - /** - * Update the status of one or all shards of this collection. - * - * @param {'READY' | 'READONLY'} status The new status of the shard(s). - * @param {string | string[]} [names] The name(s) of the shard(s) to update. If not provided, all shards will be updated. - * @returns {Promise[]>} A promise that resolves with the updated shard statuses. - */ - updateShards: ( - status: 'READY' | 'READONLY', - names?: string | string[] - ) => Promise[]>; - /** - * Update the configuration for this collection in Weaviate. - * - * Use the `weaviate.classes.Reconfigure` class to generate the necessary configuration objects for this method. - * - * @param {CollectionConfigUpdate} [config] The configuration to update. Only a subset of the actual collection configuration can be updated. - * @returns {Promise} A promise that resolves when the collection has been updated. - */ - update: (config?: CollectionConfigUpdate) => Promise; -} -export declare class VectorIndex { - static isHNSW(config?: VectorIndexConfig): config is VectorIndexConfigHNSW; - static isFlat(config?: VectorIndexConfig): config is VectorIndexConfigFlat; - static isDynamic(config?: VectorIndexConfig): config is VectorIndexConfigDynamic; -} -export declare class Quantizer { - static isPQ(config?: QuantizerConfig): config is PQConfig; - static isBQ(config?: QuantizerConfig): config is BQConfig; - static isSQ(config?: QuantizerConfig): config is SQConfig; -} -export declare const configGuards: { - quantizer: typeof Quantizer; - vectorIndex: typeof VectorIndex; -}; diff --git a/dist/node/esm/collections/config/index.js b/dist/node/esm/collections/config/index.js deleted file mode 100644 index e0ae393d..00000000 --- a/dist/node/esm/collections/config/index.js +++ /dev/null @@ -1,130 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -import { WeaviateDeserializationError } from '../../errors.js'; -import ClassUpdater from '../../schema/classUpdater.js'; -import { ClassGetter, PropertyCreator, ShardUpdater } from '../../schema/index.js'; -import ShardsGetter from '../../schema/shardsGetter.js'; -import { MergeWithExisting } from './classes.js'; -import { classToCollection, resolveProperty, resolveReference } from './utils.js'; -const config = (connection, name, dbVersionSupport, tenant) => { - const getRaw = new ClassGetter(connection).withClassName(name).do; - return { - addProperty: (property) => - new PropertyCreator(connection) - .withClassName(name) - .withProperty(resolveProperty(property, [])) - .do() - .then(() => {}), - addReference: (reference) => - new PropertyCreator(connection) - .withClassName(name) - .withProperty(resolveReference(reference)) - .do() - .then(() => {}), - get: () => getRaw().then(classToCollection), - getShards: () => { - let builder = new ShardsGetter(connection).withClassName(name); - if (tenant) { - builder = builder.withTenant(tenant); - } - return builder.do().then((shards) => - shards.map((shard) => { - if (shard.name === undefined) - throw new WeaviateDeserializationError('Shard name was not returned by Weaviate'); - if (shard.status === undefined) - throw new WeaviateDeserializationError('Shard status was not returned by Weaviate'); - if (shard.vectorQueueSize === undefined) - throw new WeaviateDeserializationError('Shard vector queue size was not returned by Weaviate'); - return { name: shard.name, status: shard.status, vectorQueueSize: shard.vectorQueueSize }; - }) - ); - }, - updateShards: function (status, names) { - return __awaiter(this, void 0, void 0, function* () { - let shardNames; - if (names === undefined) { - shardNames = yield this.getShards().then((shards) => shards.map((s) => s.name)); - } else if (typeof names === 'string') { - shardNames = [names]; - } else { - shardNames = names; - } - return Promise.all( - shardNames.map((shardName) => - new ShardUpdater(connection).withClassName(name).withShardName(shardName).withStatus(status).do() - ) - ).then(() => this.getShards()); - }); - }, - update: (config) => { - return getRaw() - .then((current) => - __awaiter(void 0, void 0, void 0, function* () { - return MergeWithExisting.schema( - current, - yield dbVersionSupport.supportsNamedVectors().then((s) => s.supports), - config - ); - }) - ) - .then((merged) => new ClassUpdater(connection).withClass(merged).do()) - .then(() => {}); - }, - }; -}; -export default config; -export class VectorIndex { - static isHNSW(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'hnsw'; - } - static isFlat(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'flat'; - } - static isDynamic(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'dynamic'; - } -} -export class Quantizer { - static isPQ(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'pq'; - } - static isBQ(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'bq'; - } - static isSQ(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'sq'; - } -} -export const configGuards = { - quantizer: Quantizer, - vectorIndex: VectorIndex, -}; diff --git a/dist/node/esm/collections/config/types/generative.d.ts b/dist/node/esm/collections/config/types/generative.d.ts deleted file mode 100644 index 05a627da..00000000 --- a/dist/node/esm/collections/config/types/generative.d.ts +++ /dev/null @@ -1,144 +0,0 @@ -export type GenerativeOpenAIConfigBase = { - baseURL?: string; - frequencyPenaltyProperty?: number; - maxTokensProperty?: number; - presencePenaltyProperty?: number; - temperatureProperty?: number; - topPProperty?: number; -}; -export type GenerativeAWSConfig = { - region: string; - service: string; - model?: string; - endpoint?: string; -}; -export type GenerativeAnthropicConfig = { - maxTokens?: number; - model?: string; - stopSequences?: string[]; - temperature?: number; - topK?: number; - topP?: number; -}; -export type GenerativeAnyscaleConfig = { - model?: string; - temperature?: number; -}; -export type GenerativeCohereConfig = { - kProperty?: number; - model?: string; - maxTokensProperty?: number; - returnLikelihoodsProperty?: string; - stopSequencesProperty?: string[]; - temperatureProperty?: number; -}; -export type GenerativeDatabricksConfig = { - endpoint: string; - maxTokens?: number; - temperature?: number; - topK?: number; - topP?: number; -}; -export type GenerativeFriendliAIConfig = { - baseURL?: string; - maxTokens?: number; - model?: string; - temperature?: number; -}; -export type GenerativeMistralConfig = { - maxTokens?: number; - model?: string; - temperature?: number; -}; -export type GenerativeOctoAIConfig = { - baseURL?: string; - maxTokens?: number; - model?: string; - temperature?: number; -}; -export type GenerativeOllamaConfig = { - apiEndpoint?: string; - model?: string; -}; -export type GenerativeOpenAIConfig = GenerativeOpenAIConfigBase & { - model?: string; -}; -export type GenerativeAzureOpenAIConfig = GenerativeOpenAIConfigBase & { - resourceName: string; - deploymentId: string; -}; -/** @deprecated Use `GenerativeGoogleConfig` instead. */ -export type GenerativePaLMConfig = GenerativeGoogleConfig; -export type GenerativeGoogleConfig = { - apiEndpoint?: string; - maxOutputTokens?: number; - modelId?: string; - projectId?: string; - temperature?: number; - topK?: number; - topP?: number; -}; -export type GenerativeConfig = - | GenerativeAnthropicConfig - | GenerativeAnyscaleConfig - | GenerativeAWSConfig - | GenerativeAzureOpenAIConfig - | GenerativeCohereConfig - | GenerativeDatabricksConfig - | GenerativeGoogleConfig - | GenerativeFriendliAIConfig - | GenerativeMistralConfig - | GenerativeOctoAIConfig - | GenerativeOllamaConfig - | GenerativeOpenAIConfig - | GenerativePaLMConfig - | Record - | undefined; -export type GenerativeConfigType = G extends 'generative-anthropic' - ? GenerativeAnthropicConfig - : G extends 'generative-anyscale' - ? GenerativeAnyscaleConfig - : G extends 'generative-aws' - ? GenerativeAWSConfig - : G extends 'generative-azure-openai' - ? GenerativeAzureOpenAIConfig - : G extends 'generative-cohere' - ? GenerativeCohereConfig - : G extends 'generative-databricks' - ? GenerativeDatabricksConfig - : G extends 'generative-google' - ? GenerativeGoogleConfig - : G extends 'generative-friendliai' - ? GenerativeFriendliAIConfig - : G extends 'generative-mistral' - ? GenerativeMistralConfig - : G extends 'generative-octoai' - ? GenerativeOctoAIConfig - : G extends 'generative-ollama' - ? GenerativeOllamaConfig - : G extends 'generative-openai' - ? GenerativeOpenAIConfig - : G extends GenerativePalm - ? GenerativePaLMConfig - : G extends 'none' - ? undefined - : Record | undefined; -/** @deprecated Use `generative-google` instead. */ -type GenerativePalm = 'generative-palm'; -export type GenerativeSearch = - | 'generative-anthropic' - | 'generative-anyscale' - | 'generative-aws' - | 'generative-azure-openai' - | 'generative-cohere' - | 'generative-databricks' - | 'generative-google' - | 'generative-friendliai' - | 'generative-mistral' - | 'generative-octoai' - | 'generative-ollama' - | 'generative-openai' - | GenerativePalm - | 'none' - | string; -export {}; diff --git a/dist/node/esm/collections/config/types/generative.js b/dist/node/esm/collections/config/types/generative.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/config/types/generative.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/config/types/index.d.ts b/dist/node/esm/collections/config/types/index.d.ts deleted file mode 100644 index 60faf95a..00000000 --- a/dist/node/esm/collections/config/types/index.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -export * from './generative.js'; -export * from './reranker.js'; -export * from './vectorIndex.js'; -export * from './vectorizer.js'; -import { - InvertedIndexConfigUpdate, - ReplicationConfigUpdate, - VectorConfigUpdate, -} from '../../configure/types/index.js'; -import { GenerativeConfig } from './generative.js'; -import { RerankerConfig } from './reranker.js'; -import { VectorIndexType } from './vectorIndex.js'; -import { VectorConfig } from './vectorizer.js'; -export type ModuleConfig = { - name: N; - config: C; -}; -export type InvertedIndexConfig = { - bm25: { - k1: number; - b: number; - }; - cleanupIntervalSeconds: number; - indexTimestamps: boolean; - indexPropertyLength: boolean; - indexNullState: boolean; - stopwords: { - preset: string; - additions: string[]; - removals: string[]; - }; -}; -export type MultiTenancyConfig = { - autoTenantActivation: boolean; - autoTenantCreation: boolean; - enabled: boolean; -}; -export type ReplicationDeletionStrategy = 'DeleteOnConflict' | 'NoAutomatedResolution'; -export type ReplicationConfig = { - asyncEnabled: boolean; - deletionStrategy: ReplicationDeletionStrategy; - factor: number; -}; -export type PropertyVectorizerConfig = Record< - string, - { - skip: boolean; - vectorizePropertyName: boolean; - } ->; -export type PropertyConfig = { - name: string; - dataType: string; - description?: string; - indexInverted: boolean; - indexFilterable: boolean; - indexRangeFilters: boolean; - indexSearchable: boolean; - nestedProperties?: PropertyConfig[]; - tokenization: string; - vectorizerConfig?: PropertyVectorizerConfig; -}; -export type ReferenceConfig = { - name: string; - description?: string; - targetCollections: string[]; -}; -export type ShardingConfig = { - virtualPerPhysical: number; - desiredCount: number; - actualCount: number; - desiredVirtualCount: number; - actualVirtualCount: number; - key: '_id'; - strategy: 'hash'; - function: 'murmur3'; -}; -export type CollectionConfig = { - name: string; - description?: string; - generative?: GenerativeConfig; - invertedIndex: InvertedIndexConfig; - multiTenancy: MultiTenancyConfig; - properties: PropertyConfig[]; - references: ReferenceConfig[]; - replication: ReplicationConfig; - reranker?: RerankerConfig; - sharding: ShardingConfig; - vectorizers: VectorConfig; -}; -export type CollectionConfigUpdate = { - description?: string; - invertedIndex?: InvertedIndexConfigUpdate; - replication?: ReplicationConfigUpdate; - vectorizers?: - | VectorConfigUpdate - | VectorConfigUpdate[]; -}; diff --git a/dist/node/esm/collections/config/types/index.js b/dist/node/esm/collections/config/types/index.js deleted file mode 100644 index fa3fdf2a..00000000 --- a/dist/node/esm/collections/config/types/index.js +++ /dev/null @@ -1,4 +0,0 @@ -export * from './generative.js'; -export * from './reranker.js'; -export * from './vectorIndex.js'; -export * from './vectorizer.js'; diff --git a/dist/node/esm/collections/config/types/reranker.d.ts b/dist/node/esm/collections/config/types/reranker.d.ts deleted file mode 100644 index 60a38f79..00000000 --- a/dist/node/esm/collections/config/types/reranker.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -export type RerankerTransformersConfig = {}; -export type RerankerCohereConfig = { - model?: 'rerank-english-v2.0' | 'rerank-multilingual-v2.0' | string; -}; -export type RerankerVoyageAIConfig = { - model?: 'rerank-lite-1' | string; -}; -export type RerankerJinaAIConfig = { - model?: - | 'jina-reranker-v2-base-multilingual' - | 'jina-reranker-v1-base-en' - | 'jina-reranker-v1-turbo-en' - | 'jina-reranker-v1-tiny-en' - | 'jina-colbert-v1-en' - | string; -}; -export type RerankerConfig = - | RerankerCohereConfig - | RerankerJinaAIConfig - | RerankerTransformersConfig - | RerankerVoyageAIConfig - | Record - | undefined; -export type Reranker = - | 'reranker-cohere' - | 'reranker-jinaai' - | 'reranker-transformers' - | 'reranker-voyageai' - | 'none' - | string; -export type RerankerConfigType = R extends 'reranker-cohere' - ? RerankerCohereConfig - : R extends 'reranker-jinaai' - ? RerankerJinaAIConfig - : R extends 'reranker-transformers' - ? RerankerTransformersConfig - : R extends 'reranker-voyageai' - ? RerankerVoyageAIConfig - : R extends 'none' - ? undefined - : Record | undefined; diff --git a/dist/node/esm/collections/config/types/reranker.js b/dist/node/esm/collections/config/types/reranker.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/config/types/reranker.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/config/types/vectorIndex.d.ts b/dist/node/esm/collections/config/types/vectorIndex.d.ts deleted file mode 100644 index 1b343cfb..00000000 --- a/dist/node/esm/collections/config/types/vectorIndex.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -export type VectorIndexConfigHNSW = { - cleanupIntervalSeconds: number; - distance: VectorDistance; - dynamicEfMin: number; - dynamicEfMax: number; - dynamicEfFactor: number; - efConstruction: number; - ef: number; - filterStrategy: VectorIndexFilterStrategy; - flatSearchCutoff: number; - maxConnections: number; - quantizer: PQConfig | BQConfig | SQConfig | undefined; - skip: boolean; - vectorCacheMaxObjects: number; - type: 'hnsw'; -}; -export type VectorIndexConfigFlat = { - distance: VectorDistance; - vectorCacheMaxObjects: number; - quantizer: BQConfig | undefined; - type: 'flat'; -}; -export type VectorIndexConfigDynamic = { - distance: VectorDistance; - threshold: number; - hnsw: VectorIndexConfigHNSW; - flat: VectorIndexConfigFlat; - type: 'dynamic'; -}; -export type VectorIndexConfigType = I extends 'hnsw' - ? VectorIndexConfigHNSW - : I extends 'flat' - ? VectorIndexConfigFlat - : I extends 'dynamic' - ? VectorIndexConfigDynamic - : I extends string - ? Record - : never; -export type BQConfig = { - cache: boolean; - rescoreLimit: number; - type: 'bq'; -}; -export type SQConfig = { - rescoreLimit: number; - trainingLimit: number; - type: 'sq'; -}; -export type PQConfig = { - bitCompression: boolean; - centroids: number; - encoder: PQEncoderConfig; - segments: number; - trainingLimit: number; - type: 'pq'; -}; -export type PQEncoderConfig = { - type: PQEncoderType; - distribution: PQEncoderDistribution; -}; -export type VectorDistance = 'cosine' | 'dot' | 'l2-squared' | 'hamming'; -export type PQEncoderType = 'kmeans' | 'tile'; -export type PQEncoderDistribution = 'log-normal' | 'normal'; -export type VectorIndexType = 'hnsw' | 'flat' | 'dynamic' | string; -export type VectorIndexFilterStrategy = 'sweeping' | 'acorn'; -export type VectorIndexConfig = VectorIndexConfigHNSW | VectorIndexConfigFlat | VectorIndexConfigDynamic; -export type QuantizerConfig = PQConfig | BQConfig | SQConfig; diff --git a/dist/node/esm/collections/config/types/vectorIndex.js b/dist/node/esm/collections/config/types/vectorIndex.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/config/types/vectorIndex.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/config/types/vectorizer.d.ts b/dist/node/esm/collections/config/types/vectorizer.d.ts deleted file mode 100644 index 53ee2d6d..00000000 --- a/dist/node/esm/collections/config/types/vectorizer.d.ts +++ /dev/null @@ -1,439 +0,0 @@ -import { ModuleConfig } from './index.js'; -import { VectorIndexConfig, VectorIndexType } from './vectorIndex.js'; -export type VectorConfig = Record< - string, - { - properties?: string[]; - vectorizer: ModuleConfig | ModuleConfig; - indexConfig: VectorIndexConfig; - indexType: VectorIndexType; - } ->; -/** @deprecated Use `multi2vec-google` instead. */ -type Multi2VecPalmVectorizer = 'multi2vec-palm'; -/** @deprecated Use `text2vec-google` instead. */ -type Text2VecPalmVectorizer = 'text2vec-palm'; -export type Vectorizer = - | 'img2vec-neural' - | 'multi2vec-clip' - | 'multi2vec-bind' - | Multi2VecPalmVectorizer - | 'multi2vec-google' - | 'ref2vec-centroid' - | 'text2vec-aws' - | 'text2vec-azure-openai' - | 'text2vec-cohere' - | 'text2vec-contextionary' - | 'text2vec-databricks' - | 'text2vec-gpt4all' - | 'text2vec-huggingface' - | 'text2vec-jina' - | 'text2vec-mistral' - | 'text2vec-octoai' - | 'text2vec-ollama' - | 'text2vec-openai' - | Text2VecPalmVectorizer - | 'text2vec-google' - | 'text2vec-transformers' - | 'text2vec-voyageai' - | 'none'; -/** The configuration for image vectorization using a neural network module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/img2vec-neural) for detailed usage. - */ -export type Img2VecNeuralConfig = { - /** The image fields used when vectorizing. This is a required field and must match the property fields of the collection that are defined as `DataType.BLOB`. */ - imageFields: string[]; -}; -/** The field configuration for multi-media vectorization. */ -export type Multi2VecField = { - /** The name of the field to be used when performing multi-media vectorization. */ - name: string; - /** The weight of the field when performing multi-media vectorization. */ - weight?: number; -}; -/** The configuration for multi-media vectorization using the CLIP module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings-multimodal) for detailed usage. - */ -export type Multi2VecClipConfig = { - /** The image fields used when vectorizing. */ - imageFields?: string[]; - /** The URL where inference requests are sent. */ - inferenceUrl?: string; - /** The text fields used when vectorizing. */ - textFields?: string[]; - /** Whether the collection name is vectorized. */ - vectorizeCollectionName?: boolean; - /** The weights of the fields used for vectorization. */ - weights?: { - /** The weights of the image fields. */ - imageFields?: number[]; - /** The weights of the text fields. */ - textFields?: number[]; - }; -}; -/** The configuration for multi-media vectorization using the Bind module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/imagebind/embeddings-multimodal) for detailed usage. - */ -export type Multi2VecBindConfig = { - /** The audio fields used when vectorizing. */ - audioFields?: string[]; - /** The depth fields used when vectorizing. */ - depthFields?: string[]; - /** The image fields used when vectorizing. */ - imageFields?: string[]; - /** The IMU fields used when vectorizing. */ - IMUFields?: string[]; - /** The text fields used when vectorizing. */ - textFields?: string[]; - /** The thermal fields used when vectorizing. */ - thermalFields?: string[]; - /** The video fields used when vectorizing. */ - videoFields?: string[]; - /** Whether the collection name is vectorized. */ - vectorizeCollectionName?: boolean; - /** The weights of the fields used for vectorization. */ - weights?: { - /** The weights of the audio fields. */ - audioFields?: number[]; - /** The weights of the depth fields. */ - depthFields?: number[]; - /** The weights of the image fields. */ - imageFields?: number[]; - /** The weights of the IMU fields. */ - IMUFields?: number[]; - /** The weights of the text fields. */ - textFields?: number[]; - /** The weights of the thermal fields. */ - thermalFields?: number[]; - /** The weights of the video fields. */ - videoFields?: number[]; - }; -}; -/** @deprecated Use `Multi2VecGoogleConfig` instead. */ -export type Multi2VecPalmConfig = Multi2VecGoogleConfig; -/** The configuration for multi-media vectorization using the Google module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. - */ -export type Multi2VecGoogleConfig = { - /** The project ID of the model in GCP. */ - projectId: string; - /** The location where the model runs. */ - location: string; - /** The image fields used when vectorizing. */ - imageFields?: string[]; - /** The text fields used when vectorizing. */ - textFields?: string[]; - /** The video fields used when vectorizing. */ - videoFields?: string[]; - /** The model ID in use. */ - modelId?: string; - /** The number of dimensions in use. */ - dimensions?: number; - /** Whether the collection name is vectorized. */ - vectorizeCollectionName?: boolean; - /** The weights of the fields used for vectorization. */ - weights?: { - /** The weights of the image fields. */ - imageFields?: number[]; - /** The weights of the text fields. */ - textFields?: number[]; - /** The weights of the video fields. */ - videoFields?: number[]; - }; -}; -/** The configuration for reference-based vectorization using the centroid method. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/ref2vec-centroid) for detailed usage. - */ -export type Ref2VecCentroidConfig = { - /** The properties used as reference points for vectorization. */ - referenceProperties: string[]; - /** The method used to calculate the centroid. */ - method: 'mean' | string; -}; -/** The configuration for text vectorization using the AWS module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/text2vec-aws) for detailed usage. - */ -export type Text2VecAWSConfig = { - /** The model to use. REQUIRED for service `sagemaker`. */ - endpoint?: string; - /** The model to use. REQUIRED for service `bedrock`. */ - model?: 'amazon.titan-embed-text-v1' | 'cohere.embed-english-v3' | 'cohere.embed-multilingual-v3' | string; - /** The AWS region where the model runs. */ - region: string; - /** The AWS service to use. */ - service: 'sagemaker' | 'bedrock' | string; - /** Whether the collection name is vectorized. */ - vectorizeCollectionName?: boolean; -}; -/** The configuration for text vectorization using the OpenAI module with Azure. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) for detailed usage. - */ -export type Text2VecAzureOpenAIConfig = { - /** The base URL to use where API requests should go. */ - baseURL?: string; - /** The deployment ID to use */ - deploymentId: string; - /** The resource name to use. */ - resourceName: string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** The configuration for text vectorization using the Cohere module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings) for detailed usage. - */ -export type Text2VecCohereConfig = { - /** The base URL to use where API requests should go. */ - baseURL?: string; - /** The model to use. */ - model?: string; - /** The truncation strategy to use. */ - truncate?: boolean; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** The configuration for text vectorization using the Contextionary module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/text2vec-contextionary) for detailed usage. - */ -export type Text2VecContextionaryConfig = { - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** The configuration for text vectorization using the Databricks module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/databricks/embeddings) for detailed usage. - */ -export type Text2VecDatabricksConfig = { - endpoint: string; - instruction?: string; - vectorizeCollectionName?: boolean; -}; -/** The configuration for text vectorization using the GPT-4-All module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/gpt4all/embeddings) for detailed usage. - */ -export type Text2VecGPT4AllConfig = { - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the HuggingFace module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/huggingface/embeddings) for detailed usage. - */ -export type Text2VecHuggingFaceConfig = { - /** The endpoint URL to use. */ - endpointURL?: string; - /** The model to use. */ - model?: string; - /** The model to use for passage vectorization. */ - passageModel?: string; - /** The model to use for query vectorization. */ - queryModel?: string; - /** Whether to use the cache. */ - useCache?: boolean; - /** Whether to use the GPU. */ - useGPU?: boolean; - /** Whether to wait for the model. */ - waitForModel?: boolean; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the Jina module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/embeddings) for detailed usage. - */ -export type Text2VecJinaConfig = { - /** The model to use. */ - model?: 'jina-embeddings-v2-base-en' | 'jina-embeddings-v2-small-en' | string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the Mistral module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/mistral/embeddings) for detailed usage. - */ -export type Text2VecMistralConfig = { - /** The model to use. */ - model?: 'mistral-embed' | string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the OctoAI module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/octoai/embeddings) for detailed usage. - */ -export type Text2VecOctoAIConfig = { - /** The base URL to use where API requests should go. */ - baseURL?: string; - /** The model to use. */ - model?: string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the Ollama module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/ollama/embeddings) for detailed usage. - */ -export type Text2VecOllamaConfig = { - /** The base URL to use where API requests should go. */ - apiEndpoint?: string; - /** The model to use. */ - model?: string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the OpenAI module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) for detailed usage. - */ -export type Text2VecOpenAIConfig = { - /** The base URL to use where API requests should go. */ - baseURL?: string; - /** The dimensions to use. */ - dimensions?: number; - /** The model to use. */ - model?: 'text-embedding-3-small' | 'text-embedding-3-large' | 'text-embedding-ada-002' | string; - /** The model version to use. */ - modelVersion?: string; - /** The type of model to use. */ - type?: 'text' | 'code' | string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** @deprecated Use `Text2VecGoogleConfig` instead. */ -export type Text2VecPalmConfig = Text2VecGoogleConfig; -/** - * The configuration for text vectorization using the Google module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. - */ -export type Text2VecGoogleConfig = { - /** The API endpoint to use without a leading scheme such as `http://`. */ - apiEndpoint?: string; - /** The model ID to use. */ - modelId?: string; - /** The project ID to use. */ - projectId?: string; - /** The Weaviate property name for the `gecko-002` or `gecko-003` model to use as the title. */ - titleProperty?: string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the Transformers module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings) for detailed usage. - */ -export type Text2VecTransformersConfig = { - /** The inference url to use where API requests should go. You can use either this OR (`passage_inference_url` & `query_inference_url`). */ - inferenceUrl?: string; - /** The inference url to use where passage API requests should go. You can use either (this AND query_inference_url) OR `inference_url`. */ - passageInferenceUrl?: string; - /** The inference url to use where query API requests should go. You can use either (this AND `passage_inference_url`) OR `inference_url`. */ - queryInferenceUrl?: string; - /** The pooling strategy to use. */ - poolingStrategy?: 'masked_mean' | 'cls' | string; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** - * The configuration for text vectorization using the VoyageAI module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings) for detailed usage. - */ -export type Text2VecVoyageAIConfig = { - /** The base URL to use where API requests should go. */ - baseURL?: string; - /** The model to use. */ - model?: string; - /** Whether to truncate the input texts to fit within the context length. */ - truncate?: boolean; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -export type NoVectorizerConfig = {}; -export type VectorizerConfig = - | Img2VecNeuralConfig - | Multi2VecClipConfig - | Multi2VecBindConfig - | Multi2VecGoogleConfig - | Multi2VecPalmConfig - | Ref2VecCentroidConfig - | Text2VecAWSConfig - | Text2VecAzureOpenAIConfig - | Text2VecContextionaryConfig - | Text2VecCohereConfig - | Text2VecDatabricksConfig - | Text2VecGoogleConfig - | Text2VecGPT4AllConfig - | Text2VecHuggingFaceConfig - | Text2VecJinaConfig - | Text2VecOpenAIConfig - | Text2VecPalmConfig - | Text2VecTransformersConfig - | Text2VecVoyageAIConfig - | NoVectorizerConfig; -export type VectorizerConfigType = V extends 'img2vec-neural' - ? Img2VecNeuralConfig | undefined - : V extends 'multi2vec-clip' - ? Multi2VecClipConfig | undefined - : V extends 'multi2vec-bind' - ? Multi2VecBindConfig | undefined - : V extends 'multi2vec-google' - ? Multi2VecGoogleConfig - : V extends Multi2VecPalmVectorizer - ? Multi2VecPalmConfig - : V extends 'ref2vec-centroid' - ? Ref2VecCentroidConfig - : V extends 'text2vec-aws' - ? Text2VecAWSConfig - : V extends 'text2vec-contextionary' - ? Text2VecContextionaryConfig | undefined - : V extends 'text2vec-cohere' - ? Text2VecCohereConfig | undefined - : V extends 'text2vec-databricks' - ? Text2VecDatabricksConfig - : V extends 'text2vec-google' - ? Text2VecGoogleConfig | undefined - : V extends 'text2vec-gpt4all' - ? Text2VecGPT4AllConfig | undefined - : V extends 'text2vec-huggingface' - ? Text2VecHuggingFaceConfig | undefined - : V extends 'text2vec-jina' - ? Text2VecJinaConfig | undefined - : V extends 'text2vec-mistral' - ? Text2VecMistralConfig | undefined - : V extends 'text2vec-octoai' - ? Text2VecOctoAIConfig | undefined - : V extends 'text2vec-ollama' - ? Text2VecOllamaConfig | undefined - : V extends 'text2vec-openai' - ? Text2VecOpenAIConfig | undefined - : V extends 'text2vec-azure-openai' - ? Text2VecAzureOpenAIConfig - : V extends Text2VecPalmVectorizer - ? Text2VecPalmConfig | undefined - : V extends 'text2vec-transformers' - ? Text2VecTransformersConfig | undefined - : V extends 'text2vec-voyageai' - ? Text2VecVoyageAIConfig | undefined - : V extends 'none' - ? {} - : V extends undefined - ? undefined - : never; -export {}; diff --git a/dist/node/esm/collections/config/types/vectorizer.js b/dist/node/esm/collections/config/types/vectorizer.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/config/types/vectorizer.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/config/utils.d.ts b/dist/node/esm/collections/config/utils.d.ts deleted file mode 100644 index 6cc1d7cf..00000000 --- a/dist/node/esm/collections/config/utils.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { WeaviateClass, WeaviateProperty } from '../../openapi/types.js'; -import { - PropertyConfigCreate, - ReferenceConfigCreate, - ReferenceMultiTargetConfigCreate, - ReferenceSingleTargetConfigCreate, -} from '../configure/types/index.js'; -import { CollectionConfig } from './types/index.js'; -export declare class ReferenceTypeGuards { - static isSingleTarget(ref: ReferenceConfigCreate): ref is ReferenceSingleTargetConfigCreate; - static isMultiTarget(ref: ReferenceConfigCreate): ref is ReferenceMultiTargetConfigCreate; -} -export declare const resolveProperty: ( - prop: PropertyConfigCreate, - vectorizers?: string[] -) => WeaviateProperty; -export declare const resolveReference: ( - ref: ReferenceSingleTargetConfigCreate | ReferenceMultiTargetConfigCreate -) => WeaviateProperty; -export declare const classToCollection: (cls: WeaviateClass) => CollectionConfig; diff --git a/dist/node/esm/collections/config/utils.js b/dist/node/esm/collections/config/utils.js deleted file mode 100644 index d5643ccd..00000000 --- a/dist/node/esm/collections/config/utils.js +++ /dev/null @@ -1,458 +0,0 @@ -var __rest = - (this && this.__rest) || - function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === 'function') - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; - }; -import { WeaviateDeserializationError } from '../../errors.js'; -export class ReferenceTypeGuards { - static isSingleTarget(ref) { - return ref.targetCollection !== undefined; - } - static isMultiTarget(ref) { - return ref.targetCollections !== undefined; - } -} -export const resolveProperty = (prop, vectorizers) => { - const { dataType, nestedProperties, skipVectorization, vectorizePropertyName } = prop, - rest = __rest(prop, ['dataType', 'nestedProperties', 'skipVectorization', 'vectorizePropertyName']); - const moduleConfig = {}; - vectorizers === null || vectorizers === void 0 - ? void 0 - : vectorizers.forEach((vectorizer) => { - moduleConfig[vectorizer] = { - skip: skipVectorization === undefined ? false : skipVectorization, - vectorizePropertyName: vectorizePropertyName === undefined ? true : vectorizePropertyName, - }; - }); - return Object.assign(Object.assign({}, rest), { - dataType: [dataType], - nestedProperties: nestedProperties - ? nestedProperties.map((prop) => resolveNestedProperty(prop)) - : undefined, - moduleConfig: Object.keys(moduleConfig).length > 0 ? moduleConfig : undefined, - }); -}; -const resolveNestedProperty = (prop) => { - const { dataType, nestedProperties } = prop, - rest = __rest(prop, ['dataType', 'nestedProperties']); - return Object.assign(Object.assign({}, rest), { - dataType: [dataType], - nestedProperties: nestedProperties ? nestedProperties.map(resolveNestedProperty) : undefined, - }); -}; -export const resolveReference = (ref) => { - if (ReferenceTypeGuards.isSingleTarget(ref)) { - const { targetCollection } = ref, - rest = __rest(ref, ['targetCollection']); - return Object.assign(Object.assign({}, rest), { dataType: [targetCollection] }); - } else { - const { targetCollections } = ref, - rest = __rest(ref, ['targetCollections']); - return Object.assign(Object.assign({}, rest), { dataType: targetCollections }); - } -}; -export const classToCollection = (cls) => { - return { - name: ConfigMapping._name(cls.class), - description: cls.description, - generative: ConfigMapping.generative(cls.moduleConfig), - invertedIndex: ConfigMapping.invertedIndex(cls.invertedIndexConfig), - multiTenancy: ConfigMapping.multiTenancy(cls.multiTenancyConfig), - properties: ConfigMapping.properties(cls.properties), - references: ConfigMapping.references(cls.properties), - replication: ConfigMapping.replication(cls.replicationConfig), - reranker: ConfigMapping.reranker(cls.moduleConfig), - sharding: ConfigMapping.sharding(cls.shardingConfig), - vectorizers: ConfigMapping.vectorizer(cls), - }; -}; -function populated(v) { - return v !== undefined && v !== null; -} -function exists(v) { - return v !== undefined && v !== null; -} -class ConfigMapping { - static _name(v) { - if (v === undefined) - throw new WeaviateDeserializationError('Collection name was not returned by Weaviate'); - return v; - } - static bm25(v) { - if (v === undefined) throw new WeaviateDeserializationError('BM25 was not returned by Weaviate'); - if (!populated(v.b)) throw new WeaviateDeserializationError('BM25 b was not returned by Weaviate'); - if (!populated(v.k1)) throw new WeaviateDeserializationError('BM25 k1 was not returned by Weaviate'); - return { - b: v.b, - k1: v.k1, - }; - } - static stopwords(v) { - if (v === undefined) throw new WeaviateDeserializationError('Stopwords were not returned by Weaviate'); - return { - additions: v.additions ? v.additions : [], - preset: v.preset ? v.preset : 'none', - removals: v.removals ? v.removals : [], - }; - } - static generative(v) { - if (!populated(v)) return undefined; - const generativeKey = Object.keys(v).find((k) => k.includes('generative')); - if (generativeKey === undefined) return undefined; - if (!generativeKey) - throw new WeaviateDeserializationError('Generative config was not returned by Weaviate'); - return { - name: generativeKey, - config: v[generativeKey], - }; - } - static reranker(v) { - if (!populated(v)) return undefined; - const rerankerKey = Object.keys(v).find((k) => k.includes('reranker')); - if (rerankerKey === undefined) return undefined; - return { - name: rerankerKey, - config: v[rerankerKey], - }; - } - static namedVectors(v) { - if (!populated(v)) throw new WeaviateDeserializationError('Vector config was not returned by Weaviate'); - const out = {}; - Object.keys(v).forEach((key) => { - const vectorizer = v[key].vectorizer; - if (!populated(vectorizer)) - throw new WeaviateDeserializationError( - `Vectorizer was not returned by Weaviate for ${key} named vector` - ); - const vectorizerNames = Object.keys(vectorizer); - if (vectorizerNames.length !== 1) - throw new WeaviateDeserializationError( - `Expected exactly one vectorizer for ${key} named vector, got ${vectorizerNames.length}` - ); - const vectorizerName = vectorizerNames[0]; - const _a = vectorizer[vectorizerName], - { properties } = _a, - restA = __rest(_a, ['properties']); - const { vectorizeClassName } = restA, - restB = __rest(restA, ['vectorizeClassName']); - out[key] = { - vectorizer: { - name: vectorizerName, - config: Object.assign({ vectorizeCollectionName: vectorizeClassName }, restB), - }, - properties: properties, - indexConfig: ConfigMapping.vectorIndex(v[key].vectorIndexConfig, v[key].vectorIndexType), - indexType: ConfigMapping.vectorIndexType(v[key].vectorIndexType), - }; - }); - return out; - } - static vectorizer(v) { - if (!populated(v)) throw new WeaviateDeserializationError('Schema was not returned by Weaviate'); - if (populated(v.vectorConfig)) { - return ConfigMapping.namedVectors(v.vectorConfig); - } - if (!populated(v.vectorizer)) - throw new WeaviateDeserializationError('Vectorizer was not returned by Weaviate'); - return { - default: { - vectorizer: - v.vectorizer === 'none' - ? { - name: 'none', - config: undefined, - } - : { - name: v.vectorizer, - config: v.moduleConfig - ? Object.assign(Object.assign({}, v.moduleConfig[v.vectorizer]), { - vectorizeCollectionName: v.moduleConfig[v.vectorizer].vectorizeClassName, - }) - : undefined, - }, - indexConfig: ConfigMapping.vectorIndex(v.vectorIndexConfig, v.vectorIndexType), - indexType: ConfigMapping.vectorIndexType(v.vectorIndexType), - }, - }; - } - static invertedIndex(v) { - if (v === undefined) - throw new WeaviateDeserializationError('Inverted index was not returned by Weaviate'); - if (!populated(v.cleanupIntervalSeconds)) - throw new WeaviateDeserializationError('Inverted index cleanup interval was not returned by Weaviate'); - return { - bm25: ConfigMapping.bm25(v.bm25), - cleanupIntervalSeconds: v.cleanupIntervalSeconds, - stopwords: ConfigMapping.stopwords(v.stopwords), - indexNullState: v.indexNullState ? v.indexNullState : false, - indexPropertyLength: v.indexPropertyLength ? v.indexPropertyLength : false, - indexTimestamps: v.indexTimestamps ? v.indexTimestamps : false, - }; - } - static multiTenancy(v) { - if (v === undefined) throw new WeaviateDeserializationError('Multi tenancy was not returned by Weaviate'); - return { - autoTenantActivation: v.autoTenantActivation ? v.autoTenantActivation : false, - autoTenantCreation: v.autoTenantCreation ? v.autoTenantCreation : false, - enabled: v.enabled ? v.enabled : false, - }; - } - static replication(v) { - if (v === undefined) throw new WeaviateDeserializationError('Replication was not returned by Weaviate'); - if (!populated(v.factor)) - throw new WeaviateDeserializationError('Replication factor was not returned by Weaviate'); - return { - factor: v.factor, - asyncEnabled: v.asyncEnabled ? v.asyncEnabled : false, - deletionStrategy: v.deletionStrategy ? v.deletionStrategy : 'NoAutomatedResolution', - }; - } - static sharding(v) { - if (v === undefined) throw new WeaviateDeserializationError('Sharding was not returned by Weaviate'); - if (!exists(v.virtualPerPhysical)) - throw new WeaviateDeserializationError('Sharding enabled was not returned by Weaviate'); - if (!exists(v.desiredCount)) - throw new WeaviateDeserializationError('Sharding desired count was not returned by Weaviate'); - if (!exists(v.actualCount)) - throw new WeaviateDeserializationError('Sharding actual count was not returned by Weaviate'); - if (!exists(v.desiredVirtualCount)) - throw new WeaviateDeserializationError('Sharding desired virtual count was not returned by Weaviate'); - if (!exists(v.actualVirtualCount)) - throw new WeaviateDeserializationError('Sharding actual virtual count was not returned by Weaviate'); - if (!exists(v.key)) throw new WeaviateDeserializationError('Sharding key was not returned by Weaviate'); - if (!exists(v.strategy)) - throw new WeaviateDeserializationError('Sharding strategy was not returned by Weaviate'); - if (!exists(v.function)) - throw new WeaviateDeserializationError('Sharding function was not returned by Weaviate'); - return { - virtualPerPhysical: v.virtualPerPhysical, - desiredCount: v.desiredCount, - actualCount: v.actualCount, - desiredVirtualCount: v.desiredVirtualCount, - actualVirtualCount: v.actualVirtualCount, - key: v.key, - strategy: v.strategy, - function: v.function, - }; - } - static pqEncoder(v) { - if (v === undefined) throw new WeaviateDeserializationError('PQ encoder was not returned by Weaviate'); - if (!exists(v.type)) - throw new WeaviateDeserializationError('PQ encoder name was not returned by Weaviate'); - if (!exists(v.distribution)) - throw new WeaviateDeserializationError('PQ encoder distribution was not returned by Weaviate'); - return { - type: v.type, - distribution: v.distribution, - }; - } - static pq(v) { - if (v === undefined) throw new WeaviateDeserializationError('PQ was not returned by Weaviate'); - if (!exists(v.enabled)) throw new WeaviateDeserializationError('PQ enabled was not returned by Weaviate'); - if (v.enabled === false) return undefined; - if (!exists(v.bitCompression)) - throw new WeaviateDeserializationError('PQ bit compression was not returned by Weaviate'); - if (!exists(v.segments)) - throw new WeaviateDeserializationError('PQ segments was not returned by Weaviate'); - if (!exists(v.trainingLimit)) - throw new WeaviateDeserializationError('PQ training limit was not returned by Weaviate'); - if (!exists(v.centroids)) - throw new WeaviateDeserializationError('PQ centroids was not returned by Weaviate'); - if (!exists(v.encoder)) throw new WeaviateDeserializationError('PQ encoder was not returned by Weaviate'); - return { - bitCompression: v.bitCompression, - segments: v.segments, - centroids: v.centroids, - trainingLimit: v.trainingLimit, - encoder: ConfigMapping.pqEncoder(v.encoder), - type: 'pq', - }; - } - static vectorIndexHNSW(v) { - if (v === undefined) throw new WeaviateDeserializationError('Vector index was not returned by Weaviate'); - if (!exists(v.cleanupIntervalSeconds)) - throw new WeaviateDeserializationError('Vector index cleanup interval was not returned by Weaviate'); - if (!exists(v.distance)) - throw new WeaviateDeserializationError('Vector index distance was not returned by Weaviate'); - if (!exists(v.dynamicEfMin)) - throw new WeaviateDeserializationError('Vector index dynamic ef min was not returned by Weaviate'); - if (!exists(v.dynamicEfMax)) - throw new WeaviateDeserializationError('Vector index dynamic ef max was not returned by Weaviate'); - if (!exists(v.dynamicEfFactor)) - throw new WeaviateDeserializationError('Vector index dynamic ef factor was not returned by Weaviate'); - if (!exists(v.ef)) throw new WeaviateDeserializationError('Vector index ef was not returned by Weaviate'); - if (!exists(v.efConstruction)) - throw new WeaviateDeserializationError('Vector index ef construction was not returned by Weaviate'); - if (!exists(v.flatSearchCutoff)) - throw new WeaviateDeserializationError('Vector index flat search cut off was not returned by Weaviate'); - if (!exists(v.maxConnections)) - throw new WeaviateDeserializationError('Vector index max connections was not returned by Weaviate'); - if (!exists(v.skip)) - throw new WeaviateDeserializationError('Vector index skip was not returned by Weaviate'); - if (!exists(v.vectorCacheMaxObjects)) - throw new WeaviateDeserializationError( - 'Vector index vector cache max objects was not returned by Weaviate' - ); - let quantizer; - if (exists(v.pq) && v.pq.enabled === true) { - quantizer = ConfigMapping.pq(v.pq); - } else if (exists(v.bq) && v.bq.enabled === true) { - quantizer = ConfigMapping.bq(v.bq); - } else if (exists(v.sq) && v.sq.enabled === true) { - quantizer = ConfigMapping.sq(v.sq); - } else { - quantizer = undefined; - } - return { - cleanupIntervalSeconds: v.cleanupIntervalSeconds, - distance: v.distance, - dynamicEfMin: v.dynamicEfMin, - dynamicEfMax: v.dynamicEfMax, - dynamicEfFactor: v.dynamicEfFactor, - ef: v.ef, - efConstruction: v.efConstruction, - filterStrategy: exists(v.filterStrategy) ? v.filterStrategy : 'sweeping', - flatSearchCutoff: v.flatSearchCutoff, - maxConnections: v.maxConnections, - quantizer: quantizer, - skip: v.skip, - vectorCacheMaxObjects: v.vectorCacheMaxObjects, - type: 'hnsw', - }; - } - static bq(v) { - if (v === undefined) throw new WeaviateDeserializationError('BQ was not returned by Weaviate'); - if (!exists(v.enabled)) throw new WeaviateDeserializationError('BQ enabled was not returned by Weaviate'); - if (v.enabled === false) return undefined; - const cache = v.cache === undefined ? false : v.cache; - const rescoreLimit = v.rescoreLimit === undefined ? 1000 : v.rescoreLimit; - return { - cache, - rescoreLimit, - type: 'bq', - }; - } - static sq(v) { - if (v === undefined) throw new WeaviateDeserializationError('SQ was not returned by Weaviate'); - if (!exists(v.enabled)) throw new WeaviateDeserializationError('SQ enabled was not returned by Weaviate'); - if (v.enabled === false) return undefined; - const rescoreLimit = v.rescoreLimit === undefined ? 1000 : v.rescoreLimit; - const trainingLimit = v.trainingLimit === undefined ? 100000 : v.trainingLimit; - return { - rescoreLimit, - trainingLimit, - type: 'sq', - }; - } - static vectorIndexFlat(v) { - if (v === undefined) throw new WeaviateDeserializationError('Vector index was not returned by Weaviate'); - if (!exists(v.vectorCacheMaxObjects)) - throw new WeaviateDeserializationError( - 'Vector index vector cache max objects was not returned by Weaviate' - ); - if (!exists(v.distance)) - throw new WeaviateDeserializationError('Vector index distance was not returned by Weaviate'); - if (!exists(v.bq)) throw new WeaviateDeserializationError('Vector index bq was not returned by Weaviate'); - return { - vectorCacheMaxObjects: v.vectorCacheMaxObjects, - distance: v.distance, - quantizer: ConfigMapping.bq(v.bq), - type: 'flat', - }; - } - static vectorIndexDynamic(v) { - if (v === undefined) throw new WeaviateDeserializationError('Vector index was not returned by Weaviate'); - if (!exists(v.threshold)) - throw new WeaviateDeserializationError('Vector index threshold was not returned by Weaviate'); - if (!exists(v.distance)) - throw new WeaviateDeserializationError('Vector index distance was not returned by Weaviate'); - if (!exists(v.hnsw)) - throw new WeaviateDeserializationError('Vector index hnsw was not returned by Weaviate'); - if (!exists(v.flat)) - throw new WeaviateDeserializationError('Vector index flat was not returned by Weaviate'); - return { - distance: v.distance, - hnsw: ConfigMapping.vectorIndexHNSW(v.hnsw), - flat: ConfigMapping.vectorIndexFlat(v.flat), - threshold: v.threshold, - type: 'dynamic', - }; - } - static vectorIndex(v, t) { - if (t === 'hnsw') { - return ConfigMapping.vectorIndexHNSW(v); - } else if (t === 'flat') { - return ConfigMapping.vectorIndexFlat(v); - } else if (t === 'dynamic') { - return ConfigMapping.vectorIndexDynamic(v); - } else { - return v; - } - } - static vectorIndexType(v) { - if (!populated(v)) - throw new WeaviateDeserializationError('Vector index type was not returned by Weaviate'); - return v; - } - static properties(v) { - if (v === undefined) throw new WeaviateDeserializationError('Properties were not returned by Weaviate'); - if (v === null) return []; - return v - .filter((prop) => { - if (!populated(prop.dataType)) - throw new WeaviateDeserializationError('Property data type was not returned by Weaviate'); - return prop.dataType[0][0].toLowerCase() === prop.dataType[0][0]; // primitive property, e.g. text - }) - .map((prop) => { - if (!populated(prop.name)) - throw new WeaviateDeserializationError('Property name was not returned by Weaviate'); - if (!populated(prop.dataType)) - throw new WeaviateDeserializationError('Property data type was not returned by Weaviate'); - return { - name: prop.name, - dataType: prop.dataType[0], - description: prop.description, - indexFilterable: prop.indexFilterable ? prop.indexFilterable : false, - indexInverted: prop.indexInverted ? prop.indexInverted : false, - indexRangeFilters: prop.indexRangeFilters ? prop.indexRangeFilters : false, - indexSearchable: prop.indexSearchable ? prop.indexSearchable : false, - vectorizerConfig: prop.moduleConfig - ? 'none' in prop.moduleConfig - ? undefined - : prop.moduleConfig - : undefined, - nestedProperties: prop.nestedProperties - ? ConfigMapping.properties(prop.nestedProperties) - : undefined, - tokenization: prop.tokenization ? prop.tokenization : 'none', - }; - }); - } - static references(v) { - if (v === undefined) throw new WeaviateDeserializationError('Properties were not returned by Weaviate'); - if (v === null) return []; - return v - .filter((prop) => { - if (!populated(prop.dataType)) - throw new WeaviateDeserializationError('Reference data type was not returned by Weaviate'); - return prop.dataType[0][0].toLowerCase() !== prop.dataType[0][0]; // reference property, e.g. Myclass - }) - .map((prop) => { - if (!populated(prop.name)) - throw new WeaviateDeserializationError('Reference name was not returned by Weaviate'); - if (!populated(prop.dataType)) - throw new WeaviateDeserializationError('Reference data type was not returned by Weaviate'); - return { - name: prop.name, - description: prop.description, - targetCollections: prop.dataType, - }; - }); - } -} diff --git a/dist/node/esm/collections/configure/generative.d.ts b/dist/node/esm/collections/configure/generative.d.ts deleted file mode 100644 index 69ac1012..00000000 --- a/dist/node/esm/collections/configure/generative.d.ts +++ /dev/null @@ -1,172 +0,0 @@ -import { - GenerativeAWSConfig, - GenerativeAnthropicConfig, - GenerativeAnyscaleConfig, - GenerativeAzureOpenAIConfig, - GenerativeCohereConfig, - GenerativeDatabricksConfig, - GenerativeFriendliAIConfig, - GenerativeGoogleConfig, - GenerativeMistralConfig, - GenerativeOctoAIConfig, - GenerativeOllamaConfig, - GenerativeOpenAIConfig, - GenerativePaLMConfig, - ModuleConfig, -} from '../config/types/index.js'; -import { - GenerativeAWSConfigCreate, - GenerativeAnthropicConfigCreate, - GenerativeAnyscaleConfigCreate, - GenerativeAzureOpenAIConfigCreate, - GenerativeCohereConfigCreate, - GenerativeDatabricksConfigCreate, - GenerativeFriendliAIConfigCreate, - GenerativeMistralConfigCreate, - GenerativeOctoAIConfigCreate, - GenerativeOllamaConfigCreate, - GenerativeOpenAIConfigCreate, - GenerativePaLMConfigCreate, -} from '../index.js'; -declare const _default: { - /** - * Create a `ModuleConfig<'generative-anthropic', GenerativeAnthropicConfig | undefined>` object for use when performing AI generation using the `generative-anthropic` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/anthropic/generative) for detailed usage. - * - * @param {GenerativeAnthropicConfigCreate} [config] The configuration for the `generative-anthropic` module. - * @returns {ModuleConfig<'generative-anthropic', GenerativeAnthropicConfig | undefined>} The configuration object. - */ - anthropic( - config?: GenerativeAnthropicConfigCreate - ): ModuleConfig<'generative-anthropic', GenerativeAnthropicConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-anyscale', GenerativeAnyscaleConfig | undefined>` object for use when performing AI generation using the `generative-anyscale` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/anyscale/generative) for detailed usage. - * - * @param {GenerativeAnyscaleConfigCreate} [config] The configuration for the `generative-aws` module. - * @returns {ModuleConfig<'generative-anyscale', GenerativeAnyscaleConfig | undefined>} The configuration object. - */ - anyscale( - config?: GenerativeAnyscaleConfigCreate - ): ModuleConfig<'generative-anyscale', GenerativeAnyscaleConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-aws', GenerativeAWSConfig>` object for use when performing AI generation using the `generative-aws` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/aws/generative) for detailed usage. - * - * @param {GenerativeAWSConfigCreate} config The configuration for the `generative-aws` module. - * @returns {ModuleConfig<'generative-aws', GenerativeAWSConfig>} The configuration object. - */ - aws(config: GenerativeAWSConfigCreate): ModuleConfig<'generative-aws', GenerativeAWSConfig>; - /** - * Create a `ModuleConfig<'generative-openai', GenerativeAzureOpenAIConfig>` object for use when performing AI generation using the `generative-openai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/generative) for detailed usage. - * - * @param {GenerativeAzureOpenAIConfigCreate} config The configuration for the `generative-openai` module. - * @returns {ModuleConfig<'generative-openai', GenerativeAzureOpenAIConfig>} The configuration object. - */ - azureOpenAI: ( - config: GenerativeAzureOpenAIConfigCreate - ) => ModuleConfig<'generative-openai', GenerativeAzureOpenAIConfig>; - /** - * Create a `ModuleConfig<'generative-cohere', GenerativeCohereConfig>` object for use when performing AI generation using the `generative-cohere` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/generative) for detailed usage. - * - * @param {GenerativeCohereConfigCreate} [config] The configuration for the `generative-cohere` module. - * @returns {ModuleConfig<'generative-cohere', GenerativeCohereConfig | undefined>} The configuration object. - */ - cohere: ( - config?: GenerativeCohereConfigCreate - ) => ModuleConfig<'generative-cohere', GenerativeCohereConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-databricks', GenerativeDatabricksConfig>` object for use when performing AI generation using the `generative-databricks` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/databricks/generative) for detailed usage. - * - * @param {GenerativeDatabricksConfigCreate} config The configuration for the `generative-databricks` module. - * @returns {ModuleConfig<'generative-databricks', GenerativeDatabricksConfig>} The configuration object. - */ - databricks: ( - config: GenerativeDatabricksConfigCreate - ) => ModuleConfig<'generative-databricks', GenerativeDatabricksConfig>; - /** - * Create a `ModuleConfig<'generative-friendliai', GenerativeFriendliAIConfig | undefined>` object for use when performing AI generation using the `generative-friendliai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/friendliai/generative) for detailed usage. - */ - friendliai( - config?: GenerativeFriendliAIConfigCreate - ): ModuleConfig<'generative-friendliai', GenerativeFriendliAIConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-mistral', GenerativeMistralConfig | undefined>` object for use when performing AI generation using the `generative-mistral` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/mistral/generative) for detailed usage. - * - * @param {GenerativeMistralConfigCreate} [config] The configuration for the `generative-mistral` module. - * @returns {ModuleConfig<'generative-mistral', GenerativeMistralConfig | undefined>} The configuration object. - */ - mistral( - config?: GenerativeMistralConfigCreate - ): ModuleConfig<'generative-mistral', GenerativeMistralConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-octoai', GenerativeOpenAIConfig | undefined>` object for use when performing AI generation using the `generative-octoai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/octoai/generative) for detailed usage. - * - * @param {GenerativeOctoAIConfigCreate} [config] The configuration for the `generative-octoai` module. - * @returns {ModuleConfig<'generative-octoai', GenerativeOctoAIConfig | undefined>} The configuration object. - */ - octoai( - config?: GenerativeOctoAIConfigCreate - ): ModuleConfig<'generative-octoai', GenerativeOctoAIConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-ollama', GenerativeOllamaConfig | undefined>` object for use when performing AI generation using the `generative-ollama` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/ollama/generative) for detailed usage. - * - * @param {GenerativeOllamaConfigCreate} [config] The configuration for the `generative-openai` module. - * @returns {ModuleConfig<'generative-ollama', GenerativeOllamaConfig | undefined>} The configuration object. - */ - ollama( - config?: GenerativeOllamaConfigCreate - ): ModuleConfig<'generative-ollama', GenerativeOllamaConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-openai', GenerativeOpenAIConfig | undefined>` object for use when performing AI generation using the `generative-openai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/generative) for detailed usage. - * - * @param {GenerativeOpenAIConfigCreate} [config] The configuration for the `generative-openai` module. - * @returns {ModuleConfig<'generative-openai', GenerativeOpenAIConfig | undefined>} The configuration object. - */ - openAI: ( - config?: GenerativeOpenAIConfigCreate - ) => ModuleConfig<'generative-openai', GenerativeOpenAIConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-palm', GenerativePaLMConfig>` object for use when performing AI generation using the `generative-palm` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/generative) for detailed usage. - * - * @param {GenerativePaLMConfigCreate} [config] The configuration for the `generative-palm` module. - * @returns {ModuleConfig<'generative-palm', GenerativePaLMConfig>} The configuration object. - * @deprecated Use `google` instead. - */ - palm: ( - config?: GenerativePaLMConfigCreate - ) => ModuleConfig<'generative-palm', GenerativePaLMConfig | undefined>; - /** - * Create a `ModuleConfig<'generative-google', GenerativeGoogleConfig>` object for use when performing AI generation using the `generative-google` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/generative) for detailed usage. - * - * @param {GenerativePaLMConfigCreate} [config] The configuration for the `generative-palm` module. - * @returns {ModuleConfig<'generative-palm', GenerativePaLMConfig>} The configuration object. - */ - google: ( - config?: GenerativePaLMConfigCreate - ) => ModuleConfig<'generative-google', GenerativeGoogleConfig | undefined>; -}; -export default _default; diff --git a/dist/node/esm/collections/configure/generative.js b/dist/node/esm/collections/configure/generative.js deleted file mode 100644 index 5cf6facd..00000000 --- a/dist/node/esm/collections/configure/generative.js +++ /dev/null @@ -1,211 +0,0 @@ -export default { - /** - * Create a `ModuleConfig<'generative-anthropic', GenerativeAnthropicConfig | undefined>` object for use when performing AI generation using the `generative-anthropic` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/anthropic/generative) for detailed usage. - * - * @param {GenerativeAnthropicConfigCreate} [config] The configuration for the `generative-anthropic` module. - * @returns {ModuleConfig<'generative-anthropic', GenerativeAnthropicConfig | undefined>} The configuration object. - */ - anthropic(config) { - return { - name: 'generative-anthropic', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-anyscale', GenerativeAnyscaleConfig | undefined>` object for use when performing AI generation using the `generative-anyscale` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/anyscale/generative) for detailed usage. - * - * @param {GenerativeAnyscaleConfigCreate} [config] The configuration for the `generative-aws` module. - * @returns {ModuleConfig<'generative-anyscale', GenerativeAnyscaleConfig | undefined>} The configuration object. - */ - anyscale(config) { - return { - name: 'generative-anyscale', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-aws', GenerativeAWSConfig>` object for use when performing AI generation using the `generative-aws` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/aws/generative) for detailed usage. - * - * @param {GenerativeAWSConfigCreate} config The configuration for the `generative-aws` module. - * @returns {ModuleConfig<'generative-aws', GenerativeAWSConfig>} The configuration object. - */ - aws(config) { - return { - name: 'generative-aws', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-openai', GenerativeAzureOpenAIConfig>` object for use when performing AI generation using the `generative-openai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/generative) for detailed usage. - * - * @param {GenerativeAzureOpenAIConfigCreate} config The configuration for the `generative-openai` module. - * @returns {ModuleConfig<'generative-openai', GenerativeAzureOpenAIConfig>} The configuration object. - */ - azureOpenAI: (config) => { - return { - name: 'generative-openai', - config: { - deploymentId: config.deploymentId, - resourceName: config.resourceName, - baseURL: config.baseURL, - frequencyPenaltyProperty: config.frequencyPenalty, - maxTokensProperty: config.maxTokens, - presencePenaltyProperty: config.presencePenalty, - temperatureProperty: config.temperature, - topPProperty: config.topP, - }, - }; - }, - /** - * Create a `ModuleConfig<'generative-cohere', GenerativeCohereConfig>` object for use when performing AI generation using the `generative-cohere` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/generative) for detailed usage. - * - * @param {GenerativeCohereConfigCreate} [config] The configuration for the `generative-cohere` module. - * @returns {ModuleConfig<'generative-cohere', GenerativeCohereConfig | undefined>} The configuration object. - */ - cohere: (config) => { - return { - name: 'generative-cohere', - config: config - ? { - kProperty: config.k, - maxTokensProperty: config.maxTokens, - model: config.model, - returnLikelihoodsProperty: config.returnLikelihoods, - stopSequencesProperty: config.stopSequences, - temperatureProperty: config.temperature, - } - : undefined, - }; - }, - /** - * Create a `ModuleConfig<'generative-databricks', GenerativeDatabricksConfig>` object for use when performing AI generation using the `generative-databricks` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/databricks/generative) for detailed usage. - * - * @param {GenerativeDatabricksConfigCreate} config The configuration for the `generative-databricks` module. - * @returns {ModuleConfig<'generative-databricks', GenerativeDatabricksConfig>} The configuration object. - */ - databricks: (config) => { - return { - name: 'generative-databricks', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-friendliai', GenerativeFriendliAIConfig | undefined>` object for use when performing AI generation using the `generative-friendliai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/friendliai/generative) for detailed usage. - */ - friendliai(config) { - return { - name: 'generative-friendliai', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-mistral', GenerativeMistralConfig | undefined>` object for use when performing AI generation using the `generative-mistral` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/mistral/generative) for detailed usage. - * - * @param {GenerativeMistralConfigCreate} [config] The configuration for the `generative-mistral` module. - * @returns {ModuleConfig<'generative-mistral', GenerativeMistralConfig | undefined>} The configuration object. - */ - mistral(config) { - return { - name: 'generative-mistral', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-octoai', GenerativeOpenAIConfig | undefined>` object for use when performing AI generation using the `generative-octoai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/octoai/generative) for detailed usage. - * - * @param {GenerativeOctoAIConfigCreate} [config] The configuration for the `generative-octoai` module. - * @returns {ModuleConfig<'generative-octoai', GenerativeOctoAIConfig | undefined>} The configuration object. - */ - octoai(config) { - return { - name: 'generative-octoai', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-ollama', GenerativeOllamaConfig | undefined>` object for use when performing AI generation using the `generative-ollama` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/ollama/generative) for detailed usage. - * - * @param {GenerativeOllamaConfigCreate} [config] The configuration for the `generative-openai` module. - * @returns {ModuleConfig<'generative-ollama', GenerativeOllamaConfig | undefined>} The configuration object. - */ - ollama(config) { - return { - name: 'generative-ollama', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-openai', GenerativeOpenAIConfig | undefined>` object for use when performing AI generation using the `generative-openai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/generative) for detailed usage. - * - * @param {GenerativeOpenAIConfigCreate} [config] The configuration for the `generative-openai` module. - * @returns {ModuleConfig<'generative-openai', GenerativeOpenAIConfig | undefined>} The configuration object. - */ - openAI: (config) => { - return { - name: 'generative-openai', - config: config - ? { - baseURL: config.baseURL, - frequencyPenaltyProperty: config.frequencyPenalty, - maxTokensProperty: config.maxTokens, - model: config.model, - presencePenaltyProperty: config.presencePenalty, - temperatureProperty: config.temperature, - topPProperty: config.topP, - } - : undefined, - }; - }, - /** - * Create a `ModuleConfig<'generative-palm', GenerativePaLMConfig>` object for use when performing AI generation using the `generative-palm` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/generative) for detailed usage. - * - * @param {GenerativePaLMConfigCreate} [config] The configuration for the `generative-palm` module. - * @returns {ModuleConfig<'generative-palm', GenerativePaLMConfig>} The configuration object. - * @deprecated Use `google` instead. - */ - palm: (config) => { - console.warn('The `generative-palm` module is deprecated. Use `generative-google` instead.'); - return { - name: 'generative-palm', - config, - }; - }, - /** - * Create a `ModuleConfig<'generative-google', GenerativeGoogleConfig>` object for use when performing AI generation using the `generative-google` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/generative) for detailed usage. - * - * @param {GenerativePaLMConfigCreate} [config] The configuration for the `generative-palm` module. - * @returns {ModuleConfig<'generative-palm', GenerativePaLMConfig>} The configuration object. - */ - google: (config) => { - return { - name: 'generative-google', - config, - }; - }, -}; diff --git a/dist/node/esm/collections/configure/index.d.ts b/dist/node/esm/collections/configure/index.d.ts deleted file mode 100644 index d75f0b04..00000000 --- a/dist/node/esm/collections/configure/index.d.ts +++ /dev/null @@ -1,889 +0,0 @@ -import { - InvertedIndexConfigCreate, - InvertedIndexConfigUpdate, - MultiTenancyConfigCreate, - ReplicationConfigCreate, - ReplicationConfigUpdate, - ReplicationDeletionStrategy, - ShardingConfigCreate, - VectorConfigUpdate, - VectorizerUpdateOptions, -} from '../types/index.js'; -import generative from './generative.js'; -import reranker from './reranker.js'; -import { configure as configureVectorIndex } from './vectorIndex.js'; -import { vectorizer } from './vectorizer.js'; -declare const dataType: { - INT: 'int'; - INT_ARRAY: 'int[]'; - NUMBER: 'number'; - NUMBER_ARRAY: 'number[]'; - TEXT: 'text'; - TEXT_ARRAY: 'text[]'; - UUID: 'uuid'; - UUID_ARRAY: 'uuid[]'; - BOOLEAN: 'boolean'; - BOOLEAN_ARRAY: 'boolean[]'; - DATE: 'date'; - DATE_ARRAY: 'date[]'; - OBJECT: 'object'; - OBJECT_ARRAY: 'object[]'; - BLOB: 'blob'; - GEO_COORDINATES: 'geoCoordinates'; - PHONE_NUMBER: 'phoneNumber'; -}; -declare const tokenization: { - WORD: 'word'; - LOWERCASE: 'lowercase'; - WHITESPACE: 'whitespace'; - FIELD: 'field'; - TRIGRAM: 'trigram'; - GSE: 'gse'; - KAGOME_KR: 'kagome_kr'; -}; -declare const vectorDistances: { - COSINE: 'cosine'; - DOT: 'dot'; - HAMMING: 'hamming'; - L2_SQUARED: 'l2-squared'; -}; -declare const configure: { - generative: { - anthropic( - config?: import('../types/index.js').GenerativeAnthropicConfig | undefined - ): import('../types/index.js').ModuleConfig< - 'generative-anthropic', - import('../types/index.js').GenerativeAnthropicConfig | undefined - >; - anyscale( - config?: import('../types/index.js').GenerativeAnyscaleConfig | undefined - ): import('../types/index.js').ModuleConfig< - 'generative-anyscale', - import('../types/index.js').GenerativeAnyscaleConfig | undefined - >; - aws( - config: import('../types/index.js').GenerativeAWSConfig - ): import('../types/index.js').ModuleConfig< - 'generative-aws', - import('../types/index.js').GenerativeAWSConfig - >; - azureOpenAI: ( - config: import('./types/generative.js').GenerativeAzureOpenAIConfigCreate - ) => import('../types/index.js').ModuleConfig< - 'generative-openai', - import('../types/index.js').GenerativeAzureOpenAIConfig - >; - cohere: ( - config?: import('./types/generative.js').GenerativeCohereConfigCreate | undefined - ) => import('../types/index.js').ModuleConfig< - 'generative-cohere', - import('../types/index.js').GenerativeCohereConfig | undefined - >; - databricks: ( - config: import('../types/index.js').GenerativeDatabricksConfig - ) => import('../types/index.js').ModuleConfig< - 'generative-databricks', - import('../types/index.js').GenerativeDatabricksConfig - >; - friendliai( - config?: import('../types/index.js').GenerativeFriendliAIConfig | undefined - ): import('../types/index.js').ModuleConfig< - 'generative-friendliai', - import('../types/index.js').GenerativeFriendliAIConfig | undefined - >; - mistral( - config?: import('../types/index.js').GenerativeMistralConfig | undefined - ): import('../types/index.js').ModuleConfig< - 'generative-mistral', - import('../types/index.js').GenerativeMistralConfig | undefined - >; - octoai( - config?: import('../types/index.js').GenerativeOctoAIConfig | undefined - ): import('../types/index.js').ModuleConfig< - 'generative-octoai', - import('../types/index.js').GenerativeOctoAIConfig | undefined - >; - ollama( - config?: import('../types/index.js').GenerativeOllamaConfig | undefined - ): import('../types/index.js').ModuleConfig< - 'generative-ollama', - import('../types/index.js').GenerativeOllamaConfig | undefined - >; - openAI: ( - config?: import('./types/generative.js').GenerativeOpenAIConfigCreate | undefined - ) => import('../types/index.js').ModuleConfig< - 'generative-openai', - import('../types/index.js').GenerativeOpenAIConfig | undefined - >; - palm: ( - config?: import('../types/index.js').GenerativeGoogleConfig | undefined - ) => import('../types/index.js').ModuleConfig< - 'generative-palm', - import('../types/index.js').GenerativeGoogleConfig | undefined - >; - google: ( - config?: import('../types/index.js').GenerativeGoogleConfig | undefined - ) => import('../types/index.js').ModuleConfig< - 'generative-google', - import('../types/index.js').GenerativeGoogleConfig | undefined - >; - }; - reranker: { - cohere: ( - config?: import('../types/index.js').RerankerCohereConfig | undefined - ) => import('../types/index.js').ModuleConfig< - 'reranker-cohere', - import('../types/index.js').RerankerCohereConfig | undefined - >; - jinaai: ( - config?: import('../types/index.js').RerankerJinaAIConfig | undefined - ) => import('../types/index.js').ModuleConfig< - 'reranker-jinaai', - import('../types/index.js').RerankerJinaAIConfig | undefined - >; - transformers: () => import('../types/index.js').ModuleConfig< - 'reranker-transformers', - Record - >; - voyageAI: ( - config?: import('../types/index.js').RerankerVoyageAIConfig | undefined - ) => import('../types/index.js').ModuleConfig< - 'reranker-voyageai', - import('../types/index.js').RerankerVoyageAIConfig | undefined - >; - }; - vectorizer: { - none: ( - opts?: - | { - name?: N | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - } - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate; - img2VecNeural: ( - opts: import('../types/index.js').Img2VecNeuralConfig & { - name?: N_1 | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_1, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - } - ) => import('./types/vectorizer.js').VectorConfigCreate; - multi2VecBind: ( - opts?: - | (import('./types/vectorizer.js').Multi2VecBindConfigCreate & { - name?: N_2 | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_2, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate; - multi2VecClip: ( - opts?: - | (import('./types/vectorizer.js').Multi2VecClipConfigCreate & { - name?: N_3 | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_3, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate; - multi2VecPalm: ( - opts: import('./types/vectorizer.js').ConfigureNonTextVectorizerOptions - ) => import('./types/vectorizer.js').VectorConfigCreate; - multi2VecGoogle: ( - opts: import('./types/vectorizer.js').ConfigureNonTextVectorizerOptions - ) => import('./types/vectorizer.js').VectorConfigCreate; - ref2VecCentroid: ( - opts: import('./types/vectorizer.js').ConfigureNonTextVectorizerOptions - ) => import('./types/vectorizer.js').VectorConfigCreate; - text2VecAWS: ( - opts: import('./types/vectorizer.js').ConfigureTextVectorizerOptions - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_7, - I_7, - 'text2vec-aws' - >; - text2VecAzureOpenAI: ( - opts: import('./types/vectorizer.js').ConfigureTextVectorizerOptions< - T_1, - N_8, - I_8, - 'text2vec-azure-openai' - > - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_8, - I_8, - 'text2vec-azure-openai' - >; - text2VecCohere: ( - opts?: - | (import('../types/index.js').Text2VecCohereConfig & { - name?: N_9 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_9, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_9, - I_9, - 'text2vec-cohere' - >; - text2VecContextionary: ( - opts?: - | (import('../types/index.js').Text2VecContextionaryConfig & { - name?: N_10 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_10, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_10, - I_10, - 'text2vec-contextionary' - >; - text2VecDatabricks: ( - opts: import('./types/vectorizer.js').ConfigureTextVectorizerOptions< - T_4, - N_11, - I_11, - 'text2vec-databricks' - > - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_11, - I_11, - 'text2vec-databricks' - >; - text2VecGPT4All: ( - opts?: - | (import('../types/index.js').Text2VecGPT4AllConfig & { - name?: N_12 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_12, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_12, - I_12, - 'text2vec-gpt4all' - >; - text2VecHuggingFace: ( - opts?: - | (import('../types/index.js').Text2VecHuggingFaceConfig & { - name?: N_13 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_13, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_13, - I_13, - 'text2vec-huggingface' - >; - text2VecJina: ( - opts?: - | (import('../types/index.js').Text2VecJinaConfig & { - name?: N_14 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_14, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_14, - I_14, - 'text2vec-jina' - >; - text2VecMistral: ( - opts?: - | (import('../types/index.js').Text2VecMistralConfig & { - name?: N_15 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_15, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_15, - I_15, - 'text2vec-mistral' - >; - text2VecOctoAI: ( - opts?: - | (import('../types/index.js').Text2VecOctoAIConfig & { - name?: N_16 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_16, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_16, - I_16, - 'text2vec-octoai' - >; - text2VecOpenAI: ( - opts?: - | (import('../types/index.js').Text2VecOpenAIConfig & { - name?: N_17 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_17, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_17, - I_17, - 'text2vec-openai' - >; - text2VecOllama: ( - opts?: - | (import('../types/index.js').Text2VecOllamaConfig & { - name?: N_18 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_18, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_18, - I_18, - 'text2vec-ollama' - >; - text2VecPalm: ( - opts?: - | (import('../types/index.js').Text2VecGoogleConfig & { - name?: N_19 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_19, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_19, - I_19, - 'text2vec-palm' - >; - text2VecGoogle: ( - opts?: - | (import('../types/index.js').Text2VecGoogleConfig & { - name?: N_20 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_20, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_20, - I_20, - 'text2vec-google' - >; - text2VecTransformers: ( - opts?: - | (import('../types/index.js').Text2VecTransformersConfig & { - name?: N_21 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_21, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_21, - I_21, - 'text2vec-transformers' - >; - text2VecVoyageAI: ( - opts?: - | (import('../types/index.js').Text2VecVoyageAIConfig & { - name?: N_22 | undefined; - sourceProperties?: import('../types/internal.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../types/index.js').ModuleConfig< - I_22, - import('./types/vectorIndex.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./types/vectorizer.js').VectorConfigCreate< - import('../types/internal.js').PrimitiveKeys, - N_22, - I_22, - 'text2vec-voyageai' - >; - }; - vectorIndex: { - flat: ( - opts?: import('./types/vectorIndex.js').VectorIndexConfigFlatCreateOptions | undefined - ) => import('../types/index.js').ModuleConfig< - 'flat', - | { - distance?: import('../types/index.js').VectorDistance | undefined; - vectorCacheMaxObjects?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | undefined; - type?: 'flat' | undefined; - } - | undefined - >; - hnsw: ( - opts?: import('./types/vectorIndex.js').VectorIndexConfigHNSWCreateOptions | undefined - ) => import('../types/index.js').ModuleConfig< - 'hnsw', - | { - cleanupIntervalSeconds?: number | undefined; - distance?: import('../types/index.js').VectorDistance | undefined; - dynamicEfMin?: number | undefined; - dynamicEfMax?: number | undefined; - dynamicEfFactor?: number | undefined; - efConstruction?: number | undefined; - ef?: number | undefined; - filterStrategy?: import('../types/index.js').VectorIndexFilterStrategy | undefined; - flatSearchCutoff?: number | undefined; - maxConnections?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | { - bitCompression?: boolean | undefined; - centroids?: number | undefined; - encoder?: - | { - type?: import('../types/index.js').PQEncoderType | undefined; - distribution?: import('../types/index.js').PQEncoderDistribution | undefined; - } - | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - type?: 'pq' | undefined; - } - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - type?: 'sq' | undefined; - } - | undefined; - skip?: boolean | undefined; - vectorCacheMaxObjects?: number | undefined; - type?: 'hnsw' | undefined; - } - | undefined - >; - dynamic: ( - opts?: import('./types/vectorIndex.js').VectorIndexConfigDynamicCreateOptions | undefined - ) => import('../types/index.js').ModuleConfig< - 'dynamic', - | { - distance?: import('../types/index.js').VectorDistance | undefined; - threshold?: number | undefined; - hnsw?: - | { - cleanupIntervalSeconds?: number | undefined; - distance?: import('../types/index.js').VectorDistance | undefined; - dynamicEfMin?: number | undefined; - dynamicEfMax?: number | undefined; - dynamicEfFactor?: number | undefined; - efConstruction?: number | undefined; - ef?: number | undefined; - filterStrategy?: import('../types/index.js').VectorIndexFilterStrategy | undefined; - flatSearchCutoff?: number | undefined; - maxConnections?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | { - bitCompression?: boolean | undefined; - centroids?: number | undefined; - encoder?: - | { - type?: import('../types/index.js').PQEncoderType | undefined; - distribution?: import('../types/index.js').PQEncoderDistribution | undefined; - } - | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - type?: 'pq' | undefined; - } - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - type?: 'sq' | undefined; - } - | undefined; - skip?: boolean | undefined; - vectorCacheMaxObjects?: number | undefined; - type?: 'hnsw' | undefined; - } - | undefined; - flat?: - | { - distance?: import('../types/index.js').VectorDistance | undefined; - vectorCacheMaxObjects?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | undefined; - type?: 'flat' | undefined; - } - | undefined; - type?: 'dynamic' | undefined; - } - | undefined - >; - quantizer: { - bq: ( - options?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - } - | undefined - ) => import('./types/vectorIndex.js').QuantizerRecursivePartial; - pq: ( - options?: - | { - bitCompression?: boolean | undefined; - centroids?: number | undefined; - encoder?: - | { - distribution?: import('../types/index.js').PQEncoderDistribution | undefined; - type?: import('../types/index.js').PQEncoderType | undefined; - } - | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./types/vectorIndex.js').QuantizerRecursivePartial; - sq: ( - options?: - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./types/vectorIndex.js').QuantizerRecursivePartial; - }; - }; - dataType: { - INT: 'int'; - INT_ARRAY: 'int[]'; - NUMBER: 'number'; - NUMBER_ARRAY: 'number[]'; - TEXT: 'text'; - TEXT_ARRAY: 'text[]'; - UUID: 'uuid'; - UUID_ARRAY: 'uuid[]'; - BOOLEAN: 'boolean'; - BOOLEAN_ARRAY: 'boolean[]'; - DATE: 'date'; - DATE_ARRAY: 'date[]'; - OBJECT: 'object'; - OBJECT_ARRAY: 'object[]'; - BLOB: 'blob'; - GEO_COORDINATES: 'geoCoordinates'; - PHONE_NUMBER: 'phoneNumber'; - }; - tokenization: { - WORD: 'word'; - LOWERCASE: 'lowercase'; - WHITESPACE: 'whitespace'; - FIELD: 'field'; - TRIGRAM: 'trigram'; - GSE: 'gse'; - KAGOME_KR: 'kagome_kr'; - }; - vectorDistances: { - COSINE: 'cosine'; - DOT: 'dot'; - HAMMING: 'hamming'; - L2_SQUARED: 'l2-squared'; - }; - /** - * Create an `InvertedIndexConfigCreate` object to be used when defining the configuration of the keyword searching algorithm of your collection. - * - * See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#configure-the-inverted-index) for details! - * - * @param {number} [options.bm25b] The BM25 b parameter. - * @param {number} [options.bm25k1] The BM25 k1 parameter. - * @param {number} [options.cleanupIntervalSeconds] The interval in seconds at which the inverted index is cleaned up. - * @param {boolean} [options.indexTimestamps] Whether to index timestamps. - * @param {boolean} [options.indexPropertyLength] Whether to index the length of properties. - * @param {boolean} [options.indexNullState] Whether to index the null state of properties. - * @param {'en' | 'none'} [options.stopwordsPreset] The stopwords preset to use. - * @param {string[]} [options.stopwordsAdditions] Additional stopwords to add. - * @param {string[]} [options.stopwordsRemovals] Stopwords to remove. - */ - invertedIndex: (options: { - bm25b?: number; - bm25k1?: number; - cleanupIntervalSeconds?: number; - indexTimestamps?: boolean; - indexPropertyLength?: boolean; - indexNullState?: boolean; - stopwordsPreset?: 'en' | 'none'; - stopwordsAdditions?: string[]; - stopwordsRemovals?: string[]; - }) => InvertedIndexConfigCreate; - /** - * Create a `MultiTenancyConfigCreate` object to be used when defining the multi-tenancy configuration of your collection. - * - * @param {boolean} [options.autoTenantActivation] Whether auto-tenant activation is enabled. Default is false. - * @param {boolean} [options.autoTenantCreation] Whether auto-tenant creation is enabled. Default is false. - * @param {boolean} [options.enabled] Whether multi-tenancy is enabled. Default is true. - */ - multiTenancy: (options?: { - autoTenantActivation?: boolean; - autoTenantCreation?: boolean; - enabled?: boolean; - }) => MultiTenancyConfigCreate; - /** - * Create a `ReplicationConfigCreate` object to be used when defining the replication configuration of your collection. - * - * NOTE: You can only use one of Sharding or Replication, not both. - * - * See [the docs](https://weaviate.io/developers/weaviate/concepts/replication-architecture#replication-vs-sharding) for more details. - * - * @param {boolean} [options.asyncEnabled] Whether asynchronous replication is enabled. Default is false. - * @param {ReplicationDeletionStrategy} [options.deletionStrategy] The deletion strategy when replication conflicts are detected between deletes and reads. - * @param {number} [options.factor] The replication factor. Default is 1. - */ - replication: (options: { - asyncEnabled?: boolean; - deletionStrategy?: ReplicationDeletionStrategy; - factor?: number; - }) => ReplicationConfigCreate; - /** - * Create a `ShardingConfigCreate` object to be used when defining the sharding configuration of your collection. - * - * NOTE: You can only use one of Sharding or Replication, not both. - * - * See [the docs](https://weaviate.io/developers/weaviate/concepts/replication-architecture#replication-vs-sharding) for more details. - * - * @param {number} [options.virtualPerPhysical] The number of virtual shards per physical shard. - * @param {number} [options.desiredCount] The desired number of physical shards. - * @param {number} [options.desiredVirtualCount] The desired number of virtual shards. - */ - sharding: (options: { - virtualPerPhysical?: number; - desiredCount?: number; - desiredVirtualCount?: number; - }) => ShardingConfigCreate; -}; -declare const reconfigure: { - vectorIndex: { - flat: (options: { - vectorCacheMaxObjects?: number | undefined; - quantizer?: import('./types/vectorIndex.js').BQConfigUpdate | undefined; - }) => import('../types/index.js').ModuleConfig< - 'flat', - import('./types/vectorIndex.js').VectorIndexConfigFlatUpdate - >; - hnsw: (options: { - dynamicEfFactor?: number | undefined; - dynamicEfMax?: number | undefined; - dynamicEfMin?: number | undefined; - ef?: number | undefined; - flatSearchCutoff?: number | undefined; - quantizer?: - | import('./types/vectorIndex.js').PQConfigUpdate - | import('./types/vectorIndex.js').BQConfigUpdate - | import('./types/vectorIndex.js').SQConfigUpdate - | undefined; - vectorCacheMaxObjects?: number | undefined; - /** - * Create a `ReplicationConfigUpdate` object to be used when defining the replication configuration of Weaviate. - * - * See [the docs](https://weaviate.io/developers/weaviate/concepts/replication-architecture#replication-vs-sharding) for more details. - * - * @param {boolean} [options.asyncEnabled] Whether asynchronous replication is enabled. - * @param {ReplicationDeletionStrategy} [options.deletionStrategy] The deletion strategy when replication conflicts are detected between deletes and reads. - * @param {number} [options.factor] The replication factor. - */ - }) => import('../types/index.js').ModuleConfig< - 'hnsw', - import('./types/vectorIndex.js').VectorIndexConfigHNSWUpdate - >; - quantizer: { - bq: ( - options?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - } - | undefined - ) => import('./types/vectorIndex.js').BQConfigUpdate; - pq: ( - options?: - | { - centroids?: number | undefined; - pqEncoderDistribution?: import('../types/index.js').PQEncoderDistribution | undefined; - pqEncoderType?: import('../types/index.js').PQEncoderType | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./types/vectorIndex.js').PQConfigUpdate; - sq: ( - options?: - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./types/vectorIndex.js').SQConfigUpdate; - }; - }; - /** - * Create an `InvertedIndexConfigUpdate` object to be used when updating the configuration of the keyword searching algorithm of your collection. - * - * See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#configure-the-inverted-index) for details! - * - * @param {number} [options.bm25b] The BM25 b parameter. - * @param {number} [options.bm25k1] The BM25 k1 parameter. - * @param {number} [options.cleanupIntervalSeconds] The interval in seconds at which the inverted index is cleaned up. - * @param {'en' | 'none'} [options.stopwordsPreset] The stopwords preset to use. - * @param {string[]} [options.stopwordsAdditions] Additional stopwords to add. - * @param {string[]} [options.stopwordsRemovals] Stopwords to remove. - */ - invertedIndex: (options: { - bm25b?: number; - bm25k1?: number; - cleanupIntervalSeconds?: number; - stopwordsPreset?: 'en' | 'none'; - stopwordsAdditions?: string[]; - stopwordsRemovals?: string[]; - }) => InvertedIndexConfigUpdate; - vectorizer: { - /** - * Create a `VectorConfigUpdate` object to be used when updating the named vector configuration of Weaviate. - * - * @param {string} name The name of the vector. - * @param {VectorizerOptions} options The options for the named vector. - */ - update: ( - options: VectorizerUpdateOptions - ) => VectorConfigUpdate; - }; - /** - * Create a `ReplicationConfigUpdate` object to be used when defining the replication configuration of Weaviate. - * - * See [the docs](https://weaviate.io/developers/weaviate/concepts/replication-architecture#replication-vs-sharding) for more details. - * - * @param {boolean} [options.asyncEnabled] Whether asynchronous replication is enabled. - * @param {ReplicationDeletionStrategy} [options.deletionStrategy] The deletion strategy when replication conflicts are detected between deletes and reads. - * @param {number} [options.factor] The replication factor. - */ - replication: (options: { - asyncEnabled?: boolean; - deletionStrategy?: ReplicationDeletionStrategy; - factor?: number; - }) => ReplicationConfigUpdate; -}; -export { - configure, - dataType, - generative, - reconfigure, - reranker, - tokenization, - vectorDistances, - configureVectorIndex as vectorIndex, - vectorizer, -}; diff --git a/dist/node/esm/collections/configure/index.js b/dist/node/esm/collections/configure/index.js deleted file mode 100644 index 19593a2c..00000000 --- a/dist/node/esm/collections/configure/index.js +++ /dev/null @@ -1,202 +0,0 @@ -import generative from './generative.js'; -import { parseWithDefault } from './parsing.js'; -import reranker from './reranker.js'; -import { configure as configureVectorIndex, reconfigure as reconfigureVectorIndex } from './vectorIndex.js'; -import { vectorizer } from './vectorizer.js'; -const dataType = { - INT: 'int', - INT_ARRAY: 'int[]', - NUMBER: 'number', - NUMBER_ARRAY: 'number[]', - TEXT: 'text', - TEXT_ARRAY: 'text[]', - UUID: 'uuid', - UUID_ARRAY: 'uuid[]', - BOOLEAN: 'boolean', - BOOLEAN_ARRAY: 'boolean[]', - DATE: 'date', - DATE_ARRAY: 'date[]', - OBJECT: 'object', - OBJECT_ARRAY: 'object[]', - BLOB: 'blob', - GEO_COORDINATES: 'geoCoordinates', - PHONE_NUMBER: 'phoneNumber', -}; -const tokenization = { - WORD: 'word', - LOWERCASE: 'lowercase', - WHITESPACE: 'whitespace', - FIELD: 'field', - TRIGRAM: 'trigram', - GSE: 'gse', - KAGOME_KR: 'kagome_kr', -}; -const vectorDistances = { - COSINE: 'cosine', - DOT: 'dot', - HAMMING: 'hamming', - L2_SQUARED: 'l2-squared', -}; -const configure = { - generative, - reranker, - vectorizer, - vectorIndex: configureVectorIndex, - dataType, - tokenization, - vectorDistances, - /** - * Create an `InvertedIndexConfigCreate` object to be used when defining the configuration of the keyword searching algorithm of your collection. - * - * See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#configure-the-inverted-index) for details! - * - * @param {number} [options.bm25b] The BM25 b parameter. - * @param {number} [options.bm25k1] The BM25 k1 parameter. - * @param {number} [options.cleanupIntervalSeconds] The interval in seconds at which the inverted index is cleaned up. - * @param {boolean} [options.indexTimestamps] Whether to index timestamps. - * @param {boolean} [options.indexPropertyLength] Whether to index the length of properties. - * @param {boolean} [options.indexNullState] Whether to index the null state of properties. - * @param {'en' | 'none'} [options.stopwordsPreset] The stopwords preset to use. - * @param {string[]} [options.stopwordsAdditions] Additional stopwords to add. - * @param {string[]} [options.stopwordsRemovals] Stopwords to remove. - */ - invertedIndex: (options) => { - return { - bm25: { - b: options.bm25b, - k1: options.bm25k1, - }, - cleanupIntervalSeconds: options.cleanupIntervalSeconds, - indexTimestamps: options.indexTimestamps, - indexPropertyLength: options.indexPropertyLength, - indexNullState: options.indexNullState, - stopwords: { - preset: options.stopwordsPreset, - additions: options.stopwordsAdditions, - removals: options.stopwordsRemovals, - }, - }; - }, - /** - * Create a `MultiTenancyConfigCreate` object to be used when defining the multi-tenancy configuration of your collection. - * - * @param {boolean} [options.autoTenantActivation] Whether auto-tenant activation is enabled. Default is false. - * @param {boolean} [options.autoTenantCreation] Whether auto-tenant creation is enabled. Default is false. - * @param {boolean} [options.enabled] Whether multi-tenancy is enabled. Default is true. - */ - multiTenancy: (options) => { - return options - ? { - autoTenantActivation: parseWithDefault(options.autoTenantActivation, false), - autoTenantCreation: parseWithDefault(options.autoTenantCreation, false), - enabled: parseWithDefault(options.enabled, true), - } - : { autoTenantActivation: false, autoTenantCreation: false, enabled: true }; - }, - /** - * Create a `ReplicationConfigCreate` object to be used when defining the replication configuration of your collection. - * - * NOTE: You can only use one of Sharding or Replication, not both. - * - * See [the docs](https://weaviate.io/developers/weaviate/concepts/replication-architecture#replication-vs-sharding) for more details. - * - * @param {boolean} [options.asyncEnabled] Whether asynchronous replication is enabled. Default is false. - * @param {ReplicationDeletionStrategy} [options.deletionStrategy] The deletion strategy when replication conflicts are detected between deletes and reads. - * @param {number} [options.factor] The replication factor. Default is 1. - */ - replication: (options) => { - return { - asyncEnabled: options.asyncEnabled, - deletionStrategy: options.deletionStrategy, - factor: options.factor, - }; - }, - /** - * Create a `ShardingConfigCreate` object to be used when defining the sharding configuration of your collection. - * - * NOTE: You can only use one of Sharding or Replication, not both. - * - * See [the docs](https://weaviate.io/developers/weaviate/concepts/replication-architecture#replication-vs-sharding) for more details. - * - * @param {number} [options.virtualPerPhysical] The number of virtual shards per physical shard. - * @param {number} [options.desiredCount] The desired number of physical shards. - * @param {number} [options.desiredVirtualCount] The desired number of virtual shards. - */ - sharding: (options) => { - return { - virtualPerPhysical: options.virtualPerPhysical, - desiredCount: options.desiredCount, - desiredVirtualCount: options.desiredVirtualCount, - }; - }, -}; -const reconfigure = { - vectorIndex: reconfigureVectorIndex, - /** - * Create an `InvertedIndexConfigUpdate` object to be used when updating the configuration of the keyword searching algorithm of your collection. - * - * See [the docs](https://weaviate.io/developers/weaviate/configuration/indexes#configure-the-inverted-index) for details! - * - * @param {number} [options.bm25b] The BM25 b parameter. - * @param {number} [options.bm25k1] The BM25 k1 parameter. - * @param {number} [options.cleanupIntervalSeconds] The interval in seconds at which the inverted index is cleaned up. - * @param {'en' | 'none'} [options.stopwordsPreset] The stopwords preset to use. - * @param {string[]} [options.stopwordsAdditions] Additional stopwords to add. - * @param {string[]} [options.stopwordsRemovals] Stopwords to remove. - */ - invertedIndex: (options) => { - return { - bm25: { - b: options.bm25b, - k1: options.bm25k1, - }, - cleanupIntervalSeconds: options.cleanupIntervalSeconds, - stopwords: { - preset: options.stopwordsPreset, - additions: options.stopwordsAdditions, - removals: options.stopwordsRemovals, - }, - }; - }, - vectorizer: { - /** - * Create a `VectorConfigUpdate` object to be used when updating the named vector configuration of Weaviate. - * - * @param {string} name The name of the vector. - * @param {VectorizerOptions} options The options for the named vector. - */ - update: (options) => { - return { - name: options === null || options === void 0 ? void 0 : options.name, - vectorIndex: options.vectorIndexConfig, - }; - }, - }, - /** - * Create a `ReplicationConfigUpdate` object to be used when defining the replication configuration of Weaviate. - * - * See [the docs](https://weaviate.io/developers/weaviate/concepts/replication-architecture#replication-vs-sharding) for more details. - * - * @param {boolean} [options.asyncEnabled] Whether asynchronous replication is enabled. - * @param {ReplicationDeletionStrategy} [options.deletionStrategy] The deletion strategy when replication conflicts are detected between deletes and reads. - * @param {number} [options.factor] The replication factor. - */ - replication: (options) => { - return { - asyncEnabled: options.asyncEnabled, - deletionStrategy: options.deletionStrategy, - factor: options.factor, - }; - }, -}; -export { - configure, - dataType, - generative, - reconfigure, - reranker, - tokenization, - vectorDistances, - configureVectorIndex as vectorIndex, - vectorizer, -}; diff --git a/dist/node/esm/collections/configure/parsing.d.ts b/dist/node/esm/collections/configure/parsing.d.ts deleted file mode 100644 index 3cbebe27..00000000 --- a/dist/node/esm/collections/configure/parsing.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { - BQConfigCreate, - BQConfigUpdate, - PQConfigCreate, - PQConfigUpdate, - SQConfigCreate, - SQConfigUpdate, -} from './types/index.js'; -type QuantizerConfig = - | PQConfigCreate - | PQConfigUpdate - | BQConfigCreate - | BQConfigUpdate - | SQConfigCreate - | SQConfigUpdate; -export declare class QuantizerGuards { - static isPQCreate(config?: QuantizerConfig): config is PQConfigCreate; - static isPQUpdate(config?: QuantizerConfig): config is PQConfigUpdate; - static isBQCreate(config?: QuantizerConfig): config is BQConfigCreate; - static isBQUpdate(config?: QuantizerConfig): config is BQConfigUpdate; - static isSQCreate(config?: QuantizerConfig): config is SQConfigCreate; - static isSQUpdate(config?: QuantizerConfig): config is SQConfigUpdate; -} -export declare function parseWithDefault(value: D | undefined, defaultValue: D): D; -export {}; diff --git a/dist/node/esm/collections/configure/parsing.js b/dist/node/esm/collections/configure/parsing.js deleted file mode 100644 index db4cb6e0..00000000 --- a/dist/node/esm/collections/configure/parsing.js +++ /dev/null @@ -1,23 +0,0 @@ -export class QuantizerGuards { - static isPQCreate(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'pq'; - } - static isPQUpdate(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'pq'; - } - static isBQCreate(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'bq'; - } - static isBQUpdate(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'bq'; - } - static isSQCreate(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'sq'; - } - static isSQUpdate(config) { - return (config === null || config === void 0 ? void 0 : config.type) === 'sq'; - } -} -export function parseWithDefault(value, defaultValue) { - return value !== undefined ? value : defaultValue; -} diff --git a/dist/node/esm/collections/configure/reranker.d.ts b/dist/node/esm/collections/configure/reranker.d.ts deleted file mode 100644 index ad457a8c..00000000 --- a/dist/node/esm/collections/configure/reranker.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { - ModuleConfig, - RerankerCohereConfig, - RerankerJinaAIConfig, - RerankerVoyageAIConfig, -} from '../config/types/index.js'; -declare const _default: { - /** - * Create a `ModuleConfig<'reranker-cohere', RerankerCohereConfig>` object for use when reranking using the `reranker-cohere` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/reranker) for detailed usage. - * - * @param {RerankerCohereConfig} [config] The configuration for the `reranker-cohere` module. - * @returns {ModuleConfig<'reranker-cohere', RerankerCohereConfig>} The configuration object. - */ - cohere: ( - config?: RerankerCohereConfig - ) => ModuleConfig<'reranker-cohere', RerankerCohereConfig | undefined>; - /** - * Create a `ModuleConfig<'reranker-jinaai', RerankerJinaAIConfig>` object for use when reranking using the `reranker-jinaai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/reranker) for detailed usage. - * - * @param {RerankerJinaAIConfig} [config] The configuration for the `reranker-jinaai` module. - * @returns {ModuleConfig<'reranker-jinaai', RerankerJinaAIConfig | undefined>} The configuration object. - */ - jinaai: ( - config?: RerankerJinaAIConfig - ) => ModuleConfig<'reranker-jinaai', RerankerJinaAIConfig | undefined>; - /** - * Create a `ModuleConfig<'reranker-transformers', Record>` object for use when reranking using the `reranker-transformers` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/reranker) for detailed usage. - * - * @returns {ModuleConfig<'reranker-transformers', Record>} The configuration object. - */ - transformers: () => ModuleConfig<'reranker-transformers', Record>; - /** - * Create a `ModuleConfig<'reranker-voyageai', RerankerVoyageAIConfig>` object for use when reranking using the `reranker-voyageai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/reranker) for detailed usage. - * - * @param {RerankerVoyageAIConfig} [config] The configuration for the `reranker-voyage-ai` module. - * @returns {ModuleConfig<'reranker-voyage-ai', RerankerVoyageAIConfig | undefined>} The configuration object. - */ - voyageAI: ( - config?: RerankerVoyageAIConfig - ) => ModuleConfig<'reranker-voyageai', RerankerVoyageAIConfig | undefined>; -}; -export default _default; diff --git a/dist/node/esm/collections/configure/reranker.js b/dist/node/esm/collections/configure/reranker.js deleted file mode 100644 index 7cb8b110..00000000 --- a/dist/node/esm/collections/configure/reranker.js +++ /dev/null @@ -1,57 +0,0 @@ -export default { - /** - * Create a `ModuleConfig<'reranker-cohere', RerankerCohereConfig>` object for use when reranking using the `reranker-cohere` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/reranker) for detailed usage. - * - * @param {RerankerCohereConfig} [config] The configuration for the `reranker-cohere` module. - * @returns {ModuleConfig<'reranker-cohere', RerankerCohereConfig>} The configuration object. - */ - cohere: (config) => { - return { - name: 'reranker-cohere', - config: config, - }; - }, - /** - * Create a `ModuleConfig<'reranker-jinaai', RerankerJinaAIConfig>` object for use when reranking using the `reranker-jinaai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/reranker) for detailed usage. - * - * @param {RerankerJinaAIConfig} [config] The configuration for the `reranker-jinaai` module. - * @returns {ModuleConfig<'reranker-jinaai', RerankerJinaAIConfig | undefined>} The configuration object. - */ - jinaai: (config) => { - return { - name: 'reranker-jinaai', - config: config, - }; - }, - /** - * Create a `ModuleConfig<'reranker-transformers', Record>` object for use when reranking using the `reranker-transformers` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/reranker) for detailed usage. - * - * @returns {ModuleConfig<'reranker-transformers', Record>} The configuration object. - */ - transformers: () => { - return { - name: 'reranker-transformers', - config: {}, - }; - }, - /** - * Create a `ModuleConfig<'reranker-voyageai', RerankerVoyageAIConfig>` object for use when reranking using the `reranker-voyageai` module. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/reranker) for detailed usage. - * - * @param {RerankerVoyageAIConfig} [config] The configuration for the `reranker-voyage-ai` module. - * @returns {ModuleConfig<'reranker-voyage-ai', RerankerVoyageAIConfig | undefined>} The configuration object. - */ - voyageAI: (config) => { - return { - name: 'reranker-voyageai', - config: config, - }; - }, -}; diff --git a/dist/node/esm/collections/configure/types/base.d.ts b/dist/node/esm/collections/configure/types/base.d.ts deleted file mode 100644 index b9748366..00000000 --- a/dist/node/esm/collections/configure/types/base.d.ts +++ /dev/null @@ -1,134 +0,0 @@ -import { WeaviateNestedProperty, WeaviateProperty } from '../../../openapi/types.js'; -import { - InvertedIndexConfig, - MultiTenancyConfig, - ReplicationConfig, - ReplicationDeletionStrategy, -} from '../../config/types/index.js'; -import { DataType } from '../../types/index.js'; -import { NonRefKeys, RefKeys } from '../../types/internal.js'; -export type RecursivePartial = T extends object - ? { - [P in keyof T]?: RecursivePartial; - } - : T; -export type InvertedIndexConfigCreate = RecursivePartial; -export type InvertedIndexConfigUpdate = { - bm25?: { - b?: number; - k1?: number; - }; - cleanupIntervalSeconds?: number; - stopwords?: { - preset?: string; - additions?: string[]; - removals?: string[]; - }; -}; -export type MultiTenancyConfigCreate = RecursivePartial; -export type NestedPropertyCreate = T extends undefined - ? { - name: string; - dataType: DataType; - description?: string; - nestedProperties?: NestedPropertyConfigCreate[]; - indexInverted?: boolean; - indexFilterable?: boolean; - indexSearchable?: boolean; - tokenization?: WeaviateNestedProperty['tokenization']; - } - : { - [K in NonRefKeys]: RequiresNested> extends true - ? { - name: K; - dataType: DataType; - nestedProperties: NestedPropertyConfigCreate>[]; - } & NestedPropertyConfigCreateBase - : { - name: K; - dataType: DataType; - nestedProperties?: NestedPropertyConfigCreate>[]; - } & NestedPropertyConfigCreateBase; - }[NonRefKeys]; -export type NestedPropertyConfigCreate = D extends 'object' | 'object[]' - ? T extends (infer U)[] - ? NestedPropertyCreate - : NestedPropertyCreate - : never; -export type RequiresNested = T extends 'object' | 'object[]' ? true : false; -export type PropertyConfigCreateBase = { - description?: string; - indexInverted?: boolean; - indexFilterable?: boolean; - indexRangeFilters?: boolean; - indexSearchable?: boolean; - tokenization?: WeaviateProperty['tokenization']; - skipVectorization?: boolean; - vectorizePropertyName?: boolean; -}; -export type NestedPropertyConfigCreateBase = { - description?: string; - indexInverted?: boolean; - indexFilterable?: boolean; - indexRangeFilters?: boolean; - indexSearchable?: boolean; - tokenization?: WeaviateNestedProperty['tokenization']; -}; -export type PropertyConfigCreate = T extends undefined - ? { - name: string; - dataType: DataType; - description?: string; - nestedProperties?: NestedPropertyConfigCreate[]; - indexInverted?: boolean; - indexFilterable?: boolean; - indexRangeFilters?: boolean; - indexSearchable?: boolean; - tokenization?: WeaviateProperty['tokenization']; - skipVectorization?: boolean; - vectorizePropertyName?: boolean; - } - : { - [K in NonRefKeys]: RequiresNested> extends true - ? { - name: K; - dataType: DataType; - nestedProperties: NestedPropertyConfigCreate>[]; - } & PropertyConfigCreateBase - : { - name: K; - dataType: DataType; - nestedProperties?: NestedPropertyConfigCreate>[]; - } & PropertyConfigCreateBase; - }[NonRefKeys]; -/** The base class for creating a reference configuration. */ -export type ReferenceConfigBaseCreate = { - /** The name of the reference. If no generic passed, the type is string. If a generic is passed, the type is a union of the keys labelled as CrossReference. */ - name: T extends undefined ? string : RefKeys; - /** The description of the reference. */ - description?: string; -}; -/** Use this type when defining a single-target reference for your collection. */ -export type ReferenceSingleTargetConfigCreate = ReferenceConfigBaseCreate & { - /** The collection that this reference points to. */ - targetCollection: string; -}; -/** Use this type when defining a multi-target reference for your collection. */ -export type ReferenceMultiTargetConfigCreate = ReferenceConfigBaseCreate & { - /** The collection(s) that this reference points to. */ - targetCollections: string[]; -}; -export type ReferenceConfigCreate = - | ReferenceSingleTargetConfigCreate - | ReferenceMultiTargetConfigCreate; -export type ReplicationConfigCreate = RecursivePartial; -export type ReplicationConfigUpdate = { - asyncEnabled?: boolean; - deletionStrategy?: ReplicationDeletionStrategy; - factor?: number; -}; -export type ShardingConfigCreate = { - virtualPerPhysical?: number; - desiredCount?: number; - desiredVirtualCount?: number; -}; diff --git a/dist/node/esm/collections/configure/types/base.js b/dist/node/esm/collections/configure/types/base.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/configure/types/base.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/configure/types/generative.d.ts b/dist/node/esm/collections/configure/types/generative.d.ts deleted file mode 100644 index b35d95f5..00000000 --- a/dist/node/esm/collections/configure/types/generative.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { - GenerativeAWSConfig, - GenerativeAnthropicConfig, - GenerativeAnyscaleConfig, - GenerativeDatabricksConfig, - GenerativeFriendliAIConfig, - GenerativeMistralConfig, - GenerativeOctoAIConfig, - GenerativeOllamaConfig, - GenerativePaLMConfig, -} from '../../index.js'; -export type GenerativeOpenAIConfigBaseCreate = { - baseURL?: string; - frequencyPenalty?: number; - maxTokens?: number; - presencePenalty?: number; - temperature?: number; - topP?: number; -}; -export type GenerativeAnthropicConfigCreate = GenerativeAnthropicConfig; -export type GenerativeAnyscaleConfigCreate = GenerativeAnyscaleConfig; -export type GenerativeAWSConfigCreate = GenerativeAWSConfig; -export type GenerativeAzureOpenAIConfigCreate = GenerativeOpenAIConfigBaseCreate & { - resourceName: string; - deploymentId: string; -}; -export type GenerativeCohereConfigCreate = { - k?: number; - maxTokens?: number; - model?: string; - returnLikelihoods?: string; - stopSequences?: string[]; - temperature?: number; -}; -export type GenerativeDatabricksConfigCreate = GenerativeDatabricksConfig; -export type GenerativeFriendliAIConfigCreate = GenerativeFriendliAIConfig; -export type GenerativeMistralConfigCreate = GenerativeMistralConfig; -export type GenerativeOctoAIConfigCreate = GenerativeOctoAIConfig; -export type GenerativeOllamaConfigCreate = GenerativeOllamaConfig; -export type GenerativeOpenAIConfigCreate = GenerativeOpenAIConfigBaseCreate & { - model?: string; -}; -export type GenerativePaLMConfigCreate = GenerativePaLMConfig; -export type GenerativeConfigCreate = - | GenerativeAnthropicConfigCreate - | GenerativeAnyscaleConfigCreate - | GenerativeAWSConfigCreate - | GenerativeAzureOpenAIConfigCreate - | GenerativeCohereConfigCreate - | GenerativeDatabricksConfigCreate - | GenerativeFriendliAIConfigCreate - | GenerativeMistralConfigCreate - | GenerativeOctoAIConfigCreate - | GenerativeOllamaConfigCreate - | GenerativeOpenAIConfigCreate - | GenerativePaLMConfigCreate - | Record - | undefined; -export type GenerativeConfigCreateType = G extends 'generative-anthropic' - ? GenerativeAnthropicConfigCreate - : G extends 'generative-aws' - ? GenerativeAWSConfigCreate - : G extends 'generative-azure-openai' - ? GenerativeAzureOpenAIConfigCreate - : G extends 'generative-cohere' - ? GenerativeCohereConfigCreate - : G extends 'generative-databricks' - ? GenerativeDatabricksConfigCreate - : G extends 'generative-friendliai' - ? GenerativeFriendliAIConfigCreate - : G extends 'generative-mistral' - ? GenerativeMistralConfigCreate - : G extends 'generative-octoai' - ? GenerativeOctoAIConfigCreate - : G extends 'generative-ollama' - ? GenerativeOllamaConfigCreate - : G extends 'generative-openai' - ? GenerativeOpenAIConfigCreate - : G extends 'generative-palm' - ? GenerativePaLMConfigCreate - : G extends 'none' - ? undefined - : Record | undefined; diff --git a/dist/node/esm/collections/configure/types/generative.js b/dist/node/esm/collections/configure/types/generative.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/configure/types/generative.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/configure/types/index.d.ts b/dist/node/esm/collections/configure/types/index.d.ts deleted file mode 100644 index 4a00d3cf..00000000 --- a/dist/node/esm/collections/configure/types/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './base.js'; -export * from './generative.js'; -export * from './vectorIndex.js'; -export * from './vectorizer.js'; diff --git a/dist/node/esm/collections/configure/types/index.js b/dist/node/esm/collections/configure/types/index.js deleted file mode 100644 index 4a00d3cf..00000000 --- a/dist/node/esm/collections/configure/types/index.js +++ /dev/null @@ -1,4 +0,0 @@ -export * from './base.js'; -export * from './generative.js'; -export * from './vectorIndex.js'; -export * from './vectorizer.js'; diff --git a/dist/node/esm/collections/configure/types/vectorIndex.d.ts b/dist/node/esm/collections/configure/types/vectorIndex.d.ts deleted file mode 100644 index 31ec77b5..00000000 --- a/dist/node/esm/collections/configure/types/vectorIndex.d.ts +++ /dev/null @@ -1,136 +0,0 @@ -import { - BQConfig, - ModuleConfig, - PQConfig, - PQEncoderDistribution, - PQEncoderType, - SQConfig, - VectorDistance, - VectorIndexConfigDynamic, - VectorIndexConfigFlat, - VectorIndexConfigHNSW, - VectorIndexFilterStrategy, -} from '../../config/types/index.js'; -import { RecursivePartial } from './base.js'; -export type QuantizerRecursivePartial = { - [P in keyof T]: P extends 'type' ? T[P] : RecursivePartial | undefined; -}; -export type PQConfigCreate = QuantizerRecursivePartial; -export type PQConfigUpdate = { - centroids?: number; - enabled?: boolean; - segments?: number; - trainingLimit?: number; - encoder?: { - type?: PQEncoderType; - distribution?: PQEncoderDistribution; - }; - type: 'pq'; -}; -export type BQConfigCreate = QuantizerRecursivePartial; -export type BQConfigUpdate = { - rescoreLimit?: number; - type: 'bq'; -}; -export type SQConfigCreate = QuantizerRecursivePartial; -export type SQConfigUpdate = { - rescoreLimit?: number; - trainingLimit?: number; - type: 'sq'; -}; -export type VectorIndexConfigHNSWCreate = RecursivePartial; -export type VectorIndexConfigDynamicCreate = RecursivePartial; -export type VectorIndexConfigDymamicUpdate = RecursivePartial; -export type VectorIndexConfigHNSWUpdate = { - dynamicEfMin?: number; - dynamicEfMax?: number; - dynamicEfFactor?: number; - ef?: number; - filterStrategy?: VectorIndexFilterStrategy; - flatSearchCutoff?: number; - quantizer?: PQConfigUpdate | BQConfigUpdate | SQConfigUpdate; - vectorCacheMaxObjects?: number; -}; -export type VectorIndexConfigCreateType = I extends 'hnsw' - ? VectorIndexConfigHNSWCreate | undefined - : I extends 'flat' - ? VectorIndexConfigFlatCreate | undefined - : I extends 'dynamic' - ? VectorIndexConfigDynamicCreate | undefined - : I extends string - ? Record - : never; -export type VectorIndexConfigFlatCreate = RecursivePartial; -export type VectorIndexConfigFlatUpdate = { - quantizer?: BQConfigUpdate; - vectorCacheMaxObjects?: number; -}; -export type VectorIndexConfigCreate = - | VectorIndexConfigFlatCreate - | VectorIndexConfigHNSWCreate - | VectorIndexConfigDynamicCreate - | Record - | undefined; -export type VectorIndexConfigUpdate = - | VectorIndexConfigFlatUpdate - | VectorIndexConfigHNSWUpdate - | VectorIndexConfigDymamicUpdate - | Record - | undefined; -export type VectorIndexConfigUpdateType = I extends 'hnsw' - ? VectorIndexConfigHNSWUpdate - : I extends 'flat' - ? VectorIndexConfigFlatUpdate - : I extends 'dynamic' - ? VectorIndexConfigDymamicUpdate - : I extends string - ? Record - : never; -export type LegacyVectorizerConfigUpdate = - | ModuleConfig<'flat', VectorIndexConfigFlatUpdate> - | ModuleConfig<'hnsw', VectorIndexConfigHNSWUpdate> - | ModuleConfig>; -export type VectorIndexConfigHNSWCreateOptions = { - /** The interval in seconds at which to clean up the index. Default is 300. */ - cleanupIntervalSeconds?: number; - /** The distance metric to use. Default is 'cosine'. */ - distanceMetric?: VectorDistance; - /** The dynamic ef factor. Default is 8. */ - dynamicEfFactor?: number; - /** The dynamic ef max. Default is 500. */ - dynamicEfMax?: number; - /** The dynamic ef min. Default is 100. */ - dynamicEfMin?: number; - /** The ef parameter. Default is -1. */ - ef?: number; - /** The ef construction parameter. Default is 128. */ - efConstruction?: number; - /** The flat search cutoff. Default is 40000. */ - flatSearchCutoff?: number; - /** The maximum number of connections. Default is 64. */ - maxConnections?: number; - /** The quantizer configuration to use. Use `vectorIndex.quantizer.bq` or `vectorIndex.quantizer.pq` to make one. */ - quantizer?: PQConfigCreate | BQConfigCreate | SQConfigCreate; - /** Whether to skip the index. Default is false. */ - skip?: boolean; - /** The maximum number of objects to cache in the vector cache. Default is 1000000000000. */ - vectorCacheMaxObjects?: number; -}; -export type VectorIndexConfigFlatCreateOptions = { - /** The distance metric to use. Default is 'cosine'. */ - distanceMetric?: VectorDistance; - /** The maximum number of objects to cache in the vector cache. Default is 1000000000000. */ - vectorCacheMaxObjects?: number; - /** The quantizer configuration to use. Default is `bq`. */ - quantizer?: BQConfigCreate; -}; -export type VectorIndexConfigDynamicCreateOptions = { - /** The distance metric to use. Default is 'cosine'. */ - distanceMetric?: VectorDistance; - /** The threshold at which to . Default is 0. */ - threshold?: number; - /** The HNSW configuration of the dynamic index. Use `configure.vectorIndex.hnsw` to make one or supply the type directly. */ - hnsw?: ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate | undefined> | VectorIndexConfigHNSWCreateOptions; - /** The flat configuration of the dynamic index. Use `configure.vectorIndex.flat` to make one or supply the type directly. */ - flat?: ModuleConfig<'flat', VectorIndexConfigFlatCreate | undefined> | VectorIndexConfigFlatCreateOptions; -}; diff --git a/dist/node/esm/collections/configure/types/vectorIndex.js b/dist/node/esm/collections/configure/types/vectorIndex.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/configure/types/vectorIndex.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/configure/types/vectorizer.d.ts b/dist/node/esm/collections/configure/types/vectorizer.d.ts deleted file mode 100644 index 97168816..00000000 --- a/dist/node/esm/collections/configure/types/vectorizer.d.ts +++ /dev/null @@ -1,190 +0,0 @@ -import { - Img2VecNeuralConfig, - ModuleConfig, - Multi2VecField, - Ref2VecCentroidConfig, - Text2VecAWSConfig, - Text2VecAzureOpenAIConfig, - Text2VecCohereConfig, - Text2VecContextionaryConfig, - Text2VecDatabricksConfig, - Text2VecGPT4AllConfig, - Text2VecGoogleConfig, - Text2VecHuggingFaceConfig, - Text2VecJinaConfig, - Text2VecMistralConfig, - Text2VecOctoAIConfig, - Text2VecOllamaConfig, - Text2VecOpenAIConfig, - Text2VecTransformersConfig, - Text2VecVoyageAIConfig, - VectorIndexType, - Vectorizer, - VectorizerConfigType, -} from '../../config/types/index.js'; -import { PrimitiveKeys } from '../../types/internal.js'; -import { VectorIndexConfigCreateType, VectorIndexConfigUpdateType } from './vectorIndex.js'; -export type VectorizerCreateOptions = { - sourceProperties?: P; - vectorIndexConfig?: ModuleConfig>; - vectorizerConfig?: ModuleConfig>; -}; -export type VectorizerUpdateOptions = { - name?: N; - vectorIndexConfig: ModuleConfig>; -}; -export type VectorConfigCreate< - P, - N extends string | undefined, - I extends VectorIndexType, - V extends Vectorizer -> = { - name: N; - properties?: P[]; - vectorizer: ModuleConfig>; - vectorIndex: ModuleConfig>; -}; -export type VectorConfigUpdate = { - name: N; - vectorIndex: ModuleConfig>; -}; -export type VectorizersConfigCreate = - | VectorConfigCreate, undefined, VectorIndexType, Vectorizer> - | VectorConfigCreate, string, VectorIndexType, Vectorizer>[]; -export type ConfigureNonTextVectorizerOptions< - N extends string | undefined, - I extends VectorIndexType, - V extends Vectorizer -> = VectorizerConfigCreateType & { - name?: N; - vectorIndexConfig?: ModuleConfig>; -}; -export type ConfigureTextVectorizerOptions< - T, - N extends string | undefined, - I extends VectorIndexType, - V extends Vectorizer -> = VectorizerConfigCreateType & { - name?: N; - sourceProperties?: PrimitiveKeys[]; - vectorIndexConfig?: ModuleConfig>; -}; -export type Img2VecNeuralConfigCreate = Img2VecNeuralConfig; -/** The configuration for the `multi2vec-clip` vectorizer. */ -export type Multi2VecClipConfigCreate = { - /** The image fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - imageFields?: string[] | Multi2VecField[]; - /** The inference url to use where API requests should go. */ - inferenceUrl?: string; - /** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - textFields?: string[] | Multi2VecField[]; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** The configuration for the `multi2vec-bind` vectorizer. */ -export type Multi2VecBindConfigCreate = { - /** The audio fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - audioFields?: string[] | Multi2VecField[]; - /** The depth fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - depthFields?: string[] | Multi2VecField[]; - /** The image fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - imageFields?: string[] | Multi2VecField[]; - /** The IMU fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - IMUFields?: string[] | Multi2VecField[]; - /** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - textFields?: string[] | Multi2VecField[]; - /** The thermal fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - thermalFields?: string[] | Multi2VecField[]; - /** The video fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - videoFields?: string[] | Multi2VecField[]; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -/** @deprecated Use `Multi2VecGoogleConfigCreate` instead.*/ -export type Multi2VecPalmConfigCreate = Multi2VecGoogleConfigCreate; -/** The configuration for the `multi2vec-google` vectorizer. */ -export type Multi2VecGoogleConfigCreate = { - /** The project id of the model in GCP. */ - projectId: string; - /** Where the model runs */ - location: string; - /** The image fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - imageFields?: string[] | Multi2VecField[]; - /** The text fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - textFields?: string[] | Multi2VecField[]; - /** The video fields to use in vectorization. Can be string of `Multi2VecField` type. If string, weight 0 will be assumed. */ - videoFields?: string[] | Multi2VecField[]; - /** The model ID to use. */ - modelId?: string; - /** The number of dimensions to use. */ - dimensions?: number; - /** Whether to vectorize the collection name. */ - vectorizeCollectionName?: boolean; -}; -export type Ref2VecCentroidConfigCreate = Ref2VecCentroidConfig; -export type Text2VecAWSConfigCreate = Text2VecAWSConfig; -export type Text2VecAzureOpenAIConfigCreate = Text2VecAzureOpenAIConfig; -export type Text2VecCohereConfigCreate = Text2VecCohereConfig; -export type Text2VecContextionaryConfigCreate = Text2VecContextionaryConfig; -export type Text2VecDatabricksConfigCreate = Text2VecDatabricksConfig; -export type Text2VecGPT4AllConfigCreate = Text2VecGPT4AllConfig; -export type Text2VecHuggingFaceConfigCreate = Text2VecHuggingFaceConfig; -export type Text2VecJinaConfigCreate = Text2VecJinaConfig; -export type Text2VecMistralConfigCreate = Text2VecMistralConfig; -export type Text2VecOctoAIConfigCreate = Text2VecOctoAIConfig; -export type Text2VecOllamaConfigCreate = Text2VecOllamaConfig; -export type Text2VecOpenAIConfigCreate = Text2VecOpenAIConfig; -/** @deprecated Use `Text2VecGoogleConfigCreate` instead. */ -export type Text2VecPalmConfigCreate = Text2VecGoogleConfig; -export type Text2VecGoogleConfigCreate = Text2VecGoogleConfig; -export type Text2VecTransformersConfigCreate = Text2VecTransformersConfig; -export type Text2VecVoyageAIConfigCreate = Text2VecVoyageAIConfig; -export type VectorizerConfigCreateType = V extends 'img2vec-neural' - ? Img2VecNeuralConfigCreate | undefined - : V extends 'multi2vec-clip' - ? Multi2VecClipConfigCreate | undefined - : V extends 'multi2vec-bind' - ? Multi2VecBindConfigCreate | undefined - : V extends 'multi2vec-palm' - ? Multi2VecPalmConfigCreate - : V extends 'multi2vec-google' - ? Multi2VecGoogleConfigCreate - : V extends 'ref2vec-centroid' - ? Ref2VecCentroidConfigCreate - : V extends 'text2vec-aws' - ? Text2VecAWSConfigCreate - : V extends 'text2vec-contextionary' - ? Text2VecContextionaryConfigCreate | undefined - : V extends 'text2vec-cohere' - ? Text2VecCohereConfigCreate | undefined - : V extends 'text2vec-databricks' - ? Text2VecDatabricksConfigCreate - : V extends 'text2vec-gpt4all' - ? Text2VecGPT4AllConfigCreate | undefined - : V extends 'text2vec-huggingface' - ? Text2VecHuggingFaceConfigCreate | undefined - : V extends 'text2vec-jina' - ? Text2VecJinaConfigCreate | undefined - : V extends 'text2vec-mistral' - ? Text2VecMistralConfigCreate | undefined - : V extends 'text2vec-octoai' - ? Text2VecOctoAIConfigCreate | undefined - : V extends 'text2vec-ollama' - ? Text2VecOllamaConfigCreate | undefined - : V extends 'text2vec-openai' - ? Text2VecOpenAIConfigCreate | undefined - : V extends 'text2vec-azure-openai' - ? Text2VecAzureOpenAIConfigCreate - : V extends 'text2vec-palm' - ? Text2VecPalmConfigCreate | undefined - : V extends 'text2vec-google' - ? Text2VecGoogleConfigCreate | undefined - : V extends 'text2vec-transformers' - ? Text2VecTransformersConfigCreate | undefined - : V extends 'text2vec-voyageai' - ? Text2VecVoyageAIConfigCreate | undefined - : V extends 'none' - ? {} - : V extends undefined - ? undefined - : never; diff --git a/dist/node/esm/collections/configure/types/vectorizer.js b/dist/node/esm/collections/configure/types/vectorizer.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/configure/types/vectorizer.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/configure/vectorIndex.d.ts b/dist/node/esm/collections/configure/vectorIndex.d.ts deleted file mode 100644 index 4145e7be..00000000 --- a/dist/node/esm/collections/configure/vectorIndex.d.ts +++ /dev/null @@ -1,181 +0,0 @@ -import { ModuleConfig, PQEncoderDistribution, PQEncoderType } from '../config/types/index.js'; -import { - BQConfigCreate, - BQConfigUpdate, - PQConfigCreate, - PQConfigUpdate, - SQConfigCreate, - SQConfigUpdate, - VectorIndexConfigDynamicCreate, - VectorIndexConfigDynamicCreateOptions, - VectorIndexConfigFlatCreate, - VectorIndexConfigFlatCreateOptions, - VectorIndexConfigFlatUpdate, - VectorIndexConfigHNSWCreate, - VectorIndexConfigHNSWCreateOptions, - VectorIndexConfigHNSWUpdate, -} from './types/index.js'; -declare const configure: { - /** - * Create a `ModuleConfig<'flat', VectorIndexConfigFlatCreate | undefined>` object when defining the configuration of the FLAT vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `configure.vectorizer` method. - * - * @param {VectorIndexConfigFlatCreateOptions} [opts] The options available for configuring the flat vector index. - * @returns {ModuleConfig<'flat', VectorIndexConfigFlatCreate | undefined>} The configuration object. - */ - flat: ( - opts?: VectorIndexConfigFlatCreateOptions - ) => ModuleConfig<'flat', VectorIndexConfigFlatCreate | undefined>; - /** - * Create a `ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate | undefined>` object when defining the configuration of the HNSW vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `configure.vectorizer` method. - * - * @param {VectorIndexConfigHNSWCreateOptions} [opts] The options available for configuring the HNSW vector index. - * @returns {ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate | undefined>} The configuration object. - */ - hnsw: ( - opts?: VectorIndexConfigHNSWCreateOptions - ) => ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate | undefined>; - /** - * Create a `ModuleConfig<'dynamic', VectorIndexConfigDynamicCreate | undefined>` object when defining the configuration of the dynamic vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `configure.vectorizer` method. - * - * @param {VectorIndexConfigDynamicCreateOptions} [opts] The options available for configuring the dynamic vector index. - * @returns {ModuleConfig<'dynamic', VectorIndexConfigDynamicCreate | undefined>} The configuration object. - */ - dynamic: ( - opts?: VectorIndexConfigDynamicCreateOptions - ) => ModuleConfig<'dynamic', VectorIndexConfigDynamicCreate | undefined>; - /** - * Define the quantizer configuration to use when creating a vector index. - */ - quantizer: { - /** - * Create an object of type `BQConfigCreate` to be used when defining the quantizer configuration of a vector index. - * - * @param {boolean} [options.cache] Whether to cache the quantizer. Default is false. - * @param {number} [options.rescoreLimit] The rescore limit. Default is 1000. - * @returns {BQConfigCreate} The object of type `BQConfigCreate`. - */ - bq: (options?: { cache?: boolean; rescoreLimit?: number }) => BQConfigCreate; - /** - * Create an object of type `PQConfigCreate` to be used when defining the quantizer configuration of a vector index. - * - * @param {boolean} [options.bitCompression] Whether to use bit compression. - * @param {number} [options.centroids] The number of centroids[. - * @param {PQEncoderDistribution} ]options.encoder.distribution The encoder distribution. - * @param {PQEncoderType} [options.encoder.type] The encoder type. - * @param {number} [options.segments] The number of segments. - * @param {number} [options.trainingLimit] The training limit. - * @returns {PQConfigCreate} The object of type `PQConfigCreate`. - */ - pq: (options?: { - bitCompression?: boolean; - centroids?: number; - encoder?: { - distribution?: PQEncoderDistribution; - type?: PQEncoderType; - }; - segments?: number; - trainingLimit?: number; - }) => PQConfigCreate; - /** - * Create an object of type `SQConfigCreate` to be used when defining the quantizer configuration of a vector index. - * - * @param {number} [options.rescoreLimit] The rescore limit. - * @param {number} [options.trainingLimit] The training limit. - * @returns {SQConfigCreate} The object of type `SQConfigCreate`. - */ - sq: (options?: { rescoreLimit?: number; trainingLimit?: number }) => SQConfigCreate; - }; -}; -declare const reconfigure: { - /** - * Create a `ModuleConfig<'flat', VectorIndexConfigFlatUpdate>` object to update the configuration of the FLAT vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `reconfigure.vectorizer` method. - * - * @param {VectorDistance} [options.distanceMetric] The distance metric to use. Default is 'cosine'. - * @param {number} [options.vectorCacheMaxObjects] The maximum number of objects to cache in the vector cache. Default is 1000000000000. - * @param {BQConfigCreate} [options.quantizer] The quantizer configuration to use. Default is `bq`. - * @returns {ModuleConfig<'flat', VectorIndexConfigFlatCreate>} The configuration object. - */ - flat: (options: { - vectorCacheMaxObjects?: number; - quantizer?: BQConfigUpdate; - }) => ModuleConfig<'flat', VectorIndexConfigFlatUpdate>; - /** - * Create a `ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate>` object to update the configuration of the HNSW vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `reconfigure.vectorizer` method. - * - * @param {number} [options.dynamicEfFactor] The dynamic ef factor. Default is 8. - * @param {number} [options.dynamicEfMax] The dynamic ef max. Default is 500. - * @param {number} [options.dynamicEfMin] The dynamic ef min. Default is 100. - * @param {number} [options.ef] The ef parameter. Default is -1. - * @param {number} [options.flatSearchCutoff] The flat search cutoff. Default is 40000. - * @param {PQConfigUpdate | BQConfigUpdate} [options.quantizer] The quantizer configuration to use. Use `vectorIndex.quantizer.bq` or `vectorIndex.quantizer.pq` to make one. - * @param {number} [options.vectorCacheMaxObjects] The maximum number of objects to cache in the vector cache. Default is 1000000000000. - * @returns {ModuleConfig<'hnsw', VectorIndexConfigHNSWUpdate>} The configuration object. - */ - hnsw: (options: { - dynamicEfFactor?: number; - dynamicEfMax?: number; - dynamicEfMin?: number; - ef?: number; - flatSearchCutoff?: number; - quantizer?: PQConfigUpdate | BQConfigUpdate | SQConfigUpdate; - vectorCacheMaxObjects?: number; - }) => ModuleConfig<'hnsw', VectorIndexConfigHNSWUpdate>; - /** - * Define the quantizer configuration to use when creating a vector index. - */ - quantizer: { - /** - * Create an object of type `BQConfigUpdate` to be used when updating the quantizer configuration of a vector index. - * - * NOTE: If the vector index already has a quantizer configured, you cannot change its quantizer type; only its values. - * So if you want to change the quantizer type, you must recreate the collection. - * - * @param {boolean} [options.cache] Whether to cache the quantizer. - * @param {number} [options.rescoreLimit] The new rescore limit. - * @returns {BQConfigCreate} The configuration object. - */ - bq: (options?: { cache?: boolean; rescoreLimit?: number }) => BQConfigUpdate; - /** - * Create an object of type `PQConfigUpdate` to be used when updating the quantizer configuration of a vector index. - * - * NOTE: If the vector index already has a quantizer configured, you cannot change its quantizer type; only its values. - * So if you want to change the quantizer type, you must recreate the collection. - * - * @param {number} [options.centroids] The new number of centroids. - * @param {PQEncoderDistribution} [options.pqEncoderDistribution] The new encoder distribution. - * @param {PQEncoderType} [options.pqEncoderType] The new encoder type. - * @param {number} [options.segments] The new number of segments. - * @param {number} [options.trainingLimit] The new training limit. - * @returns {PQConfigUpdate} The configuration object. - */ - pq: (options?: { - centroids?: number; - pqEncoderDistribution?: PQEncoderDistribution; - pqEncoderType?: PQEncoderType; - segments?: number; - trainingLimit?: number; - }) => PQConfigUpdate; - /** - * Create an object of type `SQConfigUpdate` to be used when updating the quantizer configuration of a vector index. - * - * NOTE: If the vector index already has a quantizer configured, you cannot change its quantizer type; only its values. - * So if you want to change the quantizer type, you must recreate the collection. - * - * @param {number} [options.rescoreLimit] The rescore limit. - * @param {number} [options.trainingLimit] The training limit. - * @returns {SQConfigUpdate} The configuration object. - */ - sq: (options?: { rescoreLimit?: number; trainingLimit?: number }) => SQConfigUpdate; - }; -}; -export { configure, reconfigure }; diff --git a/dist/node/esm/collections/configure/vectorIndex.js b/dist/node/esm/collections/configure/vectorIndex.js deleted file mode 100644 index be431f9d..00000000 --- a/dist/node/esm/collections/configure/vectorIndex.js +++ /dev/null @@ -1,232 +0,0 @@ -var __rest = - (this && this.__rest) || - function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === 'function') - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; - }; -const isModuleConfig = (config) => { - return config && typeof config === 'object' && 'name' in config && 'config' in config; -}; -const configure = { - /** - * Create a `ModuleConfig<'flat', VectorIndexConfigFlatCreate | undefined>` object when defining the configuration of the FLAT vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `configure.vectorizer` method. - * - * @param {VectorIndexConfigFlatCreateOptions} [opts] The options available for configuring the flat vector index. - * @returns {ModuleConfig<'flat', VectorIndexConfigFlatCreate | undefined>} The configuration object. - */ - flat: (opts) => { - const { distanceMetric: distance, vectorCacheMaxObjects, quantizer } = opts || {}; - return { - name: 'flat', - config: { - distance, - vectorCacheMaxObjects, - quantizer: quantizer, - }, - }; - }, - /** - * Create a `ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate | undefined>` object when defining the configuration of the HNSW vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `configure.vectorizer` method. - * - * @param {VectorIndexConfigHNSWCreateOptions} [opts] The options available for configuring the HNSW vector index. - * @returns {ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate | undefined>} The configuration object. - */ - hnsw: (opts) => { - const _a = opts || {}, - { distanceMetric } = _a, - rest = __rest(_a, ['distanceMetric']); - return { - name: 'hnsw', - config: rest - ? Object.assign(Object.assign({}, rest), { distance: distanceMetric, quantizer: rest.quantizer }) - : undefined, - }; - }, - /** - * Create a `ModuleConfig<'dynamic', VectorIndexConfigDynamicCreate | undefined>` object when defining the configuration of the dynamic vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `configure.vectorizer` method. - * - * @param {VectorIndexConfigDynamicCreateOptions} [opts] The options available for configuring the dynamic vector index. - * @returns {ModuleConfig<'dynamic', VectorIndexConfigDynamicCreate | undefined>} The configuration object. - */ - dynamic: (opts) => { - return { - name: 'dynamic', - config: opts - ? { - distance: opts.distanceMetric, - threshold: opts.threshold, - hnsw: isModuleConfig(opts.hnsw) ? opts.hnsw.config : configure.hnsw(opts.hnsw).config, - flat: isModuleConfig(opts.flat) ? opts.flat.config : configure.flat(opts.flat).config, - } - : undefined, - }; - }, - /** - * Define the quantizer configuration to use when creating a vector index. - */ - quantizer: { - /** - * Create an object of type `BQConfigCreate` to be used when defining the quantizer configuration of a vector index. - * - * @param {boolean} [options.cache] Whether to cache the quantizer. Default is false. - * @param {number} [options.rescoreLimit] The rescore limit. Default is 1000. - * @returns {BQConfigCreate} The object of type `BQConfigCreate`. - */ - bq: (options) => { - return { - cache: options === null || options === void 0 ? void 0 : options.cache, - rescoreLimit: options === null || options === void 0 ? void 0 : options.rescoreLimit, - type: 'bq', - }; - }, - /** - * Create an object of type `PQConfigCreate` to be used when defining the quantizer configuration of a vector index. - * - * @param {boolean} [options.bitCompression] Whether to use bit compression. - * @param {number} [options.centroids] The number of centroids[. - * @param {PQEncoderDistribution} ]options.encoder.distribution The encoder distribution. - * @param {PQEncoderType} [options.encoder.type] The encoder type. - * @param {number} [options.segments] The number of segments. - * @param {number} [options.trainingLimit] The training limit. - * @returns {PQConfigCreate} The object of type `PQConfigCreate`. - */ - pq: (options) => { - return { - bitCompression: options === null || options === void 0 ? void 0 : options.bitCompression, - centroids: options === null || options === void 0 ? void 0 : options.centroids, - encoder: (options === null || options === void 0 ? void 0 : options.encoder) - ? { - distribution: options.encoder.distribution, - type: options.encoder.type, - } - : undefined, - segments: options === null || options === void 0 ? void 0 : options.segments, - trainingLimit: options === null || options === void 0 ? void 0 : options.trainingLimit, - type: 'pq', - }; - }, - /** - * Create an object of type `SQConfigCreate` to be used when defining the quantizer configuration of a vector index. - * - * @param {number} [options.rescoreLimit] The rescore limit. - * @param {number} [options.trainingLimit] The training limit. - * @returns {SQConfigCreate} The object of type `SQConfigCreate`. - */ - sq: (options) => { - return { - rescoreLimit: options === null || options === void 0 ? void 0 : options.rescoreLimit, - trainingLimit: options === null || options === void 0 ? void 0 : options.trainingLimit, - type: 'sq', - }; - }, - }, -}; -const reconfigure = { - /** - * Create a `ModuleConfig<'flat', VectorIndexConfigFlatUpdate>` object to update the configuration of the FLAT vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `reconfigure.vectorizer` method. - * - * @param {VectorDistance} [options.distanceMetric] The distance metric to use. Default is 'cosine'. - * @param {number} [options.vectorCacheMaxObjects] The maximum number of objects to cache in the vector cache. Default is 1000000000000. - * @param {BQConfigCreate} [options.quantizer] The quantizer configuration to use. Default is `bq`. - * @returns {ModuleConfig<'flat', VectorIndexConfigFlatCreate>} The configuration object. - */ - flat: (options) => { - return { - name: 'flat', - config: options, - }; - }, - /** - * Create a `ModuleConfig<'hnsw', VectorIndexConfigHNSWCreate>` object to update the configuration of the HNSW vector index. - * - * Use this method when defining the `options.vectorIndexConfig` argument of the `reconfigure.vectorizer` method. - * - * @param {number} [options.dynamicEfFactor] The dynamic ef factor. Default is 8. - * @param {number} [options.dynamicEfMax] The dynamic ef max. Default is 500. - * @param {number} [options.dynamicEfMin] The dynamic ef min. Default is 100. - * @param {number} [options.ef] The ef parameter. Default is -1. - * @param {number} [options.flatSearchCutoff] The flat search cutoff. Default is 40000. - * @param {PQConfigUpdate | BQConfigUpdate} [options.quantizer] The quantizer configuration to use. Use `vectorIndex.quantizer.bq` or `vectorIndex.quantizer.pq` to make one. - * @param {number} [options.vectorCacheMaxObjects] The maximum number of objects to cache in the vector cache. Default is 1000000000000. - * @returns {ModuleConfig<'hnsw', VectorIndexConfigHNSWUpdate>} The configuration object. - */ - hnsw: (options) => { - return { - name: 'hnsw', - config: options, - }; - }, - /** - * Define the quantizer configuration to use when creating a vector index. - */ - quantizer: { - /** - * Create an object of type `BQConfigUpdate` to be used when updating the quantizer configuration of a vector index. - * - * NOTE: If the vector index already has a quantizer configured, you cannot change its quantizer type; only its values. - * So if you want to change the quantizer type, you must recreate the collection. - * - * @param {boolean} [options.cache] Whether to cache the quantizer. - * @param {number} [options.rescoreLimit] The new rescore limit. - * @returns {BQConfigCreate} The configuration object. - */ - bq: (options) => { - return Object.assign(Object.assign({}, options), { type: 'bq' }); - }, - /** - * Create an object of type `PQConfigUpdate` to be used when updating the quantizer configuration of a vector index. - * - * NOTE: If the vector index already has a quantizer configured, you cannot change its quantizer type; only its values. - * So if you want to change the quantizer type, you must recreate the collection. - * - * @param {number} [options.centroids] The new number of centroids. - * @param {PQEncoderDistribution} [options.pqEncoderDistribution] The new encoder distribution. - * @param {PQEncoderType} [options.pqEncoderType] The new encoder type. - * @param {number} [options.segments] The new number of segments. - * @param {number} [options.trainingLimit] The new training limit. - * @returns {PQConfigUpdate} The configuration object. - */ - pq: (options) => { - const _a = options || {}, - { pqEncoderDistribution, pqEncoderType } = _a, - rest = __rest(_a, ['pqEncoderDistribution', 'pqEncoderType']); - return Object.assign(Object.assign({}, rest), { - encoder: - pqEncoderDistribution || pqEncoderType - ? { - distribution: pqEncoderDistribution, - type: pqEncoderType, - } - : undefined, - type: 'pq', - }); - }, - /** - * Create an object of type `SQConfigUpdate` to be used when updating the quantizer configuration of a vector index. - * - * NOTE: If the vector index already has a quantizer configured, you cannot change its quantizer type; only its values. - * So if you want to change the quantizer type, you must recreate the collection. - * - * @param {number} [options.rescoreLimit] The rescore limit. - * @param {number} [options.trainingLimit] The training limit. - * @returns {SQConfigUpdate} The configuration object. - */ - sq: (options) => { - return Object.assign(Object.assign({}, options), { type: 'sq' }); - }, - }, -}; -export { configure, reconfigure }; diff --git a/dist/node/esm/collections/configure/vectorizer.d.ts b/dist/node/esm/collections/configure/vectorizer.d.ts deleted file mode 100644 index 02dcb737..00000000 --- a/dist/node/esm/collections/configure/vectorizer.d.ts +++ /dev/null @@ -1,388 +0,0 @@ -import { VectorConfigCreate, VectorIndexConfigCreateType } from '../index.js'; -import { PrimitiveKeys } from '../types/internal.js'; -import { ConfigureNonTextVectorizerOptions, ConfigureTextVectorizerOptions } from './types/index.js'; -export declare const vectorizer: { - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'none'`. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `none` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'none'>} The configuration object. - */ - none: ( - opts?: - | { - name?: N | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - } - | undefined - ) => VectorConfigCreate; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'img2vec-neural'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/img2vec-neural) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `img2vec-neural` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'img2vec-neural'>} The configuration object. - */ - img2VecNeural: ( - opts: import('../index.js').Img2VecNeuralConfig & { - name?: N_1 | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - } - ) => VectorConfigCreate; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-bind'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/imagebind/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `multi2vec-bind` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-bind'>} The configuration object. - */ - multi2VecBind: ( - opts?: - | (import('./types/vectorizer.js').Multi2VecBindConfigCreate & { - name?: N_2 | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-clip'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `multi2vec-clip` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-clip'>} The configuration object. - */ - multi2VecClip: ( - opts?: - | (import('./types/vectorizer.js').Multi2VecClipConfigCreate & { - name?: N_3 | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-palm'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} opts The configuration options for the `multi2vec-palm` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-palm'>} The configuration object. - * @deprecated Use `multi2VecGoogle` instead. - */ - multi2VecPalm: ( - opts: ConfigureNonTextVectorizerOptions - ) => VectorConfigCreate; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-google'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} opts The configuration options for the `multi2vec-google` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-google'>} The configuration object. - */ - multi2VecGoogle: ( - opts: ConfigureNonTextVectorizerOptions - ) => VectorConfigCreate; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'ref2vec-centroid'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/ref2vec-centroid) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} opts The configuration options for the `ref2vec-centroid` vectorizer. - * @returns {VectorConfigCreate} The configuration object. - */ - ref2VecCentroid: ( - opts: ConfigureNonTextVectorizerOptions - ) => VectorConfigCreate; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-aws'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/aws/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration options for the `text2vec-aws` vectorizer. - * @returns { VectorConfigCreate, N, I, 'text2vec-aws'>} The configuration object. - */ - text2VecAWS: ( - opts: ConfigureTextVectorizerOptions - ) => VectorConfigCreate, N_7, I_7, 'text2vec-aws'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-azure-openai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration options for the `text2vec-azure-openai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-azure-openai'>} The configuration object. - */ - text2VecAzureOpenAI: ( - opts: ConfigureTextVectorizerOptions - ) => VectorConfigCreate, N_8, I_8, 'text2vec-azure-openai'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-cohere'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration options for the `text2vec-cohere` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-cohere'>} The configuration object. - */ - text2VecCohere: ( - opts?: - | (import('../index.js').Text2VecCohereConfig & { - name?: N_9 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_9, I_9, 'text2vec-cohere'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-contextionary'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/text2vec-contextionary) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-contextionary` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-contextionary'>} The configuration object. - */ - text2VecContextionary: ( - opts?: - | (import('../index.js').Text2VecContextionaryConfig & { - name?: N_10 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_10, I_10, 'text2vec-contextionary'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-databricks'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/databricks/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration for the `text2vec-databricks` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-databricks'>} The configuration object. - */ - text2VecDatabricks: ( - opts: ConfigureTextVectorizerOptions - ) => VectorConfigCreate, N_11, I_11, 'text2vec-databricks'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-gpt4all'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/gpt4all/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-contextionary` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-gpt4all'>} The configuration object. - */ - text2VecGPT4All: ( - opts?: - | (import('../index.js').Text2VecGPT4AllConfig & { - name?: N_12 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_12, I_12, 'text2vec-gpt4all'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-huggingface'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/huggingface/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-contextionary` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-huggingface'>} The configuration object. - */ - text2VecHuggingFace: ( - opts?: - | (import('../index.js').Text2VecHuggingFaceConfig & { - name?: N_13 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_13, I_13, 'text2vec-huggingface'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-jina'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-jina` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-jina'>} The configuration object. - */ - text2VecJina: ( - opts?: - | (import('../index.js').Text2VecJinaConfig & { - name?: N_14 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_14, I_14, 'text2vec-jina'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-mistral'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/mistral/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-mistral` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-mistral'>} The configuration object. - */ - text2VecMistral: ( - opts?: - | (import('../index.js').Text2VecMistralConfig & { - name?: N_15 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_15, I_15, 'text2vec-mistral'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-octoai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/octoai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-octoai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-octoai'>} The configuration object. - */ - text2VecOctoAI: ( - opts?: - | (import('../index.js').Text2VecOctoAIConfig & { - name?: N_16 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_16, I_16, 'text2vec-octoai'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-openai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-openai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-openai'>} The configuration object. - */ - text2VecOpenAI: ( - opts?: - | (import('../index.js').Text2VecOpenAIConfig & { - name?: N_17 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_17, I_17, 'text2vec-openai'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-ollama'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/ollama/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-ollama` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-ollama'>} The configuration object. - */ - text2VecOllama: ( - opts?: - | (import('../index.js').Text2VecOllamaConfig & { - name?: N_18 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_18, I_18, 'text2vec-ollama'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-palm'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration for the `text2vec-palm` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-palm'>} The configuration object. - * @deprecated Use `text2VecGoogle` instead. - */ - text2VecPalm: ( - opts?: - | (import('../index.js').Text2VecGoogleConfig & { - name?: N_19 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_19, I_19, 'text2vec-palm'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-google'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration for the `text2vec-palm` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-google'>} The configuration object. - */ - text2VecGoogle: ( - opts?: - | (import('../index.js').Text2VecGoogleConfig & { - name?: N_20 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_20, I_20, 'text2vec-google'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-transformers'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-transformers` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-transformers'>} The configuration object. - */ - text2VecTransformers: ( - opts?: - | (import('../index.js').Text2VecTransformersConfig & { - name?: N_21 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_21, I_21, 'text2vec-transformers'>; - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-voyageai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-voyageai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-voyageai'>} The configuration object. - */ - text2VecVoyageAI: ( - opts?: - | (import('../index.js').Text2VecVoyageAIConfig & { - name?: N_22 | undefined; - sourceProperties?: PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('../index.js').ModuleConfig> - | undefined; - }) - | undefined - ) => VectorConfigCreate, N_22, I_22, 'text2vec-voyageai'>; -}; diff --git a/dist/node/esm/collections/configure/vectorizer.js b/dist/node/esm/collections/configure/vectorizer.js deleted file mode 100644 index a0b67f73..00000000 --- a/dist/node/esm/collections/configure/vectorizer.js +++ /dev/null @@ -1,598 +0,0 @@ -var __rest = - (this && this.__rest) || - function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === 'function') - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; - }; -const makeVectorizer = (name, options) => { - return { - name: name, - properties: options === null || options === void 0 ? void 0 : options.sourceProperties, - vectorIndex: (options === null || options === void 0 ? void 0 : options.vectorIndexConfig) - ? options.vectorIndexConfig - : { name: 'hnsw', config: undefined }, - vectorizer: (options === null || options === void 0 ? void 0 : options.vectorizerConfig) - ? options.vectorizerConfig - : { name: 'none', config: undefined }, - }; -}; -const mapMulti2VecField = (field) => { - if (typeof field === 'string') { - return { name: field }; - } - return field; -}; -const formatMulti2VecFields = (weights, key, fields) => { - if (fields !== undefined && fields.length > 0) { - weights[key] = fields.filter((f) => f.weight !== undefined).map((f) => f.weight); - if (weights[key].length === 0) { - delete weights[key]; - } - } - return weights; -}; -export const vectorizer = { - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'none'`. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `none` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'none'>} The configuration object. - */ - none: (opts) => { - const { name, vectorIndexConfig } = opts || {}; - return makeVectorizer(name, { vectorIndexConfig }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'img2vec-neural'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/img2vec-neural) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `img2vec-neural` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'img2vec-neural'>} The configuration object. - */ - img2VecNeural: (opts) => { - const { name, vectorIndexConfig } = opts, - config = __rest(opts, ['name', 'vectorIndexConfig']); - return makeVectorizer(name, { - vectorIndexConfig, - vectorizerConfig: { - name: 'img2vec-neural', - config: config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-bind'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/imagebind/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `multi2vec-bind` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-bind'>} The configuration object. - */ - multi2VecBind: (opts) => { - var _a, _b, _c, _d, _e, _f, _g; - const _h = opts || {}, - { name, vectorIndexConfig } = _h, - config = __rest(_h, ['name', 'vectorIndexConfig']); - const audioFields = - (_a = config.audioFields) === null || _a === void 0 ? void 0 : _a.map(mapMulti2VecField); - const depthFields = - (_b = config.depthFields) === null || _b === void 0 ? void 0 : _b.map(mapMulti2VecField); - const imageFields = - (_c = config.imageFields) === null || _c === void 0 ? void 0 : _c.map(mapMulti2VecField); - const IMUFields = (_d = config.IMUFields) === null || _d === void 0 ? void 0 : _d.map(mapMulti2VecField); - const textFields = - (_e = config.textFields) === null || _e === void 0 ? void 0 : _e.map(mapMulti2VecField); - const thermalFields = - (_f = config.thermalFields) === null || _f === void 0 ? void 0 : _f.map(mapMulti2VecField); - const videoFields = - (_g = config.videoFields) === null || _g === void 0 ? void 0 : _g.map(mapMulti2VecField); - let weights = {}; - weights = formatMulti2VecFields(weights, 'audioFields', audioFields); - weights = formatMulti2VecFields(weights, 'depthFields', depthFields); - weights = formatMulti2VecFields(weights, 'imageFields', imageFields); - weights = formatMulti2VecFields(weights, 'IMUFields', IMUFields); - weights = formatMulti2VecFields(weights, 'textFields', textFields); - weights = formatMulti2VecFields(weights, 'thermalFields', thermalFields); - weights = formatMulti2VecFields(weights, 'videoFields', videoFields); - return makeVectorizer(name, { - vectorIndexConfig, - vectorizerConfig: { - name: 'multi2vec-bind', - config: - Object.keys(config).length === 0 - ? undefined - : Object.assign(Object.assign({}, config), { - audioFields: - audioFields === null || audioFields === void 0 ? void 0 : audioFields.map((f) => f.name), - depthFields: - depthFields === null || depthFields === void 0 ? void 0 : depthFields.map((f) => f.name), - imageFields: - imageFields === null || imageFields === void 0 ? void 0 : imageFields.map((f) => f.name), - IMUFields: IMUFields === null || IMUFields === void 0 ? void 0 : IMUFields.map((f) => f.name), - textFields: - textFields === null || textFields === void 0 ? void 0 : textFields.map((f) => f.name), - thermalFields: - thermalFields === null || thermalFields === void 0 - ? void 0 - : thermalFields.map((f) => f.name), - videoFields: - videoFields === null || videoFields === void 0 ? void 0 : videoFields.map((f) => f.name), - weights: Object.keys(weights).length === 0 ? undefined : weights, - }), - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-clip'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} [opts] The configuration options for the `multi2vec-clip` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-clip'>} The configuration object. - */ - multi2VecClip: (opts) => { - var _a, _b; - const _c = opts || {}, - { name, vectorIndexConfig } = _c, - config = __rest(_c, ['name', 'vectorIndexConfig']); - const imageFields = - (_a = config.imageFields) === null || _a === void 0 ? void 0 : _a.map(mapMulti2VecField); - const textFields = - (_b = config.textFields) === null || _b === void 0 ? void 0 : _b.map(mapMulti2VecField); - let weights = {}; - weights = formatMulti2VecFields(weights, 'imageFields', imageFields); - weights = formatMulti2VecFields(weights, 'textFields', textFields); - return makeVectorizer(name, { - vectorIndexConfig, - vectorizerConfig: { - name: 'multi2vec-clip', - config: - Object.keys(config).length === 0 - ? undefined - : Object.assign(Object.assign({}, config), { - imageFields: - imageFields === null || imageFields === void 0 ? void 0 : imageFields.map((f) => f.name), - textFields: - textFields === null || textFields === void 0 ? void 0 : textFields.map((f) => f.name), - weights: Object.keys(weights).length === 0 ? undefined : weights, - }), - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-palm'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} opts The configuration options for the `multi2vec-palm` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-palm'>} The configuration object. - * @deprecated Use `multi2VecGoogle` instead. - */ - multi2VecPalm: (opts) => { - var _a, _b, _c; - console.warn('The `multi2vec-palm` vectorizer is deprecated. Use `multi2vec-google` instead.'); - const { name, vectorIndexConfig } = opts, - config = __rest(opts, ['name', 'vectorIndexConfig']); - const imageFields = - (_a = config.imageFields) === null || _a === void 0 ? void 0 : _a.map(mapMulti2VecField); - const textFields = - (_b = config.textFields) === null || _b === void 0 ? void 0 : _b.map(mapMulti2VecField); - const videoFields = - (_c = config.videoFields) === null || _c === void 0 ? void 0 : _c.map(mapMulti2VecField); - let weights = {}; - weights = formatMulti2VecFields(weights, 'imageFields', imageFields); - weights = formatMulti2VecFields(weights, 'textFields', textFields); - weights = formatMulti2VecFields(weights, 'videoFields', videoFields); - return makeVectorizer(name, { - vectorIndexConfig, - vectorizerConfig: { - name: 'multi2vec-palm', - config: Object.assign(Object.assign({}, config), { - imageFields: - imageFields === null || imageFields === void 0 ? void 0 : imageFields.map((f) => f.name), - textFields: textFields === null || textFields === void 0 ? void 0 : textFields.map((f) => f.name), - videoFields: - videoFields === null || videoFields === void 0 ? void 0 : videoFields.map((f) => f.name), - weights: Object.keys(weights).length === 0 ? undefined : weights, - }), - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'multi2vec-google'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings-multimodal) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} opts The configuration options for the `multi2vec-google` vectorizer. - * @returns {VectorConfigCreate[], N, I, 'multi2vec-google'>} The configuration object. - */ - multi2VecGoogle: (opts) => { - var _a, _b, _c; - const { name, vectorIndexConfig } = opts, - config = __rest(opts, ['name', 'vectorIndexConfig']); - const imageFields = - (_a = config.imageFields) === null || _a === void 0 ? void 0 : _a.map(mapMulti2VecField); - const textFields = - (_b = config.textFields) === null || _b === void 0 ? void 0 : _b.map(mapMulti2VecField); - const videoFields = - (_c = config.videoFields) === null || _c === void 0 ? void 0 : _c.map(mapMulti2VecField); - let weights = {}; - weights = formatMulti2VecFields(weights, 'imageFields', imageFields); - weights = formatMulti2VecFields(weights, 'textFields', textFields); - weights = formatMulti2VecFields(weights, 'videoFields', videoFields); - return makeVectorizer(name, { - vectorIndexConfig, - vectorizerConfig: { - name: 'multi2vec-google', - config: Object.assign(Object.assign({}, config), { - imageFields: - imageFields === null || imageFields === void 0 ? void 0 : imageFields.map((f) => f.name), - textFields: textFields === null || textFields === void 0 ? void 0 : textFields.map((f) => f.name), - videoFields: - videoFields === null || videoFields === void 0 ? void 0 : videoFields.map((f) => f.name), - weights: Object.keys(weights).length === 0 ? undefined : weights, - }), - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'ref2vec-centroid'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/ref2vec-centroid) for detailed usage. - * - * @param {ConfigureNonTextVectorizerOptions} opts The configuration options for the `ref2vec-centroid` vectorizer. - * @returns {VectorConfigCreate} The configuration object. - */ - ref2VecCentroid: (opts) => { - const { name, vectorIndexConfig } = opts, - config = __rest(opts, ['name', 'vectorIndexConfig']); - return makeVectorizer(name, { - vectorIndexConfig, - vectorizerConfig: { - name: 'ref2vec-centroid', - config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-aws'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/aws/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration options for the `text2vec-aws` vectorizer. - * @returns { VectorConfigCreate, N, I, 'text2vec-aws'>} The configuration object. - */ - text2VecAWS: (opts) => { - const { name, sourceProperties, vectorIndexConfig } = opts, - config = __rest(opts, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-aws', - config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-azure-openai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration options for the `text2vec-azure-openai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-azure-openai'>} The configuration object. - */ - text2VecAzureOpenAI: (opts) => { - const { name, sourceProperties, vectorIndexConfig } = opts, - config = __rest(opts, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-azure-openai', - config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-cohere'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/cohere/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration options for the `text2vec-cohere` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-cohere'>} The configuration object. - */ - text2VecCohere: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-cohere', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-contextionary'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/modules/text2vec-contextionary) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-contextionary` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-contextionary'>} The configuration object. - */ - text2VecContextionary: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-contextionary', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-databricks'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/databricks/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration for the `text2vec-databricks` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-databricks'>} The configuration object. - */ - text2VecDatabricks: (opts) => { - const { name, sourceProperties, vectorIndexConfig } = opts, - config = __rest(opts, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-databricks', - config: config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-gpt4all'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/gpt4all/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-contextionary` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-gpt4all'>} The configuration object. - */ - text2VecGPT4All: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-gpt4all', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-huggingface'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/huggingface/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-contextionary` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-huggingface'>} The configuration object. - */ - text2VecHuggingFace: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-huggingface', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-jina'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/jinaai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-jina` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-jina'>} The configuration object. - */ - text2VecJina: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-jina', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-mistral'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/mistral/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-mistral` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-mistral'>} The configuration object. - */ - text2VecMistral: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-mistral', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-octoai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/octoai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-octoai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-octoai'>} The configuration object. - */ - text2VecOctoAI: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-octoai', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-openai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/openai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-openai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-openai'>} The configuration object. - */ - text2VecOpenAI: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-openai', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-ollama'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/ollama/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-ollama` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-ollama'>} The configuration object. - */ - text2VecOllama: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-ollama', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-palm'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration for the `text2vec-palm` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-palm'>} The configuration object. - * @deprecated Use `text2VecGoogle` instead. - */ - text2VecPalm: (opts) => { - console.warn('The `text2VecPalm` vectorizer is deprecated. Use `text2VecGoogle` instead.'); - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-palm', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-google'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/google/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} opts The configuration for the `text2vec-palm` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-google'>} The configuration object. - */ - text2VecGoogle: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-google', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-transformers'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/transformers/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-transformers` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-transformers'>} The configuration object. - */ - text2VecTransformers: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-transformers', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, - /** - * Create a `VectorConfigCreate` object with the vectorizer set to `'text2vec-voyageai'`. - * - * See the [documentation](https://weaviate.io/developers/weaviate/model-providers/voyageai/embeddings) for detailed usage. - * - * @param {ConfigureTextVectorizerOptions} [opts] The configuration for the `text2vec-voyageai` vectorizer. - * @returns {VectorConfigCreate, N, I, 'text2vec-voyageai'>} The configuration object. - */ - text2VecVoyageAI: (opts) => { - const _a = opts || {}, - { name, sourceProperties, vectorIndexConfig } = _a, - config = __rest(_a, ['name', 'sourceProperties', 'vectorIndexConfig']); - return makeVectorizer(name, { - sourceProperties, - vectorIndexConfig, - vectorizerConfig: { - name: 'text2vec-voyageai', - config: Object.keys(config).length === 0 ? undefined : config, - }, - }); - }, -}; diff --git a/dist/node/esm/collections/data/index.d.ts b/dist/node/esm/collections/data/index.d.ts deleted file mode 100644 index 16ec86e5..00000000 --- a/dist/node/esm/collections/data/index.d.ts +++ /dev/null @@ -1,144 +0,0 @@ -import Connection from '../../connection/grpc.js'; -import { ConsistencyLevel } from '../../data/index.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { FilterValue } from '../filters/index.js'; -import { - BatchObjectsReturn, - BatchReferencesReturn, - DataObject, - DeleteManyReturn, - NonReferenceInputs, - Properties, - ReferenceInput, - ReferenceInputs, - Vectors, -} from '../types/index.js'; -/** The available options to the `data.deleteMany` method. */ -export type DeleteManyOptions = { - /** Whether to return verbose information about the operation */ - verbose?: V; - /** Whether to perform a dry run of the operation */ - dryRun?: boolean; -}; -/** The available options to the `data.insert` method. */ -export type InsertObject = { - /** The ID of the object to be inserted. If not provided, a new ID will be generated. */ - id?: string; - /** The properties of the object to be inserted */ - properties?: NonReferenceInputs; - /** The references of the object to be inserted */ - references?: ReferenceInputs; - /** The vector(s) of the object to be inserted */ - vectors?: number[] | Vectors; -}; -/** The arguments of the `data.referenceX` methods */ -export type ReferenceArgs = { - /** The ID of the object that will have the reference */ - fromUuid: string; - /** The property of the object that will have the reference */ - fromProperty: string; - /** The object(s) to reference */ - to: ReferenceInput; -}; -/** The available options to the `data.replace` method. */ -export type ReplaceObject = { - /** The ID of the object to be replaced */ - id: string; - /** The properties of the object to be replaced */ - properties?: NonReferenceInputs; - /** The references of the object to be replaced */ - references?: ReferenceInputs; - vectors?: number[] | Vectors; -}; -/** The available options to the `data.update` method. */ -export type UpdateObject = { - /** The ID of the object to be updated */ - id: string; - /** The properties of the object to be updated */ - properties?: NonReferenceInputs; - /** The references of the object to be updated */ - references?: ReferenceInputs; - vectors?: number[] | Vectors; -}; -export interface Data { - deleteById: (id: string) => Promise; - deleteMany: ( - where: FilterValue, - opts?: DeleteManyOptions - ) => Promise>; - exists: (id: string) => Promise; - /** - * Insert a single object into the collection. - * - * If you don't provide any options to the function, then an empty object will be created. - * - * @param {InsertArgs | NonReferenceInputs} [args] The object to insert. If an `id` is provided, it will be used as the object's ID. If not, a new ID will be generated. - * @returns {Promise} The ID of the inserted object. - */ - insert: (obj?: InsertObject | NonReferenceInputs) => Promise; - /** - * Insert multiple objects into the collection. - * - * This object does not perform any batching for you. It sends all objects in a single request to Weaviate. - * - * @param {(DataObject | NonReferenceInputs)[]} objects The objects to insert. - * @returns {Promise>} The result of the batch insert. - */ - insertMany: (objects: (DataObject | NonReferenceInputs)[]) => Promise>; - /** - * Create a reference between an object in this collection and any other object in Weaviate. - * - * @param {ReferenceArgs

} args The reference to create. - * @returns {Promise} - */ - referenceAdd:

(args: ReferenceArgs

) => Promise; - /** - * Create multiple references between an object in this collection and any other object in Weaviate. - * - * This method is optimized for performance and sends all references in a single request. - * - * @param {ReferenceArgs

[]} refs The references to create. - * @returns {Promise} The result of the batch reference creation. - */ - referenceAddMany:

(refs: ReferenceArgs

[]) => Promise; - /** - * Delete a reference between an object in this collection and any other object in Weaviate. - * - * @param {ReferenceArgs

} args The reference to delete. - * @returns {Promise} - */ - referenceDelete:

(args: ReferenceArgs

) => Promise; - /** - * Replace a reference between an object in this collection and any other object in Weaviate. - * - * @param {ReferenceArgs

} args The reference to replace. - * @returns {Promise} - */ - referenceReplace:

(args: ReferenceArgs

) => Promise; - /** - * Replace an object in the collection. - * - * This is equivalent to a PUT operation. - * - * @param {ReplaceOptions} [opts] The object attributes to replace. - * @returns {Promise} - */ - replace: (obj: ReplaceObject) => Promise; - /** - * Update an object in the collection. - * - * This is equivalent to a PATCH operation. - * - * @param {UpdateArgs} [opts] The object attributes to replace. - * @returns {Promise} - */ - update: (obj: UpdateObject) => Promise; -} -declare const data: ( - connection: Connection, - name: string, - dbVersionSupport: DbVersionSupport, - consistencyLevel?: ConsistencyLevel, - tenant?: string -) => Data; -export default data; diff --git a/dist/node/esm/collections/data/index.js b/dist/node/esm/collections/data/index.js deleted file mode 100644 index 968bb904..00000000 --- a/dist/node/esm/collections/data/index.js +++ /dev/null @@ -1,202 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -import { buildRefsPath } from '../../batch/path.js'; -import { Checker } from '../../data/index.js'; -import { ObjectsPath, ReferencesPath } from '../../data/path.js'; -import { Deserialize } from '../deserialize/index.js'; -import { referenceToBeacons } from '../references/utils.js'; -import { DataGuards, Serialize } from '../serialize/index.js'; -const addContext = (builder, consistencyLevel, tenant) => { - if (consistencyLevel) { - builder = builder.withConsistencyLevel(consistencyLevel); - } - if (tenant) { - builder = builder.withTenant(tenant); - } - return builder; -}; -const data = (connection, name, dbVersionSupport, consistencyLevel, tenant) => { - const objectsPath = new ObjectsPath(dbVersionSupport); - const referencesPath = new ReferencesPath(dbVersionSupport); - const parseObject = (object) => - __awaiter(void 0, void 0, void 0, function* () { - if (!object) { - return {}; - } - const obj = { - id: object.id, - properties: object.properties - ? Serialize.restProperties(object.properties, object.references) - : undefined, - }; - if (Array.isArray(object.vectors)) { - const supportsNamedVectors = yield dbVersionSupport.supportsNamedVectors(); - if (supportsNamedVectors.supports) { - obj.vector = object.vectors; - obj.vectors = { default: object.vectors }; - } else { - obj.vector = object.vectors; - } - } else if (object.vectors) { - obj.vectors = object.vectors; - } - return obj; - }); - return { - deleteById: (id) => - objectsPath - .buildDelete(id, name, consistencyLevel, tenant) - .then((path) => connection.delete(path, undefined, false)) - .then(() => true), - deleteMany: (where, opts) => - connection - .batch(name, consistencyLevel, tenant) - .then((batch) => - batch.withDelete({ - filters: Serialize.filtersGRPC(where), - dryRun: opts === null || opts === void 0 ? void 0 : opts.dryRun, - verbose: opts === null || opts === void 0 ? void 0 : opts.verbose, - }) - ) - .then((reply) => - Deserialize.deleteMany(reply, opts === null || opts === void 0 ? void 0 : opts.verbose) - ), - exists: (id) => - addContext( - new Checker(connection, objectsPath).withId(id).withClassName(name), - consistencyLevel, - tenant - ).do(), - insert: (obj) => - Promise.all([ - objectsPath.buildCreate(consistencyLevel), - parseObject(obj ? (DataGuards.isDataObject(obj) ? obj : { properties: obj }) : obj), - ]).then(([path, object]) => - connection - .postReturn(path, Object.assign({ class: name, tenant: tenant }, object)) - .then((obj) => obj.id) - ), - insertMany: (objects) => - connection.batch(name, consistencyLevel).then((batch) => - __awaiter(void 0, void 0, void 0, function* () { - const supportsNamedVectors = yield dbVersionSupport.supportsNamedVectors(); - const serialized = yield Serialize.batchObjects( - name, - objects, - supportsNamedVectors.supports, - tenant - ); - const start = Date.now(); - const reply = yield batch.withObjects({ objects: serialized.mapped }); - const end = Date.now(); - return Deserialize.batchObjects(reply, serialized.batch, serialized.mapped, end - start); - }) - ), - referenceAdd: (args) => - referencesPath - .build(args.fromUuid, name, args.fromProperty, consistencyLevel, tenant) - .then((path) => - Promise.all(referenceToBeacons(args.to).map((beacon) => connection.postEmpty(path, beacon))) - ) - .then(() => {}), - referenceAddMany: (refs) => { - const path = buildRefsPath( - new URLSearchParams(consistencyLevel ? { consistency_level: consistencyLevel } : {}) - ); - const references = []; - refs.forEach((ref) => { - referenceToBeacons(ref.to).forEach((beacon) => { - references.push({ - from: `weaviate://localhost/${name}/${ref.fromUuid}/${ref.fromProperty}`, - to: beacon.beacon, - tenant: tenant, - }); - }); - }); - const start = Date.now(); - return connection.postReturn(path, references).then((res) => { - const end = Date.now(); - const errors = {}; - res.forEach((entry, idx) => { - var _a, _b, _c, _d, _e, _f, _g; - if (((_a = entry.result) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED') { - errors[idx] = { - message: ( - (_d = - (_c = (_b = entry.result) === null || _b === void 0 ? void 0 : _b.errors) === null || - _c === void 0 - ? void 0 - : _c.error) === null || _d === void 0 - ? void 0 - : _d[0].message - ) - ? (_g = - (_f = (_e = entry.result) === null || _e === void 0 ? void 0 : _e.errors) === null || - _f === void 0 - ? void 0 - : _f.error) === null || _g === void 0 - ? void 0 - : _g[0].message - : 'unknown error', - reference: references[idx], - }; - } - }); - return { - elapsedSeconds: end - start, - errors: errors, - hasErrors: Object.keys(errors).length > 0, - }; - }); - }, - referenceDelete: (args) => - referencesPath - .build(args.fromUuid, name, args.fromProperty, consistencyLevel, tenant) - .then((path) => - Promise.all(referenceToBeacons(args.to).map((beacon) => connection.delete(path, beacon, false))) - ) - .then(() => {}), - referenceReplace: (args) => - referencesPath - .build(args.fromUuid, name, args.fromProperty, consistencyLevel, tenant) - .then((path) => connection.put(path, referenceToBeacons(args.to), false)), - replace: (obj) => - Promise.all([objectsPath.buildUpdate(obj.id, name, consistencyLevel), parseObject(obj)]).then( - ([path, object]) => connection.put(path, Object.assign({ class: name, tenant: tenant }, object)) - ), - update: (obj) => - Promise.all([objectsPath.buildUpdate(obj.id, name, consistencyLevel), parseObject(obj)]).then( - ([path, object]) => connection.patch(path, Object.assign({ class: name, tenant: tenant }, object)) - ), - }; -}; -export default data; diff --git a/dist/node/esm/collections/deserialize/index.d.ts b/dist/node/esm/collections/deserialize/index.d.ts deleted file mode 100644 index 19f8a3f1..00000000 --- a/dist/node/esm/collections/deserialize/index.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Tenant as TenantREST } from '../../openapi/types.js'; -import { BatchObject as BatchObjectGRPC, BatchObjectsReply } from '../../proto/v1/batch.js'; -import { BatchDeleteReply } from '../../proto/v1/batch_delete.js'; -import { SearchReply } from '../../proto/v1/search_get.js'; -import { TenantsGetReply } from '../../proto/v1/tenants.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { Tenant } from '../tenants/index.js'; -import { - BatchObject, - BatchObjectsReturn, - DeleteManyReturn, - GenerativeGroupByReturn, - GenerativeReturn, - GroupByReturn, - WeaviateReturn, -} from '../types/index.js'; -export declare class Deserialize { - private supports125ListValue; - private constructor(); - static use(support: DbVersionSupport): Promise; - query(reply: SearchReply): WeaviateReturn; - generate(reply: SearchReply): GenerativeReturn; - groupBy(reply: SearchReply): GroupByReturn; - generateGroupBy(reply: SearchReply): GenerativeGroupByReturn; - private properties; - private references; - private parsePropertyValue; - private parseListValue; - private objectProperties; - private static metadata; - private static uuid; - private static vectorFromBytes; - private static intsFromBytes; - private static numbersFromBytes; - private static vectors; - static batchObjects( - reply: BatchObjectsReply, - originalObjs: BatchObject[], - mappedObjs: BatchObjectGRPC[], - elapsed: number - ): BatchObjectsReturn; - static deleteMany(reply: BatchDeleteReply, verbose?: V): DeleteManyReturn; - private static activityStatusGRPC; - static activityStatusREST(status: TenantREST['activityStatus']): Tenant['activityStatus']; - static tenantsGet(reply: TenantsGetReply): Record; -} diff --git a/dist/node/esm/collections/deserialize/index.js b/dist/node/esm/collections/deserialize/index.js deleted file mode 100644 index c25584f1..00000000 --- a/dist/node/esm/collections/deserialize/index.js +++ /dev/null @@ -1,340 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -import { WeaviateDeserializationError } from '../../errors.js'; -import { TenantActivityStatus } from '../../proto/v1/tenants.js'; -import { referenceFromObjects } from '../references/utils.js'; -export class Deserialize { - constructor(supports125ListValue) { - this.supports125ListValue = supports125ListValue; - } - static use(support) { - return __awaiter(this, void 0, void 0, function* () { - const supports125ListValue = yield support.supports125ListValue().then((res) => res.supports); - return new Deserialize(supports125ListValue); - }); - } - query(reply) { - return { - objects: reply.results.map((result) => { - return { - metadata: Deserialize.metadata(result.metadata), - properties: this.properties(result.properties), - references: this.references(result.properties), - uuid: Deserialize.uuid(result.metadata), - vectors: Deserialize.vectors(result.metadata), - }; - }), - }; - } - generate(reply) { - return { - objects: reply.results.map((result) => { - var _a, _b; - return { - generated: ((_a = result.metadata) === null || _a === void 0 ? void 0 : _a.generativePresent) - ? (_b = result.metadata) === null || _b === void 0 - ? void 0 - : _b.generative - : undefined, - metadata: Deserialize.metadata(result.metadata), - properties: this.properties(result.properties), - references: this.references(result.properties), - uuid: Deserialize.uuid(result.metadata), - vectors: Deserialize.vectors(result.metadata), - }; - }), - generated: reply.generativeGroupedResult, - }; - } - groupBy(reply) { - const objects = []; - const groups = {}; - reply.groupByResults.forEach((result) => { - const objs = result.objects.map((object) => { - return { - belongsToGroup: result.name, - metadata: Deserialize.metadata(object.metadata), - properties: this.properties(object.properties), - references: this.references(object.properties), - uuid: Deserialize.uuid(object.metadata), - vectors: Deserialize.vectors(object.metadata), - }; - }); - groups[result.name] = { - maxDistance: result.maxDistance, - minDistance: result.minDistance, - name: result.name, - numberOfObjects: result.numberOfObjects, - objects: objs, - }; - objects.push(...objs); - }); - return { - objects: objects, - groups: groups, - }; - } - generateGroupBy(reply) { - const objects = []; - const groups = {}; - reply.groupByResults.forEach((result) => { - var _a; - const objs = result.objects.map((object) => { - return { - belongsToGroup: result.name, - metadata: Deserialize.metadata(object.metadata), - properties: this.properties(object.properties), - references: this.references(object.properties), - uuid: Deserialize.uuid(object.metadata), - vectors: Deserialize.vectors(object.metadata), - }; - }); - groups[result.name] = { - maxDistance: result.maxDistance, - minDistance: result.minDistance, - name: result.name, - numberOfObjects: result.numberOfObjects, - objects: objs, - generated: (_a = result.generative) === null || _a === void 0 ? void 0 : _a.result, - }; - objects.push(...objs); - }); - return { - objects: objects, - groups: groups, - generated: reply.generativeGroupedResult, - }; - } - properties(properties) { - if (!properties) return {}; - return this.objectProperties(properties.nonRefProps); - } - references(properties) { - if (!properties) return undefined; - if (properties.refProps.length === 0) return properties.refPropsRequested ? {} : undefined; - const out = {}; - properties.refProps.forEach((property) => { - const uuids = []; - out[property.propName] = referenceFromObjects( - property.properties.map((property) => { - const uuid = Deserialize.uuid(property.metadata); - uuids.push(uuid); - return { - metadata: Deserialize.metadata(property.metadata), - properties: this.properties(property), - references: this.references(property), - uuid: uuid, - vectors: Deserialize.vectors(property.metadata), - }; - }), - property.properties.length > 0 ? property.properties[0].targetCollection : '', - uuids - ); - }); - return out; - } - parsePropertyValue(value) { - if (value.boolValue !== undefined) return value.boolValue; - if (value.dateValue !== undefined) return new Date(value.dateValue); - if (value.intValue !== undefined) return value.intValue; - if (value.listValue !== undefined) - return this.supports125ListValue - ? this.parseListValue(value.listValue) - : value.listValue.values.map((v) => this.parsePropertyValue(v)); - if (value.numberValue !== undefined) return value.numberValue; - if (value.objectValue !== undefined) return this.objectProperties(value.objectValue); - if (value.stringValue !== undefined) return value.stringValue; - if (value.textValue !== undefined) return value.textValue; - if (value.uuidValue !== undefined) return value.uuidValue; - if (value.blobValue !== undefined) return value.blobValue; - if (value.geoValue !== undefined) return value.geoValue; - if (value.phoneValue !== undefined) return value.phoneValue; - if (value.nullValue !== undefined) return undefined; - throw new WeaviateDeserializationError(`Unknown value type: ${JSON.stringify(value, null, 2)}`); - } - parseListValue(value) { - if (value.boolValues !== undefined) return value.boolValues.values; - if (value.dateValues !== undefined) return value.dateValues.values.map((date) => new Date(date)); - if (value.intValues !== undefined) return Deserialize.intsFromBytes(value.intValues.values); - if (value.numberValues !== undefined) return Deserialize.numbersFromBytes(value.numberValues.values); - if (value.objectValues !== undefined) - return value.objectValues.values.map((v) => this.objectProperties(v)); - if (value.textValues !== undefined) return value.textValues.values; - if (value.uuidValues !== undefined) return value.uuidValues.values; - throw new Error(`Unknown list value type: ${JSON.stringify(value, null, 2)}`); - } - objectProperties(properties) { - const out = {}; - if (properties) { - Object.entries(properties.fields).forEach(([key, value]) => { - out[key] = this.parsePropertyValue(value); - }); - } - return out; - } - static metadata(metadata) { - const out = {}; - if (!metadata) return undefined; - if (metadata.creationTimeUnixPresent) out.creationTime = new Date(metadata.creationTimeUnix); - if (metadata.lastUpdateTimeUnixPresent) out.updateTime = new Date(metadata.lastUpdateTimeUnix); - if (metadata.distancePresent) out.distance = metadata.distance; - if (metadata.certaintyPresent) out.certainty = metadata.certainty; - if (metadata.scorePresent) out.score = metadata.score; - if (metadata.explainScorePresent) out.explainScore = metadata.explainScore; - if (metadata.rerankScorePresent) out.rerankScore = metadata.rerankScore; - if (metadata.isConsistent) out.isConsistent = metadata.isConsistent; - return out; - } - static uuid(metadata) { - if (!metadata || !(metadata.id.length > 0)) - throw new WeaviateDeserializationError('No uuid returned from server'); - return metadata.id; - } - static vectorFromBytes(bytes) { - const buffer = Buffer.from(bytes); - const view = new Float32Array(buffer.buffer, buffer.byteOffset, buffer.byteLength / 4); // vector is float32 in weaviate - return Array.from(view); - } - static intsFromBytes(bytes) { - const buffer = Buffer.from(bytes); - const view = new BigInt64Array(buffer.buffer, buffer.byteOffset, buffer.byteLength / 8); // ints are float64 in weaviate - return Array.from(view).map(Number); - } - static numbersFromBytes(bytes) { - const buffer = Buffer.from(bytes); - const view = new Float64Array(buffer.buffer, buffer.byteOffset, buffer.byteLength / 8); // numbers are float64 in weaviate - return Array.from(view); - } - static vectors(metadata) { - if (!metadata) return {}; - if (metadata.vectorBytes.length === 0 && metadata.vector.length === 0 && metadata.vectors.length === 0) - return {}; - if (metadata.vectorBytes.length > 0) - return { default: Deserialize.vectorFromBytes(metadata.vectorBytes) }; - return Object.fromEntries( - metadata.vectors.map((vector) => [vector.name, Deserialize.vectorFromBytes(vector.vectorBytes)]) - ); - } - static batchObjects(reply, originalObjs, mappedObjs, elapsed) { - const allResponses = []; - const errors = {}; - const successes = {}; - const batchErrors = {}; - reply.errors.forEach((error) => { - batchErrors[error.index] = error.error; - }); - for (const [index, object] of originalObjs.entries()) { - if (index in batchErrors) { - const error = { - message: batchErrors[index], - object: object, - originalUuid: object.id, - }; - errors[index] = error; - allResponses[index] = error; - } else { - const mappedObj = mappedObjs[index]; - successes[index] = mappedObj.uuid; - allResponses[index] = mappedObj.uuid; - } - } - return { - uuids: successes, - errors: errors, - hasErrors: reply.errors.length > 0, - allResponses: allResponses, - elapsedSeconds: elapsed, - }; - } - static deleteMany(reply, verbose) { - return Object.assign(Object.assign({}, reply), { - objects: verbose - ? reply.objects.map((obj) => { - return { - id: obj.uuid.toString(), - successful: obj.successful, - error: obj.error, - }; - }) - : undefined, - }); - } - static activityStatusGRPC(status) { - switch (status) { - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_COLD: - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_INACTIVE: - return 'INACTIVE'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_HOT: - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_ACTIVE: - return 'ACTIVE'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_FROZEN: - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_OFFLOADED: - return 'OFFLOADED'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_FREEZING: - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_OFFLOADING: - return 'OFFLOADING'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_UNFREEZING: - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_ONLOADING: - return 'ONLOADING'; - default: - throw new Error(`Unsupported tenant activity status: ${status}`); - } - } - static activityStatusREST(status) { - switch (status) { - case 'COLD': - return 'INACTIVE'; - case 'HOT': - return 'ACTIVE'; - case 'FROZEN': - return 'OFFLOADED'; - case 'FREEZING': - return 'OFFLOADING'; - case 'UNFREEZING': - return 'ONLOADING'; - case undefined: - return 'ACTIVE'; - default: - return status; - } - } - static tenantsGet(reply) { - const tenants = {}; - reply.tenants.forEach((t) => { - tenants[t.name] = { - name: t.name, - activityStatus: Deserialize.activityStatusGRPC(t.activityStatus), - }; - }); - return tenants; - } -} diff --git a/dist/node/esm/collections/filters/classes.d.ts b/dist/node/esm/collections/filters/classes.d.ts deleted file mode 100644 index 83119423..00000000 --- a/dist/node/esm/collections/filters/classes.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { FilterTarget } from '../../proto/v1/base.js'; -import { ExtractCrossReferenceType, NonRefKeys, RefKeys } from '../types/internal.js'; -import { - ContainsValue, - CountRef, - Filter, - FilterByProperty, - FilterValue, - GeoRangeFilter, - TargetRefs, -} from './types.js'; -/** - * Use this class when you want to chain filters together using logical operators. - * - * Since JS/TS has no native support for & and | as logical operators, you must use these methods and nest - * the filters you want to combine. - * - * ANDs and ORs can be nested an arbitrary number of times. - * - * @example - * ```ts - * const filter = Filters.and( - * collection.filter.byProperty('name').equal('John'), - * collection.filter.byProperty('age').greaterThan(18), - * ); - * ``` - */ -export declare class Filters { - /** - * Combine filters using the logical AND operator. - * - * @param {FilterValue[]} filters The filters to combine. - */ - static and(...filters: FilterValue[]): FilterValue; - /** - * Combine filters using the logical OR operator. - * - * @param {FilterValue[]} filters The filters to combine. - */ - static or(...filters: FilterValue[]): FilterValue; -} -export declare class FilterBase { - protected target?: TargetRefs; - protected property: string | CountRef; - constructor(property: string | CountRef, target?: TargetRefs); - protected targetPath(): FilterTarget; - private resolveTargets; -} -export declare class FilterProperty extends FilterBase implements FilterByProperty { - constructor(property: string, length: boolean, target?: TargetRefs); - isNull(value: boolean): FilterValue; - containsAny>(value: U[]): FilterValue; - containsAll>(value: U[]): FilterValue; - equal(value: V): FilterValue; - notEqual(value: V): FilterValue; - lessThan(value: U): FilterValue; - lessOrEqual(value: U): FilterValue; - greaterThan(value: U): FilterValue; - greaterOrEqual(value: U): FilterValue; - like(value: string): FilterValue; - withinGeoRange(value: GeoRangeFilter): FilterValue; -} -export declare class FilterRef implements Filter { - private target; - constructor(target: TargetRefs); - byRef & string>(linkOn: K): Filter>; - byRefMultiTarget & string>( - linkOn: K, - targetCollection: string - ): FilterRef>; - byProperty & string>(name: K, length?: boolean): FilterProperty; - byRefCount & string>(linkOn: K): FilterCount; - byId(): FilterId; - byCreationTime(): FilterCreationTime; - byUpdateTime(): FilterUpdateTime; -} -export declare class FilterCount extends FilterBase { - constructor(linkOn: string, target?: TargetRefs); - equal(value: number): FilterValue; - notEqual(value: number): FilterValue; - lessThan(value: number): FilterValue; - lessOrEqual(value: number): FilterValue; - greaterThan(value: number): FilterValue; - greaterOrEqual(value: number): FilterValue; -} -export declare class FilterId extends FilterBase { - constructor(target?: TargetRefs); - equal(value: string): FilterValue; - notEqual(value: string): FilterValue; - containsAny(value: string[]): FilterValue; -} -export declare class FilterTime extends FilterBase { - containsAny(value: (string | Date)[]): FilterValue; - equal(value: string | Date): FilterValue; - notEqual(value: string | Date): FilterValue; - lessThan(value: string | Date): FilterValue; - lessOrEqual(value: string | Date): FilterValue; - greaterThan(value: string | Date): FilterValue; - greaterOrEqual(value: string | Date): FilterValue; - private toValue; -} -export declare class FilterCreationTime extends FilterTime { - constructor(target?: TargetRefs); -} -export declare class FilterUpdateTime extends FilterTime { - constructor(target?: TargetRefs); -} diff --git a/dist/node/esm/collections/filters/classes.js b/dist/node/esm/collections/filters/classes.js deleted file mode 100644 index 84ee5114..00000000 --- a/dist/node/esm/collections/filters/classes.js +++ /dev/null @@ -1,348 +0,0 @@ -import { WeaviateInvalidInputError } from '../../errors.js'; -import { - FilterReferenceCount, - FilterReferenceMultiTarget, - FilterReferenceSingleTarget, - FilterTarget, -} from '../../proto/v1/base.js'; -import { TargetGuards } from './utils.js'; -/** - * Use this class when you want to chain filters together using logical operators. - * - * Since JS/TS has no native support for & and | as logical operators, you must use these methods and nest - * the filters you want to combine. - * - * ANDs and ORs can be nested an arbitrary number of times. - * - * @example - * ```ts - * const filter = Filters.and( - * collection.filter.byProperty('name').equal('John'), - * collection.filter.byProperty('age').greaterThan(18), - * ); - * ``` - */ -export class Filters { - /** - * Combine filters using the logical AND operator. - * - * @param {FilterValue[]} filters The filters to combine. - */ - static and(...filters) { - return { - operator: 'And', - filters: filters, - value: null, - }; - } - /** - * Combine filters using the logical OR operator. - * - * @param {FilterValue[]} filters The filters to combine. - */ - static or(...filters) { - return { - operator: 'Or', - filters: filters, - value: null, - }; - } -} -export class FilterBase { - constructor(property, target) { - this.property = property; - this.target = target; - } - targetPath() { - if (!this.target) { - return FilterTarget.fromPartial({ - property: TargetGuards.isProperty(this.property) ? this.property : undefined, - count: TargetGuards.isCountRef(this.property) - ? FilterReferenceCount.fromPartial({ - on: this.property.linkOn, - }) - : undefined, - }); - } - let target = this.target; - while (target.target !== undefined) { - if (TargetGuards.isTargetRef(target.target)) { - target = target.target; - } else { - throw new WeaviateInvalidInputError('Invalid target reference'); - } - } - target.target = this.property; - return this.resolveTargets(this.target); - } - resolveTargets(internal) { - return FilterTarget.fromPartial({ - property: TargetGuards.isProperty(internal) ? internal : undefined, - singleTarget: TargetGuards.isSingleTargetRef(internal) - ? FilterReferenceSingleTarget.fromPartial({ - on: internal.linkOn, - target: this.resolveTargets(internal.target), - }) - : undefined, - multiTarget: TargetGuards.isMultiTargetRef(internal) - ? FilterReferenceMultiTarget.fromPartial({ - on: internal.linkOn, - targetCollection: internal.targetCollection, - target: this.resolveTargets(internal.target), - }) - : undefined, - count: TargetGuards.isCountRef(internal) - ? FilterReferenceCount.fromPartial({ - on: internal.linkOn, - }) - : undefined, - }); - } -} -export class FilterProperty extends FilterBase { - constructor(property, length, target) { - super(length ? `len(${property})` : property, target); - } - isNull(value) { - return { - operator: 'IsNull', - target: this.targetPath(), - value: value, - }; - } - containsAny(value) { - return { - operator: 'ContainsAny', - target: this.targetPath(), - value: value, - }; - } - containsAll(value) { - return { - operator: 'ContainsAll', - target: this.targetPath(), - value: value, - }; - } - equal(value) { - return { - operator: 'Equal', - target: this.targetPath(), - value: value, - }; - } - notEqual(value) { - return { - operator: 'NotEqual', - target: this.targetPath(), - value: value, - }; - } - lessThan(value) { - return { - operator: 'LessThan', - target: this.targetPath(), - value: value, - }; - } - lessOrEqual(value) { - return { - operator: 'LessThanEqual', - target: this.targetPath(), - value: value, - }; - } - greaterThan(value) { - return { - operator: 'GreaterThan', - target: this.targetPath(), - value: value, - }; - } - greaterOrEqual(value) { - return { - operator: 'GreaterThanEqual', - target: this.targetPath(), - value: value, - }; - } - like(value) { - return { - operator: 'Like', - target: this.targetPath(), - value: value, - }; - } - withinGeoRange(value) { - return { - operator: 'WithinGeoRange', - target: this.targetPath(), - value: value, - }; - } -} -export class FilterRef { - constructor(target) { - this.target = target; - } - byRef(linkOn) { - this.target.target = { type_: 'single', linkOn: linkOn }; - return new FilterRef(this.target); - } - byRefMultiTarget(linkOn, targetCollection) { - this.target.target = { type_: 'multi', linkOn: linkOn, targetCollection: targetCollection }; - return new FilterRef(this.target); - } - byProperty(name, length = false) { - return new FilterProperty(name, length, this.target); - } - byRefCount(linkOn) { - return new FilterCount(linkOn, this.target); - } - byId() { - return new FilterId(this.target); - } - byCreationTime() { - return new FilterCreationTime(this.target); - } - byUpdateTime() { - return new FilterUpdateTime(this.target); - } -} -export class FilterCount extends FilterBase { - constructor(linkOn, target) { - super({ type_: 'count', linkOn }, target); - } - equal(value) { - return { - operator: 'Equal', - target: this.targetPath(), - value: value, - }; - } - notEqual(value) { - return { - operator: 'NotEqual', - target: this.targetPath(), - value: value, - }; - } - lessThan(value) { - return { - operator: 'LessThan', - target: this.targetPath(), - value: value, - }; - } - lessOrEqual(value) { - return { - operator: 'LessThanEqual', - target: this.targetPath(), - value: value, - }; - } - greaterThan(value) { - return { - operator: 'GreaterThan', - target: this.targetPath(), - value: value, - }; - } - greaterOrEqual(value) { - return { - operator: 'GreaterThanEqual', - target: this.targetPath(), - value: value, - }; - } -} -export class FilterId extends FilterBase { - constructor(target) { - super('_id', target); - } - equal(value) { - return { - operator: 'Equal', - target: this.targetPath(), - value: value, - }; - } - notEqual(value) { - return { - operator: 'NotEqual', - target: this.targetPath(), - value: value, - }; - } - containsAny(value) { - return { - operator: 'ContainsAny', - target: this.targetPath(), - value: value, - }; - } -} -export class FilterTime extends FilterBase { - containsAny(value) { - return { - operator: 'ContainsAny', - target: this.targetPath(), - value: value.map(this.toValue), - }; - } - equal(value) { - return { - operator: 'Equal', - target: this.targetPath(), - value: this.toValue(value), - }; - } - notEqual(value) { - return { - operator: 'NotEqual', - target: this.targetPath(), - value: this.toValue(value), - }; - } - lessThan(value) { - return { - operator: 'LessThan', - target: this.targetPath(), - value: this.toValue(value), - }; - } - lessOrEqual(value) { - return { - operator: 'LessThanEqual', - target: this.targetPath(), - value: this.toValue(value), - }; - } - greaterThan(value) { - return { - operator: 'GreaterThan', - target: this.targetPath(), - value: this.toValue(value), - }; - } - greaterOrEqual(value) { - return { - operator: 'GreaterThanEqual', - target: this.targetPath(), - value: this.toValue(value), - }; - } - toValue(value) { - return value instanceof Date ? value.toISOString() : value; - } -} -export class FilterCreationTime extends FilterTime { - constructor(target) { - super('_creationTimeUnix', target); - } -} -export class FilterUpdateTime extends FilterTime { - constructor(target) { - super('_lastUpdateTimeUnix', target); - } -} diff --git a/dist/node/esm/collections/filters/index.d.ts b/dist/node/esm/collections/filters/index.d.ts deleted file mode 100644 index 952d5e83..00000000 --- a/dist/node/esm/collections/filters/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -export { Filters } from './classes.js'; -export type { - Filter, - FilterByCount, - FilterById, - FilterByProperty, - FilterByTime, - FilterValue, - GeoRangeFilter, - Operator, -} from './types.js'; -import { Filter } from './types.js'; -declare const filter: () => Filter; -export default filter; diff --git a/dist/node/esm/collections/filters/index.js b/dist/node/esm/collections/filters/index.js deleted file mode 100644 index 25d304e7..00000000 --- a/dist/node/esm/collections/filters/index.js +++ /dev/null @@ -1,39 +0,0 @@ -export { Filters } from './classes.js'; -import { - FilterCount, - FilterCreationTime, - FilterId, - FilterProperty, - FilterRef, - FilterUpdateTime, -} from './classes.js'; -const filter = () => { - return { - byProperty: (name, length = false) => { - return new FilterProperty(name, length); - }, - byRef: (linkOn) => { - return new FilterRef({ type_: 'single', linkOn: linkOn }); - }, - byRefMultiTarget: (linkOn, targetCollection) => { - return new FilterRef({ - type_: 'multi', - linkOn: linkOn, - targetCollection: targetCollection, - }); - }, - byRefCount: (linkOn) => { - return new FilterCount(linkOn); - }, - byId: () => { - return new FilterId(); - }, - byCreationTime: () => { - return new FilterCreationTime(); - }, - byUpdateTime: () => { - return new FilterUpdateTime(); - }, - }; -}; -export default filter; diff --git a/dist/node/esm/collections/filters/types.d.ts b/dist/node/esm/collections/filters/types.d.ts deleted file mode 100644 index 2dbe3b0e..00000000 --- a/dist/node/esm/collections/filters/types.d.ts +++ /dev/null @@ -1,303 +0,0 @@ -import { FilterTarget } from '../../proto/v1/base.js'; -import { ExtractCrossReferenceType, NonRefKeys, RefKeys } from '../types/internal.js'; -export type Operator = - | 'Equal' - | 'NotEqual' - | 'GreaterThan' - | 'GreaterThanEqual' - | 'LessThan' - | 'LessThanEqual' - | 'Like' - | 'IsNull' - | 'WithinGeoRange' - | 'ContainsAny' - | 'ContainsAll' - | 'And' - | 'Or'; -export type FilterValue = { - filters?: FilterValue[]; - operator: Operator; - target?: FilterTarget; - value: V; -}; -export type SingleTargetRef = { - type_: 'single'; - linkOn: string; - target?: FilterTargetInternal; -}; -export type MultiTargetRef = { - type_: 'multi'; - linkOn: string; - targetCollection: string; - target?: FilterTargetInternal; -}; -export type CountRef = { - type_: 'count'; - linkOn: string; -}; -export type FilterTargetInternal = SingleTargetRef | MultiTargetRef | CountRef | string; -export type TargetRefs = SingleTargetRef | MultiTargetRef; -export type GeoRangeFilter = { - latitude: number; - longitude: number; - distance: number; -}; -export type FilterValueType = PrimitiveFilterValueType | PrimitiveListFilterValueType; -export type PrimitiveFilterValueType = number | string | boolean | Date | GeoRangeFilter; -export type PrimitiveListFilterValueType = number[] | string[] | boolean[] | Date[]; -export type ContainsValue = V extends (infer U)[] ? U : V; -export interface Filter { - /** - * Define a filter based on a property to be used when querying and deleting from a collection. - * - * @param {K} name The name of the property to filter on. - * @param {boolean} [length] Whether to filter on the length of the property or not, defaults to false. - * @returns {FilterByProperty} An interface exposing methods to filter on the property. - */ - byProperty: & string>(name: K, length?: boolean) => FilterByProperty; - /** - * Define a filter based on a single-target reference to be used when querying and deleting from a collection. - * - * @param {K} linkOn The name of the property to filter on. - * @returns {Filter>} An interface exposing methods to filter on the reference. - */ - byRef: & string>(linkOn: K) => Filter>; - /** - * Define a filter based on a multi-target reference to be used when querying and deleting from a collection. - * - * @param {K} linkOn The name of the property to filter on. - * @param {string} targetCollection The name of the target collection to filter on. - * @returns {Filter>} An interface exposing methods to filter on the reference. - */ - byRefMultiTarget: & string>( - linkOn: K, - targetCollection: string - ) => Filter>; - /** - * Define a filter based on the number of objects in a cross-reference to be used when querying and deleting from a collection. - * - * @param {K} linkOn The name of the property to filter on. - * @returns {FilterByCount} An interface exposing methods to filter on the count. - */ - byRefCount: & string>(linkOn: K) => FilterByCount; - /** - * Define a filter based on the ID to be used when querying and deleting from a collection. - * - * @returns {FilterById} An interface exposing methods to filter on the ID. - */ - byId: () => FilterById; - /** - * Define a filter based on the creation time to be used when querying and deleting from a collection. - * - * @returns {FilterByTime} An interface exposing methods to filter on the creation time. - */ - byCreationTime: () => FilterByTime; - /** - * Define a filter based on the update time to be used when querying and deleting from a collection. - * - * @returns {FilterByTime} An interface exposing methods to filter on the update time. - */ - byUpdateTime: () => FilterByTime; -} -export interface FilterByProperty { - /** - * Filter on whether the property is `null`. - * - * @param {boolean} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - isNull: (value: boolean) => FilterValue; - /** - * Filter on whether the property contains any of the given values. - * - * @param {U[]} value The values to filter on. - * @returns {FilterValue} The filter value. - */ - containsAny: >(value: U[]) => FilterValue; - /** - * Filter on whether the property contains all of the given values. - * - * @param {U[]} value The values to filter on. - * @returns {FilterValue} The filter value. - */ - containsAll: >(value: U[]) => FilterValue; - /** - * Filter on whether the property is equal to the given value. - * - * @param {V} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - equal: (value: T) => FilterValue; - /** - * Filter on whether the property is not equal to the given value. - * - * @param {V} value The value to filter on. - * @returns {FilterValue} The filter value. - * */ - notEqual: (value: T) => FilterValue; - /** - * Filter on whether the property is less than the given value. - * - * @param {number | Date} value The value to filter on. - * @returns {FilterValue | FilterValue} The filter value. - */ - lessThan: (value: U) => FilterValue; - /** - * Filter on whether the property is less than or equal to the given value. - * - * @param {number | Date} value The value to filter on. - * @returns {FilterValue | FilterValue} The filter value. - */ - lessOrEqual: (value: U) => FilterValue; - /** - * Filter on whether the property is greater than the given value. - * - * @param {number | Date} value The value to filter on. - * @returns {FilterValue | FilterValue} The filter value. - */ - greaterThan: (value: U) => FilterValue; - /** - * Filter on whether the property is greater than or equal to the given value. - * - * @param {number | Date} value The value to filter on. - * @returns {FilterValue | FilterValue} The filter value. - */ - greaterOrEqual: (value: U) => FilterValue; - /** - * Filter on whether the property is like the given value. - * - * This filter can make use of `*` and `?` as wildcards. - * See [the docs](https://weaviate.io/developers/weaviate/search/filters#by-partial-matches-text) for more details. - * - * @param {string} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - like: (value: string) => FilterValue; - /** - * Filter on whether the property is within a given range of a geo-coordinate. - * - * See [the docs](https://weaviate.io/developers/weaviate/search/filters##by-geo-coordinates) for more details. - * - * @param {GeoRangeFilter} value The geo-coordinate range to filter on. - * @returns {FilterValue} The filter value. - */ - withinGeoRange: (value: GeoRangeFilter) => FilterValue; -} -export interface FilterByCount { - /** - * Filter on whether the number of references is equal to the given integer. - * - * @param {number} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - equal: (value: number) => FilterValue; - /** - * Filter on whether the number of references is not equal to the given integer. - * - * @param {number} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - notEqual: (value: number) => FilterValue; - /** - * Filter on whether the number of references is less than the given integer. - * - * @param {number} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - lessThan: (value: number) => FilterValue; - /** - * Filter on whether the number of references is less than or equal to the given integer. - * - * @param {number} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - lessOrEqual: (value: number) => FilterValue; - /** - * Filter on whether the number of references is greater than the given integer. - * - * @param {number} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - greaterThan: (value: number) => FilterValue; - /** - * Filter on whether the number of references is greater than or equal to the given integer. - * - * @param {number} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - greaterOrEqual: (value: number) => FilterValue; -} -export interface FilterById { - /** - * Filter on whether the ID is equal to the given string. - * - * @param {string} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - equal: (value: string) => FilterValue; - /** - * Filter on whether the ID is not equal to the given string. - * - * @param {string} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - notEqual: (value: string) => FilterValue; - /** - * Filter on whether the ID is any one of the given strings. - * - * @param {string[]} value The values to filter on. - * @returns {FilterValue} The filter value. - */ - containsAny: (value: string[]) => FilterValue; -} -export interface FilterByTime { - /** - * Filter on whether the time is any one of the given strings or Dates. - * - * @param {(string | Date)[]} value The values to filter on. - * @returns {FilterValue} The filter value. - */ - containsAny: (value: (string | Date)[]) => FilterValue; - /** - * Filter on whether the time is equal to the given string or Date. - * - * @param {string | Date} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - equal: (value: string | Date) => FilterValue; - /** - * Filter on whether the time is not equal to the given string or Date. - * - * @param {string | Date} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - notEqual: (value: string | Date) => FilterValue; - /** - * Filter on whether the time is less than the given string or Date. - * - * @param {string | Date} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - lessThan: (value: string | Date) => FilterValue; - /** - * Filter on whether the time is less than or equal to the given string or Date. - * - * @param {string | Date} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - lessOrEqual: (value: string | Date) => FilterValue; - /** - * Filter on whether the time is greater than the given string or Date. - * - * @param {string | Date} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - greaterThan: (value: string | Date) => FilterValue; - /** - * Filter on whether the time is greater than or equal to the given string or Date. - * - * @param {string | Date} value The value to filter on. - * @returns {FilterValue} The filter value. - */ - greaterOrEqual: (value: string | Date) => FilterValue; -} diff --git a/dist/node/esm/collections/filters/types.js b/dist/node/esm/collections/filters/types.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/filters/types.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/filters/utils.d.ts b/dist/node/esm/collections/filters/utils.d.ts deleted file mode 100644 index 45f1371d..00000000 --- a/dist/node/esm/collections/filters/utils.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { CountRef, FilterTargetInternal, MultiTargetRef, SingleTargetRef } from './types.js'; -export declare class TargetGuards { - static isSingleTargetRef(target?: FilterTargetInternal): target is SingleTargetRef; - static isMultiTargetRef(target?: FilterTargetInternal): target is MultiTargetRef; - static isCountRef(target?: FilterTargetInternal): target is CountRef; - static isProperty(target?: FilterTargetInternal): target is string; - static isTargetRef(target?: FilterTargetInternal): target is SingleTargetRef | MultiTargetRef; -} diff --git a/dist/node/esm/collections/filters/utils.js b/dist/node/esm/collections/filters/utils.js deleted file mode 100644 index 4a689445..00000000 --- a/dist/node/esm/collections/filters/utils.js +++ /dev/null @@ -1,22 +0,0 @@ -export class TargetGuards { - static isSingleTargetRef(target) { - if (!target) return false; - return target.type_ === 'single'; - } - static isMultiTargetRef(target) { - if (!target) return false; - return target.type_ === 'multi'; - } - static isCountRef(target) { - if (!target) return false; - return target.type_ === 'count'; - } - static isProperty(target) { - if (!target) return false; - return typeof target === 'string'; - } - static isTargetRef(target) { - if (!target) return false; - return TargetGuards.isSingleTargetRef(target) || TargetGuards.isMultiTargetRef(target); - } -} diff --git a/dist/node/esm/collections/generate/index.d.ts b/dist/node/esm/collections/generate/index.d.ts deleted file mode 100644 index 125b1dca..00000000 --- a/dist/node/esm/collections/generate/index.d.ts +++ /dev/null @@ -1,103 +0,0 @@ -/// -import Connection from '../../connection/grpc.js'; -import { ConsistencyLevel } from '../../data/index.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { - BaseBm25Options, - BaseHybridOptions, - BaseNearOptions, - BaseNearTextOptions, - FetchObjectsOptions, - GroupByBm25Options, - GroupByHybridOptions, - GroupByNearOptions, - GroupByNearTextOptions, - NearMediaType, -} from '../query/types.js'; -import { GenerateOptions, GenerativeGroupByReturn, GenerativeReturn } from '../types/index.js'; -import { Generate } from './types.js'; -declare class GenerateManager implements Generate { - private check; - private constructor(); - static use( - connection: Connection, - name: string, - dbVersionSupport: DbVersionSupport, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ): GenerateManager; - private parseReply; - private parseGroupByReply; - fetchObjects(generate: GenerateOptions, opts?: FetchObjectsOptions): Promise>; - bm25(query: string, generate: GenerateOptions, opts?: BaseBm25Options): Promise>; - bm25( - query: string, - generate: GenerateOptions, - opts: GroupByBm25Options - ): Promise>; - hybrid( - query: string, - generate: GenerateOptions, - opts?: BaseHybridOptions - ): Promise>; - hybrid( - query: string, - generate: GenerateOptions, - opts: GroupByHybridOptions - ): Promise>; - nearImage( - image: string | Buffer, - generate: GenerateOptions, - opts?: BaseNearOptions - ): Promise>; - nearImage( - image: string | Buffer, - generate: GenerateOptions, - opts: GroupByNearOptions - ): Promise>; - nearObject( - id: string, - generate: GenerateOptions, - opts?: BaseNearOptions - ): Promise>; - nearObject( - id: string, - generate: GenerateOptions, - opts: GroupByNearOptions - ): Promise>; - nearText( - query: string | string[], - generate: GenerateOptions, - opts?: BaseNearTextOptions - ): Promise>; - nearText( - query: string | string[], - generate: GenerateOptions, - opts: GroupByNearTextOptions - ): Promise>; - nearVector( - vector: number[], - generate: GenerateOptions, - opts?: BaseNearOptions - ): Promise>; - nearVector( - vector: number[], - generate: GenerateOptions, - opts: GroupByNearOptions - ): Promise>; - nearMedia( - media: string | Buffer, - type: NearMediaType, - generate: GenerateOptions, - opts?: BaseNearOptions - ): Promise>; - nearMedia( - media: string | Buffer, - type: NearMediaType, - generate: GenerateOptions, - opts: GroupByNearOptions - ): Promise>; -} -declare const _default: typeof GenerateManager.use; -export default _default; -export { Generate } from './types.js'; diff --git a/dist/node/esm/collections/generate/index.js b/dist/node/esm/collections/generate/index.js deleted file mode 100644 index ba60e0e3..00000000 --- a/dist/node/esm/collections/generate/index.js +++ /dev/null @@ -1,271 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -import { WeaviateInvalidInputError } from '../../errors.js'; -import { toBase64FromMedia } from '../../index.js'; -import { Deserialize } from '../deserialize/index.js'; -import { Check } from '../query/check.js'; -import { Serialize } from '../serialize/index.js'; -class GenerateManager { - constructor(check) { - this.check = check; - } - static use(connection, name, dbVersionSupport, consistencyLevel, tenant) { - return new GenerateManager(new Check(connection, name, dbVersionSupport, consistencyLevel, tenant)); - } - parseReply(reply) { - return __awaiter(this, void 0, void 0, function* () { - const deserialize = yield Deserialize.use(this.check.dbVersionSupport); - return deserialize.generate(reply); - }); - } - parseGroupByReply(opts, reply) { - return __awaiter(this, void 0, void 0, function* () { - const deserialize = yield Deserialize.use(this.check.dbVersionSupport); - return Serialize.isGroupBy(opts) ? deserialize.generateGroupBy(reply) : deserialize.generate(reply); - }); - } - fetchObjects(generate, opts) { - return this.check - .fetchObjects(opts) - .then(({ search }) => - search.withFetch( - Object.assign(Object.assign({}, Serialize.fetchObjects(opts)), { - generative: Serialize.generative(generate), - }) - ) - ) - .then((reply) => this.parseReply(reply)); - } - bm25(query, generate, opts) { - return this.check - .bm25(opts) - .then(({ search }) => - search.withBm25( - Object.assign(Object.assign({}, Serialize.bm25(Object.assign({ query }, opts))), { - generative: Serialize.generative(generate), - groupBy: Serialize.isGroupBy(opts) ? Serialize.groupBy(opts.groupBy) : undefined, - }) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - hybrid(query, generate, opts) { - return this.check - .hybridSearch(opts) - .then(({ search, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets }) => - search.withHybrid( - Object.assign( - Object.assign( - {}, - Serialize.hybrid( - Object.assign( - { query, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets }, - opts - ) - ) - ), - { - generative: Serialize.generative(generate), - groupBy: Serialize.isGroupBy(opts) ? Serialize.groupBy(opts.groupBy) : undefined, - } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearImage(image, generate, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => - toBase64FromMedia(image).then((image) => - search.withNearImage( - Object.assign( - Object.assign( - {}, - Serialize.nearImage( - Object.assign({ image, supportsTargets, supportsWeightsForTargets }, opts ? opts : {}) - ) - ), - { - generative: Serialize.generative(generate), - groupBy: Serialize.isGroupBy(opts) ? Serialize.groupBy(opts.groupBy) : undefined, - } - ) - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearObject(id, generate, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => - search.withNearObject( - Object.assign( - Object.assign( - {}, - Serialize.nearObject( - Object.assign({ id, supportsTargets, supportsWeightsForTargets }, opts ? opts : {}) - ) - ), - { - generative: Serialize.generative(generate), - groupBy: Serialize.isGroupBy(opts) ? Serialize.groupBy(opts.groupBy) : undefined, - } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearText(query, generate, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => - search.withNearText( - Object.assign( - Object.assign( - {}, - Serialize.nearText( - Object.assign({ query, supportsTargets, supportsWeightsForTargets }, opts ? opts : {}) - ) - ), - { - generative: Serialize.generative(generate), - groupBy: Serialize.isGroupBy(opts) ? Serialize.groupBy(opts.groupBy) : undefined, - } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearVector(vector, generate, opts) { - return this.check - .nearVector(vector, opts) - .then(({ search, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets }) => - search.withNearVector( - Object.assign( - Object.assign( - {}, - Serialize.nearVector( - Object.assign( - { vector, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets }, - opts ? opts : {} - ) - ) - ), - { - generative: Serialize.generative(generate), - groupBy: Serialize.isGroupBy(opts) ? Serialize.groupBy(opts.groupBy) : undefined, - } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearMedia(media, type, generate, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => { - let reply; - const args = Object.assign({ supportsTargets, supportsWeightsForTargets }, opts ? opts : {}); - const generative = Serialize.generative(generate); - const groupBy = Serialize.isGroupBy(opts) ? Serialize.groupBy(opts.groupBy) : undefined; - switch (type) { - case 'audio': - reply = toBase64FromMedia(media).then((media) => - search.withNearAudio( - Object.assign(Object.assign({}, Serialize.nearAudio(Object.assign({ audio: media }, args))), { - generative, - groupBy, - }) - ) - ); - break; - case 'depth': - reply = toBase64FromMedia(media).then((media) => - search.withNearDepth( - Object.assign(Object.assign({}, Serialize.nearDepth(Object.assign({ depth: media }, args))), { - generative, - groupBy, - }) - ) - ); - break; - case 'image': - reply = toBase64FromMedia(media).then((media) => - search.withNearImage( - Object.assign(Object.assign({}, Serialize.nearImage(Object.assign({ image: media }, args))), { - generative, - groupBy, - }) - ) - ); - break; - case 'imu': - reply = toBase64FromMedia(media).then((media) => - search.withNearIMU( - Object.assign(Object.assign({}, Serialize.nearIMU(Object.assign({ imu: media }, args))), { - generative, - groupBy, - }) - ) - ); - break; - case 'thermal': - reply = toBase64FromMedia(media).then((media) => - search.withNearThermal( - Object.assign( - Object.assign({}, Serialize.nearThermal(Object.assign({ thermal: media }, args))), - { generative, groupBy } - ) - ) - ); - break; - case 'video': - reply = toBase64FromMedia(media).then((media) => - search.withNearVideo( - Object.assign(Object.assign({}, Serialize.nearVideo(Object.assign({ video: media }, args))), { - generative, - groupBy, - }) - ) - ); - break; - default: - throw new WeaviateInvalidInputError(`Invalid media type: ${type}`); - } - return reply; - }) - .then((reply) => this.parseGroupByReply(opts, reply)); - } -} -export default GenerateManager.use; diff --git a/dist/node/esm/collections/generate/types.d.ts b/dist/node/esm/collections/generate/types.d.ts deleted file mode 100644 index 9f41e30c..00000000 --- a/dist/node/esm/collections/generate/types.d.ts +++ /dev/null @@ -1,354 +0,0 @@ -/// -import { - BaseBm25Options, - BaseHybridOptions, - BaseNearOptions, - BaseNearTextOptions, - Bm25Options, - FetchObjectsOptions, - GroupByBm25Options, - GroupByHybridOptions, - GroupByNearOptions, - GroupByNearTextOptions, - HybridOptions, - NearMediaType, - NearOptions, - NearTextOptions, - NearVectorInputType, -} from '../query/types.js'; -import { - GenerateOptions, - GenerateReturn, - GenerativeGroupByReturn, - GenerativeReturn, -} from '../types/index.js'; -interface Bm25 { - /** - * Perform retrieval-augmented generation (RaG) on the results of a keyword-based BM25 search of objects in this collection. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/bm25) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {BaseBm25Options} [opts] - The available options for performing the BM25 search. - * @return {Promise>} - The results of the search including the generated data. - */ - bm25(query: string, generate: GenerateOptions, opts?: BaseBm25Options): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a keyword-based BM25 search of objects in this collection. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/bm25) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {GroupByBm25Options} opts - The available options for performing the BM25 search. - * @return {Promise>} - The results of the search including the generated data grouped by the specified properties. - */ - bm25( - query: string, - generate: GenerateOptions, - opts: GroupByBm25Options - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a keyword-based BM25 search of objects in this collection. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/bm25) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {Bm25Options} [opts] - The available options for performing the BM25 search. - * @return {GenerateReturn} - The results of the search including the generated data. - */ - bm25(query: string, generate: GenerateOptions, opts?: Bm25Options): GenerateReturn; -} -interface Hybrid { - /** - * Perform retrieval-augmented generation (RaG) on the results of an object search in this collection using the hybrid algorithm blending keyword-based BM25 and vector-based similarity. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/hybrid) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {BaseHybridOptions} [opts] - The available options for performing the hybrid search. - * @return {Promise>} - The results of the search including the generated data. - */ - hybrid( - query: string, - generate: GenerateOptions, - opts?: BaseHybridOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of an object search in this collection using the hybrid algorithm blending keyword-based BM25 and vector-based similarity. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/hybrid) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {GroupByHybridOptions} opts - The available options for performing the hybrid search. - * @return {Promise>} - The results of the search including the generated data grouped by the specified properties. - */ - hybrid( - query: string, - generate: GenerateOptions, - opts: GroupByHybridOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of an object search in this collection using the hybrid algorithm blending keyword-based BM25 and vector-based similarity. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/hybrid) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {HybridOptions} [opts] - The available options for performing the hybrid search. - * @return {GenerateReturn} - The results of the search including the generated data. - */ - hybrid(query: string, generate: GenerateOptions, opts?: HybridOptions): GenerateReturn; -} -interface NearMedia { - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-audio object search in this collection using an audio-capable vectorization module and vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/multi2vec-bind) for a more detailed explanation. - * - * NOTE: You must have a multi-media-capable vectorization module installed in order to use this method, e.g. `multi2vec-bind`. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string | Buffer} media - The media file to search on. This can be a base64 string, a file path string, or a buffer. - * @param {NearMediaType} type - The type of media to search on. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {BaseNearOptions} [opts] - The available options for performing the near-media search. - * @return {Promise>} - The results of the search including the generated data. - */ - nearMedia( - media: string | Buffer, - type: NearMediaType, - generate: GenerateOptions, - opts?: BaseNearOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-audio object search in this collection using an audio-capable vectorization module and vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/multi2vec-bind) for a more detailed explanation. - * - * NOTE: You must have a multi-media-capable vectorization module installed in order to use this method, e.g. `multi2vec-bind`. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string | Buffer} media - The media file to search on. This can be a base64 string, a file path string, or a buffer. - * @param {NearMediaType} type - The type of media to search on. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {GroupByNearOptions} opts - The available options for performing the near-media search. - * @return {Promise>} - The results of the search including the generated data grouped by the specified properties. - */ - nearMedia( - media: string | Buffer, - type: NearMediaType, - generate: GenerateOptions, - opts: GroupByNearOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-audio object search in this collection using an audio-capable vectorization module and vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/multi2vec-bind) for a more detailed explanation. - * - * NOTE: You must have a multi-media-capable vectorization module installed in order to use this method, e.g. `multi2vec-bind`. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string | Buffer} media - The media to search on. This can be a base64 string, a file path string, or a buffer. - * @param {NearMediaType} type - The type of media to search on. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {NearOptions} [opts] - The available options for performing the near-media search. - * @return {GenerateReturn} - The results of the search including the generated data. - */ - nearMedia( - media: string | Buffer, - type: NearMediaType, - generate: GenerateOptions, - opts?: NearOptions - ): GenerateReturn; -} -interface NearObject { - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-object object search in this collection using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#nearobject) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string} id - The ID of the object to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {BaseNearOptions} [opts] - The available options for performing the near-object search. - * @return {Promise>} - The results of the search including the generated data. - */ - nearObject( - id: string, - generate: GenerateOptions, - opts?: BaseNearOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-object object search in this collection using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#nearobject) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string} id - The ID of the object to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {GroupByNearOptions} opts - The available options for performing the near-object search. - * @return {Promise>} - The results of the search including the generated data grouped by the specified properties. - */ - nearObject( - id: string, - generate: GenerateOptions, - opts: GroupByNearOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-object object search in this collection using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#nearobject) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string} id - The ID of the object to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {NearOptions} [opts] - The available options for performing the near-object search. - * @return {GenerateReturn} - The results of the search including the generated data. - */ - nearObject(id: string, generate: GenerateOptions, opts?: NearOptions): GenerateReturn; -} -interface NearText { - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-image object search in this collection using the image-capable vectorization module and vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#neartext) for a more detailed explanation. - * - * NOTE: You must have a text-capable vectorization module installed in order to use this method, e.g. any of the `text2vec-` and `multi2vec-` modules. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string | string[]} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {BaseNearTextOptions} [opts] - The available options for performing the near-text search. - * @return {Promise>} - The results of the search including the generated data. - */ - nearText( - query: string | string[], - generate: GenerateOptions, - opts?: BaseNearTextOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-image object search in this collection using the image-capable vectorization module and vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#neartext) for a more detailed explanation. - * - * NOTE: You must have a text-capable vectorization module installed in order to use this method, e.g. any of the `text2vec-` and `multi2vec-` modules. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string | string[]} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {GroupByNearTextOptions} opts - The available options for performing the near-text search. - * @return {Promise>} - The results of the search including the generated data grouped by the specified properties. - */ - nearText( - query: string | string[], - generate: GenerateOptions, - opts: GroupByNearTextOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-image object search in this collection using the image-capable vectorization module and vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#neartext) for a more detailed explanation. - * - * NOTE: You must have a text-capable vectorization module installed in order to use this method, e.g. any of the `text2vec-` and `multi2vec-` modules. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string | string[]} query - The query to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {NearTextOptions} [opts] - The available options for performing the near-text search. - * @return {GenerateReturn} - The results of the search including the generated data. - */ - nearText( - query: string | string[], - generate: GenerateOptions, - opts?: NearTextOptions - ): GenerateReturn; -} -interface NearVector { - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-vector object search in this collection using vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {NearVectorInputType} vector - The vector(s) to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {BaseNearOptions} [opts] - The available options for performing the near-vector search. - * @return {Promise>} - The results of the search including the generated data. - */ - nearVector( - vector: NearVectorInputType, - generate: GenerateOptions, - opts?: BaseNearOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-vector object search in this collection using vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {NearVectorInputType} vector - The vector(s) to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {GroupByNearOptions} opts - The available options for performing the near-vector search. - * @return {Promise>} - The results of the search including the generated data grouped by the specified properties. - */ - nearVector( - vector: NearVectorInputType, - generate: GenerateOptions, - opts: GroupByNearOptions - ): Promise>; - /** - * Perform retrieval-augmented generation (RaG) on the results of a by-vector object search in this collection using vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {NearVectorInputType} vector - The vector(s) to search for. - * @param {GenerateOptions} generate - The available options for performing the generation. - * @param {NearOptions} [opts] - The available options for performing the near-vector search. - * @return {GenerateReturn} - The results of the search including the generated data. - */ - nearVector( - vector: NearVectorInputType, - generate: GenerateOptions, - opts?: NearOptions - ): GenerateReturn; -} -export interface Generate - extends Bm25, - Hybrid, - NearMedia, - NearObject, - NearText, - NearVector { - fetchObjects: (generate: GenerateOptions, opts?: FetchObjectsOptions) => Promise>; -} -export {}; diff --git a/dist/node/esm/collections/generate/types.js b/dist/node/esm/collections/generate/types.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/generate/types.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/index.d.ts b/dist/node/esm/collections/index.d.ts deleted file mode 100644 index 3405a255..00000000 --- a/dist/node/esm/collections/index.d.ts +++ /dev/null @@ -1,98 +0,0 @@ -import Connection from '../connection/grpc.js'; -import { WeaviateClass } from '../openapi/types.js'; -import { DbVersionSupport } from '../utils/dbVersion.js'; -import { Collection } from './collection/index.js'; -import { - CollectionConfig, - GenerativeConfig, - GenerativeSearch, - InvertedIndexConfigCreate, - ModuleConfig, - MultiTenancyConfigCreate, - Properties, - PropertyConfigCreate, - ReferenceConfigCreate, - ReplicationConfigCreate, - Reranker, - RerankerConfig, - ShardingConfigCreate, - VectorizersConfigCreate, -} from './types/index.js'; -/** - * All the options available when creating a new collection. - * - * Inspect [the docs](https://weaviate.io/developers/weaviate/configuration) for more information on the - * different configuration options and how they affect the behavior of your collection. - */ -export type CollectionConfigCreate = { - /** The name of the collection. */ - name: N; - /** The description of the collection. */ - description?: string; - /** The configuration for Weaviate's generative capabilities. */ - generative?: ModuleConfig; - /** The configuration for Weaviate's inverted index. */ - invertedIndex?: InvertedIndexConfigCreate; - /** The configuration for Weaviate's multi-tenancy capabilities. */ - multiTenancy?: MultiTenancyConfigCreate; - /** The properties of the objects in the collection. */ - properties?: PropertyConfigCreate[]; - /** The references of the objects in the collection. */ - references?: ReferenceConfigCreate[]; - /** The configuration for Weaviate's replication strategy. Is mutually exclusive with `sharding`. */ - replication?: ReplicationConfigCreate; - /** The configuration for Weaviate's reranking capabilities. */ - reranker?: ModuleConfig; - /** The configuration for Weaviate's sharding strategy. Is mutually exclusive with `replication`. */ - sharding?: ShardingConfigCreate; - /** The configuration for Weaviate's vectorizer(s) capabilities. */ - vectorizers?: VectorizersConfigCreate; -}; -declare const collections: ( - connection: Connection, - dbVersionSupport: DbVersionSupport -) => { - create: ( - config: CollectionConfigCreate - ) => Promise>; - createFromSchema: (config: WeaviateClass) => Promise>; - delete: (name: string) => Promise; - deleteAll: () => Promise; - exists: (name: string) => Promise; - export: (name: string) => Promise; - listAll: () => Promise; - get: ( - name: TName_1 - ) => Collection; -}; -export interface Collections { - create( - config: CollectionConfigCreate - ): Promise>; - createFromSchema(config: WeaviateClass): Promise>; - delete(collection: string): Promise; - deleteAll(): Promise; - exists(name: string): Promise; - export(name: string): Promise; - get( - name: TName - ): Collection; - listAll(): Promise; -} -export default collections; -export * from './aggregate/index.js'; -export * from './backup/index.js'; -export * from './cluster/index.js'; -export * from './collection/index.js'; -export * from './config/index.js'; -export * from './configure/index.js'; -export * from './data/index.js'; -export * from './filters/index.js'; -export * from './generate/index.js'; -export * from './iterator/index.js'; -export * from './query/index.js'; -export * from './references/index.js'; -export * from './sort/index.js'; -export * from './tenants/index.js'; -export * from './types/index.js'; -export * from './vectors/multiTargetVector.js'; diff --git a/dist/node/esm/collections/index.js b/dist/node/esm/collections/index.js deleted file mode 100644 index 0c23ec02..00000000 --- a/dist/node/esm/collections/index.js +++ /dev/null @@ -1,252 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -var __rest = - (this && this.__rest) || - function (s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === 'function') - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; - } - return t; - }; -import { WeaviateInvalidInputError, WeaviateUnsupportedFeatureError } from '../errors.js'; -import ClassExists from '../schema/classExists.js'; -import { ClassCreator, ClassDeleter, ClassGetter, SchemaGetter } from '../schema/index.js'; -import collection from './collection/index.js'; -import { classToCollection, resolveProperty, resolveReference } from './config/utils.js'; -import { QuantizerGuards } from './configure/parsing.js'; -import { configGuards } from './index.js'; -const parseVectorIndex = (module) => { - if (module.config === undefined) return undefined; - if (module.name === 'dynamic') { - const _a = module.config, - { hnsw, flat } = _a, - conf = __rest(_a, ['hnsw', 'flat']); - return Object.assign(Object.assign({}, conf), { - hnsw: parseVectorIndex({ name: 'hnsw', config: hnsw }), - flat: parseVectorIndex({ name: 'flat', config: flat }), - }); - } - const _b = module.config, - { quantizer } = _b, - conf = __rest(_b, ['quantizer']); - if (quantizer === undefined) return conf; - if (QuantizerGuards.isBQCreate(quantizer)) { - const { type } = quantizer, - quant = __rest(quantizer, ['type']); - return Object.assign(Object.assign({}, conf), { - bq: Object.assign(Object.assign({}, quant), { enabled: true }), - }); - } - if (QuantizerGuards.isPQCreate(quantizer)) { - const { type } = quantizer, - quant = __rest(quantizer, ['type']); - return Object.assign(Object.assign({}, conf), { - pq: Object.assign(Object.assign({}, quant), { enabled: true }), - }); - } -}; -const parseVectorizerConfig = (config) => { - if (config === undefined) return {}; - const _a = config, - { vectorizeCollectionName } = _a, - rest = __rest(_a, ['vectorizeCollectionName']); - return Object.assign(Object.assign({}, rest), { vectorizeClassName: vectorizeCollectionName }); -}; -const collections = (connection, dbVersionSupport) => { - const listAll = () => - new SchemaGetter(connection) - .do() - .then((schema) => (schema.classes ? schema.classes.map(classToCollection) : [])); - const deleteCollection = (name) => new ClassDeleter(connection).withClassName(name).do(); - return { - create: function (config) { - return __awaiter(this, void 0, void 0, function* () { - const { name, invertedIndex, multiTenancy, replication, sharding } = config, - rest = __rest(config, ['name', 'invertedIndex', 'multiTenancy', 'replication', 'sharding']); - const supportsDynamicVectorIndex = yield dbVersionSupport.supportsDynamicVectorIndex(); - const supportsNamedVectors = yield dbVersionSupport.supportsNamedVectors(); - const supportsHNSWAndBQ = yield dbVersionSupport.supportsHNSWAndBQ(); - const moduleConfig = {}; - if (config.generative) { - const generative = - config.generative.name === 'generative-azure-openai' - ? 'generative-openai' - : config.generative.name; - moduleConfig[generative] = config.generative.config ? config.generative.config : {}; - } - if (config.reranker) { - moduleConfig[config.reranker.name] = config.reranker.config ? config.reranker.config : {}; - } - const makeVectorsConfig = (configVectorizers) => { - let vectorizers = []; - const vectorsConfig = {}; - const vectorizersConfig = Array.isArray(configVectorizers) - ? configVectorizers - : [Object.assign(Object.assign({}, configVectorizers), { name: 'default' })]; - vectorizersConfig.forEach((v) => { - if (v.vectorIndex.name === 'dynamic' && !supportsDynamicVectorIndex.supports) { - throw new WeaviateUnsupportedFeatureError(supportsDynamicVectorIndex.message); - } - const vectorConfig = { - vectorIndexConfig: parseVectorIndex(v.vectorIndex), - vectorIndexType: v.vectorIndex.name, - vectorizer: {}, - }; - const vectorizer = - v.vectorizer.name === 'text2vec-azure-openai' ? 'text2vec-openai' : v.vectorizer.name; - vectorizers = [...vectorizers, vectorizer]; - vectorConfig.vectorizer[vectorizer] = Object.assign( - { properties: v.properties }, - parseVectorizerConfig(v.vectorizer.config) - ); - if (v.name === undefined) { - throw new WeaviateInvalidInputError( - 'vectorName is required for each vectorizer when specifying more than one vectorizer' - ); - } - vectorsConfig[v.name] = vectorConfig; - }); - return { vectorsConfig, vectorizers }; - }; - const makeLegacyVectorizer = (configVectorizers) => { - const vectorizer = - configVectorizers.vectorizer.name === 'text2vec-azure-openai' - ? 'text2vec-openai' - : configVectorizers.vectorizer.name; - const moduleConfig = {}; - moduleConfig[vectorizer] = parseVectorizerConfig(configVectorizers.vectorizer.config); - const vectorIndexConfig = parseVectorIndex(configVectorizers.vectorIndex); - const vectorIndexType = configVectorizers.vectorIndex.name; - if ( - vectorIndexType === 'hnsw' && - configVectorizers.vectorIndex.config !== undefined && - configGuards.quantizer.isBQ(configVectorizers.vectorIndex.config.quantizer) - ) { - if (!supportsHNSWAndBQ.supports) { - throw new WeaviateUnsupportedFeatureError(supportsHNSWAndBQ.message); - } - } - if (vectorIndexType === 'dynamic' && !supportsDynamicVectorIndex.supports) { - throw new WeaviateUnsupportedFeatureError(supportsDynamicVectorIndex.message); - } - return { - vectorizer, - moduleConfig, - vectorIndexConfig, - vectorIndexType, - }; - }; - let schema = Object.assign(Object.assign({}, rest), { - class: name, - invertedIndexConfig: invertedIndex, - moduleConfig: moduleConfig, - multiTenancyConfig: multiTenancy, - replicationConfig: replication, - shardingConfig: sharding, - }); - let vectorizers = []; - if (supportsNamedVectors.supports) { - const { vectorsConfig, vectorizers: vecs } = config.vectorizers - ? makeVectorsConfig(config.vectorizers) - : { vectorsConfig: undefined, vectorizers: [] }; - schema.vectorConfig = vectorsConfig; - vectorizers = [...vecs]; - } else { - if (config.vectorizers !== undefined && Array.isArray(config.vectorizers)) { - throw new WeaviateUnsupportedFeatureError(supportsNamedVectors.message); - } - const configs = config.vectorizers - ? makeLegacyVectorizer(config.vectorizers) - : { - vectorizer: undefined, - moduleConfig: undefined, - vectorIndexConfig: undefined, - vectorIndexType: undefined, - }; - schema = Object.assign(Object.assign({}, schema), { - moduleConfig: Object.assign(Object.assign({}, schema.moduleConfig), configs.moduleConfig), - vectorizer: configs.vectorizer, - vectorIndexConfig: configs.vectorIndexConfig, - vectorIndexType: configs.vectorIndexType, - }); - if (configs.vectorizer !== undefined) { - vectorizers = [configs.vectorizer]; - } - } - const properties = config.properties - ? config.properties.map((prop) => resolveProperty(prop, vectorizers)) - : []; - const references = config.references ? config.references.map(resolveReference) : []; - schema.properties = [...properties, ...references]; - yield new ClassCreator(connection).withClass(schema).do(); - return collection(connection, name, dbVersionSupport); - }); - }, - createFromSchema: function (config) { - return __awaiter(this, void 0, void 0, function* () { - const { class: name } = yield new ClassCreator(connection).withClass(config).do(); - return collection(connection, name, dbVersionSupport); - }); - }, - delete: deleteCollection, - deleteAll: () => - listAll().then((configs) => - Promise.all( - configs === null || configs === void 0 ? void 0 : configs.map((c) => deleteCollection(c.name)) - ) - ), - exists: (name) => new ClassExists(connection).withClassName(name).do(), - export: (name) => new ClassGetter(connection).withClassName(name).do().then(classToCollection), - listAll: listAll, - get: (name) => collection(connection, name, dbVersionSupport), - }; -}; -export default collections; -export * from './aggregate/index.js'; -export * from './backup/index.js'; -export * from './cluster/index.js'; -export * from './collection/index.js'; -export * from './config/index.js'; -export * from './configure/index.js'; -export * from './data/index.js'; -export * from './filters/index.js'; -export * from './generate/index.js'; -export * from './iterator/index.js'; -export * from './query/index.js'; -export * from './references/index.js'; -export * from './sort/index.js'; -export * from './tenants/index.js'; -export * from './types/index.js'; -export * from './vectors/multiTargetVector.js'; diff --git a/dist/node/esm/collections/iterator/index.d.ts b/dist/node/esm/collections/iterator/index.d.ts deleted file mode 100644 index 09429315..00000000 --- a/dist/node/esm/collections/iterator/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { WeaviateObject } from '../types/index.js'; -export declare class Iterator { - private query; - private cache; - private last; - constructor(query: (limit: number, after?: string) => Promise[]>); - [Symbol.asyncIterator](): { - next: () => Promise>>; - }; -} diff --git a/dist/node/esm/collections/iterator/index.js b/dist/node/esm/collections/iterator/index.js deleted file mode 100644 index c4d95338..00000000 --- a/dist/node/esm/collections/iterator/index.js +++ /dev/null @@ -1,68 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -import { WeaviateDeserializationError } from '../../errors.js'; -const ITERATOR_CACHE_SIZE = 100; -export class Iterator { - constructor(query) { - this.query = query; - this.cache = []; - this.last = undefined; - this.query = query; - } - [Symbol.asyncIterator]() { - return { - next: () => - __awaiter(this, void 0, void 0, function* () { - const objects = yield this.query(ITERATOR_CACHE_SIZE, this.last); - this.cache = objects; - if (this.cache.length == 0) { - return { - done: true, - value: undefined, - }; - } - const obj = this.cache.shift(); - if (obj === undefined) { - throw new WeaviateDeserializationError('Object iterator returned an object that is undefined'); - } - this.last = obj === null || obj === void 0 ? void 0 : obj.uuid; - if (this.last === undefined) { - throw new WeaviateDeserializationError('Object iterator returned an object without a UUID'); - } - return { - done: false, - value: obj, - }; - }), - }; - } -} diff --git a/dist/node/esm/collections/query/check.d.ts b/dist/node/esm/collections/query/check.d.ts deleted file mode 100644 index ddd9790f..00000000 --- a/dist/node/esm/collections/query/check.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -import Connection from '../../connection/grpc.js'; -import { ConsistencyLevel } from '../../index.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { - BaseBm25Options, - BaseHybridOptions, - BaseNearOptions, - FetchObjectByIdOptions, - FetchObjectsOptions, - NearVectorInputType, -} from './types.js'; -export declare class Check { - private connection; - private name; - dbVersionSupport: DbVersionSupport; - private consistencyLevel?; - private tenant?; - constructor( - connection: Connection, - name: string, - dbVersionSupport: DbVersionSupport, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ); - private getSearcher; - private checkSupportForNamedVectors; - private checkSupportForBm25AndHybridGroupByQueries; - private checkSupportForHybridNearTextAndNearVectorSubSearches; - private checkSupportForMultiTargetSearch; - private checkSupportForMultiVectorSearch; - private checkSupportForMultiWeightPerTargetSearch; - private checkSupportForMultiVectorPerTargetSearch; - nearSearch: (opts?: BaseNearOptions) => Promise<{ - search: import('../../grpc/searcher.js').Search; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - }>; - nearVector: ( - vec: NearVectorInputType, - opts?: BaseNearOptions - ) => Promise<{ - search: import('../../grpc/searcher.js').Search; - supportsTargets: boolean; - supportsVectorsForTargets: boolean; - supportsWeightsForTargets: boolean; - }>; - hybridSearch: (opts?: BaseHybridOptions) => Promise<{ - search: import('../../grpc/searcher.js').Search; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - supportsVectorsForTargets: boolean; - }>; - fetchObjects: (opts?: FetchObjectsOptions) => Promise<{ - search: import('../../grpc/searcher.js').Search; - }>; - fetchObjectById: (opts?: FetchObjectByIdOptions) => Promise<{ - search: import('../../grpc/searcher.js').Search; - }>; - bm25: (opts?: BaseBm25Options) => Promise<{ - search: import('../../grpc/searcher.js').Search; - }>; -} diff --git a/dist/node/esm/collections/query/check.js b/dist/node/esm/collections/query/check.js deleted file mode 100644 index 0dbea0c0..00000000 --- a/dist/node/esm/collections/query/check.js +++ /dev/null @@ -1,187 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -import { WeaviateUnsupportedFeatureError } from '../../errors.js'; -import { Serialize } from '../serialize/index.js'; -export class Check { - constructor(connection, name, dbVersionSupport, consistencyLevel, tenant) { - this.getSearcher = () => this.connection.search(this.name, this.consistencyLevel, this.tenant); - this.checkSupportForNamedVectors = (opts) => - __awaiter(this, void 0, void 0, function* () { - if (!Serialize.isNamedVectors(opts)) return; - const check = yield this.dbVersionSupport.supportsNamedVectors(); - if (!check.supports) throw new WeaviateUnsupportedFeatureError(check.message); - }); - this.checkSupportForBm25AndHybridGroupByQueries = (query, opts) => - __awaiter(this, void 0, void 0, function* () { - if (!Serialize.isGroupBy(opts)) return; - const check = yield this.dbVersionSupport.supportsBm25AndHybridGroupByQueries(); - if (!check.supports) throw new WeaviateUnsupportedFeatureError(check.message(query)); - }); - this.checkSupportForHybridNearTextAndNearVectorSubSearches = (opts) => - __awaiter(this, void 0, void 0, function* () { - if ( - (opts === null || opts === void 0 ? void 0 : opts.vector) === undefined || - Array.isArray(opts.vector) - ) - return; - const check = yield this.dbVersionSupport.supportsHybridNearTextAndNearVectorSubsearchQueries(); - if (!check.supports) throw new WeaviateUnsupportedFeatureError(check.message); - }); - this.checkSupportForMultiTargetSearch = (opts) => - __awaiter(this, void 0, void 0, function* () { - if (!Serialize.isMultiTarget(opts)) return false; - const check = yield this.dbVersionSupport.supportsMultiTargetVectorSearch(); - if (!check.supports) throw new WeaviateUnsupportedFeatureError(check.message); - return check.supports; - }); - this.checkSupportForMultiVectorSearch = (vec) => - __awaiter(this, void 0, void 0, function* () { - if (vec === undefined || Serialize.isHybridNearTextSearch(vec)) return false; - if (Serialize.isHybridNearVectorSearch(vec) && !Serialize.isMultiVector(vec.vector)) return false; - if (Serialize.isHybridVectorSearch(vec) && !Serialize.isMultiVector(vec)) return false; - const check = yield this.dbVersionSupport.supportsMultiVectorSearch(); - if (!check.supports) throw new WeaviateUnsupportedFeatureError(check.message); - return check.supports; - }); - this.checkSupportForMultiWeightPerTargetSearch = (opts) => - __awaiter(this, void 0, void 0, function* () { - if (!Serialize.isMultiWeightPerTarget(opts)) return false; - const check = yield this.dbVersionSupport.supportsMultiWeightsPerTargetSearch(); - if (!check.supports) throw new WeaviateUnsupportedFeatureError(check.message); - return check.supports; - }); - this.checkSupportForMultiVectorPerTargetSearch = (vec) => - __awaiter(this, void 0, void 0, function* () { - if (vec === undefined || Serialize.isHybridNearTextSearch(vec)) return false; - if (Serialize.isHybridNearVectorSearch(vec) && !Serialize.isMultiVectorPerTarget(vec.vector)) - return false; - if (Serialize.isHybridVectorSearch(vec) && !Serialize.isMultiVectorPerTarget(vec)) return false; - const check = yield this.dbVersionSupport.supportsMultiVectorPerTargetSearch(); - if (!check.supports) throw new WeaviateUnsupportedFeatureError(check.message); - return check.supports; - }); - this.nearSearch = (opts) => { - return Promise.all([ - this.getSearcher(), - this.checkSupportForMultiTargetSearch(opts), - this.checkSupportForMultiWeightPerTargetSearch(opts), - this.checkSupportForNamedVectors(opts), - ]).then(([search, supportsTargets, supportsWeightsForTargets]) => { - const is126 = supportsTargets; - const is127 = supportsWeightsForTargets; - return { search, supportsTargets: is126 || is127, supportsWeightsForTargets: is127 }; - }); - }; - this.nearVector = (vec, opts) => { - return Promise.all([ - this.getSearcher(), - this.checkSupportForMultiTargetSearch(opts), - this.checkSupportForMultiVectorSearch(vec), - this.checkSupportForMultiVectorPerTargetSearch(vec), - this.checkSupportForMultiWeightPerTargetSearch(opts), - this.checkSupportForNamedVectors(opts), - ]).then( - ([ - search, - supportsMultiTarget, - supportsMultiVector, - supportsVectorsForTargets, - supportsWeightsForTargets, - ]) => { - const is126 = supportsMultiTarget || supportsMultiVector; - const is127 = supportsVectorsForTargets || supportsWeightsForTargets; - return { - search, - supportsTargets: is126 || is127, - supportsVectorsForTargets: is127, - supportsWeightsForTargets: is127, - }; - } - ); - }; - this.hybridSearch = (opts) => { - return Promise.all([ - this.getSearcher(), - this.checkSupportForMultiTargetSearch(opts), - this.checkSupportForMultiVectorSearch(opts === null || opts === void 0 ? void 0 : opts.vector), - this.checkSupportForMultiVectorPerTargetSearch( - opts === null || opts === void 0 ? void 0 : opts.vector - ), - this.checkSupportForMultiWeightPerTargetSearch(opts), - this.checkSupportForNamedVectors(opts), - this.checkSupportForBm25AndHybridGroupByQueries('Hybrid', opts), - this.checkSupportForHybridNearTextAndNearVectorSubSearches(opts), - ]).then( - ([ - search, - supportsMultiTarget, - supportsMultiVector, - supportsWeightsForTargets, - supportsVectorsForTargets, - ]) => { - const is126 = supportsMultiTarget || supportsMultiVector; - const is127 = supportsVectorsForTargets || supportsWeightsForTargets; - return { - search, - supportsTargets: is126 || is127, - supportsWeightsForTargets: is127, - supportsVectorsForTargets: is127, - }; - } - ); - }; - this.fetchObjects = (opts) => { - return Promise.all([this.getSearcher(), this.checkSupportForNamedVectors(opts)]).then(([search]) => { - return { search }; - }); - }; - this.fetchObjectById = (opts) => { - return Promise.all([this.getSearcher(), this.checkSupportForNamedVectors(opts)]).then(([search]) => { - return { search }; - }); - }; - this.bm25 = (opts) => { - return Promise.all([ - this.getSearcher(), - this.checkSupportForNamedVectors(opts), - this.checkSupportForBm25AndHybridGroupByQueries('Bm25', opts), - ]).then(([search]) => { - return { search }; - }); - }; - this.connection = connection; - this.name = name; - this.dbVersionSupport = dbVersionSupport; - this.consistencyLevel = consistencyLevel; - this.tenant = tenant; - } -} diff --git a/dist/node/esm/collections/query/index.d.ts b/dist/node/esm/collections/query/index.d.ts deleted file mode 100644 index 25fa06d0..00000000 --- a/dist/node/esm/collections/query/index.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -/// -import Connection from '../../connection/grpc.js'; -import { ConsistencyLevel } from '../../data/index.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { GroupByReturn, WeaviateObject, WeaviateReturn } from '../types/index.js'; -import { - BaseBm25Options, - BaseHybridOptions, - BaseNearOptions, - BaseNearTextOptions, - FetchObjectByIdOptions, - FetchObjectsOptions, - GroupByBm25Options, - GroupByHybridOptions, - GroupByNearOptions, - GroupByNearTextOptions, - NearMediaType, - NearVectorInputType, - Query, -} from './types.js'; -declare class QueryManager implements Query { - private check; - private constructor(); - static use( - connection: Connection, - name: string, - dbVersionSupport: DbVersionSupport, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ): QueryManager; - private parseReply; - private parseGroupByReply; - fetchObjectById(id: string, opts?: FetchObjectByIdOptions): Promise | null>; - fetchObjects(opts?: FetchObjectsOptions): Promise>; - bm25(query: string, opts?: BaseBm25Options): Promise>; - bm25(query: string, opts: GroupByBm25Options): Promise>; - hybrid(query: string, opts?: BaseHybridOptions): Promise>; - hybrid(query: string, opts: GroupByHybridOptions): Promise>; - nearImage(image: string | Buffer, opts?: BaseNearOptions): Promise>; - nearImage(image: string | Buffer, opts: GroupByNearOptions): Promise>; - nearMedia( - media: string | Buffer, - type: NearMediaType, - opts?: BaseNearOptions - ): Promise>; - nearMedia( - media: string | Buffer, - type: NearMediaType, - opts: GroupByNearOptions - ): Promise>; - nearObject(id: string, opts?: BaseNearOptions): Promise>; - nearObject(id: string, opts: GroupByNearOptions): Promise>; - nearText(query: string | string[], opts?: BaseNearTextOptions): Promise>; - nearText(query: string | string[], opts: GroupByNearTextOptions): Promise>; - nearVector(vector: NearVectorInputType, opts?: BaseNearOptions): Promise>; - nearVector(vector: NearVectorInputType, opts: GroupByNearOptions): Promise>; -} -declare const _default: typeof QueryManager.use; -export default _default; -export { - BaseBm25Options, - BaseHybridOptions, - BaseNearOptions, - BaseNearTextOptions, - Bm25Options, - FetchObjectByIdOptions, - FetchObjectsOptions, - GroupByBm25Options, - GroupByHybridOptions, - GroupByNearOptions, - GroupByNearTextOptions, - HybridNearTextSubSearch, - HybridNearVectorSubSearch, - HybridOptions, - HybridSubSearchBase, - MoveOptions, - NearMediaType, - NearOptions, - NearTextOptions, - Query, - QueryReturn, - SearchOptions, -} from './types.js'; diff --git a/dist/node/esm/collections/query/index.js b/dist/node/esm/collections/query/index.js deleted file mode 100644 index 41db9383..00000000 --- a/dist/node/esm/collections/query/index.js +++ /dev/null @@ -1,224 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -import { WeaviateInvalidInputError } from '../../errors.js'; -import { toBase64FromMedia } from '../../utils/base64.js'; -import { Deserialize } from '../deserialize/index.js'; -import { Serialize } from '../serialize/index.js'; -import { Check } from './check.js'; -class QueryManager { - constructor(check) { - this.check = check; - } - static use(connection, name, dbVersionSupport, consistencyLevel, tenant) { - return new QueryManager(new Check(connection, name, dbVersionSupport, consistencyLevel, tenant)); - } - parseReply(reply) { - return __awaiter(this, void 0, void 0, function* () { - const deserialize = yield Deserialize.use(this.check.dbVersionSupport); - return deserialize.query(reply); - }); - } - parseGroupByReply(opts, reply) { - return __awaiter(this, void 0, void 0, function* () { - const deserialize = yield Deserialize.use(this.check.dbVersionSupport); - return Serialize.isGroupBy(opts) ? deserialize.groupBy(reply) : deserialize.query(reply); - }); - } - fetchObjectById(id, opts) { - return this.check - .fetchObjectById(opts) - .then(({ search }) => search.withFetch(Serialize.fetchObjectById(Object.assign({ id }, opts)))) - .then((reply) => this.parseReply(reply)) - .then((ret) => (ret.objects.length === 1 ? ret.objects[0] : null)); - } - fetchObjects(opts) { - return this.check - .fetchObjects(opts) - .then(({ search }) => search.withFetch(Serialize.fetchObjects(opts))) - .then((reply) => this.parseReply(reply)); - } - bm25(query, opts) { - return this.check - .bm25(opts) - .then(({ search }) => - search.withBm25( - Object.assign(Object.assign({}, Serialize.bm25(Object.assign({ query }, opts))), { - groupBy: Serialize.isGroupBy(opts) ? Serialize.groupBy(opts.groupBy) : undefined, - }) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - hybrid(query, opts) { - return this.check - .hybridSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets, supportsVectorsForTargets }) => - search.withHybrid( - Object.assign( - Object.assign( - {}, - Serialize.hybrid( - Object.assign( - { query, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets }, - opts - ) - ) - ), - { groupBy: Serialize.isGroupBy(opts) ? Serialize.groupBy(opts.groupBy) : undefined } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearImage(image, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => { - return toBase64FromMedia(image).then((image) => - search.withNearImage( - Object.assign( - Object.assign( - {}, - Serialize.nearImage( - Object.assign({ image, supportsTargets, supportsWeightsForTargets }, opts ? opts : {}) - ) - ), - { groupBy: Serialize.isGroupBy(opts) ? Serialize.groupBy(opts.groupBy) : undefined } - ) - ) - ); - }) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearMedia(media, type, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => { - const args = Object.assign({ supportsTargets, supportsWeightsForTargets }, opts ? opts : {}); - let reply; - switch (type) { - case 'audio': - reply = toBase64FromMedia(media).then((media) => - search.withNearAudio(Serialize.nearAudio(Object.assign({ audio: media }, args))) - ); - break; - case 'depth': - reply = toBase64FromMedia(media).then((media) => - search.withNearDepth(Serialize.nearDepth(Object.assign({ depth: media }, args))) - ); - break; - case 'image': - reply = toBase64FromMedia(media).then((media) => - search.withNearImage(Serialize.nearImage(Object.assign({ image: media }, args))) - ); - break; - case 'imu': - reply = toBase64FromMedia(media).then((media) => - search.withNearIMU(Serialize.nearIMU(Object.assign({ imu: media }, args))) - ); - break; - case 'thermal': - reply = toBase64FromMedia(media).then((media) => - search.withNearThermal(Serialize.nearThermal(Object.assign({ thermal: media }, args))) - ); - break; - case 'video': - reply = toBase64FromMedia(media).then((media) => - search.withNearVideo(Serialize.nearVideo(Object.assign({ video: media }, args))) - ); - break; - default: - throw new WeaviateInvalidInputError(`Invalid media type: ${type}`); - } - return reply; - }) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearObject(id, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => - search.withNearObject( - Object.assign( - Object.assign( - {}, - Serialize.nearObject( - Object.assign({ id, supportsTargets, supportsWeightsForTargets }, opts ? opts : {}) - ) - ), - { groupBy: Serialize.isGroupBy(opts) ? Serialize.groupBy(opts.groupBy) : undefined } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearText(query, opts) { - return this.check - .nearSearch(opts) - .then(({ search, supportsTargets, supportsWeightsForTargets }) => - search.withNearText( - Object.assign( - Object.assign( - {}, - Serialize.nearText( - Object.assign({ query, supportsTargets, supportsWeightsForTargets }, opts ? opts : {}) - ) - ), - { groupBy: Serialize.isGroupBy(opts) ? Serialize.groupBy(opts.groupBy) : undefined } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } - nearVector(vector, opts) { - return this.check - .nearVector(vector, opts) - .then(({ search, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets }) => - search.withNearVector( - Object.assign( - Object.assign( - {}, - Serialize.nearVector( - Object.assign( - { vector, supportsTargets, supportsVectorsForTargets, supportsWeightsForTargets }, - opts ? opts : {} - ) - ) - ), - { groupBy: Serialize.isGroupBy(opts) ? Serialize.groupBy(opts.groupBy) : undefined } - ) - ) - ) - .then((reply) => this.parseGroupByReply(opts, reply)); - } -} -export default QueryManager.use; diff --git a/dist/node/esm/collections/query/types.d.ts b/dist/node/esm/collections/query/types.d.ts deleted file mode 100644 index 333a94b4..00000000 --- a/dist/node/esm/collections/query/types.d.ts +++ /dev/null @@ -1,494 +0,0 @@ -/// -import { FilterValue } from '../filters/index.js'; -import { MultiTargetVectorJoin } from '../index.js'; -import { Sorting } from '../sort/classes.js'; -import { - GroupByOptions, - GroupByReturn, - QueryMetadata, - QueryProperty, - QueryReference, - RerankOptions, - WeaviateObject, - WeaviateReturn, -} from '../types/index.js'; -import { PrimitiveKeys } from '../types/internal.js'; -/** Options available in the `query.fetchObjectById` method */ -export type FetchObjectByIdOptions = { - /** Whether to include the vector of the object in the response. If using named vectors, pass an array of strings to include only specific vectors. */ - includeVector?: boolean | string[]; - /** - * Which properties of the object to return. Can be primitive, in which case specify their names, or nested, in which case - * use the QueryNested type. If not specified, all properties are returned. - */ - returnProperties?: QueryProperty[]; - /** Which references of the object to return. If not specified, no references are returned. */ - returnReferences?: QueryReference[]; -}; -/** Options available in the `query.fetchObjects` method */ -export type FetchObjectsOptions = { - /** How many objects to return in the query */ - limit?: number; - /** How many objects to skip in the query. Incompatible with the `after` cursor */ - offset?: number; - /** The cursor to start the query from. Incompatible with the `offset` param */ - after?: string; - /** The filters to be applied to the query. Use `weaviate.filter.*` to create filters */ - filters?: FilterValue; - /** The sorting to be applied to the query. Use `weaviate.sort.*` to create sorting */ - sort?: Sorting; - /** Whether to include the vector of the object in the response. If using named vectors, pass an array of strings to include only specific vectors. */ - includeVector?: boolean | string[]; - /** Which metadata of the object to return. If not specified, no metadata is returned. */ - returnMetadata?: QueryMetadata; - /** - * Which properties of the object to return. Can be primitive, in which case specify their names, or nested, in which case - * use the QueryNested type. If not specified, all properties are returned. - */ - returnProperties?: QueryProperty[]; - /** Which references of the object to return. If not specified, no references are returned. */ - returnReferences?: QueryReference[]; -}; -/** Base options available to all the query methods that involve searching. */ -export type SearchOptions = { - /** How many objects to return in the query */ - limit?: number; - /** How many objects to skip in the query. Incompatible with the `after` cursor */ - offset?: number; - /** The [autocut](https://weaviate.io/developers/weaviate/api/graphql/additional-operators#autocut) parameter */ - autoLimit?: number; - /** The filters to be applied to the query. Use `weaviate.filter.*` to create filters */ - filters?: FilterValue; - /** How to rerank the query results. Requires a configured [reranking](https://weaviate.io/developers/weaviate/concepts/reranking) module. */ - rerank?: RerankOptions; - /** Whether to include the vector of the object in the response. If using named vectors, pass an array of strings to include only specific vectors. */ - includeVector?: boolean | string[]; - /** Which metadata of the object to return. If not specified, no metadata is returned. */ - returnMetadata?: QueryMetadata; - /** - * Which properties of the object to return. Can be primitive, in which case specify their names, or nested, in which case - * use the QueryNested type. If not specified, all properties are returned. - */ - returnProperties?: QueryProperty[]; - /** Which references of the object to return. If not specified, no references are returned. */ - returnReferences?: QueryReference[]; -}; -/** Which property of the collection to perform the keyword search on. */ -export type Bm25QueryProperty = { - /** The property name to search on. */ - name: PrimitiveKeys; - /** The weight to provide to the keyword search for this property. */ - weight: number; -}; -/** Base options available in the `query.bm25` method */ -export type BaseBm25Options = SearchOptions & { - /** Which properties of the collection to perform the keyword search on. */ - queryProperties?: (PrimitiveKeys | Bm25QueryProperty)[]; -}; -/** Options available in the `query.bm25` method when specifying the `groupBy` parameter. */ -export type GroupByBm25Options = BaseBm25Options & { - /** The group by options to apply to the search. */ - groupBy: GroupByOptions; -}; -/** Options available in the `query.bm25` method */ -export type Bm25Options = BaseBm25Options | GroupByBm25Options | undefined; -/** Base options available in the `query.hybrid` method */ -export type BaseHybridOptions = SearchOptions & { - /** The weight of the BM25 score. If not specified, the default weight specified by the server is used. */ - alpha?: number; - /** The specific vector to search for or a specific vector subsearch. If not specified, the query is vectorized and used in the similarity search. */ - vector?: NearVectorInputType | HybridNearTextSubSearch | HybridNearVectorSubSearch; - /** The properties to search in. If not specified, all properties are searched. */ - queryProperties?: (PrimitiveKeys | Bm25QueryProperty)[]; - /** The type of fusion to apply. If not specified, the default fusion type specified by the server is used. */ - fusionType?: 'Ranked' | 'RelativeScore'; - /** Specify which vector(s) to search on if using named vectors. */ - targetVector?: TargetVectorInputType; -}; -export type HybridSubSearchBase = { - certainty?: number; - distance?: number; -}; -export type HybridNearTextSubSearch = HybridSubSearchBase & { - query: string | string[]; - moveTo?: MoveOptions; - moveAway?: MoveOptions; -}; -export type HybridNearVectorSubSearch = HybridSubSearchBase & { - vector: NearVectorInputType; -}; -/** Options available in the `query.hybrid` method when specifying the `groupBy` parameter. */ -export type GroupByHybridOptions = BaseHybridOptions & { - /** The group by options to apply to the search. */ - groupBy: GroupByOptions; -}; -/** Options available in the `query.hybrid` method */ -export type HybridOptions = BaseHybridOptions | GroupByHybridOptions | undefined; -/** Base options for the near search queries. */ -export type BaseNearOptions = SearchOptions & { - /** The minimum similarity score to return. Incompatible with the `distance` param. */ - certainty?: number; - /** The maximum distance to search. Incompatible with the `certainty` param. */ - distance?: number; - /** Specify which vector to search on if using named vectors. */ - targetVector?: TargetVectorInputType; -}; -/** Options available in the near search queries when specifying the `groupBy` parameter. */ -export type GroupByNearOptions = BaseNearOptions & { - /** The group by options to apply to the search. */ - groupBy: GroupByOptions; -}; -/** Options available when specifying `moveTo` and `moveAway` in the `query.nearText` method. */ -export type MoveOptions = { - force: number; - objects?: string[]; - concepts?: string[]; -}; -/** Base options for the `query.nearText` method. */ -export type BaseNearTextOptions = BaseNearOptions & { - moveTo?: MoveOptions; - moveAway?: MoveOptions; -}; -/** Options available in the near text search queries when specifying the `groupBy` parameter. */ -export type GroupByNearTextOptions = BaseNearTextOptions & { - groupBy: GroupByOptions; -}; -/** The type of the media to search for in the `query.nearMedia` method */ -export type NearMediaType = 'audio' | 'depth' | 'image' | 'imu' | 'thermal' | 'video'; -/** - * The vector(s) to search for in the `query/generate.nearVector` and `query/generate.hybrid` methods. One of: - * - a single vector, in which case pass a single number array. - * - multiple named vectors, in which case pass an object of type `Record`. - */ -export type NearVectorInputType = number[] | Record; -/** - * Over which vector spaces to perform the vector search query in the `nearX` search method. One of: - * - a single vector space search, in which case pass a string with the name of the vector space to search in. - * - a multi-vector space search, in which case pass an array of strings with the names of the vector spaces to search in. - * - a weighted multi-vector space search, in which case pass an object of type `MultiTargetVectorJoin` detailing the vector spaces to search in. - */ -export type TargetVectorInputType = string | string[] | MultiTargetVectorJoin; -interface Bm25 { - /** - * Search for objects in this collection using the keyword-based BM25 algorithm. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/bm25) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string} query - The query to search for. - * @param {BaseBm25Options} [opts] - The available options for the search excluding the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - bm25(query: string, opts?: BaseBm25Options): Promise>; - /** - * Search for objects in this collection using the keyword-based BM25 algorithm. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/bm25) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string} query - The query to search for. - * @param {GroupByBm25Options} opts - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - bm25(query: string, opts: GroupByBm25Options): Promise>; - /** - * Search for objects in this collection using the keyword-based BM25 algorithm. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/bm25) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string} query - The query to search for. - * @param {Bm25Options} [opts] - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - bm25(query: string, opts?: Bm25Options): QueryReturn; -} -interface Hybrid { - /** - * Search for objects in this collection using the hybrid algorithm blending keyword-based BM25 and vector-based similarity. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/hybrid) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string} query - The query to search for in the BM25 keyword search.. - * @param {BaseHybridOptions} [opts] - The available options for the search excluding the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - hybrid(query: string, opts?: BaseHybridOptions): Promise>; - /** - * Search for objects in this collection using the hybrid algorithm blending keyword-based BM25 and vector-based similarity. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/hybrid) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string} query - The query to search for in the BM25 keyword search.. - * @param {GroupByHybridOptions} opts - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - hybrid(query: string, opts: GroupByHybridOptions): Promise>; - /** - * Search for objects in this collection using the hybrid algorithm blending keyword-based BM25 and vector-based similarity. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/hybrid) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string} query - The query to search for in the BM25 keyword search.. - * @param {HybridOptions} [opts] - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - hybrid(query: string, opts?: HybridOptions): QueryReturn; -} -interface NearImage { - /** - * Search for objects by image in this collection using an image-capable vectorization module and vector-based similarity search. - * You must have an image-capable vectorization module installed in order to use this method, - * e.g. `img2vec-neural`, `multi2vec-clip`, or `multi2vec-bind. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/image) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string | Buffer} image - The image to search on. This can be a base64 string, a file path string, or a buffer. - * @param {BaseNearOptions} [opts] - The available options for the search excluding the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - nearImage(image: string | Buffer, opts?: BaseNearOptions): Promise>; - /** - * Search for objects by image in this collection using an image-capable vectorization module and vector-based similarity search. - * You must have an image-capable vectorization module installed in order to use this method, - * e.g. `img2vec-neural`, `multi2vec-clip`, or `multi2vec-bind. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string | Buffer} image - The image to search on. This can be a base64 string, a file path string, or a buffer. - * @param {GroupByNearOptions} opts - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The group by result of the search within the fetched collection. - */ - nearImage(image: string | Buffer, opts: GroupByNearOptions): Promise>; - /** - * Search for objects by image in this collection using an image-capable vectorization module and vector-based similarity search. - * You must have an image-capable vectorization module installed in order to use this method, - * e.g. `img2vec-neural`, `multi2vec-clip`, or `multi2vec-bind. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string | Buffer} image - The image to search on. This can be a base64 string, a file path string, or a buffer. - * @param {NearOptions} [opts] - The available options for the search. - * @returns {QueryReturn} - The result of the search within the fetched collection. - */ - nearImage(image: string | Buffer, opts?: NearOptions): QueryReturn; -} -interface NearMedia { - /** - * Search for objects by image in this collection using an image-capable vectorization module and vector-based similarity search. - * You must have a multi-media-capable vectorization module installed in order to use this method, e.g. `multi2vec-bind` or `multi2vec-palm`. - * - * See the [docs](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/multi2vec-bind) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string | Buffer} media - The media to search on. This can be a base64 string, a file path string, or a buffer. - * @param {NearMediaType} type - The type of media to search for, e.g. 'audio'. - * @param {BaseNearOptions} [opts] - The available options for the search excluding the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - nearMedia( - media: string | Buffer, - type: NearMediaType, - opts?: BaseNearOptions - ): Promise>; - /** - * Search for objects by image in this collection using an image-capable vectorization module and vector-based similarity search. - * You must have a multi-media-capable vectorization module installed in order to use this method, e.g. `multi2vec-bind` or `multi2vec-palm`. - * - * See the [docs](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/multi2vec-bind) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string | Buffer} media - The media to search on. This can be a base64 string, a file path string, or a buffer. - * @param {NearMediaType} type - The type of media to search for, e.g. 'audio'. - * @param {GroupByNearOptions} opts - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The group by result of the search within the fetched collection. - */ - nearMedia( - media: string | Buffer, - type: NearMediaType, - opts: GroupByNearOptions - ): Promise>; - /** - * Search for objects by image in this collection using an image-capable vectorization module and vector-based similarity search. - * You must have a multi-media-capable vectorization module installed in order to use this method, e.g. `multi2vec-bind` or `multi2vec-palm`. - * - * See the [docs](https://weaviate.io/developers/weaviate/modules/retriever-vectorizer-modules/multi2vec-bind) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string | Buffer} media - The media to search on. This can be a base64 string, a file path string, or a buffer. - * @param {NearMediaType} type - The type of media to search for, e.g. 'audio'. - * @param {NearOptions} [opts] - The available options for the search. - * @returns {QueryReturn} - The result of the search within the fetched collection. - */ - nearMedia(media: string | Buffer, type: NearMediaType, opts?: NearOptions): QueryReturn; -} -interface NearObject { - /** - * Search for objects in this collection by another object using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#nearobject) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string} id - The UUID of the object to search for. - * @param {BaseNearOptions} [opts] - The available options for the search excluding the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - nearObject(id: string, opts?: BaseNearOptions): Promise>; - /** - * Search for objects in this collection by another object using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#nearobject) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string} id - The UUID of the object to search for. - * @param {GroupByNearOptions} opts - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The group by result of the search within the fetched collection. - */ - nearObject(id: string, opts: GroupByNearOptions): Promise>; - /** - * Search for objects in this collection by another object using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {number[]} id - The UUID of the object to search for. - * @param {NearOptions} [opts] - The available options for the search. - * @returns {QueryReturn} - The result of the search within the fetched collection. - */ - nearObject(id: string, opts?: NearOptions): QueryReturn; -} -interface NearText { - /** - * Search for objects in this collection by text using text-capable vectorization module and vector-based similarity search. - * You must have a text-capable vectorization module installed in order to use this method, - * e.g. any of the `text2vec-` and `multi2vec-` modules. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#neartext) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {string | string[]} query - The text query to search for. - * @param {BaseNearTextOptions} [opts] - The available options for the search excluding the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - nearText(query: string | string[], opts?: BaseNearTextOptions): Promise>; - /** - * Search for objects in this collection by text using text-capable vectorization module and vector-based similarity search. - * You must have a text-capable vectorization module installed in order to use this method, - * e.g. any of the `text2vec-` and `multi2vec-` modules. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#neartext) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {string | string[]} query - The text query to search for. - * @param {GroupByNearTextOptions} opts - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The group by result of the search within the fetched collection. - */ - nearText(query: string | string[], opts: GroupByNearTextOptions): Promise>; - /** - * Search for objects in this collection by text using text-capable vectorization module and vector-based similarity search. - * You must have a text-capable vectorization module installed in order to use this method, - * e.g. any of the `text2vec-` and `multi2vec-` modules. - * - * See the [docs](https://weaviate.io/developers/weaviate/api/graphql/search-operators#neartext) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {string | string[]} query - The text query to search for. - * @param {NearTextOptions} [opts] - The available options for the search. - * @returns {QueryReturn} - The result of the search within the fetched collection. - */ - nearText(query: string | string[], opts?: NearTextOptions): QueryReturn; -} -interface NearVector { - /** - * Search for objects by vector in this collection using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search without the `groupBy` param. - * - * @param {NearVectorInputType} vector - The vector(s) to search on. - * @param {BaseNearOptions} [opts] - The available options for the search excluding the `groupBy` param. - * @returns {Promise>} - The result of the search within the fetched collection. - */ - nearVector(vector: NearVectorInputType, opts?: BaseNearOptions): Promise>; - /** - * Search for objects by vector in this collection using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search with the `groupBy` param. - * - * @param {NearVectorInputType} vector - The vector(s) to search for. - * @param {GroupByNearOptions} opts - The available options for the search including the `groupBy` param. - * @returns {Promise>} - The group by result of the search within the fetched collection. - */ - nearVector(vector: NearVectorInputType, opts: GroupByNearOptions): Promise>; - /** - * Search for objects by vector in this collection using a vector-based similarity search. - * - * See the [docs](https://weaviate.io/developers/weaviate/search/similarity) for a more detailed explanation. - * - * This overload is for performing a search with a programmatically defined `opts` param. - * - * @param {NearVectorInputType} vector - The vector(s) to search for. - * @param {NearOptions} [opts] - The available options for the search. - * @returns {QueryReturn} - The result of the search within the fetched collection. - */ - nearVector(vector: NearVectorInputType, opts?: NearOptions): QueryReturn; -} -/** All the available methods on the `.query` namespace. */ -export interface Query - extends Bm25, - Hybrid, - NearImage, - NearMedia, - NearObject, - NearText, - NearVector { - /** - * Retrieve an object from the server by its UUID. - * - * @param {string} id - The UUID of the object to retrieve. - * @param {FetchObjectByIdOptions} [opts] - The available options for fetching the object. - * @returns {Promise | null>} - The object with the given UUID, or null if it does not exist. - */ - fetchObjectById: (id: string, opts?: FetchObjectByIdOptions) => Promise | null>; - /** - * Retrieve objects from the server without searching. - * - * @param {FetchObjectsOptions} [opts] - The available options for fetching the objects. - * @returns {Promise>} - The objects within the fetched collection. - */ - fetchObjects: (opts?: FetchObjectsOptions) => Promise>; -} -/** Options available in the `query.nearImage`, `query.nearMedia`, `query.nearObject`, and `query.nearVector` methods */ -export type NearOptions = BaseNearOptions | GroupByNearOptions | undefined; -/** Options available in the `query.nearText` method */ -export type NearTextOptions = BaseNearTextOptions | GroupByNearTextOptions | undefined; -/** The return type of the `query` methods. It is a union of a standard query and a group by query due to function overloading. */ -export type QueryReturn = Promise> | Promise>; -export {}; diff --git a/dist/node/esm/collections/query/types.js b/dist/node/esm/collections/query/types.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/query/types.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/query/utils.d.ts b/dist/node/esm/collections/query/utils.d.ts deleted file mode 100644 index 958a6dfd..00000000 --- a/dist/node/esm/collections/query/utils.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { MultiTargetVectorJoin } from '../index.js'; -import { NearVectorInputType, TargetVectorInputType } from './types.js'; -export declare class NearVectorInputGuards { - static is1DArray(input: NearVectorInputType): input is number[]; - static isObject(input: NearVectorInputType): input is Record; -} -export declare class ArrayInputGuards { - static is1DArray(input: U | T): input is T; - static is2DArray(input: U | T): input is T; -} -export declare class TargetVectorInputGuards { - static isSingle(input: TargetVectorInputType): input is string; - static isMulti(input: TargetVectorInputType): input is string[]; - static isMultiJoin(input: TargetVectorInputType): input is MultiTargetVectorJoin; -} diff --git a/dist/node/esm/collections/query/utils.js b/dist/node/esm/collections/query/utils.js deleted file mode 100644 index 26b8bb48..00000000 --- a/dist/node/esm/collections/query/utils.js +++ /dev/null @@ -1,28 +0,0 @@ -export class NearVectorInputGuards { - static is1DArray(input) { - return Array.isArray(input) && input.length > 0 && !Array.isArray(input[0]); - } - static isObject(input) { - return !Array.isArray(input); - } -} -export class ArrayInputGuards { - static is1DArray(input) { - return Array.isArray(input) && input.length > 0 && !Array.isArray(input[0]); - } - static is2DArray(input) { - return Array.isArray(input) && input.length > 0 && Array.isArray(input[0]); - } -} -export class TargetVectorInputGuards { - static isSingle(input) { - return typeof input === 'string'; - } - static isMulti(input) { - return Array.isArray(input); - } - static isMultiJoin(input) { - const i = input; - return i.combination !== undefined && i.targetVectors !== undefined; - } -} diff --git a/dist/node/esm/collections/references/classes.d.ts b/dist/node/esm/collections/references/classes.d.ts deleted file mode 100644 index 31384fb8..00000000 --- a/dist/node/esm/collections/references/classes.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Properties, ReferenceInput, ReferenceToMultiTarget, WeaviateObject } from '../types/index.js'; -import { Beacon } from './types.js'; -export declare class ReferenceManager { - objects: WeaviateObject[]; - targetCollection: string; - uuids?: string[]; - constructor(targetCollection: string, objects?: WeaviateObject[], uuids?: string[]); - toBeaconObjs(): Beacon[]; - toBeaconStrings(): string[]; - isMultiTarget(): boolean; -} -/** - * A factory class to create references from objects to other objects. - */ -export declare class Reference { - /** - * Create a single-target reference with given UUID(s). - * - * @param {string | string[]} uuids The UUID(s) of the target object(s). - * @returns {ReferenceManager} The reference manager object. - */ - static to( - uuids: string | string[] - ): ReferenceManager; - /** - * Create a multi-target reference with given UUID(s) pointing to a specific target collection. - * - * @param {string | string[]} uuids The UUID(s) of the target object(s). - * @param {string} targetCollection The target collection name. - * @returns {ReferenceManager} The reference manager object. - */ - static toMultiTarget( - uuids: string | string[], - targetCollection: string - ): ReferenceManager; -} -export declare class ReferenceGuards { - static isReferenceManager(arg: ReferenceInput): arg is ReferenceManager; - static isUuid(arg: ReferenceInput): arg is string; - static isUuids(arg: ReferenceInput): arg is string[]; - static isMultiTarget(arg: ReferenceInput): arg is ReferenceToMultiTarget; -} diff --git a/dist/node/esm/collections/references/classes.js b/dist/node/esm/collections/references/classes.js deleted file mode 100644 index c4801c27..00000000 --- a/dist/node/esm/collections/references/classes.js +++ /dev/null @@ -1,55 +0,0 @@ -import { uuidToBeacon } from './utils.js'; -export class ReferenceManager { - constructor(targetCollection, objects, uuids) { - this.objects = objects !== null && objects !== void 0 ? objects : []; - this.targetCollection = targetCollection; - this.uuids = uuids; - } - toBeaconObjs() { - return this.uuids ? this.uuids.map((uuid) => uuidToBeacon(uuid, this.targetCollection)) : []; - } - toBeaconStrings() { - return this.uuids ? this.uuids.map((uuid) => uuidToBeacon(uuid, this.targetCollection).beacon) : []; - } - isMultiTarget() { - return this.targetCollection !== ''; - } -} -/** - * A factory class to create references from objects to other objects. - */ -export class Reference { - /** - * Create a single-target reference with given UUID(s). - * - * @param {string | string[]} uuids The UUID(s) of the target object(s). - * @returns {ReferenceManager} The reference manager object. - */ - static to(uuids) { - return new ReferenceManager('', undefined, Array.isArray(uuids) ? uuids : [uuids]); - } - /** - * Create a multi-target reference with given UUID(s) pointing to a specific target collection. - * - * @param {string | string[]} uuids The UUID(s) of the target object(s). - * @param {string} targetCollection The target collection name. - * @returns {ReferenceManager} The reference manager object. - */ - static toMultiTarget(uuids, targetCollection) { - return new ReferenceManager(targetCollection, undefined, Array.isArray(uuids) ? uuids : [uuids]); - } -} -export class ReferenceGuards { - static isReferenceManager(arg) { - return arg instanceof ReferenceManager; - } - static isUuid(arg) { - return typeof arg === 'string'; - } - static isUuids(arg) { - return Array.isArray(arg); - } - static isMultiTarget(arg) { - return arg.targetCollection !== undefined; - } -} diff --git a/dist/node/esm/collections/references/index.d.ts b/dist/node/esm/collections/references/index.d.ts deleted file mode 100644 index 58295777..00000000 --- a/dist/node/esm/collections/references/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { Reference, ReferenceManager } from './classes.js'; -export type { Beacon, CrossReference, CrossReferenceDefault, CrossReferences, UnionOf } from './types.js'; diff --git a/dist/node/esm/collections/references/index.js b/dist/node/esm/collections/references/index.js deleted file mode 100644 index 98e736d2..00000000 --- a/dist/node/esm/collections/references/index.js +++ /dev/null @@ -1 +0,0 @@ -export { Reference, ReferenceManager } from './classes.js'; diff --git a/dist/node/esm/collections/references/types.d.ts b/dist/node/esm/collections/references/types.d.ts deleted file mode 100644 index 9df567b3..00000000 --- a/dist/node/esm/collections/references/types.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { Properties, WeaviateNonGenericObject } from '../types/index.js'; -import { ReferenceManager } from './classes.js'; -export type CrossReference = ReferenceManager; -export type CrossReferenceDefault = { - objects: WeaviateNonGenericObject[]; -}; -export type CrossReferences = ReferenceManager>; -export type UnionOf = T extends (infer U)[] ? U : never; -export type Beacon = { - beacon: string; -}; diff --git a/dist/node/esm/collections/references/types.js b/dist/node/esm/collections/references/types.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/references/types.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/references/utils.d.ts b/dist/node/esm/collections/references/utils.d.ts deleted file mode 100644 index 80db3459..00000000 --- a/dist/node/esm/collections/references/utils.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ReferenceInput } from '../types/index.js'; -import { ReferenceManager } from './classes.js'; -import { Beacon } from './types.js'; -export declare function uuidToBeacon(uuid: string, targetCollection?: string): Beacon; -export declare const referenceFromObjects: ( - objects: any[], - targetCollection: string, - uuids: string[] -) => ReferenceManager; -export declare const referenceToBeacons: (ref: ReferenceInput) => Beacon[]; diff --git a/dist/node/esm/collections/references/utils.js b/dist/node/esm/collections/references/utils.js deleted file mode 100644 index bdf0be00..00000000 --- a/dist/node/esm/collections/references/utils.js +++ /dev/null @@ -1,23 +0,0 @@ -import { ReferenceGuards, ReferenceManager } from './classes.js'; -export function uuidToBeacon(uuid, targetCollection) { - return { - beacon: `weaviate://localhost/${targetCollection ? `${targetCollection}/` : ''}${uuid}`, - }; -} -export const referenceFromObjects = (objects, targetCollection, uuids) => { - return new ReferenceManager(targetCollection, objects, uuids); -}; -export const referenceToBeacons = (ref) => { - if (ReferenceGuards.isReferenceManager(ref)) { - return ref.toBeaconObjs(); - } else if (ReferenceGuards.isUuid(ref)) { - return [uuidToBeacon(ref)]; - } else if (ReferenceGuards.isUuids(ref)) { - return ref.map((uuid) => uuidToBeacon(uuid)); - } else if (ReferenceGuards.isMultiTarget(ref)) { - return typeof ref.uuids === 'string' - ? [uuidToBeacon(ref.uuids, ref.targetCollection)] - : ref.uuids.map((uuid) => uuidToBeacon(uuid, ref.targetCollection)); - } - return []; -}; diff --git a/dist/node/esm/collections/serialize/index.d.ts b/dist/node/esm/collections/serialize/index.d.ts deleted file mode 100644 index 9706b9f9..00000000 --- a/dist/node/esm/collections/serialize/index.d.ts +++ /dev/null @@ -1,224 +0,0 @@ -import { - SearchBm25Args, - SearchFetchArgs, - SearchHybridArgs, - SearchNearAudioArgs, - SearchNearDepthArgs, - SearchNearIMUArgs, - SearchNearImageArgs, - SearchNearObjectArgs, - SearchNearTextArgs, - SearchNearThermalArgs, - SearchNearVectorArgs, - SearchNearVideoArgs, -} from '../../grpc/searcher.js'; -import { WhereFilter } from '../../openapi/types.js'; -import { Filters as FiltersGRPC } from '../../proto/v1/base.js'; -import { GenerativeSearch } from '../../proto/v1/generative.js'; -import { GroupBy, Rerank, Targets } from '../../proto/v1/search_get.js'; -import { FilterValue } from '../filters/index.js'; -import { - BaseNearOptions, - Bm25Options, - FetchObjectByIdOptions, - FetchObjectsOptions, - HybridNearTextSubSearch, - HybridNearVectorSubSearch, - HybridOptions, - NearOptions, - NearTextOptions, - NearVectorInputType, - TargetVectorInputType, -} from '../query/types.js'; -import { TenantBC, TenantCreate, TenantUpdate } from '../tenants/types.js'; -import { - BatchObjects, - DataObject, - GenerateOptions, - GroupByOptions, - MetadataKeys, - NestedProperties, - NonReferenceInputs, - PhoneNumberInput, - QueryMetadata, - ReferenceInput, - RerankOptions, - WeaviateField, -} from '../types/index.js'; -export declare class DataGuards { - static isText: (argument?: WeaviateField) => argument is string; - static isTextArray: (argument?: WeaviateField) => argument is string[]; - static isInt: (argument?: WeaviateField) => argument is number; - static isIntArray: (argument?: WeaviateField) => argument is number[]; - static isFloat: (argument?: WeaviateField) => argument is number; - static isFloatArray: (argument?: WeaviateField) => argument is number[]; - static isBoolean: (argument?: WeaviateField) => argument is boolean; - static isBooleanArray: (argument?: WeaviateField) => argument is boolean[]; - static isDate: (argument?: WeaviateField) => argument is Date; - static isDateArray: (argument?: WeaviateField) => argument is Date[]; - static isGeoCoordinate: ( - argument?: WeaviateField - ) => argument is Required; - static isPhoneNumber: (argument?: WeaviateField) => argument is PhoneNumberInput; - static isNested: (argument?: WeaviateField) => argument is NestedProperties; - static isNestedArray: (argument?: WeaviateField) => argument is NestedProperties[]; - static isEmptyArray: (argument?: WeaviateField) => argument is []; - static isDataObject: (obj: DataObject | NonReferenceInputs) => obj is DataObject; -} -export declare class MetadataGuards { - static isKeys: (argument?: QueryMetadata) => argument is MetadataKeys; - static isAll: (argument?: QueryMetadata) => argument is 'all'; - static isUndefined: (argument?: QueryMetadata) => argument is undefined; -} -export declare class Serialize { - static isNamedVectors: (opts?: BaseNearOptions | undefined) => boolean; - static isMultiTarget: (opts?: BaseNearOptions | undefined) => boolean; - static isMultiWeightPerTarget: (opts?: BaseNearOptions | undefined) => boolean; - static isMultiVector: (vec?: NearVectorInputType) => boolean; - static isMultiVectorPerTarget: (vec?: NearVectorInputType) => boolean; - private static common; - static fetchObjects: (args?: FetchObjectsOptions | undefined) => SearchFetchArgs; - static fetchObjectById: ( - args: { - id: string; - } & FetchObjectByIdOptions - ) => SearchFetchArgs; - private static bm25QueryProperties; - static bm25: ( - args: { - query: string; - } & Bm25Options - ) => SearchBm25Args; - static isHybridVectorSearch: ( - vector: NearVectorInputType | HybridNearTextSubSearch | HybridNearVectorSubSearch | undefined - ) => vector is number[] | Record; - static isHybridNearTextSearch: ( - vector: NearVectorInputType | HybridNearTextSubSearch | HybridNearVectorSubSearch | undefined - ) => vector is HybridNearTextSubSearch; - static isHybridNearVectorSearch: ( - vector: NearVectorInputType | HybridNearTextSubSearch | HybridNearVectorSubSearch | undefined - ) => vector is HybridNearVectorSubSearch; - private static hybridVector; - static hybrid: ( - args: { - query: string; - supportsTargets: boolean; - supportsVectorsForTargets: boolean; - supportsWeightsForTargets: boolean; - } & HybridOptions - ) => SearchHybridArgs; - static nearAudio: ( - args: { - audio: string; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearAudioArgs; - static nearDepth: ( - args: { - depth: string; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearDepthArgs; - static nearImage: ( - args: { - image: string; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearImageArgs; - static nearIMU: ( - args: { - imu: string; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearIMUArgs; - static nearObject: ( - args: { - id: string; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearObjectArgs; - private static nearTextSearch; - static nearText: ( - args: { - query: string | string[]; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearTextOptions - ) => SearchNearTextArgs; - static nearThermal: ( - args: { - thermal: string; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearThermalArgs; - private static vectorToBytes; - private static nearVectorSearch; - static targetVector: (args: { - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - targetVector?: TargetVectorInputType; - }) => { - targets?: Targets; - targetVectors?: string[]; - }; - private static vectors; - private static targets; - static nearVector: ( - args: { - vector: NearVectorInputType; - supportsTargets: boolean; - supportsVectorsForTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearVectorArgs; - static nearVideo: ( - args: { - video: string; - supportsTargets: boolean; - supportsWeightsForTargets: boolean; - } & NearOptions - ) => SearchNearVideoArgs; - static filtersGRPC: (filters: FilterValue) => FiltersGRPC; - private static filtersGRPCValueText; - private static filtersGRPCValueTextArray; - private static filterTargetToREST; - static filtersREST: (filters: FilterValue) => WhereFilter; - private static operator; - private static queryProperties; - private static metadata; - private static sortBy; - static rerank: (rerank: RerankOptions) => Rerank; - static generative: (generative?: GenerateOptions | undefined) => GenerativeSearch; - static groupBy: (groupBy?: GroupByOptions | undefined) => GroupBy; - static isGroupBy: (args: any) => args is T; - static restProperties: ( - properties: Record, - references?: Record> - ) => Record; - private static batchProperties; - static batchObjects: ( - collection: string, - objects: (DataObject | NonReferenceInputs)[], - usesNamedVectors: boolean, - tenant?: string - ) => Promise>; - static tenants(tenants: T[], mapper: (tenant: T) => M): M[][]; - static tenantCreate( - tenant: T - ): { - name: string; - activityStatus?: 'HOT' | 'COLD'; - }; - static tenantUpdate( - tenant: T - ): { - name: string; - activityStatus: 'HOT' | 'COLD' | 'FROZEN'; - }; -} diff --git a/dist/node/esm/collections/serialize/index.js b/dist/node/esm/collections/serialize/index.js deleted file mode 100644 index bb47ca68..00000000 --- a/dist/node/esm/collections/serialize/index.js +++ /dev/null @@ -1,1225 +0,0 @@ -var _a; -import { v4 as uuidv4 } from 'uuid'; -import { - WeaviateInvalidInputError, - WeaviateSerializationError, - WeaviateUnsupportedFeatureError, -} from '../../errors.js'; -import { - Filters as FiltersGRPC, - Filters_Operator, - ObjectPropertiesValue, - Vectors as VectorsGrpc, -} from '../../proto/v1/base.js'; -import { BatchObject as BatchObjectGRPC } from '../../proto/v1/batch.js'; -import { GenerativeSearch } from '../../proto/v1/generative.js'; -import { - BM25, - CombinationMethod, - GroupBy, - Hybrid, - Hybrid_FusionType, - MetadataRequest, - NearAudioSearch, - NearDepthSearch, - NearIMUSearch, - NearImageSearch, - NearObject, - NearTextSearch, - NearTextSearch_Move, - NearThermalSearch, - NearVector, - NearVideoSearch, - Rerank, - Targets, -} from '../../proto/v1/search_get.js'; -import { FilterId } from '../filters/classes.js'; -import { Filters } from '../filters/index.js'; -import { ArrayInputGuards, NearVectorInputGuards, TargetVectorInputGuards } from '../query/utils.js'; -import { ReferenceGuards } from '../references/classes.js'; -import { uuidToBeacon } from '../references/utils.js'; -class FilterGuards {} -FilterGuards.isFilters = (argument) => { - return argument instanceof Filters; -}; -FilterGuards.isText = (argument) => { - return typeof argument === 'string'; -}; -FilterGuards.isTextArray = (argument) => { - return argument instanceof Array && argument.every((arg) => typeof arg === 'string'); -}; -FilterGuards.isInt = (argument) => { - return typeof argument === 'number' && Number.isInteger(argument); -}; -FilterGuards.isIntArray = (argument) => { - return ( - argument instanceof Array && argument.every((arg) => typeof arg === 'number' && Number.isInteger(arg)) - ); -}; -FilterGuards.isFloat = (argument) => { - return typeof argument === 'number' && !Number.isInteger(argument); -}; -FilterGuards.isFloatArray = (argument) => { - return ( - argument instanceof Array && argument.every((arg) => typeof arg === 'number' && !Number.isInteger(arg)) - ); -}; -FilterGuards.isBoolean = (argument) => { - return typeof argument === 'boolean'; -}; -FilterGuards.isBooleanArray = (argument) => { - return argument instanceof Array && argument.every((arg) => typeof arg === 'boolean'); -}; -FilterGuards.isDate = (argument) => { - return argument instanceof Date; -}; -FilterGuards.isDateArray = (argument) => { - return argument instanceof Array && argument.every((arg) => arg instanceof Date); -}; -FilterGuards.isGeoRange = (argument) => { - const arg = argument; - return arg.latitude !== undefined && arg.longitude !== undefined && arg.distance !== undefined; -}; -export class DataGuards {} -DataGuards.isText = (argument) => { - return typeof argument === 'string'; -}; -DataGuards.isTextArray = (argument) => { - return argument instanceof Array && argument.length > 0 && argument.every(DataGuards.isText); -}; -DataGuards.isInt = (argument) => { - return ( - typeof argument === 'number' && - Number.isInteger(argument) && - !Number.isNaN(argument) && - Number.isFinite(argument) - ); -}; -DataGuards.isIntArray = (argument) => { - return argument instanceof Array && argument.length > 0 && argument.every(DataGuards.isInt); -}; -DataGuards.isFloat = (argument) => { - return ( - typeof argument === 'number' && - !Number.isInteger(argument) && - !Number.isNaN(argument) && - Number.isFinite(argument) - ); -}; -DataGuards.isFloatArray = (argument) => { - return argument instanceof Array && argument.length > 0 && argument.every(DataGuards.isFloat); -}; -DataGuards.isBoolean = (argument) => { - return typeof argument === 'boolean'; -}; -DataGuards.isBooleanArray = (argument) => { - return argument instanceof Array && argument.length > 0 && argument.every(DataGuards.isBoolean); -}; -DataGuards.isDate = (argument) => { - return argument instanceof Date; -}; -DataGuards.isDateArray = (argument) => { - return argument instanceof Array && argument.length > 0 && argument.every(DataGuards.isDate); -}; -DataGuards.isGeoCoordinate = (argument) => { - return ( - argument instanceof Object && - argument.latitude !== undefined && - argument.longitude !== undefined && - Object.keys(argument).length === 2 - ); -}; -DataGuards.isPhoneNumber = (argument) => { - return ( - argument instanceof Object && - argument.number !== undefined && - (Object.keys(argument).length === 1 || - (Object.keys(argument).length === 2 && argument.defaultCountry !== undefined)) - ); -}; -DataGuards.isNested = (argument) => { - return ( - argument instanceof Object && - !(argument instanceof Array) && - !DataGuards.isDate(argument) && - !DataGuards.isGeoCoordinate(argument) && - !DataGuards.isPhoneNumber(argument) - ); -}; -DataGuards.isNestedArray = (argument) => { - return argument instanceof Array && argument.length > 0 && argument.every(DataGuards.isNested); -}; -DataGuards.isEmptyArray = (argument) => { - return argument instanceof Array && argument.length === 0; -}; -DataGuards.isDataObject = (obj) => { - return ( - obj.id !== undefined || - obj.properties !== undefined || - obj.references !== undefined || - obj.vectors !== undefined - ); -}; -export class MetadataGuards {} -MetadataGuards.isKeys = (argument) => { - return argument instanceof Array && argument.length > 0; -}; -MetadataGuards.isAll = (argument) => { - return argument === 'all'; -}; -MetadataGuards.isUndefined = (argument) => { - return argument === undefined; -}; -export class Serialize { - static tenants(tenants, mapper) { - const mapped = []; - const batches = Math.ceil(tenants.length / 100); - for (let i = 0; i < batches; i++) { - const batch = tenants.slice(i * 100, (i + 1) * 100); - mapped.push(batch.map(mapper)); - } - return mapped; - } - static tenantCreate(tenant) { - let activityStatus; - switch (tenant.activityStatus) { - case 'ACTIVE': - activityStatus = 'HOT'; - break; - case 'INACTIVE': - activityStatus = 'COLD'; - break; - case 'HOT': - case 'COLD': - case undefined: - activityStatus = tenant.activityStatus; - break; - case 'FROZEN': - throw new WeaviateInvalidInputError( - 'Invalid activity status. Please provide one of the following: ACTIVE, INACTIVE, HOT, COLD.' - ); - default: - throw new WeaviateInvalidInputError( - 'Invalid activity status. Please provide one of the following: ACTIVE, INACTIVE, HOT, COLD.' - ); - } - return { - name: tenant.name, - activityStatus, - }; - } - static tenantUpdate(tenant) { - let activityStatus; - switch (tenant.activityStatus) { - case 'ACTIVE': - activityStatus = 'HOT'; - break; - case 'INACTIVE': - activityStatus = 'COLD'; - break; - case 'OFFLOADED': - activityStatus = 'FROZEN'; - break; - case 'HOT': - case 'COLD': - case 'FROZEN': - activityStatus = tenant.activityStatus; - break; - default: - throw new WeaviateInvalidInputError( - 'Invalid activity status. Please provide one of the following: ACTIVE, INACTIVE, HOT, COLD, OFFLOADED.' - ); - } - return { - name: tenant.name, - activityStatus, - }; - } -} -_a = Serialize; -Serialize.isNamedVectors = (opts) => { - return ( - Array.isArray(opts === null || opts === void 0 ? void 0 : opts.includeVector) || - (opts === null || opts === void 0 ? void 0 : opts.targetVector) !== undefined - ); -}; -Serialize.isMultiTarget = (opts) => { - return ( - (opts === null || opts === void 0 ? void 0 : opts.targetVector) !== undefined && - !TargetVectorInputGuards.isSingle(opts.targetVector) - ); -}; -Serialize.isMultiWeightPerTarget = (opts) => { - return ( - (opts === null || opts === void 0 ? void 0 : opts.targetVector) !== undefined && - TargetVectorInputGuards.isMultiJoin(opts.targetVector) && - opts.targetVector.weights !== undefined && - Object.values(opts.targetVector.weights).some(ArrayInputGuards.is1DArray) - ); -}; -Serialize.isMultiVector = (vec) => { - return ( - vec !== undefined && - !Array.isArray(vec) && - Object.values(vec).some(ArrayInputGuards.is1DArray || ArrayInputGuards.is2DArray) - ); -}; -Serialize.isMultiVectorPerTarget = (vec) => { - return vec !== undefined && !Array.isArray(vec) && Object.values(vec).some(ArrayInputGuards.is2DArray); -}; -Serialize.common = (args) => { - const out = { - limit: args === null || args === void 0 ? void 0 : args.limit, - offset: args === null || args === void 0 ? void 0 : args.offset, - filters: (args === null || args === void 0 ? void 0 : args.filters) - ? Serialize.filtersGRPC(args.filters) - : undefined, - properties: - (args === null || args === void 0 ? void 0 : args.returnProperties) || - (args === null || args === void 0 ? void 0 : args.returnReferences) - ? Serialize.queryProperties(args.returnProperties, args.returnReferences) - : undefined, - metadata: Serialize.metadata( - args === null || args === void 0 ? void 0 : args.includeVector, - args === null || args === void 0 ? void 0 : args.returnMetadata - ), - }; - if (args === null || args === void 0 ? void 0 : args.rerank) { - out.rerank = Serialize.rerank(args.rerank); - } - return out; -}; -Serialize.fetchObjects = (args) => { - return Object.assign(Object.assign({}, Serialize.common(args)), { - after: args === null || args === void 0 ? void 0 : args.after, - sortBy: (args === null || args === void 0 ? void 0 : args.sort) - ? Serialize.sortBy(args.sort.sorts) - : undefined, - }); -}; -Serialize.fetchObjectById = (args) => { - return Object.assign( - {}, - Serialize.common({ - filters: new FilterId().equal(args.id), - includeVector: args.includeVector, - returnMetadata: ['creationTime', 'updateTime', 'isConsistent'], - returnProperties: args.returnProperties, - returnReferences: args.returnReferences, - }) - ); -}; -Serialize.bm25QueryProperties = (properties) => { - return properties === null || properties === void 0 - ? void 0 - : properties.map((property) => { - if (typeof property === 'string') { - return property; - } else { - return `${property.name}^${property.weight}`; - } - }); -}; -Serialize.bm25 = (args) => { - return Object.assign(Object.assign({}, Serialize.common(args)), { - bm25Search: BM25.fromPartial({ - query: args.query, - properties: _a.bm25QueryProperties(args.queryProperties), - }), - autocut: args.autoLimit, - }); -}; -Serialize.isHybridVectorSearch = (vector) => { - return ( - vector !== undefined && - !Serialize.isHybridNearTextSearch(vector) && - !Serialize.isHybridNearVectorSearch(vector) - ); -}; -Serialize.isHybridNearTextSearch = (vector) => { - return (vector === null || vector === void 0 ? void 0 : vector.query) !== undefined; -}; -Serialize.isHybridNearVectorSearch = (vector) => { - return (vector === null || vector === void 0 ? void 0 : vector.vector) !== undefined; -}; -Serialize.hybridVector = (args) => { - const vector = args.vector; - if (Serialize.isHybridVectorSearch(vector)) { - const { targets, targetVectors, vectorBytes, vectorPerTarget, vectorForTargets } = Serialize.vectors( - Object.assign(Object.assign({}, args), { argumentName: 'vector', vector: vector }) - ); - return vectorBytes !== undefined - ? { vectorBytes, targetVectors, targets } - : { - targetVectors, - targets, - nearVector: NearVector.fromPartial({ - vectorForTargets, - vectorPerTarget, - }), - }; - } else if (Serialize.isHybridNearTextSearch(vector)) { - const { targetVectors, targets } = Serialize.targetVector(args); - return { - targets, - targetVectors, - nearText: NearTextSearch.fromPartial({ - query: typeof vector.query === 'string' ? [vector.query] : vector.query, - certainty: vector.certainty, - distance: vector.distance, - moveAway: vector.moveAway ? NearTextSearch_Move.fromPartial(vector.moveAway) : undefined, - moveTo: vector.moveTo ? NearTextSearch_Move.fromPartial(vector.moveTo) : undefined, - }), - }; - } else if (Serialize.isHybridNearVectorSearch(vector)) { - const { targetVectors, targets, vectorBytes, vectorPerTarget, vectorForTargets } = Serialize.vectors( - Object.assign(Object.assign({}, args), { argumentName: 'vector', vector: vector.vector }) - ); - return { - targetVectors, - targets, - nearVector: NearVector.fromPartial({ - certainty: vector.certainty, - distance: vector.distance, - vectorBytes, - vectorPerTarget, - vectorForTargets, - }), - }; - } else { - const { targets, targetVectors } = Serialize.targetVector(args); - return { targets, targetVectors }; - } -}; -Serialize.hybrid = (args) => { - const fusionType = (fusionType) => { - switch (fusionType) { - case 'Ranked': - return Hybrid_FusionType.FUSION_TYPE_RANKED; - case 'RelativeScore': - return Hybrid_FusionType.FUSION_TYPE_RELATIVE_SCORE; - default: - return Hybrid_FusionType.FUSION_TYPE_UNSPECIFIED; - } - }; - const { targets, targetVectors, vectorBytes, nearText, nearVector } = Serialize.hybridVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - hybridSearch: Hybrid.fromPartial({ - query: args.query, - alpha: args.alpha ? args.alpha : 0.5, - properties: _a.bm25QueryProperties(args.queryProperties), - vectorBytes: vectorBytes, - fusionType: fusionType(args.fusionType), - targetVectors, - targets, - nearText, - nearVector, - }), - autocut: args.autoLimit, - }); -}; -Serialize.nearAudio = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearAudio: NearAudioSearch.fromPartial({ - audio: args.audio, - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - }), - autocut: args.autoLimit, - }); -}; -Serialize.nearDepth = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearDepth: NearDepthSearch.fromPartial({ - depth: args.depth, - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - }), - autocut: args.autoLimit, - }); -}; -Serialize.nearImage = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearImage: NearImageSearch.fromPartial({ - image: args.image, - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - }), - autocut: args.autoLimit, - }); -}; -Serialize.nearIMU = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearIMU: NearIMUSearch.fromPartial({ - imu: args.imu, - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - }), - autocut: args.autoLimit, - }); -}; -Serialize.nearObject = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearObject: NearObject.fromPartial({ - id: args.id, - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - }), - autocut: args.autoLimit, - }); -}; -Serialize.nearTextSearch = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return NearTextSearch.fromPartial({ - query: typeof args.query === 'string' ? [args.query] : args.query, - certainty: args.certainty, - distance: args.distance, - targets, - targetVectors, - moveAway: args.moveAway - ? NearTextSearch_Move.fromPartial({ - concepts: args.moveAway.concepts, - force: args.moveAway.force, - uuids: args.moveAway.objects, - }) - : undefined, - moveTo: args.moveTo - ? NearTextSearch_Move.fromPartial({ - concepts: args.moveTo.concepts, - force: args.moveTo.force, - uuids: args.moveTo.objects, - }) - : undefined, - }); -}; -Serialize.nearText = (args) => { - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearText: _a.nearTextSearch(args), - autocut: args.autoLimit, - }); -}; -Serialize.nearThermal = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearThermal: NearThermalSearch.fromPartial({ - thermal: args.thermal, - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - }), - autocut: args.autoLimit, - }); -}; -Serialize.vectorToBytes = (vector) => { - return new Uint8Array(new Float32Array(vector).buffer); -}; -Serialize.nearVectorSearch = (args) => { - const { targetVectors, targets, vectorBytes, vectorPerTarget, vectorForTargets } = Serialize.vectors( - Object.assign(Object.assign({}, args), { argumentName: 'nearVector' }) - ); - return NearVector.fromPartial({ - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - vectorPerTarget, - vectorBytes, - vectorForTargets, - }); -}; -Serialize.targetVector = (args) => { - if (args.targetVector === undefined) { - return {}; - } else if (TargetVectorInputGuards.isSingle(args.targetVector)) { - return args.supportsTargets - ? { - targets: Targets.fromPartial({ - targetVectors: [args.targetVector], - }), - } - : { targetVectors: [args.targetVector] }; - } else if (TargetVectorInputGuards.isMulti(args.targetVector)) { - return args.supportsTargets - ? { - targets: Targets.fromPartial({ - targetVectors: args.targetVector, - }), - } - : { targetVectors: args.targetVector }; - } else { - return { targets: Serialize.targets(args.targetVector, args.supportsWeightsForTargets) }; - } -}; -Serialize.vectors = (args) => { - const invalidVectorError = - new WeaviateInvalidInputError(`${args.argumentName} argument must be populated and: - - an array of numbers (number[]) - - an object with target names as keys and 1D and/or 2D arrays of numbers (number[] or number[][]) as values - received: ${args.vector} and ${args.targetVector}`); - if (args.vector === undefined) { - return Serialize.targetVector(args); - } - if (NearVectorInputGuards.isObject(args.vector)) { - if (Object.keys(args.vector).length === 0) { - throw invalidVectorError; - } - if (args.supportsVectorsForTargets) { - const vectorForTargets = Object.entries(args.vector) - .map(([target, vector]) => { - return { - target, - vector: vector, - }; - }) - .reduce((acc, { target, vector }) => { - return ArrayInputGuards.is2DArray(vector) - ? acc.concat(vector.map((v) => ({ name: target, vectorBytes: Serialize.vectorToBytes(v) }))) - : acc.concat([{ name: target, vectorBytes: Serialize.vectorToBytes(vector) }]); - }, []); - return args.targetVector !== undefined - ? Object.assign(Object.assign({}, Serialize.targetVector(args)), { vectorForTargets }) - : { - targetVectors: undefined, - targets: Targets.fromPartial({ - targetVectors: vectorForTargets.map((v) => v.name), - }), - vectorForTargets, - }; - } else { - const vectorPerTarget = {}; - Object.entries(args.vector).forEach(([k, v]) => { - if (ArrayInputGuards.is2DArray(v)) { - return; - } - vectorPerTarget[k] = Serialize.vectorToBytes(v); - }); - if (args.targetVector !== undefined) { - const { targets, targetVectors } = Serialize.targetVector(args); - return { - targetVectors, - targets, - vectorPerTarget, - }; - } else { - return args.supportsTargets - ? { - targets: Targets.fromPartial({ - targetVectors: Object.keys(vectorPerTarget), - }), - vectorPerTarget, - } - : { - targetVectors: Object.keys(vectorPerTarget), - vectorPerTarget, - }; - } - } - } else { - if (args.vector.length === 0) { - throw invalidVectorError; - } - if (NearVectorInputGuards.is1DArray(args.vector)) { - const { targetVectors, targets } = Serialize.targetVector(args); - const vectorBytes = Serialize.vectorToBytes(args.vector); - return { - targetVectors, - targets, - vectorBytes, - }; - } - throw invalidVectorError; - } -}; -Serialize.targets = (targets, supportsWeightsForTargets) => { - let combination; - switch (targets.combination) { - case 'sum': - combination = CombinationMethod.COMBINATION_METHOD_TYPE_SUM; - break; - case 'average': - combination = CombinationMethod.COMBINATION_METHOD_TYPE_AVERAGE; - break; - case 'minimum': - combination = CombinationMethod.COMBINATION_METHOD_TYPE_MIN; - break; - case 'relative-score': - combination = CombinationMethod.COMBINATION_METHOD_TYPE_RELATIVE_SCORE; - break; - case 'manual-weights': - combination = CombinationMethod.COMBINATION_METHOD_TYPE_MANUAL; - break; - default: - throw new Error('Invalid combination method'); - } - if (targets.weights !== undefined && supportsWeightsForTargets) { - const weightsForTargets = Object.entries(targets.weights) - .map(([target, weight]) => { - return { - target, - weight, - }; - }) - .reduce((acc, { target, weight }) => { - return Array.isArray(weight) - ? acc.concat(weight.map((w) => ({ target, weight: w }))) - : acc.concat([{ target, weight }]); - }, []); - return { - combination, - targetVectors: weightsForTargets.map((w) => w.target), - weights: {}, - weightsForTargets, - }; - } else if (targets.weights !== undefined && !supportsWeightsForTargets) { - if (Object.values(targets.weights).some((v) => Array.isArray(v))) { - throw new WeaviateUnsupportedFeatureError( - 'Multiple weights per target are not supported in this Weaviate version. Please upgrade to at least Weaviate 1.27.0.' - ); - } - return { - combination, - targetVectors: targets.targetVectors, - weights: targets.weights, - weightsForTargets: [], - }; - } else { - return { - combination, - targetVectors: targets.targetVectors, - weights: {}, - weightsForTargets: [], - }; - } -}; -Serialize.nearVector = (args) => { - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearVector: Serialize.nearVectorSearch(args), - autocut: args.autoLimit, - }); -}; -Serialize.nearVideo = (args) => { - const { targets, targetVectors } = Serialize.targetVector(args); - return Object.assign(Object.assign({}, Serialize.common(args)), { - nearVideo: NearVideoSearch.fromPartial({ - video: args.video, - certainty: args.certainty, - distance: args.distance, - targetVectors, - targets, - }), - autocut: args.autoLimit, - }); -}; -Serialize.filtersGRPC = (filters) => { - const resolveFilters = (filters) => { - var _b; - const out = []; - (_b = filters.filters) === null || _b === void 0 - ? void 0 - : _b.forEach((val) => out.push(Serialize.filtersGRPC(val))); - return out; - }; - const { value } = filters; - switch (filters.operator) { - case 'And': - return FiltersGRPC.fromPartial({ - operator: Filters_Operator.OPERATOR_AND, - filters: resolveFilters(filters), - }); - case 'Or': - return FiltersGRPC.fromPartial({ - operator: Filters_Operator.OPERATOR_OR, - filters: resolveFilters(filters), - }); - default: - return FiltersGRPC.fromPartial({ - operator: Serialize.operator(filters.operator), - target: filters.target, - valueText: _a.filtersGRPCValueText(value), - valueTextArray: _a.filtersGRPCValueTextArray(value), - valueInt: FilterGuards.isInt(value) ? value : undefined, - valueIntArray: FilterGuards.isIntArray(value) ? { values: value } : undefined, - valueNumber: FilterGuards.isFloat(value) ? value : undefined, - valueNumberArray: FilterGuards.isFloatArray(value) ? { values: value } : undefined, - valueBoolean: FilterGuards.isBoolean(value) ? value : undefined, - valueBooleanArray: FilterGuards.isBooleanArray(value) ? { values: value } : undefined, - valueGeo: FilterGuards.isGeoRange(value) ? value : undefined, - }); - } -}; -Serialize.filtersGRPCValueText = (value) => { - if (FilterGuards.isText(value)) { - return value; - } else if (FilterGuards.isDate(value)) { - return value.toISOString(); - } else { - return undefined; - } -}; -Serialize.filtersGRPCValueTextArray = (value) => { - if (FilterGuards.isTextArray(value)) { - return { values: value }; - } else if (FilterGuards.isDateArray(value)) { - return { values: value.map((v) => v.toISOString()) }; - } else { - return undefined; - } -}; -Serialize.filterTargetToREST = (target) => { - if (target.property) { - return [target.property]; - } else if (target.singleTarget) { - throw new WeaviateSerializationError( - 'Cannot use Filter.byRef() in the aggregate API currently. Instead use Filter.byRefMultiTarget() and specify the target collection explicitly.' - ); - } else if (target.multiTarget) { - if (target.multiTarget.target === undefined) { - throw new WeaviateSerializationError( - `target of multiTarget filter was unexpectedly undefined: ${target}` - ); - } - return [ - target.multiTarget.on, - target.multiTarget.targetCollection, - ...Serialize.filterTargetToREST(target.multiTarget.target), - ]; - } else if (target.count) { - return [target.count.on]; - } else { - return []; - } -}; -Serialize.filtersREST = (filters) => { - var _b; - const { value } = filters; - if (filters.operator === 'And' || filters.operator === 'Or') { - return { - operator: filters.operator, - operands: (_b = filters.filters) === null || _b === void 0 ? void 0 : _b.map(Serialize.filtersREST), - }; - } else { - if (filters.target === undefined) { - throw new WeaviateSerializationError(`target of filter was unexpectedly undefined: ${filters}`); - } - const out = { - path: Serialize.filterTargetToREST(filters.target), - operator: filters.operator, - }; - if (FilterGuards.isText(value)) { - return Object.assign(Object.assign({}, out), { valueText: value }); - } else if (FilterGuards.isTextArray(value)) { - return Object.assign(Object.assign({}, out), { valueTextArray: value }); - } else if (FilterGuards.isInt(value)) { - return Object.assign(Object.assign({}, out), { valueInt: value }); - } else if (FilterGuards.isIntArray(value)) { - return Object.assign(Object.assign({}, out), { valueIntArray: value }); - } else if (FilterGuards.isBoolean(value)) { - return Object.assign(Object.assign({}, out), { valueBoolean: value }); - } else if (FilterGuards.isBooleanArray(value)) { - return Object.assign(Object.assign({}, out), { valueBooleanArray: value }); - } else if (FilterGuards.isFloat(value)) { - return Object.assign(Object.assign({}, out), { valueNumber: value }); - } else if (FilterGuards.isFloatArray(value)) { - return Object.assign(Object.assign({}, out), { valueNumberArray: value }); - } else if (FilterGuards.isDate(value)) { - return Object.assign(Object.assign({}, out), { valueDate: value.toISOString() }); - } else if (FilterGuards.isDateArray(value)) { - return Object.assign(Object.assign({}, out), { valueDateArray: value.map((v) => v.toISOString()) }); - } else if (FilterGuards.isGeoRange(value)) { - return Object.assign(Object.assign({}, out), { - valueGeoRange: { - geoCoordinates: { - latitude: value.latitude, - longitude: value.longitude, - }, - distance: { - max: value.distance, - }, - }, - }); - } else { - throw new WeaviateInvalidInputError('Invalid filter value type'); - } - } -}; -Serialize.operator = (operator) => { - switch (operator) { - case 'Equal': - return Filters_Operator.OPERATOR_EQUAL; - case 'NotEqual': - return Filters_Operator.OPERATOR_NOT_EQUAL; - case 'ContainsAny': - return Filters_Operator.OPERATOR_CONTAINS_ANY; - case 'ContainsAll': - return Filters_Operator.OPERATOR_CONTAINS_ALL; - case 'GreaterThan': - return Filters_Operator.OPERATOR_GREATER_THAN; - case 'GreaterThanEqual': - return Filters_Operator.OPERATOR_GREATER_THAN_EQUAL; - case 'LessThan': - return Filters_Operator.OPERATOR_LESS_THAN; - case 'LessThanEqual': - return Filters_Operator.OPERATOR_LESS_THAN_EQUAL; - case 'Like': - return Filters_Operator.OPERATOR_LIKE; - case 'WithinGeoRange': - return Filters_Operator.OPERATOR_WITHIN_GEO_RANGE; - case 'IsNull': - return Filters_Operator.OPERATOR_IS_NULL; - default: - return Filters_Operator.OPERATOR_UNSPECIFIED; - } -}; -Serialize.queryProperties = (properties, references) => { - const nonRefProperties = - properties === null || properties === void 0 - ? void 0 - : properties.filter((property) => typeof property === 'string'); - const refProperties = references; - const objectProperties = - properties === null || properties === void 0 - ? void 0 - : properties.filter((property) => typeof property === 'object'); - const resolveObjectProperty = (property) => { - const objProps = property.properties.filter((property) => typeof property !== 'string'); // cannot get types to work currently :( - return { - propName: property.name, - primitiveProperties: property.properties.filter((property) => typeof property === 'string'), - objectProperties: objProps.map(resolveObjectProperty), - }; - }; - return { - nonRefProperties: nonRefProperties === undefined ? [] : nonRefProperties, - returnAllNonrefProperties: nonRefProperties === undefined, - refProperties: refProperties - ? refProperties.map((property) => { - return { - referenceProperty: property.linkOn, - properties: Serialize.queryProperties(property.returnProperties), - metadata: Serialize.metadata(property.includeVector, property.returnMetadata), - targetCollection: property.targetCollection ? property.targetCollection : '', - }; - }) - : [], - objectProperties: objectProperties - ? objectProperties.map((property) => { - const objProps = property.properties.filter((property) => typeof property !== 'string'); // cannot get types to work currently :( - return { - propName: property.name, - primitiveProperties: property.properties.filter((property) => typeof property === 'string'), - objectProperties: objProps.map(resolveObjectProperty), - }; - }) - : [], - }; -}; -Serialize.metadata = (includeVector, metadata) => { - const out = { - uuid: true, - vector: typeof includeVector === 'boolean' ? includeVector : false, - vectors: Array.isArray(includeVector) ? includeVector : [], - }; - if (MetadataGuards.isAll(metadata)) { - return Object.assign(Object.assign({}, out), { - creationTimeUnix: true, - lastUpdateTimeUnix: true, - distance: true, - certainty: true, - score: true, - explainScore: true, - isConsistent: true, - }); - } - metadata === null || metadata === void 0 - ? void 0 - : metadata.forEach((key) => { - let weaviateKey; - if (key === 'creationTime') { - weaviateKey = 'creationTimeUnix'; - } else if (key === 'updateTime') { - weaviateKey = 'lastUpdateTimeUnix'; - } else { - weaviateKey = key; - } - out[weaviateKey] = true; - }); - return MetadataRequest.fromPartial(out); -}; -Serialize.sortBy = (sort) => { - return sort.map((sort) => { - return { - ascending: !!sort.ascending, - path: [sort.property], - }; - }); -}; -Serialize.rerank = (rerank) => { - return Rerank.fromPartial({ - property: rerank.property, - query: rerank.query, - }); -}; -Serialize.generative = (generative) => { - return GenerativeSearch.fromPartial({ - singleResponsePrompt: generative === null || generative === void 0 ? void 0 : generative.singlePrompt, - groupedResponseTask: generative === null || generative === void 0 ? void 0 : generative.groupedTask, - groupedProperties: generative === null || generative === void 0 ? void 0 : generative.groupedProperties, - }); -}; -Serialize.groupBy = (groupBy) => { - return GroupBy.fromPartial({ - path: (groupBy === null || groupBy === void 0 ? void 0 : groupBy.property) - ? [groupBy.property] - : undefined, - numberOfGroups: groupBy === null || groupBy === void 0 ? void 0 : groupBy.numberOfGroups, - objectsPerGroup: groupBy === null || groupBy === void 0 ? void 0 : groupBy.objectsPerGroup, - }); -}; -Serialize.isGroupBy = (args) => { - if (args === undefined) return false; - return args.groupBy !== undefined; -}; -Serialize.restProperties = (properties, references) => { - const parsedProperties = {}; - Object.keys(properties).forEach((key) => { - const value = properties[key]; - if (DataGuards.isDate(value)) { - parsedProperties[key] = value.toISOString(); - } else if (DataGuards.isDateArray(value)) { - parsedProperties[key] = value.map((v) => v.toISOString()); - } else if (DataGuards.isPhoneNumber(value)) { - parsedProperties[key] = { - input: value.number, - defaultCountry: value.defaultCountry, - }; - } else if (DataGuards.isNestedArray(value)) { - parsedProperties[key] = value.map((v) => Serialize.restProperties(v)); - } else if (DataGuards.isNested(value)) { - parsedProperties[key] = Serialize.restProperties(value); - } else { - parsedProperties[key] = value; - } - }); - if (!references) return parsedProperties; - for (const [key, value] of Object.entries(references)) { - if (ReferenceGuards.isReferenceManager(value)) { - parsedProperties[key] = value.toBeaconObjs(); - } else if (ReferenceGuards.isUuid(value)) { - parsedProperties[key] = [uuidToBeacon(value)]; - } else if (ReferenceGuards.isMultiTarget(value)) { - parsedProperties[key] = - typeof value.uuids === 'string' - ? [uuidToBeacon(value.uuids, value.targetCollection)] - : value.uuids.map((uuid) => uuidToBeacon(uuid, value.targetCollection)); - } else { - let out = []; - value.forEach((v) => { - if (ReferenceGuards.isReferenceManager(v)) { - out = out.concat(v.toBeaconObjs()); - } else if (ReferenceGuards.isUuid(v)) { - out.push(uuidToBeacon(v)); - } else { - out = out.concat( - (ReferenceGuards.isUuid(v.uuids) ? [v.uuids] : v.uuids).map((uuid) => - uuidToBeacon(uuid, v.targetCollection) - ) - ); - } - }); - parsedProperties[key] = out; - } - } - return parsedProperties; -}; -Serialize.batchProperties = (properties, references) => { - const multiTarget = []; - const singleTarget = []; - const nonRefProperties = {}; - const emptyArray = []; - const boolArray = []; - const textArray = []; - const intArray = []; - const floatArray = []; - const objectProperties = []; - const objectArrayProperties = []; - const resolveProps = (key, value) => { - if (DataGuards.isEmptyArray(value)) { - emptyArray.push(key); - } else if (DataGuards.isBooleanArray(value)) { - boolArray.push({ - propName: key, - values: value, - }); - } else if (DataGuards.isDateArray(value)) { - textArray.push({ - propName: key, - values: value.map((v) => v.toISOString()), - }); - } else if (DataGuards.isTextArray(value)) { - textArray.push({ - propName: key, - values: value, - }); - } else if (DataGuards.isIntArray(value)) { - intArray.push({ - propName: key, - values: value, - }); - } else if (DataGuards.isFloatArray(value)) { - floatArray.push({ - propName: key, - values: [], - valuesBytes: new Uint8Array(new Float64Array(value).buffer), // is double in proto => f64 in go - }); - } else if (DataGuards.isDate(value)) { - nonRefProperties[key] = value.toISOString(); - } else if (DataGuards.isPhoneNumber(value)) { - nonRefProperties[key] = { - input: value.number, - defaultCountry: value.defaultCountry, - }; - } else if (DataGuards.isGeoCoordinate(value)) { - nonRefProperties[key] = value; - } else if (DataGuards.isNestedArray(value)) { - objectArrayProperties.push({ - propName: key, - values: value.map((v) => ObjectPropertiesValue.fromPartial(Serialize.batchProperties(v))), - }); - } else if (DataGuards.isNested(value)) { - const parsed = Serialize.batchProperties(value); - objectProperties.push({ - propName: key, - value: ObjectPropertiesValue.fromPartial(parsed), - }); - } else { - nonRefProperties[key] = value; - } - }; - const resolveRefs = (key, value) => { - if (ReferenceGuards.isReferenceManager(value)) { - if (value.isMultiTarget()) { - multiTarget.push({ - propName: key, - targetCollection: value.targetCollection, - uuids: value.toBeaconStrings(), - }); - } else { - singleTarget.push({ - propName: key, - uuids: value.toBeaconStrings(), - }); - } - } else if (ReferenceGuards.isUuid(value)) { - singleTarget.push({ - propName: key, - uuids: [value], - }); - } else if (ReferenceGuards.isMultiTarget(value)) { - multiTarget.push({ - propName: key, - targetCollection: value.targetCollection, - uuids: typeof value.uuids === 'string' ? [value.uuids] : value.uuids, - }); - } else { - value.forEach((v) => resolveRefs(key, v)); - } - }; - if (properties) { - Object.entries(properties).forEach(([key, value]) => resolveProps(key, value)); - } - if (references) { - Object.entries(references).forEach(([key, value]) => resolveRefs(key, value)); - } - return { - nonRefProperties: nonRefProperties, - multiTargetRefProps: multiTarget, - singleTargetRefProps: singleTarget, - textArrayProperties: textArray, - intArrayProperties: intArray, - numberArrayProperties: floatArray, - booleanArrayProperties: boolArray, - objectProperties: objectProperties, - objectArrayProperties: objectArrayProperties, - emptyListProps: emptyArray, - }; -}; -Serialize.batchObjects = (collection, objects, usesNamedVectors, tenant) => { - const objs = []; - const batch = []; - const iterate = (index) => { - // This allows the potentially CPU-intensive work to be done in chunks - // releasing control to the event loop after every object so that other - // events can be processed without blocking completely. - if (index < objects.length) { - setTimeout(() => iterate(index + 1)); - } else { - return; - } - const object = objects[index]; - const obj = DataGuards.isDataObject(object) - ? object - : { id: undefined, properties: object, references: undefined, vectors: undefined }; - let vectorBytes; - let vectors; - if (obj.vectors !== undefined && !Array.isArray(obj.vectors)) { - vectors = Object.entries(obj.vectors).map(([k, v]) => - VectorsGrpc.fromPartial({ - vectorBytes: Serialize.vectorToBytes(v), - name: k, - }) - ); - } else if (Array.isArray(obj.vectors) && usesNamedVectors) { - vectors = [ - VectorsGrpc.fromPartial({ - vectorBytes: Serialize.vectorToBytes(obj.vectors), - name: 'default', - }), - ]; - vectorBytes = Serialize.vectorToBytes(obj.vectors); - // required in case collection was made with <1.24.0 and has since been migrated to >=1.24.0 - } else if (obj.vectors !== undefined) { - vectorBytes = Serialize.vectorToBytes(obj.vectors); - } - objs.push( - BatchObjectGRPC.fromPartial({ - collection: collection, - properties: Serialize.batchProperties(obj.properties, obj.references), - tenant: tenant, - uuid: obj.id ? obj.id : uuidv4(), - vectorBytes, - vectors, - }) - ); - batch.push(Object.assign(Object.assign({}, obj), { collection: collection, tenant: tenant })); - }; - const waitFor = () => { - const poll = (resolve) => { - if (objs.length < objects.length) { - setTimeout(() => poll(resolve), 500); - } else { - resolve(null); - } - }; - return new Promise(poll); - }; - iterate(0); - return waitFor().then(() => { - return { batch: batch, mapped: objs }; - }); -}; diff --git a/dist/node/esm/collections/sort/classes.d.ts b/dist/node/esm/collections/sort/classes.d.ts deleted file mode 100644 index 3a1eb4ed..00000000 --- a/dist/node/esm/collections/sort/classes.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { SortBy } from '../types/index.js'; -import { NonRefKeys } from '../types/internal.js'; -export declare class Sorting { - sorts: SortBy[]; - constructor(); - /** Sort by the objects' property. */ - byProperty>(property: K, ascending?: boolean): this; - /** Sort by the objects' ID. */ - byId(ascending?: boolean): this; - /** Sort by the objects' creation time. */ - byCreationTime(ascending?: boolean): this; - /** Sort by the objects' last update time. */ - byUpdateTime(ascending?: boolean): this; -} diff --git a/dist/node/esm/collections/sort/classes.js b/dist/node/esm/collections/sort/classes.js deleted file mode 100644 index b45db714..00000000 --- a/dist/node/esm/collections/sort/classes.js +++ /dev/null @@ -1,25 +0,0 @@ -export class Sorting { - constructor() { - this.sorts = []; - } - /** Sort by the objects' property. */ - byProperty(property, ascending = true) { - this.sorts.push({ property, ascending }); - return this; - } - /** Sort by the objects' ID. */ - byId(ascending = true) { - this.sorts.push({ property: '_id', ascending }); - return this; - } - /** Sort by the objects' creation time. */ - byCreationTime(ascending = true) { - this.sorts.push({ property: '_creationTimeUnix', ascending }); - return this; - } - /** Sort by the objects' last update time. */ - byUpdateTime(ascending = true) { - this.sorts.push({ property: '_lastUpdateTimeUnix', ascending }); - return this; - } -} diff --git a/dist/node/esm/collections/sort/index.d.ts b/dist/node/esm/collections/sort/index.d.ts deleted file mode 100644 index bf33457c..00000000 --- a/dist/node/esm/collections/sort/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export type { Sort } from './types.js'; -export { Sorting }; -import { Sorting } from './classes.js'; -import { Sort } from './types.js'; -declare const sort: () => Sort; -export default sort; diff --git a/dist/node/esm/collections/sort/index.js b/dist/node/esm/collections/sort/index.js deleted file mode 100644 index f45cf53b..00000000 --- a/dist/node/esm/collections/sort/index.js +++ /dev/null @@ -1,19 +0,0 @@ -import { Sorting } from './classes.js'; -const sort = () => { - return { - byProperty(property, ascending = true) { - return new Sorting().byProperty(property, ascending); - }, - byId(ascending = true) { - return new Sorting().byId(ascending); - }, - byCreationTime(ascending = true) { - return new Sorting().byCreationTime(ascending); - }, - byUpdateTime(ascending = true) { - return new Sorting().byUpdateTime(ascending); - }, - }; -}; -export default sort; -export { Sorting }; diff --git a/dist/node/esm/collections/sort/types.d.ts b/dist/node/esm/collections/sort/types.d.ts deleted file mode 100644 index 26c7b1ca..00000000 --- a/dist/node/esm/collections/sort/types.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { NonRefKeys } from '../types/internal.js'; -import { Sorting } from './classes.js'; -/** - * Define how the query's sort operation should be performed using the available methods. - */ -export interface Sort { - /** Sort by an object property. */ - byProperty>(property: K, ascending?: boolean): Sorting; - /** Sort by the objects' ID. */ - byId(ascending?: boolean): Sorting; - /** Sort by the objects' creation time. */ - byCreationTime(ascending?: boolean): Sorting; - /** Sort by the objects' last update time. */ - byUpdateTime(ascending?: boolean): Sorting; -} diff --git a/dist/node/esm/collections/sort/types.js b/dist/node/esm/collections/sort/types.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/sort/types.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/tenants/index.d.ts b/dist/node/esm/collections/tenants/index.d.ts deleted file mode 100644 index c0a343fe..00000000 --- a/dist/node/esm/collections/tenants/index.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { ConnectionGRPC } from '../../connection/index.js'; -import { DbVersionSupport } from '../../utils/dbVersion.js'; -import { Tenant, TenantBC, TenantBase, TenantCreate, TenantUpdate } from './types.js'; -declare const tenants: ( - connection: ConnectionGRPC, - collection: string, - dbVersionSupport: DbVersionSupport -) => Tenants; -export default tenants; -export { Tenant, TenantBase, TenantCreate, TenantUpdate }; -/** - * Represents all the CRUD methods available on a collection's multi-tenancy specification within Weaviate. - - * The collection must have been created with multi-tenancy enabled in order to use any of these methods. This class - * should not be instantiated directly, but is available as a property of the `Collection` class under - * the `collection.tenants` class attribute. - * - * Starting from Weaviate v1.26, the naming convention around tenant activitiy statuses is changing. - * The changing nomenclature is as follows: - * - `HOT` is now `ACTIVE`, which means loaded fully into memory and ready for use. - * - `COLD` is now `INACTIVE`, which means not loaded into memory with files stored on disk. - * - * With this change, new statuses are being added. One is mutable and the other two are immutable. They are: - * - `OFFLOADED`, which means the tenant is not loaded into memory with files stored on the cloud. - * - `OFFLOADING`, which means the tenant is transitioning to the `OFFLOADED` status. - * - `ONLOADING`, which means the tenant is transitioning from the `OFFLOADED` status. - */ -export interface Tenants { - /** - * Create the specified tenants for a collection in Weaviate. - * The collection must have been created with multi-tenancy enabled. - * - * For details on the new activity statuses, see the docstring for the `Tenants` interface type. - * - * @param {TenantCreate | TenantCreate[]} tenants The tenant or tenants to create. - * @returns {Promise} The created tenant(s) as a list of Tenant. - */ - create: (tenants: TenantBC | TenantCreate | (TenantBC | TenantCreate)[]) => Promise; - /** - * Return all tenants currently associated with a collection in Weaviate. - * The collection must have been created with multi-tenancy enabled. - * - * For details on the new activity statuses, see the docstring for the `Tenants` interface type. - * - * @returns {Promise>} A list of tenants as an object of Tenant types, where the key is the tenant name. - */ - get: () => Promise>; - /** - * Return the specified tenants from a collection in Weaviate. - * The collection must have been created with multi-tenancy enabled. - * - * For details on the new activity statuses, see the docstring for the `Tenants` interface type. - * - * @typedef {TenantBase} T A type that extends TenantBase. - * @param {(string | T)[]} names The tenants to retrieve. - * @returns {Promise} The list of tenants. If the tenant does not exist, it will not be included in the list. - */ - getByNames: (names: (string | T)[]) => Promise>; - /** - * Return the specified tenant from a collection in Weaviate. - * The collection must have been created with multi-tenancy enabled. - * - * For details on the new activity statuses, see the docstring for the `Tenants` interface type. - * - * @typedef {TenantBase} T A type that extends TenantBase. - * @param {string | T} name The name of the tenant to retrieve. - * @returns {Promise} The tenant as a Tenant type, or null if the tenant does not exist. - */ - getByName: (name: string | T) => Promise; - /** - * Remove the specified tenants from a collection in Weaviate. - * The collection must have been created with multi-tenancy enabled. - * - * For details on the new activity statuses, see the docstring for the `Tenants` interface type. - * - * @typedef {TenantBase} T A type that extends TenantBase. - * @param {Tenant | Tenant[]} tenants The tenant or tenants to remove. - * @returns {Promise} An empty promise. - */ - remove: (tenants: string | T | (string | T)[]) => Promise; - /** - * Update the specified tenants for a collection in Weaviate. - * The collection must have been created with multi-tenancy enabled. - * - * For details on the new activity statuses, see the docstring for the `Tenants` interface type. - * - * @param {TenantInput | TenantInput[]} tenants The tenant or tenants to update. - * @returns {Promise} The updated tenant(s) as a list of Tenant. - */ - update: (tenants: TenantBC | TenantUpdate | (TenantBC | TenantUpdate)[]) => Promise; -} diff --git a/dist/node/esm/collections/tenants/index.js b/dist/node/esm/collections/tenants/index.js deleted file mode 100644 index c4b6b2b4..00000000 --- a/dist/node/esm/collections/tenants/index.js +++ /dev/null @@ -1,154 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -var __asyncValues = - (this && this.__asyncValues) || - function (o) { - if (!Symbol.asyncIterator) throw new TypeError('Symbol.asyncIterator is not defined.'); - var m = o[Symbol.asyncIterator], - i; - return m - ? m.call(o) - : ((o = typeof __values === 'function' ? __values(o) : o[Symbol.iterator]()), - (i = {}), - verb('next'), - verb('throw'), - verb('return'), - (i[Symbol.asyncIterator] = function () { - return this; - }), - i); - function verb(n) { - i[n] = - o[n] && - function (v) { - return new Promise(function (resolve, reject) { - (v = o[n](v)), settle(resolve, reject, v.done, v.value); - }); - }; - } - function settle(resolve, reject, d, v) { - Promise.resolve(v).then(function (v) { - resolve({ value: v, done: d }); - }, reject); - } - }; -import { WeaviateUnsupportedFeatureError } from '../../errors.js'; -import { TenantsCreator, TenantsDeleter, TenantsGetter, TenantsUpdater } from '../../schema/index.js'; -import { Deserialize } from '../deserialize/index.js'; -import { Serialize } from '../serialize/index.js'; -const checkSupportForGRPCTenantsGetEndpoint = (dbVersionSupport) => - __awaiter(void 0, void 0, void 0, function* () { - const check = yield dbVersionSupport.supportsTenantsGetGRPCMethod(); - if (!check.supports) throw new WeaviateUnsupportedFeatureError(check.message); - }); -const parseValueOrValueArray = (value) => (Array.isArray(value) ? value : [value]); -const parseStringOrTenant = (tenant) => (typeof tenant === 'string' ? tenant : tenant.name); -const parseTenantREST = (tenant) => { - return { - name: tenant.name, - activityStatus: Deserialize.activityStatusREST(tenant.activityStatus), - }; -}; -const tenants = (connection, collection, dbVersionSupport) => { - const getGRPC = (names) => - checkSupportForGRPCTenantsGetEndpoint(dbVersionSupport) - .then(() => connection.tenants(collection)) - .then((builder) => builder.withGet({ names })) - .then(Deserialize.tenantsGet); - const getREST = () => - new TenantsGetter(connection, collection).do().then((tenants) => { - const result = {}; - tenants.forEach((tenant) => { - if (!tenant.name) return; - result[tenant.name] = parseTenantREST(tenant); - }); - return result; - }); - return { - create: (tenants) => - new TenantsCreator(connection, collection, parseValueOrValueArray(tenants).map(Serialize.tenantCreate)) - .do() - .then((res) => res.map(parseTenantREST)), - get: function () { - return __awaiter(this, void 0, void 0, function* () { - const check = yield dbVersionSupport.supportsTenantsGetGRPCMethod(); - return check.supports ? getGRPC() : getREST(); - }); - }, - getByNames: (tenants) => getGRPC(tenants.map(parseStringOrTenant)), - getByName: (tenant) => { - const tenantName = parseStringOrTenant(tenant); - return getGRPC([tenantName]).then((tenants) => tenants[tenantName] || null); - }, - remove: (tenants) => - new TenantsDeleter( - connection, - collection, - parseValueOrValueArray(tenants).map(parseStringOrTenant) - ).do(), - update: (tenants) => - __awaiter(void 0, void 0, void 0, function* () { - var _a, e_1, _b, _c; - const out = []; - try { - for ( - var _d = true, - _e = __asyncValues( - Serialize.tenants(parseValueOrValueArray(tenants), Serialize.tenantUpdate).map((tenants) => - new TenantsUpdater(connection, collection, tenants) - .do() - .then((res) => res.map(parseTenantREST)) - ) - ), - _f; - (_f = yield _e.next()), (_a = _f.done), !_a; - _d = true - ) { - _c = _f.value; - _d = false; - const res = _c; - out.push(...res); - } - } catch (e_1_1) { - e_1 = { error: e_1_1 }; - } finally { - try { - if (!_d && !_a && (_b = _e.return)) yield _b.call(_e); - } finally { - if (e_1) throw e_1.error; - } - } - return out; - }), - }; -}; -export default tenants; diff --git a/dist/node/esm/collections/tenants/types.d.ts b/dist/node/esm/collections/tenants/types.d.ts deleted file mode 100644 index ad8c7da7..00000000 --- a/dist/node/esm/collections/tenants/types.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** The base type for a tenant. Only the name is required. */ -export type TenantBase = { - /** The name of the tenant. */ - name: string; -}; -/** The expected type when creating a tenant. */ -export type TenantCreate = TenantBase & { - /** The activity status of the tenant. Defaults to 'ACTIVE' if not provided. */ - activityStatus?: 'ACTIVE' | 'INACTIVE'; -}; -/** The expected type when updating a tenant. */ -export type TenantUpdate = TenantBase & { - /** The activity status of the tenant. Must be set to one of the options. */ - activityStatus: 'ACTIVE' | 'INACTIVE' | 'OFFLOADED'; -}; -/** The expected type when getting tenants. */ -export type TenantsGetOptions = { - tenants?: string; -}; -/** - * The expected type returned by all tenant methods. - */ -export type Tenant = TenantBase & { - /** There are two statuses that are immutable: `OFFLOADED` and `ONLOADING, which are set by the server: - * - `ONLOADING`, which means the tenant is transitioning from the `OFFLOADED` status to `ACTIVE/INACTIVE`. - * - `OFFLOADING`, which means the tenant is transitioning from `ACTIVE/INACTIVE` to the `OFFLOADED` status. - * The other three statuses are mutable within the `.create` and `.update`, methods: - * - `ACTIVE`, which means loaded fully into memory and ready for use. - * - `INACTIVE`, which means not loaded into memory with files stored on disk. - * - `OFFLOADED`, which means not loaded into memory with files stored on the cloud. - */ - activityStatus: 'ACTIVE' | 'INACTIVE' | 'OFFLOADED' | 'OFFLOADING' | 'ONLOADING'; -}; -/** This is the type of the Tenant as defined in Weaviate's OpenAPI schema. It is included here for Backwards Compatibility. */ -export type TenantBC = TenantBase & { - activityStatus?: 'HOT' | 'COLD' | 'FROZEN'; -}; diff --git a/dist/node/esm/collections/tenants/types.js b/dist/node/esm/collections/tenants/types.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/tenants/types.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/types/batch.d.ts b/dist/node/esm/collections/types/batch.d.ts deleted file mode 100644 index a3a9194c..00000000 --- a/dist/node/esm/collections/types/batch.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { BatchReference } from '../../openapi/types.js'; -import { BatchObject as BatchObjectGRPC } from '../../proto/v1/batch.js'; -import { NonReferenceInputs, ReferenceInputs, Vectors } from '../index.js'; -export type BatchObjectsReturn = { - allResponses: (string | ErrorObject)[]; - elapsedSeconds: number; - errors: Record>; - hasErrors: boolean; - uuids: Record; -}; -export type ErrorObject = { - code?: number; - message: string; - object: BatchObject; - originalUuid?: string; -}; -export type BatchObject = { - collection: string; - properties?: NonReferenceInputs; - references?: ReferenceInputs; - id?: string; - vectors?: number[] | Vectors; - tenant?: string; -}; -export type BatchObjects = { - batch: BatchObject[]; - mapped: BatchObjectGRPC[]; -}; -export type ErrorReference = { - message: string; - reference: BatchReference; -}; -export type BatchReferencesReturn = { - elapsedSeconds: number; - errors: Record; - hasErrors: boolean; -}; diff --git a/dist/node/esm/collections/types/batch.js b/dist/node/esm/collections/types/batch.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/types/batch.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/types/data.d.ts b/dist/node/esm/collections/types/data.d.ts deleted file mode 100644 index 81bdaf06..00000000 --- a/dist/node/esm/collections/types/data.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { NonReferenceInputs, ReferenceInputs } from './internal.js'; -import { Vectors } from './query.js'; -export type DataObject = { - id?: string; - properties?: NonReferenceInputs; - references?: ReferenceInputs; - vectors?: number[] | Vectors; -}; -export type DeleteManyObject = { - id: string; - successful: boolean; - error?: string; -}; -export type DeleteManyReturn = { - failed: number; - matches: number; - objects: V extends true ? DeleteManyObject[] : undefined; - successful: number; -}; -export type ReferenceToMultiTarget = { - targetCollection: string; - uuids: string | string[]; -}; diff --git a/dist/node/esm/collections/types/data.js b/dist/node/esm/collections/types/data.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/types/data.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/types/generate.d.ts b/dist/node/esm/collections/types/generate.d.ts deleted file mode 100644 index 2a3dec01..00000000 --- a/dist/node/esm/collections/types/generate.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { GroupByObject, GroupByResult, WeaviateGenericObject, WeaviateNonGenericObject } from './query.js'; -export type GenerativeGenericObject = WeaviateGenericObject & { - /** The LLM-generated output applicable to this single object. */ - generated?: string; -}; -export type GenerativeNonGenericObject = WeaviateNonGenericObject & { - /** The LLM-generated output applicable to this single object. */ - generated?: string; -}; -/** An object belonging to a collection as returned by the methods in the `collection.generate` namespace. - * - * Depending on the generic type `T`, the object will have subfields that map from `T`'s specific type definition. - * If not, then the object will be non-generic and have a `properties` field that maps from a generic string to a `WeaviateField`. - */ -export type GenerativeObject = T extends undefined - ? GenerativeNonGenericObject - : GenerativeGenericObject; -/** The return of a query method in the `collection.generate` namespace. */ -export type GenerativeReturn = { - /** The objects that were found by the query. */ - objects: GenerativeObject[]; - /** The LLM-generated output applicable to this query as a whole. */ - generated?: string; -}; -export type GenerativeGroupByResult = GroupByResult & { - generated?: string; -}; -/** The return of a query method in the `collection.generate` namespace where the `groupBy` argument was specified. */ -export type GenerativeGroupByReturn = { - /** The objects that were found by the query. */ - objects: GroupByObject[]; - /** The groups that were created by the query. */ - groups: Record>; - /** The LLM-generated output applicable to this query as a whole. */ - generated?: string; -}; -/** Options available when defining queries using methods in the `collection.generate` namespace. */ -export type GenerateOptions = { - /** The prompt to use when generating content relevant to each object of the collection individually. */ - singlePrompt?: string; - /** The prompt to use when generating content relevant to objects returned by the query as a whole. */ - groupedTask?: string; - /** The properties to use as context to be injected into the `groupedTask` prompt when performing the grouped generation. */ - groupedProperties?: T extends undefined ? string[] : (keyof T)[]; -}; -export type GenerateReturn = Promise> | Promise>; diff --git a/dist/node/esm/collections/types/generate.js b/dist/node/esm/collections/types/generate.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/types/generate.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/types/index.d.ts b/dist/node/esm/collections/types/index.d.ts deleted file mode 100644 index 82993e23..00000000 --- a/dist/node/esm/collections/types/index.d.ts +++ /dev/null @@ -1,84 +0,0 @@ -export * from '../config/types/index.js'; -export * from '../configure/types/index.js'; -export type { CollectionConfigCreate } from '../index.js'; -export * from './batch.js'; -export * from './data.js'; -export * from './generate.js'; -export type { - IsEmptyType, - IsNestedField, - IsPrimitiveField, - IsWeaviateField, - NestedKeys, - NonRefKeys, - NonReferenceInputs, - PrimitiveKeys, - QueryNested, - QueryProperty, - QueryReference, - RefKeys, - ReferenceInput, - ReferenceInputs, -} from './internal.js'; -export * from './query.js'; -import { - GeoCoordinate as GeoCoordinateGRPC, - PhoneNumber as PhoneNumberGRPC, -} from '../../proto/v1/properties.js'; -import { CrossReference } from '../references/index.js'; -export type DataType = T extends infer U | undefined - ? U extends string - ? 'text' | 'uuid' | 'blob' - : U extends number - ? 'number' | 'int' - : U extends boolean - ? 'boolean' - : U extends Date - ? 'date' - : U extends string[] - ? 'text[]' | 'uuid[]' - : U extends number[] - ? 'number[]' | 'int[]' - : U extends boolean[] - ? 'boolean[]' - : U extends Date[] - ? 'date[]' - : U extends GeoCoordinate - ? 'geoCoordinates' - : U extends PhoneNumber - ? 'phoneNumber' - : U extends object[] - ? 'object[]' - : U extends object - ? 'object' - : never - : never; -export type GeoCoordinate = Required; -export type PhoneNumber = Required; -export type PrimitiveField = - | string - | string[] - | boolean - | boolean[] - | number - | number[] - | Date - | Date[] - | Blob - | GeoCoordinate - | PhoneNumber - | PhoneNumberInput - | null; -export type NestedField = NestedProperties | NestedProperties[]; -export type WeaviateField = PrimitiveField | NestedField; -export type Property = WeaviateField | CrossReference | undefined; -export interface Properties { - [k: string]: Property; -} -export interface NestedProperties { - [k: string]: WeaviateField; -} -export type PhoneNumberInput = { - number: string; - defaultCountry?: string; -}; diff --git a/dist/node/esm/collections/types/index.js b/dist/node/esm/collections/types/index.js deleted file mode 100644 index bbf6db2e..00000000 --- a/dist/node/esm/collections/types/index.js +++ /dev/null @@ -1,6 +0,0 @@ -export * from '../config/types/index.js'; -export * from '../configure/types/index.js'; -export * from './batch.js'; -export * from './data.js'; -export * from './generate.js'; -export * from './query.js'; diff --git a/dist/node/esm/collections/types/internal.d.ts b/dist/node/esm/collections/types/internal.d.ts deleted file mode 100644 index a5b1d189..00000000 --- a/dist/node/esm/collections/types/internal.d.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { - NestedProperties, - PhoneNumber, - PhoneNumberInput, - PrimitiveField, - RefProperty, - RefPropertyDefault, - ReferenceToMultiTarget, - WeaviateField, -} from '../index.js'; -import { ReferenceManager } from '../references/classes.js'; -import { CrossReference } from '../references/index.js'; -export type ExtractCrossReferenceType = T extends CrossReference ? U : never; -type ExtractNestedType = T extends (infer U)[] - ? U extends NestedProperties - ? U - : never - : T extends NestedProperties - ? T - : never; -export type QueryNested = { - [K in NestedKeys]: { - name: K; - properties: QueryProperty>[]; - }; -}[NestedKeys]; -export type QueryNestedDefault = { - name: string; - properties: (string | QueryNestedDefault)[]; -}; -export type QueryProperty = T extends undefined - ? string | QueryNestedDefault - : PrimitiveKeys | QueryNested; -export type QueryReference = T extends undefined ? RefPropertyDefault : RefProperty; -export type NonRefProperty = keyof T | QueryNested; -export type NonPrimitiveProperty = RefProperty | QueryNested; -export type IsEmptyType = keyof T extends never ? true : false; -export type ReferenceInput = - | string - | ReferenceToMultiTarget - | ReferenceManager - | (string | ReferenceToMultiTarget | ReferenceManager)[]; -export type ReferenceInputs = Obj extends undefined - ? Record> - : { - [Key in keyof Obj as Key extends RefKeys ? Key : never]: ReferenceInput< - ExtractCrossReferenceType - >; - }; -export type IsPrimitiveField = T extends PrimitiveField ? T : never; -export type IsWeaviateField = T extends WeaviateField ? T : never; -export type IsNestedField = T extends NestedProperties | NestedProperties[] ? T : never; -/** - * This is an internal type that is used to extract the keys of a user-provided generic type that are primitive fields, e.g. non-nested and non-reference. - */ -export type PrimitiveKeys = Obj extends undefined - ? string - : { - [Key in keyof Obj]-?: undefined extends Obj[Key] - ? IsPrimitiveField> extends never - ? never - : Key - : IsPrimitiveField extends never - ? never - : Key; - }[keyof Obj] & - string; -/** - * This is an internal type that is used to extract the keys of a user-provided generic type that are references. - */ -export type RefKeys = { - [Key in keyof Obj]: Obj[Key] extends CrossReference | undefined ? Key : never; -}[keyof Obj] & - string; -/** - * This is an internal type that is used to extract the keys of a user-provided generic type that are not references. - */ -export type NonRefKeys = { - [Key in keyof Obj]-?: undefined extends Obj[Key] - ? IsWeaviateField> extends never - ? never - : Key - : IsWeaviateField extends never - ? never - : Key; -}[keyof Obj] & - string; -/** - * This is an internal type that is used to extract the keys of a user-provided generic type that are nested properties. - */ -export type NestedKeys = { - [Key in keyof Obj]-?: undefined extends Obj[Key] - ? IsNestedField> extends never - ? never - : Key - : IsNestedField extends never - ? never - : Key; -}[keyof Obj] & - string; -/** - * This is an internal type that is used to extract the allowed inputs for a non-generic type that is not a reference. - */ -export type NonReferenceInputs = Obj extends undefined - ? Record - : { - [Key in keyof Obj as Key extends NonRefKeys ? Key : never]: MapPhoneNumberType; - }; -export type MapPhoneNumberType = T extends PhoneNumber ? PhoneNumberInput : T; -export {}; diff --git a/dist/node/esm/collections/types/internal.js b/dist/node/esm/collections/types/internal.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/types/internal.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/types/query.d.ts b/dist/node/esm/collections/types/query.d.ts deleted file mode 100644 index 7be5c4f7..00000000 --- a/dist/node/esm/collections/types/query.d.ts +++ /dev/null @@ -1,136 +0,0 @@ -import { WeaviateField } from '../index.js'; -import { CrossReferenceDefault } from '../references/index.js'; -import { - ExtractCrossReferenceType, - NonRefKeys, - QueryNestedDefault, - QueryProperty, - QueryReference, - RefKeys, -} from './internal.js'; -export type Metadata = { - creationTime: Date; - updateTime: Date; - distance: number; - certainty: number; - score: number; - explainScore: string; - rerankScore: number; - isConsistent: boolean; -}; -export type MetadataKeys = (keyof Metadata)[]; -export type QueryMetadata = 'all' | MetadataKeys | undefined; -export type ReturnMetadata = Partial; -export type WeaviateGenericObject = { - /** The generic returned properties of the object derived from the type `T`. */ - properties: ReturnProperties; - /** The returned metadata of the object. */ - metadata: ReturnMetadata | undefined; - /** The returned references of the object derived from the type `T`. */ - references: ReturnReferences | undefined; - /** The UUID of the object. */ - uuid: string; - /** The returned vectors of the object. */ - vectors: Vectors; -}; -export type WeaviateNonGenericObject = { - /** The returned properties of the object. */ - properties: Record; - /** The returned metadata of the object. */ - metadata: ReturnMetadata | undefined; - /** The returned references of the object. */ - references: Record | undefined; - /** The UUID of the object. */ - uuid: string; - /** The returned vectors of the object. */ - vectors: Vectors; -}; -export type ReturnProperties = Pick>; -export type ReturnReferences = Pick>; -export type Vectors = Record; -export type ReturnVectors = V extends string[] - ? { - [Key in V[number]]: number[]; - } - : Record; -/** An object belonging to a collection as returned by the methods in the `collection.query` namespace. - * - * Depending on the generic type `T`, the object will have subfields that map from `T`'s specific type definition. - * If not, then the object will be non-generic and have a `properties` field that maps from a generic string to a `WeaviateField`. - */ -export type WeaviateObject = T extends undefined ? WeaviateNonGenericObject : WeaviateGenericObject; -/** The return of a query method in the `collection.query` namespace. */ -export type WeaviateReturn = { - /** The objects that were found by the query. */ - objects: WeaviateObject[]; -}; -export type GroupByObject = WeaviateObject & { - belongsToGroup: string; -}; -export type GroupByResult = { - name: string; - minDistance: number; - maxDistance: number; - numberOfObjects: number; - objects: WeaviateObject[]; -}; -/** The return of a query method in the `collection.query` namespace where the `groupBy` argument was specified. */ -export type GroupByReturn = { - /** The objects that were found by the query. */ - objects: GroupByObject[]; - /** The groups that were created by the query. */ - groups: Record>; -}; -export type GroupByOptions = T extends undefined - ? { - property: string; - numberOfGroups: number; - objectsPerGroup: number; - } - : { - property: keyof T; - numberOfGroups: number; - objectsPerGroup: number; - }; -export type RerankOptions = T extends undefined - ? { - property: string; - query: string; - } - : { - property: keyof T; - query?: string; - }; -export interface BaseRefProperty { - /** The property to link on when defining the references traversal. */ - linkOn: RefKeys; - /** Whether to return the vector(s) of the referenced objects in the query. */ - includeVector?: boolean | string[]; - /** The metadata to return for the referenced objects. */ - returnMetadata?: QueryMetadata; - /** The properties to return for the referenced objects. */ - returnProperties?: QueryProperty[]; - /** The references to return for the referenced objects. */ - returnReferences?: QueryReference>[]; - /** The collection to target when traversing the references. Required for multi-target references. */ - targetCollection?: string; -} -export type RefProperty = BaseRefProperty; -export type RefPropertyDefault = { - /** The property to link on when defining the references traversal. */ - linkOn: string; - /** Whether to return the vector(s) of the referenced objects in the query. */ - includeVector?: boolean | string[]; - /** The metadata to return for the referenced objects. */ - returnMetadata?: QueryMetadata; - /** The properties to return for the referenced objects. */ - returnProperties?: (string | QueryNestedDefault)[]; - /** The references to return for the referenced objects. */ - returnReferences?: RefPropertyDefault[]; - /** The collection to target when traversing the references. Required for multi-target references. */ - targetCollection?: string; -}; -export type SortBy = { - property: string; - ascending?: boolean; -}; diff --git a/dist/node/esm/collections/types/query.js b/dist/node/esm/collections/types/query.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/collections/types/query.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/collections/vectors/multiTargetVector.d.ts b/dist/node/esm/collections/vectors/multiTargetVector.d.ts deleted file mode 100644 index fb034780..00000000 --- a/dist/node/esm/collections/vectors/multiTargetVector.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -/** The allowed combination methods for multi-target vector joins */ -export type MultiTargetVectorJoinCombination = - | 'sum' - | 'average' - | 'minimum' - | 'relative-score' - | 'manual-weights'; -/** Weights for each target vector in a multi-target vector join */ -export type MultiTargetVectorWeights = Record; -/** A multi-target vector join used when specifying a vector-based query */ -export type MultiTargetVectorJoin = { - /** The combination method to use for the target vectors */ - combination: MultiTargetVectorJoinCombination; - /** The target vectors to combine */ - targetVectors: string[]; - /** The weights to use for each target vector */ - weights?: MultiTargetVectorWeights; -}; -declare const _default: () => { - sum: (targetVectors: string[]) => MultiTargetVectorJoin; - average: (targetVectors: string[]) => MultiTargetVectorJoin; - minimum: (targetVectors: string[]) => MultiTargetVectorJoin; - relativeScore: (weights: MultiTargetVectorWeights) => MultiTargetVectorJoin; - manualWeights: (weights: MultiTargetVectorWeights) => MultiTargetVectorJoin; -}; -export default _default; -export interface MultiTargetVector { - /** Create a multi-target vector join that sums the vector scores over the target vectors */ - sum: (targetVectors: string[]) => MultiTargetVectorJoin; - /** Create a multi-target vector join that averages the vector scores over the target vectors */ - average: (targetVectors: string[]) => MultiTargetVectorJoin; - /** Create a multi-target vector join that takes the minimum vector score over the target vectors */ - minimum: (targetVectors: string[]) => MultiTargetVectorJoin; - /** Create a multi-target vector join that uses relative weights for each target vector */ - relativeScore: (weights: MultiTargetVectorWeights) => MultiTargetVectorJoin; - /** Create a multi-target vector join that uses manual weights for each target vector */ - manualWeights: (weights: MultiTargetVectorWeights) => MultiTargetVectorJoin; -} diff --git a/dist/node/esm/collections/vectors/multiTargetVector.js b/dist/node/esm/collections/vectors/multiTargetVector.js deleted file mode 100644 index 0bd39014..00000000 --- a/dist/node/esm/collections/vectors/multiTargetVector.js +++ /dev/null @@ -1,27 +0,0 @@ -export default () => { - return { - sum: (targetVectors) => { - return { combination: 'sum', targetVectors }; - }, - average: (targetVectors) => { - return { combination: 'average', targetVectors }; - }, - minimum: (targetVectors) => { - return { combination: 'minimum', targetVectors }; - }, - relativeScore: (weights) => { - return { - combination: 'relative-score', - targetVectors: Object.keys(weights), - weights, - }; - }, - manualWeights: (weights) => { - return { - combination: 'manual-weights', - targetVectors: Object.keys(weights), - weights, - }; - }, - }; -}; diff --git a/dist/node/esm/connection/auth.d.ts b/dist/node/esm/connection/auth.d.ts deleted file mode 100644 index ce24ab33..00000000 --- a/dist/node/esm/connection/auth.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { HttpClient } from './http.js'; -/** - * The allowed authentication credentials. See [the docs](https://weaviate.io/developers/weaviate/configuration/authentication) for more information. - * - * The following types are allowed: - * - `AuthUserPasswordCredentials` - * - `AuthAccessTokenCredentials` - * - `AuthClientCredentials` - * - `ApiKey` - * - `string` - * - * A string is interpreted as an API key. - */ -export type AuthCredentials = - | AuthUserPasswordCredentials - | AuthAccessTokenCredentials - | AuthClientCredentials - | ApiKey - | string; -export declare const isApiKey: (creds?: AuthCredentials) => creds is string | ApiKey; -export declare const mapApiKey: (creds: ApiKey | string) => ApiKey; -interface AuthenticatorResult { - accessToken: string; - expiresAt: number; - refreshToken: string; -} -interface OidcCredentials { - silentRefresh: boolean; -} -export interface OidcAuthFlow { - refresh: () => Promise; -} -export declare class OidcAuthenticator { - private readonly http; - private readonly creds; - private accessToken; - private refreshToken?; - private expiresAt; - private refreshRunning; - private refreshInterval; - constructor(http: HttpClient, creds: any); - refresh: (localConfig: any) => Promise; - getOpenidConfig: (localConfig: any) => Promise<{ - clientId: any; - provider: any; - scopes: any; - }>; - startTokenRefresh: (authenticator: { refresh: () => any }) => void; - stopTokenRefresh: () => void; - refreshTokenProvided: () => boolean | '' | undefined; - getAccessToken: () => string; - getExpiresAt: () => number; - resetExpiresAt(): void; -} -export interface UserPasswordCredentialsInput { - username: string; - password?: string; - scopes?: any[]; - silentRefresh?: boolean; -} -export declare class AuthUserPasswordCredentials implements OidcCredentials { - private username; - private password?; - private scopes?; - readonly silentRefresh: boolean; - constructor(creds: UserPasswordCredentialsInput); -} -export interface AccessTokenCredentialsInput { - accessToken: string; - expiresIn: number; - refreshToken?: string; - silentRefresh?: boolean; -} -export declare class AuthAccessTokenCredentials implements OidcCredentials { - readonly accessToken: string; - readonly expiresAt: number; - readonly refreshToken?: string; - readonly silentRefresh: boolean; - constructor(creds: AccessTokenCredentialsInput); - validate: (creds: AccessTokenCredentialsInput) => void; -} -export interface ClientCredentialsInput { - clientSecret: string; - scopes?: any[]; - silentRefresh?: boolean; -} -export declare class AuthClientCredentials implements OidcCredentials { - private clientSecret; - private scopes?; - readonly silentRefresh: boolean; - constructor(creds: ClientCredentialsInput); -} -export declare class ApiKey { - readonly apiKey: string; - constructor(apiKey: string); -} -export {}; diff --git a/dist/node/esm/connection/auth.js b/dist/node/esm/connection/auth.js deleted file mode 100644 index 8905f954..00000000 --- a/dist/node/esm/connection/auth.js +++ /dev/null @@ -1,311 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -export const isApiKey = (creds) => { - return typeof creds === 'string' || creds instanceof ApiKey; -}; -export const mapApiKey = (creds) => { - return creds instanceof ApiKey ? creds : new ApiKey(creds); -}; -export class OidcAuthenticator { - constructor(http, creds) { - this.refresh = (localConfig) => - __awaiter(this, void 0, void 0, function* () { - const config = yield this.getOpenidConfig(localConfig); - let authenticator; - switch (this.creds.constructor) { - case AuthUserPasswordCredentials: - authenticator = new UserPasswordAuthenticator(this.http, this.creds, config); - break; - case AuthAccessTokenCredentials: - authenticator = new AccessTokenAuthenticator(this.http, this.creds, config); - break; - case AuthClientCredentials: - authenticator = new ClientCredentialsAuthenticator(this.http, this.creds, config); - break; - default: - throw new Error('unsupported credential type'); - } - return authenticator.refresh().then((resp) => { - this.accessToken = resp.accessToken; - this.expiresAt = resp.expiresAt; - this.refreshToken = resp.refreshToken; - this.startTokenRefresh(authenticator); - }); - }); - this.getOpenidConfig = (localConfig) => { - return this.http.externalGet(localConfig.href).then((openidProviderConfig) => { - const scopes = localConfig.scopes || []; - return { - clientId: localConfig.clientId, - provider: openidProviderConfig, - scopes: scopes, - }; - }); - }; - this.startTokenRefresh = (authenticator) => { - if (this.creds.silentRefresh && !this.refreshRunning && this.refreshTokenProvided()) { - this.refreshInterval = setInterval( - () => - __awaiter(this, void 0, void 0, function* () { - // check every 30s if the token will expire in <= 1m, - // if so, refresh - if (this.expiresAt - Date.now() <= 60000) { - const resp = yield authenticator.refresh(); - this.accessToken = resp.accessToken; - this.expiresAt = resp.expiresAt; - this.refreshToken = resp.refreshToken; - } - }), - 30000 - ); - this.refreshRunning = true; - } - }; - this.stopTokenRefresh = () => { - clearInterval(this.refreshInterval); - this.refreshRunning = false; - }; - this.refreshTokenProvided = () => { - return this.refreshToken && this.refreshToken != ''; - }; - this.getAccessToken = () => { - return this.accessToken; - }; - this.getExpiresAt = () => { - return this.expiresAt; - }; - this.http = http; - this.creds = creds; - this.accessToken = ''; - this.refreshToken = ''; - this.expiresAt = 0; - this.refreshRunning = false; - // If the authentication method is access token, - // our bearer token is already available for use - if (this.creds instanceof AuthAccessTokenCredentials) { - this.accessToken = this.creds.accessToken; - this.expiresAt = this.creds.expiresAt; - this.refreshToken = this.creds.refreshToken; - } - } - resetExpiresAt() { - this.expiresAt = 0; - } -} -export class AuthUserPasswordCredentials { - constructor(creds) { - this.username = creds.username; - this.password = creds.password; - this.scopes = creds.scopes; - this.silentRefresh = parseSilentRefresh(creds.silentRefresh); - } -} -class UserPasswordAuthenticator { - constructor(http, creds, config) { - this.refresh = () => { - this.validateOpenidConfig(); - return this.requestAccessToken() - .then((tokenResp) => { - return { - accessToken: tokenResp.access_token, - expiresAt: calcExpirationEpoch(tokenResp.expires_in), - refreshToken: tokenResp.refresh_token, - }; - }) - .catch((err) => { - return Promise.reject(new Error(`failed to refresh access token: ${err}`)); - }); - }; - this.validateOpenidConfig = () => { - if ( - this.openidConfig.provider.grant_types_supported !== undefined && - !this.openidConfig.provider.grant_types_supported.includes('password') - ) { - throw new Error('grant_type password not supported'); - } - if (this.openidConfig.provider.token_endpoint.includes('https://login.microsoftonline.com')) { - throw new Error( - 'microsoft/azure recommends to avoid authentication using ' + - 'username and password, so this method is not supported by this client' - ); - } - this.openidConfig.scopes.push('offline_access'); - }; - this.requestAccessToken = () => { - const url = this.openidConfig.provider.token_endpoint; - const params = new URLSearchParams({ - grant_type: 'password', - client_id: this.openidConfig.clientId, - username: this.creds.username, - password: this.creds.password, - scope: this.openidConfig.scopes.join(' '), - }); - const contentType = 'application/x-www-form-urlencoded;charset=UTF-8'; - return this.http.externalPost(url, params, contentType); - }; - this.http = http; - this.creds = creds; - this.openidConfig = config; - if (creds.scopes) { - this.openidConfig.scopes.push(creds.scopes); - } - } -} -export class AuthAccessTokenCredentials { - constructor(creds) { - this.validate = (creds) => { - if (creds.expiresIn === undefined) { - throw new Error('AuthAccessTokenCredentials: expiresIn is required'); - } - if (!Number.isInteger(creds.expiresIn) || creds.expiresIn <= 0) { - throw new Error('AuthAccessTokenCredentials: expiresIn must be int > 0'); - } - }; - this.validate(creds); - this.accessToken = creds.accessToken; - this.expiresAt = calcExpirationEpoch(creds.expiresIn); - this.refreshToken = creds.refreshToken; - this.silentRefresh = parseSilentRefresh(creds.silentRefresh); - } -} -class AccessTokenAuthenticator { - constructor(http, creds, config) { - this.refresh = () => { - if (this.creds.refreshToken === undefined || this.creds.refreshToken == '') { - console.warn('AuthAccessTokenCredentials not provided with refreshToken, cannot refresh'); - return Promise.resolve({ - accessToken: this.creds.accessToken, - expiresAt: this.creds.expiresAt, - }); - } - this.validateOpenidConfig(); - return this.requestAccessToken() - .then((tokenResp) => { - return { - accessToken: tokenResp.access_token, - expiresAt: calcExpirationEpoch(tokenResp.expires_in), - refreshToken: tokenResp.refresh_token, - }; - }) - .catch((err) => { - return Promise.reject(new Error(`failed to refresh access token: ${err}`)); - }); - }; - this.validateOpenidConfig = () => { - if ( - this.openidConfig.provider.grant_types_supported === undefined || - !this.openidConfig.provider.grant_types_supported.includes('refresh_token') - ) { - throw new Error('grant_type refresh_token not supported'); - } - }; - this.requestAccessToken = () => { - const url = this.openidConfig.provider.token_endpoint; - const params = new URLSearchParams({ - grant_type: 'refresh_token', - client_id: this.openidConfig.clientId, - refresh_token: this.creds.refreshToken, - }); - const contentType = 'application/x-www-form-urlencoded;charset=UTF-8'; - return this.http.externalPost(url, params, contentType); - }; - this.http = http; - this.creds = creds; - this.openidConfig = config; - } -} -export class AuthClientCredentials { - constructor(creds) { - this.clientSecret = creds.clientSecret; - this.scopes = creds.scopes; - this.silentRefresh = parseSilentRefresh(creds.silentRefresh); - } -} -class ClientCredentialsAuthenticator { - constructor(http, creds, config) { - this.refresh = () => { - this.validateOpenidConfig(); - return this.requestAccessToken() - .then((tokenResp) => { - return { - accessToken: tokenResp.access_token, - expiresAt: calcExpirationEpoch(tokenResp.expires_in), - refreshToken: tokenResp.refresh_token, - }; - }) - .catch((err) => { - return Promise.reject(new Error(`failed to refresh access token: ${err}`)); - }); - }; - this.validateOpenidConfig = () => { - if (this.openidConfig.scopes.length > 0) { - return; - } - if (this.openidConfig.provider.token_endpoint.includes('https://login.microsoftonline.com')) { - this.openidConfig.scopes.push(this.openidConfig.clientId + '/.default'); - } - }; - this.requestAccessToken = () => { - const url = this.openidConfig.provider.token_endpoint; - const params = new URLSearchParams({ - grant_type: 'client_credentials', - client_id: this.openidConfig.clientId, - client_secret: this.creds.clientSecret, - scope: this.openidConfig.scopes.join(' '), - }); - const contentType = 'application/x-www-form-urlencoded;charset=UTF-8'; - return this.http.externalPost(url, params, contentType); - }; - this.http = http; - this.creds = creds; - this.openidConfig = config; - if (creds.scopes) { - this.openidConfig.scopes.push(creds.scopes); - } - } -} -export class ApiKey { - constructor(apiKey) { - this.apiKey = apiKey; - } -} -function calcExpirationEpoch(expiresIn) { - return Date.now() + (expiresIn - 2) * 1000; // -2 for some lag -} -function parseSilentRefresh(silentRefresh) { - // Silent token refresh by default - if (silentRefresh === undefined) { - return true; - } else { - return silentRefresh; - } -} diff --git a/dist/node/esm/connection/gql.d.ts b/dist/node/esm/connection/gql.d.ts deleted file mode 100644 index ee57dd4e..00000000 --- a/dist/node/esm/connection/gql.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Variables } from 'graphql-request'; -import ConnectionREST, { InternalConnectionParams } from './http.js'; -export default class ConnectionGQL extends ConnectionREST { - private gql; - constructor(params: InternalConnectionParams); - query: ( - query: any, - variables?: V | undefined - ) => Promise<{ - data: T; - }>; - close: () => void; -} -export * from './auth.js'; -export type TQuery = any; -export interface GraphQLClient { - query: ( - query: TQuery, - variables?: V, - headers?: HeadersInit - ) => Promise<{ - data: T; - }>; -} -export declare const gqlClient: (config: InternalConnectionParams) => GraphQLClient; diff --git a/dist/node/esm/connection/gql.js b/dist/node/esm/connection/gql.js deleted file mode 100644 index f7a069f3..00000000 --- a/dist/node/esm/connection/gql.js +++ /dev/null @@ -1,35 +0,0 @@ -import { GraphQLClient as Client } from 'graphql-request'; -import ConnectionREST from './http.js'; -export default class ConnectionGQL extends ConnectionREST { - constructor(params) { - super(params); - this.query = (query, variables) => { - if (this.authEnabled) { - return this.login().then((token) => { - const headers = { Authorization: `Bearer ${token}` }; - return this.gql.query(query, variables, headers); - }); - } - return this.gql.query(query, variables); - }; - this.close = () => this.http.close(); - this.gql = gqlClient(params); - } -} -export * from './auth.js'; -export const gqlClient = (config) => { - const version = '/v1/graphql'; - const baseUri = `${config.host}${version}`; - const defaultHeaders = config.headers; - return { - // for backward compatibility with replaced graphql-client lib, - // results are wrapped into { data: data } - query: (query, variables, headers) => { - return new Client(baseUri, { - headers: Object.assign(Object.assign({}, defaultHeaders), headers), - }) - .request(query, variables, headers) - .then((data) => ({ data })); - }, - }; -}; diff --git a/dist/node/esm/connection/grpc.d.ts b/dist/node/esm/connection/grpc.d.ts deleted file mode 100644 index ab94b175..00000000 --- a/dist/node/esm/connection/grpc.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { ConsistencyLevel } from '../data/index.js'; -import { Batch } from '../grpc/batcher.js'; -import { Search } from '../grpc/searcher.js'; -import { Tenants } from '../grpc/tenantsManager.js'; -import { DbVersionSupport } from '../utils/dbVersion.js'; -import ConnectionGQL from './gql.js'; -import { InternalConnectionParams } from './http.js'; -export interface GrpcConnectionParams extends InternalConnectionParams { - grpcAddress: string; - grpcSecure: boolean; -} -export default class ConnectionGRPC extends ConnectionGQL { - private grpc; - private grpcAddress; - private constructor(); - static use: (params: GrpcConnectionParams) => Promise<{ - connection: ConnectionGRPC; - dbVersionProvider: import('../utils/dbVersion.js').DbVersionProvider; - dbVersionSupport: DbVersionSupport; - }>; - private connect; - search: (collection: string, consistencyLevel?: ConsistencyLevel, tenant?: string) => Promise; - batch: (collection: string, consistencyLevel?: ConsistencyLevel, tenant?: string) => Promise; - tenants: (collection: string) => Promise; - close: () => void; -} -export interface GrpcClient { - close: () => void; - batch: ( - collection: string, - consistencyLevel?: ConsistencyLevel, - tenant?: string, - bearerToken?: string - ) => Batch; - health: () => Promise; - search: ( - collection: string, - consistencyLevel?: ConsistencyLevel, - tenant?: string, - bearerToken?: string - ) => Search; - tenants: (collection: string, bearerToken?: string) => Tenants; -} -export declare const grpcClient: (config: GrpcConnectionParams) => GrpcClient; diff --git a/dist/node/esm/connection/grpc.js b/dist/node/esm/connection/grpc.js deleted file mode 100644 index 2408d339..00000000 --- a/dist/node/esm/connection/grpc.js +++ /dev/null @@ -1,194 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -var _a; -import { isAbortError } from 'abort-controller-x'; -import { ChannelCredentials, createChannel, createClientFactory, Metadata } from 'nice-grpc'; -import { retryMiddleware } from 'nice-grpc-client-middleware-retry'; -import { WeaviateGRPCUnavailableError, WeaviateUnsupportedFeatureError } from '../errors.js'; -import Batcher from '../grpc/batcher.js'; -import Searcher from '../grpc/searcher.js'; -import TenantsManager from '../grpc/tenantsManager.js'; -import { HealthCheckResponse_ServingStatus, HealthDefinition } from '../proto/google/health/v1/health.js'; -import { WeaviateDefinition } from '../proto/v1/weaviate.js'; -import { DbVersionSupport, initDbVersionProvider } from '../utils/dbVersion.js'; -import ConnectionGQL from './gql.js'; -const clientFactory = createClientFactory().use(retryMiddleware); -const MAX_GRPC_MESSAGE_LENGTH = 104858000; // 10mb, needs to be synchronized with GRPC server -// Must extend from ConnectionGQL so that it can be passed to all the builder methods, -// which are tightly coupled to ConnectionGQL -class ConnectionGRPC extends ConnectionGQL { - constructor(params) { - super(params); - this.search = (collection, consistencyLevel, tenant) => { - if (this.authEnabled) { - return this.login().then((token) => - this.grpc.search(collection, consistencyLevel, tenant, `Bearer ${token}`) - ); - } - return new Promise((resolve) => resolve(this.grpc.search(collection, consistencyLevel, tenant))); - }; - this.batch = (collection, consistencyLevel, tenant) => { - if (this.authEnabled) { - return this.login().then((token) => - this.grpc.batch(collection, consistencyLevel, tenant, `Bearer ${token}`) - ); - } - return new Promise((resolve) => resolve(this.grpc.batch(collection, consistencyLevel, tenant))); - }; - this.tenants = (collection) => { - if (this.authEnabled) { - return this.login().then((token) => this.grpc.tenants(collection, `Bearer ${token}`)); - } - return new Promise((resolve) => resolve(this.grpc.tenants(collection))); - }; - this.close = () => { - this.grpc.close(); - this.http.close(); - }; - this.grpc = grpcClient(params); - this.grpcAddress = params.grpcAddress; - } - connect() { - return __awaiter(this, void 0, void 0, function* () { - const isHealthy = yield this.grpc.health(); - if (!isHealthy) { - yield this.close(); - throw new WeaviateGRPCUnavailableError(this.grpcAddress); - } - }); - } -} -_a = ConnectionGRPC; -ConnectionGRPC.use = (params) => - __awaiter(void 0, void 0, void 0, function* () { - const connection = new ConnectionGRPC(params); - const dbVersionProvider = initDbVersionProvider(connection); - const dbVersionSupport = new DbVersionSupport(dbVersionProvider); - if (params.skipInitChecks) { - return { connection, dbVersionProvider, dbVersionSupport }; - } - yield Promise.all([ - dbVersionSupport.supportsCompatibleGrpcService().then((check) => { - if (!check.supports) { - throw new WeaviateUnsupportedFeatureError( - `Checking for gRPC compatibility failed with message: ${check.message}` - ); - } - }), - connection.connect(), - ]); - return { connection, dbVersionProvider, dbVersionSupport }; - }); -export default ConnectionGRPC; -export const grpcClient = (config) => { - const channelOptions = { - 'grpc.max_send_message_length': MAX_GRPC_MESSAGE_LENGTH, - 'grpc.max_receive_message_length': MAX_GRPC_MESSAGE_LENGTH, - }; - if (config.grpcProxyUrl) { - // grpc.http_proxy is not used by grpc.js under-the-hood - // only uses the env var and whether http_proxy is enabled - process.env.grpc_proxy = config.grpcProxyUrl; - channelOptions['grpc.enabled_http_proxy'] = true; - } - const channel = createChannel( - config.grpcAddress, - config.grpcSecure ? ChannelCredentials.createSsl() : ChannelCredentials.createInsecure(), - channelOptions - ); - const client = clientFactory.create(WeaviateDefinition, channel); - const health = clientFactory.create(HealthDefinition, channel); - return { - close: () => channel.close(), - batch: (collection, consistencyLevel, tenant, bearerToken) => { - var _b; - return Batcher.use( - client, - collection, - new Metadata( - bearerToken - ? Object.assign(Object.assign({}, config.headers), { authorization: bearerToken }) - : config.headers - ), - ((_b = config.timeout) === null || _b === void 0 ? void 0 : _b.insert) || 90, - consistencyLevel, - tenant - ); - }, - health: () => { - var _b; - const controller = new AbortController(); - const timeoutId = setTimeout( - () => controller.abort(), - (((_b = config.timeout) === null || _b === void 0 ? void 0 : _b.init) || 2) * 1000 - ); - return health - .check({ service: '/grpc.health.v1.Health/Check' }, { signal: controller.signal }) - .then((res) => res.status === HealthCheckResponse_ServingStatus.SERVING) - .catch((err) => { - if (isAbortError(err)) { - throw new WeaviateGRPCUnavailableError(config.grpcAddress); - } - throw err; - }) - .finally(() => clearTimeout(timeoutId)); - }, - search: (collection, consistencyLevel, tenant, bearerToken) => { - var _b; - return Searcher.use( - client, - collection, - new Metadata( - bearerToken - ? Object.assign(Object.assign({}, config.headers), { authorization: bearerToken }) - : config.headers - ), - ((_b = config.timeout) === null || _b === void 0 ? void 0 : _b.query) || 30, - consistencyLevel, - tenant - ); - }, - tenants: (collection, bearerToken) => { - var _b; - return TenantsManager.use( - client, - collection, - new Metadata( - bearerToken - ? Object.assign(Object.assign({}, config.headers), { authorization: bearerToken }) - : config.headers - ), - ((_b = config.timeout) === null || _b === void 0 ? void 0 : _b.query) || 30 - ); - }, - }; -}; diff --git a/dist/node/esm/connection/helpers.d.ts b/dist/node/esm/connection/helpers.d.ts deleted file mode 100644 index d26c3dd2..00000000 --- a/dist/node/esm/connection/helpers.d.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { ClientParams, WeaviateClient } from '../index.js'; -import { AuthCredentials } from './auth.js'; -import { ProxiesParams, TimeoutParams } from './http.js'; -/** The options available to the `weaviate.connectToWeaviateCloud` method. */ -export type ConnectToWeaviateCloudOptions = { - /** The authentication credentials to use when connecting to Weaviate, e.g. API key */ - authCredentials?: AuthCredentials; - /** Additional headers to include in the request */ - headers?: Record; - /** The timeouts to use when making requests to Weaviate */ - timeout?: TimeoutParams; - /** Whether to skip the initialization checks */ - skipInitChecks?: boolean; -}; -/** @deprecated Use `ConnectToWeaviateCloudOptions` instead. */ -export type ConnectToWCDOptions = ConnectToWeaviateCloudOptions; -/** @deprecated Use `ConnectToWeaviateCloudOptions` instead. */ -export type ConnectToWCSOptions = ConnectToWeaviateCloudOptions; -export type ConnectToLocalOptions = { - /** The host where Weaviate is served. Assumes that the HTTP/1.1 and HTTP/2 servers are served on the same host */ - host?: string; - /** The port of the HTTP/1.1 server */ - port?: number; - /** The port of the HTTP/2 server */ - grpcPort?: number; - /** The authentication credentials to use when connecting to Weaviate, e.g. API key */ - authCredentials?: AuthCredentials; - /** Additional headers to include in the request */ - headers?: Record; - /** The timeouts to use when making requests to Weaviate */ - timeout?: TimeoutParams; - /** Whether to skip the initialization checks */ - skipInitChecks?: boolean; -}; -export type ConnectToCustomOptions = { - /** The hostname of the HTTP/1.1 server */ - httpHost?: string; - /** An additional path of the HTTP/1.1 server, e.g. `http://proxy.net/weaviate` */ - httpPath?: string; - /** The port of the HTTP/1.1 server */ - httpPort?: number; - /** Whether to use a secure connection to the HTTP/1.1 server */ - httpSecure?: boolean; - /** The hostname of the HTTP/2 server */ - grpcHost?: string; - /** The port of the HTTP/2 server */ - grpcPort?: number; - /** Whether to use a secure connection to the HTTP/2 server */ - grpcSecure?: boolean; - /** The authentication credentials to use when connecting to Weaviate, e.g. API key */ - authCredentials?: AuthCredentials; - /** Additional headers to include in the request */ - headers?: Record; - /** The proxy configuration to use */ - proxies?: ProxiesParams; - /** The timeouts to use when making requests to Weaviate */ - timeout?: TimeoutParams; - /** Whether to skip the initialization checks */ - skipInitChecks?: boolean; -}; -export declare function connectToWeaviateCloud( - clusterURL: string, - clientMaker: (params: ClientParams) => Promise, - options?: ConnectToWeaviateCloudOptions -): Promise; -export declare function connectToLocal( - clientMaker: (params: ClientParams) => Promise, - options?: ConnectToLocalOptions -): Promise; -export declare function connectToCustom( - clientMaker: (params: ClientParams) => Promise, - options?: ConnectToCustomOptions -): Promise; diff --git a/dist/node/esm/connection/helpers.js b/dist/node/esm/connection/helpers.js deleted file mode 100644 index 74823e08..00000000 --- a/dist/node/esm/connection/helpers.js +++ /dev/null @@ -1,76 +0,0 @@ -import { WeaviateStartUpError } from '../errors.js'; -export function connectToWeaviateCloud(clusterURL, clientMaker, options) { - // check if the URL is set - if (!clusterURL) throw new Error('Missing `clusterURL` parameter'); - if (!clusterURL.startsWith('http')) { - clusterURL = `https://${clusterURL}`; - } - const url = new URL(clusterURL); - let grpcHost; - if (url.hostname.endsWith('.weaviate.network')) { - const [ident, ...rest] = url.hostname.split('.'); - grpcHost = `${ident}.grpc.${rest.join('.')}`; - } else { - grpcHost = `grpc-${url.hostname}`; - } - return clientMaker({ - connectionParams: { - http: { - secure: true, - host: url.hostname, - port: 443, - }, - grpc: { - secure: true, - host: grpcHost, - port: 443, - }, - }, - auth: options === null || options === void 0 ? void 0 : options.authCredentials, - headers: options === null || options === void 0 ? void 0 : options.headers, - }).catch((e) => { - throw new WeaviateStartUpError(`Weaviate failed to startup with message: ${e.message}`); - }); -} -export function connectToLocal(clientMaker, options) { - return clientMaker({ - connectionParams: { - http: { - secure: false, - host: (options === null || options === void 0 ? void 0 : options.host) || 'localhost', - port: (options === null || options === void 0 ? void 0 : options.port) || 8080, - }, - grpc: { - secure: false, - host: (options === null || options === void 0 ? void 0 : options.host) || 'localhost', - port: (options === null || options === void 0 ? void 0 : options.grpcPort) || 50051, - }, - }, - auth: options === null || options === void 0 ? void 0 : options.authCredentials, - headers: options === null || options === void 0 ? void 0 : options.headers, - }).catch((e) => { - throw new WeaviateStartUpError(`Weaviate failed to startup with message: ${e.message}`); - }); -} -export function connectToCustom(clientMaker, options) { - return clientMaker({ - connectionParams: { - http: { - secure: (options === null || options === void 0 ? void 0 : options.httpSecure) || false, - host: (options === null || options === void 0 ? void 0 : options.httpHost) || 'localhost', - path: (options === null || options === void 0 ? void 0 : options.httpPath) || '', - port: (options === null || options === void 0 ? void 0 : options.httpPort) || 8080, - }, - grpc: { - secure: (options === null || options === void 0 ? void 0 : options.grpcSecure) || false, - host: (options === null || options === void 0 ? void 0 : options.grpcHost) || 'localhost', - port: (options === null || options === void 0 ? void 0 : options.grpcPort) || 50051, - }, - }, - auth: options === null || options === void 0 ? void 0 : options.authCredentials, - headers: options === null || options === void 0 ? void 0 : options.headers, - proxies: options === null || options === void 0 ? void 0 : options.proxies, - }).catch((e) => { - throw new WeaviateStartUpError(`Weaviate failed to startup with message: ${e.message}`); - }); -} diff --git a/dist/node/esm/connection/http.d.ts b/dist/node/esm/connection/http.d.ts deleted file mode 100644 index 79b26a66..00000000 --- a/dist/node/esm/connection/http.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -/// -import { Agent } from 'http'; -import { - ApiKey, - AuthAccessTokenCredentials, - AuthClientCredentials, - AuthUserPasswordCredentials, - OidcAuthenticator, -} from './auth.js'; -/** - * You can only specify the gRPC proxy URL at this point in time. This is because ProxiesParams should be used to define tunnelling proxies - * and Weaviate does not support tunnelling proxies over HTTP/1.1 at this time. - * - * To use a forwarding proxy you should instead specify its URL as if it were the Weaviate instance itself. - */ -export type ProxiesParams = { - grpc?: string; -}; -export type TimeoutParams = { - /** Define the configured timeout when querying data from Weaviate */ - query?: number; - /** Define the configured timeout when mutating data to Weaviate */ - insert?: number; - /** Define the configured timeout when initially connecting to Weaviate */ - init?: number; -}; -export type InternalConnectionParams = { - authClientSecret?: AuthClientCredentials | AuthAccessTokenCredentials | AuthUserPasswordCredentials; - apiKey?: ApiKey; - host: string; - scheme?: string; - headers?: HeadersInit; - grpcProxyUrl?: string; - agent?: Agent; - timeout?: TimeoutParams; - skipInitChecks?: boolean; -}; -export default class ConnectionREST { - private apiKey?; - protected authEnabled: boolean; - readonly host: string; - readonly http: HttpClient; - oidcAuth?: OidcAuthenticator; - constructor(params: InternalConnectionParams); - private parseAuthParams; - private sanitizeParams; - postReturn: (path: string, payload: B) => Promise; - postEmpty: (path: string, payload: B) => Promise; - put: (path: string, payload: any, expectReturnContent?: boolean) => any; - patch: (path: string, payload: any) => any; - delete: (path: string, payload: any, expectReturnContent?: boolean) => any; - head: (path: string, payload: any) => any; - get: (path: string, expectReturnContent?: boolean) => any; - login: () => Promise; -} -export * from './auth.js'; -export interface HttpClient { - close: () => void; - patch: (path: string, payload: any, bearerToken?: string) => any; - head: (path: string, payload: any, bearerToken?: string) => any; - post: ( - path: string, - payload: B, - expectReturnContent: boolean, - bearerToken: string - ) => Promise; - get: (path: string, expectReturnContent?: boolean, bearerToken?: string) => any; - externalPost: (externalUrl: string, body: any, contentType: any) => any; - getRaw: (path: string, bearerToken?: string) => any; - delete: (path: string, payload: any, expectReturnContent?: boolean, bearerToken?: string) => any; - put: (path: string, payload: any, expectReturnContent?: boolean, bearerToken?: string) => any; - externalGet: (externalUrl: string) => Promise; -} -export declare const httpClient: (config: InternalConnectionParams) => HttpClient; diff --git a/dist/node/esm/connection/http.js b/dist/node/esm/connection/http.js deleted file mode 100644 index f018fdcd..00000000 --- a/dist/node/esm/connection/http.js +++ /dev/null @@ -1,329 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -import { isAbortError } from 'abort-controller-x'; -import { - WeaviateInvalidInputError, - WeaviateRequestTimeoutError, - WeaviateUnexpectedStatusCodeError, -} from '../errors.js'; -import OpenidConfigurationGetter from '../misc/openidConfigurationGetter.js'; -import { OidcAuthenticator } from './auth.js'; -export default class ConnectionREST { - constructor(params) { - this.postReturn = (path, payload) => { - if (this.authEnabled) { - return this.login().then((token) => this.http.post(path, payload, true, token).then((res) => res)); - } - return this.http.post(path, payload, true, '').then((res) => res); - }; - this.postEmpty = (path, payload) => { - if (this.authEnabled) { - return this.login().then((token) => this.http.post(path, payload, false, token)); - } - return this.http.post(path, payload, false, ''); - }; - this.put = (path, payload, expectReturnContent = true) => { - if (this.authEnabled) { - return this.login().then((token) => this.http.put(path, payload, expectReturnContent, token)); - } - return this.http.put(path, payload, expectReturnContent); - }; - this.patch = (path, payload) => { - if (this.authEnabled) { - return this.login().then((token) => this.http.patch(path, payload, token)); - } - return this.http.patch(path, payload); - }; - this.delete = (path, payload, expectReturnContent = false) => { - if (this.authEnabled) { - return this.login().then((token) => this.http.delete(path, payload, expectReturnContent, token)); - } - return this.http.delete(path, payload, expectReturnContent); - }; - this.head = (path, payload) => { - if (this.authEnabled) { - return this.login().then((token) => this.http.head(path, payload, token)); - } - return this.http.head(path, payload); - }; - this.get = (path, expectReturnContent = true) => { - if (this.authEnabled) { - return this.login().then((token) => this.http.get(path, expectReturnContent, token)); - } - return this.http.get(path, expectReturnContent); - }; - this.login = () => - __awaiter(this, void 0, void 0, function* () { - if (this.apiKey) { - return this.apiKey; - } - if (!this.oidcAuth) { - return ''; - } - const localConfig = yield new OpenidConfigurationGetter(this.http).do(); - if (localConfig === undefined) { - console.warn('client is configured for authentication, but server is not'); - return ''; - } - if (Date.now() >= this.oidcAuth.getExpiresAt()) { - yield this.oidcAuth.refresh(localConfig); - } - return this.oidcAuth.getAccessToken(); - }); - params = this.sanitizeParams(params); - this.host = params.host; - this.http = httpClient(params); - this.authEnabled = this.parseAuthParams(params); - } - parseAuthParams(params) { - var _a; - if (params.authClientSecret && params.apiKey) { - throw new WeaviateInvalidInputError( - 'must provide one of authClientSecret (OIDC) or apiKey, cannot provide both' - ); - } - if (params.authClientSecret) { - this.oidcAuth = new OidcAuthenticator(this.http, params.authClientSecret); - return true; - } - if (params.apiKey) { - this.apiKey = (_a = params.apiKey) === null || _a === void 0 ? void 0 : _a.apiKey; - return true; - } - return false; - } - sanitizeParams(params) { - // Remove trailing slashes from the host - while (params.host.endsWith('/')) { - params.host = params.host.slice(0, -1); - } - const protocolPattern = /^(https?|ftp|file)(?::\/\/)/; - const extractedSchemeMatch = params.host.match(protocolPattern); - // Check for the existence of scheme in params - if (params.scheme) { - // If the host contains a scheme different than provided scheme, replace it and throw a warning - if (extractedSchemeMatch && extractedSchemeMatch[1] !== `${params.scheme}`) { - throw new WeaviateInvalidInputError( - `The host contains a different protocol than specified in the scheme (scheme: ${params.scheme} != host: ${extractedSchemeMatch[1]})` - ); - } else if (!extractedSchemeMatch) { - // If no scheme in the host, simply prefix with the provided scheme - params.host = `${params.scheme}://${params.host}`; - } - // If there's no scheme in params, ensure the host starts with a recognized protocol - } else if (!extractedSchemeMatch) { - throw new WeaviateInvalidInputError( - 'The host must start with a recognized protocol (e.g., http or https) if no scheme is provided.' - ); - } - return params; - } -} -export * from './auth.js'; -const fetchWithTimeout = (input, timeout, init) => { - const controller = new AbortController(); - // Set a timeout to abort the request - const timeoutId = setTimeout(() => controller.abort(), timeout * 1000); - return fetch(input, Object.assign(Object.assign({}, init), { signal: controller.signal })) - .catch((error) => { - if (isAbortError(error)) { - throw new WeaviateRequestTimeoutError(`Request timed out after ${timeout}ms`); - } - throw error; // For other errors, rethrow them - }) - .finally(() => clearTimeout(timeoutId)); -}; -export const httpClient = (config) => { - const version = '/v1'; - const baseUri = `${config.host}${version}`; - const url = makeUrl(baseUri); - return { - close: () => { - var _a; - return (_a = config.agent) === null || _a === void 0 ? void 0 : _a.destroy(); - }, - post: (path, payload, expectReturnContent, bearerToken) => { - var _a; - const request = { - method: 'POST', - headers: Object.assign(Object.assign({}, config.headers), { 'content-type': 'application/json' }), - body: JSON.stringify(payload), - agent: config.agent, - }; - addAuthHeaderIfNeeded(request, bearerToken); - return fetchWithTimeout( - url(path), - ((_a = config.timeout) === null || _a === void 0 ? void 0 : _a.insert) || 90, - request - ).then(checkStatus(expectReturnContent)); - }, - put: (path, payload, expectReturnContent = true, bearerToken = '') => { - var _a; - const request = { - method: 'PUT', - headers: Object.assign(Object.assign({}, config.headers), { 'content-type': 'application/json' }), - body: JSON.stringify(payload), - agent: config.agent, - }; - addAuthHeaderIfNeeded(request, bearerToken); - return fetchWithTimeout( - url(path), - ((_a = config.timeout) === null || _a === void 0 ? void 0 : _a.insert) || 90, - request - ).then(checkStatus(expectReturnContent)); - }, - patch: (path, payload, bearerToken = '') => { - var _a; - const request = { - method: 'PATCH', - headers: Object.assign(Object.assign({}, config.headers), { 'content-type': 'application/json' }), - body: JSON.stringify(payload), - agent: config.agent, - }; - addAuthHeaderIfNeeded(request, bearerToken); - return fetchWithTimeout( - url(path), - ((_a = config.timeout) === null || _a === void 0 ? void 0 : _a.insert) || 90, - request - ).then(checkStatus(false)); - }, - delete: (path, payload = null, expectReturnContent = false, bearerToken = '') => { - var _a; - const request = { - method: 'DELETE', - headers: Object.assign(Object.assign({}, config.headers), { 'content-type': 'application/json' }), - body: payload ? JSON.stringify(payload) : undefined, - agent: config.agent, - }; - addAuthHeaderIfNeeded(request, bearerToken); - return fetchWithTimeout( - url(path), - ((_a = config.timeout) === null || _a === void 0 ? void 0 : _a.insert) || 90, - request - ).then(checkStatus(expectReturnContent)); - }, - head: (path, payload = null, bearerToken = '') => { - var _a; - const request = { - method: 'HEAD', - headers: Object.assign(Object.assign({}, config.headers), { 'content-type': 'application/json' }), - body: payload ? JSON.stringify(payload) : undefined, - agent: config.agent, - }; - addAuthHeaderIfNeeded(request, bearerToken); - return fetchWithTimeout( - url(path), - ((_a = config.timeout) === null || _a === void 0 ? void 0 : _a.query) || 30, - request - ).then(handleHeadResponse(false)); - }, - get: (path, expectReturnContent = true, bearerToken = '') => { - var _a; - const request = { - method: 'GET', - headers: Object.assign({}, config.headers), - agent: config.agent, - }; - addAuthHeaderIfNeeded(request, bearerToken); - return fetchWithTimeout( - url(path), - ((_a = config.timeout) === null || _a === void 0 ? void 0 : _a.query) || 30, - request - ).then(checkStatus(expectReturnContent)); - }, - getRaw: (path, bearerToken = '') => { - var _a; - // getRaw does not handle the status leaving this to the caller - const request = { - method: 'GET', - headers: Object.assign({}, config.headers), - agent: config.agent, - }; - addAuthHeaderIfNeeded(request, bearerToken); - return fetchWithTimeout( - url(path), - ((_a = config.timeout) === null || _a === void 0 ? void 0 : _a.query) || 30, - request - ); - }, - externalGet: (externalUrl) => { - return fetch(externalUrl, { - method: 'GET', - headers: Object.assign({}, config.headers), - }).then(checkStatus(true)); - }, - externalPost: (externalUrl, body, contentType) => { - if (contentType == undefined || contentType == '') { - contentType = 'application/json'; - } - const request = { - body: undefined, - method: 'POST', - headers: Object.assign(Object.assign({}, config.headers), { 'content-type': contentType }), - }; - if (body != null) { - request.body = body; - } - return fetch(externalUrl, request).then(checkStatus(true)); - }, - }; -}; -const makeUrl = (basePath) => (path) => basePath + path; -const checkStatus = (expectResponseBody) => (res) => { - if (res.status >= 400) { - return res.text().then((errText) => { - let err; - try { - // in case of invalid json response (like empty string) - err = JSON.stringify(JSON.parse(errText)); - } catch (e) { - err = errText; - } - return Promise.reject(new WeaviateUnexpectedStatusCodeError(res.status, err)); - }); - } - if (expectResponseBody) { - return res.json(); - } - return Promise.resolve(undefined); -}; -const handleHeadResponse = (expectResponseBody) => (res) => { - if (res.status == 200 || res.status == 204 || res.status == 404) { - return Promise.resolve(res.status == 200 || res.status == 204); - } - return checkStatus(expectResponseBody)(res); -}; -function addAuthHeaderIfNeeded(request, bearerToken) { - if (bearerToken !== '') { - request.headers.Authorization = `Bearer ${bearerToken}`; - } -} diff --git a/dist/node/esm/connection/index.d.ts b/dist/node/esm/connection/index.d.ts deleted file mode 100644 index c71e2176..00000000 --- a/dist/node/esm/connection/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import ConnectionGQL from './gql.js'; -import ConnectionGRPC from './grpc.js'; -import ConnectionREST from './http.js'; -export default ConnectionGQL; -export type { - ConnectToCustomOptions, - ConnectToLocalOptions, - ConnectToWCDOptions, - ConnectToWCSOptions, - ConnectToWeaviateCloudOptions, -} from './helpers.js'; -export type { InternalConnectionParams } from './http.js'; -export { ConnectionGQL, ConnectionGRPC, ConnectionREST }; diff --git a/dist/node/esm/connection/index.js b/dist/node/esm/connection/index.js deleted file mode 100644 index b303de55..00000000 --- a/dist/node/esm/connection/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import ConnectionGQL from './gql.js'; -import ConnectionGRPC from './grpc.js'; -import ConnectionREST from './http.js'; -export default ConnectionGQL; -export { ConnectionGQL, ConnectionGRPC, ConnectionREST }; diff --git a/dist/node/esm/data/checker.d.ts b/dist/node/esm/data/checker.d.ts deleted file mode 100644 index 59e4744d..00000000 --- a/dist/node/esm/data/checker.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ObjectsPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class Checker extends CommandBase { - private className; - private consistencyLevel?; - private id; - private tenant?; - private objectsPath; - constructor(client: Connection, objectsPath: ObjectsPath); - withId: (id: string) => this; - withClassName: (className: string) => this; - withTenant: (tenant: string) => this; - withConsistencyLevel: (consistencyLevel: ConsistencyLevel) => this; - buildPath: () => Promise; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validateId: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/data/checker.js b/dist/node/esm/data/checker.js deleted file mode 100644 index 79036814..00000000 --- a/dist/node/esm/data/checker.js +++ /dev/null @@ -1,44 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class Checker extends CommandBase { - constructor(client, objectsPath) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.withConsistencyLevel = (consistencyLevel) => { - this.consistencyLevel = consistencyLevel; - return this; - }; - this.buildPath = () => { - return this.objectsPath.buildCheck(this.id, this.className, this.consistencyLevel, this.tenant); - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validateId = () => { - this.validateIsSet(this.id, 'id', '.withId(id)'); - }; - this.validate = () => { - this.validateId(); - }; - this.do = () => { - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - this.validate(); - return this.buildPath().then((path) => this.client.head(path, undefined)); - }; - this.objectsPath = objectsPath; - } -} diff --git a/dist/node/esm/data/creator.d.ts b/dist/node/esm/data/creator.d.ts deleted file mode 100644 index ebddc382..00000000 --- a/dist/node/esm/data/creator.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import Connection from '../connection/index.js'; -import { Properties, WeaviateObject } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ObjectsPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class Creator extends CommandBase { - private className?; - private consistencyLevel?; - private id?; - private objectsPath; - private properties?; - private vector?; - private vectors?; - private tenant?; - constructor(client: Connection, objectsPath: ObjectsPath); - withVector: (vector: number[]) => this; - withVectors: (vectors: Record) => this; - withClassName: (className: string) => this; - withProperties: (properties: Properties) => this; - withId: (id: string) => this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withTenant: (tenant: string) => this; - validateClassName: () => void; - payload: () => WeaviateObject; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/data/creator.js b/dist/node/esm/data/creator.js deleted file mode 100644 index 333103d9..00000000 --- a/dist/node/esm/data/creator.js +++ /dev/null @@ -1,61 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { isValidStringProperty } from '../validation/string.js'; -export default class Creator extends CommandBase { - constructor(client, objectsPath) { - super(client); - this.withVector = (vector) => { - this.vector = vector; - return this; - }; - this.withVectors = (vectors) => { - this.vectors = vectors; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withProperties = (properties) => { - this.properties = properties; - return this; - }; - this.withId = (id) => { - this.id = id; - return this; - }; - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateClassName = () => { - if (!isValidStringProperty(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.payload = () => ({ - tenant: this.tenant, - vector: this.vector, - properties: this.properties, - class: this.className, - id: this.id, - vectors: this.vectors, - }); - this.validate = () => { - this.validateClassName(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - return this.objectsPath - .buildCreate(this.consistencyLevel) - .then((path) => this.client.postReturn(path, this.payload())); - }; - this.objectsPath = objectsPath; - } -} diff --git a/dist/node/esm/data/deleter.d.ts b/dist/node/esm/data/deleter.d.ts deleted file mode 100644 index e1a4633a..00000000 --- a/dist/node/esm/data/deleter.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ObjectsPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class Deleter extends CommandBase { - private className; - private consistencyLevel?; - private id; - private tenant?; - private objectsPath; - constructor(client: Connection, objectsPath: ObjectsPath); - withId: (id: string) => this; - withClassName: (className: string) => this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withTenant: (tenant: string) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validateId: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/data/deleter.js b/dist/node/esm/data/deleter.js deleted file mode 100644 index 60e85fde..00000000 --- a/dist/node/esm/data/deleter.js +++ /dev/null @@ -1,45 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class Deleter extends CommandBase { - constructor(client, objectsPath) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validateId = () => { - this.validateIsSet(this.id, 'id', '.withId(id)'); - }; - this.validate = () => { - this.validateId(); - }; - this.do = () => { - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - this.validate(); - return this.objectsPath - .buildDelete(this.id, this.className, this.consistencyLevel, this.tenant) - .then((path) => { - return this.client.delete(path, undefined, false); - }); - }; - this.objectsPath = objectsPath; - } -} diff --git a/dist/node/esm/data/getter.d.ts b/dist/node/esm/data/getter.d.ts deleted file mode 100644 index 3c144d74..00000000 --- a/dist/node/esm/data/getter.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import Connection from '../connection/index.js'; -import { WeaviateObjectsList } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ObjectsPath } from './path.js'; -export default class Getter extends CommandBase { - private additional; - private after; - private className?; - private limit?; - private tenant?; - private objectsPath; - constructor(client: Connection, objectsPath: ObjectsPath); - withClassName: (className: string) => this; - withAfter: (id: string) => this; - withLimit: (limit: number) => this; - withTenant: (tenant: string) => this; - extendAdditional: (prop: string) => this; - withAdditional: (additionalFlag: any) => this; - withVector: () => this; - validate(): void; - do: () => Promise; -} diff --git a/dist/node/esm/data/getter.js b/dist/node/esm/data/getter.js deleted file mode 100644 index 2a4c91b3..00000000 --- a/dist/node/esm/data/getter.js +++ /dev/null @@ -1,43 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class Getter extends CommandBase { - constructor(client, objectsPath) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withAfter = (id) => { - this.after = id; - return this; - }; - this.withLimit = (limit) => { - this.limit = limit; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.extendAdditional = (prop) => { - this.additional = [...this.additional, prop]; - return this; - }; - this.withAdditional = (additionalFlag) => this.extendAdditional(additionalFlag); - this.withVector = () => this.extendAdditional('vector'); - this.do = () => { - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - return this.objectsPath - .buildGet(this.className, this.limit, this.additional, this.after, this.tenant) - .then((path) => { - return this.client.get(path); - }); - }; - this.objectsPath = objectsPath; - this.additional = []; - } - validate() { - // nothing to validate - } -} diff --git a/dist/node/esm/data/getterById.d.ts b/dist/node/esm/data/getterById.d.ts deleted file mode 100644 index ec45df61..00000000 --- a/dist/node/esm/data/getterById.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import Connection from '../connection/index.js'; -import { WeaviateObject } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ObjectsPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class GetterById extends CommandBase { - private additional; - private className; - private id; - private consistencyLevel?; - private nodeName?; - private tenant?; - private objectsPath; - constructor(client: Connection, objectsPath: ObjectsPath); - withId: (id: string) => this; - withClassName: (className: string) => this; - withTenant: (tenant: string) => this; - extendAdditional: (prop: string) => this; - withAdditional: (additionalFlag: string) => this; - withVector: () => this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withNodeName: (nodeName: string) => this; - validateId: () => void; - validate: () => void; - buildPath: () => Promise; - do: () => Promise; -} diff --git a/dist/node/esm/data/getterById.js b/dist/node/esm/data/getterById.js deleted file mode 100644 index 45c69de0..00000000 --- a/dist/node/esm/data/getterById.js +++ /dev/null @@ -1,61 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class GetterById extends CommandBase { - constructor(client, objectsPath) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.extendAdditional = (prop) => { - this.additional = [...this.additional, prop]; - return this; - }; - this.withAdditional = (additionalFlag) => this.extendAdditional(additionalFlag); - this.withVector = () => this.extendAdditional('vector'); - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.withNodeName = (nodeName) => { - this.nodeName = nodeName; - return this; - }; - this.validateId = () => { - if (this.id == undefined || this.id == null || this.id.length == 0) { - this.addError('id must be set - initialize with getterById(id)'); - } - }; - this.validate = () => { - this.validateId(); - }; - this.buildPath = () => { - return this.objectsPath.buildGetOne( - this.id, - this.className, - this.additional, - this.consistencyLevel, - this.nodeName, - this.tenant - ); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - return this.buildPath().then((path) => { - return this.client.get(path); - }); - }; - this.objectsPath = objectsPath; - this.additional = []; - } -} diff --git a/dist/node/esm/data/index.d.ts b/dist/node/esm/data/index.d.ts deleted file mode 100644 index 275e4cc7..00000000 --- a/dist/node/esm/data/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import Connection from '../connection/index.js'; -import { DbVersionSupport } from '../utils/dbVersion.js'; -import Checker from './checker.js'; -import Creator from './creator.js'; -import Deleter from './deleter.js'; -import Getter from './getter.js'; -import GetterById from './getterById.js'; -import Merger from './merger.js'; -import ReferenceCreator from './referenceCreator.js'; -import ReferenceDeleter from './referenceDeleter.js'; -import ReferencePayloadBuilder from './referencePayloadBuilder.js'; -import ReferenceReplacer from './referenceReplacer.js'; -import Updater from './updater.js'; -import Validator from './validator.js'; -export interface Data { - creator: () => Creator; - validator: () => Validator; - updater: () => Updater; - merger: () => Merger; - getter: () => Getter; - getterById: () => GetterById; - deleter: () => Deleter; - checker: () => Checker; - referenceCreator: () => ReferenceCreator; - referenceReplacer: () => ReferenceReplacer; - referenceDeleter: () => ReferenceDeleter; - referencePayloadBuilder: () => ReferencePayloadBuilder; -} -declare const data: (client: Connection, dbVersionSupport: DbVersionSupport) => Data; -export default data; -export { default as Checker } from './checker.js'; -export { default as Creator } from './creator.js'; -export { default as Deleter } from './deleter.js'; -export { default as Getter } from './getter.js'; -export { default as GetterById } from './getterById.js'; -export { default as Merger } from './merger.js'; -export { default as ReferenceCreator } from './referenceCreator.js'; -export { default as ReferenceDeleter } from './referenceDeleter.js'; -export { default as ReferencePayloadBuilder } from './referencePayloadBuilder.js'; -export { default as ReferenceReplacer } from './referenceReplacer.js'; -export type { ConsistencyLevel } from './replication.js'; -export { default as Updater } from './updater.js'; -export { default as Validator } from './validator.js'; diff --git a/dist/node/esm/data/index.js b/dist/node/esm/data/index.js deleted file mode 100644 index 0d4eaa68..00000000 --- a/dist/node/esm/data/index.js +++ /dev/null @@ -1,46 +0,0 @@ -import { BeaconPath } from '../utils/beaconPath.js'; -import Checker from './checker.js'; -import Creator from './creator.js'; -import Deleter from './deleter.js'; -import Getter from './getter.js'; -import GetterById from './getterById.js'; -import Merger from './merger.js'; -import { ObjectsPath, ReferencesPath } from './path.js'; -import ReferenceCreator from './referenceCreator.js'; -import ReferenceDeleter from './referenceDeleter.js'; -import ReferencePayloadBuilder from './referencePayloadBuilder.js'; -import ReferenceReplacer from './referenceReplacer.js'; -import Updater from './updater.js'; -import Validator from './validator.js'; -const data = (client, dbVersionSupport) => { - const objectsPath = new ObjectsPath(dbVersionSupport); - const referencesPath = new ReferencesPath(dbVersionSupport); - const beaconPath = new BeaconPath(dbVersionSupport); - return { - creator: () => new Creator(client, objectsPath), - validator: () => new Validator(client), - updater: () => new Updater(client, objectsPath), - merger: () => new Merger(client, objectsPath), - getter: () => new Getter(client, objectsPath), - getterById: () => new GetterById(client, objectsPath), - deleter: () => new Deleter(client, objectsPath), - checker: () => new Checker(client, objectsPath), - referenceCreator: () => new ReferenceCreator(client, referencesPath, beaconPath), - referenceReplacer: () => new ReferenceReplacer(client, referencesPath, beaconPath), - referenceDeleter: () => new ReferenceDeleter(client, referencesPath, beaconPath), - referencePayloadBuilder: () => new ReferencePayloadBuilder(client), - }; -}; -export default data; -export { default as Checker } from './checker.js'; -export { default as Creator } from './creator.js'; -export { default as Deleter } from './deleter.js'; -export { default as Getter } from './getter.js'; -export { default as GetterById } from './getterById.js'; -export { default as Merger } from './merger.js'; -export { default as ReferenceCreator } from './referenceCreator.js'; -export { default as ReferenceDeleter } from './referenceDeleter.js'; -export { default as ReferencePayloadBuilder } from './referencePayloadBuilder.js'; -export { default as ReferenceReplacer } from './referenceReplacer.js'; -export { default as Updater } from './updater.js'; -export { default as Validator } from './validator.js'; diff --git a/dist/node/esm/data/merger.d.ts b/dist/node/esm/data/merger.d.ts deleted file mode 100644 index fdbb7f97..00000000 --- a/dist/node/esm/data/merger.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import Connection from '../connection/index.js'; -import { Properties, WeaviateObject } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ObjectsPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class Merger extends CommandBase { - private className; - private consistencyLevel?; - private id; - private objectsPath; - private properties?; - private tenant?; - constructor(client: Connection, objectsPath: ObjectsPath); - withProperties: (properties: Properties) => this; - withClassName: (className: string) => this; - withId: (id: string) => this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withTenant: (tenant: string) => this; - validateClassName: () => void; - validateId: () => void; - payload: () => WeaviateObject; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/data/merger.js b/dist/node/esm/data/merger.js deleted file mode 100644 index 94aeeca7..00000000 --- a/dist/node/esm/data/merger.js +++ /dev/null @@ -1,57 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { isValidStringProperty } from '../validation/string.js'; -export default class Merger extends CommandBase { - constructor(client, objectsPath) { - super(client); - this.withProperties = (properties) => { - this.properties = properties; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withId = (id) => { - this.id = id; - return this; - }; - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateClassName = () => { - if (!isValidStringProperty(this.className)) { - this.addError('className must be set - set with withClassName(className)'); - } - }; - this.validateId = () => { - if (this.id == undefined || this.id == null || this.id.length == 0) { - this.addError('id must be set - set with withId(id)'); - } - }; - this.payload = () => ({ - tenant: this.tenant, - properties: this.properties, - class: this.className, - id: this.id, - }); - this.validate = () => { - this.validateClassName(); - this.validateId(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - return this.objectsPath - .buildMerge(this.id, this.className, this.consistencyLevel) - .then((path) => this.client.patch(path, this.payload())); - }; - this.objectsPath = objectsPath; - } -} diff --git a/dist/node/esm/data/path.d.ts b/dist/node/esm/data/path.d.ts deleted file mode 100644 index 36943fb7..00000000 --- a/dist/node/esm/data/path.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { DbVersionSupport } from '../utils/dbVersion.js'; -import { ConsistencyLevel } from './replication.js'; -export declare class ObjectsPath { - private dbVersionSupport; - constructor(dbVersionSupport: DbVersionSupport); - buildCreate(consistencyLevel?: string): Promise; - buildDelete(id: string, className: string, consistencyLevel?: string, tenant?: string): Promise; - buildCheck( - id: string, - className: string, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ): Promise; - buildGetOne( - id: string, - className: string, - additional: string[], - consistencyLevel?: ConsistencyLevel, - nodeName?: string, - tenant?: string - ): Promise; - buildGet( - className?: string, - limit?: number, - additional?: string[], - after?: string, - tenant?: string - ): Promise; - buildUpdate(id: string, className: string, consistencyLevel?: string): Promise; - buildMerge(id: string, className: string, consistencyLevel?: string): Promise; - build(params: any, modifiers: any): Promise; - addClassNameDeprecatedNotSupportedCheck(params: any, path: string, support: any): string; - addClassNameDeprecatedCheck(params: any, path: string, support: any): string; - addId(params: any, path: string): string; - addQueryParams(params: any, path: string): string; - addQueryParamsForGet(params: any, path: string, support: any): string; -} -export declare class ReferencesPath { - private dbVersionSupport; - constructor(dbVersionSupport: DbVersionSupport); - build( - id: string, - className: string, - property: string, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ): Promise; -} diff --git a/dist/node/esm/data/path.js b/dist/node/esm/data/path.js deleted file mode 100644 index eb8b50b0..00000000 --- a/dist/node/esm/data/path.js +++ /dev/null @@ -1,173 +0,0 @@ -import { isValidStringProperty } from '../validation/string.js'; -import { isValidWeaviateVersion } from '../validation/version.js'; -const objectsPathPrefix = '/objects'; -export class ObjectsPath { - constructor(dbVersionSupport) { - this.dbVersionSupport = dbVersionSupport; - } - buildCreate(consistencyLevel) { - return this.build({ consistencyLevel }, [this.addQueryParams]); - } - buildDelete(id, className, consistencyLevel, tenant) { - return this.build({ id, className, consistencyLevel, tenant: tenant }, [ - this.addClassNameDeprecatedNotSupportedCheck, - this.addId, - this.addQueryParams, - ]); - } - buildCheck(id, className, consistencyLevel, tenant) { - return this.build({ id, className, consistencyLevel, tenant }, [ - this.addClassNameDeprecatedNotSupportedCheck, - this.addId, - this.addQueryParams, - ]); - } - buildGetOne(id, className, additional, consistencyLevel, nodeName, tenant) { - return this.build({ id, className, additional: additional, consistencyLevel, nodeName, tenant: tenant }, [ - this.addClassNameDeprecatedNotSupportedCheck, - this.addId, - this.addQueryParams, - ]); - } - buildGet(className, limit, additional, after, tenant) { - return this.build({ className, limit, additional, after, tenant: tenant }, [this.addQueryParamsForGet]); - } - buildUpdate(id, className, consistencyLevel) { - return this.build({ id, className, consistencyLevel }, [ - this.addClassNameDeprecatedCheck, - this.addId, - this.addQueryParams, - ]); - } - buildMerge(id, className, consistencyLevel) { - return this.build({ id, className, consistencyLevel }, [ - this.addClassNameDeprecatedCheck, - this.addId, - this.addQueryParams, - ]); - } - build(params, modifiers) { - return this.dbVersionSupport.supportsClassNameNamespacedEndpointsPromise().then((support) => { - let path = objectsPathPrefix; - modifiers.forEach((modifier) => { - path = modifier(params, path, support); - }); - return path; - }); - } - addClassNameDeprecatedNotSupportedCheck(params, path, support) { - if (support.supports) { - if (isValidStringProperty(params.className)) { - return `${path}/${params.className}`; - } else { - support.warns.deprecatedNonClassNameNamespacedEndpointsForObjects(); - } - } else { - support.warns.notSupportedClassNamespacedEndpointsForObjects(); - } - return path; - } - addClassNameDeprecatedCheck(params, path, support) { - if (support.supports) { - if (isValidStringProperty(params.className)) { - return `${path}/${params.className}`; - } else { - support.warns.deprecatedNonClassNameNamespacedEndpointsForObjects(); - } - } - return path; - } - addId(params, path) { - if (isValidStringProperty(params.id)) { - return `${path}/${params.id}`; - } - return path; - } - addQueryParams(params, path) { - const queryParams = []; - if (Array.isArray(params.additional) && params.additional.length > 0) { - queryParams.push(`include=${params.additional.join(',')}`); - } - if (isValidStringProperty(params.nodeName)) { - queryParams.push(`node_name=${params.nodeName}`); - } - if (isValidStringProperty(params.consistencyLevel)) { - queryParams.push(`consistency_level=${params.consistencyLevel}`); - } - if (isValidStringProperty(params.tenant)) { - queryParams.push(`tenant=${params.tenant}`); - } - if (queryParams.length > 0) { - return `${path}?${queryParams.join('&')}`; - } - return path; - } - addQueryParamsForGet(params, path, support) { - const queryParams = []; - if (Array.isArray(params.additional) && params.additional.length > 0) { - queryParams.push(`include=${params.additional.join(',')}`); - } - if (typeof params.limit == 'number' && params.limit > 0) { - queryParams.push(`limit=${params.limit}`); - } - if (isValidStringProperty(params.className)) { - if (support.supports) { - queryParams.push(`class=${params.className}`); - } else { - support.warns.notSupportedClassParameterInEndpointsForObjects(); - } - } - if (isValidStringProperty(params.after)) { - queryParams.push(`after=${params.after}`); - } - if (isValidStringProperty(params.tenant)) { - queryParams.push(`tenant=${params.tenant}`); - } - if (queryParams.length > 0) { - return `${path}?${queryParams.join('&')}`; - } - return path; - } -} -export class ReferencesPath { - constructor(dbVersionSupport) { - this.dbVersionSupport = dbVersionSupport; - } - build(id, className, property, consistencyLevel, tenant) { - return this.dbVersionSupport.supportsClassNameNamespacedEndpointsPromise().then((support) => { - let path = objectsPathPrefix; - if (support.supports) { - if (isValidStringProperty(className)) { - path = `${path}/${className}`; - } else { - support.warns.deprecatedNonClassNameNamespacedEndpointsForReferences(); - } - } else { - support.warns.notSupportedClassNamespacedEndpointsForReferences(); - } - if (support.version) { - if (!isValidWeaviateVersion(support.version)) { - support.warns.deprecatedWeaviateTooOld(); - } - } - if (isValidStringProperty(id)) { - path = `${path}/${id}`; - } - path = `${path}/references`; - if (isValidStringProperty(property)) { - path = `${path}/${property}`; - } - const queryParams = []; - if (isValidStringProperty(consistencyLevel)) { - queryParams.push(`consistency_level=${consistencyLevel}`); - } - if (isValidStringProperty(tenant)) { - queryParams.push(`tenant=${tenant}`); - } - if (queryParams.length > 0) { - path = `${path}?${queryParams.join('&')}`; - } - return path; - }); - } -} diff --git a/dist/node/esm/data/referenceCreator.d.ts b/dist/node/esm/data/referenceCreator.d.ts deleted file mode 100644 index c8dd1015..00000000 --- a/dist/node/esm/data/referenceCreator.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import Connection from '../connection/index.js'; -import { Reference } from '../openapi/types.js'; -import { BeaconPath } from '../utils/beaconPath.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ReferencesPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class ReferenceCreator extends CommandBase { - private beaconPath; - private className; - private consistencyLevel?; - private id; - private reference; - private referencesPath; - private refProp; - private tenant?; - constructor(client: Connection, referencesPath: ReferencesPath, beaconPath: BeaconPath); - withId: (id: string) => this; - withClassName(className: string): this; - withReference: (ref: Reference) => this; - withReferenceProperty: (refProp: string) => this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withTenant: (tenant: string) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - payload: () => { - class?: string | undefined; - schema?: - | { - [key: string]: unknown; - } - | undefined; - beacon?: string | undefined; - href?: string | undefined; - classification?: - | { - overallCount?: number | undefined; - winningCount?: number | undefined; - losingCount?: number | undefined; - closestOverallDistance?: number | undefined; - winningDistance?: number | undefined; - meanWinningDistance?: number | undefined; - closestWinningDistance?: number | undefined; - closestLosingDistance?: number | undefined; - losingDistance?: number | undefined; - meanLosingDistance?: number | undefined; - } - | undefined; - }; - do: () => Promise; -} diff --git a/dist/node/esm/data/referenceCreator.js b/dist/node/esm/data/referenceCreator.js deleted file mode 100644 index 47642c7c..00000000 --- a/dist/node/esm/data/referenceCreator.js +++ /dev/null @@ -1,59 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class ReferenceCreator extends CommandBase { - constructor(client, referencesPath, beaconPath) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.withReference = (ref) => { - this.reference = ref; - return this; - }; - this.withReferenceProperty = (refProp) => { - this.refProp = refProp; - return this; - }; - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.id, 'id', '.withId(id)'); - this.validateIsSet(this.refProp, 'referenceProperty', '.withReferenceProperty(refProp)'); - }; - this.payload = () => this.reference; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - if (!this.reference.beacon) { - throw new Error('reference beacon must be set'); - } - return Promise.all([ - this.referencesPath.build(this.id, this.className, this.refProp, this.consistencyLevel, this.tenant), - this.beaconPath.rebuild(this.reference.beacon), - ]).then((results) => { - const path = results[0]; - const beacon = results[1]; - return this.client.postEmpty(path, { beacon }); - }); - }; - this.referencesPath = referencesPath; - this.beaconPath = beaconPath; - } - withClassName(className) { - this.className = className; - return this; - } -} diff --git a/dist/node/esm/data/referenceDeleter.d.ts b/dist/node/esm/data/referenceDeleter.d.ts deleted file mode 100644 index 9de2f9d3..00000000 --- a/dist/node/esm/data/referenceDeleter.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import Connection from '../connection/index.js'; -import { Reference } from '../openapi/types.js'; -import { BeaconPath } from '../utils/beaconPath.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ReferencesPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class ReferenceDeleter extends CommandBase { - private beaconPath; - private className; - private consistencyLevel?; - private id; - private reference; - private referencesPath; - private refProp; - private tenant?; - constructor(client: Connection, referencesPath: ReferencesPath, beaconPath: BeaconPath); - withId: (id: string) => this; - withClassName(className: string): this; - withReference: (ref: Reference) => this; - withReferenceProperty: (refProp: string) => this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withTenant: (tenant: string) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - payload: () => { - class?: string | undefined; - schema?: - | { - [key: string]: unknown; - } - | undefined; - beacon?: string | undefined; - href?: string | undefined; - classification?: - | { - overallCount?: number | undefined; - winningCount?: number | undefined; - losingCount?: number | undefined; - closestOverallDistance?: number | undefined; - winningDistance?: number | undefined; - meanWinningDistance?: number | undefined; - closestWinningDistance?: number | undefined; - closestLosingDistance?: number | undefined; - losingDistance?: number | undefined; - meanLosingDistance?: number | undefined; - } - | undefined; - }; - do: () => Promise; -} diff --git a/dist/node/esm/data/referenceDeleter.js b/dist/node/esm/data/referenceDeleter.js deleted file mode 100644 index 3ff904e9..00000000 --- a/dist/node/esm/data/referenceDeleter.js +++ /dev/null @@ -1,59 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class ReferenceDeleter extends CommandBase { - constructor(client, referencesPath, beaconPath) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.withReference = (ref) => { - this.reference = ref; - return this; - }; - this.withReferenceProperty = (refProp) => { - this.refProp = refProp; - return this; - }; - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.id, 'id', '.withId(id)'); - this.validateIsSet(this.refProp, 'referenceProperty', '.withReferenceProperty(refProp)'); - }; - this.payload = () => this.reference; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - if (!this.reference.beacon) { - throw new Error('reference beacon must be set'); - } - return Promise.all([ - this.referencesPath.build(this.id, this.className, this.refProp, this.consistencyLevel, this.tenant), - this.beaconPath.rebuild(this.reference.beacon), - ]).then((results) => { - const path = results[0]; - const beacon = results[1]; - return this.client.delete(path, { beacon }, false); - }); - }; - this.referencesPath = referencesPath; - this.beaconPath = beaconPath; - } - withClassName(className) { - this.className = className; - return this; - } -} diff --git a/dist/node/esm/data/referencePayloadBuilder.d.ts b/dist/node/esm/data/referencePayloadBuilder.d.ts deleted file mode 100644 index f0ad91be..00000000 --- a/dist/node/esm/data/referencePayloadBuilder.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Connection from '../connection/index.js'; -import { Reference } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ReferencePayloadBuilder extends CommandBase { - private className?; - private id?; - constructor(client: Connection); - withId: (id: string) => this; - withClassName(className: string): this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - payload: () => Reference; - do(): Promise; -} diff --git a/dist/node/esm/data/referencePayloadBuilder.js b/dist/node/esm/data/referencePayloadBuilder.js deleted file mode 100644 index 89050d8f..00000000 --- a/dist/node/esm/data/referencePayloadBuilder.js +++ /dev/null @@ -1,39 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { isValidStringProperty } from '../validation/string.js'; -export default class ReferencePayloadBuilder extends CommandBase { - constructor(client) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.id, 'id', '.withId(id)'); - }; - this.payload = () => { - this.validate(); - if (this.errors.length > 0) { - throw new Error(this.errors.join(', ')); - } - let beacon = `weaviate://localhost`; - if (isValidStringProperty(this.className)) { - beacon = `${beacon}/${this.className}`; - } - return { - beacon: `${beacon}/${this.id}`, - }; - }; - } - withClassName(className) { - this.className = className; - return this; - } - do() { - return Promise.reject(new Error('Should never be called')); - } -} diff --git a/dist/node/esm/data/referenceReplacer.d.ts b/dist/node/esm/data/referenceReplacer.d.ts deleted file mode 100644 index 855f6299..00000000 --- a/dist/node/esm/data/referenceReplacer.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -import Connection from '../connection/index.js'; -import { BeaconPath } from '../utils/beaconPath.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ReferencesPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class ReferenceReplacer extends CommandBase { - private beaconPath; - private className; - private consistencyLevel?; - private id; - private references; - private referencesPath; - private refProp; - private tenant?; - constructor(client: Connection, referencesPath: ReferencesPath, beaconPath: BeaconPath); - withId: (id: string) => this; - withClassName(className: string): this; - withReferences: (refs: any) => this; - withReferenceProperty: (refProp: string) => this; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - withTenant: (tenant: string) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - payload: () => { - class?: string | undefined; - schema?: - | { - [key: string]: unknown; - } - | undefined; - beacon?: string | undefined; - href?: string | undefined; - classification?: - | { - overallCount?: number | undefined; - winningCount?: number | undefined; - losingCount?: number | undefined; - closestOverallDistance?: number | undefined; - winningDistance?: number | undefined; - meanWinningDistance?: number | undefined; - closestWinningDistance?: number | undefined; - closestLosingDistance?: number | undefined; - losingDistance?: number | undefined; - meanLosingDistance?: number | undefined; - } - | undefined; - }[]; - do: () => Promise; - rebuildReferencePromise(reference: any): Promise<{ - beacon: any; - }>; -} diff --git a/dist/node/esm/data/referenceReplacer.js b/dist/node/esm/data/referenceReplacer.js deleted file mode 100644 index ad46bd19..00000000 --- a/dist/node/esm/data/referenceReplacer.js +++ /dev/null @@ -1,62 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class ReferenceReplacer extends CommandBase { - constructor(client, referencesPath, beaconPath) { - super(client); - this.withId = (id) => { - this.id = id; - return this; - }; - this.withReferences = (refs) => { - this.references = refs; - return this; - }; - this.withReferenceProperty = (refProp) => { - this.refProp = refProp; - return this; - }; - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.id, 'id', '.withId(id)'); - this.validateIsSet(this.refProp, 'referenceProperty', '.withReferenceProperty(refProp)'); - }; - this.payload = () => this.references; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const payloadPromise = Array.isArray(this.references) - ? Promise.all(this.references.map((ref) => this.rebuildReferencePromise(ref))) - : Promise.resolve([]); - return Promise.all([ - this.referencesPath.build(this.id, this.className, this.refProp, this.consistencyLevel, this.tenant), - payloadPromise, - ]).then((results) => { - const path = results[0]; - const payload = results[1]; - return this.client.put(path, payload, false); - }); - }; - this.beaconPath = beaconPath; - this.referencesPath = referencesPath; - } - withClassName(className) { - this.className = className; - return this; - } - rebuildReferencePromise(reference) { - return this.beaconPath.rebuild(reference.beacon).then((beacon) => ({ beacon })); - } -} diff --git a/dist/node/esm/data/replication.d.ts b/dist/node/esm/data/replication.d.ts deleted file mode 100644 index 67600eb6..00000000 --- a/dist/node/esm/data/replication.d.ts +++ /dev/null @@ -1 +0,0 @@ -export type ConsistencyLevel = 'ALL' | 'ONE' | 'QUORUM'; diff --git a/dist/node/esm/data/replication.js b/dist/node/esm/data/replication.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/data/replication.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/data/updater.d.ts b/dist/node/esm/data/updater.d.ts deleted file mode 100644 index 2ed24b15..00000000 --- a/dist/node/esm/data/updater.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import Connection from '../connection/index.js'; -import { Properties, WeaviateObject } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { ObjectsPath } from './path.js'; -import { ConsistencyLevel } from './replication.js'; -export default class Updater extends CommandBase { - private className; - private consistencyLevel?; - private id; - private objectsPath; - private properties?; - private tenant?; - private vector?; - private vectors?; - constructor(client: Connection, objectsPath: ObjectsPath); - withVector: (vector: number[]) => this; - withVectors: (vectors: Record) => this; - withProperties: (properties: Properties) => this; - withId: (id: string) => this; - withClassName: (className: string) => this; - withTenant: (tenant: string) => this; - validateClassName: () => void; - validateId: () => void; - withConsistencyLevel: (cl: ConsistencyLevel) => this; - payload: () => WeaviateObject; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/data/updater.js b/dist/node/esm/data/updater.js deleted file mode 100644 index dd3881dc..00000000 --- a/dist/node/esm/data/updater.js +++ /dev/null @@ -1,67 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { isValidStringProperty } from '../validation/string.js'; -export default class Updater extends CommandBase { - constructor(client, objectsPath) { - super(client); - this.withVector = (vector) => { - this.vector = vector; - return this; - }; - this.withVectors = (vectors) => { - this.vectors = vectors; - return this; - }; - this.withProperties = (properties) => { - this.properties = properties; - return this; - }; - this.withId = (id) => { - this.id = id; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateClassName = () => { - if (!isValidStringProperty(this.className)) { - this.addError('className must be set - use withClassName(className)'); - } - }; - this.validateId = () => { - if (this.id == undefined || this.id == null || this.id.length == 0) { - this.addError('id must be set - initialize with updater(id)'); - } - }; - this.withConsistencyLevel = (cl) => { - this.consistencyLevel = cl; - return this; - }; - this.payload = () => ({ - tenant: this.tenant, - properties: this.properties, - class: this.className, - id: this.id, - vector: this.vector, - vectors: this.vectors, - }); - this.validate = () => { - this.validateClassName(); - this.validateId(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - return this.objectsPath - .buildUpdate(this.id, this.className, this.consistencyLevel) - .then((path) => this.client.put(path, this.payload())); - }; - this.objectsPath = objectsPath; - } -} diff --git a/dist/node/esm/data/validator.d.ts b/dist/node/esm/data/validator.d.ts deleted file mode 100644 index b1b07d56..00000000 --- a/dist/node/esm/data/validator.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import Connection from '../connection/index.js'; -import { Properties } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class Validator extends CommandBase { - private className?; - private id?; - private properties?; - constructor(client: Connection); - withClassName: (className: string) => this; - withProperties: (properties: Properties) => this; - withId: (id: string) => this; - validateClassName: () => void; - payload: () => { - properties: - | { - [key: string]: unknown; - } - | undefined; - class: string | undefined; - id: string | undefined; - }; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/data/validator.js b/dist/node/esm/data/validator.js deleted file mode 100644 index ea0e91b3..00000000 --- a/dist/node/esm/data/validator.js +++ /dev/null @@ -1,40 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { isValidStringProperty } from '../validation/string.js'; -export default class Validator extends CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withProperties = (properties) => { - this.properties = properties; - return this; - }; - this.withId = (id) => { - this.id = id; - return this; - }; - this.validateClassName = () => { - if (!isValidStringProperty(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.payload = () => ({ - properties: this.properties, - class: this.className, - id: this.id, - }); - this.validate = () => { - this.validateClassName(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/objects/validate`; - return this.client.postEmpty(path, this.payload()).then(() => true); - }; - } -} diff --git a/dist/node/esm/errors.d.ts b/dist/node/esm/errors.d.ts deleted file mode 100644 index ef91426d..00000000 --- a/dist/node/esm/errors.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -declare class WeaviateError extends Error { - message: string; - constructor(message: string); -} -/** - * Is thrown if the input to a function is invalid. - */ -export declare class WeaviateInvalidInputError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown if a query (either gRPC or GraphQL) to Weaviate fails in any way. - */ -export declare class WeaviateQueryError extends WeaviateError { - constructor(message: string, protocolType: 'GraphQL' | 'gRPC'); -} -/** - * Is thrown if a gRPC delete many request to Weaviate fails in any way. - */ -export declare class WeaviateDeleteManyError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown if a gRPC batch query to Weaviate fails in any way. - */ -export declare class WeaviateBatchError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown if the gRPC health check against Weaviate fails. - */ -export declare class WeaviateGRPCUnavailableError extends WeaviateError { - constructor(address: string); -} -/** - * Is thrown if data returned by Weaviate cannot be processed by the client. - */ -export declare class WeaviateDeserializationError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown if data to be sent to Weaviate cannot be processed by the client. - */ -export declare class WeaviateSerializationError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown if Weaviate returns an unexpected status code. - */ -export declare class WeaviateUnexpectedStatusCodeError extends WeaviateError { - code: number; - constructor(code: number, message: string); -} -export declare class WeaviateUnexpectedResponseError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown when a backup creation or restoration fails. - */ -export declare class WeaviateBackupFailed extends WeaviateError { - constructor(message: string, kind: 'creation' | 'restoration'); -} -/** - * Is thrown when a backup creation or restoration fails. - */ -export declare class WeaviateBackupCanceled extends WeaviateError { - constructor(kind: 'creation' | 'restoration'); -} -export declare class WeaviateBackupCancellationError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown if the Weaviate server does not support a feature that the client is trying to use. - */ -export declare class WeaviateUnsupportedFeatureError extends WeaviateError {} -/** - * Is thrown if the Weaviate server was not able to start up. - */ -export declare class WeaviateStartUpError extends WeaviateError { - constructor(message: string); -} -/** - * Is thrown if a request to Weaviate times out. - */ -export declare class WeaviateRequestTimeoutError extends WeaviateError { - constructor(message: string); -} -export {}; diff --git a/dist/node/esm/errors.js b/dist/node/esm/errors.js deleted file mode 100644 index dca7d787..00000000 --- a/dist/node/esm/errors.js +++ /dev/null @@ -1,133 +0,0 @@ -class WeaviateError extends Error { - constructor(message) { - super(message); - this.message = message; - this.name = this.constructor.name; - if (typeof Error.captureStackTrace === 'function') { - Error.captureStackTrace(this, this.constructor); - } - } -} -/** - * Is thrown if the input to a function is invalid. - */ -export class WeaviateInvalidInputError extends WeaviateError { - constructor(message) { - super(`Invalid input provided: ${message}`); - } -} -/** - * Is thrown if a query (either gRPC or GraphQL) to Weaviate fails in any way. - */ -export class WeaviateQueryError extends WeaviateError { - constructor(message, protocolType) { - super(`Query call with protocol ${protocolType} failed with message: ${message}`); - } -} -/** - * Is thrown if a gRPC delete many request to Weaviate fails in any way. - */ -export class WeaviateDeleteManyError extends WeaviateError { - constructor(message) { - super(`Delete many failed with message: ${message}`); - } -} -/** - * Is thrown if a gRPC batch query to Weaviate fails in any way. - */ -export class WeaviateBatchError extends WeaviateError { - constructor(message) { - super(`Batch objects insert failed with message: ${message}`); - } -} -/** - * Is thrown if the gRPC health check against Weaviate fails. - */ -export class WeaviateGRPCUnavailableError extends WeaviateError { - constructor(address) { - const grpcMsg = `Please check that the server address and port: ${address} are correct.`; - const msg = `Weaviate makes use of a high-speed gRPC API as well as a REST API. - Unfortunately, the gRPC health check against Weaviate could not be completed. - - This error could be due to one of several reasons: - - The gRPC traffic at the specified port is blocked by a firewall. - - gRPC is not enabled or incorrectly configured on the server or the client. - - ${grpcMsg} - - your connection is unstable or has a high latency. In this case you can: - - increase init-timeout in weaviate.connectToLocal({timeout: {init: X}})' - - disable startup checks by connecting using 'skipInitChecks=true' - `; - super(msg); - } -} -/** - * Is thrown if data returned by Weaviate cannot be processed by the client. - */ -export class WeaviateDeserializationError extends WeaviateError { - constructor(message) { - super(`Converting data from Weaviate failed with message: ${message}`); - } -} -/** - * Is thrown if data to be sent to Weaviate cannot be processed by the client. - */ -export class WeaviateSerializationError extends WeaviateError { - constructor(message) { - super(`Converting data to Weaviate failed with message: ${message}`); - } -} -/** - * Is thrown if Weaviate returns an unexpected status code. - */ -export class WeaviateUnexpectedStatusCodeError extends WeaviateError { - constructor(code, message) { - super(`The request to Weaviate failed with status code: ${code} and message: ${message}`); - this.code = code; - } -} -export class WeaviateUnexpectedResponseError extends WeaviateError { - constructor(message) { - super(`The response from Weaviate was unexpected: ${message}`); - } -} -/** - * Is thrown when a backup creation or restoration fails. - */ -export class WeaviateBackupFailed extends WeaviateError { - constructor(message, kind) { - super(`Backup ${kind} failed with message: ${message}`); - } -} -/** - * Is thrown when a backup creation or restoration fails. - */ -export class WeaviateBackupCanceled extends WeaviateError { - constructor(kind) { - super(`Backup ${kind} was canceled`); - } -} -export class WeaviateBackupCancellationError extends WeaviateError { - constructor(message) { - super(`Backup cancellation failed with message: ${message}`); - } -} -/** - * Is thrown if the Weaviate server does not support a feature that the client is trying to use. - */ -export class WeaviateUnsupportedFeatureError extends WeaviateError {} -/** - * Is thrown if the Weaviate server was not able to start up. - */ -export class WeaviateStartUpError extends WeaviateError { - constructor(message) { - super(`Weaviate startup failed with message: ${message}`); - } -} -/** - * Is thrown if a request to Weaviate times out. - */ -export class WeaviateRequestTimeoutError extends WeaviateError { - constructor(message) { - super(`Weaviate request timed out with message: ${message}`); - } -} diff --git a/dist/node/esm/graphql/aggregator.d.ts b/dist/node/esm/graphql/aggregator.d.ts deleted file mode 100644 index 46a96044..00000000 --- a/dist/node/esm/graphql/aggregator.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -import Connection from '../connection/index.js'; -import { WhereFilter } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { NearAudioArgs, NearDepthArgs, NearIMUArgs, NearMediaBase, NearVideoArgs } from './nearMedia.js'; -import { NearObjectArgs } from './nearObject.js'; -import { NearTextArgs } from './nearText.js'; -import { NearVectorArgs } from './nearVector.js'; -interface NearImageArgs extends NearMediaBase { - image: string; -} -export default class Aggregator extends CommandBase { - private className?; - private fields?; - private groupBy?; - private includesNearMediaFilter; - private limit?; - private nearMediaString?; - private nearMediaType?; - private nearObjectString?; - private nearTextString?; - private nearVectorString?; - private objectLimit?; - private whereString?; - private tenant?; - constructor(client: Connection); - withFields: (fields: string) => this; - withClassName: (className: string) => this; - withWhere: (where: WhereFilter) => this; - private withNearMedia; - withNearImage: (args: NearImageArgs) => this; - withNearAudio: (args: NearAudioArgs) => this; - withNearVideo: (args: NearVideoArgs) => this; - withNearDepth: (args: NearDepthArgs) => this; - withNearIMU: (args: NearIMUArgs) => this; - withNearText: (args: NearTextArgs) => this; - withNearObject: (args: NearObjectArgs) => this; - withNearVector: (args: NearVectorArgs) => this; - withObjectLimit: (objectLimit: number) => this; - withLimit: (limit: number) => this; - withGroupBy: (groupBy: string[]) => this; - withTenant: (tenant: string) => this; - validateGroup: () => void; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - do: () => Promise<{ - data: any; - }>; -} -export {}; diff --git a/dist/node/esm/graphql/aggregator.js b/dist/node/esm/graphql/aggregator.js deleted file mode 100644 index db302e3e..00000000 --- a/dist/node/esm/graphql/aggregator.js +++ /dev/null @@ -1,188 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { isValidPositiveIntProperty } from '../validation/number.js'; -import NearMedia, { NearMediaType } from './nearMedia.js'; -import NearObject from './nearObject.js'; -import NearText from './nearText.js'; -import NearVector from './nearVector.js'; -import Where from './where.js'; -export default class Aggregator extends CommandBase { - constructor(client) { - super(client); - this.withFields = (fields) => { - this.fields = fields; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withWhere = (where) => { - try { - this.whereString = new Where(where).toString(); - } catch (e) { - this.addError(e); - } - return this; - }; - this.withNearMedia = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearMediaString = new NearMedia(args).toString(); - this.nearMediaType = args.type; - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearImage = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { media: args.image, type: NearMediaType.Image }) - ); - }; - this.withNearAudio = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { media: args.audio, type: NearMediaType.Audio }) - ); - }; - this.withNearVideo = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { media: args.video, type: NearMediaType.Video }) - ); - }; - this.withNearDepth = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { media: args.depth, type: NearMediaType.Depth }) - ); - }; - this.withNearIMU = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { media: args.imu, type: NearMediaType.IMU }) - ); - }; - this.withNearText = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearTextString = new NearText(args).toString(); - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearObject = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearObjectString = new NearObject(args).toString(); - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearVector = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearVectorString = new NearVector(args).toString(); - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withObjectLimit = (objectLimit) => { - if (!isValidPositiveIntProperty(objectLimit)) { - throw new Error('objectLimit must be a non-negative integer'); - } - this.objectLimit = objectLimit; - return this; - }; - this.withLimit = (limit) => { - this.limit = limit; - return this; - }; - this.withGroupBy = (groupBy) => { - this.groupBy = groupBy; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateGroup = () => { - if (!this.groupBy) { - // nothing to check if this optional parameter is not set - return; - } - if (!Array.isArray(this.groupBy)) { - throw new Error('groupBy must be an array'); - } - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateGroup(); - this.validateIsSet(this.className, 'className', '.withClassName(className)'); - this.validateIsSet(this.fields, 'fields', '.withFields(fields)'); - }; - this.do = () => { - let params = ''; - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - if ( - this.whereString || - this.nearTextString || - this.nearObjectString || - this.nearVectorString || - this.limit || - this.groupBy || - this.tenant - ) { - let args = []; - if (this.whereString) { - args = [...args, `where:${this.whereString}`]; - } - if (this.nearTextString) { - args = [...args, `nearText:${this.nearTextString}`]; - } - if (this.nearObjectString) { - args = [...args, `nearObject:${this.nearObjectString}`]; - } - if (this.nearVectorString) { - args = [...args, `nearVector:${this.nearVectorString}`]; - } - if (this.nearMediaString) { - args = [...args, `${this.nearMediaType}:${this.nearMediaString}`]; - } - if (this.groupBy) { - args = [...args, `groupBy:${JSON.stringify(this.groupBy)}`]; - } - if (this.limit) { - args = [...args, `limit:${this.limit}`]; - } - if (this.objectLimit) { - args = [...args, `objectLimit:${this.objectLimit}`]; - } - if (this.tenant) { - args = [...args, `tenant:"${this.tenant}"`]; - } - params = `(${args.join(',')})`; - } - return this.client.query(`{Aggregate{${this.className}${params}{${this.fields}}}}`); - }; - this.includesNearMediaFilter = false; - } -} diff --git a/dist/node/esm/graphql/ask.d.ts b/dist/node/esm/graphql/ask.d.ts deleted file mode 100644 index 888bde59..00000000 --- a/dist/node/esm/graphql/ask.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export interface AskArgs { - autocorrect?: boolean; - certainty?: number; - distance?: number; - properties?: string[]; - question?: string; - rerank?: boolean; -} -export default class GraphQLAsk { - private autocorrect?; - private certainty?; - private distance?; - private properties?; - private question?; - private rerank?; - constructor(args: AskArgs); - toString(wrap?: boolean): string; - validate(): void; -} diff --git a/dist/node/esm/graphql/ask.js b/dist/node/esm/graphql/ask.js deleted file mode 100644 index 1acf4ad8..00000000 --- a/dist/node/esm/graphql/ask.js +++ /dev/null @@ -1,41 +0,0 @@ -export default class GraphQLAsk { - constructor(args) { - this.autocorrect = args.autocorrect; - this.certainty = args.certainty; - this.distance = args.distance; - this.properties = args.properties; - this.question = args.question; - this.rerank = args.rerank; - } - toString(wrap = true) { - this.validate(); - let args = []; - if (this.question) { - args = [...args, `question:${JSON.stringify(this.question)}`]; - } - if (this.properties) { - args = [...args, `properties:${JSON.stringify(this.properties)}`]; - } - if (this.certainty) { - args = [...args, `certainty:${this.certainty}`]; - } - if (this.distance) { - args = [...args, `distance:${this.distance}`]; - } - if (this.autocorrect !== undefined) { - args = [...args, `autocorrect:${this.autocorrect}`]; - } - if (this.rerank !== undefined) { - args = [...args, `rerank:${this.rerank}`]; - } - if (!wrap) { - return `${args.join(',')}`; - } - return `{${args.join(',')}}`; - } - validate() { - if (!this.question) { - throw new Error('ask filter: question needs to be set'); - } - } -} diff --git a/dist/node/esm/graphql/bm25.d.ts b/dist/node/esm/graphql/bm25.d.ts deleted file mode 100644 index ffbe1ac9..00000000 --- a/dist/node/esm/graphql/bm25.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface Bm25Args { - properties?: string[]; - query: string; -} -export default class GraphQLBm25 { - private properties?; - private query; - constructor(args: Bm25Args); - toString(): string; -} diff --git a/dist/node/esm/graphql/bm25.js b/dist/node/esm/graphql/bm25.js deleted file mode 100644 index fe2269a2..00000000 --- a/dist/node/esm/graphql/bm25.js +++ /dev/null @@ -1,13 +0,0 @@ -export default class GraphQLBm25 { - constructor(args) { - this.properties = args.properties; - this.query = args.query; - } - toString() { - let args = [`query:${JSON.stringify(this.query)}`]; // query must always be set - if (this.properties !== undefined) { - args = [...args, `properties:${JSON.stringify(this.properties)}`]; - } - return `{${args.join(',')}}`; - } -} diff --git a/dist/node/esm/graphql/explorer.d.ts b/dist/node/esm/graphql/explorer.d.ts deleted file mode 100644 index 9bb646b1..00000000 --- a/dist/node/esm/graphql/explorer.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { AskArgs } from './ask.js'; -import { NearImageArgs } from './nearImage.js'; -import { NearAudioArgs, NearDepthArgs, NearIMUArgs, NearThermalArgs, NearVideoArgs } from './nearMedia.js'; -import { NearObjectArgs } from './nearObject.js'; -import { NearTextArgs } from './nearText.js'; -import { NearVectorArgs } from './nearVector.js'; -export default class Explorer extends CommandBase { - private askString?; - private fields?; - private group?; - private limit?; - private includesNearMediaFilter; - private nearMediaString?; - private nearMediaType?; - private nearObjectString?; - private nearTextString?; - private nearVectorString?; - private params; - constructor(client: Connection); - withFields: (fields: string) => this; - withLimit: (limit: number) => this; - withNearText: (args: NearTextArgs) => this; - withNearObject: (args: NearObjectArgs) => this; - withAsk: (args: AskArgs) => this; - private withNearMedia; - withNearImage: (args: NearImageArgs) => this; - withNearAudio: (args: NearAudioArgs) => this; - withNearVideo: (args: NearVideoArgs) => this; - withNearDepth: (args: NearDepthArgs) => this; - withNearThermal: (args: NearThermalArgs) => this; - withNearIMU: (args: NearIMUArgs) => this; - withNearVector: (args: NearVectorArgs) => this; - validateGroup: () => void; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/graphql/explorer.js b/dist/node/esm/graphql/explorer.js deleted file mode 100644 index c2b80988..00000000 --- a/dist/node/esm/graphql/explorer.js +++ /dev/null @@ -1,162 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import Ask from './ask.js'; -import NearImage from './nearImage.js'; -import NearMedia, { NearMediaType } from './nearMedia.js'; -import NearObject from './nearObject.js'; -import NearText from './nearText.js'; -import NearVector from './nearVector.js'; -export default class Explorer extends CommandBase { - constructor(client) { - super(client); - this.withFields = (fields) => { - this.fields = fields; - return this; - }; - this.withLimit = (limit) => { - this.limit = limit; - return this; - }; - this.withNearText = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearTextString = new NearText(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearObject = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearObjectString = new NearObject(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withAsk = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.askString = new Ask(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearMedia = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearMediaString = new NearMedia(args).toString(); - this.nearMediaType = args.type; - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearImage = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearMediaString = new NearImage(args).toString(); - this.nearMediaType = NearMediaType.Image; - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearAudio = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { media: args.audio, type: NearMediaType.Audio }) - ); - }; - this.withNearVideo = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { media: args.video, type: NearMediaType.Video }) - ); - }; - this.withNearDepth = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { media: args.depth, type: NearMediaType.Depth }) - ); - }; - this.withNearThermal = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { media: args.thermal, type: NearMediaType.Thermal }) - ); - }; - this.withNearIMU = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { media: args.imu, type: NearMediaType.IMU }) - ); - }; - this.withNearVector = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearVectorString = new NearVector(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.validateGroup = () => { - if (!this.group) { - // nothing to check if this optional parameter is not set - return; - } - if (!Array.isArray(this.group)) { - throw new Error('groupBy must be an array'); - } - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.fields, 'fields', '.withFields(fields)'); - }; - this.do = () => { - let params = ''; - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - let args = []; - if (this.nearTextString) { - args = [...args, `nearText:${this.nearTextString}`]; - } - if (this.nearObjectString) { - args = [...args, `nearObject:${this.nearObjectString}`]; - } - if (this.askString) { - args = [...args, `ask:${this.askString}`]; - } - if (this.nearMediaString) { - args = [...args, `${this.nearMediaType}:${this.nearMediaString}`]; - } - if (this.nearVectorString) { - args = [...args, `nearVector:${this.nearVectorString}`]; - } - if (this.limit) { - args = [...args, `limit:${this.limit}`]; - } - params = `(${args.join(',')})`; - return this.client.query(`{Explore${params}{${this.fields}}}`); - }; - this.params = {}; - this.includesNearMediaFilter = false; - } -} diff --git a/dist/node/esm/graphql/generate.d.ts b/dist/node/esm/graphql/generate.d.ts deleted file mode 100644 index cbce8897..00000000 --- a/dist/node/esm/graphql/generate.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -export interface GenerateArgs { - groupedTask?: string; - groupedProperties?: string[]; - singlePrompt?: string; -} -export interface GenerateParts { - singleResult?: string; - groupedResult?: string; - results: string[]; -} -export declare class GraphQLGenerate { - private groupedTask?; - private groupedProperties?; - private singlePrompt?; - constructor(args: GenerateArgs); - toString(): string; - private validate; -} diff --git a/dist/node/esm/graphql/generate.js b/dist/node/esm/graphql/generate.js deleted file mode 100644 index 81402b81..00000000 --- a/dist/node/esm/graphql/generate.js +++ /dev/null @@ -1,40 +0,0 @@ -export class GraphQLGenerate { - constructor(args) { - this.groupedTask = args.groupedTask; - this.groupedProperties = args.groupedProperties; - this.singlePrompt = args.singlePrompt; - } - toString() { - this.validate(); - let str = 'generate('; - const results = ['error']; - if (this.singlePrompt) { - str += `singleResult:{prompt:"${this.singlePrompt.replace(/[\n\r]+/g, '')}"}`; - results.push('singleResult'); - } - if (this.groupedTask || (this.groupedProperties !== undefined && this.groupedProperties.length > 0)) { - const args = []; - if (this.groupedTask) { - args.push(`task:"${this.groupedTask.replace(/[\n\r]+/g, '')}"`); - } - if (this.groupedProperties !== undefined && this.groupedProperties.length > 0) { - args.push(`properties:${JSON.stringify(this.groupedProperties)}`); - } - str += `groupedResult:{${args.join(',')}}`; - results.push('groupedResult'); - } - str += `){${results.join(' ')}}`; - return str; - } - validate() { - if (!this.groupedTask && !this.singlePrompt) { - throw new Error('must provide at least one of `singlePrompt` or `groupTask`'); - } - if (this.groupedTask !== undefined && this.groupedTask == '') { - throw new Error('groupedTask must not be empty'); - } - if (this.singlePrompt !== undefined && this.singlePrompt == '') { - throw new Error('singlePrompt must not be empty'); - } - } -} diff --git a/dist/node/esm/graphql/getter.d.ts b/dist/node/esm/graphql/getter.d.ts deleted file mode 100644 index c31fe66c..00000000 --- a/dist/node/esm/graphql/getter.d.ts +++ /dev/null @@ -1,74 +0,0 @@ -import Connection from '../connection/index.js'; -import { ConsistencyLevel } from '../data/index.js'; -import { WhereFilter } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -import { AskArgs } from './ask.js'; -import { Bm25Args } from './bm25.js'; -import { GenerateArgs } from './generate.js'; -import { GroupArgs } from './group.js'; -import { GroupByArgs } from './groupBy.js'; -import { HybridArgs } from './hybrid.js'; -import { NearImageArgs } from './nearImage.js'; -import { NearAudioArgs, NearDepthArgs, NearIMUArgs, NearThermalArgs, NearVideoArgs } from './nearMedia.js'; -import { NearObjectArgs } from './nearObject.js'; -import { NearTextArgs } from './nearText.js'; -import { NearVectorArgs } from './nearVector.js'; -import { SortArgs } from './sort.js'; -export { FusionType } from './hybrid.js'; -export default class GraphQLGetter extends CommandBase { - private after?; - private askString?; - private bm25String?; - private className?; - private fields?; - private groupString?; - private hybridString?; - private includesNearMediaFilter; - private limit?; - private nearImageNotSet?; - private nearMediaString?; - private nearMediaType?; - private nearObjectString?; - private nearTextString?; - private nearVectorString?; - private offset?; - private sortString?; - private whereString?; - private generateString?; - private consistencyLevel?; - private groupByString?; - private tenant?; - private autocut?; - constructor(client: Connection); - withFields: (fields: string) => this; - withClassName: (className: string) => this; - withAfter: (id: string) => this; - withGroup: (args: GroupArgs) => this; - withWhere: (whereObj: WhereFilter) => this; - withNearText: (args: NearTextArgs) => this; - withBm25: (args: Bm25Args) => this; - withHybrid: (args: HybridArgs) => this; - withNearObject: (args: NearObjectArgs) => this; - withAsk: (askObj: AskArgs) => this; - private withNearMedia; - withNearImage: (args: NearImageArgs) => this; - withNearAudio: (args: NearAudioArgs) => this; - withNearVideo: (args: NearVideoArgs) => this; - withNearThermal: (args: NearThermalArgs) => this; - withNearDepth: (args: NearDepthArgs) => this; - withNearIMU: (args: NearIMUArgs) => this; - withNearVector: (args: NearVectorArgs) => this; - withLimit: (limit: number) => this; - withOffset: (offset: number) => this; - withAutocut: (autocut: number) => this; - withSort: (args: SortArgs[]) => this; - withGenerate: (args: GenerateArgs) => this; - withConsistencyLevel: (level: ConsistencyLevel) => this; - withGroupBy: (args: GroupByArgs) => this; - withTenant: (tenant: string) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - do: () => Promise<{ - data: any; - }>; -} diff --git a/dist/node/esm/graphql/getter.js b/dist/node/esm/graphql/getter.js deleted file mode 100644 index f957d3cd..00000000 --- a/dist/node/esm/graphql/getter.js +++ /dev/null @@ -1,275 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import Ask from './ask.js'; -import Bm25 from './bm25.js'; -import { GraphQLGenerate } from './generate.js'; -import Group from './group.js'; -import GroupBy from './groupBy.js'; -import Hybrid from './hybrid.js'; -import NearImage from './nearImage.js'; -import NearMedia, { NearMediaType } from './nearMedia.js'; -import NearObject from './nearObject.js'; -import NearText from './nearText.js'; -import NearVector from './nearVector.js'; -import Sort from './sort.js'; -import Where from './where.js'; -export { FusionType } from './hybrid.js'; -export default class GraphQLGetter extends CommandBase { - constructor(client) { - super(client); - this.withFields = (fields) => { - this.fields = fields; - return this; - }; - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withAfter = (id) => { - this.after = id; - return this; - }; - this.withGroup = (args) => { - try { - this.groupString = new Group(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withWhere = (whereObj) => { - try { - this.whereString = new Where(whereObj).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearText = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - this.nearTextString = new NearText(args).toString(); - this.includesNearMediaFilter = true; - return this; - }; - this.withBm25 = (args) => { - try { - this.bm25String = new Bm25(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withHybrid = (args) => { - try { - this.hybridString = new Hybrid(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearObject = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearObjectString = new NearObject(args).toString(); - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withAsk = (askObj) => { - try { - this.askString = new Ask(askObj).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearMedia = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearMediaString = new NearMedia(args).toString(); - this.nearMediaType = args.type; - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearImage = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearMediaString = new NearImage(args).toString(); - this.nearMediaType = NearMediaType.Image; - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withNearAudio = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { type: NearMediaType.Audio, media: args.audio }) - ); - }; - this.withNearVideo = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { type: NearMediaType.Video, media: args.video }) - ); - }; - this.withNearThermal = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { type: NearMediaType.Thermal, media: args.thermal }) - ); - }; - this.withNearDepth = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { type: NearMediaType.Depth, media: args.depth }) - ); - }; - this.withNearIMU = (args) => { - return this.withNearMedia( - Object.assign(Object.assign({}, args), { type: NearMediaType.IMU, media: args.imu }) - ); - }; - this.withNearVector = (args) => { - if (this.includesNearMediaFilter) { - throw new Error('cannot use multiple near filters in a single query'); - } - try { - this.nearVectorString = new NearVector(args).toString(); - this.includesNearMediaFilter = true; - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withLimit = (limit) => { - this.limit = limit; - return this; - }; - this.withOffset = (offset) => { - this.offset = offset; - return this; - }; - this.withAutocut = (autocut) => { - this.autocut = autocut; - return this; - }; - this.withSort = (args) => { - this.sortString = new Sort(args).toString(); - return this; - }; - this.withGenerate = (args) => { - this.generateString = new GraphQLGenerate(args).toString(); - return this; - }; - this.withConsistencyLevel = (level) => { - this.consistencyLevel = level; - return this; - }; - this.withGroupBy = (args) => { - try { - this.groupByString = new GroupBy(args).toString(); - } catch (e) { - this.addError(e.toString()); - } - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.className, 'className', '.withClassName(className)'); - this.validateIsSet(this.fields, 'fields', '.withFields(fields)'); - }; - this.do = () => { - var _a, _b; - let params = ''; - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - let args = []; - if (this.whereString) { - args = [...args, `where:${this.whereString}`]; - } - if (this.nearTextString) { - args = [...args, `nearText:${this.nearTextString}`]; - } - if (this.nearObjectString) { - args = [...args, `nearObject:${this.nearObjectString}`]; - } - if (this.askString) { - args = [...args, `ask:${this.askString}`]; - } - if (this.nearMediaString) { - args = [...args, `near${this.nearMediaType}:${this.nearMediaString}`]; - } - if (this.nearVectorString) { - args = [...args, `nearVector:${this.nearVectorString}`]; - } - if (this.bm25String) { - args = [...args, `bm25:${this.bm25String}`]; - } - if (this.hybridString) { - args = [...args, `hybrid:${this.hybridString}`]; - } - if (this.groupString) { - args = [...args, `group:${this.groupString}`]; - } - if (this.limit) { - args = [...args, `limit:${this.limit}`]; - } - if (this.offset) { - args = [...args, `offset:${this.offset}`]; - } - if (this.autocut) { - args = [...args, `autocut:${this.autocut}`]; - } - if (this.sortString) { - args = [...args, `sort:[${this.sortString}]`]; - } - if (this.after) { - args = [...args, `after:"${this.after}"`]; - } - if (this.generateString) { - if ((_a = this.fields) === null || _a === void 0 ? void 0 : _a.includes('_additional')) { - this.fields.replace('_additional{', `_additional{${this.generateString}`); - } else { - this.fields = - (_b = this.fields) === null || _b === void 0 - ? void 0 - : _b.concat(` _additional{${this.generateString}}`); - } - } - if (this.consistencyLevel) { - args = [...args, `consistencyLevel:${this.consistencyLevel}`]; - } - if (this.groupByString) { - args = [...args, `groupBy:${this.groupByString}`]; - } - if (this.tenant) { - args = [...args, `tenant:"${this.tenant}"`]; - } - if (args.length > 0) { - params = `(${args.join(',')})`; - } - return this.client.query(`{Get{${this.className}${params}{${this.fields}}}}`); - }; - this.includesNearMediaFilter = false; - } -} diff --git a/dist/node/esm/graphql/group.d.ts b/dist/node/esm/graphql/group.d.ts deleted file mode 100644 index ddd1b3bd..00000000 --- a/dist/node/esm/graphql/group.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export interface GroupArgs { - type: string; - force: number; -} -export default class GraphQLGroup { - private args; - constructor(args: GroupArgs); - toString(): string; -} diff --git a/dist/node/esm/graphql/group.js b/dist/node/esm/graphql/group.js deleted file mode 100644 index 7f215ca7..00000000 --- a/dist/node/esm/graphql/group.js +++ /dev/null @@ -1,16 +0,0 @@ -export default class GraphQLGroup { - constructor(args) { - this.args = args; - } - toString() { - let parts = []; - if (this.args.type) { - // value is a graphQL enum, so doesn't need to be quoted - parts = [...parts, `type:${this.args.type}`]; - } - if (this.args.force) { - parts = [...parts, `force:${this.args.force}`]; - } - return `{${parts.join(',')}}`; - } -} diff --git a/dist/node/esm/graphql/groupBy.d.ts b/dist/node/esm/graphql/groupBy.d.ts deleted file mode 100644 index 0dfdacaf..00000000 --- a/dist/node/esm/graphql/groupBy.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface GroupByArgs { - path: string[]; - groups: number; - objectsPerGroup: number; -} -export default class GraphQLGroupBy { - private args; - constructor(args: GroupByArgs); - toString(): string; -} diff --git a/dist/node/esm/graphql/groupBy.js b/dist/node/esm/graphql/groupBy.js deleted file mode 100644 index e171c86b..00000000 --- a/dist/node/esm/graphql/groupBy.js +++ /dev/null @@ -1,18 +0,0 @@ -export default class GraphQLGroupBy { - constructor(args) { - this.args = args; - } - toString() { - let parts = []; - if (this.args.path) { - parts = [...parts, `path:${JSON.stringify(this.args.path)}`]; - } - if (this.args.groups) { - parts = [...parts, `groups:${this.args.groups}`]; - } - if (this.args.objectsPerGroup) { - parts = [...parts, `objectsPerGroup:${this.args.objectsPerGroup}`]; - } - return `{${parts.join(',')}}`; - } -} diff --git a/dist/node/esm/graphql/hybrid.d.ts b/dist/node/esm/graphql/hybrid.d.ts deleted file mode 100644 index 7769abb2..00000000 --- a/dist/node/esm/graphql/hybrid.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Move } from './nearText.js'; -export interface HybridArgs { - alpha?: number; - query: string; - vector?: number[]; - properties?: string[]; - targetVectors?: string[]; - fusionType?: FusionType; - searches?: HybridSubSearch[]; -} -export interface NearTextSubSearch { - concepts: string[]; - certainty?: number; - distance?: number; - moveAwayFrom?: Move; - moveTo?: Move; -} -export interface NearVectorSubSearch { - vector: number[]; - certainty?: number; - distance?: number; - targetVectors?: string[]; -} -export interface HybridSubSearch { - nearText?: NearTextSubSearch; - nearVector?: NearVectorSubSearch; -} -export declare enum FusionType { - rankedFusion = 'rankedFusion', - relativeScoreFusion = 'relativeScoreFusion', -} -export default class GraphQLHybrid { - private alpha?; - private query; - private vector?; - private properties?; - private targetVectors?; - private fusionType?; - private searches?; - constructor(args: HybridArgs); - toString(): string; -} diff --git a/dist/node/esm/graphql/hybrid.js b/dist/node/esm/graphql/hybrid.js deleted file mode 100644 index 9a9e3372..00000000 --- a/dist/node/esm/graphql/hybrid.js +++ /dev/null @@ -1,82 +0,0 @@ -import { parseMove } from './nearText.js'; -export var FusionType; -(function (FusionType) { - FusionType['rankedFusion'] = 'rankedFusion'; - FusionType['relativeScoreFusion'] = 'relativeScoreFusion'; -})(FusionType || (FusionType = {})); -class GraphQLHybridSubSearch { - constructor(args) { - this.nearText = args.nearText; - this.nearVector = args.nearVector; - } - toString() { - let outer = []; - if (this.nearText !== undefined) { - let inner = [`concepts:${JSON.stringify(this.nearText.concepts)}`]; - if (this.nearText.certainty) { - inner = [...inner, `certainty:${this.nearText.certainty}`]; - } - if (this.nearText.distance) { - inner = [...inner, `distance:${this.nearText.distance}`]; - } - if (this.nearText.moveTo) { - inner = [...inner, parseMove('moveTo', this.nearText.moveTo)]; - } - if (this.nearText.moveAwayFrom) { - inner = [...inner, parseMove('moveAwayFrom', this.nearText.moveAwayFrom)]; - } - outer = [...outer, `nearText:{${inner.join(',')}}`]; - } - if (this.nearVector !== undefined) { - let inner = [`vector:${JSON.stringify(this.nearVector.vector)}`]; - if (this.nearVector.certainty) { - inner = [...inner, `certainty:${this.nearVector.certainty}`]; - } - if (this.nearVector.distance) { - inner = [...inner, `distance:${this.nearVector.distance}`]; - } - if (this.nearVector.targetVectors && this.nearVector.targetVectors.length > 0) { - inner = [...inner, `targetVectors:${JSON.stringify(this.nearVector.targetVectors)}`]; - } - outer = [...outer, `nearVector:{${inner.join(',')}}`]; - } - return `{${outer.join(',')}}`; - } -} -export default class GraphQLHybrid { - constructor(args) { - var _a; - this.alpha = args.alpha; - this.query = args.query; - this.vector = args.vector; - this.properties = args.properties; - this.targetVectors = args.targetVectors; - this.fusionType = args.fusionType; - this.searches = - (_a = args.searches) === null || _a === void 0 - ? void 0 - : _a.map((search) => new GraphQLHybridSubSearch(search)); - } - toString() { - let args = [`query:${JSON.stringify(this.query)}`]; // query must always be set - if (this.alpha !== undefined) { - args = [...args, `alpha:${JSON.stringify(this.alpha)}`]; - } - if (this.vector !== undefined) { - args = [...args, `vector:${JSON.stringify(this.vector)}`]; - } - if (this.properties && this.properties.length > 0) { - args = [...args, `properties:${JSON.stringify(this.properties)}`]; - } - if (this.targetVectors && this.targetVectors.length > 0) { - args = [...args, `targetVectors:${JSON.stringify(this.targetVectors)}`]; - } - if (this.fusionType !== undefined) { - args = [...args, `fusionType:${this.fusionType}`]; - } - if (this.searches !== undefined) { - args = [...args, `searches:[${this.searches.map((search) => search.toString()).join(',')}]`]; - } - return `{${args.join(',')}}`; - } -} diff --git a/dist/node/esm/graphql/index.d.ts b/dist/node/esm/graphql/index.d.ts deleted file mode 100644 index 5af5ffe5..00000000 --- a/dist/node/esm/graphql/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import Connection from '../connection/index.js'; -import Aggregator from './aggregator.js'; -import Explorer from './explorer.js'; -import GraphQLGetter from './getter.js'; -import Raw from './raw.js'; -export interface GraphQL { - get: () => GraphQLGetter; - aggregate: () => Aggregator; - explore: () => Explorer; - raw: () => Raw; -} -declare const graphql: (client: Connection) => GraphQL; -export default graphql; -export { default as Aggregator } from './aggregator.js'; -export { default as Explorer } from './explorer.js'; -export { FusionType, default as GraphQLGetter } from './getter.js'; -export { default as Raw } from './raw.js'; diff --git a/dist/node/esm/graphql/index.js b/dist/node/esm/graphql/index.js deleted file mode 100644 index b4b2eb41..00000000 --- a/dist/node/esm/graphql/index.js +++ /dev/null @@ -1,17 +0,0 @@ -import Aggregator from './aggregator.js'; -import Explorer from './explorer.js'; -import GraphQLGetter from './getter.js'; -import Raw from './raw.js'; -const graphql = (client) => { - return { - get: () => new GraphQLGetter(client), - aggregate: () => new Aggregator(client), - explore: () => new Explorer(client), - raw: () => new Raw(client), - }; -}; -export default graphql; -export { default as Aggregator } from './aggregator.js'; -export { default as Explorer } from './explorer.js'; -export { FusionType, default as GraphQLGetter } from './getter.js'; -export { default as Raw } from './raw.js'; diff --git a/dist/node/esm/graphql/nearImage.d.ts b/dist/node/esm/graphql/nearImage.d.ts deleted file mode 100644 index 7abd4c5f..00000000 --- a/dist/node/esm/graphql/nearImage.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { NearMediaBase } from './nearMedia.js'; -export interface NearImageArgs extends NearMediaBase { - image?: string; - targetVectors?: string[]; -} -export default class GraphQLNearImage { - private certainty?; - private distance?; - private image?; - private targetVectors?; - constructor(args: NearImageArgs); - toString(wrap?: boolean): string; - validate(): void; -} diff --git a/dist/node/esm/graphql/nearImage.js b/dist/node/esm/graphql/nearImage.js deleted file mode 100644 index 3c5214fb..00000000 --- a/dist/node/esm/graphql/nearImage.js +++ /dev/null @@ -1,38 +0,0 @@ -export default class GraphQLNearImage { - constructor(args) { - this.certainty = args.certainty; - this.distance = args.distance; - this.image = args.image; - this.targetVectors = args.targetVectors; - } - toString(wrap = true) { - this.validate(); - let args = []; - if (this.image) { - let img = this.image; - if (img.startsWith('data:')) { - const base64part = ';base64,'; - img = img.substring(img.indexOf(base64part) + base64part.length); - } - args = [...args, `image:${JSON.stringify(img)}`]; - } - if (this.certainty) { - args = [...args, `certainty:${this.certainty}`]; - } - if (this.distance) { - args = [...args, `distance:${this.distance}`]; - } - if (this.targetVectors && this.targetVectors.length > 0) { - args = [...args, `targetVectors:${JSON.stringify(this.targetVectors)}`]; - } - if (!wrap) { - return `${args.join(',')}`; - } - return `{${args.join(',')}}`; - } - validate() { - if (!this.image) { - throw new Error('nearImage filter: image field must be present'); - } - } -} diff --git a/dist/node/esm/graphql/nearMedia.d.ts b/dist/node/esm/graphql/nearMedia.d.ts deleted file mode 100644 index 51faeed4..00000000 --- a/dist/node/esm/graphql/nearMedia.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -export interface NearMediaBase { - certainty?: number; - distance?: number; - targetVectors?: string[]; -} -export interface NearMediaArgs extends NearMediaBase { - media: string; - type: NearMediaType; -} -export interface NearImageArgs extends NearMediaBase { - image: string; -} -export interface NearAudioArgs extends NearMediaBase { - audio: string; -} -export interface NearVideoArgs extends NearMediaBase { - video: string; -} -export interface NearThermalArgs extends NearMediaBase { - thermal: string; -} -export interface NearDepthArgs extends NearMediaBase { - depth: string; -} -export interface NearIMUArgs extends NearMediaBase { - imu: string; -} -export declare enum NearMediaType { - Image = 'Image', - Audio = 'Audio', - Video = 'Video', - Thermal = 'Thermal', - Depth = 'Depth', - IMU = 'IMU', -} -export default class GraphQLNearMedia { - private certainty?; - private distance?; - private media; - private type; - private targetVectors?; - constructor(args: NearMediaArgs); - toString(wrap?: boolean): string; -} diff --git a/dist/node/esm/graphql/nearMedia.js b/dist/node/esm/graphql/nearMedia.js deleted file mode 100644 index c1402f68..00000000 --- a/dist/node/esm/graphql/nearMedia.js +++ /dev/null @@ -1,39 +0,0 @@ -export var NearMediaType; -(function (NearMediaType) { - NearMediaType['Image'] = 'Image'; - NearMediaType['Audio'] = 'Audio'; - NearMediaType['Video'] = 'Video'; - NearMediaType['Thermal'] = 'Thermal'; - NearMediaType['Depth'] = 'Depth'; - NearMediaType['IMU'] = 'IMU'; -})(NearMediaType || (NearMediaType = {})); -export default class GraphQLNearMedia { - constructor(args) { - this.certainty = args.certainty; - this.distance = args.distance; - this.media = args.media; - this.type = args.type; - this.targetVectors = args.targetVectors; - } - toString(wrap = true) { - let args = []; - if (this.media.startsWith('data:')) { - const base64part = ';base64,'; - this.media = this.media.substring(this.media.indexOf(base64part) + base64part.length); - } - args = [...args, `${this.type.toLowerCase()}:${JSON.stringify(this.media)}`]; - if (this.certainty) { - args = [...args, `certainty:${this.certainty}`]; - } - if (this.distance) { - args = [...args, `distance:${this.distance}`]; - } - if (this.targetVectors && this.targetVectors.length > 0) { - args = [...args, `targetVectors:${JSON.stringify(this.targetVectors)}`]; - } - if (!wrap) { - return `${args.join(',')}`; - } - return `{${args.join(',')}}`; - } -} diff --git a/dist/node/esm/graphql/nearObject.d.ts b/dist/node/esm/graphql/nearObject.d.ts deleted file mode 100644 index 08d855ae..00000000 --- a/dist/node/esm/graphql/nearObject.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export interface NearObjectArgs { - beacon?: string; - certainty?: number; - distance?: number; - id?: string; - targetVectors?: string[]; -} -export default class GraphQLNearObject { - private beacon?; - private certainty?; - private distance?; - private id?; - private targetVectors?; - constructor(args: NearObjectArgs); - toString(wrap?: boolean): string; - validate(): void; -} diff --git a/dist/node/esm/graphql/nearObject.js b/dist/node/esm/graphql/nearObject.js deleted file mode 100644 index b694256b..00000000 --- a/dist/node/esm/graphql/nearObject.js +++ /dev/null @@ -1,37 +0,0 @@ -export default class GraphQLNearObject { - constructor(args) { - this.beacon = args.beacon; - this.certainty = args.certainty; - this.distance = args.distance; - this.id = args.id; - this.targetVectors = args.targetVectors; - } - toString(wrap = true) { - this.validate(); - let args = []; - if (this.id) { - args = [...args, `id:${JSON.stringify(this.id)}`]; - } - if (this.beacon) { - args = [...args, `beacon:${JSON.stringify(this.beacon)}`]; - } - if (this.certainty) { - args = [...args, `certainty:${this.certainty}`]; - } - if (this.distance) { - args = [...args, `distance:${this.distance}`]; - } - if (this.targetVectors && this.targetVectors.length > 0) { - args = [...args, `targetVectors:${JSON.stringify(this.targetVectors)}`]; - } - if (!wrap) { - return `${args.join(',')}`; - } - return `{${args.join(',')}}`; - } - validate() { - if (!this.id && !this.beacon) { - throw new Error('nearObject filter: id or beacon needs to be set'); - } - } -} diff --git a/dist/node/esm/graphql/nearText.d.ts b/dist/node/esm/graphql/nearText.d.ts deleted file mode 100644 index ce753ad7..00000000 --- a/dist/node/esm/graphql/nearText.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -export interface NearTextArgs { - autocorrect?: boolean; - certainty?: number; - concepts: string[]; - distance?: number; - moveAwayFrom?: Move; - moveTo?: Move; - targetVectors?: string[]; -} -export interface Move { - objects?: MoveObject[]; - concepts?: string[]; - force?: number; -} -export interface MoveObject { - beacon?: string; - id?: string; -} -export default class GraphQLNearText { - private autocorrect?; - private certainty?; - private concepts; - private distance?; - private moveAwayFrom?; - private moveTo?; - private targetVectors?; - constructor(args: NearTextArgs); - toString(): string; - validate(): void; -} -type MoveType = 'moveTo' | 'moveAwayFrom'; -export declare function parseMoveObjects(move: MoveType, objects: MoveObject[]): string; -export declare function parseMove(move: MoveType, args: Move): string; -export {}; diff --git a/dist/node/esm/graphql/nearText.js b/dist/node/esm/graphql/nearText.js deleted file mode 100644 index 6495249c..00000000 --- a/dist/node/esm/graphql/nearText.js +++ /dev/null @@ -1,82 +0,0 @@ -export default class GraphQLNearText { - constructor(args) { - this.autocorrect = args.autocorrect; - this.certainty = args.certainty; - this.concepts = args.concepts; - this.distance = args.distance; - this.moveAwayFrom = args.moveAwayFrom; - this.moveTo = args.moveTo; - this.targetVectors = args.targetVectors; - } - toString() { - this.validate(); - let args = [`concepts:${JSON.stringify(this.concepts)}`]; - if (this.certainty) { - args = [...args, `certainty:${this.certainty}`]; - } - if (this.distance) { - args = [...args, `distance:${this.distance}`]; - } - if (this.targetVectors && this.targetVectors.length > 0) { - args = [...args, `targetVectors:${JSON.stringify(this.targetVectors)}`]; - } - if (this.moveTo) { - args = [...args, parseMove('moveTo', this.moveTo)]; - } - if (this.moveAwayFrom) { - args = [...args, parseMove('moveAwayFrom', this.moveAwayFrom)]; - } - if (this.autocorrect !== undefined) { - args = [...args, `autocorrect:${this.autocorrect}`]; - } - return `{${args.join(',')}}`; - } - validate() { - if (this.moveTo) { - if (!this.moveTo.concepts && !this.moveTo.objects) { - throw new Error('nearText filter: moveTo.concepts or moveTo.objects must be present'); - } - if (!this.moveTo.force || (!this.moveTo.concepts && !this.moveTo.objects)) { - throw new Error("nearText filter: moveTo must have fields 'concepts' or 'objects' and 'force'"); - } - } - if (this.moveAwayFrom) { - if (!this.moveAwayFrom.concepts && !this.moveAwayFrom.objects) { - throw new Error('nearText filter: moveAwayFrom.concepts or moveAwayFrom.objects must be present'); - } - if (!this.moveAwayFrom.force || (!this.moveAwayFrom.concepts && !this.moveAwayFrom.objects)) { - throw new Error("nearText filter: moveAwayFrom must have fields 'concepts' or 'objects' and 'force'"); - } - } - } -} -export function parseMoveObjects(move, objects) { - const moveObjects = []; - for (const i in objects) { - if (!objects[i].id && !objects[i].beacon) { - throw new Error(`nearText: ${move}.objects[${i}].id or ${move}.objects[${i}].beacon must be present`); - } - const objs = []; - if (objects[i].id) { - objs.push(`id:"${objects[i].id}"`); - } - if (objects[i].beacon) { - objs.push(`beacon:"${objects[i].beacon}"`); - } - moveObjects.push(`{${objs.join(',')}}`); - } - return `[${moveObjects.join(',')}]`; -} -export function parseMove(move, args) { - let moveArgs = []; - if (args.concepts) { - moveArgs = [...moveArgs, `concepts:${JSON.stringify(args.concepts)}`]; - } - if (args.objects) { - moveArgs = [...moveArgs, `objects:${parseMoveObjects(move, args.objects)}`]; - } - if (args.force) { - moveArgs = [...moveArgs, `force:${args.force}`]; - } - return `${move}:{${moveArgs.join(',')}}`; -} diff --git a/dist/node/esm/graphql/nearVector.d.ts b/dist/node/esm/graphql/nearVector.d.ts deleted file mode 100644 index 9e79d448..00000000 --- a/dist/node/esm/graphql/nearVector.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -export interface NearVectorArgs { - certainty?: number; - distance?: number; - vector: number[]; - targetVectors?: string[]; -} -export default class GraphQLNearVector { - private certainty?; - private distance?; - private vector; - private targetVectors?; - constructor(args: NearVectorArgs); - toString(wrap?: boolean): string; -} diff --git a/dist/node/esm/graphql/nearVector.js b/dist/node/esm/graphql/nearVector.js deleted file mode 100644 index 3c33fddc..00000000 --- a/dist/node/esm/graphql/nearVector.js +++ /dev/null @@ -1,24 +0,0 @@ -export default class GraphQLNearVector { - constructor(args) { - this.certainty = args.certainty; - this.distance = args.distance; - this.vector = args.vector; - this.targetVectors = args.targetVectors; - } - toString(wrap = true) { - let args = [`vector:${JSON.stringify(this.vector)}`]; // vector must always be set - if (this.certainty) { - args = [...args, `certainty:${this.certainty}`]; - } - if (this.distance) { - args = [...args, `distance:${this.distance}`]; - } - if (this.targetVectors && this.targetVectors.length > 0) { - args = [...args, `targetVectors:${JSON.stringify(this.targetVectors)}`]; - } - if (!wrap) { - return `${args.join(',')}`; - } - return `{${args.join(',')}}`; - } -} diff --git a/dist/node/esm/graphql/raw.d.ts b/dist/node/esm/graphql/raw.d.ts deleted file mode 100644 index e5cc42cd..00000000 --- a/dist/node/esm/graphql/raw.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class RawGraphQL extends CommandBase { - private query?; - constructor(client: Connection); - withQuery: (query: string) => this; - validateIsSet: (prop: string | undefined | null, name: string, setter: string) => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/graphql/raw.js b/dist/node/esm/graphql/raw.js deleted file mode 100644 index abe19971..00000000 --- a/dist/node/esm/graphql/raw.js +++ /dev/null @@ -1,29 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class RawGraphQL extends CommandBase { - constructor(client) { - super(client); - this.withQuery = (query) => { - this.query = query; - return this; - }; - this.validateIsSet = (prop, name, setter) => { - if (prop == undefined || prop == null || prop.length == 0) { - this.addError(`${name} must be set - set with ${setter}`); - } - }; - this.validate = () => { - this.validateIsSet(this.query, 'query', '.raw().withQuery(query)'); - }; - this.do = () => { - const params = ''; - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - if (this.query) { - return this.client.query(this.query); - } - return Promise.resolve(undefined); - }; - } -} diff --git a/dist/node/esm/graphql/sort.d.ts b/dist/node/esm/graphql/sort.d.ts deleted file mode 100644 index 78ac62c2..00000000 --- a/dist/node/esm/graphql/sort.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface SortArgs { - path: string[]; - order?: string; -} -export type SortOrder = 'asc' | 'desc'; -export default class GraphQLSort { - private args; - constructor(args: SortArgs[]); - toString(): string; -} diff --git a/dist/node/esm/graphql/sort.js b/dist/node/esm/graphql/sort.js deleted file mode 100644 index 5cb50ac2..00000000 --- a/dist/node/esm/graphql/sort.js +++ /dev/null @@ -1,18 +0,0 @@ -export default class GraphQLSort { - constructor(args) { - this.args = args; - } - toString() { - const parts = []; - for (const arg of this.args) { - let part = `{path:${JSON.stringify(arg.path)}`; - if (arg.order) { - part = part.concat(`,order:${arg.order}}`); - } else { - part = part.concat('}'); - } - parts.push(part); - } - return parts.join(','); - } -} diff --git a/dist/node/esm/graphql/where.d.ts b/dist/node/esm/graphql/where.d.ts deleted file mode 100644 index c48be8a8..00000000 --- a/dist/node/esm/graphql/where.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { WhereFilter } from '../openapi/types.js'; -export default class GraphQLWhere { - private operands?; - private operator?; - private path?; - private readonly source; - private valueContent; - private valueType?; - constructor(whereObj: WhereFilter); - toString(): string; - marshalValueContent(): string; - getValueType(): string | undefined; - marshalValueGeoRange(): string; - validate(): void; - parse(): void; - parseOperator(op: string): void; - parsePath(path: string[]): void; - parseValue(key: string, value: any): void; - parseOperands(ops: any[]): void; -} diff --git a/dist/node/esm/graphql/where.js b/dist/node/esm/graphql/where.js deleted file mode 100644 index 07d346b7..00000000 --- a/dist/node/esm/graphql/where.js +++ /dev/null @@ -1,154 +0,0 @@ -export default class GraphQLWhere { - constructor(whereObj) { - this.source = whereObj; - } - toString() { - this.parse(); - this.validate(); - if (this.operands) { - return `{operator:${this.operator},operands:[${this.operands}]}`; - } else { - // this is an on-value filter - const valueType = this.getValueType(); - const valueContent = this.marshalValueContent(); - return ( - `{` + - `operator:${this.operator},` + - `${valueType}:${valueContent},` + - `path:${JSON.stringify(this.path)}` + - `}` - ); - } - } - marshalValueContent() { - if (this.valueType == 'valueGeoRange') { - return this.marshalValueGeoRange(); - } - return JSON.stringify(this.valueContent); - } - getValueType() { - switch (this.valueType) { - case 'valueStringArray': { - return 'valueString'; - } - case 'valueTextArray': { - return 'valueText'; - } - case 'valueIntArray': { - return 'valueInt'; - } - case 'valueNumberArray': { - return 'valueNumber'; - } - case 'valueDateArray': { - return 'valueDate'; - } - case 'valueBooleanArray': { - return 'valueBoolean'; - } - default: { - return this.valueType; - } - } - } - marshalValueGeoRange() { - let parts = []; - const gc = this.valueContent.geoCoordinates; - if (gc) { - let gcParts = []; - if (gc.latitude) { - gcParts = [...gcParts, `latitude:${gc.latitude}`]; - } - if (gc.longitude) { - gcParts = [...gcParts, `longitude:${gc.longitude}`]; - } - parts = [...parts, `geoCoordinates:{${gcParts.join(',')}}`]; - } - const d = this.valueContent.distance; - if (d) { - let dParts = []; - if (d.max) { - dParts = [...dParts, `max:${d.max}`]; - } - parts = [...parts, `distance:{${dParts.join(',')}}`]; - } - return `{${parts.join(',')}}`; - } - validate() { - if (!this.operator) { - throw new Error('where filter: operator cannot be empty'); - } - if (!this.operands) { - if (!this.valueType) { - throw new Error('where filter: value cannot be empty'); - } - if (!this.path) { - throw new Error('where filter: path cannot be empty'); - } - } - } - parse() { - for (const key in this.source) { - switch (key) { - case 'operator': - this.parseOperator(this.source[key]); - break; - case 'operands': - this.parseOperands(this.source[key]); - break; - case 'path': - this.parsePath(this.source[key]); - break; - default: - if (key.indexOf('value') != 0) { - throw new Error("where filter: unrecognized key '" + key + "'"); - } - this.parseValue(key, this.source[key]); - } - } - } - parseOperator(op) { - if (typeof op !== 'string') { - throw new Error('where filter: operator must be a string'); - } - this.operator = op; - } - parsePath(path) { - if (!Array.isArray(path)) { - throw new Error('where filter: path must be an array'); - } - this.path = path; - } - parseValue(key, value) { - switch (key) { - case 'valueString': - case 'valueText': - case 'valueInt': - case 'valueNumber': - case 'valueDate': - case 'valueBoolean': - case 'valueStringArray': - case 'valueTextArray': - case 'valueIntArray': - case 'valueNumberArray': - case 'valueDateArray': - case 'valueBooleanArray': - case 'valueGeoRange': - break; - default: - throw new Error("where filter: unrecognized value prop '" + key + "'"); - } - this.valueType = key; - this.valueContent = value; - } - parseOperands(ops) { - if (!Array.isArray(ops)) { - throw new Error('where filter: operands must be an array'); - } - this.operands = ops - .map((element) => { - return new GraphQLWhere(element).toString(); - }) - .join(','); - } -} diff --git a/dist/node/esm/grpc/base.d.ts b/dist/node/esm/grpc/base.d.ts deleted file mode 100644 index 8b82dff2..00000000 --- a/dist/node/esm/grpc/base.d.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Metadata } from 'nice-grpc'; -import { RetryOptions } from 'nice-grpc-client-middleware-retry'; -import { ConsistencyLevel } from '../data/index.js'; -import { ConsistencyLevel as ConsistencyLevelGRPC } from '../proto/v1/base.js'; -import { WeaviateClient } from '../proto/v1/weaviate.js'; -export default class Base { - protected connection: WeaviateClient; - protected collection: string; - protected timeout: number; - protected consistencyLevel?: ConsistencyLevelGRPC; - protected tenant?: string; - protected metadata?: Metadata; - protected constructor( - connection: WeaviateClient, - collection: string, - metadata: Metadata, - timeout: number, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ); - private mapConsistencyLevel; - protected sendWithTimeout: (send: (signal: AbortSignal) => Promise) => Promise; -} diff --git a/dist/node/esm/grpc/base.js b/dist/node/esm/grpc/base.js deleted file mode 100644 index 7b360ca6..00000000 --- a/dist/node/esm/grpc/base.js +++ /dev/null @@ -1,37 +0,0 @@ -import { isAbortError } from 'abort-controller-x'; -import { WeaviateRequestTimeoutError } from '../errors.js'; -import { ConsistencyLevel as ConsistencyLevelGRPC } from '../proto/v1/base.js'; -export default class Base { - constructor(connection, collection, metadata, timeout, consistencyLevel, tenant) { - this.sendWithTimeout = (send) => { - const controller = new AbortController(); - const timeoutId = setTimeout(() => controller.abort(), this.timeout * 1000); - return send(controller.signal) - .catch((error) => { - if (isAbortError(error)) { - throw new WeaviateRequestTimeoutError(`timed out after ${this.timeout}ms`); - } - throw error; - }) - .finally(() => clearTimeout(timeoutId)); - }; - this.connection = connection; - this.collection = collection; - this.metadata = metadata; - this.timeout = timeout; - this.consistencyLevel = this.mapConsistencyLevel(consistencyLevel); - this.tenant = tenant; - } - mapConsistencyLevel(consistencyLevel) { - switch (consistencyLevel) { - case 'ALL': - return ConsistencyLevelGRPC.CONSISTENCY_LEVEL_ALL; - case 'QUORUM': - return ConsistencyLevelGRPC.CONSISTENCY_LEVEL_QUORUM; - case 'ONE': - return ConsistencyLevelGRPC.CONSISTENCY_LEVEL_ONE; - default: - return ConsistencyLevelGRPC.CONSISTENCY_LEVEL_UNSPECIFIED; - } - } -} diff --git a/dist/node/esm/grpc/batcher.d.ts b/dist/node/esm/grpc/batcher.d.ts deleted file mode 100644 index 979373e1..00000000 --- a/dist/node/esm/grpc/batcher.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Metadata } from 'nice-grpc'; -import { RetryOptions } from 'nice-grpc-client-middleware-retry'; -import { ConsistencyLevel } from '../data/index.js'; -import { Filters } from '../proto/v1/base.js'; -import { BatchObject, BatchObjectsReply } from '../proto/v1/batch.js'; -import { BatchDeleteReply } from '../proto/v1/batch_delete.js'; -import { WeaviateClient } from '../proto/v1/weaviate.js'; -import Base from './base.js'; -export interface Batch { - withDelete: (args: BatchDeleteArgs) => Promise; - withObjects: (args: BatchObjectsArgs) => Promise; -} -export interface BatchObjectsArgs { - objects: BatchObject[]; -} -export interface BatchDeleteArgs { - filters: Filters | undefined; - verbose?: boolean; - dryRun?: boolean; -} -export default class Batcher extends Base implements Batch { - static use( - connection: WeaviateClient, - collection: string, - metadata: Metadata, - timeout: number, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ): Batch; - withDelete: (args: BatchDeleteArgs) => Promise; - withObjects: (args: BatchObjectsArgs) => Promise; - private callDelete; - private callObjects; -} diff --git a/dist/node/esm/grpc/batcher.js b/dist/node/esm/grpc/batcher.js deleted file mode 100644 index e56c9178..00000000 --- a/dist/node/esm/grpc/batcher.js +++ /dev/null @@ -1,44 +0,0 @@ -import { WeaviateBatchError, WeaviateDeleteManyError } from '../errors.js'; -import { BatchObjectsRequest } from '../proto/v1/batch.js'; -import { BatchDeleteRequest } from '../proto/v1/batch_delete.js'; -import Base from './base.js'; -import { retryOptions } from './retry.js'; -export default class Batcher extends Base { - constructor() { - super(...arguments); - this.withDelete = (args) => this.callDelete(BatchDeleteRequest.fromPartial(args)); - this.withObjects = (args) => this.callObjects(BatchObjectsRequest.fromPartial(args)); - } - static use(connection, collection, metadata, timeout, consistencyLevel, tenant) { - return new Batcher(connection, collection, metadata, timeout, consistencyLevel, tenant); - } - callDelete(message) { - return this.sendWithTimeout((signal) => - this.connection.batchDelete( - Object.assign(Object.assign({}, message), { - collection: this.collection, - consistencyLevel: this.consistencyLevel, - tenant: this.tenant, - }), - { - metadata: this.metadata, - signal, - } - ) - ).catch((err) => { - throw new WeaviateDeleteManyError(err.message); - }); - } - callObjects(message) { - return this.sendWithTimeout((signal) => - this.connection - .batchObjects( - Object.assign(Object.assign({}, message), { consistencyLevel: this.consistencyLevel }), - Object.assign({ metadata: this.metadata, signal }, retryOptions) - ) - .catch((err) => { - throw new WeaviateBatchError(err.message); - }) - ); - } -} diff --git a/dist/node/esm/grpc/retry.d.ts b/dist/node/esm/grpc/retry.d.ts deleted file mode 100644 index 92ffdf04..00000000 --- a/dist/node/esm/grpc/retry.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { RetryOptions } from 'nice-grpc-client-middleware-retry'; -export declare const retryOptions: RetryOptions; diff --git a/dist/node/esm/grpc/retry.js b/dist/node/esm/grpc/retry.js deleted file mode 100644 index 28b56910..00000000 --- a/dist/node/esm/grpc/retry.js +++ /dev/null @@ -1,9 +0,0 @@ -import { Status } from 'nice-grpc'; -export const retryOptions = { - retry: true, - retryMaxAttempts: 5, - retryableStatuses: [Status.UNAVAILABLE], - onRetryableError(error, attempt, delayMs) { - console.warn(error, `Attempt ${attempt} failed. Retrying in ${delayMs}ms.`); - }, -}; diff --git a/dist/node/esm/grpc/searcher.d.ts b/dist/node/esm/grpc/searcher.d.ts deleted file mode 100644 index ce229e05..00000000 --- a/dist/node/esm/grpc/searcher.d.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { Metadata } from 'nice-grpc'; -import { RetryOptions } from 'nice-grpc-client-middleware-retry'; -import { ConsistencyLevel } from '../data/index.js'; -import { Filters } from '../proto/v1/base.js'; -import { GenerativeSearch } from '../proto/v1/generative.js'; -import { - BM25, - GroupBy, - Hybrid, - MetadataRequest, - NearAudioSearch, - NearDepthSearch, - NearImageSearch, - NearIMUSearch, - NearObject, - NearTextSearch, - NearThermalSearch, - NearVector, - NearVideoSearch, - PropertiesRequest, - Rerank, - SearchReply, - SortBy, -} from '../proto/v1/search_get.js'; -import { WeaviateClient } from '../proto/v1/weaviate.js'; -import Base from './base.js'; -export type SearchFetchArgs = { - limit?: number; - offset?: number; - after?: string; - filters?: Filters; - sortBy?: SortBy[]; - metadata?: MetadataRequest; - properties?: PropertiesRequest; - generative?: GenerativeSearch; - groupBy?: GroupBy; -}; -export type BaseSearchArgs = { - limit?: number; - offset?: number; - autocut?: number; - filters?: Filters; - rerank?: Rerank; - metadata?: MetadataRequest; - properties?: PropertiesRequest; - generative?: GenerativeSearch; - groupBy?: GroupBy; -}; -export type SearchBm25Args = BaseSearchArgs & { - bm25Search: BM25; -}; -export type SearchHybridArgs = BaseSearchArgs & { - hybridSearch: Hybrid; -}; -export type SearchNearAudioArgs = BaseSearchArgs & { - nearAudio: NearAudioSearch; -}; -export type SearchNearDepthArgs = BaseSearchArgs & { - nearDepth: NearDepthSearch; -}; -export type SearchNearImageArgs = BaseSearchArgs & { - nearImage: NearImageSearch; -}; -export type SearchNearIMUArgs = BaseSearchArgs & { - nearIMU: NearIMUSearch; -}; -export type SearchNearObjectArgs = BaseSearchArgs & { - nearObject: NearObject; -}; -export type SearchNearTextArgs = BaseSearchArgs & { - nearText: NearTextSearch; -}; -export type SearchNearThermalArgs = BaseSearchArgs & { - nearThermal: NearThermalSearch; -}; -export type SearchNearVectorArgs = BaseSearchArgs & { - nearVector: NearVector; -}; -export type SearchNearVideoArgs = BaseSearchArgs & { - nearVideo: NearVideoSearch; -}; -export interface Search { - withFetch: (args: SearchFetchArgs) => Promise; - withBm25: (args: SearchBm25Args) => Promise; - withHybrid: (args: SearchHybridArgs) => Promise; - withNearAudio: (args: SearchNearAudioArgs) => Promise; - withNearDepth: (args: SearchNearDepthArgs) => Promise; - withNearImage: (args: SearchNearImageArgs) => Promise; - withNearIMU: (args: SearchNearIMUArgs) => Promise; - withNearObject: (args: SearchNearObjectArgs) => Promise; - withNearText: (args: SearchNearTextArgs) => Promise; - withNearThermal: (args: SearchNearThermalArgs) => Promise; - withNearVector: (args: SearchNearVectorArgs) => Promise; - withNearVideo: (args: SearchNearVideoArgs) => Promise; -} -export default class Searcher extends Base implements Search { - static use( - connection: WeaviateClient, - collection: string, - metadata: Metadata, - timeout: number, - consistencyLevel?: ConsistencyLevel, - tenant?: string - ): Search; - withFetch: (args: SearchFetchArgs) => Promise; - withBm25: (args: SearchBm25Args) => Promise; - withHybrid: (args: SearchHybridArgs) => Promise; - withNearAudio: (args: SearchNearAudioArgs) => Promise; - withNearDepth: (args: SearchNearDepthArgs) => Promise; - withNearImage: (args: SearchNearImageArgs) => Promise; - withNearIMU: (args: SearchNearIMUArgs) => Promise; - withNearObject: (args: SearchNearObjectArgs) => Promise; - withNearText: (args: SearchNearTextArgs) => Promise; - withNearThermal: (args: SearchNearThermalArgs) => Promise; - withNearVector: (args: SearchNearVectorArgs) => Promise; - withNearVideo: (args: SearchNearVideoArgs) => Promise; - private call; -} diff --git a/dist/node/esm/grpc/searcher.js b/dist/node/esm/grpc/searcher.js deleted file mode 100644 index 250bea71..00000000 --- a/dist/node/esm/grpc/searcher.js +++ /dev/null @@ -1,41 +0,0 @@ -import { WeaviateQueryError } from '../errors.js'; -import { SearchRequest } from '../proto/v1/search_get.js'; -import Base from './base.js'; -import { retryOptions } from './retry.js'; -export default class Searcher extends Base { - constructor() { - super(...arguments); - this.withFetch = (args) => this.call(SearchRequest.fromPartial(args)); - this.withBm25 = (args) => this.call(SearchRequest.fromPartial(args)); - this.withHybrid = (args) => this.call(SearchRequest.fromPartial(args)); - this.withNearAudio = (args) => this.call(SearchRequest.fromPartial(args)); - this.withNearDepth = (args) => this.call(SearchRequest.fromPartial(args)); - this.withNearImage = (args) => this.call(SearchRequest.fromPartial(args)); - this.withNearIMU = (args) => this.call(SearchRequest.fromPartial(args)); - this.withNearObject = (args) => this.call(SearchRequest.fromPartial(args)); - this.withNearText = (args) => this.call(SearchRequest.fromPartial(args)); - this.withNearThermal = (args) => this.call(SearchRequest.fromPartial(args)); - this.withNearVector = (args) => this.call(SearchRequest.fromPartial(args)); - this.withNearVideo = (args) => this.call(SearchRequest.fromPartial(args)); - this.call = (message) => - this.sendWithTimeout((signal) => - this.connection - .search( - Object.assign(Object.assign({}, message), { - collection: this.collection, - consistencyLevel: this.consistencyLevel, - tenant: this.tenant, - uses123Api: true, - uses125Api: true, - }), - Object.assign({ metadata: this.metadata, signal }, retryOptions) - ) - .catch((err) => { - throw new WeaviateQueryError(err.message, 'gRPC'); - }) - ); - } - static use(connection, collection, metadata, timeout, consistencyLevel, tenant) { - return new Searcher(connection, collection, metadata, timeout, consistencyLevel, tenant); - } -} diff --git a/dist/node/esm/grpc/tenantsManager.d.ts b/dist/node/esm/grpc/tenantsManager.d.ts deleted file mode 100644 index 4b838464..00000000 --- a/dist/node/esm/grpc/tenantsManager.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Metadata } from 'nice-grpc'; -import { RetryOptions } from 'nice-grpc-client-middleware-retry'; -import { TenantsGetReply } from '../proto/v1/tenants.js'; -import { WeaviateClient } from '../proto/v1/weaviate.js'; -import Base from './base.js'; -export type TenantsGetArgs = { - names?: string[]; -}; -export interface Tenants { - withGet: (args: TenantsGetArgs) => Promise; -} -export default class TenantsManager extends Base implements Tenants { - static use( - connection: WeaviateClient, - collection: string, - metadata: Metadata, - timeout: number - ): Tenants; - withGet: (args: TenantsGetArgs) => Promise; - private call; -} diff --git a/dist/node/esm/grpc/tenantsManager.js b/dist/node/esm/grpc/tenantsManager.js deleted file mode 100644 index c83b914a..00000000 --- a/dist/node/esm/grpc/tenantsManager.js +++ /dev/null @@ -1,21 +0,0 @@ -import { TenantsGetRequest } from '../proto/v1/tenants.js'; -import Base from './base.js'; -import { retryOptions } from './retry.js'; -export default class TenantsManager extends Base { - constructor() { - super(...arguments); - this.withGet = (args) => - this.call(TenantsGetRequest.fromPartial({ names: args.names ? { values: args.names } : undefined })); - } - static use(connection, collection, metadata, timeout) { - return new TenantsManager(connection, collection, metadata, timeout); - } - call(message) { - return this.sendWithTimeout((signal) => - this.connection.tenantsGet( - Object.assign(Object.assign({}, message), { collection: this.collection }), - Object.assign({ metadata: this.metadata, signal }, retryOptions) - ) - ); - } -} diff --git a/dist/node/esm/index.d.ts b/dist/node/esm/index.d.ts deleted file mode 100644 index e867bcc9..00000000 --- a/dist/node/esm/index.d.ts +++ /dev/null @@ -1,960 +0,0 @@ -import { Backend, BackupCompressionLevel, BackupStatus } from './backup/index.js'; -import { Backup } from './collections/backup/client.js'; -import { Cluster } from './collections/cluster/index.js'; -import { Collections } from './collections/index.js'; -import { - AccessTokenCredentialsInput, - ApiKey, - AuthAccessTokenCredentials, - AuthClientCredentials, - AuthCredentials, - AuthUserPasswordCredentials, - ClientCredentialsInput, - OidcAuthenticator, - UserPasswordCredentialsInput, -} from './connection/auth.js'; -import { - ConnectToCustomOptions, - ConnectToLocalOptions, - ConnectToWCDOptions, - ConnectToWCSOptions, - ConnectToWeaviateCloudOptions, -} from './connection/helpers.js'; -import { ProxiesParams, TimeoutParams } from './connection/http.js'; -import { ConsistencyLevel } from './data/replication.js'; -import { Meta } from './openapi/types.js'; -import { DbVersion } from './utils/dbVersion.js'; -import weaviateV2 from './v2/index.js'; -export type ProtocolParams = { - /** - * The host to connect to. E.g., `localhost` or `example.com`. - */ - host: string; - /** - * The port to connect to. E.g., `8080` or `80`. - */ - port: number; - /** - * Whether to use a secure connection (https). - */ - secure: boolean; - /** - * An optional path in the case that you are using a forwarding proxy. - * - * E.g., http://localhost:8080/weaviate - */ - path?: string; -}; -export type ConnectionParams = { - /** - * The connection parameters for the REST and GraphQL APIs (http/1.1). - */ - http: ProtocolParams; - /** - * The connection paramaters for the gRPC API (http/2). - */ - grpc: ProtocolParams; -}; -export type ClientParams = { - /** - * The connection parameters for Weaviate's public APIs. - */ - connectionParams: ConnectionParams; - /** - * The credentials used to authenticate with Weaviate. - * - * Can be any of `AuthUserPasswordCredentials`, `AuthAccessTokenCredentials`, `AuthClientCredentials`, and `ApiKey`. - */ - auth?: AuthCredentials; - /** - * Additional headers that should be passed to Weaviate in the underlying requests. E.g., X-OpenAI-Api-Key - */ - headers?: HeadersInit; - /** - * The connection parameters for any tunnelling proxies that should be used. - * - * Note, if your proxy is a forwarding proxy then supply its configuration as if it were the Weaviate server itself using `rest` and `grpc`. - */ - proxies?: ProxiesParams; - /** The timeouts to use when making requests to Weaviate */ - timeout?: TimeoutParams; - /** Whether to skip the initialization checks */ - skipInitChecks?: boolean; -}; -export interface WeaviateClient { - backup: Backup; - cluster: Cluster; - collections: Collections; - oidcAuth?: OidcAuthenticator; - close: () => Promise; - getMeta: () => Promise; - getOpenIDConfig?: () => Promise; - getWeaviateVersion: () => Promise; - isLive: () => Promise; - isReady: () => Promise; -} -declare const app: { - /** - * Connect to a custom Weaviate deployment, e.g. your own self-hosted Kubernetes cluster. - * - * @param {ConnectToCustomOptions} options Options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your custom Weaviate deployment. - */ - connectToCustom: (options: ConnectToCustomOptions) => Promise; - /** - * Connect to a locally-deployed Weaviate instance, e.g. as a Docker compose stack. - * - * @param {ConnectToLocalOptions} [options] Options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your local Weaviate instance. - */ - connectToLocal: (options?: ConnectToLocalOptions) => Promise; - /** - * Connect to your own Weaviate Cloud (WCD) instance. - * - * @deprecated Use `connectToWeaviateCloud` instead. - * - * @param {string} clusterURL The URL of your WCD instance. E.g., `https://example.weaviate.network`. - * @param {ConnectToWCDOptions} [options] Additional options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your WCD instance. - */ - connectToWCD: (clusterURL: string, options?: ConnectToWCDOptions) => Promise; - /** - * Connect to your own Weaviate Cloud Service (WCS) instance. - * - * @deprecated Use `connectToWeaviateCloud` instead. - * - * @param {string} clusterURL The URL of your WCD instance. E.g., `https://example.weaviate.network`. - * @param {ConnectToWCSOptions} [options] Additional options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your WCS instance. - */ - connectToWCS: (clusterURL: string, options?: ConnectToWCSOptions) => Promise; - /** - * Connect to your own Weaviate Cloud (WCD) instance. - * - * @param {string} clusterURL The URL of your WCD instance. E.g., `https://example.weaviate.network`. - * @param {ConnectToWeaviateCloudOptions} [options] Additional options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your WCD instance. - */ - connectToWeaviateCloud: ( - clusterURL: string, - options?: ConnectToWeaviateCloudOptions - ) => Promise; - client: (params: ClientParams) => Promise; - ApiKey: typeof ApiKey; - AuthUserPasswordCredentials: typeof AuthUserPasswordCredentials; - AuthAccessTokenCredentials: typeof AuthAccessTokenCredentials; - AuthClientCredentials: typeof AuthClientCredentials; - configure: { - generative: { - anthropic( - config?: import('./collections/index.js').GenerativeAnthropicConfig | undefined - ): import('./collections/index.js').ModuleConfig< - 'generative-anthropic', - import('./collections/index.js').GenerativeAnthropicConfig | undefined - >; - anyscale( - config?: import('./collections/index.js').GenerativeAnyscaleConfig | undefined - ): import('./collections/index.js').ModuleConfig< - 'generative-anyscale', - import('./collections/index.js').GenerativeAnyscaleConfig | undefined - >; - aws( - config: import('./collections/index.js').GenerativeAWSConfig - ): import('./collections/index.js').ModuleConfig< - 'generative-aws', - import('./collections/index.js').GenerativeAWSConfig - >; - azureOpenAI: ( - config: import('./collections/index.js').GenerativeAzureOpenAIConfigCreate - ) => import('./collections/index.js').ModuleConfig< - 'generative-openai', - import('./collections/index.js').GenerativeAzureOpenAIConfig - >; - cohere: ( - config?: import('./collections/index.js').GenerativeCohereConfigCreate | undefined - ) => import('./collections/index.js').ModuleConfig< - 'generative-cohere', - import('./collections/index.js').GenerativeCohereConfig | undefined - >; - databricks: ( - config: import('./collections/index.js').GenerativeDatabricksConfig - ) => import('./collections/index.js').ModuleConfig< - 'generative-databricks', - import('./collections/index.js').GenerativeDatabricksConfig - >; - friendliai( - config?: import('./collections/index.js').GenerativeFriendliAIConfig | undefined - ): import('./collections/index.js').ModuleConfig< - 'generative-friendliai', - import('./collections/index.js').GenerativeFriendliAIConfig | undefined - >; - mistral( - config?: import('./collections/index.js').GenerativeMistralConfig | undefined - ): import('./collections/index.js').ModuleConfig< - 'generative-mistral', - import('./collections/index.js').GenerativeMistralConfig | undefined - >; - octoai( - config?: import('./collections/index.js').GenerativeOctoAIConfig | undefined - ): import('./collections/index.js').ModuleConfig< - 'generative-octoai', - import('./collections/index.js').GenerativeOctoAIConfig | undefined - >; - ollama( - config?: import('./collections/index.js').GenerativeOllamaConfig | undefined - ): import('./collections/index.js').ModuleConfig< - 'generative-ollama', - import('./collections/index.js').GenerativeOllamaConfig | undefined - >; - openAI: ( - config?: import('./collections/index.js').GenerativeOpenAIConfigCreate | undefined - ) => import('./collections/index.js').ModuleConfig< - 'generative-openai', - import('./collections/index.js').GenerativeOpenAIConfig | undefined - >; - palm: ( - config?: import('./collections/index.js').GenerativeGoogleConfig | undefined - ) => import('./collections/index.js').ModuleConfig< - 'generative-palm', - import('./collections/index.js').GenerativeGoogleConfig | undefined - >; - google: ( - config?: import('./collections/index.js').GenerativeGoogleConfig | undefined - ) => import('./collections/index.js').ModuleConfig< - 'generative-google', - import('./collections/index.js').GenerativeGoogleConfig | undefined - >; - }; - reranker: { - cohere: ( - config?: import('./collections/index.js').RerankerCohereConfig | undefined - ) => import('./collections/index.js').ModuleConfig< - 'reranker-cohere', - import('./collections/index.js').RerankerCohereConfig | undefined - >; - jinaai: ( - config?: import('./collections/index.js').RerankerJinaAIConfig | undefined - ) => import('./collections/index.js').ModuleConfig< - 'reranker-jinaai', - import('./collections/index.js').RerankerJinaAIConfig | undefined - >; - transformers: () => import('./collections/index.js').ModuleConfig< - 'reranker-transformers', - Record - >; - voyageAI: ( - config?: import('./collections/index.js').RerankerVoyageAIConfig | undefined - ) => import('./collections/index.js').ModuleConfig< - 'reranker-voyageai', - import('./collections/index.js').RerankerVoyageAIConfig | undefined - >; - }; - vectorizer: { - none: ( - opts?: - | { - name?: N | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - } - | undefined - ) => import('./collections/index.js').VectorConfigCreate; - img2VecNeural: ( - opts: import('./collections/index.js').Img2VecNeuralConfig & { - name?: N_1 | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_1, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - } - ) => import('./collections/index.js').VectorConfigCreate; - multi2VecBind: ( - opts?: - | (import('./collections/index.js').Multi2VecBindConfigCreate & { - name?: N_2 | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_2, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate; - multi2VecClip: ( - opts?: - | (import('./collections/index.js').Multi2VecClipConfigCreate & { - name?: N_3 | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_3, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate; - multi2VecPalm: ( - opts: import('./collections/index.js').ConfigureNonTextVectorizerOptions - ) => import('./collections/index.js').VectorConfigCreate; - multi2VecGoogle: ( - opts: import('./collections/index.js').ConfigureNonTextVectorizerOptions - ) => import('./collections/index.js').VectorConfigCreate; - ref2VecCentroid: ( - opts: import('./collections/index.js').ConfigureNonTextVectorizerOptions - ) => import('./collections/index.js').VectorConfigCreate; - text2VecAWS: ( - opts: import('./collections/index.js').ConfigureTextVectorizerOptions - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_7, - I_7, - 'text2vec-aws' - >; - text2VecAzureOpenAI: ( - opts: import('./collections/index.js').ConfigureTextVectorizerOptions< - T_1, - N_8, - I_8, - 'text2vec-azure-openai' - > - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_8, - I_8, - 'text2vec-azure-openai' - >; - text2VecCohere: ( - opts?: - | (import('./collections/index.js').Text2VecCohereConfig & { - name?: N_9 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_9, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_9, - I_9, - 'text2vec-cohere' - >; - text2VecContextionary: ( - opts?: - | (import('./collections/index.js').Text2VecContextionaryConfig & { - name?: N_10 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_10, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_10, - I_10, - 'text2vec-contextionary' - >; - text2VecDatabricks: ( - opts: import('./collections/index.js').ConfigureTextVectorizerOptions< - T_4, - N_11, - I_11, - 'text2vec-databricks' - > - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_11, - I_11, - 'text2vec-databricks' - >; - text2VecGPT4All: ( - opts?: - | (import('./collections/index.js').Text2VecGPT4AllConfig & { - name?: N_12 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_12, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_12, - I_12, - 'text2vec-gpt4all' - >; - text2VecHuggingFace: ( - opts?: - | (import('./collections/index.js').Text2VecHuggingFaceConfig & { - name?: N_13 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_13, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_13, - I_13, - 'text2vec-huggingface' - >; - text2VecJina: ( - opts?: - | (import('./collections/index.js').Text2VecJinaConfig & { - name?: N_14 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_14, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_14, - I_14, - 'text2vec-jina' - >; - text2VecMistral: ( - opts?: - | (import('./collections/index.js').Text2VecMistralConfig & { - name?: N_15 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_15, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_15, - I_15, - 'text2vec-mistral' - >; - text2VecOctoAI: ( - opts?: - | (import('./collections/index.js').Text2VecOctoAIConfig & { - name?: N_16 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_16, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_16, - I_16, - 'text2vec-octoai' - >; - text2VecOpenAI: ( - opts?: - | (import('./collections/index.js').Text2VecOpenAIConfig & { - name?: N_17 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_17, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_17, - I_17, - 'text2vec-openai' - >; - text2VecOllama: ( - opts?: - | (import('./collections/index.js').Text2VecOllamaConfig & { - name?: N_18 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_18, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_18, - I_18, - 'text2vec-ollama' - >; - text2VecPalm: ( - opts?: - | (import('./collections/index.js').Text2VecGoogleConfig & { - name?: N_19 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_19, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_19, - I_19, - 'text2vec-palm' - >; - text2VecGoogle: ( - opts?: - | (import('./collections/index.js').Text2VecGoogleConfig & { - name?: N_20 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_20, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_20, - I_20, - 'text2vec-google' - >; - text2VecTransformers: ( - opts?: - | (import('./collections/index.js').Text2VecTransformersConfig & { - name?: N_21 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_21, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_21, - I_21, - 'text2vec-transformers' - >; - text2VecVoyageAI: ( - opts?: - | (import('./collections/index.js').Text2VecVoyageAIConfig & { - name?: N_22 | undefined; - sourceProperties?: import('./collections/index.js').PrimitiveKeys[] | undefined; - vectorIndexConfig?: - | import('./collections/index.js').ModuleConfig< - I_22, - import('./collections/index.js').VectorIndexConfigCreateType - > - | undefined; - }) - | undefined - ) => import('./collections/index.js').VectorConfigCreate< - import('./collections/index.js').PrimitiveKeys, - N_22, - I_22, - 'text2vec-voyageai' - >; - }; - vectorIndex: { - flat: ( - opts?: import('./collections/index.js').VectorIndexConfigFlatCreateOptions | undefined - ) => import('./collections/index.js').ModuleConfig< - 'flat', - | { - distance?: import('./collections/index.js').VectorDistance | undefined; - vectorCacheMaxObjects?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | undefined; - type?: 'flat' | undefined; - } - | undefined - >; - hnsw: ( - opts?: import('./collections/index.js').VectorIndexConfigHNSWCreateOptions | undefined - ) => import('./collections/index.js').ModuleConfig< - 'hnsw', - | { - cleanupIntervalSeconds?: number | undefined; - distance?: import('./collections/index.js').VectorDistance | undefined; - dynamicEfMin?: number | undefined; - dynamicEfMax?: number | undefined; - dynamicEfFactor?: number | undefined; - efConstruction?: number | undefined; - ef?: number | undefined; - filterStrategy?: import('./collections/index.js').VectorIndexFilterStrategy | undefined; - flatSearchCutoff?: number | undefined; - maxConnections?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | { - bitCompression?: boolean | undefined; - centroids?: number | undefined; - encoder?: - | { - type?: import('./collections/index.js').PQEncoderType | undefined; - distribution?: import('./collections/index.js').PQEncoderDistribution | undefined; - } - | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - type?: 'pq' | undefined; - } - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - type?: 'sq' | undefined; - } - | undefined; - skip?: boolean | undefined; - vectorCacheMaxObjects?: number | undefined; - type?: 'hnsw' | undefined; - } - | undefined - >; - dynamic: ( - opts?: import('./collections/index.js').VectorIndexConfigDynamicCreateOptions | undefined - ) => import('./collections/index.js').ModuleConfig< - 'dynamic', - | { - distance?: import('./collections/index.js').VectorDistance | undefined; - threshold?: number | undefined; - hnsw?: - | { - cleanupIntervalSeconds?: number | undefined; - distance?: import('./collections/index.js').VectorDistance | undefined; - dynamicEfMin?: number | undefined; - dynamicEfMax?: number | undefined; - dynamicEfFactor?: number | undefined; - efConstruction?: number | undefined; - ef?: number | undefined; - filterStrategy?: import('./collections/index.js').VectorIndexFilterStrategy | undefined; - flatSearchCutoff?: number | undefined; - maxConnections?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | { - bitCompression?: boolean | undefined; - centroids?: number | undefined; - encoder?: - | { - type?: import('./collections/index.js').PQEncoderType | undefined; - distribution?: - | import('./collections/index.js').PQEncoderDistribution - | undefined; - } - | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - type?: 'pq' | undefined; - } - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - type?: 'sq' | undefined; - } - | undefined; - skip?: boolean | undefined; - vectorCacheMaxObjects?: number | undefined; - type?: 'hnsw' | undefined; - } - | undefined; - flat?: - | { - distance?: import('./collections/index.js').VectorDistance | undefined; - vectorCacheMaxObjects?: number | undefined; - quantizer?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - type?: 'bq' | undefined; - } - | undefined; - type?: 'flat' | undefined; - } - | undefined; - type?: 'dynamic' | undefined; - } - | undefined - >; - quantizer: { - bq: ( - options?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - } - | undefined - ) => import('./collections/index.js').QuantizerRecursivePartial< - import('./collections/index.js').BQConfig - >; - pq: ( - options?: - | { - bitCompression?: boolean | undefined; - centroids?: number | undefined; - encoder?: - | { - distribution?: import('./collections/index.js').PQEncoderDistribution | undefined; - type?: import('./collections/index.js').PQEncoderType | undefined; - } - | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./collections/index.js').QuantizerRecursivePartial< - import('./collections/index.js').PQConfig - >; - sq: ( - options?: - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./collections/index.js').QuantizerRecursivePartial< - import('./collections/index.js').SQConfig - >; - }; - }; - dataType: { - INT: 'int'; - INT_ARRAY: 'int[]'; - NUMBER: 'number'; - NUMBER_ARRAY: 'number[]'; - TEXT: 'text'; - TEXT_ARRAY: 'text[]'; - UUID: 'uuid'; - UUID_ARRAY: 'uuid[]'; - BOOLEAN: 'boolean'; - BOOLEAN_ARRAY: 'boolean[]'; - DATE: 'date'; - DATE_ARRAY: 'date[]'; - OBJECT: 'object'; - OBJECT_ARRAY: 'object[]'; - BLOB: 'blob'; - GEO_COORDINATES: 'geoCoordinates'; - PHONE_NUMBER: 'phoneNumber'; - }; - tokenization: { - WORD: 'word'; - LOWERCASE: 'lowercase'; - WHITESPACE: 'whitespace'; - FIELD: 'field'; - TRIGRAM: 'trigram'; - GSE: 'gse'; - KAGOME_KR: 'kagome_kr'; - }; - vectorDistances: { - COSINE: 'cosine'; - DOT: 'dot'; - HAMMING: 'hamming'; - L2_SQUARED: 'l2-squared'; - }; - invertedIndex: (options: { - bm25b?: number | undefined; - bm25k1?: number | undefined; - cleanupIntervalSeconds?: number | undefined; - indexTimestamps?: boolean | undefined; - indexPropertyLength?: boolean | undefined; - indexNullState?: boolean | undefined; - stopwordsPreset?: 'none' | 'en' | undefined; - stopwordsAdditions?: string[] | undefined; - stopwordsRemovals?: string[] | undefined; - }) => { - bm25?: - | { - k1?: number | undefined; - b?: number | undefined; - } - | undefined; - cleanupIntervalSeconds?: number | undefined; - indexTimestamps?: boolean | undefined; - indexPropertyLength?: boolean | undefined; - indexNullState?: boolean | undefined; - stopwords?: - | { - preset?: string | undefined; - additions?: (string | undefined)[] | undefined; - removals?: (string | undefined)[] | undefined; - } - | undefined; - }; - multiTenancy: ( - options?: - | { - autoTenantActivation?: boolean | undefined; - autoTenantCreation?: boolean | undefined; - enabled?: boolean | undefined; - } - | undefined - ) => { - autoTenantActivation?: boolean | undefined; - autoTenantCreation?: boolean | undefined; - enabled?: boolean | undefined; - }; - replication: (options: { - asyncEnabled?: boolean | undefined; - deletionStrategy?: import('./collections/index.js').ReplicationDeletionStrategy | undefined; - factor?: number | undefined; - }) => { - asyncEnabled?: boolean | undefined; - deletionStrategy?: import('./collections/index.js').ReplicationDeletionStrategy | undefined; - factor?: number | undefined; - }; - sharding: (options: { - virtualPerPhysical?: number | undefined; - desiredCount?: number | undefined; - desiredVirtualCount?: number | undefined; - }) => import('./collections/index.js').ShardingConfigCreate; - }; - configGuards: { - quantizer: typeof import('./collections/index.js').Quantizer; - vectorIndex: typeof import('./collections/index.js').VectorIndex; - }; - reconfigure: { - vectorIndex: { - flat: (options: { - vectorCacheMaxObjects?: number | undefined; - quantizer?: import('./collections/index.js').BQConfigUpdate | undefined; - }) => import('./collections/index.js').ModuleConfig< - 'flat', - import('./collections/index.js').VectorIndexConfigFlatUpdate - >; - hnsw: (options: { - dynamicEfFactor?: number | undefined; - dynamicEfMax?: number | undefined; - dynamicEfMin?: number | undefined; - ef?: number | undefined; - flatSearchCutoff?: number | undefined; - quantizer?: - | import('./collections/index.js').PQConfigUpdate - | import('./collections/index.js').BQConfigUpdate - | import('./collections/index.js').SQConfigUpdate - | undefined; - vectorCacheMaxObjects?: number | undefined; - }) => import('./collections/index.js').ModuleConfig< - 'hnsw', - import('./collections/index.js').VectorIndexConfigHNSWUpdate - >; - quantizer: { - bq: ( - options?: - | { - cache?: boolean | undefined; - rescoreLimit?: number | undefined; - } - | undefined - ) => import('./collections/index.js').BQConfigUpdate; - pq: ( - options?: - | { - centroids?: number | undefined; - pqEncoderDistribution?: import('./collections/index.js').PQEncoderDistribution | undefined; - pqEncoderType?: import('./collections/index.js').PQEncoderType | undefined; - segments?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./collections/index.js').PQConfigUpdate; - sq: ( - options?: - | { - rescoreLimit?: number | undefined; - trainingLimit?: number | undefined; - } - | undefined - ) => import('./collections/index.js').SQConfigUpdate; - }; - }; - invertedIndex: (options: { - bm25b?: number | undefined; - bm25k1?: number | undefined; - cleanupIntervalSeconds?: number | undefined; - stopwordsPreset?: 'none' | 'en' | undefined; - stopwordsAdditions?: string[] | undefined; - stopwordsRemovals?: string[] | undefined; - }) => import('./collections/index.js').InvertedIndexConfigUpdate; - vectorizer: { - update: ( - options: import('./collections/index.js').VectorizerUpdateOptions - ) => import('./collections/index.js').VectorConfigUpdate; - }; - replication: (options: { - asyncEnabled?: boolean | undefined; - deletionStrategy?: import('./collections/index.js').ReplicationDeletionStrategy | undefined; - factor?: number | undefined; - }) => import('./collections/index.js').ReplicationConfigUpdate; - }; -}; -export default app; -export * from './collections/index.js'; -export * from './connection/index.js'; -export * from './utils/base64.js'; -export * from './utils/uuid.js'; -export { - AccessTokenCredentialsInput, - ApiKey, - AuthAccessTokenCredentials, - AuthClientCredentials, - AuthCredentials, - AuthUserPasswordCredentials, - Backend, - BackupCompressionLevel, - BackupStatus, - ClientCredentialsInput, - ConsistencyLevel, - ProxiesParams, - TimeoutParams, - UserPasswordCredentialsInput, - weaviateV2, -}; diff --git a/dist/node/esm/index.js b/dist/node/esm/index.js deleted file mode 100644 index bc3cbc83..00000000 --- a/dist/node/esm/index.js +++ /dev/null @@ -1,173 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -import { Agent as HttpAgent } from 'http'; -import { Agent as HttpsAgent } from 'https'; -import { backup } from './collections/backup/client.js'; -import cluster from './collections/cluster/index.js'; -import { configGuards } from './collections/config/index.js'; -import { configure, reconfigure } from './collections/configure/index.js'; -import collections from './collections/index.js'; -import { - ApiKey, - AuthAccessTokenCredentials, - AuthClientCredentials, - AuthUserPasswordCredentials, - isApiKey, - mapApiKey, -} from './connection/auth.js'; -import { connectToCustom, connectToLocal, connectToWeaviateCloud } from './connection/helpers.js'; -import { ConnectionGRPC } from './connection/index.js'; -import { LiveChecker, OpenidConfigurationGetter, ReadyChecker } from './misc/index.js'; -import MetaGetter from './misc/metaGetter.js'; -import weaviateV2 from './v2/index.js'; -const cleanHost = (host, protocol) => { - if (host.includes('http')) { - console.warn(`The ${protocol}.host parameter should not include the protocol. Please remove the http:// or https:// from the ${protocol}.host parameter.\ - To specify a secure connection, set the secure parameter to true. The protocol will be inferred from the secure parameter instead.`); - return host.replace('http://', '').replace('https://', ''); - } - return host; -}; -const app = { - /** - * Connect to a custom Weaviate deployment, e.g. your own self-hosted Kubernetes cluster. - * - * @param {ConnectToCustomOptions} options Options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your custom Weaviate deployment. - */ - connectToCustom: function (options) { - return connectToCustom(this.client, options); - }, - /** - * Connect to a locally-deployed Weaviate instance, e.g. as a Docker compose stack. - * - * @param {ConnectToLocalOptions} [options] Options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your local Weaviate instance. - */ - connectToLocal: function (options) { - return connectToLocal(this.client, options); - }, - /** - * Connect to your own Weaviate Cloud (WCD) instance. - * - * @deprecated Use `connectToWeaviateCloud` instead. - * - * @param {string} clusterURL The URL of your WCD instance. E.g., `https://example.weaviate.network`. - * @param {ConnectToWCDOptions} [options] Additional options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your WCD instance. - */ - connectToWCD: function (clusterURL, options) { - console.warn( - 'The `connectToWCD` method is deprecated. Please use `connectToWeaviateCloud` instead. This method will be removed in a future release.' - ); - return connectToWeaviateCloud(clusterURL, this.client, options); - }, - /** - * Connect to your own Weaviate Cloud Service (WCS) instance. - * - * @deprecated Use `connectToWeaviateCloud` instead. - * - * @param {string} clusterURL The URL of your WCD instance. E.g., `https://example.weaviate.network`. - * @param {ConnectToWCSOptions} [options] Additional options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your WCS instance. - */ - connectToWCS: function (clusterURL, options) { - console.warn( - 'The `connectToWCS` method is deprecated. Please use `connectToWeaviateCloud` instead. This method will be removed in a future release.' - ); - return connectToWeaviateCloud(clusterURL, this.client, options); - }, - /** - * Connect to your own Weaviate Cloud (WCD) instance. - * - * @param {string} clusterURL The URL of your WCD instance. E.g., `https://example.weaviate.network`. - * @param {ConnectToWeaviateCloudOptions} [options] Additional options for the connection. - * @returns {Promise} A Promise that resolves to a client connected to your WCD instance. - */ - connectToWeaviateCloud: function (clusterURL, options) { - return connectToWeaviateCloud(clusterURL, this.client, options); - }, - client: function (params) { - var _a; - return __awaiter(this, void 0, void 0, function* () { - let { host: httpHost } = params.connectionParams.http; - let { host: grpcHost } = params.connectionParams.grpc; - const { port: httpPort, secure: httpSecure, path: httpPath } = params.connectionParams.http; - const { port: grpcPort, secure: grpcSecure } = params.connectionParams.grpc; - httpHost = cleanHost(httpHost, 'rest'); - grpcHost = cleanHost(grpcHost, 'grpc'); - // check if headers are set - if (!params.headers) params.headers = {}; - const scheme = httpSecure ? 'https' : 'http'; - const agent = httpSecure ? new HttpsAgent({ keepAlive: true }) : new HttpAgent({ keepAlive: true }); - const { connection, dbVersionProvider, dbVersionSupport } = yield ConnectionGRPC.use({ - host: `${scheme}://${httpHost}:${httpPort}${httpPath || ''}`, - scheme: scheme, - headers: params.headers, - grpcAddress: `${grpcHost}:${grpcPort}`, - grpcSecure: grpcSecure, - grpcProxyUrl: (_a = params.proxies) === null || _a === void 0 ? void 0 : _a.grpc, - apiKey: isApiKey(params.auth) ? mapApiKey(params.auth) : undefined, - authClientSecret: isApiKey(params.auth) ? undefined : params.auth, - agent, - timeout: params.timeout, - skipInitChecks: params.skipInitChecks, - }); - const ifc = { - backup: backup(connection), - cluster: cluster(connection), - collections: collections(connection, dbVersionSupport), - close: () => Promise.resolve(connection.close()), - getMeta: () => new MetaGetter(connection).do(), - getOpenIDConfig: () => new OpenidConfigurationGetter(connection.http).do(), - getWeaviateVersion: () => dbVersionSupport.getVersion(), - isLive: () => new LiveChecker(connection, dbVersionProvider).do(), - isReady: () => new ReadyChecker(connection, dbVersionProvider).do(), - }; - if (connection.oidcAuth) ifc.oidcAuth = connection.oidcAuth; - return ifc; - }); - }, - ApiKey, - AuthUserPasswordCredentials, - AuthAccessTokenCredentials, - AuthClientCredentials, - configure, - configGuards, - reconfigure, -}; -export default app; -export * from './collections/index.js'; -export * from './connection/index.js'; -export * from './utils/base64.js'; -export * from './utils/uuid.js'; -export { ApiKey, AuthAccessTokenCredentials, AuthClientCredentials, AuthUserPasswordCredentials, weaviateV2 }; diff --git a/dist/node/esm/misc/index.d.ts b/dist/node/esm/misc/index.d.ts deleted file mode 100644 index 42313024..00000000 --- a/dist/node/esm/misc/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import Connection from '../connection/index.js'; -import { DbVersionProvider } from '../utils/dbVersion.js'; -import LiveChecker from './liveChecker.js'; -import MetaGetter from './metaGetter.js'; -import OpenidConfigurationGetter from './openidConfigurationGetter.js'; -import ReadyChecker from './readyChecker.js'; -export interface Misc { - liveChecker: () => LiveChecker; - readyChecker: () => ReadyChecker; - metaGetter: () => MetaGetter; - openidConfigurationGetter: () => OpenidConfigurationGetter; -} -declare const misc: (client: Connection, dbVersionProvider: DbVersionProvider) => Misc; -export default misc; -export { default as LiveChecker } from './liveChecker.js'; -export { default as MetaGetter } from './metaGetter.js'; -export { default as OpenidConfigurationGetter } from './openidConfigurationGetter.js'; -export { default as ReadyChecker } from './readyChecker.js'; diff --git a/dist/node/esm/misc/index.js b/dist/node/esm/misc/index.js deleted file mode 100644 index dad9c601..00000000 --- a/dist/node/esm/misc/index.js +++ /dev/null @@ -1,17 +0,0 @@ -import LiveChecker from './liveChecker.js'; -import MetaGetter from './metaGetter.js'; -import OpenidConfigurationGetter from './openidConfigurationGetter.js'; -import ReadyChecker from './readyChecker.js'; -const misc = (client, dbVersionProvider) => { - return { - liveChecker: () => new LiveChecker(client, dbVersionProvider), - readyChecker: () => new ReadyChecker(client, dbVersionProvider), - metaGetter: () => new MetaGetter(client), - openidConfigurationGetter: () => new OpenidConfigurationGetter(client.http), - }; -}; -export default misc; -export { default as LiveChecker } from './liveChecker.js'; -export { default as MetaGetter } from './metaGetter.js'; -export { default as OpenidConfigurationGetter } from './openidConfigurationGetter.js'; -export { default as ReadyChecker } from './readyChecker.js'; diff --git a/dist/node/esm/misc/liveChecker.d.ts b/dist/node/esm/misc/liveChecker.d.ts deleted file mode 100644 index 434105df..00000000 --- a/dist/node/esm/misc/liveChecker.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Connection from '../connection/index.js'; -import { DbVersionProvider } from '../utils/dbVersion.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class LiveChecker extends CommandBase { - private dbVersionProvider; - constructor(client: Connection, dbVersionProvider: DbVersionProvider); - validate(): void; - do: () => any; -} diff --git a/dist/node/esm/misc/liveChecker.js b/dist/node/esm/misc/liveChecker.js deleted file mode 100644 index 892cb33f..00000000 --- a/dist/node/esm/misc/liveChecker.js +++ /dev/null @@ -1,19 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class LiveChecker extends CommandBase { - constructor(client, dbVersionProvider) { - super(client); - this.do = () => { - return this.client - .get('/.well-known/live', false) - .then(() => { - setTimeout(() => this.dbVersionProvider.refresh()); - return Promise.resolve(true); - }) - .catch(() => Promise.resolve(false)); - }; - this.dbVersionProvider = dbVersionProvider; - } - validate() { - // nothing to validate - } -} diff --git a/dist/node/esm/misc/metaGetter.d.ts b/dist/node/esm/misc/metaGetter.d.ts deleted file mode 100644 index 2bb8d773..00000000 --- a/dist/node/esm/misc/metaGetter.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import Connection from '../connection/index.js'; -import { Meta } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class MetaGetter extends CommandBase { - constructor(client: Connection); - validate(): void; - do: () => Promise; -} diff --git a/dist/node/esm/misc/metaGetter.js b/dist/node/esm/misc/metaGetter.js deleted file mode 100644 index a6777f74..00000000 --- a/dist/node/esm/misc/metaGetter.js +++ /dev/null @@ -1,12 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class MetaGetter extends CommandBase { - constructor(client) { - super(client); - this.do = () => { - return this.client.get('/meta', true); - }; - } - validate() { - // nothing to validate - } -} diff --git a/dist/node/esm/misc/openidConfigurationGetter.d.ts b/dist/node/esm/misc/openidConfigurationGetter.d.ts deleted file mode 100644 index f2db85ab..00000000 --- a/dist/node/esm/misc/openidConfigurationGetter.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { HttpClient } from '../connection/http.js'; -export default class OpenidConfigurationGetterGetter { - private client; - constructor(client: HttpClient); - do: () => any; -} diff --git a/dist/node/esm/misc/openidConfigurationGetter.js b/dist/node/esm/misc/openidConfigurationGetter.js deleted file mode 100644 index f4126f01..00000000 --- a/dist/node/esm/misc/openidConfigurationGetter.js +++ /dev/null @@ -1,17 +0,0 @@ -export default class OpenidConfigurationGetterGetter { - constructor(client) { - this.do = () => { - return this.client.getRaw('/.well-known/openid-configuration').then((res) => { - if (res.status < 400) { - return res.json(); - } - if (res.status == 404) { - // OIDC is not configured - return Promise.resolve(undefined); - } - return Promise.reject(new Error(`unexpected status code: ${res.status}`)); - }); - }; - this.client = client; - } -} diff --git a/dist/node/esm/misc/readyChecker.d.ts b/dist/node/esm/misc/readyChecker.d.ts deleted file mode 100644 index e83d4d1c..00000000 --- a/dist/node/esm/misc/readyChecker.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Connection from '../connection/index.js'; -import { DbVersionProvider } from '../utils/dbVersion.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ReadyChecker extends CommandBase { - private dbVersionProvider; - constructor(client: Connection, dbVersionProvider: DbVersionProvider); - validate(): void; - do: () => any; -} diff --git a/dist/node/esm/misc/readyChecker.js b/dist/node/esm/misc/readyChecker.js deleted file mode 100644 index d8824a59..00000000 --- a/dist/node/esm/misc/readyChecker.js +++ /dev/null @@ -1,19 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class ReadyChecker extends CommandBase { - constructor(client, dbVersionProvider) { - super(client); - this.do = () => { - return this.client - .get('/.well-known/ready', false) - .then(() => { - setTimeout(() => this.dbVersionProvider.refresh()); - return Promise.resolve(true); - }) - .catch(() => Promise.resolve(false)); - }; - this.dbVersionProvider = dbVersionProvider; - } - validate() { - // nothing to validate - } -} diff --git a/dist/node/esm/openapi/schema.d.ts b/dist/node/esm/openapi/schema.d.ts deleted file mode 100644 index 7de49fcd..00000000 --- a/dist/node/esm/openapi/schema.d.ts +++ /dev/null @@ -1,3100 +0,0 @@ -/** - * This file was auto-generated by openapi-typescript. - * Do not make direct changes to the file. - */ -export interface paths { - '/': { - /** Home. Discover the REST API */ - get: operations['weaviate.root']; - }; - '/.well-known/live': { - /** Determines whether the application is alive. Can be used for kubernetes liveness probe */ - get: operations['weaviate.wellknown.liveness']; - }; - '/.well-known/ready': { - /** Determines whether the application is ready to receive traffic. Can be used for kubernetes readiness probe. */ - get: operations['weaviate.wellknown.readiness']; - }; - '/.well-known/openid-configuration': { - /** OIDC Discovery page, redirects to the token issuer if one is configured */ - get: { - responses: { - /** Successful response, inspect body */ - 200: { - schema: { - /** @description The Location to redirect to */ - href?: string; - /** @description OAuth Client ID */ - clientId?: string; - /** @description OAuth Scopes */ - scopes?: string[]; - }; - }; - /** Not found, no oidc provider present */ - 404: unknown; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - }; - '/objects': { - /** Lists all Objects in reverse order of creation, owned by the user that belongs to the used token. */ - get: operations['objects.list']; - /** Registers a new Object. Provided meta-data and schema values are validated. */ - post: operations['objects.create']; - }; - '/objects/{id}': { - /** Lists Objects. */ - get: operations['objects.get']; - /** Updates an Object's data. Given meta-data and schema values are validated. LastUpdateTime is set to the time this function is called. */ - put: operations['objects.update']; - /** Deletes an Object from the system. */ - delete: operations['objects.delete']; - /** Checks if an Object exists in the system. */ - head: operations['objects.head']; - /** Updates an Object. This method supports json-merge style patch semantics (RFC 7396). Provided meta-data and schema values are validated. LastUpdateTime is set to the time this function is called. */ - patch: operations['objects.patch']; - }; - '/objects/{className}/{id}': { - /** Get a single data object */ - get: operations['objects.class.get']; - /** Update an individual data object based on its class and uuid. */ - put: operations['objects.class.put']; - /** Delete a single data object. */ - delete: operations['objects.class.delete']; - /** Checks if a data object exists without retrieving it. */ - head: operations['objects.class.head']; - /** Update an individual data object based on its class and uuid. This method supports json-merge style patch semantics (RFC 7396). Provided meta-data and schema values are validated. LastUpdateTime is set to the time this function is called. */ - patch: operations['objects.class.patch']; - }; - '/objects/{id}/references/{propertyName}': { - /** Replace all references to a class-property. */ - put: operations['objects.references.update']; - /** Add a single reference to a class-property. */ - post: operations['objects.references.create']; - /** Delete the single reference that is given in the body from the list of references that this property has. */ - delete: operations['objects.references.delete']; - }; - '/objects/{className}/{id}/references/{propertyName}': { - /** Update all references of a property of a data object. */ - put: operations['objects.class.references.put']; - /** Add a single reference to a class-property. */ - post: operations['objects.class.references.create']; - /** Delete the single reference that is given in the body from the list of references that this property of a data object has */ - delete: operations['objects.class.references.delete']; - }; - '/objects/validate': { - /** Validate an Object's schema and meta-data. It has to be based on a schema, which is related to the given Object to be accepted by this validation. */ - post: operations['objects.validate']; - }; - '/batch/objects': { - /** Register new Objects in bulk. Provided meta-data and schema values are validated. */ - post: operations['batch.objects.create']; - /** Delete Objects in bulk that match a certain filter. */ - delete: operations['batch.objects.delete']; - }; - '/batch/references': { - /** Register cross-references between any class items (objects or objects) in bulk. */ - post: operations['batch.references.create']; - }; - '/graphql': { - /** Get an object based on GraphQL */ - post: operations['graphql.post']; - }; - '/graphql/batch': { - /** Perform a batched GraphQL query */ - post: operations['graphql.batch']; - }; - '/meta': { - /** Gives meta information about the server and can be used to provide information to another Weaviate instance that wants to interact with the current instance. */ - get: operations['meta.get']; - }; - '/schema': { - get: operations['schema.dump']; - post: operations['schema.objects.create']; - }; - '/schema/{className}': { - get: operations['schema.objects.get']; - /** Use this endpoint to alter an existing class in the schema. Note that not all settings are mutable. If an error about immutable fields is returned and you still need to update this particular setting, you will have to delete the class (and the underlying data) and recreate. This endpoint cannot be used to modify properties. Instead use POST /v1/schema/{className}/properties. A typical use case for this endpoint is to update configuration, such as the vectorIndexConfig. Note that even in mutable sections, such as vectorIndexConfig, some fields may be immutable. */ - put: operations['schema.objects.update']; - delete: operations['schema.objects.delete']; - }; - '/schema/{className}/properties': { - post: operations['schema.objects.properties.add']; - }; - '/schema/{className}/shards': { - get: operations['schema.objects.shards.get']; - }; - '/schema/{className}/shards/{shardName}': { - /** Update shard status of an Object Class */ - put: operations['schema.objects.shards.update']; - }; - '/schema/{className}/tenants': { - /** get all tenants from a specific class */ - get: operations['tenants.get']; - /** Update tenant of a specific class */ - put: operations['tenants.update']; - /** Create a new tenant for a specific class */ - post: operations['tenants.create']; - /** delete tenants from a specific class */ - delete: operations['tenants.delete']; - }; - '/schema/{className}/tenants/{tenantName}': { - /** Check if a tenant exists for a specific class */ - head: operations['tenant.exists']; - }; - '/backups/{backend}': { - /** [Coming soon] List all backups in progress not implemented yet. */ - get: operations['backups.list']; - /** Starts a process of creating a backup for a set of classes */ - post: operations['backups.create']; - }; - '/backups/{backend}/{id}': { - /** Returns status of backup creation attempt for a set of classes */ - get: operations['backups.create.status']; - /** Cancel created backup with specified ID */ - delete: operations['backups.cancel']; - }; - '/backups/{backend}/{id}/restore': { - /** Returns status of a backup restoration attempt for a set of classes */ - get: operations['backups.restore.status']; - /** Starts a process of restoring a backup for a set of classes */ - post: operations['backups.restore']; - }; - '/cluster/statistics': { - /** Returns Raft cluster statistics of Weaviate DB. */ - get: operations['cluster.get.statistics']; - }; - '/nodes': { - /** Returns status of Weaviate DB. */ - get: operations['nodes.get']; - }; - '/nodes/{className}': { - /** Returns status of Weaviate DB. */ - get: operations['nodes.get.class']; - }; - '/classifications/': { - /** Trigger a classification based on the specified params. Classifications will run in the background, use GET /classifications/ to retrieve the status of your classification. */ - post: operations['classifications.post']; - }; - '/classifications/{id}': { - /** Get status, results and metadata of a previously created classification */ - get: operations['classifications.get']; - }; -} -export interface definitions { - Link: { - /** @description target of the link */ - href?: string; - /** @description relationship if both resources are related, e.g. 'next', 'previous', 'parent', etc. */ - rel?: string; - /** @description human readable name of the resource group */ - name?: string; - /** @description weaviate documentation about this resource group */ - documentationHref?: string; - }; - Principal: { - /** @description The username that was extracted either from the authentication information */ - username?: string; - groups?: string[]; - }; - /** @description An array of available words and contexts. */ - C11yWordsResponse: { - /** @description Weighted results for all words */ - concatenatedWord?: { - concatenatedWord?: string; - singleWords?: unknown[]; - concatenatedVector?: definitions['C11yVector']; - concatenatedNearestNeighbors?: definitions['C11yNearestNeighbors']; - }; - /** @description Weighted results for per individual word */ - individualWords?: { - word?: string; - present?: boolean; - info?: { - vector?: definitions['C11yVector']; - nearestNeighbors?: definitions['C11yNearestNeighbors']; - }; - }[]; - }; - /** @description A resource describing an extension to the contextinoary, containing both the identifier and the definition of the extension */ - C11yExtension: { - /** - * @description The new concept you want to extend. Must be an all-lowercase single word, or a space delimited compound word. Examples: 'foobarium', 'my custom concept' - * @example foobarium - */ - concept?: string; - /** @description A list of space-delimited words or a sentence describing what the custom concept is about. Avoid using the custom concept itself. An Example definition for the custom concept 'foobarium': would be 'a naturally occurring element which can only be seen by programmers' */ - definition?: string; - /** - * Format: float - * @description Weight of the definition of the new concept where 1='override existing definition entirely' and 0='ignore custom definition'. Note that if the custom concept is not present in the contextionary yet, the weight cannot be less than 1. - */ - weight?: number; - }; - /** @description C11y function to show the nearest neighbors to a word. */ - C11yNearestNeighbors: { - word?: string; - /** Format: float */ - distance?: number; - }[]; - /** @description A Vector in the Contextionary */ - C11yVector: number[]; - /** @description A Vector object */ - Vector: number[]; - /** @description A Multi Vector map of named vectors */ - Vectors: { - [key: string]: definitions['Vector']; - }; - /** @description Receive question based on array of classes, properties and values. */ - C11yVectorBasedQuestion: { - /** @description Vectorized classname. */ - classVectors?: number[]; - /** @description Vectorized properties. */ - classProps?: { - propsVectors?: number[]; - /** @description String with valuename. */ - value?: string; - }[]; - }[]; - Deprecation: { - /** @description The id that uniquely identifies this particular deprecations (mostly used internally) */ - id?: string; - /** @description Whether the problematic API functionality is deprecated (planned to be removed) or already removed */ - status?: string; - /** @description Describes which API is effected, usually one of: REST, GraphQL */ - apiType?: string; - /** @description What this deprecation is about */ - msg?: string; - /** @description User-required object to not be affected by the (planned) removal */ - mitigation?: string; - /** @description The deprecation was introduced in this version */ - sinceVersion?: string; - /** @description A best-effort guess of which upcoming version will remove the feature entirely */ - plannedRemovalVersion?: string; - /** @description If the feature has already been removed, it was removed in this version */ - removedIn?: string; - /** - * Format: date-time - * @description If the feature has already been removed, it was removed at this timestamp - */ - removedTime?: string; - /** - * Format: date-time - * @description The deprecation was introduced in this version - */ - sinceTime?: string; - /** @description The locations within the specified API affected by this deprecation */ - locations?: string[]; - }; - /** @description An error response given by Weaviate end-points. */ - ErrorResponse: { - error?: { - message?: string; - }[]; - }; - /** @description An error response caused by a GraphQL query. */ - GraphQLError: { - locations?: { - /** Format: int64 */ - column?: number; - /** Format: int64 */ - line?: number; - }[]; - message?: string; - path?: string[]; - }; - /** @description GraphQL query based on: http://facebook.github.io/graphql/. */ - GraphQLQuery: { - /** @description The name of the operation if multiple exist in the query. */ - operationName?: string; - /** @description Query based on GraphQL syntax. */ - query?: string; - /** @description Additional variables for the query. */ - variables?: { - [key: string]: unknown; - }; - }; - /** @description A list of GraphQL queries. */ - GraphQLQueries: definitions['GraphQLQuery'][]; - /** @description GraphQL based response: http://facebook.github.io/graphql/. */ - GraphQLResponse: { - /** @description GraphQL data object. */ - data?: { - [key: string]: definitions['JsonObject']; - }; - /** @description Array with errors. */ - errors?: definitions['GraphQLError'][]; - }; - /** @description A list of GraphQL responses. */ - GraphQLResponses: definitions['GraphQLResponse'][]; - /** @description Configure the inverted index built into Weaviate */ - InvertedIndexConfig: { - /** - * Format: int - * @description Asynchronous index clean up happens every n seconds - */ - cleanupIntervalSeconds?: number; - bm25?: definitions['BM25Config']; - stopwords?: definitions['StopwordConfig']; - /** @description Index each object by its internal timestamps */ - indexTimestamps?: boolean; - /** @description Index each object with the null state */ - indexNullState?: boolean; - /** @description Index length of properties */ - indexPropertyLength?: boolean; - }; - /** @description Configure how replication is executed in a cluster */ - ReplicationConfig: { - /** @description Number of times a class is replicated */ - factor?: number; - /** @description Enable asynchronous replication */ - asyncEnabled?: boolean; - /** - * @description Conflict resolution strategy for deleted objects - * @enum {string} - */ - deletionStrategy?: 'NoAutomatedResolution' | 'DeleteOnConflict'; - }; - /** @description tuning parameters for the BM25 algorithm */ - BM25Config: { - /** - * Format: float - * @description calibrates term-weight scaling based on the term frequency within a document - */ - k1?: number; - /** - * Format: float - * @description calibrates term-weight scaling based on the document length - */ - b?: number; - }; - /** @description fine-grained control over stopword list usage */ - StopwordConfig: { - /** @description pre-existing list of common words by language */ - preset?: string; - /** @description stopwords to be considered additionally */ - additions?: string[]; - /** @description stopwords to be removed from consideration */ - removals?: string[]; - }; - /** @description Configuration related to multi-tenancy within a class */ - MultiTenancyConfig: { - /** @description Whether or not multi-tenancy is enabled for this class */ - enabled?: boolean; - /** @description Nonexistent tenants should (not) be created implicitly */ - autoTenantCreation?: boolean; - /** @description Existing tenants should (not) be turned HOT implicitly when they are accessed and in another activity status */ - autoTenantActivation?: boolean; - }; - /** @description JSON object value. */ - JsonObject: { - [key: string]: unknown; - }; - /** @description Contains meta information of the current Weaviate instance. */ - Meta: { - /** - * Format: url - * @description The url of the host. - */ - hostname?: string; - /** @description Version of weaviate you are currently running */ - version?: string; - /** @description Module-specific meta information */ - modules?: { - [key: string]: unknown; - }; - }; - /** @description Multiple instances of references to other objects. */ - MultipleRef: definitions['SingleRef'][]; - /** @description Either a JSONPatch document as defined by RFC 6902 (from, op, path, value), or a merge document (RFC 7396). */ - PatchDocumentObject: { - /** @description A string containing a JSON Pointer value. */ - from?: string; - /** - * @description The operation to be performed. - * @enum {string} - */ - op: 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test'; - /** @description A JSON-Pointer. */ - path: string; - /** @description The value to be used within the operations. */ - value?: { - [key: string]: unknown; - }; - merge?: definitions['Object']; - }; - /** @description Either a JSONPatch document as defined by RFC 6902 (from, op, path, value), or a merge document (RFC 7396). */ - PatchDocumentAction: { - /** @description A string containing a JSON Pointer value. */ - from?: string; - /** - * @description The operation to be performed. - * @enum {string} - */ - op: 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test'; - /** @description A JSON-Pointer. */ - path: string; - /** @description The value to be used within the operations. */ - value?: { - [key: string]: unknown; - }; - merge?: definitions['Object']; - }; - /** @description A single peer in the network. */ - PeerUpdate: { - /** - * Format: uuid - * @description The session ID of the peer. - */ - id?: string; - /** @description Human readable name. */ - name?: string; - /** - * Format: uri - * @description The location where the peer is exposed to the internet. - */ - uri?: string; - /** @description The latest known hash of the peer's schema. */ - schemaHash?: string; - }; - /** @description List of known peers. */ - PeerUpdateList: definitions['PeerUpdate'][]; - /** @description Allow custom overrides of vector weights as math expressions. E.g. "pancake": "7" will set the weight for the word pancake to 7 in the vectorization, whereas "w * 3" would triple the originally calculated word. This is an open object, with OpenAPI Specification 3.0 this will be more detailed. See Weaviate docs for more info. In the future this will become a key/value (string/string) object. */ - VectorWeights: { - [key: string]: unknown; - }; - /** @description This is an open object, with OpenAPI Specification 3.0 this will be more detailed. See Weaviate docs for more info. In the future this will become a key/value OR a SingleRef definition. */ - PropertySchema: { - [key: string]: unknown; - }; - /** @description This is an open object, with OpenAPI Specification 3.0 this will be more detailed. See Weaviate docs for more info. In the future this will become a key/value OR a SingleRef definition. */ - SchemaHistory: { - [key: string]: unknown; - }; - /** @description Definitions of semantic schemas (also see: https://github.com/weaviate/weaviate-semantic-schemas). */ - Schema: { - /** @description Semantic classes that are available. */ - classes?: definitions['Class'][]; - /** - * Format: email - * @description Email of the maintainer. - */ - maintainer?: string; - /** @description Name of the schema. */ - name?: string; - }; - /** @description Indicates the health of the schema in a cluster. */ - SchemaClusterStatus: { - /** @description True if the cluster is in sync, false if there is an issue (see error). */ - healthy?: boolean; - /** @description Contains the sync check error if one occurred */ - error?: string; - /** @description Hostname of the coordinating node, i.e. the one that received the cluster. This can be useful information if the error message contains phrases such as 'other nodes agree, but local does not', etc. */ - hostname?: string; - /** - * Format: int - * @description Number of nodes that participated in the sync check - */ - nodeCount?: number; - /** @description The cluster check at startup can be ignored (to recover from an out-of-sync situation). */ - ignoreSchemaSync?: boolean; - }; - Class: { - /** @description Name of the class as URI relative to the schema URL. */ - class?: string; - vectorConfig?: { - [key: string]: definitions['VectorConfig']; - }; - /** @description Name of the vector index to use, eg. (HNSW) */ - vectorIndexType?: string; - /** @description Vector-index config, that is specific to the type of index selected in vectorIndexType */ - vectorIndexConfig?: { - [key: string]: unknown; - }; - /** @description Manage how the index should be sharded and distributed in the cluster */ - shardingConfig?: { - [key: string]: unknown; - }; - replicationConfig?: definitions['ReplicationConfig']; - invertedIndexConfig?: definitions['InvertedIndexConfig']; - multiTenancyConfig?: definitions['MultiTenancyConfig']; - /** @description Specify how the vectors for this class should be determined. The options are either 'none' - this means you have to import a vector with each object yourself - or the name of a module that provides vectorization capabilities, such as 'text2vec-contextionary'. If left empty, it will use the globally configured default which can itself either be 'none' or a specific module. */ - vectorizer?: string; - /** @description Configuration specific to modules this Weaviate instance has installed */ - moduleConfig?: { - [key: string]: unknown; - }; - /** @description Description of the class. */ - description?: string; - /** @description The properties of the class. */ - properties?: definitions['Property'][]; - }; - Property: { - /** @description Can be a reference to another type when it starts with a capital (for example Person), otherwise "string" or "int". */ - dataType?: string[]; - /** @description Description of the property. */ - description?: string; - /** @description Configuration specific to modules this Weaviate instance has installed */ - moduleConfig?: { - [key: string]: unknown; - }; - /** @description Name of the property as URI relative to the schema URL. */ - name?: string; - /** @description Optional. Should this property be indexed in the inverted index. Defaults to true. If you choose false, you will not be able to use this property in where filters, bm25 or hybrid search. This property has no affect on vectorization decisions done by modules (deprecated as of v1.19; use indexFilterable or/and indexSearchable instead) */ - indexInverted?: boolean; - /** @description Optional. Should this property be indexed in the inverted index. Defaults to true. If you choose false, you will not be able to use this property in where filters. This property has no affect on vectorization decisions done by modules */ - indexFilterable?: boolean; - /** @description Optional. Should this property be indexed in the inverted index. Defaults to true. Applicable only to properties of data type text and text[]. If you choose false, you will not be able to use this property in bm25 or hybrid search. This property has no affect on vectorization decisions done by modules */ - indexSearchable?: boolean; - /** @description Optional. Should this property be indexed in the inverted index. Defaults to false. Provides better performance for range queries compared to filterable index in large datasets. Applicable only to properties of data type int, number, date. */ - indexRangeFilters?: boolean; - /** - * @description Determines tokenization of the property as separate words or whole field. Optional. Applies to text and text[] data types. Allowed values are `word` (default; splits on any non-alphanumerical, lowercases), `lowercase` (splits on white spaces, lowercases), `whitespace` (splits on white spaces), `field` (trims). Not supported for remaining data types - * @enum {string} - */ - tokenization?: 'word' | 'lowercase' | 'whitespace' | 'field' | 'trigram' | 'gse' | 'kagome_kr'; - /** @description The properties of the nested object(s). Applies to object and object[] data types. */ - nestedProperties?: definitions['NestedProperty'][]; - }; - VectorConfig: { - /** @description Configuration of a specific vectorizer used by this vector */ - vectorizer?: { - [key: string]: unknown; - }; - /** @description Name of the vector index to use, eg. (HNSW) */ - vectorIndexType?: string; - /** @description Vector-index config, that is specific to the type of index selected in vectorIndexType */ - vectorIndexConfig?: { - [key: string]: unknown; - }; - }; - NestedProperty: { - dataType?: string[]; - description?: string; - name?: string; - indexFilterable?: boolean; - indexSearchable?: boolean; - indexRangeFilters?: boolean; - /** @enum {string} */ - tokenization?: 'word' | 'lowercase' | 'whitespace' | 'field'; - nestedProperties?: definitions['NestedProperty'][]; - }; - /** @description The status of all the shards of a Class */ - ShardStatusList: definitions['ShardStatusGetResponse'][]; - /** @description Response body of shard status get request */ - ShardStatusGetResponse: { - /** @description Name of the shard */ - name?: string; - /** @description Status of the shard */ - status?: string; - /** @description Size of the vector queue of the shard */ - vectorQueueSize?: number; - }; - /** @description The status of a single shard */ - ShardStatus: { - /** @description Status of the shard */ - status?: string; - }; - /** @description The definition of a backup create metadata */ - BackupCreateStatusResponse: { - /** @description The ID of the backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id?: string; - /** @description Backup backend name e.g. filesystem, gcs, s3. */ - backend?: string; - /** @description destination path of backup files proper to selected backend */ - path?: string; - /** @description error message if creation failed */ - error?: string; - /** - * @description phase of backup creation process - * @default STARTED - * @enum {string} - */ - status?: 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED' | 'CANCELED'; - }; - /** @description The definition of a backup restore metadata */ - BackupRestoreStatusResponse: { - /** @description The ID of the backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id?: string; - /** @description Backup backend name e.g. filesystem, gcs, s3. */ - backend?: string; - /** @description destination path of backup files proper to selected backup backend */ - path?: string; - /** @description error message if restoration failed */ - error?: string; - /** - * @description phase of backup restoration process - * @default STARTED - * @enum {string} - */ - status?: 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED' | 'CANCELED'; - }; - /** @description Backup custom configuration */ - BackupConfig: { - /** - * @description Desired CPU core utilization ranging from 1%-80% - * @default 50 - */ - CPUPercentage?: number; - /** - * @description Weaviate will attempt to come close the specified size, with a minimum of 2MB, default of 128MB, and a maximum of 512MB - * @default 128 - */ - ChunkSize?: number; - /** - * @description compression level used by compression algorithm - * @default DefaultCompression - * @enum {string} - */ - CompressionLevel?: 'DefaultCompression' | 'BestSpeed' | 'BestCompression'; - }; - /** @description Backup custom configuration */ - RestoreConfig: { - /** - * @description Desired CPU core utilization ranging from 1%-80% - * @default 50 - */ - CPUPercentage?: number; - }; - /** @description Request body for creating a backup of a set of classes */ - BackupCreateRequest: { - /** @description The ID of the backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id?: string; - /** @description Custom configuration for the backup creation process */ - config?: definitions['BackupConfig']; - /** @description List of classes to include in the backup creation process */ - include?: string[]; - /** @description List of classes to exclude from the backup creation process */ - exclude?: string[]; - }; - /** @description The definition of a backup create response body */ - BackupCreateResponse: { - /** @description The ID of the backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id?: string; - /** @description The list of classes for which the backup creation process was started */ - classes?: string[]; - /** @description Backup backend name e.g. filesystem, gcs, s3. */ - backend?: string; - /** @description destination path of backup files proper to selected backend */ - path?: string; - /** @description error message if creation failed */ - error?: string; - /** - * @description phase of backup creation process - * @default STARTED - * @enum {string} - */ - status?: 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED' | 'CANCELED'; - }; - /** @description The definition of a backup create response body */ - BackupListResponse: { - /** @description The ID of the backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id?: string; - /** @description destination path of backup files proper to selected backend */ - path?: string; - /** @description The list of classes for which the existed backup process */ - classes?: string[]; - /** - * @description status of backup process - * @enum {string} - */ - status?: 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED' | 'CANCELED'; - }[]; - /** @description Request body for restoring a backup for a set of classes */ - BackupRestoreRequest: { - /** @description Custom configuration for the backup restoration process */ - config?: definitions['RestoreConfig']; - /** @description List of classes to include in the backup restoration process */ - include?: string[]; - /** @description List of classes to exclude from the backup restoration process */ - exclude?: string[]; - /** @description Allows overriding the node names stored in the backup with different ones. Useful when restoring backups to a different environment. */ - node_mapping?: { - [key: string]: string; - }; - }; - /** @description The definition of a backup restore response body */ - BackupRestoreResponse: { - /** @description The ID of the backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id?: string; - /** @description The list of classes for which the backup restoration process was started */ - classes?: string[]; - /** @description Backup backend name e.g. filesystem, gcs, s3. */ - backend?: string; - /** @description destination path of backup files proper to selected backend */ - path?: string; - /** @description error message if restoration failed */ - error?: string; - /** - * @description phase of backup restoration process - * @default STARTED - * @enum {string} - */ - status?: 'STARTED' | 'TRANSFERRING' | 'TRANSFERRED' | 'SUCCESS' | 'FAILED' | 'CANCELED'; - }; - /** @description The summary of Weaviate's statistics. */ - NodeStats: { - /** - * Format: int - * @description The count of Weaviate's shards. - */ - shardCount?: number; - /** - * Format: int64 - * @description The total number of objects in DB. - */ - objectCount?: number; - }; - /** @description The summary of a nodes batch queue congestion status. */ - BatchStats: { - /** - * Format: int - * @description How many objects are currently in the batch queue. - */ - queueLength?: number; - /** - * Format: int - * @description How many objects are approximately processed from the batch queue per second. - */ - ratePerSecond?: number; - }; - /** @description The definition of a node shard status response body */ - NodeShardStatus: { - /** @description The name of the shard. */ - name?: string; - /** @description The name of shard's class. */ - class?: string; - /** - * Format: int64 - * @description The number of objects in shard. - */ - objectCount?: number; - /** - * Format: string - * @description The status of the vector indexing process. - */ - vectorIndexingStatus?: unknown; - /** - * Format: boolean - * @description The status of vector compression/quantization. - */ - compressed?: unknown; - /** - * Format: int64 - * @description The length of the vector indexing queue. - */ - vectorQueueLength?: number; - /** @description The load status of the shard. */ - loaded?: boolean; - }; - /** @description The definition of a backup node status response body */ - NodeStatus: { - /** @description The name of the node. */ - name?: string; - /** - * @description Node's status. - * @default HEALTHY - * @enum {string} - */ - status?: 'HEALTHY' | 'UNHEALTHY' | 'UNAVAILABLE' | 'TIMEOUT'; - /** @description The version of Weaviate. */ - version?: string; - /** @description The gitHash of Weaviate. */ - gitHash?: string; - /** @description Weaviate overall statistics. */ - stats?: definitions['NodeStats']; - /** @description Weaviate batch statistics. */ - batchStats?: definitions['BatchStats']; - /** @description The list of the shards with it's statistics. */ - shards?: definitions['NodeShardStatus'][]; - }; - /** @description The status of all of the Weaviate nodes */ - NodesStatusResponse: { - nodes?: definitions['NodeStatus'][]; - }; - /** @description The definition of Raft statistics. */ - RaftStatistics: { - appliedIndex?: string; - commitIndex?: string; - fsmPending?: string; - lastContact?: string; - lastLogIndex?: string; - lastLogTerm?: string; - lastSnapshotIndex?: string; - lastSnapshotTerm?: string; - /** @description Weaviate Raft nodes. */ - latestConfiguration?: { - [key: string]: unknown; - }; - latestConfigurationIndex?: string; - numPeers?: string; - protocolVersion?: string; - protocolVersionMax?: string; - protocolVersionMin?: string; - snapshotVersionMax?: string; - snapshotVersionMin?: string; - state?: string; - term?: string; - }; - /** @description The definition of node statistics. */ - Statistics: { - /** @description The name of the node. */ - name?: string; - /** - * @description Node's status. - * @default HEALTHY - * @enum {string} - */ - status?: 'HEALTHY' | 'UNHEALTHY' | 'UNAVAILABLE' | 'TIMEOUT'; - bootstrapped?: boolean; - dbLoaded?: boolean; - /** Format: uint64 */ - initialLastAppliedIndex?: number; - lastAppliedIndex?: number; - isVoter?: boolean; - leaderId?: { - [key: string]: unknown; - }; - leaderAddress?: { - [key: string]: unknown; - }; - open?: boolean; - ready?: boolean; - candidates?: { - [key: string]: unknown; - }; - /** @description Weaviate Raft statistics. */ - raft?: definitions['RaftStatistics']; - }; - /** @description The cluster statistics of all of the Weaviate nodes */ - ClusterStatisticsResponse: { - statistics?: definitions['Statistics'][]; - synchronized?: boolean; - }; - /** @description Either set beacon (direct reference) or set class and schema (concept reference) */ - SingleRef: { - /** - * Format: uri - * @description If using a concept reference (rather than a direct reference), specify the desired class name here - */ - class?: string; - /** @description If using a concept reference (rather than a direct reference), specify the desired properties here */ - schema?: definitions['PropertySchema']; - /** - * Format: uri - * @description If using a direct reference, specify the URI to point to the cross-ref here. Should be in the form of weaviate://localhost/ for the example of a local cross-ref to an object - */ - beacon?: string; - /** - * Format: uri - * @description If using a direct reference, this read-only fields provides a link to the referenced resource. If 'origin' is globally configured, an absolute URI is shown - a relative URI otherwise. - */ - href?: string; - /** @description Additional Meta information about classifications if the item was part of one */ - classification?: definitions['ReferenceMetaClassification']; - }; - /** @description Additional Meta information about a single object object. */ - AdditionalProperties: { - [key: string]: { - [key: string]: unknown; - }; - }; - /** @description This meta field contains additional info about the classified reference property */ - ReferenceMetaClassification: { - /** - * Format: int64 - * @description overall neighbors checked as part of the classification. In most cases this will equal k, but could be lower than k - for example if not enough data was present - */ - overallCount?: number; - /** - * Format: int64 - * @description size of the winning group, a number between 1..k - */ - winningCount?: number; - /** - * Format: int64 - * @description size of the losing group, can be 0 if the winning group size equals k - */ - losingCount?: number; - /** - * Format: float32 - * @description The lowest distance of any neighbor, regardless of whether they were in the winning or losing group - */ - closestOverallDistance?: number; - /** - * Format: float32 - * @description deprecated - do not use, to be removed in 0.23.0 - */ - winningDistance?: number; - /** - * Format: float32 - * @description Mean distance of all neighbors from the winning group - */ - meanWinningDistance?: number; - /** - * Format: float32 - * @description Closest distance of a neighbor from the winning group - */ - closestWinningDistance?: number; - /** - * Format: float32 - * @description The lowest distance of a neighbor in the losing group. Optional. If k equals the size of the winning group, there is no losing group - */ - closestLosingDistance?: number; - /** - * Format: float32 - * @description deprecated - do not use, to be removed in 0.23.0 - */ - losingDistance?: number; - /** - * Format: float32 - * @description Mean distance of all neighbors from the losing group. Optional. If k equals the size of the winning group, there is no losing group. - */ - meanLosingDistance?: number; - }; - BatchReference: { - /** - * Format: uri - * @description Long-form beacon-style URI to identify the source of the cross-ref including the property name. Should be in the form of weaviate://localhost////, where must be one of 'objects', 'objects' and and must represent the cross-ref property of source class to be used. - * @example weaviate://localhost/Zoo/a5d09582-4239-4702-81c9-92a6e0122bb4/hasAnimals - */ - from?: string; - /** - * Format: uri - * @description Short-form URI to point to the cross-ref. Should be in the form of weaviate://localhost/ for the example of a local cross-ref to an object - * @example weaviate://localhost/97525810-a9a5-4eb0-858a-71449aeb007f - */ - to?: string; - /** @description Name of the reference tenant. */ - tenant?: string; - }; - BatchReferenceResponse: definitions['BatchReference'] & { - /** - * Format: object - * @description Results for this specific reference. - */ - result?: { - /** - * @default SUCCESS - * @enum {string} - */ - status?: 'SUCCESS' | 'PENDING' | 'FAILED'; - errors?: definitions['ErrorResponse']; - }; - }; - GeoCoordinates: { - /** - * Format: float - * @description The latitude of the point on earth in decimal form - */ - latitude?: number; - /** - * Format: float - * @description The longitude of the point on earth in decimal form - */ - longitude?: number; - }; - PhoneNumber: { - /** @description The raw input as the phone number is present in your raw data set. It will be parsed into the standardized formats if valid. */ - input?: string; - /** @description Read-only. Parsed result in the international format (e.g. +49 123 ...) */ - internationalFormatted?: string; - /** @description Optional. The ISO 3166-1 alpha-2 country code. This is used to figure out the correct countryCode and international format if only a national number (e.g. 0123 4567) is provided */ - defaultCountry?: string; - /** - * Format: uint64 - * @description Read-only. The numerical country code (e.g. 49) - */ - countryCode?: number; - /** - * Format: uint64 - * @description Read-only. The numerical representation of the national part - */ - national?: number; - /** @description Read-only. Parsed result in the national format (e.g. 0123 456789) */ - nationalFormatted?: string; - /** @description Read-only. Indicates whether the parsed number is a valid phone number */ - valid?: boolean; - }; - Object: { - /** @description Class of the Object, defined in the schema. */ - class?: string; - vectorWeights?: definitions['VectorWeights']; - properties?: definitions['PropertySchema']; - /** - * Format: uuid - * @description ID of the Object. - */ - id?: string; - /** - * Format: int64 - * @description Timestamp of creation of this Object in milliseconds since epoch UTC. - */ - creationTimeUnix?: number; - /** - * Format: int64 - * @description Timestamp of the last Object update in milliseconds since epoch UTC. - */ - lastUpdateTimeUnix?: number; - /** @description This field returns vectors associated with the Object. C11yVector, Vector or Vectors values are possible. */ - vector?: definitions['C11yVector']; - /** @description This field returns vectors associated with the Object. */ - vectors?: definitions['Vectors']; - /** @description Name of the Objects tenant. */ - tenant?: string; - additional?: definitions['AdditionalProperties']; - }; - ObjectsGetResponse: definitions['Object'] & { - deprecations?: definitions['Deprecation'][]; - } & { - /** - * Format: object - * @description Results for this specific Object. - */ - result?: { - /** - * @default SUCCESS - * @enum {string} - */ - status?: 'SUCCESS' | 'PENDING' | 'FAILED'; - errors?: definitions['ErrorResponse']; - }; - }; - BatchDelete: { - /** @description Outlines how to find the objects to be deleted. */ - match?: { - /** - * @description Class (name) which objects will be deleted. - * @example City - */ - class?: string; - /** @description Filter to limit the objects to be deleted. */ - where?: definitions['WhereFilter']; - }; - /** - * @description Controls the verbosity of the output, possible values are: "minimal", "verbose". Defaults to "minimal". - * @default minimal - */ - output?: string; - /** - * @description If true, objects will not be deleted yet, but merely listed. Defaults to false. - * @default false - */ - dryRun?: boolean; - }; - /** @description Delete Objects response. */ - BatchDeleteResponse: { - /** @description Outlines how to find the objects to be deleted. */ - match?: { - /** - * @description Class (name) which objects will be deleted. - * @example City - */ - class?: string; - /** @description Filter to limit the objects to be deleted. */ - where?: definitions['WhereFilter']; - }; - /** - * @description Controls the verbosity of the output, possible values are: "minimal", "verbose". Defaults to "minimal". - * @default minimal - */ - output?: string; - /** - * @description If true, objects will not be deleted yet, but merely listed. Defaults to false. - * @default false - */ - dryRun?: boolean; - results?: { - /** - * Format: int64 - * @description How many objects were matched by the filter. - */ - matches?: number; - /** - * Format: int64 - * @description The most amount of objects that can be deleted in a single query, equals QUERY_MAXIMUM_RESULTS. - */ - limit?: number; - /** - * Format: int64 - * @description How many objects were successfully deleted in this round. - */ - successful?: number; - /** - * Format: int64 - * @description How many objects should have been deleted but could not be deleted. - */ - failed?: number; - /** @description With output set to "minimal" only objects with error occurred will the be described. Successfully deleted objects would be omitted. Output set to "verbose" will list all of the objets with their respective statuses. */ - objects?: { - /** - * Format: uuid - * @description ID of the Object. - */ - id?: string; - /** - * @default SUCCESS - * @enum {string} - */ - status?: 'SUCCESS' | 'DRYRUN' | 'FAILED'; - errors?: definitions['ErrorResponse']; - }[]; - }; - }; - /** @description List of Objects. */ - ObjectsListResponse: { - /** @description The actual list of Objects. */ - objects?: definitions['Object'][]; - deprecations?: definitions['Deprecation'][]; - /** - * Format: int64 - * @description The total number of Objects for the query. The number of items in a response may be smaller due to paging. - */ - totalResults?: number; - }; - /** @description Manage classifications, trigger them and view status of past classifications. */ - Classification: { - /** - * Format: uuid - * @description ID to uniquely identify this classification run - * @example ee722219-b8ec-4db1-8f8d-5150bb1a9e0c - */ - id?: string; - /** - * @description class (name) which is used in this classification - * @example City - */ - class?: string; - /** - * @description which ref-property to set as part of the classification - * @example [ - * "inCountry" - * ] - */ - classifyProperties?: string[]; - /** - * @description base the text-based classification on these fields (of type text) - * @example [ - * "description" - * ] - */ - basedOnProperties?: string[]; - /** - * @description status of this classification - * @example running - * @enum {string} - */ - status?: 'running' | 'completed' | 'failed'; - /** @description additional meta information about the classification */ - meta?: definitions['ClassificationMeta']; - /** @description which algorithm to use for classifications */ - type?: string; - /** @description classification-type specific settings */ - settings?: { - [key: string]: unknown; - }; - /** - * @description error message if status == failed - * @default - * @example classify xzy: something went wrong - */ - error?: string; - filters?: { - /** @description limit the objects to be classified */ - sourceWhere?: definitions['WhereFilter']; - /** @description Limit the training objects to be considered during the classification. Can only be used on types with explicit training sets, such as 'knn' */ - trainingSetWhere?: definitions['WhereFilter']; - /** @description Limit the possible sources when using an algorithm which doesn't really on training data, e.g. 'contextual'. When using an algorithm with a training set, such as 'knn', limit the training set instead */ - targetWhere?: definitions['WhereFilter']; - }; - }; - /** @description Additional information to a specific classification */ - ClassificationMeta: { - /** - * Format: date-time - * @description time when this classification was started - * @example 2017-07-21T17:32:28Z - */ - started?: string; - /** - * Format: date-time - * @description time when this classification finished - * @example 2017-07-21T17:32:28Z - */ - completed?: string; - /** - * @description number of objects which were taken into consideration for classification - * @example 147 - */ - count?: number; - /** - * @description number of objects successfully classified - * @example 140 - */ - countSucceeded?: number; - /** - * @description number of objects which could not be classified - see error message for details - * @example 7 - */ - countFailed?: number; - }; - /** @description Filter search results using a where filter */ - WhereFilter: { - /** @description combine multiple where filters, requires 'And' or 'Or' operator */ - operands?: definitions['WhereFilter'][]; - /** - * @description operator to use - * @example GreaterThanEqual - * @enum {string} - */ - operator?: - | 'And' - | 'Or' - | 'Equal' - | 'Like' - | 'NotEqual' - | 'GreaterThan' - | 'GreaterThanEqual' - | 'LessThan' - | 'LessThanEqual' - | 'WithinGeoRange' - | 'IsNull' - | 'ContainsAny' - | 'ContainsAll'; - /** - * @description path to the property currently being filtered - * @example [ - * "inCity", - * "City", - * "name" - * ] - */ - path?: string[]; - /** - * Format: int64 - * @description value as integer - * @example 2000 - */ - valueInt?: number; - /** - * Format: float64 - * @description value as number/float - * @example 3.14 - */ - valueNumber?: number; - /** - * @description value as boolean - * @example false - */ - valueBoolean?: boolean; - /** - * @description value as text (deprecated as of v1.19; alias for valueText) - * @example my search term - */ - valueString?: string; - /** - * @description value as text - * @example my search term - */ - valueText?: string; - /** - * @description value as date (as string) - * @example TODO - */ - valueDate?: string; - /** - * @description value as integer - * @example [100, 200] - */ - valueIntArray?: number[]; - /** - * @description value as number/float - * @example [ - * 3.14 - * ] - */ - valueNumberArray?: number[]; - /** - * @description value as boolean - * @example [ - * true, - * false - * ] - */ - valueBooleanArray?: boolean[]; - /** - * @description value as text (deprecated as of v1.19; alias for valueText) - * @example [ - * "my search term" - * ] - */ - valueStringArray?: string[]; - /** - * @description value as text - * @example [ - * "my search term" - * ] - */ - valueTextArray?: string[]; - /** - * @description value as date (as string) - * @example TODO - */ - valueDateArray?: string[]; - /** @description value as geo coordinates and distance */ - valueGeoRange?: definitions['WhereFilterGeoRange']; - }; - /** @description filter within a distance of a georange */ - WhereFilterGeoRange: { - geoCoordinates?: definitions['GeoCoordinates']; - distance?: { - /** Format: float64 */ - max?: number; - }; - }; - /** @description attributes representing a single tenant within weaviate */ - Tenant: { - /** @description name of the tenant */ - name?: string; - /** - * @description activity status of the tenant's shard. Optional for creating tenant (implicit `ACTIVE`) and required for updating tenant. For creation, allowed values are `ACTIVE` - tenant is fully active and `INACTIVE` - tenant is inactive; no actions can be performed on tenant, tenant's files are stored locally. For updating, `ACTIVE`, `INACTIVE` and also `OFFLOADED` - as INACTIVE, but files are stored on cloud storage. The following values are read-only and are set by the server for internal use: `OFFLOADING` - tenant is transitioning from ACTIVE/INACTIVE to OFFLOADED, `ONLOADING` - tenant is transitioning from OFFLOADED to ACTIVE/INACTIVE. We still accept deprecated names `HOT` (now `ACTIVE`), `COLD` (now `INACTIVE`), `FROZEN` (now `OFFLOADED`), `FREEZING` (now `OFFLOADING`), `UNFREEZING` (now `ONLOADING`). - * @enum {string} - */ - activityStatus?: - | 'ACTIVE' - | 'INACTIVE' - | 'OFFLOADED' - | 'OFFLOADING' - | 'ONLOADING' - | 'HOT' - | 'COLD' - | 'FROZEN' - | 'FREEZING' - | 'UNFREEZING'; - }; -} -export interface parameters { - /** @description The starting ID of the result window. */ - CommonAfterParameterQuery: string; - /** - * Format: int64 - * @description The starting index of the result window. Default value is 0. - * @default 0 - */ - CommonOffsetParameterQuery: number; - /** - * Format: int64 - * @description The maximum number of items to be returned per page. Default value is set in Weaviate config. - */ - CommonLimitParameterQuery: number; - /** @description Include additional information, such as classification infos. Allowed values include: classification, vector, interpretation */ - CommonIncludeParameterQuery: string; - /** @description Determines how many replicas must acknowledge a request before it is considered successful */ - CommonConsistencyLevelParameterQuery: string; - /** @description Specifies the tenant in a request targeting a multi-tenant class */ - CommonTenantParameterQuery: string; - /** @description The target node which should fulfill the request */ - CommonNodeNameParameterQuery: string; - /** @description Sort parameter to pass an information about the names of the sort fields */ - CommonSortParameterQuery: string; - /** @description Order parameter to tell how to order (asc or desc) data within given field */ - CommonOrderParameterQuery: string; - /** @description Class parameter specifies the class from which to query objects */ - CommonClassParameterQuery: string; - /** - * @description Controls the verbosity of the output, possible values are: "minimal", "verbose". Defaults to "minimal". - * @default minimal - */ - CommonOutputVerbosityParameterQuery: string; -} -export interface operations { - /** Home. Discover the REST API */ - 'weaviate.root': { - responses: { - /** Weaviate is alive and ready to serve content */ - 200: { - schema: { - links?: definitions['Link'][]; - }; - }; - }; - }; - /** Determines whether the application is alive. Can be used for kubernetes liveness probe */ - 'weaviate.wellknown.liveness': { - responses: { - /** The application is able to respond to HTTP requests */ - 200: unknown; - }; - }; - /** Determines whether the application is ready to receive traffic. Can be used for kubernetes readiness probe. */ - 'weaviate.wellknown.readiness': { - responses: { - /** The application has completed its start-up routine and is ready to accept traffic. */ - 200: unknown; - /** The application is currently not able to serve traffic. If other horizontal replicas of weaviate are available and they are capable of receiving traffic, all traffic should be redirected there instead. */ - 503: unknown; - }; - }; - /** Lists all Objects in reverse order of creation, owned by the user that belongs to the used token. */ - 'objects.list': { - parameters: { - query: { - /** The starting ID of the result window. */ - after?: parameters['CommonAfterParameterQuery']; - /** The starting index of the result window. Default value is 0. */ - offset?: parameters['CommonOffsetParameterQuery']; - /** The maximum number of items to be returned per page. Default value is set in Weaviate config. */ - limit?: parameters['CommonLimitParameterQuery']; - /** Include additional information, such as classification infos. Allowed values include: classification, vector, interpretation */ - include?: parameters['CommonIncludeParameterQuery']; - /** Sort parameter to pass an information about the names of the sort fields */ - sort?: parameters['CommonSortParameterQuery']; - /** Order parameter to tell how to order (asc or desc) data within given field */ - order?: parameters['CommonOrderParameterQuery']; - /** Class parameter specifies the class from which to query objects */ - class?: parameters['CommonClassParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successful response. */ - 200: { - schema: definitions['ObjectsListResponse']; - }; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Registers a new Object. Provided meta-data and schema values are validated. */ - 'objects.create': { - parameters: { - body: { - body: definitions['Object']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - }; - }; - responses: { - /** Object created. */ - 200: { - schema: definitions['Object']; - }; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Lists Objects. */ - 'objects.get': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - }; - query: { - /** Include additional information, such as classification infos. Allowed values include: classification, vector, interpretation */ - include?: parameters['CommonIncludeParameterQuery']; - }; - }; - responses: { - /** Successful response. */ - 200: { - schema: definitions['Object']; - }; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Updates an Object's data. Given meta-data and schema values are validated. LastUpdateTime is set to the time this function is called. */ - 'objects.update': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - }; - body: { - body: definitions['Object']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - }; - }; - responses: { - /** Successfully received. */ - 200: { - schema: definitions['Object']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Deletes an Object from the system. */ - 'objects.delete': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully deleted. */ - 204: never; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Checks if an Object exists in the system. */ - 'objects.head': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - }; - }; - responses: { - /** Object exists. */ - 204: never; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Object doesn't exist. */ - 404: unknown; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Updates an Object. This method supports json-merge style patch semantics (RFC 7396). Provided meta-data and schema values are validated. LastUpdateTime is set to the time this function is called. */ - 'objects.patch': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - }; - body: { - /** RFC 7396-style patch, the body contains the object to merge into the existing object. */ - body?: definitions['Object']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - }; - }; - responses: { - /** Successfully applied. No content provided. */ - 204: never; - /** The patch-JSON is malformed. */ - 400: unknown; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** The patch-JSON is valid but unprocessable. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Get a single data object */ - 'objects.class.get': { - parameters: { - path: { - className: string; - /** Unique ID of the Object. */ - id: string; - }; - query: { - /** Include additional information, such as classification infos. Allowed values include: classification, vector, interpretation */ - include?: parameters['CommonIncludeParameterQuery']; - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** The target node which should fulfill the request */ - node_name?: parameters['CommonNodeNameParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successful response. */ - 200: { - schema: definitions['Object']; - }; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** Request is well-formed (i.e., syntactically correct), but erroneous. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Update an individual data object based on its class and uuid. */ - 'objects.class.put': { - parameters: { - path: { - className: string; - /** The uuid of the data object to update. */ - id: string; - }; - body: { - body: definitions['Object']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - }; - }; - responses: { - /** Successfully received. */ - 200: { - schema: definitions['Object']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Delete a single data object. */ - 'objects.class.delete': { - parameters: { - path: { - className: string; - /** Unique ID of the Object. */ - id: string; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully deleted. */ - 204: never; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** Request is well-formed (i.e., syntactically correct), but erroneous. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Checks if a data object exists without retrieving it. */ - 'objects.class.head': { - parameters: { - path: { - /** The class name as defined in the schema */ - className: string; - /** The uuid of the data object */ - id: string; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Object exists. */ - 204: never; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Object doesn't exist. */ - 404: unknown; - /** Request is well-formed (i.e., syntactically correct), but erroneous. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Update an individual data object based on its class and uuid. This method supports json-merge style patch semantics (RFC 7396). Provided meta-data and schema values are validated. LastUpdateTime is set to the time this function is called. */ - 'objects.class.patch': { - parameters: { - path: { - /** The class name as defined in the schema */ - className: string; - /** The uuid of the data object to update. */ - id: string; - }; - body: { - /** RFC 7396-style patch, the body contains the object to merge into the existing object. */ - body?: definitions['Object']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - }; - }; - responses: { - /** Successfully applied. No content provided. */ - 204: never; - /** The patch-JSON is malformed. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: unknown; - /** The patch-JSON is valid but unprocessable. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Replace all references to a class-property. */ - 'objects.references.update': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - /** Unique name of the property related to the Object. */ - propertyName: string; - }; - body: { - body: definitions['MultipleRef']; - }; - query: { - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully replaced all the references. */ - 200: unknown; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the property exists or that it is a class? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Add a single reference to a class-property. */ - 'objects.references.create': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - /** Unique name of the property related to the Object. */ - propertyName: string; - }; - body: { - body: definitions['SingleRef']; - }; - query: { - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully added the reference. */ - 200: unknown; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the property exists or that it is a class? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Delete the single reference that is given in the body from the list of references that this property has. */ - 'objects.references.delete': { - parameters: { - path: { - /** Unique ID of the Object. */ - id: string; - /** Unique name of the property related to the Object. */ - propertyName: string; - }; - body: { - body: definitions['SingleRef']; - }; - query: { - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully deleted. */ - 204: never; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Update all references of a property of a data object. */ - 'objects.class.references.put': { - parameters: { - path: { - /** The class name as defined in the schema */ - className: string; - /** Unique ID of the Object. */ - id: string; - /** Unique name of the property related to the Object. */ - propertyName: string; - }; - body: { - body: definitions['MultipleRef']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully replaced all the references. */ - 200: unknown; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Source object doesn't exist. */ - 404: unknown; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the property exists or that it is a class? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Add a single reference to a class-property. */ - 'objects.class.references.create': { - parameters: { - path: { - /** The class name as defined in the schema */ - className: string; - /** Unique ID of the Object. */ - id: string; - /** Unique name of the property related to the Object. */ - propertyName: string; - }; - body: { - body: definitions['SingleRef']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully added the reference. */ - 200: unknown; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Source object doesn't exist. */ - 404: unknown; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the property exists or that it is a class? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Delete the single reference that is given in the body from the list of references that this property of a data object has */ - 'objects.class.references.delete': { - parameters: { - path: { - /** The class name as defined in the schema */ - className: string; - /** Unique ID of the Object. */ - id: string; - /** Unique name of the property related to the Object. */ - propertyName: string; - }; - body: { - body: definitions['SingleRef']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Successfully deleted. */ - 204: never; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Successful query result but no resource was found. */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the property exists or that it is a class? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Validate an Object's schema and meta-data. It has to be based on a schema, which is related to the given Object to be accepted by this validation. */ - 'objects.validate': { - parameters: { - body: { - body: definitions['Object']; - }; - }; - responses: { - /** Successfully validated. */ - 200: unknown; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Register new Objects in bulk. Provided meta-data and schema values are validated. */ - 'batch.objects.create': { - parameters: { - body: { - body: { - /** @description Define which fields need to be returned. Default value is ALL */ - fields?: ('ALL' | 'class' | 'schema' | 'id' | 'creationTimeUnix')[]; - objects?: definitions['Object'][]; - }; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - }; - }; - responses: { - /** Request succeeded, see response body to get detailed information about each batched item. */ - 200: { - schema: definitions['ObjectsGetResponse'][]; - }; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Delete Objects in bulk that match a certain filter. */ - 'batch.objects.delete': { - parameters: { - body: { - body: definitions['BatchDelete']; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - /** Specifies the tenant in a request targeting a multi-tenant class */ - tenant?: parameters['CommonTenantParameterQuery']; - }; - }; - responses: { - /** Request succeeded, see response body to get detailed information about each batched item. */ - 200: { - schema: definitions['BatchDeleteResponse']; - }; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Register cross-references between any class items (objects or objects) in bulk. */ - 'batch.references.create': { - parameters: { - body: { - /** A list of references to be batched. The ideal size depends on the used database connector. Please see the documentation of the used connector for help */ - body: definitions['BatchReference'][]; - }; - query: { - /** Determines how many replicas must acknowledge a request before it is considered successful */ - consistency_level?: parameters['CommonConsistencyLevelParameterQuery']; - }; - }; - responses: { - /** Request Successful. Warning: A successful request does not guarantee that every batched reference was successfully created. Inspect the response body to see which references succeeded and which failed. */ - 200: { - schema: definitions['BatchReferenceResponse'][]; - }; - /** Malformed request. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Get an object based on GraphQL */ - 'graphql.post': { - parameters: { - body: { - /** The GraphQL query request parameters. */ - body: definitions['GraphQLQuery']; - }; - }; - responses: { - /** Successful query (with select). */ - 200: { - schema: definitions['GraphQLResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Perform a batched GraphQL query */ - 'graphql.batch': { - parameters: { - body: { - /** The GraphQL queries. */ - body: definitions['GraphQLQueries']; - }; - }; - responses: { - /** Successful query (with select). */ - 200: { - schema: definitions['GraphQLResponses']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Request body is well-formed (i.e., syntactically correct), but semantically erroneous. Are you sure the class is defined in the configuration file? */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Gives meta information about the server and can be used to provide information to another Weaviate instance that wants to interact with the current instance. */ - 'meta.get': { - responses: { - /** Successful response. */ - 200: { - schema: definitions['Meta']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - 'schema.dump': { - parameters: { - header: { - /** If consistency is true, the request will be proxied to the leader to ensure strong schema consistency */ - consistency?: boolean; - }; - }; - responses: { - /** Successfully dumped the database schema. */ - 200: { - schema: definitions['Schema']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - 'schema.objects.create': { - parameters: { - body: { - objectClass: definitions['Class']; - }; - }; - responses: { - /** Added the new Object class to the schema. */ - 200: { - schema: definitions['Class']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid Object class */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - 'schema.objects.get': { - parameters: { - path: { - className: string; - }; - header: { - /** If consistency is true, the request will be proxied to the leader to ensure strong schema consistency */ - consistency?: boolean; - }; - }; - responses: { - /** Found the Class, returned as body */ - 200: { - schema: definitions['Class']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** This class does not exist */ - 404: unknown; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Use this endpoint to alter an existing class in the schema. Note that not all settings are mutable. If an error about immutable fields is returned and you still need to update this particular setting, you will have to delete the class (and the underlying data) and recreate. This endpoint cannot be used to modify properties. Instead use POST /v1/schema/{className}/properties. A typical use case for this endpoint is to update configuration, such as the vectorIndexConfig. Note that even in mutable sections, such as vectorIndexConfig, some fields may be immutable. */ - 'schema.objects.update': { - parameters: { - path: { - className: string; - }; - body: { - objectClass: definitions['Class']; - }; - }; - responses: { - /** Class was updated successfully */ - 200: { - schema: definitions['Class']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Class to be updated does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** Invalid update attempt */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - 'schema.objects.delete': { - parameters: { - path: { - className: string; - }; - }; - responses: { - /** Removed the Object class from the schema. */ - 200: unknown; - /** Could not delete the Object class. */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - 'schema.objects.properties.add': { - parameters: { - path: { - className: string; - }; - body: { - body: definitions['Property']; - }; - }; - responses: { - /** Added the property. */ - 200: { - schema: definitions['Property']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid property. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - 'schema.objects.shards.get': { - parameters: { - path: { - className: string; - }; - query: { - tenant?: string; - }; - }; - responses: { - /** Found the status of the shards, returned as body */ - 200: { - schema: definitions['ShardStatusList']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** This class does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Update shard status of an Object Class */ - 'schema.objects.shards.update': { - parameters: { - path: { - className: string; - shardName: string; - }; - body: { - body: definitions['ShardStatus']; - }; - }; - responses: { - /** Shard status was updated successfully */ - 200: { - schema: definitions['ShardStatus']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Shard to be updated does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** Invalid update attempt */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** get all tenants from a specific class */ - 'tenants.get': { - parameters: { - path: { - className: string; - }; - header: { - /** If consistency is true, the request will be proxied to the leader to ensure strong schema consistency */ - consistency?: boolean; - }; - }; - responses: { - /** tenants from specified class. */ - 200: { - schema: definitions['Tenant'][]; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid Tenant class */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Update tenant of a specific class */ - 'tenants.update': { - parameters: { - path: { - className: string; - }; - body: { - body: definitions['Tenant'][]; - }; - }; - responses: { - /** Updated tenants of the specified class */ - 200: { - schema: definitions['Tenant'][]; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid Tenant class */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Create a new tenant for a specific class */ - 'tenants.create': { - parameters: { - path: { - className: string; - }; - body: { - body: definitions['Tenant'][]; - }; - }; - responses: { - /** Added new tenants to the specified class */ - 200: { - schema: definitions['Tenant'][]; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid Tenant class */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** delete tenants from a specific class */ - 'tenants.delete': { - parameters: { - path: { - className: string; - }; - body: { - tenants: string[]; - }; - }; - responses: { - /** Deleted tenants from specified class. */ - 200: unknown; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid Tenant class */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Check if a tenant exists for a specific class */ - 'tenant.exists': { - parameters: { - path: { - className: string; - tenantName: string; - }; - header: { - /** If consistency is true, the request will be proxied to the leader to ensure strong schema consistency */ - consistency?: boolean; - }; - }; - responses: { - /** The tenant exists in the specified class */ - 200: unknown; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** The tenant not found */ - 404: unknown; - /** Invalid Tenant class */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** [Coming soon] List all backups in progress not implemented yet. */ - 'backups.list': { - parameters: { - path: { - /** Backup backend name e.g. filesystem, gcs, s3. */ - backend: string; - }; - }; - responses: { - /** Existed backups */ - 200: { - schema: definitions['BackupListResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup list. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Starts a process of creating a backup for a set of classes */ - 'backups.create': { - parameters: { - path: { - /** Backup backend name e.g. filesystem, gcs, s3. */ - backend: string; - }; - body: { - body: definitions['BackupCreateRequest']; - }; - }; - responses: { - /** Backup create process successfully started. */ - 200: { - schema: definitions['BackupCreateResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup creation attempt. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Returns status of backup creation attempt for a set of classes */ - 'backups.create.status': { - parameters: { - path: { - /** Backup backend name e.g. filesystem, gcs, s3. */ - backend: string; - /** The ID of a backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id: string; - }; - }; - responses: { - /** Backup creation status successfully returned */ - 200: { - schema: definitions['BackupCreateStatusResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Not Found - Backup does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup restoration status attempt. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Cancel created backup with specified ID */ - 'backups.cancel': { - parameters: { - path: { - /** Backup backend name e.g. filesystem, gcs, s3. */ - backend: string; - /** The ID of a backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id: string; - }; - }; - responses: { - /** Successfully deleted. */ - 204: never; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup cancellation attempt. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Returns status of a backup restoration attempt for a set of classes */ - 'backups.restore.status': { - parameters: { - path: { - /** Backup backend name e.g. filesystem, gcs, s3. */ - backend: string; - /** The ID of a backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id: string; - }; - }; - responses: { - /** Backup restoration status successfully returned */ - 200: { - schema: definitions['BackupRestoreStatusResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Not Found - Backup does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Starts a process of restoring a backup for a set of classes */ - 'backups.restore': { - parameters: { - path: { - /** Backup backend name e.g. filesystem, gcs, s3. */ - backend: string; - /** The ID of a backup. Must be URL-safe and work as a filesystem path, only lowercase, numbers, underscore, minus characters allowed. */ - id: string; - }; - body: { - body: definitions['BackupRestoreRequest']; - }; - }; - responses: { - /** Backup restoration process successfully started. */ - 200: { - schema: definitions['BackupRestoreResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Not Found - Backup does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup restoration attempt. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Returns Raft cluster statistics of Weaviate DB. */ - 'cluster.get.statistics': { - responses: { - /** Cluster statistics successfully returned */ - 200: { - schema: definitions['ClusterStatisticsResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup restoration status attempt. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Returns status of Weaviate DB. */ - 'nodes.get': { - parameters: { - query: { - /** Controls the verbosity of the output, possible values are: "minimal", "verbose". Defaults to "minimal". */ - output?: parameters['CommonOutputVerbosityParameterQuery']; - }; - }; - responses: { - /** Nodes status successfully returned */ - 200: { - schema: definitions['NodesStatusResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Not Found - Backup does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup restoration status attempt. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Returns status of Weaviate DB. */ - 'nodes.get.class': { - parameters: { - path: { - className: string; - }; - query: { - /** Controls the verbosity of the output, possible values are: "minimal", "verbose". Defaults to "minimal". */ - output?: parameters['CommonOutputVerbosityParameterQuery']; - }; - }; - responses: { - /** Nodes status successfully returned */ - 200: { - schema: definitions['NodesStatusResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Not Found - Backup does not exist */ - 404: { - schema: definitions['ErrorResponse']; - }; - /** Invalid backup restoration status attempt. */ - 422: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Trigger a classification based on the specified params. Classifications will run in the background, use GET /classifications/ to retrieve the status of your classification. */ - 'classifications.post': { - parameters: { - body: { - /** parameters to start a classification */ - params: definitions['Classification']; - }; - }; - responses: { - /** Successfully started classification. */ - 201: { - schema: definitions['Classification']; - }; - /** Incorrect request */ - 400: { - schema: definitions['ErrorResponse']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; - /** Get status, results and metadata of a previously created classification */ - 'classifications.get': { - parameters: { - path: { - /** classification id */ - id: string; - }; - }; - responses: { - /** Found the classification, returned as body */ - 200: { - schema: definitions['Classification']; - }; - /** Unauthorized or invalid credentials. */ - 401: unknown; - /** Forbidden */ - 403: { - schema: definitions['ErrorResponse']; - }; - /** Not Found - Classification does not exist */ - 404: unknown; - /** An error has occurred while trying to fulfill the request. Most likely the ErrorResponse will contain more information about the error. */ - 500: { - schema: definitions['ErrorResponse']; - }; - }; - }; -} -export interface external {} diff --git a/dist/node/esm/openapi/schema.js b/dist/node/esm/openapi/schema.js deleted file mode 100644 index 6738d94e..00000000 --- a/dist/node/esm/openapi/schema.js +++ /dev/null @@ -1,5 +0,0 @@ -/** - * This file was auto-generated by openapi-typescript. - * Do not make direct changes to the file. - */ -export {}; diff --git a/dist/node/esm/openapi/types.d.ts b/dist/node/esm/openapi/types.d.ts deleted file mode 100644 index 4ab8f2a9..00000000 --- a/dist/node/esm/openapi/types.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { definitions } from './schema.js'; -type Override = Omit & T2; -type DefaultProperties = { - [key: string]: unknown; -}; -export type WeaviateObject = Override< - definitions['Object'], - { - properties?: T; - } ->; -export type WeaviateObjectsList = definitions['ObjectsListResponse']; -export type WeaviateObjectsGet = definitions['ObjectsGetResponse']; -export type Reference = definitions['SingleRef']; -export type WeaviateError = definitions['ErrorResponse']; -export type Properties = definitions['PropertySchema']; -export type Property = definitions['Property']; -export type DataObject = definitions['Object']; -export type BackupCreateRequest = definitions['BackupCreateRequest']; -export type BackupCreateResponse = definitions['BackupCreateResponse']; -export type BackupCreateStatusResponse = definitions['BackupCreateStatusResponse']; -export type BackupRestoreRequest = definitions['BackupRestoreRequest']; -export type BackupRestoreResponse = definitions['BackupRestoreResponse']; -export type BackupRestoreStatusResponse = definitions['BackupRestoreStatusResponse']; -export type BackupConfig = definitions['BackupConfig']; -export type RestoreConfig = definitions['RestoreConfig']; -export type BatchDelete = definitions['BatchDelete']; -export type BatchDeleteResponse = definitions['BatchDeleteResponse']; -export type BatchRequest = { - fields?: ('ALL' | 'class' | 'schema' | 'id' | 'creationTimeUnix')[]; - objects?: WeaviateObject[]; -}; -export type BatchReference = definitions['BatchReference']; -export type BatchReferenceResponse = definitions['BatchReferenceResponse']; -export type C11yWordsResponse = definitions['C11yWordsResponse']; -export type C11yExtension = definitions['C11yExtension']; -export type Classification = definitions['Classification']; -export type WhereFilter = definitions['WhereFilter']; -export type WeaviateSchema = definitions['Schema']; -export type WeaviateClass = definitions['Class']; -export type WeaviateProperty = definitions['Property']; -export type WeaviateNestedProperty = definitions['NestedProperty']; -export type ShardStatus = definitions['ShardStatus']; -export type ShardStatusList = definitions['ShardStatusList']; -export type Tenant = definitions['Tenant']; -export type TenantActivityStatus = Tenant['activityStatus']; -export type SchemaClusterStatus = definitions['SchemaClusterStatus']; -export type WeaviateModuleConfig = WeaviateClass['moduleConfig']; -export type WeaviateInvertedIndexConfig = WeaviateClass['invertedIndexConfig']; -export type WeaviateBM25Config = definitions['BM25Config']; -export type WeaviateStopwordConfig = definitions['StopwordConfig']; -export type WeaviateMultiTenancyConfig = WeaviateClass['multiTenancyConfig']; -export type WeaviateReplicationConfig = WeaviateClass['replicationConfig']; -export type WeaviateShardingConfig = WeaviateClass['shardingConfig']; -export type WeaviateShardStatus = definitions['ShardStatusGetResponse']; -export type WeaviateVectorIndexConfig = WeaviateClass['vectorIndexConfig']; -export type WeaviateVectorsConfig = WeaviateClass['vectorConfig']; -export type WeaviateVectorConfig = definitions['VectorConfig']; -export type NodesStatusResponse = definitions['NodesStatusResponse']; -export type NodeStats = definitions['NodeStats']; -export type BatchStats = definitions['BatchStats']; -export type NodeShardStatus = definitions['NodeShardStatus']; -export type Meta = definitions['Meta']; -export {}; diff --git a/dist/node/esm/openapi/types.js b/dist/node/esm/openapi/types.js deleted file mode 100644 index cb0ff5c3..00000000 --- a/dist/node/esm/openapi/types.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/node/esm/package.json b/dist/node/esm/package.json deleted file mode 100644 index 6990891f..00000000 --- a/dist/node/esm/package.json +++ /dev/null @@ -1 +0,0 @@ -{"type": "module"} diff --git a/dist/node/esm/proto/google/health/v1/health.d.ts b/dist/node/esm/proto/google/health/v1/health.d.ts deleted file mode 100644 index c70d64a3..00000000 --- a/dist/node/esm/proto/google/health/v1/health.d.ts +++ /dev/null @@ -1,189 +0,0 @@ -import { type CallContext, type CallOptions } from 'nice-grpc-common'; -import _m0 from 'protobufjs/minimal.js'; -export declare const protobufPackage = 'grpc.health.v1'; -export interface HealthCheckRequest { - service: string; -} -export interface HealthCheckResponse { - status: HealthCheckResponse_ServingStatus; -} -export declare enum HealthCheckResponse_ServingStatus { - UNKNOWN = 0, - SERVING = 1, - NOT_SERVING = 2, - /** SERVICE_UNKNOWN - Used only by the Watch method. */ - SERVICE_UNKNOWN = 3, - UNRECOGNIZED = -1, -} -export declare function healthCheckResponse_ServingStatusFromJSON( - object: any -): HealthCheckResponse_ServingStatus; -export declare function healthCheckResponse_ServingStatusToJSON( - object: HealthCheckResponse_ServingStatus -): string; -export declare const HealthCheckRequest: { - encode(message: HealthCheckRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): HealthCheckRequest; - fromJSON(object: any): HealthCheckRequest; - toJSON(message: HealthCheckRequest): unknown; - create(base?: DeepPartial): HealthCheckRequest; - fromPartial(object: DeepPartial): HealthCheckRequest; -}; -export declare const HealthCheckResponse: { - encode(message: HealthCheckResponse, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): HealthCheckResponse; - fromJSON(object: any): HealthCheckResponse; - toJSON(message: HealthCheckResponse): unknown; - create(base?: DeepPartial): HealthCheckResponse; - fromPartial(object: DeepPartial): HealthCheckResponse; -}; -export type HealthDefinition = typeof HealthDefinition; -export declare const HealthDefinition: { - readonly name: 'Health'; - readonly fullName: 'grpc.health.v1.Health'; - readonly methods: { - /** - * If the requested service is unknown, the call will fail with status - * NOT_FOUND. - */ - readonly check: { - readonly name: 'Check'; - readonly requestType: { - encode(message: HealthCheckRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): HealthCheckRequest; - fromJSON(object: any): HealthCheckRequest; - toJSON(message: HealthCheckRequest): unknown; - create(base?: DeepPartial): HealthCheckRequest; - fromPartial(object: DeepPartial): HealthCheckRequest; - }; - readonly requestStream: false; - readonly responseType: { - encode(message: HealthCheckResponse, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): HealthCheckResponse; - fromJSON(object: any): HealthCheckResponse; - toJSON(message: HealthCheckResponse): unknown; - create(base?: DeepPartial): HealthCheckResponse; - fromPartial(object: DeepPartial): HealthCheckResponse; - }; - readonly responseStream: false; - readonly options: {}; - }; - /** - * Performs a watch for the serving status of the requested service. - * The server will immediately send back a message indicating the current - * serving status. It will then subsequently send a new message whenever - * the service's serving status changes. - * - * If the requested service is unknown when the call is received, the - * server will send a message setting the serving status to - * SERVICE_UNKNOWN but will *not* terminate the call. If at some - * future point, the serving status of the service becomes known, the - * server will send a new message with the service's serving status. - * - * If the call terminates with status UNIMPLEMENTED, then clients - * should assume this method is not supported and should not retry the - * call. If the call terminates with any other status (including OK), - * clients should retry the call with appropriate exponential backoff. - */ - readonly watch: { - readonly name: 'Watch'; - readonly requestType: { - encode(message: HealthCheckRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): HealthCheckRequest; - fromJSON(object: any): HealthCheckRequest; - toJSON(message: HealthCheckRequest): unknown; - create(base?: DeepPartial): HealthCheckRequest; - fromPartial(object: DeepPartial): HealthCheckRequest; - }; - readonly requestStream: false; - readonly responseType: { - encode(message: HealthCheckResponse, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): HealthCheckResponse; - fromJSON(object: any): HealthCheckResponse; - toJSON(message: HealthCheckResponse): unknown; - create(base?: DeepPartial): HealthCheckResponse; - fromPartial(object: DeepPartial): HealthCheckResponse; - }; - readonly responseStream: true; - readonly options: {}; - }; - }; -}; -export interface HealthServiceImplementation { - /** - * If the requested service is unknown, the call will fail with status - * NOT_FOUND. - */ - check( - request: HealthCheckRequest, - context: CallContext & CallContextExt - ): Promise>; - /** - * Performs a watch for the serving status of the requested service. - * The server will immediately send back a message indicating the current - * serving status. It will then subsequently send a new message whenever - * the service's serving status changes. - * - * If the requested service is unknown when the call is received, the - * server will send a message setting the serving status to - * SERVICE_UNKNOWN but will *not* terminate the call. If at some - * future point, the serving status of the service becomes known, the - * server will send a new message with the service's serving status. - * - * If the call terminates with status UNIMPLEMENTED, then clients - * should assume this method is not supported and should not retry the - * call. If the call terminates with any other status (including OK), - * clients should retry the call with appropriate exponential backoff. - */ - watch( - request: HealthCheckRequest, - context: CallContext & CallContextExt - ): ServerStreamingMethodResult>; -} -export interface HealthClient { - /** - * If the requested service is unknown, the call will fail with status - * NOT_FOUND. - */ - check( - request: DeepPartial, - options?: CallOptions & CallOptionsExt - ): Promise; - /** - * Performs a watch for the serving status of the requested service. - * The server will immediately send back a message indicating the current - * serving status. It will then subsequently send a new message whenever - * the service's serving status changes. - * - * If the requested service is unknown when the call is received, the - * server will send a message setting the serving status to - * SERVICE_UNKNOWN but will *not* terminate the call. If at some - * future point, the serving status of the service becomes known, the - * server will send a new message with the service's serving status. - * - * If the call terminates with status UNIMPLEMENTED, then clients - * should assume this method is not supported and should not retry the - * call. If the call terminates with any other status (including OK), - * clients should retry the call with appropriate exponential backoff. - */ - watch( - request: DeepPartial, - options?: CallOptions & CallOptionsExt - ): AsyncIterable; -} -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export type ServerStreamingMethodResult = { - [Symbol.asyncIterator](): AsyncIterator; -}; -export {}; diff --git a/dist/node/esm/proto/google/health/v1/health.js b/dist/node/esm/proto/google/health/v1/health.js deleted file mode 100644 index bc02b390..00000000 --- a/dist/node/esm/proto/google/health/v1/health.js +++ /dev/null @@ -1,201 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: health.proto -import _m0 from 'protobufjs/minimal.js'; -export const protobufPackage = 'grpc.health.v1'; -export var HealthCheckResponse_ServingStatus; -(function (HealthCheckResponse_ServingStatus) { - HealthCheckResponse_ServingStatus[(HealthCheckResponse_ServingStatus['UNKNOWN'] = 0)] = 'UNKNOWN'; - HealthCheckResponse_ServingStatus[(HealthCheckResponse_ServingStatus['SERVING'] = 1)] = 'SERVING'; - HealthCheckResponse_ServingStatus[(HealthCheckResponse_ServingStatus['NOT_SERVING'] = 2)] = 'NOT_SERVING'; - /** SERVICE_UNKNOWN - Used only by the Watch method. */ - HealthCheckResponse_ServingStatus[(HealthCheckResponse_ServingStatus['SERVICE_UNKNOWN'] = 3)] = - 'SERVICE_UNKNOWN'; - HealthCheckResponse_ServingStatus[(HealthCheckResponse_ServingStatus['UNRECOGNIZED'] = -1)] = - 'UNRECOGNIZED'; -})(HealthCheckResponse_ServingStatus || (HealthCheckResponse_ServingStatus = {})); -export function healthCheckResponse_ServingStatusFromJSON(object) { - switch (object) { - case 0: - case 'UNKNOWN': - return HealthCheckResponse_ServingStatus.UNKNOWN; - case 1: - case 'SERVING': - return HealthCheckResponse_ServingStatus.SERVING; - case 2: - case 'NOT_SERVING': - return HealthCheckResponse_ServingStatus.NOT_SERVING; - case 3: - case 'SERVICE_UNKNOWN': - return HealthCheckResponse_ServingStatus.SERVICE_UNKNOWN; - case -1: - case 'UNRECOGNIZED': - default: - return HealthCheckResponse_ServingStatus.UNRECOGNIZED; - } -} -export function healthCheckResponse_ServingStatusToJSON(object) { - switch (object) { - case HealthCheckResponse_ServingStatus.UNKNOWN: - return 'UNKNOWN'; - case HealthCheckResponse_ServingStatus.SERVING: - return 'SERVING'; - case HealthCheckResponse_ServingStatus.NOT_SERVING: - return 'NOT_SERVING'; - case HealthCheckResponse_ServingStatus.SERVICE_UNKNOWN: - return 'SERVICE_UNKNOWN'; - case HealthCheckResponse_ServingStatus.UNRECOGNIZED: - default: - return 'UNRECOGNIZED'; - } -} -function createBaseHealthCheckRequest() { - return { service: '' }; -} -export const HealthCheckRequest = { - encode(message, writer = _m0.Writer.create()) { - if (message.service !== '') { - writer.uint32(10).string(message.service); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseHealthCheckRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.service = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { service: isSet(object.service) ? globalThis.String(object.service) : '' }; - }, - toJSON(message) { - const obj = {}; - if (message.service !== '') { - obj.service = message.service; - } - return obj; - }, - create(base) { - return HealthCheckRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseHealthCheckRequest(); - message.service = (_a = object.service) !== null && _a !== void 0 ? _a : ''; - return message; - }, -}; -function createBaseHealthCheckResponse() { - return { status: 0 }; -} -export const HealthCheckResponse = { - encode(message, writer = _m0.Writer.create()) { - if (message.status !== 0) { - writer.uint32(8).int32(message.status); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseHealthCheckResponse(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.status = reader.int32(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { status: isSet(object.status) ? healthCheckResponse_ServingStatusFromJSON(object.status) : 0 }; - }, - toJSON(message) { - const obj = {}; - if (message.status !== 0) { - obj.status = healthCheckResponse_ServingStatusToJSON(message.status); - } - return obj; - }, - create(base) { - return HealthCheckResponse.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseHealthCheckResponse(); - message.status = (_a = object.status) !== null && _a !== void 0 ? _a : 0; - return message; - }, -}; -export const HealthDefinition = { - name: 'Health', - fullName: 'grpc.health.v1.Health', - methods: { - /** - * If the requested service is unknown, the call will fail with status - * NOT_FOUND. - */ - check: { - name: 'Check', - requestType: HealthCheckRequest, - requestStream: false, - responseType: HealthCheckResponse, - responseStream: false, - options: {}, - }, - /** - * Performs a watch for the serving status of the requested service. - * The server will immediately send back a message indicating the current - * serving status. It will then subsequently send a new message whenever - * the service's serving status changes. - * - * If the requested service is unknown when the call is received, the - * server will send a message setting the serving status to - * SERVICE_UNKNOWN but will *not* terminate the call. If at some - * future point, the serving status of the service becomes known, the - * server will send a new message with the service's serving status. - * - * If the call terminates with status UNIMPLEMENTED, then clients - * should assume this method is not supported and should not retry the - * call. If the call terminates with any other status (including OK), - * clients should retry the call with appropriate exponential backoff. - */ - watch: { - name: 'Watch', - requestType: HealthCheckRequest, - requestStream: false, - responseType: HealthCheckResponse, - responseStream: true, - options: {}, - }, - }, -}; -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/esm/proto/google/protobuf/struct.d.ts b/dist/node/esm/proto/google/protobuf/struct.d.ts deleted file mode 100644 index 124c3e6e..00000000 --- a/dist/node/esm/proto/google/protobuf/struct.d.ts +++ /dev/null @@ -1,129 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -export declare const protobufPackage = 'google.protobuf'; -/** - * `NullValue` is a singleton enumeration to represent the null value for the - * `Value` type union. - * - * The JSON representation for `NullValue` is JSON `null`. - */ -export declare enum NullValue { - /** NULL_VALUE - Null value. */ - NULL_VALUE = 0, - UNRECOGNIZED = -1, -} -export declare function nullValueFromJSON(object: any): NullValue; -export declare function nullValueToJSON(object: NullValue): string; -/** - * `Struct` represents a structured data value, consisting of fields - * which map to dynamically typed values. In some languages, `Struct` - * might be supported by a native representation. For example, in - * scripting languages like JS a struct is represented as an - * object. The details of that representation are described together - * with the proto support for the language. - * - * The JSON representation for `Struct` is JSON object. - */ -export interface Struct { - /** Unordered map of dynamically typed values. */ - fields: { - [key: string]: any | undefined; - }; -} -export interface Struct_FieldsEntry { - key: string; - value: any | undefined; -} -/** - * `Value` represents a dynamically typed value which can be either - * null, a number, a string, a boolean, a recursive struct value, or a - * list of values. A producer of value is expected to set one of these - * variants. Absence of any variant indicates an error. - * - * The JSON representation for `Value` is JSON value. - */ -export interface Value { - /** Represents a null value. */ - nullValue?: NullValue | undefined; - /** Represents a double value. */ - numberValue?: number | undefined; - /** Represents a string value. */ - stringValue?: string | undefined; - /** Represents a boolean value. */ - boolValue?: boolean | undefined; - /** Represents a structured value. */ - structValue?: - | { - [key: string]: any; - } - | undefined; - /** Represents a repeated `Value`. */ - listValue?: Array | undefined; -} -/** - * `ListValue` is a wrapper around a repeated field of values. - * - * The JSON representation for `ListValue` is JSON array. - */ -export interface ListValue { - /** Repeated field of dynamically typed values. */ - values: any[]; -} -export declare const Struct: { - encode(message: Struct, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Struct; - fromJSON(object: any): Struct; - toJSON(message: Struct): unknown; - create(base?: DeepPartial): Struct; - fromPartial(object: DeepPartial): Struct; - wrap( - object: - | { - [key: string]: any; - } - | undefined - ): Struct; - unwrap(message: Struct): { - [key: string]: any; - }; -}; -export declare const Struct_FieldsEntry: { - encode(message: Struct_FieldsEntry, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Struct_FieldsEntry; - fromJSON(object: any): Struct_FieldsEntry; - toJSON(message: Struct_FieldsEntry): unknown; - create(base?: DeepPartial): Struct_FieldsEntry; - fromPartial(object: DeepPartial): Struct_FieldsEntry; -}; -export declare const Value: { - encode(message: Value, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Value; - fromJSON(object: any): Value; - toJSON(message: Value): unknown; - create(base?: DeepPartial): Value; - fromPartial(object: DeepPartial): Value; - wrap(value: any): Value; - unwrap(message: any): string | number | boolean | Object | null | Array | undefined; -}; -export declare const ListValue: { - encode(message: ListValue, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): ListValue; - fromJSON(object: any): ListValue; - toJSON(message: ListValue): unknown; - create(base?: DeepPartial): ListValue; - fromPartial(object: DeepPartial): ListValue; - wrap(array: Array | undefined): ListValue; - unwrap(message: ListValue): Array; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/esm/proto/google/protobuf/struct.js b/dist/node/esm/proto/google/protobuf/struct.js deleted file mode 100644 index 7c4d1a4c..00000000 --- a/dist/node/esm/proto/google/protobuf/struct.js +++ /dev/null @@ -1,444 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: google/protobuf/struct.proto -/* eslint-disable */ -import _m0 from 'protobufjs/minimal.js'; -export const protobufPackage = 'google.protobuf'; -/** - * `NullValue` is a singleton enumeration to represent the null value for the - * `Value` type union. - * - * The JSON representation for `NullValue` is JSON `null`. - */ -export var NullValue; -(function (NullValue) { - /** NULL_VALUE - Null value. */ - NullValue[(NullValue['NULL_VALUE'] = 0)] = 'NULL_VALUE'; - NullValue[(NullValue['UNRECOGNIZED'] = -1)] = 'UNRECOGNIZED'; -})(NullValue || (NullValue = {})); -export function nullValueFromJSON(object) { - switch (object) { - case 0: - case 'NULL_VALUE': - return NullValue.NULL_VALUE; - case -1: - case 'UNRECOGNIZED': - default: - return NullValue.UNRECOGNIZED; - } -} -export function nullValueToJSON(object) { - switch (object) { - case NullValue.NULL_VALUE: - return 'NULL_VALUE'; - case NullValue.UNRECOGNIZED: - default: - return 'UNRECOGNIZED'; - } -} -function createBaseStruct() { - return { fields: {} }; -} -export const Struct = { - encode(message, writer = _m0.Writer.create()) { - Object.entries(message.fields).forEach(([key, value]) => { - if (value !== undefined) { - Struct_FieldsEntry.encode({ key: key, value }, writer.uint32(10).fork()).ldelim(); - } - }); - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseStruct(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - const entry1 = Struct_FieldsEntry.decode(reader, reader.uint32()); - if (entry1.value !== undefined) { - message.fields[entry1.key] = entry1.value; - } - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - fields: isObject(object.fields) - ? Object.entries(object.fields).reduce((acc, [key, value]) => { - acc[key] = value; - return acc; - }, {}) - : {}, - }; - }, - toJSON(message) { - const obj = {}; - if (message.fields) { - const entries = Object.entries(message.fields); - if (entries.length > 0) { - obj.fields = {}; - entries.forEach(([k, v]) => { - obj.fields[k] = v; - }); - } - } - return obj; - }, - create(base) { - return Struct.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseStruct(); - message.fields = Object.entries((_a = object.fields) !== null && _a !== void 0 ? _a : {}).reduce( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = value; - } - return acc; - }, - {} - ); - return message; - }, - wrap(object) { - const struct = createBaseStruct(); - if (object !== undefined) { - for (const key of Object.keys(object)) { - struct.fields[key] = object[key]; - } - } - return struct; - }, - unwrap(message) { - const object = {}; - if (message.fields) { - for (const key of Object.keys(message.fields)) { - object[key] = message.fields[key]; - } - } - return object; - }, -}; -function createBaseStruct_FieldsEntry() { - return { key: '', value: undefined }; -} -export const Struct_FieldsEntry = { - encode(message, writer = _m0.Writer.create()) { - if (message.key !== '') { - writer.uint32(10).string(message.key); - } - if (message.value !== undefined) { - Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseStruct_FieldsEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.key = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.value = Value.unwrap(Value.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - key: isSet(object.key) ? globalThis.String(object.key) : '', - value: isSet(object === null || object === void 0 ? void 0 : object.value) ? object.value : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.key !== '') { - obj.key = message.key; - } - if (message.value !== undefined) { - obj.value = message.value; - } - return obj; - }, - create(base) { - return Struct_FieldsEntry.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseStruct_FieldsEntry(); - message.key = (_a = object.key) !== null && _a !== void 0 ? _a : ''; - message.value = (_b = object.value) !== null && _b !== void 0 ? _b : undefined; - return message; - }, -}; -function createBaseValue() { - return { - nullValue: undefined, - numberValue: undefined, - stringValue: undefined, - boolValue: undefined, - structValue: undefined, - listValue: undefined, - }; -} -export const Value = { - encode(message, writer = _m0.Writer.create()) { - if (message.nullValue !== undefined) { - writer.uint32(8).int32(message.nullValue); - } - if (message.numberValue !== undefined) { - writer.uint32(17).double(message.numberValue); - } - if (message.stringValue !== undefined) { - writer.uint32(26).string(message.stringValue); - } - if (message.boolValue !== undefined) { - writer.uint32(32).bool(message.boolValue); - } - if (message.structValue !== undefined) { - Struct.encode(Struct.wrap(message.structValue), writer.uint32(42).fork()).ldelim(); - } - if (message.listValue !== undefined) { - ListValue.encode(ListValue.wrap(message.listValue), writer.uint32(50).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseValue(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.nullValue = reader.int32(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.numberValue = reader.double(); - continue; - case 3: - if (tag !== 26) { - break; - } - message.stringValue = reader.string(); - continue; - case 4: - if (tag !== 32) { - break; - } - message.boolValue = reader.bool(); - continue; - case 5: - if (tag !== 42) { - break; - } - message.structValue = Struct.unwrap(Struct.decode(reader, reader.uint32())); - continue; - case 6: - if (tag !== 50) { - break; - } - message.listValue = ListValue.unwrap(ListValue.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : undefined, - numberValue: isSet(object.numberValue) ? globalThis.Number(object.numberValue) : undefined, - stringValue: isSet(object.stringValue) ? globalThis.String(object.stringValue) : undefined, - boolValue: isSet(object.boolValue) ? globalThis.Boolean(object.boolValue) : undefined, - structValue: isObject(object.structValue) ? object.structValue : undefined, - listValue: globalThis.Array.isArray(object.listValue) ? [...object.listValue] : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.nullValue !== undefined) { - obj.nullValue = nullValueToJSON(message.nullValue); - } - if (message.numberValue !== undefined) { - obj.numberValue = message.numberValue; - } - if (message.stringValue !== undefined) { - obj.stringValue = message.stringValue; - } - if (message.boolValue !== undefined) { - obj.boolValue = message.boolValue; - } - if (message.structValue !== undefined) { - obj.structValue = message.structValue; - } - if (message.listValue !== undefined) { - obj.listValue = message.listValue; - } - return obj; - }, - create(base) { - return Value.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f; - const message = createBaseValue(); - message.nullValue = (_a = object.nullValue) !== null && _a !== void 0 ? _a : undefined; - message.numberValue = (_b = object.numberValue) !== null && _b !== void 0 ? _b : undefined; - message.stringValue = (_c = object.stringValue) !== null && _c !== void 0 ? _c : undefined; - message.boolValue = (_d = object.boolValue) !== null && _d !== void 0 ? _d : undefined; - message.structValue = (_e = object.structValue) !== null && _e !== void 0 ? _e : undefined; - message.listValue = (_f = object.listValue) !== null && _f !== void 0 ? _f : undefined; - return message; - }, - wrap(value) { - const result = createBaseValue(); - if (value === null) { - result.nullValue = NullValue.NULL_VALUE; - } else if (typeof value === 'boolean') { - result.boolValue = value; - } else if (typeof value === 'number') { - result.numberValue = value; - } else if (typeof value === 'string') { - result.stringValue = value; - } else if (globalThis.Array.isArray(value)) { - result.listValue = value; - } else if (typeof value === 'object') { - result.structValue = value; - } else if (typeof value !== 'undefined') { - throw new globalThis.Error('Unsupported any value type: ' + typeof value); - } - return result; - }, - unwrap(message) { - if (message.stringValue !== undefined) { - return message.stringValue; - } else if ((message === null || message === void 0 ? void 0 : message.numberValue) !== undefined) { - return message.numberValue; - } else if ((message === null || message === void 0 ? void 0 : message.boolValue) !== undefined) { - return message.boolValue; - } else if ((message === null || message === void 0 ? void 0 : message.structValue) !== undefined) { - return message.structValue; - } else if ((message === null || message === void 0 ? void 0 : message.listValue) !== undefined) { - return message.listValue; - } else if ((message === null || message === void 0 ? void 0 : message.nullValue) !== undefined) { - return null; - } - return undefined; - }, -}; -function createBaseListValue() { - return { values: [] }; -} -export const ListValue = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.values) { - Value.encode(Value.wrap(v), writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListValue(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(Value.unwrap(Value.decode(reader, reader.uint32()))); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? [...object.values] - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return ListValue.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseListValue(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, - wrap(array) { - const result = createBaseListValue(); - result.values = array !== null && array !== void 0 ? array : []; - return result; - }, - unwrap(message) { - if ( - (message === null || message === void 0 ? void 0 : message.hasOwnProperty('values')) && - globalThis.Array.isArray(message.values) - ) { - return message.values; - } else { - return message; - } - }, -}; -function isObject(value) { - return typeof value === 'object' && value !== null; -} -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/esm/proto/v1/base.d.ts b/dist/node/esm/proto/v1/base.d.ts deleted file mode 100644 index 37f25b14..00000000 --- a/dist/node/esm/proto/v1/base.d.ts +++ /dev/null @@ -1,293 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -export declare const protobufPackage = 'weaviate.v1'; -export declare enum ConsistencyLevel { - CONSISTENCY_LEVEL_UNSPECIFIED = 0, - CONSISTENCY_LEVEL_ONE = 1, - CONSISTENCY_LEVEL_QUORUM = 2, - CONSISTENCY_LEVEL_ALL = 3, - UNRECOGNIZED = -1, -} -export declare function consistencyLevelFromJSON(object: any): ConsistencyLevel; -export declare function consistencyLevelToJSON(object: ConsistencyLevel): string; -export interface NumberArrayProperties { - /** - * will be removed in the future, use vector_bytes - * - * @deprecated - */ - values: number[]; - propName: string; - valuesBytes: Uint8Array; -} -export interface IntArrayProperties { - values: number[]; - propName: string; -} -export interface TextArrayProperties { - values: string[]; - propName: string; -} -export interface BooleanArrayProperties { - values: boolean[]; - propName: string; -} -export interface ObjectPropertiesValue { - nonRefProperties: - | { - [key: string]: any; - } - | undefined; - numberArrayProperties: NumberArrayProperties[]; - intArrayProperties: IntArrayProperties[]; - textArrayProperties: TextArrayProperties[]; - booleanArrayProperties: BooleanArrayProperties[]; - objectProperties: ObjectProperties[]; - objectArrayProperties: ObjectArrayProperties[]; - emptyListProps: string[]; -} -export interface ObjectArrayProperties { - values: ObjectPropertiesValue[]; - propName: string; -} -export interface ObjectProperties { - value: ObjectPropertiesValue | undefined; - propName: string; -} -export interface TextArray { - values: string[]; -} -export interface IntArray { - values: number[]; -} -export interface NumberArray { - values: number[]; -} -export interface BooleanArray { - values: boolean[]; -} -export interface Filters { - operator: Filters_Operator; - /** - * protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED - * - * @deprecated - */ - on: string[]; - filters: Filters[]; - valueText?: string | undefined; - valueInt?: number | undefined; - valueBoolean?: boolean | undefined; - valueNumber?: number | undefined; - valueTextArray?: TextArray | undefined; - valueIntArray?: IntArray | undefined; - valueBooleanArray?: BooleanArray | undefined; - valueNumberArray?: NumberArray | undefined; - valueGeo?: GeoCoordinatesFilter | undefined; - /** leave space for more filter values */ - target: FilterTarget | undefined; -} -export declare enum Filters_Operator { - OPERATOR_UNSPECIFIED = 0, - OPERATOR_EQUAL = 1, - OPERATOR_NOT_EQUAL = 2, - OPERATOR_GREATER_THAN = 3, - OPERATOR_GREATER_THAN_EQUAL = 4, - OPERATOR_LESS_THAN = 5, - OPERATOR_LESS_THAN_EQUAL = 6, - OPERATOR_AND = 7, - OPERATOR_OR = 8, - OPERATOR_WITHIN_GEO_RANGE = 9, - OPERATOR_LIKE = 10, - OPERATOR_IS_NULL = 11, - OPERATOR_CONTAINS_ANY = 12, - OPERATOR_CONTAINS_ALL = 13, - UNRECOGNIZED = -1, -} -export declare function filters_OperatorFromJSON(object: any): Filters_Operator; -export declare function filters_OperatorToJSON(object: Filters_Operator): string; -export interface FilterReferenceSingleTarget { - on: string; - target: FilterTarget | undefined; -} -export interface FilterReferenceMultiTarget { - on: string; - target: FilterTarget | undefined; - targetCollection: string; -} -export interface FilterReferenceCount { - on: string; -} -export interface FilterTarget { - property?: string | undefined; - singleTarget?: FilterReferenceSingleTarget | undefined; - multiTarget?: FilterReferenceMultiTarget | undefined; - count?: FilterReferenceCount | undefined; -} -export interface GeoCoordinatesFilter { - latitude: number; - longitude: number; - distance: number; -} -export interface Vectors { - name: string; - /** for multi-vec */ - index: number; - vectorBytes: Uint8Array; -} -export declare const NumberArrayProperties: { - encode(message: NumberArrayProperties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NumberArrayProperties; - fromJSON(object: any): NumberArrayProperties; - toJSON(message: NumberArrayProperties): unknown; - create(base?: DeepPartial): NumberArrayProperties; - fromPartial(object: DeepPartial): NumberArrayProperties; -}; -export declare const IntArrayProperties: { - encode(message: IntArrayProperties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): IntArrayProperties; - fromJSON(object: any): IntArrayProperties; - toJSON(message: IntArrayProperties): unknown; - create(base?: DeepPartial): IntArrayProperties; - fromPartial(object: DeepPartial): IntArrayProperties; -}; -export declare const TextArrayProperties: { - encode(message: TextArrayProperties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): TextArrayProperties; - fromJSON(object: any): TextArrayProperties; - toJSON(message: TextArrayProperties): unknown; - create(base?: DeepPartial): TextArrayProperties; - fromPartial(object: DeepPartial): TextArrayProperties; -}; -export declare const BooleanArrayProperties: { - encode(message: BooleanArrayProperties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BooleanArrayProperties; - fromJSON(object: any): BooleanArrayProperties; - toJSON(message: BooleanArrayProperties): unknown; - create(base?: DeepPartial): BooleanArrayProperties; - fromPartial(object: DeepPartial): BooleanArrayProperties; -}; -export declare const ObjectPropertiesValue: { - encode(message: ObjectPropertiesValue, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): ObjectPropertiesValue; - fromJSON(object: any): ObjectPropertiesValue; - toJSON(message: ObjectPropertiesValue): unknown; - create(base?: DeepPartial): ObjectPropertiesValue; - fromPartial(object: DeepPartial): ObjectPropertiesValue; -}; -export declare const ObjectArrayProperties: { - encode(message: ObjectArrayProperties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): ObjectArrayProperties; - fromJSON(object: any): ObjectArrayProperties; - toJSON(message: ObjectArrayProperties): unknown; - create(base?: DeepPartial): ObjectArrayProperties; - fromPartial(object: DeepPartial): ObjectArrayProperties; -}; -export declare const ObjectProperties: { - encode(message: ObjectProperties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): ObjectProperties; - fromJSON(object: any): ObjectProperties; - toJSON(message: ObjectProperties): unknown; - create(base?: DeepPartial): ObjectProperties; - fromPartial(object: DeepPartial): ObjectProperties; -}; -export declare const TextArray: { - encode(message: TextArray, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): TextArray; - fromJSON(object: any): TextArray; - toJSON(message: TextArray): unknown; - create(base?: DeepPartial): TextArray; - fromPartial(object: DeepPartial): TextArray; -}; -export declare const IntArray: { - encode(message: IntArray, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): IntArray; - fromJSON(object: any): IntArray; - toJSON(message: IntArray): unknown; - create(base?: DeepPartial): IntArray; - fromPartial(object: DeepPartial): IntArray; -}; -export declare const NumberArray: { - encode(message: NumberArray, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NumberArray; - fromJSON(object: any): NumberArray; - toJSON(message: NumberArray): unknown; - create(base?: DeepPartial): NumberArray; - fromPartial(object: DeepPartial): NumberArray; -}; -export declare const BooleanArray: { - encode(message: BooleanArray, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BooleanArray; - fromJSON(object: any): BooleanArray; - toJSON(message: BooleanArray): unknown; - create(base?: DeepPartial): BooleanArray; - fromPartial(object: DeepPartial): BooleanArray; -}; -export declare const Filters: { - encode(message: Filters, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Filters; - fromJSON(object: any): Filters; - toJSON(message: Filters): unknown; - create(base?: DeepPartial): Filters; - fromPartial(object: DeepPartial): Filters; -}; -export declare const FilterReferenceSingleTarget: { - encode(message: FilterReferenceSingleTarget, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): FilterReferenceSingleTarget; - fromJSON(object: any): FilterReferenceSingleTarget; - toJSON(message: FilterReferenceSingleTarget): unknown; - create(base?: DeepPartial): FilterReferenceSingleTarget; - fromPartial(object: DeepPartial): FilterReferenceSingleTarget; -}; -export declare const FilterReferenceMultiTarget: { - encode(message: FilterReferenceMultiTarget, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): FilterReferenceMultiTarget; - fromJSON(object: any): FilterReferenceMultiTarget; - toJSON(message: FilterReferenceMultiTarget): unknown; - create(base?: DeepPartial): FilterReferenceMultiTarget; - fromPartial(object: DeepPartial): FilterReferenceMultiTarget; -}; -export declare const FilterReferenceCount: { - encode(message: FilterReferenceCount, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): FilterReferenceCount; - fromJSON(object: any): FilterReferenceCount; - toJSON(message: FilterReferenceCount): unknown; - create(base?: DeepPartial): FilterReferenceCount; - fromPartial(object: DeepPartial): FilterReferenceCount; -}; -export declare const FilterTarget: { - encode(message: FilterTarget, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): FilterTarget; - fromJSON(object: any): FilterTarget; - toJSON(message: FilterTarget): unknown; - create(base?: DeepPartial): FilterTarget; - fromPartial(object: DeepPartial): FilterTarget; -}; -export declare const GeoCoordinatesFilter: { - encode(message: GeoCoordinatesFilter, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GeoCoordinatesFilter; - fromJSON(object: any): GeoCoordinatesFilter; - toJSON(message: GeoCoordinatesFilter): unknown; - create(base?: DeepPartial): GeoCoordinatesFilter; - fromPartial(object: DeepPartial): GeoCoordinatesFilter; -}; -export declare const Vectors: { - encode(message: Vectors, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Vectors; - fromJSON(object: any): Vectors; - toJSON(message: Vectors): unknown; - create(base?: DeepPartial): Vectors; - fromPartial(object: DeepPartial): Vectors; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/esm/proto/v1/base.js b/dist/node/esm/proto/v1/base.js deleted file mode 100644 index f7948a0a..00000000 --- a/dist/node/esm/proto/v1/base.js +++ /dev/null @@ -1,1859 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/base.proto -/* eslint-disable */ -import Long from 'long'; -import _m0 from 'protobufjs/minimal.js'; -import { Struct } from '../google/protobuf/struct.js'; -export const protobufPackage = 'weaviate.v1'; -export var ConsistencyLevel; -(function (ConsistencyLevel) { - ConsistencyLevel[(ConsistencyLevel['CONSISTENCY_LEVEL_UNSPECIFIED'] = 0)] = 'CONSISTENCY_LEVEL_UNSPECIFIED'; - ConsistencyLevel[(ConsistencyLevel['CONSISTENCY_LEVEL_ONE'] = 1)] = 'CONSISTENCY_LEVEL_ONE'; - ConsistencyLevel[(ConsistencyLevel['CONSISTENCY_LEVEL_QUORUM'] = 2)] = 'CONSISTENCY_LEVEL_QUORUM'; - ConsistencyLevel[(ConsistencyLevel['CONSISTENCY_LEVEL_ALL'] = 3)] = 'CONSISTENCY_LEVEL_ALL'; - ConsistencyLevel[(ConsistencyLevel['UNRECOGNIZED'] = -1)] = 'UNRECOGNIZED'; -})(ConsistencyLevel || (ConsistencyLevel = {})); -export function consistencyLevelFromJSON(object) { - switch (object) { - case 0: - case 'CONSISTENCY_LEVEL_UNSPECIFIED': - return ConsistencyLevel.CONSISTENCY_LEVEL_UNSPECIFIED; - case 1: - case 'CONSISTENCY_LEVEL_ONE': - return ConsistencyLevel.CONSISTENCY_LEVEL_ONE; - case 2: - case 'CONSISTENCY_LEVEL_QUORUM': - return ConsistencyLevel.CONSISTENCY_LEVEL_QUORUM; - case 3: - case 'CONSISTENCY_LEVEL_ALL': - return ConsistencyLevel.CONSISTENCY_LEVEL_ALL; - case -1: - case 'UNRECOGNIZED': - default: - return ConsistencyLevel.UNRECOGNIZED; - } -} -export function consistencyLevelToJSON(object) { - switch (object) { - case ConsistencyLevel.CONSISTENCY_LEVEL_UNSPECIFIED: - return 'CONSISTENCY_LEVEL_UNSPECIFIED'; - case ConsistencyLevel.CONSISTENCY_LEVEL_ONE: - return 'CONSISTENCY_LEVEL_ONE'; - case ConsistencyLevel.CONSISTENCY_LEVEL_QUORUM: - return 'CONSISTENCY_LEVEL_QUORUM'; - case ConsistencyLevel.CONSISTENCY_LEVEL_ALL: - return 'CONSISTENCY_LEVEL_ALL'; - case ConsistencyLevel.UNRECOGNIZED: - default: - return 'UNRECOGNIZED'; - } -} -export var Filters_Operator; -(function (Filters_Operator) { - Filters_Operator[(Filters_Operator['OPERATOR_UNSPECIFIED'] = 0)] = 'OPERATOR_UNSPECIFIED'; - Filters_Operator[(Filters_Operator['OPERATOR_EQUAL'] = 1)] = 'OPERATOR_EQUAL'; - Filters_Operator[(Filters_Operator['OPERATOR_NOT_EQUAL'] = 2)] = 'OPERATOR_NOT_EQUAL'; - Filters_Operator[(Filters_Operator['OPERATOR_GREATER_THAN'] = 3)] = 'OPERATOR_GREATER_THAN'; - Filters_Operator[(Filters_Operator['OPERATOR_GREATER_THAN_EQUAL'] = 4)] = 'OPERATOR_GREATER_THAN_EQUAL'; - Filters_Operator[(Filters_Operator['OPERATOR_LESS_THAN'] = 5)] = 'OPERATOR_LESS_THAN'; - Filters_Operator[(Filters_Operator['OPERATOR_LESS_THAN_EQUAL'] = 6)] = 'OPERATOR_LESS_THAN_EQUAL'; - Filters_Operator[(Filters_Operator['OPERATOR_AND'] = 7)] = 'OPERATOR_AND'; - Filters_Operator[(Filters_Operator['OPERATOR_OR'] = 8)] = 'OPERATOR_OR'; - Filters_Operator[(Filters_Operator['OPERATOR_WITHIN_GEO_RANGE'] = 9)] = 'OPERATOR_WITHIN_GEO_RANGE'; - Filters_Operator[(Filters_Operator['OPERATOR_LIKE'] = 10)] = 'OPERATOR_LIKE'; - Filters_Operator[(Filters_Operator['OPERATOR_IS_NULL'] = 11)] = 'OPERATOR_IS_NULL'; - Filters_Operator[(Filters_Operator['OPERATOR_CONTAINS_ANY'] = 12)] = 'OPERATOR_CONTAINS_ANY'; - Filters_Operator[(Filters_Operator['OPERATOR_CONTAINS_ALL'] = 13)] = 'OPERATOR_CONTAINS_ALL'; - Filters_Operator[(Filters_Operator['UNRECOGNIZED'] = -1)] = 'UNRECOGNIZED'; -})(Filters_Operator || (Filters_Operator = {})); -export function filters_OperatorFromJSON(object) { - switch (object) { - case 0: - case 'OPERATOR_UNSPECIFIED': - return Filters_Operator.OPERATOR_UNSPECIFIED; - case 1: - case 'OPERATOR_EQUAL': - return Filters_Operator.OPERATOR_EQUAL; - case 2: - case 'OPERATOR_NOT_EQUAL': - return Filters_Operator.OPERATOR_NOT_EQUAL; - case 3: - case 'OPERATOR_GREATER_THAN': - return Filters_Operator.OPERATOR_GREATER_THAN; - case 4: - case 'OPERATOR_GREATER_THAN_EQUAL': - return Filters_Operator.OPERATOR_GREATER_THAN_EQUAL; - case 5: - case 'OPERATOR_LESS_THAN': - return Filters_Operator.OPERATOR_LESS_THAN; - case 6: - case 'OPERATOR_LESS_THAN_EQUAL': - return Filters_Operator.OPERATOR_LESS_THAN_EQUAL; - case 7: - case 'OPERATOR_AND': - return Filters_Operator.OPERATOR_AND; - case 8: - case 'OPERATOR_OR': - return Filters_Operator.OPERATOR_OR; - case 9: - case 'OPERATOR_WITHIN_GEO_RANGE': - return Filters_Operator.OPERATOR_WITHIN_GEO_RANGE; - case 10: - case 'OPERATOR_LIKE': - return Filters_Operator.OPERATOR_LIKE; - case 11: - case 'OPERATOR_IS_NULL': - return Filters_Operator.OPERATOR_IS_NULL; - case 12: - case 'OPERATOR_CONTAINS_ANY': - return Filters_Operator.OPERATOR_CONTAINS_ANY; - case 13: - case 'OPERATOR_CONTAINS_ALL': - return Filters_Operator.OPERATOR_CONTAINS_ALL; - case -1: - case 'UNRECOGNIZED': - default: - return Filters_Operator.UNRECOGNIZED; - } -} -export function filters_OperatorToJSON(object) { - switch (object) { - case Filters_Operator.OPERATOR_UNSPECIFIED: - return 'OPERATOR_UNSPECIFIED'; - case Filters_Operator.OPERATOR_EQUAL: - return 'OPERATOR_EQUAL'; - case Filters_Operator.OPERATOR_NOT_EQUAL: - return 'OPERATOR_NOT_EQUAL'; - case Filters_Operator.OPERATOR_GREATER_THAN: - return 'OPERATOR_GREATER_THAN'; - case Filters_Operator.OPERATOR_GREATER_THAN_EQUAL: - return 'OPERATOR_GREATER_THAN_EQUAL'; - case Filters_Operator.OPERATOR_LESS_THAN: - return 'OPERATOR_LESS_THAN'; - case Filters_Operator.OPERATOR_LESS_THAN_EQUAL: - return 'OPERATOR_LESS_THAN_EQUAL'; - case Filters_Operator.OPERATOR_AND: - return 'OPERATOR_AND'; - case Filters_Operator.OPERATOR_OR: - return 'OPERATOR_OR'; - case Filters_Operator.OPERATOR_WITHIN_GEO_RANGE: - return 'OPERATOR_WITHIN_GEO_RANGE'; - case Filters_Operator.OPERATOR_LIKE: - return 'OPERATOR_LIKE'; - case Filters_Operator.OPERATOR_IS_NULL: - return 'OPERATOR_IS_NULL'; - case Filters_Operator.OPERATOR_CONTAINS_ANY: - return 'OPERATOR_CONTAINS_ANY'; - case Filters_Operator.OPERATOR_CONTAINS_ALL: - return 'OPERATOR_CONTAINS_ALL'; - case Filters_Operator.UNRECOGNIZED: - default: - return 'UNRECOGNIZED'; - } -} -function createBaseNumberArrayProperties() { - return { values: [], propName: '', valuesBytes: new Uint8Array(0) }; -} -export const NumberArrayProperties = { - encode(message, writer = _m0.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.values) { - writer.double(v); - } - writer.ldelim(); - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - if (message.valuesBytes.length !== 0) { - writer.uint32(26).bytes(message.valuesBytes); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNumberArrayProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 9) { - message.values.push(reader.double()); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.values.push(reader.double()); - } - continue; - } - break; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - case 3: - if (tag !== 26) { - break; - } - message.valuesBytes = reader.bytes(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.Number(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - valuesBytes: isSet(object.valuesBytes) ? bytesFromBase64(object.valuesBytes) : new Uint8Array(0), - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - if (message.propName !== '') { - obj.propName = message.propName; - } - if (message.valuesBytes.length !== 0) { - obj.valuesBytes = base64FromBytes(message.valuesBytes); - } - return obj; - }, - create(base) { - return NumberArrayProperties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseNumberArrayProperties(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - message.valuesBytes = (_c = object.valuesBytes) !== null && _c !== void 0 ? _c : new Uint8Array(0); - return message; - }, -}; -function createBaseIntArrayProperties() { - return { values: [], propName: '' }; -} -export const IntArrayProperties = { - encode(message, writer = _m0.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.values) { - writer.int64(v); - } - writer.ldelim(); - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseIntArrayProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 8) { - message.values.push(longToNumber(reader.int64())); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.values.push(longToNumber(reader.int64())); - } - continue; - } - break; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.Number(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values.map((e) => Math.round(e)); - } - if (message.propName !== '') { - obj.propName = message.propName; - } - return obj; - }, - create(base) { - return IntArrayProperties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseIntArrayProperties(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function createBaseTextArrayProperties() { - return { values: [], propName: '' }; -} -export const TextArrayProperties = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.values) { - writer.uint32(10).string(v); - } - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTextArrayProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(reader.string()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.String(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - if (message.propName !== '') { - obj.propName = message.propName; - } - return obj; - }, - create(base) { - return TextArrayProperties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseTextArrayProperties(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function createBaseBooleanArrayProperties() { - return { values: [], propName: '' }; -} -export const BooleanArrayProperties = { - encode(message, writer = _m0.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.values) { - writer.bool(v); - } - writer.ldelim(); - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBooleanArrayProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 8) { - message.values.push(reader.bool()); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.values.push(reader.bool()); - } - continue; - } - break; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.Boolean(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - if (message.propName !== '') { - obj.propName = message.propName; - } - return obj; - }, - create(base) { - return BooleanArrayProperties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseBooleanArrayProperties(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function createBaseObjectPropertiesValue() { - return { - nonRefProperties: undefined, - numberArrayProperties: [], - intArrayProperties: [], - textArrayProperties: [], - booleanArrayProperties: [], - objectProperties: [], - objectArrayProperties: [], - emptyListProps: [], - }; -} -export const ObjectPropertiesValue = { - encode(message, writer = _m0.Writer.create()) { - if (message.nonRefProperties !== undefined) { - Struct.encode(Struct.wrap(message.nonRefProperties), writer.uint32(10).fork()).ldelim(); - } - for (const v of message.numberArrayProperties) { - NumberArrayProperties.encode(v, writer.uint32(18).fork()).ldelim(); - } - for (const v of message.intArrayProperties) { - IntArrayProperties.encode(v, writer.uint32(26).fork()).ldelim(); - } - for (const v of message.textArrayProperties) { - TextArrayProperties.encode(v, writer.uint32(34).fork()).ldelim(); - } - for (const v of message.booleanArrayProperties) { - BooleanArrayProperties.encode(v, writer.uint32(42).fork()).ldelim(); - } - for (const v of message.objectProperties) { - ObjectProperties.encode(v, writer.uint32(50).fork()).ldelim(); - } - for (const v of message.objectArrayProperties) { - ObjectArrayProperties.encode(v, writer.uint32(58).fork()).ldelim(); - } - for (const v of message.emptyListProps) { - writer.uint32(82).string(v); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseObjectPropertiesValue(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.nonRefProperties = Struct.unwrap(Struct.decode(reader, reader.uint32())); - continue; - case 2: - if (tag !== 18) { - break; - } - message.numberArrayProperties.push(NumberArrayProperties.decode(reader, reader.uint32())); - continue; - case 3: - if (tag !== 26) { - break; - } - message.intArrayProperties.push(IntArrayProperties.decode(reader, reader.uint32())); - continue; - case 4: - if (tag !== 34) { - break; - } - message.textArrayProperties.push(TextArrayProperties.decode(reader, reader.uint32())); - continue; - case 5: - if (tag !== 42) { - break; - } - message.booleanArrayProperties.push(BooleanArrayProperties.decode(reader, reader.uint32())); - continue; - case 6: - if (tag !== 50) { - break; - } - message.objectProperties.push(ObjectProperties.decode(reader, reader.uint32())); - continue; - case 7: - if (tag !== 58) { - break; - } - message.objectArrayProperties.push(ObjectArrayProperties.decode(reader, reader.uint32())); - continue; - case 10: - if (tag !== 82) { - break; - } - message.emptyListProps.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - nonRefProperties: isObject(object.nonRefProperties) ? object.nonRefProperties : undefined, - numberArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.numberArrayProperties - ) - ? object.numberArrayProperties.map((e) => NumberArrayProperties.fromJSON(e)) - : [], - intArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.intArrayProperties - ) - ? object.intArrayProperties.map((e) => IntArrayProperties.fromJSON(e)) - : [], - textArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.textArrayProperties - ) - ? object.textArrayProperties.map((e) => TextArrayProperties.fromJSON(e)) - : [], - booleanArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.booleanArrayProperties - ) - ? object.booleanArrayProperties.map((e) => BooleanArrayProperties.fromJSON(e)) - : [], - objectProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectProperties - ) - ? object.objectProperties.map((e) => ObjectProperties.fromJSON(e)) - : [], - objectArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectArrayProperties - ) - ? object.objectArrayProperties.map((e) => ObjectArrayProperties.fromJSON(e)) - : [], - emptyListProps: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.emptyListProps - ) - ? object.emptyListProps.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b, _c, _d, _e, _f, _g; - const obj = {}; - if (message.nonRefProperties !== undefined) { - obj.nonRefProperties = message.nonRefProperties; - } - if ((_a = message.numberArrayProperties) === null || _a === void 0 ? void 0 : _a.length) { - obj.numberArrayProperties = message.numberArrayProperties.map((e) => NumberArrayProperties.toJSON(e)); - } - if ((_b = message.intArrayProperties) === null || _b === void 0 ? void 0 : _b.length) { - obj.intArrayProperties = message.intArrayProperties.map((e) => IntArrayProperties.toJSON(e)); - } - if ((_c = message.textArrayProperties) === null || _c === void 0 ? void 0 : _c.length) { - obj.textArrayProperties = message.textArrayProperties.map((e) => TextArrayProperties.toJSON(e)); - } - if ((_d = message.booleanArrayProperties) === null || _d === void 0 ? void 0 : _d.length) { - obj.booleanArrayProperties = message.booleanArrayProperties.map((e) => - BooleanArrayProperties.toJSON(e) - ); - } - if ((_e = message.objectProperties) === null || _e === void 0 ? void 0 : _e.length) { - obj.objectProperties = message.objectProperties.map((e) => ObjectProperties.toJSON(e)); - } - if ((_f = message.objectArrayProperties) === null || _f === void 0 ? void 0 : _f.length) { - obj.objectArrayProperties = message.objectArrayProperties.map((e) => ObjectArrayProperties.toJSON(e)); - } - if ((_g = message.emptyListProps) === null || _g === void 0 ? void 0 : _g.length) { - obj.emptyListProps = message.emptyListProps; - } - return obj; - }, - create(base) { - return ObjectPropertiesValue.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h; - const message = createBaseObjectPropertiesValue(); - message.nonRefProperties = (_a = object.nonRefProperties) !== null && _a !== void 0 ? _a : undefined; - message.numberArrayProperties = - ((_b = object.numberArrayProperties) === null || _b === void 0 - ? void 0 - : _b.map((e) => NumberArrayProperties.fromPartial(e))) || []; - message.intArrayProperties = - ((_c = object.intArrayProperties) === null || _c === void 0 - ? void 0 - : _c.map((e) => IntArrayProperties.fromPartial(e))) || []; - message.textArrayProperties = - ((_d = object.textArrayProperties) === null || _d === void 0 - ? void 0 - : _d.map((e) => TextArrayProperties.fromPartial(e))) || []; - message.booleanArrayProperties = - ((_e = object.booleanArrayProperties) === null || _e === void 0 - ? void 0 - : _e.map((e) => BooleanArrayProperties.fromPartial(e))) || []; - message.objectProperties = - ((_f = object.objectProperties) === null || _f === void 0 - ? void 0 - : _f.map((e) => ObjectProperties.fromPartial(e))) || []; - message.objectArrayProperties = - ((_g = object.objectArrayProperties) === null || _g === void 0 - ? void 0 - : _g.map((e) => ObjectArrayProperties.fromPartial(e))) || []; - message.emptyListProps = - ((_h = object.emptyListProps) === null || _h === void 0 ? void 0 : _h.map((e) => e)) || []; - return message; - }, -}; -function createBaseObjectArrayProperties() { - return { values: [], propName: '' }; -} -export const ObjectArrayProperties = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.values) { - ObjectPropertiesValue.encode(v, writer.uint32(10).fork()).ldelim(); - } - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseObjectArrayProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(ObjectPropertiesValue.decode(reader, reader.uint32())); - continue; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => ObjectPropertiesValue.fromJSON(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values.map((e) => ObjectPropertiesValue.toJSON(e)); - } - if (message.propName !== '') { - obj.propName = message.propName; - } - return obj; - }, - create(base) { - return ObjectArrayProperties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseObjectArrayProperties(); - message.values = - ((_a = object.values) === null || _a === void 0 - ? void 0 - : _a.map((e) => ObjectPropertiesValue.fromPartial(e))) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function createBaseObjectProperties() { - return { value: undefined, propName: '' }; -} -export const ObjectProperties = { - encode(message, writer = _m0.Writer.create()) { - if (message.value !== undefined) { - ObjectPropertiesValue.encode(message.value, writer.uint32(10).fork()).ldelim(); - } - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseObjectProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.value = ObjectPropertiesValue.decode(reader, reader.uint32()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - value: isSet(object.value) ? ObjectPropertiesValue.fromJSON(object.value) : undefined, - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - }; - }, - toJSON(message) { - const obj = {}; - if (message.value !== undefined) { - obj.value = ObjectPropertiesValue.toJSON(message.value); - } - if (message.propName !== '') { - obj.propName = message.propName; - } - return obj; - }, - create(base) { - return ObjectProperties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseObjectProperties(); - message.value = - object.value !== undefined && object.value !== null - ? ObjectPropertiesValue.fromPartial(object.value) - : undefined; - message.propName = (_a = object.propName) !== null && _a !== void 0 ? _a : ''; - return message; - }, -}; -function createBaseTextArray() { - return { values: [] }; -} -export const TextArray = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.values) { - writer.uint32(10).string(v); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTextArray(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return TextArray.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseTextArray(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseIntArray() { - return { values: [] }; -} -export const IntArray = { - encode(message, writer = _m0.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.values) { - writer.int64(v); - } - writer.ldelim(); - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseIntArray(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 8) { - message.values.push(longToNumber(reader.int64())); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.values.push(longToNumber(reader.int64())); - } - continue; - } - break; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.Number(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values.map((e) => Math.round(e)); - } - return obj; - }, - create(base) { - return IntArray.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseIntArray(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseNumberArray() { - return { values: [] }; -} -export const NumberArray = { - encode(message, writer = _m0.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.values) { - writer.double(v); - } - writer.ldelim(); - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNumberArray(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 9) { - message.values.push(reader.double()); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.values.push(reader.double()); - } - continue; - } - break; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.Number(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return NumberArray.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseNumberArray(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseBooleanArray() { - return { values: [] }; -} -export const BooleanArray = { - encode(message, writer = _m0.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.values) { - writer.bool(v); - } - writer.ldelim(); - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBooleanArray(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 8) { - message.values.push(reader.bool()); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.values.push(reader.bool()); - } - continue; - } - break; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.Boolean(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return BooleanArray.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseBooleanArray(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseFilters() { - return { - operator: 0, - on: [], - filters: [], - valueText: undefined, - valueInt: undefined, - valueBoolean: undefined, - valueNumber: undefined, - valueTextArray: undefined, - valueIntArray: undefined, - valueBooleanArray: undefined, - valueNumberArray: undefined, - valueGeo: undefined, - target: undefined, - }; -} -export const Filters = { - encode(message, writer = _m0.Writer.create()) { - if (message.operator !== 0) { - writer.uint32(8).int32(message.operator); - } - for (const v of message.on) { - writer.uint32(18).string(v); - } - for (const v of message.filters) { - Filters.encode(v, writer.uint32(26).fork()).ldelim(); - } - if (message.valueText !== undefined) { - writer.uint32(34).string(message.valueText); - } - if (message.valueInt !== undefined) { - writer.uint32(40).int64(message.valueInt); - } - if (message.valueBoolean !== undefined) { - writer.uint32(48).bool(message.valueBoolean); - } - if (message.valueNumber !== undefined) { - writer.uint32(57).double(message.valueNumber); - } - if (message.valueTextArray !== undefined) { - TextArray.encode(message.valueTextArray, writer.uint32(74).fork()).ldelim(); - } - if (message.valueIntArray !== undefined) { - IntArray.encode(message.valueIntArray, writer.uint32(82).fork()).ldelim(); - } - if (message.valueBooleanArray !== undefined) { - BooleanArray.encode(message.valueBooleanArray, writer.uint32(90).fork()).ldelim(); - } - if (message.valueNumberArray !== undefined) { - NumberArray.encode(message.valueNumberArray, writer.uint32(98).fork()).ldelim(); - } - if (message.valueGeo !== undefined) { - GeoCoordinatesFilter.encode(message.valueGeo, writer.uint32(106).fork()).ldelim(); - } - if (message.target !== undefined) { - FilterTarget.encode(message.target, writer.uint32(162).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFilters(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.operator = reader.int32(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.on.push(reader.string()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.filters.push(Filters.decode(reader, reader.uint32())); - continue; - case 4: - if (tag !== 34) { - break; - } - message.valueText = reader.string(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.valueInt = longToNumber(reader.int64()); - continue; - case 6: - if (tag !== 48) { - break; - } - message.valueBoolean = reader.bool(); - continue; - case 7: - if (tag !== 57) { - break; - } - message.valueNumber = reader.double(); - continue; - case 9: - if (tag !== 74) { - break; - } - message.valueTextArray = TextArray.decode(reader, reader.uint32()); - continue; - case 10: - if (tag !== 82) { - break; - } - message.valueIntArray = IntArray.decode(reader, reader.uint32()); - continue; - case 11: - if (tag !== 90) { - break; - } - message.valueBooleanArray = BooleanArray.decode(reader, reader.uint32()); - continue; - case 12: - if (tag !== 98) { - break; - } - message.valueNumberArray = NumberArray.decode(reader, reader.uint32()); - continue; - case 13: - if (tag !== 106) { - break; - } - message.valueGeo = GeoCoordinatesFilter.decode(reader, reader.uint32()); - continue; - case 20: - if (tag !== 162) { - break; - } - message.target = FilterTarget.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - operator: isSet(object.operator) ? filters_OperatorFromJSON(object.operator) : 0, - on: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.on) - ? object.on.map((e) => globalThis.String(e)) - : [], - filters: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.filters) - ? object.filters.map((e) => Filters.fromJSON(e)) - : [], - valueText: isSet(object.valueText) ? globalThis.String(object.valueText) : undefined, - valueInt: isSet(object.valueInt) ? globalThis.Number(object.valueInt) : undefined, - valueBoolean: isSet(object.valueBoolean) ? globalThis.Boolean(object.valueBoolean) : undefined, - valueNumber: isSet(object.valueNumber) ? globalThis.Number(object.valueNumber) : undefined, - valueTextArray: isSet(object.valueTextArray) ? TextArray.fromJSON(object.valueTextArray) : undefined, - valueIntArray: isSet(object.valueIntArray) ? IntArray.fromJSON(object.valueIntArray) : undefined, - valueBooleanArray: isSet(object.valueBooleanArray) - ? BooleanArray.fromJSON(object.valueBooleanArray) - : undefined, - valueNumberArray: isSet(object.valueNumberArray) - ? NumberArray.fromJSON(object.valueNumberArray) - : undefined, - valueGeo: isSet(object.valueGeo) ? GeoCoordinatesFilter.fromJSON(object.valueGeo) : undefined, - target: isSet(object.target) ? FilterTarget.fromJSON(object.target) : undefined, - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if (message.operator !== 0) { - obj.operator = filters_OperatorToJSON(message.operator); - } - if ((_a = message.on) === null || _a === void 0 ? void 0 : _a.length) { - obj.on = message.on; - } - if ((_b = message.filters) === null || _b === void 0 ? void 0 : _b.length) { - obj.filters = message.filters.map((e) => Filters.toJSON(e)); - } - if (message.valueText !== undefined) { - obj.valueText = message.valueText; - } - if (message.valueInt !== undefined) { - obj.valueInt = Math.round(message.valueInt); - } - if (message.valueBoolean !== undefined) { - obj.valueBoolean = message.valueBoolean; - } - if (message.valueNumber !== undefined) { - obj.valueNumber = message.valueNumber; - } - if (message.valueTextArray !== undefined) { - obj.valueTextArray = TextArray.toJSON(message.valueTextArray); - } - if (message.valueIntArray !== undefined) { - obj.valueIntArray = IntArray.toJSON(message.valueIntArray); - } - if (message.valueBooleanArray !== undefined) { - obj.valueBooleanArray = BooleanArray.toJSON(message.valueBooleanArray); - } - if (message.valueNumberArray !== undefined) { - obj.valueNumberArray = NumberArray.toJSON(message.valueNumberArray); - } - if (message.valueGeo !== undefined) { - obj.valueGeo = GeoCoordinatesFilter.toJSON(message.valueGeo); - } - if (message.target !== undefined) { - obj.target = FilterTarget.toJSON(message.target); - } - return obj; - }, - create(base) { - return Filters.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g; - const message = createBaseFilters(); - message.operator = (_a = object.operator) !== null && _a !== void 0 ? _a : 0; - message.on = ((_b = object.on) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - message.filters = - ((_c = object.filters) === null || _c === void 0 ? void 0 : _c.map((e) => Filters.fromPartial(e))) || - []; - message.valueText = (_d = object.valueText) !== null && _d !== void 0 ? _d : undefined; - message.valueInt = (_e = object.valueInt) !== null && _e !== void 0 ? _e : undefined; - message.valueBoolean = (_f = object.valueBoolean) !== null && _f !== void 0 ? _f : undefined; - message.valueNumber = (_g = object.valueNumber) !== null && _g !== void 0 ? _g : undefined; - message.valueTextArray = - object.valueTextArray !== undefined && object.valueTextArray !== null - ? TextArray.fromPartial(object.valueTextArray) - : undefined; - message.valueIntArray = - object.valueIntArray !== undefined && object.valueIntArray !== null - ? IntArray.fromPartial(object.valueIntArray) - : undefined; - message.valueBooleanArray = - object.valueBooleanArray !== undefined && object.valueBooleanArray !== null - ? BooleanArray.fromPartial(object.valueBooleanArray) - : undefined; - message.valueNumberArray = - object.valueNumberArray !== undefined && object.valueNumberArray !== null - ? NumberArray.fromPartial(object.valueNumberArray) - : undefined; - message.valueGeo = - object.valueGeo !== undefined && object.valueGeo !== null - ? GeoCoordinatesFilter.fromPartial(object.valueGeo) - : undefined; - message.target = - object.target !== undefined && object.target !== null - ? FilterTarget.fromPartial(object.target) - : undefined; - return message; - }, -}; -function createBaseFilterReferenceSingleTarget() { - return { on: '', target: undefined }; -} -export const FilterReferenceSingleTarget = { - encode(message, writer = _m0.Writer.create()) { - if (message.on !== '') { - writer.uint32(10).string(message.on); - } - if (message.target !== undefined) { - FilterTarget.encode(message.target, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFilterReferenceSingleTarget(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.on = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.target = FilterTarget.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - on: isSet(object.on) ? globalThis.String(object.on) : '', - target: isSet(object.target) ? FilterTarget.fromJSON(object.target) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.on !== '') { - obj.on = message.on; - } - if (message.target !== undefined) { - obj.target = FilterTarget.toJSON(message.target); - } - return obj; - }, - create(base) { - return FilterReferenceSingleTarget.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseFilterReferenceSingleTarget(); - message.on = (_a = object.on) !== null && _a !== void 0 ? _a : ''; - message.target = - object.target !== undefined && object.target !== null - ? FilterTarget.fromPartial(object.target) - : undefined; - return message; - }, -}; -function createBaseFilterReferenceMultiTarget() { - return { on: '', target: undefined, targetCollection: '' }; -} -export const FilterReferenceMultiTarget = { - encode(message, writer = _m0.Writer.create()) { - if (message.on !== '') { - writer.uint32(10).string(message.on); - } - if (message.target !== undefined) { - FilterTarget.encode(message.target, writer.uint32(18).fork()).ldelim(); - } - if (message.targetCollection !== '') { - writer.uint32(26).string(message.targetCollection); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFilterReferenceMultiTarget(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.on = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.target = FilterTarget.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.targetCollection = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - on: isSet(object.on) ? globalThis.String(object.on) : '', - target: isSet(object.target) ? FilterTarget.fromJSON(object.target) : undefined, - targetCollection: isSet(object.targetCollection) ? globalThis.String(object.targetCollection) : '', - }; - }, - toJSON(message) { - const obj = {}; - if (message.on !== '') { - obj.on = message.on; - } - if (message.target !== undefined) { - obj.target = FilterTarget.toJSON(message.target); - } - if (message.targetCollection !== '') { - obj.targetCollection = message.targetCollection; - } - return obj; - }, - create(base) { - return FilterReferenceMultiTarget.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseFilterReferenceMultiTarget(); - message.on = (_a = object.on) !== null && _a !== void 0 ? _a : ''; - message.target = - object.target !== undefined && object.target !== null - ? FilterTarget.fromPartial(object.target) - : undefined; - message.targetCollection = (_b = object.targetCollection) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function createBaseFilterReferenceCount() { - return { on: '' }; -} -export const FilterReferenceCount = { - encode(message, writer = _m0.Writer.create()) { - if (message.on !== '') { - writer.uint32(10).string(message.on); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFilterReferenceCount(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.on = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { on: isSet(object.on) ? globalThis.String(object.on) : '' }; - }, - toJSON(message) { - const obj = {}; - if (message.on !== '') { - obj.on = message.on; - } - return obj; - }, - create(base) { - return FilterReferenceCount.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseFilterReferenceCount(); - message.on = (_a = object.on) !== null && _a !== void 0 ? _a : ''; - return message; - }, -}; -function createBaseFilterTarget() { - return { property: undefined, singleTarget: undefined, multiTarget: undefined, count: undefined }; -} -export const FilterTarget = { - encode(message, writer = _m0.Writer.create()) { - if (message.property !== undefined) { - writer.uint32(10).string(message.property); - } - if (message.singleTarget !== undefined) { - FilterReferenceSingleTarget.encode(message.singleTarget, writer.uint32(18).fork()).ldelim(); - } - if (message.multiTarget !== undefined) { - FilterReferenceMultiTarget.encode(message.multiTarget, writer.uint32(26).fork()).ldelim(); - } - if (message.count !== undefined) { - FilterReferenceCount.encode(message.count, writer.uint32(34).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseFilterTarget(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.property = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.singleTarget = FilterReferenceSingleTarget.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.multiTarget = FilterReferenceMultiTarget.decode(reader, reader.uint32()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.count = FilterReferenceCount.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - property: isSet(object.property) ? globalThis.String(object.property) : undefined, - singleTarget: isSet(object.singleTarget) - ? FilterReferenceSingleTarget.fromJSON(object.singleTarget) - : undefined, - multiTarget: isSet(object.multiTarget) - ? FilterReferenceMultiTarget.fromJSON(object.multiTarget) - : undefined, - count: isSet(object.count) ? FilterReferenceCount.fromJSON(object.count) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.property !== undefined) { - obj.property = message.property; - } - if (message.singleTarget !== undefined) { - obj.singleTarget = FilterReferenceSingleTarget.toJSON(message.singleTarget); - } - if (message.multiTarget !== undefined) { - obj.multiTarget = FilterReferenceMultiTarget.toJSON(message.multiTarget); - } - if (message.count !== undefined) { - obj.count = FilterReferenceCount.toJSON(message.count); - } - return obj; - }, - create(base) { - return FilterTarget.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseFilterTarget(); - message.property = (_a = object.property) !== null && _a !== void 0 ? _a : undefined; - message.singleTarget = - object.singleTarget !== undefined && object.singleTarget !== null - ? FilterReferenceSingleTarget.fromPartial(object.singleTarget) - : undefined; - message.multiTarget = - object.multiTarget !== undefined && object.multiTarget !== null - ? FilterReferenceMultiTarget.fromPartial(object.multiTarget) - : undefined; - message.count = - object.count !== undefined && object.count !== null - ? FilterReferenceCount.fromPartial(object.count) - : undefined; - return message; - }, -}; -function createBaseGeoCoordinatesFilter() { - return { latitude: 0, longitude: 0, distance: 0 }; -} -export const GeoCoordinatesFilter = { - encode(message, writer = _m0.Writer.create()) { - if (message.latitude !== 0) { - writer.uint32(13).float(message.latitude); - } - if (message.longitude !== 0) { - writer.uint32(21).float(message.longitude); - } - if (message.distance !== 0) { - writer.uint32(29).float(message.distance); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGeoCoordinatesFilter(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 13) { - break; - } - message.latitude = reader.float(); - continue; - case 2: - if (tag !== 21) { - break; - } - message.longitude = reader.float(); - continue; - case 3: - if (tag !== 29) { - break; - } - message.distance = reader.float(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - latitude: isSet(object.latitude) ? globalThis.Number(object.latitude) : 0, - longitude: isSet(object.longitude) ? globalThis.Number(object.longitude) : 0, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : 0, - }; - }, - toJSON(message) { - const obj = {}; - if (message.latitude !== 0) { - obj.latitude = message.latitude; - } - if (message.longitude !== 0) { - obj.longitude = message.longitude; - } - if (message.distance !== 0) { - obj.distance = message.distance; - } - return obj; - }, - create(base) { - return GeoCoordinatesFilter.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGeoCoordinatesFilter(); - message.latitude = (_a = object.latitude) !== null && _a !== void 0 ? _a : 0; - message.longitude = (_b = object.longitude) !== null && _b !== void 0 ? _b : 0; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : 0; - return message; - }, -}; -function createBaseVectors() { - return { name: '', index: 0, vectorBytes: new Uint8Array(0) }; -} -export const Vectors = { - encode(message, writer = _m0.Writer.create()) { - if (message.name !== '') { - writer.uint32(10).string(message.name); - } - if (message.index !== 0) { - writer.uint32(16).uint64(message.index); - } - if (message.vectorBytes.length !== 0) { - writer.uint32(26).bytes(message.vectorBytes); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseVectors(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.name = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.index = longToNumber(reader.uint64()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.vectorBytes = reader.bytes(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - name: isSet(object.name) ? globalThis.String(object.name) : '', - index: isSet(object.index) ? globalThis.Number(object.index) : 0, - vectorBytes: isSet(object.vectorBytes) ? bytesFromBase64(object.vectorBytes) : new Uint8Array(0), - }; - }, - toJSON(message) { - const obj = {}; - if (message.name !== '') { - obj.name = message.name; - } - if (message.index !== 0) { - obj.index = Math.round(message.index); - } - if (message.vectorBytes.length !== 0) { - obj.vectorBytes = base64FromBytes(message.vectorBytes); - } - return obj; - }, - create(base) { - return Vectors.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseVectors(); - message.name = (_a = object.name) !== null && _a !== void 0 ? _a : ''; - message.index = (_b = object.index) !== null && _b !== void 0 ? _b : 0; - message.vectorBytes = (_c = object.vectorBytes) !== null && _c !== void 0 ? _c : new Uint8Array(0); - return message; - }, -}; -function bytesFromBase64(b64) { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} -function base64FromBytes(arr) { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString('base64'); - } else { - const bin = []; - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join('')); - } -} -function longToNumber(long) { - if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { - throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); - } - return long.toNumber(); -} -if (_m0.util.Long !== Long) { - _m0.util.Long = Long; - _m0.configure(); -} -function isObject(value) { - return typeof value === 'object' && value !== null; -} -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/esm/proto/v1/batch.d.ts b/dist/node/esm/proto/v1/batch.d.ts deleted file mode 100644 index 4fca61ea..00000000 --- a/dist/node/esm/proto/v1/batch.d.ts +++ /dev/null @@ -1,137 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -import { - BooleanArrayProperties, - ConsistencyLevel, - IntArrayProperties, - NumberArrayProperties, - ObjectArrayProperties, - ObjectProperties, - TextArrayProperties, - Vectors, -} from './base.js'; -export declare const protobufPackage = 'weaviate.v1'; -export interface BatchObjectsRequest { - objects: BatchObject[]; - consistencyLevel?: ConsistencyLevel | undefined; -} -export interface BatchObject { - uuid: string; - /** - * protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED - * - * @deprecated - */ - vector: number[]; - properties: BatchObject_Properties | undefined; - collection: string; - tenant: string; - vectorBytes: Uint8Array; - /** protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED */ - vectors: Vectors[]; -} -export interface BatchObject_Properties { - nonRefProperties: - | { - [key: string]: any; - } - | undefined; - singleTargetRefProps: BatchObject_SingleTargetRefProps[]; - multiTargetRefProps: BatchObject_MultiTargetRefProps[]; - numberArrayProperties: NumberArrayProperties[]; - intArrayProperties: IntArrayProperties[]; - textArrayProperties: TextArrayProperties[]; - booleanArrayProperties: BooleanArrayProperties[]; - objectProperties: ObjectProperties[]; - objectArrayProperties: ObjectArrayProperties[]; - /** - * empty lists do not have a type in many languages and clients do not know which datatype the property has. - * Weaviate can get the datatype from its schema - */ - emptyListProps: string[]; -} -export interface BatchObject_SingleTargetRefProps { - uuids: string[]; - propName: string; -} -export interface BatchObject_MultiTargetRefProps { - uuids: string[]; - propName: string; - targetCollection: string; -} -export interface BatchObjectsReply { - took: number; - errors: BatchObjectsReply_BatchError[]; -} -export interface BatchObjectsReply_BatchError { - index: number; - error: string; -} -export declare const BatchObjectsRequest: { - encode(message: BatchObjectsRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchObjectsRequest; - fromJSON(object: any): BatchObjectsRequest; - toJSON(message: BatchObjectsRequest): unknown; - create(base?: DeepPartial): BatchObjectsRequest; - fromPartial(object: DeepPartial): BatchObjectsRequest; -}; -export declare const BatchObject: { - encode(message: BatchObject, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchObject; - fromJSON(object: any): BatchObject; - toJSON(message: BatchObject): unknown; - create(base?: DeepPartial): BatchObject; - fromPartial(object: DeepPartial): BatchObject; -}; -export declare const BatchObject_Properties: { - encode(message: BatchObject_Properties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchObject_Properties; - fromJSON(object: any): BatchObject_Properties; - toJSON(message: BatchObject_Properties): unknown; - create(base?: DeepPartial): BatchObject_Properties; - fromPartial(object: DeepPartial): BatchObject_Properties; -}; -export declare const BatchObject_SingleTargetRefProps: { - encode(message: BatchObject_SingleTargetRefProps, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchObject_SingleTargetRefProps; - fromJSON(object: any): BatchObject_SingleTargetRefProps; - toJSON(message: BatchObject_SingleTargetRefProps): unknown; - create(base?: DeepPartial): BatchObject_SingleTargetRefProps; - fromPartial(object: DeepPartial): BatchObject_SingleTargetRefProps; -}; -export declare const BatchObject_MultiTargetRefProps: { - encode(message: BatchObject_MultiTargetRefProps, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchObject_MultiTargetRefProps; - fromJSON(object: any): BatchObject_MultiTargetRefProps; - toJSON(message: BatchObject_MultiTargetRefProps): unknown; - create(base?: DeepPartial): BatchObject_MultiTargetRefProps; - fromPartial(object: DeepPartial): BatchObject_MultiTargetRefProps; -}; -export declare const BatchObjectsReply: { - encode(message: BatchObjectsReply, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchObjectsReply; - fromJSON(object: any): BatchObjectsReply; - toJSON(message: BatchObjectsReply): unknown; - create(base?: DeepPartial): BatchObjectsReply; - fromPartial(object: DeepPartial): BatchObjectsReply; -}; -export declare const BatchObjectsReply_BatchError: { - encode(message: BatchObjectsReply_BatchError, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchObjectsReply_BatchError; - fromJSON(object: any): BatchObjectsReply_BatchError; - toJSON(message: BatchObjectsReply_BatchError): unknown; - create(base?: DeepPartial): BatchObjectsReply_BatchError; - fromPartial(object: DeepPartial): BatchObjectsReply_BatchError; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/esm/proto/v1/batch.js b/dist/node/esm/proto/v1/batch.js deleted file mode 100644 index 8faa174b..00000000 --- a/dist/node/esm/proto/v1/batch.js +++ /dev/null @@ -1,840 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/batch.proto -/* eslint-disable */ -import _m0 from 'protobufjs/minimal.js'; -import { Struct } from '../google/protobuf/struct.js'; -import { - BooleanArrayProperties, - consistencyLevelFromJSON, - consistencyLevelToJSON, - IntArrayProperties, - NumberArrayProperties, - ObjectArrayProperties, - ObjectProperties, - TextArrayProperties, - Vectors, -} from './base.js'; -export const protobufPackage = 'weaviate.v1'; -function createBaseBatchObjectsRequest() { - return { objects: [], consistencyLevel: undefined }; -} -export const BatchObjectsRequest = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.objects) { - BatchObject.encode(v, writer.uint32(10).fork()).ldelim(); - } - if (message.consistencyLevel !== undefined) { - writer.uint32(16).int32(message.consistencyLevel); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchObjectsRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.objects.push(BatchObject.decode(reader, reader.uint32())); - continue; - case 2: - if (tag !== 16) { - break; - } - message.consistencyLevel = reader.int32(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - objects: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.objects) - ? object.objects.map((e) => BatchObject.fromJSON(e)) - : [], - consistencyLevel: isSet(object.consistencyLevel) - ? consistencyLevelFromJSON(object.consistencyLevel) - : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.objects) === null || _a === void 0 ? void 0 : _a.length) { - obj.objects = message.objects.map((e) => BatchObject.toJSON(e)); - } - if (message.consistencyLevel !== undefined) { - obj.consistencyLevel = consistencyLevelToJSON(message.consistencyLevel); - } - return obj; - }, - create(base) { - return BatchObjectsRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseBatchObjectsRequest(); - message.objects = - ((_a = object.objects) === null || _a === void 0 - ? void 0 - : _a.map((e) => BatchObject.fromPartial(e))) || []; - message.consistencyLevel = (_b = object.consistencyLevel) !== null && _b !== void 0 ? _b : undefined; - return message; - }, -}; -function createBaseBatchObject() { - return { - uuid: '', - vector: [], - properties: undefined, - collection: '', - tenant: '', - vectorBytes: new Uint8Array(0), - vectors: [], - }; -} -export const BatchObject = { - encode(message, writer = _m0.Writer.create()) { - if (message.uuid !== '') { - writer.uint32(10).string(message.uuid); - } - writer.uint32(18).fork(); - for (const v of message.vector) { - writer.float(v); - } - writer.ldelim(); - if (message.properties !== undefined) { - BatchObject_Properties.encode(message.properties, writer.uint32(26).fork()).ldelim(); - } - if (message.collection !== '') { - writer.uint32(34).string(message.collection); - } - if (message.tenant !== '') { - writer.uint32(42).string(message.tenant); - } - if (message.vectorBytes.length !== 0) { - writer.uint32(50).bytes(message.vectorBytes); - } - for (const v of message.vectors) { - Vectors.encode(v, writer.uint32(186).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchObject(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.uuid = reader.string(); - continue; - case 2: - if (tag === 21) { - message.vector.push(reader.float()); - continue; - } - if (tag === 18) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.vector.push(reader.float()); - } - continue; - } - break; - case 3: - if (tag !== 26) { - break; - } - message.properties = BatchObject_Properties.decode(reader, reader.uint32()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.collection = reader.string(); - continue; - case 5: - if (tag !== 42) { - break; - } - message.tenant = reader.string(); - continue; - case 6: - if (tag !== 50) { - break; - } - message.vectorBytes = reader.bytes(); - continue; - case 23: - if (tag !== 186) { - break; - } - message.vectors.push(Vectors.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - uuid: isSet(object.uuid) ? globalThis.String(object.uuid) : '', - vector: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.vector) - ? object.vector.map((e) => globalThis.Number(e)) - : [], - properties: isSet(object.properties) ? BatchObject_Properties.fromJSON(object.properties) : undefined, - collection: isSet(object.collection) ? globalThis.String(object.collection) : '', - tenant: isSet(object.tenant) ? globalThis.String(object.tenant) : '', - vectorBytes: isSet(object.vectorBytes) ? bytesFromBase64(object.vectorBytes) : new Uint8Array(0), - vectors: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.vectors) - ? object.vectors.map((e) => Vectors.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if (message.uuid !== '') { - obj.uuid = message.uuid; - } - if ((_a = message.vector) === null || _a === void 0 ? void 0 : _a.length) { - obj.vector = message.vector; - } - if (message.properties !== undefined) { - obj.properties = BatchObject_Properties.toJSON(message.properties); - } - if (message.collection !== '') { - obj.collection = message.collection; - } - if (message.tenant !== '') { - obj.tenant = message.tenant; - } - if (message.vectorBytes.length !== 0) { - obj.vectorBytes = base64FromBytes(message.vectorBytes); - } - if ((_b = message.vectors) === null || _b === void 0 ? void 0 : _b.length) { - obj.vectors = message.vectors.map((e) => Vectors.toJSON(e)); - } - return obj; - }, - create(base) { - return BatchObject.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f; - const message = createBaseBatchObject(); - message.uuid = (_a = object.uuid) !== null && _a !== void 0 ? _a : ''; - message.vector = ((_b = object.vector) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - message.properties = - object.properties !== undefined && object.properties !== null - ? BatchObject_Properties.fromPartial(object.properties) - : undefined; - message.collection = (_c = object.collection) !== null && _c !== void 0 ? _c : ''; - message.tenant = (_d = object.tenant) !== null && _d !== void 0 ? _d : ''; - message.vectorBytes = (_e = object.vectorBytes) !== null && _e !== void 0 ? _e : new Uint8Array(0); - message.vectors = - ((_f = object.vectors) === null || _f === void 0 ? void 0 : _f.map((e) => Vectors.fromPartial(e))) || - []; - return message; - }, -}; -function createBaseBatchObject_Properties() { - return { - nonRefProperties: undefined, - singleTargetRefProps: [], - multiTargetRefProps: [], - numberArrayProperties: [], - intArrayProperties: [], - textArrayProperties: [], - booleanArrayProperties: [], - objectProperties: [], - objectArrayProperties: [], - emptyListProps: [], - }; -} -export const BatchObject_Properties = { - encode(message, writer = _m0.Writer.create()) { - if (message.nonRefProperties !== undefined) { - Struct.encode(Struct.wrap(message.nonRefProperties), writer.uint32(10).fork()).ldelim(); - } - for (const v of message.singleTargetRefProps) { - BatchObject_SingleTargetRefProps.encode(v, writer.uint32(18).fork()).ldelim(); - } - for (const v of message.multiTargetRefProps) { - BatchObject_MultiTargetRefProps.encode(v, writer.uint32(26).fork()).ldelim(); - } - for (const v of message.numberArrayProperties) { - NumberArrayProperties.encode(v, writer.uint32(34).fork()).ldelim(); - } - for (const v of message.intArrayProperties) { - IntArrayProperties.encode(v, writer.uint32(42).fork()).ldelim(); - } - for (const v of message.textArrayProperties) { - TextArrayProperties.encode(v, writer.uint32(50).fork()).ldelim(); - } - for (const v of message.booleanArrayProperties) { - BooleanArrayProperties.encode(v, writer.uint32(58).fork()).ldelim(); - } - for (const v of message.objectProperties) { - ObjectProperties.encode(v, writer.uint32(66).fork()).ldelim(); - } - for (const v of message.objectArrayProperties) { - ObjectArrayProperties.encode(v, writer.uint32(74).fork()).ldelim(); - } - for (const v of message.emptyListProps) { - writer.uint32(82).string(v); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchObject_Properties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.nonRefProperties = Struct.unwrap(Struct.decode(reader, reader.uint32())); - continue; - case 2: - if (tag !== 18) { - break; - } - message.singleTargetRefProps.push(BatchObject_SingleTargetRefProps.decode(reader, reader.uint32())); - continue; - case 3: - if (tag !== 26) { - break; - } - message.multiTargetRefProps.push(BatchObject_MultiTargetRefProps.decode(reader, reader.uint32())); - continue; - case 4: - if (tag !== 34) { - break; - } - message.numberArrayProperties.push(NumberArrayProperties.decode(reader, reader.uint32())); - continue; - case 5: - if (tag !== 42) { - break; - } - message.intArrayProperties.push(IntArrayProperties.decode(reader, reader.uint32())); - continue; - case 6: - if (tag !== 50) { - break; - } - message.textArrayProperties.push(TextArrayProperties.decode(reader, reader.uint32())); - continue; - case 7: - if (tag !== 58) { - break; - } - message.booleanArrayProperties.push(BooleanArrayProperties.decode(reader, reader.uint32())); - continue; - case 8: - if (tag !== 66) { - break; - } - message.objectProperties.push(ObjectProperties.decode(reader, reader.uint32())); - continue; - case 9: - if (tag !== 74) { - break; - } - message.objectArrayProperties.push(ObjectArrayProperties.decode(reader, reader.uint32())); - continue; - case 10: - if (tag !== 82) { - break; - } - message.emptyListProps.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - nonRefProperties: isObject(object.nonRefProperties) ? object.nonRefProperties : undefined, - singleTargetRefProps: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.singleTargetRefProps - ) - ? object.singleTargetRefProps.map((e) => BatchObject_SingleTargetRefProps.fromJSON(e)) - : [], - multiTargetRefProps: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.multiTargetRefProps - ) - ? object.multiTargetRefProps.map((e) => BatchObject_MultiTargetRefProps.fromJSON(e)) - : [], - numberArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.numberArrayProperties - ) - ? object.numberArrayProperties.map((e) => NumberArrayProperties.fromJSON(e)) - : [], - intArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.intArrayProperties - ) - ? object.intArrayProperties.map((e) => IntArrayProperties.fromJSON(e)) - : [], - textArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.textArrayProperties - ) - ? object.textArrayProperties.map((e) => TextArrayProperties.fromJSON(e)) - : [], - booleanArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.booleanArrayProperties - ) - ? object.booleanArrayProperties.map((e) => BooleanArrayProperties.fromJSON(e)) - : [], - objectProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectProperties - ) - ? object.objectProperties.map((e) => ObjectProperties.fromJSON(e)) - : [], - objectArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectArrayProperties - ) - ? object.objectArrayProperties.map((e) => ObjectArrayProperties.fromJSON(e)) - : [], - emptyListProps: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.emptyListProps - ) - ? object.emptyListProps.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - const obj = {}; - if (message.nonRefProperties !== undefined) { - obj.nonRefProperties = message.nonRefProperties; - } - if ((_a = message.singleTargetRefProps) === null || _a === void 0 ? void 0 : _a.length) { - obj.singleTargetRefProps = message.singleTargetRefProps.map((e) => - BatchObject_SingleTargetRefProps.toJSON(e) - ); - } - if ((_b = message.multiTargetRefProps) === null || _b === void 0 ? void 0 : _b.length) { - obj.multiTargetRefProps = message.multiTargetRefProps.map((e) => - BatchObject_MultiTargetRefProps.toJSON(e) - ); - } - if ((_c = message.numberArrayProperties) === null || _c === void 0 ? void 0 : _c.length) { - obj.numberArrayProperties = message.numberArrayProperties.map((e) => NumberArrayProperties.toJSON(e)); - } - if ((_d = message.intArrayProperties) === null || _d === void 0 ? void 0 : _d.length) { - obj.intArrayProperties = message.intArrayProperties.map((e) => IntArrayProperties.toJSON(e)); - } - if ((_e = message.textArrayProperties) === null || _e === void 0 ? void 0 : _e.length) { - obj.textArrayProperties = message.textArrayProperties.map((e) => TextArrayProperties.toJSON(e)); - } - if ((_f = message.booleanArrayProperties) === null || _f === void 0 ? void 0 : _f.length) { - obj.booleanArrayProperties = message.booleanArrayProperties.map((e) => - BooleanArrayProperties.toJSON(e) - ); - } - if ((_g = message.objectProperties) === null || _g === void 0 ? void 0 : _g.length) { - obj.objectProperties = message.objectProperties.map((e) => ObjectProperties.toJSON(e)); - } - if ((_h = message.objectArrayProperties) === null || _h === void 0 ? void 0 : _h.length) { - obj.objectArrayProperties = message.objectArrayProperties.map((e) => ObjectArrayProperties.toJSON(e)); - } - if ((_j = message.emptyListProps) === null || _j === void 0 ? void 0 : _j.length) { - obj.emptyListProps = message.emptyListProps; - } - return obj; - }, - create(base) { - return BatchObject_Properties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - const message = createBaseBatchObject_Properties(); - message.nonRefProperties = (_a = object.nonRefProperties) !== null && _a !== void 0 ? _a : undefined; - message.singleTargetRefProps = - ((_b = object.singleTargetRefProps) === null || _b === void 0 - ? void 0 - : _b.map((e) => BatchObject_SingleTargetRefProps.fromPartial(e))) || []; - message.multiTargetRefProps = - ((_c = object.multiTargetRefProps) === null || _c === void 0 - ? void 0 - : _c.map((e) => BatchObject_MultiTargetRefProps.fromPartial(e))) || []; - message.numberArrayProperties = - ((_d = object.numberArrayProperties) === null || _d === void 0 - ? void 0 - : _d.map((e) => NumberArrayProperties.fromPartial(e))) || []; - message.intArrayProperties = - ((_e = object.intArrayProperties) === null || _e === void 0 - ? void 0 - : _e.map((e) => IntArrayProperties.fromPartial(e))) || []; - message.textArrayProperties = - ((_f = object.textArrayProperties) === null || _f === void 0 - ? void 0 - : _f.map((e) => TextArrayProperties.fromPartial(e))) || []; - message.booleanArrayProperties = - ((_g = object.booleanArrayProperties) === null || _g === void 0 - ? void 0 - : _g.map((e) => BooleanArrayProperties.fromPartial(e))) || []; - message.objectProperties = - ((_h = object.objectProperties) === null || _h === void 0 - ? void 0 - : _h.map((e) => ObjectProperties.fromPartial(e))) || []; - message.objectArrayProperties = - ((_j = object.objectArrayProperties) === null || _j === void 0 - ? void 0 - : _j.map((e) => ObjectArrayProperties.fromPartial(e))) || []; - message.emptyListProps = - ((_k = object.emptyListProps) === null || _k === void 0 ? void 0 : _k.map((e) => e)) || []; - return message; - }, -}; -function createBaseBatchObject_SingleTargetRefProps() { - return { uuids: [], propName: '' }; -} -export const BatchObject_SingleTargetRefProps = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.uuids) { - writer.uint32(10).string(v); - } - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchObject_SingleTargetRefProps(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.uuids.push(reader.string()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - uuids: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.uuids) - ? object.uuids.map((e) => globalThis.String(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.uuids) === null || _a === void 0 ? void 0 : _a.length) { - obj.uuids = message.uuids; - } - if (message.propName !== '') { - obj.propName = message.propName; - } - return obj; - }, - create(base) { - return BatchObject_SingleTargetRefProps.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseBatchObject_SingleTargetRefProps(); - message.uuids = ((_a = object.uuids) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function createBaseBatchObject_MultiTargetRefProps() { - return { uuids: [], propName: '', targetCollection: '' }; -} -export const BatchObject_MultiTargetRefProps = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.uuids) { - writer.uint32(10).string(v); - } - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - if (message.targetCollection !== '') { - writer.uint32(26).string(message.targetCollection); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchObject_MultiTargetRefProps(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.uuids.push(reader.string()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - case 3: - if (tag !== 26) { - break; - } - message.targetCollection = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - uuids: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.uuids) - ? object.uuids.map((e) => globalThis.String(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - targetCollection: isSet(object.targetCollection) ? globalThis.String(object.targetCollection) : '', - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.uuids) === null || _a === void 0 ? void 0 : _a.length) { - obj.uuids = message.uuids; - } - if (message.propName !== '') { - obj.propName = message.propName; - } - if (message.targetCollection !== '') { - obj.targetCollection = message.targetCollection; - } - return obj; - }, - create(base) { - return BatchObject_MultiTargetRefProps.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseBatchObject_MultiTargetRefProps(); - message.uuids = ((_a = object.uuids) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - message.targetCollection = (_c = object.targetCollection) !== null && _c !== void 0 ? _c : ''; - return message; - }, -}; -function createBaseBatchObjectsReply() { - return { took: 0, errors: [] }; -} -export const BatchObjectsReply = { - encode(message, writer = _m0.Writer.create()) { - if (message.took !== 0) { - writer.uint32(13).float(message.took); - } - for (const v of message.errors) { - BatchObjectsReply_BatchError.encode(v, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchObjectsReply(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 13) { - break; - } - message.took = reader.float(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.errors.push(BatchObjectsReply_BatchError.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - took: isSet(object.took) ? globalThis.Number(object.took) : 0, - errors: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.errors) - ? object.errors.map((e) => BatchObjectsReply_BatchError.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.took !== 0) { - obj.took = message.took; - } - if ((_a = message.errors) === null || _a === void 0 ? void 0 : _a.length) { - obj.errors = message.errors.map((e) => BatchObjectsReply_BatchError.toJSON(e)); - } - return obj; - }, - create(base) { - return BatchObjectsReply.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseBatchObjectsReply(); - message.took = (_a = object.took) !== null && _a !== void 0 ? _a : 0; - message.errors = - ((_b = object.errors) === null || _b === void 0 - ? void 0 - : _b.map((e) => BatchObjectsReply_BatchError.fromPartial(e))) || []; - return message; - }, -}; -function createBaseBatchObjectsReply_BatchError() { - return { index: 0, error: '' }; -} -export const BatchObjectsReply_BatchError = { - encode(message, writer = _m0.Writer.create()) { - if (message.index !== 0) { - writer.uint32(8).int32(message.index); - } - if (message.error !== '') { - writer.uint32(18).string(message.error); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchObjectsReply_BatchError(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.index = reader.int32(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.error = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - index: isSet(object.index) ? globalThis.Number(object.index) : 0, - error: isSet(object.error) ? globalThis.String(object.error) : '', - }; - }, - toJSON(message) { - const obj = {}; - if (message.index !== 0) { - obj.index = Math.round(message.index); - } - if (message.error !== '') { - obj.error = message.error; - } - return obj; - }, - create(base) { - return BatchObjectsReply_BatchError.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseBatchObjectsReply_BatchError(); - message.index = (_a = object.index) !== null && _a !== void 0 ? _a : 0; - message.error = (_b = object.error) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function bytesFromBase64(b64) { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} -function base64FromBytes(arr) { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString('base64'); - } else { - const bin = []; - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join('')); - } -} -function isObject(value) { - return typeof value === 'object' && value !== null; -} -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/esm/proto/v1/batch_delete.d.ts b/dist/node/esm/proto/v1/batch_delete.d.ts deleted file mode 100644 index 33f03c57..00000000 --- a/dist/node/esm/proto/v1/batch_delete.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -import { ConsistencyLevel, Filters } from './base.js'; -export declare const protobufPackage = 'weaviate.v1'; -export interface BatchDeleteRequest { - collection: string; - filters: Filters | undefined; - verbose: boolean; - dryRun: boolean; - consistencyLevel?: ConsistencyLevel | undefined; - tenant?: string | undefined; -} -export interface BatchDeleteReply { - took: number; - failed: number; - matches: number; - successful: number; - objects: BatchDeleteObject[]; -} -export interface BatchDeleteObject { - uuid: Uint8Array; - successful: boolean; - /** empty string means no error */ - error?: string | undefined; -} -export declare const BatchDeleteRequest: { - encode(message: BatchDeleteRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchDeleteRequest; - fromJSON(object: any): BatchDeleteRequest; - toJSON(message: BatchDeleteRequest): unknown; - create(base?: DeepPartial): BatchDeleteRequest; - fromPartial(object: DeepPartial): BatchDeleteRequest; -}; -export declare const BatchDeleteReply: { - encode(message: BatchDeleteReply, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchDeleteReply; - fromJSON(object: any): BatchDeleteReply; - toJSON(message: BatchDeleteReply): unknown; - create(base?: DeepPartial): BatchDeleteReply; - fromPartial(object: DeepPartial): BatchDeleteReply; -}; -export declare const BatchDeleteObject: { - encode(message: BatchDeleteObject, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BatchDeleteObject; - fromJSON(object: any): BatchDeleteObject; - toJSON(message: BatchDeleteObject): unknown; - create(base?: DeepPartial): BatchDeleteObject; - fromPartial(object: DeepPartial): BatchDeleteObject; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/esm/proto/v1/batch_delete.js b/dist/node/esm/proto/v1/batch_delete.js deleted file mode 100644 index 96cad67b..00000000 --- a/dist/node/esm/proto/v1/batch_delete.js +++ /dev/null @@ -1,377 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/batch_delete.proto -/* eslint-disable */ -import Long from 'long'; -import _m0 from 'protobufjs/minimal.js'; -import { consistencyLevelFromJSON, consistencyLevelToJSON, Filters } from './base.js'; -export const protobufPackage = 'weaviate.v1'; -function createBaseBatchDeleteRequest() { - return { - collection: '', - filters: undefined, - verbose: false, - dryRun: false, - consistencyLevel: undefined, - tenant: undefined, - }; -} -export const BatchDeleteRequest = { - encode(message, writer = _m0.Writer.create()) { - if (message.collection !== '') { - writer.uint32(10).string(message.collection); - } - if (message.filters !== undefined) { - Filters.encode(message.filters, writer.uint32(18).fork()).ldelim(); - } - if (message.verbose !== false) { - writer.uint32(24).bool(message.verbose); - } - if (message.dryRun !== false) { - writer.uint32(32).bool(message.dryRun); - } - if (message.consistencyLevel !== undefined) { - writer.uint32(40).int32(message.consistencyLevel); - } - if (message.tenant !== undefined) { - writer.uint32(50).string(message.tenant); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchDeleteRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.collection = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.filters = Filters.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 24) { - break; - } - message.verbose = reader.bool(); - continue; - case 4: - if (tag !== 32) { - break; - } - message.dryRun = reader.bool(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.consistencyLevel = reader.int32(); - continue; - case 6: - if (tag !== 50) { - break; - } - message.tenant = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - collection: isSet(object.collection) ? globalThis.String(object.collection) : '', - filters: isSet(object.filters) ? Filters.fromJSON(object.filters) : undefined, - verbose: isSet(object.verbose) ? globalThis.Boolean(object.verbose) : false, - dryRun: isSet(object.dryRun) ? globalThis.Boolean(object.dryRun) : false, - consistencyLevel: isSet(object.consistencyLevel) - ? consistencyLevelFromJSON(object.consistencyLevel) - : undefined, - tenant: isSet(object.tenant) ? globalThis.String(object.tenant) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.collection !== '') { - obj.collection = message.collection; - } - if (message.filters !== undefined) { - obj.filters = Filters.toJSON(message.filters); - } - if (message.verbose !== false) { - obj.verbose = message.verbose; - } - if (message.dryRun !== false) { - obj.dryRun = message.dryRun; - } - if (message.consistencyLevel !== undefined) { - obj.consistencyLevel = consistencyLevelToJSON(message.consistencyLevel); - } - if (message.tenant !== undefined) { - obj.tenant = message.tenant; - } - return obj; - }, - create(base) { - return BatchDeleteRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e; - const message = createBaseBatchDeleteRequest(); - message.collection = (_a = object.collection) !== null && _a !== void 0 ? _a : ''; - message.filters = - object.filters !== undefined && object.filters !== null - ? Filters.fromPartial(object.filters) - : undefined; - message.verbose = (_b = object.verbose) !== null && _b !== void 0 ? _b : false; - message.dryRun = (_c = object.dryRun) !== null && _c !== void 0 ? _c : false; - message.consistencyLevel = (_d = object.consistencyLevel) !== null && _d !== void 0 ? _d : undefined; - message.tenant = (_e = object.tenant) !== null && _e !== void 0 ? _e : undefined; - return message; - }, -}; -function createBaseBatchDeleteReply() { - return { took: 0, failed: 0, matches: 0, successful: 0, objects: [] }; -} -export const BatchDeleteReply = { - encode(message, writer = _m0.Writer.create()) { - if (message.took !== 0) { - writer.uint32(13).float(message.took); - } - if (message.failed !== 0) { - writer.uint32(16).int64(message.failed); - } - if (message.matches !== 0) { - writer.uint32(24).int64(message.matches); - } - if (message.successful !== 0) { - writer.uint32(32).int64(message.successful); - } - for (const v of message.objects) { - BatchDeleteObject.encode(v, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchDeleteReply(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 13) { - break; - } - message.took = reader.float(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.failed = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 24) { - break; - } - message.matches = longToNumber(reader.int64()); - continue; - case 4: - if (tag !== 32) { - break; - } - message.successful = longToNumber(reader.int64()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.objects.push(BatchDeleteObject.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - took: isSet(object.took) ? globalThis.Number(object.took) : 0, - failed: isSet(object.failed) ? globalThis.Number(object.failed) : 0, - matches: isSet(object.matches) ? globalThis.Number(object.matches) : 0, - successful: isSet(object.successful) ? globalThis.Number(object.successful) : 0, - objects: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.objects) - ? object.objects.map((e) => BatchDeleteObject.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.took !== 0) { - obj.took = message.took; - } - if (message.failed !== 0) { - obj.failed = Math.round(message.failed); - } - if (message.matches !== 0) { - obj.matches = Math.round(message.matches); - } - if (message.successful !== 0) { - obj.successful = Math.round(message.successful); - } - if ((_a = message.objects) === null || _a === void 0 ? void 0 : _a.length) { - obj.objects = message.objects.map((e) => BatchDeleteObject.toJSON(e)); - } - return obj; - }, - create(base) { - return BatchDeleteReply.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e; - const message = createBaseBatchDeleteReply(); - message.took = (_a = object.took) !== null && _a !== void 0 ? _a : 0; - message.failed = (_b = object.failed) !== null && _b !== void 0 ? _b : 0; - message.matches = (_c = object.matches) !== null && _c !== void 0 ? _c : 0; - message.successful = (_d = object.successful) !== null && _d !== void 0 ? _d : 0; - message.objects = - ((_e = object.objects) === null || _e === void 0 - ? void 0 - : _e.map((e) => BatchDeleteObject.fromPartial(e))) || []; - return message; - }, -}; -function createBaseBatchDeleteObject() { - return { uuid: new Uint8Array(0), successful: false, error: undefined }; -} -export const BatchDeleteObject = { - encode(message, writer = _m0.Writer.create()) { - if (message.uuid.length !== 0) { - writer.uint32(10).bytes(message.uuid); - } - if (message.successful !== false) { - writer.uint32(16).bool(message.successful); - } - if (message.error !== undefined) { - writer.uint32(26).string(message.error); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBatchDeleteObject(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.uuid = reader.bytes(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.successful = reader.bool(); - continue; - case 3: - if (tag !== 26) { - break; - } - message.error = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - uuid: isSet(object.uuid) ? bytesFromBase64(object.uuid) : new Uint8Array(0), - successful: isSet(object.successful) ? globalThis.Boolean(object.successful) : false, - error: isSet(object.error) ? globalThis.String(object.error) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.uuid.length !== 0) { - obj.uuid = base64FromBytes(message.uuid); - } - if (message.successful !== false) { - obj.successful = message.successful; - } - if (message.error !== undefined) { - obj.error = message.error; - } - return obj; - }, - create(base) { - return BatchDeleteObject.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseBatchDeleteObject(); - message.uuid = (_a = object.uuid) !== null && _a !== void 0 ? _a : new Uint8Array(0); - message.successful = (_b = object.successful) !== null && _b !== void 0 ? _b : false; - message.error = (_c = object.error) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function bytesFromBase64(b64) { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} -function base64FromBytes(arr) { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString('base64'); - } else { - const bin = []; - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join('')); - } -} -function longToNumber(long) { - if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { - throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); - } - return long.toNumber(); -} -if (_m0.util.Long !== Long) { - _m0.util.Long = Long; - _m0.configure(); -} -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/esm/proto/v1/generative.d.ts b/dist/node/esm/proto/v1/generative.d.ts deleted file mode 100644 index fee6ca3c..00000000 --- a/dist/node/esm/proto/v1/generative.d.ts +++ /dev/null @@ -1,538 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -import { TextArray } from './base.js'; -export declare const protobufPackage = 'weaviate.v1'; -export interface GenerativeSearch { - /** @deprecated */ - singleResponsePrompt: string; - /** @deprecated */ - groupedResponseTask: string; - /** @deprecated */ - groupedProperties: string[]; - single: GenerativeSearch_Single | undefined; - grouped: GenerativeSearch_Grouped | undefined; -} -export interface GenerativeSearch_Single { - prompt: string; - debug: boolean; - /** only allow one at the beginning, but multiple in the future */ - queries: GenerativeProvider[]; -} -export interface GenerativeSearch_Grouped { - task: string; - properties?: TextArray | undefined; -} -export interface GenerativeProvider { - returnMetadata: boolean; - anthropic?: GenerativeAnthropic | undefined; - anyscale?: GenerativeAnyscale | undefined; - aws?: GenerativeAWS | undefined; - cohere?: GenerativeCohere | undefined; - dummy?: GenerativeDummy | undefined; - mistral?: GenerativeMistral | undefined; - octoai?: GenerativeOctoAI | undefined; - ollama?: GenerativeOllama | undefined; - openai?: GenerativeOpenAI | undefined; - google?: GenerativeGoogle | undefined; -} -export interface GenerativeAnthropic { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - temperature?: number | undefined; - topK?: number | undefined; - topP?: number | undefined; - stopSequences?: TextArray | undefined; -} -export interface GenerativeAnyscale { - baseUrl?: string | undefined; - model?: string | undefined; - temperature?: number | undefined; -} -export interface GenerativeAWS { - model?: string | undefined; - temperature?: number | undefined; -} -export interface GenerativeCohere { - baseUrl?: string | undefined; - frequencyPenalty?: number | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - k?: number | undefined; - p?: number | undefined; - presencePenalty?: number | undefined; - stopSequences?: TextArray | undefined; - temperature?: number | undefined; -} -export interface GenerativeDummy {} -export interface GenerativeMistral { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - temperature?: number | undefined; - topP?: number | undefined; -} -export interface GenerativeOctoAI { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - n?: number | undefined; - temperature?: number | undefined; - topP?: number | undefined; -} -export interface GenerativeOllama { - apiEndpoint?: string | undefined; - model?: string | undefined; - temperature?: number | undefined; -} -export interface GenerativeOpenAI { - frequencyPenalty?: number | undefined; - logProbs?: boolean | undefined; - maxTokens?: number | undefined; - model: string; - n?: number | undefined; - presencePenalty?: number | undefined; - stop?: TextArray | undefined; - temperature?: number | undefined; - topP?: number | undefined; - topLogProbs?: number | undefined; -} -export interface GenerativeGoogle { - frequencyPenalty?: number | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - presencePenalty?: number | undefined; - temperature?: number | undefined; - topK?: number | undefined; - topP?: number | undefined; - stopSequences?: TextArray | undefined; -} -export interface GenerativeAnthropicMetadata { - usage: GenerativeAnthropicMetadata_Usage | undefined; -} -export interface GenerativeAnthropicMetadata_Usage { - inputTokens: number; - outputTokens: number; -} -export interface GenerativeAnyscaleMetadata {} -export interface GenerativeAWSMetadata {} -export interface GenerativeCohereMetadata { - apiVersion?: GenerativeCohereMetadata_ApiVersion | undefined; - billedUnits?: GenerativeCohereMetadata_BilledUnits | undefined; - tokens?: GenerativeCohereMetadata_Tokens | undefined; - warnings?: TextArray | undefined; -} -export interface GenerativeCohereMetadata_ApiVersion { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; -} -export interface GenerativeCohereMetadata_BilledUnits { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; -} -export interface GenerativeCohereMetadata_Tokens { - inputTokens?: number | undefined; - outputTokens?: number | undefined; -} -export interface GenerativeDummyMetadata {} -export interface GenerativeMistralMetadata { - usage?: GenerativeMistralMetadata_Usage | undefined; -} -export interface GenerativeMistralMetadata_Usage { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; -} -export interface GenerativeOctoAIMetadata { - usage?: GenerativeOctoAIMetadata_Usage | undefined; -} -export interface GenerativeOctoAIMetadata_Usage { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; -} -export interface GenerativeOllamaMetadata {} -export interface GenerativeOpenAIMetadata { - usage?: GenerativeOpenAIMetadata_Usage | undefined; -} -export interface GenerativeOpenAIMetadata_Usage { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; -} -export interface GenerativeGoogleMetadata { - metadata?: GenerativeGoogleMetadata_Metadata | undefined; - usageMetadata?: GenerativeGoogleMetadata_UsageMetadata | undefined; -} -export interface GenerativeGoogleMetadata_TokenCount { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; -} -export interface GenerativeGoogleMetadata_TokenMetadata { - inputTokenCount?: GenerativeGoogleMetadata_TokenCount | undefined; - outputTokenCount?: GenerativeGoogleMetadata_TokenCount | undefined; -} -export interface GenerativeGoogleMetadata_Metadata { - tokenMetadata?: GenerativeGoogleMetadata_TokenMetadata | undefined; -} -export interface GenerativeGoogleMetadata_UsageMetadata { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; -} -export interface GenerativeMetadata { - anthropic?: GenerativeAnthropicMetadata | undefined; - anyscale?: GenerativeAnyscaleMetadata | undefined; - aws?: GenerativeAWSMetadata | undefined; - cohere?: GenerativeCohereMetadata | undefined; - dummy?: GenerativeDummyMetadata | undefined; - mistral?: GenerativeMistralMetadata | undefined; - octoai?: GenerativeOctoAIMetadata | undefined; - ollama?: GenerativeOllamaMetadata | undefined; - openai?: GenerativeOpenAIMetadata | undefined; - google?: GenerativeGoogleMetadata | undefined; -} -export interface GenerativeReply { - result: string; - debug?: GenerativeDebug | undefined; - metadata?: GenerativeMetadata | undefined; -} -export interface GenerativeResult { - values: GenerativeReply[]; -} -export interface GenerativeDebug { - fullPrompt?: string | undefined; -} -export declare const GenerativeSearch: { - encode(message: GenerativeSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeSearch; - fromJSON(object: any): GenerativeSearch; - toJSON(message: GenerativeSearch): unknown; - create(base?: DeepPartial): GenerativeSearch; - fromPartial(object: DeepPartial): GenerativeSearch; -}; -export declare const GenerativeSearch_Single: { - encode(message: GenerativeSearch_Single, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeSearch_Single; - fromJSON(object: any): GenerativeSearch_Single; - toJSON(message: GenerativeSearch_Single): unknown; - create(base?: DeepPartial): GenerativeSearch_Single; - fromPartial(object: DeepPartial): GenerativeSearch_Single; -}; -export declare const GenerativeSearch_Grouped: { - encode(message: GenerativeSearch_Grouped, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeSearch_Grouped; - fromJSON(object: any): GenerativeSearch_Grouped; - toJSON(message: GenerativeSearch_Grouped): unknown; - create(base?: DeepPartial): GenerativeSearch_Grouped; - fromPartial(object: DeepPartial): GenerativeSearch_Grouped; -}; -export declare const GenerativeProvider: { - encode(message: GenerativeProvider, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeProvider; - fromJSON(object: any): GenerativeProvider; - toJSON(message: GenerativeProvider): unknown; - create(base?: DeepPartial): GenerativeProvider; - fromPartial(object: DeepPartial): GenerativeProvider; -}; -export declare const GenerativeAnthropic: { - encode(message: GenerativeAnthropic, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeAnthropic; - fromJSON(object: any): GenerativeAnthropic; - toJSON(message: GenerativeAnthropic): unknown; - create(base?: DeepPartial): GenerativeAnthropic; - fromPartial(object: DeepPartial): GenerativeAnthropic; -}; -export declare const GenerativeAnyscale: { - encode(message: GenerativeAnyscale, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeAnyscale; - fromJSON(object: any): GenerativeAnyscale; - toJSON(message: GenerativeAnyscale): unknown; - create(base?: DeepPartial): GenerativeAnyscale; - fromPartial(object: DeepPartial): GenerativeAnyscale; -}; -export declare const GenerativeAWS: { - encode(message: GenerativeAWS, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeAWS; - fromJSON(object: any): GenerativeAWS; - toJSON(message: GenerativeAWS): unknown; - create(base?: DeepPartial): GenerativeAWS; - fromPartial(object: DeepPartial): GenerativeAWS; -}; -export declare const GenerativeCohere: { - encode(message: GenerativeCohere, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeCohere; - fromJSON(object: any): GenerativeCohere; - toJSON(message: GenerativeCohere): unknown; - create(base?: DeepPartial): GenerativeCohere; - fromPartial(object: DeepPartial): GenerativeCohere; -}; -export declare const GenerativeDummy: { - encode(_: GenerativeDummy, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeDummy; - fromJSON(_: any): GenerativeDummy; - toJSON(_: GenerativeDummy): unknown; - create(base?: DeepPartial): GenerativeDummy; - fromPartial(_: DeepPartial): GenerativeDummy; -}; -export declare const GenerativeMistral: { - encode(message: GenerativeMistral, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeMistral; - fromJSON(object: any): GenerativeMistral; - toJSON(message: GenerativeMistral): unknown; - create(base?: DeepPartial): GenerativeMistral; - fromPartial(object: DeepPartial): GenerativeMistral; -}; -export declare const GenerativeOctoAI: { - encode(message: GenerativeOctoAI, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOctoAI; - fromJSON(object: any): GenerativeOctoAI; - toJSON(message: GenerativeOctoAI): unknown; - create(base?: DeepPartial): GenerativeOctoAI; - fromPartial(object: DeepPartial): GenerativeOctoAI; -}; -export declare const GenerativeOllama: { - encode(message: GenerativeOllama, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOllama; - fromJSON(object: any): GenerativeOllama; - toJSON(message: GenerativeOllama): unknown; - create(base?: DeepPartial): GenerativeOllama; - fromPartial(object: DeepPartial): GenerativeOllama; -}; -export declare const GenerativeOpenAI: { - encode(message: GenerativeOpenAI, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOpenAI; - fromJSON(object: any): GenerativeOpenAI; - toJSON(message: GenerativeOpenAI): unknown; - create(base?: DeepPartial): GenerativeOpenAI; - fromPartial(object: DeepPartial): GenerativeOpenAI; -}; -export declare const GenerativeGoogle: { - encode(message: GenerativeGoogle, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeGoogle; - fromJSON(object: any): GenerativeGoogle; - toJSON(message: GenerativeGoogle): unknown; - create(base?: DeepPartial): GenerativeGoogle; - fromPartial(object: DeepPartial): GenerativeGoogle; -}; -export declare const GenerativeAnthropicMetadata: { - encode(message: GenerativeAnthropicMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeAnthropicMetadata; - fromJSON(object: any): GenerativeAnthropicMetadata; - toJSON(message: GenerativeAnthropicMetadata): unknown; - create(base?: DeepPartial): GenerativeAnthropicMetadata; - fromPartial(object: DeepPartial): GenerativeAnthropicMetadata; -}; -export declare const GenerativeAnthropicMetadata_Usage: { - encode(message: GenerativeAnthropicMetadata_Usage, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeAnthropicMetadata_Usage; - fromJSON(object: any): GenerativeAnthropicMetadata_Usage; - toJSON(message: GenerativeAnthropicMetadata_Usage): unknown; - create(base?: DeepPartial): GenerativeAnthropicMetadata_Usage; - fromPartial(object: DeepPartial): GenerativeAnthropicMetadata_Usage; -}; -export declare const GenerativeAnyscaleMetadata: { - encode(_: GenerativeAnyscaleMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeAnyscaleMetadata; - fromJSON(_: any): GenerativeAnyscaleMetadata; - toJSON(_: GenerativeAnyscaleMetadata): unknown; - create(base?: DeepPartial): GenerativeAnyscaleMetadata; - fromPartial(_: DeepPartial): GenerativeAnyscaleMetadata; -}; -export declare const GenerativeAWSMetadata: { - encode(_: GenerativeAWSMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeAWSMetadata; - fromJSON(_: any): GenerativeAWSMetadata; - toJSON(_: GenerativeAWSMetadata): unknown; - create(base?: DeepPartial): GenerativeAWSMetadata; - fromPartial(_: DeepPartial): GenerativeAWSMetadata; -}; -export declare const GenerativeCohereMetadata: { - encode(message: GenerativeCohereMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeCohereMetadata; - fromJSON(object: any): GenerativeCohereMetadata; - toJSON(message: GenerativeCohereMetadata): unknown; - create(base?: DeepPartial): GenerativeCohereMetadata; - fromPartial(object: DeepPartial): GenerativeCohereMetadata; -}; -export declare const GenerativeCohereMetadata_ApiVersion: { - encode(message: GenerativeCohereMetadata_ApiVersion, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeCohereMetadata_ApiVersion; - fromJSON(object: any): GenerativeCohereMetadata_ApiVersion; - toJSON(message: GenerativeCohereMetadata_ApiVersion): unknown; - create(base?: DeepPartial): GenerativeCohereMetadata_ApiVersion; - fromPartial(object: DeepPartial): GenerativeCohereMetadata_ApiVersion; -}; -export declare const GenerativeCohereMetadata_BilledUnits: { - encode(message: GenerativeCohereMetadata_BilledUnits, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeCohereMetadata_BilledUnits; - fromJSON(object: any): GenerativeCohereMetadata_BilledUnits; - toJSON(message: GenerativeCohereMetadata_BilledUnits): unknown; - create(base?: DeepPartial): GenerativeCohereMetadata_BilledUnits; - fromPartial( - object: DeepPartial - ): GenerativeCohereMetadata_BilledUnits; -}; -export declare const GenerativeCohereMetadata_Tokens: { - encode(message: GenerativeCohereMetadata_Tokens, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeCohereMetadata_Tokens; - fromJSON(object: any): GenerativeCohereMetadata_Tokens; - toJSON(message: GenerativeCohereMetadata_Tokens): unknown; - create(base?: DeepPartial): GenerativeCohereMetadata_Tokens; - fromPartial(object: DeepPartial): GenerativeCohereMetadata_Tokens; -}; -export declare const GenerativeDummyMetadata: { - encode(_: GenerativeDummyMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeDummyMetadata; - fromJSON(_: any): GenerativeDummyMetadata; - toJSON(_: GenerativeDummyMetadata): unknown; - create(base?: DeepPartial): GenerativeDummyMetadata; - fromPartial(_: DeepPartial): GenerativeDummyMetadata; -}; -export declare const GenerativeMistralMetadata: { - encode(message: GenerativeMistralMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeMistralMetadata; - fromJSON(object: any): GenerativeMistralMetadata; - toJSON(message: GenerativeMistralMetadata): unknown; - create(base?: DeepPartial): GenerativeMistralMetadata; - fromPartial(object: DeepPartial): GenerativeMistralMetadata; -}; -export declare const GenerativeMistralMetadata_Usage: { - encode(message: GenerativeMistralMetadata_Usage, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeMistralMetadata_Usage; - fromJSON(object: any): GenerativeMistralMetadata_Usage; - toJSON(message: GenerativeMistralMetadata_Usage): unknown; - create(base?: DeepPartial): GenerativeMistralMetadata_Usage; - fromPartial(object: DeepPartial): GenerativeMistralMetadata_Usage; -}; -export declare const GenerativeOctoAIMetadata: { - encode(message: GenerativeOctoAIMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOctoAIMetadata; - fromJSON(object: any): GenerativeOctoAIMetadata; - toJSON(message: GenerativeOctoAIMetadata): unknown; - create(base?: DeepPartial): GenerativeOctoAIMetadata; - fromPartial(object: DeepPartial): GenerativeOctoAIMetadata; -}; -export declare const GenerativeOctoAIMetadata_Usage: { - encode(message: GenerativeOctoAIMetadata_Usage, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOctoAIMetadata_Usage; - fromJSON(object: any): GenerativeOctoAIMetadata_Usage; - toJSON(message: GenerativeOctoAIMetadata_Usage): unknown; - create(base?: DeepPartial): GenerativeOctoAIMetadata_Usage; - fromPartial(object: DeepPartial): GenerativeOctoAIMetadata_Usage; -}; -export declare const GenerativeOllamaMetadata: { - encode(_: GenerativeOllamaMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOllamaMetadata; - fromJSON(_: any): GenerativeOllamaMetadata; - toJSON(_: GenerativeOllamaMetadata): unknown; - create(base?: DeepPartial): GenerativeOllamaMetadata; - fromPartial(_: DeepPartial): GenerativeOllamaMetadata; -}; -export declare const GenerativeOpenAIMetadata: { - encode(message: GenerativeOpenAIMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOpenAIMetadata; - fromJSON(object: any): GenerativeOpenAIMetadata; - toJSON(message: GenerativeOpenAIMetadata): unknown; - create(base?: DeepPartial): GenerativeOpenAIMetadata; - fromPartial(object: DeepPartial): GenerativeOpenAIMetadata; -}; -export declare const GenerativeOpenAIMetadata_Usage: { - encode(message: GenerativeOpenAIMetadata_Usage, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeOpenAIMetadata_Usage; - fromJSON(object: any): GenerativeOpenAIMetadata_Usage; - toJSON(message: GenerativeOpenAIMetadata_Usage): unknown; - create(base?: DeepPartial): GenerativeOpenAIMetadata_Usage; - fromPartial(object: DeepPartial): GenerativeOpenAIMetadata_Usage; -}; -export declare const GenerativeGoogleMetadata: { - encode(message: GenerativeGoogleMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeGoogleMetadata; - fromJSON(object: any): GenerativeGoogleMetadata; - toJSON(message: GenerativeGoogleMetadata): unknown; - create(base?: DeepPartial): GenerativeGoogleMetadata; - fromPartial(object: DeepPartial): GenerativeGoogleMetadata; -}; -export declare const GenerativeGoogleMetadata_TokenCount: { - encode(message: GenerativeGoogleMetadata_TokenCount, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeGoogleMetadata_TokenCount; - fromJSON(object: any): GenerativeGoogleMetadata_TokenCount; - toJSON(message: GenerativeGoogleMetadata_TokenCount): unknown; - create(base?: DeepPartial): GenerativeGoogleMetadata_TokenCount; - fromPartial(object: DeepPartial): GenerativeGoogleMetadata_TokenCount; -}; -export declare const GenerativeGoogleMetadata_TokenMetadata: { - encode(message: GenerativeGoogleMetadata_TokenMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeGoogleMetadata_TokenMetadata; - fromJSON(object: any): GenerativeGoogleMetadata_TokenMetadata; - toJSON(message: GenerativeGoogleMetadata_TokenMetadata): unknown; - create(base?: DeepPartial): GenerativeGoogleMetadata_TokenMetadata; - fromPartial( - object: DeepPartial - ): GenerativeGoogleMetadata_TokenMetadata; -}; -export declare const GenerativeGoogleMetadata_Metadata: { - encode(message: GenerativeGoogleMetadata_Metadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeGoogleMetadata_Metadata; - fromJSON(object: any): GenerativeGoogleMetadata_Metadata; - toJSON(message: GenerativeGoogleMetadata_Metadata): unknown; - create(base?: DeepPartial): GenerativeGoogleMetadata_Metadata; - fromPartial(object: DeepPartial): GenerativeGoogleMetadata_Metadata; -}; -export declare const GenerativeGoogleMetadata_UsageMetadata: { - encode(message: GenerativeGoogleMetadata_UsageMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeGoogleMetadata_UsageMetadata; - fromJSON(object: any): GenerativeGoogleMetadata_UsageMetadata; - toJSON(message: GenerativeGoogleMetadata_UsageMetadata): unknown; - create(base?: DeepPartial): GenerativeGoogleMetadata_UsageMetadata; - fromPartial( - object: DeepPartial - ): GenerativeGoogleMetadata_UsageMetadata; -}; -export declare const GenerativeMetadata: { - encode(message: GenerativeMetadata, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeMetadata; - fromJSON(object: any): GenerativeMetadata; - toJSON(message: GenerativeMetadata): unknown; - create(base?: DeepPartial): GenerativeMetadata; - fromPartial(object: DeepPartial): GenerativeMetadata; -}; -export declare const GenerativeReply: { - encode(message: GenerativeReply, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeReply; - fromJSON(object: any): GenerativeReply; - toJSON(message: GenerativeReply): unknown; - create(base?: DeepPartial): GenerativeReply; - fromPartial(object: DeepPartial): GenerativeReply; -}; -export declare const GenerativeResult: { - encode(message: GenerativeResult, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeResult; - fromJSON(object: any): GenerativeResult; - toJSON(message: GenerativeResult): unknown; - create(base?: DeepPartial): GenerativeResult; - fromPartial(object: DeepPartial): GenerativeResult; -}; -export declare const GenerativeDebug: { - encode(message: GenerativeDebug, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GenerativeDebug; - fromJSON(object: any): GenerativeDebug; - toJSON(message: GenerativeDebug): unknown; - create(base?: DeepPartial): GenerativeDebug; - fromPartial(object: DeepPartial): GenerativeDebug; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/esm/proto/v1/generative.js b/dist/node/esm/proto/v1/generative.js deleted file mode 100644 index 7b33c3a7..00000000 --- a/dist/node/esm/proto/v1/generative.js +++ /dev/null @@ -1,3560 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/generative.proto -/* eslint-disable */ -import Long from 'long'; -import _m0 from 'protobufjs/minimal.js'; -import { TextArray } from './base.js'; -export const protobufPackage = 'weaviate.v1'; -function createBaseGenerativeSearch() { - return { - singleResponsePrompt: '', - groupedResponseTask: '', - groupedProperties: [], - single: undefined, - grouped: undefined, - }; -} -export const GenerativeSearch = { - encode(message, writer = _m0.Writer.create()) { - if (message.singleResponsePrompt !== '') { - writer.uint32(10).string(message.singleResponsePrompt); - } - if (message.groupedResponseTask !== '') { - writer.uint32(18).string(message.groupedResponseTask); - } - for (const v of message.groupedProperties) { - writer.uint32(26).string(v); - } - if (message.single !== undefined) { - GenerativeSearch_Single.encode(message.single, writer.uint32(34).fork()).ldelim(); - } - if (message.grouped !== undefined) { - GenerativeSearch_Grouped.encode(message.grouped, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.singleResponsePrompt = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.groupedResponseTask = reader.string(); - continue; - case 3: - if (tag !== 26) { - break; - } - message.groupedProperties.push(reader.string()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.single = GenerativeSearch_Single.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.grouped = GenerativeSearch_Grouped.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - singleResponsePrompt: isSet(object.singleResponsePrompt) - ? globalThis.String(object.singleResponsePrompt) - : '', - groupedResponseTask: isSet(object.groupedResponseTask) - ? globalThis.String(object.groupedResponseTask) - : '', - groupedProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.groupedProperties - ) - ? object.groupedProperties.map((e) => globalThis.String(e)) - : [], - single: isSet(object.single) ? GenerativeSearch_Single.fromJSON(object.single) : undefined, - grouped: isSet(object.grouped) ? GenerativeSearch_Grouped.fromJSON(object.grouped) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.singleResponsePrompt !== '') { - obj.singleResponsePrompt = message.singleResponsePrompt; - } - if (message.groupedResponseTask !== '') { - obj.groupedResponseTask = message.groupedResponseTask; - } - if ((_a = message.groupedProperties) === null || _a === void 0 ? void 0 : _a.length) { - obj.groupedProperties = message.groupedProperties; - } - if (message.single !== undefined) { - obj.single = GenerativeSearch_Single.toJSON(message.single); - } - if (message.grouped !== undefined) { - obj.grouped = GenerativeSearch_Grouped.toJSON(message.grouped); - } - return obj; - }, - create(base) { - return GenerativeSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeSearch(); - message.singleResponsePrompt = (_a = object.singleResponsePrompt) !== null && _a !== void 0 ? _a : ''; - message.groupedResponseTask = (_b = object.groupedResponseTask) !== null && _b !== void 0 ? _b : ''; - message.groupedProperties = - ((_c = object.groupedProperties) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || []; - message.single = - object.single !== undefined && object.single !== null - ? GenerativeSearch_Single.fromPartial(object.single) - : undefined; - message.grouped = - object.grouped !== undefined && object.grouped !== null - ? GenerativeSearch_Grouped.fromPartial(object.grouped) - : undefined; - return message; - }, -}; -function createBaseGenerativeSearch_Single() { - return { prompt: '', debug: false, queries: [] }; -} -export const GenerativeSearch_Single = { - encode(message, writer = _m0.Writer.create()) { - if (message.prompt !== '') { - writer.uint32(10).string(message.prompt); - } - if (message.debug !== false) { - writer.uint32(16).bool(message.debug); - } - for (const v of message.queries) { - GenerativeProvider.encode(v, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeSearch_Single(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.prompt = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.debug = reader.bool(); - continue; - case 3: - if (tag !== 26) { - break; - } - message.queries.push(GenerativeProvider.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - prompt: isSet(object.prompt) ? globalThis.String(object.prompt) : '', - debug: isSet(object.debug) ? globalThis.Boolean(object.debug) : false, - queries: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.queries) - ? object.queries.map((e) => GenerativeProvider.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.prompt !== '') { - obj.prompt = message.prompt; - } - if (message.debug !== false) { - obj.debug = message.debug; - } - if ((_a = message.queries) === null || _a === void 0 ? void 0 : _a.length) { - obj.queries = message.queries.map((e) => GenerativeProvider.toJSON(e)); - } - return obj; - }, - create(base) { - return GenerativeSearch_Single.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeSearch_Single(); - message.prompt = (_a = object.prompt) !== null && _a !== void 0 ? _a : ''; - message.debug = (_b = object.debug) !== null && _b !== void 0 ? _b : false; - message.queries = - ((_c = object.queries) === null || _c === void 0 - ? void 0 - : _c.map((e) => GenerativeProvider.fromPartial(e))) || []; - return message; - }, -}; -function createBaseGenerativeSearch_Grouped() { - return { task: '', properties: undefined }; -} -export const GenerativeSearch_Grouped = { - encode(message, writer = _m0.Writer.create()) { - if (message.task !== '') { - writer.uint32(10).string(message.task); - } - if (message.properties !== undefined) { - TextArray.encode(message.properties, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeSearch_Grouped(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.task = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.properties = TextArray.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - task: isSet(object.task) ? globalThis.String(object.task) : '', - properties: isSet(object.properties) ? TextArray.fromJSON(object.properties) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.task !== '') { - obj.task = message.task; - } - if (message.properties !== undefined) { - obj.properties = TextArray.toJSON(message.properties); - } - return obj; - }, - create(base) { - return GenerativeSearch_Grouped.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseGenerativeSearch_Grouped(); - message.task = (_a = object.task) !== null && _a !== void 0 ? _a : ''; - message.properties = - object.properties !== undefined && object.properties !== null - ? TextArray.fromPartial(object.properties) - : undefined; - return message; - }, -}; -function createBaseGenerativeProvider() { - return { - returnMetadata: false, - anthropic: undefined, - anyscale: undefined, - aws: undefined, - cohere: undefined, - dummy: undefined, - mistral: undefined, - octoai: undefined, - ollama: undefined, - openai: undefined, - google: undefined, - }; -} -export const GenerativeProvider = { - encode(message, writer = _m0.Writer.create()) { - if (message.returnMetadata !== false) { - writer.uint32(8).bool(message.returnMetadata); - } - if (message.anthropic !== undefined) { - GenerativeAnthropic.encode(message.anthropic, writer.uint32(18).fork()).ldelim(); - } - if (message.anyscale !== undefined) { - GenerativeAnyscale.encode(message.anyscale, writer.uint32(26).fork()).ldelim(); - } - if (message.aws !== undefined) { - GenerativeAWS.encode(message.aws, writer.uint32(34).fork()).ldelim(); - } - if (message.cohere !== undefined) { - GenerativeCohere.encode(message.cohere, writer.uint32(42).fork()).ldelim(); - } - if (message.dummy !== undefined) { - GenerativeDummy.encode(message.dummy, writer.uint32(50).fork()).ldelim(); - } - if (message.mistral !== undefined) { - GenerativeMistral.encode(message.mistral, writer.uint32(58).fork()).ldelim(); - } - if (message.octoai !== undefined) { - GenerativeOctoAI.encode(message.octoai, writer.uint32(66).fork()).ldelim(); - } - if (message.ollama !== undefined) { - GenerativeOllama.encode(message.ollama, writer.uint32(74).fork()).ldelim(); - } - if (message.openai !== undefined) { - GenerativeOpenAI.encode(message.openai, writer.uint32(82).fork()).ldelim(); - } - if (message.google !== undefined) { - GenerativeGoogle.encode(message.google, writer.uint32(90).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeProvider(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.returnMetadata = reader.bool(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.anthropic = GenerativeAnthropic.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.anyscale = GenerativeAnyscale.decode(reader, reader.uint32()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.aws = GenerativeAWS.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.cohere = GenerativeCohere.decode(reader, reader.uint32()); - continue; - case 6: - if (tag !== 50) { - break; - } - message.dummy = GenerativeDummy.decode(reader, reader.uint32()); - continue; - case 7: - if (tag !== 58) { - break; - } - message.mistral = GenerativeMistral.decode(reader, reader.uint32()); - continue; - case 8: - if (tag !== 66) { - break; - } - message.octoai = GenerativeOctoAI.decode(reader, reader.uint32()); - continue; - case 9: - if (tag !== 74) { - break; - } - message.ollama = GenerativeOllama.decode(reader, reader.uint32()); - continue; - case 10: - if (tag !== 82) { - break; - } - message.openai = GenerativeOpenAI.decode(reader, reader.uint32()); - continue; - case 11: - if (tag !== 90) { - break; - } - message.google = GenerativeGoogle.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - returnMetadata: isSet(object.returnMetadata) ? globalThis.Boolean(object.returnMetadata) : false, - anthropic: isSet(object.anthropic) ? GenerativeAnthropic.fromJSON(object.anthropic) : undefined, - anyscale: isSet(object.anyscale) ? GenerativeAnyscale.fromJSON(object.anyscale) : undefined, - aws: isSet(object.aws) ? GenerativeAWS.fromJSON(object.aws) : undefined, - cohere: isSet(object.cohere) ? GenerativeCohere.fromJSON(object.cohere) : undefined, - dummy: isSet(object.dummy) ? GenerativeDummy.fromJSON(object.dummy) : undefined, - mistral: isSet(object.mistral) ? GenerativeMistral.fromJSON(object.mistral) : undefined, - octoai: isSet(object.octoai) ? GenerativeOctoAI.fromJSON(object.octoai) : undefined, - ollama: isSet(object.ollama) ? GenerativeOllama.fromJSON(object.ollama) : undefined, - openai: isSet(object.openai) ? GenerativeOpenAI.fromJSON(object.openai) : undefined, - google: isSet(object.google) ? GenerativeGoogle.fromJSON(object.google) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.returnMetadata !== false) { - obj.returnMetadata = message.returnMetadata; - } - if (message.anthropic !== undefined) { - obj.anthropic = GenerativeAnthropic.toJSON(message.anthropic); - } - if (message.anyscale !== undefined) { - obj.anyscale = GenerativeAnyscale.toJSON(message.anyscale); - } - if (message.aws !== undefined) { - obj.aws = GenerativeAWS.toJSON(message.aws); - } - if (message.cohere !== undefined) { - obj.cohere = GenerativeCohere.toJSON(message.cohere); - } - if (message.dummy !== undefined) { - obj.dummy = GenerativeDummy.toJSON(message.dummy); - } - if (message.mistral !== undefined) { - obj.mistral = GenerativeMistral.toJSON(message.mistral); - } - if (message.octoai !== undefined) { - obj.octoai = GenerativeOctoAI.toJSON(message.octoai); - } - if (message.ollama !== undefined) { - obj.ollama = GenerativeOllama.toJSON(message.ollama); - } - if (message.openai !== undefined) { - obj.openai = GenerativeOpenAI.toJSON(message.openai); - } - if (message.google !== undefined) { - obj.google = GenerativeGoogle.toJSON(message.google); - } - return obj; - }, - create(base) { - return GenerativeProvider.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseGenerativeProvider(); - message.returnMetadata = (_a = object.returnMetadata) !== null && _a !== void 0 ? _a : false; - message.anthropic = - object.anthropic !== undefined && object.anthropic !== null - ? GenerativeAnthropic.fromPartial(object.anthropic) - : undefined; - message.anyscale = - object.anyscale !== undefined && object.anyscale !== null - ? GenerativeAnyscale.fromPartial(object.anyscale) - : undefined; - message.aws = - object.aws !== undefined && object.aws !== null ? GenerativeAWS.fromPartial(object.aws) : undefined; - message.cohere = - object.cohere !== undefined && object.cohere !== null - ? GenerativeCohere.fromPartial(object.cohere) - : undefined; - message.dummy = - object.dummy !== undefined && object.dummy !== null - ? GenerativeDummy.fromPartial(object.dummy) - : undefined; - message.mistral = - object.mistral !== undefined && object.mistral !== null - ? GenerativeMistral.fromPartial(object.mistral) - : undefined; - message.octoai = - object.octoai !== undefined && object.octoai !== null - ? GenerativeOctoAI.fromPartial(object.octoai) - : undefined; - message.ollama = - object.ollama !== undefined && object.ollama !== null - ? GenerativeOllama.fromPartial(object.ollama) - : undefined; - message.openai = - object.openai !== undefined && object.openai !== null - ? GenerativeOpenAI.fromPartial(object.openai) - : undefined; - message.google = - object.google !== undefined && object.google !== null - ? GenerativeGoogle.fromPartial(object.google) - : undefined; - return message; - }, -}; -function createBaseGenerativeAnthropic() { - return { - baseUrl: undefined, - maxTokens: undefined, - model: undefined, - temperature: undefined, - topK: undefined, - topP: undefined, - stopSequences: undefined, - }; -} -export const GenerativeAnthropic = { - encode(message, writer = _m0.Writer.create()) { - if (message.baseUrl !== undefined) { - writer.uint32(10).string(message.baseUrl); - } - if (message.maxTokens !== undefined) { - writer.uint32(16).int64(message.maxTokens); - } - if (message.model !== undefined) { - writer.uint32(26).string(message.model); - } - if (message.temperature !== undefined) { - writer.uint32(33).double(message.temperature); - } - if (message.topK !== undefined) { - writer.uint32(40).int64(message.topK); - } - if (message.topP !== undefined) { - writer.uint32(49).double(message.topP); - } - if (message.stopSequences !== undefined) { - TextArray.encode(message.stopSequences, writer.uint32(58).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeAnthropic(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.baseUrl = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.maxTokens = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.model = reader.string(); - continue; - case 4: - if (tag !== 33) { - break; - } - message.temperature = reader.double(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.topK = longToNumber(reader.int64()); - continue; - case 6: - if (tag !== 49) { - break; - } - message.topP = reader.double(); - continue; - case 7: - if (tag !== 58) { - break; - } - message.stopSequences = TextArray.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - baseUrl: isSet(object.baseUrl) ? globalThis.String(object.baseUrl) : undefined, - maxTokens: isSet(object.maxTokens) ? globalThis.Number(object.maxTokens) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - topK: isSet(object.topK) ? globalThis.Number(object.topK) : undefined, - topP: isSet(object.topP) ? globalThis.Number(object.topP) : undefined, - stopSequences: isSet(object.stopSequences) ? TextArray.fromJSON(object.stopSequences) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.baseUrl !== undefined) { - obj.baseUrl = message.baseUrl; - } - if (message.maxTokens !== undefined) { - obj.maxTokens = Math.round(message.maxTokens); - } - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - if (message.topK !== undefined) { - obj.topK = Math.round(message.topK); - } - if (message.topP !== undefined) { - obj.topP = message.topP; - } - if (message.stopSequences !== undefined) { - obj.stopSequences = TextArray.toJSON(message.stopSequences); - } - return obj; - }, - create(base) { - return GenerativeAnthropic.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f; - const message = createBaseGenerativeAnthropic(); - message.baseUrl = (_a = object.baseUrl) !== null && _a !== void 0 ? _a : undefined; - message.maxTokens = (_b = object.maxTokens) !== null && _b !== void 0 ? _b : undefined; - message.model = (_c = object.model) !== null && _c !== void 0 ? _c : undefined; - message.temperature = (_d = object.temperature) !== null && _d !== void 0 ? _d : undefined; - message.topK = (_e = object.topK) !== null && _e !== void 0 ? _e : undefined; - message.topP = (_f = object.topP) !== null && _f !== void 0 ? _f : undefined; - message.stopSequences = - object.stopSequences !== undefined && object.stopSequences !== null - ? TextArray.fromPartial(object.stopSequences) - : undefined; - return message; - }, -}; -function createBaseGenerativeAnyscale() { - return { baseUrl: undefined, model: undefined, temperature: undefined }; -} -export const GenerativeAnyscale = { - encode(message, writer = _m0.Writer.create()) { - if (message.baseUrl !== undefined) { - writer.uint32(10).string(message.baseUrl); - } - if (message.model !== undefined) { - writer.uint32(18).string(message.model); - } - if (message.temperature !== undefined) { - writer.uint32(25).double(message.temperature); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeAnyscale(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.baseUrl = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.model = reader.string(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.temperature = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - baseUrl: isSet(object.baseUrl) ? globalThis.String(object.baseUrl) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.baseUrl !== undefined) { - obj.baseUrl = message.baseUrl; - } - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - return obj; - }, - create(base) { - return GenerativeAnyscale.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeAnyscale(); - message.baseUrl = (_a = object.baseUrl) !== null && _a !== void 0 ? _a : undefined; - message.model = (_b = object.model) !== null && _b !== void 0 ? _b : undefined; - message.temperature = (_c = object.temperature) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function createBaseGenerativeAWS() { - return { model: undefined, temperature: undefined }; -} -export const GenerativeAWS = { - encode(message, writer = _m0.Writer.create()) { - if (message.model !== undefined) { - writer.uint32(26).string(message.model); - } - if (message.temperature !== undefined) { - writer.uint32(65).double(message.temperature); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeAWS(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 3: - if (tag !== 26) { - break; - } - message.model = reader.string(); - continue; - case 8: - if (tag !== 65) { - break; - } - message.temperature = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - return obj; - }, - create(base) { - return GenerativeAWS.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseGenerativeAWS(); - message.model = (_a = object.model) !== null && _a !== void 0 ? _a : undefined; - message.temperature = (_b = object.temperature) !== null && _b !== void 0 ? _b : undefined; - return message; - }, -}; -function createBaseGenerativeCohere() { - return { - baseUrl: undefined, - frequencyPenalty: undefined, - maxTokens: undefined, - model: undefined, - k: undefined, - p: undefined, - presencePenalty: undefined, - stopSequences: undefined, - temperature: undefined, - }; -} -export const GenerativeCohere = { - encode(message, writer = _m0.Writer.create()) { - if (message.baseUrl !== undefined) { - writer.uint32(10).string(message.baseUrl); - } - if (message.frequencyPenalty !== undefined) { - writer.uint32(17).double(message.frequencyPenalty); - } - if (message.maxTokens !== undefined) { - writer.uint32(24).int64(message.maxTokens); - } - if (message.model !== undefined) { - writer.uint32(34).string(message.model); - } - if (message.k !== undefined) { - writer.uint32(40).int64(message.k); - } - if (message.p !== undefined) { - writer.uint32(49).double(message.p); - } - if (message.presencePenalty !== undefined) { - writer.uint32(57).double(message.presencePenalty); - } - if (message.stopSequences !== undefined) { - TextArray.encode(message.stopSequences, writer.uint32(66).fork()).ldelim(); - } - if (message.temperature !== undefined) { - writer.uint32(73).double(message.temperature); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeCohere(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.baseUrl = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.frequencyPenalty = reader.double(); - continue; - case 3: - if (tag !== 24) { - break; - } - message.maxTokens = longToNumber(reader.int64()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.model = reader.string(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.k = longToNumber(reader.int64()); - continue; - case 6: - if (tag !== 49) { - break; - } - message.p = reader.double(); - continue; - case 7: - if (tag !== 57) { - break; - } - message.presencePenalty = reader.double(); - continue; - case 8: - if (tag !== 66) { - break; - } - message.stopSequences = TextArray.decode(reader, reader.uint32()); - continue; - case 9: - if (tag !== 73) { - break; - } - message.temperature = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - baseUrl: isSet(object.baseUrl) ? globalThis.String(object.baseUrl) : undefined, - frequencyPenalty: isSet(object.frequencyPenalty) - ? globalThis.Number(object.frequencyPenalty) - : undefined, - maxTokens: isSet(object.maxTokens) ? globalThis.Number(object.maxTokens) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - k: isSet(object.k) ? globalThis.Number(object.k) : undefined, - p: isSet(object.p) ? globalThis.Number(object.p) : undefined, - presencePenalty: isSet(object.presencePenalty) ? globalThis.Number(object.presencePenalty) : undefined, - stopSequences: isSet(object.stopSequences) ? TextArray.fromJSON(object.stopSequences) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.baseUrl !== undefined) { - obj.baseUrl = message.baseUrl; - } - if (message.frequencyPenalty !== undefined) { - obj.frequencyPenalty = message.frequencyPenalty; - } - if (message.maxTokens !== undefined) { - obj.maxTokens = Math.round(message.maxTokens); - } - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.k !== undefined) { - obj.k = Math.round(message.k); - } - if (message.p !== undefined) { - obj.p = message.p; - } - if (message.presencePenalty !== undefined) { - obj.presencePenalty = message.presencePenalty; - } - if (message.stopSequences !== undefined) { - obj.stopSequences = TextArray.toJSON(message.stopSequences); - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - return obj; - }, - create(base) { - return GenerativeCohere.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h; - const message = createBaseGenerativeCohere(); - message.baseUrl = (_a = object.baseUrl) !== null && _a !== void 0 ? _a : undefined; - message.frequencyPenalty = (_b = object.frequencyPenalty) !== null && _b !== void 0 ? _b : undefined; - message.maxTokens = (_c = object.maxTokens) !== null && _c !== void 0 ? _c : undefined; - message.model = (_d = object.model) !== null && _d !== void 0 ? _d : undefined; - message.k = (_e = object.k) !== null && _e !== void 0 ? _e : undefined; - message.p = (_f = object.p) !== null && _f !== void 0 ? _f : undefined; - message.presencePenalty = (_g = object.presencePenalty) !== null && _g !== void 0 ? _g : undefined; - message.stopSequences = - object.stopSequences !== undefined && object.stopSequences !== null - ? TextArray.fromPartial(object.stopSequences) - : undefined; - message.temperature = (_h = object.temperature) !== null && _h !== void 0 ? _h : undefined; - return message; - }, -}; -function createBaseGenerativeDummy() { - return {}; -} -export const GenerativeDummy = { - encode(_, writer = _m0.Writer.create()) { - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeDummy(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(_) { - return {}; - }, - toJSON(_) { - const obj = {}; - return obj; - }, - create(base) { - return GenerativeDummy.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(_) { - const message = createBaseGenerativeDummy(); - return message; - }, -}; -function createBaseGenerativeMistral() { - return { - baseUrl: undefined, - maxTokens: undefined, - model: undefined, - temperature: undefined, - topP: undefined, - }; -} -export const GenerativeMistral = { - encode(message, writer = _m0.Writer.create()) { - if (message.baseUrl !== undefined) { - writer.uint32(10).string(message.baseUrl); - } - if (message.maxTokens !== undefined) { - writer.uint32(16).int64(message.maxTokens); - } - if (message.model !== undefined) { - writer.uint32(26).string(message.model); - } - if (message.temperature !== undefined) { - writer.uint32(33).double(message.temperature); - } - if (message.topP !== undefined) { - writer.uint32(41).double(message.topP); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeMistral(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.baseUrl = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.maxTokens = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.model = reader.string(); - continue; - case 4: - if (tag !== 33) { - break; - } - message.temperature = reader.double(); - continue; - case 5: - if (tag !== 41) { - break; - } - message.topP = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - baseUrl: isSet(object.baseUrl) ? globalThis.String(object.baseUrl) : undefined, - maxTokens: isSet(object.maxTokens) ? globalThis.Number(object.maxTokens) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - topP: isSet(object.topP) ? globalThis.Number(object.topP) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.baseUrl !== undefined) { - obj.baseUrl = message.baseUrl; - } - if (message.maxTokens !== undefined) { - obj.maxTokens = Math.round(message.maxTokens); - } - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - if (message.topP !== undefined) { - obj.topP = message.topP; - } - return obj; - }, - create(base) { - return GenerativeMistral.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e; - const message = createBaseGenerativeMistral(); - message.baseUrl = (_a = object.baseUrl) !== null && _a !== void 0 ? _a : undefined; - message.maxTokens = (_b = object.maxTokens) !== null && _b !== void 0 ? _b : undefined; - message.model = (_c = object.model) !== null && _c !== void 0 ? _c : undefined; - message.temperature = (_d = object.temperature) !== null && _d !== void 0 ? _d : undefined; - message.topP = (_e = object.topP) !== null && _e !== void 0 ? _e : undefined; - return message; - }, -}; -function createBaseGenerativeOctoAI() { - return { - baseUrl: undefined, - maxTokens: undefined, - model: undefined, - n: undefined, - temperature: undefined, - topP: undefined, - }; -} -export const GenerativeOctoAI = { - encode(message, writer = _m0.Writer.create()) { - if (message.baseUrl !== undefined) { - writer.uint32(10).string(message.baseUrl); - } - if (message.maxTokens !== undefined) { - writer.uint32(16).int64(message.maxTokens); - } - if (message.model !== undefined) { - writer.uint32(26).string(message.model); - } - if (message.n !== undefined) { - writer.uint32(32).int64(message.n); - } - if (message.temperature !== undefined) { - writer.uint32(41).double(message.temperature); - } - if (message.topP !== undefined) { - writer.uint32(49).double(message.topP); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOctoAI(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.baseUrl = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.maxTokens = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.model = reader.string(); - continue; - case 4: - if (tag !== 32) { - break; - } - message.n = longToNumber(reader.int64()); - continue; - case 5: - if (tag !== 41) { - break; - } - message.temperature = reader.double(); - continue; - case 6: - if (tag !== 49) { - break; - } - message.topP = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - baseUrl: isSet(object.baseUrl) ? globalThis.String(object.baseUrl) : undefined, - maxTokens: isSet(object.maxTokens) ? globalThis.Number(object.maxTokens) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - n: isSet(object.n) ? globalThis.Number(object.n) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - topP: isSet(object.topP) ? globalThis.Number(object.topP) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.baseUrl !== undefined) { - obj.baseUrl = message.baseUrl; - } - if (message.maxTokens !== undefined) { - obj.maxTokens = Math.round(message.maxTokens); - } - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.n !== undefined) { - obj.n = Math.round(message.n); - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - if (message.topP !== undefined) { - obj.topP = message.topP; - } - return obj; - }, - create(base) { - return GenerativeOctoAI.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f; - const message = createBaseGenerativeOctoAI(); - message.baseUrl = (_a = object.baseUrl) !== null && _a !== void 0 ? _a : undefined; - message.maxTokens = (_b = object.maxTokens) !== null && _b !== void 0 ? _b : undefined; - message.model = (_c = object.model) !== null && _c !== void 0 ? _c : undefined; - message.n = (_d = object.n) !== null && _d !== void 0 ? _d : undefined; - message.temperature = (_e = object.temperature) !== null && _e !== void 0 ? _e : undefined; - message.topP = (_f = object.topP) !== null && _f !== void 0 ? _f : undefined; - return message; - }, -}; -function createBaseGenerativeOllama() { - return { apiEndpoint: undefined, model: undefined, temperature: undefined }; -} -export const GenerativeOllama = { - encode(message, writer = _m0.Writer.create()) { - if (message.apiEndpoint !== undefined) { - writer.uint32(10).string(message.apiEndpoint); - } - if (message.model !== undefined) { - writer.uint32(18).string(message.model); - } - if (message.temperature !== undefined) { - writer.uint32(25).double(message.temperature); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOllama(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.apiEndpoint = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.model = reader.string(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.temperature = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - apiEndpoint: isSet(object.apiEndpoint) ? globalThis.String(object.apiEndpoint) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.apiEndpoint !== undefined) { - obj.apiEndpoint = message.apiEndpoint; - } - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - return obj; - }, - create(base) { - return GenerativeOllama.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeOllama(); - message.apiEndpoint = (_a = object.apiEndpoint) !== null && _a !== void 0 ? _a : undefined; - message.model = (_b = object.model) !== null && _b !== void 0 ? _b : undefined; - message.temperature = (_c = object.temperature) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function createBaseGenerativeOpenAI() { - return { - frequencyPenalty: undefined, - logProbs: undefined, - maxTokens: undefined, - model: '', - n: undefined, - presencePenalty: undefined, - stop: undefined, - temperature: undefined, - topP: undefined, - topLogProbs: undefined, - }; -} -export const GenerativeOpenAI = { - encode(message, writer = _m0.Writer.create()) { - if (message.frequencyPenalty !== undefined) { - writer.uint32(9).double(message.frequencyPenalty); - } - if (message.logProbs !== undefined) { - writer.uint32(16).bool(message.logProbs); - } - if (message.maxTokens !== undefined) { - writer.uint32(24).int64(message.maxTokens); - } - if (message.model !== '') { - writer.uint32(34).string(message.model); - } - if (message.n !== undefined) { - writer.uint32(40).int64(message.n); - } - if (message.presencePenalty !== undefined) { - writer.uint32(49).double(message.presencePenalty); - } - if (message.stop !== undefined) { - TextArray.encode(message.stop, writer.uint32(58).fork()).ldelim(); - } - if (message.temperature !== undefined) { - writer.uint32(65).double(message.temperature); - } - if (message.topP !== undefined) { - writer.uint32(73).double(message.topP); - } - if (message.topLogProbs !== undefined) { - writer.uint32(80).int64(message.topLogProbs); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOpenAI(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 9) { - break; - } - message.frequencyPenalty = reader.double(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.logProbs = reader.bool(); - continue; - case 3: - if (tag !== 24) { - break; - } - message.maxTokens = longToNumber(reader.int64()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.model = reader.string(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.n = longToNumber(reader.int64()); - continue; - case 6: - if (tag !== 49) { - break; - } - message.presencePenalty = reader.double(); - continue; - case 7: - if (tag !== 58) { - break; - } - message.stop = TextArray.decode(reader, reader.uint32()); - continue; - case 8: - if (tag !== 65) { - break; - } - message.temperature = reader.double(); - continue; - case 9: - if (tag !== 73) { - break; - } - message.topP = reader.double(); - continue; - case 10: - if (tag !== 80) { - break; - } - message.topLogProbs = longToNumber(reader.int64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - frequencyPenalty: isSet(object.frequencyPenalty) - ? globalThis.Number(object.frequencyPenalty) - : undefined, - logProbs: isSet(object.logProbs) ? globalThis.Boolean(object.logProbs) : undefined, - maxTokens: isSet(object.maxTokens) ? globalThis.Number(object.maxTokens) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : '', - n: isSet(object.n) ? globalThis.Number(object.n) : undefined, - presencePenalty: isSet(object.presencePenalty) ? globalThis.Number(object.presencePenalty) : undefined, - stop: isSet(object.stop) ? TextArray.fromJSON(object.stop) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - topP: isSet(object.topP) ? globalThis.Number(object.topP) : undefined, - topLogProbs: isSet(object.topLogProbs) ? globalThis.Number(object.topLogProbs) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.frequencyPenalty !== undefined) { - obj.frequencyPenalty = message.frequencyPenalty; - } - if (message.logProbs !== undefined) { - obj.logProbs = message.logProbs; - } - if (message.maxTokens !== undefined) { - obj.maxTokens = Math.round(message.maxTokens); - } - if (message.model !== '') { - obj.model = message.model; - } - if (message.n !== undefined) { - obj.n = Math.round(message.n); - } - if (message.presencePenalty !== undefined) { - obj.presencePenalty = message.presencePenalty; - } - if (message.stop !== undefined) { - obj.stop = TextArray.toJSON(message.stop); - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - if (message.topP !== undefined) { - obj.topP = message.topP; - } - if (message.topLogProbs !== undefined) { - obj.topLogProbs = Math.round(message.topLogProbs); - } - return obj; - }, - create(base) { - return GenerativeOpenAI.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - const message = createBaseGenerativeOpenAI(); - message.frequencyPenalty = (_a = object.frequencyPenalty) !== null && _a !== void 0 ? _a : undefined; - message.logProbs = (_b = object.logProbs) !== null && _b !== void 0 ? _b : undefined; - message.maxTokens = (_c = object.maxTokens) !== null && _c !== void 0 ? _c : undefined; - message.model = (_d = object.model) !== null && _d !== void 0 ? _d : ''; - message.n = (_e = object.n) !== null && _e !== void 0 ? _e : undefined; - message.presencePenalty = (_f = object.presencePenalty) !== null && _f !== void 0 ? _f : undefined; - message.stop = - object.stop !== undefined && object.stop !== null ? TextArray.fromPartial(object.stop) : undefined; - message.temperature = (_g = object.temperature) !== null && _g !== void 0 ? _g : undefined; - message.topP = (_h = object.topP) !== null && _h !== void 0 ? _h : undefined; - message.topLogProbs = (_j = object.topLogProbs) !== null && _j !== void 0 ? _j : undefined; - return message; - }, -}; -function createBaseGenerativeGoogle() { - return { - frequencyPenalty: undefined, - maxTokens: undefined, - model: undefined, - presencePenalty: undefined, - temperature: undefined, - topK: undefined, - topP: undefined, - stopSequences: undefined, - }; -} -export const GenerativeGoogle = { - encode(message, writer = _m0.Writer.create()) { - if (message.frequencyPenalty !== undefined) { - writer.uint32(9).double(message.frequencyPenalty); - } - if (message.maxTokens !== undefined) { - writer.uint32(16).int64(message.maxTokens); - } - if (message.model !== undefined) { - writer.uint32(26).string(message.model); - } - if (message.presencePenalty !== undefined) { - writer.uint32(33).double(message.presencePenalty); - } - if (message.temperature !== undefined) { - writer.uint32(41).double(message.temperature); - } - if (message.topK !== undefined) { - writer.uint32(48).int64(message.topK); - } - if (message.topP !== undefined) { - writer.uint32(57).double(message.topP); - } - if (message.stopSequences !== undefined) { - TextArray.encode(message.stopSequences, writer.uint32(66).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeGoogle(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 9) { - break; - } - message.frequencyPenalty = reader.double(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.maxTokens = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.model = reader.string(); - continue; - case 4: - if (tag !== 33) { - break; - } - message.presencePenalty = reader.double(); - continue; - case 5: - if (tag !== 41) { - break; - } - message.temperature = reader.double(); - continue; - case 6: - if (tag !== 48) { - break; - } - message.topK = longToNumber(reader.int64()); - continue; - case 7: - if (tag !== 57) { - break; - } - message.topP = reader.double(); - continue; - case 8: - if (tag !== 66) { - break; - } - message.stopSequences = TextArray.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - frequencyPenalty: isSet(object.frequencyPenalty) - ? globalThis.Number(object.frequencyPenalty) - : undefined, - maxTokens: isSet(object.maxTokens) ? globalThis.Number(object.maxTokens) : undefined, - model: isSet(object.model) ? globalThis.String(object.model) : undefined, - presencePenalty: isSet(object.presencePenalty) ? globalThis.Number(object.presencePenalty) : undefined, - temperature: isSet(object.temperature) ? globalThis.Number(object.temperature) : undefined, - topK: isSet(object.topK) ? globalThis.Number(object.topK) : undefined, - topP: isSet(object.topP) ? globalThis.Number(object.topP) : undefined, - stopSequences: isSet(object.stopSequences) ? TextArray.fromJSON(object.stopSequences) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.frequencyPenalty !== undefined) { - obj.frequencyPenalty = message.frequencyPenalty; - } - if (message.maxTokens !== undefined) { - obj.maxTokens = Math.round(message.maxTokens); - } - if (message.model !== undefined) { - obj.model = message.model; - } - if (message.presencePenalty !== undefined) { - obj.presencePenalty = message.presencePenalty; - } - if (message.temperature !== undefined) { - obj.temperature = message.temperature; - } - if (message.topK !== undefined) { - obj.topK = Math.round(message.topK); - } - if (message.topP !== undefined) { - obj.topP = message.topP; - } - if (message.stopSequences !== undefined) { - obj.stopSequences = TextArray.toJSON(message.stopSequences); - } - return obj; - }, - create(base) { - return GenerativeGoogle.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g; - const message = createBaseGenerativeGoogle(); - message.frequencyPenalty = (_a = object.frequencyPenalty) !== null && _a !== void 0 ? _a : undefined; - message.maxTokens = (_b = object.maxTokens) !== null && _b !== void 0 ? _b : undefined; - message.model = (_c = object.model) !== null && _c !== void 0 ? _c : undefined; - message.presencePenalty = (_d = object.presencePenalty) !== null && _d !== void 0 ? _d : undefined; - message.temperature = (_e = object.temperature) !== null && _e !== void 0 ? _e : undefined; - message.topK = (_f = object.topK) !== null && _f !== void 0 ? _f : undefined; - message.topP = (_g = object.topP) !== null && _g !== void 0 ? _g : undefined; - message.stopSequences = - object.stopSequences !== undefined && object.stopSequences !== null - ? TextArray.fromPartial(object.stopSequences) - : undefined; - return message; - }, -}; -function createBaseGenerativeAnthropicMetadata() { - return { usage: undefined }; -} -export const GenerativeAnthropicMetadata = { - encode(message, writer = _m0.Writer.create()) { - if (message.usage !== undefined) { - GenerativeAnthropicMetadata_Usage.encode(message.usage, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeAnthropicMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.usage = GenerativeAnthropicMetadata_Usage.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - usage: isSet(object.usage) ? GenerativeAnthropicMetadata_Usage.fromJSON(object.usage) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.usage !== undefined) { - obj.usage = GenerativeAnthropicMetadata_Usage.toJSON(message.usage); - } - return obj; - }, - create(base) { - return GenerativeAnthropicMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeAnthropicMetadata(); - message.usage = - object.usage !== undefined && object.usage !== null - ? GenerativeAnthropicMetadata_Usage.fromPartial(object.usage) - : undefined; - return message; - }, -}; -function createBaseGenerativeAnthropicMetadata_Usage() { - return { inputTokens: 0, outputTokens: 0 }; -} -export const GenerativeAnthropicMetadata_Usage = { - encode(message, writer = _m0.Writer.create()) { - if (message.inputTokens !== 0) { - writer.uint32(8).int64(message.inputTokens); - } - if (message.outputTokens !== 0) { - writer.uint32(16).int64(message.outputTokens); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeAnthropicMetadata_Usage(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.inputTokens = longToNumber(reader.int64()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.outputTokens = longToNumber(reader.int64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - inputTokens: isSet(object.inputTokens) ? globalThis.Number(object.inputTokens) : 0, - outputTokens: isSet(object.outputTokens) ? globalThis.Number(object.outputTokens) : 0, - }; - }, - toJSON(message) { - const obj = {}; - if (message.inputTokens !== 0) { - obj.inputTokens = Math.round(message.inputTokens); - } - if (message.outputTokens !== 0) { - obj.outputTokens = Math.round(message.outputTokens); - } - return obj; - }, - create(base) { - return GenerativeAnthropicMetadata_Usage.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseGenerativeAnthropicMetadata_Usage(); - message.inputTokens = (_a = object.inputTokens) !== null && _a !== void 0 ? _a : 0; - message.outputTokens = (_b = object.outputTokens) !== null && _b !== void 0 ? _b : 0; - return message; - }, -}; -function createBaseGenerativeAnyscaleMetadata() { - return {}; -} -export const GenerativeAnyscaleMetadata = { - encode(_, writer = _m0.Writer.create()) { - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeAnyscaleMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(_) { - return {}; - }, - toJSON(_) { - const obj = {}; - return obj; - }, - create(base) { - return GenerativeAnyscaleMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(_) { - const message = createBaseGenerativeAnyscaleMetadata(); - return message; - }, -}; -function createBaseGenerativeAWSMetadata() { - return {}; -} -export const GenerativeAWSMetadata = { - encode(_, writer = _m0.Writer.create()) { - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeAWSMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(_) { - return {}; - }, - toJSON(_) { - const obj = {}; - return obj; - }, - create(base) { - return GenerativeAWSMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(_) { - const message = createBaseGenerativeAWSMetadata(); - return message; - }, -}; -function createBaseGenerativeCohereMetadata() { - return { apiVersion: undefined, billedUnits: undefined, tokens: undefined, warnings: undefined }; -} -export const GenerativeCohereMetadata = { - encode(message, writer = _m0.Writer.create()) { - if (message.apiVersion !== undefined) { - GenerativeCohereMetadata_ApiVersion.encode(message.apiVersion, writer.uint32(10).fork()).ldelim(); - } - if (message.billedUnits !== undefined) { - GenerativeCohereMetadata_BilledUnits.encode(message.billedUnits, writer.uint32(18).fork()).ldelim(); - } - if (message.tokens !== undefined) { - GenerativeCohereMetadata_Tokens.encode(message.tokens, writer.uint32(26).fork()).ldelim(); - } - if (message.warnings !== undefined) { - TextArray.encode(message.warnings, writer.uint32(34).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeCohereMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.apiVersion = GenerativeCohereMetadata_ApiVersion.decode(reader, reader.uint32()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.billedUnits = GenerativeCohereMetadata_BilledUnits.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.tokens = GenerativeCohereMetadata_Tokens.decode(reader, reader.uint32()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.warnings = TextArray.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - apiVersion: isSet(object.apiVersion) - ? GenerativeCohereMetadata_ApiVersion.fromJSON(object.apiVersion) - : undefined, - billedUnits: isSet(object.billedUnits) - ? GenerativeCohereMetadata_BilledUnits.fromJSON(object.billedUnits) - : undefined, - tokens: isSet(object.tokens) ? GenerativeCohereMetadata_Tokens.fromJSON(object.tokens) : undefined, - warnings: isSet(object.warnings) ? TextArray.fromJSON(object.warnings) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.apiVersion !== undefined) { - obj.apiVersion = GenerativeCohereMetadata_ApiVersion.toJSON(message.apiVersion); - } - if (message.billedUnits !== undefined) { - obj.billedUnits = GenerativeCohereMetadata_BilledUnits.toJSON(message.billedUnits); - } - if (message.tokens !== undefined) { - obj.tokens = GenerativeCohereMetadata_Tokens.toJSON(message.tokens); - } - if (message.warnings !== undefined) { - obj.warnings = TextArray.toJSON(message.warnings); - } - return obj; - }, - create(base) { - return GenerativeCohereMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeCohereMetadata(); - message.apiVersion = - object.apiVersion !== undefined && object.apiVersion !== null - ? GenerativeCohereMetadata_ApiVersion.fromPartial(object.apiVersion) - : undefined; - message.billedUnits = - object.billedUnits !== undefined && object.billedUnits !== null - ? GenerativeCohereMetadata_BilledUnits.fromPartial(object.billedUnits) - : undefined; - message.tokens = - object.tokens !== undefined && object.tokens !== null - ? GenerativeCohereMetadata_Tokens.fromPartial(object.tokens) - : undefined; - message.warnings = - object.warnings !== undefined && object.warnings !== null - ? TextArray.fromPartial(object.warnings) - : undefined; - return message; - }, -}; -function createBaseGenerativeCohereMetadata_ApiVersion() { - return { version: undefined, isDeprecated: undefined, isExperimental: undefined }; -} -export const GenerativeCohereMetadata_ApiVersion = { - encode(message, writer = _m0.Writer.create()) { - if (message.version !== undefined) { - writer.uint32(10).string(message.version); - } - if (message.isDeprecated !== undefined) { - writer.uint32(16).bool(message.isDeprecated); - } - if (message.isExperimental !== undefined) { - writer.uint32(24).bool(message.isExperimental); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeCohereMetadata_ApiVersion(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.version = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.isDeprecated = reader.bool(); - continue; - case 3: - if (tag !== 24) { - break; - } - message.isExperimental = reader.bool(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - version: isSet(object.version) ? globalThis.String(object.version) : undefined, - isDeprecated: isSet(object.isDeprecated) ? globalThis.Boolean(object.isDeprecated) : undefined, - isExperimental: isSet(object.isExperimental) ? globalThis.Boolean(object.isExperimental) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.version !== undefined) { - obj.version = message.version; - } - if (message.isDeprecated !== undefined) { - obj.isDeprecated = message.isDeprecated; - } - if (message.isExperimental !== undefined) { - obj.isExperimental = message.isExperimental; - } - return obj; - }, - create(base) { - return GenerativeCohereMetadata_ApiVersion.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeCohereMetadata_ApiVersion(); - message.version = (_a = object.version) !== null && _a !== void 0 ? _a : undefined; - message.isDeprecated = (_b = object.isDeprecated) !== null && _b !== void 0 ? _b : undefined; - message.isExperimental = (_c = object.isExperimental) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function createBaseGenerativeCohereMetadata_BilledUnits() { - return { - inputTokens: undefined, - outputTokens: undefined, - searchUnits: undefined, - classifications: undefined, - }; -} -export const GenerativeCohereMetadata_BilledUnits = { - encode(message, writer = _m0.Writer.create()) { - if (message.inputTokens !== undefined) { - writer.uint32(9).double(message.inputTokens); - } - if (message.outputTokens !== undefined) { - writer.uint32(17).double(message.outputTokens); - } - if (message.searchUnits !== undefined) { - writer.uint32(25).double(message.searchUnits); - } - if (message.classifications !== undefined) { - writer.uint32(33).double(message.classifications); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeCohereMetadata_BilledUnits(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 9) { - break; - } - message.inputTokens = reader.double(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.outputTokens = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.searchUnits = reader.double(); - continue; - case 4: - if (tag !== 33) { - break; - } - message.classifications = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - inputTokens: isSet(object.inputTokens) ? globalThis.Number(object.inputTokens) : undefined, - outputTokens: isSet(object.outputTokens) ? globalThis.Number(object.outputTokens) : undefined, - searchUnits: isSet(object.searchUnits) ? globalThis.Number(object.searchUnits) : undefined, - classifications: isSet(object.classifications) ? globalThis.Number(object.classifications) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.inputTokens !== undefined) { - obj.inputTokens = message.inputTokens; - } - if (message.outputTokens !== undefined) { - obj.outputTokens = message.outputTokens; - } - if (message.searchUnits !== undefined) { - obj.searchUnits = message.searchUnits; - } - if (message.classifications !== undefined) { - obj.classifications = message.classifications; - } - return obj; - }, - create(base) { - return GenerativeCohereMetadata_BilledUnits.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseGenerativeCohereMetadata_BilledUnits(); - message.inputTokens = (_a = object.inputTokens) !== null && _a !== void 0 ? _a : undefined; - message.outputTokens = (_b = object.outputTokens) !== null && _b !== void 0 ? _b : undefined; - message.searchUnits = (_c = object.searchUnits) !== null && _c !== void 0 ? _c : undefined; - message.classifications = (_d = object.classifications) !== null && _d !== void 0 ? _d : undefined; - return message; - }, -}; -function createBaseGenerativeCohereMetadata_Tokens() { - return { inputTokens: undefined, outputTokens: undefined }; -} -export const GenerativeCohereMetadata_Tokens = { - encode(message, writer = _m0.Writer.create()) { - if (message.inputTokens !== undefined) { - writer.uint32(9).double(message.inputTokens); - } - if (message.outputTokens !== undefined) { - writer.uint32(17).double(message.outputTokens); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeCohereMetadata_Tokens(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 9) { - break; - } - message.inputTokens = reader.double(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.outputTokens = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - inputTokens: isSet(object.inputTokens) ? globalThis.Number(object.inputTokens) : undefined, - outputTokens: isSet(object.outputTokens) ? globalThis.Number(object.outputTokens) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.inputTokens !== undefined) { - obj.inputTokens = message.inputTokens; - } - if (message.outputTokens !== undefined) { - obj.outputTokens = message.outputTokens; - } - return obj; - }, - create(base) { - return GenerativeCohereMetadata_Tokens.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseGenerativeCohereMetadata_Tokens(); - message.inputTokens = (_a = object.inputTokens) !== null && _a !== void 0 ? _a : undefined; - message.outputTokens = (_b = object.outputTokens) !== null && _b !== void 0 ? _b : undefined; - return message; - }, -}; -function createBaseGenerativeDummyMetadata() { - return {}; -} -export const GenerativeDummyMetadata = { - encode(_, writer = _m0.Writer.create()) { - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeDummyMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(_) { - return {}; - }, - toJSON(_) { - const obj = {}; - return obj; - }, - create(base) { - return GenerativeDummyMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(_) { - const message = createBaseGenerativeDummyMetadata(); - return message; - }, -}; -function createBaseGenerativeMistralMetadata() { - return { usage: undefined }; -} -export const GenerativeMistralMetadata = { - encode(message, writer = _m0.Writer.create()) { - if (message.usage !== undefined) { - GenerativeMistralMetadata_Usage.encode(message.usage, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeMistralMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.usage = GenerativeMistralMetadata_Usage.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - usage: isSet(object.usage) ? GenerativeMistralMetadata_Usage.fromJSON(object.usage) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.usage !== undefined) { - obj.usage = GenerativeMistralMetadata_Usage.toJSON(message.usage); - } - return obj; - }, - create(base) { - return GenerativeMistralMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeMistralMetadata(); - message.usage = - object.usage !== undefined && object.usage !== null - ? GenerativeMistralMetadata_Usage.fromPartial(object.usage) - : undefined; - return message; - }, -}; -function createBaseGenerativeMistralMetadata_Usage() { - return { promptTokens: undefined, completionTokens: undefined, totalTokens: undefined }; -} -export const GenerativeMistralMetadata_Usage = { - encode(message, writer = _m0.Writer.create()) { - if (message.promptTokens !== undefined) { - writer.uint32(8).int64(message.promptTokens); - } - if (message.completionTokens !== undefined) { - writer.uint32(16).int64(message.completionTokens); - } - if (message.totalTokens !== undefined) { - writer.uint32(24).int64(message.totalTokens); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeMistralMetadata_Usage(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.promptTokens = longToNumber(reader.int64()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.completionTokens = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 24) { - break; - } - message.totalTokens = longToNumber(reader.int64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - promptTokens: isSet(object.promptTokens) ? globalThis.Number(object.promptTokens) : undefined, - completionTokens: isSet(object.completionTokens) - ? globalThis.Number(object.completionTokens) - : undefined, - totalTokens: isSet(object.totalTokens) ? globalThis.Number(object.totalTokens) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.promptTokens !== undefined) { - obj.promptTokens = Math.round(message.promptTokens); - } - if (message.completionTokens !== undefined) { - obj.completionTokens = Math.round(message.completionTokens); - } - if (message.totalTokens !== undefined) { - obj.totalTokens = Math.round(message.totalTokens); - } - return obj; - }, - create(base) { - return GenerativeMistralMetadata_Usage.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeMistralMetadata_Usage(); - message.promptTokens = (_a = object.promptTokens) !== null && _a !== void 0 ? _a : undefined; - message.completionTokens = (_b = object.completionTokens) !== null && _b !== void 0 ? _b : undefined; - message.totalTokens = (_c = object.totalTokens) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function createBaseGenerativeOctoAIMetadata() { - return { usage: undefined }; -} -export const GenerativeOctoAIMetadata = { - encode(message, writer = _m0.Writer.create()) { - if (message.usage !== undefined) { - GenerativeOctoAIMetadata_Usage.encode(message.usage, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOctoAIMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.usage = GenerativeOctoAIMetadata_Usage.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { usage: isSet(object.usage) ? GenerativeOctoAIMetadata_Usage.fromJSON(object.usage) : undefined }; - }, - toJSON(message) { - const obj = {}; - if (message.usage !== undefined) { - obj.usage = GenerativeOctoAIMetadata_Usage.toJSON(message.usage); - } - return obj; - }, - create(base) { - return GenerativeOctoAIMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeOctoAIMetadata(); - message.usage = - object.usage !== undefined && object.usage !== null - ? GenerativeOctoAIMetadata_Usage.fromPartial(object.usage) - : undefined; - return message; - }, -}; -function createBaseGenerativeOctoAIMetadata_Usage() { - return { promptTokens: undefined, completionTokens: undefined, totalTokens: undefined }; -} -export const GenerativeOctoAIMetadata_Usage = { - encode(message, writer = _m0.Writer.create()) { - if (message.promptTokens !== undefined) { - writer.uint32(8).int64(message.promptTokens); - } - if (message.completionTokens !== undefined) { - writer.uint32(16).int64(message.completionTokens); - } - if (message.totalTokens !== undefined) { - writer.uint32(24).int64(message.totalTokens); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOctoAIMetadata_Usage(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.promptTokens = longToNumber(reader.int64()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.completionTokens = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 24) { - break; - } - message.totalTokens = longToNumber(reader.int64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - promptTokens: isSet(object.promptTokens) ? globalThis.Number(object.promptTokens) : undefined, - completionTokens: isSet(object.completionTokens) - ? globalThis.Number(object.completionTokens) - : undefined, - totalTokens: isSet(object.totalTokens) ? globalThis.Number(object.totalTokens) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.promptTokens !== undefined) { - obj.promptTokens = Math.round(message.promptTokens); - } - if (message.completionTokens !== undefined) { - obj.completionTokens = Math.round(message.completionTokens); - } - if (message.totalTokens !== undefined) { - obj.totalTokens = Math.round(message.totalTokens); - } - return obj; - }, - create(base) { - return GenerativeOctoAIMetadata_Usage.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeOctoAIMetadata_Usage(); - message.promptTokens = (_a = object.promptTokens) !== null && _a !== void 0 ? _a : undefined; - message.completionTokens = (_b = object.completionTokens) !== null && _b !== void 0 ? _b : undefined; - message.totalTokens = (_c = object.totalTokens) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function createBaseGenerativeOllamaMetadata() { - return {}; -} -export const GenerativeOllamaMetadata = { - encode(_, writer = _m0.Writer.create()) { - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOllamaMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(_) { - return {}; - }, - toJSON(_) { - const obj = {}; - return obj; - }, - create(base) { - return GenerativeOllamaMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(_) { - const message = createBaseGenerativeOllamaMetadata(); - return message; - }, -}; -function createBaseGenerativeOpenAIMetadata() { - return { usage: undefined }; -} -export const GenerativeOpenAIMetadata = { - encode(message, writer = _m0.Writer.create()) { - if (message.usage !== undefined) { - GenerativeOpenAIMetadata_Usage.encode(message.usage, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOpenAIMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.usage = GenerativeOpenAIMetadata_Usage.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { usage: isSet(object.usage) ? GenerativeOpenAIMetadata_Usage.fromJSON(object.usage) : undefined }; - }, - toJSON(message) { - const obj = {}; - if (message.usage !== undefined) { - obj.usage = GenerativeOpenAIMetadata_Usage.toJSON(message.usage); - } - return obj; - }, - create(base) { - return GenerativeOpenAIMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeOpenAIMetadata(); - message.usage = - object.usage !== undefined && object.usage !== null - ? GenerativeOpenAIMetadata_Usage.fromPartial(object.usage) - : undefined; - return message; - }, -}; -function createBaseGenerativeOpenAIMetadata_Usage() { - return { promptTokens: undefined, completionTokens: undefined, totalTokens: undefined }; -} -export const GenerativeOpenAIMetadata_Usage = { - encode(message, writer = _m0.Writer.create()) { - if (message.promptTokens !== undefined) { - writer.uint32(8).int64(message.promptTokens); - } - if (message.completionTokens !== undefined) { - writer.uint32(16).int64(message.completionTokens); - } - if (message.totalTokens !== undefined) { - writer.uint32(24).int64(message.totalTokens); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeOpenAIMetadata_Usage(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.promptTokens = longToNumber(reader.int64()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.completionTokens = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 24) { - break; - } - message.totalTokens = longToNumber(reader.int64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - promptTokens: isSet(object.promptTokens) ? globalThis.Number(object.promptTokens) : undefined, - completionTokens: isSet(object.completionTokens) - ? globalThis.Number(object.completionTokens) - : undefined, - totalTokens: isSet(object.totalTokens) ? globalThis.Number(object.totalTokens) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.promptTokens !== undefined) { - obj.promptTokens = Math.round(message.promptTokens); - } - if (message.completionTokens !== undefined) { - obj.completionTokens = Math.round(message.completionTokens); - } - if (message.totalTokens !== undefined) { - obj.totalTokens = Math.round(message.totalTokens); - } - return obj; - }, - create(base) { - return GenerativeOpenAIMetadata_Usage.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeOpenAIMetadata_Usage(); - message.promptTokens = (_a = object.promptTokens) !== null && _a !== void 0 ? _a : undefined; - message.completionTokens = (_b = object.completionTokens) !== null && _b !== void 0 ? _b : undefined; - message.totalTokens = (_c = object.totalTokens) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function createBaseGenerativeGoogleMetadata() { - return { metadata: undefined, usageMetadata: undefined }; -} -export const GenerativeGoogleMetadata = { - encode(message, writer = _m0.Writer.create()) { - if (message.metadata !== undefined) { - GenerativeGoogleMetadata_Metadata.encode(message.metadata, writer.uint32(10).fork()).ldelim(); - } - if (message.usageMetadata !== undefined) { - GenerativeGoogleMetadata_UsageMetadata.encode(message.usageMetadata, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeGoogleMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.metadata = GenerativeGoogleMetadata_Metadata.decode(reader, reader.uint32()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.usageMetadata = GenerativeGoogleMetadata_UsageMetadata.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - metadata: isSet(object.metadata) - ? GenerativeGoogleMetadata_Metadata.fromJSON(object.metadata) - : undefined, - usageMetadata: isSet(object.usageMetadata) - ? GenerativeGoogleMetadata_UsageMetadata.fromJSON(object.usageMetadata) - : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.metadata !== undefined) { - obj.metadata = GenerativeGoogleMetadata_Metadata.toJSON(message.metadata); - } - if (message.usageMetadata !== undefined) { - obj.usageMetadata = GenerativeGoogleMetadata_UsageMetadata.toJSON(message.usageMetadata); - } - return obj; - }, - create(base) { - return GenerativeGoogleMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeGoogleMetadata(); - message.metadata = - object.metadata !== undefined && object.metadata !== null - ? GenerativeGoogleMetadata_Metadata.fromPartial(object.metadata) - : undefined; - message.usageMetadata = - object.usageMetadata !== undefined && object.usageMetadata !== null - ? GenerativeGoogleMetadata_UsageMetadata.fromPartial(object.usageMetadata) - : undefined; - return message; - }, -}; -function createBaseGenerativeGoogleMetadata_TokenCount() { - return { totalBillableCharacters: undefined, totalTokens: undefined }; -} -export const GenerativeGoogleMetadata_TokenCount = { - encode(message, writer = _m0.Writer.create()) { - if (message.totalBillableCharacters !== undefined) { - writer.uint32(8).int64(message.totalBillableCharacters); - } - if (message.totalTokens !== undefined) { - writer.uint32(16).int64(message.totalTokens); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeGoogleMetadata_TokenCount(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.totalBillableCharacters = longToNumber(reader.int64()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.totalTokens = longToNumber(reader.int64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - totalBillableCharacters: isSet(object.totalBillableCharacters) - ? globalThis.Number(object.totalBillableCharacters) - : undefined, - totalTokens: isSet(object.totalTokens) ? globalThis.Number(object.totalTokens) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.totalBillableCharacters !== undefined) { - obj.totalBillableCharacters = Math.round(message.totalBillableCharacters); - } - if (message.totalTokens !== undefined) { - obj.totalTokens = Math.round(message.totalTokens); - } - return obj; - }, - create(base) { - return GenerativeGoogleMetadata_TokenCount.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseGenerativeGoogleMetadata_TokenCount(); - message.totalBillableCharacters = - (_a = object.totalBillableCharacters) !== null && _a !== void 0 ? _a : undefined; - message.totalTokens = (_b = object.totalTokens) !== null && _b !== void 0 ? _b : undefined; - return message; - }, -}; -function createBaseGenerativeGoogleMetadata_TokenMetadata() { - return { inputTokenCount: undefined, outputTokenCount: undefined }; -} -export const GenerativeGoogleMetadata_TokenMetadata = { - encode(message, writer = _m0.Writer.create()) { - if (message.inputTokenCount !== undefined) { - GenerativeGoogleMetadata_TokenCount.encode(message.inputTokenCount, writer.uint32(10).fork()).ldelim(); - } - if (message.outputTokenCount !== undefined) { - GenerativeGoogleMetadata_TokenCount.encode(message.outputTokenCount, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeGoogleMetadata_TokenMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.inputTokenCount = GenerativeGoogleMetadata_TokenCount.decode(reader, reader.uint32()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.outputTokenCount = GenerativeGoogleMetadata_TokenCount.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - inputTokenCount: isSet(object.inputTokenCount) - ? GenerativeGoogleMetadata_TokenCount.fromJSON(object.inputTokenCount) - : undefined, - outputTokenCount: isSet(object.outputTokenCount) - ? GenerativeGoogleMetadata_TokenCount.fromJSON(object.outputTokenCount) - : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.inputTokenCount !== undefined) { - obj.inputTokenCount = GenerativeGoogleMetadata_TokenCount.toJSON(message.inputTokenCount); - } - if (message.outputTokenCount !== undefined) { - obj.outputTokenCount = GenerativeGoogleMetadata_TokenCount.toJSON(message.outputTokenCount); - } - return obj; - }, - create(base) { - return GenerativeGoogleMetadata_TokenMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeGoogleMetadata_TokenMetadata(); - message.inputTokenCount = - object.inputTokenCount !== undefined && object.inputTokenCount !== null - ? GenerativeGoogleMetadata_TokenCount.fromPartial(object.inputTokenCount) - : undefined; - message.outputTokenCount = - object.outputTokenCount !== undefined && object.outputTokenCount !== null - ? GenerativeGoogleMetadata_TokenCount.fromPartial(object.outputTokenCount) - : undefined; - return message; - }, -}; -function createBaseGenerativeGoogleMetadata_Metadata() { - return { tokenMetadata: undefined }; -} -export const GenerativeGoogleMetadata_Metadata = { - encode(message, writer = _m0.Writer.create()) { - if (message.tokenMetadata !== undefined) { - GenerativeGoogleMetadata_TokenMetadata.encode(message.tokenMetadata, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeGoogleMetadata_Metadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.tokenMetadata = GenerativeGoogleMetadata_TokenMetadata.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - tokenMetadata: isSet(object.tokenMetadata) - ? GenerativeGoogleMetadata_TokenMetadata.fromJSON(object.tokenMetadata) - : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.tokenMetadata !== undefined) { - obj.tokenMetadata = GenerativeGoogleMetadata_TokenMetadata.toJSON(message.tokenMetadata); - } - return obj; - }, - create(base) { - return GenerativeGoogleMetadata_Metadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeGoogleMetadata_Metadata(); - message.tokenMetadata = - object.tokenMetadata !== undefined && object.tokenMetadata !== null - ? GenerativeGoogleMetadata_TokenMetadata.fromPartial(object.tokenMetadata) - : undefined; - return message; - }, -}; -function createBaseGenerativeGoogleMetadata_UsageMetadata() { - return { promptTokenCount: undefined, candidatesTokenCount: undefined, totalTokenCount: undefined }; -} -export const GenerativeGoogleMetadata_UsageMetadata = { - encode(message, writer = _m0.Writer.create()) { - if (message.promptTokenCount !== undefined) { - writer.uint32(8).int64(message.promptTokenCount); - } - if (message.candidatesTokenCount !== undefined) { - writer.uint32(16).int64(message.candidatesTokenCount); - } - if (message.totalTokenCount !== undefined) { - writer.uint32(24).int64(message.totalTokenCount); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeGoogleMetadata_UsageMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.promptTokenCount = longToNumber(reader.int64()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.candidatesTokenCount = longToNumber(reader.int64()); - continue; - case 3: - if (tag !== 24) { - break; - } - message.totalTokenCount = longToNumber(reader.int64()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - promptTokenCount: isSet(object.promptTokenCount) - ? globalThis.Number(object.promptTokenCount) - : undefined, - candidatesTokenCount: isSet(object.candidatesTokenCount) - ? globalThis.Number(object.candidatesTokenCount) - : undefined, - totalTokenCount: isSet(object.totalTokenCount) ? globalThis.Number(object.totalTokenCount) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.promptTokenCount !== undefined) { - obj.promptTokenCount = Math.round(message.promptTokenCount); - } - if (message.candidatesTokenCount !== undefined) { - obj.candidatesTokenCount = Math.round(message.candidatesTokenCount); - } - if (message.totalTokenCount !== undefined) { - obj.totalTokenCount = Math.round(message.totalTokenCount); - } - return obj; - }, - create(base) { - return GenerativeGoogleMetadata_UsageMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGenerativeGoogleMetadata_UsageMetadata(); - message.promptTokenCount = (_a = object.promptTokenCount) !== null && _a !== void 0 ? _a : undefined; - message.candidatesTokenCount = - (_b = object.candidatesTokenCount) !== null && _b !== void 0 ? _b : undefined; - message.totalTokenCount = (_c = object.totalTokenCount) !== null && _c !== void 0 ? _c : undefined; - return message; - }, -}; -function createBaseGenerativeMetadata() { - return { - anthropic: undefined, - anyscale: undefined, - aws: undefined, - cohere: undefined, - dummy: undefined, - mistral: undefined, - octoai: undefined, - ollama: undefined, - openai: undefined, - google: undefined, - }; -} -export const GenerativeMetadata = { - encode(message, writer = _m0.Writer.create()) { - if (message.anthropic !== undefined) { - GenerativeAnthropicMetadata.encode(message.anthropic, writer.uint32(10).fork()).ldelim(); - } - if (message.anyscale !== undefined) { - GenerativeAnyscaleMetadata.encode(message.anyscale, writer.uint32(18).fork()).ldelim(); - } - if (message.aws !== undefined) { - GenerativeAWSMetadata.encode(message.aws, writer.uint32(26).fork()).ldelim(); - } - if (message.cohere !== undefined) { - GenerativeCohereMetadata.encode(message.cohere, writer.uint32(34).fork()).ldelim(); - } - if (message.dummy !== undefined) { - GenerativeDummyMetadata.encode(message.dummy, writer.uint32(42).fork()).ldelim(); - } - if (message.mistral !== undefined) { - GenerativeMistralMetadata.encode(message.mistral, writer.uint32(50).fork()).ldelim(); - } - if (message.octoai !== undefined) { - GenerativeOctoAIMetadata.encode(message.octoai, writer.uint32(58).fork()).ldelim(); - } - if (message.ollama !== undefined) { - GenerativeOllamaMetadata.encode(message.ollama, writer.uint32(66).fork()).ldelim(); - } - if (message.openai !== undefined) { - GenerativeOpenAIMetadata.encode(message.openai, writer.uint32(74).fork()).ldelim(); - } - if (message.google !== undefined) { - GenerativeGoogleMetadata.encode(message.google, writer.uint32(82).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeMetadata(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.anthropic = GenerativeAnthropicMetadata.decode(reader, reader.uint32()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.anyscale = GenerativeAnyscaleMetadata.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.aws = GenerativeAWSMetadata.decode(reader, reader.uint32()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.cohere = GenerativeCohereMetadata.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.dummy = GenerativeDummyMetadata.decode(reader, reader.uint32()); - continue; - case 6: - if (tag !== 50) { - break; - } - message.mistral = GenerativeMistralMetadata.decode(reader, reader.uint32()); - continue; - case 7: - if (tag !== 58) { - break; - } - message.octoai = GenerativeOctoAIMetadata.decode(reader, reader.uint32()); - continue; - case 8: - if (tag !== 66) { - break; - } - message.ollama = GenerativeOllamaMetadata.decode(reader, reader.uint32()); - continue; - case 9: - if (tag !== 74) { - break; - } - message.openai = GenerativeOpenAIMetadata.decode(reader, reader.uint32()); - continue; - case 10: - if (tag !== 82) { - break; - } - message.google = GenerativeGoogleMetadata.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - anthropic: isSet(object.anthropic) ? GenerativeAnthropicMetadata.fromJSON(object.anthropic) : undefined, - anyscale: isSet(object.anyscale) ? GenerativeAnyscaleMetadata.fromJSON(object.anyscale) : undefined, - aws: isSet(object.aws) ? GenerativeAWSMetadata.fromJSON(object.aws) : undefined, - cohere: isSet(object.cohere) ? GenerativeCohereMetadata.fromJSON(object.cohere) : undefined, - dummy: isSet(object.dummy) ? GenerativeDummyMetadata.fromJSON(object.dummy) : undefined, - mistral: isSet(object.mistral) ? GenerativeMistralMetadata.fromJSON(object.mistral) : undefined, - octoai: isSet(object.octoai) ? GenerativeOctoAIMetadata.fromJSON(object.octoai) : undefined, - ollama: isSet(object.ollama) ? GenerativeOllamaMetadata.fromJSON(object.ollama) : undefined, - openai: isSet(object.openai) ? GenerativeOpenAIMetadata.fromJSON(object.openai) : undefined, - google: isSet(object.google) ? GenerativeGoogleMetadata.fromJSON(object.google) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.anthropic !== undefined) { - obj.anthropic = GenerativeAnthropicMetadata.toJSON(message.anthropic); - } - if (message.anyscale !== undefined) { - obj.anyscale = GenerativeAnyscaleMetadata.toJSON(message.anyscale); - } - if (message.aws !== undefined) { - obj.aws = GenerativeAWSMetadata.toJSON(message.aws); - } - if (message.cohere !== undefined) { - obj.cohere = GenerativeCohereMetadata.toJSON(message.cohere); - } - if (message.dummy !== undefined) { - obj.dummy = GenerativeDummyMetadata.toJSON(message.dummy); - } - if (message.mistral !== undefined) { - obj.mistral = GenerativeMistralMetadata.toJSON(message.mistral); - } - if (message.octoai !== undefined) { - obj.octoai = GenerativeOctoAIMetadata.toJSON(message.octoai); - } - if (message.ollama !== undefined) { - obj.ollama = GenerativeOllamaMetadata.toJSON(message.ollama); - } - if (message.openai !== undefined) { - obj.openai = GenerativeOpenAIMetadata.toJSON(message.openai); - } - if (message.google !== undefined) { - obj.google = GenerativeGoogleMetadata.toJSON(message.google); - } - return obj; - }, - create(base) { - return GenerativeMetadata.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseGenerativeMetadata(); - message.anthropic = - object.anthropic !== undefined && object.anthropic !== null - ? GenerativeAnthropicMetadata.fromPartial(object.anthropic) - : undefined; - message.anyscale = - object.anyscale !== undefined && object.anyscale !== null - ? GenerativeAnyscaleMetadata.fromPartial(object.anyscale) - : undefined; - message.aws = - object.aws !== undefined && object.aws !== null - ? GenerativeAWSMetadata.fromPartial(object.aws) - : undefined; - message.cohere = - object.cohere !== undefined && object.cohere !== null - ? GenerativeCohereMetadata.fromPartial(object.cohere) - : undefined; - message.dummy = - object.dummy !== undefined && object.dummy !== null - ? GenerativeDummyMetadata.fromPartial(object.dummy) - : undefined; - message.mistral = - object.mistral !== undefined && object.mistral !== null - ? GenerativeMistralMetadata.fromPartial(object.mistral) - : undefined; - message.octoai = - object.octoai !== undefined && object.octoai !== null - ? GenerativeOctoAIMetadata.fromPartial(object.octoai) - : undefined; - message.ollama = - object.ollama !== undefined && object.ollama !== null - ? GenerativeOllamaMetadata.fromPartial(object.ollama) - : undefined; - message.openai = - object.openai !== undefined && object.openai !== null - ? GenerativeOpenAIMetadata.fromPartial(object.openai) - : undefined; - message.google = - object.google !== undefined && object.google !== null - ? GenerativeGoogleMetadata.fromPartial(object.google) - : undefined; - return message; - }, -}; -function createBaseGenerativeReply() { - return { result: '', debug: undefined, metadata: undefined }; -} -export const GenerativeReply = { - encode(message, writer = _m0.Writer.create()) { - if (message.result !== '') { - writer.uint32(10).string(message.result); - } - if (message.debug !== undefined) { - GenerativeDebug.encode(message.debug, writer.uint32(18).fork()).ldelim(); - } - if (message.metadata !== undefined) { - GenerativeMetadata.encode(message.metadata, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeReply(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.result = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.debug = GenerativeDebug.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.metadata = GenerativeMetadata.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - result: isSet(object.result) ? globalThis.String(object.result) : '', - debug: isSet(object.debug) ? GenerativeDebug.fromJSON(object.debug) : undefined, - metadata: isSet(object.metadata) ? GenerativeMetadata.fromJSON(object.metadata) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.result !== '') { - obj.result = message.result; - } - if (message.debug !== undefined) { - obj.debug = GenerativeDebug.toJSON(message.debug); - } - if (message.metadata !== undefined) { - obj.metadata = GenerativeMetadata.toJSON(message.metadata); - } - return obj; - }, - create(base) { - return GenerativeReply.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseGenerativeReply(); - message.result = (_a = object.result) !== null && _a !== void 0 ? _a : ''; - message.debug = - object.debug !== undefined && object.debug !== null - ? GenerativeDebug.fromPartial(object.debug) - : undefined; - message.metadata = - object.metadata !== undefined && object.metadata !== null - ? GenerativeMetadata.fromPartial(object.metadata) - : undefined; - return message; - }, -}; -function createBaseGenerativeResult() { - return { values: [] }; -} -export const GenerativeResult = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.values) { - GenerativeReply.encode(v, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeResult(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(GenerativeReply.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => GenerativeReply.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values.map((e) => GenerativeReply.toJSON(e)); - } - return obj; - }, - create(base) { - return GenerativeResult.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseGenerativeResult(); - message.values = - ((_a = object.values) === null || _a === void 0 - ? void 0 - : _a.map((e) => GenerativeReply.fromPartial(e))) || []; - return message; - }, -}; -function createBaseGenerativeDebug() { - return { fullPrompt: undefined }; -} -export const GenerativeDebug = { - encode(message, writer = _m0.Writer.create()) { - if (message.fullPrompt !== undefined) { - writer.uint32(10).string(message.fullPrompt); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGenerativeDebug(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.fullPrompt = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { fullPrompt: isSet(object.fullPrompt) ? globalThis.String(object.fullPrompt) : undefined }; - }, - toJSON(message) { - const obj = {}; - if (message.fullPrompt !== undefined) { - obj.fullPrompt = message.fullPrompt; - } - return obj; - }, - create(base) { - return GenerativeDebug.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseGenerativeDebug(); - message.fullPrompt = (_a = object.fullPrompt) !== null && _a !== void 0 ? _a : undefined; - return message; - }, -}; -function longToNumber(long) { - if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { - throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); - } - return long.toNumber(); -} -if (_m0.util.Long !== Long) { - _m0.util.Long = Long; - _m0.configure(); -} -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/esm/proto/v1/properties.d.ts b/dist/node/esm/proto/v1/properties.d.ts deleted file mode 100644 index 6829c255..00000000 --- a/dist/node/esm/proto/v1/properties.d.ts +++ /dev/null @@ -1,198 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -import { NullValue } from '../google/protobuf/struct.js'; -export declare const protobufPackage = 'weaviate.v1'; -export interface Properties { - fields: { - [key: string]: Value; - }; -} -export interface Properties_FieldsEntry { - key: string; - value: Value | undefined; -} -export interface Value { - numberValue?: number | undefined; - /** @deprecated */ - stringValue?: string | undefined; - boolValue?: boolean | undefined; - objectValue?: Properties | undefined; - listValue?: ListValue | undefined; - dateValue?: string | undefined; - uuidValue?: string | undefined; - intValue?: number | undefined; - geoValue?: GeoCoordinate | undefined; - blobValue?: string | undefined; - phoneValue?: PhoneNumber | undefined; - nullValue?: NullValue | undefined; - textValue?: string | undefined; -} -export interface ListValue { - /** @deprecated */ - values: Value[]; - numberValues?: NumberValues | undefined; - boolValues?: BoolValues | undefined; - objectValues?: ObjectValues | undefined; - dateValues?: DateValues | undefined; - uuidValues?: UuidValues | undefined; - intValues?: IntValues | undefined; - textValues?: TextValues | undefined; -} -export interface NumberValues { - /** - * The values are stored as a byte array, where each 8 bytes represent a single float64 value. - * The byte array is stored in little-endian order using uint64 encoding. - */ - values: Uint8Array; -} -export interface TextValues { - values: string[]; -} -export interface BoolValues { - values: boolean[]; -} -export interface ObjectValues { - values: Properties[]; -} -export interface DateValues { - values: string[]; -} -export interface UuidValues { - values: string[]; -} -export interface IntValues { - /** - * The values are stored as a byte array, where each 8 bytes represent a single int64 value. - * The byte array is stored in little-endian order using uint64 encoding. - */ - values: Uint8Array; -} -export interface GeoCoordinate { - longitude: number; - latitude: number; -} -export interface PhoneNumber { - countryCode: number; - defaultCountry: string; - input: string; - internationalFormatted: string; - national: number; - nationalFormatted: string; - valid: boolean; -} -export declare const Properties: { - encode(message: Properties, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Properties; - fromJSON(object: any): Properties; - toJSON(message: Properties): unknown; - create(base?: DeepPartial): Properties; - fromPartial(object: DeepPartial): Properties; -}; -export declare const Properties_FieldsEntry: { - encode(message: Properties_FieldsEntry, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Properties_FieldsEntry; - fromJSON(object: any): Properties_FieldsEntry; - toJSON(message: Properties_FieldsEntry): unknown; - create(base?: DeepPartial): Properties_FieldsEntry; - fromPartial(object: DeepPartial): Properties_FieldsEntry; -}; -export declare const Value: { - encode(message: Value, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Value; - fromJSON(object: any): Value; - toJSON(message: Value): unknown; - create(base?: DeepPartial): Value; - fromPartial(object: DeepPartial): Value; -}; -export declare const ListValue: { - encode(message: ListValue, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): ListValue; - fromJSON(object: any): ListValue; - toJSON(message: ListValue): unknown; - create(base?: DeepPartial): ListValue; - fromPartial(object: DeepPartial): ListValue; -}; -export declare const NumberValues: { - encode(message: NumberValues, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NumberValues; - fromJSON(object: any): NumberValues; - toJSON(message: NumberValues): unknown; - create(base?: DeepPartial): NumberValues; - fromPartial(object: DeepPartial): NumberValues; -}; -export declare const TextValues: { - encode(message: TextValues, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): TextValues; - fromJSON(object: any): TextValues; - toJSON(message: TextValues): unknown; - create(base?: DeepPartial): TextValues; - fromPartial(object: DeepPartial): TextValues; -}; -export declare const BoolValues: { - encode(message: BoolValues, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BoolValues; - fromJSON(object: any): BoolValues; - toJSON(message: BoolValues): unknown; - create(base?: DeepPartial): BoolValues; - fromPartial(object: DeepPartial): BoolValues; -}; -export declare const ObjectValues: { - encode(message: ObjectValues, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): ObjectValues; - fromJSON(object: any): ObjectValues; - toJSON(message: ObjectValues): unknown; - create(base?: DeepPartial): ObjectValues; - fromPartial(object: DeepPartial): ObjectValues; -}; -export declare const DateValues: { - encode(message: DateValues, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): DateValues; - fromJSON(object: any): DateValues; - toJSON(message: DateValues): unknown; - create(base?: DeepPartial): DateValues; - fromPartial(object: DeepPartial): DateValues; -}; -export declare const UuidValues: { - encode(message: UuidValues, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): UuidValues; - fromJSON(object: any): UuidValues; - toJSON(message: UuidValues): unknown; - create(base?: DeepPartial): UuidValues; - fromPartial(object: DeepPartial): UuidValues; -}; -export declare const IntValues: { - encode(message: IntValues, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): IntValues; - fromJSON(object: any): IntValues; - toJSON(message: IntValues): unknown; - create(base?: DeepPartial): IntValues; - fromPartial(object: DeepPartial): IntValues; -}; -export declare const GeoCoordinate: { - encode(message: GeoCoordinate, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GeoCoordinate; - fromJSON(object: any): GeoCoordinate; - toJSON(message: GeoCoordinate): unknown; - create(base?: DeepPartial): GeoCoordinate; - fromPartial(object: DeepPartial): GeoCoordinate; -}; -export declare const PhoneNumber: { - encode(message: PhoneNumber, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): PhoneNumber; - fromJSON(object: any): PhoneNumber; - toJSON(message: PhoneNumber): unknown; - create(base?: DeepPartial): PhoneNumber; - fromPartial(object: DeepPartial): PhoneNumber; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/esm/proto/v1/properties.js b/dist/node/esm/proto/v1/properties.js deleted file mode 100644 index de63630b..00000000 --- a/dist/node/esm/proto/v1/properties.js +++ /dev/null @@ -1,1231 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/properties.proto -/* eslint-disable */ -import Long from 'long'; -import _m0 from 'protobufjs/minimal.js'; -import { nullValueFromJSON, nullValueToJSON } from '../google/protobuf/struct.js'; -export const protobufPackage = 'weaviate.v1'; -function createBaseProperties() { - return { fields: {} }; -} -export const Properties = { - encode(message, writer = _m0.Writer.create()) { - Object.entries(message.fields).forEach(([key, value]) => { - Properties_FieldsEntry.encode({ key: key, value }, writer.uint32(10).fork()).ldelim(); - }); - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseProperties(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - const entry1 = Properties_FieldsEntry.decode(reader, reader.uint32()); - if (entry1.value !== undefined) { - message.fields[entry1.key] = entry1.value; - } - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - fields: isObject(object.fields) - ? Object.entries(object.fields).reduce((acc, [key, value]) => { - acc[key] = Value.fromJSON(value); - return acc; - }, {}) - : {}, - }; - }, - toJSON(message) { - const obj = {}; - if (message.fields) { - const entries = Object.entries(message.fields); - if (entries.length > 0) { - obj.fields = {}; - entries.forEach(([k, v]) => { - obj.fields[k] = Value.toJSON(v); - }); - } - } - return obj; - }, - create(base) { - return Properties.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseProperties(); - message.fields = Object.entries((_a = object.fields) !== null && _a !== void 0 ? _a : {}).reduce( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = Value.fromPartial(value); - } - return acc; - }, - {} - ); - return message; - }, -}; -function createBaseProperties_FieldsEntry() { - return { key: '', value: undefined }; -} -export const Properties_FieldsEntry = { - encode(message, writer = _m0.Writer.create()) { - if (message.key !== '') { - writer.uint32(10).string(message.key); - } - if (message.value !== undefined) { - Value.encode(message.value, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseProperties_FieldsEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.key = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.value = Value.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - key: isSet(object.key) ? globalThis.String(object.key) : '', - value: isSet(object.value) ? Value.fromJSON(object.value) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.key !== '') { - obj.key = message.key; - } - if (message.value !== undefined) { - obj.value = Value.toJSON(message.value); - } - return obj; - }, - create(base) { - return Properties_FieldsEntry.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseProperties_FieldsEntry(); - message.key = (_a = object.key) !== null && _a !== void 0 ? _a : ''; - message.value = - object.value !== undefined && object.value !== null ? Value.fromPartial(object.value) : undefined; - return message; - }, -}; -function createBaseValue() { - return { - numberValue: undefined, - stringValue: undefined, - boolValue: undefined, - objectValue: undefined, - listValue: undefined, - dateValue: undefined, - uuidValue: undefined, - intValue: undefined, - geoValue: undefined, - blobValue: undefined, - phoneValue: undefined, - nullValue: undefined, - textValue: undefined, - }; -} -export const Value = { - encode(message, writer = _m0.Writer.create()) { - if (message.numberValue !== undefined) { - writer.uint32(9).double(message.numberValue); - } - if (message.stringValue !== undefined) { - writer.uint32(18).string(message.stringValue); - } - if (message.boolValue !== undefined) { - writer.uint32(24).bool(message.boolValue); - } - if (message.objectValue !== undefined) { - Properties.encode(message.objectValue, writer.uint32(34).fork()).ldelim(); - } - if (message.listValue !== undefined) { - ListValue.encode(message.listValue, writer.uint32(42).fork()).ldelim(); - } - if (message.dateValue !== undefined) { - writer.uint32(50).string(message.dateValue); - } - if (message.uuidValue !== undefined) { - writer.uint32(58).string(message.uuidValue); - } - if (message.intValue !== undefined) { - writer.uint32(64).int64(message.intValue); - } - if (message.geoValue !== undefined) { - GeoCoordinate.encode(message.geoValue, writer.uint32(74).fork()).ldelim(); - } - if (message.blobValue !== undefined) { - writer.uint32(82).string(message.blobValue); - } - if (message.phoneValue !== undefined) { - PhoneNumber.encode(message.phoneValue, writer.uint32(90).fork()).ldelim(); - } - if (message.nullValue !== undefined) { - writer.uint32(96).int32(message.nullValue); - } - if (message.textValue !== undefined) { - writer.uint32(106).string(message.textValue); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseValue(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 9) { - break; - } - message.numberValue = reader.double(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.stringValue = reader.string(); - continue; - case 3: - if (tag !== 24) { - break; - } - message.boolValue = reader.bool(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.objectValue = Properties.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.listValue = ListValue.decode(reader, reader.uint32()); - continue; - case 6: - if (tag !== 50) { - break; - } - message.dateValue = reader.string(); - continue; - case 7: - if (tag !== 58) { - break; - } - message.uuidValue = reader.string(); - continue; - case 8: - if (tag !== 64) { - break; - } - message.intValue = longToNumber(reader.int64()); - continue; - case 9: - if (tag !== 74) { - break; - } - message.geoValue = GeoCoordinate.decode(reader, reader.uint32()); - continue; - case 10: - if (tag !== 82) { - break; - } - message.blobValue = reader.string(); - continue; - case 11: - if (tag !== 90) { - break; - } - message.phoneValue = PhoneNumber.decode(reader, reader.uint32()); - continue; - case 12: - if (tag !== 96) { - break; - } - message.nullValue = reader.int32(); - continue; - case 13: - if (tag !== 106) { - break; - } - message.textValue = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - numberValue: isSet(object.numberValue) ? globalThis.Number(object.numberValue) : undefined, - stringValue: isSet(object.stringValue) ? globalThis.String(object.stringValue) : undefined, - boolValue: isSet(object.boolValue) ? globalThis.Boolean(object.boolValue) : undefined, - objectValue: isSet(object.objectValue) ? Properties.fromJSON(object.objectValue) : undefined, - listValue: isSet(object.listValue) ? ListValue.fromJSON(object.listValue) : undefined, - dateValue: isSet(object.dateValue) ? globalThis.String(object.dateValue) : undefined, - uuidValue: isSet(object.uuidValue) ? globalThis.String(object.uuidValue) : undefined, - intValue: isSet(object.intValue) ? globalThis.Number(object.intValue) : undefined, - geoValue: isSet(object.geoValue) ? GeoCoordinate.fromJSON(object.geoValue) : undefined, - blobValue: isSet(object.blobValue) ? globalThis.String(object.blobValue) : undefined, - phoneValue: isSet(object.phoneValue) ? PhoneNumber.fromJSON(object.phoneValue) : undefined, - nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : undefined, - textValue: isSet(object.textValue) ? globalThis.String(object.textValue) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.numberValue !== undefined) { - obj.numberValue = message.numberValue; - } - if (message.stringValue !== undefined) { - obj.stringValue = message.stringValue; - } - if (message.boolValue !== undefined) { - obj.boolValue = message.boolValue; - } - if (message.objectValue !== undefined) { - obj.objectValue = Properties.toJSON(message.objectValue); - } - if (message.listValue !== undefined) { - obj.listValue = ListValue.toJSON(message.listValue); - } - if (message.dateValue !== undefined) { - obj.dateValue = message.dateValue; - } - if (message.uuidValue !== undefined) { - obj.uuidValue = message.uuidValue; - } - if (message.intValue !== undefined) { - obj.intValue = Math.round(message.intValue); - } - if (message.geoValue !== undefined) { - obj.geoValue = GeoCoordinate.toJSON(message.geoValue); - } - if (message.blobValue !== undefined) { - obj.blobValue = message.blobValue; - } - if (message.phoneValue !== undefined) { - obj.phoneValue = PhoneNumber.toJSON(message.phoneValue); - } - if (message.nullValue !== undefined) { - obj.nullValue = nullValueToJSON(message.nullValue); - } - if (message.textValue !== undefined) { - obj.textValue = message.textValue; - } - return obj; - }, - create(base) { - return Value.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j; - const message = createBaseValue(); - message.numberValue = (_a = object.numberValue) !== null && _a !== void 0 ? _a : undefined; - message.stringValue = (_b = object.stringValue) !== null && _b !== void 0 ? _b : undefined; - message.boolValue = (_c = object.boolValue) !== null && _c !== void 0 ? _c : undefined; - message.objectValue = - object.objectValue !== undefined && object.objectValue !== null - ? Properties.fromPartial(object.objectValue) - : undefined; - message.listValue = - object.listValue !== undefined && object.listValue !== null - ? ListValue.fromPartial(object.listValue) - : undefined; - message.dateValue = (_d = object.dateValue) !== null && _d !== void 0 ? _d : undefined; - message.uuidValue = (_e = object.uuidValue) !== null && _e !== void 0 ? _e : undefined; - message.intValue = (_f = object.intValue) !== null && _f !== void 0 ? _f : undefined; - message.geoValue = - object.geoValue !== undefined && object.geoValue !== null - ? GeoCoordinate.fromPartial(object.geoValue) - : undefined; - message.blobValue = (_g = object.blobValue) !== null && _g !== void 0 ? _g : undefined; - message.phoneValue = - object.phoneValue !== undefined && object.phoneValue !== null - ? PhoneNumber.fromPartial(object.phoneValue) - : undefined; - message.nullValue = (_h = object.nullValue) !== null && _h !== void 0 ? _h : undefined; - message.textValue = (_j = object.textValue) !== null && _j !== void 0 ? _j : undefined; - return message; - }, -}; -function createBaseListValue() { - return { - values: [], - numberValues: undefined, - boolValues: undefined, - objectValues: undefined, - dateValues: undefined, - uuidValues: undefined, - intValues: undefined, - textValues: undefined, - }; -} -export const ListValue = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.values) { - Value.encode(v, writer.uint32(10).fork()).ldelim(); - } - if (message.numberValues !== undefined) { - NumberValues.encode(message.numberValues, writer.uint32(18).fork()).ldelim(); - } - if (message.boolValues !== undefined) { - BoolValues.encode(message.boolValues, writer.uint32(26).fork()).ldelim(); - } - if (message.objectValues !== undefined) { - ObjectValues.encode(message.objectValues, writer.uint32(34).fork()).ldelim(); - } - if (message.dateValues !== undefined) { - DateValues.encode(message.dateValues, writer.uint32(42).fork()).ldelim(); - } - if (message.uuidValues !== undefined) { - UuidValues.encode(message.uuidValues, writer.uint32(50).fork()).ldelim(); - } - if (message.intValues !== undefined) { - IntValues.encode(message.intValues, writer.uint32(58).fork()).ldelim(); - } - if (message.textValues !== undefined) { - TextValues.encode(message.textValues, writer.uint32(66).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseListValue(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(Value.decode(reader, reader.uint32())); - continue; - case 2: - if (tag !== 18) { - break; - } - message.numberValues = NumberValues.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.boolValues = BoolValues.decode(reader, reader.uint32()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.objectValues = ObjectValues.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.dateValues = DateValues.decode(reader, reader.uint32()); - continue; - case 6: - if (tag !== 50) { - break; - } - message.uuidValues = UuidValues.decode(reader, reader.uint32()); - continue; - case 7: - if (tag !== 58) { - break; - } - message.intValues = IntValues.decode(reader, reader.uint32()); - continue; - case 8: - if (tag !== 66) { - break; - } - message.textValues = TextValues.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => Value.fromJSON(e)) - : [], - numberValues: isSet(object.numberValues) ? NumberValues.fromJSON(object.numberValues) : undefined, - boolValues: isSet(object.boolValues) ? BoolValues.fromJSON(object.boolValues) : undefined, - objectValues: isSet(object.objectValues) ? ObjectValues.fromJSON(object.objectValues) : undefined, - dateValues: isSet(object.dateValues) ? DateValues.fromJSON(object.dateValues) : undefined, - uuidValues: isSet(object.uuidValues) ? UuidValues.fromJSON(object.uuidValues) : undefined, - intValues: isSet(object.intValues) ? IntValues.fromJSON(object.intValues) : undefined, - textValues: isSet(object.textValues) ? TextValues.fromJSON(object.textValues) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values.map((e) => Value.toJSON(e)); - } - if (message.numberValues !== undefined) { - obj.numberValues = NumberValues.toJSON(message.numberValues); - } - if (message.boolValues !== undefined) { - obj.boolValues = BoolValues.toJSON(message.boolValues); - } - if (message.objectValues !== undefined) { - obj.objectValues = ObjectValues.toJSON(message.objectValues); - } - if (message.dateValues !== undefined) { - obj.dateValues = DateValues.toJSON(message.dateValues); - } - if (message.uuidValues !== undefined) { - obj.uuidValues = UuidValues.toJSON(message.uuidValues); - } - if (message.intValues !== undefined) { - obj.intValues = IntValues.toJSON(message.intValues); - } - if (message.textValues !== undefined) { - obj.textValues = TextValues.toJSON(message.textValues); - } - return obj; - }, - create(base) { - return ListValue.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseListValue(); - message.values = - ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => Value.fromPartial(e))) || []; - message.numberValues = - object.numberValues !== undefined && object.numberValues !== null - ? NumberValues.fromPartial(object.numberValues) - : undefined; - message.boolValues = - object.boolValues !== undefined && object.boolValues !== null - ? BoolValues.fromPartial(object.boolValues) - : undefined; - message.objectValues = - object.objectValues !== undefined && object.objectValues !== null - ? ObjectValues.fromPartial(object.objectValues) - : undefined; - message.dateValues = - object.dateValues !== undefined && object.dateValues !== null - ? DateValues.fromPartial(object.dateValues) - : undefined; - message.uuidValues = - object.uuidValues !== undefined && object.uuidValues !== null - ? UuidValues.fromPartial(object.uuidValues) - : undefined; - message.intValues = - object.intValues !== undefined && object.intValues !== null - ? IntValues.fromPartial(object.intValues) - : undefined; - message.textValues = - object.textValues !== undefined && object.textValues !== null - ? TextValues.fromPartial(object.textValues) - : undefined; - return message; - }, -}; -function createBaseNumberValues() { - return { values: new Uint8Array(0) }; -} -export const NumberValues = { - encode(message, writer = _m0.Writer.create()) { - if (message.values.length !== 0) { - writer.uint32(10).bytes(message.values); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNumberValues(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values = reader.bytes(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { values: isSet(object.values) ? bytesFromBase64(object.values) : new Uint8Array(0) }; - }, - toJSON(message) { - const obj = {}; - if (message.values.length !== 0) { - obj.values = base64FromBytes(message.values); - } - return obj; - }, - create(base) { - return NumberValues.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseNumberValues(); - message.values = (_a = object.values) !== null && _a !== void 0 ? _a : new Uint8Array(0); - return message; - }, -}; -function createBaseTextValues() { - return { values: [] }; -} -export const TextValues = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.values) { - writer.uint32(10).string(v); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTextValues(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return TextValues.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseTextValues(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseBoolValues() { - return { values: [] }; -} -export const BoolValues = { - encode(message, writer = _m0.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.values) { - writer.bool(v); - } - writer.ldelim(); - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBoolValues(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 8) { - message.values.push(reader.bool()); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.values.push(reader.bool()); - } - continue; - } - break; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.Boolean(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return BoolValues.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseBoolValues(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseObjectValues() { - return { values: [] }; -} -export const ObjectValues = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.values) { - Properties.encode(v, writer.uint32(10).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseObjectValues(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(Properties.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => Properties.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values.map((e) => Properties.toJSON(e)); - } - return obj; - }, - create(base) { - return ObjectValues.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseObjectValues(); - message.values = - ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => Properties.fromPartial(e))) || - []; - return message; - }, -}; -function createBaseDateValues() { - return { values: [] }; -} -export const DateValues = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.values) { - writer.uint32(10).string(v); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseDateValues(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return DateValues.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseDateValues(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseUuidValues() { - return { values: [] }; -} -export const UuidValues = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.values) { - writer.uint32(10).string(v); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseUuidValues(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return UuidValues.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseUuidValues(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseIntValues() { - return { values: new Uint8Array(0) }; -} -export const IntValues = { - encode(message, writer = _m0.Writer.create()) { - if (message.values.length !== 0) { - writer.uint32(10).bytes(message.values); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseIntValues(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values = reader.bytes(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { values: isSet(object.values) ? bytesFromBase64(object.values) : new Uint8Array(0) }; - }, - toJSON(message) { - const obj = {}; - if (message.values.length !== 0) { - obj.values = base64FromBytes(message.values); - } - return obj; - }, - create(base) { - return IntValues.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseIntValues(); - message.values = (_a = object.values) !== null && _a !== void 0 ? _a : new Uint8Array(0); - return message; - }, -}; -function createBaseGeoCoordinate() { - return { longitude: 0, latitude: 0 }; -} -export const GeoCoordinate = { - encode(message, writer = _m0.Writer.create()) { - if (message.longitude !== 0) { - writer.uint32(13).float(message.longitude); - } - if (message.latitude !== 0) { - writer.uint32(21).float(message.latitude); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGeoCoordinate(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 13) { - break; - } - message.longitude = reader.float(); - continue; - case 2: - if (tag !== 21) { - break; - } - message.latitude = reader.float(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - longitude: isSet(object.longitude) ? globalThis.Number(object.longitude) : 0, - latitude: isSet(object.latitude) ? globalThis.Number(object.latitude) : 0, - }; - }, - toJSON(message) { - const obj = {}; - if (message.longitude !== 0) { - obj.longitude = message.longitude; - } - if (message.latitude !== 0) { - obj.latitude = message.latitude; - } - return obj; - }, - create(base) { - return GeoCoordinate.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseGeoCoordinate(); - message.longitude = (_a = object.longitude) !== null && _a !== void 0 ? _a : 0; - message.latitude = (_b = object.latitude) !== null && _b !== void 0 ? _b : 0; - return message; - }, -}; -function createBasePhoneNumber() { - return { - countryCode: 0, - defaultCountry: '', - input: '', - internationalFormatted: '', - national: 0, - nationalFormatted: '', - valid: false, - }; -} -export const PhoneNumber = { - encode(message, writer = _m0.Writer.create()) { - if (message.countryCode !== 0) { - writer.uint32(8).uint64(message.countryCode); - } - if (message.defaultCountry !== '') { - writer.uint32(18).string(message.defaultCountry); - } - if (message.input !== '') { - writer.uint32(26).string(message.input); - } - if (message.internationalFormatted !== '') { - writer.uint32(34).string(message.internationalFormatted); - } - if (message.national !== 0) { - writer.uint32(40).uint64(message.national); - } - if (message.nationalFormatted !== '') { - writer.uint32(50).string(message.nationalFormatted); - } - if (message.valid !== false) { - writer.uint32(56).bool(message.valid); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePhoneNumber(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.countryCode = longToNumber(reader.uint64()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.defaultCountry = reader.string(); - continue; - case 3: - if (tag !== 26) { - break; - } - message.input = reader.string(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.internationalFormatted = reader.string(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.national = longToNumber(reader.uint64()); - continue; - case 6: - if (tag !== 50) { - break; - } - message.nationalFormatted = reader.string(); - continue; - case 7: - if (tag !== 56) { - break; - } - message.valid = reader.bool(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - countryCode: isSet(object.countryCode) ? globalThis.Number(object.countryCode) : 0, - defaultCountry: isSet(object.defaultCountry) ? globalThis.String(object.defaultCountry) : '', - input: isSet(object.input) ? globalThis.String(object.input) : '', - internationalFormatted: isSet(object.internationalFormatted) - ? globalThis.String(object.internationalFormatted) - : '', - national: isSet(object.national) ? globalThis.Number(object.national) : 0, - nationalFormatted: isSet(object.nationalFormatted) ? globalThis.String(object.nationalFormatted) : '', - valid: isSet(object.valid) ? globalThis.Boolean(object.valid) : false, - }; - }, - toJSON(message) { - const obj = {}; - if (message.countryCode !== 0) { - obj.countryCode = Math.round(message.countryCode); - } - if (message.defaultCountry !== '') { - obj.defaultCountry = message.defaultCountry; - } - if (message.input !== '') { - obj.input = message.input; - } - if (message.internationalFormatted !== '') { - obj.internationalFormatted = message.internationalFormatted; - } - if (message.national !== 0) { - obj.national = Math.round(message.national); - } - if (message.nationalFormatted !== '') { - obj.nationalFormatted = message.nationalFormatted; - } - if (message.valid !== false) { - obj.valid = message.valid; - } - return obj; - }, - create(base) { - return PhoneNumber.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g; - const message = createBasePhoneNumber(); - message.countryCode = (_a = object.countryCode) !== null && _a !== void 0 ? _a : 0; - message.defaultCountry = (_b = object.defaultCountry) !== null && _b !== void 0 ? _b : ''; - message.input = (_c = object.input) !== null && _c !== void 0 ? _c : ''; - message.internationalFormatted = (_d = object.internationalFormatted) !== null && _d !== void 0 ? _d : ''; - message.national = (_e = object.national) !== null && _e !== void 0 ? _e : 0; - message.nationalFormatted = (_f = object.nationalFormatted) !== null && _f !== void 0 ? _f : ''; - message.valid = (_g = object.valid) !== null && _g !== void 0 ? _g : false; - return message; - }, -}; -function bytesFromBase64(b64) { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} -function base64FromBytes(arr) { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString('base64'); - } else { - const bin = []; - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join('')); - } -} -function longToNumber(long) { - if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { - throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); - } - return long.toNumber(); -} -if (_m0.util.Long !== Long) { - _m0.util.Long = Long; - _m0.configure(); -} -function isObject(value) { - return typeof value === 'object' && value !== null; -} -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/esm/proto/v1/search_get.d.ts b/dist/node/esm/proto/v1/search_get.d.ts deleted file mode 100644 index 2bbe25cb..00000000 --- a/dist/node/esm/proto/v1/search_get.d.ts +++ /dev/null @@ -1,671 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -import { - BooleanArrayProperties, - ConsistencyLevel, - Filters, - IntArrayProperties, - NumberArrayProperties, - ObjectArrayProperties, - ObjectProperties, - TextArrayProperties, - Vectors, -} from './base.js'; -import { GenerativeReply, GenerativeResult, GenerativeSearch } from './generative.js'; -import { Properties } from './properties.js'; -export declare const protobufPackage = 'weaviate.v1'; -export declare enum CombinationMethod { - COMBINATION_METHOD_UNSPECIFIED = 0, - COMBINATION_METHOD_TYPE_SUM = 1, - COMBINATION_METHOD_TYPE_MIN = 2, - COMBINATION_METHOD_TYPE_AVERAGE = 3, - COMBINATION_METHOD_TYPE_RELATIVE_SCORE = 4, - COMBINATION_METHOD_TYPE_MANUAL = 5, - UNRECOGNIZED = -1, -} -export declare function combinationMethodFromJSON(object: any): CombinationMethod; -export declare function combinationMethodToJSON(object: CombinationMethod): string; -export interface SearchRequest { - /** required */ - collection: string; - /** parameters */ - tenant: string; - consistencyLevel?: ConsistencyLevel | undefined; - /** what is returned */ - properties?: PropertiesRequest | undefined; - metadata?: MetadataRequest | undefined; - groupBy?: GroupBy | undefined; - /** affects order and length of results. 0/empty (default value) means disabled */ - limit: number; - offset: number; - autocut: number; - after: string; - /** protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED */ - sortBy: SortBy[]; - /** matches/searches for objects */ - filters?: Filters | undefined; - hybridSearch?: Hybrid | undefined; - bm25Search?: BM25 | undefined; - nearVector?: NearVector | undefined; - nearObject?: NearObject | undefined; - nearText?: NearTextSearch | undefined; - nearImage?: NearImageSearch | undefined; - nearAudio?: NearAudioSearch | undefined; - nearVideo?: NearVideoSearch | undefined; - nearDepth?: NearDepthSearch | undefined; - nearThermal?: NearThermalSearch | undefined; - nearImu?: NearIMUSearch | undefined; - generative?: GenerativeSearch | undefined; - rerank?: Rerank | undefined; - /** @deprecated */ - uses123Api: boolean; - /** @deprecated */ - uses125Api: boolean; - uses127Api: boolean; -} -export interface GroupBy { - /** - * currently only supports one entry (eg just properties, no refs). But might - * be extended in the future. - * protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED - */ - path: string[]; - numberOfGroups: number; - objectsPerGroup: number; -} -export interface SortBy { - ascending: boolean; - /** - * currently only supports one entry (eg just properties, no refs). But the - * weaviate datastructure already has paths in it and this makes it easily - * extendable in the future - * protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED - */ - path: string[]; -} -export interface MetadataRequest { - uuid: boolean; - vector: boolean; - creationTimeUnix: boolean; - lastUpdateTimeUnix: boolean; - distance: boolean; - certainty: boolean; - score: boolean; - explainScore: boolean; - isConsistent: boolean; - vectors: string[]; -} -export interface PropertiesRequest { - nonRefProperties: string[]; - refProperties: RefPropertiesRequest[]; - objectProperties: ObjectPropertiesRequest[]; - returnAllNonrefProperties: boolean; -} -export interface ObjectPropertiesRequest { - propName: string; - primitiveProperties: string[]; - objectProperties: ObjectPropertiesRequest[]; -} -export interface WeightsForTarget { - target: string; - weight: number; -} -export interface Targets { - targetVectors: string[]; - combination: CombinationMethod; - /** - * deprecated in 1.26.2 - use weights_for_targets - * - * @deprecated - */ - weights: { - [key: string]: number; - }; - weightsForTargets: WeightsForTarget[]; -} -export interface Targets_WeightsEntry { - key: string; - value: number; -} -export interface Hybrid { - query: string; - properties: string[]; - /** - * protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED - * - * @deprecated - */ - vector: number[]; - alpha: number; - fusionType: Hybrid_FusionType; - vectorBytes: Uint8Array; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - /** targets in msg is ignored and should not be set for hybrid */ - nearText: NearTextSearch | undefined; - /** same as above. Use the target vector in the hybrid message */ - nearVector: NearVector | undefined; - targets: Targets | undefined; - vectorDistance?: number | undefined; -} -export declare enum Hybrid_FusionType { - FUSION_TYPE_UNSPECIFIED = 0, - FUSION_TYPE_RANKED = 1, - FUSION_TYPE_RELATIVE_SCORE = 2, - UNRECOGNIZED = -1, -} -export declare function hybrid_FusionTypeFromJSON(object: any): Hybrid_FusionType; -export declare function hybrid_FusionTypeToJSON(object: Hybrid_FusionType): string; -export interface NearTextSearch { - /** protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED */ - query: string[]; - certainty?: number | undefined; - distance?: number | undefined; - moveTo?: NearTextSearch_Move | undefined; - moveAway?: NearTextSearch_Move | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface NearTextSearch_Move { - force: number; - concepts: string[]; - uuids: string[]; -} -export interface NearImageSearch { - image: string; - certainty?: number | undefined; - distance?: number | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface NearAudioSearch { - audio: string; - certainty?: number | undefined; - distance?: number | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface NearVideoSearch { - video: string; - certainty?: number | undefined; - distance?: number | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface NearDepthSearch { - depth: string; - certainty?: number | undefined; - distance?: number | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface NearThermalSearch { - thermal: string; - certainty?: number | undefined; - distance?: number | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface NearIMUSearch { - imu: string; - certainty?: number | undefined; - distance?: number | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface BM25 { - query: string; - properties: string[]; -} -export interface RefPropertiesRequest { - referenceProperty: string; - properties: PropertiesRequest | undefined; - metadata: MetadataRequest | undefined; - targetCollection: string; -} -export interface VectorForTarget { - name: string; - vectorBytes: Uint8Array; -} -export interface NearVector { - /** - * protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED - * - * @deprecated - */ - vector: number[]; - certainty?: number | undefined; - distance?: number | undefined; - vectorBytes: Uint8Array; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; - /** - * deprecated in 1.26.2 - use vector_for_targets - * - * @deprecated - */ - vectorPerTarget: { - [key: string]: Uint8Array; - }; - vectorForTargets: VectorForTarget[]; -} -export interface NearVector_VectorPerTargetEntry { - key: string; - value: Uint8Array; -} -export interface NearObject { - id: string; - certainty?: number | undefined; - distance?: number | undefined; - /** - * deprecated in 1.26 - use targets - * - * @deprecated - */ - targetVectors: string[]; - targets: Targets | undefined; -} -export interface Rerank { - property: string; - query?: string | undefined; -} -export interface SearchReply { - took: number; - results: SearchResult[]; - /** @deprecated */ - generativeGroupedResult?: string | undefined; - groupByResults: GroupByResult[]; - generativeGroupedResults?: GenerativeResult | undefined; -} -export interface RerankReply { - score: number; -} -export interface GroupByResult { - name: string; - minDistance: number; - maxDistance: number; - numberOfObjects: number; - objects: SearchResult[]; - rerank?: RerankReply | undefined; - /** @deprecated */ - generative?: GenerativeReply | undefined; - generativeResult?: GenerativeResult | undefined; -} -export interface SearchResult { - properties: PropertiesResult | undefined; - metadata: MetadataResult | undefined; - generative?: GenerativeResult | undefined; -} -export interface MetadataResult { - id: string; - /** - * protolint:disable:next REPEATED_FIELD_NAMES_PLURALIZED - * - * @deprecated - */ - vector: number[]; - creationTimeUnix: number; - creationTimeUnixPresent: boolean; - lastUpdateTimeUnix: number; - lastUpdateTimeUnixPresent: boolean; - distance: number; - distancePresent: boolean; - certainty: number; - certaintyPresent: boolean; - score: number; - scorePresent: boolean; - explainScore: string; - explainScorePresent: boolean; - isConsistent?: boolean | undefined; - /** @deprecated */ - generative: string; - /** @deprecated */ - generativePresent: boolean; - isConsistentPresent: boolean; - vectorBytes: Uint8Array; - idAsBytes: Uint8Array; - rerankScore: number; - rerankScorePresent: boolean; - vectors: Vectors[]; -} -export interface PropertiesResult { - /** @deprecated */ - nonRefProperties: - | { - [key: string]: any; - } - | undefined; - refProps: RefPropertiesResult[]; - targetCollection: string; - metadata: MetadataResult | undefined; - /** @deprecated */ - numberArrayProperties: NumberArrayProperties[]; - /** @deprecated */ - intArrayProperties: IntArrayProperties[]; - /** @deprecated */ - textArrayProperties: TextArrayProperties[]; - /** @deprecated */ - booleanArrayProperties: BooleanArrayProperties[]; - /** @deprecated */ - objectProperties: ObjectProperties[]; - /** @deprecated */ - objectArrayProperties: ObjectArrayProperties[]; - nonRefProps: Properties | undefined; - refPropsRequested: boolean; -} -export interface RefPropertiesResult { - properties: PropertiesResult[]; - propName: string; -} -export declare const SearchRequest: { - encode(message: SearchRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): SearchRequest; - fromJSON(object: any): SearchRequest; - toJSON(message: SearchRequest): unknown; - create(base?: DeepPartial): SearchRequest; - fromPartial(object: DeepPartial): SearchRequest; -}; -export declare const GroupBy: { - encode(message: GroupBy, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GroupBy; - fromJSON(object: any): GroupBy; - toJSON(message: GroupBy): unknown; - create(base?: DeepPartial): GroupBy; - fromPartial(object: DeepPartial): GroupBy; -}; -export declare const SortBy: { - encode(message: SortBy, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): SortBy; - fromJSON(object: any): SortBy; - toJSON(message: SortBy): unknown; - create(base?: DeepPartial): SortBy; - fromPartial(object: DeepPartial): SortBy; -}; -export declare const MetadataRequest: { - encode(message: MetadataRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): MetadataRequest; - fromJSON(object: any): MetadataRequest; - toJSON(message: MetadataRequest): unknown; - create(base?: DeepPartial): MetadataRequest; - fromPartial(object: DeepPartial): MetadataRequest; -}; -export declare const PropertiesRequest: { - encode(message: PropertiesRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): PropertiesRequest; - fromJSON(object: any): PropertiesRequest; - toJSON(message: PropertiesRequest): unknown; - create(base?: DeepPartial): PropertiesRequest; - fromPartial(object: DeepPartial): PropertiesRequest; -}; -export declare const ObjectPropertiesRequest: { - encode(message: ObjectPropertiesRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): ObjectPropertiesRequest; - fromJSON(object: any): ObjectPropertiesRequest; - toJSON(message: ObjectPropertiesRequest): unknown; - create(base?: DeepPartial): ObjectPropertiesRequest; - fromPartial(object: DeepPartial): ObjectPropertiesRequest; -}; -export declare const WeightsForTarget: { - encode(message: WeightsForTarget, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): WeightsForTarget; - fromJSON(object: any): WeightsForTarget; - toJSON(message: WeightsForTarget): unknown; - create(base?: DeepPartial): WeightsForTarget; - fromPartial(object: DeepPartial): WeightsForTarget; -}; -export declare const Targets: { - encode(message: Targets, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Targets; - fromJSON(object: any): Targets; - toJSON(message: Targets): unknown; - create(base?: DeepPartial): Targets; - fromPartial(object: DeepPartial): Targets; -}; -export declare const Targets_WeightsEntry: { - encode(message: Targets_WeightsEntry, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Targets_WeightsEntry; - fromJSON(object: any): Targets_WeightsEntry; - toJSON(message: Targets_WeightsEntry): unknown; - create(base?: DeepPartial): Targets_WeightsEntry; - fromPartial(object: DeepPartial): Targets_WeightsEntry; -}; -export declare const Hybrid: { - encode(message: Hybrid, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Hybrid; - fromJSON(object: any): Hybrid; - toJSON(message: Hybrid): unknown; - create(base?: DeepPartial): Hybrid; - fromPartial(object: DeepPartial): Hybrid; -}; -export declare const NearTextSearch: { - encode(message: NearTextSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearTextSearch; - fromJSON(object: any): NearTextSearch; - toJSON(message: NearTextSearch): unknown; - create(base?: DeepPartial): NearTextSearch; - fromPartial(object: DeepPartial): NearTextSearch; -}; -export declare const NearTextSearch_Move: { - encode(message: NearTextSearch_Move, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearTextSearch_Move; - fromJSON(object: any): NearTextSearch_Move; - toJSON(message: NearTextSearch_Move): unknown; - create(base?: DeepPartial): NearTextSearch_Move; - fromPartial(object: DeepPartial): NearTextSearch_Move; -}; -export declare const NearImageSearch: { - encode(message: NearImageSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearImageSearch; - fromJSON(object: any): NearImageSearch; - toJSON(message: NearImageSearch): unknown; - create(base?: DeepPartial): NearImageSearch; - fromPartial(object: DeepPartial): NearImageSearch; -}; -export declare const NearAudioSearch: { - encode(message: NearAudioSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearAudioSearch; - fromJSON(object: any): NearAudioSearch; - toJSON(message: NearAudioSearch): unknown; - create(base?: DeepPartial): NearAudioSearch; - fromPartial(object: DeepPartial): NearAudioSearch; -}; -export declare const NearVideoSearch: { - encode(message: NearVideoSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearVideoSearch; - fromJSON(object: any): NearVideoSearch; - toJSON(message: NearVideoSearch): unknown; - create(base?: DeepPartial): NearVideoSearch; - fromPartial(object: DeepPartial): NearVideoSearch; -}; -export declare const NearDepthSearch: { - encode(message: NearDepthSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearDepthSearch; - fromJSON(object: any): NearDepthSearch; - toJSON(message: NearDepthSearch): unknown; - create(base?: DeepPartial): NearDepthSearch; - fromPartial(object: DeepPartial): NearDepthSearch; -}; -export declare const NearThermalSearch: { - encode(message: NearThermalSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearThermalSearch; - fromJSON(object: any): NearThermalSearch; - toJSON(message: NearThermalSearch): unknown; - create(base?: DeepPartial): NearThermalSearch; - fromPartial(object: DeepPartial): NearThermalSearch; -}; -export declare const NearIMUSearch: { - encode(message: NearIMUSearch, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearIMUSearch; - fromJSON(object: any): NearIMUSearch; - toJSON(message: NearIMUSearch): unknown; - create(base?: DeepPartial): NearIMUSearch; - fromPartial(object: DeepPartial): NearIMUSearch; -}; -export declare const BM25: { - encode(message: BM25, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): BM25; - fromJSON(object: any): BM25; - toJSON(message: BM25): unknown; - create(base?: DeepPartial): BM25; - fromPartial(object: DeepPartial): BM25; -}; -export declare const RefPropertiesRequest: { - encode(message: RefPropertiesRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): RefPropertiesRequest; - fromJSON(object: any): RefPropertiesRequest; - toJSON(message: RefPropertiesRequest): unknown; - create(base?: DeepPartial): RefPropertiesRequest; - fromPartial(object: DeepPartial): RefPropertiesRequest; -}; -export declare const VectorForTarget: { - encode(message: VectorForTarget, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): VectorForTarget; - fromJSON(object: any): VectorForTarget; - toJSON(message: VectorForTarget): unknown; - create(base?: DeepPartial): VectorForTarget; - fromPartial(object: DeepPartial): VectorForTarget; -}; -export declare const NearVector: { - encode(message: NearVector, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearVector; - fromJSON(object: any): NearVector; - toJSON(message: NearVector): unknown; - create(base?: DeepPartial): NearVector; - fromPartial(object: DeepPartial): NearVector; -}; -export declare const NearVector_VectorPerTargetEntry: { - encode(message: NearVector_VectorPerTargetEntry, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearVector_VectorPerTargetEntry; - fromJSON(object: any): NearVector_VectorPerTargetEntry; - toJSON(message: NearVector_VectorPerTargetEntry): unknown; - create(base?: DeepPartial): NearVector_VectorPerTargetEntry; - fromPartial(object: DeepPartial): NearVector_VectorPerTargetEntry; -}; -export declare const NearObject: { - encode(message: NearObject, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): NearObject; - fromJSON(object: any): NearObject; - toJSON(message: NearObject): unknown; - create(base?: DeepPartial): NearObject; - fromPartial(object: DeepPartial): NearObject; -}; -export declare const Rerank: { - encode(message: Rerank, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Rerank; - fromJSON(object: any): Rerank; - toJSON(message: Rerank): unknown; - create(base?: DeepPartial): Rerank; - fromPartial(object: DeepPartial): Rerank; -}; -export declare const SearchReply: { - encode(message: SearchReply, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): SearchReply; - fromJSON(object: any): SearchReply; - toJSON(message: SearchReply): unknown; - create(base?: DeepPartial): SearchReply; - fromPartial(object: DeepPartial): SearchReply; -}; -export declare const RerankReply: { - encode(message: RerankReply, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): RerankReply; - fromJSON(object: any): RerankReply; - toJSON(message: RerankReply): unknown; - create(base?: DeepPartial): RerankReply; - fromPartial(object: DeepPartial): RerankReply; -}; -export declare const GroupByResult: { - encode(message: GroupByResult, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): GroupByResult; - fromJSON(object: any): GroupByResult; - toJSON(message: GroupByResult): unknown; - create(base?: DeepPartial): GroupByResult; - fromPartial(object: DeepPartial): GroupByResult; -}; -export declare const SearchResult: { - encode(message: SearchResult, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): SearchResult; - fromJSON(object: any): SearchResult; - toJSON(message: SearchResult): unknown; - create(base?: DeepPartial): SearchResult; - fromPartial(object: DeepPartial): SearchResult; -}; -export declare const MetadataResult: { - encode(message: MetadataResult, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): MetadataResult; - fromJSON(object: any): MetadataResult; - toJSON(message: MetadataResult): unknown; - create(base?: DeepPartial): MetadataResult; - fromPartial(object: DeepPartial): MetadataResult; -}; -export declare const PropertiesResult: { - encode(message: PropertiesResult, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): PropertiesResult; - fromJSON(object: any): PropertiesResult; - toJSON(message: PropertiesResult): unknown; - create(base?: DeepPartial): PropertiesResult; - fromPartial(object: DeepPartial): PropertiesResult; -}; -export declare const RefPropertiesResult: { - encode(message: RefPropertiesResult, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): RefPropertiesResult; - fromJSON(object: any): RefPropertiesResult; - toJSON(message: RefPropertiesResult): unknown; - create(base?: DeepPartial): RefPropertiesResult; - fromPartial(object: DeepPartial): RefPropertiesResult; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/esm/proto/v1/search_get.js b/dist/node/esm/proto/v1/search_get.js deleted file mode 100644 index a608b2af..00000000 --- a/dist/node/esm/proto/v1/search_get.js +++ /dev/null @@ -1,4607 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/search_get.proto -/* eslint-disable */ -import Long from 'long'; -import _m0 from 'protobufjs/minimal.js'; -import { Struct } from '../google/protobuf/struct.js'; -import { - BooleanArrayProperties, - consistencyLevelFromJSON, - consistencyLevelToJSON, - Filters, - IntArrayProperties, - NumberArrayProperties, - ObjectArrayProperties, - ObjectProperties, - TextArrayProperties, - Vectors, -} from './base.js'; -import { GenerativeReply, GenerativeResult, GenerativeSearch } from './generative.js'; -import { Properties } from './properties.js'; -export const protobufPackage = 'weaviate.v1'; -export var CombinationMethod; -(function (CombinationMethod) { - CombinationMethod[(CombinationMethod['COMBINATION_METHOD_UNSPECIFIED'] = 0)] = - 'COMBINATION_METHOD_UNSPECIFIED'; - CombinationMethod[(CombinationMethod['COMBINATION_METHOD_TYPE_SUM'] = 1)] = 'COMBINATION_METHOD_TYPE_SUM'; - CombinationMethod[(CombinationMethod['COMBINATION_METHOD_TYPE_MIN'] = 2)] = 'COMBINATION_METHOD_TYPE_MIN'; - CombinationMethod[(CombinationMethod['COMBINATION_METHOD_TYPE_AVERAGE'] = 3)] = - 'COMBINATION_METHOD_TYPE_AVERAGE'; - CombinationMethod[(CombinationMethod['COMBINATION_METHOD_TYPE_RELATIVE_SCORE'] = 4)] = - 'COMBINATION_METHOD_TYPE_RELATIVE_SCORE'; - CombinationMethod[(CombinationMethod['COMBINATION_METHOD_TYPE_MANUAL'] = 5)] = - 'COMBINATION_METHOD_TYPE_MANUAL'; - CombinationMethod[(CombinationMethod['UNRECOGNIZED'] = -1)] = 'UNRECOGNIZED'; -})(CombinationMethod || (CombinationMethod = {})); -export function combinationMethodFromJSON(object) { - switch (object) { - case 0: - case 'COMBINATION_METHOD_UNSPECIFIED': - return CombinationMethod.COMBINATION_METHOD_UNSPECIFIED; - case 1: - case 'COMBINATION_METHOD_TYPE_SUM': - return CombinationMethod.COMBINATION_METHOD_TYPE_SUM; - case 2: - case 'COMBINATION_METHOD_TYPE_MIN': - return CombinationMethod.COMBINATION_METHOD_TYPE_MIN; - case 3: - case 'COMBINATION_METHOD_TYPE_AVERAGE': - return CombinationMethod.COMBINATION_METHOD_TYPE_AVERAGE; - case 4: - case 'COMBINATION_METHOD_TYPE_RELATIVE_SCORE': - return CombinationMethod.COMBINATION_METHOD_TYPE_RELATIVE_SCORE; - case 5: - case 'COMBINATION_METHOD_TYPE_MANUAL': - return CombinationMethod.COMBINATION_METHOD_TYPE_MANUAL; - case -1: - case 'UNRECOGNIZED': - default: - return CombinationMethod.UNRECOGNIZED; - } -} -export function combinationMethodToJSON(object) { - switch (object) { - case CombinationMethod.COMBINATION_METHOD_UNSPECIFIED: - return 'COMBINATION_METHOD_UNSPECIFIED'; - case CombinationMethod.COMBINATION_METHOD_TYPE_SUM: - return 'COMBINATION_METHOD_TYPE_SUM'; - case CombinationMethod.COMBINATION_METHOD_TYPE_MIN: - return 'COMBINATION_METHOD_TYPE_MIN'; - case CombinationMethod.COMBINATION_METHOD_TYPE_AVERAGE: - return 'COMBINATION_METHOD_TYPE_AVERAGE'; - case CombinationMethod.COMBINATION_METHOD_TYPE_RELATIVE_SCORE: - return 'COMBINATION_METHOD_TYPE_RELATIVE_SCORE'; - case CombinationMethod.COMBINATION_METHOD_TYPE_MANUAL: - return 'COMBINATION_METHOD_TYPE_MANUAL'; - case CombinationMethod.UNRECOGNIZED: - default: - return 'UNRECOGNIZED'; - } -} -export var Hybrid_FusionType; -(function (Hybrid_FusionType) { - Hybrid_FusionType[(Hybrid_FusionType['FUSION_TYPE_UNSPECIFIED'] = 0)] = 'FUSION_TYPE_UNSPECIFIED'; - Hybrid_FusionType[(Hybrid_FusionType['FUSION_TYPE_RANKED'] = 1)] = 'FUSION_TYPE_RANKED'; - Hybrid_FusionType[(Hybrid_FusionType['FUSION_TYPE_RELATIVE_SCORE'] = 2)] = 'FUSION_TYPE_RELATIVE_SCORE'; - Hybrid_FusionType[(Hybrid_FusionType['UNRECOGNIZED'] = -1)] = 'UNRECOGNIZED'; -})(Hybrid_FusionType || (Hybrid_FusionType = {})); -export function hybrid_FusionTypeFromJSON(object) { - switch (object) { - case 0: - case 'FUSION_TYPE_UNSPECIFIED': - return Hybrid_FusionType.FUSION_TYPE_UNSPECIFIED; - case 1: - case 'FUSION_TYPE_RANKED': - return Hybrid_FusionType.FUSION_TYPE_RANKED; - case 2: - case 'FUSION_TYPE_RELATIVE_SCORE': - return Hybrid_FusionType.FUSION_TYPE_RELATIVE_SCORE; - case -1: - case 'UNRECOGNIZED': - default: - return Hybrid_FusionType.UNRECOGNIZED; - } -} -export function hybrid_FusionTypeToJSON(object) { - switch (object) { - case Hybrid_FusionType.FUSION_TYPE_UNSPECIFIED: - return 'FUSION_TYPE_UNSPECIFIED'; - case Hybrid_FusionType.FUSION_TYPE_RANKED: - return 'FUSION_TYPE_RANKED'; - case Hybrid_FusionType.FUSION_TYPE_RELATIVE_SCORE: - return 'FUSION_TYPE_RELATIVE_SCORE'; - case Hybrid_FusionType.UNRECOGNIZED: - default: - return 'UNRECOGNIZED'; - } -} -function createBaseSearchRequest() { - return { - collection: '', - tenant: '', - consistencyLevel: undefined, - properties: undefined, - metadata: undefined, - groupBy: undefined, - limit: 0, - offset: 0, - autocut: 0, - after: '', - sortBy: [], - filters: undefined, - hybridSearch: undefined, - bm25Search: undefined, - nearVector: undefined, - nearObject: undefined, - nearText: undefined, - nearImage: undefined, - nearAudio: undefined, - nearVideo: undefined, - nearDepth: undefined, - nearThermal: undefined, - nearImu: undefined, - generative: undefined, - rerank: undefined, - uses123Api: false, - uses125Api: false, - uses127Api: false, - }; -} -export const SearchRequest = { - encode(message, writer = _m0.Writer.create()) { - if (message.collection !== '') { - writer.uint32(10).string(message.collection); - } - if (message.tenant !== '') { - writer.uint32(82).string(message.tenant); - } - if (message.consistencyLevel !== undefined) { - writer.uint32(88).int32(message.consistencyLevel); - } - if (message.properties !== undefined) { - PropertiesRequest.encode(message.properties, writer.uint32(162).fork()).ldelim(); - } - if (message.metadata !== undefined) { - MetadataRequest.encode(message.metadata, writer.uint32(170).fork()).ldelim(); - } - if (message.groupBy !== undefined) { - GroupBy.encode(message.groupBy, writer.uint32(178).fork()).ldelim(); - } - if (message.limit !== 0) { - writer.uint32(240).uint32(message.limit); - } - if (message.offset !== 0) { - writer.uint32(248).uint32(message.offset); - } - if (message.autocut !== 0) { - writer.uint32(256).uint32(message.autocut); - } - if (message.after !== '') { - writer.uint32(266).string(message.after); - } - for (const v of message.sortBy) { - SortBy.encode(v, writer.uint32(274).fork()).ldelim(); - } - if (message.filters !== undefined) { - Filters.encode(message.filters, writer.uint32(322).fork()).ldelim(); - } - if (message.hybridSearch !== undefined) { - Hybrid.encode(message.hybridSearch, writer.uint32(330).fork()).ldelim(); - } - if (message.bm25Search !== undefined) { - BM25.encode(message.bm25Search, writer.uint32(338).fork()).ldelim(); - } - if (message.nearVector !== undefined) { - NearVector.encode(message.nearVector, writer.uint32(346).fork()).ldelim(); - } - if (message.nearObject !== undefined) { - NearObject.encode(message.nearObject, writer.uint32(354).fork()).ldelim(); - } - if (message.nearText !== undefined) { - NearTextSearch.encode(message.nearText, writer.uint32(362).fork()).ldelim(); - } - if (message.nearImage !== undefined) { - NearImageSearch.encode(message.nearImage, writer.uint32(370).fork()).ldelim(); - } - if (message.nearAudio !== undefined) { - NearAudioSearch.encode(message.nearAudio, writer.uint32(378).fork()).ldelim(); - } - if (message.nearVideo !== undefined) { - NearVideoSearch.encode(message.nearVideo, writer.uint32(386).fork()).ldelim(); - } - if (message.nearDepth !== undefined) { - NearDepthSearch.encode(message.nearDepth, writer.uint32(394).fork()).ldelim(); - } - if (message.nearThermal !== undefined) { - NearThermalSearch.encode(message.nearThermal, writer.uint32(402).fork()).ldelim(); - } - if (message.nearImu !== undefined) { - NearIMUSearch.encode(message.nearImu, writer.uint32(410).fork()).ldelim(); - } - if (message.generative !== undefined) { - GenerativeSearch.encode(message.generative, writer.uint32(482).fork()).ldelim(); - } - if (message.rerank !== undefined) { - Rerank.encode(message.rerank, writer.uint32(490).fork()).ldelim(); - } - if (message.uses123Api !== false) { - writer.uint32(800).bool(message.uses123Api); - } - if (message.uses125Api !== false) { - writer.uint32(808).bool(message.uses125Api); - } - if (message.uses127Api !== false) { - writer.uint32(816).bool(message.uses127Api); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSearchRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.collection = reader.string(); - continue; - case 10: - if (tag !== 82) { - break; - } - message.tenant = reader.string(); - continue; - case 11: - if (tag !== 88) { - break; - } - message.consistencyLevel = reader.int32(); - continue; - case 20: - if (tag !== 162) { - break; - } - message.properties = PropertiesRequest.decode(reader, reader.uint32()); - continue; - case 21: - if (tag !== 170) { - break; - } - message.metadata = MetadataRequest.decode(reader, reader.uint32()); - continue; - case 22: - if (tag !== 178) { - break; - } - message.groupBy = GroupBy.decode(reader, reader.uint32()); - continue; - case 30: - if (tag !== 240) { - break; - } - message.limit = reader.uint32(); - continue; - case 31: - if (tag !== 248) { - break; - } - message.offset = reader.uint32(); - continue; - case 32: - if (tag !== 256) { - break; - } - message.autocut = reader.uint32(); - continue; - case 33: - if (tag !== 266) { - break; - } - message.after = reader.string(); - continue; - case 34: - if (tag !== 274) { - break; - } - message.sortBy.push(SortBy.decode(reader, reader.uint32())); - continue; - case 40: - if (tag !== 322) { - break; - } - message.filters = Filters.decode(reader, reader.uint32()); - continue; - case 41: - if (tag !== 330) { - break; - } - message.hybridSearch = Hybrid.decode(reader, reader.uint32()); - continue; - case 42: - if (tag !== 338) { - break; - } - message.bm25Search = BM25.decode(reader, reader.uint32()); - continue; - case 43: - if (tag !== 346) { - break; - } - message.nearVector = NearVector.decode(reader, reader.uint32()); - continue; - case 44: - if (tag !== 354) { - break; - } - message.nearObject = NearObject.decode(reader, reader.uint32()); - continue; - case 45: - if (tag !== 362) { - break; - } - message.nearText = NearTextSearch.decode(reader, reader.uint32()); - continue; - case 46: - if (tag !== 370) { - break; - } - message.nearImage = NearImageSearch.decode(reader, reader.uint32()); - continue; - case 47: - if (tag !== 378) { - break; - } - message.nearAudio = NearAudioSearch.decode(reader, reader.uint32()); - continue; - case 48: - if (tag !== 386) { - break; - } - message.nearVideo = NearVideoSearch.decode(reader, reader.uint32()); - continue; - case 49: - if (tag !== 394) { - break; - } - message.nearDepth = NearDepthSearch.decode(reader, reader.uint32()); - continue; - case 50: - if (tag !== 402) { - break; - } - message.nearThermal = NearThermalSearch.decode(reader, reader.uint32()); - continue; - case 51: - if (tag !== 410) { - break; - } - message.nearImu = NearIMUSearch.decode(reader, reader.uint32()); - continue; - case 60: - if (tag !== 482) { - break; - } - message.generative = GenerativeSearch.decode(reader, reader.uint32()); - continue; - case 61: - if (tag !== 490) { - break; - } - message.rerank = Rerank.decode(reader, reader.uint32()); - continue; - case 100: - if (tag !== 800) { - break; - } - message.uses123Api = reader.bool(); - continue; - case 101: - if (tag !== 808) { - break; - } - message.uses125Api = reader.bool(); - continue; - case 102: - if (tag !== 816) { - break; - } - message.uses127Api = reader.bool(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - collection: isSet(object.collection) ? globalThis.String(object.collection) : '', - tenant: isSet(object.tenant) ? globalThis.String(object.tenant) : '', - consistencyLevel: isSet(object.consistencyLevel) - ? consistencyLevelFromJSON(object.consistencyLevel) - : undefined, - properties: isSet(object.properties) ? PropertiesRequest.fromJSON(object.properties) : undefined, - metadata: isSet(object.metadata) ? MetadataRequest.fromJSON(object.metadata) : undefined, - groupBy: isSet(object.groupBy) ? GroupBy.fromJSON(object.groupBy) : undefined, - limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0, - offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0, - autocut: isSet(object.autocut) ? globalThis.Number(object.autocut) : 0, - after: isSet(object.after) ? globalThis.String(object.after) : '', - sortBy: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sortBy) - ? object.sortBy.map((e) => SortBy.fromJSON(e)) - : [], - filters: isSet(object.filters) ? Filters.fromJSON(object.filters) : undefined, - hybridSearch: isSet(object.hybridSearch) ? Hybrid.fromJSON(object.hybridSearch) : undefined, - bm25Search: isSet(object.bm25Search) ? BM25.fromJSON(object.bm25Search) : undefined, - nearVector: isSet(object.nearVector) ? NearVector.fromJSON(object.nearVector) : undefined, - nearObject: isSet(object.nearObject) ? NearObject.fromJSON(object.nearObject) : undefined, - nearText: isSet(object.nearText) ? NearTextSearch.fromJSON(object.nearText) : undefined, - nearImage: isSet(object.nearImage) ? NearImageSearch.fromJSON(object.nearImage) : undefined, - nearAudio: isSet(object.nearAudio) ? NearAudioSearch.fromJSON(object.nearAudio) : undefined, - nearVideo: isSet(object.nearVideo) ? NearVideoSearch.fromJSON(object.nearVideo) : undefined, - nearDepth: isSet(object.nearDepth) ? NearDepthSearch.fromJSON(object.nearDepth) : undefined, - nearThermal: isSet(object.nearThermal) ? NearThermalSearch.fromJSON(object.nearThermal) : undefined, - nearImu: isSet(object.nearImu) ? NearIMUSearch.fromJSON(object.nearImu) : undefined, - generative: isSet(object.generative) ? GenerativeSearch.fromJSON(object.generative) : undefined, - rerank: isSet(object.rerank) ? Rerank.fromJSON(object.rerank) : undefined, - uses123Api: isSet(object.uses123Api) ? globalThis.Boolean(object.uses123Api) : false, - uses125Api: isSet(object.uses125Api) ? globalThis.Boolean(object.uses125Api) : false, - uses127Api: isSet(object.uses127Api) ? globalThis.Boolean(object.uses127Api) : false, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.collection !== '') { - obj.collection = message.collection; - } - if (message.tenant !== '') { - obj.tenant = message.tenant; - } - if (message.consistencyLevel !== undefined) { - obj.consistencyLevel = consistencyLevelToJSON(message.consistencyLevel); - } - if (message.properties !== undefined) { - obj.properties = PropertiesRequest.toJSON(message.properties); - } - if (message.metadata !== undefined) { - obj.metadata = MetadataRequest.toJSON(message.metadata); - } - if (message.groupBy !== undefined) { - obj.groupBy = GroupBy.toJSON(message.groupBy); - } - if (message.limit !== 0) { - obj.limit = Math.round(message.limit); - } - if (message.offset !== 0) { - obj.offset = Math.round(message.offset); - } - if (message.autocut !== 0) { - obj.autocut = Math.round(message.autocut); - } - if (message.after !== '') { - obj.after = message.after; - } - if ((_a = message.sortBy) === null || _a === void 0 ? void 0 : _a.length) { - obj.sortBy = message.sortBy.map((e) => SortBy.toJSON(e)); - } - if (message.filters !== undefined) { - obj.filters = Filters.toJSON(message.filters); - } - if (message.hybridSearch !== undefined) { - obj.hybridSearch = Hybrid.toJSON(message.hybridSearch); - } - if (message.bm25Search !== undefined) { - obj.bm25Search = BM25.toJSON(message.bm25Search); - } - if (message.nearVector !== undefined) { - obj.nearVector = NearVector.toJSON(message.nearVector); - } - if (message.nearObject !== undefined) { - obj.nearObject = NearObject.toJSON(message.nearObject); - } - if (message.nearText !== undefined) { - obj.nearText = NearTextSearch.toJSON(message.nearText); - } - if (message.nearImage !== undefined) { - obj.nearImage = NearImageSearch.toJSON(message.nearImage); - } - if (message.nearAudio !== undefined) { - obj.nearAudio = NearAudioSearch.toJSON(message.nearAudio); - } - if (message.nearVideo !== undefined) { - obj.nearVideo = NearVideoSearch.toJSON(message.nearVideo); - } - if (message.nearDepth !== undefined) { - obj.nearDepth = NearDepthSearch.toJSON(message.nearDepth); - } - if (message.nearThermal !== undefined) { - obj.nearThermal = NearThermalSearch.toJSON(message.nearThermal); - } - if (message.nearImu !== undefined) { - obj.nearImu = NearIMUSearch.toJSON(message.nearImu); - } - if (message.generative !== undefined) { - obj.generative = GenerativeSearch.toJSON(message.generative); - } - if (message.rerank !== undefined) { - obj.rerank = Rerank.toJSON(message.rerank); - } - if (message.uses123Api !== false) { - obj.uses123Api = message.uses123Api; - } - if (message.uses125Api !== false) { - obj.uses125Api = message.uses125Api; - } - if (message.uses127Api !== false) { - obj.uses127Api = message.uses127Api; - } - return obj; - }, - create(base) { - return SearchRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; - const message = createBaseSearchRequest(); - message.collection = (_a = object.collection) !== null && _a !== void 0 ? _a : ''; - message.tenant = (_b = object.tenant) !== null && _b !== void 0 ? _b : ''; - message.consistencyLevel = (_c = object.consistencyLevel) !== null && _c !== void 0 ? _c : undefined; - message.properties = - object.properties !== undefined && object.properties !== null - ? PropertiesRequest.fromPartial(object.properties) - : undefined; - message.metadata = - object.metadata !== undefined && object.metadata !== null - ? MetadataRequest.fromPartial(object.metadata) - : undefined; - message.groupBy = - object.groupBy !== undefined && object.groupBy !== null - ? GroupBy.fromPartial(object.groupBy) - : undefined; - message.limit = (_d = object.limit) !== null && _d !== void 0 ? _d : 0; - message.offset = (_e = object.offset) !== null && _e !== void 0 ? _e : 0; - message.autocut = (_f = object.autocut) !== null && _f !== void 0 ? _f : 0; - message.after = (_g = object.after) !== null && _g !== void 0 ? _g : ''; - message.sortBy = - ((_h = object.sortBy) === null || _h === void 0 ? void 0 : _h.map((e) => SortBy.fromPartial(e))) || []; - message.filters = - object.filters !== undefined && object.filters !== null - ? Filters.fromPartial(object.filters) - : undefined; - message.hybridSearch = - object.hybridSearch !== undefined && object.hybridSearch !== null - ? Hybrid.fromPartial(object.hybridSearch) - : undefined; - message.bm25Search = - object.bm25Search !== undefined && object.bm25Search !== null - ? BM25.fromPartial(object.bm25Search) - : undefined; - message.nearVector = - object.nearVector !== undefined && object.nearVector !== null - ? NearVector.fromPartial(object.nearVector) - : undefined; - message.nearObject = - object.nearObject !== undefined && object.nearObject !== null - ? NearObject.fromPartial(object.nearObject) - : undefined; - message.nearText = - object.nearText !== undefined && object.nearText !== null - ? NearTextSearch.fromPartial(object.nearText) - : undefined; - message.nearImage = - object.nearImage !== undefined && object.nearImage !== null - ? NearImageSearch.fromPartial(object.nearImage) - : undefined; - message.nearAudio = - object.nearAudio !== undefined && object.nearAudio !== null - ? NearAudioSearch.fromPartial(object.nearAudio) - : undefined; - message.nearVideo = - object.nearVideo !== undefined && object.nearVideo !== null - ? NearVideoSearch.fromPartial(object.nearVideo) - : undefined; - message.nearDepth = - object.nearDepth !== undefined && object.nearDepth !== null - ? NearDepthSearch.fromPartial(object.nearDepth) - : undefined; - message.nearThermal = - object.nearThermal !== undefined && object.nearThermal !== null - ? NearThermalSearch.fromPartial(object.nearThermal) - : undefined; - message.nearImu = - object.nearImu !== undefined && object.nearImu !== null - ? NearIMUSearch.fromPartial(object.nearImu) - : undefined; - message.generative = - object.generative !== undefined && object.generative !== null - ? GenerativeSearch.fromPartial(object.generative) - : undefined; - message.rerank = - object.rerank !== undefined && object.rerank !== null ? Rerank.fromPartial(object.rerank) : undefined; - message.uses123Api = (_j = object.uses123Api) !== null && _j !== void 0 ? _j : false; - message.uses125Api = (_k = object.uses125Api) !== null && _k !== void 0 ? _k : false; - message.uses127Api = (_l = object.uses127Api) !== null && _l !== void 0 ? _l : false; - return message; - }, -}; -function createBaseGroupBy() { - return { path: [], numberOfGroups: 0, objectsPerGroup: 0 }; -} -export const GroupBy = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.path) { - writer.uint32(10).string(v); - } - if (message.numberOfGroups !== 0) { - writer.uint32(16).int32(message.numberOfGroups); - } - if (message.objectsPerGroup !== 0) { - writer.uint32(24).int32(message.objectsPerGroup); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGroupBy(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.path.push(reader.string()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.numberOfGroups = reader.int32(); - continue; - case 3: - if (tag !== 24) { - break; - } - message.objectsPerGroup = reader.int32(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - path: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.path) - ? object.path.map((e) => globalThis.String(e)) - : [], - numberOfGroups: isSet(object.numberOfGroups) ? globalThis.Number(object.numberOfGroups) : 0, - objectsPerGroup: isSet(object.objectsPerGroup) ? globalThis.Number(object.objectsPerGroup) : 0, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.path) === null || _a === void 0 ? void 0 : _a.length) { - obj.path = message.path; - } - if (message.numberOfGroups !== 0) { - obj.numberOfGroups = Math.round(message.numberOfGroups); - } - if (message.objectsPerGroup !== 0) { - obj.objectsPerGroup = Math.round(message.objectsPerGroup); - } - return obj; - }, - create(base) { - return GroupBy.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseGroupBy(); - message.path = ((_a = object.path) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.numberOfGroups = (_b = object.numberOfGroups) !== null && _b !== void 0 ? _b : 0; - message.objectsPerGroup = (_c = object.objectsPerGroup) !== null && _c !== void 0 ? _c : 0; - return message; - }, -}; -function createBaseSortBy() { - return { ascending: false, path: [] }; -} -export const SortBy = { - encode(message, writer = _m0.Writer.create()) { - if (message.ascending !== false) { - writer.uint32(8).bool(message.ascending); - } - for (const v of message.path) { - writer.uint32(18).string(v); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSortBy(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.ascending = reader.bool(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.path.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - ascending: isSet(object.ascending) ? globalThis.Boolean(object.ascending) : false, - path: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.path) - ? object.path.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.ascending !== false) { - obj.ascending = message.ascending; - } - if ((_a = message.path) === null || _a === void 0 ? void 0 : _a.length) { - obj.path = message.path; - } - return obj; - }, - create(base) { - return SortBy.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseSortBy(); - message.ascending = (_a = object.ascending) !== null && _a !== void 0 ? _a : false; - message.path = ((_b = object.path) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - return message; - }, -}; -function createBaseMetadataRequest() { - return { - uuid: false, - vector: false, - creationTimeUnix: false, - lastUpdateTimeUnix: false, - distance: false, - certainty: false, - score: false, - explainScore: false, - isConsistent: false, - vectors: [], - }; -} -export const MetadataRequest = { - encode(message, writer = _m0.Writer.create()) { - if (message.uuid !== false) { - writer.uint32(8).bool(message.uuid); - } - if (message.vector !== false) { - writer.uint32(16).bool(message.vector); - } - if (message.creationTimeUnix !== false) { - writer.uint32(24).bool(message.creationTimeUnix); - } - if (message.lastUpdateTimeUnix !== false) { - writer.uint32(32).bool(message.lastUpdateTimeUnix); - } - if (message.distance !== false) { - writer.uint32(40).bool(message.distance); - } - if (message.certainty !== false) { - writer.uint32(48).bool(message.certainty); - } - if (message.score !== false) { - writer.uint32(56).bool(message.score); - } - if (message.explainScore !== false) { - writer.uint32(64).bool(message.explainScore); - } - if (message.isConsistent !== false) { - writer.uint32(72).bool(message.isConsistent); - } - for (const v of message.vectors) { - writer.uint32(82).string(v); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMetadataRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 8) { - break; - } - message.uuid = reader.bool(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.vector = reader.bool(); - continue; - case 3: - if (tag !== 24) { - break; - } - message.creationTimeUnix = reader.bool(); - continue; - case 4: - if (tag !== 32) { - break; - } - message.lastUpdateTimeUnix = reader.bool(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.distance = reader.bool(); - continue; - case 6: - if (tag !== 48) { - break; - } - message.certainty = reader.bool(); - continue; - case 7: - if (tag !== 56) { - break; - } - message.score = reader.bool(); - continue; - case 8: - if (tag !== 64) { - break; - } - message.explainScore = reader.bool(); - continue; - case 9: - if (tag !== 72) { - break; - } - message.isConsistent = reader.bool(); - continue; - case 10: - if (tag !== 82) { - break; - } - message.vectors.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - uuid: isSet(object.uuid) ? globalThis.Boolean(object.uuid) : false, - vector: isSet(object.vector) ? globalThis.Boolean(object.vector) : false, - creationTimeUnix: isSet(object.creationTimeUnix) ? globalThis.Boolean(object.creationTimeUnix) : false, - lastUpdateTimeUnix: isSet(object.lastUpdateTimeUnix) - ? globalThis.Boolean(object.lastUpdateTimeUnix) - : false, - distance: isSet(object.distance) ? globalThis.Boolean(object.distance) : false, - certainty: isSet(object.certainty) ? globalThis.Boolean(object.certainty) : false, - score: isSet(object.score) ? globalThis.Boolean(object.score) : false, - explainScore: isSet(object.explainScore) ? globalThis.Boolean(object.explainScore) : false, - isConsistent: isSet(object.isConsistent) ? globalThis.Boolean(object.isConsistent) : false, - vectors: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.vectors) - ? object.vectors.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.uuid !== false) { - obj.uuid = message.uuid; - } - if (message.vector !== false) { - obj.vector = message.vector; - } - if (message.creationTimeUnix !== false) { - obj.creationTimeUnix = message.creationTimeUnix; - } - if (message.lastUpdateTimeUnix !== false) { - obj.lastUpdateTimeUnix = message.lastUpdateTimeUnix; - } - if (message.distance !== false) { - obj.distance = message.distance; - } - if (message.certainty !== false) { - obj.certainty = message.certainty; - } - if (message.score !== false) { - obj.score = message.score; - } - if (message.explainScore !== false) { - obj.explainScore = message.explainScore; - } - if (message.isConsistent !== false) { - obj.isConsistent = message.isConsistent; - } - if ((_a = message.vectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.vectors = message.vectors; - } - return obj; - }, - create(base) { - return MetadataRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - const message = createBaseMetadataRequest(); - message.uuid = (_a = object.uuid) !== null && _a !== void 0 ? _a : false; - message.vector = (_b = object.vector) !== null && _b !== void 0 ? _b : false; - message.creationTimeUnix = (_c = object.creationTimeUnix) !== null && _c !== void 0 ? _c : false; - message.lastUpdateTimeUnix = (_d = object.lastUpdateTimeUnix) !== null && _d !== void 0 ? _d : false; - message.distance = (_e = object.distance) !== null && _e !== void 0 ? _e : false; - message.certainty = (_f = object.certainty) !== null && _f !== void 0 ? _f : false; - message.score = (_g = object.score) !== null && _g !== void 0 ? _g : false; - message.explainScore = (_h = object.explainScore) !== null && _h !== void 0 ? _h : false; - message.isConsistent = (_j = object.isConsistent) !== null && _j !== void 0 ? _j : false; - message.vectors = ((_k = object.vectors) === null || _k === void 0 ? void 0 : _k.map((e) => e)) || []; - return message; - }, -}; -function createBasePropertiesRequest() { - return { nonRefProperties: [], refProperties: [], objectProperties: [], returnAllNonrefProperties: false }; -} -export const PropertiesRequest = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.nonRefProperties) { - writer.uint32(10).string(v); - } - for (const v of message.refProperties) { - RefPropertiesRequest.encode(v, writer.uint32(18).fork()).ldelim(); - } - for (const v of message.objectProperties) { - ObjectPropertiesRequest.encode(v, writer.uint32(26).fork()).ldelim(); - } - if (message.returnAllNonrefProperties !== false) { - writer.uint32(88).bool(message.returnAllNonrefProperties); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePropertiesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.nonRefProperties.push(reader.string()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.refProperties.push(RefPropertiesRequest.decode(reader, reader.uint32())); - continue; - case 3: - if (tag !== 26) { - break; - } - message.objectProperties.push(ObjectPropertiesRequest.decode(reader, reader.uint32())); - continue; - case 11: - if (tag !== 88) { - break; - } - message.returnAllNonrefProperties = reader.bool(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - nonRefProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.nonRefProperties - ) - ? object.nonRefProperties.map((e) => globalThis.String(e)) - : [], - refProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.refProperties - ) - ? object.refProperties.map((e) => RefPropertiesRequest.fromJSON(e)) - : [], - objectProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectProperties - ) - ? object.objectProperties.map((e) => ObjectPropertiesRequest.fromJSON(e)) - : [], - returnAllNonrefProperties: isSet(object.returnAllNonrefProperties) - ? globalThis.Boolean(object.returnAllNonrefProperties) - : false, - }; - }, - toJSON(message) { - var _a, _b, _c; - const obj = {}; - if ((_a = message.nonRefProperties) === null || _a === void 0 ? void 0 : _a.length) { - obj.nonRefProperties = message.nonRefProperties; - } - if ((_b = message.refProperties) === null || _b === void 0 ? void 0 : _b.length) { - obj.refProperties = message.refProperties.map((e) => RefPropertiesRequest.toJSON(e)); - } - if ((_c = message.objectProperties) === null || _c === void 0 ? void 0 : _c.length) { - obj.objectProperties = message.objectProperties.map((e) => ObjectPropertiesRequest.toJSON(e)); - } - if (message.returnAllNonrefProperties !== false) { - obj.returnAllNonrefProperties = message.returnAllNonrefProperties; - } - return obj; - }, - create(base) { - return PropertiesRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBasePropertiesRequest(); - message.nonRefProperties = - ((_a = object.nonRefProperties) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.refProperties = - ((_b = object.refProperties) === null || _b === void 0 - ? void 0 - : _b.map((e) => RefPropertiesRequest.fromPartial(e))) || []; - message.objectProperties = - ((_c = object.objectProperties) === null || _c === void 0 - ? void 0 - : _c.map((e) => ObjectPropertiesRequest.fromPartial(e))) || []; - message.returnAllNonrefProperties = - (_d = object.returnAllNonrefProperties) !== null && _d !== void 0 ? _d : false; - return message; - }, -}; -function createBaseObjectPropertiesRequest() { - return { propName: '', primitiveProperties: [], objectProperties: [] }; -} -export const ObjectPropertiesRequest = { - encode(message, writer = _m0.Writer.create()) { - if (message.propName !== '') { - writer.uint32(10).string(message.propName); - } - for (const v of message.primitiveProperties) { - writer.uint32(18).string(v); - } - for (const v of message.objectProperties) { - ObjectPropertiesRequest.encode(v, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseObjectPropertiesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.propName = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.primitiveProperties.push(reader.string()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.objectProperties.push(ObjectPropertiesRequest.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - primitiveProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.primitiveProperties - ) - ? object.primitiveProperties.map((e) => globalThis.String(e)) - : [], - objectProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectProperties - ) - ? object.objectProperties.map((e) => ObjectPropertiesRequest.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if (message.propName !== '') { - obj.propName = message.propName; - } - if ((_a = message.primitiveProperties) === null || _a === void 0 ? void 0 : _a.length) { - obj.primitiveProperties = message.primitiveProperties; - } - if ((_b = message.objectProperties) === null || _b === void 0 ? void 0 : _b.length) { - obj.objectProperties = message.objectProperties.map((e) => ObjectPropertiesRequest.toJSON(e)); - } - return obj; - }, - create(base) { - return ObjectPropertiesRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseObjectPropertiesRequest(); - message.propName = (_a = object.propName) !== null && _a !== void 0 ? _a : ''; - message.primitiveProperties = - ((_b = object.primitiveProperties) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - message.objectProperties = - ((_c = object.objectProperties) === null || _c === void 0 - ? void 0 - : _c.map((e) => ObjectPropertiesRequest.fromPartial(e))) || []; - return message; - }, -}; -function createBaseWeightsForTarget() { - return { target: '', weight: 0 }; -} -export const WeightsForTarget = { - encode(message, writer = _m0.Writer.create()) { - if (message.target !== '') { - writer.uint32(10).string(message.target); - } - if (message.weight !== 0) { - writer.uint32(21).float(message.weight); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseWeightsForTarget(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.target = reader.string(); - continue; - case 2: - if (tag !== 21) { - break; - } - message.weight = reader.float(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - target: isSet(object.target) ? globalThis.String(object.target) : '', - weight: isSet(object.weight) ? globalThis.Number(object.weight) : 0, - }; - }, - toJSON(message) { - const obj = {}; - if (message.target !== '') { - obj.target = message.target; - } - if (message.weight !== 0) { - obj.weight = message.weight; - } - return obj; - }, - create(base) { - return WeightsForTarget.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseWeightsForTarget(); - message.target = (_a = object.target) !== null && _a !== void 0 ? _a : ''; - message.weight = (_b = object.weight) !== null && _b !== void 0 ? _b : 0; - return message; - }, -}; -function createBaseTargets() { - return { targetVectors: [], combination: 0, weights: {}, weightsForTargets: [] }; -} -export const Targets = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.targetVectors) { - writer.uint32(10).string(v); - } - if (message.combination !== 0) { - writer.uint32(16).int32(message.combination); - } - Object.entries(message.weights).forEach(([key, value]) => { - Targets_WeightsEntry.encode({ key: key, value }, writer.uint32(26).fork()).ldelim(); - }); - for (const v of message.weightsForTargets) { - WeightsForTarget.encode(v, writer.uint32(34).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTargets(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 2: - if (tag !== 16) { - break; - } - message.combination = reader.int32(); - continue; - case 3: - if (tag !== 26) { - break; - } - const entry3 = Targets_WeightsEntry.decode(reader, reader.uint32()); - if (entry3.value !== undefined) { - message.weights[entry3.key] = entry3.value; - } - continue; - case 4: - if (tag !== 34) { - break; - } - message.weightsForTargets.push(WeightsForTarget.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - combination: isSet(object.combination) ? combinationMethodFromJSON(object.combination) : 0, - weights: isObject(object.weights) - ? Object.entries(object.weights).reduce((acc, [key, value]) => { - acc[key] = Number(value); - return acc; - }, {}) - : {}, - weightsForTargets: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.weightsForTargets - ) - ? object.weightsForTargets.map((e) => WeightsForTarget.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.combination !== 0) { - obj.combination = combinationMethodToJSON(message.combination); - } - if (message.weights) { - const entries = Object.entries(message.weights); - if (entries.length > 0) { - obj.weights = {}; - entries.forEach(([k, v]) => { - obj.weights[k] = v; - }); - } - } - if ((_b = message.weightsForTargets) === null || _b === void 0 ? void 0 : _b.length) { - obj.weightsForTargets = message.weightsForTargets.map((e) => WeightsForTarget.toJSON(e)); - } - return obj; - }, - create(base) { - return Targets.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseTargets(); - message.targetVectors = - ((_a = object.targetVectors) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.combination = (_b = object.combination) !== null && _b !== void 0 ? _b : 0; - message.weights = Object.entries((_c = object.weights) !== null && _c !== void 0 ? _c : {}).reduce( - (acc, [key, value]) => { - if (value !== undefined) { - acc[key] = globalThis.Number(value); - } - return acc; - }, - {} - ); - message.weightsForTargets = - ((_d = object.weightsForTargets) === null || _d === void 0 - ? void 0 - : _d.map((e) => WeightsForTarget.fromPartial(e))) || []; - return message; - }, -}; -function createBaseTargets_WeightsEntry() { - return { key: '', value: 0 }; -} -export const Targets_WeightsEntry = { - encode(message, writer = _m0.Writer.create()) { - if (message.key !== '') { - writer.uint32(10).string(message.key); - } - if (message.value !== 0) { - writer.uint32(21).float(message.value); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTargets_WeightsEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.key = reader.string(); - continue; - case 2: - if (tag !== 21) { - break; - } - message.value = reader.float(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - key: isSet(object.key) ? globalThis.String(object.key) : '', - value: isSet(object.value) ? globalThis.Number(object.value) : 0, - }; - }, - toJSON(message) { - const obj = {}; - if (message.key !== '') { - obj.key = message.key; - } - if (message.value !== 0) { - obj.value = message.value; - } - return obj; - }, - create(base) { - return Targets_WeightsEntry.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseTargets_WeightsEntry(); - message.key = (_a = object.key) !== null && _a !== void 0 ? _a : ''; - message.value = (_b = object.value) !== null && _b !== void 0 ? _b : 0; - return message; - }, -}; -function createBaseHybrid() { - return { - query: '', - properties: [], - vector: [], - alpha: 0, - fusionType: 0, - vectorBytes: new Uint8Array(0), - targetVectors: [], - nearText: undefined, - nearVector: undefined, - targets: undefined, - vectorDistance: undefined, - }; -} -export const Hybrid = { - encode(message, writer = _m0.Writer.create()) { - if (message.query !== '') { - writer.uint32(10).string(message.query); - } - for (const v of message.properties) { - writer.uint32(18).string(v); - } - writer.uint32(26).fork(); - for (const v of message.vector) { - writer.float(v); - } - writer.ldelim(); - if (message.alpha !== 0) { - writer.uint32(37).float(message.alpha); - } - if (message.fusionType !== 0) { - writer.uint32(40).int32(message.fusionType); - } - if (message.vectorBytes.length !== 0) { - writer.uint32(50).bytes(message.vectorBytes); - } - for (const v of message.targetVectors) { - writer.uint32(58).string(v); - } - if (message.nearText !== undefined) { - NearTextSearch.encode(message.nearText, writer.uint32(66).fork()).ldelim(); - } - if (message.nearVector !== undefined) { - NearVector.encode(message.nearVector, writer.uint32(74).fork()).ldelim(); - } - if (message.targets !== undefined) { - Targets.encode(message.targets, writer.uint32(82).fork()).ldelim(); - } - if (message.vectorDistance !== undefined) { - writer.uint32(165).float(message.vectorDistance); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseHybrid(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.query = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.properties.push(reader.string()); - continue; - case 3: - if (tag === 29) { - message.vector.push(reader.float()); - continue; - } - if (tag === 26) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.vector.push(reader.float()); - } - continue; - } - break; - case 4: - if (tag !== 37) { - break; - } - message.alpha = reader.float(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.fusionType = reader.int32(); - continue; - case 6: - if (tag !== 50) { - break; - } - message.vectorBytes = reader.bytes(); - continue; - case 7: - if (tag !== 58) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 8: - if (tag !== 66) { - break; - } - message.nearText = NearTextSearch.decode(reader, reader.uint32()); - continue; - case 9: - if (tag !== 74) { - break; - } - message.nearVector = NearVector.decode(reader, reader.uint32()); - continue; - case 10: - if (tag !== 82) { - break; - } - message.targets = Targets.decode(reader, reader.uint32()); - continue; - case 20: - if (tag !== 165) { - break; - } - message.vectorDistance = reader.float(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - query: isSet(object.query) ? globalThis.String(object.query) : '', - properties: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.properties) - ? object.properties.map((e) => globalThis.String(e)) - : [], - vector: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.vector) - ? object.vector.map((e) => globalThis.Number(e)) - : [], - alpha: isSet(object.alpha) ? globalThis.Number(object.alpha) : 0, - fusionType: isSet(object.fusionType) ? hybrid_FusionTypeFromJSON(object.fusionType) : 0, - vectorBytes: isSet(object.vectorBytes) ? bytesFromBase64(object.vectorBytes) : new Uint8Array(0), - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - nearText: isSet(object.nearText) ? NearTextSearch.fromJSON(object.nearText) : undefined, - nearVector: isSet(object.nearVector) ? NearVector.fromJSON(object.nearVector) : undefined, - targets: isSet(object.targets) ? Targets.fromJSON(object.targets) : undefined, - vectorDistance: isSet(object.vectorDistance) ? globalThis.Number(object.vectorDistance) : undefined, - }; - }, - toJSON(message) { - var _a, _b, _c; - const obj = {}; - if (message.query !== '') { - obj.query = message.query; - } - if ((_a = message.properties) === null || _a === void 0 ? void 0 : _a.length) { - obj.properties = message.properties; - } - if ((_b = message.vector) === null || _b === void 0 ? void 0 : _b.length) { - obj.vector = message.vector; - } - if (message.alpha !== 0) { - obj.alpha = message.alpha; - } - if (message.fusionType !== 0) { - obj.fusionType = hybrid_FusionTypeToJSON(message.fusionType); - } - if (message.vectorBytes.length !== 0) { - obj.vectorBytes = base64FromBytes(message.vectorBytes); - } - if ((_c = message.targetVectors) === null || _c === void 0 ? void 0 : _c.length) { - obj.targetVectors = message.targetVectors; - } - if (message.nearText !== undefined) { - obj.nearText = NearTextSearch.toJSON(message.nearText); - } - if (message.nearVector !== undefined) { - obj.nearVector = NearVector.toJSON(message.nearVector); - } - if (message.targets !== undefined) { - obj.targets = Targets.toJSON(message.targets); - } - if (message.vectorDistance !== undefined) { - obj.vectorDistance = message.vectorDistance; - } - return obj; - }, - create(base) { - return Hybrid.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h; - const message = createBaseHybrid(); - message.query = (_a = object.query) !== null && _a !== void 0 ? _a : ''; - message.properties = - ((_b = object.properties) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - message.vector = ((_c = object.vector) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || []; - message.alpha = (_d = object.alpha) !== null && _d !== void 0 ? _d : 0; - message.fusionType = (_e = object.fusionType) !== null && _e !== void 0 ? _e : 0; - message.vectorBytes = (_f = object.vectorBytes) !== null && _f !== void 0 ? _f : new Uint8Array(0); - message.targetVectors = - ((_g = object.targetVectors) === null || _g === void 0 ? void 0 : _g.map((e) => e)) || []; - message.nearText = - object.nearText !== undefined && object.nearText !== null - ? NearTextSearch.fromPartial(object.nearText) - : undefined; - message.nearVector = - object.nearVector !== undefined && object.nearVector !== null - ? NearVector.fromPartial(object.nearVector) - : undefined; - message.targets = - object.targets !== undefined && object.targets !== null - ? Targets.fromPartial(object.targets) - : undefined; - message.vectorDistance = (_h = object.vectorDistance) !== null && _h !== void 0 ? _h : undefined; - return message; - }, -}; -function createBaseNearTextSearch() { - return { - query: [], - certainty: undefined, - distance: undefined, - moveTo: undefined, - moveAway: undefined, - targetVectors: [], - targets: undefined, - }; -} -export const NearTextSearch = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.query) { - writer.uint32(10).string(v); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - if (message.moveTo !== undefined) { - NearTextSearch_Move.encode(message.moveTo, writer.uint32(34).fork()).ldelim(); - } - if (message.moveAway !== undefined) { - NearTextSearch_Move.encode(message.moveAway, writer.uint32(42).fork()).ldelim(); - } - for (const v of message.targetVectors) { - writer.uint32(50).string(v); - } - if (message.targets !== undefined) { - Targets.encode(message.targets, writer.uint32(58).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearTextSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.query.push(reader.string()); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.moveTo = NearTextSearch_Move.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.moveAway = NearTextSearch_Move.decode(reader, reader.uint32()); - continue; - case 6: - if (tag !== 50) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 7: - if (tag !== 58) { - break; - } - message.targets = Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - query: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.query) - ? object.query.map((e) => globalThis.String(e)) - : [], - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - moveTo: isSet(object.moveTo) ? NearTextSearch_Move.fromJSON(object.moveTo) : undefined, - moveAway: isSet(object.moveAway) ? NearTextSearch_Move.fromJSON(object.moveAway) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if ((_a = message.query) === null || _a === void 0 ? void 0 : _a.length) { - obj.query = message.query; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if (message.moveTo !== undefined) { - obj.moveTo = NearTextSearch_Move.toJSON(message.moveTo); - } - if (message.moveAway !== undefined) { - obj.moveAway = NearTextSearch_Move.toJSON(message.moveAway); - } - if ((_b = message.targetVectors) === null || _b === void 0 ? void 0 : _b.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return NearTextSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearTextSearch(); - message.query = ((_a = object.query) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.moveTo = - object.moveTo !== undefined && object.moveTo !== null - ? NearTextSearch_Move.fromPartial(object.moveTo) - : undefined; - message.moveAway = - object.moveAway !== undefined && object.moveAway !== null - ? NearTextSearch_Move.fromPartial(object.moveAway) - : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseNearTextSearch_Move() { - return { force: 0, concepts: [], uuids: [] }; -} -export const NearTextSearch_Move = { - encode(message, writer = _m0.Writer.create()) { - if (message.force !== 0) { - writer.uint32(13).float(message.force); - } - for (const v of message.concepts) { - writer.uint32(18).string(v); - } - for (const v of message.uuids) { - writer.uint32(26).string(v); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearTextSearch_Move(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 13) { - break; - } - message.force = reader.float(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.concepts.push(reader.string()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.uuids.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - force: isSet(object.force) ? globalThis.Number(object.force) : 0, - concepts: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.concepts) - ? object.concepts.map((e) => globalThis.String(e)) - : [], - uuids: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.uuids) - ? object.uuids.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if (message.force !== 0) { - obj.force = message.force; - } - if ((_a = message.concepts) === null || _a === void 0 ? void 0 : _a.length) { - obj.concepts = message.concepts; - } - if ((_b = message.uuids) === null || _b === void 0 ? void 0 : _b.length) { - obj.uuids = message.uuids; - } - return obj; - }, - create(base) { - return NearTextSearch_Move.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c; - const message = createBaseNearTextSearch_Move(); - message.force = (_a = object.force) !== null && _a !== void 0 ? _a : 0; - message.concepts = ((_b = object.concepts) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - message.uuids = ((_c = object.uuids) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || []; - return message; - }, -}; -function createBaseNearImageSearch() { - return { image: '', certainty: undefined, distance: undefined, targetVectors: [], targets: undefined }; -} -export const NearImageSearch = { - encode(message, writer = _m0.Writer.create()) { - if (message.image !== '') { - writer.uint32(10).string(message.image); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - for (const v of message.targetVectors) { - writer.uint32(34).string(v); - } - if (message.targets !== undefined) { - Targets.encode(message.targets, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearImageSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.image = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targets = Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - image: isSet(object.image) ? globalThis.String(object.image) : '', - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.image !== '') { - obj.image = message.image; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return NearImageSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearImageSearch(); - message.image = (_a = object.image) !== null && _a !== void 0 ? _a : ''; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseNearAudioSearch() { - return { audio: '', certainty: undefined, distance: undefined, targetVectors: [], targets: undefined }; -} -export const NearAudioSearch = { - encode(message, writer = _m0.Writer.create()) { - if (message.audio !== '') { - writer.uint32(10).string(message.audio); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - for (const v of message.targetVectors) { - writer.uint32(34).string(v); - } - if (message.targets !== undefined) { - Targets.encode(message.targets, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearAudioSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.audio = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targets = Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - audio: isSet(object.audio) ? globalThis.String(object.audio) : '', - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.audio !== '') { - obj.audio = message.audio; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return NearAudioSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearAudioSearch(); - message.audio = (_a = object.audio) !== null && _a !== void 0 ? _a : ''; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseNearVideoSearch() { - return { video: '', certainty: undefined, distance: undefined, targetVectors: [], targets: undefined }; -} -export const NearVideoSearch = { - encode(message, writer = _m0.Writer.create()) { - if (message.video !== '') { - writer.uint32(10).string(message.video); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - for (const v of message.targetVectors) { - writer.uint32(34).string(v); - } - if (message.targets !== undefined) { - Targets.encode(message.targets, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearVideoSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.video = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targets = Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - video: isSet(object.video) ? globalThis.String(object.video) : '', - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.video !== '') { - obj.video = message.video; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return NearVideoSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearVideoSearch(); - message.video = (_a = object.video) !== null && _a !== void 0 ? _a : ''; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseNearDepthSearch() { - return { depth: '', certainty: undefined, distance: undefined, targetVectors: [], targets: undefined }; -} -export const NearDepthSearch = { - encode(message, writer = _m0.Writer.create()) { - if (message.depth !== '') { - writer.uint32(10).string(message.depth); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - for (const v of message.targetVectors) { - writer.uint32(34).string(v); - } - if (message.targets !== undefined) { - Targets.encode(message.targets, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearDepthSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.depth = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targets = Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - depth: isSet(object.depth) ? globalThis.String(object.depth) : '', - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.depth !== '') { - obj.depth = message.depth; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return NearDepthSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearDepthSearch(); - message.depth = (_a = object.depth) !== null && _a !== void 0 ? _a : ''; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseNearThermalSearch() { - return { thermal: '', certainty: undefined, distance: undefined, targetVectors: [], targets: undefined }; -} -export const NearThermalSearch = { - encode(message, writer = _m0.Writer.create()) { - if (message.thermal !== '') { - writer.uint32(10).string(message.thermal); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - for (const v of message.targetVectors) { - writer.uint32(34).string(v); - } - if (message.targets !== undefined) { - Targets.encode(message.targets, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearThermalSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.thermal = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targets = Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - thermal: isSet(object.thermal) ? globalThis.String(object.thermal) : '', - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.thermal !== '') { - obj.thermal = message.thermal; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return NearThermalSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearThermalSearch(); - message.thermal = (_a = object.thermal) !== null && _a !== void 0 ? _a : ''; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseNearIMUSearch() { - return { imu: '', certainty: undefined, distance: undefined, targetVectors: [], targets: undefined }; -} -export const NearIMUSearch = { - encode(message, writer = _m0.Writer.create()) { - if (message.imu !== '') { - writer.uint32(10).string(message.imu); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - for (const v of message.targetVectors) { - writer.uint32(34).string(v); - } - if (message.targets !== undefined) { - Targets.encode(message.targets, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearIMUSearch(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.imu = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targets = Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - imu: isSet(object.imu) ? globalThis.String(object.imu) : '', - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.imu !== '') { - obj.imu = message.imu; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return NearIMUSearch.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearIMUSearch(); - message.imu = (_a = object.imu) !== null && _a !== void 0 ? _a : ''; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseBM25() { - return { query: '', properties: [] }; -} -export const BM25 = { - encode(message, writer = _m0.Writer.create()) { - if (message.query !== '') { - writer.uint32(10).string(message.query); - } - for (const v of message.properties) { - writer.uint32(18).string(v); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseBM25(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.query = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.properties.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - query: isSet(object.query) ? globalThis.String(object.query) : '', - properties: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.properties) - ? object.properties.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.query !== '') { - obj.query = message.query; - } - if ((_a = message.properties) === null || _a === void 0 ? void 0 : _a.length) { - obj.properties = message.properties; - } - return obj; - }, - create(base) { - return BM25.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseBM25(); - message.query = (_a = object.query) !== null && _a !== void 0 ? _a : ''; - message.properties = - ((_b = object.properties) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - return message; - }, -}; -function createBaseRefPropertiesRequest() { - return { referenceProperty: '', properties: undefined, metadata: undefined, targetCollection: '' }; -} -export const RefPropertiesRequest = { - encode(message, writer = _m0.Writer.create()) { - if (message.referenceProperty !== '') { - writer.uint32(10).string(message.referenceProperty); - } - if (message.properties !== undefined) { - PropertiesRequest.encode(message.properties, writer.uint32(18).fork()).ldelim(); - } - if (message.metadata !== undefined) { - MetadataRequest.encode(message.metadata, writer.uint32(26).fork()).ldelim(); - } - if (message.targetCollection !== '') { - writer.uint32(34).string(message.targetCollection); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRefPropertiesRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.referenceProperty = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.properties = PropertiesRequest.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.metadata = MetadataRequest.decode(reader, reader.uint32()); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetCollection = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - referenceProperty: isSet(object.referenceProperty) ? globalThis.String(object.referenceProperty) : '', - properties: isSet(object.properties) ? PropertiesRequest.fromJSON(object.properties) : undefined, - metadata: isSet(object.metadata) ? MetadataRequest.fromJSON(object.metadata) : undefined, - targetCollection: isSet(object.targetCollection) ? globalThis.String(object.targetCollection) : '', - }; - }, - toJSON(message) { - const obj = {}; - if (message.referenceProperty !== '') { - obj.referenceProperty = message.referenceProperty; - } - if (message.properties !== undefined) { - obj.properties = PropertiesRequest.toJSON(message.properties); - } - if (message.metadata !== undefined) { - obj.metadata = MetadataRequest.toJSON(message.metadata); - } - if (message.targetCollection !== '') { - obj.targetCollection = message.targetCollection; - } - return obj; - }, - create(base) { - return RefPropertiesRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseRefPropertiesRequest(); - message.referenceProperty = (_a = object.referenceProperty) !== null && _a !== void 0 ? _a : ''; - message.properties = - object.properties !== undefined && object.properties !== null - ? PropertiesRequest.fromPartial(object.properties) - : undefined; - message.metadata = - object.metadata !== undefined && object.metadata !== null - ? MetadataRequest.fromPartial(object.metadata) - : undefined; - message.targetCollection = (_b = object.targetCollection) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function createBaseVectorForTarget() { - return { name: '', vectorBytes: new Uint8Array(0) }; -} -export const VectorForTarget = { - encode(message, writer = _m0.Writer.create()) { - if (message.name !== '') { - writer.uint32(10).string(message.name); - } - if (message.vectorBytes.length !== 0) { - writer.uint32(18).bytes(message.vectorBytes); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseVectorForTarget(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.name = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.vectorBytes = reader.bytes(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - name: isSet(object.name) ? globalThis.String(object.name) : '', - vectorBytes: isSet(object.vectorBytes) ? bytesFromBase64(object.vectorBytes) : new Uint8Array(0), - }; - }, - toJSON(message) { - const obj = {}; - if (message.name !== '') { - obj.name = message.name; - } - if (message.vectorBytes.length !== 0) { - obj.vectorBytes = base64FromBytes(message.vectorBytes); - } - return obj; - }, - create(base) { - return VectorForTarget.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseVectorForTarget(); - message.name = (_a = object.name) !== null && _a !== void 0 ? _a : ''; - message.vectorBytes = (_b = object.vectorBytes) !== null && _b !== void 0 ? _b : new Uint8Array(0); - return message; - }, -}; -function createBaseNearVector() { - return { - vector: [], - certainty: undefined, - distance: undefined, - vectorBytes: new Uint8Array(0), - targetVectors: [], - targets: undefined, - vectorPerTarget: {}, - vectorForTargets: [], - }; -} -export const NearVector = { - encode(message, writer = _m0.Writer.create()) { - writer.uint32(10).fork(); - for (const v of message.vector) { - writer.float(v); - } - writer.ldelim(); - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - if (message.vectorBytes.length !== 0) { - writer.uint32(34).bytes(message.vectorBytes); - } - for (const v of message.targetVectors) { - writer.uint32(42).string(v); - } - if (message.targets !== undefined) { - Targets.encode(message.targets, writer.uint32(50).fork()).ldelim(); - } - Object.entries(message.vectorPerTarget).forEach(([key, value]) => { - NearVector_VectorPerTargetEntry.encode({ key: key, value }, writer.uint32(58).fork()).ldelim(); - }); - for (const v of message.vectorForTargets) { - VectorForTarget.encode(v, writer.uint32(66).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearVector(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag === 13) { - message.vector.push(reader.float()); - continue; - } - if (tag === 10) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.vector.push(reader.float()); - } - continue; - } - break; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.vectorBytes = reader.bytes(); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 6: - if (tag !== 50) { - break; - } - message.targets = Targets.decode(reader, reader.uint32()); - continue; - case 7: - if (tag !== 58) { - break; - } - const entry7 = NearVector_VectorPerTargetEntry.decode(reader, reader.uint32()); - if (entry7.value !== undefined) { - message.vectorPerTarget[entry7.key] = entry7.value; - } - continue; - case 8: - if (tag !== 66) { - break; - } - message.vectorForTargets.push(VectorForTarget.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - vector: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.vector) - ? object.vector.map((e) => globalThis.Number(e)) - : [], - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - vectorBytes: isSet(object.vectorBytes) ? bytesFromBase64(object.vectorBytes) : new Uint8Array(0), - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? Targets.fromJSON(object.targets) : undefined, - vectorPerTarget: isObject(object.vectorPerTarget) - ? Object.entries(object.vectorPerTarget).reduce((acc, [key, value]) => { - acc[key] = bytesFromBase64(value); - return acc; - }, {}) - : {}, - vectorForTargets: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.vectorForTargets - ) - ? object.vectorForTargets.map((e) => VectorForTarget.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b, _c; - const obj = {}; - if ((_a = message.vector) === null || _a === void 0 ? void 0 : _a.length) { - obj.vector = message.vector; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if (message.vectorBytes.length !== 0) { - obj.vectorBytes = base64FromBytes(message.vectorBytes); - } - if ((_b = message.targetVectors) === null || _b === void 0 ? void 0 : _b.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = Targets.toJSON(message.targets); - } - if (message.vectorPerTarget) { - const entries = Object.entries(message.vectorPerTarget); - if (entries.length > 0) { - obj.vectorPerTarget = {}; - entries.forEach(([k, v]) => { - obj.vectorPerTarget[k] = base64FromBytes(v); - }); - } - } - if ((_c = message.vectorForTargets) === null || _c === void 0 ? void 0 : _c.length) { - obj.vectorForTargets = message.vectorForTargets.map((e) => VectorForTarget.toJSON(e)); - } - return obj; - }, - create(base) { - return NearVector.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g; - const message = createBaseNearVector(); - message.vector = ((_a = object.vector) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.vectorBytes = (_d = object.vectorBytes) !== null && _d !== void 0 ? _d : new Uint8Array(0); - message.targetVectors = - ((_e = object.targetVectors) === null || _e === void 0 ? void 0 : _e.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? Targets.fromPartial(object.targets) - : undefined; - message.vectorPerTarget = Object.entries( - (_f = object.vectorPerTarget) !== null && _f !== void 0 ? _f : {} - ).reduce((acc, [key, value]) => { - if (value !== undefined) { - acc[key] = value; - } - return acc; - }, {}); - message.vectorForTargets = - ((_g = object.vectorForTargets) === null || _g === void 0 - ? void 0 - : _g.map((e) => VectorForTarget.fromPartial(e))) || []; - return message; - }, -}; -function createBaseNearVector_VectorPerTargetEntry() { - return { key: '', value: new Uint8Array(0) }; -} -export const NearVector_VectorPerTargetEntry = { - encode(message, writer = _m0.Writer.create()) { - if (message.key !== '') { - writer.uint32(10).string(message.key); - } - if (message.value.length !== 0) { - writer.uint32(18).bytes(message.value); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearVector_VectorPerTargetEntry(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.key = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.value = reader.bytes(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - key: isSet(object.key) ? globalThis.String(object.key) : '', - value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0), - }; - }, - toJSON(message) { - const obj = {}; - if (message.key !== '') { - obj.key = message.key; - } - if (message.value.length !== 0) { - obj.value = base64FromBytes(message.value); - } - return obj; - }, - create(base) { - return NearVector_VectorPerTargetEntry.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseNearVector_VectorPerTargetEntry(); - message.key = (_a = object.key) !== null && _a !== void 0 ? _a : ''; - message.value = (_b = object.value) !== null && _b !== void 0 ? _b : new Uint8Array(0); - return message; - }, -}; -function createBaseNearObject() { - return { id: '', certainty: undefined, distance: undefined, targetVectors: [], targets: undefined }; -} -export const NearObject = { - encode(message, writer = _m0.Writer.create()) { - if (message.id !== '') { - writer.uint32(10).string(message.id); - } - if (message.certainty !== undefined) { - writer.uint32(17).double(message.certainty); - } - if (message.distance !== undefined) { - writer.uint32(25).double(message.distance); - } - for (const v of message.targetVectors) { - writer.uint32(34).string(v); - } - if (message.targets !== undefined) { - Targets.encode(message.targets, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseNearObject(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.id = reader.string(); - continue; - case 2: - if (tag !== 17) { - break; - } - message.certainty = reader.double(); - continue; - case 3: - if (tag !== 25) { - break; - } - message.distance = reader.double(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.targetVectors.push(reader.string()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.targets = Targets.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - id: isSet(object.id) ? globalThis.String(object.id) : '', - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : undefined, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : undefined, - targetVectors: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.targetVectors - ) - ? object.targetVectors.map((e) => globalThis.String(e)) - : [], - targets: isSet(object.targets) ? Targets.fromJSON(object.targets) : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.id !== '') { - obj.id = message.id; - } - if (message.certainty !== undefined) { - obj.certainty = message.certainty; - } - if (message.distance !== undefined) { - obj.distance = message.distance; - } - if ((_a = message.targetVectors) === null || _a === void 0 ? void 0 : _a.length) { - obj.targetVectors = message.targetVectors; - } - if (message.targets !== undefined) { - obj.targets = Targets.toJSON(message.targets); - } - return obj; - }, - create(base) { - return NearObject.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseNearObject(); - message.id = (_a = object.id) !== null && _a !== void 0 ? _a : ''; - message.certainty = (_b = object.certainty) !== null && _b !== void 0 ? _b : undefined; - message.distance = (_c = object.distance) !== null && _c !== void 0 ? _c : undefined; - message.targetVectors = - ((_d = object.targetVectors) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || []; - message.targets = - object.targets !== undefined && object.targets !== null - ? Targets.fromPartial(object.targets) - : undefined; - return message; - }, -}; -function createBaseRerank() { - return { property: '', query: undefined }; -} -export const Rerank = { - encode(message, writer = _m0.Writer.create()) { - if (message.property !== '') { - writer.uint32(10).string(message.property); - } - if (message.query !== undefined) { - writer.uint32(18).string(message.query); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRerank(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.property = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.query = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - property: isSet(object.property) ? globalThis.String(object.property) : '', - query: isSet(object.query) ? globalThis.String(object.query) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.property !== '') { - obj.property = message.property; - } - if (message.query !== undefined) { - obj.query = message.query; - } - return obj; - }, - create(base) { - return Rerank.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseRerank(); - message.property = (_a = object.property) !== null && _a !== void 0 ? _a : ''; - message.query = (_b = object.query) !== null && _b !== void 0 ? _b : undefined; - return message; - }, -}; -function createBaseSearchReply() { - return { - took: 0, - results: [], - generativeGroupedResult: undefined, - groupByResults: [], - generativeGroupedResults: undefined, - }; -} -export const SearchReply = { - encode(message, writer = _m0.Writer.create()) { - if (message.took !== 0) { - writer.uint32(13).float(message.took); - } - for (const v of message.results) { - SearchResult.encode(v, writer.uint32(18).fork()).ldelim(); - } - if (message.generativeGroupedResult !== undefined) { - writer.uint32(26).string(message.generativeGroupedResult); - } - for (const v of message.groupByResults) { - GroupByResult.encode(v, writer.uint32(34).fork()).ldelim(); - } - if (message.generativeGroupedResults !== undefined) { - GenerativeResult.encode(message.generativeGroupedResults, writer.uint32(42).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSearchReply(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 13) { - break; - } - message.took = reader.float(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.results.push(SearchResult.decode(reader, reader.uint32())); - continue; - case 3: - if (tag !== 26) { - break; - } - message.generativeGroupedResult = reader.string(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.groupByResults.push(GroupByResult.decode(reader, reader.uint32())); - continue; - case 5: - if (tag !== 42) { - break; - } - message.generativeGroupedResults = GenerativeResult.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - took: isSet(object.took) ? globalThis.Number(object.took) : 0, - results: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.results) - ? object.results.map((e) => SearchResult.fromJSON(e)) - : [], - generativeGroupedResult: isSet(object.generativeGroupedResult) - ? globalThis.String(object.generativeGroupedResult) - : undefined, - groupByResults: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.groupByResults - ) - ? object.groupByResults.map((e) => GroupByResult.fromJSON(e)) - : [], - generativeGroupedResults: isSet(object.generativeGroupedResults) - ? GenerativeResult.fromJSON(object.generativeGroupedResults) - : undefined, - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if (message.took !== 0) { - obj.took = message.took; - } - if ((_a = message.results) === null || _a === void 0 ? void 0 : _a.length) { - obj.results = message.results.map((e) => SearchResult.toJSON(e)); - } - if (message.generativeGroupedResult !== undefined) { - obj.generativeGroupedResult = message.generativeGroupedResult; - } - if ((_b = message.groupByResults) === null || _b === void 0 ? void 0 : _b.length) { - obj.groupByResults = message.groupByResults.map((e) => GroupByResult.toJSON(e)); - } - if (message.generativeGroupedResults !== undefined) { - obj.generativeGroupedResults = GenerativeResult.toJSON(message.generativeGroupedResults); - } - return obj; - }, - create(base) { - return SearchReply.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d; - const message = createBaseSearchReply(); - message.took = (_a = object.took) !== null && _a !== void 0 ? _a : 0; - message.results = - ((_b = object.results) === null || _b === void 0 - ? void 0 - : _b.map((e) => SearchResult.fromPartial(e))) || []; - message.generativeGroupedResult = - (_c = object.generativeGroupedResult) !== null && _c !== void 0 ? _c : undefined; - message.groupByResults = - ((_d = object.groupByResults) === null || _d === void 0 - ? void 0 - : _d.map((e) => GroupByResult.fromPartial(e))) || []; - message.generativeGroupedResults = - object.generativeGroupedResults !== undefined && object.generativeGroupedResults !== null - ? GenerativeResult.fromPartial(object.generativeGroupedResults) - : undefined; - return message; - }, -}; -function createBaseRerankReply() { - return { score: 0 }; -} -export const RerankReply = { - encode(message, writer = _m0.Writer.create()) { - if (message.score !== 0) { - writer.uint32(9).double(message.score); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRerankReply(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 9) { - break; - } - message.score = reader.double(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { score: isSet(object.score) ? globalThis.Number(object.score) : 0 }; - }, - toJSON(message) { - const obj = {}; - if (message.score !== 0) { - obj.score = message.score; - } - return obj; - }, - create(base) { - return RerankReply.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseRerankReply(); - message.score = (_a = object.score) !== null && _a !== void 0 ? _a : 0; - return message; - }, -}; -function createBaseGroupByResult() { - return { - name: '', - minDistance: 0, - maxDistance: 0, - numberOfObjects: 0, - objects: [], - rerank: undefined, - generative: undefined, - generativeResult: undefined, - }; -} -export const GroupByResult = { - encode(message, writer = _m0.Writer.create()) { - if (message.name !== '') { - writer.uint32(10).string(message.name); - } - if (message.minDistance !== 0) { - writer.uint32(21).float(message.minDistance); - } - if (message.maxDistance !== 0) { - writer.uint32(29).float(message.maxDistance); - } - if (message.numberOfObjects !== 0) { - writer.uint32(32).int64(message.numberOfObjects); - } - for (const v of message.objects) { - SearchResult.encode(v, writer.uint32(42).fork()).ldelim(); - } - if (message.rerank !== undefined) { - RerankReply.encode(message.rerank, writer.uint32(50).fork()).ldelim(); - } - if (message.generative !== undefined) { - GenerativeReply.encode(message.generative, writer.uint32(58).fork()).ldelim(); - } - if (message.generativeResult !== undefined) { - GenerativeResult.encode(message.generativeResult, writer.uint32(66).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseGroupByResult(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.name = reader.string(); - continue; - case 2: - if (tag !== 21) { - break; - } - message.minDistance = reader.float(); - continue; - case 3: - if (tag !== 29) { - break; - } - message.maxDistance = reader.float(); - continue; - case 4: - if (tag !== 32) { - break; - } - message.numberOfObjects = longToNumber(reader.int64()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.objects.push(SearchResult.decode(reader, reader.uint32())); - continue; - case 6: - if (tag !== 50) { - break; - } - message.rerank = RerankReply.decode(reader, reader.uint32()); - continue; - case 7: - if (tag !== 58) { - break; - } - message.generative = GenerativeReply.decode(reader, reader.uint32()); - continue; - case 8: - if (tag !== 66) { - break; - } - message.generativeResult = GenerativeResult.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - name: isSet(object.name) ? globalThis.String(object.name) : '', - minDistance: isSet(object.minDistance) ? globalThis.Number(object.minDistance) : 0, - maxDistance: isSet(object.maxDistance) ? globalThis.Number(object.maxDistance) : 0, - numberOfObjects: isSet(object.numberOfObjects) ? globalThis.Number(object.numberOfObjects) : 0, - objects: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.objects) - ? object.objects.map((e) => SearchResult.fromJSON(e)) - : [], - rerank: isSet(object.rerank) ? RerankReply.fromJSON(object.rerank) : undefined, - generative: isSet(object.generative) ? GenerativeReply.fromJSON(object.generative) : undefined, - generativeResult: isSet(object.generativeResult) - ? GenerativeResult.fromJSON(object.generativeResult) - : undefined, - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.name !== '') { - obj.name = message.name; - } - if (message.minDistance !== 0) { - obj.minDistance = message.minDistance; - } - if (message.maxDistance !== 0) { - obj.maxDistance = message.maxDistance; - } - if (message.numberOfObjects !== 0) { - obj.numberOfObjects = Math.round(message.numberOfObjects); - } - if ((_a = message.objects) === null || _a === void 0 ? void 0 : _a.length) { - obj.objects = message.objects.map((e) => SearchResult.toJSON(e)); - } - if (message.rerank !== undefined) { - obj.rerank = RerankReply.toJSON(message.rerank); - } - if (message.generative !== undefined) { - obj.generative = GenerativeReply.toJSON(message.generative); - } - if (message.generativeResult !== undefined) { - obj.generativeResult = GenerativeResult.toJSON(message.generativeResult); - } - return obj; - }, - create(base) { - return GroupByResult.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e; - const message = createBaseGroupByResult(); - message.name = (_a = object.name) !== null && _a !== void 0 ? _a : ''; - message.minDistance = (_b = object.minDistance) !== null && _b !== void 0 ? _b : 0; - message.maxDistance = (_c = object.maxDistance) !== null && _c !== void 0 ? _c : 0; - message.numberOfObjects = (_d = object.numberOfObjects) !== null && _d !== void 0 ? _d : 0; - message.objects = - ((_e = object.objects) === null || _e === void 0 - ? void 0 - : _e.map((e) => SearchResult.fromPartial(e))) || []; - message.rerank = - object.rerank !== undefined && object.rerank !== null - ? RerankReply.fromPartial(object.rerank) - : undefined; - message.generative = - object.generative !== undefined && object.generative !== null - ? GenerativeReply.fromPartial(object.generative) - : undefined; - message.generativeResult = - object.generativeResult !== undefined && object.generativeResult !== null - ? GenerativeResult.fromPartial(object.generativeResult) - : undefined; - return message; - }, -}; -function createBaseSearchResult() { - return { properties: undefined, metadata: undefined, generative: undefined }; -} -export const SearchResult = { - encode(message, writer = _m0.Writer.create()) { - if (message.properties !== undefined) { - PropertiesResult.encode(message.properties, writer.uint32(10).fork()).ldelim(); - } - if (message.metadata !== undefined) { - MetadataResult.encode(message.metadata, writer.uint32(18).fork()).ldelim(); - } - if (message.generative !== undefined) { - GenerativeResult.encode(message.generative, writer.uint32(26).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseSearchResult(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.properties = PropertiesResult.decode(reader, reader.uint32()); - continue; - case 2: - if (tag !== 18) { - break; - } - message.metadata = MetadataResult.decode(reader, reader.uint32()); - continue; - case 3: - if (tag !== 26) { - break; - } - message.generative = GenerativeResult.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - properties: isSet(object.properties) ? PropertiesResult.fromJSON(object.properties) : undefined, - metadata: isSet(object.metadata) ? MetadataResult.fromJSON(object.metadata) : undefined, - generative: isSet(object.generative) ? GenerativeResult.fromJSON(object.generative) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.properties !== undefined) { - obj.properties = PropertiesResult.toJSON(message.properties); - } - if (message.metadata !== undefined) { - obj.metadata = MetadataResult.toJSON(message.metadata); - } - if (message.generative !== undefined) { - obj.generative = GenerativeResult.toJSON(message.generative); - } - return obj; - }, - create(base) { - return SearchResult.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - const message = createBaseSearchResult(); - message.properties = - object.properties !== undefined && object.properties !== null - ? PropertiesResult.fromPartial(object.properties) - : undefined; - message.metadata = - object.metadata !== undefined && object.metadata !== null - ? MetadataResult.fromPartial(object.metadata) - : undefined; - message.generative = - object.generative !== undefined && object.generative !== null - ? GenerativeResult.fromPartial(object.generative) - : undefined; - return message; - }, -}; -function createBaseMetadataResult() { - return { - id: '', - vector: [], - creationTimeUnix: 0, - creationTimeUnixPresent: false, - lastUpdateTimeUnix: 0, - lastUpdateTimeUnixPresent: false, - distance: 0, - distancePresent: false, - certainty: 0, - certaintyPresent: false, - score: 0, - scorePresent: false, - explainScore: '', - explainScorePresent: false, - isConsistent: undefined, - generative: '', - generativePresent: false, - isConsistentPresent: false, - vectorBytes: new Uint8Array(0), - idAsBytes: new Uint8Array(0), - rerankScore: 0, - rerankScorePresent: false, - vectors: [], - }; -} -export const MetadataResult = { - encode(message, writer = _m0.Writer.create()) { - if (message.id !== '') { - writer.uint32(10).string(message.id); - } - writer.uint32(18).fork(); - for (const v of message.vector) { - writer.float(v); - } - writer.ldelim(); - if (message.creationTimeUnix !== 0) { - writer.uint32(24).int64(message.creationTimeUnix); - } - if (message.creationTimeUnixPresent !== false) { - writer.uint32(32).bool(message.creationTimeUnixPresent); - } - if (message.lastUpdateTimeUnix !== 0) { - writer.uint32(40).int64(message.lastUpdateTimeUnix); - } - if (message.lastUpdateTimeUnixPresent !== false) { - writer.uint32(48).bool(message.lastUpdateTimeUnixPresent); - } - if (message.distance !== 0) { - writer.uint32(61).float(message.distance); - } - if (message.distancePresent !== false) { - writer.uint32(64).bool(message.distancePresent); - } - if (message.certainty !== 0) { - writer.uint32(77).float(message.certainty); - } - if (message.certaintyPresent !== false) { - writer.uint32(80).bool(message.certaintyPresent); - } - if (message.score !== 0) { - writer.uint32(93).float(message.score); - } - if (message.scorePresent !== false) { - writer.uint32(96).bool(message.scorePresent); - } - if (message.explainScore !== '') { - writer.uint32(106).string(message.explainScore); - } - if (message.explainScorePresent !== false) { - writer.uint32(112).bool(message.explainScorePresent); - } - if (message.isConsistent !== undefined) { - writer.uint32(120).bool(message.isConsistent); - } - if (message.generative !== '') { - writer.uint32(130).string(message.generative); - } - if (message.generativePresent !== false) { - writer.uint32(136).bool(message.generativePresent); - } - if (message.isConsistentPresent !== false) { - writer.uint32(144).bool(message.isConsistentPresent); - } - if (message.vectorBytes.length !== 0) { - writer.uint32(154).bytes(message.vectorBytes); - } - if (message.idAsBytes.length !== 0) { - writer.uint32(162).bytes(message.idAsBytes); - } - if (message.rerankScore !== 0) { - writer.uint32(169).double(message.rerankScore); - } - if (message.rerankScorePresent !== false) { - writer.uint32(176).bool(message.rerankScorePresent); - } - for (const v of message.vectors) { - Vectors.encode(v, writer.uint32(186).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseMetadataResult(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.id = reader.string(); - continue; - case 2: - if (tag === 21) { - message.vector.push(reader.float()); - continue; - } - if (tag === 18) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.vector.push(reader.float()); - } - continue; - } - break; - case 3: - if (tag !== 24) { - break; - } - message.creationTimeUnix = longToNumber(reader.int64()); - continue; - case 4: - if (tag !== 32) { - break; - } - message.creationTimeUnixPresent = reader.bool(); - continue; - case 5: - if (tag !== 40) { - break; - } - message.lastUpdateTimeUnix = longToNumber(reader.int64()); - continue; - case 6: - if (tag !== 48) { - break; - } - message.lastUpdateTimeUnixPresent = reader.bool(); - continue; - case 7: - if (tag !== 61) { - break; - } - message.distance = reader.float(); - continue; - case 8: - if (tag !== 64) { - break; - } - message.distancePresent = reader.bool(); - continue; - case 9: - if (tag !== 77) { - break; - } - message.certainty = reader.float(); - continue; - case 10: - if (tag !== 80) { - break; - } - message.certaintyPresent = reader.bool(); - continue; - case 11: - if (tag !== 93) { - break; - } - message.score = reader.float(); - continue; - case 12: - if (tag !== 96) { - break; - } - message.scorePresent = reader.bool(); - continue; - case 13: - if (tag !== 106) { - break; - } - message.explainScore = reader.string(); - continue; - case 14: - if (tag !== 112) { - break; - } - message.explainScorePresent = reader.bool(); - continue; - case 15: - if (tag !== 120) { - break; - } - message.isConsistent = reader.bool(); - continue; - case 16: - if (tag !== 130) { - break; - } - message.generative = reader.string(); - continue; - case 17: - if (tag !== 136) { - break; - } - message.generativePresent = reader.bool(); - continue; - case 18: - if (tag !== 144) { - break; - } - message.isConsistentPresent = reader.bool(); - continue; - case 19: - if (tag !== 154) { - break; - } - message.vectorBytes = reader.bytes(); - continue; - case 20: - if (tag !== 162) { - break; - } - message.idAsBytes = reader.bytes(); - continue; - case 21: - if (tag !== 169) { - break; - } - message.rerankScore = reader.double(); - continue; - case 22: - if (tag !== 176) { - break; - } - message.rerankScorePresent = reader.bool(); - continue; - case 23: - if (tag !== 186) { - break; - } - message.vectors.push(Vectors.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - id: isSet(object.id) ? globalThis.String(object.id) : '', - vector: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.vector) - ? object.vector.map((e) => globalThis.Number(e)) - : [], - creationTimeUnix: isSet(object.creationTimeUnix) ? globalThis.Number(object.creationTimeUnix) : 0, - creationTimeUnixPresent: isSet(object.creationTimeUnixPresent) - ? globalThis.Boolean(object.creationTimeUnixPresent) - : false, - lastUpdateTimeUnix: isSet(object.lastUpdateTimeUnix) ? globalThis.Number(object.lastUpdateTimeUnix) : 0, - lastUpdateTimeUnixPresent: isSet(object.lastUpdateTimeUnixPresent) - ? globalThis.Boolean(object.lastUpdateTimeUnixPresent) - : false, - distance: isSet(object.distance) ? globalThis.Number(object.distance) : 0, - distancePresent: isSet(object.distancePresent) ? globalThis.Boolean(object.distancePresent) : false, - certainty: isSet(object.certainty) ? globalThis.Number(object.certainty) : 0, - certaintyPresent: isSet(object.certaintyPresent) ? globalThis.Boolean(object.certaintyPresent) : false, - score: isSet(object.score) ? globalThis.Number(object.score) : 0, - scorePresent: isSet(object.scorePresent) ? globalThis.Boolean(object.scorePresent) : false, - explainScore: isSet(object.explainScore) ? globalThis.String(object.explainScore) : '', - explainScorePresent: isSet(object.explainScorePresent) - ? globalThis.Boolean(object.explainScorePresent) - : false, - isConsistent: isSet(object.isConsistent) ? globalThis.Boolean(object.isConsistent) : undefined, - generative: isSet(object.generative) ? globalThis.String(object.generative) : '', - generativePresent: isSet(object.generativePresent) - ? globalThis.Boolean(object.generativePresent) - : false, - isConsistentPresent: isSet(object.isConsistentPresent) - ? globalThis.Boolean(object.isConsistentPresent) - : false, - vectorBytes: isSet(object.vectorBytes) ? bytesFromBase64(object.vectorBytes) : new Uint8Array(0), - idAsBytes: isSet(object.idAsBytes) ? bytesFromBase64(object.idAsBytes) : new Uint8Array(0), - rerankScore: isSet(object.rerankScore) ? globalThis.Number(object.rerankScore) : 0, - rerankScorePresent: isSet(object.rerankScorePresent) - ? globalThis.Boolean(object.rerankScorePresent) - : false, - vectors: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.vectors) - ? object.vectors.map((e) => Vectors.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a, _b; - const obj = {}; - if (message.id !== '') { - obj.id = message.id; - } - if ((_a = message.vector) === null || _a === void 0 ? void 0 : _a.length) { - obj.vector = message.vector; - } - if (message.creationTimeUnix !== 0) { - obj.creationTimeUnix = Math.round(message.creationTimeUnix); - } - if (message.creationTimeUnixPresent !== false) { - obj.creationTimeUnixPresent = message.creationTimeUnixPresent; - } - if (message.lastUpdateTimeUnix !== 0) { - obj.lastUpdateTimeUnix = Math.round(message.lastUpdateTimeUnix); - } - if (message.lastUpdateTimeUnixPresent !== false) { - obj.lastUpdateTimeUnixPresent = message.lastUpdateTimeUnixPresent; - } - if (message.distance !== 0) { - obj.distance = message.distance; - } - if (message.distancePresent !== false) { - obj.distancePresent = message.distancePresent; - } - if (message.certainty !== 0) { - obj.certainty = message.certainty; - } - if (message.certaintyPresent !== false) { - obj.certaintyPresent = message.certaintyPresent; - } - if (message.score !== 0) { - obj.score = message.score; - } - if (message.scorePresent !== false) { - obj.scorePresent = message.scorePresent; - } - if (message.explainScore !== '') { - obj.explainScore = message.explainScore; - } - if (message.explainScorePresent !== false) { - obj.explainScorePresent = message.explainScorePresent; - } - if (message.isConsistent !== undefined) { - obj.isConsistent = message.isConsistent; - } - if (message.generative !== '') { - obj.generative = message.generative; - } - if (message.generativePresent !== false) { - obj.generativePresent = message.generativePresent; - } - if (message.isConsistentPresent !== false) { - obj.isConsistentPresent = message.isConsistentPresent; - } - if (message.vectorBytes.length !== 0) { - obj.vectorBytes = base64FromBytes(message.vectorBytes); - } - if (message.idAsBytes.length !== 0) { - obj.idAsBytes = base64FromBytes(message.idAsBytes); - } - if (message.rerankScore !== 0) { - obj.rerankScore = message.rerankScore; - } - if (message.rerankScorePresent !== false) { - obj.rerankScorePresent = message.rerankScorePresent; - } - if ((_b = message.vectors) === null || _b === void 0 ? void 0 : _b.length) { - obj.vectors = message.vectors.map((e) => Vectors.toJSON(e)); - } - return obj; - }, - create(base) { - return MetadataResult.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y; - const message = createBaseMetadataResult(); - message.id = (_a = object.id) !== null && _a !== void 0 ? _a : ''; - message.vector = ((_b = object.vector) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; - message.creationTimeUnix = (_c = object.creationTimeUnix) !== null && _c !== void 0 ? _c : 0; - message.creationTimeUnixPresent = - (_d = object.creationTimeUnixPresent) !== null && _d !== void 0 ? _d : false; - message.lastUpdateTimeUnix = (_e = object.lastUpdateTimeUnix) !== null && _e !== void 0 ? _e : 0; - message.lastUpdateTimeUnixPresent = - (_f = object.lastUpdateTimeUnixPresent) !== null && _f !== void 0 ? _f : false; - message.distance = (_g = object.distance) !== null && _g !== void 0 ? _g : 0; - message.distancePresent = (_h = object.distancePresent) !== null && _h !== void 0 ? _h : false; - message.certainty = (_j = object.certainty) !== null && _j !== void 0 ? _j : 0; - message.certaintyPresent = (_k = object.certaintyPresent) !== null && _k !== void 0 ? _k : false; - message.score = (_l = object.score) !== null && _l !== void 0 ? _l : 0; - message.scorePresent = (_m = object.scorePresent) !== null && _m !== void 0 ? _m : false; - message.explainScore = (_o = object.explainScore) !== null && _o !== void 0 ? _o : ''; - message.explainScorePresent = (_p = object.explainScorePresent) !== null && _p !== void 0 ? _p : false; - message.isConsistent = (_q = object.isConsistent) !== null && _q !== void 0 ? _q : undefined; - message.generative = (_r = object.generative) !== null && _r !== void 0 ? _r : ''; - message.generativePresent = (_s = object.generativePresent) !== null && _s !== void 0 ? _s : false; - message.isConsistentPresent = (_t = object.isConsistentPresent) !== null && _t !== void 0 ? _t : false; - message.vectorBytes = (_u = object.vectorBytes) !== null && _u !== void 0 ? _u : new Uint8Array(0); - message.idAsBytes = (_v = object.idAsBytes) !== null && _v !== void 0 ? _v : new Uint8Array(0); - message.rerankScore = (_w = object.rerankScore) !== null && _w !== void 0 ? _w : 0; - message.rerankScorePresent = (_x = object.rerankScorePresent) !== null && _x !== void 0 ? _x : false; - message.vectors = - ((_y = object.vectors) === null || _y === void 0 ? void 0 : _y.map((e) => Vectors.fromPartial(e))) || - []; - return message; - }, -}; -function createBasePropertiesResult() { - return { - nonRefProperties: undefined, - refProps: [], - targetCollection: '', - metadata: undefined, - numberArrayProperties: [], - intArrayProperties: [], - textArrayProperties: [], - booleanArrayProperties: [], - objectProperties: [], - objectArrayProperties: [], - nonRefProps: undefined, - refPropsRequested: false, - }; -} -export const PropertiesResult = { - encode(message, writer = _m0.Writer.create()) { - if (message.nonRefProperties !== undefined) { - Struct.encode(Struct.wrap(message.nonRefProperties), writer.uint32(10).fork()).ldelim(); - } - for (const v of message.refProps) { - RefPropertiesResult.encode(v, writer.uint32(18).fork()).ldelim(); - } - if (message.targetCollection !== '') { - writer.uint32(26).string(message.targetCollection); - } - if (message.metadata !== undefined) { - MetadataResult.encode(message.metadata, writer.uint32(34).fork()).ldelim(); - } - for (const v of message.numberArrayProperties) { - NumberArrayProperties.encode(v, writer.uint32(42).fork()).ldelim(); - } - for (const v of message.intArrayProperties) { - IntArrayProperties.encode(v, writer.uint32(50).fork()).ldelim(); - } - for (const v of message.textArrayProperties) { - TextArrayProperties.encode(v, writer.uint32(58).fork()).ldelim(); - } - for (const v of message.booleanArrayProperties) { - BooleanArrayProperties.encode(v, writer.uint32(66).fork()).ldelim(); - } - for (const v of message.objectProperties) { - ObjectProperties.encode(v, writer.uint32(74).fork()).ldelim(); - } - for (const v of message.objectArrayProperties) { - ObjectArrayProperties.encode(v, writer.uint32(82).fork()).ldelim(); - } - if (message.nonRefProps !== undefined) { - Properties.encode(message.nonRefProps, writer.uint32(90).fork()).ldelim(); - } - if (message.refPropsRequested !== false) { - writer.uint32(96).bool(message.refPropsRequested); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBasePropertiesResult(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.nonRefProperties = Struct.unwrap(Struct.decode(reader, reader.uint32())); - continue; - case 2: - if (tag !== 18) { - break; - } - message.refProps.push(RefPropertiesResult.decode(reader, reader.uint32())); - continue; - case 3: - if (tag !== 26) { - break; - } - message.targetCollection = reader.string(); - continue; - case 4: - if (tag !== 34) { - break; - } - message.metadata = MetadataResult.decode(reader, reader.uint32()); - continue; - case 5: - if (tag !== 42) { - break; - } - message.numberArrayProperties.push(NumberArrayProperties.decode(reader, reader.uint32())); - continue; - case 6: - if (tag !== 50) { - break; - } - message.intArrayProperties.push(IntArrayProperties.decode(reader, reader.uint32())); - continue; - case 7: - if (tag !== 58) { - break; - } - message.textArrayProperties.push(TextArrayProperties.decode(reader, reader.uint32())); - continue; - case 8: - if (tag !== 66) { - break; - } - message.booleanArrayProperties.push(BooleanArrayProperties.decode(reader, reader.uint32())); - continue; - case 9: - if (tag !== 74) { - break; - } - message.objectProperties.push(ObjectProperties.decode(reader, reader.uint32())); - continue; - case 10: - if (tag !== 82) { - break; - } - message.objectArrayProperties.push(ObjectArrayProperties.decode(reader, reader.uint32())); - continue; - case 11: - if (tag !== 90) { - break; - } - message.nonRefProps = Properties.decode(reader, reader.uint32()); - continue; - case 12: - if (tag !== 96) { - break; - } - message.refPropsRequested = reader.bool(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - nonRefProperties: isObject(object.nonRefProperties) ? object.nonRefProperties : undefined, - refProps: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.refProps) - ? object.refProps.map((e) => RefPropertiesResult.fromJSON(e)) - : [], - targetCollection: isSet(object.targetCollection) ? globalThis.String(object.targetCollection) : '', - metadata: isSet(object.metadata) ? MetadataResult.fromJSON(object.metadata) : undefined, - numberArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.numberArrayProperties - ) - ? object.numberArrayProperties.map((e) => NumberArrayProperties.fromJSON(e)) - : [], - intArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.intArrayProperties - ) - ? object.intArrayProperties.map((e) => IntArrayProperties.fromJSON(e)) - : [], - textArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.textArrayProperties - ) - ? object.textArrayProperties.map((e) => TextArrayProperties.fromJSON(e)) - : [], - booleanArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.booleanArrayProperties - ) - ? object.booleanArrayProperties.map((e) => BooleanArrayProperties.fromJSON(e)) - : [], - objectProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectProperties - ) - ? object.objectProperties.map((e) => ObjectProperties.fromJSON(e)) - : [], - objectArrayProperties: globalThis.Array.isArray( - object === null || object === void 0 ? void 0 : object.objectArrayProperties - ) - ? object.objectArrayProperties.map((e) => ObjectArrayProperties.fromJSON(e)) - : [], - nonRefProps: isSet(object.nonRefProps) ? Properties.fromJSON(object.nonRefProps) : undefined, - refPropsRequested: isSet(object.refPropsRequested) - ? globalThis.Boolean(object.refPropsRequested) - : false, - }; - }, - toJSON(message) { - var _a, _b, _c, _d, _e, _f, _g; - const obj = {}; - if (message.nonRefProperties !== undefined) { - obj.nonRefProperties = message.nonRefProperties; - } - if ((_a = message.refProps) === null || _a === void 0 ? void 0 : _a.length) { - obj.refProps = message.refProps.map((e) => RefPropertiesResult.toJSON(e)); - } - if (message.targetCollection !== '') { - obj.targetCollection = message.targetCollection; - } - if (message.metadata !== undefined) { - obj.metadata = MetadataResult.toJSON(message.metadata); - } - if ((_b = message.numberArrayProperties) === null || _b === void 0 ? void 0 : _b.length) { - obj.numberArrayProperties = message.numberArrayProperties.map((e) => NumberArrayProperties.toJSON(e)); - } - if ((_c = message.intArrayProperties) === null || _c === void 0 ? void 0 : _c.length) { - obj.intArrayProperties = message.intArrayProperties.map((e) => IntArrayProperties.toJSON(e)); - } - if ((_d = message.textArrayProperties) === null || _d === void 0 ? void 0 : _d.length) { - obj.textArrayProperties = message.textArrayProperties.map((e) => TextArrayProperties.toJSON(e)); - } - if ((_e = message.booleanArrayProperties) === null || _e === void 0 ? void 0 : _e.length) { - obj.booleanArrayProperties = message.booleanArrayProperties.map((e) => - BooleanArrayProperties.toJSON(e) - ); - } - if ((_f = message.objectProperties) === null || _f === void 0 ? void 0 : _f.length) { - obj.objectProperties = message.objectProperties.map((e) => ObjectProperties.toJSON(e)); - } - if ((_g = message.objectArrayProperties) === null || _g === void 0 ? void 0 : _g.length) { - obj.objectArrayProperties = message.objectArrayProperties.map((e) => ObjectArrayProperties.toJSON(e)); - } - if (message.nonRefProps !== undefined) { - obj.nonRefProps = Properties.toJSON(message.nonRefProps); - } - if (message.refPropsRequested !== false) { - obj.refPropsRequested = message.refPropsRequested; - } - return obj; - }, - create(base) { - return PropertiesResult.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; - const message = createBasePropertiesResult(); - message.nonRefProperties = (_a = object.nonRefProperties) !== null && _a !== void 0 ? _a : undefined; - message.refProps = - ((_b = object.refProps) === null || _b === void 0 - ? void 0 - : _b.map((e) => RefPropertiesResult.fromPartial(e))) || []; - message.targetCollection = (_c = object.targetCollection) !== null && _c !== void 0 ? _c : ''; - message.metadata = - object.metadata !== undefined && object.metadata !== null - ? MetadataResult.fromPartial(object.metadata) - : undefined; - message.numberArrayProperties = - ((_d = object.numberArrayProperties) === null || _d === void 0 - ? void 0 - : _d.map((e) => NumberArrayProperties.fromPartial(e))) || []; - message.intArrayProperties = - ((_e = object.intArrayProperties) === null || _e === void 0 - ? void 0 - : _e.map((e) => IntArrayProperties.fromPartial(e))) || []; - message.textArrayProperties = - ((_f = object.textArrayProperties) === null || _f === void 0 - ? void 0 - : _f.map((e) => TextArrayProperties.fromPartial(e))) || []; - message.booleanArrayProperties = - ((_g = object.booleanArrayProperties) === null || _g === void 0 - ? void 0 - : _g.map((e) => BooleanArrayProperties.fromPartial(e))) || []; - message.objectProperties = - ((_h = object.objectProperties) === null || _h === void 0 - ? void 0 - : _h.map((e) => ObjectProperties.fromPartial(e))) || []; - message.objectArrayProperties = - ((_j = object.objectArrayProperties) === null || _j === void 0 - ? void 0 - : _j.map((e) => ObjectArrayProperties.fromPartial(e))) || []; - message.nonRefProps = - object.nonRefProps !== undefined && object.nonRefProps !== null - ? Properties.fromPartial(object.nonRefProps) - : undefined; - message.refPropsRequested = (_k = object.refPropsRequested) !== null && _k !== void 0 ? _k : false; - return message; - }, -}; -function createBaseRefPropertiesResult() { - return { properties: [], propName: '' }; -} -export const RefPropertiesResult = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.properties) { - PropertiesResult.encode(v, writer.uint32(10).fork()).ldelim(); - } - if (message.propName !== '') { - writer.uint32(18).string(message.propName); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseRefPropertiesResult(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.properties.push(PropertiesResult.decode(reader, reader.uint32())); - continue; - case 2: - if (tag !== 18) { - break; - } - message.propName = reader.string(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - properties: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.properties) - ? object.properties.map((e) => PropertiesResult.fromJSON(e)) - : [], - propName: isSet(object.propName) ? globalThis.String(object.propName) : '', - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.properties) === null || _a === void 0 ? void 0 : _a.length) { - obj.properties = message.properties.map((e) => PropertiesResult.toJSON(e)); - } - if (message.propName !== '') { - obj.propName = message.propName; - } - return obj; - }, - create(base) { - return RefPropertiesResult.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseRefPropertiesResult(); - message.properties = - ((_a = object.properties) === null || _a === void 0 - ? void 0 - : _a.map((e) => PropertiesResult.fromPartial(e))) || []; - message.propName = (_b = object.propName) !== null && _b !== void 0 ? _b : ''; - return message; - }, -}; -function bytesFromBase64(b64) { - if (globalThis.Buffer) { - return Uint8Array.from(globalThis.Buffer.from(b64, 'base64')); - } else { - const bin = globalThis.atob(b64); - const arr = new Uint8Array(bin.length); - for (let i = 0; i < bin.length; ++i) { - arr[i] = bin.charCodeAt(i); - } - return arr; - } -} -function base64FromBytes(arr) { - if (globalThis.Buffer) { - return globalThis.Buffer.from(arr).toString('base64'); - } else { - const bin = []; - arr.forEach((byte) => { - bin.push(globalThis.String.fromCharCode(byte)); - }); - return globalThis.btoa(bin.join('')); - } -} -function longToNumber(long) { - if (long.gt(globalThis.Number.MAX_SAFE_INTEGER)) { - throw new globalThis.Error('Value is larger than Number.MAX_SAFE_INTEGER'); - } - return long.toNumber(); -} -if (_m0.util.Long !== Long) { - _m0.util.Long = Long; - _m0.configure(); -} -function isObject(value) { - return typeof value === 'object' && value !== null; -} -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/esm/proto/v1/tenants.d.ts b/dist/node/esm/proto/v1/tenants.d.ts deleted file mode 100644 index 6ac14095..00000000 --- a/dist/node/esm/proto/v1/tenants.d.ts +++ /dev/null @@ -1,79 +0,0 @@ -import _m0 from 'protobufjs/minimal.js'; -export declare const protobufPackage = 'weaviate.v1'; -export declare enum TenantActivityStatus { - TENANT_ACTIVITY_STATUS_UNSPECIFIED = 0, - TENANT_ACTIVITY_STATUS_HOT = 1, - TENANT_ACTIVITY_STATUS_COLD = 2, - TENANT_ACTIVITY_STATUS_FROZEN = 4, - TENANT_ACTIVITY_STATUS_UNFREEZING = 5, - TENANT_ACTIVITY_STATUS_FREEZING = 6, - /** TENANT_ACTIVITY_STATUS_ACTIVE - not used yet - added to let the clients already add code to handle this in the future */ - TENANT_ACTIVITY_STATUS_ACTIVE = 7, - TENANT_ACTIVITY_STATUS_INACTIVE = 8, - TENANT_ACTIVITY_STATUS_OFFLOADED = 9, - TENANT_ACTIVITY_STATUS_OFFLOADING = 10, - TENANT_ACTIVITY_STATUS_ONLOADING = 11, - UNRECOGNIZED = -1, -} -export declare function tenantActivityStatusFromJSON(object: any): TenantActivityStatus; -export declare function tenantActivityStatusToJSON(object: TenantActivityStatus): string; -export interface TenantsGetRequest { - collection: string; - names?: TenantNames | undefined; -} -export interface TenantNames { - values: string[]; -} -export interface TenantsGetReply { - took: number; - tenants: Tenant[]; -} -export interface Tenant { - name: string; - activityStatus: TenantActivityStatus; -} -export declare const TenantsGetRequest: { - encode(message: TenantsGetRequest, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): TenantsGetRequest; - fromJSON(object: any): TenantsGetRequest; - toJSON(message: TenantsGetRequest): unknown; - create(base?: DeepPartial): TenantsGetRequest; - fromPartial(object: DeepPartial): TenantsGetRequest; -}; -export declare const TenantNames: { - encode(message: TenantNames, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): TenantNames; - fromJSON(object: any): TenantNames; - toJSON(message: TenantNames): unknown; - create(base?: DeepPartial): TenantNames; - fromPartial(object: DeepPartial): TenantNames; -}; -export declare const TenantsGetReply: { - encode(message: TenantsGetReply, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): TenantsGetReply; - fromJSON(object: any): TenantsGetReply; - toJSON(message: TenantsGetReply): unknown; - create(base?: DeepPartial): TenantsGetReply; - fromPartial(object: DeepPartial): TenantsGetReply; -}; -export declare const Tenant: { - encode(message: Tenant, writer?: _m0.Writer): _m0.Writer; - decode(input: _m0.Reader | Uint8Array, length?: number): Tenant; - fromJSON(object: any): Tenant; - toJSON(message: Tenant): unknown; - create(base?: DeepPartial): Tenant; - fromPartial(object: DeepPartial): Tenant; -}; -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/esm/proto/v1/tenants.js b/dist/node/esm/proto/v1/tenants.js deleted file mode 100644 index caff561b..00000000 --- a/dist/node/esm/proto/v1/tenants.js +++ /dev/null @@ -1,370 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/tenants.proto -/* eslint-disable */ -import _m0 from 'protobufjs/minimal.js'; -export const protobufPackage = 'weaviate.v1'; -export var TenantActivityStatus; -(function (TenantActivityStatus) { - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_UNSPECIFIED'] = 0)] = - 'TENANT_ACTIVITY_STATUS_UNSPECIFIED'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_HOT'] = 1)] = - 'TENANT_ACTIVITY_STATUS_HOT'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_COLD'] = 2)] = - 'TENANT_ACTIVITY_STATUS_COLD'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_FROZEN'] = 4)] = - 'TENANT_ACTIVITY_STATUS_FROZEN'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_UNFREEZING'] = 5)] = - 'TENANT_ACTIVITY_STATUS_UNFREEZING'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_FREEZING'] = 6)] = - 'TENANT_ACTIVITY_STATUS_FREEZING'; - /** TENANT_ACTIVITY_STATUS_ACTIVE - not used yet - added to let the clients already add code to handle this in the future */ - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_ACTIVE'] = 7)] = - 'TENANT_ACTIVITY_STATUS_ACTIVE'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_INACTIVE'] = 8)] = - 'TENANT_ACTIVITY_STATUS_INACTIVE'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_OFFLOADED'] = 9)] = - 'TENANT_ACTIVITY_STATUS_OFFLOADED'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_OFFLOADING'] = 10)] = - 'TENANT_ACTIVITY_STATUS_OFFLOADING'; - TenantActivityStatus[(TenantActivityStatus['TENANT_ACTIVITY_STATUS_ONLOADING'] = 11)] = - 'TENANT_ACTIVITY_STATUS_ONLOADING'; - TenantActivityStatus[(TenantActivityStatus['UNRECOGNIZED'] = -1)] = 'UNRECOGNIZED'; -})(TenantActivityStatus || (TenantActivityStatus = {})); -export function tenantActivityStatusFromJSON(object) { - switch (object) { - case 0: - case 'TENANT_ACTIVITY_STATUS_UNSPECIFIED': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_UNSPECIFIED; - case 1: - case 'TENANT_ACTIVITY_STATUS_HOT': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_HOT; - case 2: - case 'TENANT_ACTIVITY_STATUS_COLD': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_COLD; - case 4: - case 'TENANT_ACTIVITY_STATUS_FROZEN': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_FROZEN; - case 5: - case 'TENANT_ACTIVITY_STATUS_UNFREEZING': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_UNFREEZING; - case 6: - case 'TENANT_ACTIVITY_STATUS_FREEZING': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_FREEZING; - case 7: - case 'TENANT_ACTIVITY_STATUS_ACTIVE': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_ACTIVE; - case 8: - case 'TENANT_ACTIVITY_STATUS_INACTIVE': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_INACTIVE; - case 9: - case 'TENANT_ACTIVITY_STATUS_OFFLOADED': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_OFFLOADED; - case 10: - case 'TENANT_ACTIVITY_STATUS_OFFLOADING': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_OFFLOADING; - case 11: - case 'TENANT_ACTIVITY_STATUS_ONLOADING': - return TenantActivityStatus.TENANT_ACTIVITY_STATUS_ONLOADING; - case -1: - case 'UNRECOGNIZED': - default: - return TenantActivityStatus.UNRECOGNIZED; - } -} -export function tenantActivityStatusToJSON(object) { - switch (object) { - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_UNSPECIFIED: - return 'TENANT_ACTIVITY_STATUS_UNSPECIFIED'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_HOT: - return 'TENANT_ACTIVITY_STATUS_HOT'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_COLD: - return 'TENANT_ACTIVITY_STATUS_COLD'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_FROZEN: - return 'TENANT_ACTIVITY_STATUS_FROZEN'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_UNFREEZING: - return 'TENANT_ACTIVITY_STATUS_UNFREEZING'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_FREEZING: - return 'TENANT_ACTIVITY_STATUS_FREEZING'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_ACTIVE: - return 'TENANT_ACTIVITY_STATUS_ACTIVE'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_INACTIVE: - return 'TENANT_ACTIVITY_STATUS_INACTIVE'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_OFFLOADED: - return 'TENANT_ACTIVITY_STATUS_OFFLOADED'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_OFFLOADING: - return 'TENANT_ACTIVITY_STATUS_OFFLOADING'; - case TenantActivityStatus.TENANT_ACTIVITY_STATUS_ONLOADING: - return 'TENANT_ACTIVITY_STATUS_ONLOADING'; - case TenantActivityStatus.UNRECOGNIZED: - default: - return 'UNRECOGNIZED'; - } -} -function createBaseTenantsGetRequest() { - return { collection: '', names: undefined }; -} -export const TenantsGetRequest = { - encode(message, writer = _m0.Writer.create()) { - if (message.collection !== '') { - writer.uint32(10).string(message.collection); - } - if (message.names !== undefined) { - TenantNames.encode(message.names, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTenantsGetRequest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.collection = reader.string(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.names = TenantNames.decode(reader, reader.uint32()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - collection: isSet(object.collection) ? globalThis.String(object.collection) : '', - names: isSet(object.names) ? TenantNames.fromJSON(object.names) : undefined, - }; - }, - toJSON(message) { - const obj = {}; - if (message.collection !== '') { - obj.collection = message.collection; - } - if (message.names !== undefined) { - obj.names = TenantNames.toJSON(message.names); - } - return obj; - }, - create(base) { - return TenantsGetRequest.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseTenantsGetRequest(); - message.collection = (_a = object.collection) !== null && _a !== void 0 ? _a : ''; - message.names = - object.names !== undefined && object.names !== null ? TenantNames.fromPartial(object.names) : undefined; - return message; - }, -}; -function createBaseTenantNames() { - return { values: [] }; -} -export const TenantNames = { - encode(message, writer = _m0.Writer.create()) { - for (const v of message.values) { - writer.uint32(10).string(v); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTenantNames(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.values.push(reader.string()); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - values: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.values) - ? object.values.map((e) => globalThis.String(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if ((_a = message.values) === null || _a === void 0 ? void 0 : _a.length) { - obj.values = message.values; - } - return obj; - }, - create(base) { - return TenantNames.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a; - const message = createBaseTenantNames(); - message.values = ((_a = object.values) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; - return message; - }, -}; -function createBaseTenantsGetReply() { - return { took: 0, tenants: [] }; -} -export const TenantsGetReply = { - encode(message, writer = _m0.Writer.create()) { - if (message.took !== 0) { - writer.uint32(13).float(message.took); - } - for (const v of message.tenants) { - Tenant.encode(v, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTenantsGetReply(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 13) { - break; - } - message.took = reader.float(); - continue; - case 2: - if (tag !== 18) { - break; - } - message.tenants.push(Tenant.decode(reader, reader.uint32())); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - took: isSet(object.took) ? globalThis.Number(object.took) : 0, - tenants: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.tenants) - ? object.tenants.map((e) => Tenant.fromJSON(e)) - : [], - }; - }, - toJSON(message) { - var _a; - const obj = {}; - if (message.took !== 0) { - obj.took = message.took; - } - if ((_a = message.tenants) === null || _a === void 0 ? void 0 : _a.length) { - obj.tenants = message.tenants.map((e) => Tenant.toJSON(e)); - } - return obj; - }, - create(base) { - return TenantsGetReply.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseTenantsGetReply(); - message.took = (_a = object.took) !== null && _a !== void 0 ? _a : 0; - message.tenants = - ((_b = object.tenants) === null || _b === void 0 ? void 0 : _b.map((e) => Tenant.fromPartial(e))) || []; - return message; - }, -}; -function createBaseTenant() { - return { name: '', activityStatus: 0 }; -} -export const Tenant = { - encode(message, writer = _m0.Writer.create()) { - if (message.name !== '') { - writer.uint32(10).string(message.name); - } - if (message.activityStatus !== 0) { - writer.uint32(16).int32(message.activityStatus); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseTenant(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - if (tag !== 10) { - break; - } - message.name = reader.string(); - continue; - case 2: - if (tag !== 16) { - break; - } - message.activityStatus = reader.int32(); - continue; - } - if ((tag & 7) === 4 || tag === 0) { - break; - } - reader.skipType(tag & 7); - } - return message; - }, - fromJSON(object) { - return { - name: isSet(object.name) ? globalThis.String(object.name) : '', - activityStatus: isSet(object.activityStatus) ? tenantActivityStatusFromJSON(object.activityStatus) : 0, - }; - }, - toJSON(message) { - const obj = {}; - if (message.name !== '') { - obj.name = message.name; - } - if (message.activityStatus !== 0) { - obj.activityStatus = tenantActivityStatusToJSON(message.activityStatus); - } - return obj; - }, - create(base) { - return Tenant.fromPartial(base !== null && base !== void 0 ? base : {}); - }, - fromPartial(object) { - var _a, _b; - const message = createBaseTenant(); - message.name = (_a = object.name) !== null && _a !== void 0 ? _a : ''; - message.activityStatus = (_b = object.activityStatus) !== null && _b !== void 0 ? _b : 0; - return message; - }, -}; -function isSet(value) { - return value !== null && value !== undefined; -} diff --git a/dist/node/esm/proto/v1/weaviate.d.ts b/dist/node/esm/proto/v1/weaviate.d.ts deleted file mode 100644 index 811cc998..00000000 --- a/dist/node/esm/proto/v1/weaviate.d.ts +++ /dev/null @@ -1,4427 +0,0 @@ -import { type CallContext, type CallOptions } from 'nice-grpc-common'; -import { BatchObjectsReply, BatchObjectsRequest } from './batch.js'; -import { BatchDeleteReply, BatchDeleteRequest } from './batch_delete.js'; -import { SearchReply, SearchRequest } from './search_get.js'; -import { TenantsGetReply, TenantsGetRequest } from './tenants.js'; -export declare const protobufPackage = 'weaviate.v1'; -export type WeaviateDefinition = typeof WeaviateDefinition; -export declare const WeaviateDefinition: { - readonly name: 'Weaviate'; - readonly fullName: 'weaviate.v1.Weaviate'; - readonly methods: { - readonly search: { - readonly name: 'Search'; - readonly requestType: { - encode(message: SearchRequest, writer?: import('protobufjs').Writer): import('protobufjs').Writer; - decode(input: Uint8Array | import('protobufjs').Reader, length?: number | undefined): SearchRequest; - fromJSON(object: any): SearchRequest; - toJSON(message: SearchRequest): unknown; - create( - base?: - | { - collection?: string | undefined; - tenant?: string | undefined; - consistencyLevel?: import('./base.js').ConsistencyLevel | undefined; - properties?: - | { - nonRefProperties?: string[] | undefined; - refProperties?: - | { - referenceProperty?: string | undefined; - properties?: any | undefined; - metadata?: - | { - uuid?: boolean | undefined; - vector?: boolean | undefined; - creationTimeUnix?: boolean | undefined; - lastUpdateTimeUnix?: boolean | undefined; - distance?: boolean | undefined; - certainty?: boolean | undefined; - score?: boolean | undefined; - explainScore?: boolean | undefined; - isConsistent?: boolean | undefined; - vectors?: string[] | undefined; - } - | undefined; - targetCollection?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - propName?: string | undefined; - primitiveProperties?: string[] | undefined; - objectProperties?: any[] | undefined; - }[] - | undefined; - returnAllNonrefProperties?: boolean | undefined; - } - | undefined; - metadata?: - | { - uuid?: boolean | undefined; - vector?: boolean | undefined; - creationTimeUnix?: boolean | undefined; - lastUpdateTimeUnix?: boolean | undefined; - distance?: boolean | undefined; - certainty?: boolean | undefined; - score?: boolean | undefined; - explainScore?: boolean | undefined; - isConsistent?: boolean | undefined; - vectors?: string[] | undefined; - } - | undefined; - groupBy?: - | { - path?: string[] | undefined; - numberOfGroups?: number | undefined; - objectsPerGroup?: number | undefined; - } - | undefined; - limit?: number | undefined; - offset?: number | undefined; - autocut?: number | undefined; - after?: string | undefined; - sortBy?: - | { - ascending?: boolean | undefined; - path?: string[] | undefined; - }[] - | undefined; - filters?: - | { - operator?: import('./base.js').Filters_Operator | undefined; - on?: string[] | undefined; - filters?: any[] | undefined; - valueText?: string | undefined; - valueInt?: number | undefined; - valueBoolean?: boolean | undefined; - valueNumber?: number | undefined; - valueTextArray?: - | { - values?: string[] | undefined; - } - | undefined; - valueIntArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueBooleanArray?: - | { - values?: boolean[] | undefined; - } - | undefined; - valueNumberArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueGeo?: - | { - latitude?: number | undefined; - longitude?: number | undefined; - distance?: number | undefined; - } - | undefined; - target?: - | { - property?: string | undefined; - singleTarget?: - | { - on?: string | undefined; - target?: any | undefined; - } - | undefined; - multiTarget?: - | { - on?: string | undefined; - target?: any | undefined; - targetCollection?: string | undefined; - } - | undefined; - count?: - | { - on?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - hybridSearch?: - | { - query?: string | undefined; - properties?: string[] | undefined; - vector?: number[] | undefined; - alpha?: number | undefined; - fusionType?: import('./search_get.js').Hybrid_FusionType | undefined; - vectorBytes?: Uint8Array | undefined; - targetVectors?: string[] | undefined; - nearText?: - | { - query?: string[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - moveTo?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - moveAway?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearVector?: - | { - vector?: number[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - vectorBytes?: Uint8Array | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - vectorPerTarget?: - | { - [x: string]: Uint8Array | undefined; - } - | undefined; - vectorForTargets?: - | { - name?: string | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - vectorDistance?: number | undefined; - } - | undefined; - bm25Search?: - | { - query?: string | undefined; - properties?: string[] | undefined; - } - | undefined; - nearVector?: - | { - vector?: number[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - vectorBytes?: Uint8Array | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - vectorPerTarget?: - | { - [x: string]: Uint8Array | undefined; - } - | undefined; - vectorForTargets?: - | { - name?: string | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - nearObject?: - | { - id?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearText?: - | { - query?: string[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - moveTo?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - moveAway?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearImage?: - | { - image?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearAudio?: - | { - audio?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearVideo?: - | { - video?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearDepth?: - | { - depth?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearThermal?: - | { - thermal?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearImu?: - | { - imu?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - generative?: - | { - singleResponsePrompt?: string | undefined; - groupedResponseTask?: string | undefined; - groupedProperties?: string[] | undefined; - single?: - | { - prompt?: string | undefined; - debug?: boolean | undefined; - queries?: - | { - returnMetadata?: boolean | undefined; - anthropic?: - | { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - temperature?: number | undefined; - topK?: number | undefined; - topP?: number | undefined; - stopSequences?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - anyscale?: - | { - baseUrl?: string | undefined; - model?: string | undefined; - temperature?: number | undefined; - } - | undefined; - aws?: - | { - model?: string | undefined; - temperature?: number | undefined; - } - | undefined; - cohere?: - | { - baseUrl?: string | undefined; - frequencyPenalty?: number | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - k?: number | undefined; - p?: number | undefined; - presencePenalty?: number | undefined; - stopSequences?: - | { - values?: string[] | undefined; - } - | undefined; - temperature?: number | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - temperature?: number | undefined; - topP?: number | undefined; - } - | undefined; - octoai?: - | { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - n?: number | undefined; - temperature?: number | undefined; - topP?: number | undefined; - } - | undefined; - ollama?: - | { - apiEndpoint?: string | undefined; - model?: string | undefined; - temperature?: number | undefined; - } - | undefined; - openai?: - | { - frequencyPenalty?: number | undefined; - logProbs?: boolean | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - n?: number | undefined; - presencePenalty?: number | undefined; - stop?: - | { - values?: string[] | undefined; - } - | undefined; - temperature?: number | undefined; - topP?: number | undefined; - topLogProbs?: number | undefined; - } - | undefined; - google?: - | { - frequencyPenalty?: number | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - presencePenalty?: number | undefined; - temperature?: number | undefined; - topK?: number | undefined; - topP?: number | undefined; - stopSequences?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - grouped?: - | { - task?: string | undefined; - properties?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - rerank?: - | { - property?: string | undefined; - query?: string | undefined; - } - | undefined; - uses123Api?: boolean | undefined; - uses125Api?: boolean | undefined; - uses127Api?: boolean | undefined; - } - | undefined - ): SearchRequest; - fromPartial(object: { - collection?: string | undefined; - tenant?: string | undefined; - consistencyLevel?: import('./base.js').ConsistencyLevel | undefined; - properties?: - | { - nonRefProperties?: string[] | undefined; - refProperties?: - | { - referenceProperty?: string | undefined; - properties?: any | undefined; - metadata?: - | { - uuid?: boolean | undefined; - vector?: boolean | undefined; - creationTimeUnix?: boolean | undefined; - lastUpdateTimeUnix?: boolean | undefined; - distance?: boolean | undefined; - certainty?: boolean | undefined; - score?: boolean | undefined; - explainScore?: boolean | undefined; - isConsistent?: boolean | undefined; - vectors?: string[] | undefined; - } - | undefined; - targetCollection?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - propName?: string | undefined; - primitiveProperties?: string[] | undefined; - objectProperties?: any[] | undefined; - }[] - | undefined; - returnAllNonrefProperties?: boolean | undefined; - } - | undefined; - metadata?: - | { - uuid?: boolean | undefined; - vector?: boolean | undefined; - creationTimeUnix?: boolean | undefined; - lastUpdateTimeUnix?: boolean | undefined; - distance?: boolean | undefined; - certainty?: boolean | undefined; - score?: boolean | undefined; - explainScore?: boolean | undefined; - isConsistent?: boolean | undefined; - vectors?: string[] | undefined; - } - | undefined; - groupBy?: - | { - path?: string[] | undefined; - numberOfGroups?: number | undefined; - objectsPerGroup?: number | undefined; - } - | undefined; - limit?: number | undefined; - offset?: number | undefined; - autocut?: number | undefined; - after?: string | undefined; - sortBy?: - | { - ascending?: boolean | undefined; - path?: string[] | undefined; - }[] - | undefined; - filters?: - | { - operator?: import('./base.js').Filters_Operator | undefined; - on?: string[] | undefined; - filters?: any[] | undefined; - valueText?: string | undefined; - valueInt?: number | undefined; - valueBoolean?: boolean | undefined; - valueNumber?: number | undefined; - valueTextArray?: - | { - values?: string[] | undefined; - } - | undefined; - valueIntArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueBooleanArray?: - | { - values?: boolean[] | undefined; - } - | undefined; - valueNumberArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueGeo?: - | { - latitude?: number | undefined; - longitude?: number | undefined; - distance?: number | undefined; - } - | undefined; - target?: - | { - property?: string | undefined; - singleTarget?: - | { - on?: string | undefined; - target?: any | undefined; - } - | undefined; - multiTarget?: - | { - on?: string | undefined; - target?: any | undefined; - targetCollection?: string | undefined; - } - | undefined; - count?: - | { - on?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - hybridSearch?: - | { - query?: string | undefined; - properties?: string[] | undefined; - vector?: number[] | undefined; - alpha?: number | undefined; - fusionType?: import('./search_get.js').Hybrid_FusionType | undefined; - vectorBytes?: Uint8Array | undefined; - targetVectors?: string[] | undefined; - nearText?: - | { - query?: string[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - moveTo?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - moveAway?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearVector?: - | { - vector?: number[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - vectorBytes?: Uint8Array | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - vectorPerTarget?: - | { - [x: string]: Uint8Array | undefined; - } - | undefined; - vectorForTargets?: - | { - name?: string | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - vectorDistance?: number | undefined; - } - | undefined; - bm25Search?: - | { - query?: string | undefined; - properties?: string[] | undefined; - } - | undefined; - nearVector?: - | { - vector?: number[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - vectorBytes?: Uint8Array | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - vectorPerTarget?: - | { - [x: string]: Uint8Array | undefined; - } - | undefined; - vectorForTargets?: - | { - name?: string | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - nearObject?: - | { - id?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearText?: - | { - query?: string[] | undefined; - certainty?: number | undefined; - distance?: number | undefined; - moveTo?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - moveAway?: - | { - force?: number | undefined; - concepts?: string[] | undefined; - uuids?: string[] | undefined; - } - | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearImage?: - | { - image?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearAudio?: - | { - audio?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearVideo?: - | { - video?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearDepth?: - | { - depth?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearThermal?: - | { - thermal?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - nearImu?: - | { - imu?: string | undefined; - certainty?: number | undefined; - distance?: number | undefined; - targetVectors?: string[] | undefined; - targets?: - | { - targetVectors?: string[] | undefined; - combination?: import('./search_get.js').CombinationMethod | undefined; - weights?: - | { - [x: string]: number | undefined; - } - | undefined; - weightsForTargets?: - | { - target?: string | undefined; - weight?: number | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - generative?: - | { - singleResponsePrompt?: string | undefined; - groupedResponseTask?: string | undefined; - groupedProperties?: string[] | undefined; - single?: - | { - prompt?: string | undefined; - debug?: boolean | undefined; - queries?: - | { - returnMetadata?: boolean | undefined; - anthropic?: - | { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - temperature?: number | undefined; - topK?: number | undefined; - topP?: number | undefined; - stopSequences?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - anyscale?: - | { - baseUrl?: string | undefined; - model?: string | undefined; - temperature?: number | undefined; - } - | undefined; - aws?: - | { - model?: string | undefined; - temperature?: number | undefined; - } - | undefined; - cohere?: - | { - baseUrl?: string | undefined; - frequencyPenalty?: number | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - k?: number | undefined; - p?: number | undefined; - presencePenalty?: number | undefined; - stopSequences?: - | { - values?: string[] | undefined; - } - | undefined; - temperature?: number | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - temperature?: number | undefined; - topP?: number | undefined; - } - | undefined; - octoai?: - | { - baseUrl?: string | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - n?: number | undefined; - temperature?: number | undefined; - topP?: number | undefined; - } - | undefined; - ollama?: - | { - apiEndpoint?: string | undefined; - model?: string | undefined; - temperature?: number | undefined; - } - | undefined; - openai?: - | { - frequencyPenalty?: number | undefined; - logProbs?: boolean | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - n?: number | undefined; - presencePenalty?: number | undefined; - stop?: - | { - values?: string[] | undefined; - } - | undefined; - temperature?: number | undefined; - topP?: number | undefined; - topLogProbs?: number | undefined; - } - | undefined; - google?: - | { - frequencyPenalty?: number | undefined; - maxTokens?: number | undefined; - model?: string | undefined; - presencePenalty?: number | undefined; - temperature?: number | undefined; - topK?: number | undefined; - topP?: number | undefined; - stopSequences?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - grouped?: - | { - task?: string | undefined; - properties?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - rerank?: - | { - property?: string | undefined; - query?: string | undefined; - } - | undefined; - uses123Api?: boolean | undefined; - uses125Api?: boolean | undefined; - uses127Api?: boolean | undefined; - }): SearchRequest; - }; - readonly requestStream: false; - readonly responseType: { - encode(message: SearchReply, writer?: import('protobufjs').Writer): import('protobufjs').Writer; - decode(input: Uint8Array | import('protobufjs').Reader, length?: number | undefined): SearchReply; - fromJSON(object: any): SearchReply; - toJSON(message: SearchReply): unknown; - create( - base?: - | { - took?: number | undefined; - results?: - | { - properties?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - refProps?: - | { - properties?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - targetCollection?: string | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: any[] | undefined; - objectArrayProperties?: - | { - values?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: - | { - values?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: any | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: any[] | undefined; - emptyListProps?: string[] | undefined; - }[] - | undefined; - propName?: string | undefined; - }[] - | undefined; - nonRefProps?: - | { - fields?: - | { - [x: string]: - | { - numberValue?: number | undefined; - stringValue?: string | undefined; - boolValue?: boolean | undefined; - objectValue?: any | undefined; - listValue?: - | { - values?: any[] | undefined; - numberValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - boolValues?: - | { - values?: boolean[] | undefined; - } - | undefined; - objectValues?: - | { - values?: any[] | undefined; - } - | undefined; - dateValues?: - | { - values?: string[] | undefined; - } - | undefined; - uuidValues?: - | { - values?: string[] | undefined; - } - | undefined; - intValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - textValues?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dateValue?: string | undefined; - uuidValue?: string | undefined; - intValue?: number | undefined; - geoValue?: - | { - longitude?: number | undefined; - latitude?: number | undefined; - } - | undefined; - blobValue?: string | undefined; - phoneValue?: - | { - countryCode?: number | undefined; - defaultCountry?: string | undefined; - input?: string | undefined; - internationalFormatted?: string | undefined; - national?: number | undefined; - nationalFormatted?: string | undefined; - valid?: boolean | undefined; - } - | undefined; - nullValue?: - | import('../google/protobuf/struct.js').NullValue - | undefined; - textValue?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - refPropsRequested?: boolean | undefined; - } - | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - generative?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - }[] - | undefined; - generativeGroupedResult?: string | undefined; - groupByResults?: - | { - name?: string | undefined; - minDistance?: number | undefined; - maxDistance?: number | undefined; - numberOfObjects?: number | undefined; - objects?: - | { - properties?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - refProps?: - | { - properties?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - targetCollection?: string | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: any[] | undefined; - objectArrayProperties?: - | { - values?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: - | { - values?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: any | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: any[] | undefined; - emptyListProps?: string[] | undefined; - }[] - | undefined; - propName?: string | undefined; - }[] - | undefined; - nonRefProps?: - | { - fields?: - | { - [x: string]: - | { - numberValue?: number | undefined; - stringValue?: string | undefined; - boolValue?: boolean | undefined; - objectValue?: any | undefined; - listValue?: - | { - values?: any[] | undefined; - numberValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - boolValues?: - | { - values?: boolean[] | undefined; - } - | undefined; - objectValues?: - | { - values?: any[] | undefined; - } - | undefined; - dateValues?: - | { - values?: string[] | undefined; - } - | undefined; - uuidValues?: - | { - values?: string[] | undefined; - } - | undefined; - intValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - textValues?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dateValue?: string | undefined; - uuidValue?: string | undefined; - intValue?: number | undefined; - geoValue?: - | { - longitude?: number | undefined; - latitude?: number | undefined; - } - | undefined; - blobValue?: string | undefined; - phoneValue?: - | { - countryCode?: number | undefined; - defaultCountry?: string | undefined; - input?: string | undefined; - internationalFormatted?: string | undefined; - national?: number | undefined; - nationalFormatted?: string | undefined; - valid?: boolean | undefined; - } - | undefined; - nullValue?: - | import('../google/protobuf/struct.js').NullValue - | undefined; - textValue?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - refPropsRequested?: boolean | undefined; - } - | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - generative?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: - | number - | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: - | number - | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - }[] - | undefined; - rerank?: - | { - score?: number | undefined; - } - | undefined; - generative?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - generativeResult?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - }[] - | undefined; - generativeGroupedResults?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined - ): SearchReply; - fromPartial(object: { - took?: number | undefined; - results?: - | { - properties?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - refProps?: - | { - properties?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - targetCollection?: string | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: any[] | undefined; - objectArrayProperties?: - | { - values?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: - | { - values?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: any | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: any[] | undefined; - emptyListProps?: string[] | undefined; - }[] - | undefined; - propName?: string | undefined; - }[] - | undefined; - nonRefProps?: - | { - fields?: - | { - [x: string]: - | { - numberValue?: number | undefined; - stringValue?: string | undefined; - boolValue?: boolean | undefined; - objectValue?: any | undefined; - listValue?: - | { - values?: any[] | undefined; - numberValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - boolValues?: - | { - values?: boolean[] | undefined; - } - | undefined; - objectValues?: - | { - values?: any[] | undefined; - } - | undefined; - dateValues?: - | { - values?: string[] | undefined; - } - | undefined; - uuidValues?: - | { - values?: string[] | undefined; - } - | undefined; - intValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - textValues?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dateValue?: string | undefined; - uuidValue?: string | undefined; - intValue?: number | undefined; - geoValue?: - | { - longitude?: number | undefined; - latitude?: number | undefined; - } - | undefined; - blobValue?: string | undefined; - phoneValue?: - | { - countryCode?: number | undefined; - defaultCountry?: string | undefined; - input?: string | undefined; - internationalFormatted?: string | undefined; - national?: number | undefined; - nationalFormatted?: string | undefined; - valid?: boolean | undefined; - } - | undefined; - nullValue?: - | import('../google/protobuf/struct.js').NullValue - | undefined; - textValue?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - refPropsRequested?: boolean | undefined; - } - | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - generative?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - }[] - | undefined; - generativeGroupedResult?: string | undefined; - groupByResults?: - | { - name?: string | undefined; - minDistance?: number | undefined; - maxDistance?: number | undefined; - numberOfObjects?: number | undefined; - objects?: - | { - properties?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - refProps?: - | { - properties?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - targetCollection?: string | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: any[] | undefined; - objectArrayProperties?: - | { - values?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: - | { - values?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: any | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: any[] | undefined; - emptyListProps?: string[] | undefined; - }[] - | undefined; - propName?: string | undefined; - }[] - | undefined; - nonRefProps?: - | { - fields?: - | { - [x: string]: - | { - numberValue?: number | undefined; - stringValue?: string | undefined; - boolValue?: boolean | undefined; - objectValue?: any | undefined; - listValue?: - | { - values?: any[] | undefined; - numberValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - boolValues?: - | { - values?: boolean[] | undefined; - } - | undefined; - objectValues?: - | { - values?: any[] | undefined; - } - | undefined; - dateValues?: - | { - values?: string[] | undefined; - } - | undefined; - uuidValues?: - | { - values?: string[] | undefined; - } - | undefined; - intValues?: - | { - values?: Uint8Array | undefined; - } - | undefined; - textValues?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dateValue?: string | undefined; - uuidValue?: string | undefined; - intValue?: number | undefined; - geoValue?: - | { - longitude?: number | undefined; - latitude?: number | undefined; - } - | undefined; - blobValue?: string | undefined; - phoneValue?: - | { - countryCode?: number | undefined; - defaultCountry?: string | undefined; - input?: string | undefined; - internationalFormatted?: string | undefined; - national?: number | undefined; - nationalFormatted?: string | undefined; - valid?: boolean | undefined; - } - | undefined; - nullValue?: - | import('../google/protobuf/struct.js').NullValue - | undefined; - textValue?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - refPropsRequested?: boolean | undefined; - } - | undefined; - metadata?: - | { - id?: string | undefined; - vector?: number[] | undefined; - creationTimeUnix?: number | undefined; - creationTimeUnixPresent?: boolean | undefined; - lastUpdateTimeUnix?: number | undefined; - lastUpdateTimeUnixPresent?: boolean | undefined; - distance?: number | undefined; - distancePresent?: boolean | undefined; - certainty?: number | undefined; - certaintyPresent?: boolean | undefined; - score?: number | undefined; - scorePresent?: boolean | undefined; - explainScore?: string | undefined; - explainScorePresent?: boolean | undefined; - isConsistent?: boolean | undefined; - generative?: string | undefined; - generativePresent?: boolean | undefined; - isConsistentPresent?: boolean | undefined; - vectorBytes?: Uint8Array | undefined; - idAsBytes?: Uint8Array | undefined; - rerankScore?: number | undefined; - rerankScorePresent?: boolean | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - } - | undefined; - generative?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - }[] - | undefined; - rerank?: - | { - score?: number | undefined; - } - | undefined; - generative?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - generativeResult?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - }[] - | undefined; - generativeGroupedResults?: - | { - values?: - | { - result?: string | undefined; - debug?: - | { - fullPrompt?: string | undefined; - } - | undefined; - metadata?: - | { - anthropic?: - | { - usage?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - } - | undefined; - anyscale?: {} | undefined; - aws?: {} | undefined; - cohere?: - | { - apiVersion?: - | { - version?: string | undefined; - isDeprecated?: boolean | undefined; - isExperimental?: boolean | undefined; - } - | undefined; - billedUnits?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - searchUnits?: number | undefined; - classifications?: number | undefined; - } - | undefined; - tokens?: - | { - inputTokens?: number | undefined; - outputTokens?: number | undefined; - } - | undefined; - warnings?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined; - dummy?: {} | undefined; - mistral?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - octoai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - ollama?: {} | undefined; - openai?: - | { - usage?: - | { - promptTokens?: number | undefined; - completionTokens?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - google?: - | { - metadata?: - | { - tokenMetadata?: - | { - inputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - outputTokenCount?: - | { - totalBillableCharacters?: number | undefined; - totalTokens?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - usageMetadata?: - | { - promptTokenCount?: number | undefined; - candidatesTokenCount?: number | undefined; - totalTokenCount?: number | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - }[] - | undefined; - } - | undefined; - }): SearchReply; - }; - readonly responseStream: false; - readonly options: {}; - }; - readonly batchObjects: { - readonly name: 'BatchObjects'; - readonly requestType: { - encode( - message: BatchObjectsRequest, - writer?: import('protobufjs').Writer - ): import('protobufjs').Writer; - decode( - input: Uint8Array | import('protobufjs').Reader, - length?: number | undefined - ): BatchObjectsRequest; - fromJSON(object: any): BatchObjectsRequest; - toJSON(message: BatchObjectsRequest): unknown; - create( - base?: - | { - objects?: - | { - uuid?: string | undefined; - vector?: number[] | undefined; - properties?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - singleTargetRefProps?: - | { - uuids?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - multiTargetRefProps?: - | { - uuids?: string[] | undefined; - propName?: string | undefined; - targetCollection?: string | undefined; - }[] - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: any[] | undefined; - objectArrayProperties?: - | { - values?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: - | { - values?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: any | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: any[] | undefined; - emptyListProps?: string[] | undefined; - }[] - | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - collection?: string | undefined; - tenant?: string | undefined; - vectorBytes?: Uint8Array | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - }[] - | undefined; - consistencyLevel?: import('./base.js').ConsistencyLevel | undefined; - } - | undefined - ): BatchObjectsRequest; - fromPartial(object: { - objects?: - | { - uuid?: string | undefined; - vector?: number[] | undefined; - properties?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - singleTargetRefProps?: - | { - uuids?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - multiTargetRefProps?: - | { - uuids?: string[] | undefined; - propName?: string | undefined; - targetCollection?: string | undefined; - }[] - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: any[] | undefined; - objectArrayProperties?: - | { - values?: any[] | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: - | { - values?: - | { - nonRefProperties?: - | { - [x: string]: any; - } - | undefined; - numberArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - valuesBytes?: Uint8Array | undefined; - }[] - | undefined; - intArrayProperties?: - | { - values?: number[] | undefined; - propName?: string | undefined; - }[] - | undefined; - textArrayProperties?: - | { - values?: string[] | undefined; - propName?: string | undefined; - }[] - | undefined; - booleanArrayProperties?: - | { - values?: boolean[] | undefined; - propName?: string | undefined; - }[] - | undefined; - objectProperties?: - | { - value?: any | undefined; - propName?: string | undefined; - }[] - | undefined; - objectArrayProperties?: any[] | undefined; - emptyListProps?: string[] | undefined; - }[] - | undefined; - propName?: string | undefined; - }[] - | undefined; - emptyListProps?: string[] | undefined; - } - | undefined; - collection?: string | undefined; - tenant?: string | undefined; - vectorBytes?: Uint8Array | undefined; - vectors?: - | { - name?: string | undefined; - index?: number | undefined; - vectorBytes?: Uint8Array | undefined; - }[] - | undefined; - }[] - | undefined; - consistencyLevel?: import('./base.js').ConsistencyLevel | undefined; - }): BatchObjectsRequest; - }; - readonly requestStream: false; - readonly responseType: { - encode(message: BatchObjectsReply, writer?: import('protobufjs').Writer): import('protobufjs').Writer; - decode( - input: Uint8Array | import('protobufjs').Reader, - length?: number | undefined - ): BatchObjectsReply; - fromJSON(object: any): BatchObjectsReply; - toJSON(message: BatchObjectsReply): unknown; - create( - base?: - | { - took?: number | undefined; - errors?: - | { - index?: number | undefined; - error?: string | undefined; - }[] - | undefined; - } - | undefined - ): BatchObjectsReply; - fromPartial(object: { - took?: number | undefined; - errors?: - | { - index?: number | undefined; - error?: string | undefined; - }[] - | undefined; - }): BatchObjectsReply; - }; - readonly responseStream: false; - readonly options: {}; - }; - readonly batchDelete: { - readonly name: 'BatchDelete'; - readonly requestType: { - encode( - message: BatchDeleteRequest, - writer?: import('protobufjs').Writer - ): import('protobufjs').Writer; - decode( - input: Uint8Array | import('protobufjs').Reader, - length?: number | undefined - ): BatchDeleteRequest; - fromJSON(object: any): BatchDeleteRequest; - toJSON(message: BatchDeleteRequest): unknown; - create( - base?: - | { - collection?: string | undefined; - filters?: - | { - operator?: import('./base.js').Filters_Operator | undefined; - on?: string[] | undefined; - filters?: any[] | undefined; - valueText?: string | undefined; - valueInt?: number | undefined; - valueBoolean?: boolean | undefined; - valueNumber?: number | undefined; - valueTextArray?: - | { - values?: string[] | undefined; - } - | undefined; - valueIntArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueBooleanArray?: - | { - values?: boolean[] | undefined; - } - | undefined; - valueNumberArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueGeo?: - | { - latitude?: number | undefined; - longitude?: number | undefined; - distance?: number | undefined; - } - | undefined; - target?: - | { - property?: string | undefined; - singleTarget?: - | { - on?: string | undefined; - target?: any | undefined; - } - | undefined; - multiTarget?: - | { - on?: string | undefined; - target?: any | undefined; - targetCollection?: string | undefined; - } - | undefined; - count?: - | { - on?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - verbose?: boolean | undefined; - dryRun?: boolean | undefined; - consistencyLevel?: import('./base.js').ConsistencyLevel | undefined; - tenant?: string | undefined; - } - | undefined - ): BatchDeleteRequest; - fromPartial(object: { - collection?: string | undefined; - filters?: - | { - operator?: import('./base.js').Filters_Operator | undefined; - on?: string[] | undefined; - filters?: any[] | undefined; - valueText?: string | undefined; - valueInt?: number | undefined; - valueBoolean?: boolean | undefined; - valueNumber?: number | undefined; - valueTextArray?: - | { - values?: string[] | undefined; - } - | undefined; - valueIntArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueBooleanArray?: - | { - values?: boolean[] | undefined; - } - | undefined; - valueNumberArray?: - | { - values?: number[] | undefined; - } - | undefined; - valueGeo?: - | { - latitude?: number | undefined; - longitude?: number | undefined; - distance?: number | undefined; - } - | undefined; - target?: - | { - property?: string | undefined; - singleTarget?: - | { - on?: string | undefined; - target?: any | undefined; - } - | undefined; - multiTarget?: - | { - on?: string | undefined; - target?: any | undefined; - targetCollection?: string | undefined; - } - | undefined; - count?: - | { - on?: string | undefined; - } - | undefined; - } - | undefined; - } - | undefined; - verbose?: boolean | undefined; - dryRun?: boolean | undefined; - consistencyLevel?: import('./base.js').ConsistencyLevel | undefined; - tenant?: string | undefined; - }): BatchDeleteRequest; - }; - readonly requestStream: false; - readonly responseType: { - encode(message: BatchDeleteReply, writer?: import('protobufjs').Writer): import('protobufjs').Writer; - decode( - input: Uint8Array | import('protobufjs').Reader, - length?: number | undefined - ): BatchDeleteReply; - fromJSON(object: any): BatchDeleteReply; - toJSON(message: BatchDeleteReply): unknown; - create( - base?: - | { - took?: number | undefined; - failed?: number | undefined; - matches?: number | undefined; - successful?: number | undefined; - objects?: - | { - uuid?: Uint8Array | undefined; - successful?: boolean | undefined; - error?: string | undefined; - }[] - | undefined; - } - | undefined - ): BatchDeleteReply; - fromPartial(object: { - took?: number | undefined; - failed?: number | undefined; - matches?: number | undefined; - successful?: number | undefined; - objects?: - | { - uuid?: Uint8Array | undefined; - successful?: boolean | undefined; - error?: string | undefined; - }[] - | undefined; - }): BatchDeleteReply; - }; - readonly responseStream: false; - readonly options: {}; - }; - readonly tenantsGet: { - readonly name: 'TenantsGet'; - readonly requestType: { - encode(message: TenantsGetRequest, writer?: import('protobufjs').Writer): import('protobufjs').Writer; - decode( - input: Uint8Array | import('protobufjs').Reader, - length?: number | undefined - ): TenantsGetRequest; - fromJSON(object: any): TenantsGetRequest; - toJSON(message: TenantsGetRequest): unknown; - create( - base?: - | { - collection?: string | undefined; - names?: - | { - values?: string[] | undefined; - } - | undefined; - } - | undefined - ): TenantsGetRequest; - fromPartial(object: { - collection?: string | undefined; - names?: - | { - values?: string[] | undefined; - } - | undefined; - }): TenantsGetRequest; - }; - readonly requestStream: false; - readonly responseType: { - encode(message: TenantsGetReply, writer?: import('protobufjs').Writer): import('protobufjs').Writer; - decode(input: Uint8Array | import('protobufjs').Reader, length?: number | undefined): TenantsGetReply; - fromJSON(object: any): TenantsGetReply; - toJSON(message: TenantsGetReply): unknown; - create( - base?: - | { - took?: number | undefined; - tenants?: - | { - name?: string | undefined; - activityStatus?: import('./tenants.js').TenantActivityStatus | undefined; - }[] - | undefined; - } - | undefined - ): TenantsGetReply; - fromPartial(object: { - took?: number | undefined; - tenants?: - | { - name?: string | undefined; - activityStatus?: import('./tenants.js').TenantActivityStatus | undefined; - }[] - | undefined; - }): TenantsGetReply; - }; - readonly responseStream: false; - readonly options: {}; - }; - }; -}; -export interface WeaviateServiceImplementation { - search(request: SearchRequest, context: CallContext & CallContextExt): Promise>; - batchObjects( - request: BatchObjectsRequest, - context: CallContext & CallContextExt - ): Promise>; - batchDelete( - request: BatchDeleteRequest, - context: CallContext & CallContextExt - ): Promise>; - tenantsGet( - request: TenantsGetRequest, - context: CallContext & CallContextExt - ): Promise>; -} -export interface WeaviateClient { - search(request: DeepPartial, options?: CallOptions & CallOptionsExt): Promise; - batchObjects( - request: DeepPartial, - options?: CallOptions & CallOptionsExt - ): Promise; - batchDelete( - request: DeepPartial, - options?: CallOptions & CallOptionsExt - ): Promise; - tenantsGet( - request: DeepPartial, - options?: CallOptions & CallOptionsExt - ): Promise; -} -type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; -export type DeepPartial = T extends Builtin - ? T - : T extends globalThis.Array - ? globalThis.Array> - : T extends ReadonlyArray - ? ReadonlyArray> - : T extends {} - ? { - [K in keyof T]?: DeepPartial; - } - : Partial; -export {}; diff --git a/dist/node/esm/proto/v1/weaviate.js b/dist/node/esm/proto/v1/weaviate.js deleted file mode 100644 index d5cbc416..00000000 --- a/dist/node/esm/proto/v1/weaviate.js +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by protoc-gen-ts_proto. DO NOT EDIT. -// versions: -// protoc-gen-ts_proto v1.176.0 -// protoc v3.19.1 -// source: v1/weaviate.proto -import { BatchObjectsReply, BatchObjectsRequest } from './batch.js'; -import { BatchDeleteReply, BatchDeleteRequest } from './batch_delete.js'; -import { SearchReply, SearchRequest } from './search_get.js'; -import { TenantsGetReply, TenantsGetRequest } from './tenants.js'; -export const protobufPackage = 'weaviate.v1'; -export const WeaviateDefinition = { - name: 'Weaviate', - fullName: 'weaviate.v1.Weaviate', - methods: { - search: { - name: 'Search', - requestType: SearchRequest, - requestStream: false, - responseType: SearchReply, - responseStream: false, - options: {}, - }, - batchObjects: { - name: 'BatchObjects', - requestType: BatchObjectsRequest, - requestStream: false, - responseType: BatchObjectsReply, - responseStream: false, - options: {}, - }, - batchDelete: { - name: 'BatchDelete', - requestType: BatchDeleteRequest, - requestStream: false, - responseType: BatchDeleteReply, - responseStream: false, - options: {}, - }, - tenantsGet: { - name: 'TenantsGet', - requestType: TenantsGetRequest, - requestStream: false, - responseType: TenantsGetReply, - responseStream: false, - options: {}, - }, - }, -}; diff --git a/dist/node/esm/schema/classCreator.d.ts b/dist/node/esm/schema/classCreator.d.ts deleted file mode 100644 index d1f1f16d..00000000 --- a/dist/node/esm/schema/classCreator.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Connection from '../connection/index.js'; -import { WeaviateClass } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassCreator extends CommandBase { - private class; - constructor(client: Connection); - withClass: (classObj: object) => this; - validateClass: () => void; - validate(): void; - do: () => Promise; -} diff --git a/dist/node/esm/schema/classCreator.js b/dist/node/esm/schema/classCreator.js deleted file mode 100644 index b34f6ef2..00000000 --- a/dist/node/esm/schema/classCreator.js +++ /dev/null @@ -1,26 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassCreator extends CommandBase { - constructor(client) { - super(client); - this.withClass = (classObj) => { - this.class = classObj; - return this; - }; - this.validateClass = () => { - if (this.class == undefined || this.class == null) { - this.addError('class object must be set - set with .withClass(class)'); - } - }; - this.do = () => { - this.validateClass(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/schema`; - return this.client.postReturn(path, this.class); - }; - } - validate() { - this.validateClass(); - } -} diff --git a/dist/node/esm/schema/classDeleter.d.ts b/dist/node/esm/schema/classDeleter.d.ts deleted file mode 100644 index 6ed553be..00000000 --- a/dist/node/esm/schema/classDeleter.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassDeleter extends CommandBase { - private className?; - constructor(client: Connection); - withClassName: (className: string) => this; - validateClassName: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/schema/classDeleter.js b/dist/node/esm/schema/classDeleter.js deleted file mode 100644 index 5a90b141..00000000 --- a/dist/node/esm/schema/classDeleter.js +++ /dev/null @@ -1,27 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { isValidStringProperty } from '../validation/string.js'; -export default class ClassDeleter extends CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.validateClassName = () => { - if (!isValidStringProperty(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.validate = () => { - this.validateClassName(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/schema/${this.className}`; - return this.client.delete(path, undefined, false); - }; - } -} diff --git a/dist/node/esm/schema/classExists.d.ts b/dist/node/esm/schema/classExists.d.ts deleted file mode 100644 index 17f936ac..00000000 --- a/dist/node/esm/schema/classExists.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassExists extends CommandBase { - private className?; - constructor(client: Connection); - withClassName: (className: string) => this; - validateClassName: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/schema/classExists.js b/dist/node/esm/schema/classExists.js deleted file mode 100644 index 5d69953b..00000000 --- a/dist/node/esm/schema/classExists.js +++ /dev/null @@ -1,32 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { isValidStringProperty } from '../validation/string.js'; -export default class ClassExists extends CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.validateClassName = () => { - if (!isValidStringProperty(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.validate = () => { - this.validateClassName(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/schema`; - return this.client.get(path).then((res) => { - var _a; - return (_a = res.classes) === null || _a === void 0 - ? void 0 - : _a.some((c) => c.class === this.className); - }); - }; - } -} diff --git a/dist/node/esm/schema/classGetter.d.ts b/dist/node/esm/schema/classGetter.d.ts deleted file mode 100644 index eed46f7f..00000000 --- a/dist/node/esm/schema/classGetter.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Connection from '../connection/index.js'; -import { WeaviateClass } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassGetter extends CommandBase { - private className?; - constructor(client: Connection); - withClassName: (className: string) => this; - validateClassName: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/schema/classGetter.js b/dist/node/esm/schema/classGetter.js deleted file mode 100644 index 80ae6d82..00000000 --- a/dist/node/esm/schema/classGetter.js +++ /dev/null @@ -1,27 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { isValidStringProperty } from '../validation/string.js'; -export default class ClassGetter extends CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.validateClassName = () => { - if (!isValidStringProperty(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.validate = () => { - this.validateClassName(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/schema/${this.className}`; - return this.client.get(path); - }; - } -} diff --git a/dist/node/esm/schema/classUpdater.d.ts b/dist/node/esm/schema/classUpdater.d.ts deleted file mode 100644 index 78417a17..00000000 --- a/dist/node/esm/schema/classUpdater.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import Connection from '../connection/index.js'; -import { WeaviateClass } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassUpdater extends CommandBase { - private class; - constructor(client: Connection); - withClass: (classObj: WeaviateClass) => this; - validateClass: () => void; - validate(): void; - do: () => Promise; -} diff --git a/dist/node/esm/schema/classUpdater.js b/dist/node/esm/schema/classUpdater.js deleted file mode 100644 index 5df81ca4..00000000 --- a/dist/node/esm/schema/classUpdater.js +++ /dev/null @@ -1,26 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class ClassUpdater extends CommandBase { - constructor(client) { - super(client); - this.withClass = (classObj) => { - this.class = classObj; - return this; - }; - this.validateClass = () => { - if (this.class == undefined || this.class == null) { - this.addError('class object must be set - set with .withClass(class)'); - } - }; - this.do = () => { - this.validateClass(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/schema/${this.class.class}`; - return this.client.put(path, this.class, false); - }; - } - validate() { - this.validateClass(); - } -} diff --git a/dist/node/esm/schema/deleteAll.d.ts b/dist/node/esm/schema/deleteAll.d.ts deleted file mode 100644 index 1aa13713..00000000 --- a/dist/node/esm/schema/deleteAll.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Connection from '../connection/index.js'; -declare const _default: (client: Connection) => Promise; -export default _default; diff --git a/dist/node/esm/schema/deleteAll.js b/dist/node/esm/schema/deleteAll.js deleted file mode 100644 index 1c557efe..00000000 --- a/dist/node/esm/schema/deleteAll.js +++ /dev/null @@ -1,46 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -import ClassDeleter from './classDeleter.js'; -import SchemaGetter from './getter.js'; -export default (client) => - __awaiter(void 0, void 0, void 0, function* () { - const getter = new SchemaGetter(client); - const schema = yield getter.do(); - yield Promise.all( - schema.classes - ? schema.classes.map((c) => { - const deleter = new ClassDeleter(client); - return deleter.withClassName(c.class).do(); - }) - : [] - ); - }); diff --git a/dist/node/esm/schema/getter.d.ts b/dist/node/esm/schema/getter.d.ts deleted file mode 100644 index 123cd761..00000000 --- a/dist/node/esm/schema/getter.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -import Connection from '../connection/index.js'; -import { WeaviateSchema } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class SchemaGetter extends CommandBase { - constructor(client: Connection); - validate(): void; - do: () => Promise; -} diff --git a/dist/node/esm/schema/getter.js b/dist/node/esm/schema/getter.js deleted file mode 100644 index c9eae6c7..00000000 --- a/dist/node/esm/schema/getter.js +++ /dev/null @@ -1,16 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class SchemaGetter extends CommandBase { - constructor(client) { - super(client); - this.do = () => { - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/schema`; - return this.client.get(path); - }; - } - validate() { - // nothing to validate - } -} diff --git a/dist/node/esm/schema/index.d.ts b/dist/node/esm/schema/index.d.ts deleted file mode 100644 index f567bb05..00000000 --- a/dist/node/esm/schema/index.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -import Connection from '../connection/index.js'; -import { Tenant } from '../openapi/types.js'; -import ClassCreator from './classCreator.js'; -import ClassDeleter from './classDeleter.js'; -import ClassGetter from './classGetter.js'; -import ClassUpdater from './classUpdater.js'; -import SchemaGetter from './getter.js'; -import PropertyCreator from './propertyCreator.js'; -import ShardUpdater from './shardUpdater.js'; -import ShardsGetter from './shardsGetter.js'; -import ShardsUpdater from './shardsUpdater.js'; -import TenantsCreator from './tenantsCreator.js'; -import TenantsDeleter from './tenantsDeleter.js'; -import TenantsExists from './tenantsExists.js'; -import TenantsGetter from './tenantsGetter.js'; -import TenantsUpdater from './tenantsUpdater.js'; -export interface Schema { - classCreator: () => ClassCreator; - classDeleter: () => ClassDeleter; - classGetter: () => ClassGetter; - classUpdater: () => ClassUpdater; - exists: (className: string) => Promise; - getter: () => SchemaGetter; - propertyCreator: () => PropertyCreator; - deleteAll: () => Promise; - shardsGetter: () => ShardsGetter; - shardUpdater: () => ShardUpdater; - shardsUpdater: () => ShardsUpdater; - tenantsCreator: (className: string, tenants: Array) => TenantsCreator; - tenantsGetter: (className: string) => TenantsGetter; - tenantsUpdater: (className: string, tenants: Array) => TenantsUpdater; - tenantsDeleter: (className: string, tenants: Array) => TenantsDeleter; - tenantsExists: (className: string, tenant: string) => TenantsExists; -} -declare const schema: (client: Connection) => Schema; -export default schema; -export { default as ClassCreator } from './classCreator.js'; -export { default as ClassDeleter } from './classDeleter.js'; -export { default as ClassGetter } from './classGetter.js'; -export { default as SchemaGetter } from './getter.js'; -export { default as PropertyCreator } from './propertyCreator.js'; -export { default as ShardUpdater } from './shardUpdater.js'; -export { default as ShardsUpdater } from './shardsUpdater.js'; -export { default as TenantsCreator } from './tenantsCreator.js'; -export { default as TenantsDeleter } from './tenantsDeleter.js'; -export { default as TenantsExists } from './tenantsExists.js'; -export { default as TenantsGetter } from './tenantsGetter.js'; -export { default as TenantsUpdater } from './tenantsUpdater.js'; diff --git a/dist/node/esm/schema/index.js b/dist/node/esm/schema/index.js deleted file mode 100644 index 3983f3bd..00000000 --- a/dist/node/esm/schema/index.js +++ /dev/null @@ -1,49 +0,0 @@ -import ClassCreator from './classCreator.js'; -import ClassDeleter from './classDeleter.js'; -import ClassExists from './classExists.js'; -import ClassGetter from './classGetter.js'; -import ClassUpdater from './classUpdater.js'; -import deleteAll from './deleteAll.js'; -import SchemaGetter from './getter.js'; -import PropertyCreator from './propertyCreator.js'; -import ShardUpdater from './shardUpdater.js'; -import ShardsGetter from './shardsGetter.js'; -import ShardsUpdater from './shardsUpdater.js'; -import TenantsCreator from './tenantsCreator.js'; -import TenantsDeleter from './tenantsDeleter.js'; -import TenantsExists from './tenantsExists.js'; -import TenantsGetter from './tenantsGetter.js'; -import TenantsUpdater from './tenantsUpdater.js'; -const schema = (client) => { - return { - classCreator: () => new ClassCreator(client), - classDeleter: () => new ClassDeleter(client), - classGetter: () => new ClassGetter(client), - classUpdater: () => new ClassUpdater(client), - exists: (className) => new ClassExists(client).withClassName(className).do(), - getter: () => new SchemaGetter(client), - propertyCreator: () => new PropertyCreator(client), - deleteAll: () => deleteAll(client), - shardsGetter: () => new ShardsGetter(client), - shardUpdater: () => new ShardUpdater(client), - shardsUpdater: () => new ShardsUpdater(client), - tenantsCreator: (className, tenants) => new TenantsCreator(client, className, tenants), - tenantsGetter: (className) => new TenantsGetter(client, className), - tenantsUpdater: (className, tenants) => new TenantsUpdater(client, className, tenants), - tenantsDeleter: (className, tenants) => new TenantsDeleter(client, className, tenants), - tenantsExists: (className, tenant) => new TenantsExists(client, className, tenant), - }; -}; -export default schema; -export { default as ClassCreator } from './classCreator.js'; -export { default as ClassDeleter } from './classDeleter.js'; -export { default as ClassGetter } from './classGetter.js'; -export { default as SchemaGetter } from './getter.js'; -export { default as PropertyCreator } from './propertyCreator.js'; -export { default as ShardUpdater } from './shardUpdater.js'; -export { default as ShardsUpdater } from './shardsUpdater.js'; -export { default as TenantsCreator } from './tenantsCreator.js'; -export { default as TenantsDeleter } from './tenantsDeleter.js'; -export { default as TenantsExists } from './tenantsExists.js'; -export { default as TenantsGetter } from './tenantsGetter.js'; -export { default as TenantsUpdater } from './tenantsUpdater.js'; diff --git a/dist/node/esm/schema/propertyCreator.d.ts b/dist/node/esm/schema/propertyCreator.d.ts deleted file mode 100644 index 7b368df7..00000000 --- a/dist/node/esm/schema/propertyCreator.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Connection from '../connection/index.js'; -import { Property } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class PropertyCreator extends CommandBase { - private className; - private property; - constructor(client: Connection); - withClassName: (className: string) => this; - withProperty: (property: Property) => this; - validateClassName: () => void; - validateProperty: () => void; - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/schema/propertyCreator.js b/dist/node/esm/schema/propertyCreator.js deleted file mode 100644 index a67b0916..00000000 --- a/dist/node/esm/schema/propertyCreator.js +++ /dev/null @@ -1,37 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { isValidStringProperty } from '../validation/string.js'; -export default class PropertyCreator extends CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withProperty = (property) => { - this.property = property; - return this; - }; - this.validateClassName = () => { - if (!isValidStringProperty(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.validateProperty = () => { - if (this.property == undefined || this.property == null) { - this.addError('property must be set - set with .withProperty(property)'); - } - }; - this.validate = () => { - this.validateClassName(); - this.validateProperty(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error('invalid usage: ' + this.errors.join(', '))); - } - const path = `/schema/${this.className}/properties`; - return this.client.postReturn(path, this.property); - }; - } -} diff --git a/dist/node/esm/schema/shardUpdater.d.ts b/dist/node/esm/schema/shardUpdater.d.ts deleted file mode 100644 index 2d618fed..00000000 --- a/dist/node/esm/schema/shardUpdater.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ShardUpdater extends CommandBase { - private className; - private shardName; - private status; - constructor(client: Connection); - withClassName: (className: string) => this; - validateClassName: () => void; - withShardName: (shardName: string) => this; - validateShardName: () => void; - withStatus: (status: string) => this; - validateStatus: () => void; - validate: () => void; - do: () => any; -} -export declare function updateShard( - client: Connection, - className: string, - shardName: string, - status: string -): any; diff --git a/dist/node/esm/schema/shardUpdater.js b/dist/node/esm/schema/shardUpdater.js deleted file mode 100644 index 53a1153a..00000000 --- a/dist/node/esm/schema/shardUpdater.js +++ /dev/null @@ -1,50 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { isValidStringProperty } from '../validation/string.js'; -export default class ShardUpdater extends CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.validateClassName = () => { - if (!isValidStringProperty(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.withShardName = (shardName) => { - this.shardName = shardName; - return this; - }; - this.validateShardName = () => { - if (!isValidStringProperty(this.shardName)) { - this.addError('shardName must be set - set with .withShardName(shardName)'); - } - }; - this.withStatus = (status) => { - this.status = status; - return this; - }; - this.validateStatus = () => { - if (!isValidStringProperty(this.status)) { - this.addError('status must be set - set with .withStatus(status)'); - } - }; - this.validate = () => { - this.validateClassName(); - this.validateShardName(); - this.validateStatus(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error(`invalid usage: ${this.errors.join(', ')}`)); - } - return updateShard(this.client, this.className, this.shardName, this.status); - }; - } -} -export function updateShard(client, className, shardName, status) { - const path = `/schema/${className}/shards/${shardName}`; - return client.put(path, { status: status }, true); -} diff --git a/dist/node/esm/schema/shardsGetter.d.ts b/dist/node/esm/schema/shardsGetter.d.ts deleted file mode 100644 index 604a1407..00000000 --- a/dist/node/esm/schema/shardsGetter.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import Connection from '../connection/index.js'; -import { ShardStatusList } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ShardsGetter extends CommandBase { - private className?; - private tenant?; - constructor(client: Connection); - withClassName: (className: string) => this; - withTenant: (tenant: string) => this; - validateClassName: () => void; - validate: () => void; - do: () => Promise; -} -export declare function getShards(client: Connection, className: any, tenant?: string): any; diff --git a/dist/node/esm/schema/shardsGetter.js b/dist/node/esm/schema/shardsGetter.js deleted file mode 100644 index 01ba8d69..00000000 --- a/dist/node/esm/schema/shardsGetter.js +++ /dev/null @@ -1,34 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -import { isValidStringProperty } from '../validation/string.js'; -export default class ShardsGetter extends CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.withTenant = (tenant) => { - this.tenant = tenant; - return this; - }; - this.validateClassName = () => { - if (!isValidStringProperty(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.validate = () => { - this.validateClassName(); - }; - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error(`invalid usage: ${this.errors.join(', ')}`)); - } - return getShards(this.client, this.className, this.tenant); - }; - } -} -export function getShards(client, className, tenant) { - const path = `/schema/${className}/shards${tenant ? `?tenant=${tenant}` : ''}`; - return client.get(path); -} diff --git a/dist/node/esm/schema/shardsUpdater.d.ts b/dist/node/esm/schema/shardsUpdater.d.ts deleted file mode 100644 index 533b0b32..00000000 --- a/dist/node/esm/schema/shardsUpdater.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import Connection from '../connection/index.js'; -import { ShardStatusList } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class ShardsUpdater extends CommandBase { - private className; - private shards; - private status; - constructor(client: Connection); - withClassName: (className: string) => this; - validateClassName: () => void; - withStatus: (status: string) => this; - validateStatus: () => void; - validate: () => void; - updateShards: () => Promise; - do: () => Promise; -} diff --git a/dist/node/esm/schema/shardsUpdater.js b/dist/node/esm/schema/shardsUpdater.js deleted file mode 100644 index 1a3c0016..00000000 --- a/dist/node/esm/schema/shardsUpdater.js +++ /dev/null @@ -1,96 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -import { CommandBase } from '../validation/commandBase.js'; -import { isValidStringProperty } from '../validation/string.js'; -import { updateShard } from './shardUpdater.js'; -import { getShards } from './shardsGetter.js'; -export default class ShardsUpdater extends CommandBase { - constructor(client) { - super(client); - this.withClassName = (className) => { - this.className = className; - return this; - }; - this.validateClassName = () => { - if (!isValidStringProperty(this.className)) { - this.addError('className must be set - set with .withClassName(className)'); - } - }; - this.withStatus = (status) => { - this.status = status; - return this; - }; - this.validateStatus = () => { - if (!isValidStringProperty(this.status)) { - this.addError('status must be set - set with .withStatus(status)'); - } - }; - this.validate = () => { - this.validateClassName(); - this.validateStatus(); - }; - this.updateShards = () => - __awaiter(this, void 0, void 0, function* () { - const payload = yield Promise.all( - Array.from({ length: this.shards.length }, (_, i) => - updateShard(this.client, this.className, this.shards[i].name || '', this.status) - .then((res) => { - return { name: this.shards[i].name, status: res.status }; - }) - .catch((err) => this.addError(err.toString())) - ) - ); - if (this.errors.length > 0) { - return Promise.reject(new Error(`failed to update shards: ${this.errors.join(', ')}`)); - } - return Promise.resolve(payload); - }); - this.do = () => { - this.validate(); - if (this.errors.length > 0) { - return Promise.reject(new Error(`invalid usage: ${this.errors.join(', ')}`)); - } - return getShards(this.client, this.className) - .then((shards) => (this.shards = shards)) - .then(() => { - return this.updateShards(); - }) - .then((payload) => { - return payload; - }) - .catch((err) => { - return Promise.reject(err); - }); - }; - this.shards = []; - } -} diff --git a/dist/node/esm/schema/tenantsCreator.d.ts b/dist/node/esm/schema/tenantsCreator.d.ts deleted file mode 100644 index 88f702f8..00000000 --- a/dist/node/esm/schema/tenantsCreator.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import Connection from '../connection/index.js'; -import { Tenant } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsCreator extends CommandBase { - private className; - private tenants; - constructor(client: Connection, className: string, tenants: Array); - validate: () => void; - do: () => Promise>; -} diff --git a/dist/node/esm/schema/tenantsCreator.js b/dist/node/esm/schema/tenantsCreator.js deleted file mode 100644 index 44003a3c..00000000 --- a/dist/node/esm/schema/tenantsCreator.js +++ /dev/null @@ -1,14 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsCreator extends CommandBase { - constructor(client, className, tenants) { - super(client); - this.validate = () => { - // nothing to validate - }; - this.do = () => { - return this.client.postReturn(`/schema/${this.className}/tenants`, this.tenants); - }; - this.className = className; - this.tenants = tenants; - } -} diff --git a/dist/node/esm/schema/tenantsDeleter.d.ts b/dist/node/esm/schema/tenantsDeleter.d.ts deleted file mode 100644 index 2df19490..00000000 --- a/dist/node/esm/schema/tenantsDeleter.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsDeleter extends CommandBase { - private className; - private tenants; - constructor(client: Connection, className: string, tenants: Array); - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/schema/tenantsDeleter.js b/dist/node/esm/schema/tenantsDeleter.js deleted file mode 100644 index 449dbb90..00000000 --- a/dist/node/esm/schema/tenantsDeleter.js +++ /dev/null @@ -1,14 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsDeleter extends CommandBase { - constructor(client, className, tenants) { - super(client); - this.validate = () => { - // nothing to validate - }; - this.do = () => { - return this.client.delete(`/schema/${this.className}/tenants`, this.tenants, false); - }; - this.className = className; - this.tenants = tenants; - } -} diff --git a/dist/node/esm/schema/tenantsExists.d.ts b/dist/node/esm/schema/tenantsExists.d.ts deleted file mode 100644 index 4f9adcac..00000000 --- a/dist/node/esm/schema/tenantsExists.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Connection from '../connection/index.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsExists extends CommandBase { - private className; - private tenant; - constructor(client: Connection, className: string, tenant: string); - validate: () => void; - do: () => Promise; -} diff --git a/dist/node/esm/schema/tenantsExists.js b/dist/node/esm/schema/tenantsExists.js deleted file mode 100644 index 6d280085..00000000 --- a/dist/node/esm/schema/tenantsExists.js +++ /dev/null @@ -1,14 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsExists extends CommandBase { - constructor(client, className, tenant) { - super(client); - this.validate = () => { - // nothing to validate - }; - this.do = () => { - return this.client.head(`/schema/${this.className}/tenants/${this.tenant}`, undefined); - }; - this.className = className; - this.tenant = tenant; - } -} diff --git a/dist/node/esm/schema/tenantsGetter.d.ts b/dist/node/esm/schema/tenantsGetter.d.ts deleted file mode 100644 index 23437227..00000000 --- a/dist/node/esm/schema/tenantsGetter.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Connection from '../connection/index.js'; -import { Tenant } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsGetter extends CommandBase { - private className; - constructor(client: Connection, className: string); - validate: () => void; - do: () => Promise>; -} diff --git a/dist/node/esm/schema/tenantsGetter.js b/dist/node/esm/schema/tenantsGetter.js deleted file mode 100644 index 4eb4e8d0..00000000 --- a/dist/node/esm/schema/tenantsGetter.js +++ /dev/null @@ -1,13 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsGetter extends CommandBase { - constructor(client, className) { - super(client); - this.validate = () => { - // nothing to validate - }; - this.do = () => { - return this.client.get(`/schema/${this.className}/tenants`); - }; - this.className = className; - } -} diff --git a/dist/node/esm/schema/tenantsUpdater.d.ts b/dist/node/esm/schema/tenantsUpdater.d.ts deleted file mode 100644 index 7e3e6d3a..00000000 --- a/dist/node/esm/schema/tenantsUpdater.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import Connection from '../connection/index.js'; -import { Tenant } from '../openapi/types.js'; -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsUpdater extends CommandBase { - private className; - private tenants; - constructor(client: Connection, className: string, tenants: Array); - validate: () => void; - do: () => Promise>; -} diff --git a/dist/node/esm/schema/tenantsUpdater.js b/dist/node/esm/schema/tenantsUpdater.js deleted file mode 100644 index 60ab9d51..00000000 --- a/dist/node/esm/schema/tenantsUpdater.js +++ /dev/null @@ -1,14 +0,0 @@ -import { CommandBase } from '../validation/commandBase.js'; -export default class TenantsUpdater extends CommandBase { - constructor(client, className, tenants) { - super(client); - this.validate = () => { - // nothing to validate - }; - this.do = () => { - return this.client.put(`/schema/${this.className}/tenants`, this.tenants); - }; - this.className = className; - this.tenants = tenants; - } -} diff --git a/dist/node/esm/utils/base64.d.ts b/dist/node/esm/utils/base64.d.ts deleted file mode 100644 index 3090d225..00000000 --- a/dist/node/esm/utils/base64.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// -/** - * This function converts a file buffer into a base64 string so that it can be - * sent to Weaviate and stored as a media field. - * - * @param {string | Buffer} file The media to convert either as a base64 string, a file path string, or as a buffer. If you passed a base64 string, the function does nothing and returns the string as is. - * @returns {string} The base64 string - */ -export declare const toBase64FromMedia: (media: string | Buffer) => Promise; diff --git a/dist/node/esm/utils/base64.js b/dist/node/esm/utils/base64.js deleted file mode 100644 index efd5265a..00000000 --- a/dist/node/esm/utils/base64.js +++ /dev/null @@ -1,46 +0,0 @@ -import fs from 'fs'; -const isFilePromise = (file) => - new Promise((resolve, reject) => { - if (file instanceof Buffer) { - resolve(false); - } - fs.stat(file, (err, stats) => { - if (err) { - if (err.code == 'ENAMETOOLONG') { - resolve(false); - return; - } - reject(err); - return; - } - if (stats === undefined) { - resolve(false); - return; - } - resolve(stats.isFile()); - }); - }); -const isBuffer = (file) => file instanceof Buffer; -const fileToBase64 = (file) => - isFilePromise(file).then((isFile) => - isFile - ? new Promise((resolve, reject) => { - fs.readFile(file, (err, data) => { - if (err) { - reject(err); - } - resolve(data.toString('base64')); - }); - }) - : isBuffer(file) - ? Promise.resolve(file.toString('base64')) - : Promise.resolve(file) - ); -/** - * This function converts a file buffer into a base64 string so that it can be - * sent to Weaviate and stored as a media field. - * - * @param {string | Buffer} file The media to convert either as a base64 string, a file path string, or as a buffer. If you passed a base64 string, the function does nothing and returns the string as is. - * @returns {string} The base64 string - */ -export const toBase64FromMedia = (media) => fileToBase64(media); diff --git a/dist/node/esm/utils/beaconPath.d.ts b/dist/node/esm/utils/beaconPath.d.ts deleted file mode 100644 index 0da700a7..00000000 --- a/dist/node/esm/utils/beaconPath.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { DbVersionSupport } from './dbVersion.js'; -export declare class BeaconPath { - private dbVersionSupport; - private beaconRegExp; - constructor(dbVersionSupport: DbVersionSupport); - rebuild(beacon: string): Promise; -} diff --git a/dist/node/esm/utils/beaconPath.js b/dist/node/esm/utils/beaconPath.js deleted file mode 100644 index f148efc1..00000000 --- a/dist/node/esm/utils/beaconPath.js +++ /dev/null @@ -1,81 +0,0 @@ -var __awaiter = - (this && this.__awaiter) || - function (thisArg, _arguments, P, generator) { - function adopt(value) { - return value instanceof P - ? value - : new P(function (resolve) { - resolve(value); - }); - } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { - try { - step(generator.next(value)); - } catch (e) { - reject(e); - } - } - function rejected(value) { - try { - step(generator['throw'](value)); - } catch (e) { - reject(e); - } - } - function step(result) { - result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); - } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); - }; -import { isValidStringProperty } from '../validation/string.js'; -import { isValidWeaviateVersion } from '../validation/version.js'; -const beaconPathPrefix = 'weaviate://localhost'; -export class BeaconPath { - constructor(dbVersionSupport) { - this.dbVersionSupport = dbVersionSupport; - // matches - // weaviate://localhost/class/id => match[2] = class, match[4] = id - // weaviate://localhost/class/id/ => match[2] = class, match[4] = id - // weaviate://localhost/id => match[2] = id, match[4] = undefined - // weaviate://localhost/id/ => match[2] = id, match[4] = undefined - this.beaconRegExp = /^weaviate:\/\/localhost(\/([^\\/]+))?(\/([^\\/]+))?[\\/]?$/gi; - } - rebuild(beacon) { - return __awaiter(this, void 0, void 0, function* () { - const support = yield this.dbVersionSupport.supportsClassNameNamespacedEndpointsPromise(); - const match = new RegExp(this.beaconRegExp).exec(beacon); - if (!match) { - return beacon; - } - let className; - let id; - if (match[4] !== undefined) { - id = match[4]; - className = match[2]; - } else { - id = match[2]; - } - let beaconPath = beaconPathPrefix; - if (support.supports) { - if (isValidStringProperty(className)) { - beaconPath = `${beaconPath}/${className}`; - } else { - support.warns.deprecatedNonClassNameNamespacedEndpointsForBeacons(); - } - } else { - support.warns.notSupportedClassNamespacedEndpointsForBeacons(); - } - if (support.version) { - if (!isValidWeaviateVersion(support.version)) { - support.warns.deprecatedWeaviateTooOld(); - } - } - if (isValidStringProperty(id)) { - beaconPath = `${beaconPath}/${id}`; - } - return beaconPath; - }); - } -} diff --git a/dist/node/esm/utils/dbVersion.d.ts b/dist/node/esm/utils/dbVersion.d.ts deleted file mode 100644 index 01e72b28..00000000 --- a/dist/node/esm/utils/dbVersion.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -import ConnectionGRPC from '../connection/grpc.js'; -export declare class DbVersionSupport { - private dbVersionProvider; - constructor(dbVersionProvider: VersionProvider); - getVersion: () => Promise; - supportsClassNameNamespacedEndpointsPromise(): Promise<{ - version: string; - supports: boolean; - warns: { - deprecatedNonClassNameNamespacedEndpointsForObjects: () => void; - deprecatedNonClassNameNamespacedEndpointsForReferences: () => void; - deprecatedNonClassNameNamespacedEndpointsForBeacons: () => void; - deprecatedWeaviateTooOld: () => void; - notSupportedClassNamespacedEndpointsForObjects: () => void; - notSupportedClassNamespacedEndpointsForReferences: () => void; - notSupportedClassNamespacedEndpointsForBeacons: () => void; - notSupportedClassParameterInEndpointsForObjects: () => void; - }; - }>; - supportsClassNameNamespacedEndpoints(version?: string): boolean; - private errorMessage; - supportsCompatibleGrpcService: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsHNSWAndBQ: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsBm25AndHybridGroupByQueries: () => Promise<{ - version: DbVersion; - supports: boolean; - message: (query: 'Bm25' | 'Hybrid') => string; - }>; - supportsHybridNearTextAndNearVectorSubsearchQueries: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supports125ListValue: () => Promise<{ - version: DbVersion; - supports: boolean; - message: undefined; - }>; - supportsNamedVectors: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsTenantsGetGRPCMethod: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsDynamicVectorIndex: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsMultiTargetVectorSearch: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsMultiVectorSearch: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsMultiVectorPerTargetSearch: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; - supportsMultiWeightsPerTargetSearch: () => Promise<{ - version: DbVersion; - supports: boolean; - message: string; - }>; -} -export interface VersionProvider { - getVersionString(): Promise; - getVersion(): Promise; -} -export declare class DbVersionProvider implements VersionProvider { - private versionPromise?; - private versionStringGetter; - constructor(versionStringGetter: () => Promise); - getVersionString(): Promise; - getVersion(): Promise; - refresh(force?: boolean): Promise; - cache(version: string): Promise; -} -export declare function initDbVersionProvider(conn: ConnectionGRPC): DbVersionProvider; -export declare class DbVersion { - private major; - private minor; - private patch?; - constructor(major: number, minor: number, patch?: number); - static fromString: (version: string) => DbVersion; - private checkNumber; - show: () => string; - isAtLeast: (major: number, minor: number, patch?: number) => boolean; - isLowerThan: (major: number, minor: number, patch: number) => boolean; -} diff --git a/dist/node/esm/utils/dbVersion.js b/dist/node/esm/utils/dbVersion.js deleted file mode 100644 index e9579743..00000000 --- a/dist/node/esm/utils/dbVersion.js +++ /dev/null @@ -1,257 +0,0 @@ -import MetaGetter from '../misc/metaGetter.js'; -export class DbVersionSupport { - constructor(dbVersionProvider) { - this.getVersion = () => this.dbVersionProvider.getVersion(); - this.errorMessage = (feature, current, required) => - `${feature} is not supported with Weaviate version v${current}. Please use version v${required} or higher.`; - this.supportsCompatibleGrpcService = () => - this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 23, 7), - message: this.errorMessage('The gRPC API', version.show(), '1.23.7'), - }; - }); - this.supportsHNSWAndBQ = () => - this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 24, 0), - message: this.errorMessage('HNSW index and BQ quantizer', version.show(), '1.24.0'), - }; - }); - this.supportsBm25AndHybridGroupByQueries = () => - this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 25, 0), - message: (query) => this.errorMessage(`GroupBy with ${query}`, version.show(), '1.25.0'), - }; - }); - this.supportsHybridNearTextAndNearVectorSubsearchQueries = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 25, 0), - message: this.errorMessage('Hybrid nearText/nearVector subsearching', version.show(), '1.25.0'), - }; - }); - }; - this.supports125ListValue = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 25, 0), - message: undefined, - }; - }); - }; - this.supportsNamedVectors = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 24, 0), - message: this.errorMessage('Named vectors', version.show(), '1.24.0'), - }; - }); - }; - this.supportsTenantsGetGRPCMethod = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 25, 0), - message: this.errorMessage('Tenants get method', version.show(), '1.25.0'), - }; - }); - }; - this.supportsDynamicVectorIndex = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 25, 0), - message: this.errorMessage('Dynamic vector index', version.show(), '1.25.0'), - }; - }); - }; - this.supportsMultiTargetVectorSearch = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 26, 0), - message: this.errorMessage('Multi-target vector search', version.show(), '1.26.0'), - }; - }); - }; - this.supportsMultiVectorSearch = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 26, 0), - message: this.errorMessage('Multi-vector search', version.show(), '1.26.0'), - }; - }); - }; - this.supportsMultiVectorPerTargetSearch = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 27, 0), - message: this.errorMessage('Multi-vector-per-target search', version.show(), '1.27.0'), - }; - }); - }; - this.supportsMultiWeightsPerTargetSearch = () => { - return this.dbVersionProvider.getVersion().then((version) => { - return { - version: version, - supports: version.isAtLeast(1, 27, 0), - message: this.errorMessage( - 'Multi-target vector search with multiple weights', - version.show(), - '1.27.0' - ), - }; - }); - }; - this.dbVersionProvider = dbVersionProvider; - } - supportsClassNameNamespacedEndpointsPromise() { - return this.dbVersionProvider - .getVersion() - .then((version) => version.show()) - .then((version) => ({ - version: version, - supports: this.supportsClassNameNamespacedEndpoints(version), - warns: { - deprecatedNonClassNameNamespacedEndpointsForObjects: () => - console.warn( - `Usage of objects paths without className is deprecated in Weaviate ${version}. Please provide className parameter` - ), - deprecatedNonClassNameNamespacedEndpointsForReferences: () => - console.warn( - `Usage of references paths without className is deprecated in Weaviate ${version}. Please provide className parameter` - ), - deprecatedNonClassNameNamespacedEndpointsForBeacons: () => - console.warn( - `Usage of beacons paths without className is deprecated in Weaviate ${version}. Please provide className parameter` - ), - deprecatedWeaviateTooOld: () => - console.warn( - `Usage of weaviate ${version} is deprecated. Please consider upgrading to the latest version. See https://www.weaviate.io/developers/weaviate for details.` - ), - notSupportedClassNamespacedEndpointsForObjects: () => - console.warn( - `Usage of objects paths with className is not supported in Weaviate ${version}. className parameter is ignored` - ), - notSupportedClassNamespacedEndpointsForReferences: () => - console.warn( - `Usage of references paths with className is not supported in Weaviate ${version}. className parameter is ignored` - ), - notSupportedClassNamespacedEndpointsForBeacons: () => - console.warn( - `Usage of beacons paths with className is not supported in Weaviate ${version}. className parameter is ignored` - ), - notSupportedClassParameterInEndpointsForObjects: () => - console.warn( - `Usage of objects paths with class query parameter is not supported in Weaviate ${version}. class query parameter is ignored` - ), - }, - })); - } - // >= 1.14 - supportsClassNameNamespacedEndpoints(version) { - if (typeof version === 'string') { - const versionNumbers = version.split('.'); - if (versionNumbers.length >= 2) { - const major = parseInt(versionNumbers[0], 10); - const minor = parseInt(versionNumbers[1], 10); - return (major == 1 && minor >= 14) || major >= 2; - } - } - return false; - } -} -const EMPTY_VERSION = ''; -export class DbVersionProvider { - constructor(versionStringGetter) { - this.versionStringGetter = versionStringGetter; - this.versionPromise = undefined; - } - getVersionString() { - return this.getVersion().then((version) => version.show()); - } - getVersion() { - if (this.versionPromise) { - return this.versionPromise; - } - return this.versionStringGetter().then((version) => this.cache(version)); - } - refresh(force = false) { - if (force || !this.versionPromise) { - this.versionPromise = undefined; - return this.versionStringGetter() - .then((version) => this.cache(version)) - .then(() => Promise.resolve(true)); - } - return Promise.resolve(false); - } - cache(version) { - if (version === EMPTY_VERSION) { - return Promise.resolve(new DbVersion(0, 0, 0)); - } - this.versionPromise = Promise.resolve(DbVersion.fromString(version)); - return this.versionPromise; - } -} -export function initDbVersionProvider(conn) { - const metaGetter = new MetaGetter(conn); - const versionGetter = () => { - return metaGetter.do().then((result) => (result.version ? result.version : '')); - }; - return new DbVersionProvider(versionGetter); -} -export class DbVersion { - constructor(major, minor, patch) { - this.checkNumber = (num) => { - if (!Number.isSafeInteger(num)) { - throw new Error(`Invalid number: ${num}`); - } - }; - this.show = () => - this.major === 0 && this.major === this.minor && this.minor === this.patch - ? '' - : `${this.major}.${this.minor}${this.patch !== undefined ? `.${this.patch}` : ''}`; - this.isAtLeast = (major, minor, patch) => { - this.checkNumber(major); - this.checkNumber(minor); - if (this.major > major) return true; - if (this.major < major) return false; - if (this.minor > minor) return true; - if (this.minor < minor) return false; - if (this.patch !== undefined && patch !== undefined && this.patch >= patch) { - this.checkNumber(patch); - return true; - } - return false; - }; - this.isLowerThan = (major, minor, patch) => !this.isAtLeast(major, minor, patch); - this.major = major; - this.minor = minor; - this.patch = patch; - } -} -DbVersion.fromString = (version) => { - let regex = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/; - let match = version.match(regex); - if (match) { - const [_, major, minor, patch] = match; - return new DbVersion(parseInt(major, 10), parseInt(minor, 10), parseInt(patch, 10)); - } - regex = /^v?(\d+)\.(\d+)$/; - match = version.match(regex); - if (match) { - const [_, major, minor] = match; - return new DbVersion(parseInt(major, 10), parseInt(minor, 10)); - } - throw new Error(`Invalid version string: ${version}`); -}; diff --git a/dist/node/esm/utils/testData.d.ts b/dist/node/esm/utils/testData.d.ts deleted file mode 100644 index 7024a4e3..00000000 --- a/dist/node/esm/utils/testData.d.ts +++ /dev/null @@ -1,354 +0,0 @@ -import { WeaviateClient } from '../v2/index.js'; -export declare const PIZZA_CLASS_NAME = 'Pizza'; -export declare const SOUP_CLASS_NAME = 'Soup'; -export declare function createTestFoodSchema(client: WeaviateClient): Promise< - [ - { - class?: string | undefined; - vectorConfig?: - | { - [key: string]: { - vectorizer?: - | { - [key: string]: unknown; - } - | undefined; - vectorIndexType?: string | undefined; - vectorIndexConfig?: - | { - [key: string]: unknown; - } - | undefined; - }; - } - | undefined; - vectorIndexType?: string | undefined; - vectorIndexConfig?: - | { - [key: string]: unknown; - } - | undefined; - shardingConfig?: - | { - [key: string]: unknown; - } - | undefined; - replicationConfig?: - | { - factor?: number | undefined; - asyncEnabled?: boolean | undefined; - deletionStrategy?: 'NoAutomatedResolution' | 'DeleteOnConflict' | undefined; - } - | undefined; - invertedIndexConfig?: - | { - cleanupIntervalSeconds?: number | undefined; - bm25?: - | { - k1?: number | undefined; - b?: number | undefined; - } - | undefined; - stopwords?: - | { - preset?: string | undefined; - additions?: string[] | undefined; - removals?: string[] | undefined; - } - | undefined; - indexTimestamps?: boolean | undefined; - indexNullState?: boolean | undefined; - indexPropertyLength?: boolean | undefined; - } - | undefined; - multiTenancyConfig?: - | { - enabled?: boolean | undefined; - autoTenantCreation?: boolean | undefined; - autoTenantActivation?: boolean | undefined; - } - | undefined; - vectorizer?: string | undefined; - moduleConfig?: - | { - [key: string]: unknown; - } - | undefined; - description?: string | undefined; - properties?: - | { - dataType?: string[] | undefined; - description?: string | undefined; - moduleConfig?: - | { - [key: string]: unknown; - } - | undefined; - name?: string | undefined; - indexInverted?: boolean | undefined; - indexFilterable?: boolean | undefined; - indexSearchable?: boolean | undefined; - indexRangeFilters?: boolean | undefined; - tokenization?: - | 'word' - | 'lowercase' - | 'whitespace' - | 'field' - | 'trigram' - | 'gse' - | 'kagome_kr' - | undefined; - nestedProperties?: - | { - dataType?: string[] | undefined; - description?: string | undefined; - name?: string | undefined; - indexFilterable?: boolean | undefined; - indexSearchable?: boolean | undefined; - indexRangeFilters?: boolean | undefined; - tokenization?: 'word' | 'lowercase' | 'whitespace' | 'field' | undefined; - nestedProperties?: any[] | undefined; - }[] - | undefined; - }[] - | undefined; - }, - { - class?: string | undefined; - vectorConfig?: - | { - [key: string]: { - vectorizer?: - | { - [key: string]: unknown; - } - | undefined; - vectorIndexType?: string | undefined; - vectorIndexConfig?: - | { - [key: string]: unknown; - } - | undefined; - }; - } - | undefined; - vectorIndexType?: string | undefined; - vectorIndexConfig?: - | { - [key: string]: unknown; - } - | undefined; - shardingConfig?: - | { - [key: string]: unknown; - } - | undefined; - replicationConfig?: - | { - factor?: number | undefined; - asyncEnabled?: boolean | undefined; - deletionStrategy?: 'NoAutomatedResolution' | 'DeleteOnConflict' | undefined; - } - | undefined; - invertedIndexConfig?: - | { - cleanupIntervalSeconds?: number | undefined; - bm25?: - | { - k1?: number | undefined; - b?: number | undefined; - } - | undefined; - stopwords?: - | { - preset?: string | undefined; - additions?: string[] | undefined; - removals?: string[] | undefined; - } - | undefined; - indexTimestamps?: boolean | undefined; - indexNullState?: boolean | undefined; - indexPropertyLength?: boolean | undefined; - } - | undefined; - multiTenancyConfig?: - | { - enabled?: boolean | undefined; - autoTenantCreation?: boolean | undefined; - autoTenantActivation?: boolean | undefined; - } - | undefined; - vectorizer?: string | undefined; - moduleConfig?: - | { - [key: string]: unknown; - } - | undefined; - description?: string | undefined; - properties?: - | { - dataType?: string[] | undefined; - description?: string | undefined; - moduleConfig?: - | { - [key: string]: unknown; - } - | undefined; - name?: string | undefined; - indexInverted?: boolean | undefined; - indexFilterable?: boolean | undefined; - indexSearchable?: boolean | undefined; - indexRangeFilters?: boolean | undefined; - tokenization?: - | 'word' - | 'lowercase' - | 'whitespace' - | 'field' - | 'trigram' - | 'gse' - | 'kagome_kr' - | undefined; - nestedProperties?: - | { - dataType?: string[] | undefined; - description?: string | undefined; - name?: string | undefined; - indexFilterable?: boolean | undefined; - indexSearchable?: boolean | undefined; - indexRangeFilters?: boolean | undefined; - tokenization?: 'word' | 'lowercase' | 'whitespace' | 'field' | undefined; - nestedProperties?: any[] | undefined; - }[] - | undefined; - }[] - | undefined; - } - ] ->; -export declare function createTestFoodData(client: WeaviateClient): Promise< - ({ - class?: string | undefined; - vectorWeights?: - | { - [key: string]: unknown; - } - | undefined; - properties?: - | { - [key: string]: unknown; - } - | undefined; - id?: string | undefined; - creationTimeUnix?: number | undefined; - lastUpdateTimeUnix?: number | undefined; - vector?: number[] | undefined; - vectors?: - | { - [key: string]: number[]; - } - | undefined; - tenant?: string | undefined; - additional?: - | { - [key: string]: { - [key: string]: unknown; - }; - } - | undefined; - } & { - deprecations?: - | { - id?: string | undefined; - status?: string | undefined; - apiType?: string | undefined; - msg?: string | undefined; - mitigation?: string | undefined; - sinceVersion?: string | undefined; - plannedRemovalVersion?: string | undefined; - removedIn?: string | undefined; - removedTime?: string | undefined; - sinceTime?: string | undefined; - locations?: string[] | undefined; - }[] - | undefined; - } & { - result?: - | { - status?: 'SUCCESS' | 'FAILED' | 'PENDING' | undefined; - errors?: - | { - error?: - | { - message?: string | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - })[] ->; -export declare function createTestFoodSchemaAndData(client: WeaviateClient): Promise< - ({ - class?: string | undefined; - vectorWeights?: - | { - [key: string]: unknown; - } - | undefined; - properties?: - | { - [key: string]: unknown; - } - | undefined; - id?: string | undefined; - creationTimeUnix?: number | undefined; - lastUpdateTimeUnix?: number | undefined; - vector?: number[] | undefined; - vectors?: - | { - [key: string]: number[]; - } - | undefined; - tenant?: string | undefined; - additional?: - | { - [key: string]: { - [key: string]: unknown; - }; - } - | undefined; - } & { - deprecations?: - | { - id?: string | undefined; - status?: string | undefined; - apiType?: string | undefined; - msg?: string | undefined; - mitigation?: string | undefined; - sinceVersion?: string | undefined; - plannedRemovalVersion?: string | undefined; - removedIn?: string | undefined; - removedTime?: string | undefined; - sinceTime?: string | undefined; - locations?: string[] | undefined; - }[] - | undefined; - } & { - result?: - | { - status?: 'SUCCESS' | 'FAILED' | 'PENDING' | undefined; - errors?: - | { - error?: - | { - message?: string | undefined; - }[] - | undefined; - } - | undefined; - } - | undefined; - })[] ->; -export declare function cleanupTestFood(client: WeaviateClient): Promise<[void, void]>; diff --git a/dist/node/esm/utils/testData.js b/dist/node/esm/utils/testData.js deleted file mode 100644 index 545ba7b6..00000000 --- a/dist/node/esm/utils/testData.js +++ /dev/null @@ -1,116 +0,0 @@ -export const PIZZA_CLASS_NAME = 'Pizza'; -export const SOUP_CLASS_NAME = 'Soup'; -const foodProperties = [ - { - name: 'name', - dataType: ['string'], - description: 'name', - tokenization: 'field', - }, - { - name: 'description', - dataType: ['text'], - description: 'description', - tokenization: 'word', - }, - { - name: 'bestBefore', - dataType: ['date'], - description: 'best before', - }, -]; -const pizzaClass = { - class: PIZZA_CLASS_NAME, - description: 'A delicious religion like food and arguably the best export of Italy.', - invertedIndexConfig: { - indexTimestamps: true, - }, - properties: foodProperties, -}; -const soupClass = { - class: SOUP_CLASS_NAME, - description: 'Mostly water based brew of sustenance for humans.', - properties: foodProperties, -}; -const pizzaObjects = [ - { - class: PIZZA_CLASS_NAME, - id: '10523cdd-15a2-42f4-81fa-267fe92f7cd6', - properties: { - name: 'Quattro Formaggi', - description: - "Pizza quattro formaggi Italian: ['kwattro for'maddÊ’i] (four cheese pizza) is a variety of pizza in Italian cuisine that is topped with a combination of four kinds of cheese, usually melted together, with (rossa, red) or without (bianca, white) tomato sauce. It is popular worldwide, including in Italy,[1] and is one of the iconic items from pizzerias's menus.", - bestBefore: '2022-01-02T03:04:05+01:00', - }, - }, - { - class: PIZZA_CLASS_NAME, - id: '927dd3ac-e012-4093-8007-7799cc7e81e4', - properties: { - name: 'Frutti di Mare', - description: - 'Frutti di Mare is an Italian type of pizza that may be served with scampi, mussels or squid. It typically lacks cheese, with the seafood being served atop a tomato sauce.', - bestBefore: '2022-02-03T04:05:06+02:00', - }, - }, - { - class: PIZZA_CLASS_NAME, - id: 'f824a18e-c430-4475-9bef-847673fbb54e', - properties: { - name: 'Hawaii', - description: 'Universally accepted to be the best pizza ever created.', - bestBefore: '2022-03-04T05:06:07+03:00', - }, - }, - { - class: PIZZA_CLASS_NAME, - id: 'd2b393ff-4b26-48c7-b554-218d970a9e17', - properties: { - name: 'Doener', - description: 'A innovation, some say revolution, in the pizza industry.', - bestBefore: '2022-04-05T06:07:08+04:00', - }, - }, -]; -const soupObjects = [ - { - class: SOUP_CLASS_NAME, - id: '8c156d37-81aa-4ce9-a811-621e2702b825', - properties: { - name: 'ChickenSoup', - description: 'Used by humans when their inferior genetics are attacked by microscopic organisms.', - bestBefore: '2022-05-06T07:08:09+05:00', - }, - }, - { - class: SOUP_CLASS_NAME, - id: '27351361-2898-4d1a-aad7-1ca48253eb0b', - properties: { - name: 'Beautiful', - description: 'Putting the game of letter soups to a whole new level.', - bestBefore: '2022-06-07T08:09:10+06:00', - }, - }, -]; -export function createTestFoodSchema(client) { - return Promise.all([ - client.schema.classCreator().withClass(pizzaClass).do(), - client.schema.classCreator().withClass(soupClass).do(), - ]); -} -export function createTestFoodData(client) { - return client.batch - .objectsBatcher() - .withObjects(...pizzaObjects) - .withObjects(...soupObjects) - .do(); -} -export function createTestFoodSchemaAndData(client) { - return createTestFoodSchema(client).then(() => createTestFoodData(client)); -} -export function cleanupTestFood(client) { - return Promise.all([ - client.schema.classDeleter().withClassName(PIZZA_CLASS_NAME).do(), - client.schema.classDeleter().withClassName(SOUP_CLASS_NAME).do(), - ]); -} diff --git a/dist/node/esm/utils/uuid.d.ts b/dist/node/esm/utils/uuid.d.ts deleted file mode 100644 index eeb2e494..00000000 --- a/dist/node/esm/utils/uuid.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function generateUuid5(identifier: string | number, namespace?: string | number): string; diff --git a/dist/node/esm/utils/uuid.js b/dist/node/esm/utils/uuid.js deleted file mode 100644 index 5122b040..00000000 --- a/dist/node/esm/utils/uuid.js +++ /dev/null @@ -1,7 +0,0 @@ -import { v5 as uuid5 } from 'uuid'; -// Generates UUIDv5, used to consistently generate the same UUID for -// a specific identifier and namespace -export function generateUuid5(identifier, namespace = '') { - const stringified = identifier.toString() + namespace.toString(); - return uuid5(stringified, uuid5.DNS).toString(); -} diff --git a/dist/node/esm/v2/index.d.ts b/dist/node/esm/v2/index.d.ts deleted file mode 100644 index aa763abe..00000000 --- a/dist/node/esm/v2/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { Backup } from '../backup/index.js'; -import { Batch } from '../batch/index.js'; -import { C11y } from '../c11y/index.js'; -import { Classifications } from '../classifications/index.js'; -import { Cluster } from '../cluster/index.js'; -import { - ApiKey, - AuthAccessTokenCredentials, - AuthClientCredentials, - AuthUserPasswordCredentials, - OidcAuthenticator, -} from '../connection/auth.js'; -import { InternalConnectionParams as ConnectionParams } from '../connection/index.js'; -import { Data } from '../data/index.js'; -import { GraphQL } from '../graphql/index.js'; -import { Misc } from '../misc/index.js'; -import { Schema } from '../schema/index.js'; -export interface WeaviateClient { - graphql: GraphQL; - schema: Schema; - data: Data; - classifications: Classifications; - batch: Batch; - misc: Misc; - c11y: C11y; - backup: Backup; - cluster: Cluster; - oidcAuth?: OidcAuthenticator; -} -declare const app: { - client: (params: ConnectionParams) => WeaviateClient; - ApiKey: typeof ApiKey; - AuthUserPasswordCredentials: typeof AuthUserPasswordCredentials; - AuthAccessTokenCredentials: typeof AuthAccessTokenCredentials; - AuthClientCredentials: typeof AuthClientCredentials; -}; -export default app; -export * from '../backup/index.js'; -export * from '../batch/index.js'; -export * from '../c11y/index.js'; -export * from '../classifications/index.js'; -export * from '../cluster/index.js'; -export * from '../connection/index.js'; -export * from '../data/index.js'; -export * from '../graphql/index.js'; -export * from '../misc/index.js'; -export * from '../openapi/types.js'; -export * from '../schema/index.js'; -export * from '../utils/base64.js'; -export * from '../utils/uuid.js'; diff --git a/dist/node/esm/v2/index.js b/dist/node/esm/v2/index.js deleted file mode 100644 index a22d8050..00000000 --- a/dist/node/esm/v2/index.js +++ /dev/null @@ -1,72 +0,0 @@ -import backup from '../backup/index.js'; -import batch from '../batch/index.js'; -import c11y from '../c11y/index.js'; -import classifications from '../classifications/index.js'; -import cluster from '../cluster/index.js'; -import { - ApiKey, - AuthAccessTokenCredentials, - AuthClientCredentials, - AuthUserPasswordCredentials, -} from '../connection/auth.js'; -import { ConnectionGQL } from '../connection/index.js'; -import data from '../data/index.js'; -import graphql from '../graphql/index.js'; -import misc from '../misc/index.js'; -import MetaGetter from '../misc/metaGetter.js'; -import schema from '../schema/index.js'; -import { DbVersionProvider, DbVersionSupport } from '../utils/dbVersion.js'; -const app = { - client: function (params) { - // check if the URL is set - if (!params.host) throw new Error('Missing `host` parameter'); - // check if headers are set - if (!params.headers) params.headers = {}; - const conn = new ConnectionGQL(params); - const dbVersionProvider = initDbVersionProvider(conn); - const dbVersionSupport = new DbVersionSupport(dbVersionProvider); - const ifc = { - graphql: graphql(conn), - schema: schema(conn), - data: data(conn, dbVersionSupport), - classifications: classifications(conn), - batch: batch(conn, dbVersionSupport), - misc: misc(conn, dbVersionProvider), - c11y: c11y(conn), - backup: backup(conn), - cluster: cluster(conn), - }; - if (conn.oidcAuth) ifc.oidcAuth = conn.oidcAuth; - return ifc; - }, - ApiKey, - AuthUserPasswordCredentials, - AuthAccessTokenCredentials, - AuthClientCredentials, -}; -function initDbVersionProvider(conn) { - const metaGetter = new MetaGetter(conn); - const versionGetter = () => { - return metaGetter - .do() - .then((result) => result.version) - .catch(() => Promise.resolve('')); - }; - const dbVersionProvider = new DbVersionProvider(versionGetter); - dbVersionProvider.refresh(); - return dbVersionProvider; -} -export default app; -export * from '../backup/index.js'; -export * from '../batch/index.js'; -export * from '../c11y/index.js'; -export * from '../classifications/index.js'; -export * from '../cluster/index.js'; -export * from '../connection/index.js'; -export * from '../data/index.js'; -export * from '../graphql/index.js'; -export * from '../misc/index.js'; -export * from '../openapi/types.js'; -export * from '../schema/index.js'; -export * from '../utils/base64.js'; -export * from '../utils/uuid.js'; diff --git a/dist/node/esm/validation/commandBase.d.ts b/dist/node/esm/validation/commandBase.d.ts deleted file mode 100644 index 2c457099..00000000 --- a/dist/node/esm/validation/commandBase.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -import Connection from '../connection/index.js'; -export interface ICommandBase { - /** - * The client's connection - */ - client: Connection; - /** - * An array of validation errors - */ - errors: string[]; - /** - * Execute the command - */ - do: () => Promise; - /** - * Optional method to build the payload of an actual call - */ - payload?: () => any; - /** - * validate that all the required parameters were feed to the builder - */ - validate: () => void; -} -export declare abstract class CommandBase implements ICommandBase { - private _errors; - readonly client: Connection; - protected constructor(client: Connection); - get errors(): string[]; - addError(error: string): void; - addErrors(errors: string[]): void; - abstract do(): Promise; - abstract validate(): void; -} diff --git a/dist/node/esm/validation/commandBase.js b/dist/node/esm/validation/commandBase.js deleted file mode 100644 index 2d237746..00000000 --- a/dist/node/esm/validation/commandBase.js +++ /dev/null @@ -1,15 +0,0 @@ -export class CommandBase { - constructor(client) { - this.client = client; - this._errors = []; - } - get errors() { - return this._errors; - } - addError(error) { - this._errors = [...this.errors, error]; - } - addErrors(errors) { - this._errors = [...this.errors, ...errors]; - } -} diff --git a/dist/node/esm/validation/number.d.ts b/dist/node/esm/validation/number.d.ts deleted file mode 100644 index 0a89171c..00000000 --- a/dist/node/esm/validation/number.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export declare function isValidIntProperty(input: any): boolean; -export declare function isValidPositiveIntProperty(input: any): boolean; -export declare function isValidNumber(input: any): boolean; -export declare function isValidNumberArray(input: any): boolean; diff --git a/dist/node/esm/validation/number.js b/dist/node/esm/validation/number.js deleted file mode 100644 index 12b77ce9..00000000 --- a/dist/node/esm/validation/number.js +++ /dev/null @@ -1,20 +0,0 @@ -export function isValidIntProperty(input) { - return Number.isInteger(input); -} -export function isValidPositiveIntProperty(input) { - return isValidIntProperty(input) && input >= 0; -} -export function isValidNumber(input) { - return typeof input == 'number'; -} -export function isValidNumberArray(input) { - if (Array.isArray(input)) { - for (const i in input) { - if (!isValidNumber(input[i])) { - return false; - } - } - return true; - } - return false; -} diff --git a/dist/node/esm/validation/string.d.ts b/dist/node/esm/validation/string.d.ts deleted file mode 100644 index b9638ca8..00000000 --- a/dist/node/esm/validation/string.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export declare function isValidStringProperty(input: any): boolean; -export declare function isValidStringArray(input: any): boolean; diff --git a/dist/node/esm/validation/string.js b/dist/node/esm/validation/string.js deleted file mode 100644 index 97b8108c..00000000 --- a/dist/node/esm/validation/string.js +++ /dev/null @@ -1,14 +0,0 @@ -export function isValidStringProperty(input) { - return typeof input == 'string' && input.length > 0; -} -export function isValidStringArray(input) { - if (Array.isArray(input)) { - for (const i in input) { - if (!isValidStringProperty(input[i])) { - return false; - } - } - return true; - } - return false; -} diff --git a/dist/node/esm/validation/version.d.ts b/dist/node/esm/validation/version.d.ts deleted file mode 100644 index c08b161d..00000000 --- a/dist/node/esm/validation/version.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function isValidWeaviateVersion(version: string): boolean; diff --git a/dist/node/esm/validation/version.js b/dist/node/esm/validation/version.js deleted file mode 100644 index 1d618888..00000000 --- a/dist/node/esm/validation/version.js +++ /dev/null @@ -1,11 +0,0 @@ -export function isValidWeaviateVersion(version) { - if (typeof version === 'string') { - const versionNumbers = version.split('.'); - if (versionNumbers.length >= 2) { - const major = parseInt(versionNumbers[0], 10); - const minor = parseInt(versionNumbers[1], 10); - return !(major <= 1 && minor < 16); - } - } - return true; -}