UNPKG

@qdrant/js-client-rest

Version:

This repository contains the REST client for the [Qdrant](https://github.com/qdrant/qdrant) vector search engine.

2 lines (1 loc) 28.2 kB
"use strict";var t={isNone:function(){return!0},orElse:function(t){return t},orCall:function(t){return t()},orNull:function(){return null},orThrow:function(t){throw void 0===t&&(t="Unexpected null value"),new TypeError(t)},map:function(){return t},get:function(){return t}},e=function(){function t(t){this.value=t}return t.prototype.isNone=function(){return!1},t.prototype.orElse=function(){return this.value},t.prototype.orCall=function(){return this.value},t.prototype.orNull=function(){return this.value},t.prototype.orThrow=function(){return this.value},t.prototype.map=function(t){return o(t(this.value))},t.prototype.get=function(t){return this.map((function(e){return e[t]}))},t}();function o(o){return function(o){return o===t||o instanceof e}(o)?o:null==o?t:function(t){if(null==t)throw new TypeError("some() does not accept null or undefined");return new e(t)}(o)}class n extends Error{constructor(t){super(t.statusText),Object.setPrototypeOf(this,new.target.prototype),this.headers=t.headers,this.url=t.url,this.status=t.status,this.statusText=t.statusText,this.data=t.data}}let r,s;"rawJSON"in JSON&&(r=function(t,e,o){if(Number.isInteger(e)&&!Number.isSafeInteger(e))try{return BigInt(o.source)}catch{return e}return e},s=function(t,e){return"bigint"==typeof e?JSON.rawJSON(String(e)):e});const a=t=>"post"===t||"put"===t||"patch"===t||"delete"===t;function i(t,e,o){let n={};return a(t)?o.forEach((t=>{n[t]=e[t],delete e[t]})):n={...e},function(t){const e=[],o=(t,e)=>`${encodeURIComponent(t)}=${encodeURIComponent(String(e))}`;return Object.keys(t).forEach((n=>{const r=t[n];null!=r&&(Array.isArray(r)?r.forEach((t=>e.push(o(n,t)))):e.push(o(n,r)))})),e.length>0?`?${e.join("&")}`:""}(n)}function c(t,e){const o=new Headers(t?.headers),n=new Headers(e?.headers);for(const t of n.keys()){const e=n.get(t);null!=e&&o.set(t,e)}return{...t,...e,headers:o}}function l(t){const e=Object.assign(Array.isArray(t.payload)?[]:{},t.payload),o=function(t,e){return t.replace(/\{([^}]+)\}/g,((t,o)=>{const n=encodeURIComponent(e[o]);return delete e[o],n}))}(t.path,e),n=i(t.method,e,t.queryParams),r=function(t,e){if(!a(t))return;const o=e instanceof FormData?e:JSON.stringify(e,s);return"delete"===t&&"{}"===o?void 0:o}(t.method,e),c=a(t.method)?function(t,e){const o=new Headers(e);return void 0===t||t instanceof FormData||o.has("Content-Type")||o.append("Content-Type","application/json"),o.has("Accept")||o.append("Accept","application/json"),o}(r,t.init?.headers):new Headers(t.init?.headers);return{url:t.baseUrl+o+n,init:{...t.init,method:t.method.toUpperCase(),headers:c,body:r}}}async function h(t,e){const o=await fetch(t,e),s=await async function(t){if(204===t.status)return;const e=t.headers.get("content-type"),o=await t.text();if(e&&e.includes("application/json"))return JSON.parse(o,r);try{return JSON.parse(o,r)}catch(t){return o}}(o),a={headers:o.headers,url:o.url,ok:o.ok,status:o.status,statusText:o.statusText,data:s};if(a.ok)return a;throw new n(a)}function p(){let t="",e={};const o=[],r=function(t,e){const o=async(n,r,s)=>{if(null==t||n===t.length)return e(r,s);const a=t[n];return await a(r,s,((t,e)=>o(n+1,t,e)))};return(t,e)=>o(0,t,e)}(o,h);return{configure:n=>{t=n.baseUrl||"",e=n.init||{},o.splice(0),o.push(...n.use||[])},use:t=>o.push(t),path:o=>({method:s=>({create:a=>function(t){const e=async(o,r)=>{try{return await t(o,r)}catch(t){if(t instanceof n)throw new e.Error(t);throw t}};return e.Error=class extends n{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype)}getActualType(){return{status:this.status,data:this.data}}},e}(((n,i)=>async function(t){const{url:e,init:o}=l(t);return await t.fetch(e,o)}({baseUrl:t||"",path:o,method:s,queryParams:Object.keys(a||{}),payload:n,init:c(e,i),fetch:r})))})})}}const d={for:()=>p()};function u(t){return{clusterStatus:t.path("/cluster").method("get").create(),collectionClusterInfo:t.path("/collections/{collection_name}/cluster").method("get").create(),recoverCurrentPeer:t.path("/cluster/recover").method("post").create(),removePeer:t.path("/cluster/peer/{peer_id}").method("delete").create({force:!0}),updateCollectionCluster:t.path("/collections/{collection_name}/cluster").method("post").create({timeout:!0})}}function m(t){return{collectionClusterInfo:t.path("/collections/{collection_name}/cluster").method("get").create(),createCollection:t.path("/collections/{collection_name}").method("put").create({timeout:!0}),createFieldIndex:t.path("/collections/{collection_name}/index").method("put").create({ordering:!0,wait:!0}),createSnapshot:t.path("/collections/{collection_name}/snapshots").method("post").create({wait:!0}),deleteCollection:t.path("/collections/{collection_name}").method("delete").create({timeout:!0}),deleteFieldIndex:t.path("/collections/{collection_name}/index/{field_name}").method("delete").create({ordering:!0,wait:!0}),deleteSnapshots:t.path("/collections/{collection_name}/snapshots/{snapshot_name}").method("delete").create({wait:!0}),getCollection:t.path("/collections/{collection_name}").method("get").create(),getCollectionAliases:t.path("/collections/{collection_name}/aliases").method("get").create(),getCollections:t.path("/collections").method("get").create(),getCollectionsAliases:t.path("/aliases").method("get").create(),collectionExists:t.path("/collections/{collection_name}/exists").method("get").create(),getSnapshot:t.path("/collections/{collection_name}/snapshots/{snapshot_name}").method("get").create(),listSnapshots:t.path("/collections/{collection_name}/snapshots").method("get").create(),updateAliases:t.path("/collections/aliases").method("post").create({timeout:!0}),updateCollection:t.path("/collections/{collection_name}").method("patch").create({timeout:!0}),updateCollectionCluster:t.path("/collections/{collection_name}/cluster").method("post").create({timeout:!0})}}function _(t){return{clearPayload:t.path("/collections/{collection_name}/points/payload/clear").method("post").create({ordering:!0,wait:!0}),countPoints:t.path("/collections/{collection_name}/points/count").method("post").create({timeout:!0}),deletePayload:t.path("/collections/{collection_name}/points/payload/delete").method("post").create({wait:!0,ordering:!0}),deletePoints:t.path("/collections/{collection_name}/points/delete").method("post").create({wait:!0,ordering:!0}),updateVectors:t.path("/collections/{collection_name}/points/vectors").method("put").create({wait:!0,ordering:!0}),deleteVectors:t.path("/collections/{collection_name}/points/vectors/delete").method("post").create({wait:!0,ordering:!0}),getPoint:t.path("/collections/{collection_name}/points/{id}").method("get").create(),getPoints:t.path("/collections/{collection_name}/points").method("post").create({consistency:!0,timeout:!0}),overwritePayload:t.path("/collections/{collection_name}/points/payload").method("put").create({wait:!0,ordering:!0}),recommendBatchPoints:t.path("/collections/{collection_name}/points/recommend/batch").method("post").create({consistency:!0,timeout:!0}),recommendPoints:t.path("/collections/{collection_name}/points/recommend").method("post").create({consistency:!0,timeout:!0}),searchPointGroups:t.path("/collections/{collection_name}/points/search/groups").method("post").create({consistency:!0,timeout:!0}),scrollPoints:t.path("/collections/{collection_name}/points/scroll").method("post").create({consistency:!0,timeout:!0}),searchBatchPoints:t.path("/collections/{collection_name}/points/search/batch").method("post").create({consistency:!0,timeout:!0}),searchPoints:t.path("/collections/{collection_name}/points/search").method("post").create({consistency:!0,timeout:!0}),setPayload:t.path("/collections/{collection_name}/points/payload").method("post").create({wait:!0,ordering:!0}),upsertPoints:t.path("/collections/{collection_name}/points").method("put").create({wait:!0,ordering:!0}),recommendPointGroups:t.path("/collections/{collection_name}/points/recommend/groups").method("post").create({consistency:!0,timeout:!0}),batchUpdate:t.path("/collections/{collection_name}/points/batch").method("post").create({wait:!0,ordering:!0}),discoverPoints:t.path("/collections/{collection_name}/points/discover").method("post").create({consistency:!0,timeout:!0}),discoverBatchPoints:t.path("/collections/{collection_name}/points/discover/batch").method("post").create({consistency:!0,timeout:!0}),queryPoints:t.path("/collections/{collection_name}/points/query").method("post").create({consistency:!0,timeout:!0}),queryBatchPoints:t.path("/collections/{collection_name}/points/query/batch").method("post").create({consistency:!0,timeout:!0}),queryPointsGroups:t.path("/collections/{collection_name}/points/query/groups").method("post").create({consistency:!0,timeout:!0})}}function y(t){return{getLocks:t.path("/locks").method("get").create(),metrics:t.path("/metrics").method("get").create(),postLocks:t.path("/locks").method("post").create(),telemetry:t.path("/telemetry").method("get").create(),healthz:t.path("/healthz").method("get").create(),livez:t.path("/livez").method("get").create(),readyz:t.path("/readyz").method("get").create(),root:t.path("/").method("get").create(),getIssues:t.path("/issues").method("get").create(),clearIssues:t.path("/issues").method("delete").create()}}function w(t){return{createFullSnapshot:t.path("/snapshots").method("post").create({wait:!0}),createSnapshot:t.path("/collections/{collection_name}/snapshots").method("post").create({wait:!0}),deleteFullSnapshot:t.path("/snapshots/{snapshot_name}").method("delete").create({wait:!0}),deleteSnapshot:t.path("/collections/{collection_name}/snapshots/{snapshot_name}").method("delete").create({wait:!0}),getFullSnapshot:t.path("/snapshots/{snapshot_name}").method("get").create(),getSnapshot:t.path("/collections/{collection_name}/snapshots/{snapshot_name}").method("get").create(),listFullSnapshots:t.path("/snapshots").method("get").create(),listSnapshots:t.path("/collections/{collection_name}/snapshots").method("get").create(),recoverFromUploadedSnapshot:t.path("/collections/{collection_name}/snapshots/upload").method("post").create({wait:!0,priority:!0,checksum:!0}),recoverFromSnapshot:t.path("/collections/{collection_name}/snapshots/recover").method("put").create({wait:!0}),recoverShardFromUploadedSnapshot:t.path("/collections/{collection_name}/shards/{shard_id}/snapshots/upload").method("post").create({wait:!0,priority:!0,checksum:!0}),recoverShardFromSnapshot:t.path("/collections/{collection_name}/shards/{shard_id}/snapshots/recover").method("put").create({wait:!0}),listShardSnapshots:t.path("/collections/{collection_name}/shards/{shard_id}/snapshots").method("get").create(),createShardSnapshot:t.path("/collections/{collection_name}/shards/{shard_id}/snapshots").method("post").create({wait:!0}),getShardSnapshot:t.path("/collections/{collection_name}/shards/{shard_id}/snapshots/{snapshot_name}").method("get").create(),deleteShardSnapshot:t.path("/collections/{collection_name}/shards/{shard_id}/snapshots/{snapshot_name}").method("delete").create({wait:!0})}}function f(t){return{createShardKey:t.path("/collections/{collection_name}/shards").method("put").create({timeout:!0}),deleteShardKey:t.path("/collections/{collection_name}/shards/delete").method("post").create({timeout:!0})}}class g extends Error{constructor(t){super(t),this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}}class C extends g{static forResponse(t){const e=`${`${t.status}`} ${t.statusText?`(${t.statusText})`:"(Unrecognized Status Code)"}`.trim(),o=t.data?JSON.stringify(t.data,null,2):null;let n="";o&&(n=o.length<=200?o:o.slice(0,-4)+" ...");return new C(`Unexpected Response: ${e}\n${`Raw response content:\n${n}`}`)}}class v extends g{}class A extends g{}function k(t,e){const o=function(t,{headers:e,timeout:o,connections:n}){const r=[];Number.isFinite(o)&&r.push((async(t,e,n)=>{const r=new AbortController,s=setTimeout((()=>r.abort()),o);try{return await n(t,Object.assign(e,{signal:r.signal}))}catch(t){if(t instanceof Error&&"AbortError"===t.name)throw new A(t.message);throw t}finally{clearTimeout(s)}}));r.push((async(t,e,o)=>{const n=await o(t,e);if(200===n.status||201===n.status)return n;throw C.forResponse(n)}));const s=d.for();return s.configure({baseUrl:t,init:{headers:e,dispatcher:void 0},use:r}),s}(t,e);return{cluster:u(o),collections:m(o),points:_(o),service:y(o),snapshots:w(o),shards:f(o)}}exports.QdrantClient=class{constructor({url:t,host:e,apiKey:o,https:n,prefix:r,port:s=6333,timeout:a=3e5,...i}={}){if(this._https=n??"string"==typeof o,this._scheme=this._https?"https":"http",this._prefix=r??"",this._prefix.length>0&&!this._prefix.startsWith("/")&&(this._prefix=`/${this._prefix}`),t&&e)throw new v(`Only one of \`url\`, \`host\` params can be set. Url is ${t}, host is ${e}`);if(e&&(e.startsWith("http://")||e.startsWith("https://")||/:\d+$/.test(e)))throw new v("The `host` param is not expected to contain neither protocol (http:// or https://) nor port (:6333).\nTry to use the `url` parameter instead.");if(t){if(!t.startsWith("http://")&&!t.startsWith("https://"))throw new v("The `url` param expected to contain a valid URL starting with a protocol (http:// or https://).");const e=new URL(t);if(this._host=e.hostname,this._port=e.port?Number(e.port):s,this._scheme=e.protocol.replace(":",""),this._prefix.length>0&&"/"!==e.pathname)throw new v(`Prefix can be set either in \`url\` or in \`prefix\`.\nurl is ${t}, prefix is ${e.pathname}`)}else this._port=s,this._host=e??"127.0.0.1";const c=new Headers([["user-agent","qdrant-js"]]),l=i.headers??{};Object.keys(l).forEach((t=>{l[t]&&c.set(t,String(l[t]))})),"string"==typeof o&&("http"===this._scheme&&console.warn("Api key is used with unsecure connection."),c.set("api-key",o));const h=this._port?`${this._host}:${this._port}`:this._host;this._restUri=`${this._scheme}://${h}${this._prefix}`;const p=i.maxConnections,d={headers:c,timeout:a,connections:p};this._openApiClient=k(this._restUri,d)}api(t){return this._openApiClient[t]}async searchBatch(t,{searches:e,consistency:n,timeout:r}){return o((await this._openApiClient.points.searchBatchPoints({collection_name:t,consistency:n,timeout:r,searches:e})).data.result).orThrow("Search batch returned empty")}async search(t,{shard_key:e,vector:n,limit:r=10,offset:s=0,filter:a,params:i,with_payload:c=!0,with_vector:l=!1,score_threshold:h,consistency:p,timeout:d}){return o((await this._openApiClient.points.searchPoints({collection_name:t,consistency:p,timeout:d,shard_key:e,vector:n,limit:r,offset:s,filter:a,params:i,with_payload:c,with_vector:l,score_threshold:h})).data.result).orThrow("Search returned empty")}async recommendBatch(t,{searches:e,consistency:n,timeout:r}){return o((await this._openApiClient.points.recommendBatchPoints({collection_name:t,searches:e,consistency:n,timeout:r})).data.result).orElse([])}async recommend_batch(t,{searches:e,consistency:n,timeout:r}){return o((await this._openApiClient.points.recommendBatchPoints({collection_name:t,searches:e,consistency:n,timeout:r})).data.result).orElse([])}async recommend(t,{shard_key:e,positive:n,negative:r,strategy:s,filter:a,params:i,limit:c=10,offset:l=0,with_payload:h=!0,with_vector:p=!1,score_threshold:d,using:u,lookup_from:m,consistency:_,timeout:y}){return o((await this._openApiClient.points.recommendPoints({collection_name:t,limit:c,shard_key:e,positive:n,negative:r,strategy:s,filter:a,params:i,offset:l,with_payload:h,with_vector:p,score_threshold:d,using:u,lookup_from:m,consistency:_,timeout:y})).data.result).orThrow("Recommend points API returned empty")}async scroll(t,{shard_key:e,filter:n,consistency:r,timeout:s,limit:a=10,offset:i,with_payload:c=!0,with_vector:l=!1,order_by:h}={}){return o((await this._openApiClient.points.scrollPoints({collection_name:t,shard_key:e,limit:a,offset:i,filter:n,with_payload:c,with_vector:l,order_by:h,consistency:r,timeout:s})).data.result).orThrow("Scroll points API returned empty")}async count(t,{shard_key:e,filter:n,exact:r=!0,timeout:s}={}){return o((await this._openApiClient.points.countPoints({collection_name:t,shard_key:e,filter:n,exact:r,timeout:s})).data.result).orThrow("Count points returned empty")}async collectionClusterInfo(t){return o((await this._openApiClient.collections.collectionClusterInfo({collection_name:t})).data.result).orThrow("Collection cluster info returned empty")}async updateVectors(t,{wait:e=!0,ordering:n,points:r,shard_key:s}){return o((await this._openApiClient.points.updateVectors({collection_name:t,wait:e,ordering:n,points:r,shard_key:s})).data.result).orThrow("Update vectors returned empty")}async deleteVectors(t,{wait:e=!0,ordering:n,points:r,filter:s,vector:a,shard_key:i}){return o((await this._openApiClient.points.deleteVectors({collection_name:t,wait:e,ordering:n,points:r,filter:s,vector:a,shard_key:i})).data.result).orThrow("Delete vectors returned empty")}async searchPointGroups(t,{consistency:e,timeout:n,shard_key:r,vector:s,filter:a,params:i,with_payload:c=null,with_vector:l=null,score_threshold:h,group_by:p,group_size:d,limit:u}){return o((await this._openApiClient.points.searchPointGroups({collection_name:t,consistency:e,timeout:n,shard_key:r,vector:s,filter:a,params:i,with_payload:c,with_vector:l,score_threshold:h,group_by:p,group_size:d,limit:u})).data.result).orThrow("Search point groups returned empty")}async recommendPointGroups(t,{consistency:e,timeout:n,shard_key:r,positive:s,strategy:a,negative:i=[],filter:c,params:l,with_payload:h=null,with_vector:p=null,score_threshold:d,using:u=null,lookup_from:m=null,group_by:_,group_size:y,limit:w}){return o((await this._openApiClient.points.recommendPointGroups({collection_name:t,consistency:e,timeout:n,shard_key:r,positive:s,negative:i,strategy:a,filter:c,params:l,with_payload:h,with_vector:p,score_threshold:d,using:u,lookup_from:m,group_by:_,group_size:y,limit:w})).data.result).orThrow("Recommend point groups API returned empty")}async upsert(t,{wait:e=!0,ordering:n,...r}){return o((await this._openApiClient.points.upsertPoints({collection_name:t,wait:e,ordering:n,...r})).data.result).orThrow("Upsert returned empty")}async retrieve(t,{shard_key:e,ids:n,with_payload:r=!0,with_vector:s,consistency:a,timeout:i}){return o((await this._openApiClient.points.getPoints({collection_name:t,shard_key:e,ids:n,with_payload:r,with_vector:s,consistency:a,timeout:i})).data.result).orThrow("Retrieve API returned empty")}async delete(t,{wait:e,ordering:n,...r}){return o((await this._openApiClient.points.deletePoints({collection_name:t,wait:e,ordering:n,...r})).data.result).orThrow("Delete points returned empty")}async setPayload(t,{payload:e,points:n,filter:r,shard_key:s,key:a,ordering:i,wait:c=!0}){return o((await this._openApiClient.points.setPayload({collection_name:t,payload:e,points:n,filter:r,shard_key:s,key:a,wait:c,ordering:i})).data.result).orThrow("Set payload returned empty")}async overwritePayload(t,{ordering:e,payload:n,points:r,filter:s,shard_key:a,key:i,wait:c=!0}){return o((await this._openApiClient.points.overwritePayload({collection_name:t,payload:n,points:r,filter:s,shard_key:a,key:i,wait:c,ordering:e})).data.result).orThrow("Overwrite payload returned empty")}async deletePayload(t,{ordering:e,keys:n,points:r,filter:s,shard_key:a,wait:i=!0}){return o((await this._openApiClient.points.deletePayload({collection_name:t,keys:n,points:r,filter:s,shard_key:a,wait:i,ordering:e})).data.result).orThrow("Delete payload returned empty")}async clearPayload(t,{ordering:e,wait:n=!0,...r}){return o((await this._openApiClient.points.clearPayload({collection_name:t,wait:n,ordering:e,...r})).data.result).orThrow("Clear payload returned empty")}async updateCollectionAliases({actions:t,timeout:e}){return o((await this._openApiClient.collections.updateAliases({actions:t,timeout:e})).data.result).orThrow("Update aliases returned empty")}async getCollectionAliases(t){return o((await this._openApiClient.collections.getCollectionAliases({collection_name:t})).data.result).orThrow("Get collection aliases returned empty")}async getAliases(){return o((await this._openApiClient.collections.getCollectionsAliases({})).data.result).orThrow("Get aliases returned empty")}async getCollections(){return o((await this._openApiClient.collections.getCollections({})).data.result).orThrow("Get collections returned empty")}async getCollection(t){return o((await this._openApiClient.collections.getCollection({collection_name:t})).data.result).orThrow("Get collection returned empty")}async updateCollection(t,e){return o((await this._openApiClient.collections.updateCollection({collection_name:t,...e})).data.result).orThrow("Update collection returned empty")}async deleteCollection(t,e){return o((await this._openApiClient.collections.deleteCollection({collection_name:t,...e})).data.result).orThrow("Delete collection returned empty")}async createCollection(t,{timeout:e,vectors:n,hnsw_config:r,init_from:s,on_disk_payload:a,optimizers_config:i,quantization_config:c,replication_factor:l,shard_number:h,sharding_method:p,wal_config:d,write_consistency_factor:u,sparse_vectors:m}){return o((await this._openApiClient.collections.createCollection({collection_name:t,timeout:e,vectors:n,hnsw_config:r,init_from:s,on_disk_payload:a,optimizers_config:i,quantization_config:c,replication_factor:l,shard_number:h,sharding_method:p,wal_config:d,write_consistency_factor:u,sparse_vectors:m})).data.result).orThrow("Create collection returned empty")}async recreateCollection(t,{timeout:e,vectors:n,hnsw_config:r,init_from:s,on_disk_payload:a,optimizers_config:i,quantization_config:c,replication_factor:l,shard_number:h,sharding_method:p,wal_config:d,write_consistency_factor:u,sparse_vectors:m}){o(await this._openApiClient.collections.deleteCollection({collection_name:t,timeout:e})).get("ok").orThrow("Delete collection returned failed");return o(await this._openApiClient.collections.createCollection({collection_name:t,timeout:e,vectors:n,hnsw_config:r,init_from:s,on_disk_payload:a,optimizers_config:i,quantization_config:c,replication_factor:l,shard_number:h,sharding_method:p,wal_config:d,write_consistency_factor:u,sparse_vectors:m})).orThrow("Create collection returned empty")}async createPayloadIndex(t,{wait:e,ordering:n,field_name:r,field_schema:s}){return o((await this._openApiClient.collections.createFieldIndex({collection_name:t,field_name:r,field_schema:s,wait:e,ordering:n})).data.result).orThrow("Create field index returned empty")}async deletePayloadIndex(t,e,{wait:n=!0,ordering:r}={}){return o((await this._openApiClient.collections.deleteFieldIndex({collection_name:t,field_name:e,wait:n,ordering:r})).data.result).orThrow("Delete field index returned empty")}async listSnapshots(t){return o((await this._openApiClient.snapshots.listSnapshots({collection_name:t})).data.result).orThrow("List snapshots API returned empty")}async createSnapshot(t,e){return o((await this._openApiClient.snapshots.createSnapshot({collection_name:t,...e})).data.result).orNull()}async deleteSnapshot(t,e,n){return o((await this._openApiClient.snapshots.deleteSnapshot({collection_name:t,snapshot_name:e,...n})).data.result).orThrow("Delete snapshot API returned empty")}async listFullSnapshots(){return o((await this._openApiClient.snapshots.listFullSnapshots({})).data.result).orThrow("List full snapshots API returned empty")}async createFullSnapshot(t){return o((await this._openApiClient.snapshots.createFullSnapshot(t??{})).data.result).orThrow("Create full snapshot API returned empty")}async deleteFullSnapshot(t,e){return o((await this._openApiClient.snapshots.deleteFullSnapshot({snapshot_name:t,...e})).data.result).orThrow("Delete full snapshot API returned empty")}async recoverSnapshot(t,{location:e,priority:n,checksum:r,api_key:s}){return o((await this._openApiClient.snapshots.recoverFromSnapshot({collection_name:t,location:e,priority:n,checksum:r,api_key:s})).data.result).orThrow("Recover from snapshot API returned empty")}async lockStorage(t){return o((await this._openApiClient.service.postLocks({write:!0,error_message:t})).data.result).orThrow("Lock storage returned empty")}async unlockStorage(){return o((await this._openApiClient.service.postLocks({write:!1})).data.result).orThrow("Post locks returned empty")}async getLocks(){return o((await this._openApiClient.service.getLocks({})).data.result).orThrow("Get locks returned empty")}async batchUpdate(t,{wait:e=!0,ordering:n,...r}){return o((await this._openApiClient.points.batchUpdate({collection_name:t,wait:e,ordering:n,...r})).data.result).orThrow("Batch update returned empty")}async recoverShardFromSnapshot(t,e,{wait:n=!0,...r}){return o((await this._openApiClient.snapshots.recoverShardFromSnapshot({collection_name:t,shard_id:e,wait:n,...r})).data.result).orThrow("Recover shard from snapshot returned empty")}async listShardSnapshots(t,e){return o((await this._openApiClient.snapshots.listShardSnapshots({collection_name:t,shard_id:e})).data.result).orThrow("List shard snapshots returned empty")}async createShardSnapshot(t,e,{wait:n=!0}){return o((await this._openApiClient.snapshots.createShardSnapshot({collection_name:t,shard_id:e,wait:n})).data.result).orThrow("Create shard snapshot returned empty")}async deleteShardSnapshot(t,e,n,{wait:r=!0}){return o((await this._openApiClient.snapshots.deleteShardSnapshot({collection_name:t,shard_id:e,snapshot_name:n,wait:r})).data.result).orThrow("Create shard snapshot returned empty")}async createShardKey(t,{shard_key:e,shards_number:n,replication_factor:r,placement:s,timeout:a}){return o((await this._openApiClient.shards.createShardKey({collection_name:t,shard_key:e,shards_number:n,replication_factor:r,placement:s,timeout:a})).data.result).orThrow("Create shard key returned empty")}async deleteShardKey(t,{shard_key:e,timeout:n}){return o((await this._openApiClient.shards.deleteShardKey({collection_name:t,shard_key:e,timeout:n})).data.result).orThrow("Create shard key returned empty")}async discoverPoints(t,{consistency:e,timeout:n,shard_key:r,target:s,context:a,params:i,limit:c,offset:l,with_payload:h,with_vector:p,using:d,lookup_from:u}){return o((await this._openApiClient.points.discoverPoints({collection_name:t,consistency:e,timeout:n,shard_key:r,target:s,context:a,params:i,limit:c,offset:l,with_payload:h,with_vector:p,using:d,lookup_from:u})).data.result).orThrow("Discover points returned empty")}async discoverBatchPoints(t,{consistency:e,timeout:n,searches:r}){return o((await this._openApiClient.points.discoverBatchPoints({collection_name:t,consistency:e,timeout:n,searches:r})).data.result).orThrow("Discover batch points returned empty")}async versionInfo(){return o((await this._openApiClient.service.root({})).data).orThrow("Version Info returned empty")}async collectionExists(t){return o((await this._openApiClient.collections.collectionExists({collection_name:t})).data.result).orThrow("Collection exists returned empty")}async query(t,{consistency:e,timeout:n,shard_key:r,prefetch:s,query:a,using:i,filter:c,params:l,score_threshold:h,limit:p,offset:d,with_vector:u,with_payload:m,lookup_from:_}){return o((await this._openApiClient.points.queryPoints({collection_name:t,consistency:e,timeout:n,shard_key:r,prefetch:s,query:a,using:i,filter:c,params:l,score_threshold:h,limit:p,offset:d,with_vector:u,with_payload:m,lookup_from:_})).data.result).orThrow("Query points returned empty")}async queryBatch(t,{consistency:e,timeout:n,searches:r}){return o((await this._openApiClient.points.queryBatchPoints({collection_name:t,consistency:e,timeout:n,searches:r})).data.result).orThrow("Query points returned empty")}async queryGroups(t,{consistency:e,timeout:n,shard_key:r,prefetch:s,query:a,using:i,filter:c,params:l,score_threshold:h,with_vector:p,with_payload:d,group_by:u,group_size:m,limit:_,with_lookup:y}){return o((await this._openApiClient.points.queryPointsGroups({collection_name:t,consistency:e,timeout:n,shard_key:r,prefetch:s,query:a,using:i,filter:c,params:l,score_threshold:h,with_vector:p,with_payload:d,group_by:u,group_size:m,limit:_,with_lookup:y})).data.result).orThrow("Query groups returned empty")}},exports.QdrantClientConfigError=v,exports.QdrantClientTimeoutError=A,exports.QdrantClientUnexpectedResponseError=C;