@supabase/storage-js 2.87.4-canary.2 → 2.87.4-canary.4

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.
Files changed (206) hide show
  1. package/README.md +2 -106
  2. package/dist/index.cjs +3019 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +2601 -0
  5. package/dist/index.d.cts.map +1 -0
  6. package/dist/index.d.mts +2601 -0
  7. package/dist/index.d.mts.map +1 -0
  8. package/dist/index.mjs +2998 -0
  9. package/dist/index.mjs.map +1 -0
  10. package/dist/umd/supabase.js +1 -1
  11. package/package.json +21 -12
  12. package/src/lib/version.ts +1 -1
  13. package/dist/main/StorageClient.d.ts +0 -64
  14. package/dist/main/StorageClient.d.ts.map +0 -1
  15. package/dist/main/StorageClient.js +0 -74
  16. package/dist/main/StorageClient.js.map +0 -1
  17. package/dist/main/index.d.ts +0 -7
  18. package/dist/main/index.d.ts.map +0 -1
  19. package/dist/main/index.js +0 -12
  20. package/dist/main/index.js.map +0 -1
  21. package/dist/main/lib/constants.d.ts +0 -4
  22. package/dist/main/lib/constants.d.ts.map +0 -1
  23. package/dist/main/lib/constants.js +0 -8
  24. package/dist/main/lib/constants.js.map +0 -1
  25. package/dist/main/lib/errors.d.ts +0 -21
  26. package/dist/main/lib/errors.d.ts.map +0 -1
  27. package/dist/main/lib/errors.js +0 -41
  28. package/dist/main/lib/errors.js.map +0 -1
  29. package/dist/main/lib/fetch.d.ts +0 -16
  30. package/dist/main/lib/fetch.d.ts.map +0 -1
  31. package/dist/main/lib/fetch.js +0 -95
  32. package/dist/main/lib/fetch.js.map +0 -1
  33. package/dist/main/lib/helpers.d.ts +0 -28
  34. package/dist/main/lib/helpers.d.ts.map +0 -1
  35. package/dist/main/lib/helpers.js +0 -87
  36. package/dist/main/lib/helpers.js.map +0 -1
  37. package/dist/main/lib/index.d.ts +0 -6
  38. package/dist/main/lib/index.d.ts.map +0 -1
  39. package/dist/main/lib/index.js +0 -9
  40. package/dist/main/lib/index.js.map +0 -1
  41. package/dist/main/lib/types.d.ts +0 -226
  42. package/dist/main/lib/types.d.ts.map +0 -1
  43. package/dist/main/lib/types.js +0 -3
  44. package/dist/main/lib/types.js.map +0 -1
  45. package/dist/main/lib/vectors/StorageVectorsClient.d.ts +0 -505
  46. package/dist/main/lib/vectors/StorageVectorsClient.d.ts.map +0 -1
  47. package/dist/main/lib/vectors/StorageVectorsClient.js +0 -582
  48. package/dist/main/lib/vectors/StorageVectorsClient.js.map +0 -1
  49. package/dist/main/lib/vectors/VectorBucketApi.d.ts +0 -32
  50. package/dist/main/lib/vectors/VectorBucketApi.d.ts.map +0 -1
  51. package/dist/main/lib/vectors/VectorBucketApi.js +0 -102
  52. package/dist/main/lib/vectors/VectorBucketApi.js.map +0 -1
  53. package/dist/main/lib/vectors/VectorDataApi.d.ts +0 -32
  54. package/dist/main/lib/vectors/VectorDataApi.d.ts.map +0 -1
  55. package/dist/main/lib/vectors/VectorDataApi.js +0 -147
  56. package/dist/main/lib/vectors/VectorDataApi.js.map +0 -1
  57. package/dist/main/lib/vectors/VectorIndexApi.d.ts +0 -47
  58. package/dist/main/lib/vectors/VectorIndexApi.d.ts.map +0 -1
  59. package/dist/main/lib/vectors/VectorIndexApi.js +0 -104
  60. package/dist/main/lib/vectors/VectorIndexApi.js.map +0 -1
  61. package/dist/main/lib/vectors/constants.d.ts +0 -5
  62. package/dist/main/lib/vectors/constants.d.ts.map +0 -1
  63. package/dist/main/lib/vectors/constants.js +0 -9
  64. package/dist/main/lib/vectors/constants.js.map +0 -1
  65. package/dist/main/lib/vectors/errors.d.ts +0 -55
  66. package/dist/main/lib/vectors/errors.d.ts.map +0 -1
  67. package/dist/main/lib/vectors/errors.js +0 -76
  68. package/dist/main/lib/vectors/errors.js.map +0 -1
  69. package/dist/main/lib/vectors/fetch.d.ts +0 -57
  70. package/dist/main/lib/vectors/fetch.d.ts.map +0 -1
  71. package/dist/main/lib/vectors/fetch.js +0 -167
  72. package/dist/main/lib/vectors/fetch.js.map +0 -1
  73. package/dist/main/lib/vectors/helpers.d.ts +0 -46
  74. package/dist/main/lib/vectors/helpers.d.ts.map +0 -1
  75. package/dist/main/lib/vectors/helpers.js +0 -74
  76. package/dist/main/lib/vectors/helpers.js.map +0 -1
  77. package/dist/main/lib/vectors/index.d.ts +0 -11
  78. package/dist/main/lib/vectors/index.d.ts.map +0 -1
  79. package/dist/main/lib/vectors/index.js +0 -31
  80. package/dist/main/lib/vectors/index.js.map +0 -1
  81. package/dist/main/lib/vectors/types.d.ts +0 -279
  82. package/dist/main/lib/vectors/types.d.ts.map +0 -1
  83. package/dist/main/lib/vectors/types.js +0 -3
  84. package/dist/main/lib/vectors/types.js.map +0 -1
  85. package/dist/main/lib/version.d.ts +0 -2
  86. package/dist/main/lib/version.d.ts.map +0 -1
  87. package/dist/main/lib/version.js +0 -11
  88. package/dist/main/lib/version.js.map +0 -1
  89. package/dist/main/packages/BlobDownloadBuilder.d.ts +0 -16
  90. package/dist/main/packages/BlobDownloadBuilder.d.ts.map +0 -1
  91. package/dist/main/packages/BlobDownloadBuilder.js +0 -55
  92. package/dist/main/packages/BlobDownloadBuilder.js.map +0 -1
  93. package/dist/main/packages/StorageAnalyticsClient.d.ts +0 -324
  94. package/dist/main/packages/StorageAnalyticsClient.d.ts.map +0 -1
  95. package/dist/main/packages/StorageAnalyticsClient.js +0 -395
  96. package/dist/main/packages/StorageAnalyticsClient.js.map +0 -1
  97. package/dist/main/packages/StorageBucketApi.d.ts +0 -266
  98. package/dist/main/packages/StorageBucketApi.d.ts.map +0 -1
  99. package/dist/main/packages/StorageBucketApi.js +0 -362
  100. package/dist/main/packages/StorageBucketApi.js.map +0 -1
  101. package/dist/main/packages/StorageFileApi.d.ts +0 -680
  102. package/dist/main/packages/StorageFileApi.d.ts.map +0 -1
  103. package/dist/main/packages/StorageFileApi.js +0 -1002
  104. package/dist/main/packages/StorageFileApi.js.map +0 -1
  105. package/dist/main/packages/StreamDownloadBuilder.d.ts +0 -9
  106. package/dist/main/packages/StreamDownloadBuilder.d.ts.map +0 -1
  107. package/dist/main/packages/StreamDownloadBuilder.js +0 -35
  108. package/dist/main/packages/StreamDownloadBuilder.js.map +0 -1
  109. package/dist/module/StorageClient.d.ts +0 -64
  110. package/dist/module/StorageClient.d.ts.map +0 -1
  111. package/dist/module/StorageClient.js +0 -69
  112. package/dist/module/StorageClient.js.map +0 -1
  113. package/dist/module/index.d.ts +0 -7
  114. package/dist/module/index.d.ts.map +0 -1
  115. package/dist/module/index.js +0 -6
  116. package/dist/module/index.js.map +0 -1
  117. package/dist/module/lib/constants.d.ts +0 -4
  118. package/dist/module/lib/constants.d.ts.map +0 -1
  119. package/dist/module/lib/constants.js +0 -5
  120. package/dist/module/lib/constants.js.map +0 -1
  121. package/dist/module/lib/errors.d.ts +0 -21
  122. package/dist/module/lib/errors.d.ts.map +0 -1
  123. package/dist/module/lib/errors.js +0 -34
  124. package/dist/module/lib/errors.js.map +0 -1
  125. package/dist/module/lib/fetch.d.ts +0 -16
  126. package/dist/module/lib/fetch.d.ts.map +0 -1
  127. package/dist/module/lib/fetch.js +0 -88
  128. package/dist/module/lib/fetch.js.map +0 -1
  129. package/dist/module/lib/helpers.d.ts +0 -28
  130. package/dist/module/lib/helpers.d.ts.map +0 -1
  131. package/dist/module/lib/helpers.js +0 -79
  132. package/dist/module/lib/helpers.js.map +0 -1
  133. package/dist/module/lib/index.d.ts +0 -6
  134. package/dist/module/lib/index.d.ts.map +0 -1
  135. package/dist/module/lib/index.js +0 -6
  136. package/dist/module/lib/index.js.map +0 -1
  137. package/dist/module/lib/types.d.ts +0 -226
  138. package/dist/module/lib/types.d.ts.map +0 -1
  139. package/dist/module/lib/types.js +0 -2
  140. package/dist/module/lib/types.js.map +0 -1
  141. package/dist/module/lib/vectors/StorageVectorsClient.d.ts +0 -505
  142. package/dist/module/lib/vectors/StorageVectorsClient.d.ts.map +0 -1
  143. package/dist/module/lib/vectors/StorageVectorsClient.js +0 -576
  144. package/dist/module/lib/vectors/StorageVectorsClient.js.map +0 -1
  145. package/dist/module/lib/vectors/VectorBucketApi.d.ts +0 -32
  146. package/dist/module/lib/vectors/VectorBucketApi.d.ts.map +0 -1
  147. package/dist/module/lib/vectors/VectorBucketApi.js +0 -99
  148. package/dist/module/lib/vectors/VectorBucketApi.js.map +0 -1
  149. package/dist/module/lib/vectors/VectorDataApi.d.ts +0 -32
  150. package/dist/module/lib/vectors/VectorDataApi.d.ts.map +0 -1
  151. package/dist/module/lib/vectors/VectorDataApi.js +0 -144
  152. package/dist/module/lib/vectors/VectorDataApi.js.map +0 -1
  153. package/dist/module/lib/vectors/VectorIndexApi.d.ts +0 -47
  154. package/dist/module/lib/vectors/VectorIndexApi.d.ts.map +0 -1
  155. package/dist/module/lib/vectors/VectorIndexApi.js +0 -101
  156. package/dist/module/lib/vectors/VectorIndexApi.js.map +0 -1
  157. package/dist/module/lib/vectors/constants.d.ts +0 -5
  158. package/dist/module/lib/vectors/constants.d.ts.map +0 -1
  159. package/dist/module/lib/vectors/constants.js +0 -6
  160. package/dist/module/lib/vectors/constants.js.map +0 -1
  161. package/dist/module/lib/vectors/errors.d.ts +0 -55
  162. package/dist/module/lib/vectors/errors.d.ts.map +0 -1
  163. package/dist/module/lib/vectors/errors.js +0 -69
  164. package/dist/module/lib/vectors/errors.js.map +0 -1
  165. package/dist/module/lib/vectors/fetch.d.ts +0 -57
  166. package/dist/module/lib/vectors/fetch.d.ts.map +0 -1
  167. package/dist/module/lib/vectors/fetch.js +0 -161
  168. package/dist/module/lib/vectors/fetch.js.map +0 -1
  169. package/dist/module/lib/vectors/helpers.d.ts +0 -46
  170. package/dist/module/lib/vectors/helpers.d.ts.map +0 -1
  171. package/dist/module/lib/vectors/helpers.js +0 -66
  172. package/dist/module/lib/vectors/helpers.js.map +0 -1
  173. package/dist/module/lib/vectors/index.d.ts +0 -11
  174. package/dist/module/lib/vectors/index.d.ts.map +0 -1
  175. package/dist/module/lib/vectors/index.js +0 -11
  176. package/dist/module/lib/vectors/index.js.map +0 -1
  177. package/dist/module/lib/vectors/types.d.ts +0 -279
  178. package/dist/module/lib/vectors/types.d.ts.map +0 -1
  179. package/dist/module/lib/vectors/types.js +0 -2
  180. package/dist/module/lib/vectors/types.js.map +0 -1
  181. package/dist/module/lib/version.d.ts +0 -2
  182. package/dist/module/lib/version.d.ts.map +0 -1
  183. package/dist/module/lib/version.js +0 -8
  184. package/dist/module/lib/version.js.map +0 -1
  185. package/dist/module/packages/BlobDownloadBuilder.d.ts +0 -16
  186. package/dist/module/packages/BlobDownloadBuilder.d.ts.map +0 -1
  187. package/dist/module/packages/BlobDownloadBuilder.js +0 -53
  188. package/dist/module/packages/BlobDownloadBuilder.js.map +0 -1
  189. package/dist/module/packages/StorageAnalyticsClient.d.ts +0 -324
  190. package/dist/module/packages/StorageAnalyticsClient.d.ts.map +0 -1
  191. package/dist/module/packages/StorageAnalyticsClient.js +0 -392
  192. package/dist/module/packages/StorageAnalyticsClient.js.map +0 -1
  193. package/dist/module/packages/StorageBucketApi.d.ts +0 -266
  194. package/dist/module/packages/StorageBucketApi.d.ts.map +0 -1
  195. package/dist/module/packages/StorageBucketApi.js +0 -359
  196. package/dist/module/packages/StorageBucketApi.js.map +0 -1
  197. package/dist/module/packages/StorageFileApi.d.ts +0 -680
  198. package/dist/module/packages/StorageFileApi.d.ts.map +0 -1
  199. package/dist/module/packages/StorageFileApi.js +0 -999
  200. package/dist/module/packages/StorageFileApi.js.map +0 -1
  201. package/dist/module/packages/StreamDownloadBuilder.d.ts +0 -9
  202. package/dist/module/packages/StreamDownloadBuilder.d.ts.map +0 -1
  203. package/dist/module/packages/StreamDownloadBuilder.js +0 -32
  204. package/dist/module/packages/StreamDownloadBuilder.js.map +0 -1
  205. package/dist/tsconfig.module.tsbuildinfo +0 -1
  206. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const constants_1 = require("./constants");
