@cloudflare/workers-types 4.20240722.0 → 4.20240725.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.
@@ -1621,12 +1621,6 @@ declare class Request<
1621
1621
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1622
1622
  */
1623
1623
  get keepalive(): boolean;
1624
- /**
1625
- * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
1626
- *
1627
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
1628
- */
1629
- get cache(): string | undefined;
1630
1624
  }
1631
1625
  interface RequestInit<Cf = CfProperties> {
1632
1626
  /* A string to set request's method. */
@@ -1639,8 +1633,6 @@ interface RequestInit<Cf = CfProperties> {
1639
1633
  redirect?: string;
1640
1634
  fetcher?: Fetcher | null;
1641
1635
  cf?: Cf;
1642
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1643
- cache?: string;
1644
1636
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1645
1637
  integrity?: string;
1646
1638
  /* An AbortSignal to set request's signal. */
@@ -4643,7 +4635,7 @@ declare abstract class D1PreparedStatement {
4643
4635
  bind(...values: unknown[]): D1PreparedStatement;
4644
4636
  first<T = unknown>(colName: string): Promise<T | null>;
4645
4637
  first<T = Record<string, unknown>>(): Promise<T | null>;
4646
- run(): Promise<D1Response>;
4638
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4647
4639
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4648
4640
  raw<T = unknown[]>(options: {
4649
4641
  columnNames: true;
@@ -5112,11 +5104,23 @@ type VectorizeVectorMetadataFilter = {
5112
5104
  * Distance metrics determine how other "similar" vectors are determined.
5113
5105
  */
5114
5106
  type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5115
- interface VectorizeQueryOptions {
5107
+ /**
5108
+ * Metadata return levels for a Vectorize query.
5109
+ *
5110
+ * Default to "none".
5111
+ *
5112
+ * @property all Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.
5113
+ * @property indexed Return all metadata fields configured for indexing in the vector return set. This level of retrieval is "free" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).
5114
+ * @property none No indexed metadata will be returned.
5115
+ */
5116
+ type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5117
+ interface VectorizeQueryOptions<
5118
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5119
+ > {
5116
5120
  topK?: number;
5117
5121
  namespace?: string;
5118
5122
  returnValues?: boolean;
5119
- returnMetadata?: boolean;
5123
+ returnMetadata?: MetadataReturn;
5120
5124
  filter?: VectorizeVectorMetadataFilter;
5121
5125
  }
5122
5126
  /**
@@ -5155,7 +5159,7 @@ interface VectorizeVector {
5155
5159
  values: VectorFloatArray | number[];
5156
5160
  /** The namespace this vector belongs to. */
5157
5161
  namespace?: string;
5158
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5162
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5159
5163
  metadata?: Record<string, VectorizeVectorMetadata>;
5160
5164
  }
5161
5165
  /**
@@ -5167,7 +5171,7 @@ type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5167
5171
  score: number;
5168
5172
  };
5169
5173
  /**
5170
- * A set of vector {@link VectorizeMatch} for a particular query.
5174
+ * A set of matching {@link VectorizeMatch} for a particular query.
5171
5175
  */
5172
5176
  interface VectorizeMatches {
5173
5177
  matches: VectorizeMatch[];
@@ -5176,6 +5180,9 @@ interface VectorizeMatches {
5176
5180
  /**
5177
5181
  * Results of an operation that performed a mutation on a set of vectors.
5178
5182
  * Here, `ids` is a list of vectors that were successfully processed.
5183
+ *
5184
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5185
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5179
5186
  */
5180
5187
  interface VectorizeVectorMutation {
5181
5188
  /* List of ids of vectors that were successfully processed. */
@@ -5184,14 +5191,19 @@ interface VectorizeVectorMutation {
5184
5191
  count: number;
5185
5192
  }
5186
5193
  /**
5187
- * Results of an operation that performed a mutation on a set of vectors
5188
- * with the v2 version of Vectorize.
5189
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5194
+ * Result type indicating a mutation on the Vectorize Index.
5195
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5190
5196
  */
5191
- interface VectorizeVectorMutationV2 {
5192
- /* The identifier for the last mutation processed by Vectorize. */
5197
+ interface VectorizeAsyncMutation {
5198
+ /** The unique identifier for the async mutation operation containing the changeset. */
5193
5199
  mutationId: string;
5194
5200
  }
5201
+ /**
5202
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5203
+ *
5204
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5205
+ * See {@link Vectorize} for its new implementation.
5206
+ */
5195
5207
  declare abstract class VectorizeIndex {
5196
5208
  /**
5197
5209
  * Get information about the currently bound index.
@@ -5233,6 +5245,52 @@ declare abstract class VectorizeIndex {
5233
5245
  */
5234
5246
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5235
5247
  }
5248
+ /**
5249
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5250
+ *
5251
+ * Mutations in this version are async, returning a mutation id.
5252
+ */
5253
+ declare abstract class Vectorize {
5254
+ /**
5255
+ * Get information about the currently bound index.
5256
+ * @returns A promise that resolves with information about the current index.
5257
+ */
5258
+ public describe(): Promise<VectorizeIndexDetails>;
5259
+ /**
5260
+ * Use the provided vector to perform a similarity search across the index.
5261
+ * @param vector Input vector that will be used to drive the similarity search.
5262
+ * @param options Configuration options to massage the returned data.
5263
+ * @returns A promise that resolves with matched and scored vectors.
5264
+ */
5265
+ public query(
5266
+ vector: VectorFloatArray | number[],
5267
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5268
+ ): Promise<VectorizeMatches>;
5269
+ /**
5270
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5271
+ * @param vectors List of vectors that will be inserted.
5272
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5273
+ */
5274
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5275
+ /**
5276
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5277
+ * @param vectors List of vectors that will be upserted.
5278
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5279
+ */
5280
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5281
+ /**
5282
+ * Delete a list of vectors with a matching id.
5283
+ * @param ids List of vector ids that should be deleted.
5284
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5285
+ */
5286
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5287
+ /**
5288
+ * Get a list of vectors with a matching id.
5289
+ * @param ids List of vector ids that should be returned.
5290
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5291
+ */
5292
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5293
+ }
5236
5294
  /**
5237
5295
  * The interface for "version_metadata" binding
5238
5296
  * providing metadata about the Worker Version using this binding.
@@ -1626,12 +1626,6 @@ export declare class Request<
1626
1626
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1627
1627
  */
1628
1628
  get keepalive(): boolean;
1629
- /**
1630
- * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
1631
- *
1632
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
1633
- */
1634
- get cache(): string | undefined;
1635
1629
  }
1636
1630
  export interface RequestInit<Cf = CfProperties> {
1637
1631
  /* A string to set request's method. */
@@ -1644,8 +1638,6 @@ export interface RequestInit<Cf = CfProperties> {
1644
1638
  redirect?: string;
1645
1639
  fetcher?: Fetcher | null;
1646
1640
  cf?: Cf;
1647
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1648
- cache?: string;
1649
1641
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1650
1642
  integrity?: string;
1651
1643
  /* An AbortSignal to set request's signal. */
@@ -4665,7 +4657,7 @@ export declare abstract class D1PreparedStatement {
4665
4657
  bind(...values: unknown[]): D1PreparedStatement;
4666
4658
  first<T = unknown>(colName: string): Promise<T | null>;
4667
4659
  first<T = Record<string, unknown>>(): Promise<T | null>;
4668
- run(): Promise<D1Response>;
4660
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4669
4661
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4670
4662
  raw<T = unknown[]>(options: {
4671
4663
  columnNames: true;
@@ -5072,11 +5064,23 @@ export type VectorizeVectorMetadataFilter = {
5072
5064
  * Distance metrics determine how other "similar" vectors are determined.
5073
5065
  */
5074
5066
  export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5075
- export interface VectorizeQueryOptions {
5067
+ /**
5068
+ * Metadata return levels for a Vectorize query.
5069
+ *
5070
+ * Default to "none".
5071
+ *
5072
+ * @property all Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.
5073
+ * @property indexed Return all metadata fields configured for indexing in the vector return set. This level of retrieval is "free" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).
5074
+ * @property none No indexed metadata will be returned.
5075
+ */
5076
+ export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5077
+ export interface VectorizeQueryOptions<
5078
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5079
+ > {
5076
5080
  topK?: number;
5077
5081
  namespace?: string;
5078
5082
  returnValues?: boolean;
5079
- returnMetadata?: boolean;
5083
+ returnMetadata?: MetadataReturn;
5080
5084
  filter?: VectorizeVectorMetadataFilter;
5081
5085
  }
5082
5086
  /**
@@ -5115,7 +5119,7 @@ export interface VectorizeVector {
5115
5119
  values: VectorFloatArray | number[];
5116
5120
  /** The namespace this vector belongs to. */
5117
5121
  namespace?: string;
5118
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5122
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5119
5123
  metadata?: Record<string, VectorizeVectorMetadata>;
5120
5124
  }
5121
5125
  /**
@@ -5127,7 +5131,7 @@ export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5127
5131
  score: number;
5128
5132
  };
5129
5133
  /**
5130
- * A set of vector {@link VectorizeMatch} for a particular query.
5134
+ * A set of matching {@link VectorizeMatch} for a particular query.
5131
5135
  */
5132
5136
  export interface VectorizeMatches {
5133
5137
  matches: VectorizeMatch[];
@@ -5136,6 +5140,9 @@ export interface VectorizeMatches {
5136
5140
  /**
5137
5141
  * Results of an operation that performed a mutation on a set of vectors.
5138
5142
  * Here, `ids` is a list of vectors that were successfully processed.
5143
+ *
5144
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5145
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5139
5146
  */
5140
5147
  export interface VectorizeVectorMutation {
5141
5148
  /* List of ids of vectors that were successfully processed. */
@@ -5144,14 +5151,19 @@ export interface VectorizeVectorMutation {
5144
5151
  count: number;
5145
5152
  }
5146
5153
  /**
5147
- * Results of an operation that performed a mutation on a set of vectors
5148
- * with the v2 version of Vectorize.
5149
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5154
+ * Result type indicating a mutation on the Vectorize Index.
5155
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5150
5156
  */
5151
- export interface VectorizeVectorMutationV2 {
5152
- /* The identifier for the last mutation processed by Vectorize. */
5157
+ export interface VectorizeAsyncMutation {
5158
+ /** The unique identifier for the async mutation operation containing the changeset. */
5153
5159
  mutationId: string;
5154
5160
  }
5161
+ /**
5162
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5163
+ *
5164
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5165
+ * See {@link Vectorize} for its new implementation.
5166
+ */
5155
5167
  export declare abstract class VectorizeIndex {
5156
5168
  /**
5157
5169
  * Get information about the currently bound index.
@@ -5193,6 +5205,52 @@ export declare abstract class VectorizeIndex {
5193
5205
  */
5194
5206
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5195
5207
  }
5208
+ /**
5209
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5210
+ *
5211
+ * Mutations in this version are async, returning a mutation id.
5212
+ */
5213
+ export declare abstract class Vectorize {
5214
+ /**
5215
+ * Get information about the currently bound index.
5216
+ * @returns A promise that resolves with information about the current index.
5217
+ */
5218
+ public describe(): Promise<VectorizeIndexDetails>;
5219
+ /**
5220
+ * Use the provided vector to perform a similarity search across the index.
5221
+ * @param vector Input vector that will be used to drive the similarity search.
5222
+ * @param options Configuration options to massage the returned data.
5223
+ * @returns A promise that resolves with matched and scored vectors.
5224
+ */
5225
+ public query(
5226
+ vector: VectorFloatArray | number[],
5227
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5228
+ ): Promise<VectorizeMatches>;
5229
+ /**
5230
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5231
+ * @param vectors List of vectors that will be inserted.
5232
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5233
+ */
5234
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5235
+ /**
5236
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5237
+ * @param vectors List of vectors that will be upserted.
5238
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5239
+ */
5240
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5241
+ /**
5242
+ * Delete a list of vectors with a matching id.
5243
+ * @param ids List of vector ids that should be deleted.
5244
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5245
+ */
5246
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5247
+ /**
5248
+ * Get a list of vectors with a matching id.
5249
+ * @param ids List of vector ids that should be returned.
5250
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5251
+ */
5252
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5253
+ }
5196
5254
  /**
5197
5255
  * The interface for "version_metadata" binding
5198
5256
  * providing metadata about the Worker Version using this binding.
@@ -1621,12 +1621,6 @@ declare class Request<
1621
1621
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1622
1622
  */
1623
1623
  get keepalive(): boolean;
1624
- /**
1625
- * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
1626
- *
1627
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
1628
- */
1629
- get cache(): string | undefined;
1630
1624
  }
1631
1625
  interface RequestInit<Cf = CfProperties> {
1632
1626
  /* A string to set request's method. */
@@ -1639,8 +1633,6 @@ interface RequestInit<Cf = CfProperties> {
1639
1633
  redirect?: string;
1640
1634
  fetcher?: Fetcher | null;
1641
1635
  cf?: Cf;
1642
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1643
- cache?: string;
1644
1636
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1645
1637
  integrity?: string;
1646
1638
  /* An AbortSignal to set request's signal. */
@@ -4644,7 +4636,7 @@ declare abstract class D1PreparedStatement {
4644
4636
  bind(...values: unknown[]): D1PreparedStatement;
4645
4637
  first<T = unknown>(colName: string): Promise<T | null>;
4646
4638
  first<T = Record<string, unknown>>(): Promise<T | null>;
4647
- run(): Promise<D1Response>;
4639
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4648
4640
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4649
4641
  raw<T = unknown[]>(options: {
4650
4642
  columnNames: true;
@@ -5113,11 +5105,23 @@ type VectorizeVectorMetadataFilter = {
5113
5105
  * Distance metrics determine how other "similar" vectors are determined.
5114
5106
  */
5115
5107
  type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5116
- interface VectorizeQueryOptions {
5108
+ /**
5109
+ * Metadata return levels for a Vectorize query.
5110
+ *
5111
+ * Default to "none".
5112
+ *
5113
+ * @property all Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.
5114
+ * @property indexed Return all metadata fields configured for indexing in the vector return set. This level of retrieval is "free" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).
5115
+ * @property none No indexed metadata will be returned.
5116
+ */
5117
+ type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5118
+ interface VectorizeQueryOptions<
5119
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5120
+ > {
5117
5121
  topK?: number;
5118
5122
  namespace?: string;
5119
5123
  returnValues?: boolean;
5120
- returnMetadata?: boolean;
5124
+ returnMetadata?: MetadataReturn;
5121
5125
  filter?: VectorizeVectorMetadataFilter;
5122
5126
  }
5123
5127
  /**
@@ -5156,7 +5160,7 @@ interface VectorizeVector {
5156
5160
  values: VectorFloatArray | number[];
5157
5161
  /** The namespace this vector belongs to. */
5158
5162
  namespace?: string;
5159
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5163
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5160
5164
  metadata?: Record<string, VectorizeVectorMetadata>;
5161
5165
  }
5162
5166
  /**
@@ -5168,7 +5172,7 @@ type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5168
5172
  score: number;
5169
5173
  };
5170
5174
  /**
5171
- * A set of vector {@link VectorizeMatch} for a particular query.
5175
+ * A set of matching {@link VectorizeMatch} for a particular query.
5172
5176
  */
5173
5177
  interface VectorizeMatches {
5174
5178
  matches: VectorizeMatch[];
@@ -5177,6 +5181,9 @@ interface VectorizeMatches {
5177
5181
  /**
5178
5182
  * Results of an operation that performed a mutation on a set of vectors.
5179
5183
  * Here, `ids` is a list of vectors that were successfully processed.
5184
+ *
5185
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5186
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5180
5187
  */
5181
5188
  interface VectorizeVectorMutation {
5182
5189
  /* List of ids of vectors that were successfully processed. */
@@ -5185,14 +5192,19 @@ interface VectorizeVectorMutation {
5185
5192
  count: number;
5186
5193
  }
5187
5194
  /**
5188
- * Results of an operation that performed a mutation on a set of vectors
5189
- * with the v2 version of Vectorize.
5190
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5195
+ * Result type indicating a mutation on the Vectorize Index.
5196
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5191
5197
  */
5192
- interface VectorizeVectorMutationV2 {
5193
- /* The identifier for the last mutation processed by Vectorize. */
5198
+ interface VectorizeAsyncMutation {
5199
+ /** The unique identifier for the async mutation operation containing the changeset. */
5194
5200
  mutationId: string;
5195
5201
  }
5202
+ /**
5203
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5204
+ *
5205
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5206
+ * See {@link Vectorize} for its new implementation.
5207
+ */
5196
5208
  declare abstract class VectorizeIndex {
5197
5209
  /**
5198
5210
  * Get information about the currently bound index.
@@ -5234,6 +5246,52 @@ declare abstract class VectorizeIndex {
5234
5246
  */
5235
5247
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5236
5248
  }
5249
+ /**
5250
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5251
+ *
5252
+ * Mutations in this version are async, returning a mutation id.
5253
+ */
5254
+ declare abstract class Vectorize {
5255
+ /**
5256
+ * Get information about the currently bound index.
5257
+ * @returns A promise that resolves with information about the current index.
5258
+ */
5259
+ public describe(): Promise<VectorizeIndexDetails>;
5260
+ /**
5261
+ * Use the provided vector to perform a similarity search across the index.
5262
+ * @param vector Input vector that will be used to drive the similarity search.
5263
+ * @param options Configuration options to massage the returned data.
5264
+ * @returns A promise that resolves with matched and scored vectors.
5265
+ */
5266
+ public query(
5267
+ vector: VectorFloatArray | number[],
5268
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5269
+ ): Promise<VectorizeMatches>;
5270
+ /**
5271
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5272
+ * @param vectors List of vectors that will be inserted.
5273
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5274
+ */
5275
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5276
+ /**
5277
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5278
+ * @param vectors List of vectors that will be upserted.
5279
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5280
+ */
5281
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5282
+ /**
5283
+ * Delete a list of vectors with a matching id.
5284
+ * @param ids List of vector ids that should be deleted.
5285
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5286
+ */
5287
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5288
+ /**
5289
+ * Get a list of vectors with a matching id.
5290
+ * @param ids List of vector ids that should be returned.
5291
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5292
+ */
5293
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5294
+ }
5237
5295
  /**
5238
5296
  * The interface for "version_metadata" binding
5239
5297
  * providing metadata about the Worker Version using this binding.
@@ -1626,12 +1626,6 @@ export declare class Request<
1626
1626
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1627
1627
  */
1628
1628
  get keepalive(): boolean;
1629
- /**
1630
- * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
1631
- *
1632
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
1633
- */
1634
- get cache(): string | undefined;
1635
1629
  }
1636
1630
  export interface RequestInit<Cf = CfProperties> {
1637
1631
  /* A string to set request's method. */
@@ -1644,8 +1638,6 @@ export interface RequestInit<Cf = CfProperties> {
1644
1638
  redirect?: string;
1645
1639
  fetcher?: Fetcher | null;
1646
1640
  cf?: Cf;
1647
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1648
- cache?: string;
1649
1641
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1650
1642
  integrity?: string;
1651
1643
  /* An AbortSignal to set request's signal. */
@@ -4666,7 +4658,7 @@ export declare abstract class D1PreparedStatement {
4666
4658
  bind(...values: unknown[]): D1PreparedStatement;
4667
4659
  first<T = unknown>(colName: string): Promise<T | null>;
4668
4660
  first<T = Record<string, unknown>>(): Promise<T | null>;
4669
- run(): Promise<D1Response>;
4661
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4670
4662
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4671
4663
  raw<T = unknown[]>(options: {
4672
4664
  columnNames: true;
@@ -5073,11 +5065,23 @@ export type VectorizeVectorMetadataFilter = {
5073
5065
  * Distance metrics determine how other "similar" vectors are determined.
5074
5066
  */
5075
5067
  export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5076
- export interface VectorizeQueryOptions {
5068
+ /**
5069
+ * Metadata return levels for a Vectorize query.
5070
+ *
5071
+ * Default to "none".
5072
+ *
5073
+ * @property all Full metadata for the vector return set, including all fields (including those un-indexed) without truncation. This is a more expensive retrieval, as it requires additional fetching & reading of un-indexed data.
5074
+ * @property indexed Return all metadata fields configured for indexing in the vector return set. This level of retrieval is "free" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).
5075
+ * @property none No indexed metadata will be returned.
5076
+ */
5077
+ export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5078
+ export interface VectorizeQueryOptions<
5079
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5080
+ > {
5077
5081
  topK?: number;
5078
5082
  namespace?: string;
5079
5083
  returnValues?: boolean;
5080
- returnMetadata?: boolean;
5084
+ returnMetadata?: MetadataReturn;
5081
5085
  filter?: VectorizeVectorMetadataFilter;
5082
5086
  }
5083
5087
  /**
@@ -5116,7 +5120,7 @@ export interface VectorizeVector {
5116
5120
  values: VectorFloatArray | number[];
5117
5121
  /** The namespace this vector belongs to. */
5118
5122
  namespace?: string;
5119
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5123
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5120
5124
  metadata?: Record<string, VectorizeVectorMetadata>;
5121
5125
  }
5122
5126
  /**
@@ -5128,7 +5132,7 @@ export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5128
5132
  score: number;
5129
5133
  };
5130
5134
  /**
5131
- * A set of vector {@link VectorizeMatch} for a particular query.
5135
+ * A set of matching {@link VectorizeMatch} for a particular query.
5132
5136
  */
5133
5137
  export interface VectorizeMatches {
5134
5138
  matches: VectorizeMatch[];
@@ -5137,6 +5141,9 @@ export interface VectorizeMatches {
5137
5141
  /**
5138
5142
  * Results of an operation that performed a mutation on a set of vectors.
5139
5143
  * Here, `ids` is a list of vectors that were successfully processed.
5144
+ *
5145
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5146
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5140
5147
  */
5141
5148
  export interface VectorizeVectorMutation {
5142
5149
  /* List of ids of vectors that were successfully processed. */
@@ -5145,14 +5152,19 @@ export interface VectorizeVectorMutation {
5145
5152
  count: number;
5146
5153
  }
5147
5154
  /**
5148
- * Results of an operation that performed a mutation on a set of vectors
5149
- * with the v2 version of Vectorize.
5150
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5155
+ * Result type indicating a mutation on the Vectorize Index.
5156
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5151
5157
  */
5152
- export interface VectorizeVectorMutationV2 {
5153
- /* The identifier for the last mutation processed by Vectorize. */
5158
+ export interface VectorizeAsyncMutation {
5159
+ /** The unique identifier for the async mutation operation containing the changeset. */
5154
5160
  mutationId: string;
5155
5161
  }
5162
+ /**
5163
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5164
+ *
5165
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5166
+ * See {@link Vectorize} for its new implementation.
5167
+ */
5156
5168
  export declare abstract class VectorizeIndex {
5157
5169
  /**
5158
5170
  * Get information about the currently bound index.
@@ -5194,6 +5206,52 @@ export declare abstract class VectorizeIndex {
5194
5206
  */
5195
5207
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5196
5208
  }
5209
+ /**
5210
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5211
+ *
5212
+ * Mutations in this version are async, returning a mutation id.
5213
+ */
5214
+ export declare abstract class Vectorize {
5215
+ /**
5216
+ * Get information about the currently bound index.
5217
+ * @returns A promise that resolves with information about the current index.
5218
+ */
5219
+ public describe(): Promise<VectorizeIndexDetails>;
5220
+ /**
5221
+ * Use the provided vector to perform a similarity search across the index.
5222
+ * @param vector Input vector that will be used to drive the similarity search.
5223
+ * @param options Configuration options to massage the returned data.
5224
+ * @returns A promise that resolves with matched and scored vectors.
5225
+ */
5226
+ public query(
5227
+ vector: VectorFloatArray | number[],
5228
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5229
+ ): Promise<VectorizeMatches>;
5230
+ /**
5231
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5232
+ * @param vectors List of vectors that will be inserted.
5233
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5234
+ */
5235
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5236
+ /**
5237
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5238
+ * @param vectors List of vectors that will be upserted.
5239
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5240
+ */
5241
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5242
+ /**
5243
+ * Delete a list of vectors with a matching id.
5244
+ * @param ids List of vector ids that should be deleted.
5245
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5246
+ */
5247
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5248
+ /**
5249
+ * Get a list of vectors with a matching id.
5250
+ * @param ids List of vector ids that should be returned.
5251
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5252
+ */
5253
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5254
+ }
5197
5255
  /**
5198
5256
  * The interface for "version_metadata" binding
5199
5257
  * providing metadata about the Worker Version using this binding.