endee 1.7.1-dev.3 → 1.8.0-dev.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 +537 -384
- package/dist/collection.d.ts +83 -0
- package/dist/collection.d.ts.map +1 -0
- package/dist/collection.js +724 -0
- package/dist/collection.js.map +1 -0
- package/dist/constants.d.ts +38 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +38 -0
- package/dist/constants.js.map +1 -0
- package/dist/endee.d.ts +93 -0
- package/dist/endee.d.ts.map +1 -0
- package/dist/endee.js +316 -0
- package/dist/endee.js.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/reranker.d.ts +32 -0
- package/dist/reranker.d.ts.map +1 -0
- package/dist/reranker.js +96 -0
- package/dist/reranker.js.map +1 -0
- package/dist/types/index.d.ts +126 -85
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/endee.class.d.ts +0 -18
- package/dist/endee.class.d.ts.map +0 -1
- package/dist/endee.class.js +0 -279
- package/dist/endee.class.js.map +0 -1
- package/dist/index.class.d.ts +0 -32
- package/dist/index.class.d.ts.map +0 -1
- package/dist/index.class.js +0 -391
- package/dist/index.class.js.map +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reranking utilities for the Endee client.
|
|
3
|
+
*
|
|
4
|
+
* Ports the Python client's `apply_rrf`. Each reranker accepts the per-field
|
|
5
|
+
* ranked hits from the server SearchResult and returns a fused, ranked list of
|
|
6
|
+
* `[intId, score]` tuples truncated to `limit`.
|
|
7
|
+
*/
|
|
8
|
+
import type { RerankOptions, RerankResponse, SearchResponse } from './types/index.js';
|
|
9
|
+
/** `{ fieldName: [[intId, score], ...] }` from the server SearchResult. */
|
|
10
|
+
export type ResultsMap = Map<string, Array<[number, number]>> | Record<string, Array<[number, number]>>;
|
|
11
|
+
/**
|
|
12
|
+
* Reciprocal Rank Fusion across named fields.
|
|
13
|
+
*
|
|
14
|
+
* For each field, a hit at rank `r` (1-based) contributes `weight / (k + r)` to
|
|
15
|
+
* that object's score. Scores are summed across fields and the top `limit`
|
|
16
|
+
* objects are returned, sorted by score descending.
|
|
17
|
+
*/
|
|
18
|
+
export declare function applyRrf(resultsMap: ResultsMap, fieldWeights: Record<string, number>, limit: number, k?: number): Array<[number, number]>;
|
|
19
|
+
/**
|
|
20
|
+
* Fuse the per-field results from `search()` into a single ranked list.
|
|
21
|
+
*
|
|
22
|
+
* Uses Reciprocal Rank Fusion over each field's decoded `SearchHit[]`: a hit at
|
|
23
|
+
* rank `r` (1-based) in field `f` contributes `fieldWeights[f] / (rrfK + r)` to
|
|
24
|
+
* that object's score. Scores are summed across fields (deduped by `id`) and the
|
|
25
|
+
* top `limit` hits are returned, sorted by fused score descending.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* const res = await col.search({ fields: { embedding: { query: v }, keywords: { query: s } }, limit: 10 });
|
|
29
|
+
* const fused = rerank(res, { name: 'rrf', limit: 10, fieldWeights: { embedding: 0.6, keywords: 0.4 } });
|
|
30
|
+
*/
|
|
31
|
+
export declare function rerank(searchResults: SearchResponse, options: RerankOptions): RerankResponse;
|
|
32
|
+
//# sourceMappingURL=reranker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reranker.d.ts","sourceRoot":"","sources":["../src/reranker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAa,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEjG,2EAA2E;AAC3E,MAAM,MAAM,UAAU,GAClB,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GACpC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAO5C;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,KAAK,EAAE,MAAM,EACb,CAAC,SAAK,GACL,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAgBzB;AAsBD;;;;;;;;;;;GAWG;AACH,wBAAgB,MAAM,CAAC,aAAa,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,GAAG,cAAc,CAmC5F"}
|
package/dist/reranker.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reranking utilities for the Endee client.
|
|
3
|
+
*
|
|
4
|
+
* Ports the Python client's `apply_rrf`. Each reranker accepts the per-field
|
|
5
|
+
* ranked hits from the server SearchResult and returns a fused, ranked list of
|
|
6
|
+
* `[intId, score]` tuples truncated to `limit`.
|
|
7
|
+
*/
|
|
8
|
+
import { DEFAULT_RRF_RANK_CONSTANT, DEFAULT_TOP_K } from './constants.js';
|
|
9
|
+
function entries(map) {
|
|
10
|
+
if (map instanceof Map)
|
|
11
|
+
return Array.from(map.entries());
|
|
12
|
+
return Object.entries(map);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Reciprocal Rank Fusion across named fields.
|
|
16
|
+
*
|
|
17
|
+
* For each field, a hit at rank `r` (1-based) contributes `weight / (k + r)` to
|
|
18
|
+
* that object's score. Scores are summed across fields and the top `limit`
|
|
19
|
+
* objects are returned, sorted by score descending.
|
|
20
|
+
*/
|
|
21
|
+
export function applyRrf(resultsMap, fieldWeights, limit, k = 60) {
|
|
22
|
+
const rrfScores = new Map();
|
|
23
|
+
for (const [fieldName, hits] of entries(resultsMap)) {
|
|
24
|
+
const weight = fieldWeights[fieldName] ?? 0.0;
|
|
25
|
+
let rank = 1;
|
|
26
|
+
for (const hit of hits || []) {
|
|
27
|
+
const intId = hit[0];
|
|
28
|
+
rrfScores.set(intId, (rrfScores.get(intId) ?? 0.0) + weight / (k + rank));
|
|
29
|
+
rank += 1;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return Array.from(rrfScores.entries())
|
|
33
|
+
.sort((a, b) => b[1] - a[1])
|
|
34
|
+
.slice(0, limit);
|
|
35
|
+
}
|
|
36
|
+
/** Resolve and validate per-field weights against the fields present. */
|
|
37
|
+
function resolveFieldWeights(fieldNames, fieldWeights) {
|
|
38
|
+
if (fieldWeights === null || fieldWeights === undefined) {
|
|
39
|
+
const n = fieldNames.length;
|
|
40
|
+
return Object.fromEntries(fieldNames.map((f) => [f, 1.0 / n]));
|
|
41
|
+
}
|
|
42
|
+
const missing = fieldNames.filter((f) => !(f in fieldWeights));
|
|
43
|
+
if (missing.length > 0) {
|
|
44
|
+
throw new Error(`fieldWeights missing entries for: ${missing.sort().join(', ')}`);
|
|
45
|
+
}
|
|
46
|
+
const total = fieldNames.reduce((s, f) => s + fieldWeights[f], 0);
|
|
47
|
+
if (Math.abs(total - 1.0) > 1e-6) {
|
|
48
|
+
throw new Error(`fieldWeights must sum to 1.0 (got ${total})`);
|
|
49
|
+
}
|
|
50
|
+
return fieldWeights;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Fuse the per-field results from `search()` into a single ranked list.
|
|
54
|
+
*
|
|
55
|
+
* Uses Reciprocal Rank Fusion over each field's decoded `SearchHit[]`: a hit at
|
|
56
|
+
* rank `r` (1-based) in field `f` contributes `fieldWeights[f] / (rrfK + r)` to
|
|
57
|
+
* that object's score. Scores are summed across fields (deduped by `id`) and the
|
|
58
|
+
* top `limit` hits are returned, sorted by fused score descending.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* const res = await col.search({ fields: { embedding: { query: v }, keywords: { query: s } }, limit: 10 });
|
|
62
|
+
* const fused = rerank(res, { name: 'rrf', limit: 10, fieldWeights: { embedding: 0.6, keywords: 0.4 } });
|
|
63
|
+
*/
|
|
64
|
+
export function rerank(searchResults, options) {
|
|
65
|
+
const { name, limit = DEFAULT_TOP_K, rrfK = DEFAULT_RRF_RANK_CONSTANT } = options;
|
|
66
|
+
if (name !== 'rrf') {
|
|
67
|
+
throw new Error("rerank: name must be 'rrf'");
|
|
68
|
+
}
|
|
69
|
+
const perField = searchResults?.results;
|
|
70
|
+
if (perField === null || typeof perField !== 'object' || Array.isArray(perField)) {
|
|
71
|
+
throw new Error('rerank: expected search results to be a per-field map of hits');
|
|
72
|
+
}
|
|
73
|
+
const fieldNames = Object.keys(perField);
|
|
74
|
+
if (fieldNames.length === 0)
|
|
75
|
+
throw new Error('rerank: no fields to fuse');
|
|
76
|
+
const weights = resolveFieldWeights(fieldNames, options.fieldWeights);
|
|
77
|
+
const scores = new Map();
|
|
78
|
+
const hitById = new Map();
|
|
79
|
+
for (const fname of fieldNames) {
|
|
80
|
+
const weight = weights[fname] ?? 0.0;
|
|
81
|
+
let rank = 1;
|
|
82
|
+
for (const hit of perField[fname] ?? []) {
|
|
83
|
+
const id = hit.id;
|
|
84
|
+
scores.set(id, (scores.get(id) ?? 0.0) + weight / (rrfK + rank));
|
|
85
|
+
if (!hitById.has(id))
|
|
86
|
+
hitById.set(id, hit);
|
|
87
|
+
rank += 1;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const results = Array.from(scores.entries())
|
|
91
|
+
.sort((a, b) => b[1] - a[1])
|
|
92
|
+
.slice(0, limit)
|
|
93
|
+
.map(([id, score]) => ({ ...hitById.get(id), similarity: score }));
|
|
94
|
+
return { results };
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=reranker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reranker.js","sourceRoot":"","sources":["../src/reranker.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,yBAAyB,EAAE,aAAa,EAAE,MA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C,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3B,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;SACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAe,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IAEpF,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,115 +1,156 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Type definitions for Endee
|
|
2
|
+
* Type definitions for the Endee client (v2 Collections API).
|
|
3
3
|
*/
|
|
4
4
|
export type SpaceType = 'cosine' | 'l2' | 'ip';
|
|
5
5
|
export declare enum Precision {
|
|
6
6
|
BINARY = "binary",
|
|
7
7
|
INT8 = "int8",
|
|
8
|
+
INT8E = "int8e",
|
|
8
9
|
INT16 = "int16",
|
|
9
10
|
FLOAT16 = "float16",
|
|
10
11
|
FLOAT32 = "float32"
|
|
11
12
|
}
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
export type FieldType = 'vector' | 'sparse' | 'multi_vector';
|
|
14
|
+
/** HNSW / quantization params for a `vector` or `multi_vector` field. */
|
|
15
|
+
export interface FieldParams {
|
|
16
|
+
dimension?: number;
|
|
17
|
+
space_type?: SpaceType;
|
|
18
|
+
precision?: Precision | string;
|
|
19
|
+
/** Required for multi_vector fields. */
|
|
20
|
+
pooling?: 'mean' | 'max';
|
|
21
|
+
/** Optional HNSW build params. */
|
|
16
22
|
M?: number;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
ef_con?: number;
|
|
24
|
+
[key: string]: unknown;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A field definition sent to the server as-is on `createCollection`.
|
|
28
|
+
*
|
|
29
|
+
* - `vector` → requires `params` ({ dimension, space_type, precision, ... }).
|
|
30
|
+
* - `sparse` → requires top-level `sparse_model` ("default" | "endee_bm25").
|
|
31
|
+
* - `multi_vector` → requires `params` including `pooling`.
|
|
32
|
+
*/
|
|
33
|
+
export interface FieldDefinition {
|
|
34
|
+
name: string;
|
|
35
|
+
type: FieldType;
|
|
36
|
+
params?: FieldParams;
|
|
37
|
+
sparse_model?: string;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
/** Sparse vector value: parallel `indices` / `values` arrays. */
|
|
41
|
+
export interface SparseValue {
|
|
42
|
+
indices?: number[];
|
|
43
|
+
values?: number[];
|
|
44
|
+
/** Aliases also accepted on input (mirrors the Python client). */
|
|
45
|
+
sparse_indices?: number[];
|
|
46
|
+
sparse_values?: number[];
|
|
47
|
+
position?: number[];
|
|
21
48
|
}
|
|
22
|
-
|
|
49
|
+
/** A per-object field value: dense vector, sparse, or multi-vector. */
|
|
50
|
+
export type FieldValue = number[] | number[][] | SparseValue;
|
|
51
|
+
/** One object to upsert. */
|
|
52
|
+
export interface ObjectInput {
|
|
23
53
|
id: string;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
54
|
+
meta?: Record<string, unknown> | null;
|
|
55
|
+
filter?: Record<string, unknown> | string | null;
|
|
56
|
+
fields?: Record<string, FieldValue>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Per-field search config. The query value is required; `weight` is the
|
|
60
|
+
* fraction of the request `limit` to draw from this field (effective per-field
|
|
61
|
+
* limit = ceil(weight * limit)). Omit `weight` to use the full `limit`.
|
|
62
|
+
*/
|
|
63
|
+
export interface FieldQueryConfig {
|
|
64
|
+
query: FieldValue;
|
|
65
|
+
/** Fraction of the request `limit` to take from this field (0 < weight <= 1). */
|
|
66
|
+
weight?: number;
|
|
67
|
+
ef_search?: number;
|
|
68
|
+
[key: string]: unknown;
|
|
69
|
+
}
|
|
70
|
+
/** A field's query in a search request: always the config-dict form. */
|
|
71
|
+
export type SearchFieldValue = FieldQueryConfig;
|
|
72
|
+
export interface SearchOptions {
|
|
73
|
+
fields: Record<string, SearchFieldValue>;
|
|
74
|
+
limit?: number;
|
|
33
75
|
filter?: Array<Record<string, unknown>> | null;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
76
|
+
efSearch?: number;
|
|
77
|
+
}
|
|
78
|
+
/** Options for the standalone `rerank()` fusion of per-field search results. */
|
|
79
|
+
export interface RerankOptions {
|
|
80
|
+
/** Reranker algorithm. Only `'rrf'` is supported. */
|
|
81
|
+
name: 'rrf';
|
|
82
|
+
/** Max number of fused hits to return. */
|
|
83
|
+
limit?: number;
|
|
84
|
+
/** Per-field RRF weights; must sum to 1.0. Defaults to uniform. */
|
|
85
|
+
fieldWeights?: Record<string, number> | null;
|
|
86
|
+
/** RRF rank constant. */
|
|
87
|
+
rrfK?: number;
|
|
88
|
+
}
|
|
89
|
+
/** A single search result hit. */
|
|
90
|
+
export interface SearchHit {
|
|
44
91
|
id: string;
|
|
45
92
|
similarity: number;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
filter?: Record<string, unknown>;
|
|
49
|
-
norm?: number;
|
|
50
|
-
vector?: number[];
|
|
93
|
+
meta: Record<string, unknown>;
|
|
94
|
+
filter: Record<string, unknown>;
|
|
51
95
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
efCon?: number;
|
|
60
|
-
checksum?: number;
|
|
61
|
-
libToken?: string;
|
|
62
|
-
version?: number;
|
|
63
|
-
sparseDimension?: number;
|
|
64
|
-
sparseModel?: string | null;
|
|
96
|
+
/**
|
|
97
|
+
* `search()` always returns one ranked list per queried field, keyed by field
|
|
98
|
+
* name. Use `rerank()` to fuse these into a single ranked list.
|
|
99
|
+
*/
|
|
100
|
+
export type SearchResults = Record<string, SearchHit[]>;
|
|
101
|
+
export interface SearchResponse {
|
|
102
|
+
results: SearchResults;
|
|
65
103
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
precision: Precision;
|
|
73
|
-
M: number;
|
|
74
|
-
efCon: number;
|
|
75
|
-
sparseModel: string | null;
|
|
76
|
-
}
|
|
77
|
-
export interface VectorInfo {
|
|
104
|
+
/** A fused, single-list result as returned by `rerank()`. */
|
|
105
|
+
export interface RerankResponse {
|
|
106
|
+
results: SearchHit[];
|
|
107
|
+
}
|
|
108
|
+
/** A full object as returned by `getObjects`. */
|
|
109
|
+
export interface FullObject {
|
|
78
110
|
id: string;
|
|
79
111
|
meta: Record<string, unknown>;
|
|
80
112
|
filter: Record<string, unknown>;
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
113
|
+
vectors: Record<string, number[]>;
|
|
114
|
+
sparses: Record<string, {
|
|
115
|
+
indices: number[];
|
|
116
|
+
values: number[];
|
|
117
|
+
}>;
|
|
118
|
+
multi_vectors: Record<string, number[][]>;
|
|
119
|
+
}
|
|
120
|
+
/** Collection metadata returned by `describe()` / `getCollection`. */
|
|
121
|
+
export interface CollectionMetadata {
|
|
122
|
+
name?: string;
|
|
123
|
+
fields: FieldDefinition[];
|
|
124
|
+
created_at?: number | string;
|
|
125
|
+
layout_version?: number;
|
|
126
|
+
[key: string]: unknown;
|
|
85
127
|
}
|
|
86
|
-
export interface
|
|
128
|
+
export interface UpdateFilterEntry {
|
|
87
129
|
id: string;
|
|
88
130
|
filter: Record<string, unknown>;
|
|
89
131
|
}
|
|
90
132
|
export interface RebuildOptions {
|
|
91
|
-
|
|
133
|
+
field: string;
|
|
134
|
+
m?: number;
|
|
92
135
|
efCon?: number;
|
|
93
136
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
completed_at?: string;
|
|
113
|
-
error?: string;
|
|
137
|
+
/** Database tier for admin database operations. */
|
|
138
|
+
export type DbType = 'starter' | 'pro' | 'scale' | 'enterprise';
|
|
139
|
+
/** Token type: read-write (`rw`) or read-only (`r`). */
|
|
140
|
+
export type TokenType = 'rw' | 'r';
|
|
141
|
+
/** A database entry as returned by `listDatabases()`. */
|
|
142
|
+
export interface DatabaseInfo {
|
|
143
|
+
db_name: string;
|
|
144
|
+
db_type?: DbType | string;
|
|
145
|
+
is_active?: boolean;
|
|
146
|
+
created_at?: number | string;
|
|
147
|
+
[key: string]: unknown;
|
|
148
|
+
}
|
|
149
|
+
/** A token entry as returned by `listTokens()` / `listMyTokens()` (no secret). */
|
|
150
|
+
export interface TokenInfo {
|
|
151
|
+
name: string;
|
|
152
|
+
token_type?: TokenType | string;
|
|
153
|
+
created_at?: number | string;
|
|
154
|
+
[key: string]: unknown;
|
|
114
155
|
}
|
|
115
156
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/C,oBAAY,SAAS;IACnB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED,MAAM,
|
|
1
|
+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AM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAID,mDAAmD;AACnD,MAAM,MAAM,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,YAAY,CAAC;AAEhE,wDAAwD;AACxD,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,GAAG,CAAC;AAEnC,yDAAyD;AACzD,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,kFAAkF;AAClF,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
package/dist/types/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Type definitions for Endee
|
|
2
|
+
* Type definitions for the Endee client (v2 Collections API).
|
|
3
3
|
*/
|
|
4
4
|
export var Precision;
|
|
5
5
|
(function (Precision) {
|
|
6
6
|
Precision["BINARY"] = "binary";
|
|
7
7
|
Precision["INT8"] = "int8";
|
|
8
|
+
Precision["INT8E"] = "int8e";
|
|
8
9
|
Precision["INT16"] = "int16";
|
|
9
10
|
Precision["FLOAT16"] = "float16";
|
|
10
11
|
Precision["FLOAT32"] = "float32";
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,CAAN,IAAY,SAOX;AAPD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,0BAAa,CAAA;IACb,4BAAe,CAAA;IACf,4BAAe,CAAA;IACf,gCAAmB,CAAA;IACnB,gCAAmB,CAAA;AACrB,CAAC,EAPW,SAAS,KAAT,SAAS,QAOpB"}
|
package/package.json
CHANGED
package/dist/endee.class.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Index } from './index.class.js';
|
|
2
|
-
import { type CreateIndexOptions } from './types/index.js';
|
|
3
|
-
export declare class Endee {
|
|
4
|
-
private token;
|
|
5
|
-
private baseUrl;
|
|
6
|
-
private version;
|
|
7
|
-
constructor(token?: string | null);
|
|
8
|
-
setBaseUrl(url: string): string;
|
|
9
|
-
createCollection(options: CreateIndexOptions): Promise<string>;
|
|
10
|
-
createIndex(options: CreateIndexOptions): Promise<string>;
|
|
11
|
-
listCollections(): Promise<unknown>;
|
|
12
|
-
listIndexes(): Promise<unknown>;
|
|
13
|
-
deleteCollection(name: string): Promise<string>;
|
|
14
|
-
deleteIndex(name: string): Promise<string>;
|
|
15
|
-
getCollection(name: string): Promise<Index>;
|
|
16
|
-
getIndex(name: string): Promise<Index>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=endee.class.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endee.class.d.ts","sourceRoot":"","sources":["../src/endee.class.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAa,KAAK,kBAAkB,EAAkB,MAAM,kBAAkB,CAAC;AAEtF,qBAAa,KAAK;IAChB,OAAO,CAAC,KAAK,CAAgB;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAS;gBAEZ,KAAK,GAAE,MAAM,GAAG,IAAW;IAavC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAKzB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAgE9D,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAiEzD,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAgBnC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAgB/B,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAuB/C,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAuB1C,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAoC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;CAmC7C"}
|