5
- const errors_1 = require("./errors");
6
- const fetch_1 = require("./fetch");
7
- const helpers_1 = require("./helpers");
8
- /**
9
- * @hidden
10
- * Base implementation for vector bucket operations.
11
- * Use {@link StorageVectorsClient} via `supabase.storage.vectors` instead.
12
- */
13
- class VectorBucketApi {
14
- /** Creates a new VectorBucketApi instance */
15
- constructor(url, headers = {}, fetch) {
16
- this.shouldThrowOnError = false;
17
- this.url = url.replace(/\/$/, '');
18
- this.headers = Object.assign(Object.assign({}, constants_1.DEFAULT_HEADERS), headers);
19
- this.fetch = (0, helpers_1.resolveFetch)(fetch);
20
- }
21
- /** Enable throwing errors instead of returning them in the response */
22
- throwOnError() {
23
- this.shouldThrowOnError = true;
24
- return this;
25
- }
26
- /** Creates a new vector bucket */
27
- createBucket(vectorBucketName) {
28
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
29
- try {
30
- const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: this.headers });
31
- return { data: data || {}, error: null };
32
- }
33
- catch (error) {
34
- if (this.shouldThrowOnError) {
35
- throw error;
36
- }
37
- if ((0, errors_1.isStorageVectorsError)(error)) {
38
- return { data: null, error };
39
- }
40
- throw error;
41
- }
42
- });
43
- }
44
- /** Retrieves metadata for a specific vector bucket */
45
- getBucket(vectorBucketName) {
46
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
47
- try {
48
- const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/GetVectorBucket`, { vectorBucketName }, { headers: this.headers });
49
- return { data, error: null };
50
- }
51
- catch (error) {
52
- if (this.shouldThrowOnError) {
53
- throw error;
54
- }
55
- if ((0, errors_1.isStorageVectorsError)(error)) {
56
- return { data: null, error };
57
- }
58
- throw error;
59
- }
60
- });
61
- }
62
- /** Lists vector buckets with optional filtering and pagination */
63
- listBuckets() {
64
- return tslib_1.__awaiter(this, arguments, void 0, function* (options = {}) {
65
- try {
66
- const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/ListVectorBuckets`, options, {
67
- headers: this.headers,
68
- });
69
- return { data, error: null };
70
- }
71
- catch (error) {
72
- if (this.shouldThrowOnError) {
73
- throw error;
74
- }
75
- if ((0, errors_1.isStorageVectorsError)(error)) {
76
- return { data: null, error };
77
- }
78
- throw error;
79
- }
80
- });
81
- }
82
- /** Deletes a vector bucket (must be empty first) */
83
- deleteBucket(vectorBucketName) {
84
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
85
- try {
86
- const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: this.headers });
87
- return { data: data || {}, error: null };
88
- }
89
- catch (error) {
90
- if (this.shouldThrowOnError) {
91
- throw error;
92
- }
93
- if ((0, errors_1.isStorageVectorsError)(error)) {
94
- return { data: null, error };
95
- }
96
- throw error;
97
- }
98
- });
99
- }
100
- }
101
- exports.default = VectorBucketApi;
102
- //# sourceMappingURL=VectorBucketApi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VectorBucketApi.js","sourceRoot":"","sources":["../../../../src/lib/vectors/VectorBucketApi.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAC7C,qCAAgD;AAChD,mCAAqC;AACrC,uCAAwC;AAQxC;;;;GAIG;AACH,MAAqB,eAAe;IAMlC,6CAA6C;IAC7C,YAAY,GAAW,EAAE,UAAqC,EAAE,EAAE,KAAa;QAHrE,uBAAkB,GAAG,KAAK,CAAA;QAIlC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QACjC,IAAI,CAAC,OAAO,mCAAQ,2BAAe,GAAK,OAAO,CAAE,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,IAAA,sBAAY,EAAC,KAAK,CAAC,CAAA;IAClC,CAAC;IAED,uEAAuE;IAChE,YAAY;QACjB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAA;QAC9B,OAAO,IA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E,KAAK,EAAE,CAAA;gBAC9B,CAAC;gBACD,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC;KAAA;CACF;AArGD,kCAqGC"}
@@ -1,32 +0,0 @@
1
- import { Fetch } from './fetch';
2
- import { ApiResponse, PutVectorsOptions, GetVectorsOptions, GetVectorsResponse, DeleteVectorsOptions, ListVectorsOptions, ListVectorsResponse, QueryVectorsOptions, QueryVectorsResponse } from './types';
3
- /**
4
- * @hidden
5
- * Base implementation for vector data operations.
6
- * Use {@link VectorIndexScope} via `supabase.storage.vectors.from('bucket').index('idx')` instead.
7
- */
8
- export default class VectorDataApi {
9
- protected url: string;
10
- protected headers: {
11
- [key: string]: string;
12
- };
13
- protected fetch: Fetch;
14
- protected shouldThrowOnError: boolean;
15
- /** Creates a new VectorDataApi instance */
16
- constructor(url: string, headers?: {
17
- [key: string]: string;
18
- }, fetch?: Fetch);
19
- /** Enable throwing errors instead of returning them in the response */
20
- throwOnError(): this;
21
- /** Inserts or updates vectors in batch (1-500 per request) */
22
- putVectors(options: PutVectorsOptions): Promise<ApiResponse<undefined>>;
23
- /** Retrieves vectors by their keys in batch */
24
- getVectors(options: GetVectorsOptions): Promise<ApiResponse<GetVectorsResponse>>;
25
- /** Lists vectors in an index with pagination */
26
- listVectors(options: ListVectorsOptions): Promise<ApiResponse<ListVectorsResponse>>;
27
- /** Queries for similar vectors using approximate nearest neighbor search */
28
- queryVectors(options: QueryVectorsOptions): Promise<ApiResponse<QueryVectorsResponse>>;
29
- /** Deletes vectors by their keys in batch (1-500 per request) */
30
- deleteVectors(options: DeleteVectorsOptions): Promise<ApiResponse<undefined>>;
31
- }
32
- //# sourceMappingURL=VectorDataApi.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VectorDataApi.d.ts","sourceRoot":"","sources":["../../../../src/lib/vectors/VectorDataApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAQ,MAAM,SAAS,CAAA;AAErC,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAEhB;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IAC5C,SAAS,CAAC,KAAK,EAAE,KAAK,CAAA;IACtB,SAAS,CAAC,kBAAkB,UAAQ;IAEpC,2CAA2C;gBAC/B,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,EAAE,KAAK,CAAC,EAAE,KAAK;IAM/E,uEAAuE;IAChE,YAAY,IAAI,IAAI;IAK3B,8DAA8D;IACxD,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAsB7E,+CAA+C;IACzC,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAiBtF,gDAAgD;IAC1C,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IA6BzF,4EAA4E;IACtE,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;IAiB5F,iEAAiE;IAC3D,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;CAqBpF"}
@@ -1,147 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const constants_1 = require("./constants");
5
- const errors_1 = require("./errors");
6
- const fetch_1 = require("./fetch");
7
- const helpers_1 = require("./helpers");
8
- /**
9
- * @hidden
10
- * Base implementation for vector data operations.
11
- * Use {@link VectorIndexScope} via `supabase.storage.vectors.from('bucket').index('idx')` instead.
12
- */
13
- class VectorDataApi {
14
- /** Creates a new VectorDataApi instance */
15
- constructor(url, headers = {}, fetch) {
16
- this.shouldThrowOnError = false;
17
- this.url = url.replace(/\/$/, '');
18
- this.headers = Object.assign(Object.assign({}, constants_1.DEFAULT_HEADERS), headers);
19
- this.fetch = (0, helpers_1.resolveFetch)(fetch);
20
- }
21
- /** Enable throwing errors instead of returning them in the response */
22
- throwOnError() {
23
- this.shouldThrowOnError = true;
24
- return this;
25
- }
26
- /** Inserts or updates vectors in batch (1-500 per request) */
27
- putVectors(options) {
28
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
29
- try {
30
- // Validate batch size
31
- if (options.vectors.length < 1 || options.vectors.length > 500) {
32
- throw new Error('Vector batch size must be between 1 and 500 items');
33
- }
34
- const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/PutVectors`, options, {
35
- headers: this.headers,
36
- });
37
- return { data: data || {}, error: null };
38
- }
39
- catch (error) {
40
- if (this.shouldThrowOnError) {
41
- throw error;
42
- }
43
- if ((0, errors_1.isStorageVectorsError)(error)) {
44
- return { data: null, error };
45
- }
46
- throw error;
47
- }
48
- });
49
- }
50
- /** Retrieves vectors by their keys in batch */
51
- getVectors(options) {
52
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
53
- try {
54
- const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/GetVectors`, options, {
55
- headers: this.headers,
56
- });
57
- return { data, error: null };
58
- }
59
- catch (error) {
60
- if (this.shouldThrowOnError) {
61
- throw error;
62
- }
63
- if ((0, errors_1.isStorageVectorsError)(error)) {
64
- return { data: null, error };
65
- }
66
- throw error;
67
- }
68
- });
69
- }
70
- /** Lists vectors in an index with pagination */
71
- listVectors(options) {
72
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
73
- try {
74
- // Validate segment configuration
75
- if (options.segmentCount !== undefined) {
76
- if (options.segmentCount < 1 || options.segmentCount > 16) {
77
- throw new Error('segmentCount must be between 1 and 16');
78
- }
79
- if (options.segmentIndex !== undefined) {
80
- if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) {
81
- throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`);
82
- }
83
- }
84
- }
85
- const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/ListVectors`, options, {
86
- headers: this.headers,
87
- });
88
- return { data, error: null };
89
- }
90
- catch (error) {
91
- if (this.shouldThrowOnError) {
92
- throw error;
93
- }
94
- if ((0, errors_1.isStorageVectorsError)(error)) {
95
- return { data: null, error };
96
- }
97
- throw error;
98
- }
99
- });
100
- }
101
- /** Queries for similar vectors using approximate nearest neighbor search */
102
- queryVectors(options) {
103
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
104
- try {
105
- const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/QueryVectors`, options, {
106
- headers: this.headers,
107
- });
108
- return { data, error: null };
109
- }
110
- catch (error) {
111
- if (this.shouldThrowOnError) {
112
- throw error;
113
- }
114
- if ((0, errors_1.isStorageVectorsError)(error)) {
115
- return { data: null, error };
116
- }
117
- throw error;
118
- }
119
- });
120
- }
121
- /** Deletes vectors by their keys in batch (1-500 per request) */
122
- deleteVectors(options) {
123
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
124
- try {
125
- // Validate batch size
126
- if (options.keys.length < 1 || options.keys.length > 500) {
127
- throw new Error('Keys batch size must be between 1 and 500 items');
128
- }
129
- const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/DeleteVectors`, options, {
130
- headers: this.headers,
131
- });
132
- return { data: data || {}, error: null };
133
- }
134
- catch (error) {
135
- if (this.shouldThrowOnError) {
136
- throw error;
137
- }
138
- if ((0, errors_1.isStorageVectorsError)(error)) {
139
- return { data: null, error };
140
- }
141
- throw error;
142
- }
143
- });
144
- }
145
- }
146
- exports.default = VectorDataApi;
147
- //# sourceMappingURL=VectorDataApi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VectorDataApi.js","sourceRoot":"","sources":["../../../../src/lib/vectors/VectorDataApi.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAC7C,qCAAgD;AAChD,mCAAqC;AACrC,uCAAwC;AAaxC;;;;GAIG;AACH,MAAqB,aAAa;IAMhC,2CAA2C;IAC3C,YAAY,GAAW,EAAE,UAAqC,EAAE,EAAE,KAAa;QAHrE,uBAAkB,GAAG,KAAK,CAAA;QAIlC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QACjC,IAAI,CAAC,OAAO,mCAAQ,2BAAe,GAAK,OAAO,CAAE,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,IAAA,sBAAY,EAAC,KAAK,CAAC,CAAA;IAClC,CAAC;IAED,uEAAuE;IAChE,YAAY;QACjB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAA;QAC9B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,8DAA8D;IACxD,UAAU,CAAC,OAA0B;;YACzC,IAAI,CAAC;gBACH,sBAAsB;gBACtB,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;oBAC/D,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAA;gBACtE,CAAC;gBAED,MAAM,IAAI,GAAG,MAAM,IAAA,YAAI,EAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,aAAa,EAAE,OAAO,EAAE;oBACrE,OAAO,EAAE,IAAI,CAAC,OAAO;iBACtB,CAAC,CAAA;gBACF,OAAO,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;YAC1C,CAAC;YA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AqB,EAAC,KAAK,CAAC,EAAE,CAAC;oBACjC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;gBAC9B,CAAC;gBACD,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC;KAAA;IAED,iEAAiE;IAC3D,aAAa,CAAC,OAA6B;;YAC/C,IAAI,CAAC;gBACH,sBAAsB;gBACtB,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;oBACzD,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAA;gBACpE,CAAC;gBAED,MAAM,IAAI,GAAG,MAAM,IAAA,YAAI,EAAC,IAAI,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,gBAAgB,EAAE,OAAO,EAAE;oBACxE,OAAO,EAAE,IAAI,CAAC,OAAO;iBACtB,CAAC,CAAA;gBACF,OAAO,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;YAC1C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;oBAC5B,MAAM,KAAK,CAAA;gBACb,CAAC;gBACD,IAAI,IAAA,8BAAqB,EAAC,KAAK,CAAC,EAAE,CAAC;oBACjC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;gBAC9B,CAAC;gBACD,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC;KAAA;CACF;AAlID,gCAkIC"}
@@ -1,47 +0,0 @@
1
- import { Fetch } from './fetch';
2
- import { ApiResponse, VectorIndex, ListIndexesOptions, ListIndexesResponse, VectorDataType, DistanceMetric, MetadataConfiguration } from './types';
3
- /**
4
- * @alpha
5
- *
6
- * Options for creating a vector index
7
- *
8
- * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
9
- */
10
- export interface CreateIndexOptions {
11
- vectorBucketName: string;
12
- indexName: string;
13
- dataType: VectorDataType;
14
- dimension: number;
15
- distanceMetric: DistanceMetric;
16
- metadataConfiguration?: MetadataConfiguration;
17
- }
18
- /**
19
- * @hidden
20
- * Base implementation for vector index operations.
21
- * Use {@link VectorBucketScope} via `supabase.storage.vectors.from('bucket')` instead.
22
- */
23
- export default class VectorIndexApi {
24
- protected url: string;
25
- protected headers: {
26
- [key: string]: string;
27
- };
28
- protected fetch: Fetch;
29
- protected shouldThrowOnError: boolean;
30
- /** Creates a new VectorIndexApi instance */
31
- constructor(url: string, headers?: {
32
- [key: string]: string;
33
- }, fetch?: Fetch);
34
- /** Enable throwing errors instead of returning them in the response */
35
- throwOnError(): this;
36
- /** Creates a new vector index within a bucket */
37
- createIndex(options: CreateIndexOptions): Promise<ApiResponse<undefined>>;
38
- /** Retrieves metadata for a specific vector index */
39
- getIndex(vectorBucketName: string, indexName: string): Promise<ApiResponse<{
40
- index: VectorIndex;
41
- }>>;
42
- /** Lists vector indexes within a bucket with optional filtering and pagination */
43
- listIndexes(options: ListIndexesOptions): Promise<ApiResponse<ListIndexesResponse>>;
44
- /** Deletes a vector index and all its data */
45
- deleteIndex(vectorBucketName: string, indexName: string): Promise<ApiResponse<undefined>>;
46
- }
47
- //# sourceMappingURL=VectorIndexApi.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VectorIndexApi.d.ts","sourceRoot":"","sources":["../../../../src/lib/vectors/VectorIndexApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAQ,MAAM,SAAS,CAAA;AAErC,OAAO,EACL,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAEhB;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,cAAc,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,cAAc,CAAA;IAC9B,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;CAC9C;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IAC5C,SAAS,CAAC,KAAK,EAAE,KAAK,CAAA;IACtB,SAAS,CAAC,kBAAkB,UAAQ;IAEpC,4CAA4C;gBAChC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,EAAE,KAAK,CAAC,EAAE,KAAK;IAM/E,uEAAuE;IAChE,YAAY,IAAI,IAAI;IAK3B,iDAAiD;IAC3C,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAiB/E,qDAAqD;IAC/C,QAAQ,CACZ,gBAAgB,EAAE,MAAM,EACxB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,CAAC;QAAE,KAAK,EAAE,WAAW,CAAA;KAAE,CAAC,CAAC;IAoB/C,kFAAkF;IAC5E,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAiBzF,8CAA8C;IACxC,WAAW,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;CAmBhG"}
@@ -1,104 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const constants_1 = require("./constants");
5
- const errors_1 = require("./errors");
6
- const fetch_1 = require("./fetch");
7
- const helpers_1 = require("./helpers");
8
- /**
9
- * @hidden
10
- * Base implementation for vector index operations.
11
- * Use {@link VectorBucketScope} via `supabase.storage.vectors.from('bucket')` instead.
12
- */
13
- class VectorIndexApi {
14
- /** Creates a new VectorIndexApi instance */
15
- constructor(url, headers = {}, fetch) {
16
- this.shouldThrowOnError = false;
17
- this.url = url.replace(/\/$/, '');
18
- this.headers = Object.assign(Object.assign({}, constants_1.DEFAULT_HEADERS), headers);
19
- this.fetch = (0, helpers_1.resolveFetch)(fetch);
20
- }
21
- /** Enable throwing errors instead of returning them in the response */
22
- throwOnError() {
23
- this.shouldThrowOnError = true;
24
- return this;
25
- }
26
- /** Creates a new vector index within a bucket */
27
- createIndex(options) {
28
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
29
- try {
30
- const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/CreateIndex`, options, {
31
- headers: this.headers,
32
- });
33
- return { data: data || {}, error: null };
34
- }
35
- catch (error) {
36
- if (this.shouldThrowOnError) {
37
- throw error;
38
- }
39
- if ((0, errors_1.isStorageVectorsError)(error)) {
40
- return { data: null, error };
41
- }
42
- throw error;
43
- }
44
- });
45
- }
46
- /** Retrieves metadata for a specific vector index */
47
- getIndex(vectorBucketName, indexName) {
48
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
49
- try {
50
- const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/GetIndex`, { vectorBucketName, indexName }, { headers: this.headers });
51
- return { data, error: null };
52
- }
53
- catch (error) {
54
- if (this.shouldThrowOnError) {
55
- throw error;
56
- }
57
- if ((0, errors_1.isStorageVectorsError)(error)) {
58
- return { data: null, error };
59
- }
60
- throw error;
61
- }
62
- });
63
- }
64
- /** Lists vector indexes within a bucket with optional filtering and pagination */
65
- listIndexes(options) {
66
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
67
- try {
68
- const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/ListIndexes`, options, {
69
- headers: this.headers,
70
- });
71
- return { data, error: null };
72
- }
73
- catch (error) {
74
- if (this.shouldThrowOnError) {
75
- throw error;
76
- }
77
- if ((0, errors_1.isStorageVectorsError)(error)) {
78
- return { data: null, error };
79
- }
80
- throw error;
81
- }
82
- });
83
- }
84
- /** Deletes a vector index and all its data */
85
- deleteIndex(vectorBucketName, indexName) {
86
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
87
- try {
88
- const data = yield (0, fetch_1.post)(this.fetch, `${this.url}/DeleteIndex`, { vectorBucketName, indexName }, { headers: this.headers });
89
- return { data: data || {}, error: null };
90
- }
91
- catch (error) {
92
- if (this.shouldThrowOnError) {
93
- throw error;
94
- }
95
- if ((0, errors_1.isStorageVectorsError)(error)) {
96
- return { data: null, error };
97
- }
98
- throw error;
99
- }
100
- });
101
- }
102
- }
103
- exports.default = VectorIndexApi;
104
- //# sourceMappingURL=VectorIndexApi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"VectorIndexApi.js","sourceRoot":"","sources":["../../../../src/lib/vectors/VectorIndexApi.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAC7C,qCAAgD;AAChD,mCAAqC;AACrC,uCAAwC;AA2BxC;;;;GAIG;AACH,MAAqB,cAAc;IAMjC,4CAA4C;IAC5C,YAAY,GAAW,EAAE,UAAqC,EAAE,EAAE,KAAa;QAHrE,uBAAkB,GAAG,KAAK,CAAA;QAIlC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QACjC,IAAI,CAAC,OAAO,mCAAQ,2BAAe,GAAK,OAAO,CAAE,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,IAAA,sBAAY,EAAC,KAAK,CAAC,CAAA;IAClC,CAAC;IAED,uEAAuE;IAChE,YAAY;QACjB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAA;QAC9B,OAAO,IAAI,CAAA;IACb,CAAC;IAED,iDAAiD;IAC3C,WAAW,CAAC,OAA2B;;YAC3C,IAAI,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KAAK,CAAA;YACb,CAAC;QACH,CAAC;KAAA;CACF;AAnGD,iCAmGC"}
@@ -1,5 +0,0 @@
1
- export declare const DEFAULT_HEADERS: {
2
- 'X-Client-Info': string;
3
- 'Content-Type': string;
4
- };
5
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/lib/vectors/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,eAAe;;;CAG3B,CAAA"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_HEADERS = void 0;
4
- const version_1 = require("../version");
5
- exports.DEFAULT_HEADERS = {
6
- 'X-Client-Info': `storage-js/${version_1.version}`,
7
- 'Content-Type': 'application/json',
8
- };
9
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/lib/vectors/constants.ts"],"names":[],"mappings":";;;AAAA,wCAAoC;AACvB,QAAA,eAAe,GAAG;IAC7B,eAAe,EAAE,cAAc,iBAAO,EAAE;IACxC,cAAc,EAAE,kBAAkB;CACnC,CAAA"}
@@ -1,55 +0,0 @@
1
- /**
2
- * Base error class for all Storage Vectors errors
3
- */
4
- export declare class StorageVectorsError extends Error {
5
- protected __isStorageVectorsError: boolean;
6
- constructor(message: string);
7
- }
8
- /**
9
- * Type guard to check if an error is a StorageVectorsError
10
- * @param error - The error to check
11
- * @returns True if the error is a StorageVectorsError
12
- */
13
- export declare function isStorageVectorsError(error: unknown): error is StorageVectorsError;
14
- /**
15
- * API error returned from S3 Vectors service
16
- * Includes HTTP status code and service-specific error code
17
- */
18
- export declare class StorageVectorsApiError extends StorageVectorsError {
19
- status: number;
20
- statusCode: string;
21
- constructor(message: string, status: number, statusCode: string);
22
- toJSON(): {
23
- name: string;
24
- message: string;
25
- status: number;
26
- statusCode: string;
27
- };
28
- }
29
- /**
30
- * Unknown error that doesn't match expected error patterns
31
- * Wraps the original error for debugging
32
- */
33
- export declare class StorageVectorsUnknownError extends StorageVectorsError {
34
- originalError: unknown;
35
- constructor(message: string, originalError: unknown);
36
- }
37
- /**
38
- * Error codes specific to S3 Vectors API
39
- * Maps AWS service errors to application-friendly error codes
40
- */
41
- export declare enum StorageVectorsErrorCode {
42
- /** Internal server fault (HTTP 500) */
43
- InternalError = "InternalError",
44
- /** Resource already exists / conflict (HTTP 409) */
45
- S3VectorConflictException = "S3VectorConflictException",
46
- /** Resource not found (HTTP 404) */
47
- S3VectorNotFoundException = "S3VectorNotFoundException",
48
- /** Delete bucket while not empty (HTTP 400) */
49
- S3VectorBucketNotEmpty = "S3VectorBucketNotEmpty",
50
- /** Exceeds bucket quota/limit (HTTP 400) */
51
- S3VectorMaxBucketsExceeded = "S3VectorMaxBucketsExceeded",
52
- /** Exceeds index quota/limit (HTTP 400) */
53
- S3VectorMaxIndexesExceeded = "S3VectorMaxIndexesExceeded"
54
- }
55
- //# sourceMappingURL=errors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/lib/vectors/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,SAAS,CAAC,uBAAuB,UAAO;gBAE5B,OAAO,EAAE,MAAM;CAI5B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAElF;AAED;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,mBAAmB;IAC7D,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;gBAEN,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAO/D,MAAM;;;;;;CAQP;AAED;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,mBAAmB;IACjE,aAAa,EAAE,OAAO,CAAA;gBAEV,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO;CAKpD;AAED;;;GAGG;AACH,oBAAY,uBAAuB;IACjC,uCAAuC;IACvC,aAAa,kBAAkB;IAC/B,oDAAoD;IACpD,yBAAyB,8BAA8B;IACvD,oCAAoC;IACpC,yBAAyB,8BAA8B;IACvD,+CAA+C;IAC/C,sBAAsB,2BAA2B;IACjD,4CAA4C;IAC5C,0BAA0B,+BAA+B;IACzD,2CAA2C;IAC3C,0BAA0B,+BAA+B;CAC1D"}
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StorageVectorsErrorCode = exports.StorageVectorsUnknownError = exports.StorageVectorsApiError = exports.StorageVectorsError = void 0;
4
- exports.isStorageVectorsError = isStorageVectorsError;
5
- /**
6
- * Base error class for all Storage Vectors errors
7
- */
8
- class StorageVectorsError extends Error {
9
- constructor(message) {
10
- super(message);
11
- this.__isStorageVectorsError = true;
12
- this.name = 'StorageVectorsError';
13
- }
14
- }
15
- exports.StorageVectorsError = StorageVectorsError;
16
- /**
17
- * Type guard to check if an error is a StorageVectorsError
18
- * @param error - The error to check
19
- * @returns True if the error is a StorageVectorsError
20
- */
21
- function isStorageVectorsError(error) {
22
- return typeof error === 'object' && error !== null && '__isStorageVectorsError' in error;
23
- }
24
- /**
25
- * API error returned from S3 Vectors service
26
- * Includes HTTP status code and service-specific error code
27
- */
28
- class StorageVectorsApiError extends StorageVectorsError {
29
- constructor(message, status, statusCode) {
30
- super(message);
31
- this.name = 'StorageVectorsApiError';
32
- this.status = status;
33
- this.statusCode = statusCode;
34
- }
35
- toJSON() {
36
- return {
37
- name: this.name,
38
- message: this.message,
39
- status: this.status,
40
- statusCode: this.statusCode,
41
- };
42
- }
43
- }
44
- exports.StorageVectorsApiError = StorageVectorsApiError;
45
- /**
46
- * Unknown error that doesn't match expected error patterns
47
- * Wraps the original error for debugging
48
- */
49
- class StorageVectorsUnknownError extends StorageVectorsError {
50
- constructor(message, originalError) {
51
- super(message);
52
- this.name = 'StorageVectorsUnknownError';
53
- this.originalError = originalError;
54
- }
55
- }
56
- exports.StorageVectorsUnknownError = StorageVectorsUnknownError;
57
- /**
58
- * Error codes specific to S3 Vectors API
59
- * Maps AWS service errors to application-friendly error codes
60
- */
61
- var StorageVectorsErrorCode;
62
- (function (StorageVectorsErrorCode) {
63
- /** Internal server fault (HTTP 500) */
64
- StorageVectorsErrorCode["InternalError"] = "InternalError";
65
- /** Resource already exists / conflict (HTTP 409) */
66
- StorageVectorsErrorCode["S3VectorConflictException"] = "S3VectorConflictException";
67
- /** Resource not found (HTTP 404) */
68
- StorageVectorsErrorCode["S3VectorNotFoundException"] = "S3VectorNotFoundException";
69
- /** Delete bucket while not empty (HTTP 400) */
70
- StorageVectorsErrorCode["S3VectorBucketNotEmpty"] = "S3VectorBucketNotEmpty";
71
- /** Exceeds bucket quota/limit (HTTP 400) */
72
- StorageVectorsErrorCode["S3VectorMaxBucketsExceeded"] = "S3VectorMaxBucketsExceeded";
73
- /** Exceeds index quota/limit (HTTP 400) */
74
- StorageVectorsErrorCode["S3VectorMaxIndexesExceeded"] = "S3VectorMaxIndexesExceeded";
75
- })(StorageVectorsErrorCode || (exports.StorageVectorsErrorCode = StorageVectorsErrorCode = {}));
76
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/lib/vectors/errors.ts"],"names":[],"mappings":";;;AAiBA,sDAEC;AAnBD;;GAEG;AACH,MAAa,mBAAoB,SAAQ,KAAK;IAG5C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QAHN,4BAAuB,GAAG,IAAI,CAAA;QAItC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC;CACF;AAPD,kDAOC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,KAAc;IAClD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI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