@supabase/storage-js 2.79.1-canary.1 → 2.80.0

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 (197) hide show
  1. package/README.md +920 -12
  2. package/dist/main/StorageClient.d.ts +28 -0
  3. package/dist/main/StorageClient.d.ts.map +1 -1
  4. package/dist/main/StorageClient.js +38 -5
  5. package/dist/main/StorageClient.js.map +1 -1
  6. package/dist/main/index.d.ts +2 -0
  7. package/dist/main/index.d.ts.map +1 -1
  8. package/dist/main/index.js +7 -17
  9. package/dist/main/index.js.map +1 -1
  10. package/dist/main/lib/constants.d.ts.map +1 -1
  11. package/dist/main/lib/constants.js +3 -1
  12. package/dist/main/lib/constants.js.map +1 -1
  13. package/dist/main/lib/fetch.d.ts.map +1 -1
  14. package/dist/main/lib/fetch.js +16 -17
  15. package/dist/main/lib/fetch.js.map +1 -1
  16. package/dist/main/lib/helpers.d.ts +1 -1
  17. package/dist/main/lib/helpers.d.ts.map +1 -1
  18. package/dist/main/lib/helpers.js +4 -57
  19. package/dist/main/lib/helpers.js.map +1 -1
  20. package/dist/main/lib/index.d.ts +1 -0
  21. package/dist/main/lib/index.d.ts.map +1 -1
  22. package/dist/main/lib/index.js +6 -18
  23. package/dist/main/lib/index.js.map +1 -1
  24. package/dist/main/lib/types.d.ts +74 -4
  25. package/dist/main/lib/types.d.ts.map +1 -1
  26. package/dist/main/lib/vectors/StorageVectorsClient.d.ts +310 -0
  27. package/dist/main/lib/vectors/StorageVectorsClient.d.ts.map +1 -0
  28. package/dist/main/lib/vectors/StorageVectorsClient.js +366 -0
  29. package/dist/main/lib/vectors/StorageVectorsClient.js.map +1 -0
  30. package/dist/main/lib/vectors/VectorBucketApi.d.ts +129 -0
  31. package/dist/main/lib/vectors/VectorBucketApi.d.ts.map +1 -0
  32. package/dist/main/lib/vectors/VectorBucketApi.js +199 -0
  33. package/dist/main/lib/vectors/VectorBucketApi.js.map +1 -0
  34. package/dist/main/lib/vectors/VectorDataApi.d.ts +221 -0
  35. package/dist/main/lib/vectors/VectorDataApi.d.ts.map +1 -0
  36. package/dist/main/lib/vectors/VectorDataApi.js +336 -0
  37. package/dist/main/lib/vectors/VectorDataApi.js.map +1 -0
  38. package/dist/main/lib/vectors/VectorIndexApi.d.ts +157 -0
  39. package/dist/main/lib/vectors/VectorIndexApi.d.ts.map +1 -0
  40. package/dist/main/lib/vectors/VectorIndexApi.js +218 -0
  41. package/dist/main/lib/vectors/VectorIndexApi.js.map +1 -0
  42. package/dist/main/lib/vectors/constants.d.ts +5 -0
  43. package/dist/main/lib/vectors/constants.d.ts.map +1 -0
  44. package/dist/main/lib/vectors/constants.js +9 -0
  45. package/dist/main/lib/vectors/constants.js.map +1 -0
  46. package/dist/main/lib/vectors/errors.d.ts +55 -0
  47. package/dist/main/lib/vectors/errors.d.ts.map +1 -0
  48. package/dist/main/lib/vectors/errors.js +76 -0
  49. package/dist/main/lib/vectors/errors.js.map +1 -0
  50. package/dist/main/lib/vectors/fetch.d.ts +57 -0
  51. package/dist/main/lib/vectors/fetch.d.ts.map +1 -0
  52. package/dist/main/lib/vectors/fetch.js +167 -0
  53. package/dist/main/lib/vectors/fetch.js.map +1 -0
  54. package/dist/main/lib/vectors/helpers.d.ts +46 -0
  55. package/dist/main/lib/vectors/helpers.d.ts.map +1 -0
  56. package/dist/main/lib/vectors/helpers.js +74 -0
  57. package/dist/main/lib/vectors/helpers.js.map +1 -0
  58. package/dist/main/lib/vectors/index.d.ts +11 -0
  59. package/dist/main/lib/vectors/index.d.ts.map +1 -0
  60. package/dist/main/lib/vectors/index.js +31 -0
  61. package/dist/main/lib/vectors/index.js.map +1 -0
  62. package/dist/main/lib/vectors/types.d.ts +277 -0
  63. package/dist/main/lib/vectors/types.d.ts.map +1 -0
  64. package/dist/main/lib/vectors/types.js +3 -0
  65. package/dist/main/lib/vectors/types.js.map +1 -0
  66. package/dist/main/lib/version.d.ts +1 -1
  67. package/dist/main/lib/version.d.ts.map +1 -1
  68. package/dist/main/lib/version.js +1 -1
  69. package/dist/main/lib/version.js.map +1 -1
  70. package/dist/main/packages/BlobDownloadBuilder.d.ts +6 -1
  71. package/dist/main/packages/BlobDownloadBuilder.d.ts.map +1 -1
  72. package/dist/main/packages/BlobDownloadBuilder.js +20 -15
  73. package/dist/main/packages/BlobDownloadBuilder.js.map +1 -1
  74. package/dist/main/packages/StorageAnalyticsApi.d.ts +123 -0
  75. package/dist/main/packages/StorageAnalyticsApi.d.ts.map +1 -0
  76. package/dist/main/packages/StorageAnalyticsApi.js +164 -0
  77. package/dist/main/packages/StorageAnalyticsApi.js.map +1 -0
  78. package/dist/main/packages/StorageBucketApi.d.ts +3 -2
  79. package/dist/main/packages/StorageBucketApi.d.ts.map +1 -1
  80. package/dist/main/packages/StorageBucketApi.js +34 -18
  81. package/dist/main/packages/StorageBucketApi.js.map +1 -1
  82. package/dist/main/packages/StorageFileApi.d.ts.map +1 -1
  83. package/dist/main/packages/StorageFileApi.js +28 -29
  84. package/dist/main/packages/StorageFileApi.js.map +1 -1
  85. package/dist/main/packages/StreamDownloadBuilder.js +2 -10
  86. package/dist/main/packages/StreamDownloadBuilder.js.map +1 -1
  87. package/dist/module/StorageClient.d.ts +28 -0
  88. package/dist/module/StorageClient.d.ts.map +1 -1
  89. package/dist/module/StorageClient.js +35 -0
  90. package/dist/module/StorageClient.js.map +1 -1
  91. package/dist/module/index.d.ts +2 -0
  92. package/dist/module/index.d.ts.map +1 -1
  93. package/dist/module/index.js +2 -0
  94. package/dist/module/index.js.map +1 -1
  95. package/dist/module/lib/constants.d.ts.map +1 -1
  96. package/dist/module/lib/constants.js +3 -1
  97. package/dist/module/lib/constants.js.map +1 -1
  98. package/dist/module/lib/fetch.d.ts.map +1 -1
  99. package/dist/module/lib/fetch.js +9 -10
  100. package/dist/module/lib/fetch.js.map +1 -1
  101. package/dist/module/lib/helpers.d.ts +1 -1
  102. package/dist/module/lib/helpers.d.ts.map +1 -1
  103. package/dist/module/lib/helpers.js +4 -24
  104. package/dist/module/lib/helpers.js.map +1 -1
  105. package/dist/module/lib/index.d.ts +1 -0
  106. package/dist/module/lib/index.d.ts.map +1 -1
  107. package/dist/module/lib/index.js +1 -0
  108. package/dist/module/lib/index.js.map +1 -1
  109. package/dist/module/lib/types.d.ts +74 -4
  110. package/dist/module/lib/types.d.ts.map +1 -1
  111. package/dist/module/lib/vectors/StorageVectorsClient.d.ts +310 -0
  112. package/dist/module/lib/vectors/StorageVectorsClient.d.ts.map +1 -0
  113. package/dist/module/lib/vectors/StorageVectorsClient.js +360 -0
  114. package/dist/module/lib/vectors/StorageVectorsClient.js.map +1 -0
  115. package/dist/module/lib/vectors/VectorBucketApi.d.ts +129 -0
  116. package/dist/module/lib/vectors/VectorBucketApi.d.ts.map +1 -0
  117. package/dist/module/lib/vectors/VectorBucketApi.js +196 -0
  118. package/dist/module/lib/vectors/VectorBucketApi.js.map +1 -0
  119. package/dist/module/lib/vectors/VectorDataApi.d.ts +221 -0
  120. package/dist/module/lib/vectors/VectorDataApi.d.ts.map +1 -0
  121. package/dist/module/lib/vectors/VectorDataApi.js +333 -0
  122. package/dist/module/lib/vectors/VectorDataApi.js.map +1 -0
  123. package/dist/module/lib/vectors/VectorIndexApi.d.ts +157 -0
  124. package/dist/module/lib/vectors/VectorIndexApi.d.ts.map +1 -0
  125. package/dist/module/lib/vectors/VectorIndexApi.js +215 -0
  126. package/dist/module/lib/vectors/VectorIndexApi.js.map +1 -0
  127. package/dist/module/lib/vectors/constants.d.ts +5 -0
  128. package/dist/module/lib/vectors/constants.d.ts.map +1 -0
  129. package/dist/module/lib/vectors/constants.js +6 -0
  130. package/dist/module/lib/vectors/constants.js.map +1 -0
  131. package/dist/module/lib/vectors/errors.d.ts +55 -0
  132. package/dist/module/lib/vectors/errors.d.ts.map +1 -0
  133. package/dist/module/lib/vectors/errors.js +69 -0
  134. package/dist/module/lib/vectors/errors.js.map +1 -0
  135. package/dist/module/lib/vectors/fetch.d.ts +57 -0
  136. package/dist/module/lib/vectors/fetch.d.ts.map +1 -0
  137. package/dist/module/lib/vectors/fetch.js +161 -0
  138. package/dist/module/lib/vectors/fetch.js.map +1 -0
  139. package/dist/module/lib/vectors/helpers.d.ts +46 -0
  140. package/dist/module/lib/vectors/helpers.d.ts.map +1 -0
  141. package/dist/module/lib/vectors/helpers.js +66 -0
  142. package/dist/module/lib/vectors/helpers.js.map +1 -0
  143. package/dist/module/lib/vectors/index.d.ts +11 -0
  144. package/dist/module/lib/vectors/index.d.ts.map +1 -0
  145. package/dist/module/lib/vectors/index.js +11 -0
  146. package/dist/module/lib/vectors/index.js.map +1 -0
  147. package/dist/module/lib/vectors/types.d.ts +277 -0
  148. package/dist/module/lib/vectors/types.d.ts.map +1 -0
  149. package/dist/module/lib/vectors/types.js +2 -0
  150. package/dist/module/lib/vectors/types.js.map +1 -0
  151. package/dist/module/lib/version.d.ts +1 -1
  152. package/dist/module/lib/version.d.ts.map +1 -1
  153. package/dist/module/lib/version.js +1 -1
  154. package/dist/module/lib/version.js.map +1 -1
  155. package/dist/module/packages/BlobDownloadBuilder.d.ts +6 -1
  156. package/dist/module/packages/BlobDownloadBuilder.d.ts.map +1 -1
  157. package/dist/module/packages/BlobDownloadBuilder.js +20 -11
  158. package/dist/module/packages/BlobDownloadBuilder.js.map +1 -1
  159. package/dist/module/packages/StorageAnalyticsApi.d.ts +123 -0
  160. package/dist/module/packages/StorageAnalyticsApi.d.ts.map +1 -0
  161. package/dist/module/packages/StorageAnalyticsApi.js +161 -0
  162. package/dist/module/packages/StorageAnalyticsApi.js.map +1 -0
  163. package/dist/module/packages/StorageBucketApi.d.ts +3 -2
  164. package/dist/module/packages/StorageBucketApi.d.ts.map +1 -1
  165. package/dist/module/packages/StorageBucketApi.js +28 -12
  166. package/dist/module/packages/StorageBucketApi.js.map +1 -1
  167. package/dist/module/packages/StorageFileApi.d.ts.map +1 -1
  168. package/dist/module/packages/StorageFileApi.js +13 -11
  169. package/dist/module/packages/StorageFileApi.js.map +1 -1
  170. package/dist/module/packages/StreamDownloadBuilder.js +1 -9
  171. package/dist/module/packages/StreamDownloadBuilder.js.map +1 -1
  172. package/dist/tsconfig.module.tsbuildinfo +1 -0
  173. package/dist/tsconfig.tsbuildinfo +1 -0
  174. package/dist/umd/supabase.js +1 -1
  175. package/package.json +6 -13
  176. package/src/StorageClient.ts +37 -0
  177. package/src/index.ts +2 -0
  178. package/src/lib/constants.ts +3 -1
  179. package/src/lib/fetch.ts +5 -1
  180. package/src/lib/helpers.ts +3 -14
  181. package/src/lib/index.ts +1 -0
  182. package/src/lib/types.ts +83 -2
  183. package/src/lib/vectors/StorageVectorsClient.ts +405 -0
  184. package/src/lib/vectors/VectorBucketApi.ts +217 -0
  185. package/src/lib/vectors/VectorDataApi.ts +341 -0
  186. package/src/lib/vectors/VectorIndexApi.ts +245 -0
  187. package/src/lib/vectors/constants.ts +5 -0
  188. package/src/lib/vectors/errors.ts +78 -0
  189. package/src/lib/vectors/fetch.ts +218 -0
  190. package/src/lib/vectors/helpers.ts +79 -0
  191. package/src/lib/vectors/index.ts +66 -0
  192. package/src/lib/vectors/types.ts +299 -0
  193. package/src/lib/version.ts +1 -1
  194. package/src/packages/BlobDownloadBuilder.ts +22 -2
  195. package/src/packages/StorageAnalyticsApi.ts +199 -0
  196. package/src/packages/StorageBucketApi.ts +29 -4
  197. package/src/packages/StorageFileApi.ts +15 -2
