@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/2023-07-01/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;
|
|
@@ -366,7 +368,7 @@ export declare function structuredClone<T>(
|
|
|
366
368
|
export declare function reportError(error: any): void;
|
|
367
369
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
|
|
368
370
|
export declare function fetch(
|
|
369
|
-
input: RequestInfo,
|
|
371
|
+
input: RequestInfo | URL,
|
|
370
372
|
init?: RequestInit<RequestInitCfProperties>,
|
|
371
373
|
): Promise<Response>;
|
|
372
374
|
export declare const self: ServiceWorkerGlobalScope;
|
|
@@ -393,12 +395,14 @@ export declare const scheduler: Scheduler;
|
|
|
393
395
|
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
394
396
|
*/
|
|
395
397
|
export declare const performance: Performance;
|
|
398
|
+
export declare const Cloudflare: Cloudflare;
|
|
396
399
|
export declare const origin: string;
|
|
397
400
|
export declare const navigator: Navigator;
|
|
398
401
|
export interface TestController {}
|
|
399
402
|
export interface ExecutionContext {
|
|
400
403
|
waitUntil(promise: Promise<any>): void;
|
|
401
404
|
passThroughOnException(): void;
|
|
405
|
+
props: any;
|
|
402
406
|
}
|
|
403
407
|
export type ExportedHandlerFetchHandler<
|
|
404
408
|
Env = unknown,
|
|
@@ -418,6 +422,11 @@ export type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
|
418
422
|
env: Env,
|
|
419
423
|
ctx: ExecutionContext,
|
|
420
424
|
) => void | Promise<void>;
|
|
425
|
+
export type ExportedHandlerTailStreamHandler<Env = unknown> = (
|
|
426
|
+
event: TailStream.TailEvent,
|
|
427
|
+
env: Env,
|
|
428
|
+
ctx: ExecutionContext,
|
|
429
|
+
) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
|
|
421
430
|
export type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
422
431
|
controller: ScheduledController,
|
|
423
432
|
env: Env,
|
|
@@ -441,6 +450,7 @@ export interface ExportedHandler<
|
|
|
441
450
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
442
451
|
tail?: ExportedHandlerTailHandler<Env>;
|
|
443
452
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
453
|
+
tailStream?: ExportedHandlerTailStreamHandler<Env>;
|
|
444
454
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
445
455
|
test?: ExportedHandlerTestHandler<Env>;
|
|
446
456
|
email?: EmailExportedHandler<Env>;
|
|
@@ -464,8 +474,9 @@ export declare abstract class Navigator {
|
|
|
464
474
|
| string
|
|
465
475
|
| (ArrayBuffer | ArrayBufferView)
|
|
466
476
|
| Blob
|
|
477
|
+
| FormData
|
|
467
478
|
| URLSearchParams
|
|
468
|
-
|
|
|
479
|
+
| URLSearchParams,
|
|
469
480
|
): boolean;
|
|
470
481
|
readonly userAgent: string;
|
|
471
482
|
readonly gpu: GPU;
|
|
@@ -486,9 +497,12 @@ export interface AlarmInvocationInfo {
|
|
|
486
497
|
readonly isRetry: boolean;
|
|
487
498
|
readonly retryCount: number;
|
|
488
499
|
}
|
|
500
|
+
export interface Cloudflare {
|
|
501
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
502
|
+
}
|
|
489
503
|
export interface DurableObject {
|
|
490
504
|
fetch(request: Request): Response | Promise<Response>;
|
|
491
|
-
alarm?(): void | Promise<void>;
|
|
505
|
+
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
|
|
492
506
|
webSocketMessage?(
|
|
493
507
|
ws: WebSocket,
|
|
494
508
|
message: string | ArrayBuffer,
|
|
@@ -561,6 +575,7 @@ export interface DurableObjectState {
|
|
|
561
575
|
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
|
|
562
576
|
getHibernatableWebSocketEventTimeout(): number | null;
|
|
563
577
|
getTags(ws: WebSocket): string[];
|
|
578
|
+
abort(reason?: string): void;
|
|
564
579
|
}
|
|
565
580
|
export interface DurableObjectTransaction {
|
|
566
581
|
get<T = unknown>(
|
|
@@ -627,7 +642,11 @@ export interface DurableObjectStorage {
|
|
|
627
642
|
): Promise<void>;
|
|
628
643
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
629
644
|
sync(): Promise<void>;
|
|
645
|
+
sql: SqlStorage;
|
|
630
646
|
transactionSync<T>(closure: () => T): T;
|
|
647
|
+
getCurrentBookmark(): Promise<string>;
|
|
648
|
+
getBookmarkForTime(timestamp: number | Date): Promise<string>;
|
|
649
|
+
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
|
|
631
650
|
}
|
|
632
651
|
export interface DurableObjectListOptions {
|
|
633
652
|
start?: string;
|
|
@@ -998,14 +1017,17 @@ export declare abstract class CacheStorage {
|
|
|
998
1017
|
*/
|
|
999
1018
|
export declare abstract class Cache {
|
|
1000
1019
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
|
|
1001
|
-
delete(
|
|
1020
|
+
delete(
|
|
1021
|
+
request: RequestInfo | URL,
|
|
1022
|
+
options?: CacheQueryOptions,
|
|
1023
|
+
): Promise<boolean>;
|
|
1002
1024
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
|
|
1003
1025
|
match(
|
|
1004
|
-
request: RequestInfo,
|
|
1026
|
+
request: RequestInfo | URL,
|
|
1005
1027
|
options?: CacheQueryOptions,
|
|
1006
1028
|
): Promise<Response | undefined>;
|
|
1007
1029
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
|
|
1008
|
-
put(request: RequestInfo, response: Response): Promise<void>;
|
|
1030
|
+
put(request: RequestInfo | URL, response: Response): Promise<void>;
|
|
1009
1031
|
}
|
|
1010
1032
|
export interface CacheQueryOptions {
|
|
1011
1033
|
ignoreMethod?: boolean;
|
|
@@ -1428,20 +1450,44 @@ export interface Element {
|
|
|
1428
1450
|
hasAttribute(name: string): boolean;
|
|
1429
1451
|
setAttribute(name: string, value: string): Element;
|
|
1430
1452
|
removeAttribute(name: string): Element;
|
|
1431
|
-
before(
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1453
|
+
before(
|
|
1454
|
+
content: string | ReadableStream | Response,
|
|
1455
|
+
options?: ContentOptions,
|
|
1456
|
+
): Element;
|
|
1457
|
+
after(
|
|
1458
|
+
content: string | ReadableStream | Response,
|
|
1459
|
+
options?: ContentOptions,
|
|
1460
|
+
): Element;
|
|
1461
|
+
prepend(
|
|
1462
|
+
content: string | ReadableStream | Response,
|
|
1463
|
+
options?: ContentOptions,
|
|
1464
|
+
): Element;
|
|
1465
|
+
append(
|
|
1466
|
+
content: string | ReadableStream | Response,
|
|
1467
|
+
options?: ContentOptions,
|
|
1468
|
+
): Element;
|
|
1469
|
+
replace(
|
|
1470
|
+
content: string | ReadableStream | Response,
|
|
1471
|
+
options?: ContentOptions,
|
|
1472
|
+
): Element;
|
|
1436
1473
|
remove(): Element;
|
|
1437
1474
|
removeAndKeepContent(): Element;
|
|
1438
|
-
setInnerContent(
|
|
1475
|
+
setInnerContent(
|
|
1476
|
+
content: string | ReadableStream | Response,
|
|
1477
|
+
options?: ContentOptions,
|
|
1478
|
+
): Element;
|
|
1439
1479
|
onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
|
|
1440
1480
|
}
|
|
1441
1481
|
export interface EndTag {
|
|
1442
1482
|
name: string;
|
|
1443
|
-
before(
|
|
1444
|
-
|
|
1483
|
+
before(
|
|
1484
|
+
content: string | ReadableStream | Response,
|
|
1485
|
+
options?: ContentOptions,
|
|
1486
|
+
): EndTag;
|
|
1487
|
+
after(
|
|
1488
|
+
content: string | ReadableStream | Response,
|
|
1489
|
+
options?: ContentOptions,
|
|
1490
|
+
): EndTag;
|
|
1445
1491
|
remove(): EndTag;
|
|
1446
1492
|
}
|
|
1447
1493
|
export interface Comment {
|
|
@@ -1456,9 +1502,18 @@ export interface Text {
|
|
|
1456
1502
|
readonly text: string;
|
|
1457
1503
|
readonly lastInTextNode: boolean;
|
|
1458
1504
|
readonly removed: boolean;
|
|
1459
|
-
before(
|
|
1460
|
-
|
|
1461
|
-
|
|
1505
|
+
before(
|
|
1506
|
+
content: string | ReadableStream | Response,
|
|
1507
|
+
options?: ContentOptions,
|
|
1508
|
+
): Text;
|
|
1509
|
+
after(
|
|
1510
|
+
content: string | ReadableStream | Response,
|
|
1511
|
+
options?: ContentOptions,
|
|
1512
|
+
): Text;
|
|
1513
|
+
replace(
|
|
1514
|
+
content: string | ReadableStream | Response,
|
|
1515
|
+
options?: ContentOptions,
|
|
1516
|
+
): Text;
|
|
1462
1517
|
remove(): Text;
|
|
1463
1518
|
}
|
|
1464
1519
|
export interface DocumentEnd {
|
|
@@ -1542,28 +1597,34 @@ export declare abstract class Body {
|
|
|
1542
1597
|
*
|
|
1543
1598
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1544
1599
|
*/
|
|
1545
|
-
export declare
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1600
|
+
export declare var Response: {
|
|
1601
|
+
prototype: Response;
|
|
1602
|
+
new (body?: BodyInit | null, init?: ResponseInit): Response;
|
|
1603
|
+
redirect(url: string, status?: number): Response;
|
|
1604
|
+
json(any: any, maybeInit?: ResponseInit | Response): Response;
|
|
1605
|
+
};
|
|
1606
|
+
/**
|
|
1607
|
+
* This Fetch API interface represents the response to a request.
|
|
1608
|
+
*
|
|
1609
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1610
|
+
*/
|
|
1611
|
+
export interface Response extends Body {
|
|
1551
1612
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
|
|
1552
1613
|
clone(): Response;
|
|
1553
1614
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
|
|
1554
|
-
|
|
1615
|
+
status: number;
|
|
1555
1616
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
|
|
1556
|
-
|
|
1617
|
+
statusText: string;
|
|
1557
1618
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
|
|
1558
|
-
|
|
1619
|
+
headers: Headers;
|
|
1559
1620
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
|
|
1560
|
-
|
|
1621
|
+
ok: boolean;
|
|
1561
1622
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
|
|
1562
|
-
|
|
1623
|
+
redirected: boolean;
|
|
1563
1624
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1625
|
+
url: string;
|
|
1626
|
+
webSocket: WebSocket | null;
|
|
1627
|
+
cf: any | undefined;
|
|
1567
1628
|
}
|
|
1568
1629
|
export interface ResponseInit {
|
|
1569
1630
|
status?: number;
|
|
@@ -1576,17 +1637,28 @@ export interface ResponseInit {
|
|
|
1576
1637
|
export type RequestInfo<
|
|
1577
1638
|
CfHostMetadata = unknown,
|
|
1578
1639
|
Cf = CfProperties<CfHostMetadata>,
|
|
1579
|
-
> = Request<CfHostMetadata, Cf> | string
|
|
1640
|
+
> = Request<CfHostMetadata, Cf> | string;
|
|
1641
|
+
/**
|
|
1642
|
+
* This Fetch API interface represents a resource request.
|
|
1643
|
+
*
|
|
1644
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
|
|
1645
|
+
*/
|
|
1646
|
+
export declare var Request: {
|
|
1647
|
+
prototype: Request;
|
|
1648
|
+
new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
|
|
1649
|
+
input: RequestInfo<CfProperties> | URL,
|
|
1650
|
+
init?: RequestInit<Cf>,
|
|
1651
|
+
): Request<CfHostMetadata, Cf>;
|
|
1652
|
+
};
|
|
1580
1653
|
/**
|
|
1581
1654
|
* This Fetch API interface represents a resource request.
|
|
1582
1655
|
*
|
|
1583
1656
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
|
|
1584
1657
|
*/
|
|
1585
|
-
export
|
|
1658
|
+
export interface Request<
|
|
1586
1659
|
CfHostMetadata = unknown,
|
|
1587
1660
|
Cf = CfProperties<CfHostMetadata>,
|
|
1588
1661
|
> extends Body {
|
|
1589
|
-
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1590
1662
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
|
|
1591
1663
|
clone(): Request<CfHostMetadata, Cf>;
|
|
1592
1664
|
/**
|
|
@@ -1594,45 +1666,45 @@ export declare class Request<
|
|
|
1594
1666
|
*
|
|
1595
1667
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
|
|
1596
1668
|
*/
|
|
1597
|
-
|
|
1669
|
+
method: string;
|
|
1598
1670
|
/**
|
|
1599
1671
|
* Returns the URL of request as a string.
|
|
1600
1672
|
*
|
|
1601
1673
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
|
|
1602
1674
|
*/
|
|
1603
|
-
|
|
1675
|
+
url: string;
|
|
1604
1676
|
/**
|
|
1605
1677
|
* Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the "Host" header.
|
|
1606
1678
|
*
|
|
1607
1679
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
|
|
1608
1680
|
*/
|
|
1609
|
-
|
|
1681
|
+
headers: Headers;
|
|
1610
1682
|
/**
|
|
1611
1683
|
* Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default.
|
|
1612
1684
|
*
|
|
1613
1685
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
|
|
1614
1686
|
*/
|
|
1615
|
-
|
|
1616
|
-
|
|
1687
|
+
redirect: string;
|
|
1688
|
+
fetcher: Fetcher | null;
|
|
1617
1689
|
/**
|
|
1618
1690
|
* Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
|
|
1619
1691
|
*
|
|
1620
1692
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
|
|
1621
1693
|
*/
|
|
1622
|
-
|
|
1623
|
-
|
|
1694
|
+
signal: AbortSignal;
|
|
1695
|
+
cf: Cf | undefined;
|
|
1624
1696
|
/**
|
|
1625
1697
|
* Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI]
|
|
1626
1698
|
*
|
|
1627
1699
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
|
|
1628
1700
|
*/
|
|
1629
|
-
|
|
1701
|
+
integrity: string;
|
|
1630
1702
|
/**
|
|
1631
1703
|
* Returns a boolean indicating whether or not request can outlive the global in which it was created.
|
|
1632
1704
|
*
|
|
1633
1705
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
|
|
1634
1706
|
*/
|
|
1635
|
-
|
|
1707
|
+
keepalive: boolean;
|
|
1636
1708
|
}
|
|
1637
1709
|
export interface RequestInit<Cf = CfProperties> {
|
|
1638
1710
|
/* A string to set request's method. */
|
|
@@ -1659,7 +1731,7 @@ export type Fetcher<
|
|
|
1659
1731
|
> = (T extends Rpc.EntrypointBranded
|
|
1660
1732
|
? Rpc.Provider<T, Reserved | "fetch" | "connect">
|
|
1661
1733
|
: unknown) & {
|
|
1662
|
-
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1734
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1663
1735
|
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1664
1736
|
};
|
|
1665
1737
|
export interface FetcherPutOptions {
|
|
@@ -1881,6 +1953,7 @@ export interface R2MultipartUpload {
|
|
|
1881
1953
|
uploadPart(
|
|
1882
1954
|
partNumber: number,
|
|
1883
1955
|
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
|
|
1956
|
+
options?: R2UploadPartOptions,
|
|
1884
1957
|
): Promise<R2UploadedPart>;
|
|
1885
1958
|
abort(): Promise<void>;
|
|
1886
1959
|
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
|
|
@@ -1901,6 +1974,7 @@ export declare abstract class R2Object {
|
|
|
1901
1974
|
readonly customMetadata?: Record<string, string>;
|
|
1902
1975
|
readonly range?: R2Range;
|
|
1903
1976
|
readonly storageClass: string;
|
|
1977
|
+
readonly ssecKeyMd5?: string;
|
|
1904
1978
|
writeHttpMetadata(headers: Headers): void;
|
|
1905
1979
|
}
|
|
1906
1980
|
export interface R2ObjectBody extends R2Object {
|
|
@@ -1933,6 +2007,7 @@ export interface R2Conditional {
|
|
|
1933
2007
|
export interface R2GetOptions {
|
|
1934
2008
|
onlyIf?: R2Conditional | Headers;
|
|
1935
2009
|
range?: R2Range | Headers;
|
|
2010
|
+
ssecKey?: ArrayBuffer | string;
|
|
1936
2011
|
}
|
|
1937
2012
|
export interface R2PutOptions {
|
|
1938
2013
|
onlyIf?: R2Conditional | Headers;
|
|
@@ -1944,11 +2019,13 @@ export interface R2PutOptions {
|
|
|
1944
2019
|
sha384?: ArrayBuffer | string;
|
|
1945
2020
|
sha512?: ArrayBuffer | string;
|
|
1946
2021
|
storageClass?: string;
|
|
2022
|
+
ssecKey?: ArrayBuffer | string;
|
|
1947
2023
|
}
|
|
1948
2024
|
export interface R2MultipartOptions {
|
|
1949
2025
|
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1950
2026
|
customMetadata?: Record<string, string>;
|
|
1951
2027
|
storageClass?: string;
|
|
2028
|
+
ssecKey?: ArrayBuffer | string;
|
|
1952
2029
|
}
|
|
1953
2030
|
export interface R2Checksums {
|
|
1954
2031
|
readonly md5?: ArrayBuffer;
|
|
@@ -1985,6 +2062,9 @@ export type R2Objects = {
|
|
|
1985
2062
|
truncated: false;
|
|
1986
2063
|
}
|
|
1987
2064
|
);
|
|
2065
|
+
export interface R2UploadPartOptions {
|
|
2066
|
+
ssecKey?: ArrayBuffer | string;
|
|
2067
|
+
}
|
|
1988
2068
|
export declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1989
2069
|
readonly scheduledTime: number;
|
|
1990
2070
|
readonly cron: string;
|
|
@@ -2398,6 +2478,8 @@ export interface TraceItem {
|
|
|
2398
2478
|
readonly dispatchNamespace?: string;
|
|
2399
2479
|
readonly scriptTags?: string[];
|
|
2400
2480
|
readonly outcome: string;
|
|
2481
|
+
readonly executionModel: string;
|
|
2482
|
+
readonly truncated: boolean;
|
|
2401
2483
|
}
|
|
2402
2484
|
export interface TraceItemAlarmEventInfo {
|
|
2403
2485
|
readonly scheduledTime: Date;
|
|
@@ -2537,6 +2619,10 @@ export declare class URL {
|
|
|
2537
2619
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
|
|
2538
2620
|
static canParse(url: string, base?: string): boolean;
|
|
2539
2621
|
static parse(url: string, base?: string): URL | null;
|
|
2622
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static) */
|
|
2623
|
+
static createObjectURL(object: File | Blob): string;
|
|
2624
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static) */
|
|
2625
|
+
static revokeObjectURL(object_url: string): void;
|
|
2540
2626
|
}
|
|
2541
2627
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
|
|
2542
2628
|
export declare class URLSearchParams {
|
|
@@ -2710,8 +2796,24 @@ export type WebSocketEventMap = {
|
|
|
2710
2796
|
*
|
|
2711
2797
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
2712
2798
|
*/
|
|
2713
|
-
export declare
|
|
2714
|
-
|
|
2799
|
+
export declare var WebSocket: {
|
|
2800
|
+
prototype: WebSocket;
|
|
2801
|
+
new (url: string, protocols?: string[] | string): WebSocket;
|
|
2802
|
+
readonly READY_STATE_CONNECTING: number;
|
|
2803
|
+
readonly CONNECTING: number;
|
|
2804
|
+
readonly READY_STATE_OPEN: number;
|
|
2805
|
+
readonly OPEN: number;
|
|
2806
|
+
readonly READY_STATE_CLOSING: number;
|
|
2807
|
+
readonly CLOSING: number;
|
|
2808
|
+
readonly READY_STATE_CLOSED: number;
|
|
2809
|
+
readonly CLOSED: number;
|
|
2810
|
+
};
|
|
2811
|
+
/**
|
|
2812
|
+
* Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
|
|
2813
|
+
*
|
|
2814
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
2815
|
+
*/
|
|
2816
|
+
export interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
2715
2817
|
accept(): void;
|
|
2716
2818
|
/**
|
|
2717
2819
|
* Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
|
|
@@ -2727,38 +2829,30 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
2727
2829
|
close(code?: number, reason?: string): void;
|
|
2728
2830
|
serializeAttachment(attachment: any): void;
|
|
2729
2831
|
deserializeAttachment(): any | null;
|
|
2730
|
-
static readonly READY_STATE_CONNECTING: number;
|
|
2731
|
-
static readonly CONNECTING: number;
|
|
2732
|
-
static readonly READY_STATE_OPEN: number;
|
|
2733
|
-
static readonly OPEN: number;
|
|
2734
|
-
static readonly READY_STATE_CLOSING: number;
|
|
2735
|
-
static readonly CLOSING: number;
|
|
2736
|
-
static readonly READY_STATE_CLOSED: number;
|
|
2737
|
-
static readonly CLOSED: number;
|
|
2738
2832
|
/**
|
|
2739
2833
|
* Returns the state of the WebSocket object's connection. It can have the values described below.
|
|
2740
2834
|
*
|
|
2741
2835
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
|
|
2742
2836
|
*/
|
|
2743
|
-
|
|
2837
|
+
readyState: number;
|
|
2744
2838
|
/**
|
|
2745
2839
|
* Returns the URL that was used to establish the WebSocket connection.
|
|
2746
2840
|
*
|
|
2747
2841
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
|
|
2748
2842
|
*/
|
|
2749
|
-
|
|
2843
|
+
url: string | null;
|
|
2750
2844
|
/**
|
|
2751
2845
|
* Returns the subprotocol selected by the server, if any. It can be used in conjunction with the array form of the constructor's second argument to perform subprotocol negotiation.
|
|
2752
2846
|
*
|
|
2753
2847
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
|
|
2754
2848
|
*/
|
|
2755
|
-
|
|
2849
|
+
protocol: string | null;
|
|
2756
2850
|
/**
|
|
2757
2851
|
* Returns the extensions selected by the server, if any.
|
|
2758
2852
|
*
|
|
2759
2853
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
|
|
2760
2854
|
*/
|
|
2761
|
-
|
|
2855
|
+
extensions: string | null;
|
|
2762
2856
|
}
|
|
2763
2857
|
export declare const WebSocketPair: {
|
|
2764
2858
|
new (): {
|
|
@@ -2766,6 +2860,37 @@ export declare const WebSocketPair: {
|
|
|
2766
2860
|
1: WebSocket;
|
|
2767
2861
|
};
|
|
2768
2862
|
};
|
|
2863
|
+
export interface SqlStorage {
|
|
2864
|
+
exec<T extends Record<string, SqlStorageValue>>(
|
|
2865
|
+
query: string,
|
|
2866
|
+
...bindings: any[]
|
|
2867
|
+
): SqlStorageCursor<T>;
|
|
2868
|
+
get databaseSize(): number;
|
|
2869
|
+
Cursor: typeof SqlStorageCursor;
|
|
2870
|
+
Statement: typeof SqlStorageStatement;
|
|
2871
|
+
}
|
|
2872
|
+
export declare abstract class SqlStorageStatement {}
|
|
2873
|
+
export type SqlStorageValue = ArrayBuffer | string | number | null;
|
|
2874
|
+
export declare abstract class SqlStorageCursor<
|
|
2875
|
+
T extends Record<string, SqlStorageValue>,
|
|
2876
|
+
> {
|
|
2877
|
+
next():
|
|
2878
|
+
| {
|
|
2879
|
+
done?: false;
|
|
2880
|
+
value: T;
|
|
2881
|
+
}
|
|
2882
|
+
| {
|
|
2883
|
+
done: true;
|
|
2884
|
+
value?: never;
|
|
2885
|
+
};
|
|
2886
|
+
toArray(): T[];
|
|
2887
|
+
one(): T;
|
|
2888
|
+
raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
|
|
2889
|
+
columnNames: string[];
|
|
2890
|
+
get rowsRead(): number;
|
|
2891
|
+
get rowsWritten(): number;
|
|
2892
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
2893
|
+
}
|
|
2769
2894
|
export interface Socket {
|
|
2770
2895
|
get readable(): ReadableStream;
|
|
2771
2896
|
get writable(): WritableStream;
|
|
@@ -3303,7 +3428,7 @@ export interface GPUOrigin3DDict {
|
|
|
3303
3428
|
z?: number;
|
|
3304
3429
|
}
|
|
3305
3430
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
|
|
3306
|
-
export declare class EventSource {
|
|
3431
|
+
export declare class EventSource extends EventTarget {
|
|
3307
3432
|
constructor(url: string, init?: EventSourceEventSourceInit);
|
|
3308
3433
|
/**
|
|
3309
3434
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -3402,10 +3527,10 @@ export declare abstract class BaseAiSentenceSimilarity {
|
|
|
3402
3527
|
inputs: AiSentenceSimilarityInput;
|
|
3403
3528
|
postProcessedOutputs: AiSentenceSimilarityOutput;
|
|
3404
3529
|
}
|
|
3405
|
-
export type
|
|
3530
|
+
export type AiAutomaticSpeechRecognitionInput = {
|
|
3406
3531
|
audio: number[];
|
|
3407
3532
|
};
|
|
3408
|
-
export type
|
|
3533
|
+
export type AiAutomaticSpeechRecognitionOutput = {
|
|
3409
3534
|
text?: string;
|
|
3410
3535
|
words?: {
|
|
3411
3536
|
word: string;
|
|
@@ -3414,9 +3539,9 @@ export type AiSpeechRecognitionOutput = {
|
|
|
3414
3539
|
}[];
|
|
3415
3540
|
vtt?: string;
|
|
3416
3541
|
};
|
|
3417
|
-
export declare abstract class
|
|
3418
|
-
inputs:
|
|
3419
|
-
postProcessedOutputs:
|
|
3542
|
+
export declare abstract class BaseAiAutomaticSpeechRecognition {
|
|
3543
|
+
inputs: AiAutomaticSpeechRecognitionInput;
|
|
3544
|
+
postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;
|
|
3420
3545
|
}
|
|
3421
3546
|
export type AiSummarizationInput = {
|
|
3422
3547
|
input_text: string;
|
|
@@ -3452,16 +3577,36 @@ export declare abstract class BaseAiTextEmbeddings {
|
|
|
3452
3577
|
postProcessedOutputs: AiTextEmbeddingsOutput;
|
|
3453
3578
|
}
|
|
3454
3579
|
export type RoleScopedChatInput = {
|
|
3455
|
-
role:
|
|
3580
|
+
role:
|
|
3581
|
+
| "user"
|
|
3582
|
+
| "assistant"
|
|
3583
|
+
| "system"
|
|
3584
|
+
| "tool"
|
|
3585
|
+
| (string & NonNullable<unknown>);
|
|
3456
3586
|
content: string;
|
|
3587
|
+
name?: string;
|
|
3588
|
+
};
|
|
3589
|
+
export type AiTextGenerationToolLegacyInput = {
|
|
3590
|
+
name: string;
|
|
3591
|
+
description: string;
|
|
3592
|
+
parameters?: {
|
|
3593
|
+
type: "object" | (string & NonNullable<unknown>);
|
|
3594
|
+
properties: {
|
|
3595
|
+
[key: string]: {
|
|
3596
|
+
type: string;
|
|
3597
|
+
description?: string;
|
|
3598
|
+
};
|
|
3599
|
+
};
|
|
3600
|
+
required: string[];
|
|
3601
|
+
};
|
|
3457
3602
|
};
|
|
3458
3603
|
export type AiTextGenerationToolInput = {
|
|
3459
|
-
type: "function";
|
|
3604
|
+
type: "function" | (string & NonNullable<unknown>);
|
|
3460
3605
|
function: {
|
|
3461
3606
|
name: string;
|
|
3462
3607
|
description: string;
|
|
3463
3608
|
parameters?: {
|
|
3464
|
-
type: "object";
|
|
3609
|
+
type: "object" | (string & NonNullable<unknown>);
|
|
3465
3610
|
properties: {
|
|
3466
3611
|
[key: string]: {
|
|
3467
3612
|
type: string;
|
|
@@ -3472,6 +3617,10 @@ export type AiTextGenerationToolInput = {
|
|
|
3472
3617
|
};
|
|
3473
3618
|
};
|
|
3474
3619
|
};
|
|
3620
|
+
export type AiTextGenerationFunctionsInput = {
|
|
3621
|
+
name: string;
|
|
3622
|
+
code: string;
|
|
3623
|
+
};
|
|
3475
3624
|
export type AiTextGenerationInput = {
|
|
3476
3625
|
prompt?: string;
|
|
3477
3626
|
raw?: boolean;
|
|
@@ -3485,7 +3634,11 @@ export type AiTextGenerationInput = {
|
|
|
3485
3634
|
frequency_penalty?: number;
|
|
3486
3635
|
presence_penalty?: number;
|
|
3487
3636
|
messages?: RoleScopedChatInput[];
|
|
3488
|
-
tools?:
|
|
3637
|
+
tools?:
|
|
3638
|
+
| AiTextGenerationToolInput[]
|
|
3639
|
+
| AiTextGenerationToolLegacyInput[]
|
|
3640
|
+
| (object & NonNullable<unknown>);
|
|
3641
|
+
functions?: AiTextGenerationFunctionsInput[];
|
|
3489
3642
|
};
|
|
3490
3643
|
export type AiTextGenerationOutput =
|
|
3491
3644
|
| {
|
|
@@ -3500,15 +3653,33 @@ export declare abstract class BaseAiTextGeneration {
|
|
|
3500
3653
|
inputs: AiTextGenerationInput;
|
|
3501
3654
|
postProcessedOutputs: AiTextGenerationOutput;
|
|
3502
3655
|
}
|
|
3656
|
+
export type AiTextToSpeechInput = {
|
|
3657
|
+
prompt: string;
|
|
3658
|
+
lang?: string;
|
|
3659
|
+
};
|
|
3660
|
+
export type AiTextToSpeechOutput =
|
|
3661
|
+
| Uint8Array
|
|
3662
|
+
| {
|
|
3663
|
+
audio: string;
|
|
3664
|
+
};
|
|
3665
|
+
export declare abstract class BaseAiTextToSpeech {
|
|
3666
|
+
inputs: AiTextToSpeechInput;
|
|
3667
|
+
postProcessedOutputs: AiTextToSpeechOutput;
|
|
3668
|
+
}
|
|
3503
3669
|
export type AiTextToImageInput = {
|
|
3504
3670
|
prompt: string;
|
|
3671
|
+
negative_prompt?: string;
|
|
3672
|
+
height?: number;
|
|
3673
|
+
width?: number;
|
|
3505
3674
|
image?: number[];
|
|
3675
|
+
image_b64?: string;
|
|
3506
3676
|
mask?: number[];
|
|
3507
3677
|
num_steps?: number;
|
|
3508
3678
|
strength?: number;
|
|
3509
3679
|
guidance?: number;
|
|
3680
|
+
seed?: number;
|
|
3510
3681
|
};
|
|
3511
|
-
export type AiTextToImageOutput = Uint8Array
|
|
3682
|
+
export type AiTextToImageOutput = ReadableStream<Uint8Array>;
|
|
3512
3683
|
export declare abstract class BaseAiTextToImage {
|
|
3513
3684
|
inputs: AiTextToImageInput;
|
|
3514
3685
|
postProcessedOutputs: AiTextToImageOutput;
|
|
@@ -3525,127 +3696,615 @@ export declare abstract class BaseAiTranslation {
|
|
|
3525
3696
|
inputs: AiTranslationInput;
|
|
3526
3697
|
postProcessedOutputs: AiTranslationOutput;
|
|
3527
3698
|
}
|
|
3699
|
+
export type Ai_Cf_Openai_Whisper_Input =
|
|
3700
|
+
| string
|
|
3701
|
+
| {
|
|
3702
|
+
/**
|
|
3703
|
+
* An array of integers that represent the audio data constrained to 8-bit unsigned integer values
|
|
3704
|
+
*/
|
|
3705
|
+
audio: number[];
|
|
3706
|
+
};
|
|
3707
|
+
export interface Ai_Cf_Openai_Whisper_Output {
|
|
3708
|
+
/**
|
|
3709
|
+
* The transcription
|
|
3710
|
+
*/
|
|
3711
|
+
text: string;
|
|
3712
|
+
word_count?: number;
|
|
3713
|
+
words?: {
|
|
3714
|
+
word?: string;
|
|
3715
|
+
/**
|
|
3716
|
+
* The second this word begins in the recording
|
|
3717
|
+
*/
|
|
3718
|
+
start?: number;
|
|
3719
|
+
/**
|
|
3720
|
+
* The ending second when the word completes
|
|
3721
|
+
*/
|
|
3722
|
+
end?: number;
|
|
3723
|
+
}[];
|
|
3724
|
+
vtt?: string;
|
|
3725
|
+
}
|
|
3726
|
+
export declare abstract class Base_Ai_Cf_Openai_Whisper {
|
|
3727
|
+
inputs: Ai_Cf_Openai_Whisper_Input;
|
|
3728
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;
|
|
3729
|
+
}
|
|
3730
|
+
export type Ai_Cf_Openai_Whisper_Tiny_En_Input =
|
|
3731
|
+
| string
|
|
3732
|
+
| {
|
|
3733
|
+
/**
|
|
3734
|
+
* An array of integers that represent the audio data constrained to 8-bit unsigned integer values
|
|
3735
|
+
*/
|
|
3736
|
+
audio: number[];
|
|
3737
|
+
};
|
|
3738
|
+
export interface Ai_Cf_Openai_Whisper_Tiny_En_Output {
|
|
3739
|
+
/**
|
|
3740
|
+
* The transcription
|
|
3741
|
+
*/
|
|
3742
|
+
text: string;
|
|
3743
|
+
word_count?: number;
|
|
3744
|
+
words?: {
|
|
3745
|
+
word?: string;
|
|
3746
|
+
/**
|
|
3747
|
+
* The second this word begins in the recording
|
|
3748
|
+
*/
|
|
3749
|
+
start?: number;
|
|
3750
|
+
/**
|
|
3751
|
+
* The ending second when the word completes
|
|
3752
|
+
*/
|
|
3753
|
+
end?: number;
|
|
3754
|
+
}[];
|
|
3755
|
+
vtt?: string;
|
|
3756
|
+
}
|
|
3757
|
+
export declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
|
|
3758
|
+
inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;
|
|
3759
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
|
|
3760
|
+
}
|
|
3761
|
+
export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
|
|
3762
|
+
/**
|
|
3763
|
+
* Base64 encoded value of the audio data.
|
|
3764
|
+
*/
|
|
3765
|
+
audio: string;
|
|
3766
|
+
/**
|
|
3767
|
+
* Supported tasks are 'translate' or 'transcribe'.
|
|
3768
|
+
*/
|
|
3769
|
+
task?: string;
|
|
3770
|
+
/**
|
|
3771
|
+
* The language of the audio being transcribed or translated.
|
|
3772
|
+
*/
|
|
3773
|
+
language?: string;
|
|
3774
|
+
/**
|
|
3775
|
+
* Preprocess the audio with a voice activity detection model.
|
|
3776
|
+
*/
|
|
3777
|
+
vad_filter?: string;
|
|
3778
|
+
/**
|
|
3779
|
+
* A text prompt to help provide context to the model on the contents of the audio.
|
|
3780
|
+
*/
|
|
3781
|
+
initial_prompt?: string;
|
|
3782
|
+
/**
|
|
3783
|
+
* The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
|
|
3784
|
+
*/
|
|
3785
|
+
prefix?: string;
|
|
3786
|
+
}
|
|
3787
|
+
export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
|
|
3788
|
+
transcription_info?: {
|
|
3789
|
+
/**
|
|
3790
|
+
* The language of the audio being transcribed or translated.
|
|
3791
|
+
*/
|
|
3792
|
+
language?: string;
|
|
3793
|
+
/**
|
|
3794
|
+
* The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.
|
|
3795
|
+
*/
|
|
3796
|
+
language_probability?: number;
|
|
3797
|
+
/**
|
|
3798
|
+
* The total duration of the original audio file, in seconds.
|
|
3799
|
+
*/
|
|
3800
|
+
duration?: number;
|
|
3801
|
+
/**
|
|
3802
|
+
* The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.
|
|
3803
|
+
*/
|
|
3804
|
+
duration_after_vad?: number;
|
|
3805
|
+
};
|
|
3806
|
+
/**
|
|
3807
|
+
* The complete transcription of the audio.
|
|
3808
|
+
*/
|
|
3809
|
+
text: string;
|
|
3810
|
+
/**
|
|
3811
|
+
* The total number of words in the transcription.
|
|
3812
|
+
*/
|
|
3813
|
+
word_count?: number;
|
|
3814
|
+
segments?: {
|
|
3815
|
+
/**
|
|
3816
|
+
* The starting time of the segment within the audio, in seconds.
|
|
3817
|
+
*/
|
|
3818
|
+
start?: number;
|
|
3819
|
+
/**
|
|
3820
|
+
* The ending time of the segment within the audio, in seconds.
|
|
3821
|
+
*/
|
|
3822
|
+
end?: number;
|
|
3823
|
+
/**
|
|
3824
|
+
* The transcription of the segment.
|
|
3825
|
+
*/
|
|
3826
|
+
text?: string;
|
|
3827
|
+
/**
|
|
3828
|
+
* The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.
|
|
3829
|
+
*/
|
|
3830
|
+
temperature?: number;
|
|
3831
|
+
/**
|
|
3832
|
+
* The average log probability of the predictions for the words in this segment, indicating overall confidence.
|
|
3833
|
+
*/
|
|
3834
|
+
avg_logprob?: number;
|
|
3835
|
+
/**
|
|
3836
|
+
* The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.
|
|
3837
|
+
*/
|
|
3838
|
+
compression_ratio?: number;
|
|
3839
|
+
/**
|
|
3840
|
+
* The probability that the segment contains no speech, represented as a decimal between 0 and 1.
|
|
3841
|
+
*/
|
|
3842
|
+
no_speech_prob?: number;
|
|
3843
|
+
words?: {
|
|
3844
|
+
/**
|
|
3845
|
+
* The individual word transcribed from the audio.
|
|
3846
|
+
*/
|
|
3847
|
+
word?: string;
|
|
3848
|
+
/**
|
|
3849
|
+
* The starting time of the word within the audio, in seconds.
|
|
3850
|
+
*/
|
|
3851
|
+
start?: number;
|
|
3852
|
+
/**
|
|
3853
|
+
* The ending time of the word within the audio, in seconds.
|
|
3854
|
+
*/
|
|
3855
|
+
end?: number;
|
|
3856
|
+
}[];
|
|
3857
|
+
};
|
|
3858
|
+
/**
|
|
3859
|
+
* The transcription in WebVTT format, which includes timing and text information for use in subtitles.
|
|
3860
|
+
*/
|
|
3861
|
+
vtt?: string;
|
|
3862
|
+
}
|
|
3863
|
+
export declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {
|
|
3864
|
+
inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;
|
|
3865
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;
|
|
3866
|
+
}
|
|
3867
|
+
export interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {
|
|
3868
|
+
/**
|
|
3869
|
+
* A text description of the image you want to generate.
|
|
3870
|
+
*/
|
|
3871
|
+
prompt: string;
|
|
3872
|
+
/**
|
|
3873
|
+
* The number of diffusion steps; higher values can improve quality but take longer.
|
|
3874
|
+
*/
|
|
3875
|
+
steps?: number;
|
|
3876
|
+
}
|
|
3877
|
+
export interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {
|
|
3878
|
+
/**
|
|
3879
|
+
* The generated image in Base64 format.
|
|
3880
|
+
*/
|
|
3881
|
+
image?: string;
|
|
3882
|
+
}
|
|
3883
|
+
export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {
|
|
3884
|
+
inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;
|
|
3885
|
+
postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;
|
|
3886
|
+
}
|
|
3887
|
+
export type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Prompt | Messages;
|
|
3888
|
+
export interface Prompt {
|
|
3889
|
+
/**
|
|
3890
|
+
* The input text prompt for the model to generate a response.
|
|
3891
|
+
*/
|
|
3892
|
+
prompt: string;
|
|
3893
|
+
image?: number[] | (string & NonNullable<unknown>);
|
|
3894
|
+
/**
|
|
3895
|
+
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
|
|
3896
|
+
*/
|
|
3897
|
+
raw?: boolean;
|
|
3898
|
+
/**
|
|
3899
|
+
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
|
|
3900
|
+
*/
|
|
3901
|
+
stream?: boolean;
|
|
3902
|
+
/**
|
|
3903
|
+
* The maximum number of tokens to generate in the response.
|
|
3904
|
+
*/
|
|
3905
|
+
max_tokens?: number;
|
|
3906
|
+
/**
|
|
3907
|
+
* Controls the randomness of the output; higher values produce more random results.
|
|
3908
|
+
*/
|
|
3909
|
+
temperature?: number;
|
|
3910
|
+
/**
|
|
3911
|
+
* 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.
|
|
3912
|
+
*/
|
|
3913
|
+
top_p?: number;
|
|
3914
|
+
/**
|
|
3915
|
+
* 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.
|
|
3916
|
+
*/
|
|
3917
|
+
top_k?: number;
|
|
3918
|
+
/**
|
|
3919
|
+
* Random seed for reproducibility of the generation.
|
|
3920
|
+
*/
|
|
3921
|
+
seed?: number;
|
|
3922
|
+
/**
|
|
3923
|
+
* Penalty for repeated tokens; higher values discourage repetition.
|
|
3924
|
+
*/
|
|
3925
|
+
repetition_penalty?: number;
|
|
3926
|
+
/**
|
|
3927
|
+
* Decreases the likelihood of the model repeating the same lines verbatim.
|
|
3928
|
+
*/
|
|
3929
|
+
frequency_penalty?: number;
|
|
3930
|
+
/**
|
|
3931
|
+
* Increases the likelihood of the model introducing new topics.
|
|
3932
|
+
*/
|
|
3933
|
+
presence_penalty?: number;
|
|
3934
|
+
/**
|
|
3935
|
+
* Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
|
|
3936
|
+
*/
|
|
3937
|
+
lora?: string;
|
|
3938
|
+
}
|
|
3939
|
+
export interface Messages {
|
|
3940
|
+
/**
|
|
3941
|
+
* An array of message objects representing the conversation history.
|
|
3942
|
+
*/
|
|
3943
|
+
messages: {
|
|
3944
|
+
/**
|
|
3945
|
+
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
3946
|
+
*/
|
|
3947
|
+
role: string;
|
|
3948
|
+
/**
|
|
3949
|
+
* The content of the message as a string.
|
|
3950
|
+
*/
|
|
3951
|
+
content: string;
|
|
3952
|
+
}[];
|
|
3953
|
+
image?: number[] | string;
|
|
3954
|
+
functions?: {
|
|
3955
|
+
name: string;
|
|
3956
|
+
code: string;
|
|
3957
|
+
}[];
|
|
3958
|
+
/**
|
|
3959
|
+
* A list of tools available for the assistant to use.
|
|
3960
|
+
*/
|
|
3961
|
+
tools?: (
|
|
3962
|
+
| {
|
|
3963
|
+
/**
|
|
3964
|
+
* The name of the tool. More descriptive the better.
|
|
3965
|
+
*/
|
|
3966
|
+
name: string;
|
|
3967
|
+
/**
|
|
3968
|
+
* A brief description of what the tool does.
|
|
3969
|
+
*/
|
|
3970
|
+
description: string;
|
|
3971
|
+
/**
|
|
3972
|
+
* Schema defining the parameters accepted by the tool.
|
|
3973
|
+
*/
|
|
3974
|
+
parameters: {
|
|
3975
|
+
/**
|
|
3976
|
+
* The type of the parameters object (usually 'object').
|
|
3977
|
+
*/
|
|
3978
|
+
type: string;
|
|
3979
|
+
/**
|
|
3980
|
+
* List of required parameter names.
|
|
3981
|
+
*/
|
|
3982
|
+
required?: string[];
|
|
3983
|
+
/**
|
|
3984
|
+
* Definitions of each parameter.
|
|
3985
|
+
*/
|
|
3986
|
+
properties: {
|
|
3987
|
+
[k: string]: {
|
|
3988
|
+
/**
|
|
3989
|
+
* The data type of the parameter.
|
|
3990
|
+
*/
|
|
3991
|
+
type: string;
|
|
3992
|
+
/**
|
|
3993
|
+
* A description of the expected parameter.
|
|
3994
|
+
*/
|
|
3995
|
+
description: string;
|
|
3996
|
+
};
|
|
3997
|
+
};
|
|
3998
|
+
};
|
|
3999
|
+
}
|
|
4000
|
+
| {
|
|
4001
|
+
/**
|
|
4002
|
+
* Specifies the type of tool (e.g., 'function').
|
|
4003
|
+
*/
|
|
4004
|
+
type: string;
|
|
4005
|
+
/**
|
|
4006
|
+
* Details of the function tool.
|
|
4007
|
+
*/
|
|
4008
|
+
function: {
|
|
4009
|
+
/**
|
|
4010
|
+
* The name of the function.
|
|
4011
|
+
*/
|
|
4012
|
+
name: string;
|
|
4013
|
+
/**
|
|
4014
|
+
* A brief description of what the function does.
|
|
4015
|
+
*/
|
|
4016
|
+
description: string;
|
|
4017
|
+
/**
|
|
4018
|
+
* Schema defining the parameters accepted by the function.
|
|
4019
|
+
*/
|
|
4020
|
+
parameters: {
|
|
4021
|
+
/**
|
|
4022
|
+
* The type of the parameters object (usually 'object').
|
|
4023
|
+
*/
|
|
4024
|
+
type: string;
|
|
4025
|
+
/**
|
|
4026
|
+
* List of required parameter names.
|
|
4027
|
+
*/
|
|
4028
|
+
required?: string[];
|
|
4029
|
+
/**
|
|
4030
|
+
* Definitions of each parameter.
|
|
4031
|
+
*/
|
|
4032
|
+
properties: {
|
|
4033
|
+
[k: string]: {
|
|
4034
|
+
/**
|
|
4035
|
+
* The data type of the parameter.
|
|
4036
|
+
*/
|
|
4037
|
+
type: string;
|
|
4038
|
+
/**
|
|
4039
|
+
* A description of the expected parameter.
|
|
4040
|
+
*/
|
|
4041
|
+
description: string;
|
|
4042
|
+
};
|
|
4043
|
+
};
|
|
4044
|
+
};
|
|
4045
|
+
};
|
|
4046
|
+
}
|
|
4047
|
+
)[];
|
|
4048
|
+
/**
|
|
4049
|
+
* If true, the response will be streamed back incrementally.
|
|
4050
|
+
*/
|
|
4051
|
+
stream?: boolean;
|
|
4052
|
+
/**
|
|
4053
|
+
* The maximum number of tokens to generate in the response.
|
|
4054
|
+
*/
|
|
4055
|
+
max_tokens?: number;
|
|
4056
|
+
/**
|
|
4057
|
+
* Controls the randomness of the output; higher values produce more random results.
|
|
4058
|
+
*/
|
|
4059
|
+
temperature?: number;
|
|
4060
|
+
/**
|
|
4061
|
+
* 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.
|
|
4062
|
+
*/
|
|
4063
|
+
top_p?: number;
|
|
4064
|
+
/**
|
|
4065
|
+
* 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.
|
|
4066
|
+
*/
|
|
4067
|
+
top_k?: number;
|
|
4068
|
+
/**
|
|
4069
|
+
* Random seed for reproducibility of the generation.
|
|
4070
|
+
*/
|
|
4071
|
+
seed?: number;
|
|
4072
|
+
/**
|
|
4073
|
+
* Penalty for repeated tokens; higher values discourage repetition.
|
|
4074
|
+
*/
|
|
4075
|
+
repetition_penalty?: number;
|
|
4076
|
+
/**
|
|
4077
|
+
* Decreases the likelihood of the model repeating the same lines verbatim.
|
|
4078
|
+
*/
|
|
4079
|
+
frequency_penalty?: number;
|
|
4080
|
+
/**
|
|
4081
|
+
* Increases the likelihood of the model introducing new topics.
|
|
4082
|
+
*/
|
|
4083
|
+
presence_penalty?: number;
|
|
4084
|
+
}
|
|
4085
|
+
export type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output =
|
|
4086
|
+
| {
|
|
4087
|
+
/**
|
|
4088
|
+
* The generated text response from the model
|
|
4089
|
+
*/
|
|
4090
|
+
response?: string;
|
|
4091
|
+
/**
|
|
4092
|
+
* An array of tool calls requests made during the response generation
|
|
4093
|
+
*/
|
|
4094
|
+
tool_calls?: {
|
|
4095
|
+
/**
|
|
4096
|
+
* The arguments passed to be passed to the tool call request
|
|
4097
|
+
*/
|
|
4098
|
+
arguments?: object;
|
|
4099
|
+
/**
|
|
4100
|
+
* The name of the tool to be called
|
|
4101
|
+
*/
|
|
4102
|
+
name?: string;
|
|
4103
|
+
}[];
|
|
4104
|
+
}
|
|
4105
|
+
| ReadableStream;
|
|
4106
|
+
export declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {
|
|
4107
|
+
inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;
|
|
4108
|
+
postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;
|
|
4109
|
+
}
|
|
4110
|
+
export interface AiModels {
|
|
4111
|
+
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
4112
|
+
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
4113
|
+
"@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage;
|
|
4114
|
+
"@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage;
|
|
4115
|
+
"@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage;
|
|
4116
|
+
"@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage;
|
|
4117
|
+
"@cf/baai/bge-base-en-v1.5": BaseAiTextEmbeddings;
|
|
4118
|
+
"@cf/baai/bge-small-en-v1.5": BaseAiTextEmbeddings;
|
|
4119
|
+
"@cf/baai/bge-large-en-v1.5": BaseAiTextEmbeddings;
|
|
4120
|
+
"@cf/microsoft/resnet-50": BaseAiImageClassification;
|
|
4121
|
+
"@cf/facebook/detr-resnet-50": BaseAiObjectDetection;
|
|
4122
|
+
"@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration;
|
|
4123
|
+
"@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration;
|
|
4124
|
+
"@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration;
|
|
4125
|
+
"@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration;
|
|
4126
|
+
"@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration;
|
|
4127
|
+
"@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
|
|
4128
|
+
"@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
|
|
4129
|
+
"@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
|
|
4130
|
+
"@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
|
|
4131
|
+
"@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
|
|
4132
|
+
"@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
|
|
4133
|
+
"@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
|
|
4134
|
+
"@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration;
|
|
4135
|
+
"@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration;
|
|
4136
|
+
"@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration;
|
|
4137
|
+
"@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration;
|
|
4138
|
+
"@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration;
|
|
4139
|
+
"@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration;
|
|
4140
|
+
"@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration;
|
|
4141
|
+
"@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration;
|
|
4142
|
+
"@cf/microsoft/phi-2": BaseAiTextGeneration;
|
|
4143
|
+
"@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration;
|
|
4144
|
+
"@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration;
|
|
4145
|
+
"@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration;
|
|
4146
|
+
"@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration;
|
|
4147
|
+
"@hf/google/gemma-7b-it": BaseAiTextGeneration;
|
|
4148
|
+
"@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration;
|
|
4149
|
+
"@cf/google/gemma-2b-it-lora": BaseAiTextGeneration;
|
|
4150
|
+
"@cf/google/gemma-7b-it-lora": BaseAiTextGeneration;
|
|
4151
|
+
"@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration;
|
|
4152
|
+
"@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration;
|
|
4153
|
+
"@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration;
|
|
4154
|
+
"@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration;
|
|
4155
|
+
"@hf/meta-llama/meta-llama-3-8b-instruct": BaseAiTextGeneration;
|
|
4156
|
+
"@cf/meta/llama-3.1-8b-instruct": BaseAiTextGeneration;
|
|
4157
|
+
"@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration;
|
|
4158
|
+
"@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration;
|
|
4159
|
+
"@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration;
|
|
4160
|
+
"@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration;
|
|
4161
|
+
"@cf/meta/llama-3.3-70b-instruct-fp8-fast": BaseAiTextGeneration;
|
|
4162
|
+
"@cf/meta/m2m100-1.2b": BaseAiTranslation;
|
|
4163
|
+
"@cf/facebook/bart-large-cnn": BaseAiSummarization;
|
|
4164
|
+
"@cf/unum/uform-gen2-qwen-500m": BaseAiImageToText;
|
|
4165
|
+
"@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText;
|
|
4166
|
+
"@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper;
|
|
4167
|
+
"@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En;
|
|
4168
|
+
"@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;
|
|
4169
|
+
"@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;
|
|
4170
|
+
"@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;
|
|
4171
|
+
}
|
|
4172
|
+
export type AiOptions = {
|
|
4173
|
+
gateway?: GatewayOptions;
|
|
4174
|
+
prefix?: string;
|
|
4175
|
+
extraHeaders?: object;
|
|
4176
|
+
};
|
|
4177
|
+
export type AiModelsSearchParams = {
|
|
4178
|
+
author?: string;
|
|
4179
|
+
hide_experimental?: boolean;
|
|
4180
|
+
page?: number;
|
|
4181
|
+
per_page?: number;
|
|
4182
|
+
search?: string;
|
|
4183
|
+
source?: number;
|
|
4184
|
+
task?: string;
|
|
4185
|
+
};
|
|
4186
|
+
export type AiModelsSearchObject = {
|
|
4187
|
+
id: string;
|
|
4188
|
+
source: number;
|
|
4189
|
+
name: string;
|
|
4190
|
+
description: string;
|
|
4191
|
+
task: {
|
|
4192
|
+
id: string;
|
|
4193
|
+
name: string;
|
|
4194
|
+
description: string;
|
|
4195
|
+
};
|
|
4196
|
+
tags: string[];
|
|
4197
|
+
properties: {
|
|
4198
|
+
property_id: string;
|
|
4199
|
+
value: string;
|
|
4200
|
+
}[];
|
|
4201
|
+
};
|
|
4202
|
+
export interface InferenceUpstreamError extends Error {}
|
|
4203
|
+
export interface AiInternalError extends Error {}
|
|
4204
|
+
export type AiModelListType = Record<string, any>;
|
|
4205
|
+
export declare abstract class Ai<
|
|
4206
|
+
AiModelList extends AiModelListType = AiModels,
|
|
4207
|
+
> {
|
|
4208
|
+
aiGatewayLogId: string | null;
|
|
4209
|
+
gateway(gatewayId: string): AiGateway;
|
|
4210
|
+
run<Name extends keyof AiModelList>(
|
|
4211
|
+
model: Name,
|
|
4212
|
+
inputs: AiModelList[Name]["inputs"],
|
|
4213
|
+
options?: AiOptions,
|
|
4214
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
4215
|
+
public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
4216
|
+
}
|
|
3528
4217
|
export type GatewayOptions = {
|
|
3529
4218
|
id: string;
|
|
4219
|
+
cacheKey?: string;
|
|
3530
4220
|
cacheTtl?: number;
|
|
3531
4221
|
skipCache?: boolean;
|
|
3532
4222
|
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
4223
|
+
collectLog?: boolean;
|
|
3533
4224
|
};
|
|
3534
|
-
export type
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
4225
|
+
export type AiGatewayPatchLog = {
|
|
4226
|
+
score?: number | null;
|
|
4227
|
+
feedback?: -1 | 1 | null;
|
|
4228
|
+
metadata?: Record<string, number | string | boolean | null | bigint> | null;
|
|
3538
4229
|
};
|
|
3539
|
-
export type
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
| "
|
|
3568
|
-
| "
|
|
3569
|
-
| "
|
|
3570
|
-
| "
|
|
3571
|
-
| "
|
|
3572
|
-
| "
|
|
3573
|
-
| "
|
|
3574
|
-
| "
|
|
3575
|
-
| "
|
|
3576
|
-
| "
|
|
3577
|
-
| "
|
|
3578
|
-
| "
|
|
3579
|
-
| "
|
|
3580
|
-
| "
|
|
3581
|
-
| "
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
): Promise<
|
|
3614
|
-
run(
|
|
3615
|
-
model: BaseAiSpeechRecognitionModels,
|
|
3616
|
-
inputs: BaseAiSpeechRecognition["inputs"],
|
|
3617
|
-
options?: AiOptions,
|
|
3618
|
-
): Promise<BaseAiSpeechRecognition["postProcessedOutputs"]>;
|
|
3619
|
-
run(
|
|
3620
|
-
model: BaseAiImageClassificationModels,
|
|
3621
|
-
inputs: BaseAiImageClassification["inputs"],
|
|
3622
|
-
options?: AiOptions,
|
|
3623
|
-
): Promise<BaseAiImageClassification["postProcessedOutputs"]>;
|
|
3624
|
-
run(
|
|
3625
|
-
model: BaseAiObjectDetectionModels,
|
|
3626
|
-
inputs: BaseAiObjectDetection["inputs"],
|
|
3627
|
-
options?: AiOptions,
|
|
3628
|
-
): Promise<BaseAiObjectDetection["postProcessedOutputs"]>;
|
|
3629
|
-
run(
|
|
3630
|
-
model: BaseAiTextGenerationModels,
|
|
3631
|
-
inputs: BaseAiTextGeneration["inputs"],
|
|
3632
|
-
options?: AiOptions,
|
|
3633
|
-
): Promise<BaseAiTextGeneration["postProcessedOutputs"]>;
|
|
3634
|
-
run(
|
|
3635
|
-
model: BaseAiTranslationModels,
|
|
3636
|
-
inputs: BaseAiTranslation["inputs"],
|
|
3637
|
-
options?: AiOptions,
|
|
3638
|
-
): Promise<BaseAiTranslation["postProcessedOutputs"]>;
|
|
3639
|
-
run(
|
|
3640
|
-
model: BaseAiSummarizationModels,
|
|
3641
|
-
inputs: BaseAiSummarization["inputs"],
|
|
3642
|
-
options?: AiOptions,
|
|
3643
|
-
): Promise<BaseAiSummarization["postProcessedOutputs"]>;
|
|
4230
|
+
export type AiGatewayLog = {
|
|
4231
|
+
id: string;
|
|
4232
|
+
provider: string;
|
|
4233
|
+
model: string;
|
|
4234
|
+
model_type?: string;
|
|
4235
|
+
path: string;
|
|
4236
|
+
duration: number;
|
|
4237
|
+
request_type?: string;
|
|
4238
|
+
request_content_type?: string;
|
|
4239
|
+
status_code: number;
|
|
4240
|
+
response_content_type?: string;
|
|
4241
|
+
success: boolean;
|
|
4242
|
+
cached: boolean;
|
|
4243
|
+
tokens_in?: number;
|
|
4244
|
+
tokens_out?: number;
|
|
4245
|
+
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
4246
|
+
step?: number;
|
|
4247
|
+
cost?: number;
|
|
4248
|
+
custom_cost?: boolean;
|
|
4249
|
+
request_size: number;
|
|
4250
|
+
request_head?: string;
|
|
4251
|
+
request_head_complete: boolean;
|
|
4252
|
+
response_size: number;
|
|
4253
|
+
response_head?: string;
|
|
4254
|
+
response_head_complete: boolean;
|
|
4255
|
+
created_at: Date;
|
|
4256
|
+
};
|
|
4257
|
+
export type AIGatewayProviders =
|
|
4258
|
+
| "workers-ai"
|
|
4259
|
+
| "anthropic"
|
|
4260
|
+
| "aws-bedrock"
|
|
4261
|
+
| "azure-openai"
|
|
4262
|
+
| "google-vertex-ai"
|
|
4263
|
+
| "huggingface"
|
|
4264
|
+
| "openai"
|
|
4265
|
+
| "perplexity-ai"
|
|
4266
|
+
| "replicate"
|
|
4267
|
+
| "groq"
|
|
4268
|
+
| "cohere"
|
|
4269
|
+
| "google-ai-studio"
|
|
4270
|
+
| "mistral"
|
|
4271
|
+
| "grok"
|
|
4272
|
+
| "openrouter";
|
|
4273
|
+
export type AIGatewayHeaders = {
|
|
4274
|
+
"cf-aig-metadata":
|
|
4275
|
+
| Record<string, number | string | boolean | null | bigint>
|
|
4276
|
+
| string;
|
|
4277
|
+
"cf-aig-custom-cost":
|
|
4278
|
+
| {
|
|
4279
|
+
per_token_in?: number;
|
|
4280
|
+
per_token_out?: number;
|
|
4281
|
+
}
|
|
4282
|
+
| {
|
|
4283
|
+
total_cost?: number;
|
|
4284
|
+
}
|
|
4285
|
+
| string;
|
|
4286
|
+
"cf-aig-cache-ttl": number | string;
|
|
4287
|
+
"cf-aig-skip-cache": boolean | string;
|
|
4288
|
+
"cf-aig-cache-key": string;
|
|
4289
|
+
"cf-aig-collect-log": boolean | string;
|
|
4290
|
+
Authorization: string;
|
|
4291
|
+
"Content-Type": string;
|
|
4292
|
+
[key: string]: string | number | boolean | object;
|
|
4293
|
+
};
|
|
4294
|
+
export type AIGatewayUniversalRequest = {
|
|
4295
|
+
provider: AIGatewayProviders | string; // eslint-disable-line
|
|
4296
|
+
endpoint: string;
|
|
4297
|
+
headers: Partial<AIGatewayHeaders>;
|
|
4298
|
+
query: unknown;
|
|
4299
|
+
};
|
|
4300
|
+
export interface AiGatewayInternalError extends Error {}
|
|
4301
|
+
export interface AiGatewayLogNotFound extends Error {}
|
|
4302
|
+
export declare abstract class AiGateway {
|
|
4303
|
+
patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
|
|
4304
|
+
getLog(logId: string): Promise<AiGatewayLog>;
|
|
3644
4305
|
run(
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
options?: AiOptions,
|
|
3648
|
-
): Promise<BaseAiImageToText["postProcessedOutputs"]>;
|
|
4306
|
+
data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
|
|
4307
|
+
): Promise<Response>;
|
|
3649
4308
|
}
|
|
3650
4309
|
export interface BasicImageTransformations {
|
|
3651
4310
|
/**
|
|
@@ -4663,7 +5322,7 @@ export declare abstract class D1PreparedStatement {
|
|
|
4663
5322
|
bind(...values: unknown[]): D1PreparedStatement;
|
|
4664
5323
|
first<T = unknown>(colName: string): Promise<T | null>;
|
|
4665
5324
|
first<T = Record<string, unknown>>(): Promise<T | null>;
|
|
4666
|
-
run(): Promise<
|
|
5325
|
+
run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
|
|
4667
5326
|
all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
|
|
4668
5327
|
raw<T = unknown[]>(options: {
|
|
4669
5328
|
columnNames: true;
|
|
@@ -4719,6 +5378,12 @@ export interface ForwardableEmailMessage extends EmailMessage {
|
|
|
4719
5378
|
* @returns A promise that resolves when the email message is forwarded.
|
|
4720
5379
|
*/
|
|
4721
5380
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
5381
|
+
/**
|
|
5382
|
+
* Reply to the sender of this email message with a new EmailMessage object.
|
|
5383
|
+
* @param message The reply message.
|
|
5384
|
+
* @returns A promise that resolves when the email message is replied.
|
|
5385
|
+
*/
|
|
5386
|
+
reply(message: EmailMessage): Promise<void>;
|
|
4722
5387
|
}
|
|
4723
5388
|
/**
|
|
4724
5389
|
* A binding that allows a Worker to send email messages.
|
|
@@ -4781,6 +5446,128 @@ export interface Hyperdrive {
|
|
|
4781
5446
|
*/
|
|
4782
5447
|
readonly database: string;
|
|
4783
5448
|
}
|
|
5449
|
+
// Copyright (c) 2024 Cloudflare, Inc.
|
|
5450
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5451
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5452
|
+
export type ImageInfoResponse =
|
|
5453
|
+
| {
|
|
5454
|
+
format: "image/svg+xml";
|
|
5455
|
+
}
|
|
5456
|
+
| {
|
|
5457
|
+
format: string;
|
|
5458
|
+
fileSize: number;
|
|
5459
|
+
width: number;
|
|
5460
|
+
height: number;
|
|
5461
|
+
};
|
|
5462
|
+
export type ImageTransform = {
|
|
5463
|
+
fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
|
|
5464
|
+
gravity?:
|
|
5465
|
+
| "left"
|
|
5466
|
+
| "right"
|
|
5467
|
+
| "top"
|
|
5468
|
+
| "bottom"
|
|
5469
|
+
| "center"
|
|
5470
|
+
| "auto"
|
|
5471
|
+
| "entropy"
|
|
5472
|
+
| "face"
|
|
5473
|
+
| {
|
|
5474
|
+
x?: number;
|
|
5475
|
+
y?: number;
|
|
5476
|
+
mode: "remainder" | "box-center";
|
|
5477
|
+
};
|
|
5478
|
+
trim?: {
|
|
5479
|
+
top?: number;
|
|
5480
|
+
bottom?: number;
|
|
5481
|
+
left?: number;
|
|
5482
|
+
right?: number;
|
|
5483
|
+
width?: number;
|
|
5484
|
+
height?: number;
|
|
5485
|
+
border?:
|
|
5486
|
+
| boolean
|
|
5487
|
+
| {
|
|
5488
|
+
color?: string;
|
|
5489
|
+
tolerance?: number;
|
|
5490
|
+
keep?: number;
|
|
5491
|
+
};
|
|
5492
|
+
};
|
|
5493
|
+
width?: number;
|
|
5494
|
+
height?: number;
|
|
5495
|
+
background?: string;
|
|
5496
|
+
rotate?: number;
|
|
5497
|
+
sharpen?: number;
|
|
5498
|
+
blur?: number;
|
|
5499
|
+
contrast?: number;
|
|
5500
|
+
brightness?: number;
|
|
5501
|
+
gamma?: number;
|
|
5502
|
+
border?: {
|
|
5503
|
+
color?: string;
|
|
5504
|
+
width?: number;
|
|
5505
|
+
top?: number;
|
|
5506
|
+
bottom?: number;
|
|
5507
|
+
left?: number;
|
|
5508
|
+
right?: number;
|
|
5509
|
+
};
|
|
5510
|
+
zoom?: number;
|
|
5511
|
+
};
|
|
5512
|
+
export type ImageOutputOptions = {
|
|
5513
|
+
format:
|
|
5514
|
+
| "image/jpeg"
|
|
5515
|
+
| "image/png"
|
|
5516
|
+
| "image/gif"
|
|
5517
|
+
| "image/webp"
|
|
5518
|
+
| "image/avif"
|
|
5519
|
+
| "rgb"
|
|
5520
|
+
| "rgba";
|
|
5521
|
+
quality?: number;
|
|
5522
|
+
background?: string;
|
|
5523
|
+
};
|
|
5524
|
+
export interface ImagesBinding {
|
|
5525
|
+
/**
|
|
5526
|
+
* Get image metadata (type, width and height)
|
|
5527
|
+
* @throws {@link ImagesError} with code 9412 if input is not an image
|
|
5528
|
+
* @param stream The image bytes
|
|
5529
|
+
*/
|
|
5530
|
+
info(stream: ReadableStream<Uint8Array>): Promise<ImageInfoResponse>;
|
|
5531
|
+
/**
|
|
5532
|
+
* Begin applying a series of transformations to an image
|
|
5533
|
+
* @param stream The image bytes
|
|
5534
|
+
* @returns A transform handle
|
|
5535
|
+
*/
|
|
5536
|
+
input(stream: ReadableStream<Uint8Array>): ImageTransformer;
|
|
5537
|
+
}
|
|
5538
|
+
export interface ImageTransformer {
|
|
5539
|
+
/**
|
|
5540
|
+
* Apply transform next, returning a transform handle.
|
|
5541
|
+
* You can then apply more transformations or retrieve the output.
|
|
5542
|
+
* @param transform
|
|
5543
|
+
*/
|
|
5544
|
+
transform(transform: ImageTransform): ImageTransformer;
|
|
5545
|
+
/**
|
|
5546
|
+
* Retrieve the image that results from applying the transforms to the
|
|
5547
|
+
* provided input
|
|
5548
|
+
* @param options Options that apply to the output e.g. output format
|
|
5549
|
+
*/
|
|
5550
|
+
output(options: ImageOutputOptions): Promise<ImageTransformationResult>;
|
|
5551
|
+
}
|
|
5552
|
+
export interface ImageTransformationResult {
|
|
5553
|
+
/**
|
|
5554
|
+
* The image as a response, ready to store in cache or return to users
|
|
5555
|
+
*/
|
|
5556
|
+
response(): Response;
|
|
5557
|
+
/**
|
|
5558
|
+
* The content type of the returned image
|
|
5559
|
+
*/
|
|
5560
|
+
contentType(): string;
|
|
5561
|
+
/**
|
|
5562
|
+
* The bytes of the response
|
|
5563
|
+
*/
|
|
5564
|
+
image(): ReadableStream<Uint8Array>;
|
|
5565
|
+
}
|
|
5566
|
+
export interface ImagesError extends Error {
|
|
5567
|
+
readonly code: number;
|
|
5568
|
+
readonly message: string;
|
|
5569
|
+
readonly stack?: string;
|
|
5570
|
+
}
|
|
4784
5571
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
4785
5572
|
export type EventContext<Env, P extends string, Data> = {
|
|
4786
5573
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -4824,6 +5611,30 @@ export type PagesPluginFunction<
|
|
|
4824
5611
|
> = (
|
|
4825
5612
|
context: EventPluginContext<Env, Params, Data, PluginArgs>,
|
|
4826
5613
|
) => Response | Promise<Response>;
|
|
5614
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5615
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5616
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5617
|
+
export declare abstract class PipelineTransform {
|
|
5618
|
+
/**
|
|
5619
|
+
* transformJson recieves an array of javascript objects which can be
|
|
5620
|
+
* mutated and returned to the pipeline
|
|
5621
|
+
* @param data The data to be mutated
|
|
5622
|
+
* @returns A promise containing the mutated data
|
|
5623
|
+
*/
|
|
5624
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
5625
|
+
}
|
|
5626
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5627
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5628
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5629
|
+
export interface Pipeline {
|
|
5630
|
+
/**
|
|
5631
|
+
* send takes an array of javascript objects which are
|
|
5632
|
+
* then received by the pipeline for processing
|
|
5633
|
+
*
|
|
5634
|
+
* @param data The data to be sent
|
|
5635
|
+
*/
|
|
5636
|
+
send(data: object[]): Promise<void>;
|
|
5637
|
+
}
|
|
4827
5638
|
// PubSubMessage represents an incoming PubSub message.
|
|
4828
5639
|
// The message includes metadata about the broker, the client, and the payload
|
|
4829
5640
|
// itself.
|
|
@@ -4884,6 +5695,7 @@ export declare namespace Rpc {
|
|
|
4884
5695
|
export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
|
|
4885
5696
|
export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
|
|
4886
5697
|
export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
|
|
5698
|
+
export const __WORKFLOW_ENTRYPOINT_BRAND: "__WORKFLOW_ENTRYPOINT_BRAND";
|
|
4887
5699
|
export interface RpcTargetBranded {
|
|
4888
5700
|
[__RPC_TARGET_BRAND]: never;
|
|
4889
5701
|
}
|
|
@@ -4893,13 +5705,20 @@ export declare namespace Rpc {
|
|
|
4893
5705
|
export interface DurableObjectBranded {
|
|
4894
5706
|
[__DURABLE_OBJECT_BRAND]: never;
|
|
4895
5707
|
}
|
|
5708
|
+
export interface WorkflowEntrypointBranded {
|
|
5709
|
+
[__WORKFLOW_ENTRYPOINT_BRAND]: never;
|
|
5710
|
+
}
|
|
4896
5711
|
export type EntrypointBranded =
|
|
4897
5712
|
| WorkerEntrypointBranded
|
|
4898
|
-
| DurableObjectBranded
|
|
5713
|
+
| DurableObjectBranded
|
|
5714
|
+
| WorkflowEntrypointBranded;
|
|
4899
5715
|
// Types that can be used through `Stub`s
|
|
4900
5716
|
export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
|
|
4901
5717
|
// Types that can be passed over RPC
|
|
4902
|
-
type
|
|
5718
|
+
// The reason for using a generic type here is to build a serializable subset of structured
|
|
5719
|
+
// cloneable composite types. This allows types defined with the "interface" keyword to pass the
|
|
5720
|
+
// serializable check as well. Otherwise, only types defined with the "type" keyword would pass.
|
|
5721
|
+
type Serializable<T> =
|
|
4903
5722
|
// Structured cloneables
|
|
4904
5723
|
| void
|
|
4905
5724
|
| undefined
|
|
@@ -4915,11 +5734,14 @@ export declare namespace Rpc {
|
|
|
4915
5734
|
| Error
|
|
4916
5735
|
| RegExp
|
|
4917
5736
|
// Structured cloneable composites
|
|
4918
|
-
| Map<
|
|
4919
|
-
|
|
4920
|
-
|
|
5737
|
+
| Map<
|
|
5738
|
+
T extends Map<infer U, unknown> ? Serializable<U> : never,
|
|
5739
|
+
T extends Map<unknown, infer U> ? Serializable<U> : never
|
|
5740
|
+
>
|
|
5741
|
+
| Set<T extends Set<infer U> ? Serializable<U> : never>
|
|
5742
|
+
| ReadonlyArray<T extends ReadonlyArray<infer U> ? Serializable<U> : never>
|
|
4921
5743
|
| {
|
|
4922
|
-
[
|
|
5744
|
+
[K in keyof T]: K extends number | string ? Serializable<T[K]> : never;
|
|
4923
5745
|
}
|
|
4924
5746
|
// Special types
|
|
4925
5747
|
| ReadableStream<Uint8Array>
|
|
@@ -4949,7 +5771,7 @@ export declare namespace Rpc {
|
|
|
4949
5771
|
: T extends ReadonlyArray<infer V>
|
|
4950
5772
|
? ReadonlyArray<Stubify<V>>
|
|
4951
5773
|
: T extends {
|
|
4952
|
-
[key: string | number]:
|
|
5774
|
+
[key: string | number]: any;
|
|
4953
5775
|
}
|
|
4954
5776
|
? {
|
|
4955
5777
|
[K in keyof T]: Stubify<T[K]>;
|
|
@@ -4992,7 +5814,7 @@ export declare namespace Rpc {
|
|
|
4992
5814
|
// Intersecting with `(Maybe)Provider` allows pipelining.
|
|
4993
5815
|
type Result<R> = R extends Stubable
|
|
4994
5816
|
? Promise<Stub<R>> & Provider<R>
|
|
4995
|
-
: R extends Serializable
|
|
5817
|
+
: R extends Serializable<R>
|
|
4996
5818
|
? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R>
|
|
4997
5819
|
: never;
|
|
4998
5820
|
// Type for method or property on an RPC interface.
|
|
@@ -5021,6 +5843,198 @@ export declare namespace Rpc {
|
|
|
5021
5843
|
>]: MethodOrProperty<T[K]>;
|
|
5022
5844
|
};
|
|
5023
5845
|
}
|
|
5846
|
+
export declare namespace TailStream {
|
|
5847
|
+
interface Header {
|
|
5848
|
+
readonly name: string;
|
|
5849
|
+
readonly value: string;
|
|
5850
|
+
}
|
|
5851
|
+
interface FetchEventInfo {
|
|
5852
|
+
readonly type: "fetch";
|
|
5853
|
+
readonly method: string;
|
|
5854
|
+
readonly url: string;
|
|
5855
|
+
readonly cfJson: string;
|
|
5856
|
+
readonly headers: Header[];
|
|
5857
|
+
}
|
|
5858
|
+
interface JsRpcEventInfo {
|
|
5859
|
+
readonly type: "jsrpc";
|
|
5860
|
+
readonly methodName: string;
|
|
5861
|
+
}
|
|
5862
|
+
interface ScheduledEventInfo {
|
|
5863
|
+
readonly type: "scheduled";
|
|
5864
|
+
readonly scheduledTime: Date;
|
|
5865
|
+
readonly cron: string;
|
|
5866
|
+
}
|
|
5867
|
+
interface AlarmEventInfo {
|
|
5868
|
+
readonly type: "alarm";
|
|
5869
|
+
readonly scheduledTime: Date;
|
|
5870
|
+
}
|
|
5871
|
+
interface QueueEventInfo {
|
|
5872
|
+
readonly type: "queue";
|
|
5873
|
+
readonly queueName: string;
|
|
5874
|
+
readonly batchSize: number;
|
|
5875
|
+
}
|
|
5876
|
+
interface EmailEventInfo {
|
|
5877
|
+
readonly type: "email";
|
|
5878
|
+
readonly mailFrom: string;
|
|
5879
|
+
readonly rcptTo: string;
|
|
5880
|
+
readonly rawSize: number;
|
|
5881
|
+
}
|
|
5882
|
+
interface TraceEventInfo {
|
|
5883
|
+
readonly type: "trace";
|
|
5884
|
+
readonly traces: (string | null)[];
|
|
5885
|
+
}
|
|
5886
|
+
interface HibernatableWebSocketEventInfoMessage {
|
|
5887
|
+
readonly type: "message";
|
|
5888
|
+
}
|
|
5889
|
+
interface HibernatableWebSocketEventInfoError {
|
|
5890
|
+
readonly type: "error";
|
|
5891
|
+
}
|
|
5892
|
+
interface HibernatableWebSocketEventInfoClose {
|
|
5893
|
+
readonly type: "close";
|
|
5894
|
+
readonly code: number;
|
|
5895
|
+
readonly wasClean: boolean;
|
|
5896
|
+
}
|
|
5897
|
+
interface HibernatableWebSocketEventInfo {
|
|
5898
|
+
readonly type: "hibernatableWebSocket";
|
|
5899
|
+
readonly info:
|
|
5900
|
+
| HibernatableWebSocketEventInfoClose
|
|
5901
|
+
| HibernatableWebSocketEventInfoError
|
|
5902
|
+
| HibernatableWebSocketEventInfoMessage;
|
|
5903
|
+
}
|
|
5904
|
+
interface Resume {
|
|
5905
|
+
readonly type: "resume";
|
|
5906
|
+
readonly attachment?: any;
|
|
5907
|
+
}
|
|
5908
|
+
interface CustomEventInfo {
|
|
5909
|
+
readonly type: "custom";
|
|
5910
|
+
}
|
|
5911
|
+
interface FetchResponseInfo {
|
|
5912
|
+
readonly type: "fetch";
|
|
5913
|
+
readonly statusCode: number;
|
|
5914
|
+
}
|
|
5915
|
+
type EventOutcome =
|
|
5916
|
+
| "ok"
|
|
5917
|
+
| "canceled"
|
|
5918
|
+
| "exception"
|
|
5919
|
+
| "unknown"
|
|
5920
|
+
| "killSwitch"
|
|
5921
|
+
| "daemonDown"
|
|
5922
|
+
| "exceededCpu"
|
|
5923
|
+
| "exceededMemory"
|
|
5924
|
+
| "loadShed"
|
|
5925
|
+
| "responseStreamDisconnected"
|
|
5926
|
+
| "scriptNotFound";
|
|
5927
|
+
interface ScriptVersion {
|
|
5928
|
+
readonly id: string;
|
|
5929
|
+
readonly tag?: string;
|
|
5930
|
+
readonly message?: string;
|
|
5931
|
+
}
|
|
5932
|
+
interface Trigger {
|
|
5933
|
+
readonly traceId: string;
|
|
5934
|
+
readonly invocationId: string;
|
|
5935
|
+
readonly spanId: string;
|
|
5936
|
+
}
|
|
5937
|
+
interface Onset {
|
|
5938
|
+
readonly type: "onset";
|
|
5939
|
+
readonly dispatchNamespace?: string;
|
|
5940
|
+
readonly entrypoint?: string;
|
|
5941
|
+
readonly scriptName?: string;
|
|
5942
|
+
readonly scriptTags?: string[];
|
|
5943
|
+
readonly scriptVersion?: ScriptVersion;
|
|
5944
|
+
readonly trigger?: Trigger;
|
|
5945
|
+
readonly info:
|
|
5946
|
+
| FetchEventInfo
|
|
5947
|
+
| JsRpcEventInfo
|
|
5948
|
+
| ScheduledEventInfo
|
|
5949
|
+
| AlarmEventInfo
|
|
5950
|
+
| QueueEventInfo
|
|
5951
|
+
| EmailEventInfo
|
|
5952
|
+
| TraceEventInfo
|
|
5953
|
+
| HibernatableWebSocketEventInfo
|
|
5954
|
+
| Resume
|
|
5955
|
+
| CustomEventInfo;
|
|
5956
|
+
}
|
|
5957
|
+
interface Outcome {
|
|
5958
|
+
readonly type: "outcome";
|
|
5959
|
+
readonly outcome: EventOutcome;
|
|
5960
|
+
readonly cpuTime: number;
|
|
5961
|
+
readonly wallTime: number;
|
|
5962
|
+
}
|
|
5963
|
+
interface Hibernate {
|
|
5964
|
+
readonly type: "hibernate";
|
|
5965
|
+
}
|
|
5966
|
+
interface SpanOpen {
|
|
5967
|
+
readonly type: "spanOpen";
|
|
5968
|
+
readonly op?: string;
|
|
5969
|
+
readonly info?: FetchEventInfo | JsRpcEventInfo | Attribute[];
|
|
5970
|
+
}
|
|
5971
|
+
interface SpanClose {
|
|
5972
|
+
readonly type: "spanClose";
|
|
5973
|
+
readonly outcome: EventOutcome;
|
|
5974
|
+
}
|
|
5975
|
+
interface DiagnosticChannelEvent {
|
|
5976
|
+
readonly type: "diagnosticChannel";
|
|
5977
|
+
readonly channel: string;
|
|
5978
|
+
readonly message: any;
|
|
5979
|
+
}
|
|
5980
|
+
interface Exception {
|
|
5981
|
+
readonly type: "exception";
|
|
5982
|
+
readonly name: string;
|
|
5983
|
+
readonly message: string;
|
|
5984
|
+
readonly stack?: string;
|
|
5985
|
+
}
|
|
5986
|
+
interface Log {
|
|
5987
|
+
readonly type: "log";
|
|
5988
|
+
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
5989
|
+
readonly message: string;
|
|
5990
|
+
}
|
|
5991
|
+
interface Return {
|
|
5992
|
+
readonly type: "return";
|
|
5993
|
+
readonly info?: FetchResponseInfo | Attribute[];
|
|
5994
|
+
}
|
|
5995
|
+
interface Link {
|
|
5996
|
+
readonly type: "link";
|
|
5997
|
+
readonly label?: string;
|
|
5998
|
+
readonly traceId: string;
|
|
5999
|
+
readonly invocationId: string;
|
|
6000
|
+
readonly spanId: string;
|
|
6001
|
+
}
|
|
6002
|
+
interface Attribute {
|
|
6003
|
+
readonly type: "attribute";
|
|
6004
|
+
readonly name: string;
|
|
6005
|
+
readonly value: string | string[] | boolean | boolean[] | number | number[];
|
|
6006
|
+
}
|
|
6007
|
+
type Mark =
|
|
6008
|
+
| DiagnosticChannelEvent
|
|
6009
|
+
| Exception
|
|
6010
|
+
| Log
|
|
6011
|
+
| Return
|
|
6012
|
+
| Link
|
|
6013
|
+
| Attribute[];
|
|
6014
|
+
interface TailEvent {
|
|
6015
|
+
readonly traceId: string;
|
|
6016
|
+
readonly invocationId: string;
|
|
6017
|
+
readonly spanId: string;
|
|
6018
|
+
readonly timestamp: Date;
|
|
6019
|
+
readonly sequence: number;
|
|
6020
|
+
readonly event: Onset | Outcome | Hibernate | SpanOpen | SpanClose | Mark;
|
|
6021
|
+
}
|
|
6022
|
+
type TailEventHandler = (event: TailEvent) => void | Promise<void>;
|
|
6023
|
+
type TailEventHandlerName =
|
|
6024
|
+
| "onset"
|
|
6025
|
+
| "outcome"
|
|
6026
|
+
| "hibernate"
|
|
6027
|
+
| "spanOpen"
|
|
6028
|
+
| "spanClose"
|
|
6029
|
+
| "diagnosticChannel"
|
|
6030
|
+
| "exception"
|
|
6031
|
+
| "log"
|
|
6032
|
+
| "return"
|
|
6033
|
+
| "link"
|
|
6034
|
+
| "attribute";
|
|
6035
|
+
type TailEventHandlerObject = Record<TailEventHandlerName, TailEventHandler>;
|
|
6036
|
+
type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;
|
|
6037
|
+
}
|
|
5024
6038
|
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5025
6039
|
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5026
6040
|
// https://opensource.org/licenses/Apache-2.0
|
|
@@ -5064,11 +6078,21 @@ export type VectorizeVectorMetadataFilter = {
|
|
|
5064
6078
|
* Distance metrics determine how other "similar" vectors are determined.
|
|
5065
6079
|
*/
|
|
5066
6080
|
export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
|
|
6081
|
+
/**
|
|
6082
|
+
* Metadata return levels for a Vectorize query.
|
|
6083
|
+
*
|
|
6084
|
+
* Default to "none".
|
|
6085
|
+
*
|
|
6086
|
+
* @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.
|
|
6087
|
+
* @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).
|
|
6088
|
+
* @property none No indexed metadata will be returned.
|
|
6089
|
+
*/
|
|
6090
|
+
export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
|
|
5067
6091
|
export interface VectorizeQueryOptions {
|
|
5068
6092
|
topK?: number;
|
|
5069
6093
|
namespace?: string;
|
|
5070
6094
|
returnValues?: boolean;
|
|
5071
|
-
returnMetadata?: boolean;
|
|
6095
|
+
returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
|
|
5072
6096
|
filter?: VectorizeVectorMetadataFilter;
|
|
5073
6097
|
}
|
|
5074
6098
|
/**
|
|
@@ -5084,6 +6108,9 @@ export type VectorizeIndexConfig =
|
|
|
5084
6108
|
};
|
|
5085
6109
|
/**
|
|
5086
6110
|
* Metadata about an existing index.
|
|
6111
|
+
*
|
|
6112
|
+
* This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
|
|
6113
|
+
* See {@link VectorizeIndexInfo} for its post-beta equivalent.
|
|
5087
6114
|
*/
|
|
5088
6115
|
export interface VectorizeIndexDetails {
|
|
5089
6116
|
/** The unique ID of the index */
|
|
@@ -5097,6 +6124,19 @@ export interface VectorizeIndexDetails {
|
|
|
5097
6124
|
/** The number of records containing vectors within the index. */
|
|
5098
6125
|
vectorsCount: number;
|
|
5099
6126
|
}
|
|
6127
|
+
/**
|
|
6128
|
+
* Metadata about an existing index.
|
|
6129
|
+
*/
|
|
6130
|
+
export interface VectorizeIndexInfo {
|
|
6131
|
+
/** The number of records containing vectors within the index. */
|
|
6132
|
+
vectorCount: number;
|
|
6133
|
+
/** Number of dimensions the index has been configured for. */
|
|
6134
|
+
dimensions: number;
|
|
6135
|
+
/** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
|
|
6136
|
+
processedUpToDatetime: number;
|
|
6137
|
+
/** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
|
|
6138
|
+
processedUpToMutation: number;
|
|
6139
|
+
}
|
|
5100
6140
|
/**
|
|
5101
6141
|
* Represents a single vector value set along with its associated metadata.
|
|
5102
6142
|
*/
|
|
@@ -5107,7 +6147,7 @@ export interface VectorizeVector {
|
|
|
5107
6147
|
values: VectorFloatArray | number[];
|
|
5108
6148
|
/** The namespace this vector belongs to. */
|
|
5109
6149
|
namespace?: string;
|
|
5110
|
-
/** Metadata associated with the vector. Includes the values of
|
|
6150
|
+
/** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
|
|
5111
6151
|
metadata?: Record<string, VectorizeVectorMetadata>;
|
|
5112
6152
|
}
|
|
5113
6153
|
/**
|
|
@@ -5119,7 +6159,7 @@ export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
|
|
|
5119
6159
|
score: number;
|
|
5120
6160
|
};
|
|
5121
6161
|
/**
|
|
5122
|
-
* A set of
|
|
6162
|
+
* A set of matching {@link VectorizeMatch} for a particular query.
|
|
5123
6163
|
*/
|
|
5124
6164
|
export interface VectorizeMatches {
|
|
5125
6165
|
matches: VectorizeMatch[];
|
|
@@ -5128,6 +6168,9 @@ export interface VectorizeMatches {
|
|
|
5128
6168
|
/**
|
|
5129
6169
|
* Results of an operation that performed a mutation on a set of vectors.
|
|
5130
6170
|
* Here, `ids` is a list of vectors that were successfully processed.
|
|
6171
|
+
*
|
|
6172
|
+
* This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
|
|
6173
|
+
* See {@link VectorizeAsyncMutation} for its post-beta equivalent.
|
|
5131
6174
|
*/
|
|
5132
6175
|
export interface VectorizeVectorMutation {
|
|
5133
6176
|
/* List of ids of vectors that were successfully processed. */
|
|
@@ -5136,14 +6179,19 @@ export interface VectorizeVectorMutation {
|
|
|
5136
6179
|
count: number;
|
|
5137
6180
|
}
|
|
5138
6181
|
/**
|
|
5139
|
-
*
|
|
5140
|
-
*
|
|
5141
|
-
* Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
|
|
6182
|
+
* Result type indicating a mutation on the Vectorize Index.
|
|
6183
|
+
* Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
|
|
5142
6184
|
*/
|
|
5143
|
-
export interface
|
|
5144
|
-
|
|
6185
|
+
export interface VectorizeAsyncMutation {
|
|
6186
|
+
/** The unique identifier for the async mutation operation containing the changeset. */
|
|
5145
6187
|
mutationId: string;
|
|
5146
6188
|
}
|
|
6189
|
+
/**
|
|
6190
|
+
* A Vectorize Vector Search Index for querying vectors/embeddings.
|
|
6191
|
+
*
|
|
6192
|
+
* This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
|
|
6193
|
+
* See {@link Vectorize} for its new implementation.
|
|
6194
|
+
*/
|
|
5147
6195
|
export declare abstract class VectorizeIndex {
|
|
5148
6196
|
/**
|
|
5149
6197
|
* Get information about the currently bound index.
|
|
@@ -5158,7 +6206,7 @@ export declare abstract class VectorizeIndex {
|
|
|
5158
6206
|
*/
|
|
5159
6207
|
public query(
|
|
5160
6208
|
vector: VectorFloatArray | number[],
|
|
5161
|
-
options
|
|
6209
|
+
options?: VectorizeQueryOptions,
|
|
5162
6210
|
): Promise<VectorizeMatches>;
|
|
5163
6211
|
/**
|
|
5164
6212
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
@@ -5185,6 +6233,62 @@ export declare abstract class VectorizeIndex {
|
|
|
5185
6233
|
*/
|
|
5186
6234
|
public getByIds(ids: string[]): Promise<VectorizeVector[]>;
|
|
5187
6235
|
}
|
|
6236
|
+
/**
|
|
6237
|
+
* A Vectorize Vector Search Index for querying vectors/embeddings.
|
|
6238
|
+
*
|
|
6239
|
+
* Mutations in this version are async, returning a mutation id.
|
|
6240
|
+
*/
|
|
6241
|
+
export declare abstract class Vectorize {
|
|
6242
|
+
/**
|
|
6243
|
+
* Get information about the currently bound index.
|
|
6244
|
+
* @returns A promise that resolves with information about the current index.
|
|
6245
|
+
*/
|
|
6246
|
+
public describe(): Promise<VectorizeIndexInfo>;
|
|
6247
|
+
/**
|
|
6248
|
+
* Use the provided vector to perform a similarity search across the index.
|
|
6249
|
+
* @param vector Input vector that will be used to drive the similarity search.
|
|
6250
|
+
* @param options Configuration options to massage the returned data.
|
|
6251
|
+
* @returns A promise that resolves with matched and scored vectors.
|
|
6252
|
+
*/
|
|
6253
|
+
public query(
|
|
6254
|
+
vector: VectorFloatArray | number[],
|
|
6255
|
+
options?: VectorizeQueryOptions,
|
|
6256
|
+
): Promise<VectorizeMatches>;
|
|
6257
|
+
/**
|
|
6258
|
+
* Use the provided vector-id to perform a similarity search across the index.
|
|
6259
|
+
* @param vectorId Id for a vector in the index against which the index should be queried.
|
|
6260
|
+
* @param options Configuration options to massage the returned data.
|
|
6261
|
+
* @returns A promise that resolves with matched and scored vectors.
|
|
6262
|
+
*/
|
|
6263
|
+
public queryById(
|
|
6264
|
+
vectorId: string,
|
|
6265
|
+
options?: VectorizeQueryOptions,
|
|
6266
|
+
): Promise<VectorizeMatches>;
|
|
6267
|
+
/**
|
|
6268
|
+
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
6269
|
+
* @param vectors List of vectors that will be inserted.
|
|
6270
|
+
* @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
|
|
6271
|
+
*/
|
|
6272
|
+
public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
|
|
6273
|
+
/**
|
|
6274
|
+
* Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
|
|
6275
|
+
* @param vectors List of vectors that will be upserted.
|
|
6276
|
+
* @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
|
|
6277
|
+
*/
|
|
6278
|
+
public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
|
|
6279
|
+
/**
|
|
6280
|
+
* Delete a list of vectors with a matching id.
|
|
6281
|
+
* @param ids List of vector ids that should be deleted.
|
|
6282
|
+
* @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
|
|
6283
|
+
*/
|
|
6284
|
+
public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
|
|
6285
|
+
/**
|
|
6286
|
+
* Get a list of vectors with a matching id.
|
|
6287
|
+
* @param ids List of vector ids that should be returned.
|
|
6288
|
+
* @returns A promise that resolves with the raw unscored vectors matching the id set.
|
|
6289
|
+
*/
|
|
6290
|
+
public getByIds(ids: string[]): Promise<VectorizeVector[]>;
|
|
6291
|
+
}
|
|
5188
6292
|
/**
|
|
5189
6293
|
* The interface for "version_metadata" binding
|
|
5190
6294
|
* providing metadata about the Worker Version using this binding.
|
|
@@ -5235,3 +6339,70 @@ export interface DispatchNamespace {
|
|
|
5235
6339
|
options?: DynamicDispatchOptions,
|
|
5236
6340
|
): Fetcher;
|
|
5237
6341
|
}
|
|
6342
|
+
export declare abstract class Workflow<PARAMS = unknown> {
|
|
6343
|
+
/**
|
|
6344
|
+
* Get a handle to an existing instance of the Workflow.
|
|
6345
|
+
* @param id Id for the instance of this Workflow
|
|
6346
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
6347
|
+
*/
|
|
6348
|
+
public get(id: string): Promise<WorkflowInstance>;
|
|
6349
|
+
/**
|
|
6350
|
+
* Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.
|
|
6351
|
+
* @param options Options when creating an instance including id and params
|
|
6352
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
6353
|
+
*/
|
|
6354
|
+
public create(
|
|
6355
|
+
options?: WorkflowInstanceCreateOptions<PARAMS>,
|
|
6356
|
+
): Promise<WorkflowInstance>;
|
|
6357
|
+
}
|
|
6358
|
+
export interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
|
|
6359
|
+
/**
|
|
6360
|
+
* An id for your Workflow instance. Must be unique within the Workflow.
|
|
6361
|
+
*/
|
|
6362
|
+
id?: string;
|
|
6363
|
+
/**
|
|
6364
|
+
* The event payload the Workflow instance is triggered with
|
|
6365
|
+
*/
|
|
6366
|
+
params?: PARAMS;
|
|
6367
|
+
}
|
|
6368
|
+
export type InstanceStatus = {
|
|
6369
|
+
status:
|
|
6370
|
+
| "queued" // means that instance is waiting to be started (see concurrency limits)
|
|
6371
|
+
| "running"
|
|
6372
|
+
| "paused"
|
|
6373
|
+
| "errored"
|
|
6374
|
+
| "terminated" // user terminated the instance while it was running
|
|
6375
|
+
| "complete"
|
|
6376
|
+
| "waiting" // instance is hibernating and waiting for sleep or event to finish
|
|
6377
|
+
| "waitingForPause" // instance is finishing the current work to pause
|
|
6378
|
+
| "unknown";
|
|
6379
|
+
error?: string;
|
|
6380
|
+
output?: object;
|
|
6381
|
+
};
|
|
6382
|
+
export interface WorkflowError {
|
|
6383
|
+
code?: number;
|
|
6384
|
+
message: string;
|
|
6385
|
+
}
|
|
6386
|
+
export declare abstract class WorkflowInstance {
|
|
6387
|
+
public id: string;
|
|
6388
|
+
/**
|
|
6389
|
+
* Pause the instance.
|
|
6390
|
+
*/
|
|
6391
|
+
public pause(): Promise<void>;
|
|
6392
|
+
/**
|
|
6393
|
+
* Resume the instance. If it is already running, an error will be thrown.
|
|
6394
|
+
*/
|
|
6395
|
+
public resume(): Promise<void>;
|
|
6396
|
+
/**
|
|
6397
|
+
* Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
|
|
6398
|
+
*/
|
|
6399
|
+
public terminate(): Promise<void>;
|
|
6400
|
+
/**
|
|
6401
|
+
* Restart the instance.
|
|
6402
|
+
*/
|
|
6403
|
+
public restart(): Promise<void>;
|
|
6404
|
+
/**
|
|
6405
|
+
* Returns the current status of the instance.
|
|
6406
|
+
*/
|
|
6407
|
+
public status(): Promise<InstanceStatus>;
|
|
6408
|
+
}
|