endee 1.0.0-beta.1 → 1.0.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,17 +3,18 @@
3
3
  */
4
4
  import axios from 'axios';
5
5
  import { raiseException } from './exceptions.js';
6
- import { Index } from './indexClient.js';
7
- import { isValidIndexName, } from './utils.js';
6
+ import { Index } from './index.class.js';
7
+ import { isValidIndexName } from './utils.js';
8
+ import { Precision } from './types/index.js';
8
9
  export class Endee {
9
10
  token;
10
11
  baseUrl;
11
12
  version;
12
13
  constructor(token = null) {
13
14
  this.token = token;
14
- this.baseUrl = "http://127.0.0.1:8080/api/v1";
15
+ this.baseUrl = 'http://127.0.0.1:8080/api/v1';
15
16
  if (token) {
16
- const tokenParts = token.split(":");
17
+ const tokenParts = token.split(':');
17
18
  if (tokenParts.length > 2) {
18
19
  this.baseUrl = `https://${tokenParts[2]}.endee.io/api/v1`;
19
20
  this.token = `${tokenParts[0]}:${tokenParts[1]}`;
@@ -21,21 +22,28 @@ export class Endee {
21
22
  }
22
23
  this.version = 1;
23
24
  }
25
+ setBaseUrl(url) {
26
+ this.baseUrl = url;
27
+ return url;
28
+ }
24
29
  async createIndex(options) {
25
- const { name, dimension, spaceType = 'cosine', M = 16, efCon = 128, useFp16 = true, version, } = options;
30
+ const { name, dimension, spaceType = 'cosine', M = 16, efCon = 128, precision = Precision.INT8D, version = null, sparseDimension = null, } = options;
26
31
  if (!isValidIndexName(name)) {
27
- throw new Error("Invalid index name. Index name must be alphanumeric and can contain underscores and less than 48 characters");
32
+ throw new Error('Invalid index name. Index name must be alphanumeric and can contain underscores and less than 48 characters');
28
33
  }
29
34
  if (dimension > 10000) {
30
- throw new Error("Dimension cannot be greater than 10000");
35
+ throw new Error('Dimension cannot be greater than 10000');
36
+ }
37
+ if (sparseDimension && sparseDimension < 0) {
38
+ throw new Error('Sparse dimension cannot be less than 0');
31
39
  }
32
40
  const normalizedSpaceType = spaceType.toLowerCase();
33
- if (!["cosine", "l2", "ip"].includes(normalizedSpaceType)) {
41
+ if (!['cosine', 'l2', 'ip'].includes(normalizedSpaceType)) {
34
42
  throw new Error(`Invalid space type: ${spaceType}`);
35
43
  }
36
44
  const headers = {
37
45
  Authorization: `${this.token}`,
38
- "Content-Type": "application/json",
46
+ 'Content-Type': 'application/json',
39
47
  };
40
48
  const data = {
41
49
  index_name: name,
@@ -43,8 +51,13 @@ export class Endee {
43
51
  space_type: normalizedSpaceType,
44
52
  M: M,
45
53
  ef_con: efCon,
46
- use_fp16: useFp16,
54
+ checksum: -1,
55
+ precision: precision,
56
+ version: version,
47
57
  };
58
+ if (sparseDimension) {
59
+ data.sparse_dim = sparseDimension;
60
+ }
48
61
  if (version !== undefined) {
49
62
  data.version = version;
50
63
  }
@@ -65,7 +78,7 @@ export class Endee {
65
78
  console.error(response.data);
66
79
  raiseException(response.status, response.data);
67
80
  }
68
- return "Index created successfully";
81
+ return 'Index created successfully';
69
82
  }
70
83
  async listIndexes() {
71
84
  const headers = {
@@ -109,7 +122,7 @@ export class Endee {
109
122
  async getIndex(name) {
110
123
  const headers = {
111
124
  Authorization: `${this.token}`,
112
- "Content-Type": "application/json",
125
+ 'Content-Type': 'application/json',
113
126
  };
114
127
  let response;
115
128
  try {
@@ -124,8 +137,19 @@ export class Endee {
124
137
  throw err;
125
138
  }
126
139
  const data = response.data;
127
- const idx = new Index(name, this.token, this.baseUrl, this.version, data);
140
+ const indexInfo = {
141
+ name: data.index_name,
142
+ spaceType: data.space_type,
143
+ dimension: data.dimension,
144
+ total_elements: data.total_elements,
145
+ precision: data.precision,
146
+ M: data.M,
147
+ checksum: data.checksum,
148
+ version: data.version,
149
+ sparseDimension: data.sparse_dim,
150
+ };
151
+ const idx = new Index(name, this.token, this.baseUrl, this.version, indexInfo);
128
152
  return idx;
129
153
  }
130
154
  }
131
- //# sourceMappingURL=endee.js.map
155
+ //# sourceMappingURL=endee.class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,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AC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;gBAC5C,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACzD,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;QACD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QAE3B,MAAM,SAAS,GAAc;YAC3B,IAAI,EAAE,IAAI,CAAC,UAAU;YACrB,SAAS,EAAE,IAAI,CAAC,UAAU;YAC1B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,CAAC,EAAE,IAAI,CAAC,CAAC;YACT,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,eAAe,EAAE,IAAI,CAAC,UAAU;SACjC,CAAC;QAEF,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,KAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAChF,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
@@ -2,58 +2,58 @@
2
2
  * Exception classes for Endee-DB
3
3
  */
4
4
  export class EndeeException extends Error {
5
- constructor(message = "An error occurred in Endee-DB") {
5
+ constructor(message = 'An error occurred in Endee-DB') {
6
6
  super(message);
7
- this.name = "EndeeException";
7
+ this.name = 'EndeeException';
8
8
  Object.setPrototypeOf(this, EndeeException.prototype);
9
9
  }
10
10
  }
11
11
  export class APIException extends EndeeException {
12
12
  constructor(message) {
13
13
  super(`API Error: ${message}`);
14
- this.name = "APIException";
14
+ this.name = 'APIException';
15
15
  Object.setPrototypeOf(this, APIException.prototype);
16
16
  }
17
17
  }
18
18
  export class ServerException extends EndeeException {
19
19
  constructor(message) {
20
20
  super(`Server Busy: ${message}`);
21
- this.name = "ServerException";
21
+ this.name = 'ServerException';
22
22
  Object.setPrototypeOf(this, ServerException.prototype);
23
23
  }
24
24
  }
25
25
  export class ForbiddenException extends EndeeException {
26
26
  constructor(message) {
27
27
  super(`Forbidden: ${message}`);
28
- this.name = "ForbiddenException";
28
+ this.name = 'ForbiddenException';
29
29
  Object.setPrototypeOf(this, ForbiddenException.prototype);
30
30
  }
31
31
  }
32
32
  export class ConflictException extends EndeeException {
33
33
  constructor(message) {
34
34
  super(`Conflict: ${message}`);
35
- this.name = "ConflictException";
35
+ this.name = 'ConflictException';
36
36
  Object.setPrototypeOf(this, ConflictException.prototype);
37
37
  }
38
38
  }
39
39
  export class NotFoundException extends EndeeException {
40
40
  constructor(message) {
41
41
  super(`Resource Not Found: ${message}`);
42
- this.name = "NotFoundException";
42
+ this.name = 'NotFoundException';
43
43
  Object.setPrototypeOf(this, NotFoundException.prototype);
44
44
  }
45
45
  }
46
46
  export class AuthenticationException extends EndeeException {
47
47
  constructor(message) {
48
48
  super(`Authentication Error: ${message}`);
49
- this.name = "AuthenticationException";
49
+ this.name = 'AuthenticationException';
50
50
  Object.setPrototypeOf(this, AuthenticationException.prototype);
51
51
  }
52
52
  }
53
53
  export class SubscriptionException extends EndeeException {
54
54
  constructor(message) {
55
55
  super(`Subscription Error: ${message}`);
56
- this.name = "SubscriptionException";
56
+ this.name = 'SubscriptionException';
57
57
  Object.setPrototypeOf(this, SubscriptionException.prototype);
58
58
  }
59
59
  }
@@ -62,17 +62,17 @@ export function raiseException(code, text) {
62
62
  try {
63
63
  if (typeof text === 'string') {
64
64
  const parsed = JSON.parse(text);
65
- message = parsed.error || "Unknown error";
65
+ message = parsed.error || 'Unknown error';
66
66
  }
67
67
  else if (text && typeof text === 'object' && 'error' in text) {
68
- message = String(text.error) || "Unknown error";
68
+ message = String(text.error) || 'Unknown error';
69
69
  }
70
70
  else {
71
- message = String(text) || "Unknown error";
71
+ message = String(text) || 'Unknown error';
72
72
  }
73
73
  }
74
74
  catch {
75
- message = String(text) || "Unknown error";
75
+ message = String(text) || 'Unknown error';
76
76
  }
77
77
  if (code === 400) {
78
78
  throw new APIException(message);
@@ -93,10 +93,10 @@ export function raiseException(code, text) {
93
93
  throw new ConflictException(message);
94
94
  }
95
95
  else if (code >= 500) {
96
- throw new ServerException("Server is busy. Please try again in sometime");
96
+ throw new ServerException('Server is busy. Please try again in sometime');
97
97
  }
98
98
  else {
99
- throw new APIException("Unknown Error. Please try again in sometime");
99
+ throw new APIException('Unknown Error. Please try again in sometime');
100
100
  }
101
101
  }
102
102
  //# sourceMappingURL=exceptions.js.map
@@ -1,30 +1,26 @@
1
1
  /**
2
2
  * Index client for Endee-DB
3
3
  */
4
- import type { VectorItem, QueryOptions, QueryResult, IndexInfo, IndexDescription } from './types/index.js';
4
+ import { VectorItem, QueryOptions, QueryResult, IndexInfo, IndexDescription, VectorInfo } from './types/index.js';
5
5
  export declare class Index {
6
6
  private name;
7
7
  private token;
8
8
  private url;
9
9
  private count;
10
- private space_type;
10
+ private spaceType;
11
11
  private dimension;
12
12
  private precision;
13
13
  private M;
14
+ private sparseDimension;
14
15
  constructor(name: string, token: string, url: string, _version?: number, params?: Partial<IndexInfo>);
15
16
  toString(): string;
17
+ private isHybrid;
16
18
  private _normalizeVector;
17
19
  upsert(inputArray: VectorItem[]): Promise<string>;
18
20
  query(options: QueryOptions): Promise<QueryResult[]>;
19
21
  deleteVector(id: string): Promise<string>;
20
- deleteWithFilter(filter: Record<string, unknown>): Promise<unknown>;
21
- getVector(id: string): Promise<{
22
- id: string;
23
- meta: Record<string, unknown>;
24
- filter: string;
25
- norm: number;
26
- vector: number[];
27
- }>;
22
+ deleteWithFilter(filter: Array<Record<string, unknown>>): Promise<unknown>;
23
+ getVector(id: string): Promise<VectorInfo>;
28
24
  describe(): IndexDescription;
29
25
  }
30
- //# sourceMappingURL=indexClient.d.ts.map
26
+ //# sourceMappingURL=index.class.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.class.d.ts","sourceRoot":"","sources":["../src/index.class.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EACL,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,gBAAgB,EAGhB,UAAU,EACX,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,KAAK;IAChB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,CAAC,CAAS;IAClB,OAAO,CAAC,eAAe,CAAS;gBAG9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,QAAQ,SAAI,EACZ,MAAM,GAAE,OAAO,CAAC,SAAS,CAAM;IAajC,QAAQ,IAAI,MAAM;IAIlB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,gBAAgB;IAelB,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IA6EjD,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAuHpD,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBzC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAqB1E,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAwChD,QAAQ,IAAI,gBAAgB;CAY7B"}
@@ -5,66 +5,95 @@ import axios from 'axios';
5
5
  import { encode, decode } from '@msgpack/msgpack';
6
6
  import { jsonZip, jsonUnzip } from './crypto.js';
7
7
  import { raiseException } from './exceptions.js';
8
- import pako from 'pako';
8
+ import { Precision, } from './types/index.js';
9
9
  export class Index {
10
10
  name;
11
11
  token;
12
12
  url;
13
13
  count;
14
- space_type;
14
+ spaceType;
15
15
  dimension;
16
16
  precision;
17
17
  M;
18
+ sparseDimension;
18
19
  constructor(name, token, url, _version = 1, params = {}) {
19
20
  this.name = name;
20
21
  this.token = token;
21
22
  this.url = url;
22
23
  this.count = params.total_elements || 0;
23
- this.space_type = params.space_type || 'cosine';
24
+ this.spaceType = params.spaceType || 'cosine';
24
25
  this.dimension = params.dimension || 0;
25
- this.precision = params.use_fp16 ? 'float16' : 'float32';
26
+ this.precision = params.precision || Precision.INT8D;
26
27
  this.M = params.M || 16;
28
+ this.sparseDimension = params.sparseDimension || 0;
27
29
  }
28
30
  toString() {
29
31
  return this.name;
30
32
  }
33
+ isHybrid() {
34
+ return this.sparseDimension > 0;
35
+ }
31
36
  _normalizeVector(vector) {
32
37
  if (vector.length !== this.dimension) {
33
38
  throw new Error(`Vector dimension mismatch: expected ${this.dimension}, got ${vector.length}`);
34
39
  }
35
- if (this.space_type !== "cosine") {
40
+ if (this.spaceType !== 'cosine') {
36
41
  return [vector, 1.0];
37
42
  }
38
43
  const norm = Math.sqrt(vector.reduce((sum, v) => sum + v * v, 0));
39
44
  if (norm === 0)
40
45
  return [vector, 1.0];
41
- const normalized = vector.map(v => v / norm);
46
+ const normalized = vector.map((v) => v / norm);
42
47
  return [normalized, norm];
43
48
  }
44
49
  async upsert(inputArray) {
45
50
  if (inputArray.length > 1000) {
46
- throw new Error("Cannot insert more than 1000 vectors at a time");
51
+ throw new Error('Cannot insert more than 1000 vectors at a time');
47
52
  }
48
53
  const vectorBatch = [];
49
54
  for (const item of inputArray) {
50
55
  const [vector, norm] = this._normalizeVector(item.vector);
51
56
  const metaData = jsonZip(item.meta || {});
57
+ const sparseIndices = item.sparseIndices || [];
58
+ const sparseValues = item.sparseValues || [];
59
+ if (!this.isHybrid() && (sparseIndices.length > 0 || sparseValues.length > 0)) {
60
+ throw new Error('Cannot insert sparse data into a dense-only index. Create index with sparseDimension > 0 for hybrid support.');
61
+ }
62
+ if (this.isHybrid()) {
63
+ if (sparseIndices.length == 0 || sparseValues.length == 0) {
64
+ throw new Error('Both sparse_indices and sparse_values must be provided for hybrid vectors.');
65
+ }
66
+ if (sparseIndices.length !== sparseValues.length) {
67
+ throw new Error(`sparseIndices and sparseValues must have the same length. Got ${sparseIndices.length} length indices and ${sparseValues.length} length values.`);
68
+ }
69
+ for (const idx of sparseIndices) {
70
+ if (idx < 0 || idx >= this.sparseDimension) {
71
+ throw new Error(`Sparse index ${idx} is out of bounds. Must be in range [0,${this.sparseDimension}).`);
72
+ }
73
+ }
74
+ }
52
75
  const vectorObj = [
53
76
  String(item.id || ''),
54
77
  metaData,
55
78
  JSON.stringify(item.filter || {}),
56
79
  norm,
57
- vector
80
+ vector,
58
81
  ];
82
+ if (this.isHybrid()) {
83
+ vectorObj.push(sparseIndices, sparseValues);
84
+ }
59
85
  vectorBatch.push(vectorObj);
60
86
  }
61
87
  const serializedData = encode(vectorBatch);
62
88
  const headers = {
63
- 'Authorization': this.token,
64
- 'Content-Type': 'application/msgpack'
89
+ Authorization: this.token,
90
+ 'Content-Type': 'application/msgpack',
65
91
  };
66
92
  try {
67
- await axios.post(`${this.url}/index/${this.name}/vector/insert`, serializedData, { headers, responseType: 'arraybuffer' });
93
+ await axios.post(`${this.url}/index/${this.name}/vector/insert`, serializedData, {
94
+ headers,
95
+ responseType: 'arraybuffer',
96
+ });
68
97
  }
69
98
  catch (err) {
70
99
  if (axios.isAxiosError(err) && err.response) {
@@ -72,33 +101,55 @@ export class Index {
72
101
  }
73
102
  throw err;
74
103
  }
75
- return "Vectors inserted successfully";
104
+ return 'Vectors inserted successfully';
76
105
  }
77
106
  async query(options) {
78
- const { vector, topK = 10, filter = null, ef = 128, includeVectors = false, } = options;
79
- if (!vector)
80
- throw new Error("vector is required");
81
- if (topK > 200)
82
- throw new Error("top_k cannot be greater than 200");
107
+ const { vector = null, topK = 10, filter = null, ef = 128, includeVectors = false, sparseIndices = null, sparseValues = null, } = options;
108
+ if (topK > 512 || topK < 0)
109
+ throw new Error('top_k cannot be greater than 512 and less than 0');
83
110
  if (ef > 1024)
84
- throw new Error("ef search cannot be greater than 1024");
85
- const [queryVector] = this._normalizeVector(vector);
111
+ throw new Error('ef search cannot be greater than 1024');
112
+ const hasSparse = sparseIndices && sparseIndices.length > 0 && sparseValues && sparseIndices.length > 0;
113
+ let hasDense = false;
114
+ if (vector)
115
+ hasDense = true;
116
+ if (!hasDense && !hasSparse) {
117
+ throw new Error("At least one of 'vector' or 'sparseIndices'/'sparseValues' must be provided.");
118
+ }
119
+ if (hasSparse && !this.isHybrid()) {
120
+ throw new Error('Cannot perform sparse search on a dense-only index. Create index with sparseDimension > 0 for hybrid support.');
121
+ }
122
+ if (hasSparse) {
123
+ if (sparseIndices.length != sparseValues.length) {
124
+ throw new Error(`sparseIndices and sparseValues must have the same length. Got ${sparseIndices.length} length indices and ${sparseValues.length} length values.`);
125
+ }
126
+ }
86
127
  const headers = {
87
- 'Authorization': this.token,
88
- 'Content-Type': 'application/json'
128
+ Authorization: this.token,
129
+ 'Content-Type': 'application/json',
89
130
  };
90
131
  const data = {
91
- vector: queryVector,
92
132
  k: topK,
93
133
  ef: ef,
94
- include_vectors: includeVectors
134
+ include_vectors: includeVectors,
95
135
  };
136
+ if (vector) {
137
+ const [queryVector] = this._normalizeVector(vector);
138
+ data.vector = queryVector;
139
+ }
140
+ if (hasSparse) {
141
+ data.sparse_indices = sparseIndices;
142
+ data.sparse_values = sparseValues;
143
+ }
96
144
  if (filter) {
97
145
  data.filter = JSON.stringify(filter);
98
146
  }
99
147
  let response;
100
148
  try {
101
- response = await axios.post(`${this.url}/index/${this.name}/search`, data, { headers, responseType: 'arraybuffer' });
149
+ response = await axios.post(`${this.url}/index/${this.name}/search`, data, {
150
+ headers,
151
+ responseType: 'arraybuffer',
152
+ });
102
153
  }
103
154
  catch (err) {
104
155
  if (axios.isAxiosError(err) && err.response) {
@@ -108,7 +159,7 @@ export class Index {
108
159
  }
109
160
  const decoded = decode(new Uint8Array(response.data));
110
161
  const results = Array.isArray(decoded) ? decoded : [];
111
- let processedResults = [];
162
+ const processedResults = [];
112
163
  for (const result of results) {
113
164
  const similarity = result[0];
114
165
  const vectorId = result[1];
@@ -117,19 +168,13 @@ export class Index {
117
168
  const normValue = result[4];
118
169
  const vectorData = result.length > 5 ? result[5] : undefined;
119
170
  let meta = {};
120
- try {
121
- const inflated = pako.inflate(jsonUnzip(metaData));
122
- meta = JSON.parse(new TextDecoder().decode(inflated));
123
- }
124
- catch {
125
- meta = jsonUnzip(metaData);
126
- }
171
+ meta = jsonUnzip(metaData);
127
172
  const processedResult = {
128
173
  id: vectorId,
129
174
  similarity: similarity,
130
175
  distance: 1 - similarity,
131
176
  meta: meta,
132
- norm: normValue
177
+ norm: normValue,
133
178
  };
134
179
  if (filterStr) {
135
180
  processedResult.filter = JSON.parse(filterStr);
@@ -148,11 +193,13 @@ export class Index {
148
193
  }
149
194
  async deleteVector(id) {
150
195
  const headers = {
151
- 'Authorization': this.token,
196
+ Authorization: this.token,
152
197
  };
153
198
  let response;
154
199
  try {
155
- response = await axios.delete(`${this.url}/index/${this.name}/vector/${id}/delete`, { headers });
200
+ response = await axios.delete(`${this.url}/index/${this.name}/vector/${id}/delete`, {
201
+ headers,
202
+ });
156
203
  }
157
204
  catch (err) {
158
205
  if (axios.isAxiosError(err) && err.response) {
@@ -160,18 +207,21 @@ export class Index {
160
207
  }
161
208
  throw err;
162
209
  }
163
- return response.data + " rows deleted";
210
+ return response.data + ' rows deleted';
164
211
  }
165
212
  // Need to test this function first.
166
213
  async deleteWithFilter(filter) {
167
214
  const headers = {
168
- 'Authorization': this.token,
169
- 'Content-Type': 'application/json'
215
+ Authorization: this.token,
216
+ 'Content-Type': 'application/json',
170
217
  };
171
218
  const data = { filter };
172
219
  let response;
173
220
  try {
174
- response = await axios.delete(`${this.url}/index/${this.name}/vectors/delete`, { headers, data });
221
+ response = await axios.delete(`${this.url}/index/${this.name}/vectors/delete`, {
222
+ headers,
223
+ data,
224
+ });
175
225
  }
176
226
  catch (err) {
177
227
  if (axios.isAxiosError(err) && err.response) {
@@ -183,8 +233,8 @@ export class Index {
183
233
  }
184
234
  async getVector(id) {
185
235
  const headers = {
186
- 'Authorization': this.token,
187
- 'Content-Type': 'application/json'
236
+ Authorization: this.token,
237
+ 'Content-Type': 'application/json',
188
238
  };
189
239
  let response;
190
240
  try {
@@ -199,23 +249,26 @@ export class Index {
199
249
  const vectorObj = decode(new Uint8Array(response.data));
200
250
  const meta = jsonUnzip(vectorObj[1]);
201
251
  const vector = Array.from(vectorObj[4]);
252
+ const parsedFilter = JSON.parse(vectorObj[2]);
202
253
  return {
203
254
  id: vectorObj[0],
204
255
  meta: meta,
205
- filter: vectorObj[2],
256
+ filter: parsedFilter,
206
257
  norm: vectorObj[3],
207
- vector: vector
258
+ vector: vector,
208
259
  };
209
260
  }
210
261
  describe() {
211
262
  return {
212
263
  name: this.name,
213
- space_type: this.space_type,
264
+ spaceType: this.spaceType,
214
265
  dimension: this.dimension,
266
+ sparseDimension: this.sparseDimension,
267
+ isHybrid: this.isHybrid(),
215
268
  count: this.count,
216
269
  precision: this.precision,
217
270
  M: this.M,
218
271
  };
219
272
  }
220
273
  }
221
- //# sourceMappingURL=indexClient.js.map
274
+ //# sourceMappingURL=index.class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.class.js","sourceRoot":"","sources":["../src/index.class.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC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M,SAAS,GAAG,MAAM,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAMrD,CAAC;QAEF,MAAM,IAAI,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACrC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAE9C,OAAO;YACL,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;YAChB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,YAAY;YACpB,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;YAClB,MAAM,EAAE,MAAM;SACf,CAAC;IACJ,CAAC;IAED,QAAQ;QACN,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE;YACzB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,CAAC,EAAE,IAAI,CAAC,CAAC;SACV,CAAC;IACJ,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Main export file for Endee-DB
3
3
  */
4
- export { Endee } from './endee.js';
5
- export { Index } from './indexClient.js';
4
+ export { Endee } from './endee.class.js';
5
+ export { Index } from './index.class.js';
6
6
  export * from './exceptions.js';
7
7
  export * from './types/index.js';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Main export file for Endee-DB
3
3
  */
4
- export { Endee } from './endee.js';
5
- export { Index } from './indexClient.js';
4
+ export { Endee } from './endee.class.js';
5
+ export { Index } from './index.class.js';
6
6
  export * from './exceptions.js';
7
7
  export * from './types/index.js';
8
8
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}