@cloudflare/workers-types 0.20240712.0 → 0.20250124.2
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 +1408 -183
- package/2021-11-03/index.ts +1345 -179
- package/2022-01-31/index.d.ts +1429 -204
- package/2022-01-31/index.ts +1366 -200
- package/2022-03-21/index.d.ts +1431 -205
- package/2022-03-21/index.ts +1368 -201
- package/2022-08-04/index.d.ts +1431 -205
- package/2022-08-04/index.ts +1368 -201
- package/2022-10-31/index.d.ts +1435 -205
- package/2022-10-31/index.ts +1372 -201
- package/2022-11-30/index.d.ts +1435 -205
- package/2022-11-30/index.ts +1372 -201
- package/2023-03-01/index.d.ts +1435 -205
- package/2023-03-01/index.ts +1372 -201
- package/2023-07-01/index.d.ts +1435 -205
- package/2023-07-01/index.ts +1372 -201
- package/experimental/index.d.ts +1446 -212
- package/experimental/index.ts +1383 -208
- package/index.d.ts +1408 -183
- package/index.ts +1345 -179
- package/oldest/index.d.ts +1408 -183
- package/oldest/index.ts +1345 -179
- package/package.json +1 -1
package/2021-11-03/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ and limitations under the License.
|
|
|
14
14
|
***************************************************************************** */
|
|
15
15
|
/* eslint-disable */
|
|
16
16
|
// noinspection JSUnusedGlobalSymbols
|
|
17
|
+
export declare var onmessage: never;
|
|
17
18
|
/**
|
|
18
19
|
* An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API.
|
|
19
20
|
*
|
|
@@ -227,7 +228,7 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
227
228
|
structuredClone<T>(value: T, options?: StructuredSerializeOptions): T;
|
|
228
229
|
reportError(error: any): void;
|
|
229
230
|
fetch(
|
|
230
|
-
input: RequestInfo,
|
|
231
|
+
input: RequestInfo | URL,
|
|
231
232
|
init?: RequestInit<RequestInitCfProperties>,
|
|
232
233
|
): Promise<Response>;
|
|
233
234
|
self: ServiceWorkerGlobalScope;
|
|
@@ -235,6 +236,7 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
|
|
|
235
236
|
caches: CacheStorage;
|
|
236
237
|
scheduler: Scheduler;
|
|
237
238
|
performance: Performance;
|
|
239
|
+
Cloudflare: Cloudflare;
|
|
238
240
|
readonly origin: string;
|
|
239
241
|
Event: typeof Event;
|
|
240
242
|
ExtendableEvent: typeof ExtendableEvent;
|
|
@@ -359,7 +361,7 @@ export declare function structuredClone<T>(
|
|
|
359
361
|
export declare function reportError(error: any): void;
|
|
360
362
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
|
|
361
363
|
export declare function fetch(
|
|
362
|
-
input: RequestInfo,
|
|
364
|
+
input: RequestInfo | URL,
|
|
363
365
|
init?: RequestInit<RequestInitCfProperties>,
|
|
364
366
|
): Promise<Response>;
|
|
365
367
|
export declare const self: ServiceWorkerGlobalScope;
|
|
@@ -386,11 +388,13 @@ export declare const scheduler: Scheduler;
|
|
|
386
388
|
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
387
389
|
*/
|
|
388
390
|
export declare const performance: Performance;
|
|
391
|
+
export declare const Cloudflare: Cloudflare;
|
|
389
392
|
export declare const origin: string;
|
|
390
393
|
export interface TestController {}
|
|
391
394
|
export interface ExecutionContext {
|
|
392
395
|
waitUntil(promise: Promise<any>): void;
|
|
393
396
|
passThroughOnException(): void;
|
|
397
|
+
props: any;
|
|
394
398
|
}
|
|
395
399
|
export type ExportedHandlerFetchHandler<
|
|
396
400
|
Env = unknown,
|
|
@@ -410,6 +414,11 @@ export type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
|
410
414
|
env: Env,
|
|
411
415
|
ctx: ExecutionContext,
|
|
412
416
|
) => void | Promise<void>;
|
|
417
|
+
export type ExportedHandlerTailStreamHandler<Env = unknown> = (
|
|
418
|
+
event: TailStream.TailEvent,
|
|
419
|
+
env: Env,
|
|
420
|
+
ctx: ExecutionContext,
|
|
421
|
+
) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
|
|
413
422
|
export type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
414
423
|
controller: ScheduledController,
|
|
415
424
|
env: Env,
|
|
@@ -433,6 +442,7 @@ export interface ExportedHandler<
|
|
|
433
442
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
434
443
|
tail?: ExportedHandlerTailHandler<Env>;
|
|
435
444
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
445
|
+
tailStream?: ExportedHandlerTailStreamHandler<Env>;
|
|
436
446
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
437
447
|
test?: ExportedHandlerTestHandler<Env>;
|
|
438
448
|
email?: EmailExportedHandler<Env>;
|
|
@@ -464,9 +474,12 @@ export interface AlarmInvocationInfo {
|
|
|
464
474
|
readonly isRetry: boolean;
|
|
465
475
|
readonly retryCount: number;
|
|
466
476
|
}
|
|
477
|
+
export interface Cloudflare {
|
|
478
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
479
|
+
}
|
|
467
480
|
export interface DurableObject {
|
|
468
481
|
fetch(request: Request): Response | Promise<Response>;
|
|
469
|
-
alarm?(): void | Promise<void>;
|
|
482
|
+
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
|
|
470
483
|
webSocketMessage?(
|
|
471
484
|
ws: WebSocket,
|
|
472
485
|
message: string | ArrayBuffer,
|
|
@@ -539,6 +552,7 @@ export interface DurableObjectState {
|
|
|
539
552
|
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
|
|
540
553
|
getHibernatableWebSocketEventTimeout(): number | null;
|
|
541
554
|
getTags(ws: WebSocket): string[];
|
|
555
|
+
abort(reason?: string): void;
|
|
542
556
|
}
|
|
543
557
|
export interface DurableObjectTransaction {
|
|
544
558
|
get<T = unknown>(
|
|
@@ -605,7 +619,11 @@ export interface DurableObjectStorage {
|
|
|
605
619
|
): Promise<void>;
|
|
606
620
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
607
621
|
sync(): Promise<void>;
|
|
622
|
+
sql: SqlStorage;
|
|
608
623
|
transactionSync<T>(closure: () => T): T;
|
|
624
|
+
getCurrentBookmark(): Promise<string>;
|
|
625
|
+
getBookmarkForTime(timestamp: number | Date): Promise<string>;
|
|
626
|
+
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
|
|
609
627
|
}
|
|
610
628
|
export interface DurableObjectListOptions {
|
|
611
629
|
start?: string;
|
|
@@ -970,14 +988,17 @@ export declare abstract class CacheStorage {
|
|
|
970
988
|
*/
|
|
971
989
|
export declare abstract class Cache {
|
|
972
990
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
|
|
973
|
-
delete(
|
|
991
|
+
delete(
|
|
992
|
+
request: RequestInfo | URL,
|
|
993
|
+
options?: CacheQueryOptions,
|
|
994
|
+
): Promise<boolean>;
|
|
974
995
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
|
|
975
996
|
match(
|
|
976
|
-
request: RequestInfo,
|
|
997
|
+
request: RequestInfo | URL,
|
|
977
998
|
options?: CacheQueryOptions,
|
|
978
999
|
): Promise<Response | undefined>;
|
|
979
1000
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
|
|
980
|
-
put(request: RequestInfo, response: Response): Promise<void>;
|
|
1001
|
+
put(request: RequestInfo | URL, response: Response): Promise<void>;
|
|
981
1002
|
}
|
|
982
1003
|
export interface CacheQueryOptions {
|
|
983
1004
|
ignoreMethod?: boolean;
|
|
@@ -1400,20 +1421,44 @@ export interface Element {
|
|
|
1400
1421
|
hasAttribute(name: string): boolean;
|
|
1401
1422
|
setAttribute(name: string, value: string): Element;
|
|
1402
1423
|
removeAttribute(name: string): Element;
|
|
1403
|
-
before(
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1424
|
+
before(
|
|
1425
|
+
content: string | ReadableStream | Response,
|
|
1426
|
+
options?: ContentOptions,
|
|
1427
|
+
): Element;
|
|
1428
|
+
after(
|
|
1429
|
+
content: string | ReadableStream | Response,
|
|
1430
|
+
options?: ContentOptions,
|
|
1431
|
+
): Element;
|
|
1432
|
+
prepend(
|
|
1433
|
+
content: string | ReadableStream | Response,
|
|
1434
|
+
options?: ContentOptions,
|
|
1435
|
+
): Element;
|
|
1436
|
+
append(
|
|
1437
|
+
content: string | ReadableStream | Response,
|
|
1438
|
+
options?: ContentOptions,
|
|
1439
|
+
): Element;
|
|
1440
|
+
replace(
|
|
1441
|
+
content: string | ReadableStream | Response,
|
|
1442
|
+
options?: ContentOptions,
|
|
1443
|
+
): Element;
|
|
1408
1444
|
remove(): Element;
|
|
1409
1445
|
removeAndKeepContent(): Element;
|
|
1410
|
-
setInnerContent(
|
|
1446
|
+
setInnerContent(
|
|
1447
|
+
content: string | ReadableStream | Response,
|
|
1448
|
+
options?: ContentOptions,
|
|
1449
|
+
): Element;
|
|
1411
1450
|
onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
|
|
1412
1451
|
}
|
|
1413
1452
|
export interface EndTag {
|
|
1414
1453
|
name: string;
|
|
1415
|
-
before(
|
|
1416
|
-
|
|
1454
|
+
before(
|
|
1455
|
+
content: string | ReadableStream | Response,
|
|
1456
|
+
options?: ContentOptions,
|
|
1457
|
+
): EndTag;
|
|
1458
|
+
after(
|
|
1459
|
+
content: string | ReadableStream | Response,
|
|
1460
|
+
options?: ContentOptions,
|
|
1461
|
+
): EndTag;
|
|
1417
1462
|
remove(): EndTag;
|
|
1418
1463
|
}
|
|
1419
1464
|
export interface Comment {
|
|
@@ -1428,9 +1473,18 @@ export interface Text {
|
|
|
1428
1473
|
readonly text: string;
|
|
1429
1474
|
readonly lastInTextNode: boolean;
|
|
1430
1475
|
readonly removed: boolean;
|
|
1431
|
-
before(
|
|
1432
|
-
|
|
1433
|
-
|
|
1476
|
+
before(
|
|
1477
|
+
content: string | ReadableStream | Response,
|
|
1478
|
+
options?: ContentOptions,
|
|
1479
|
+
): Text;
|
|
1480
|
+
after(
|
|
1481
|
+
content: string | ReadableStream | Response,
|
|
1482
|
+
options?: ContentOptions,
|
|
1483
|
+
): Text;
|
|
1484
|
+
replace(
|
|
1485
|
+
content: string | ReadableStream | Response,
|
|
1486
|
+
options?: ContentOptions,
|
|
1487
|
+
): Text;
|
|
1434
1488
|
remove(): Text;
|
|
1435
1489
|
}
|
|
1436
1490
|
export interface DocumentEnd {
|
|
@@ -1512,12 +1566,18 @@ export declare abstract class Body {
|
|
|
1512
1566
|
*
|
|
1513
1567
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1514
1568
|
*/
|
|
1515
|
-
export declare
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1569
|
+
export declare var Response: {
|
|
1570
|
+
prototype: Response;
|
|
1571
|
+
new (body?: BodyInit | null, init?: ResponseInit): Response;
|
|
1572
|
+
redirect(url: string, status?: number): Response;
|
|
1573
|
+
json(any: any, maybeInit?: ResponseInit | Response): Response;
|
|
1574
|
+
};
|
|
1575
|
+
/**
|
|
1576
|
+
* This Fetch API interface represents the response to a request.
|
|
1577
|
+
*
|
|
1578
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1579
|
+
*/
|
|
1580
|
+
export interface Response extends Body {
|
|
1521
1581
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
|
|
1522
1582
|
clone(): Response;
|
|
1523
1583
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
|
|
@@ -1546,17 +1606,28 @@ export interface ResponseInit {
|
|
|
1546
1606
|
export type RequestInfo<
|
|
1547
1607
|
CfHostMetadata = unknown,
|
|
1548
1608
|
Cf = CfProperties<CfHostMetadata>,
|
|
1549
|
-
> = Request<CfHostMetadata, Cf> | string
|
|
1609
|
+
> = Request<CfHostMetadata, Cf> | string;
|
|
1610
|
+
/**
|
|
1611
|
+
* This Fetch API interface represents a resource request.
|
|
1612
|
+
*
|
|
1613
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
|
|
1614
|
+
*/
|
|
1615
|
+
export declare var Request: {
|
|
1616
|
+
prototype: Request;
|
|
1617
|
+
new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
|
|
1618
|
+
input: RequestInfo<CfProperties> | URL,
|
|
1619
|
+
init?: RequestInit<Cf>,
|
|
1620
|
+
): Request<CfHostMetadata, Cf>;
|
|
1621
|
+
};
|
|
1550
1622
|
/**
|
|
1551
1623
|
* This Fetch API interface represents a resource request.
|
|
1552
1624
|
*
|
|
1553
1625
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
|
|
1554
1626
|
*/
|
|
1555
|
-
export
|
|
1627
|
+
export interface Request<
|
|
1556
1628
|
CfHostMetadata = unknown,
|
|
1557
1629
|
Cf = CfProperties<CfHostMetadata>,
|
|
1558
1630
|
> extends Body {
|
|
1559
|
-
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1560
1631
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
|
|
1561
1632
|
clone(): Request<CfHostMetadata, Cf>;
|
|
1562
1633
|
/**
|
|
@@ -1629,7 +1700,7 @@ export type Fetcher<
|
|
|
1629
1700
|
> = (T extends Rpc.EntrypointBranded
|
|
1630
1701
|
? Rpc.Provider<T, Reserved | "fetch" | "connect">
|
|
1631
1702
|
: unknown) & {
|
|
1632
|
-
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1703
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1633
1704
|
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1634
1705
|
};
|
|
1635
1706
|
export interface FetcherPutOptions {
|
|
@@ -1850,6 +1921,7 @@ export interface R2MultipartUpload {
|
|
|
1850
1921
|
uploadPart(
|
|
1851
1922
|
partNumber: number,
|
|
1852
1923
|
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
|
|
1924
|
+
options?: R2UploadPartOptions,
|
|
1853
1925
|
): Promise<R2UploadedPart>;
|
|
1854
1926
|
abort(): Promise<void>;
|
|
1855
1927
|
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
|
|
@@ -1870,6 +1942,7 @@ export declare abstract class R2Object {
|
|
|
1870
1942
|
readonly customMetadata?: Record<string, string>;
|
|
1871
1943
|
readonly range?: R2Range;
|
|
1872
1944
|
readonly storageClass: string;
|
|
1945
|
+
readonly ssecKeyMd5?: string;
|
|
1873
1946
|
writeHttpMetadata(headers: Headers): void;
|
|
1874
1947
|
}
|
|
1875
1948
|
export interface R2ObjectBody extends R2Object {
|
|
@@ -1902,6 +1975,7 @@ export interface R2Conditional {
|
|
|
1902
1975
|
export interface R2GetOptions {
|
|
1903
1976
|
onlyIf?: R2Conditional | Headers;
|
|
1904
1977
|
range?: R2Range | Headers;
|
|
1978
|
+
ssecKey?: ArrayBuffer | string;
|
|
1905
1979
|
}
|
|
1906
1980
|
export interface R2PutOptions {
|
|
1907
1981
|
onlyIf?: R2Conditional | Headers;
|
|
@@ -1913,11 +1987,13 @@ export interface R2PutOptions {
|
|
|
1913
1987
|
sha384?: ArrayBuffer | string;
|
|
1914
1988
|
sha512?: ArrayBuffer | string;
|
|
1915
1989
|
storageClass?: string;
|
|
1990
|
+
ssecKey?: ArrayBuffer | string;
|
|
1916
1991
|
}
|
|
1917
1992
|
export interface R2MultipartOptions {
|
|
1918
1993
|
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1919
1994
|
customMetadata?: Record<string, string>;
|
|
1920
1995
|
storageClass?: string;
|
|
1996
|
+
ssecKey?: ArrayBuffer | string;
|
|
1921
1997
|
}
|
|
1922
1998
|
export interface R2Checksums {
|
|
1923
1999
|
readonly md5?: ArrayBuffer;
|
|
@@ -1954,6 +2030,9 @@ export type R2Objects = {
|
|
|
1954
2030
|
truncated: false;
|
|
1955
2031
|
}
|
|
1956
2032
|
);
|
|
2033
|
+
export interface R2UploadPartOptions {
|
|
2034
|
+
ssecKey?: ArrayBuffer | string;
|
|
2035
|
+
}
|
|
1957
2036
|
export declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1958
2037
|
readonly scheduledTime: number;
|
|
1959
2038
|
readonly cron: string;
|
|
@@ -2367,6 +2446,8 @@ export interface TraceItem {
|
|
|
2367
2446
|
readonly dispatchNamespace?: string;
|
|
2368
2447
|
readonly scriptTags?: string[];
|
|
2369
2448
|
readonly outcome: string;
|
|
2449
|
+
readonly executionModel: string;
|
|
2450
|
+
readonly truncated: boolean;
|
|
2370
2451
|
}
|
|
2371
2452
|
export interface TraceItemAlarmEventInfo {
|
|
2372
2453
|
readonly scheduledTime: Date;
|
|
@@ -2660,8 +2741,24 @@ export type WebSocketEventMap = {
|
|
|
2660
2741
|
*
|
|
2661
2742
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
2662
2743
|
*/
|
|
2663
|
-
export declare
|
|
2664
|
-
|
|
2744
|
+
export declare var WebSocket: {
|
|
2745
|
+
prototype: WebSocket;
|
|
2746
|
+
new (url: string, protocols?: string[] | string): WebSocket;
|
|
2747
|
+
readonly READY_STATE_CONNECTING: number;
|
|
2748
|
+
readonly CONNECTING: number;
|
|
2749
|
+
readonly READY_STATE_OPEN: number;
|
|
2750
|
+
readonly OPEN: number;
|
|
2751
|
+
readonly READY_STATE_CLOSING: number;
|
|
2752
|
+
readonly CLOSING: number;
|
|
2753
|
+
readonly READY_STATE_CLOSED: number;
|
|
2754
|
+
readonly CLOSED: number;
|
|
2755
|
+
};
|
|
2756
|
+
/**
|
|
2757
|
+
* Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
|
|
2758
|
+
*
|
|
2759
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
2760
|
+
*/
|
|
2761
|
+
export interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
2665
2762
|
accept(): void;
|
|
2666
2763
|
/**
|
|
2667
2764
|
* Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
|
|
@@ -2677,14 +2774,6 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
2677
2774
|
close(code?: number, reason?: string): void;
|
|
2678
2775
|
serializeAttachment(attachment: any): void;
|
|
2679
2776
|
deserializeAttachment(): any | null;
|
|
2680
|
-
static readonly READY_STATE_CONNECTING: number;
|
|
2681
|
-
static readonly CONNECTING: number;
|
|
2682
|
-
static readonly READY_STATE_OPEN: number;
|
|
2683
|
-
static readonly OPEN: number;
|
|
2684
|
-
static readonly READY_STATE_CLOSING: number;
|
|
2685
|
-
static readonly CLOSING: number;
|
|
2686
|
-
static readonly READY_STATE_CLOSED: number;
|
|
2687
|
-
static readonly CLOSED: number;
|
|
2688
2777
|
/**
|
|
2689
2778
|
* Returns the state of the WebSocket object's connection. It can have the values described below.
|
|
2690
2779
|
*
|
|
@@ -2716,6 +2805,37 @@ export declare const WebSocketPair: {
|
|
|
2716
2805
|
1: WebSocket;
|
|
2717
2806
|
};
|
|
2718
2807
|
};
|
|
2808
|
+
export interface SqlStorage {
|
|
2809
|
+
exec<T extends Record<string, SqlStorageValue>>(
|
|
2810
|
+
query: string,
|
|
2811
|
+
...bindings: any[]
|
|
2812
|
+
): SqlStorageCursor<T>;
|
|
2813
|
+
get databaseSize(): number;
|
|
2814
|
+
Cursor: typeof SqlStorageCursor;
|
|
2815
|
+
Statement: typeof SqlStorageStatement;
|
|
2816
|
+
}
|
|
2817
|
+
export declare abstract class SqlStorageStatement {}
|
|
2818
|
+
export type SqlStorageValue = ArrayBuffer | string | number | null;
|
|
2819
|
+
export declare abstract class SqlStorageCursor<
|
|
2820
|
+
T extends Record<string, SqlStorageValue>,
|
|
2821
|
+
> {
|
|
2822
|
+
next():
|
|
2823
|
+
| {
|
|
2824
|
+
done?: false;
|
|
2825
|
+
value: T;
|
|
2826
|
+
}
|
|
2827
|
+
| {
|
|
2828
|
+
done: true;
|
|
2829
|
+
value?: never;
|
|
2830
|
+
};
|
|
2831
|
+
toArray(): T[];
|
|
2832
|
+
one(): T;
|
|
2833
|
+
raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
|
|
2834
|
+
columnNames: string[];
|
|
2835
|
+
get rowsRead(): number;
|
|
2836
|
+
get rowsWritten(): number;
|
|
2837
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
2838
|
+
}
|
|
2719
2839
|
export interface Socket {
|
|
2720
2840
|
get readable(): ReadableStream;
|
|
2721
2841
|
get writable(): WritableStream;
|
|
@@ -3246,7 +3366,7 @@ export interface GPUOrigin3DDict {
|
|
|
3246
3366
|
z?: number;
|
|
3247
3367
|
}
|
|
3248
3368
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
|
|
3249
|
-
export declare class EventSource {
|
|
3369
|
+
export declare class EventSource extends EventTarget {
|
|
3250
3370
|
constructor(url: string, init?: EventSourceEventSourceInit);
|
|
3251
3371
|
/**
|
|
3252
3372
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -3345,10 +3465,10 @@ export declare abstract class BaseAiSentenceSimilarity {
|
|
|
3345
3465
|
inputs: AiSentenceSimilarityInput;
|
|
3346
3466
|
postProcessedOutputs: AiSentenceSimilarityOutput;
|
|
3347
3467
|
}
|
|
3348
|
-
export type
|
|
3468
|
+
export type AiAutomaticSpeechRecognitionInput = {
|
|
3349
3469
|
audio: number[];
|
|
3350
3470
|
};
|
|
3351
|
-
export type
|
|
3471
|
+
export type AiAutomaticSpeechRecognitionOutput = {
|
|
3352
3472
|
text?: string;
|
|
3353
3473
|
words?: {
|
|
3354
3474
|
word: string;
|
|
@@ -3357,9 +3477,9 @@ export type AiSpeechRecognitionOutput = {
|
|
|
3357
3477
|
}[];
|
|
3358
3478
|
vtt?: string;
|
|
3359
3479
|
};
|
|
3360
|
-
export declare abstract class
|
|
3361
|
-
inputs:
|
|
3362
|
-
postProcessedOutputs:
|
|
3480
|
+
export declare abstract class BaseAiAutomaticSpeechRecognition {
|
|
3481
|
+
inputs: AiAutomaticSpeechRecognitionInput;
|
|
3482
|
+
postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;
|
|
3363
3483
|
}
|
|
3364
3484
|
export type AiSummarizationInput = {
|
|
3365
3485
|
input_text: string;
|
|
@@ -3395,16 +3515,36 @@ export declare abstract class BaseAiTextEmbeddings {
|
|
|
3395
3515
|
postProcessedOutputs: AiTextEmbeddingsOutput;
|
|
3396
3516
|
}
|
|
3397
3517
|
export type RoleScopedChatInput = {
|
|
3398
|
-
role:
|
|
3518
|
+
role:
|
|
3519
|
+
| "user"
|
|
3520
|
+
| "assistant"
|
|
3521
|
+
| "system"
|
|
3522
|
+
| "tool"
|
|
3523
|
+
| (string & NonNullable<unknown>);
|
|
3399
3524
|
content: string;
|
|
3525
|
+
name?: string;
|
|
3526
|
+
};
|
|
3527
|
+
export type AiTextGenerationToolLegacyInput = {
|
|
3528
|
+
name: string;
|
|
3529
|
+
description: string;
|
|
3530
|
+
parameters?: {
|
|
3531
|
+
type: "object" | (string & NonNullable<unknown>);
|
|
3532
|
+
properties: {
|
|
3533
|
+
[key: string]: {
|
|
3534
|
+
type: string;
|
|
3535
|
+
description?: string;
|
|
3536
|
+
};
|
|
3537
|
+
};
|
|
3538
|
+
required: string[];
|
|
3539
|
+
};
|
|
3400
3540
|
};
|
|
3401
3541
|
export type AiTextGenerationToolInput = {
|
|
3402
|
-
type: "function";
|
|
3542
|
+
type: "function" | (string & NonNullable<unknown>);
|
|
3403
3543
|
function: {
|
|
3404
3544
|
name: string;
|
|
3405
3545
|
description: string;
|
|
3406
3546
|
parameters?: {
|
|
3407
|
-
type: "object";
|
|
3547
|
+
type: "object" | (string & NonNullable<unknown>);
|
|
3408
3548
|
properties: {
|
|
3409
3549
|
[key: string]: {
|
|
3410
3550
|
type: string;
|
|
@@ -3415,6 +3555,10 @@ export type AiTextGenerationToolInput = {
|
|
|
3415
3555
|
};
|
|
3416
3556
|
};
|
|
3417
3557
|
};
|
|
3558
|
+
export type AiTextGenerationFunctionsInput = {
|
|
3559
|
+
name: string;
|
|
3560
|
+
code: string;
|
|
3561
|
+
};
|
|
3418
3562
|
export type AiTextGenerationInput = {
|
|
3419
3563
|
prompt?: string;
|
|
3420
3564
|
raw?: boolean;
|
|
@@ -3428,7 +3572,11 @@ export type AiTextGenerationInput = {
|
|
|
3428
3572
|
frequency_penalty?: number;
|
|
3429
3573
|
presence_penalty?: number;
|
|
3430
3574
|
messages?: RoleScopedChatInput[];
|
|
3431
|
-
tools?:
|
|
3575
|
+
tools?:
|
|
3576
|
+
| AiTextGenerationToolInput[]
|
|
3577
|
+
| AiTextGenerationToolLegacyInput[]
|
|
3578
|
+
| (object & NonNullable<unknown>);
|
|
3579
|
+
functions?: AiTextGenerationFunctionsInput[];
|
|
3432
3580
|
};
|
|
3433
3581
|
export type AiTextGenerationOutput =
|
|
3434
3582
|
| {
|
|
@@ -3443,15 +3591,33 @@ export declare abstract class BaseAiTextGeneration {
|
|
|
3443
3591
|
inputs: AiTextGenerationInput;
|
|
3444
3592
|
postProcessedOutputs: AiTextGenerationOutput;
|
|
3445
3593
|
}
|
|
3594
|
+
export type AiTextToSpeechInput = {
|
|
3595
|
+
prompt: string;
|
|
3596
|
+
lang?: string;
|
|
3597
|
+
};
|
|
3598
|
+
export type AiTextToSpeechOutput =
|
|
3599
|
+
| Uint8Array
|
|
3600
|
+
| {
|
|
3601
|
+
audio: string;
|
|
3602
|
+
};
|
|
3603
|
+
export declare abstract class BaseAiTextToSpeech {
|
|
3604
|
+
inputs: AiTextToSpeechInput;
|
|
3605
|
+
postProcessedOutputs: AiTextToSpeechOutput;
|
|
3606
|
+
}
|
|
3446
3607
|
export type AiTextToImageInput = {
|
|
3447
3608
|
prompt: string;
|
|
3609
|
+
negative_prompt?: string;
|
|
3610
|
+
height?: number;
|
|
3611
|
+
width?: number;
|
|
3448
3612
|
image?: number[];
|
|
3613
|
+
image_b64?: string;
|
|
3449
3614
|
mask?: number[];
|
|
3450
3615
|
num_steps?: number;
|
|
3451
3616
|
strength?: number;
|
|
3452
3617
|
guidance?: number;
|
|
3618
|
+
seed?: number;
|
|
3453
3619
|
};
|
|
3454
|
-
export type AiTextToImageOutput = Uint8Array
|
|
3620
|
+
export type AiTextToImageOutput = ReadableStream<Uint8Array>;
|
|
3455
3621
|
export declare abstract class BaseAiTextToImage {
|
|
3456
3622
|
inputs: AiTextToImageInput;
|
|
3457
3623
|
postProcessedOutputs: AiTextToImageOutput;
|
|
@@ -3468,127 +3634,615 @@ export declare abstract class BaseAiTranslation {
|
|
|
3468
3634
|
inputs: AiTranslationInput;
|
|
3469
3635
|
postProcessedOutputs: AiTranslationOutput;
|
|
3470
3636
|
}
|
|
3637
|
+
export type Ai_Cf_Openai_Whisper_Input =
|
|
3638
|
+
| string
|
|
3639
|
+
| {
|
|
3640
|
+
/**
|
|
3641
|
+
* An array of integers that represent the audio data constrained to 8-bit unsigned integer values
|
|
3642
|
+
*/
|
|
3643
|
+
audio: number[];
|
|
3644
|
+
};
|
|
3645
|
+
export interface Ai_Cf_Openai_Whisper_Output {
|
|
3646
|
+
/**
|
|
3647
|
+
* The transcription
|
|
3648
|
+
*/
|
|
3649
|
+
text: string;
|
|
3650
|
+
word_count?: number;
|
|
3651
|
+
words?: {
|
|
3652
|
+
word?: string;
|
|
3653
|
+
/**
|
|
3654
|
+
* The second this word begins in the recording
|
|
3655
|
+
*/
|
|
3656
|
+
start?: number;
|
|
3657
|
+
/**
|
|
3658
|
+
* The ending second when the word completes
|
|
3659
|
+
*/
|
|
3660
|
+
end?: number;
|
|
3661
|
+
}[];
|
|
3662
|
+
vtt?: string;
|
|
3663
|
+
}
|
|
3664
|
+
export declare abstract class Base_Ai_Cf_Openai_Whisper {
|
|
3665
|
+
inputs: Ai_Cf_Openai_Whisper_Input;
|
|
3666
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;
|
|
3667
|
+
}
|
|
3668
|
+
export type Ai_Cf_Openai_Whisper_Tiny_En_Input =
|
|
3669
|
+
| string
|
|
3670
|
+
| {
|
|
3671
|
+
/**
|
|
3672
|
+
* An array of integers that represent the audio data constrained to 8-bit unsigned integer values
|
|
3673
|
+
*/
|
|
3674
|
+
audio: number[];
|
|
3675
|
+
};
|
|
3676
|
+
export interface Ai_Cf_Openai_Whisper_Tiny_En_Output {
|
|
3677
|
+
/**
|
|
3678
|
+
* The transcription
|
|
3679
|
+
*/
|
|
3680
|
+
text: string;
|
|
3681
|
+
word_count?: number;
|
|
3682
|
+
words?: {
|
|
3683
|
+
word?: string;
|
|
3684
|
+
/**
|
|
3685
|
+
* The second this word begins in the recording
|
|
3686
|
+
*/
|
|
3687
|
+
start?: number;
|
|
3688
|
+
/**
|
|
3689
|
+
* The ending second when the word completes
|
|
3690
|
+
*/
|
|
3691
|
+
end?: number;
|
|
3692
|
+
}[];
|
|
3693
|
+
vtt?: string;
|
|
3694
|
+
}
|
|
3695
|
+
export declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
|
|
3696
|
+
inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;
|
|
3697
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
|
|
3698
|
+
}
|
|
3699
|
+
export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
|
|
3700
|
+
/**
|
|
3701
|
+
* Base64 encoded value of the audio data.
|
|
3702
|
+
*/
|
|
3703
|
+
audio: string;
|
|
3704
|
+
/**
|
|
3705
|
+
* Supported tasks are 'translate' or 'transcribe'.
|
|
3706
|
+
*/
|
|
3707
|
+
task?: string;
|
|
3708
|
+
/**
|
|
3709
|
+
* The language of the audio being transcribed or translated.
|
|
3710
|
+
*/
|
|
3711
|
+
language?: string;
|
|
3712
|
+
/**
|
|
3713
|
+
* Preprocess the audio with a voice activity detection model.
|
|
3714
|
+
*/
|
|
3715
|
+
vad_filter?: string;
|
|
3716
|
+
/**
|
|
3717
|
+
* A text prompt to help provide context to the model on the contents of the audio.
|
|
3718
|
+
*/
|
|
3719
|
+
initial_prompt?: string;
|
|
3720
|
+
/**
|
|
3721
|
+
* The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
|
|
3722
|
+
*/
|
|
3723
|
+
prefix?: string;
|
|
3724
|
+
}
|
|
3725
|
+
export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
|
|
3726
|
+
transcription_info?: {
|
|
3727
|
+
/**
|
|
3728
|
+
* The language of the audio being transcribed or translated.
|
|
3729
|
+
*/
|
|
3730
|
+
language?: string;
|
|
3731
|
+
/**
|
|
3732
|
+
* The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.
|
|
3733
|
+
*/
|
|
3734
|
+
language_probability?: number;
|
|
3735
|
+
/**
|
|
3736
|
+
* The total duration of the original audio file, in seconds.
|
|
3737
|
+
*/
|
|
3738
|
+
duration?: number;
|
|
3739
|
+
/**
|
|
3740
|
+
* The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.
|
|
3741
|
+
*/
|
|
3742
|
+
duration_after_vad?: number;
|
|
3743
|
+
};
|
|
3744
|
+
/**
|
|
3745
|
+
* The complete transcription of the audio.
|
|
3746
|
+
*/
|
|
3747
|
+
text: string;
|
|
3748
|
+
/**
|
|
3749
|
+
* The total number of words in the transcription.
|
|
3750
|
+
*/
|
|
3751
|
+
word_count?: number;
|
|
3752
|
+
segments?: {
|
|
3753
|
+
/**
|
|
3754
|
+
* The starting time of the segment within the audio, in seconds.
|
|
3755
|
+
*/
|
|
3756
|
+
start?: number;
|
|
3757
|
+
/**
|
|
3758
|
+
* The ending time of the segment within the audio, in seconds.
|
|
3759
|
+
*/
|
|
3760
|
+
end?: number;
|
|
3761
|
+
/**
|
|
3762
|
+
* The transcription of the segment.
|
|
3763
|
+
*/
|
|
3764
|
+
text?: string;
|
|
3765
|
+
/**
|
|
3766
|
+
* The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.
|
|
3767
|
+
*/
|
|
3768
|
+
temperature?: number;
|
|
3769
|
+
/**
|
|
3770
|
+
* The average log probability of the predictions for the words in this segment, indicating overall confidence.
|
|
3771
|
+
*/
|
|
3772
|
+
avg_logprob?: number;
|
|
3773
|
+
/**
|
|
3774
|
+
* The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.
|
|
3775
|
+
*/
|
|
3776
|
+
compression_ratio?: number;
|
|
3777
|
+
/**
|
|
3778
|
+
* The probability that the segment contains no speech, represented as a decimal between 0 and 1.
|
|
3779
|
+
*/
|
|
3780
|
+
no_speech_prob?: number;
|
|
3781
|
+
words?: {
|
|
3782
|
+
/**
|
|
3783
|
+
* The individual word transcribed from the audio.
|
|
3784
|
+
*/
|
|
3785
|
+
word?: string;
|
|
3786
|
+
/**
|
|
3787
|
+
* The starting time of the word within the audio, in seconds.
|
|
3788
|
+
*/
|
|
3789
|
+
start?: number;
|
|
3790
|
+
/**
|
|
3791
|
+
* The ending time of the word within the audio, in seconds.
|
|
3792
|
+
*/
|
|
3793
|
+
end?: number;
|
|
3794
|
+
}[];
|
|
3795
|
+
};
|
|
3796
|
+
/**
|
|
3797
|
+
* The transcription in WebVTT format, which includes timing and text information for use in subtitles.
|
|
3798
|
+
*/
|
|
3799
|
+
vtt?: string;
|
|
3800
|
+
}
|
|
3801
|
+
export declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {
|
|
3802
|
+
inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;
|
|
3803
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;
|
|
3804
|
+
}
|
|
3805
|
+
export interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {
|
|
3806
|
+
/**
|
|
3807
|
+
* A text description of the image you want to generate.
|
|
3808
|
+
*/
|
|
3809
|
+
prompt: string;
|
|
3810
|
+
/**
|
|
3811
|
+
* The number of diffusion steps; higher values can improve quality but take longer.
|
|
3812
|
+
*/
|
|
3813
|
+
steps?: number;
|
|
3814
|
+
}
|
|
3815
|
+
export interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {
|
|
3816
|
+
/**
|
|
3817
|
+
* The generated image in Base64 format.
|
|
3818
|
+
*/
|
|
3819
|
+
image?: string;
|
|
3820
|
+
}
|
|
3821
|
+
export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {
|
|
3822
|
+
inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;
|
|
3823
|
+
postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;
|
|
3824
|
+
}
|
|
3825
|
+
export type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Prompt | Messages;
|
|
3826
|
+
export interface Prompt {
|
|
3827
|
+
/**
|
|
3828
|
+
* The input text prompt for the model to generate a response.
|
|
3829
|
+
*/
|
|
3830
|
+
prompt: string;
|
|
3831
|
+
image?: number[] | (string & NonNullable<unknown>);
|
|
3832
|
+
/**
|
|
3833
|
+
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
|
|
3834
|
+
*/
|
|
3835
|
+
raw?: boolean;
|
|
3836
|
+
/**
|
|
3837
|
+
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
|
|
3838
|
+
*/
|
|
3839
|
+
stream?: boolean;
|
|
3840
|
+
/**
|
|
3841
|
+
* The maximum number of tokens to generate in the response.
|
|
3842
|
+
*/
|
|
3843
|
+
max_tokens?: number;
|
|
3844
|
+
/**
|
|
3845
|
+
* Controls the randomness of the output; higher values produce more random results.
|
|
3846
|
+
*/
|
|
3847
|
+
temperature?: number;
|
|
3848
|
+
/**
|
|
3849
|
+
* Adjusts the creativity of the AI's responses by controlling how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
|
|
3850
|
+
*/
|
|
3851
|
+
top_p?: number;
|
|
3852
|
+
/**
|
|
3853
|
+
* Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
|
|
3854
|
+
*/
|
|
3855
|
+
top_k?: number;
|
|
3856
|
+
/**
|
|
3857
|
+
* Random seed for reproducibility of the generation.
|
|
3858
|
+
*/
|
|
3859
|
+
seed?: number;
|
|
3860
|
+
/**
|
|
3861
|
+
* Penalty for repeated tokens; higher values discourage repetition.
|
|
3862
|
+
*/
|
|
3863
|
+
repetition_penalty?: number;
|
|
3864
|
+
/**
|
|
3865
|
+
* Decreases the likelihood of the model repeating the same lines verbatim.
|
|
3866
|
+
*/
|
|
3867
|
+
frequency_penalty?: number;
|
|
3868
|
+
/**
|
|
3869
|
+
* Increases the likelihood of the model introducing new topics.
|
|
3870
|
+
*/
|
|
3871
|
+
presence_penalty?: number;
|
|
3872
|
+
/**
|
|
3873
|
+
* Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
|
|
3874
|
+
*/
|
|
3875
|
+
lora?: string;
|
|
3876
|
+
}
|
|
3877
|
+
export interface Messages {
|
|
3878
|
+
/**
|
|
3879
|
+
* An array of message objects representing the conversation history.
|
|
3880
|
+
*/
|
|
3881
|
+
messages: {
|
|
3882
|
+
/**
|
|
3883
|
+
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
3884
|
+
*/
|
|
3885
|
+
role: string;
|
|
3886
|
+
/**
|
|
3887
|
+
* The content of the message as a string.
|
|
3888
|
+
*/
|
|
3889
|
+
content: string;
|
|
3890
|
+
}[];
|
|
3891
|
+
image?: number[] | string;
|
|
3892
|
+
functions?: {
|
|
3893
|
+
name: string;
|
|
3894
|
+
code: string;
|
|
3895
|
+
}[];
|
|
3896
|
+
/**
|
|
3897
|
+
* A list of tools available for the assistant to use.
|
|
3898
|
+
*/
|
|
3899
|
+
tools?: (
|
|
3900
|
+
| {
|
|
3901
|
+
/**
|
|
3902
|
+
* The name of the tool. More descriptive the better.
|
|
3903
|
+
*/
|
|
3904
|
+
name: string;
|
|
3905
|
+
/**
|
|
3906
|
+
* A brief description of what the tool does.
|
|
3907
|
+
*/
|
|
3908
|
+
description: string;
|
|
3909
|
+
/**
|
|
3910
|
+
* Schema defining the parameters accepted by the tool.
|
|
3911
|
+
*/
|
|
3912
|
+
parameters: {
|
|
3913
|
+
/**
|
|
3914
|
+
* The type of the parameters object (usually 'object').
|
|
3915
|
+
*/
|
|
3916
|
+
type: string;
|
|
3917
|
+
/**
|
|
3918
|
+
* List of required parameter names.
|
|
3919
|
+
*/
|
|
3920
|
+
required?: string[];
|
|
3921
|
+
/**
|
|
3922
|
+
* Definitions of each parameter.
|
|
3923
|
+
*/
|
|
3924
|
+
properties: {
|
|
3925
|
+
[k: string]: {
|
|
3926
|
+
/**
|
|
3927
|
+
* The data type of the parameter.
|
|
3928
|
+
*/
|
|
3929
|
+
type: string;
|
|
3930
|
+
/**
|
|
3931
|
+
* A description of the expected parameter.
|
|
3932
|
+
*/
|
|
3933
|
+
description: string;
|
|
3934
|
+
};
|
|
3935
|
+
};
|
|
3936
|
+
};
|
|
3937
|
+
}
|
|
3938
|
+
| {
|
|
3939
|
+
/**
|
|
3940
|
+
* Specifies the type of tool (e.g., 'function').
|
|
3941
|
+
*/
|
|
3942
|
+
type: string;
|
|
3943
|
+
/**
|
|
3944
|
+
* Details of the function tool.
|
|
3945
|
+
*/
|
|
3946
|
+
function: {
|
|
3947
|
+
/**
|
|
3948
|
+
* The name of the function.
|
|
3949
|
+
*/
|
|
3950
|
+
name: string;
|
|
3951
|
+
/**
|
|
3952
|
+
* A brief description of what the function does.
|
|
3953
|
+
*/
|
|
3954
|
+
description: string;
|
|
3955
|
+
/**
|
|
3956
|
+
* Schema defining the parameters accepted by the function.
|
|
3957
|
+
*/
|
|
3958
|
+
parameters: {
|
|
3959
|
+
/**
|
|
3960
|
+
* The type of the parameters object (usually 'object').
|
|
3961
|
+
*/
|
|
3962
|
+
type: string;
|
|
3963
|
+
/**
|
|
3964
|
+
* List of required parameter names.
|
|
3965
|
+
*/
|
|
3966
|
+
required?: string[];
|
|
3967
|
+
/**
|
|
3968
|
+
* Definitions of each parameter.
|
|
3969
|
+
*/
|
|
3970
|
+
properties: {
|
|
3971
|
+
[k: string]: {
|
|
3972
|
+
/**
|
|
3973
|
+
* The data type of the parameter.
|
|
3974
|
+
*/
|
|
3975
|
+
type: string;
|
|
3976
|
+
/**
|
|
3977
|
+
* A description of the expected parameter.
|
|
3978
|
+
*/
|
|
3979
|
+
description: string;
|
|
3980
|
+
};
|
|
3981
|
+
};
|
|
3982
|
+
};
|
|
3983
|
+
};
|
|
3984
|
+
}
|
|
3985
|
+
)[];
|
|
3986
|
+
/**
|
|
3987
|
+
* If true, the response will be streamed back incrementally.
|
|
3988
|
+
*/
|
|
3989
|
+
stream?: boolean;
|
|
3990
|
+
/**
|
|
3991
|
+
* The maximum number of tokens to generate in the response.
|
|
3992
|
+
*/
|
|
3993
|
+
max_tokens?: number;
|
|
3994
|
+
/**
|
|
3995
|
+
* Controls the randomness of the output; higher values produce more random results.
|
|
3996
|
+
*/
|
|
3997
|
+
temperature?: number;
|
|
3998
|
+
/**
|
|
3999
|
+
* Controls the creativity of the AI's responses by adjusting how many possible words it considers. Lower values make outputs more predictable; higher values allow for more varied and creative responses.
|
|
4000
|
+
*/
|
|
4001
|
+
top_p?: number;
|
|
4002
|
+
/**
|
|
4003
|
+
* Limits the AI to choose from the top 'k' most probable words. Lower values make responses more focused; higher values introduce more variety and potential surprises.
|
|
4004
|
+
*/
|
|
4005
|
+
top_k?: number;
|
|
4006
|
+
/**
|
|
4007
|
+
* Random seed for reproducibility of the generation.
|
|
4008
|
+
*/
|
|
4009
|
+
seed?: number;
|
|
4010
|
+
/**
|
|
4011
|
+
* Penalty for repeated tokens; higher values discourage repetition.
|
|
4012
|
+
*/
|
|
4013
|
+
repetition_penalty?: number;
|
|
4014
|
+
/**
|
|
4015
|
+
* Decreases the likelihood of the model repeating the same lines verbatim.
|
|
4016
|
+
*/
|
|
4017
|
+
frequency_penalty?: number;
|
|
4018
|
+
/**
|
|
4019
|
+
* Increases the likelihood of the model introducing new topics.
|
|
4020
|
+
*/
|
|
4021
|
+
presence_penalty?: number;
|
|
4022
|
+
}
|
|
4023
|
+
export type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output =
|
|
4024
|
+
| {
|
|
4025
|
+
/**
|
|
4026
|
+
* The generated text response from the model
|
|
4027
|
+
*/
|
|
4028
|
+
response?: string;
|
|
4029
|
+
/**
|
|
4030
|
+
* An array of tool calls requests made during the response generation
|
|
4031
|
+
*/
|
|
4032
|
+
tool_calls?: {
|
|
4033
|
+
/**
|
|
4034
|
+
* The arguments passed to be passed to the tool call request
|
|
4035
|
+
*/
|
|
4036
|
+
arguments?: object;
|
|
4037
|
+
/**
|
|
4038
|
+
* The name of the tool to be called
|
|
4039
|
+
*/
|
|
4040
|
+
name?: string;
|
|
4041
|
+
}[];
|
|
4042
|
+
}
|
|
4043
|
+
| ReadableStream;
|
|
4044
|
+
export declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {
|
|
4045
|
+
inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;
|
|
4046
|
+
postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;
|
|
4047
|
+
}
|
|
4048
|
+
export interface AiModels {
|
|
4049
|
+
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
4050
|
+
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
4051
|
+
"@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage;
|
|
4052
|
+
"@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage;
|
|
4053
|
+
"@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage;
|
|
4054
|
+
"@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage;
|
|
4055
|
+
"@cf/baai/bge-base-en-v1.5": BaseAiTextEmbeddings;
|
|
4056
|
+
"@cf/baai/bge-small-en-v1.5": BaseAiTextEmbeddings;
|
|
4057
|
+
"@cf/baai/bge-large-en-v1.5": BaseAiTextEmbeddings;
|
|
4058
|
+
"@cf/microsoft/resnet-50": BaseAiImageClassification;
|
|
4059
|
+
"@cf/facebook/detr-resnet-50": BaseAiObjectDetection;
|
|
4060
|
+
"@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration;
|
|
4061
|
+
"@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration;
|
|
4062
|
+
"@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration;
|
|
4063
|
+
"@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration;
|
|
4064
|
+
"@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration;
|
|
4065
|
+
"@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
|
|
4066
|
+
"@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
|
|
4067
|
+
"@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
|
|
4068
|
+
"@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
|
|
4069
|
+
"@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
|
|
4070
|
+
"@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
|
|
4071
|
+
"@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
|
|
4072
|
+
"@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration;
|
|
4073
|
+
"@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration;
|
|
4074
|
+
"@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration;
|
|
4075
|
+
"@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration;
|
|
4076
|
+
"@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration;
|
|
4077
|
+
"@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration;
|
|
4078
|
+
"@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration;
|
|
4079
|
+
"@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration;
|
|
4080
|
+
"@cf/microsoft/phi-2": BaseAiTextGeneration;
|
|
4081
|
+
"@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration;
|
|
4082
|
+
"@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration;
|
|
4083
|
+
"@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration;
|
|
4084
|
+
"@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration;
|
|
4085
|
+
"@hf/google/gemma-7b-it": BaseAiTextGeneration;
|
|
4086
|
+
"@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration;
|
|
4087
|
+
"@cf/google/gemma-2b-it-lora": BaseAiTextGeneration;
|
|
4088
|
+
"@cf/google/gemma-7b-it-lora": BaseAiTextGeneration;
|
|
4089
|
+
"@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration;
|
|
4090
|
+
"@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration;
|
|
4091
|
+
"@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration;
|
|
4092
|
+
"@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration;
|
|
4093
|
+
"@hf/meta-llama/meta-llama-3-8b-instruct": BaseAiTextGeneration;
|
|
4094
|
+
"@cf/meta/llama-3.1-8b-instruct": BaseAiTextGeneration;
|
|
4095
|
+
"@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration;
|
|
4096
|
+
"@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration;
|
|
4097
|
+
"@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration;
|
|
4098
|
+
"@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration;
|
|
4099
|
+
"@cf/meta/llama-3.3-70b-instruct-fp8-fast": BaseAiTextGeneration;
|
|
4100
|
+
"@cf/meta/m2m100-1.2b": BaseAiTranslation;
|
|
4101
|
+
"@cf/facebook/bart-large-cnn": BaseAiSummarization;
|
|
4102
|
+
"@cf/unum/uform-gen2-qwen-500m": BaseAiImageToText;
|
|
4103
|
+
"@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText;
|
|
4104
|
+
"@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper;
|
|
4105
|
+
"@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En;
|
|
4106
|
+
"@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;
|
|
4107
|
+
"@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;
|
|
4108
|
+
"@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;
|
|
4109
|
+
}
|
|
4110
|
+
export type AiOptions = {
|
|
4111
|
+
gateway?: GatewayOptions;
|
|
4112
|
+
prefix?: string;
|
|
4113
|
+
extraHeaders?: object;
|
|
4114
|
+
};
|
|
4115
|
+
export type AiModelsSearchParams = {
|
|
4116
|
+
author?: string;
|
|
4117
|
+
hide_experimental?: boolean;
|
|
4118
|
+
page?: number;
|
|
4119
|
+
per_page?: number;
|
|
4120
|
+
search?: string;
|
|
4121
|
+
source?: number;
|
|
4122
|
+
task?: string;
|
|
4123
|
+
};
|
|
4124
|
+
export type AiModelsSearchObject = {
|
|
4125
|
+
id: string;
|
|
4126
|
+
source: number;
|
|
4127
|
+
name: string;
|
|
4128
|
+
description: string;
|
|
4129
|
+
task: {
|
|
4130
|
+
id: string;
|
|
4131
|
+
name: string;
|
|
4132
|
+
description: string;
|
|
4133
|
+
};
|
|
4134
|
+
tags: string[];
|
|
4135
|
+
properties: {
|
|
4136
|
+
property_id: string;
|
|
4137
|
+
value: string;
|
|
4138
|
+
}[];
|
|
4139
|
+
};
|
|
4140
|
+
export interface InferenceUpstreamError extends Error {}
|
|
4141
|
+
export interface AiInternalError extends Error {}
|
|
4142
|
+
export type AiModelListType = Record<string, any>;
|
|
4143
|
+
export declare abstract class Ai<
|
|
4144
|
+
AiModelList extends AiModelListType = AiModels,
|
|
4145
|
+
> {
|
|
4146
|
+
aiGatewayLogId: string | null;
|
|
4147
|
+
gateway(gatewayId: string): AiGateway;
|
|
4148
|
+
run<Name extends keyof AiModelList>(
|
|
4149
|
+
model: Name,
|
|
4150
|
+
inputs: AiModelList[Name]["inputs"],
|
|
4151
|
+
options?: AiOptions,
|
|
4152
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
4153
|
+
public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
4154
|
+
}
|
|
3471
4155
|
export type GatewayOptions = {
|
|
3472
4156
|
id: string;
|
|
4157
|
+
cacheKey?: string;
|
|
3473
4158
|
cacheTtl?: number;
|
|
3474
4159
|
skipCache?: boolean;
|
|
3475
4160
|
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
4161
|
+
collectLog?: boolean;
|
|
3476
4162
|
};
|
|
3477
|
-
export type
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
4163
|
+
export type AiGatewayPatchLog = {
|
|
4164
|
+
score?: number | null;
|
|
4165
|
+
feedback?: -1 | 1 | null;
|
|
4166
|
+
metadata?: Record<string, number | string | boolean | null | bigint> | null;
|
|
3481
4167
|
};
|
|
3482
|
-
export type
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
| "
|
|
3511
|
-
| "
|
|
3512
|
-
| "
|
|
3513
|
-
| "
|
|
3514
|
-
| "
|
|
3515
|
-
| "
|
|
3516
|
-
| "
|
|
3517
|
-
| "
|
|
3518
|
-
| "
|
|
3519
|
-
| "
|
|
3520
|
-
| "
|
|
3521
|
-
| "
|
|
3522
|
-
| "
|
|
3523
|
-
| "
|
|
3524
|
-
| "
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
): Promise<
|
|
3557
|
-
run(
|
|
3558
|
-
model: BaseAiSpeechRecognitionModels,
|
|
3559
|
-
inputs: BaseAiSpeechRecognition["inputs"],
|
|
3560
|
-
options?: AiOptions,
|
|
3561
|
-
): Promise<BaseAiSpeechRecognition["postProcessedOutputs"]>;
|
|
3562
|
-
run(
|
|
3563
|
-
model: BaseAiImageClassificationModels,
|
|
3564
|
-
inputs: BaseAiImageClassification["inputs"],
|
|
3565
|
-
options?: AiOptions,
|
|
3566
|
-
): Promise<BaseAiImageClassification["postProcessedOutputs"]>;
|
|
3567
|
-
run(
|
|
3568
|
-
model: BaseAiObjectDetectionModels,
|
|
3569
|
-
inputs: BaseAiObjectDetection["inputs"],
|
|
3570
|
-
options?: AiOptions,
|
|
3571
|
-
): Promise<BaseAiObjectDetection["postProcessedOutputs"]>;
|
|
3572
|
-
run(
|
|
3573
|
-
model: BaseAiTextGenerationModels,
|
|
3574
|
-
inputs: BaseAiTextGeneration["inputs"],
|
|
3575
|
-
options?: AiOptions,
|
|
3576
|
-
): Promise<BaseAiTextGeneration["postProcessedOutputs"]>;
|
|
3577
|
-
run(
|
|
3578
|
-
model: BaseAiTranslationModels,
|
|
3579
|
-
inputs: BaseAiTranslation["inputs"],
|
|
3580
|
-
options?: AiOptions,
|
|
3581
|
-
): Promise<BaseAiTranslation["postProcessedOutputs"]>;
|
|
3582
|
-
run(
|
|
3583
|
-
model: BaseAiSummarizationModels,
|
|
3584
|
-
inputs: BaseAiSummarization["inputs"],
|
|
3585
|
-
options?: AiOptions,
|
|
3586
|
-
): Promise<BaseAiSummarization["postProcessedOutputs"]>;
|
|
4168
|
+
export type AiGatewayLog = {
|
|
4169
|
+
id: string;
|
|
4170
|
+
provider: string;
|
|
4171
|
+
model: string;
|
|
4172
|
+
model_type?: string;
|
|
4173
|
+
path: string;
|
|
4174
|
+
duration: number;
|
|
4175
|
+
request_type?: string;
|
|
4176
|
+
request_content_type?: string;
|
|
4177
|
+
status_code: number;
|
|
4178
|
+
response_content_type?: string;
|
|
4179
|
+
success: boolean;
|
|
4180
|
+
cached: boolean;
|
|
4181
|
+
tokens_in?: number;
|
|
4182
|
+
tokens_out?: number;
|
|
4183
|
+
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
4184
|
+
step?: number;
|
|
4185
|
+
cost?: number;
|
|
4186
|
+
custom_cost?: boolean;
|
|
4187
|
+
request_size: number;
|
|
4188
|
+
request_head?: string;
|
|
4189
|
+
request_head_complete: boolean;
|
|
4190
|
+
response_size: number;
|
|
4191
|
+
response_head?: string;
|
|
4192
|
+
response_head_complete: boolean;
|
|
4193
|
+
created_at: Date;
|
|
4194
|
+
};
|
|
4195
|
+
export type AIGatewayProviders =
|
|
4196
|
+
| "workers-ai"
|
|
4197
|
+
| "anthropic"
|
|
4198
|
+
| "aws-bedrock"
|
|
4199
|
+
| "azure-openai"
|
|
4200
|
+
| "google-vertex-ai"
|
|
4201
|
+
| "huggingface"
|
|
4202
|
+
| "openai"
|
|
4203
|
+
| "perplexity-ai"
|
|
4204
|
+
| "replicate"
|
|
4205
|
+
| "groq"
|
|
4206
|
+
| "cohere"
|
|
4207
|
+
| "google-ai-studio"
|
|
4208
|
+
| "mistral"
|
|
4209
|
+
| "grok"
|
|
4210
|
+
| "openrouter";
|
|
4211
|
+
export type AIGatewayHeaders = {
|
|
4212
|
+
"cf-aig-metadata":
|
|
4213
|
+
| Record<string, number | string | boolean | null | bigint>
|
|
4214
|
+
| string;
|
|
4215
|
+
"cf-aig-custom-cost":
|
|
4216
|
+
| {
|
|
4217
|
+
per_token_in?: number;
|
|
4218
|
+
per_token_out?: number;
|
|
4219
|
+
}
|
|
4220
|
+
| {
|
|
4221
|
+
total_cost?: number;
|
|
4222
|
+
}
|
|
4223
|
+
| string;
|
|
4224
|
+
"cf-aig-cache-ttl": number | string;
|
|
4225
|
+
"cf-aig-skip-cache": boolean | string;
|
|
4226
|
+
"cf-aig-cache-key": string;
|
|
4227
|
+
"cf-aig-collect-log": boolean | string;
|
|
4228
|
+
Authorization: string;
|
|
4229
|
+
"Content-Type": string;
|
|
4230
|
+
[key: string]: string | number | boolean | object;
|
|
4231
|
+
};
|
|
4232
|
+
export type AIGatewayUniversalRequest = {
|
|
4233
|
+
provider: AIGatewayProviders | string; // eslint-disable-line
|
|
4234
|
+
endpoint: string;
|
|
4235
|
+
headers: Partial<AIGatewayHeaders>;
|
|
4236
|
+
query: unknown;
|
|
4237
|
+
};
|
|
4238
|
+
export interface AiGatewayInternalError extends Error {}
|
|
4239
|
+
export interface AiGatewayLogNotFound extends Error {}
|
|
4240
|
+
export declare abstract class AiGateway {
|
|
4241
|
+
patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
|
|
4242
|
+
getLog(logId: string): Promise<AiGatewayLog>;
|
|
3587
4243
|
run(
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
options?: AiOptions,
|
|
3591
|
-
): Promise<BaseAiImageToText["postProcessedOutputs"]>;
|
|
4244
|
+
data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
|
|
4245
|
+
): Promise<Response>;
|
|
3592
4246
|
}
|
|
3593
4247
|
export interface BasicImageTransformations {
|
|
3594
4248
|
/**
|
|
@@ -4606,7 +5260,7 @@ export declare abstract class D1PreparedStatement {
|
|
|
4606
5260
|
bind(...values: unknown[]): D1PreparedStatement;
|
|
4607
5261
|
first<T = unknown>(colName: string): Promise<T | null>;
|
|
4608
5262
|
first<T = Record<string, unknown>>(): Promise<T | null>;
|
|
4609
|
-
run(): Promise<
|
|
5263
|
+
run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
|
|
4610
5264
|
all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
|
|
4611
5265
|
raw<T = unknown[]>(options: {
|
|
4612
5266
|
columnNames: true;
|
|
@@ -4662,6 +5316,12 @@ export interface ForwardableEmailMessage extends EmailMessage {
|
|
|
4662
5316
|
* @returns A promise that resolves when the email message is forwarded.
|
|
4663
5317
|
*/
|
|
4664
5318
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
5319
|
+
/**
|
|
5320
|
+
* Reply to the sender of this email message with a new EmailMessage object.
|
|
5321
|
+
* @param message The reply message.
|
|
5322
|
+
* @returns A promise that resolves when the email message is replied.
|
|
5323
|
+
*/
|
|
5324
|
+
reply(message: EmailMessage): Promise<void>;
|
|
4665
5325
|
}
|
|
4666
5326
|
/**
|
|
4667
5327
|
* A binding that allows a Worker to send email messages.
|
|
@@ -4724,6 +5384,128 @@ export interface Hyperdrive {
|
|
|
4724
5384
|
*/
|
|
4725
5385
|
readonly database: string;
|
|
4726
5386
|
}
|
|
5387
|
+
// Copyright (c) 2024 Cloudflare, Inc.
|
|
5388
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5389
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5390
|
+
export type ImageInfoResponse =
|
|
5391
|
+
| {
|
|
5392
|
+
format: "image/svg+xml";
|
|
5393
|
+
}
|
|
5394
|
+
| {
|
|
5395
|
+
format: string;
|
|
5396
|
+
fileSize: number;
|
|
5397
|
+
width: number;
|
|
5398
|
+
height: number;
|
|
5399
|
+
};
|
|
5400
|
+
export type ImageTransform = {
|
|
5401
|
+
fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
|
|
5402
|
+
gravity?:
|
|
5403
|
+
| "left"
|
|
5404
|
+
| "right"
|
|
5405
|
+
| "top"
|
|
5406
|
+
| "bottom"
|
|
5407
|
+
| "center"
|
|
5408
|
+
| "auto"
|
|
5409
|
+
| "entropy"
|
|
5410
|
+
| "face"
|
|
5411
|
+
| {
|
|
5412
|
+
x?: number;
|
|
5413
|
+
y?: number;
|
|
5414
|
+
mode: "remainder" | "box-center";
|
|
5415
|
+
};
|
|
5416
|
+
trim?: {
|
|
5417
|
+
top?: number;
|
|
5418
|
+
bottom?: number;
|
|
5419
|
+
left?: number;
|
|
5420
|
+
right?: number;
|
|
5421
|
+
width?: number;
|
|
5422
|
+
height?: number;
|
|
5423
|
+
border?:
|
|
5424
|
+
| boolean
|
|
5425
|
+
| {
|
|
5426
|
+
color?: string;
|
|
5427
|
+
tolerance?: number;
|
|
5428
|
+
keep?: number;
|
|
5429
|
+
};
|
|
5430
|
+
};
|
|
5431
|
+
width?: number;
|
|
5432
|
+
height?: number;
|
|
5433
|
+
background?: string;
|
|
5434
|
+
rotate?: number;
|
|
5435
|
+
sharpen?: number;
|
|
5436
|
+
blur?: number;
|
|
5437
|
+
contrast?: number;
|
|
5438
|
+
brightness?: number;
|
|
5439
|
+
gamma?: number;
|
|
5440
|
+
border?: {
|
|
5441
|
+
color?: string;
|
|
5442
|
+
width?: number;
|
|
5443
|
+
top?: number;
|
|
5444
|
+
bottom?: number;
|
|
5445
|
+
left?: number;
|
|
5446
|
+
right?: number;
|
|
5447
|
+
};
|
|
5448
|
+
zoom?: number;
|
|
5449
|
+
};
|
|
5450
|
+
export type ImageOutputOptions = {
|
|
5451
|
+
format:
|
|
5452
|
+
| "image/jpeg"
|
|
5453
|
+
| "image/png"
|
|
5454
|
+
| "image/gif"
|
|
5455
|
+
| "image/webp"
|
|
5456
|
+
| "image/avif"
|
|
5457
|
+
| "rgb"
|
|
5458
|
+
| "rgba";
|
|
5459
|
+
quality?: number;
|
|
5460
|
+
background?: string;
|
|
5461
|
+
};
|
|
5462
|
+
export interface ImagesBinding {
|
|
5463
|
+
/**
|
|
5464
|
+
* Get image metadata (type, width and height)
|
|
5465
|
+
* @throws {@link ImagesError} with code 9412 if input is not an image
|
|
5466
|
+
* @param stream The image bytes
|
|
5467
|
+
*/
|
|
5468
|
+
info(stream: ReadableStream<Uint8Array>): Promise<ImageInfoResponse>;
|
|
5469
|
+
/**
|
|
5470
|
+
* Begin applying a series of transformations to an image
|
|
5471
|
+
* @param stream The image bytes
|
|
5472
|
+
* @returns A transform handle
|
|
5473
|
+
*/
|
|
5474
|
+
input(stream: ReadableStream<Uint8Array>): ImageTransformer;
|
|
5475
|
+
}
|
|
5476
|
+
export interface ImageTransformer {
|
|
5477
|
+
/**
|
|
5478
|
+
* Apply transform next, returning a transform handle.
|
|
5479
|
+
* You can then apply more transformations or retrieve the output.
|
|
5480
|
+
* @param transform
|
|
5481
|
+
*/
|
|
5482
|
+
transform(transform: ImageTransform): ImageTransformer;
|
|
5483
|
+
/**
|
|
5484
|
+
* Retrieve the image that results from applying the transforms to the
|
|
5485
|
+
* provided input
|
|
5486
|
+
* @param options Options that apply to the output e.g. output format
|
|
5487
|
+
*/
|
|
5488
|
+
output(options: ImageOutputOptions): Promise<ImageTransformationResult>;
|
|
5489
|
+
}
|
|
5490
|
+
export interface ImageTransformationResult {
|
|
5491
|
+
/**
|
|
5492
|
+
* The image as a response, ready to store in cache or return to users
|
|
5493
|
+
*/
|
|
5494
|
+
response(): Response;
|
|
5495
|
+
/**
|
|
5496
|
+
* The content type of the returned image
|
|
5497
|
+
*/
|
|
5498
|
+
contentType(): string;
|
|
5499
|
+
/**
|
|
5500
|
+
* The bytes of the response
|
|
5501
|
+
*/
|
|
5502
|
+
image(): ReadableStream<Uint8Array>;
|
|
5503
|
+
}
|
|
5504
|
+
export interface ImagesError extends Error {
|
|
5505
|
+
readonly code: number;
|
|
5506
|
+
readonly message: string;
|
|
5507
|
+
readonly stack?: string;
|
|
5508
|
+
}
|
|
4727
5509
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
4728
5510
|
export type EventContext<Env, P extends string, Data> = {
|
|
4729
5511
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -4767,6 +5549,30 @@ export type PagesPluginFunction<
|
|
|
4767
5549
|
> = (
|
|
4768
5550
|
context: EventPluginContext<Env, Params, Data, PluginArgs>,
|
|
4769
5551
|
) => Response | Promise<Response>;
|
|
5552
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5553
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5554
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5555
|
+
export declare abstract class PipelineTransform {
|
|
5556
|
+
/**
|
|
5557
|
+
* transformJson recieves an array of javascript objects which can be
|
|
5558
|
+
* mutated and returned to the pipeline
|
|
5559
|
+
* @param data The data to be mutated
|
|
5560
|
+
* @returns A promise containing the mutated data
|
|
5561
|
+
*/
|
|
5562
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
5563
|
+
}
|
|
5564
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5565
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5566
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5567
|
+
export interface Pipeline {
|
|
5568
|
+
/**
|
|
5569
|
+
* send takes an array of javascript objects which are
|
|
5570
|
+
* then received by the pipeline for processing
|
|
5571
|
+
*
|
|
5572
|
+
* @param data The data to be sent
|
|
5573
|
+
*/
|
|
5574
|
+
send(data: object[]): Promise<void>;
|
|
5575
|
+
}
|
|
4770
5576
|
// PubSubMessage represents an incoming PubSub message.
|
|
4771
5577
|
// The message includes metadata about the broker, the client, and the payload
|
|
4772
5578
|
// itself.
|
|
@@ -4827,6 +5633,7 @@ export declare namespace Rpc {
|
|
|
4827
5633
|
export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
|
|
4828
5634
|
export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
|
|
4829
5635
|
export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
|
|
5636
|
+
export const __WORKFLOW_ENTRYPOINT_BRAND: "__WORKFLOW_ENTRYPOINT_BRAND";
|
|
4830
5637
|
export interface RpcTargetBranded {
|
|
4831
5638
|
[__RPC_TARGET_BRAND]: never;
|
|
4832
5639
|
}
|
|
@@ -4836,13 +5643,20 @@ export declare namespace Rpc {
|
|
|
4836
5643
|
export interface DurableObjectBranded {
|
|
4837
5644
|
[__DURABLE_OBJECT_BRAND]: never;
|
|
4838
5645
|
}
|
|
5646
|
+
export interface WorkflowEntrypointBranded {
|
|
5647
|
+
[__WORKFLOW_ENTRYPOINT_BRAND]: never;
|
|
5648
|
+
}
|
|
4839
5649
|
export type EntrypointBranded =
|
|
4840
5650
|
| WorkerEntrypointBranded
|
|
4841
|
-
| DurableObjectBranded
|
|
5651
|
+
| DurableObjectBranded
|
|
5652
|
+
| WorkflowEntrypointBranded;
|
|
4842
5653
|
// Types that can be used through `Stub`s
|
|
4843
5654
|
export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
|
|
4844
5655
|
// Types that can be passed over RPC
|
|
4845
|
-
type
|
|
5656
|
+
// The reason for using a generic type here is to build a serializable subset of structured
|
|
5657
|
+
// cloneable composite types. This allows types defined with the "interface" keyword to pass the
|
|
5658
|
+
// serializable check as well. Otherwise, only types defined with the "type" keyword would pass.
|
|
5659
|
+
type Serializable<T> =
|
|
4846
5660
|
// Structured cloneables
|
|
4847
5661
|
| void
|
|
4848
5662
|
| undefined
|
|
@@ -4858,11 +5672,14 @@ export declare namespace Rpc {
|
|
|
4858
5672
|
| Error
|
|
4859
5673
|
| RegExp
|
|
4860
5674
|
// Structured cloneable composites
|
|
4861
|
-
| Map<
|
|
4862
|
-
|
|
4863
|
-
|
|
5675
|
+
| Map<
|
|
5676
|
+
T extends Map<infer U, unknown> ? Serializable<U> : never,
|
|
5677
|
+
T extends Map<unknown, infer U> ? Serializable<U> : never
|
|
5678
|
+
>
|
|
5679
|
+
| Set<T extends Set<infer U> ? Serializable<U> : never>
|
|
5680
|
+
| ReadonlyArray<T extends ReadonlyArray<infer U> ? Serializable<U> : never>
|
|
4864
5681
|
| {
|
|
4865
|
-
[
|
|
5682
|
+
[K in keyof T]: K extends number | string ? Serializable<T[K]> : never;
|
|
4866
5683
|
}
|
|
4867
5684
|
// Special types
|
|
4868
5685
|
| ReadableStream<Uint8Array>
|
|
@@ -4892,7 +5709,7 @@ export declare namespace Rpc {
|
|
|
4892
5709
|
: T extends ReadonlyArray<infer V>
|
|
4893
5710
|
? ReadonlyArray<Stubify<V>>
|
|
4894
5711
|
: T extends {
|
|
4895
|
-
[key: string | number]:
|
|
5712
|
+
[key: string | number]: any;
|
|
4896
5713
|
}
|
|
4897
5714
|
? {
|
|
4898
5715
|
[K in keyof T]: Stubify<T[K]>;
|
|
@@ -4935,7 +5752,7 @@ export declare namespace Rpc {
|
|
|
4935
5752
|
// Intersecting with `(Maybe)Provider` allows pipelining.
|
|
4936
5753
|
type Result<R> = R extends Stubable
|
|
4937
5754
|
? Promise<Stub<R>> & Provider<R>
|
|
4938
|
-
: R extends Serializable
|
|
5755
|
+
: R extends Serializable<R>
|
|
4939
5756
|
? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R>
|
|
4940
5757
|
: never;
|
|
4941
5758
|
// Type for method or property on an RPC interface.
|
|
@@ -4964,6 +5781,198 @@ export declare namespace Rpc {
|
|
|
4964
5781
|
>]: MethodOrProperty<T[K]>;
|
|
4965
5782
|
};
|
|
4966
5783
|
}
|
|
5784
|
+
export declare namespace TailStream {
|
|
5785
|
+
interface Header {
|
|
5786
|
+
readonly name: string;
|
|
5787
|
+
readonly value: string;
|
|
5788
|
+
}
|
|
5789
|
+
interface FetchEventInfo {
|
|
5790
|
+
readonly type: "fetch";
|
|
5791
|
+
readonly method: string;
|
|
5792
|
+
readonly url: string;
|
|
5793
|
+
readonly cfJson: string;
|
|
5794
|
+
readonly headers: Header[];
|
|
5795
|
+
}
|
|
5796
|
+
interface JsRpcEventInfo {
|
|
5797
|
+
readonly type: "jsrpc";
|
|
5798
|
+
readonly methodName: string;
|
|
5799
|
+
}
|
|
5800
|
+
interface ScheduledEventInfo {
|
|
5801
|
+
readonly type: "scheduled";
|
|
5802
|
+
readonly scheduledTime: Date;
|
|
5803
|
+
readonly cron: string;
|
|
5804
|
+
}
|
|
5805
|
+
interface AlarmEventInfo {
|
|
5806
|
+
readonly type: "alarm";
|
|
5807
|
+
readonly scheduledTime: Date;
|
|
5808
|
+
}
|
|
5809
|
+
interface QueueEventInfo {
|
|
5810
|
+
readonly type: "queue";
|
|
5811
|
+
readonly queueName: string;
|
|
5812
|
+
readonly batchSize: number;
|
|
5813
|
+
}
|
|
5814
|
+
interface EmailEventInfo {
|
|
5815
|
+
readonly type: "email";
|
|
5816
|
+
readonly mailFrom: string;
|
|
5817
|
+
readonly rcptTo: string;
|
|
5818
|
+
readonly rawSize: number;
|
|
5819
|
+
}
|
|
5820
|
+
interface TraceEventInfo {
|
|
5821
|
+
readonly type: "trace";
|
|
5822
|
+
readonly traces: (string | null)[];
|
|
5823
|
+
}
|
|
5824
|
+
interface HibernatableWebSocketEventInfoMessage {
|
|
5825
|
+
readonly type: "message";
|
|
5826
|
+
}
|
|
5827
|
+
interface HibernatableWebSocketEventInfoError {
|
|
5828
|
+
readonly type: "error";
|
|
5829
|
+
}
|
|
5830
|
+
interface HibernatableWebSocketEventInfoClose {
|
|
5831
|
+
readonly type: "close";
|
|
5832
|
+
readonly code: number;
|
|
5833
|
+
readonly wasClean: boolean;
|
|
5834
|
+
}
|
|
5835
|
+
interface HibernatableWebSocketEventInfo {
|
|
5836
|
+
readonly type: "hibernatableWebSocket";
|
|
5837
|
+
readonly info:
|
|
5838
|
+
| HibernatableWebSocketEventInfoClose
|
|
5839
|
+
| HibernatableWebSocketEventInfoError
|
|
5840
|
+
| HibernatableWebSocketEventInfoMessage;
|
|
5841
|
+
}
|
|
5842
|
+
interface Resume {
|
|
5843
|
+
readonly type: "resume";
|
|
5844
|
+
readonly attachment?: any;
|
|
5845
|
+
}
|
|
5846
|
+
interface CustomEventInfo {
|
|
5847
|
+
readonly type: "custom";
|
|
5848
|
+
}
|
|
5849
|
+
interface FetchResponseInfo {
|
|
5850
|
+
readonly type: "fetch";
|
|
5851
|
+
readonly statusCode: number;
|
|
5852
|
+
}
|
|
5853
|
+
type EventOutcome =
|
|
5854
|
+
| "ok"
|
|
5855
|
+
| "canceled"
|
|
5856
|
+
| "exception"
|
|
5857
|
+
| "unknown"
|
|
5858
|
+
| "killSwitch"
|
|
5859
|
+
| "daemonDown"
|
|
5860
|
+
| "exceededCpu"
|
|
5861
|
+
| "exceededMemory"
|
|
5862
|
+
| "loadShed"
|
|
5863
|
+
| "responseStreamDisconnected"
|
|
5864
|
+
| "scriptNotFound";
|
|
5865
|
+
interface ScriptVersion {
|
|
5866
|
+
readonly id: string;
|
|
5867
|
+
readonly tag?: string;
|
|
5868
|
+
readonly message?: string;
|
|
5869
|
+
}
|
|
5870
|
+
interface Trigger {
|
|
5871
|
+
readonly traceId: string;
|
|
5872
|
+
readonly invocationId: string;
|
|
5873
|
+
readonly spanId: string;
|
|
5874
|
+
}
|
|
5875
|
+
interface Onset {
|
|
5876
|
+
readonly type: "onset";
|
|
5877
|
+
readonly dispatchNamespace?: string;
|
|
5878
|
+
readonly entrypoint?: string;
|
|
5879
|
+
readonly scriptName?: string;
|
|
5880
|
+
readonly scriptTags?: string[];
|
|
5881
|
+
readonly scriptVersion?: ScriptVersion;
|
|
5882
|
+
readonly trigger?: Trigger;
|
|
5883
|
+
readonly info:
|
|
5884
|
+
| FetchEventInfo
|
|
5885
|
+
| JsRpcEventInfo
|
|
5886
|
+
| ScheduledEventInfo
|
|
5887
|
+
| AlarmEventInfo
|
|
5888
|
+
| QueueEventInfo
|
|
5889
|
+
| EmailEventInfo
|
|
5890
|
+
| TraceEventInfo
|
|
5891
|
+
| HibernatableWebSocketEventInfo
|
|
5892
|
+
| Resume
|
|
5893
|
+
| CustomEventInfo;
|
|
5894
|
+
}
|
|
5895
|
+
interface Outcome {
|
|
5896
|
+
readonly type: "outcome";
|
|
5897
|
+
readonly outcome: EventOutcome;
|
|
5898
|
+
readonly cpuTime: number;
|
|
5899
|
+
readonly wallTime: number;
|
|
5900
|
+
}
|
|
5901
|
+
interface Hibernate {
|
|
5902
|
+
readonly type: "hibernate";
|
|
5903
|
+
}
|
|
5904
|
+
interface SpanOpen {
|
|
5905
|
+
readonly type: "spanOpen";
|
|
5906
|
+
readonly op?: string;
|
|
5907
|
+
readonly info?: FetchEventInfo | JsRpcEventInfo | Attribute[];
|
|
5908
|
+
}
|
|
5909
|
+
interface SpanClose {
|
|
5910
|
+
readonly type: "spanClose";
|
|
5911
|
+
readonly outcome: EventOutcome;
|
|
5912
|
+
}
|
|
5913
|
+
interface DiagnosticChannelEvent {
|
|
5914
|
+
readonly type: "diagnosticChannel";
|
|
5915
|
+
readonly channel: string;
|
|
5916
|
+
readonly message: any;
|
|
5917
|
+
}
|
|
5918
|
+
interface Exception {
|
|
5919
|
+
readonly type: "exception";
|
|
5920
|
+
readonly name: string;
|
|
5921
|
+
readonly message: string;
|
|
5922
|
+
readonly stack?: string;
|
|
5923
|
+
}
|
|
5924
|
+
interface Log {
|
|
5925
|
+
readonly type: "log";
|
|
5926
|
+
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
5927
|
+
readonly message: string;
|
|
5928
|
+
}
|
|
5929
|
+
interface Return {
|
|
5930
|
+
readonly type: "return";
|
|
5931
|
+
readonly info?: FetchResponseInfo | Attribute[];
|
|
5932
|
+
}
|
|
5933
|
+
interface Link {
|
|
5934
|
+
readonly type: "link";
|
|
5935
|
+
readonly label?: string;
|
|
5936
|
+
readonly traceId: string;
|
|
5937
|
+
readonly invocationId: string;
|
|
5938
|
+
readonly spanId: string;
|
|
5939
|
+
}
|
|
5940
|
+
interface Attribute {
|
|
5941
|
+
readonly type: "attribute";
|
|
5942
|
+
readonly name: string;
|
|
5943
|
+
readonly value: string | string[] | boolean | boolean[] | number | number[];
|
|
5944
|
+
}
|
|
5945
|
+
type Mark =
|
|
5946
|
+
| DiagnosticChannelEvent
|
|
5947
|
+
| Exception
|
|
5948
|
+
| Log
|
|
5949
|
+
| Return
|
|
5950
|
+
| Link
|
|
5951
|
+
| Attribute[];
|
|
5952
|
+
interface TailEvent {
|
|
5953
|
+
readonly traceId: string;
|
|
5954
|
+
readonly invocationId: string;
|
|
5955
|
+
readonly spanId: string;
|
|
5956
|
+
readonly timestamp: Date;
|
|
5957
|
+
readonly sequence: number;
|
|
5958
|
+
readonly event: Onset | Outcome | Hibernate | SpanOpen | SpanClose | Mark;
|
|
5959
|
+
}
|
|
5960
|
+
type TailEventHandler = (event: TailEvent) => void | Promise<void>;
|
|
5961
|
+
type TailEventHandlerName =
|
|
5962
|
+
| "onset"
|
|
5963
|
+
| "outcome"
|
|
5964
|
+
| "hibernate"
|
|
5965
|
+
| "spanOpen"
|
|
5966
|
+
| "spanClose"
|
|
5967
|
+
| "diagnosticChannel"
|
|
5968
|
+
| "exception"
|
|
5969
|
+
| "log"
|
|
5970
|
+
| "return"
|
|
5971
|
+
| "link"
|
|
5972
|
+
| "attribute";
|
|
5973
|
+
type TailEventHandlerObject = Record<TailEventHandlerName, TailEventHandler>;
|
|
5974
|
+
type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;
|
|
5975
|
+
}
|
|
4967
5976
|
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
4968
5977
|
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4969
5978
|
// https://opensource.org/licenses/Apache-2.0
|
|
@@ -5007,11 +6016,21 @@ export type VectorizeVectorMetadataFilter = {
|
|
|
5007
6016
|
* Distance metrics determine how other "similar" vectors are determined.
|
|
5008
6017
|
*/
|
|
5009
6018
|
export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
|
|
6019
|
+
/**
|
|
6020
|
+
* Metadata return levels for a Vectorize query.
|
|
6021
|
+
*
|
|
6022
|
+
* Default to "none".
|
|
6023
|
+
*
|
|
6024
|
+
* @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.
|
|
6025
|
+
* @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).
|
|
6026
|
+
* @property none No indexed metadata will be returned.
|
|
6027
|
+
*/
|
|
6028
|
+
export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
|
|
5010
6029
|
export interface VectorizeQueryOptions {
|
|
5011
6030
|
topK?: number;
|
|
5012
6031
|
namespace?: string;
|
|
5013
6032
|
returnValues?: boolean;
|
|
5014
|
-
returnMetadata?: boolean;
|
|
6033
|
+
returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
|
|
5015
6034
|
filter?: VectorizeVectorMetadataFilter;
|
|
5016
6035
|
}
|
|
5017
6036
|
/**
|
|
@@ -5027,6 +6046,9 @@ export type VectorizeIndexConfig =
|
|
|
5027
6046
|
};
|
|
5028
6047
|
/**
|
|
5029
6048
|
* Metadata about an existing index.
|
|
6049
|
+
*
|
|
6050
|
+
* This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
|
|
6051
|
+
* See {@link VectorizeIndexInfo} for its post-beta equivalent.
|
|
5030
6052
|
*/
|
|
5031
6053
|
export interface VectorizeIndexDetails {
|
|
5032
6054
|
/** The unique ID of the index */
|
|
@@ -5040,6 +6062,19 @@ export interface VectorizeIndexDetails {
|
|
|
5040
6062
|
/** The number of records containing vectors within the index. */
|
|
5041
6063
|
vectorsCount: number;
|
|
5042
6064
|
}
|
|
6065
|
+
/**
|
|
6066
|
+
* Metadata about an existing index.
|
|
6067
|
+
*/
|
|
6068
|
+
export interface VectorizeIndexInfo {
|
|
6069
|
+
/** The number of records containing vectors within the index. */
|
|
6070
|
+
vectorCount: number;
|
|
6071
|
+
/** Number of dimensions the index has been configured for. */
|
|
6072
|
+
dimensions: number;
|
|
6073
|
+
/** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
|
|
6074
|
+
processedUpToDatetime: number;
|
|
6075
|
+
/** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
|
|
6076
|
+
processedUpToMutation: number;
|
|
6077
|
+
}
|
|
5043
6078
|
/**
|
|
5044
6079
|
* Represents a single vector value set along with its associated metadata.
|
|
5045
6080
|
*/
|
|
@@ -5050,7 +6085,7 @@ export interface VectorizeVector {
|
|
|
5050
6085
|
values: VectorFloatArray | number[];
|
|
5051
6086
|
/** The namespace this vector belongs to. */
|
|
5052
6087
|
namespace?: string;
|
|
5053
|
-
/** Metadata associated with the vector. Includes the values of
|
|
6088
|
+
/** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
|
|
5054
6089
|
metadata?: Record<string, VectorizeVectorMetadata>;
|
|
5055
6090
|
}
|
|
5056
6091
|
/**
|
|
@@ -5062,7 +6097,7 @@ export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
|
|
|
5062
6097
|
score: number;
|
|
5063
6098
|
};
|
|
5064
6099
|
/**
|
|
5065
|
-
* A set of
|
|
6100
|
+
* A set of matching {@link VectorizeMatch} for a particular query.
|
|
5066
6101
|
*/
|
|
5067
6102
|
export interface VectorizeMatches {
|
|
5068
6103
|
matches: VectorizeMatch[];
|
|
@@ -5071,6 +6106,9 @@ export interface VectorizeMatches {
|
|
|
5071
6106
|
/**
|
|
5072
6107
|
* Results of an operation that performed a mutation on a set of vectors.
|
|
5073
6108
|
* Here, `ids` is a list of vectors that were successfully processed.
|
|
6109
|
+
*
|
|
6110
|
+
* This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
|
|
6111
|
+
* See {@link VectorizeAsyncMutation} for its post-beta equivalent.
|
|
5074
6112
|
*/
|
|
5075
6113
|
export interface VectorizeVectorMutation {
|
|
5076
6114
|
/* List of ids of vectors that were successfully processed. */
|
|
@@ -5079,14 +6117,19 @@ export interface VectorizeVectorMutation {
|
|
|
5079
6117
|
count: number;
|
|
5080
6118
|
}
|
|
5081
6119
|
/**
|
|
5082
|
-
*
|
|
5083
|
-
*
|
|
5084
|
-
* Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
|
|
6120
|
+
* Result type indicating a mutation on the Vectorize Index.
|
|
6121
|
+
* Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
|
|
5085
6122
|
*/
|
|
5086
|
-
export interface
|
|
5087
|
-
|
|
6123
|
+
export interface VectorizeAsyncMutation {
|
|
6124
|
+
/** The unique identifier for the async mutation operation containing the changeset. */
|
|
5088
6125
|
mutationId: string;
|
|
5089
6126
|
}
|
|
6127
|
+
/**
|
|
6128
|
+
* A Vectorize Vector Search Index for querying vectors/embeddings.
|
|
6129
|
+
*
|
|
6130
|
+
* This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
|
|
6131
|
+
* See {@link Vectorize} for its new implementation.
|
|
6132
|
+
*/
|
|
5090
6133
|
export declare abstract class VectorizeIndex {
|
|
5091
6134
|
/**
|
|
5092
6135
|
* Get information about the currently bound index.
|
|
@@ -5101,7 +6144,7 @@ export declare abstract class VectorizeIndex {
|
|
|
5101
6144
|
*/
|
|
5102
6145
|
public query(
|
|
5103
6146
|
vector: VectorFloatArray | number[],
|
|
5104
|
-
options
|
|
6147
|
+
options?: VectorizeQueryOptions,
|
|
5105
6148
|
): Promise<VectorizeMatches>;
|
|
5106
6149
|
/**
|
|
5107
6150
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
@@ -5128,6 +6171,62 @@ export declare abstract class VectorizeIndex {
|
|
|
5128
6171
|
*/
|
|
5129
6172
|
public getByIds(ids: string[]): Promise<VectorizeVector[]>;
|
|
5130
6173
|
}
|
|
6174
|
+
/**
|
|
6175
|
+
* A Vectorize Vector Search Index for querying vectors/embeddings.
|
|
6176
|
+
*
|
|
6177
|
+
* Mutations in this version are async, returning a mutation id.
|
|
6178
|
+
*/
|
|
6179
|
+
export declare abstract class Vectorize {
|
|
6180
|
+
/**
|
|
6181
|
+
* Get information about the currently bound index.
|
|
6182
|
+
* @returns A promise that resolves with information about the current index.
|
|
6183
|
+
*/
|
|
6184
|
+
public describe(): Promise<VectorizeIndexInfo>;
|
|
6185
|
+
/**
|
|
6186
|
+
* Use the provided vector to perform a similarity search across the index.
|
|
6187
|
+
* @param vector Input vector that will be used to drive the similarity search.
|
|
6188
|
+
* @param options Configuration options to massage the returned data.
|
|
6189
|
+
* @returns A promise that resolves with matched and scored vectors.
|
|
6190
|
+
*/
|
|
6191
|
+
public query(
|
|
6192
|
+
vector: VectorFloatArray | number[],
|
|
6193
|
+
options?: VectorizeQueryOptions,
|
|
6194
|
+
): Promise<VectorizeMatches>;
|
|
6195
|
+
/**
|
|
6196
|
+
* Use the provided vector-id to perform a similarity search across the index.
|
|
6197
|
+
* @param vectorId Id for a vector in the index against which the index should be queried.
|
|
6198
|
+
* @param options Configuration options to massage the returned data.
|
|
6199
|
+
* @returns A promise that resolves with matched and scored vectors.
|
|
6200
|
+
*/
|
|
6201
|
+
public queryById(
|
|
6202
|
+
vectorId: string,
|
|
6203
|
+
options?: VectorizeQueryOptions,
|
|
6204
|
+
): Promise<VectorizeMatches>;
|
|
6205
|
+
/**
|
|
6206
|
+
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
6207
|
+
* @param vectors List of vectors that will be inserted.
|
|
6208
|
+
* @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
|
|
6209
|
+
*/
|
|
6210
|
+
public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
|
|
6211
|
+
/**
|
|
6212
|
+
* Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
|
|
6213
|
+
* @param vectors List of vectors that will be upserted.
|
|
6214
|
+
* @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
|
|
6215
|
+
*/
|
|
6216
|
+
public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
|
|
6217
|
+
/**
|
|
6218
|
+
* Delete a list of vectors with a matching id.
|
|
6219
|
+
* @param ids List of vector ids that should be deleted.
|
|
6220
|
+
* @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
|
|
6221
|
+
*/
|
|
6222
|
+
public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
|
|
6223
|
+
/**
|
|
6224
|
+
* Get a list of vectors with a matching id.
|
|
6225
|
+
* @param ids List of vector ids that should be returned.
|
|
6226
|
+
* @returns A promise that resolves with the raw unscored vectors matching the id set.
|
|
6227
|
+
*/
|
|
6228
|
+
public getByIds(ids: string[]): Promise<VectorizeVector[]>;
|
|
6229
|
+
}
|
|
5131
6230
|
/**
|
|
5132
6231
|
* The interface for "version_metadata" binding
|
|
5133
6232
|
* providing metadata about the Worker Version using this binding.
|
|
@@ -5178,3 +6277,70 @@ export interface DispatchNamespace {
|
|
|
5178
6277
|
options?: DynamicDispatchOptions,
|
|
5179
6278
|
): Fetcher;
|
|
5180
6279
|
}
|
|
6280
|
+
export declare abstract class Workflow<PARAMS = unknown> {
|
|
6281
|
+
/**
|
|
6282
|
+
* Get a handle to an existing instance of the Workflow.
|
|
6283
|
+
* @param id Id for the instance of this Workflow
|
|
6284
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
6285
|
+
*/
|
|
6286
|
+
public get(id: string): Promise<WorkflowInstance>;
|
|
6287
|
+
/**
|
|
6288
|
+
* Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.
|
|
6289
|
+
* @param options Options when creating an instance including id and params
|
|
6290
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
6291
|
+
*/
|
|
6292
|
+
public create(
|
|
6293
|
+
options?: WorkflowInstanceCreateOptions<PARAMS>,
|
|
6294
|
+
): Promise<WorkflowInstance>;
|
|
6295
|
+
}
|
|
6296
|
+
export interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
|
|
6297
|
+
/**
|
|
6298
|
+
* An id for your Workflow instance. Must be unique within the Workflow.
|
|
6299
|
+
*/
|
|
6300
|
+
id?: string;
|
|
6301
|
+
/**
|
|
6302
|
+
* The event payload the Workflow instance is triggered with
|
|
6303
|
+
*/
|
|
6304
|
+
params?: PARAMS;
|
|
6305
|
+
}
|
|
6306
|
+
export type InstanceStatus = {
|
|
6307
|
+
status:
|
|
6308
|
+
| "queued" // means that instance is waiting to be started (see concurrency limits)
|
|
6309
|
+
| "running"
|
|
6310
|
+
| "paused"
|
|
6311
|
+
| "errored"
|
|
6312
|
+
| "terminated" // user terminated the instance while it was running
|
|
6313
|
+
| "complete"
|
|
6314
|
+
| "waiting" // instance is hibernating and waiting for sleep or event to finish
|
|
6315
|
+
| "waitingForPause" // instance is finishing the current work to pause
|
|
6316
|
+
| "unknown";
|
|
6317
|
+
error?: string;
|
|
6318
|
+
output?: object;
|
|
6319
|
+
};
|
|
6320
|
+
export interface WorkflowError {
|
|
6321
|
+
code?: number;
|
|
6322
|
+
message: string;
|
|
6323
|
+
}
|
|
6324
|
+
export declare abstract class WorkflowInstance {
|
|
6325
|
+
public id: string;
|
|
6326
|
+
/**
|
|
6327
|
+
* Pause the instance.
|
|
6328
|
+
*/
|
|
6329
|
+
public pause(): Promise<void>;
|
|
6330
|
+
/**
|
|
6331
|
+
* Resume the instance. If it is already running, an error will be thrown.
|
|
6332
|
+
*/
|
|
6333
|
+
public resume(): Promise<void>;
|
|
6334
|
+
/**
|
|
6335
|
+
* Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
|
|
6336
|
+
*/
|
|
6337
|
+
public terminate(): Promise<void>;
|
|
6338
|
+
/**
|
|
6339
|
+
* Restart the instance.
|
|
6340
|
+
*/
|
|
6341
|
+
public restart(): Promise<void>;
|
|
6342
|
+
/**
|
|
6343
|
+
* Returns the current status of the instance.
|
|
6344
|
+
*/
|
|
6345
|
+
public status(): Promise<InstanceStatus>;
|
|
6346
|
+
}
|