endee 1.0.0-beta.1
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.
- package/README.md +163 -0
- package/dist/crypto.d.ts +6 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +35 -0
- package/dist/crypto.js.map +1 -0
- package/dist/endee.d.ts +16 -0
- package/dist/endee.d.ts.map +1 -0
- package/dist/endee.js +131 -0
- package/dist/endee.js.map +1 -0
- package/dist/exceptions.d.ts +29 -0
- package/dist/exceptions.d.ts.map +1 -0
- package/dist/exceptions.js +102 -0
- package/dist/exceptions.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/indexClient.d.ts +30 -0
- package/dist/indexClient.d.ts.map +1 -0
- package/dist/indexClient.js +221 -0
- package/dist/indexClient.js.map +1 -0
- package/dist/types/index.d.ts +55 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/userClient.d.ts +21 -0
- package/dist/userClient.d.ts.map +1 -0
- package/dist/userClient.js +104 -0
- package/dist/userClient.js.map +1 -0
- package/dist/utils.d.ts +27 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +198 -0
- package/dist/utils.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Endee - TypeScript Vector Database Client
|
|
2
|
+
|
|
3
|
+
Endee is a TypeScript client for a vector database designed for maximum speed and efficiency. This package provides full type safety, modern ES module support, and optimized code for rapid Approximate Nearest Neighbor (ANN) searches on vector data.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- **TypeScript First**: Full type safety and IntelliSense support
|
|
8
|
+
- **Fast ANN Searches**: Efficient similarity searches on vector data
|
|
9
|
+
- **Multiple Distance Metrics**: Support for cosine, L2, and inner product distance metrics
|
|
10
|
+
- **Metadata Support**: Attach and search with metadata and filters
|
|
11
|
+
- **High Performance**: Optimized for speed and efficiency
|
|
12
|
+
- **Modern ES Modules**: Native ES module support with proper tree-shaking
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install endee
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { Endee } from "endee";
|
|
24
|
+
|
|
25
|
+
// Initialize client with your API token
|
|
26
|
+
const endee = new Endee("user_id:api_token:region");
|
|
27
|
+
|
|
28
|
+
// Create a new index
|
|
29
|
+
await endee.createIndex({
|
|
30
|
+
name: "my_vectors",
|
|
31
|
+
dimension: 1536, // Your vector dimension
|
|
32
|
+
spaceType: "cosine" // Distance metric (cosine, l2, ip)
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Get index reference
|
|
36
|
+
const index = await endee.getIndex("my_vectors");
|
|
37
|
+
|
|
38
|
+
// Insert vectors
|
|
39
|
+
await index.upsert([
|
|
40
|
+
{
|
|
41
|
+
id: "doc1",
|
|
42
|
+
vector: [0.1, 0.2, 0.3 /* ... */], // Your vector data
|
|
43
|
+
meta: { text: "Example document", category: "reference" },
|
|
44
|
+
},
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
// Query similar vectors
|
|
48
|
+
const results = await index.query({
|
|
49
|
+
vector: [0.2, 0.3, 0.4 /* ... */], // Query vector
|
|
50
|
+
topK: 10,
|
|
51
|
+
filter: { category: { eq: "reference" } }, // Optional filter
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// Process results
|
|
55
|
+
for (const item of results) {
|
|
56
|
+
console.log(`ID: ${item.id}, Similarity: ${item.similarity}`);
|
|
57
|
+
console.log(`Metadata:`, item.meta);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Basic Usage
|
|
62
|
+
|
|
63
|
+
### Initializing the Client
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
import { Endee } from "endee";
|
|
67
|
+
|
|
68
|
+
// Production with specific region
|
|
69
|
+
const endee = new Endee("user_id:api_token:region");
|
|
70
|
+
|
|
71
|
+
// Local development (defaults to http://127.0.0.1:8080/api/v1)
|
|
72
|
+
const endee = new Endee();
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Managing Indexes
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// List all indexes
|
|
79
|
+
const indexes = await endee.listIndexes();
|
|
80
|
+
|
|
81
|
+
// Create an index with custom parameters
|
|
82
|
+
await endee.createIndex({
|
|
83
|
+
name: "my_custom_index",
|
|
84
|
+
dimension: 384,
|
|
85
|
+
spaceType: "l2", // space type
|
|
86
|
+
M: 32, // M: Graph connectivity parameter
|
|
87
|
+
efCon: 200, // efCon: Construction-time parameter
|
|
88
|
+
useFp16: true // useFp16: Use half-precision for storage optimization
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// Delete an index
|
|
92
|
+
await endee.deleteIndex("my_index");
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Working with Vectors
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
// Get index reference
|
|
99
|
+
const index = await endee.getIndex("my_index");
|
|
100
|
+
|
|
101
|
+
// Insert multiple vectors in a batch
|
|
102
|
+
await index.upsert([
|
|
103
|
+
{
|
|
104
|
+
id: "vec1",
|
|
105
|
+
vector: [/* ... */], // Your vector
|
|
106
|
+
meta: { title: "First document" },
|
|
107
|
+
filter: { tags: "important" },
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "vec2",
|
|
111
|
+
vector: [/* ... */], // Another vector
|
|
112
|
+
filter: { visibility: "public" }, // Optional filter values
|
|
113
|
+
},
|
|
114
|
+
]);
|
|
115
|
+
|
|
116
|
+
// Query with custom parameters
|
|
117
|
+
const results = await index.query({
|
|
118
|
+
vector: [/* ... */], // Query vector
|
|
119
|
+
topK: 5, // Number of results to return
|
|
120
|
+
filter: { tags: "important" }, // Filter for matching
|
|
121
|
+
ef: 128, // Runtime parameter for search quality
|
|
122
|
+
includeVectors: true, // Include vector data in results
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Delete vectors
|
|
126
|
+
await index.deleteVector("vec1");
|
|
127
|
+
await index.deleteWithFilter({ visibility: "public" });
|
|
128
|
+
|
|
129
|
+
// Get a specific vector
|
|
130
|
+
const vector = await index.getVector("vec1");
|
|
131
|
+
|
|
132
|
+
// Get index description
|
|
133
|
+
const description = await index.describe();
|
|
134
|
+
console.log(description);
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## TypeScript Types
|
|
138
|
+
|
|
139
|
+
The package includes comprehensive TypeScript types:
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
import type {
|
|
143
|
+
VectorItem,
|
|
144
|
+
QueryOptions,
|
|
145
|
+
QueryResult,
|
|
146
|
+
CreateIndexOptions,
|
|
147
|
+
IndexDescription,
|
|
148
|
+
SpaceType
|
|
149
|
+
} from "endee";
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Requirements
|
|
153
|
+
|
|
154
|
+
- Node.js >= 18.0.0
|
|
155
|
+
- TypeScript >= 5.0.0 (for development)
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
MIT
|
|
160
|
+
|
|
161
|
+
## Author
|
|
162
|
+
|
|
163
|
+
Pankaj Singh
|
package/dist/crypto.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cryptographic utilities for Endee-DB
|
|
3
|
+
*/
|
|
4
|
+
export declare function jsonZip(obj: Record<string, unknown> | null | undefined): Buffer;
|
|
5
|
+
export declare function jsonUnzip(compressed: Buffer | Uint8Array | string | Record<string, unknown> | null | undefined): Record<string, unknown>;
|
|
6
|
+
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAI/E;AAED,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAuBxI"}
|
package/dist/crypto.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cryptographic utilities for Endee-DB
|
|
3
|
+
*/
|
|
4
|
+
import * as zlib from 'zlib';
|
|
5
|
+
export function jsonZip(obj) {
|
|
6
|
+
if (!obj || Object.keys(obj).length === 0)
|
|
7
|
+
return Buffer.alloc(0);
|
|
8
|
+
const jsonStr = JSON.stringify(obj);
|
|
9
|
+
return zlib.deflateSync(Buffer.from(jsonStr, 'utf-8'));
|
|
10
|
+
}
|
|
11
|
+
export function jsonUnzip(compressed) {
|
|
12
|
+
if (!compressed || (compressed instanceof Buffer && compressed.length === 0))
|
|
13
|
+
return {};
|
|
14
|
+
if (typeof compressed === "object" && !Buffer.isBuffer(compressed) && !(compressed instanceof Uint8Array)) {
|
|
15
|
+
return compressed;
|
|
16
|
+
}
|
|
17
|
+
if (typeof compressed === "string") {
|
|
18
|
+
try {
|
|
19
|
+
return JSON.parse(compressed);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// Not JSON, fall through to zlib
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const buffer = Buffer.isBuffer(compressed) ? compressed : Buffer.from(compressed);
|
|
27
|
+
const decompressed = zlib.inflateSync(buffer);
|
|
28
|
+
return JSON.parse(decompressed.toString('utf-8'));
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
const error = err;
|
|
32
|
+
throw new Error(`Failed to decompress data: ${error.message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=crypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,MAAM,UAAU,OAAO,CAAC,GAA+C;IACrE,IAAI,CAAC,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAClE,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACpC,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,UAAqF;IAC7G,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,YAAY,MAAM,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC;QAAE,OAAO,EAAE,CAAC;IAExF,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,UAAU,YAAY,UAAU,CAAC,EAAE,CAAC;QAC1G,OAAO,UAAqC,CAAC;IAC/C,CAAC;IAED,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QACnC,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAA4B,CAAC;QAC3D,CAAC;QAAC,MAAM,CAAC;YACP,iCAAiC;QACnC,CAAC;IACH,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAClF,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAA4B,CAAC;IAC/E,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,KAAK,GAAG,GAAY,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,8BAA8B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;AACH,CAAC"}
|
package/dist/endee.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main Endee client for Endee-DB
|
|
3
|
+
*/
|
|
4
|
+
import { Index } from './indexClient.js';
|
|
5
|
+
import type { CreateIndexOptions } from './types/index.js';
|
|
6
|
+
export declare class Endee {
|
|
7
|
+
private token;
|
|
8
|
+
private baseUrl;
|
|
9
|
+
private version;
|
|
10
|
+
constructor(token?: string | null);
|
|
11
|
+
createIndex(options: CreateIndexOptions): Promise<string>;
|
|
12
|
+
listIndexes(): Promise<unknown>;
|
|
13
|
+
deleteIndex(name: string): Promise<string>;
|
|
14
|
+
getIndex(name: string): Promise<Index>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=endee.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endee.d.ts","sourceRoot":"","sources":["../src/endee.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAIzC,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,kBAAkB,CAAC;AAE1B,qBAAa,KAAK;IAChB,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;gBAEZ,KAAK,GAAE,MAAM,GAAG,IAAW;IAajC,WAAW,CACf,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,MAAM,CAAC;IAyDZ,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAgB/B,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAuB1C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;CA0B7C"}
|
package/dist/endee.js
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main Endee client for Endee-DB
|
|
3
|
+
*/
|
|
4
|
+
import axios from 'axios';
|
|
5
|
+
import { raiseException } from './exceptions.js';
|
|
6
|
+
import { Index } from './indexClient.js';
|
|
7
|
+
import { isValidIndexName, } from './utils.js';
|
|
8
|
+
export class Endee {
|
|
9
|
+
token;
|
|
10
|
+
baseUrl;
|
|
11
|
+
version;
|
|
12
|
+
constructor(token = null) {
|
|
13
|
+
this.token = token;
|
|
14
|
+
this.baseUrl = "http://127.0.0.1:8080/api/v1";
|
|
15
|
+
if (token) {
|
|
16
|
+
const tokenParts = token.split(":");
|
|
17
|
+
if (tokenParts.length > 2) {
|
|
18
|
+
this.baseUrl = `https://${tokenParts[2]}.endee.io/api/v1`;
|
|
19
|
+
this.token = `${tokenParts[0]}:${tokenParts[1]}`;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
this.version = 1;
|
|
23
|
+
}
|
|
24
|
+
async createIndex(options) {
|
|
25
|
+
const { name, dimension, spaceType = 'cosine', M = 16, efCon = 128, useFp16 = true, version, } = options;
|
|
26
|
+
if (!isValidIndexName(name)) {
|
|
27
|
+
throw new Error("Invalid index name. Index name must be alphanumeric and can contain underscores and less than 48 characters");
|
|
28
|
+
}
|
|
29
|
+
if (dimension > 10000) {
|
|
30
|
+
throw new Error("Dimension cannot be greater than 10000");
|
|
31
|
+
}
|
|
32
|
+
const normalizedSpaceType = spaceType.toLowerCase();
|
|
33
|
+
if (!["cosine", "l2", "ip"].includes(normalizedSpaceType)) {
|
|
34
|
+
throw new Error(`Invalid space type: ${spaceType}`);
|
|
35
|
+
}
|
|
36
|
+
const headers = {
|
|
37
|
+
Authorization: `${this.token}`,
|
|
38
|
+
"Content-Type": "application/json",
|
|
39
|
+
};
|
|
40
|
+
const data = {
|
|
41
|
+
index_name: name,
|
|
42
|
+
dim: dimension,
|
|
43
|
+
space_type: normalizedSpaceType,
|
|
44
|
+
M: M,
|
|
45
|
+
ef_con: efCon,
|
|
46
|
+
use_fp16: useFp16,
|
|
47
|
+
};
|
|
48
|
+
if (version !== undefined) {
|
|
49
|
+
data.version = version;
|
|
50
|
+
}
|
|
51
|
+
let response;
|
|
52
|
+
try {
|
|
53
|
+
response = await axios.post(`${this.baseUrl}/index/create`, data, {
|
|
54
|
+
headers,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
if (axios.isAxiosError(err) && err.response) {
|
|
59
|
+
console.error(err.response.data);
|
|
60
|
+
raiseException(err.response.status, err.response.data);
|
|
61
|
+
}
|
|
62
|
+
throw err;
|
|
63
|
+
}
|
|
64
|
+
if (response.status !== 200) {
|
|
65
|
+
console.error(response.data);
|
|
66
|
+
raiseException(response.status, response.data);
|
|
67
|
+
}
|
|
68
|
+
return "Index created successfully";
|
|
69
|
+
}
|
|
70
|
+
async listIndexes() {
|
|
71
|
+
const headers = {
|
|
72
|
+
Authorization: `${this.token}`,
|
|
73
|
+
};
|
|
74
|
+
let response;
|
|
75
|
+
try {
|
|
76
|
+
response = await axios.get(`${this.baseUrl}/index/list`, { headers });
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
if (axios.isAxiosError(err) && err.response) {
|
|
80
|
+
raiseException(err.response.status, err.response.data);
|
|
81
|
+
}
|
|
82
|
+
throw err;
|
|
83
|
+
}
|
|
84
|
+
return response.data;
|
|
85
|
+
}
|
|
86
|
+
async deleteIndex(name) {
|
|
87
|
+
const headers = {
|
|
88
|
+
Authorization: `${this.token}`,
|
|
89
|
+
};
|
|
90
|
+
let response;
|
|
91
|
+
try {
|
|
92
|
+
response = await axios.delete(`${this.baseUrl}/index/${name}/delete`, {
|
|
93
|
+
headers,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
if (axios.isAxiosError(err) && err.response) {
|
|
98
|
+
console.error(err.response.data);
|
|
99
|
+
raiseException(err.response.status, err.response.data);
|
|
100
|
+
}
|
|
101
|
+
throw err;
|
|
102
|
+
}
|
|
103
|
+
if (response.status !== 200) {
|
|
104
|
+
console.error(response.data);
|
|
105
|
+
raiseException(response.status, response.data);
|
|
106
|
+
}
|
|
107
|
+
return `Index ${name} deleted successfully`;
|
|
108
|
+
}
|
|
109
|
+
async getIndex(name) {
|
|
110
|
+
const headers = {
|
|
111
|
+
Authorization: `${this.token}`,
|
|
112
|
+
"Content-Type": "application/json",
|
|
113
|
+
};
|
|
114
|
+
let response;
|
|
115
|
+
try {
|
|
116
|
+
response = await axios.get(`${this.baseUrl}/index/${name}/info`, {
|
|
117
|
+
headers,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
if (axios.isAxiosError(err) && err.response) {
|
|
122
|
+
raiseException(err.response.status, err.response.data);
|
|
123
|
+
}
|
|
124
|
+
throw err;
|
|
125
|
+
}
|
|
126
|
+
const data = response.data;
|
|
127
|
+
const idx = new Index(name, this.token, this.baseUrl, this.version, data);
|
|
128
|
+
return idx;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=endee.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endee.js","sourceRoot":"","sources":["../src/endee.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MA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ception classes for Endee-DB
|
|
3
|
+
*/
|
|
4
|
+
export declare class EndeeException extends Error {
|
|
5
|
+
constructor(message?: string);
|
|
6
|
+
}
|
|
7
|
+
export declare class APIException extends EndeeException {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
export declare class ServerException extends EndeeException {
|
|
11
|
+
constructor(message: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class ForbiddenException extends EndeeException {
|
|
14
|
+
constructor(message: string);
|
|
15
|
+
}
|
|
16
|
+
export declare class ConflictException extends EndeeException {
|
|
17
|
+
constructor(message: string);
|
|
18
|
+
}
|
|
19
|
+
export declare class NotFoundException extends EndeeException {
|
|
20
|
+
constructor(message: string);
|
|
21
|
+
}
|
|
22
|
+
export declare class AuthenticationException extends EndeeException {
|
|
23
|
+
constructor(message: string);
|
|
24
|
+
}
|
|
25
|
+
export declare class SubscriptionException extends EndeeException {
|
|
26
|
+
constructor(message: string);
|
|
27
|
+
}
|
|
28
|
+
export declare function raiseException(code: number, text: string | unknown): never;
|
|
29
|
+
//# sourceMappingURL=exceptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.d.ts","sourceRoot":"","sources":["../src/exceptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,SAAkC;CAKtD;AAED,qBAAa,YAAa,SAAQ,cAAc;gBAClC,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,eAAgB,SAAQ,cAAc;gBACrC,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,kBAAmB,SAAQ,cAAc;gBACxC,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,iBAAkB,SAAQ,cAAc;gBACvC,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,iBAAkB,SAAQ,cAAc;gBACvC,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,uBAAwB,SAAQ,cAAc;gBAC7C,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,qBAAsB,SAAQ,cAAc;gBAC3C,OAAO,EAAE,MAAM;CAK5B;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAgC1E"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exception classes for Endee-DB
|
|
3
|
+
*/
|
|
4
|
+
export class EndeeException extends Error {
|
|
5
|
+
constructor(message = "An error occurred in Endee-DB") {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "EndeeException";
|
|
8
|
+
Object.setPrototypeOf(this, EndeeException.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export class APIException extends EndeeException {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(`API Error: ${message}`);
|
|
14
|
+
this.name = "APIException";
|
|
15
|
+
Object.setPrototypeOf(this, APIException.prototype);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class ServerException extends EndeeException {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
super(`Server Busy: ${message}`);
|
|
21
|
+
this.name = "ServerException";
|
|
22
|
+
Object.setPrototypeOf(this, ServerException.prototype);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class ForbiddenException extends EndeeException {
|
|
26
|
+
constructor(message) {
|
|
27
|
+
super(`Forbidden: ${message}`);
|
|
28
|
+
this.name = "ForbiddenException";
|
|
29
|
+
Object.setPrototypeOf(this, ForbiddenException.prototype);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export class ConflictException extends EndeeException {
|
|
33
|
+
constructor(message) {
|
|
34
|
+
super(`Conflict: ${message}`);
|
|
35
|
+
this.name = "ConflictException";
|
|
36
|
+
Object.setPrototypeOf(this, ConflictException.prototype);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export class NotFoundException extends EndeeException {
|
|
40
|
+
constructor(message) {
|
|
41
|
+
super(`Resource Not Found: ${message}`);
|
|
42
|
+
this.name = "NotFoundException";
|
|
43
|
+
Object.setPrototypeOf(this, NotFoundException.prototype);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export class AuthenticationException extends EndeeException {
|
|
47
|
+
constructor(message) {
|
|
48
|
+
super(`Authentication Error: ${message}`);
|
|
49
|
+
this.name = "AuthenticationException";
|
|
50
|
+
Object.setPrototypeOf(this, AuthenticationException.prototype);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export class SubscriptionException extends EndeeException {
|
|
54
|
+
constructor(message) {
|
|
55
|
+
super(`Subscription Error: ${message}`);
|
|
56
|
+
this.name = "SubscriptionException";
|
|
57
|
+
Object.setPrototypeOf(this, SubscriptionException.prototype);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
export function raiseException(code, text) {
|
|
61
|
+
let message;
|
|
62
|
+
try {
|
|
63
|
+
if (typeof text === 'string') {
|
|
64
|
+
const parsed = JSON.parse(text);
|
|
65
|
+
message = parsed.error || "Unknown error";
|
|
66
|
+
}
|
|
67
|
+
else if (text && typeof text === 'object' && 'error' in text) {
|
|
68
|
+
message = String(text.error) || "Unknown error";
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
message = String(text) || "Unknown error";
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
message = String(text) || "Unknown error";
|
|
76
|
+
}
|
|
77
|
+
if (code === 400) {
|
|
78
|
+
throw new APIException(message);
|
|
79
|
+
}
|
|
80
|
+
else if (code === 401) {
|
|
81
|
+
throw new AuthenticationException(message);
|
|
82
|
+
}
|
|
83
|
+
else if (code === 402) {
|
|
84
|
+
throw new SubscriptionException(message);
|
|
85
|
+
}
|
|
86
|
+
else if (code === 403) {
|
|
87
|
+
throw new ForbiddenException(message);
|
|
88
|
+
}
|
|
89
|
+
else if (code === 404) {
|
|
90
|
+
throw new NotFoundException(message);
|
|
91
|
+
}
|
|
92
|
+
else if (code === 409) {
|
|
93
|
+
throw new ConflictException(message);
|
|
94
|
+
}
|
|
95
|
+
else if (code >= 500) {
|
|
96
|
+
throw new ServerException("Server is busy. Please try again in sometime");
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
throw new APIException("Unknown Error. Please try again in sometime");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=exceptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../src/exceptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,OAAO,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAO,GAAG,+BAA+B;QACnD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,cAAc;IAC9C,YAAY,OAAe;QACzB,KAAK,CAAC,cAAc,OAAO,EAAE,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,cAAc;IACjD,YAAY,OAAe;QACzB,KAAK,CAAC,gBAAgB,OAAO,EAAE,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,cAAc;IACpD,YAAY,OAAe;QACzB,KAAK,CAAC,cAAc,OAAO,EAAE,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,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MAAM,IAAI,YAAY,CAAC,6CAA6C,CAAC,CAAC;IACxE,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +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"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Index client for Endee-DB
|
|
3
|
+
*/
|
|
4
|
+
import type { VectorItem, QueryOptions, QueryResult, IndexInfo, IndexDescription } from './types/index.js';
|
|
5
|
+
export declare class Index {
|
|
6
|
+
private name;
|
|
7
|
+
private token;
|
|
8
|
+
private url;
|
|
9
|
+
private count;
|
|
10
|
+
private space_type;
|
|
11
|
+
private dimension;
|
|
12
|
+
private precision;
|
|
13
|
+
private M;
|
|
14
|
+
constructor(name: string, token: string, url: string, _version?: number, params?: Partial<IndexInfo>);
|
|
15
|
+
toString(): string;
|
|
16
|
+
private _normalizeVector;
|
|
17
|
+
upsert(inputArray: VectorItem[]): Promise<string>;
|
|
18
|
+
query(options: QueryOptions): Promise<QueryResult[]>;
|
|
19
|
+
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
|
+
}>;
|
|
28
|
+
describe(): IndexDescription;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=indexClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexClient.d.ts","sourceRoot":"","sources":["../src/indexClient.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,gBAAgB,EAEjB,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,UAAU,CAAY;IAC9B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,CAAC,CAAS;gBAGhB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,QAAQ,SAAI,EACZ,MAAM,GAAE,OAAO,CAAC,SAAS,CAAM;IAYjC,QAAQ,IAAI,MAAM;IAIlB,OAAO,CAAC,gBAAgB;IAalB,MAAM,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IA2CjD,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IA4FpD,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAoBzC,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAqBnE,SAAS,CAAC,EAAE,EA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