@upstash/vector 1.2.1 → 1.2.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.
- package/dist/{chunk-HESEGT2A.mjs → chunk-MQ3XJEJ2.mjs} +9 -5
- package/dist/cloudflare.d.mts +3 -3
- package/dist/cloudflare.d.ts +3 -3
- package/dist/cloudflare.js +9 -5
- package/dist/cloudflare.mjs +1 -1
- package/dist/nodejs.d.mts +3 -3
- package/dist/nodejs.d.ts +3 -3
- package/dist/nodejs.js +9 -5
- package/dist/nodejs.mjs +1 -1
- package/dist/{vector-1qEMEEQL.d.mts → vector-7jBuY6ad.d.mts} +7 -1
- package/dist/{vector-1qEMEEQL.d.ts → vector-7jBuY6ad.d.ts} +7 -1
- package/package.json +1 -1
|
@@ -31,13 +31,15 @@ var HttpClient = class {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
async request(req) {
|
|
34
|
+
const signal = this.options.signal;
|
|
35
|
+
const isSignalFunction = typeof signal === "function";
|
|
34
36
|
const requestOptions = {
|
|
35
37
|
cache: this.options.cache,
|
|
36
38
|
method: "POST",
|
|
37
39
|
headers: this.headers,
|
|
38
40
|
body: JSON.stringify(req.body),
|
|
39
41
|
keepalive: true,
|
|
40
|
-
signal:
|
|
42
|
+
signal: isSignalFunction ? signal() : signal
|
|
41
43
|
};
|
|
42
44
|
let res = null;
|
|
43
45
|
let error = null;
|
|
@@ -46,13 +48,15 @@ var HttpClient = class {
|
|
|
46
48
|
res = await fetch([this.baseUrl, ...req.path ?? []].join("/"), requestOptions);
|
|
47
49
|
break;
|
|
48
50
|
} catch (error_) {
|
|
49
|
-
if (
|
|
51
|
+
if (requestOptions.signal?.aborted && isSignalFunction) {
|
|
52
|
+
throw error_;
|
|
53
|
+
} else if (requestOptions.signal?.aborted) {
|
|
50
54
|
const myBlob = new Blob([
|
|
51
|
-
JSON.stringify({ result:
|
|
55
|
+
JSON.stringify({ result: requestOptions.signal.reason ?? "Aborted" })
|
|
52
56
|
]);
|
|
53
57
|
const myOptions = {
|
|
54
58
|
status: 200,
|
|
55
|
-
statusText:
|
|
59
|
+
statusText: requestOptions.signal.reason ?? "Aborted"
|
|
56
60
|
};
|
|
57
61
|
res = new Response(myBlob, myOptions);
|
|
58
62
|
break;
|
|
@@ -855,7 +859,7 @@ var Index = class {
|
|
|
855
859
|
};
|
|
856
860
|
|
|
857
861
|
// version.ts
|
|
858
|
-
var VERSION = "v1.2.
|
|
862
|
+
var VERSION = "v1.2.2";
|
|
859
863
|
|
|
860
864
|
export {
|
|
861
865
|
HttpClient,
|
package/dist/cloudflare.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RequesterConfig, D as Dict, I as Index$1 } from './vector-
|
|
2
|
-
export { d as FetchResult, F as FusionAlgorithm, f as InfoResult, Q as QueryMode, e as QueryResult, c as RangeResult, a as Requester, S as SparseVector, U as UpstashRequest, b as UpstashResponse, V as Vector, W as WeightingStrategy } from './vector-
|
|
1
|
+
import { H as HttpClientConfig, R as RequesterConfig, D as Dict, I as Index$1 } from './vector-7jBuY6ad.mjs';
|
|
2
|
+
export { d as FetchResult, F as FusionAlgorithm, f as InfoResult, Q as QueryMode, e as QueryResult, c as RangeResult, a as Requester, S as SparseVector, U as UpstashRequest, b as UpstashResponse, V as Vector, W as WeightingStrategy } from './vector-7jBuY6ad.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Connection credentials for upstash vector.
|
|
@@ -18,7 +18,7 @@ type IndexConfig = {
|
|
|
18
18
|
* The signal will allow aborting requests on the fly.
|
|
19
19
|
* For more check: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
|
|
20
20
|
*/
|
|
21
|
-
signal?:
|
|
21
|
+
signal?: HttpClientConfig["signal"];
|
|
22
22
|
/**
|
|
23
23
|
* Enable telemetry to help us improve the SDK.
|
|
24
24
|
* The sdk will send the sdk version, platform and node version as telemetry headers.
|
package/dist/cloudflare.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RequesterConfig, D as Dict, I as Index$1 } from './vector-
|
|
2
|
-
export { d as FetchResult, F as FusionAlgorithm, f as InfoResult, Q as QueryMode, e as QueryResult, c as RangeResult, a as Requester, S as SparseVector, U as UpstashRequest, b as UpstashResponse, V as Vector, W as WeightingStrategy } from './vector-
|
|
1
|
+
import { H as HttpClientConfig, R as RequesterConfig, D as Dict, I as Index$1 } from './vector-7jBuY6ad.js';
|
|
2
|
+
export { d as FetchResult, F as FusionAlgorithm, f as InfoResult, Q as QueryMode, e as QueryResult, c as RangeResult, a as Requester, S as SparseVector, U as UpstashRequest, b as UpstashResponse, V as Vector, W as WeightingStrategy } from './vector-7jBuY6ad.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Connection credentials for upstash vector.
|
|
@@ -18,7 +18,7 @@ type IndexConfig = {
|
|
|
18
18
|
* The signal will allow aborting requests on the fly.
|
|
19
19
|
* For more check: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
|
|
20
20
|
*/
|
|
21
|
-
signal?:
|
|
21
|
+
signal?: HttpClientConfig["signal"];
|
|
22
22
|
/**
|
|
23
23
|
* Enable telemetry to help us improve the SDK.
|
|
24
24
|
* The sdk will send the sdk version, platform and node version as telemetry headers.
|
package/dist/cloudflare.js
CHANGED
|
@@ -60,13 +60,15 @@ var HttpClient = class {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
async request(req) {
|
|
63
|
+
const signal = this.options.signal;
|
|
64
|
+
const isSignalFunction = typeof signal === "function";
|
|
63
65
|
const requestOptions = {
|
|
64
66
|
cache: this.options.cache,
|
|
65
67
|
method: "POST",
|
|
66
68
|
headers: this.headers,
|
|
67
69
|
body: JSON.stringify(req.body),
|
|
68
70
|
keepalive: true,
|
|
69
|
-
signal:
|
|
71
|
+
signal: isSignalFunction ? signal() : signal
|
|
70
72
|
};
|
|
71
73
|
let res = null;
|
|
72
74
|
let error = null;
|
|
@@ -75,13 +77,15 @@ var HttpClient = class {
|
|
|
75
77
|
res = await fetch([this.baseUrl, ...req.path ?? []].join("/"), requestOptions);
|
|
76
78
|
break;
|
|
77
79
|
} catch (error_) {
|
|
78
|
-
if (
|
|
80
|
+
if (requestOptions.signal?.aborted && isSignalFunction) {
|
|
81
|
+
throw error_;
|
|
82
|
+
} else if (requestOptions.signal?.aborted) {
|
|
79
83
|
const myBlob = new Blob([
|
|
80
|
-
JSON.stringify({ result:
|
|
84
|
+
JSON.stringify({ result: requestOptions.signal.reason ?? "Aborted" })
|
|
81
85
|
]);
|
|
82
86
|
const myOptions = {
|
|
83
87
|
status: 200,
|
|
84
|
-
statusText:
|
|
88
|
+
statusText: requestOptions.signal.reason ?? "Aborted"
|
|
85
89
|
};
|
|
86
90
|
res = new Response(myBlob, myOptions);
|
|
87
91
|
break;
|
|
@@ -884,7 +888,7 @@ var Index = class {
|
|
|
884
888
|
};
|
|
885
889
|
|
|
886
890
|
// version.ts
|
|
887
|
-
var VERSION = "v1.2.
|
|
891
|
+
var VERSION = "v1.2.2";
|
|
888
892
|
|
|
889
893
|
// src/platforms/cloudflare.ts
|
|
890
894
|
var Index2 = class _Index extends Index {
|
package/dist/cloudflare.mjs
CHANGED
package/dist/nodejs.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RequesterConfig, D as Dict, I as Index$1, a as Requester } from './vector-
|
|
2
|
-
export { d as FetchResult, F as FusionAlgorithm, f as InfoResult, Q as QueryMode, e as QueryResult, c as RangeResult, S as SparseVector, U as UpstashRequest, b as UpstashResponse, V as Vector, W as WeightingStrategy } from './vector-
|
|
1
|
+
import { H as HttpClientConfig, R as RequesterConfig, D as Dict, I as Index$1, a as Requester } from './vector-7jBuY6ad.mjs';
|
|
2
|
+
export { d as FetchResult, F as FusionAlgorithm, f as InfoResult, Q as QueryMode, e as QueryResult, c as RangeResult, S as SparseVector, U as UpstashRequest, b as UpstashResponse, V as Vector, W as WeightingStrategy } from './vector-7jBuY6ad.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Connection credentials for upstash vector.
|
|
@@ -18,7 +18,7 @@ type IndexConfig = {
|
|
|
18
18
|
* The signal will allow aborting requests on the fly.
|
|
19
19
|
* For more check: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
|
|
20
20
|
*/
|
|
21
|
-
signal?:
|
|
21
|
+
signal?: HttpClientConfig["signal"];
|
|
22
22
|
/**
|
|
23
23
|
* Enable telemetry to help us improve the SDK.
|
|
24
24
|
* The sdk will send the sdk version, platform and node version as telemetry headers.
|
package/dist/nodejs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RequesterConfig, D as Dict, I as Index$1, a as Requester } from './vector-
|
|
2
|
-
export { d as FetchResult, F as FusionAlgorithm, f as InfoResult, Q as QueryMode, e as QueryResult, c as RangeResult, S as SparseVector, U as UpstashRequest, b as UpstashResponse, V as Vector, W as WeightingStrategy } from './vector-
|
|
1
|
+
import { H as HttpClientConfig, R as RequesterConfig, D as Dict, I as Index$1, a as Requester } from './vector-7jBuY6ad.js';
|
|
2
|
+
export { d as FetchResult, F as FusionAlgorithm, f as InfoResult, Q as QueryMode, e as QueryResult, c as RangeResult, S as SparseVector, U as UpstashRequest, b as UpstashResponse, V as Vector, W as WeightingStrategy } from './vector-7jBuY6ad.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Connection credentials for upstash vector.
|
|
@@ -18,7 +18,7 @@ type IndexConfig = {
|
|
|
18
18
|
* The signal will allow aborting requests on the fly.
|
|
19
19
|
* For more check: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
|
|
20
20
|
*/
|
|
21
|
-
signal?:
|
|
21
|
+
signal?: HttpClientConfig["signal"];
|
|
22
22
|
/**
|
|
23
23
|
* Enable telemetry to help us improve the SDK.
|
|
24
24
|
* The sdk will send the sdk version, platform and node version as telemetry headers.
|
package/dist/nodejs.js
CHANGED
|
@@ -60,13 +60,15 @@ var HttpClient = class {
|
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
async request(req) {
|
|
63
|
+
const signal = this.options.signal;
|
|
64
|
+
const isSignalFunction = typeof signal === "function";
|
|
63
65
|
const requestOptions = {
|
|
64
66
|
cache: this.options.cache,
|
|
65
67
|
method: "POST",
|
|
66
68
|
headers: this.headers,
|
|
67
69
|
body: JSON.stringify(req.body),
|
|
68
70
|
keepalive: true,
|
|
69
|
-
signal:
|
|
71
|
+
signal: isSignalFunction ? signal() : signal
|
|
70
72
|
};
|
|
71
73
|
let res = null;
|
|
72
74
|
let error = null;
|
|
@@ -75,13 +77,15 @@ var HttpClient = class {
|
|
|
75
77
|
res = await fetch([this.baseUrl, ...req.path ?? []].join("/"), requestOptions);
|
|
76
78
|
break;
|
|
77
79
|
} catch (error_) {
|
|
78
|
-
if (
|
|
80
|
+
if (requestOptions.signal?.aborted && isSignalFunction) {
|
|
81
|
+
throw error_;
|
|
82
|
+
} else if (requestOptions.signal?.aborted) {
|
|
79
83
|
const myBlob = new Blob([
|
|
80
|
-
JSON.stringify({ result:
|
|
84
|
+
JSON.stringify({ result: requestOptions.signal.reason ?? "Aborted" })
|
|
81
85
|
]);
|
|
82
86
|
const myOptions = {
|
|
83
87
|
status: 200,
|
|
84
|
-
statusText:
|
|
88
|
+
statusText: requestOptions.signal.reason ?? "Aborted"
|
|
85
89
|
};
|
|
86
90
|
res = new Response(myBlob, myOptions);
|
|
87
91
|
break;
|
|
@@ -884,7 +888,7 @@ var Index = class {
|
|
|
884
888
|
};
|
|
885
889
|
|
|
886
890
|
// version.ts
|
|
887
|
-
var VERSION = "v1.2.
|
|
891
|
+
var VERSION = "v1.2.2";
|
|
888
892
|
|
|
889
893
|
// src/utils/get-runtime.ts
|
|
890
894
|
function getRuntime() {
|
package/dist/nodejs.mjs
CHANGED
|
@@ -41,6 +41,12 @@ type RequesterConfig = {
|
|
|
41
41
|
*/
|
|
42
42
|
cache?: CacheSetting;
|
|
43
43
|
};
|
|
44
|
+
type HttpClientConfig = {
|
|
45
|
+
headers?: Record<string, string>;
|
|
46
|
+
baseUrl: string;
|
|
47
|
+
retry?: RetryConfig;
|
|
48
|
+
signal?: AbortSignal | (() => AbortSignal);
|
|
49
|
+
} & RequesterConfig;
|
|
44
50
|
|
|
45
51
|
type Vector<TMetadata = Dict> = {
|
|
46
52
|
id: string;
|
|
@@ -905,4 +911,4 @@ declare class Index<TIndexMetadata extends Dict = Dict> {
|
|
|
905
911
|
deleteNamespace: (namespace: string) => Promise<string>;
|
|
906
912
|
}
|
|
907
913
|
|
|
908
|
-
export { type Dict as D, FusionAlgorithm as F, Index as I, QueryMode as Q, type RequesterConfig as R, type SparseVector as S, type UpstashRequest as U, type Vector as V, WeightingStrategy as W, type Requester as a, type UpstashResponse as b, type RangeResult as c, type FetchResult as d, type QueryResult as e, type InfoResult as f };
|
|
914
|
+
export { type Dict as D, FusionAlgorithm as F, type HttpClientConfig as H, Index as I, QueryMode as Q, type RequesterConfig as R, type SparseVector as S, type UpstashRequest as U, type Vector as V, WeightingStrategy as W, type Requester as a, type UpstashResponse as b, type RangeResult as c, type FetchResult as d, type QueryResult as e, type InfoResult as f };
|
|
@@ -41,6 +41,12 @@ type RequesterConfig = {
|
|
|
41
41
|
*/
|
|
42
42
|
cache?: CacheSetting;
|
|
43
43
|
};
|
|
44
|
+
type HttpClientConfig = {
|
|
45
|
+
headers?: Record<string, string>;
|
|
46
|
+
baseUrl: string;
|
|
47
|
+
retry?: RetryConfig;
|
|
48
|
+
signal?: AbortSignal | (() => AbortSignal);
|
|
49
|
+
} & RequesterConfig;
|
|
44
50
|
|
|
45
51
|
type Vector<TMetadata = Dict> = {
|
|
46
52
|
id: string;
|
|
@@ -905,4 +911,4 @@ declare class Index<TIndexMetadata extends Dict = Dict> {
|
|
|
905
911
|
deleteNamespace: (namespace: string) => Promise<string>;
|
|
906
912
|
}
|
|
907
913
|
|
|
908
|
-
export { type Dict as D, FusionAlgorithm as F, Index as I, QueryMode as Q, type RequesterConfig as R, type SparseVector as S, type UpstashRequest as U, type Vector as V, WeightingStrategy as W, type Requester as a, type UpstashResponse as b, type RangeResult as c, type FetchResult as d, type QueryResult as e, type InfoResult as f };
|
|
914
|
+
export { type Dict as D, FusionAlgorithm as F, type HttpClientConfig as H, Index as I, QueryMode as Q, type RequesterConfig as R, type SparseVector as S, type UpstashRequest as U, type Vector as V, WeightingStrategy as W, type Requester as a, type UpstashResponse as b, type RangeResult as c, type FetchResult as d, type QueryResult as e, type InfoResult as f };
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "name": "@upstash/vector", "version": "v1.2.
|
|
1
|
+
{ "name": "@upstash/vector", "version": "v1.2.2", "author": "Oguzhan Olguncu <oguzhan@upstash.com>", "repository": { "type": "git", "url": "https://github.com/upstash/vector-js" }, "exports": { ".": { "import": "./dist/nodejs.mjs", "require": "./dist/nodejs.js" }, "./cloudflare": { "import": "./dist/cloudflare.mjs", "require": "./dist/cloudflare.js" }, "./nodejs": { "import": "./dist/nodejs.mjs", "require": "./dist/nodejs.js" } }, "main": "./dist/nodejs.js", "module": "./dist/nodejs.mjs", "types": "./dist/nodejs.d.ts", "devDependencies": { "@commitlint/cli": "^18.6.0", "@commitlint/config-conventional": "^18.6.0", "@typescript-eslint/eslint-plugin": "^8.4.0", "bun-types": "latest", "eslint": "9.10.0", "eslint-plugin-unicorn": "^55.0.0", "husky": "^8.0.3", "prettier": "^3.3.3", "tsup": "latest", "typescript": "^5.0.0", "vitest": "^1.2.2" }, "bugs": { "url": "https://github.com/upstash/vector/issues" }, "description": "An HTTP/REST based Vector DB client built on top of Upstash REST API.", "files": [ "dist" ], "homepage": "https://upstash.com/vector", "keywords": [ "vector", "upstash", "db" ], "license": "MIT", "scripts": { "test": "bun test src --coverage --bail --coverageSkipTestFiles=[test-utils.ts] --timeout 20000", "fmt": "prettier --write .", "lint": "tsc && eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix", "build": "tsup ", "prepare": "husky install" } }
|