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