@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/experimental/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 {}
|
|
@@ -487,6 +489,9 @@ export interface AlarmInvocationInfo {
|
|
|
487
489
|
readonly isRetry: boolean;
|
|
488
490
|
readonly retryCount: number;
|
|
489
491
|
}
|
|
492
|
+
export interface Cloudflare {
|
|
493
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
494
|
+
}
|
|
490
495
|
export interface DurableObject {
|
|
491
496
|
fetch(request: Request): Response | Promise<Response>;
|
|
492
497
|
alarm?(): void | Promise<void>;
|
|
@@ -1643,6 +1648,12 @@ export declare class Request<
|
|
|
1643
1648
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
|
|
1644
1649
|
*/
|
|
1645
1650
|
get keepalive(): boolean;
|
|
1651
|
+
/**
|
|
1652
|
+
* Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
|
|
1653
|
+
*
|
|
1654
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
|
|
1655
|
+
*/
|
|
1656
|
+
cache?: "no-store";
|
|
1646
1657
|
}
|
|
1647
1658
|
export interface RequestInit<Cf = CfProperties> {
|
|
1648
1659
|
/* A string to set request's method. */
|
|
@@ -1655,6 +1666,8 @@ export interface RequestInit<Cf = CfProperties> {
|
|
|
1655
1666
|
redirect?: string;
|
|
1656
1667
|
fetcher?: Fetcher | null;
|
|
1657
1668
|
cf?: Cf;
|
|
1669
|
+
/* A string indicating how the request will interact with the browser's cache to set request's cache. */
|
|
1670
|
+
cache?: "no-store";
|
|
1658
1671
|
/* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1659
1672
|
integrity?: string;
|
|
1660
1673
|
/* An AbortSignal to set request's signal. */
|
|
@@ -2330,15 +2343,15 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
2330
2343
|
}
|
|
2331
2344
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
2332
2345
|
constructor(
|
|
2333
|
-
|
|
2334
|
-
|
|
2346
|
+
param1: number | bigint,
|
|
2347
|
+
param2?: IdentityTransformStreamQueuingStrategy,
|
|
2335
2348
|
);
|
|
2336
2349
|
}
|
|
2337
2350
|
export declare class IdentityTransformStream extends TransformStream<
|
|
2338
2351
|
ArrayBuffer | ArrayBufferView,
|
|
2339
2352
|
Uint8Array
|
|
2340
2353
|
> {
|
|
2341
|
-
constructor(
|
|
2354
|
+
constructor(param1?: IdentityTransformStreamQueuingStrategy);
|
|
2342
2355
|
}
|
|
2343
2356
|
export interface IdentityTransformStreamQueuingStrategy {
|
|
2344
2357
|
highWaterMark?: number | bigint;
|
|
@@ -2373,7 +2386,7 @@ export declare class TextDecoderStream extends TransformStream<
|
|
|
2373
2386
|
ArrayBuffer | ArrayBufferView,
|
|
2374
2387
|
string
|
|
2375
2388
|
> {
|
|
2376
|
-
constructor(
|
|
2389
|
+
constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
|
|
2377
2390
|
get encoding(): string;
|
|
2378
2391
|
get fatal(): boolean;
|
|
2379
2392
|
get ignoreBOM(): boolean;
|
|
@@ -2587,13 +2600,13 @@ export declare class URL {
|
|
|
2587
2600
|
/*function toString() { [native code] }*/
|
|
2588
2601
|
toString(): string;
|
|
2589
2602
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
|
|
2590
|
-
static canParse(
|
|
2591
|
-
static parse(
|
|
2603
|
+
static canParse(param0: string, param1?: string): boolean;
|
|
2604
|
+
static parse(param1: string, param2?: string): URL | null;
|
|
2592
2605
|
}
|
|
2593
2606
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
|
|
2594
2607
|
export declare class URLSearchParams {
|
|
2595
2608
|
constructor(
|
|
2596
|
-
|
|
2609
|
+
param0?: Iterable<Iterable<string>> | Record<string, string> | string,
|
|
2597
2610
|
);
|
|
2598
2611
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/size) */
|
|
2599
2612
|
get size(): number;
|
|
@@ -2602,37 +2615,37 @@ export declare class URLSearchParams {
|
|
|
2602
2615
|
*
|
|
2603
2616
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/append)
|
|
2604
2617
|
*/
|
|
2605
|
-
append(
|
|
2618
|
+
append(param0: string, param1: string): void;
|
|
2606
2619
|
/**
|
|
2607
2620
|
* Deletes the given search parameter, and its associated value, from the list of all search parameters.
|
|
2608
2621
|
*
|
|
2609
2622
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/delete)
|
|
2610
2623
|
*/
|
|
2611
|
-
delete(
|
|
2624
|
+
delete(param1: string, param2?: string): void;
|
|
2612
2625
|
/**
|
|
2613
2626
|
* Returns the first value associated to the given search parameter.
|
|
2614
2627
|
*
|
|
2615
2628
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/get)
|
|
2616
2629
|
*/
|
|
2617
|
-
get(
|
|
2630
|
+
get(param0: string): string | null;
|
|
2618
2631
|
/**
|
|
2619
2632
|
* Returns all the values association with a given search parameter.
|
|
2620
2633
|
*
|
|
2621
2634
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/getAll)
|
|
2622
2635
|
*/
|
|
2623
|
-
getAll(
|
|
2636
|
+
getAll(param0: string): string[];
|
|
2624
2637
|
/**
|
|
2625
2638
|
* Returns a Boolean indicating if such a search parameter exists.
|
|
2626
2639
|
*
|
|
2627
2640
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/has)
|
|
2628
2641
|
*/
|
|
2629
|
-
has(
|
|
2642
|
+
has(param1: string, param2?: string): boolean;
|
|
2630
2643
|
/**
|
|
2631
2644
|
* Sets the value associated to a given search parameter to the given value. If there were several values, delete the others.
|
|
2632
2645
|
*
|
|
2633
2646
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/set)
|
|
2634
2647
|
*/
|
|
2635
|
-
set(
|
|
2648
|
+
set(param0: string, param1: string): void;
|
|
2636
2649
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams/sort) */
|
|
2637
2650
|
sort(): void;
|
|
2638
2651
|
/* Returns an array of key, value pairs for every entry in the search params. */
|
|
@@ -5029,6 +5042,18 @@ export type PagesPluginFunction<
|
|
|
5029
5042
|
> = (
|
|
5030
5043
|
context: EventPluginContext<Env, Params, Data, PluginArgs>,
|
|
5031
5044
|
) => Response | Promise<Response>;
|
|
5045
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5046
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5047
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5048
|
+
export declare abstract class PipelineTransform {
|
|
5049
|
+
/**
|
|
5050
|
+
* transformJson recieves an array of javascript objects which can be
|
|
5051
|
+
* mutated and returned to the pipeline
|
|
5052
|
+
* @param data The data to be mutated
|
|
5053
|
+
* @returns A promise containing the mutated data
|
|
5054
|
+
*/
|
|
5055
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
5056
|
+
}
|
|
5032
5057
|
// PubSubMessage represents an incoming PubSub message.
|
|
5033
5058
|
// The message includes metadata about the broker, the client, and the payload
|
|
5034
5059
|
// itself.
|
|
@@ -5284,13 +5309,11 @@ export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
|
|
|
5284
5309
|
* @property none No indexed metadata will be returned.
|
|
5285
5310
|
*/
|
|
5286
5311
|
export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
|
|
5287
|
-
export interface VectorizeQueryOptions
|
|
5288
|
-
MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
|
|
5289
|
-
> {
|
|
5312
|
+
export interface VectorizeQueryOptions {
|
|
5290
5313
|
topK?: number;
|
|
5291
5314
|
namespace?: string;
|
|
5292
5315
|
returnValues?: boolean;
|
|
5293
|
-
returnMetadata?:
|
|
5316
|
+
returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
|
|
5294
5317
|
filter?: VectorizeVectorMetadataFilter;
|
|
5295
5318
|
}
|
|
5296
5319
|
/**
|
|
@@ -5404,7 +5427,7 @@ export declare abstract class VectorizeIndex {
|
|
|
5404
5427
|
*/
|
|
5405
5428
|
public query(
|
|
5406
5429
|
vector: VectorFloatArray | number[],
|
|
5407
|
-
options
|
|
5430
|
+
options?: VectorizeQueryOptions,
|
|
5408
5431
|
): Promise<VectorizeMatches>;
|
|
5409
5432
|
/**
|
|
5410
5433
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
@@ -5450,7 +5473,7 @@ export declare abstract class Vectorize {
|
|
|
5450
5473
|
*/
|
|
5451
5474
|
public query(
|
|
5452
5475
|
vector: VectorFloatArray | number[],
|
|
5453
|
-
options
|
|
5476
|
+
options?: VectorizeQueryOptions,
|
|
5454
5477
|
): Promise<VectorizeMatches>;
|
|
5455
5478
|
/**
|
|
5456
5479
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
package/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;
|
|
@@ -384,6 +385,7 @@ declare const scheduler: Scheduler;
|
|
|
384
385
|
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
385
386
|
*/
|
|
386
387
|
declare const performance: Performance;
|
|
388
|
+
declare const Cloudflare: Cloudflare;
|
|
387
389
|
declare const origin: string;
|
|
388
390
|
interface TestController {}
|
|
389
391
|
interface ExecutionContext {
|
|
@@ -459,6 +461,9 @@ interface AlarmInvocationInfo {
|
|
|
459
461
|
readonly isRetry: boolean;
|
|
460
462
|
readonly retryCount: number;
|
|
461
463
|
}
|
|
464
|
+
interface Cloudflare {
|
|
465
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
466
|
+
}
|
|
462
467
|
interface DurableObject {
|
|
463
468
|
fetch(request: Request): Response | Promise<Response>;
|
|
464
469
|
alarm?(): void | Promise<void>;
|
|
@@ -2242,15 +2247,15 @@ declare class TransformStream<I = any, O = any> {
|
|
|
2242
2247
|
}
|
|
2243
2248
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
2244
2249
|
constructor(
|
|
2245
|
-
|
|
2246
|
-
|
|
2250
|
+
param1: number | bigint,
|
|
2251
|
+
param2?: IdentityTransformStreamQueuingStrategy,
|
|
2247
2252
|
);
|
|
2248
2253
|
}
|
|
2249
2254
|
declare class IdentityTransformStream extends TransformStream<
|
|
2250
2255
|
ArrayBuffer | ArrayBufferView,
|
|
2251
2256
|
Uint8Array
|
|
2252
2257
|
> {
|
|
2253
|
-
constructor(
|
|
2258
|
+
constructor(param1?: IdentityTransformStreamQueuingStrategy);
|
|
2254
2259
|
}
|
|
2255
2260
|
interface IdentityTransformStreamQueuingStrategy {
|
|
2256
2261
|
highWaterMark?: number | bigint;
|
|
@@ -2282,7 +2287,7 @@ declare class TextDecoderStream extends TransformStream<
|
|
|
2282
2287
|
ArrayBuffer | ArrayBufferView,
|
|
2283
2288
|
string
|
|
2284
2289
|
> {
|
|
2285
|
-
constructor(
|
|
2290
|
+
constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
|
|
2286
2291
|
get encoding(): string;
|
|
2287
2292
|
get fatal(): boolean;
|
|
2288
2293
|
get ignoreBOM(): boolean;
|
|
@@ -4885,6 +4890,18 @@ type PagesPluginFunction<
|
|
|
4885
4890
|
declare module "assets:*" {
|
|
4886
4891
|
export const onRequest: PagesFunction;
|
|
4887
4892
|
}
|
|
4893
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4894
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4895
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4896
|
+
declare abstract class PipelineTransform {
|
|
4897
|
+
/**
|
|
4898
|
+
* transformJson recieves an array of javascript objects which can be
|
|
4899
|
+
* mutated and returned to the pipeline
|
|
4900
|
+
* @param data The data to be mutated
|
|
4901
|
+
* @returns A promise containing the mutated data
|
|
4902
|
+
*/
|
|
4903
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
4904
|
+
}
|
|
4888
4905
|
// PubSubMessage represents an incoming PubSub message.
|
|
4889
4906
|
// The message includes metadata about the broker, the client, and the payload
|
|
4890
4907
|
// itself.
|
|
@@ -5131,7 +5148,7 @@ declare module "cloudflare:workers" {
|
|
|
5131
5148
|
): void | Promise<void>;
|
|
5132
5149
|
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
5133
5150
|
}
|
|
5134
|
-
export type
|
|
5151
|
+
export type WorkflowDurationLabel =
|
|
5135
5152
|
| "second"
|
|
5136
5153
|
| "minute"
|
|
5137
5154
|
| "hour"
|
|
@@ -5139,13 +5156,32 @@ declare module "cloudflare:workers" {
|
|
|
5139
5156
|
| "week"
|
|
5140
5157
|
| "month"
|
|
5141
5158
|
| "year";
|
|
5142
|
-
export type
|
|
5143
|
-
|
|
5159
|
+
export type WorkflowSleepDuration =
|
|
5160
|
+
| `${number} ${WorkflowDurationLabel}${"s" | ""}`
|
|
5161
|
+
| number;
|
|
5162
|
+
export type WorkflowBackoff = "constant" | "linear" | "exponential";
|
|
5163
|
+
export type WorkflowStepConfig = {
|
|
5164
|
+
retries?: {
|
|
5165
|
+
limit: number;
|
|
5166
|
+
delay: string | number;
|
|
5167
|
+
backoff?: WorkflowBackoff;
|
|
5168
|
+
};
|
|
5169
|
+
timeout?: string | number;
|
|
5170
|
+
};
|
|
5171
|
+
export type WorkflowEvent<T> = {
|
|
5172
|
+
payload: T;
|
|
5173
|
+
timestamp: Date;
|
|
5174
|
+
};
|
|
5175
|
+
export type WorkflowStep = {
|
|
5144
5176
|
do: <T extends Rpc.Serializable>(
|
|
5145
5177
|
name: string,
|
|
5146
|
-
callback: () => T
|
|
5147
|
-
|
|
5148
|
-
|
|
5178
|
+
callback: () => Promise<T>,
|
|
5179
|
+
config?: WorkflowStepConfig,
|
|
5180
|
+
) => Promise<T>;
|
|
5181
|
+
sleep: (
|
|
5182
|
+
name: string,
|
|
5183
|
+
duration: WorkflowSleepDuration,
|
|
5184
|
+
) => void | Promise<void>;
|
|
5149
5185
|
};
|
|
5150
5186
|
export abstract class Workflow<
|
|
5151
5187
|
Env = unknown,
|
|
@@ -5155,13 +5191,7 @@ declare module "cloudflare:workers" {
|
|
|
5155
5191
|
[Rpc.__WORKFLOW_BRAND]: never;
|
|
5156
5192
|
protected ctx: ExecutionContext;
|
|
5157
5193
|
protected env: Env;
|
|
5158
|
-
run(
|
|
5159
|
-
events: Array<{
|
|
5160
|
-
payload: T;
|
|
5161
|
-
timestamp: Date;
|
|
5162
|
-
}>,
|
|
5163
|
-
step: WorkflowStep,
|
|
5164
|
-
): unknown | Promise<unknown>;
|
|
5194
|
+
run(events: Array<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;
|
|
5165
5195
|
}
|
|
5166
5196
|
}
|
|
5167
5197
|
declare module "cloudflare:sockets" {
|
|
@@ -5224,13 +5254,11 @@ type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
|
|
|
5224
5254
|
* @property none No indexed metadata will be returned.
|
|
5225
5255
|
*/
|
|
5226
5256
|
type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
|
|
5227
|
-
interface VectorizeQueryOptions
|
|
5228
|
-
MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
|
|
5229
|
-
> {
|
|
5257
|
+
interface VectorizeQueryOptions {
|
|
5230
5258
|
topK?: number;
|
|
5231
5259
|
namespace?: string;
|
|
5232
5260
|
returnValues?: boolean;
|
|
5233
|
-
returnMetadata?:
|
|
5261
|
+
returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
|
|
5234
5262
|
filter?: VectorizeVectorMetadataFilter;
|
|
5235
5263
|
}
|
|
5236
5264
|
/**
|
|
@@ -5344,7 +5372,7 @@ declare abstract class VectorizeIndex {
|
|
|
5344
5372
|
*/
|
|
5345
5373
|
public query(
|
|
5346
5374
|
vector: VectorFloatArray | number[],
|
|
5347
|
-
options
|
|
5375
|
+
options?: VectorizeQueryOptions,
|
|
5348
5376
|
): Promise<VectorizeMatches>;
|
|
5349
5377
|
/**
|
|
5350
5378
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
@@ -5390,7 +5418,7 @@ declare abstract class Vectorize {
|
|
|
5390
5418
|
*/
|
|
5391
5419
|
public query(
|
|
5392
5420
|
vector: VectorFloatArray | number[],
|
|
5393
|
-
options
|
|
5421
|
+
options?: VectorizeQueryOptions,
|
|
5394
5422
|
): Promise<VectorizeMatches>;
|
|
5395
5423
|
/**
|
|
5396
5424
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
package/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;
|
|
@@ -386,6 +387,7 @@ export declare const scheduler: Scheduler;
|
|
|
386
387
|
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
387
388
|
*/
|
|
388
389
|
export declare const performance: Performance;
|
|
390
|
+
export declare const Cloudflare: Cloudflare;
|
|
389
391
|
export declare const origin: string;
|
|
390
392
|
export interface TestController {}
|
|
391
393
|
export interface ExecutionContext {
|
|
@@ -464,6 +466,9 @@ export interface AlarmInvocationInfo {
|
|
|
464
466
|
readonly isRetry: boolean;
|
|
465
467
|
readonly retryCount: number;
|
|
466
468
|
}
|
|
469
|
+
export interface Cloudflare {
|
|
470
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
471
|
+
}
|
|
467
472
|
export interface DurableObject {
|
|
468
473
|
fetch(request: Request): Response | Promise<Response>;
|
|
469
474
|
alarm?(): void | Promise<void>;
|
|
@@ -2248,15 +2253,15 @@ export declare class TransformStream<I = any, O = any> {
|
|
|
2248
2253
|
}
|
|
2249
2254
|
export declare class FixedLengthStream extends IdentityTransformStream {
|
|
2250
2255
|
constructor(
|
|
2251
|
-
|
|
2252
|
-
|
|
2256
|
+
param1: number | bigint,
|
|
2257
|
+
param2?: IdentityTransformStreamQueuingStrategy,
|
|
2253
2258
|
);
|
|
2254
2259
|
}
|
|
2255
2260
|
export declare class IdentityTransformStream extends TransformStream<
|
|
2256
2261
|
ArrayBuffer | ArrayBufferView,
|
|
2257
2262
|
Uint8Array
|
|
2258
2263
|
> {
|
|
2259
|
-
constructor(
|
|
2264
|
+
constructor(param1?: IdentityTransformStreamQueuingStrategy);
|
|
2260
2265
|
}
|
|
2261
2266
|
export interface IdentityTransformStreamQueuingStrategy {
|
|
2262
2267
|
highWaterMark?: number | bigint;
|
|
@@ -2291,7 +2296,7 @@ export declare class TextDecoderStream extends TransformStream<
|
|
|
2291
2296
|
ArrayBuffer | ArrayBufferView,
|
|
2292
2297
|
string
|
|
2293
2298
|
> {
|
|
2294
|
-
constructor(
|
|
2299
|
+
constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
|
|
2295
2300
|
get encoding(): string;
|
|
2296
2301
|
get fatal(): boolean;
|
|
2297
2302
|
get ignoreBOM(): boolean;
|
|
@@ -4897,6 +4902,18 @@ export type PagesPluginFunction<
|
|
|
4897
4902
|
> = (
|
|
4898
4903
|
context: EventPluginContext<Env, Params, Data, PluginArgs>,
|
|
4899
4904
|
) => Response | Promise<Response>;
|
|
4905
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4906
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4907
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4908
|
+
export declare abstract class PipelineTransform {
|
|
4909
|
+
/**
|
|
4910
|
+
* transformJson recieves an array of javascript objects which can be
|
|
4911
|
+
* mutated and returned to the pipeline
|
|
4912
|
+
* @param data The data to be mutated
|
|
4913
|
+
* @returns A promise containing the mutated data
|
|
4914
|
+
*/
|
|
4915
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
4916
|
+
}
|
|
4900
4917
|
// PubSubMessage represents an incoming PubSub message.
|
|
4901
4918
|
// The message includes metadata about the broker, the client, and the payload
|
|
4902
4919
|
// itself.
|
|
@@ -5152,13 +5169,11 @@ export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
|
|
|
5152
5169
|
* @property none No indexed metadata will be returned.
|
|
5153
5170
|
*/
|
|
5154
5171
|
export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
|
|
5155
|
-
export interface VectorizeQueryOptions
|
|
5156
|
-
MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
|
|
5157
|
-
> {
|
|
5172
|
+
export interface VectorizeQueryOptions {
|
|
5158
5173
|
topK?: number;
|
|
5159
5174
|
namespace?: string;
|
|
5160
5175
|
returnValues?: boolean;
|
|
5161
|
-
returnMetadata?:
|
|
5176
|
+
returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
|
|
5162
5177
|
filter?: VectorizeVectorMetadataFilter;
|
|
5163
5178
|
}
|
|
5164
5179
|
/**
|
|
@@ -5272,7 +5287,7 @@ export declare abstract class VectorizeIndex {
|
|
|
5272
5287
|
*/
|
|
5273
5288
|
public query(
|
|
5274
5289
|
vector: VectorFloatArray | number[],
|
|
5275
|
-
options
|
|
5290
|
+
options?: VectorizeQueryOptions,
|
|
5276
5291
|
): Promise<VectorizeMatches>;
|
|
5277
5292
|
/**
|
|
5278
5293
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
@@ -5318,7 +5333,7 @@ export declare abstract class Vectorize {
|
|
|
5318
5333
|
*/
|
|
5319
5334
|
public query(
|
|
5320
5335
|
vector: VectorFloatArray | number[],
|
|
5321
|
-
options
|
|
5336
|
+
options?: VectorizeQueryOptions,
|
|
5322
5337
|
): Promise<VectorizeMatches>;
|
|
5323
5338
|
/**
|
|
5324
5339
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
package/oldest/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;
|
|
@@ -384,6 +385,7 @@ declare const scheduler: Scheduler;
|
|
|
384
385
|
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
385
386
|
*/
|
|
386
387
|
declare const performance: Performance;
|
|
388
|
+
declare const Cloudflare: Cloudflare;
|
|
387
389
|
declare const origin: string;
|
|
388
390
|
interface TestController {}
|
|
389
391
|
interface ExecutionContext {
|
|
@@ -459,6 +461,9 @@ interface AlarmInvocationInfo {
|
|
|
459
461
|
readonly isRetry: boolean;
|
|
460
462
|
readonly retryCount: number;
|
|
461
463
|
}
|
|
464
|
+
interface Cloudflare {
|
|
465
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
466
|
+
}
|
|
462
467
|
interface DurableObject {
|
|
463
468
|
fetch(request: Request): Response | Promise<Response>;
|
|
464
469
|
alarm?(): void | Promise<void>;
|
|
@@ -2242,15 +2247,15 @@ declare class TransformStream<I = any, O = any> {
|
|
|
2242
2247
|
}
|
|
2243
2248
|
declare class FixedLengthStream extends IdentityTransformStream {
|
|
2244
2249
|
constructor(
|
|
2245
|
-
|
|
2246
|
-
|
|
2250
|
+
param1: number | bigint,
|
|
2251
|
+
param2?: IdentityTransformStreamQueuingStrategy,
|
|
2247
2252
|
);
|
|
2248
2253
|
}
|
|
2249
2254
|
declare class IdentityTransformStream extends TransformStream<
|
|
2250
2255
|
ArrayBuffer | ArrayBufferView,
|
|
2251
2256
|
Uint8Array
|
|
2252
2257
|
> {
|
|
2253
|
-
constructor(
|
|
2258
|
+
constructor(param1?: IdentityTransformStreamQueuingStrategy);
|
|
2254
2259
|
}
|
|
2255
2260
|
interface IdentityTransformStreamQueuingStrategy {
|
|
2256
2261
|
highWaterMark?: number | bigint;
|
|
@@ -2282,7 +2287,7 @@ declare class TextDecoderStream extends TransformStream<
|
|
|
2282
2287
|
ArrayBuffer | ArrayBufferView,
|
|
2283
2288
|
string
|
|
2284
2289
|
> {
|
|
2285
|
-
constructor(
|
|
2290
|
+
constructor(param1?: string, param2?: TextDecoderStreamTextDecoderStreamInit);
|
|
2286
2291
|
get encoding(): string;
|
|
2287
2292
|
get fatal(): boolean;
|
|
2288
2293
|
get ignoreBOM(): boolean;
|
|
@@ -4885,6 +4890,18 @@ type PagesPluginFunction<
|
|
|
4885
4890
|
declare module "assets:*" {
|
|
4886
4891
|
export const onRequest: PagesFunction;
|
|
4887
4892
|
}
|
|
4893
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4894
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4895
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4896
|
+
declare abstract class PipelineTransform {
|
|
4897
|
+
/**
|
|
4898
|
+
* transformJson recieves an array of javascript objects which can be
|
|
4899
|
+
* mutated and returned to the pipeline
|
|
4900
|
+
* @param data The data to be mutated
|
|
4901
|
+
* @returns A promise containing the mutated data
|
|
4902
|
+
*/
|
|
4903
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
4904
|
+
}
|
|
4888
4905
|
// PubSubMessage represents an incoming PubSub message.
|
|
4889
4906
|
// The message includes metadata about the broker, the client, and the payload
|
|
4890
4907
|
// itself.
|
|
@@ -5131,7 +5148,7 @@ declare module "cloudflare:workers" {
|
|
|
5131
5148
|
): void | Promise<void>;
|
|
5132
5149
|
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
5133
5150
|
}
|
|
5134
|
-
export type
|
|
5151
|
+
export type WorkflowDurationLabel =
|
|
5135
5152
|
| "second"
|
|
5136
5153
|
| "minute"
|
|
5137
5154
|
| "hour"
|
|
@@ -5139,13 +5156,32 @@ declare module "cloudflare:workers" {
|
|
|
5139
5156
|
| "week"
|
|
5140
5157
|
| "month"
|
|
5141
5158
|
| "year";
|
|
5142
|
-
export type
|
|
5143
|
-
|
|
5159
|
+
export type WorkflowSleepDuration =
|
|
5160
|
+
| `${number} ${WorkflowDurationLabel}${"s" | ""}`
|
|
5161
|
+
| number;
|
|
5162
|
+
export type WorkflowBackoff = "constant" | "linear" | "exponential";
|
|
5163
|
+
export type WorkflowStepConfig = {
|
|
5164
|
+
retries?: {
|
|
5165
|
+
limit: number;
|
|
5166
|
+
delay: string | number;
|
|
5167
|
+
backoff?: WorkflowBackoff;
|
|
5168
|
+
};
|
|
5169
|
+
timeout?: string | number;
|
|
5170
|
+
};
|
|
5171
|
+
export type WorkflowEvent<T> = {
|
|
5172
|
+
payload: T;
|
|
5173
|
+
timestamp: Date;
|
|
5174
|
+
};
|
|
5175
|
+
export type WorkflowStep = {
|
|
5144
5176
|
do: <T extends Rpc.Serializable>(
|
|
5145
5177
|
name: string,
|
|
5146
|
-
callback: () => T
|
|
5147
|
-
|
|
5148
|
-
|
|
5178
|
+
callback: () => Promise<T>,
|
|
5179
|
+
config?: WorkflowStepConfig,
|
|
5180
|
+
) => Promise<T>;
|
|
5181
|
+
sleep: (
|
|
5182
|
+
name: string,
|
|
5183
|
+
duration: WorkflowSleepDuration,
|
|
5184
|
+
) => void | Promise<void>;
|
|
5149
5185
|
};
|
|
5150
5186
|
export abstract class Workflow<
|
|
5151
5187
|
Env = unknown,
|
|
@@ -5155,13 +5191,7 @@ declare module "cloudflare:workers" {
|
|
|
5155
5191
|
[Rpc.__WORKFLOW_BRAND]: never;
|
|
5156
5192
|
protected ctx: ExecutionContext;
|
|
5157
5193
|
protected env: Env;
|
|
5158
|
-
run(
|
|
5159
|
-
events: Array<{
|
|
5160
|
-
payload: T;
|
|
5161
|
-
timestamp: Date;
|
|
5162
|
-
}>,
|
|
5163
|
-
step: WorkflowStep,
|
|
5164
|
-
): unknown | Promise<unknown>;
|
|
5194
|
+
run(events: Array<WorkflowEvent<T>>, step: WorkflowStep): Promise<unknown>;
|
|
5165
5195
|
}
|
|
5166
5196
|
}
|
|
5167
5197
|
declare module "cloudflare:sockets" {
|
|
@@ -5224,13 +5254,11 @@ type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
|
|
|
5224
5254
|
* @property none No indexed metadata will be returned.
|
|
5225
5255
|
*/
|
|
5226
5256
|
type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
|
|
5227
|
-
interface VectorizeQueryOptions
|
|
5228
|
-
MetadataReturn extends boolean | VectorizeMetadataRetrievalLevel = boolean,
|
|
5229
|
-
> {
|
|
5257
|
+
interface VectorizeQueryOptions {
|
|
5230
5258
|
topK?: number;
|
|
5231
5259
|
namespace?: string;
|
|
5232
5260
|
returnValues?: boolean;
|
|
5233
|
-
returnMetadata?:
|
|
5261
|
+
returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
|
|
5234
5262
|
filter?: VectorizeVectorMetadataFilter;
|
|
5235
5263
|
}
|
|
5236
5264
|
/**
|
|
@@ -5344,7 +5372,7 @@ declare abstract class VectorizeIndex {
|
|
|
5344
5372
|
*/
|
|
5345
5373
|
public query(
|
|
5346
5374
|
vector: VectorFloatArray | number[],
|
|
5347
|
-
options
|
|
5375
|
+
options?: VectorizeQueryOptions,
|
|
5348
5376
|
): Promise<VectorizeMatches>;
|
|
5349
5377
|
/**
|
|
5350
5378
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
@@ -5390,7 +5418,7 @@ declare abstract class Vectorize {
|
|
|
5390
5418
|
*/
|
|
5391
5419
|
public query(
|
|
5392
5420
|
vector: VectorFloatArray | number[],
|
|
5393
|
-
options
|
|
5421
|
+
options?: VectorizeQueryOptions,
|
|
5394
5422
|
): Promise<VectorizeMatches>;
|
|
5395
5423
|
/**
|
|
5396
5424
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|