@cloudflare/workers-types 4.20240815.0 → 4.20240903.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.
- package/2021-11-03/index.d.ts +51 -23
- package/2021-11-03/index.ts +25 -10
- package/2022-01-31/index.d.ts +51 -23
- package/2022-01-31/index.ts +25 -10
- package/2022-03-21/index.d.ts +51 -23
- package/2022-03-21/index.ts +25 -10
- package/2022-08-04/index.d.ts +51 -23
- package/2022-08-04/index.ts +25 -10
- package/2022-10-31/index.d.ts +58 -30
- package/2022-10-31/index.ts +32 -17
- package/2022-11-30/index.d.ts +58 -30
- package/2022-11-30/index.ts +32 -17
- package/2023-03-01/index.d.ts +58 -30
- package/2023-03-01/index.ts +32 -17
- package/2023-07-01/index.d.ts +60 -32
- package/2023-07-01/index.ts +34 -19
- package/experimental/index.d.ts +68 -32
- package/experimental/index.ts +42 -19
- package/index.d.ts +51 -23
- package/index.ts +25 -10
- package/oldest/index.d.ts +51 -23
- package/oldest/index.ts +25 -10
- package/package.json +1 -1
package/2023-07-01/index.d.ts
CHANGED
|
@@ -235,6 +235,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
235
235
|
caches: CacheStorage;
|
|
236
236
|
scheduler: Scheduler;
|
|
237
237
|
performance: Performance;
|
|
238
|
+
Cloudflare: Cloudflare;
|
|
238
239
|
readonly origin: string;
|
|
239
240
|
Event: typeof Event;
|
|
240
241
|
ExtendableEvent: typeof ExtendableEvent;
|
|
@@ -391,6 +392,7 @@ declare const scheduler: Scheduler;
|
|
|
391
392
|
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
392
393
|
*/
|
|
393
394
|
declare const performance: Performance;
|
|
395
|
+
declare const Cloudflare: Cloudflare;
|
|
394
396
|
declare const origin: string;
|
|
395
397
|
declare const navigator: Navigator;
|
|
396
398
|
interface TestController {}
|
|
@@ -481,6 +483,9 @@ interface AlarmInvocationInfo {
|
|
|
481
483
|
readonly isRetry: boolean;
|
|
482
484
|
readonly retryCount: number;
|
|
483
485
|
}
|
|
486
|
+
interface Cloudflare {
|
|
487
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
488
|
+
}
|
|
484
489
|
interface DurableObject {
|
|
485
490
|
fetch(request: Request): Response | Promise<Response>;
|
|
486
491
|
alarm?(): void | Promise<void>;
|
|
@@ -2273,15 +2278,15 @@ declare class TransformStream<I = any, O = any> {
|
|
|
2273
2278
|
}
|
|
2274
2279
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
2275
2280
|
constructor(
|
|
2276
|
-
|
|
2277
|
-
|
|
2281
|
+
param1: number | bigint,
|
|
2282
|
+
param2?: IdentityTransformStreamQueuingStrategy,
|
|
2278
2283
|
);
|
|
2279
2284
|
}
|
|
2280
2285
|
declare class IdentityTransformStream extends TransformStream<
|
|
2281
2286
|
ArrayBuffer | ArrayBufferView,
|
|
2282
2287
|
Uint8Array
|
|
2283
2288
|
> {
|
|
2284
|
-
constructor(
|
|
2289
|
+
constructor(param1?: IdentityTransformStreamQueuingStrategy);
|
|
2285
2290
|
}
|
|
2286
2291
|
interface IdentityTransformStreamQueuingStrategy {
|
|
2287
2292
|
highWaterMark?: number | bigint;
|
|
@@ -2313,7 +2318,7 @@ declare class TextDecoderStream extends TransformStream<
|
|
|
2313
2318
|
ArrayBuffer | ArrayBufferView,
|
|
2314
2319
|
string
|
|
2315
2320
|
> {
|
|
2316
|
-
constructor(
|
|
2321
|
+
constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
|
|
2317
2322
|
get encoding(): string;
|
|
2318
2323
|
get fatal(): boolean;
|
|
2319
2324
|
get ignoreBOM(): boolean;
|
|
@@ -2527,13 +2532,13 @@ declare class URL {
|
|
|
2527
2532
|
/*function toString() { [native code] }*/
|
|
2528
2533
|
toString(): string;
|
|
2529
2534
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
|
|
2530
|
-
static canParse(
|
|
2531
|
-
static parse(
|
|
2535
|
+
static canParse(param0: string, param1?: string): boolean;
|
|
2536
|
+
static parse(param1: string, param2?: string): URL | null;
|
|
2532
2537
|
}
|
|
2533
2538
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
|
|
2534
2539
|
declare class URLSearchParams {
|
|
2535
2540
|
constructor(
|
|
2536
|
-
|
|
2541
|
+
param0?: Iterable<Iterable<string>> | Record<string, string> | string,
|
|
2537
2542
|
);
|
|
2538
2543
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) */
|
|
2539
2544
|
get size(): number;
|
|
@@ -2542,37 +2547,37 @@ declare class URLSearchParams {
|
|
|
2542
2547
|
*
|
|
2543
2548
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
|
|
2544
2549
|
*/
|
|
2545
|
-
append(
|
|
2550
|
+
append(param0: string, param1: string): void;
|
|
2546
2551
|
/**
|
|
2547
2552
|
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
|
|
2548
2553
|
*
|
|
2549
2554
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
|
|
2550
2555
|
*/
|
|
2551
|
-
delete(
|
|
2556
|
+
delete(param1: string, param2?: string): void;
|
|
2552
2557
|
/**
|
|
2553
2558
|
* Returns the first value associated to the given search parameter.
|
|
2554
2559
|
*
|
|
2555
2560
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
|
|
2556
2561
|
*/
|
|
2557
|
-
get(
|
|
2562
|
+
get(param0: string): string | null;
|
|
2558
2563
|
/**
|
|
2559
2564
|
* Returns all the values association with a given search parameter.
|
|
2560
2565
|
*
|
|
2561
2566
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
|
|
2562
2567
|
*/
|
|
2563
|
-
getAll(
|
|
2568
|
+
getAll(param0: string): string[];
|
|
2564
2569
|
/**
|
|
2565
2570
|
* Returns a Boolean indicating if such a search parameter exists.
|
|
2566
2571
|
*
|
|
2567
2572
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
|
|
2568
2573
|
*/
|
|
2569
|
-
has(
|
|
2574
|
+
has(param1: string, param2?: string): boolean;
|
|
2570
2575
|
/**
|
|
2571
2576
|
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
|
|
2572
2577
|
*
|
|
2573
2578
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
|
|
2574
2579
|
*/
|
|
2575
|
-
set(
|
|
2580
|
+
set(param0: string, param1: string): void;
|
|
2576
2581
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) */
|
|
2577
2582
|
sort(): void;
|
|
2578
2583
|
/* Returns an array of key, value pairs for every entry in the search params. */
|
|
@@ -4942,6 +4947,18 @@ type PagesPluginFunction<
|
|
|
4942
4947
|
declare module "assets:*" {
|
|
4943
4948
|
export const onRequest: PagesFunction;
|
|
4944
4949
|
}
|
|
4950
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4951
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4952
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4953
|
+
declare abstract class PipelineTransform {
|
|
4954
|
+
/**
|
|
4955
|
+
* transformJson recieves an array of javascript objects which can be
|
|
4956
|
+
* mutated and returned to the pipeline
|
|
4957
|
+
* @param data The data to be mutated
|
|
4958
|
+
* @returns A promise containing the mutated data
|
|
4959
|
+
*/
|
|
4960
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
4961
|
+
}
|
|
4945
4962
|
// PubSubMessage represents an incoming PubSub message.
|
|
4946
4963
|
// The message includes metadata about the broker, the client, and the payload
|
|
4947
4964
|
// itself.
|
|
@@ -5188,7 +5205,7 @@ declare module "cloudflare:workers" {
|
|
|
5188
5205
|
): void | Promise<void>;
|
|
5189
5206
|
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
5190
5207
|
}
|
|
5191
|
-
export type
|
|
5208
|
+
export type WorkflowDurationLabel =
|
|
5192
5209
|
| "second"
|
|
5193
5210
|
| "minute"
|
|
5194
5211
|
| "hour"
|
|
@@ -5196,13 +5213,32 @@ declare module "cloudflare:workers" {
|
|
|
5196
5213
|
| "week"
|
|
5197
5214
|
| "month"
|
|
5198
5215
|
| "year";
|
|
5199
|
-
export type
|
|
5200
|
-
|
|
5216
|
+
export type WorkflowSleepDuration =
|
|
5217
|
+
| `${number} ${WorkflowDurationLabel}${"s" | ""}`
|
|
5218
|
+
| number;
|
|
5219
|
+
export type WorkflowBackoff = "constant" | "linear" | "exponential";
|
|
5220
|
+
export type WorkflowStepConfig = {
|
|
5221
|
+
retries?: {
|
|
5222
|
+
limit: number;
|
|
5223
|
+
delay: string | number;
|
|
5224
|
+
backoff?: WorkflowBackoff;
|
|
5225
|
+
};
|
|
5226
|
+
timeout?: string | number;
|
|
5227
|
+
};
|
|
5228
|
+
export type WorkflowEvent<T> = {
|
|
5229
|
+
payload: T;
|
|
5230
|
+
timestamp: Date;
|
|
5231
|
+
};
|
|
5232
|
+
export type WorkflowStep = {
|
|
5201
5233
|
do: <T extends Rpc.Serializable>(
|
|
5202
5234
|
name: string,
|
|
5203
|
-
callback: () => T
|
|
5204
|
-
|
|
5205
|
-
|
|
5235
|
+
callback: () => Promise<T>,
|
|
5236
|
+
config?: WorkflowStepConfig,
|
|
5237
|
+
) => Promise<T>;
|
|
5238
|
+
sleep: (
|
|
5239
|
+
name: string,
|
|
5240
|
+
duration: WorkflowSleepDuration,
|
|
5241
|
+
) => void | Promise<void>;
|
|
5206
5242
|
};
|
|
5207
5243
|
export abstract class Workflow<
|
|
5208
5244
|
Env = unknown,
|
|
@@ -5212,13 +5248,7 @@ declare module "cloudflare:workers" {
|
|
|
5212
5248
|
[Rpc.__WORKFLOW_BRAND]: never;
|
|
5213
5249
|
protected ctx: ExecutionContext;
|
|
5214
5250
|
protected env: Env;
|
|
5215
|
-
run(
|
|
5216
|
-
events: Array<{
|
|
5217
|
-
payload: T;
|
|
5218
|
-
timestamp: Date;
|
|
5219
|
-
}>,
|
|
5220
|
-
step: WorkflowStep,
|
|
5221
|
-
): unknown | Promise<unknown>;
|
|
5251
|
+
run(events: Array<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;
|
|
5222
5252
|
}
|
|
5223
5253
|
}
|
|
5224
5254
|
declare module "cloudflare:sockets" {
|
|
@@ -5281,13 +5311,11 @@ type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
|
|
|
5281
5311
|
* @property none No indexed metadata will be returned.
|
|
5282
5312
|
*/
|
|
5283
5313
|
type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
|
|
5284
|
-
interface VectorizeQueryOptions
|
|
5285
|
-
MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
|
|
5286
|
-
> {
|
|
5314
|
+
interface VectorizeQueryOptions {
|
|
5287
5315
|
topK?: number;
|
|
5288
5316
|
namespace?: string;
|
|
5289
5317
|
returnValues?: boolean;
|
|
5290
|
-
returnMetadata?:
|
|
5318
|
+
returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
|
|
5291
5319
|
filter?: VectorizeVectorMetadataFilter;
|
|
5292
5320
|
}
|
|
5293
5321
|
/**
|
|
@@ -5401,7 +5429,7 @@ declare abstract class VectorizeIndex {
|
|
|
5401
5429
|
*/
|
|
5402
5430
|
public query(
|
|
5403
5431
|
vector: VectorFloatArray | number[],
|
|
5404
|
-
options
|
|
5432
|
+
options?: VectorizeQueryOptions,
|
|
5405
5433
|
): Promise<VectorizeMatches>;
|
|
5406
5434
|
/**
|
|
5407
5435
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
@@ -5447,7 +5475,7 @@ declare abstract class Vectorize {
|
|
|
5447
5475
|
*/
|
|
5448
5476
|
public query(
|
|
5449
5477
|
vector: VectorFloatArray | number[],
|
|
5450
|
-
options
|
|
5478
|
+
options?: VectorizeQueryOptions,
|
|
5451
5479
|
): Promise<VectorizeMatches>;
|
|
5452
5480
|
/**
|
|
5453
5481
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
package/2023-07-01/index.ts
CHANGED
|
@@ -235,6 +235,7 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
235
235
|
caches: CacheStorage;
|
|
236
236
|
scheduler: Scheduler;
|
|
237
237
|
performance: Performance;
|
|
238
|
+
Cloudflare: Cloudflare;
|
|
238
239
|
readonly origin: string;
|
|
239
240
|
Event: typeof Event;
|
|
240
241
|
ExtendableEvent: typeof ExtendableEvent;
|
|
@@ -393,6 +394,7 @@ export declare const scheduler: Scheduler;
|
|
|
393
394
|
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
394
395
|
*/
|
|
395
396
|
export declare const performance: Performance;
|
|
397
|
+
export declare const Cloudflare: Cloudflare;
|
|
396
398
|
export declare const origin: string;
|
|
397
399
|
export declare const navigator: Navigator;
|
|
398
400
|
export interface TestController {}
|
|
@@ -486,6 +488,9 @@ export interface AlarmInvocationInfo {
|
|
|
486
488
|
readonly isRetry: boolean;
|
|
487
489
|
readonly retryCount: number;
|
|
488
490
|
}
|
|
491
|
+
export interface Cloudflare {
|
|
492
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
493
|
+
}
|
|
489
494
|
export interface DurableObject {
|
|
490
495
|
fetch(request: Request): Response | Promise<Response>;
|
|
491
496
|
alarm?(): void | Promise<void>;
|
|
@@ -2279,15 +2284,15 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
2279
2284
|
}
|
|
2280
2285
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
2281
2286
|
constructor(
|
|
2282
|
-
|
|
2283
|
-
|
|
2287
|
+
param1: number | bigint,
|
|
2288
|
+
param2?: IdentityTransformStreamQueuingStrategy,
|
|
2284
2289
|
);
|
|
2285
2290
|
}
|
|
2286
2291
|
export declare class IdentityTransformStream extends TransformStream<
|
|
2287
2292
|
ArrayBuffer | ArrayBufferView,
|
|
2288
2293
|
Uint8Array
|
|
2289
2294
|
> {
|
|
2290
|
-
constructor(
|
|
2295
|
+
constructor(param1?: IdentityTransformStreamQueuingStrategy);
|
|
2291
2296
|
}
|
|
2292
2297
|
export interface IdentityTransformStreamQueuingStrategy {
|
|
2293
2298
|
highWaterMark?: number | bigint;
|
|
@@ -2322,7 +2327,7 @@ export declare class TextDecoderStream extends TransformStream<
|
|
|
2322
2327
|
ArrayBuffer | ArrayBufferView,
|
|
2323
2328
|
string
|
|
2324
2329
|
> {
|
|
2325
|
-
constructor(
|
|
2330
|
+
constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
|
|
2326
2331
|
get encoding(): string;
|
|
2327
2332
|
get fatal(): boolean;
|
|
2328
2333
|
get ignoreBOM(): boolean;
|
|
@@ -2536,13 +2541,13 @@ export declare class URL {
|
|
|
2536
2541
|
/*function toString() { [native code] }*/
|
|
2537
2542
|
toString(): string;
|
|
2538
2543
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
|
|
2539
|
-
static canParse(
|
|
2540
|
-
static parse(
|
|
2544
|
+
static canParse(param0: string, param1?: string): boolean;
|
|
2545
|
+
static parse(param1: string, param2?: string): URL | null;
|
|
2541
2546
|
}
|
|
2542
2547
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
|
|
2543
2548
|
export declare class URLSearchParams {
|
|
2544
2549
|
constructor(
|
|
2545
|
-
|
|
2550
|
+
param0?: Iterable<Iterable<string>> | Record<string, string> | string,
|
|
2546
2551
|
);
|
|
2547
2552
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) */
|
|
2548
2553
|
get size(): number;
|
|
@@ -2551,37 +2556,37 @@ export declare class URLSearchParams {
|
|
|
2551
2556
|
*
|
|
2552
2557
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
|
|
2553
2558
|
*/
|
|
2554
|
-
append(
|
|
2559
|
+
append(param0: string, param1: string): void;
|
|
2555
2560
|
/**
|
|
2556
2561
|
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
|
|
2557
2562
|
*
|
|
2558
2563
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
|
|
2559
2564
|
*/
|
|
2560
|
-
delete(
|
|
2565
|
+
delete(param1: string, param2?: string): void;
|
|
2561
2566
|
/**
|
|
2562
2567
|
* Returns the first value associated to the given search parameter.
|
|
2563
2568
|
*
|
|
2564
2569
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
|
|
2565
2570
|
*/
|
|
2566
|
-
get(
|
|
2571
|
+
get(param0: string): string | null;
|
|
2567
2572
|
/**
|
|
2568
2573
|
* Returns all the values association with a given search parameter.
|
|
2569
2574
|
*
|
|
2570
2575
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
|
|
2571
2576
|
*/
|
|
2572
|
-
getAll(
|
|
2577
|
+
getAll(param0: string): string[];
|
|
2573
2578
|
/**
|
|
2574
2579
|
* Returns a Boolean indicating if such a search parameter exists.
|
|
2575
2580
|
*
|
|
2576
2581
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
|
|
2577
2582
|
*/
|
|
2578
|
-
has(
|
|
2583
|
+
has(param1: string, param2?: string): boolean;
|
|
2579
2584
|
/**
|
|
2580
2585
|
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
|
|
2581
2586
|
*
|
|
2582
2587
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
|
|
2583
2588
|
*/
|
|
2584
|
-
set(
|
|
2589
|
+
set(param0: string, param1: string): void;
|
|
2585
2590
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) */
|
|
2586
2591
|
sort(): void;
|
|
2587
2592
|
/* Returns an array of key, value pairs for every entry in the search params. */
|
|
@@ -4954,6 +4959,18 @@ export type PagesPluginFunction<
|
|
|
4954
4959
|
> = (
|
|
4955
4960
|
context: EventPluginContext<Env, Params, Data, PluginArgs>,
|
|
4956
4961
|
) => Response | Promise<Response>;
|
|
4962
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4963
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4964
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4965
|
+
export declare abstract class PipelineTransform {
|
|
4966
|
+
/**
|
|
4967
|
+
* transformJson recieves an array of javascript objects which can be
|
|
4968
|
+
* mutated and returned to the pipeline
|
|
4969
|
+
* @param data The data to be mutated
|
|
4970
|
+
* @returns A promise containing the mutated data
|
|
4971
|
+
*/
|
|
4972
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
4973
|
+
}
|
|
4957
4974
|
// PubSubMessage represents an incoming PubSub message.
|
|
4958
4975
|
// The message includes metadata about the broker, the client, and the payload
|
|
4959
4976
|
// itself.
|
|
@@ -5209,13 +5226,11 @@ export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
|
|
|
5209
5226
|
* @property none No indexed metadata will be returned.
|
|
5210
5227
|
*/
|
|
5211
5228
|
export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
|
|
5212
|
-
export interface VectorizeQueryOptions
|
|
5213
|
-
MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
|
|
5214
|
-
> {
|
|
5229
|
+
export interface VectorizeQueryOptions {
|
|
5215
5230
|
topK?: number;
|
|
5216
5231
|
namespace?: string;
|
|
5217
5232
|
returnValues?: boolean;
|
|
5218
|
-
returnMetadata?:
|
|
5233
|
+
returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
|
|
5219
5234
|
filter?: VectorizeVectorMetadataFilter;
|
|
5220
5235
|
}
|
|
5221
5236
|
/**
|
|
@@ -5329,7 +5344,7 @@ export declare abstract class VectorizeIndex {
|
|
|
5329
5344
|
*/
|
|
5330
5345
|
public query(
|
|
5331
5346
|
vector: VectorFloatArray | number[],
|
|
5332
|
-
options
|
|
5347
|
+
options?: VectorizeQueryOptions,
|
|
5333
5348
|
): Promise<VectorizeMatches>;
|
|
5334
5349
|
/**
|
|
5335
5350
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
@@ -5375,7 +5390,7 @@ export declare abstract class Vectorize {
|
|
|
5375
5390
|
*/
|
|
5376
5391
|
public query(
|
|
5377
5392
|
vector: VectorFloatArray | number[],
|
|
5378
|
-
options
|
|
5393
|
+
options?: VectorizeQueryOptions,
|
|
5379
5394
|
): Promise<VectorizeMatches>;
|
|
5380
5395
|
/**
|
|
5381
5396
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
package/experimental/index.d.ts
CHANGED
|
@@ -235,6 +235,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
235
235
|
caches: CacheStorage;
|
|
236
236
|
scheduler: Scheduler;
|
|
237
237
|
performance: Performance;
|
|
238
|
+
Cloudflare: Cloudflare;
|
|
238
239
|
readonly origin: string;
|
|
239
240
|
Event: typeof Event;
|
|
240
241
|
ExtendableEvent: typeof ExtendableEvent;
|
|
@@ -391,6 +392,7 @@ declare const scheduler: Scheduler;
|
|
|
391
392
|
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
392
393
|
*/
|
|
393
394
|
declare const performance: Performance;
|
|
395
|
+
declare const Cloudflare: Cloudflare;
|
|
394
396
|
declare const origin: string;
|
|
395
397
|
declare const navigator: Navigator;
|
|
396
398
|
interface TestController {}
|
|
@@ -482,6 +484,9 @@ interface AlarmInvocationInfo {
|
|
|
482
484
|
readonly isRetry: boolean;
|
|
483
485
|
readonly retryCount: number;
|
|
484
486
|
}
|
|
487
|
+
interface Cloudflare {
|
|
488
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
489
|
+
}
|
|
485
490
|
interface DurableObject {
|
|
486
491
|
fetch(request: Request): Response | Promise<Response>;
|
|
487
492
|
alarm?(): void | Promise<void>;
|
|
@@ -1638,6 +1643,12 @@ declare class Request<
|
|
|
1638
1643
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
|
|
1639
1644
|
*/
|
|
1640
1645
|
get keepalive(): boolean;
|
|
1646
|
+
/**
|
|
1647
|
+
* Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
|
|
1648
|
+
*
|
|
1649
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
|
|
1650
|
+
*/
|
|
1651
|
+
cache?: "no-store";
|
|
1641
1652
|
}
|
|
1642
1653
|
interface RequestInit<Cf = CfProperties> {
|
|
1643
1654
|
/* A string to set request's method. */
|
|
@@ -1650,6 +1661,8 @@ interface RequestInit<Cf = CfProperties> {
|
|
|
1650
1661
|
redirect?: string;
|
|
1651
1662
|
fetcher?: Fetcher | null;
|
|
1652
1663
|
cf?: Cf;
|
|
1664
|
+
/* A string indicating how the request will interact with the browser's cache to set request's cache. */
|
|
1665
|
+
cache?: "no-store";
|
|
1653
1666
|
/* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1654
1667
|
integrity?: string;
|
|
1655
1668
|
/* An AbortSignal to set request's signal. */
|
|
@@ -2324,15 +2337,15 @@ declare class TransformStream<I = any, O = any> {
|
|
|
2324
2337
|
}
|
|
2325
2338
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
2326
2339
|
constructor(
|
|
2327
|
-
|
|
2328
|
-
|
|
2340
|
+
param1: number | bigint,
|
|
2341
|
+
param2?: IdentityTransformStreamQueuingStrategy,
|
|
2329
2342
|
);
|
|
2330
2343
|
}
|
|
2331
2344
|
declare class IdentityTransformStream extends TransformStream<
|
|
2332
2345
|
ArrayBuffer | ArrayBufferView,
|
|
2333
2346
|
Uint8Array
|
|
2334
2347
|
> {
|
|
2335
|
-
constructor(
|
|
2348
|
+
constructor(param1?: IdentityTransformStreamQueuingStrategy);
|
|
2336
2349
|
}
|
|
2337
2350
|
interface IdentityTransformStreamQueuingStrategy {
|
|
2338
2351
|
highWaterMark?: number | bigint;
|
|
@@ -2364,7 +2377,7 @@ declare class TextDecoderStream extends TransformStream<
|
|
|
2364
2377
|
ArrayBuffer | ArrayBufferView,
|
|
2365
2378
|
string
|
|
2366
2379
|
> {
|
|
2367
|
-
constructor(
|
|
2380
|
+
constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
|
|
2368
2381
|
get encoding(): string;
|
|
2369
2382
|
get fatal(): boolean;
|
|
2370
2383
|
get ignoreBOM(): boolean;
|
|
@@ -2578,13 +2591,13 @@ declare class URL {
|
|
|
2578
2591
|
/*function toString() { [native code] }*/
|
|
2579
2592
|
toString(): string;
|
|
2580
2593
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
|
|
2581
|
-
static canParse(
|
|
2582
|
-
static parse(
|
|
2594
|
+
static canParse(param0: string, param1?: string): boolean;
|
|
2595
|
+
static parse(param1: string, param2?: string): URL | null;
|
|
2583
2596
|
}
|
|
2584
2597
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
|
|
2585
2598
|
declare class URLSearchParams {
|
|
2586
2599
|
constructor(
|
|
2587
|
-
|
|
2600
|
+
param0?: Iterable<Iterable<string>> | Record<string, string> | string,
|
|
2588
2601
|
);
|
|
2589
2602
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) */
|
|
2590
2603
|
get size(): number;
|
|
@@ -2593,37 +2606,37 @@ declare class URLSearchParams {
|
|
|
2593
2606
|
*
|
|
2594
2607
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
|
|
2595
2608
|
*/
|
|
2596
|
-
append(
|
|
2609
|
+
append(param0: string, param1: string): void;
|
|
2597
2610
|
/**
|
|
2598
2611
|
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
|
|
2599
2612
|
*
|
|
2600
2613
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
|
|
2601
2614
|
*/
|
|
2602
|
-
delete(
|
|
2615
|
+
delete(param1: string, param2?: string): void;
|
|
2603
2616
|
/**
|
|
2604
2617
|
* Returns the first value associated to the given search parameter.
|
|
2605
2618
|
*
|
|
2606
2619
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
|
|
2607
2620
|
*/
|
|
2608
|
-
get(
|
|
2621
|
+
get(param0: string): string | null;
|
|
2609
2622
|
/**
|
|
2610
2623
|
* Returns all the values association with a given search parameter.
|
|
2611
2624
|
*
|
|
2612
2625
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
|
|
2613
2626
|
*/
|
|
2614
|
-
getAll(
|
|
2627
|
+
getAll(param0: string): string[];
|
|
2615
2628
|
/**
|
|
2616
2629
|
* Returns a Boolean indicating if such a search parameter exists.
|
|
2617
2630
|
*
|
|
2618
2631
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
|
|
2619
2632
|
*/
|
|
2620
|
-
has(
|
|
2633
|
+
has(param1: string, param2?: string): boolean;
|
|
2621
2634
|
/**
|
|
2622
2635
|
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
|
|
2623
2636
|
*
|
|
2624
2637
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
|
|
2625
2638
|
*/
|
|
2626
|
-
set(
|
|
2639
|
+
set(param0: string, param1: string): void;
|
|
2627
2640
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) */
|
|
2628
2641
|
sort(): void;
|
|
2629
2642
|
/* Returns an array of key, value pairs for every entry in the search params. */
|
|
@@ -5017,6 +5030,18 @@ type PagesPluginFunction<
|
|
|
5017
5030
|
declare module "assets:*" {
|
|
5018
5031
|
export const onRequest: PagesFunction;
|
|
5019
5032
|
}
|
|
5033
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5034
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5035
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5036
|
+
declare abstract class PipelineTransform {
|
|
5037
|
+
/**
|
|
5038
|
+
* transformJson recieves an array of javascript objects which can be
|
|
5039
|
+
* mutated and returned to the pipeline
|
|
5040
|
+
* @param data The data to be mutated
|
|
5041
|
+
* @returns A promise containing the mutated data
|
|
5042
|
+
*/
|
|
5043
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
5044
|
+
}
|
|
5020
5045
|
// PubSubMessage represents an incoming PubSub message.
|
|
5021
5046
|
// The message includes metadata about the broker, the client, and the payload
|
|
5022
5047
|
// itself.
|
|
@@ -5263,7 +5288,7 @@ declare module "cloudflare:workers" {
|
|
|
5263
5288
|
): void | Promise<void>;
|
|
5264
5289
|
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
5265
5290
|
}
|
|
5266
|
-
export type
|
|
5291
|
+
export type WorkflowDurationLabel =
|
|
5267
5292
|
| "second"
|
|
5268
5293
|
| "minute"
|
|
5269
5294
|
| "hour"
|
|
@@ -5271,13 +5296,32 @@ declare module "cloudflare:workers" {
|
|
|
5271
5296
|
| "week"
|
|
5272
5297
|
| "month"
|
|
5273
5298
|
| "year";
|
|
5274
|
-
export type
|
|
5275
|
-
|
|
5299
|
+
export type WorkflowSleepDuration =
|
|
5300
|
+
| `${number} ${WorkflowDurationLabel}${"s" | ""}`
|
|
5301
|
+
| number;
|
|
5302
|
+
export type WorkflowBackoff = "constant" | "linear" | "exponential";
|
|
5303
|
+
export type WorkflowStepConfig = {
|
|
5304
|
+
retries?: {
|
|
5305
|
+
limit: number;
|
|
5306
|
+
delay: string | number;
|
|
5307
|
+
backoff?: WorkflowBackoff;
|
|
5308
|
+
};
|
|
5309
|
+
timeout?: string | number;
|
|
5310
|
+
};
|
|
5311
|
+
export type WorkflowEvent<T> = {
|
|
5312
|
+
payload: T;
|
|
5313
|
+
timestamp: Date;
|
|
5314
|
+
};
|
|
5315
|
+
export type WorkflowStep = {
|
|
5276
5316
|
do: <T extends Rpc.Serializable>(
|
|
5277
5317
|
name: string,
|
|
5278
|
-
callback: () => T
|
|
5279
|
-
|
|
5280
|
-
|
|
5318
|
+
callback: () => Promise<T>,
|
|
5319
|
+
config?: WorkflowStepConfig,
|
|
5320
|
+
) => Promise<T>;
|
|
5321
|
+
sleep: (
|
|
5322
|
+
name: string,
|
|
5323
|
+
duration: WorkflowSleepDuration,
|
|
5324
|
+
) => void | Promise<void>;
|
|
5281
5325
|
};
|
|
5282
5326
|
export abstract class Workflow<
|
|
5283
5327
|
Env = unknown,
|
|
@@ -5287,13 +5331,7 @@ declare module "cloudflare:workers" {
|
|
|
5287
5331
|
[Rpc.__WORKFLOW_BRAND]: never;
|
|
5288
5332
|
protected ctx: ExecutionContext;
|
|
5289
5333
|
protected env: Env;
|
|
5290
|
-
run(
|
|
5291
|
-
events: Array<{
|
|
5292
|
-
payload: T;
|
|
5293
|
-
timestamp: Date;
|
|
5294
|
-
}>,
|
|
5295
|
-
step: WorkflowStep,
|
|
5296
|
-
): unknown | Promise<unknown>;
|
|
5334
|
+
run(events: Array<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;
|
|
5297
5335
|
}
|
|
5298
5336
|
}
|
|
5299
5337
|
declare module "cloudflare:sockets" {
|
|
@@ -5356,13 +5394,11 @@ type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
|
|
|
5356
5394
|
* @property none No indexed metadata will be returned.
|
|
5357
5395
|
*/
|
|
5358
5396
|
type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
|
|
5359
|
-
interface VectorizeQueryOptions
|
|
5360
|
-
MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
|
|
5361
|
-
> {
|
|
5397
|
+
interface VectorizeQueryOptions {
|
|
5362
5398
|
topK?: number;
|
|
5363
5399
|
namespace?: string;
|
|
5364
5400
|
returnValues?: boolean;
|
|
5365
|
-
returnMetadata?:
|
|
5401
|
+
returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
|
|
5366
5402
|
filter?: VectorizeVectorMetadataFilter;
|
|
5367
5403
|
}
|
|
5368
5404
|
/**
|
|
@@ -5476,7 +5512,7 @@ declare abstract class VectorizeIndex {
|
|
|
5476
5512
|
*/
|
|
5477
5513
|
public query(
|
|
5478
5514
|
vector: VectorFloatArray | number[],
|
|
5479
|
-
options
|
|
5515
|
+
options?: VectorizeQueryOptions,
|
|
5480
5516
|
): Promise<VectorizeMatches>;
|
|
5481
5517
|
/**
|
|
5482
5518
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
@@ -5522,7 +5558,7 @@ declare abstract class Vectorize {
|
|
|
5522
5558
|
*/
|
|
5523
5559
|
public query(
|
|
5524
5560
|
vector: VectorFloatArray | number[],
|
|
5525
|
-
options
|
|
5561
|
+
options?: VectorizeQueryOptions,
|
|
5526
5562
|
): Promise<VectorizeMatches>;
|
|
5527
5563
|
/**
|
|
5528
5564
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|