@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.
@@ -1610,8 +1610,6 @@ interface RequestInit<Cf = CfProperties> {
1610
1610
  redirect?: string;
1611
1611
  fetcher?: Fetcher | null;
1612
1612
  cf?: Cf;
1613
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1614
- cache?: string;
1615
1613
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1616
1614
  integrity?: string;
1617
1615
  /* An AbortSignal to set request's signal. */
@@ -4587,7 +4585,7 @@ declare abstract class D1PreparedStatement {
4587
4585
  bind(...values: unknown[]): D1PreparedStatement;
4588
4586
  first<T = unknown>(colName: string): Promise<T | null>;
4589
4587
  first<T = Record<string, unknown>>(): Promise<T | null>;
4590
- run(): Promise<D1Response>;
4588
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4591
4589
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4592
4590
  raw<T = unknown[]>(options: {
4593
4591
  columnNames: true;
@@ -5056,11 +5054,23 @@ type VectorizeVectorMetadataFilter = {
5056
5054
  * Distance metrics determine how other "similar" vectors are determined.
5057
5055
  */
5058
5056
  type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5059
- interface VectorizeQueryOptions {
5057
+ /**
5058
+ * Metadata return levels for a Vectorize query.
5059
+ *
5060
+ * Default to "none".
5061
+ *
5062
+ * @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.
5063
+ * @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).
5064
+ * @property none No indexed metadata will be returned.
5065
+ */
5066
+ type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5067
+ interface VectorizeQueryOptions<
5068
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5069
+ > {
5060
5070
  topK?: number;
5061
5071
  namespace?: string;
5062
5072
  returnValues?: boolean;
5063
- returnMetadata?: boolean;
5073
+ returnMetadata?: MetadataReturn;
5064
5074
  filter?: VectorizeVectorMetadataFilter;
5065
5075
  }
5066
5076
  /**
@@ -5099,7 +5109,7 @@ interface VectorizeVector {
5099
5109
  values: VectorFloatArray | number[];
5100
5110
  /** The namespace this vector belongs to. */
5101
5111
  namespace?: string;
5102
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5112
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5103
5113
  metadata?: Record<string, VectorizeVectorMetadata>;
5104
5114
  }
5105
5115
  /**
@@ -5111,7 +5121,7 @@ type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5111
5121
  score: number;
5112
5122
  };
5113
5123
  /**
5114
- * A set of vector {@link VectorizeMatch} for a particular query.
5124
+ * A set of matching {@link VectorizeMatch} for a particular query.
5115
5125
  */
5116
5126
  interface VectorizeMatches {
5117
5127
  matches: VectorizeMatch[];
@@ -5120,6 +5130,9 @@ interface VectorizeMatches {
5120
5130
  /**
5121
5131
  * Results of an operation that performed a mutation on a set of vectors.
5122
5132
  * Here, `ids` is a list of vectors that were successfully processed.
5133
+ *
5134
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5135
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5123
5136
  */
5124
5137
  interface VectorizeVectorMutation {
5125
5138
  /* List of ids of vectors that were successfully processed. */
@@ -5128,14 +5141,19 @@ interface VectorizeVectorMutation {
5128
5141
  count: number;
5129
5142
  }
5130
5143
  /**
5131
- * Results of an operation that performed a mutation on a set of vectors
5132
- * with the v2 version of Vectorize.
5133
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5144
+ * Result type indicating a mutation on the Vectorize Index.
5145
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5134
5146
  */
5135
- interface VectorizeVectorMutationV2 {
5136
- /* The identifier for the last mutation processed by Vectorize. */
5147
+ interface VectorizeAsyncMutation {
5148
+ /** The unique identifier for the async mutation operation containing the changeset. */
5137
5149
  mutationId: string;
5138
5150
  }
5151
+ /**
5152
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5153
+ *
5154
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5155
+ * See {@link Vectorize} for its new implementation.
5156
+ */
5139
5157
  declare abstract class VectorizeIndex {
5140
5158
  /**
5141
5159
  * Get information about the currently bound index.
@@ -5177,6 +5195,52 @@ declare abstract class VectorizeIndex {
5177
5195
  */
5178
5196
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5179
5197
  }
5198
+ /**
5199
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5200
+ *
5201
+ * Mutations in this version are async, returning a mutation id.
5202
+ */
5203
+ declare abstract class Vectorize {
5204
+ /**
5205
+ * Get information about the currently bound index.
5206
+ * @returns A promise that resolves with information about the current index.
5207
+ */
5208
+ public describe(): Promise<VectorizeIndexDetails>;
5209
+ /**
5210
+ * Use the provided vector to perform a similarity search across the index.
5211
+ * @param vector Input vector that will be used to drive the similarity search.
5212
+ * @param options Configuration options to massage the returned data.
5213
+ * @returns A promise that resolves with matched and scored vectors.
5214
+ */
5215
+ public query(
5216
+ vector: VectorFloatArray | number[],
5217
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5218
+ ): Promise<VectorizeMatches>;
5219
+ /**
5220
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5221
+ * @param vectors List of vectors that will be inserted.
5222
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5223
+ */
5224
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5225
+ /**
5226
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5227
+ * @param vectors List of vectors that will be upserted.
5228
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5229
+ */
5230
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5231
+ /**
5232
+ * Delete a list of vectors with a matching id.
5233
+ * @param ids List of vector ids that should be deleted.
5234
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5235
+ */
5236
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5237
+ /**
5238
+ * Get a list of vectors with a matching id.
5239
+ * @param ids List of vector ids that should be returned.
5240
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5241
+ */
5242
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5243
+ }
5180
5244
  /**
5181
5245
  * The interface for "version_metadata" binding
5182
5246
  * providing metadata about the Worker Version using this binding.
@@ -1615,8 +1615,6 @@ export interface RequestInit<Cf = CfProperties> {
1615
1615
  redirect?: string;
1616
1616
  fetcher?: Fetcher | null;
1617
1617
  cf?: Cf;
1618
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1619
- cache?: string;
1620
1618
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1621
1619
  integrity?: string;
1622
1620
  /* An AbortSignal to set request's signal. */
@@ -4609,7 +4607,7 @@ export declare abstract class D1PreparedStatement {
4609
4607
  bind(...values: unknown[]): D1PreparedStatement;
4610
4608
  first<T = unknown>(colName: string): Promise<T | null>;
4611
4609
  first<T = Record<string, unknown>>(): Promise<T | null>;
4612
- run(): Promise<D1Response>;
4610
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4613
4611
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4614
4612
  raw<T = unknown[]>(options: {
4615
4613
  columnNames: true;
@@ -5016,11 +5014,23 @@ export type VectorizeVectorMetadataFilter = {
5016
5014
  * Distance metrics determine how other "similar" vectors are determined.
5017
5015
  */
5018
5016
  export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5019
- export interface VectorizeQueryOptions {
5017
+ /**
5018
+ * Metadata return levels for a Vectorize query.
5019
+ *
5020
+ * Default to "none".
5021
+ *
5022
+ * @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.
5023
+ * @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).
5024
+ * @property none No indexed metadata will be returned.
5025
+ */
5026
+ export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5027
+ export interface VectorizeQueryOptions<
5028
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5029
+ > {
5020
5030
  topK?: number;
5021
5031
  namespace?: string;
5022
5032
  returnValues?: boolean;
5023
- returnMetadata?: boolean;
5033
+ returnMetadata?: MetadataReturn;
5024
5034
  filter?: VectorizeVectorMetadataFilter;
5025
5035
  }
5026
5036
  /**
@@ -5059,7 +5069,7 @@ export interface VectorizeVector {
5059
5069
  values: VectorFloatArray | number[];
5060
5070
  /** The namespace this vector belongs to. */
5061
5071
  namespace?: string;
5062
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5072
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5063
5073
  metadata?: Record<string, VectorizeVectorMetadata>;
5064
5074
  }
5065
5075
  /**
@@ -5071,7 +5081,7 @@ export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5071
5081
  score: number;
5072
5082
  };
5073
5083
  /**
5074
- * A set of vector {@link VectorizeMatch} for a particular query.
5084
+ * A set of matching {@link VectorizeMatch} for a particular query.
5075
5085
  */
5076
5086
  export interface VectorizeMatches {
5077
5087
  matches: VectorizeMatch[];
@@ -5080,6 +5090,9 @@ export interface VectorizeMatches {
5080
5090
  /**
5081
5091
  * Results of an operation that performed a mutation on a set of vectors.
5082
5092
  * Here, `ids` is a list of vectors that were successfully processed.
5093
+ *
5094
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5095
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5083
5096
  */
5084
5097
  export interface VectorizeVectorMutation {
5085
5098
  /* List of ids of vectors that were successfully processed. */
@@ -5088,14 +5101,19 @@ export interface VectorizeVectorMutation {
5088
5101
  count: number;
5089
5102
  }
5090
5103
  /**
5091
- * Results of an operation that performed a mutation on a set of vectors
5092
- * with the v2 version of Vectorize.
5093
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5104
+ * Result type indicating a mutation on the Vectorize Index.
5105
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5094
5106
  */
5095
- export interface VectorizeVectorMutationV2 {
5096
- /* The identifier for the last mutation processed by Vectorize. */
5107
+ export interface VectorizeAsyncMutation {
5108
+ /** The unique identifier for the async mutation operation containing the changeset. */
5097
5109
  mutationId: string;
5098
5110
  }
5111
+ /**
5112
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5113
+ *
5114
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5115
+ * See {@link Vectorize} for its new implementation.
5116
+ */
5099
5117
  export declare abstract class VectorizeIndex {
5100
5118
  /**
5101
5119
  * Get information about the currently bound index.
@@ -5137,6 +5155,52 @@ export declare abstract class VectorizeIndex {
5137
5155
  */
5138
5156
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5139
5157
  }
5158
+ /**
5159
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5160
+ *
5161
+ * Mutations in this version are async, returning a mutation id.
5162
+ */
5163
+ export declare abstract class Vectorize {
5164
+ /**
5165
+ * Get information about the currently bound index.
5166
+ * @returns A promise that resolves with information about the current index.
5167
+ */
5168
+ public describe(): Promise<VectorizeIndexDetails>;
5169
+ /**
5170
+ * Use the provided vector to perform a similarity search across the index.
5171
+ * @param vector Input vector that will be used to drive the similarity search.
5172
+ * @param options Configuration options to massage the returned data.
5173
+ * @returns A promise that resolves with matched and scored vectors.
5174
+ */
5175
+ public query(
5176
+ vector: VectorFloatArray | number[],
5177
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5178
+ ): Promise<VectorizeMatches>;
5179
+ /**
5180
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5181
+ * @param vectors List of vectors that will be inserted.
5182
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5183
+ */
5184
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5185
+ /**
5186
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5187
+ * @param vectors List of vectors that will be upserted.
5188
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5189
+ */
5190
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5191
+ /**
5192
+ * Delete a list of vectors with a matching id.
5193
+ * @param ids List of vector ids that should be deleted.
5194
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5195
+ */
5196
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5197
+ /**
5198
+ * Get a list of vectors with a matching id.
5199
+ * @param ids List of vector ids that should be returned.
5200
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5201
+ */
5202
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5203
+ }
5140
5204
  /**
5141
5205
  * The interface for "version_metadata" binding
5142
5206
  * providing metadata about the Worker Version using this binding.
@@ -1604,12 +1604,6 @@ declare class Request<
1604
1604
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1605
1605
  */
1606
1606
  get keepalive(): boolean;
1607
- /**
1608
- * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
1609
- *
1610
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
1611
- */
1612
- get cache(): string | undefined;
1613
1607
  }
1614
1608
  interface RequestInit<Cf = CfProperties> {
1615
1609
  /* A string to set request's method. */
@@ -1622,8 +1616,6 @@ interface RequestInit<Cf = CfProperties> {
1622
1616
  redirect?: string;
1623
1617
  fetcher?: Fetcher | null;
1624
1618
  cf?: Cf;
1625
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1626
- cache?: string;
1627
1619
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1628
1620
  integrity?: string;
1629
1621
  /* An AbortSignal to set request's signal. */
@@ -4619,7 +4611,7 @@ declare abstract class D1PreparedStatement {
4619
4611
  bind(...values: unknown[]): D1PreparedStatement;
4620
4612
  first<T = unknown>(colName: string): Promise<T | null>;
4621
4613
  first<T = Record<string, unknown>>(): Promise<T | null>;
4622
- run(): Promise<D1Response>;
4614
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4623
4615
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4624
4616
  raw<T = unknown[]>(options: {
4625
4617
  columnNames: true;
@@ -5088,11 +5080,23 @@ type VectorizeVectorMetadataFilter = {
5088
5080
  * Distance metrics determine how other "similar" vectors are determined.
5089
5081
  */
5090
5082
  type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5091
- interface VectorizeQueryOptions {
5083
+ /**
5084
+ * Metadata return levels for a Vectorize query.
5085
+ *
5086
+ * Default to "none".
5087
+ *
5088
+ * @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.
5089
+ * @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).
5090
+ * @property none No indexed metadata will be returned.
5091
+ */
5092
+ type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5093
+ interface VectorizeQueryOptions<
5094
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5095
+ > {
5092
5096
  topK?: number;
5093
5097
  namespace?: string;
5094
5098
  returnValues?: boolean;
5095
- returnMetadata?: boolean;
5099
+ returnMetadata?: MetadataReturn;
5096
5100
  filter?: VectorizeVectorMetadataFilter;
5097
5101
  }
5098
5102
  /**
@@ -5131,7 +5135,7 @@ interface VectorizeVector {
5131
5135
  values: VectorFloatArray | number[];
5132
5136
  /** The namespace this vector belongs to. */
5133
5137
  namespace?: string;
5134
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5138
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5135
5139
  metadata?: Record<string, VectorizeVectorMetadata>;
5136
5140
  }
5137
5141
  /**
@@ -5143,7 +5147,7 @@ type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5143
5147
  score: number;
5144
5148
  };
5145
5149
  /**
5146
- * A set of vector {@link VectorizeMatch} for a particular query.
5150
+ * A set of matching {@link VectorizeMatch} for a particular query.
5147
5151
  */
5148
5152
  interface VectorizeMatches {
5149
5153
  matches: VectorizeMatch[];
@@ -5152,6 +5156,9 @@ interface VectorizeMatches {
5152
5156
  /**
5153
5157
  * Results of an operation that performed a mutation on a set of vectors.
5154
5158
  * Here, `ids` is a list of vectors that were successfully processed.
5159
+ *
5160
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5161
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5155
5162
  */
5156
5163
  interface VectorizeVectorMutation {
5157
5164
  /* List of ids of vectors that were successfully processed. */
@@ -5160,14 +5167,19 @@ interface VectorizeVectorMutation {
5160
5167
  count: number;
5161
5168
  }
5162
5169
  /**
5163
- * Results of an operation that performed a mutation on a set of vectors
5164
- * with the v2 version of Vectorize.
5165
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5170
+ * Result type indicating a mutation on the Vectorize Index.
5171
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5166
5172
  */
5167
- interface VectorizeVectorMutationV2 {
5168
- /* The identifier for the last mutation processed by Vectorize. */
5173
+ interface VectorizeAsyncMutation {
5174
+ /** The unique identifier for the async mutation operation containing the changeset. */
5169
5175
  mutationId: string;
5170
5176
  }
5177
+ /**
5178
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5179
+ *
5180
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5181
+ * See {@link Vectorize} for its new implementation.
5182
+ */
5171
5183
  declare abstract class VectorizeIndex {
5172
5184
  /**
5173
5185
  * Get information about the currently bound index.
@@ -5209,6 +5221,52 @@ declare abstract class VectorizeIndex {
5209
5221
  */
5210
5222
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5211
5223
  }
5224
+ /**
5225
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5226
+ *
5227
+ * Mutations in this version are async, returning a mutation id.
5228
+ */
5229
+ declare abstract class Vectorize {
5230
+ /**
5231
+ * Get information about the currently bound index.
5232
+ * @returns A promise that resolves with information about the current index.
5233
+ */
5234
+ public describe(): Promise<VectorizeIndexDetails>;
5235
+ /**
5236
+ * Use the provided vector to perform a similarity search across the index.
5237
+ * @param vector Input vector that will be used to drive the similarity search.
5238
+ * @param options Configuration options to massage the returned data.
5239
+ * @returns A promise that resolves with matched and scored vectors.
5240
+ */
5241
+ public query(
5242
+ vector: VectorFloatArray | number[],
5243
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5244
+ ): Promise<VectorizeMatches>;
5245
+ /**
5246
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5247
+ * @param vectors List of vectors that will be inserted.
5248
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5249
+ */
5250
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5251
+ /**
5252
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5253
+ * @param vectors List of vectors that will be upserted.
5254
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5255
+ */
5256
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5257
+ /**
5258
+ * Delete a list of vectors with a matching id.
5259
+ * @param ids List of vector ids that should be deleted.
5260
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5261
+ */
5262
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5263
+ /**
5264
+ * Get a list of vectors with a matching id.
5265
+ * @param ids List of vector ids that should be returned.
5266
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5267
+ */
5268
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5269
+ }
5212
5270
  /**
5213
5271
  * The interface for "version_metadata" binding
5214
5272
  * providing metadata about the Worker Version using this binding.
@@ -1609,12 +1609,6 @@ export declare class Request<
1609
1609
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
1610
1610
  */
1611
1611
  get keepalive(): boolean;
1612
- /**
1613
- * Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
1614
- *
1615
- * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
1616
- */
1617
- get cache(): string | undefined;
1618
1612
  }
1619
1613
  export interface RequestInit<Cf = CfProperties> {
1620
1614
  /* A string to set request's method. */
@@ -1627,8 +1621,6 @@ export interface RequestInit<Cf = CfProperties> {
1627
1621
  redirect?: string;
1628
1622
  fetcher?: Fetcher | null;
1629
1623
  cf?: Cf;
1630
- /* A string indicating how the request will interact with the browser's cache to set request's cache. */
1631
- cache?: string;
1632
1624
  /* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
1633
1625
  integrity?: string;
1634
1626
  /* An AbortSignal to set request's signal. */
@@ -4641,7 +4633,7 @@ export declare abstract class D1PreparedStatement {
4641
4633
  bind(...values: unknown[]): D1PreparedStatement;
4642
4634
  first<T = unknown>(colName: string): Promise<T | null>;
4643
4635
  first<T = Record<string, unknown>>(): Promise<T | null>;
4644
- run(): Promise<D1Response>;
4636
+ run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4645
4637
  all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
4646
4638
  raw<T = unknown[]>(options: {
4647
4639
  columnNames: true;
@@ -5048,11 +5040,23 @@ export type VectorizeVectorMetadataFilter = {
5048
5040
  * Distance metrics determine how other "similar" vectors are determined.
5049
5041
  */
5050
5042
  export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
5051
- export interface VectorizeQueryOptions {
5043
+ /**
5044
+ * Metadata return levels for a Vectorize query.
5045
+ *
5046
+ * Default to "none".
5047
+ *
5048
+ * @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.
5049
+ * @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).
5050
+ * @property none No indexed metadata will be returned.
5051
+ */
5052
+ export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
5053
+ export interface VectorizeQueryOptions<
5054
+ MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
5055
+ > {
5052
5056
  topK?: number;
5053
5057
  namespace?: string;
5054
5058
  returnValues?: boolean;
5055
- returnMetadata?: boolean;
5059
+ returnMetadata?: MetadataReturn;
5056
5060
  filter?: VectorizeVectorMetadataFilter;
5057
5061
  }
5058
5062
  /**
@@ -5091,7 +5095,7 @@ export interface VectorizeVector {
5091
5095
  values: VectorFloatArray | number[];
5092
5096
  /** The namespace this vector belongs to. */
5093
5097
  namespace?: string;
5094
- /** Metadata associated with the vector. Includes the values of the other fields and potentially additional details. */
5098
+ /** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
5095
5099
  metadata?: Record<string, VectorizeVectorMetadata>;
5096
5100
  }
5097
5101
  /**
@@ -5103,7 +5107,7 @@ export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
5103
5107
  score: number;
5104
5108
  };
5105
5109
  /**
5106
- * A set of vector {@link VectorizeMatch} for a particular query.
5110
+ * A set of matching {@link VectorizeMatch} for a particular query.
5107
5111
  */
5108
5112
  export interface VectorizeMatches {
5109
5113
  matches: VectorizeMatch[];
@@ -5112,6 +5116,9 @@ export interface VectorizeMatches {
5112
5116
  /**
5113
5117
  * Results of an operation that performed a mutation on a set of vectors.
5114
5118
  * Here, `ids` is a list of vectors that were successfully processed.
5119
+ *
5120
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5121
+ * See {@link VectorizeAsyncMutation} for its post-beta equivalent.
5115
5122
  */
5116
5123
  export interface VectorizeVectorMutation {
5117
5124
  /* List of ids of vectors that were successfully processed. */
@@ -5120,14 +5127,19 @@ export interface VectorizeVectorMutation {
5120
5127
  count: number;
5121
5128
  }
5122
5129
  /**
5123
- * Results of an operation that performed a mutation on a set of vectors
5124
- * with the v2 version of Vectorize.
5125
- * Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
5130
+ * Result type indicating a mutation on the Vectorize Index.
5131
+ * Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
5126
5132
  */
5127
- export interface VectorizeVectorMutationV2 {
5128
- /* The identifier for the last mutation processed by Vectorize. */
5133
+ export interface VectorizeAsyncMutation {
5134
+ /** The unique identifier for the async mutation operation containing the changeset. */
5129
5135
  mutationId: string;
5130
5136
  }
5137
+ /**
5138
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5139
+ *
5140
+ * This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
5141
+ * See {@link Vectorize} for its new implementation.
5142
+ */
5131
5143
  export declare abstract class VectorizeIndex {
5132
5144
  /**
5133
5145
  * Get information about the currently bound index.
@@ -5169,6 +5181,52 @@ export declare abstract class VectorizeIndex {
5169
5181
  */
5170
5182
  public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5171
5183
  }
5184
+ /**
5185
+ * A Vectorize Vector Search Index for querying vectors/embeddings.
5186
+ *
5187
+ * Mutations in this version are async, returning a mutation id.
5188
+ */
5189
+ export declare abstract class Vectorize {
5190
+ /**
5191
+ * Get information about the currently bound index.
5192
+ * @returns A promise that resolves with information about the current index.
5193
+ */
5194
+ public describe(): Promise<VectorizeIndexDetails>;
5195
+ /**
5196
+ * Use the provided vector to perform a similarity search across the index.
5197
+ * @param vector Input vector that will be used to drive the similarity search.
5198
+ * @param options Configuration options to massage the returned data.
5199
+ * @returns A promise that resolves with matched and scored vectors.
5200
+ */
5201
+ public query(
5202
+ vector: VectorFloatArray | number[],
5203
+ options: VectorizeQueryOptions<VectorizeMetadataRetrievalLevel>,
5204
+ ): Promise<VectorizeMatches>;
5205
+ /**
5206
+ * Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
5207
+ * @param vectors List of vectors that will be inserted.
5208
+ * @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
5209
+ */
5210
+ public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5211
+ /**
5212
+ * Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
5213
+ * @param vectors List of vectors that will be upserted.
5214
+ * @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
5215
+ */
5216
+ public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
5217
+ /**
5218
+ * Delete a list of vectors with a matching id.
5219
+ * @param ids List of vector ids that should be deleted.
5220
+ * @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
5221
+ */
5222
+ public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
5223
+ /**
5224
+ * Get a list of vectors with a matching id.
5225
+ * @param ids List of vector ids that should be returned.
5226
+ * @returns A promise that resolves with the raw unscored vectors matching the id set.
5227
+ */
5228
+ public getByIds(ids: string[]): Promise<VectorizeVector[]>;
5229
+ }
5172
5230
  /**
5173
5231
  * The interface for "version_metadata" binding
5174
5232
  * providing metadata about the Worker Version using this binding.