@@ -0,0 +1,157 @@
1
+ import { Fetch } from './fetch';
2
+ import { ApiResponse, VectorIndex, ListIndexesOptions, ListIndexesResponse, VectorDataType, DistanceMetric, MetadataConfiguration } from './types';
3
+ /**
4
+ * Options for creating a vector index
5
+ */
6
+ export interface CreateIndexOptions {
7
+ vectorBucketName: string;
8
+ indexName: string;
9
+ dataType: VectorDataType;
10
+ dimension: number;
11
+ distanceMetric: DistanceMetric;
12
+ metadataConfiguration?: MetadataConfiguration;
13
+ }
14
+ /**
15
+ * API class for managing Vector Indexes within Vector Buckets
16
+ * Provides methods for creating, reading, listing, and deleting vector indexes
17
+ */
18
+ export default class VectorIndexApi {
19
+ protected url: string;
20
+ protected headers: {
21
+ [key: string]: string;
22
+ };
23
+ protected fetch: Fetch;
24
+ protected shouldThrowOnError: boolean;
25
+ constructor(url: string, headers?: {
26
+ [key: string]: string;
27
+ }, fetch?: Fetch);
28
+ /**
29
+ * Enable throwing errors instead of returning them in the response
30
+ * When enabled, failed operations will throw instead of returning { data: null, error }
31
+ *
32
+ * @returns This instance for method chaining
33
+ * @example
34
+ * ```typescript
35
+ * const client = new VectorIndexApi(url, headers)
36
+ * client.throwOnError()
37
+ * const { data } = await client.createIndex(options) // throws on error
38
+ * ```
39
+ */
40
+ throwOnError(): this;
41
+ /**
42
+ * Creates a new vector index within a bucket
43
+ * Defines the schema for vectors including dimensionality, distance metric, and metadata config
44
+ *
45
+ * @param options - Index configuration
46
+ * @param options.vectorBucketName - Name of the parent vector bucket
47
+ * @param options.indexName - Unique name for the index within the bucket
48
+ * @param options.dataType - Data type for vector components (currently only 'float32')
49
+ * @param options.dimension - Dimensionality of vectors (e.g., 384, 768, 1536)
50
+ * @param options.distanceMetric - Similarity metric ('cosine', 'euclidean', 'dotproduct')
51
+ * @param options.metadataConfiguration - Optional config for non-filterable metadata keys
52
+ * @returns Promise with empty response on success or error
53
+ *
54
+ * @throws {StorageVectorsApiError} With code:
55
+ * - `S3VectorConflictException` if index already exists (HTTP 409)
56
+ * - `S3VectorMaxIndexesExceeded` if quota exceeded (HTTP 400)
57
+ * - `S3VectorNotFoundException` if bucket doesn't exist (HTTP 404)
58
+ * - `InternalError` for server errors (HTTP 500)
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * const { data, error } = await client.createIndex({
63
+ * vectorBucketName: 'embeddings-prod',
64
+ * indexName: 'documents-openai-small',
65
+ * dataType: 'float32',
66
+ * dimension: 1536,
67
+ * distanceMetric: 'cosine',
68
+ * metadataConfiguration: {
69
+ * nonFilterableMetadataKeys: ['raw_text', 'internal_id']
70
+ * }
71
+ * })
72
+ * ```
73
+ */
74
+ createIndex(options: CreateIndexOptions): Promise<ApiResponse<undefined>>;
75
+ /**
76
+ * Retrieves metadata for a specific vector index
77
+ * Returns index configuration including dimension, distance metric, and metadata settings
78
+ *
79
+ * @param vectorBucketName - Name of the parent vector bucket
80
+ * @param indexName - Name of the index to retrieve
81
+ * @returns Promise with index metadata or error
82
+ *
83
+ * @throws {StorageVectorsApiError} With code:
84
+ * - `S3VectorNotFoundException` if index or bucket doesn't exist (HTTP 404)
85
+ * - `InternalError` for server errors (HTTP 500)
86
+ *
87
+ * @example
88
+ * ```typescript
89
+ * const { data, error } = await client.getIndex('embeddings-prod', 'documents-openai-small')
90
+ * if (data) {
91
+ * console.log('Index dimension:', data.index.dimension)
92
+ * console.log('Distance metric:', data.index.distanceMetric)
93
+ * }
94
+ * ```
95
+ */
96
+ getIndex(vectorBucketName: string, indexName: string): Promise<ApiResponse<{
97
+ index: VectorIndex;
98
+ }>>;
99
+ /**
100
+ * Lists vector indexes within a bucket with optional filtering and pagination
101
+ * Supports prefix-based filtering and paginated results
102
+ *
103
+ * @param options - Listing options
104
+ * @param options.vectorBucketName - Name of the parent vector bucket
105
+ * @param options.prefix - Filter indexes by name prefix
106
+ * @param options.maxResults - Maximum results per page (default: 100)
107
+ * @param options.nextToken - Pagination token from previous response
108
+ * @returns Promise with list of indexes and pagination token
109
+ *
110
+ * @throws {StorageVectorsApiError} With code:
111
+ * - `S3VectorNotFoundException` if bucket doesn't exist (HTTP 404)
112
+ * - `InternalError` for server errors (HTTP 500)
113
+ *
114
+ * @example
115
+ * ```typescript
116
+ * // List all indexes in a bucket
117
+ * const { data, error } = await client.listIndexes({
118
+ * vectorBucketName: 'embeddings-prod',
119
+ * prefix: 'documents-'
120
+ * })
121
+ * if (data) {
122
+ * console.log('Found indexes:', data.indexes.map(i => i.indexName))
123
+ * // Fetch next page if available
124
+ * if (data.nextToken) {
125
+ * const next = await client.listIndexes({
126
+ * vectorBucketName: 'embeddings-prod',
127
+ * nextToken: data.nextToken
128
+ * })
129
+ * }
130
+ * }
131
+ * ```
132
+ */
133
+ listIndexes(options: ListIndexesOptions): Promise<ApiResponse<ListIndexesResponse>>;
134
+ /**
135
+ * Deletes a vector index and all its data
136
+ * This operation removes the index schema and all vectors stored in the index
137
+ *
138
+ * @param vectorBucketName - Name of the parent vector bucket
139
+ * @param indexName - Name of the index to delete
140
+ * @returns Promise with empty response on success or error
141
+ *
142
+ * @throws {StorageVectorsApiError} With code:
143
+ * - `S3VectorNotFoundException` if index or bucket doesn't exist (HTTP 404)
144
+ * - `InternalError` for server errors (HTTP 500)
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * // Delete an index and all its vectors
149
+ * const { error } = await client.deleteIndex('embeddings-prod', 'old-index')
150
+ * if (!error) {
151
+ * console.log('Index deleted successfully')
152
+ * }
153
+ * ```
154
+ */
155
+ deleteIndex(vectorBucketName: string, indexName: string): Promise<ApiResponse<undefined>>;
156
+ }
157
+ //# sourceMappingURL=VectorIndexApi.d.ts.map
@@ -0,0 +1 @@
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;;GAEG;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;;;GAGG;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;gBAExB,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,EAAE,KAAK,CAAC,EAAE,KAAK;IAM/E;;;;;;;;;;;OAWG;IACI,YAAY,IAAI,IAAI;IAK3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAiB/E;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,QAAQ,CACZ,gBAAgB,EAAE,MAAM,EACxB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,WAAW,CAAC;QAAE,KAAK,EAAE,WAAW,CAAA;KAAE,CAAC,CAAC;IAoB/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACG,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;IAiBzF;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,WAAW,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;CAmBhG"}
@@ -0,0 +1,215 @@
1
+ import { __awaiter } from "tslib";
2
+ import { DEFAULT_HEADERS } from './constants';
3
+ import { isStorageVectorsError } from './errors';
4
+ import { post } from './fetch';
5
+ import { resolveFetch } from './helpers';
6
+ /**
7
+ * API class for managing Vector Indexes within Vector Buckets
8
+ * Provides methods for creating, reading, listing, and deleting vector indexes
9
+ */
10
+ export default class VectorIndexApi {
11
+ constructor(url, headers = {}, fetch) {
12
+ this.shouldThrowOnError = false;
13
+ this.url = url.replace(/\/$/, '');
14
+ this.headers = Object.assign(Object.assign({}, DEFAULT_HEADERS), headers);
15
+ this.fetch = resolveFetch(fetch);
16
+ }
17
+ /**
18
+ * Enable throwing errors instead of returning them in the response
19
+ * When enabled, failed operations will throw instead of returning { data: null, error }
20
+ *
21
+ * @returns This instance for method chaining
22
+ * @example
23
+ * ```typescript
24
+ * const client = new VectorIndexApi(url, headers)
25
+ * client.throwOnError()
26
+ * const { data } = await client.createIndex(options) // throws on error
27
+ * ```
28
+ */
29
+ throwOnError() {
30
+ this.shouldThrowOnError = true;
31
+ return this;
32
+ }
33
+ /**
34
+ * Creates a new vector index within a bucket
35
+ * Defines the schema for vectors including dimensionality, distance metric, and metadata config
36
+ *
37
+ * @param options - Index configuration
38
+ * @param options.vectorBucketName - Name of the parent vector bucket
39
+ * @param options.indexName - Unique name for the index within the bucket
40
+ * @param options.dataType - Data type for vector components (currently only 'float32')
41
+ * @param options.dimension - Dimensionality of vectors (e.g., 384, 768, 1536)
42
+ * @param options.distanceMetric - Similarity metric ('cosine', 'euclidean', 'dotproduct')
43
+ * @param options.metadataConfiguration - Optional config for non-filterable metadata keys
44
+ * @returns Promise with empty response on success or error
45
+ *
46
+ * @throws {StorageVectorsApiError} With code:
47
+ * - `S3VectorConflictException` if index already exists (HTTP 409)
48
+ * - `S3VectorMaxIndexesExceeded` if quota exceeded (HTTP 400)
49
+ * - `S3VectorNotFoundException` if bucket doesn't exist (HTTP 404)
50
+ * - `InternalError` for server errors (HTTP 500)
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * const { data, error } = await client.createIndex({
55
+ * vectorBucketName: 'embeddings-prod',
56
+ * indexName: 'documents-openai-small',
57
+ * dataType: 'float32',
58
+ * dimension: 1536,
59
+ * distanceMetric: 'cosine',
60
+ * metadataConfiguration: {
61
+ * nonFilterableMetadataKeys: ['raw_text', 'internal_id']
62
+ * }
63
+ * })
64
+ * ```
65
+ */
66
+ createIndex(options) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ try {
69
+ const data = yield post(this.fetch, `${this.url}/CreateIndex`, options, {
70
+ headers: this.headers,
71
+ });
72
+ return { data: data || {}, error: null };
73
+ }
74
+ catch (error) {
75
+ if (this.shouldThrowOnError) {
76
+ throw error;
77
+ }
78
+ if (isStorageVectorsError(error)) {
79
+ return { data: null, error };
80
+ }
81
+ throw error;
82
+ }
83
+ });
84
+ }
85
+ /**
86
+ * Retrieves metadata for a specific vector index
87
+ * Returns index configuration including dimension, distance metric, and metadata settings
88
+ *
89
+ * @param vectorBucketName - Name of the parent vector bucket
90
+ * @param indexName - Name of the index to retrieve
91
+ * @returns Promise with index metadata or error
92
+ *
93
+ * @throws {StorageVectorsApiError} With code:
94
+ * - `S3VectorNotFoundException` if index or bucket doesn't exist (HTTP 404)
95
+ * - `InternalError` for server errors (HTTP 500)
96
+ *
97
+ * @example
98
+ * ```typescript
99
+ * const { data, error } = await client.getIndex('embeddings-prod', 'documents-openai-small')
100
+ * if (data) {
101
+ * console.log('Index dimension:', data.index.dimension)
102
+ * console.log('Distance metric:', data.index.distanceMetric)
103
+ * }
104
+ * ```
105
+ */
106
+ getIndex(vectorBucketName, indexName) {
107
+ return __awaiter(this, void 0, void 0, function* () {
108
+ try {
109
+ const data = yield post(this.fetch, `${this.url}/GetIndex`, { vectorBucketName, indexName }, { headers: this.headers });
110
+ return { data, error: null };
111
+ }
112
+ catch (error) {
113
+ if (this.shouldThrowOnError) {
114
+ throw error;
115
+ }
116
+ if (isStorageVectorsError(error)) {
117
+ return { data: null, error };
118
+ }
119
+ throw error;
120
+ }
121
+ });
122
+ }
123
+ /**
124
+ * Lists vector indexes within a bucket with optional filtering and pagination
125
+ * Supports prefix-based filtering and paginated results
126
+ *
127
+ * @param options - Listing options
128
+ * @param options.vectorBucketName - Name of the parent vector bucket
129
+ * @param options.prefix - Filter indexes by name prefix
130
+ * @param options.maxResults - Maximum results per page (default: 100)
131
+ * @param options.nextToken - Pagination token from previous response
132
+ * @returns Promise with list of indexes and pagination token
133
+ *
134
+ * @throws {StorageVectorsApiError} With code:
135
+ * - `S3VectorNotFoundException` if bucket doesn't exist (HTTP 404)
136
+ * - `InternalError` for server errors (HTTP 500)
137
+ *
138
+ * @example
139
+ * ```typescript
140
+ * // List all indexes in a bucket
141
+ * const { data, error } = await client.listIndexes({
142
+ * vectorBucketName: 'embeddings-prod',
143
+ * prefix: 'documents-'
144
+ * })
145
+ * if (data) {
146
+ * console.log('Found indexes:', data.indexes.map(i => i.indexName))
147
+ * // Fetch next page if available
148
+ * if (data.nextToken) {
149
+ * const next = await client.listIndexes({
150
+ * vectorBucketName: 'embeddings-prod',
151
+ * nextToken: data.nextToken
152
+ * })
153
+ * }
154
+ * }
155
+ * ```
156
+ */
157
+ listIndexes(options) {
158
+ return __awaiter(this, void 0, void 0, function* () {
159
+ try {
160
+ const data = yield post(this.fetch, `${this.url}/ListIndexes`, options, {
161
+ headers: this.headers,
162
+ });
163
+ return { data, error: null };
164
+ }
165
+ catch (error) {
166
+ if (this.shouldThrowOnError) {
167
+ throw error;
168
+ }
169
+ if (isStorageVectorsError(error)) {
170
+ return { data: null, error };
171
+ }
172
+ throw error;
173
+ }
174
+ });
175
+ }
176
+ /**
177
+ * Deletes a vector index and all its data
178
+ * This operation removes the index schema and all vectors stored in the index
179
+ *
180
+ * @param vectorBucketName - Name of the parent vector bucket
181
+ * @param indexName - Name of the index to delete
182
+ * @returns Promise with empty response on success or error
183
+ *
184
+ * @throws {StorageVectorsApiError} With code:
185
+ * - `S3VectorNotFoundException` if index or bucket doesn't exist (HTTP 404)
186
+ * - `InternalError` for server errors (HTTP 500)
187
+ *
188
+ * @example
189
+ * ```typescript
190
+ * // Delete an index and all its vectors
191
+ * const { error } = await client.deleteIndex('embeddings-prod', 'old-index')
192
+ * if (!error) {
193
+ * console.log('Index deleted successfully')
194
+ * }
195
+ * ```
196
+ */
197
+ deleteIndex(vectorBucketName, indexName) {
198
+ return __awaiter(this, void 0, void 0, function* () {
199
+ try {
200
+ const data = yield post(this.fetch, `${this.url}/DeleteIndex`, { vectorBucketName, indexName }, { headers: this.headers });
201
+ return { data: data || {}, error: null };
202
+ }
203
+ catch (error) {
204
+ if (this.shouldThrowOnError) {
205
+ throw error;
206
+ }
207
+ if (isStorageVectorsError(error)) {
208
+ return { data: null, error };
209
+ }
210
+ throw error;
211
+ }
212
+ });
213
+ }
214
+ }
215
+ //# sourceMappingURL=VectorIndexApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VectorIndexApi.js","sourceRoot":"","sources":["../../../../src/lib/vectors/VectorIndexApi.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,EAAS,IAAI,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAuBxC;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IAMjC,YAAY,GAAW,EAAE,UAAqC,EAAE,EAAE,KAAa;QAFrE,uBAAkB,GAAG,KAAK,CAAA;QAGlC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;QACjC,IAAI,CAAC,OAAO,mCAAQ,eAAe,GAAK,OAAO,CAAE,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;IAClC,CAAC;IAED;;;;;;;;;;;OAWG;IACI,YAAY;QACjB,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAA;QAC9B,OAAO,IAAI,CAAA;IACb,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,WAAW,CAAC,OAA2B;;YAC3C,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,GA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@ -0,0 +1,5 @@
1
+ export declare const DEFAULT_HEADERS: {
2
+ 'X-Client-Info': string;
3
+ 'Content-Type': string;
4
+ };
5
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/lib/vectors/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,eAAe;;;CAG3B,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { version } from '../version';
2
+ export const DEFAULT_HEADERS = {
3
+ 'X-Client-Info': `storage-js/${version}`,
4
+ 'Content-Type': 'application/json',
5
+ };
6
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/lib/vectors/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,eAAe,EAAE,cAAc,OAAO,EAAE;IACxC,cAAc,EAAE,kBAAkB;CACnC,CAAA"}
@@ -0,0 +1,55 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Base error class for all Storage Vectors errors
3
+ */
4
+ export class StorageVectorsError extends Error {
5
+ constructor(message) {
6
+ super(message);
7
+ this.__isStorageVectorsError = true;
8
+ this.name = 'StorageVectorsError';
9
+ }
10
+ }
11
+ /**
12
+ * Type guard to check if an error is a StorageVectorsError
13
+ * @param error - The error to check
14
+ * @returns True if the error is a StorageVectorsError
15
+ */
16
+ export function isStorageVectorsError(error) {
17
+ return typeof error === 'object' && error !== null && '__isStorageVectorsError' in error;
18
+ }
19
+ /**
20
+ * API error returned from S3 Vectors service
21
+ * Includes HTTP status code and service-specific error code
22
+ */
23
+ export class StorageVectorsApiError extends StorageVectorsError {
24
+ constructor(message, status, statusCode) {
25
+ super(message);
26
+ this.name = 'StorageVectorsApiError';
27
+ this.status = status;
28
+ this.statusCode = statusCode;
29
+ }
30
+ toJSON() {
31
+ return {
32
+ name: this.name,
33
+ message: this.message,
34
+ status: this.status,
35
+ statusCode: this.statusCode,
36
+ };
37
+ }
38
+ }
39
+ /**
40
+ * Unknown error that doesn't match expected error patterns
41
+ * Wraps the original error for debugging
42
+ */
43
+ export class StorageVectorsUnknownError extends StorageVectorsError {
44
+ constructor(message, originalError) {
45
+ super(message);
46
+ this.name = 'StorageVectorsUnknownError';
47
+ this.originalError = originalError;
48
+ }
49
+ }
50
+ /**
51
+ * Error codes specific to S3 Vectors API
52
+ * Maps AWS service errors to application-friendly error codes
53
+ */
54
+ export var StorageVectorsErrorCode;
55
+ (function (StorageVectorsErrorCode) {
56
+ /** Internal server fault (HTTP 500) */
57
+ StorageVectorsErrorCode["InternalError"] = "InternalError";
58
+ /** Resource already exists / conflict (HTTP 409) */
59
+ StorageVectorsErrorCode["S3VectorConflictException"] = "S3VectorConflictException";
60
+ /** Resource not found (HTTP 404) */
61
+ StorageVectorsErrorCode["S3VectorNotFoundException"] = "S3VectorNotFoundException";
62
+ /** Delete bucket while not empty (HTTP 400) */
63
+ StorageVectorsErrorCode["S3VectorBucketNotEmpty"] = "S3VectorBucketNotEmpty";
64
+ /** Exceeds bucket quota/limit (HTTP 400) */
65
+ StorageVectorsErrorCode["S3VectorMaxBucketsExceeded"] = "S3VectorMaxBucketsExceeded";
66
+ /** Exceeds index quota/limit (HTTP 400) */
67
+ StorageVectorsErrorCode["S3VectorMaxIndexesExceeded"] = "S3VectorMaxIndexesExceeded";
68
+ })(StorageVectorsErrorCode || (StorageVectorsErrorCode = {}));
69
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/lib/vectors/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,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;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,yBAAyB,IAAI,KAAK,CAAA;AAC1F,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,mBAAmB;IAI7D,YAAY,OAAe,EAAE,MAAc,EAAE,UAAkB;QAC7D,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAA;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAA;IACH,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,0BAA2B,SAAQ,mBAAmB;IAGjE,YAAY,OAAe,EAAE,aAAsB;QACjD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAA;QACxC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;IACpC,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,uBAaX;AAbD,WAAY,uBAAuB;IACjC,uCAAuC;IACvC,0DAA+B,CAAA;IAC/B,oDAAoD;IACpD,kFAAuD,CAAA;IACvD,oCAAoC;IACpC,kFAAuD,CAAA;IACvD,+CAA+C;IAC/C,4EAAiD,CAAA;IACjD,4CAA4C;IAC5C,oFAAyD,CAAA;IACzD,2CAA2C;IAC3C,oFAAyD,CAAA;AAC3D,CAAC,EAbW,uBAAuB,KAAvB,uBAAuB,QAalC"}
@@ -0,0 +1,57 @@
1
+ import { VectorFetchParameters } from './types';
2
+ export type Fetch = typeof fetch;
3
+ /**
4
+ * Options for fetch requests
5
+ * @property headers - Custom HTTP headers
6
+ * @property noResolveJson - If true, return raw Response instead of parsing JSON
7
+ */
8
+ export interface FetchOptions {
9
+ headers?: {
10
+ [key: string]: string;
11
+ };
12
+ noResolveJson?: boolean;
13
+ }
14
+ /**
15
+ * HTTP methods supported by the API
16
+ */
17
+ export type RequestMethodType = 'GET' | 'POST' | 'PUT' | 'DELETE';
18
+ /**
19
+ * Performs a GET request
20
+ * @param fetcher - Fetch function to use
21
+ * @param url - Request URL
22
+ * @param options - Custom fetch options
23
+ * @param parameters - Additional fetch parameters
24
+ * @returns Promise with parsed response
25
+ */
26
+ export declare function get(fetcher: Fetch, url: string, options?: FetchOptions, parameters?: VectorFetchParameters): Promise<any>;
27
+ /**
28
+ * Performs a POST request
29
+ * @param fetcher - Fetch function to use
30
+ * @param url - Request URL
31
+ * @param body - Request body to be JSON stringified
32
+ * @param options - Custom fetch options
33
+ * @param parameters - Additional fetch parameters
34
+ * @returns Promise with parsed response
35
+ */
36
+ export declare function post(fetcher: Fetch, url: string, body: object, options?: FetchOptions, parameters?: VectorFetchParameters): Promise<any>;
37
+ /**
38
+ * Performs a PUT request
39
+ * @param fetcher - Fetch function to use
40
+ * @param url - Request URL
41
+ * @param body - Request body to be JSON stringified
42
+ * @param options - Custom fetch options
43
+ * @param parameters - Additional fetch parameters
44
+ * @returns Promise with parsed response
45
+ */
46
+ export declare function put(fetcher: Fetch, url: string, body: object, options?: FetchOptions, parameters?: VectorFetchParameters): Promise<any>;
47
+ /**
48
+ * Performs a DELETE request
49
+ * @param fetcher - Fetch function to use
50
+ * @param url - Request URL
51
+ * @param body - Request body to be JSON stringified
52
+ * @param options - Custom fetch options
53
+ * @param parameters - Additional fetch parameters
54
+ * @returns Promise with parsed response
55
+ */
56
+ export declare function remove(fetcher: Fetch, url: string, body: object, options?: FetchOptions, parameters?: VectorFetchParameters): Promise<any>;
57
+ //# sourceMappingURL=fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../src/lib/vectors/fetch.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE/C,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAA;AAEhC;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE;QACR,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KACtB,CAA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