@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/2022-03-21/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ and limitations under the License.
|
|
|
14
14
|
***************************************************************************** */
|
|
15
15
|
/* eslint-disable */
|
|
16
16
|
// noinspection JSUnusedGlobalSymbols
|
|
17
|
+
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 @@ 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 @@ 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 @@ declare function structuredClone<T>(
|
|
|
359
361
|
declare function reportError(error: any): void;
|
|
360
362
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
|
|
361
363
|
declare function fetch(
|
|
362
|
-
input: RequestInfo,
|
|
364
|
+
input: RequestInfo | URL,
|
|
363
365
|
init?: RequestInit<RequestInitCfProperties>,
|
|
364
366
|
): Promise<Response>;
|
|
365
367
|
declare const self: ServiceWorkerGlobalScope;
|
|
@@ -386,12 +388,14 @@ declare const scheduler: Scheduler;
|
|
|
386
388
|
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
387
389
|
*/
|
|
388
390
|
declare const performance: Performance;
|
|
391
|
+
declare const Cloudflare: Cloudflare;
|
|
389
392
|
declare const origin: string;
|
|
390
393
|
declare const navigator: Navigator;
|
|
391
394
|
interface TestController {}
|
|
392
395
|
interface ExecutionContext {
|
|
393
396
|
waitUntil(promise: Promise<any>): void;
|
|
394
397
|
passThroughOnException(): void;
|
|
398
|
+
props: any;
|
|
395
399
|
}
|
|
396
400
|
type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown> = (
|
|
397
401
|
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
@@ -408,6 +412,11 @@ type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
|
408
412
|
env: Env,
|
|
409
413
|
ctx: ExecutionContext,
|
|
410
414
|
) => void | Promise<void>;
|
|
415
|
+
type ExportedHandlerTailStreamHandler<Env = unknown> = (
|
|
416
|
+
event: TailStream.TailEvent,
|
|
417
|
+
env: Env,
|
|
418
|
+
ctx: ExecutionContext,
|
|
419
|
+
) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
|
|
411
420
|
type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
412
421
|
controller: ScheduledController,
|
|
413
422
|
env: Env,
|
|
@@ -431,6 +440,7 @@ interface ExportedHandler<
|
|
|
431
440
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
432
441
|
tail?: ExportedHandlerTailHandler<Env>;
|
|
433
442
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
443
|
+
tailStream?: ExportedHandlerTailStreamHandler<Env>;
|
|
434
444
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
435
445
|
test?: ExportedHandlerTestHandler<Env>;
|
|
436
446
|
email?: EmailExportedHandler<Env>;
|
|
@@ -454,8 +464,9 @@ declare abstract class Navigator {
|
|
|
454
464
|
| string
|
|
455
465
|
| (ArrayBuffer | ArrayBufferView)
|
|
456
466
|
| Blob
|
|
467
|
+
| FormData
|
|
457
468
|
| URLSearchParams
|
|
458
|
-
|
|
|
469
|
+
| URLSearchParams,
|
|
459
470
|
): boolean;
|
|
460
471
|
readonly userAgent: string;
|
|
461
472
|
readonly gpu: GPU;
|
|
@@ -476,9 +487,12 @@ interface AlarmInvocationInfo {
|
|
|
476
487
|
readonly isRetry: boolean;
|
|
477
488
|
readonly retryCount: number;
|
|
478
489
|
}
|
|
490
|
+
interface Cloudflare {
|
|
491
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
492
|
+
}
|
|
479
493
|
interface DurableObject {
|
|
480
494
|
fetch(request: Request): Response | Promise<Response>;
|
|
481
|
-
alarm?(): void | Promise<void>;
|
|
495
|
+
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
|
|
482
496
|
webSocketMessage?(
|
|
483
497
|
ws: WebSocket,
|
|
484
498
|
message: string | ArrayBuffer,
|
|
@@ -551,6 +565,7 @@ interface DurableObjectState {
|
|
|
551
565
|
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
|
|
552
566
|
getHibernatableWebSocketEventTimeout(): number | null;
|
|
553
567
|
getTags(ws: WebSocket): string[];
|
|
568
|
+
abort(reason?: string): void;
|
|
554
569
|
}
|
|
555
570
|
interface DurableObjectTransaction {
|
|
556
571
|
get<T = unknown>(
|
|
@@ -617,7 +632,11 @@ interface DurableObjectStorage {
|
|
|
617
632
|
): Promise<void>;
|
|
618
633
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
619
634
|
sync(): Promise<void>;
|
|
635
|
+
sql: SqlStorage;
|
|
620
636
|
transactionSync<T>(closure: () => T): T;
|
|
637
|
+
getCurrentBookmark(): Promise<string>;
|
|
638
|
+
getBookmarkForTime(timestamp: number | Date): Promise<string>;
|
|
639
|
+
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
|
|
621
640
|
}
|
|
622
641
|
interface DurableObjectListOptions {
|
|
623
642
|
start?: string;
|
|
@@ -988,14 +1007,17 @@ declare abstract class CacheStorage {
|
|
|
988
1007
|
*/
|
|
989
1008
|
declare abstract class Cache {
|
|
990
1009
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
|
|
991
|
-
delete(
|
|
1010
|
+
delete(
|
|
1011
|
+
request: RequestInfo | URL,
|
|
1012
|
+
options?: CacheQueryOptions,
|
|
1013
|
+
): Promise<boolean>;
|
|
992
1014
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
|
|
993
1015
|
match(
|
|
994
|
-
request: RequestInfo,
|
|
1016
|
+
request: RequestInfo | URL,
|
|
995
1017
|
options?: CacheQueryOptions,
|
|
996
1018
|
): Promise<Response | undefined>;
|
|
997
1019
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
|
|
998
|
-
put(request: RequestInfo, response: Response): Promise<void>;
|
|
1020
|
+
put(request: RequestInfo | URL, response: Response): Promise<void>;
|
|
999
1021
|
}
|
|
1000
1022
|
interface CacheQueryOptions {
|
|
1001
1023
|
ignoreMethod?: boolean;
|
|
@@ -1418,20 +1440,44 @@ interface Element {
|
|
|
1418
1440
|
hasAttribute(name: string): boolean;
|
|
1419
1441
|
setAttribute(name: string, value: string): Element;
|
|
1420
1442
|
removeAttribute(name: string): Element;
|
|
1421
|
-
before(
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1443
|
+
before(
|
|
1444
|
+
content: string | ReadableStream | Response,
|
|
1445
|
+
options?: ContentOptions,
|
|
1446
|
+
): Element;
|
|
1447
|
+
after(
|
|
1448
|
+
content: string | ReadableStream | Response,
|
|
1449
|
+
options?: ContentOptions,
|
|
1450
|
+
): Element;
|
|
1451
|
+
prepend(
|
|
1452
|
+
content: string | ReadableStream | Response,
|
|
1453
|
+
options?: ContentOptions,
|
|
1454
|
+
): Element;
|
|
1455
|
+
append(
|
|
1456
|
+
content: string | ReadableStream | Response,
|
|
1457
|
+
options?: ContentOptions,
|
|
1458
|
+
): Element;
|
|
1459
|
+
replace(
|
|
1460
|
+
content: string | ReadableStream | Response,
|
|
1461
|
+
options?: ContentOptions,
|
|
1462
|
+
): Element;
|
|
1426
1463
|
remove(): Element;
|
|
1427
1464
|
removeAndKeepContent(): Element;
|
|
1428
|
-
setInnerContent(
|
|
1465
|
+
setInnerContent(
|
|
1466
|
+
content: string | ReadableStream | Response,
|
|
1467
|
+
options?: ContentOptions,
|
|
1468
|
+
): Element;
|
|
1429
1469
|
onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
|
|
1430
1470
|
}
|
|
1431
1471
|
interface EndTag {
|
|
1432
1472
|
name: string;
|
|
1433
|
-
before(
|
|
1434
|
-
|
|
1473
|
+
before(
|
|
1474
|
+
content: string | ReadableStream | Response,
|
|
1475
|
+
options?: ContentOptions,
|
|
1476
|
+
): EndTag;
|
|
1477
|
+
after(
|
|
1478
|
+
content: string | ReadableStream | Response,
|
|
1479
|
+
options?: ContentOptions,
|
|
1480
|
+
): EndTag;
|
|
1435
1481
|
remove(): EndTag;
|
|
1436
1482
|
}
|
|
1437
1483
|
interface Comment {
|
|
@@ -1446,9 +1492,18 @@ interface Text {
|
|
|
1446
1492
|
readonly text: string;
|
|
1447
1493
|
readonly lastInTextNode: boolean;
|
|
1448
1494
|
readonly removed: boolean;
|
|
1449
|
-
before(
|
|
1450
|
-
|
|
1451
|
-
|
|
1495
|
+
before(
|
|
1496
|
+
content: string | ReadableStream | Response,
|
|
1497
|
+
options?: ContentOptions,
|
|
1498
|
+
): Text;
|
|
1499
|
+
after(
|
|
1500
|
+
content: string | ReadableStream | Response,
|
|
1501
|
+
options?: ContentOptions,
|
|
1502
|
+
): Text;
|
|
1503
|
+
replace(
|
|
1504
|
+
content: string | ReadableStream | Response,
|
|
1505
|
+
options?: ContentOptions,
|
|
1506
|
+
): Text;
|
|
1452
1507
|
remove(): Text;
|
|
1453
1508
|
}
|
|
1454
1509
|
interface DocumentEnd {
|
|
@@ -1530,28 +1585,34 @@ declare abstract class Body {
|
|
|
1530
1585
|
*
|
|
1531
1586
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1532
1587
|
*/
|
|
1533
|
-
declare
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1588
|
+
declare var Response: {
|
|
1589
|
+
prototype: Response;
|
|
1590
|
+
new (body?: BodyInit | null, init?: ResponseInit): Response;
|
|
1591
|
+
redirect(url: string, status?: number): Response;
|
|
1592
|
+
json(any: any, maybeInit?: ResponseInit | Response): Response;
|
|
1593
|
+
};
|
|
1594
|
+
/**
|
|
1595
|
+
* This Fetch API interface represents the response to a request.
|
|
1596
|
+
*
|
|
1597
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1598
|
+
*/
|
|
1599
|
+
interface Response extends Body {
|
|
1539
1600
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
|
|
1540
1601
|
clone(): Response;
|
|
1541
1602
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
|
|
1542
|
-
|
|
1603
|
+
status: number;
|
|
1543
1604
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
|
|
1544
|
-
|
|
1605
|
+
statusText: string;
|
|
1545
1606
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
|
|
1546
|
-
|
|
1607
|
+
headers: Headers;
|
|
1547
1608
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
|
|
1548
|
-
|
|
1609
|
+
ok: boolean;
|
|
1549
1610
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
|
|
1550
|
-
|
|
1611
|
+
redirected: boolean;
|
|
1551
1612
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1613
|
+
url: string;
|
|
1614
|
+
webSocket: WebSocket | null;
|
|
1615
|
+
cf: any | undefined;
|
|
1555
1616
|
}
|
|
1556
1617
|
interface ResponseInit {
|
|
1557
1618
|
status?: number;
|
|
@@ -1563,18 +1624,26 @@ interface ResponseInit {
|
|
|
1563
1624
|
}
|
|
1564
1625
|
type RequestInfo<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>> =
|
|
1565
1626
|
| Request<CfHostMetadata, Cf>
|
|
1566
|
-
| string
|
|
1567
|
-
| URL;
|
|
1627
|
+
| string;
|
|
1568
1628
|
/**
|
|
1569
1629
|
* This Fetch API interface represents a resource request.
|
|
1570
1630
|
*
|
|
1571
1631
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
|
|
1572
1632
|
*/
|
|
1573
|
-
declare
|
|
1574
|
-
|
|
1575
|
-
Cf = CfProperties<CfHostMetadata
|
|
1576
|
-
>
|
|
1577
|
-
|
|
1633
|
+
declare var Request: {
|
|
1634
|
+
prototype: Request;
|
|
1635
|
+
new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
|
|
1636
|
+
input: RequestInfo<CfProperties> | URL,
|
|
1637
|
+
init?: RequestInit<Cf>,
|
|
1638
|
+
): Request<CfHostMetadata, Cf>;
|
|
1639
|
+
};
|
|
1640
|
+
/**
|
|
1641
|
+
* This Fetch API interface represents a resource request.
|
|
1642
|
+
*
|
|
1643
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
|
|
1644
|
+
*/
|
|
1645
|
+
interface Request<CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>
|
|
1646
|
+
extends Body {
|
|
1578
1647
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
|
|
1579
1648
|
clone(): Request<CfHostMetadata, Cf>;
|
|
1580
1649
|
/**
|
|
@@ -1582,45 +1651,45 @@ declare class Request<
|
|
|
1582
1651
|
*
|
|
1583
1652
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
|
|
1584
1653
|
*/
|
|
1585
|
-
|
|
1654
|
+
method: string;
|
|
1586
1655
|
/**
|
|
1587
1656
|
* Returns the URL of request as a string.
|
|
1588
1657
|
*
|
|
1589
1658
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
|
|
1590
1659
|
*/
|
|
1591
|
-
|
|
1660
|
+
url: string;
|
|
1592
1661
|
/**
|
|
1593
1662
|
* 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.
|
|
1594
1663
|
*
|
|
1595
1664
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
|
|
1596
1665
|
*/
|
|
1597
|
-
|
|
1666
|
+
headers: Headers;
|
|
1598
1667
|
/**
|
|
1599
1668
|
* 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.
|
|
1600
1669
|
*
|
|
1601
1670
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
|
|
1602
1671
|
*/
|
|
1603
|
-
|
|
1604
|
-
|
|
1672
|
+
redirect: string;
|
|
1673
|
+
fetcher: Fetcher | null;
|
|
1605
1674
|
/**
|
|
1606
1675
|
* Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
|
|
1607
1676
|
*
|
|
1608
1677
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
|
|
1609
1678
|
*/
|
|
1610
|
-
|
|
1611
|
-
|
|
1679
|
+
signal: AbortSignal;
|
|
1680
|
+
cf: Cf | undefined;
|
|
1612
1681
|
/**
|
|
1613
1682
|
* 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]
|
|
1614
1683
|
*
|
|
1615
1684
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
|
|
1616
1685
|
*/
|
|
1617
|
-
|
|
1686
|
+
integrity: string;
|
|
1618
1687
|
/**
|
|
1619
1688
|
* Returns a boolean indicating whether or not request can outlive the global in which it was created.
|
|
1620
1689
|
*
|
|
1621
1690
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
|
|
1622
1691
|
*/
|
|
1623
|
-
|
|
1692
|
+
keepalive: boolean;
|
|
1624
1693
|
}
|
|
1625
1694
|
interface RequestInit<Cf = CfProperties> {
|
|
1626
1695
|
/* A string to set request's method. */
|
|
@@ -1646,7 +1715,7 @@ type Fetcher<
|
|
|
1646
1715
|
> = (T extends Rpc.EntrypointBranded
|
|
1647
1716
|
? Rpc.Provider<T, Reserved | "fetch" | "connect">
|
|
1648
1717
|
: unknown) & {
|
|
1649
|
-
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1718
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1650
1719
|
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1651
1720
|
};
|
|
1652
1721
|
interface FetcherPutOptions {
|
|
@@ -1867,6 +1936,7 @@ interface R2MultipartUpload {
|
|
|
1867
1936
|
uploadPart(
|
|
1868
1937
|
partNumber: number,
|
|
1869
1938
|
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
|
|
1939
|
+
options?: R2UploadPartOptions,
|
|
1870
1940
|
): Promise<R2UploadedPart>;
|
|
1871
1941
|
abort(): Promise<void>;
|
|
1872
1942
|
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
|
|
@@ -1887,6 +1957,7 @@ declare abstract class R2Object {
|
|
|
1887
1957
|
readonly customMetadata?: Record<string, string>;
|
|
1888
1958
|
readonly range?: R2Range;
|
|
1889
1959
|
readonly storageClass: string;
|
|
1960
|
+
readonly ssecKeyMd5?: string;
|
|
1890
1961
|
writeHttpMetadata(headers: Headers): void;
|
|
1891
1962
|
}
|
|
1892
1963
|
interface R2ObjectBody extends R2Object {
|
|
@@ -1919,6 +1990,7 @@ interface R2Conditional {
|
|
|
1919
1990
|
interface R2GetOptions {
|
|
1920
1991
|
onlyIf?: R2Conditional | Headers;
|
|
1921
1992
|
range?: R2Range | Headers;
|
|
1993
|
+
ssecKey?: ArrayBuffer | string;
|
|
1922
1994
|
}
|
|
1923
1995
|
interface R2PutOptions {
|
|
1924
1996
|
onlyIf?: R2Conditional | Headers;
|
|
@@ -1930,11 +2002,13 @@ interface R2PutOptions {
|
|
|
1930
2002
|
sha384?: ArrayBuffer | string;
|
|
1931
2003
|
sha512?: ArrayBuffer | string;
|
|
1932
2004
|
storageClass?: string;
|
|
2005
|
+
ssecKey?: ArrayBuffer | string;
|
|
1933
2006
|
}
|
|
1934
2007
|
interface R2MultipartOptions {
|
|
1935
2008
|
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1936
2009
|
customMetadata?: Record<string, string>;
|
|
1937
2010
|
storageClass?: string;
|
|
2011
|
+
ssecKey?: ArrayBuffer | string;
|
|
1938
2012
|
}
|
|
1939
2013
|
interface R2Checksums {
|
|
1940
2014
|
readonly md5?: ArrayBuffer;
|
|
@@ -1971,6 +2045,9 @@ type R2Objects = {
|
|
|
1971
2045
|
truncated: false;
|
|
1972
2046
|
}
|
|
1973
2047
|
);
|
|
2048
|
+
interface R2UploadPartOptions {
|
|
2049
|
+
ssecKey?: ArrayBuffer | string;
|
|
2050
|
+
}
|
|
1974
2051
|
declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1975
2052
|
readonly scheduledTime: number;
|
|
1976
2053
|
readonly cron: string;
|
|
@@ -2381,6 +2458,8 @@ interface TraceItem {
|
|
|
2381
2458
|
readonly dispatchNamespace?: string;
|
|
2382
2459
|
readonly scriptTags?: string[];
|
|
2383
2460
|
readonly outcome: string;
|
|
2461
|
+
readonly executionModel: string;
|
|
2462
|
+
readonly truncated: boolean;
|
|
2384
2463
|
}
|
|
2385
2464
|
interface TraceItemAlarmEventInfo {
|
|
2386
2465
|
readonly scheduledTime: Date;
|
|
@@ -2694,8 +2773,24 @@ type WebSocketEventMap = {
|
|
|
2694
2773
|
*
|
|
2695
2774
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
2696
2775
|
*/
|
|
2697
|
-
declare
|
|
2698
|
-
|
|
2776
|
+
declare var WebSocket: {
|
|
2777
|
+
prototype: WebSocket;
|
|
2778
|
+
new (url: string, protocols?: string[] | string): WebSocket;
|
|
2779
|
+
readonly READY_STATE_CONNECTING: number;
|
|
2780
|
+
readonly CONNECTING: number;
|
|
2781
|
+
readonly READY_STATE_OPEN: number;
|
|
2782
|
+
readonly OPEN: number;
|
|
2783
|
+
readonly READY_STATE_CLOSING: number;
|
|
2784
|
+
readonly CLOSING: number;
|
|
2785
|
+
readonly READY_STATE_CLOSED: number;
|
|
2786
|
+
readonly CLOSED: number;
|
|
2787
|
+
};
|
|
2788
|
+
/**
|
|
2789
|
+
* Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
|
|
2790
|
+
*
|
|
2791
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
2792
|
+
*/
|
|
2793
|
+
interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
2699
2794
|
accept(): void;
|
|
2700
2795
|
/**
|
|
2701
2796
|
* Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
|
|
@@ -2711,38 +2806,30 @@ declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
2711
2806
|
close(code?: number, reason?: string): void;
|
|
2712
2807
|
serializeAttachment(attachment: any): void;
|
|
2713
2808
|
deserializeAttachment(): any | null;
|
|
2714
|
-
static readonly READY_STATE_CONNECTING: number;
|
|
2715
|
-
static readonly CONNECTING: number;
|
|
2716
|
-
static readonly READY_STATE_OPEN: number;
|
|
2717
|
-
static readonly OPEN: number;
|
|
2718
|
-
static readonly READY_STATE_CLOSING: number;
|
|
2719
|
-
static readonly CLOSING: number;
|
|
2720
|
-
static readonly READY_STATE_CLOSED: number;
|
|
2721
|
-
static readonly CLOSED: number;
|
|
2722
2809
|
/**
|
|
2723
2810
|
* Returns the state of the WebSocket object's connection. It can have the values described below.
|
|
2724
2811
|
*
|
|
2725
2812
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
|
|
2726
2813
|
*/
|
|
2727
|
-
|
|
2814
|
+
readyState: number;
|
|
2728
2815
|
/**
|
|
2729
2816
|
* Returns the URL that was used to establish the WebSocket connection.
|
|
2730
2817
|
*
|
|
2731
2818
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
|
|
2732
2819
|
*/
|
|
2733
|
-
|
|
2820
|
+
url: string | null;
|
|
2734
2821
|
/**
|
|
2735
2822
|
* 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.
|
|
2736
2823
|
*
|
|
2737
2824
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
|
|
2738
2825
|
*/
|
|
2739
|
-
|
|
2826
|
+
protocol: string | null;
|
|
2740
2827
|
/**
|
|
2741
2828
|
* Returns the extensions selected by the server, if any.
|
|
2742
2829
|
*
|
|
2743
2830
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
|
|
2744
2831
|
*/
|
|
2745
|
-
|
|
2832
|
+
extensions: string | null;
|
|
2746
2833
|
}
|
|
2747
2834
|
declare const WebSocketPair: {
|
|
2748
2835
|
new (): {
|
|
@@ -2750,6 +2837,37 @@ declare const WebSocketPair: {
|
|
|
2750
2837
|
1: WebSocket;
|
|
2751
2838
|
};
|
|
2752
2839
|
};
|
|
2840
|
+
interface SqlStorage {
|
|
2841
|
+
exec<T extends Record<string, SqlStorageValue>>(
|
|
2842
|
+
query: string,
|
|
2843
|
+
...bindings: any[]
|
|
2844
|
+
): SqlStorageCursor<T>;
|
|
2845
|
+
get databaseSize(): number;
|
|
2846
|
+
Cursor: typeof SqlStorageCursor;
|
|
2847
|
+
Statement: typeof SqlStorageStatement;
|
|
2848
|
+
}
|
|
2849
|
+
declare abstract class SqlStorageStatement {}
|
|
2850
|
+
type SqlStorageValue = ArrayBuffer | string | number | null;
|
|
2851
|
+
declare abstract class SqlStorageCursor<
|
|
2852
|
+
T extends Record<string, SqlStorageValue>,
|
|
2853
|
+
> {
|
|
2854
|
+
next():
|
|
2855
|
+
| {
|
|
2856
|
+
done?: false;
|
|
2857
|
+
value: T;
|
|
2858
|
+
}
|
|
2859
|
+
| {
|
|
2860
|
+
done: true;
|
|
2861
|
+
value?: never;
|
|
2862
|
+
};
|
|
2863
|
+
toArray(): T[];
|
|
2864
|
+
one(): T;
|
|
2865
|
+
raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
|
|
2866
|
+
columnNames: string[];
|
|
2867
|
+
get rowsRead(): number;
|
|
2868
|
+
get rowsWritten(): number;
|
|
2869
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
2870
|
+
}
|
|
2753
2871
|
interface Socket {
|
|
2754
2872
|
get readable(): ReadableStream;
|
|
2755
2873
|
get writable(): WritableStream;
|
|
@@ -3287,7 +3405,7 @@ interface GPUOrigin3DDict {
|
|
|
3287
3405
|
z?: number;
|
|
3288
3406
|
}
|
|
3289
3407
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
|
|
3290
|
-
declare class EventSource {
|
|
3408
|
+
declare class EventSource extends EventTarget {
|
|
3291
3409
|
constructor(url: string, init?: EventSourceEventSourceInit);
|
|
3292
3410
|
/**
|
|
3293
3411
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -3386,10 +3504,10 @@ declare abstract class BaseAiSentenceSimilarity {
|
|
|
3386
3504
|
inputs: AiSentenceSimilarityInput;
|
|
3387
3505
|
postProcessedOutputs: AiSentenceSimilarityOutput;
|
|
3388
3506
|
}
|
|
3389
|
-
type
|
|
3507
|
+
type AiAutomaticSpeechRecognitionInput = {
|
|
3390
3508
|
audio: number[];
|
|
3391
3509
|
};
|
|
3392
|
-
type
|
|
3510
|
+
type AiAutomaticSpeechRecognitionOutput = {
|
|
3393
3511
|
text?: string;
|
|
3394
3512
|
words?: {
|
|
3395
3513
|
word: string;
|
|
@@ -3398,9 +3516,9 @@ type AiSpeechRecognitionOutput = {
|
|
|
3398
3516
|
}[];
|
|
3399
3517
|
vtt?: string;
|
|
3400
3518
|
};
|
|
3401
|
-
declare abstract class
|
|
3402
|
-
inputs:
|
|
3403
|
-
postProcessedOutputs:
|
|
3519
|
+
declare abstract class BaseAiAutomaticSpeechRecognition {
|
|
3520
|
+
inputs: AiAutomaticSpeechRecognitionInput;
|
|
3521
|
+
postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;
|
|
3404
3522
|
}
|
|
3405
3523
|
type AiSummarizationInput = {
|
|
3406
3524
|
input_text: string;
|
|
@@ -3436,16 +3554,36 @@ declare abstract class BaseAiTextEmbeddings {
|
|
|
3436
3554
|
postProcessedOutputs: AiTextEmbeddingsOutput;
|
|
3437
3555
|
}
|
|
3438
3556
|
type RoleScopedChatInput = {
|
|
3439
|
-
role:
|
|
3557
|
+
role:
|
|
3558
|
+
| "user"
|
|
3559
|
+
| "assistant"
|
|
3560
|
+
| "system"
|
|
3561
|
+
| "tool"
|
|
3562
|
+
| (string & NonNullable<unknown>);
|
|
3440
3563
|
content: string;
|
|
3564
|
+
name?: string;
|
|
3565
|
+
};
|
|
3566
|
+
type AiTextGenerationToolLegacyInput = {
|
|
3567
|
+
name: string;
|
|
3568
|
+
description: string;
|
|
3569
|
+
parameters?: {
|
|
3570
|
+
type: "object" | (string & NonNullable<unknown>);
|
|
3571
|
+
properties: {
|
|
3572
|
+
[key: string]: {
|
|
3573
|
+
type: string;
|
|
3574
|
+
description?: string;
|
|
3575
|
+
};
|
|
3576
|
+
};
|
|
3577
|
+
required: string[];
|
|
3578
|
+
};
|
|
3441
3579
|
};
|
|
3442
3580
|
type AiTextGenerationToolInput = {
|
|
3443
|
-
type: "function";
|
|
3581
|
+
type: "function" | (string & NonNullable<unknown>);
|
|
3444
3582
|
function: {
|
|
3445
3583
|
name: string;
|
|
3446
3584
|
description: string;
|
|
3447
3585
|
parameters?: {
|
|
3448
|
-
type: "object";
|
|
3586
|
+
type: "object" | (string & NonNullable<unknown>);
|
|
3449
3587
|
properties: {
|
|
3450
3588
|
[key: string]: {
|
|
3451
3589
|
type: string;
|
|
@@ -3456,6 +3594,10 @@ type AiTextGenerationToolInput = {
|
|
|
3456
3594
|
};
|
|
3457
3595
|
};
|
|
3458
3596
|
};
|
|
3597
|
+
type AiTextGenerationFunctionsInput = {
|
|
3598
|
+
name: string;
|
|
3599
|
+
code: string;
|
|
3600
|
+
};
|
|
3459
3601
|
type AiTextGenerationInput = {
|
|
3460
3602
|
prompt?: string;
|
|
3461
3603
|
raw?: boolean;
|
|
@@ -3469,7 +3611,11 @@ type AiTextGenerationInput = {
|
|
|
3469
3611
|
frequency_penalty?: number;
|
|
3470
3612
|
presence_penalty?: number;
|
|
3471
3613
|
messages?: RoleScopedChatInput[];
|
|
3472
|
-
tools?:
|
|
3614
|
+
tools?:
|
|
3615
|
+
| AiTextGenerationToolInput[]
|
|
3616
|
+
| AiTextGenerationToolLegacyInput[]
|
|
3617
|
+
| (object & NonNullable<unknown>);
|
|
3618
|
+
functions?: AiTextGenerationFunctionsInput[];
|
|
3473
3619
|
};
|
|
3474
3620
|
type AiTextGenerationOutput =
|
|
3475
3621
|
| {
|
|
@@ -3484,15 +3630,33 @@ declare abstract class BaseAiTextGeneration {
|
|
|
3484
3630
|
inputs: AiTextGenerationInput;
|
|
3485
3631
|
postProcessedOutputs: AiTextGenerationOutput;
|
|
3486
3632
|
}
|
|
3633
|
+
type AiTextToSpeechInput = {
|
|
3634
|
+
prompt: string;
|
|
3635
|
+
lang?: string;
|
|
3636
|
+
};
|
|
3637
|
+
type AiTextToSpeechOutput =
|
|
3638
|
+
| Uint8Array
|
|
3639
|
+
| {
|
|
3640
|
+
audio: string;
|
|
3641
|
+
};
|
|
3642
|
+
declare abstract class BaseAiTextToSpeech {
|
|
3643
|
+
inputs: AiTextToSpeechInput;
|
|
3644
|
+
postProcessedOutputs: AiTextToSpeechOutput;
|
|
3645
|
+
}
|
|
3487
3646
|
type AiTextToImageInput = {
|
|
3488
3647
|
prompt: string;
|
|
3648
|
+
negative_prompt?: string;
|
|
3649
|
+
height?: number;
|
|
3650
|
+
width?: number;
|
|
3489
3651
|
image?: number[];
|
|
3652
|
+
image_b64?: string;
|
|
3490
3653
|
mask?: number[];
|
|
3491
3654
|
num_steps?: number;
|
|
3492
3655
|
strength?: number;
|
|
3493
3656
|
guidance?: number;
|
|
3657
|
+
seed?: number;
|
|
3494
3658
|
};
|
|
3495
|
-
type AiTextToImageOutput = Uint8Array
|
|
3659
|
+
type AiTextToImageOutput = ReadableStream<Uint8Array>;
|
|
3496
3660
|
declare abstract class BaseAiTextToImage {
|
|
3497
3661
|
inputs: AiTextToImageInput;
|
|
3498
3662
|
postProcessedOutputs: AiTextToImageOutput;
|
|
@@ -3509,126 +3673,613 @@ declare abstract class BaseAiTranslation {
|
|
|
3509
3673
|
inputs: AiTranslationInput;
|
|
3510
3674
|
postProcessedOutputs: AiTranslationOutput;
|
|
3511
3675
|
}
|
|
3676
|
+
type Ai_Cf_Openai_Whisper_Input =
|
|
3677
|
+
| string
|
|
3678
|
+
| {
|
|
3679
|
+
/**
|
|
3680
|
+
* An array of integers that represent the audio data constrained to 8-bit unsigned integer values
|
|
3681
|
+
*/
|
|
3682
|
+
audio: number[];
|
|
3683
|
+
};
|
|
3684
|
+
interface Ai_Cf_Openai_Whisper_Output {
|
|
3685
|
+
/**
|
|
3686
|
+
* The transcription
|
|
3687
|
+
*/
|
|
3688
|
+
text: string;
|
|
3689
|
+
word_count?: number;
|
|
3690
|
+
words?: {
|
|
3691
|
+
word?: string;
|
|
3692
|
+
/**
|
|
3693
|
+
* The second this word begins in the recording
|
|
3694
|
+
*/
|
|
3695
|
+
start?: number;
|
|
3696
|
+
/**
|
|
3697
|
+
* The ending second when the word completes
|
|
3698
|
+
*/
|
|
3699
|
+
end?: number;
|
|
3700
|
+
}[];
|
|
3701
|
+
vtt?: string;
|
|
3702
|
+
}
|
|
3703
|
+
declare abstract class Base_Ai_Cf_Openai_Whisper {
|
|
3704
|
+
inputs: Ai_Cf_Openai_Whisper_Input;
|
|
3705
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;
|
|
3706
|
+
}
|
|
3707
|
+
type Ai_Cf_Openai_Whisper_Tiny_En_Input =
|
|
3708
|
+
| string
|
|
3709
|
+
| {
|
|
3710
|
+
/**
|
|
3711
|
+
* An array of integers that represent the audio data constrained to 8-bit unsigned integer values
|
|
3712
|
+
*/
|
|
3713
|
+
audio: number[];
|
|
3714
|
+
};
|
|
3715
|
+
interface Ai_Cf_Openai_Whisper_Tiny_En_Output {
|
|
3716
|
+
/**
|
|
3717
|
+
* The transcription
|
|
3718
|
+
*/
|
|
3719
|
+
text: string;
|
|
3720
|
+
word_count?: number;
|
|
3721
|
+
words?: {
|
|
3722
|
+
word?: string;
|
|
3723
|
+
/**
|
|
3724
|
+
* The second this word begins in the recording
|
|
3725
|
+
*/
|
|
3726
|
+
start?: number;
|
|
3727
|
+
/**
|
|
3728
|
+
* The ending second when the word completes
|
|
3729
|
+
*/
|
|
3730
|
+
end?: number;
|
|
3731
|
+
}[];
|
|
3732
|
+
vtt?: string;
|
|
3733
|
+
}
|
|
3734
|
+
declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
|
|
3735
|
+
inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;
|
|
3736
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
|
|
3737
|
+
}
|
|
3738
|
+
interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
|
|
3739
|
+
/**
|
|
3740
|
+
* Base64 encoded value of the audio data.
|
|
3741
|
+
*/
|
|
3742
|
+
audio: string;
|
|
3743
|
+
/**
|
|
3744
|
+
* Supported tasks are 'translate' or 'transcribe'.
|
|
3745
|
+
*/
|
|
3746
|
+
task?: string;
|
|
3747
|
+
/**
|
|
3748
|
+
* The language of the audio being transcribed or translated.
|
|
3749
|
+
*/
|
|
3750
|
+
language?: string;
|
|
3751
|
+
/**
|
|
3752
|
+
* Preprocess the audio with a voice activity detection model.
|
|
3753
|
+
*/
|
|
3754
|
+
vad_filter?: string;
|
|
3755
|
+
/**
|
|
3756
|
+
* A text prompt to help provide context to the model on the contents of the audio.
|
|
3757
|
+
*/
|
|
3758
|
+
initial_prompt?: string;
|
|
3759
|
+
/**
|
|
3760
|
+
* The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
|
|
3761
|
+
*/
|
|
3762
|
+
prefix?: string;
|
|
3763
|
+
}
|
|
3764
|
+
interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
|
|
3765
|
+
transcription_info?: {
|
|
3766
|
+
/**
|
|
3767
|
+
* The language of the audio being transcribed or translated.
|
|
3768
|
+
*/
|
|
3769
|
+
language?: string;
|
|
3770
|
+
/**
|
|
3771
|
+
* The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.
|
|
3772
|
+
*/
|
|
3773
|
+
language_probability?: number;
|
|
3774
|
+
/**
|
|
3775
|
+
* The total duration of the original audio file, in seconds.
|
|
3776
|
+
*/
|
|
3777
|
+
duration?: number;
|
|
3778
|
+
/**
|
|
3779
|
+
* The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.
|
|
3780
|
+
*/
|
|
3781
|
+
duration_after_vad?: number;
|
|
3782
|
+
};
|
|
3783
|
+
/**
|
|
3784
|
+
* The complete transcription of the audio.
|
|
3785
|
+
*/
|
|
3786
|
+
text: string;
|
|
3787
|
+
/**
|
|
3788
|
+
* The total number of words in the transcription.
|
|
3789
|
+
*/
|
|
3790
|
+
word_count?: number;
|
|
3791
|
+
segments?: {
|
|
3792
|
+
/**
|
|
3793
|
+
* The starting time of the segment within the audio, in seconds.
|
|
3794
|
+
*/
|
|
3795
|
+
start?: number;
|
|
3796
|
+
/**
|
|
3797
|
+
* The ending time of the segment within the audio, in seconds.
|
|
3798
|
+
*/
|
|
3799
|
+
end?: number;
|
|
3800
|
+
/**
|
|
3801
|
+
* The transcription of the segment.
|
|
3802
|
+
*/
|
|
3803
|
+
text?: string;
|
|
3804
|
+
/**
|
|
3805
|
+
* The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.
|
|
3806
|
+
*/
|
|
3807
|
+
temperature?: number;
|
|
3808
|
+
/**
|
|
3809
|
+
* The average log probability of the predictions for the words in this segment, indicating overall confidence.
|
|
3810
|
+
*/
|
|
3811
|
+
avg_logprob?: number;
|
|
3812
|
+
/**
|
|
3813
|
+
* The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.
|
|
3814
|
+
*/
|
|
3815
|
+
compression_ratio?: number;
|
|
3816
|
+
/**
|
|
3817
|
+
* The probability that the segment contains no speech, represented as a decimal between 0 and 1.
|
|
3818
|
+
*/
|
|
3819
|
+
no_speech_prob?: number;
|
|
3820
|
+
words?: {
|
|
3821
|
+
/**
|
|
3822
|
+
* The individual word transcribed from the audio.
|
|
3823
|
+
*/
|
|
3824
|
+
word?: string;
|
|
3825
|
+
/**
|
|
3826
|
+
* The starting time of the word within the audio, in seconds.
|
|
3827
|
+
*/
|
|
3828
|
+
start?: number;
|
|
3829
|
+
/**
|
|
3830
|
+
* The ending time of the word within the audio, in seconds.
|
|
3831
|
+
*/
|
|
3832
|
+
end?: number;
|
|
3833
|
+
}[];
|
|
3834
|
+
};
|
|
3835
|
+
/**
|
|
3836
|
+
* The transcription in WebVTT format, which includes timing and text information for use in subtitles.
|
|
3837
|
+
*/
|
|
3838
|
+
vtt?: string;
|
|
3839
|
+
}
|
|
3840
|
+
declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {
|
|
3841
|
+
inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;
|
|
3842
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;
|
|
3843
|
+
}
|
|
3844
|
+
interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {
|
|
3845
|
+
/**
|
|
3846
|
+
* A text description of the image you want to generate.
|
|
3847
|
+
*/
|
|
3848
|
+
prompt: string;
|
|
3849
|
+
/**
|
|
3850
|
+
* The number of diffusion steps; higher values can improve quality but take longer.
|
|
3851
|
+
*/
|
|
3852
|
+
steps?: number;
|
|
3853
|
+
}
|
|
3854
|
+
interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {
|
|
3855
|
+
/**
|
|
3856
|
+
* The generated image in Base64 format.
|
|
3857
|
+
*/
|
|
3858
|
+
image?: string;
|
|
3859
|
+
}
|
|
3860
|
+
declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {
|
|
3861
|
+
inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;
|
|
3862
|
+
postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;
|
|
3863
|
+
}
|
|
3864
|
+
type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Prompt | Messages;
|
|
3865
|
+
interface Prompt {
|
|
3866
|
+
/**
|
|
3867
|
+
* The input text prompt for the model to generate a response.
|
|
3868
|
+
*/
|
|
3869
|
+
prompt: string;
|
|
3870
|
+
image?: number[] | (string & NonNullable<unknown>);
|
|
3871
|
+
/**
|
|
3872
|
+
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
|
|
3873
|
+
*/
|
|
3874
|
+
raw?: boolean;
|
|
3875
|
+
/**
|
|
3876
|
+
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
|
|
3877
|
+
*/
|
|
3878
|
+
stream?: boolean;
|
|
3879
|
+
/**
|
|
3880
|
+
* The maximum number of tokens to generate in the response.
|
|
3881
|
+
*/
|
|
3882
|
+
max_tokens?: number;
|
|
3883
|
+
/**
|
|
3884
|
+
* Controls the randomness of the output; higher values produce more random results.
|
|
3885
|
+
*/
|
|
3886
|
+
temperature?: number;
|
|
3887
|
+
/**
|
|
3888
|
+
* 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.
|
|
3889
|
+
*/
|
|
3890
|
+
top_p?: number;
|
|
3891
|
+
/**
|
|
3892
|
+
* 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.
|
|
3893
|
+
*/
|
|
3894
|
+
top_k?: number;
|
|
3895
|
+
/**
|
|
3896
|
+
* Random seed for reproducibility of the generation.
|
|
3897
|
+
*/
|
|
3898
|
+
seed?: number;
|
|
3899
|
+
/**
|
|
3900
|
+
* Penalty for repeated tokens; higher values discourage repetition.
|
|
3901
|
+
*/
|
|
3902
|
+
repetition_penalty?: number;
|
|
3903
|
+
/**
|
|
3904
|
+
* Decreases the likelihood of the model repeating the same lines verbatim.
|
|
3905
|
+
*/
|
|
3906
|
+
frequency_penalty?: number;
|
|
3907
|
+
/**
|
|
3908
|
+
* Increases the likelihood of the model introducing new topics.
|
|
3909
|
+
*/
|
|
3910
|
+
presence_penalty?: number;
|
|
3911
|
+
/**
|
|
3912
|
+
* Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
|
|
3913
|
+
*/
|
|
3914
|
+
lora?: string;
|
|
3915
|
+
}
|
|
3916
|
+
interface Messages {
|
|
3917
|
+
/**
|
|
3918
|
+
* An array of message objects representing the conversation history.
|
|
3919
|
+
*/
|
|
3920
|
+
messages: {
|
|
3921
|
+
/**
|
|
3922
|
+
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
3923
|
+
*/
|
|
3924
|
+
role: string;
|
|
3925
|
+
/**
|
|
3926
|
+
* The content of the message as a string.
|
|
3927
|
+
*/
|
|
3928
|
+
content: string;
|
|
3929
|
+
}[];
|
|
3930
|
+
image?: number[] | string;
|
|
3931
|
+
functions?: {
|
|
3932
|
+
name: string;
|
|
3933
|
+
code: string;
|
|
3934
|
+
}[];
|
|
3935
|
+
/**
|
|
3936
|
+
* A list of tools available for the assistant to use.
|
|
3937
|
+
*/
|
|
3938
|
+
tools?: (
|
|
3939
|
+
| {
|
|
3940
|
+
/**
|
|
3941
|
+
* The name of the tool. More descriptive the better.
|
|
3942
|
+
*/
|
|
3943
|
+
name: string;
|
|
3944
|
+
/**
|
|
3945
|
+
* A brief description of what the tool does.
|
|
3946
|
+
*/
|
|
3947
|
+
description: string;
|
|
3948
|
+
/**
|
|
3949
|
+
* Schema defining the parameters accepted by the tool.
|
|
3950
|
+
*/
|
|
3951
|
+
parameters: {
|
|
3952
|
+
/**
|
|
3953
|
+
* The type of the parameters object (usually 'object').
|
|
3954
|
+
*/
|
|
3955
|
+
type: string;
|
|
3956
|
+
/**
|
|
3957
|
+
* List of required parameter names.
|
|
3958
|
+
*/
|
|
3959
|
+
required?: string[];
|
|
3960
|
+
/**
|
|
3961
|
+
* Definitions of each parameter.
|
|
3962
|
+
*/
|
|
3963
|
+
properties: {
|
|
3964
|
+
[k: string]: {
|
|
3965
|
+
/**
|
|
3966
|
+
* The data type of the parameter.
|
|
3967
|
+
*/
|
|
3968
|
+
type: string;
|
|
3969
|
+
/**
|
|
3970
|
+
* A description of the expected parameter.
|
|
3971
|
+
*/
|
|
3972
|
+
description: string;
|
|
3973
|
+
};
|
|
3974
|
+
};
|
|
3975
|
+
};
|
|
3976
|
+
}
|
|
3977
|
+
| {
|
|
3978
|
+
/**
|
|
3979
|
+
* Specifies the type of tool (e.g., 'function').
|
|
3980
|
+
*/
|
|
3981
|
+
type: string;
|
|
3982
|
+
/**
|
|
3983
|
+
* Details of the function tool.
|
|
3984
|
+
*/
|
|
3985
|
+
function: {
|
|
3986
|
+
/**
|
|
3987
|
+
* The name of the function.
|
|
3988
|
+
*/
|
|
3989
|
+
name: string;
|
|
3990
|
+
/**
|
|
3991
|
+
* A brief description of what the function does.
|
|
3992
|
+
*/
|
|
3993
|
+
description: string;
|
|
3994
|
+
/**
|
|
3995
|
+
* Schema defining the parameters accepted by the function.
|
|
3996
|
+
*/
|
|
3997
|
+
parameters: {
|
|
3998
|
+
/**
|
|
3999
|
+
* The type of the parameters object (usually 'object').
|
|
4000
|
+
*/
|
|
4001
|
+
type: string;
|
|
4002
|
+
/**
|
|
4003
|
+
* List of required parameter names.
|
|
4004
|
+
*/
|
|
4005
|
+
required?: string[];
|
|
4006
|
+
/**
|
|
4007
|
+
* Definitions of each parameter.
|
|
4008
|
+
*/
|
|
4009
|
+
properties: {
|
|
4010
|
+
[k: string]: {
|
|
4011
|
+
/**
|
|
4012
|
+
* The data type of the parameter.
|
|
4013
|
+
*/
|
|
4014
|
+
type: string;
|
|
4015
|
+
/**
|
|
4016
|
+
* A description of the expected parameter.
|
|
4017
|
+
*/
|
|
4018
|
+
description: string;
|
|
4019
|
+
};
|
|
4020
|
+
};
|
|
4021
|
+
};
|
|
4022
|
+
};
|
|
4023
|
+
}
|
|
4024
|
+
)[];
|
|
4025
|
+
/**
|
|
4026
|
+
* If true, the response will be streamed back incrementally.
|
|
4027
|
+
*/
|
|
4028
|
+
stream?: boolean;
|
|
4029
|
+
/**
|
|
4030
|
+
* The maximum number of tokens to generate in the response.
|
|
4031
|
+
*/
|
|
4032
|
+
max_tokens?: number;
|
|
4033
|
+
/**
|
|
4034
|
+
* Controls the randomness of the output; higher values produce more random results.
|
|
4035
|
+
*/
|
|
4036
|
+
temperature?: number;
|
|
4037
|
+
/**
|
|
4038
|
+
* 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.
|
|
4039
|
+
*/
|
|
4040
|
+
top_p?: number;
|
|
4041
|
+
/**
|
|
4042
|
+
* 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.
|
|
4043
|
+
*/
|
|
4044
|
+
top_k?: number;
|
|
4045
|
+
/**
|
|
4046
|
+
* Random seed for reproducibility of the generation.
|
|
4047
|
+
*/
|
|
4048
|
+
seed?: number;
|
|
4049
|
+
/**
|
|
4050
|
+
* Penalty for repeated tokens; higher values discourage repetition.
|
|
4051
|
+
*/
|
|
4052
|
+
repetition_penalty?: number;
|
|
4053
|
+
/**
|
|
4054
|
+
* Decreases the likelihood of the model repeating the same lines verbatim.
|
|
4055
|
+
*/
|
|
4056
|
+
frequency_penalty?: number;
|
|
4057
|
+
/**
|
|
4058
|
+
* Increases the likelihood of the model introducing new topics.
|
|
4059
|
+
*/
|
|
4060
|
+
presence_penalty?: number;
|
|
4061
|
+
}
|
|
4062
|
+
type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output =
|
|
4063
|
+
| {
|
|
4064
|
+
/**
|
|
4065
|
+
* The generated text response from the model
|
|
4066
|
+
*/
|
|
4067
|
+
response?: string;
|
|
4068
|
+
/**
|
|
4069
|
+
* An array of tool calls requests made during the response generation
|
|
4070
|
+
*/
|
|
4071
|
+
tool_calls?: {
|
|
4072
|
+
/**
|
|
4073
|
+
* The arguments passed to be passed to the tool call request
|
|
4074
|
+
*/
|
|
4075
|
+
arguments?: object;
|
|
4076
|
+
/**
|
|
4077
|
+
* The name of the tool to be called
|
|
4078
|
+
*/
|
|
4079
|
+
name?: string;
|
|
4080
|
+
}[];
|
|
4081
|
+
}
|
|
4082
|
+
| ReadableStream;
|
|
4083
|
+
declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {
|
|
4084
|
+
inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;
|
|
4085
|
+
postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;
|
|
4086
|
+
}
|
|
4087
|
+
interface AiModels {
|
|
4088
|
+
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
4089
|
+
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
4090
|
+
"@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage;
|
|
4091
|
+
"@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage;
|
|
4092
|
+
"@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage;
|
|
4093
|
+
"@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage;
|
|
4094
|
+
"@cf/baai/bge-base-en-v1.5": BaseAiTextEmbeddings;
|
|
4095
|
+
"@cf/baai/bge-small-en-v1.5": BaseAiTextEmbeddings;
|
|
4096
|
+
"@cf/baai/bge-large-en-v1.5": BaseAiTextEmbeddings;
|
|
4097
|
+
"@cf/microsoft/resnet-50": BaseAiImageClassification;
|
|
4098
|
+
"@cf/facebook/detr-resnet-50": BaseAiObjectDetection;
|
|
4099
|
+
"@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration;
|
|
4100
|
+
"@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration;
|
|
4101
|
+
"@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration;
|
|
4102
|
+
"@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration;
|
|
4103
|
+
"@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration;
|
|
4104
|
+
"@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
|
|
4105
|
+
"@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
|
|
4106
|
+
"@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
|
|
4107
|
+
"@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
|
|
4108
|
+
"@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
|
|
4109
|
+
"@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
|
|
4110
|
+
"@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
|
|
4111
|
+
"@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration;
|
|
4112
|
+
"@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration;
|
|
4113
|
+
"@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration;
|
|
4114
|
+
"@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration;
|
|
4115
|
+
"@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration;
|
|
4116
|
+
"@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration;
|
|
4117
|
+
"@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration;
|
|
4118
|
+
"@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration;
|
|
4119
|
+
"@cf/microsoft/phi-2": BaseAiTextGeneration;
|
|
4120
|
+
"@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration;
|
|
4121
|
+
"@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration;
|
|
4122
|
+
"@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration;
|
|
4123
|
+
"@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration;
|
|
4124
|
+
"@hf/google/gemma-7b-it": BaseAiTextGeneration;
|
|
4125
|
+
"@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration;
|
|
4126
|
+
"@cf/google/gemma-2b-it-lora": BaseAiTextGeneration;
|
|
4127
|
+
"@cf/google/gemma-7b-it-lora": BaseAiTextGeneration;
|
|
4128
|
+
"@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration;
|
|
4129
|
+
"@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration;
|
|
4130
|
+
"@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration;
|
|
4131
|
+
"@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration;
|
|
4132
|
+
"@hf/meta-llama/meta-llama-3-8b-instruct": BaseAiTextGeneration;
|
|
4133
|
+
"@cf/meta/llama-3.1-8b-instruct": BaseAiTextGeneration;
|
|
4134
|
+
"@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration;
|
|
4135
|
+
"@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration;
|
|
4136
|
+
"@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration;
|
|
4137
|
+
"@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration;
|
|
4138
|
+
"@cf/meta/llama-3.3-70b-instruct-fp8-fast": BaseAiTextGeneration;
|
|
4139
|
+
"@cf/meta/m2m100-1.2b": BaseAiTranslation;
|
|
4140
|
+
"@cf/facebook/bart-large-cnn": BaseAiSummarization;
|
|
4141
|
+
"@cf/unum/uform-gen2-qwen-500m": BaseAiImageToText;
|
|
4142
|
+
"@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText;
|
|
4143
|
+
"@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper;
|
|
4144
|
+
"@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En;
|
|
4145
|
+
"@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;
|
|
4146
|
+
"@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;
|
|
4147
|
+
"@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;
|
|
4148
|
+
}
|
|
4149
|
+
type AiOptions = {
|
|
4150
|
+
gateway?: GatewayOptions;
|
|
4151
|
+
prefix?: string;
|
|
4152
|
+
extraHeaders?: object;
|
|
4153
|
+
};
|
|
4154
|
+
type AiModelsSearchParams = {
|
|
4155
|
+
author?: string;
|
|
4156
|
+
hide_experimental?: boolean;
|
|
4157
|
+
page?: number;
|
|
4158
|
+
per_page?: number;
|
|
4159
|
+
search?: string;
|
|
4160
|
+
source?: number;
|
|
4161
|
+
task?: string;
|
|
4162
|
+
};
|
|
4163
|
+
type AiModelsSearchObject = {
|
|
4164
|
+
id: string;
|
|
4165
|
+
source: number;
|
|
4166
|
+
name: string;
|
|
4167
|
+
description: string;
|
|
4168
|
+
task: {
|
|
4169
|
+
id: string;
|
|
4170
|
+
name: string;
|
|
4171
|
+
description: string;
|
|
4172
|
+
};
|
|
4173
|
+
tags: string[];
|
|
4174
|
+
properties: {
|
|
4175
|
+
property_id: string;
|
|
4176
|
+
value: string;
|
|
4177
|
+
}[];
|
|
4178
|
+
};
|
|
4179
|
+
interface InferenceUpstreamError extends Error {}
|
|
4180
|
+
interface AiInternalError extends Error {}
|
|
4181
|
+
type AiModelListType = Record<string, any>;
|
|
4182
|
+
declare abstract class Ai<AiModelList extends AiModelListType = AiModels> {
|
|
4183
|
+
aiGatewayLogId: string | null;
|
|
4184
|
+
gateway(gatewayId: string): AiGateway;
|
|
4185
|
+
run<Name extends keyof AiModelList>(
|
|
4186
|
+
model: Name,
|
|
4187
|
+
inputs: AiModelList[Name]["inputs"],
|
|
4188
|
+
options?: AiOptions,
|
|
4189
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
4190
|
+
public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
4191
|
+
}
|
|
3512
4192
|
type GatewayOptions = {
|
|
3513
4193
|
id: string;
|
|
4194
|
+
cacheKey?: string;
|
|
3514
4195
|
cacheTtl?: number;
|
|
3515
4196
|
skipCache?: boolean;
|
|
3516
4197
|
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
4198
|
+
collectLog?: boolean;
|
|
3517
4199
|
};
|
|
3518
|
-
type
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
4200
|
+
type AiGatewayPatchLog = {
|
|
4201
|
+
score?: number | null;
|
|
4202
|
+
feedback?: -1 | 1 | null;
|
|
4203
|
+
metadata?: Record<string, number | string | boolean | null | bigint> | null;
|
|
3522
4204
|
};
|
|
3523
|
-
type
|
|
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
|
-
| "
|
|
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
|
-
): Promise<
|
|
3597
|
-
|
|
3598
|
-
model: BaseAiSpeechRecognitionModels,
|
|
3599
|
-
inputs: BaseAiSpeechRecognition["inputs"],
|
|
3600
|
-
options?: AiOptions,
|
|
3601
|
-
): Promise<BaseAiSpeechRecognition["postProcessedOutputs"]>;
|
|
3602
|
-
run(
|
|
3603
|
-
model: BaseAiImageClassificationModels,
|
|
3604
|
-
inputs: BaseAiImageClassification["inputs"],
|
|
3605
|
-
options?: AiOptions,
|
|
3606
|
-
): Promise<BaseAiImageClassification["postProcessedOutputs"]>;
|
|
3607
|
-
run(
|
|
3608
|
-
model: BaseAiObjectDetectionModels,
|
|
3609
|
-
inputs: BaseAiObjectDetection["inputs"],
|
|
3610
|
-
options?: AiOptions,
|
|
3611
|
-
): Promise<BaseAiObjectDetection["postProcessedOutputs"]>;
|
|
3612
|
-
run(
|
|
3613
|
-
model: BaseAiTextGenerationModels,
|
|
3614
|
-
inputs: BaseAiTextGeneration["inputs"],
|
|
3615
|
-
options?: AiOptions,
|
|
3616
|
-
): Promise<BaseAiTextGeneration["postProcessedOutputs"]>;
|
|
3617
|
-
run(
|
|
3618
|
-
model: BaseAiTranslationModels,
|
|
3619
|
-
inputs: BaseAiTranslation["inputs"],
|
|
3620
|
-
options?: AiOptions,
|
|
3621
|
-
): Promise<BaseAiTranslation["postProcessedOutputs"]>;
|
|
3622
|
-
run(
|
|
3623
|
-
model: BaseAiSummarizationModels,
|
|
3624
|
-
inputs: BaseAiSummarization["inputs"],
|
|
3625
|
-
options?: AiOptions,
|
|
3626
|
-
): Promise<BaseAiSummarization["postProcessedOutputs"]>;
|
|
4205
|
+
type AiGatewayLog = {
|
|
4206
|
+
id: string;
|
|
4207
|
+
provider: string;
|
|
4208
|
+
model: string;
|
|
4209
|
+
model_type?: string;
|
|
4210
|
+
path: string;
|
|
4211
|
+
duration: number;
|
|
4212
|
+
request_type?: string;
|
|
4213
|
+
request_content_type?: string;
|
|
4214
|
+
status_code: number;
|
|
4215
|
+
response_content_type?: string;
|
|
4216
|
+
success: boolean;
|
|
4217
|
+
cached: boolean;
|
|
4218
|
+
tokens_in?: number;
|
|
4219
|
+
tokens_out?: number;
|
|
4220
|
+
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
4221
|
+
step?: number;
|
|
4222
|
+
cost?: number;
|
|
4223
|
+
custom_cost?: boolean;
|
|
4224
|
+
request_size: number;
|
|
4225
|
+
request_head?: string;
|
|
4226
|
+
request_head_complete: boolean;
|
|
4227
|
+
response_size: number;
|
|
4228
|
+
response_head?: string;
|
|
4229
|
+
response_head_complete: boolean;
|
|
4230
|
+
created_at: Date;
|
|
4231
|
+
};
|
|
4232
|
+
type AIGatewayProviders =
|
|
4233
|
+
| "workers-ai"
|
|
4234
|
+
| "anthropic"
|
|
4235
|
+
| "aws-bedrock"
|
|
4236
|
+
| "azure-openai"
|
|
4237
|
+
| "google-vertex-ai"
|
|
4238
|
+
| "huggingface"
|
|
4239
|
+
| "openai"
|
|
4240
|
+
| "perplexity-ai"
|
|
4241
|
+
| "replicate"
|
|
4242
|
+
| "groq"
|
|
4243
|
+
| "cohere"
|
|
4244
|
+
| "google-ai-studio"
|
|
4245
|
+
| "mistral"
|
|
4246
|
+
| "grok"
|
|
4247
|
+
| "openrouter";
|
|
4248
|
+
type AIGatewayHeaders = {
|
|
4249
|
+
"cf-aig-metadata":
|
|
4250
|
+
| Record<string, number | string | boolean | null | bigint>
|
|
4251
|
+
| string;
|
|
4252
|
+
"cf-aig-custom-cost":
|
|
4253
|
+
| {
|
|
4254
|
+
per_token_in?: number;
|
|
4255
|
+
per_token_out?: number;
|
|
4256
|
+
}
|
|
4257
|
+
| {
|
|
4258
|
+
total_cost?: number;
|
|
4259
|
+
}
|
|
4260
|
+
| string;
|
|
4261
|
+
"cf-aig-cache-ttl": number | string;
|
|
4262
|
+
"cf-aig-skip-cache": boolean | string;
|
|
4263
|
+
"cf-aig-cache-key": string;
|
|
4264
|
+
"cf-aig-collect-log": boolean | string;
|
|
4265
|
+
Authorization: string;
|
|
4266
|
+
"Content-Type": string;
|
|
4267
|
+
[key: string]: string | number | boolean | object;
|
|
4268
|
+
};
|
|
4269
|
+
type AIGatewayUniversalRequest = {
|
|
4270
|
+
provider: AIGatewayProviders | string; // eslint-disable-line
|
|
4271
|
+
endpoint: string;
|
|
4272
|
+
headers: Partial<AIGatewayHeaders>;
|
|
4273
|
+
query: unknown;
|
|
4274
|
+
};
|
|
4275
|
+
interface AiGatewayInternalError extends Error {}
|
|
4276
|
+
interface AiGatewayLogNotFound extends Error {}
|
|
4277
|
+
declare abstract class AiGateway {
|
|
4278
|
+
patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
|
|
4279
|
+
getLog(logId: string): Promise<AiGatewayLog>;
|
|
3627
4280
|
run(
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
options?: AiOptions,
|
|
3631
|
-
): Promise<BaseAiImageToText["postProcessedOutputs"]>;
|
|
4281
|
+
data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
|
|
4282
|
+
): Promise<Response>;
|
|
3632
4283
|
}
|
|
3633
4284
|
interface BasicImageTransformations {
|
|
3634
4285
|
/**
|
|
@@ -4634,7 +5285,7 @@ declare abstract class D1PreparedStatement {
|
|
|
4634
5285
|
bind(...values: unknown[]): D1PreparedStatement;
|
|
4635
5286
|
first<T = unknown>(colName: string): Promise<T | null>;
|
|
4636
5287
|
first<T = Record<string, unknown>>(): Promise<T | null>;
|
|
4637
|
-
run(): Promise<
|
|
5288
|
+
run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
|
|
4638
5289
|
all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
|
|
4639
5290
|
raw<T = unknown[]>(options: {
|
|
4640
5291
|
columnNames: true;
|
|
@@ -4690,6 +5341,12 @@ interface ForwardableEmailMessage extends EmailMessage {
|
|
|
4690
5341
|
* @returns A promise that resolves when the email message is forwarded.
|
|
4691
5342
|
*/
|
|
4692
5343
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
5344
|
+
/**
|
|
5345
|
+
* Reply to the sender of this email message with a new EmailMessage object.
|
|
5346
|
+
* @param message The reply message.
|
|
5347
|
+
* @returns A promise that resolves when the email message is replied.
|
|
5348
|
+
*/
|
|
5349
|
+
reply(message: EmailMessage): Promise<void>;
|
|
4693
5350
|
}
|
|
4694
5351
|
/**
|
|
4695
5352
|
* A binding that allows a Worker to send email messages.
|
|
@@ -4759,6 +5416,128 @@ interface Hyperdrive {
|
|
|
4759
5416
|
*/
|
|
4760
5417
|
readonly database: string;
|
|
4761
5418
|
}
|
|
5419
|
+
// Copyright (c) 2024 Cloudflare, Inc.
|
|
5420
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5421
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5422
|
+
type ImageInfoResponse =
|
|
5423
|
+
| {
|
|
5424
|
+
format: "image/svg+xml";
|
|
5425
|
+
}
|
|
5426
|
+
| {
|
|
5427
|
+
format: string;
|
|
5428
|
+
fileSize: number;
|
|
5429
|
+
width: number;
|
|
5430
|
+
height: number;
|
|
5431
|
+
};
|
|
5432
|
+
type ImageTransform = {
|
|
5433
|
+
fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
|
|
5434
|
+
gravity?:
|
|
5435
|
+
| "left"
|
|
5436
|
+
| "right"
|
|
5437
|
+
| "top"
|
|
5438
|
+
| "bottom"
|
|
5439
|
+
| "center"
|
|
5440
|
+
| "auto"
|
|
5441
|
+
| "entropy"
|
|
5442
|
+
| "face"
|
|
5443
|
+
| {
|
|
5444
|
+
x?: number;
|
|
5445
|
+
y?: number;
|
|
5446
|
+
mode: "remainder" | "box-center";
|
|
5447
|
+
};
|
|
5448
|
+
trim?: {
|
|
5449
|
+
top?: number;
|
|
5450
|
+
bottom?: number;
|
|
5451
|
+
left?: number;
|
|
5452
|
+
right?: number;
|
|
5453
|
+
width?: number;
|
|
5454
|
+
height?: number;
|
|
5455
|
+
border?:
|
|
5456
|
+
| boolean
|
|
5457
|
+
| {
|
|
5458
|
+
color?: string;
|
|
5459
|
+
tolerance?: number;
|
|
5460
|
+
keep?: number;
|
|
5461
|
+
};
|
|
5462
|
+
};
|
|
5463
|
+
width?: number;
|
|
5464
|
+
height?: number;
|
|
5465
|
+
background?: string;
|
|
5466
|
+
rotate?: number;
|
|
5467
|
+
sharpen?: number;
|
|
5468
|
+
blur?: number;
|
|
5469
|
+
contrast?: number;
|
|
5470
|
+
brightness?: number;
|
|
5471
|
+
gamma?: number;
|
|
5472
|
+
border?: {
|
|
5473
|
+
color?: string;
|
|
5474
|
+
width?: number;
|
|
5475
|
+
top?: number;
|
|
5476
|
+
bottom?: number;
|
|
5477
|
+
left?: number;
|
|
5478
|
+
right?: number;
|
|
5479
|
+
};
|
|
5480
|
+
zoom?: number;
|
|
5481
|
+
};
|
|
5482
|
+
type ImageOutputOptions = {
|
|
5483
|
+
format:
|
|
5484
|
+
| "image/jpeg"
|
|
5485
|
+
| "image/png"
|
|
5486
|
+
| "image/gif"
|
|
5487
|
+
| "image/webp"
|
|
5488
|
+
| "image/avif"
|
|
5489
|
+
| "rgb"
|
|
5490
|
+
| "rgba";
|
|
5491
|
+
quality?: number;
|
|
5492
|
+
background?: string;
|
|
5493
|
+
};
|
|
5494
|
+
interface ImagesBinding {
|
|
5495
|
+
/**
|
|
5496
|
+
* Get image metadata (type, width and height)
|
|
5497
|
+
* @throws {@link ImagesError} with code 9412 if input is not an image
|
|
5498
|
+
* @param stream The image bytes
|
|
5499
|
+
*/
|
|
5500
|
+
info(stream: ReadableStream<Uint8Array>): Promise<ImageInfoResponse>;
|
|
5501
|
+
/**
|
|
5502
|
+
* Begin applying a series of transformations to an image
|
|
5503
|
+
* @param stream The image bytes
|
|
5504
|
+
* @returns A transform handle
|
|
5505
|
+
*/
|
|
5506
|
+
input(stream: ReadableStream<Uint8Array>): ImageTransformer;
|
|
5507
|
+
}
|
|
5508
|
+
interface ImageTransformer {
|
|
5509
|
+
/**
|
|
5510
|
+
* Apply transform next, returning a transform handle.
|
|
5511
|
+
* You can then apply more transformations or retrieve the output.
|
|
5512
|
+
* @param transform
|
|
5513
|
+
*/
|
|
5514
|
+
transform(transform: ImageTransform): ImageTransformer;
|
|
5515
|
+
/**
|
|
5516
|
+
* Retrieve the image that results from applying the transforms to the
|
|
5517
|
+
* provided input
|
|
5518
|
+
* @param options Options that apply to the output e.g. output format
|
|
5519
|
+
*/
|
|
5520
|
+
output(options: ImageOutputOptions): Promise<ImageTransformationResult>;
|
|
5521
|
+
}
|
|
5522
|
+
interface ImageTransformationResult {
|
|
5523
|
+
/**
|
|
5524
|
+
* The image as a response, ready to store in cache or return to users
|
|
5525
|
+
*/
|
|
5526
|
+
response(): Response;
|
|
5527
|
+
/**
|
|
5528
|
+
* The content type of the returned image
|
|
5529
|
+
*/
|
|
5530
|
+
contentType(): string;
|
|
5531
|
+
/**
|
|
5532
|
+
* The bytes of the response
|
|
5533
|
+
*/
|
|
5534
|
+
image(): ReadableStream<Uint8Array>;
|
|
5535
|
+
}
|
|
5536
|
+
interface ImagesError extends Error {
|
|
5537
|
+
readonly code: number;
|
|
5538
|
+
readonly message: string;
|
|
5539
|
+
readonly stack?: string;
|
|
5540
|
+
}
|
|
4762
5541
|
type Params<P extends string = any> = Record<P, string | string[]>;
|
|
4763
5542
|
type EventContext<Env, P extends string, Data> = {
|
|
4764
5543
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -4805,6 +5584,30 @@ type PagesPluginFunction<
|
|
|
4805
5584
|
declare module "assets:*" {
|
|
4806
5585
|
export const onRequest: PagesFunction;
|
|
4807
5586
|
}
|
|
5587
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5588
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5589
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5590
|
+
declare abstract class PipelineTransform {
|
|
5591
|
+
/**
|
|
5592
|
+
* transformJson recieves an array of javascript objects which can be
|
|
5593
|
+
* mutated and returned to the pipeline
|
|
5594
|
+
* @param data The data to be mutated
|
|
5595
|
+
* @returns A promise containing the mutated data
|
|
5596
|
+
*/
|
|
5597
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
5598
|
+
}
|
|
5599
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5600
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5601
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5602
|
+
interface Pipeline {
|
|
5603
|
+
/**
|
|
5604
|
+
* send takes an array of javascript objects which are
|
|
5605
|
+
* then received by the pipeline for processing
|
|
5606
|
+
*
|
|
5607
|
+
* @param data The data to be sent
|
|
5608
|
+
*/
|
|
5609
|
+
send(data: object[]): Promise<void>;
|
|
5610
|
+
}
|
|
4808
5611
|
// PubSubMessage represents an incoming PubSub message.
|
|
4809
5612
|
// The message includes metadata about the broker, the client, and the payload
|
|
4810
5613
|
// itself.
|
|
@@ -4865,6 +5668,7 @@ declare namespace Rpc {
|
|
|
4865
5668
|
export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
|
|
4866
5669
|
export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
|
|
4867
5670
|
export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
|
|
5671
|
+
export const __WORKFLOW_ENTRYPOINT_BRAND: "__WORKFLOW_ENTRYPOINT_BRAND";
|
|
4868
5672
|
export interface RpcTargetBranded {
|
|
4869
5673
|
[__RPC_TARGET_BRAND]: never;
|
|
4870
5674
|
}
|
|
@@ -4874,13 +5678,20 @@ declare namespace Rpc {
|
|
|
4874
5678
|
export interface DurableObjectBranded {
|
|
4875
5679
|
[__DURABLE_OBJECT_BRAND]: never;
|
|
4876
5680
|
}
|
|
5681
|
+
export interface WorkflowEntrypointBranded {
|
|
5682
|
+
[__WORKFLOW_ENTRYPOINT_BRAND]: never;
|
|
5683
|
+
}
|
|
4877
5684
|
export type EntrypointBranded =
|
|
4878
5685
|
| WorkerEntrypointBranded
|
|
4879
|
-
| DurableObjectBranded
|
|
5686
|
+
| DurableObjectBranded
|
|
5687
|
+
| WorkflowEntrypointBranded;
|
|
4880
5688
|
// Types that can be used through `Stub`s
|
|
4881
5689
|
export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
|
|
4882
5690
|
// Types that can be passed over RPC
|
|
4883
|
-
type
|
|
5691
|
+
// The reason for using a generic type here is to build a serializable subset of structured
|
|
5692
|
+
// cloneable composite types. This allows types defined with the "interface" keyword to pass the
|
|
5693
|
+
// serializable check as well. Otherwise, only types defined with the "type" keyword would pass.
|
|
5694
|
+
type Serializable<T> =
|
|
4884
5695
|
// Structured cloneables
|
|
4885
5696
|
| void
|
|
4886
5697
|
| undefined
|
|
@@ -4896,11 +5707,14 @@ declare namespace Rpc {
|
|
|
4896
5707
|
| Error
|
|
4897
5708
|
| RegExp
|
|
4898
5709
|
// Structured cloneable composites
|
|
4899
|
-
| Map<
|
|
4900
|
-
|
|
4901
|
-
|
|
5710
|
+
| Map<
|
|
5711
|
+
T extends Map<infer U, unknown> ? Serializable<U> : never,
|
|
5712
|
+
T extends Map<unknown, infer U> ? Serializable<U> : never
|
|
5713
|
+
>
|
|
5714
|
+
| Set<T extends Set<infer U> ? Serializable<U> : never>
|
|
5715
|
+
| ReadonlyArray<T extends ReadonlyArray<infer U> ? Serializable<U> : never>
|
|
4902
5716
|
| {
|
|
4903
|
-
[
|
|
5717
|
+
[K in keyof T]: K extends number | string ? Serializable<T[K]> : never;
|
|
4904
5718
|
}
|
|
4905
5719
|
// Special types
|
|
4906
5720
|
| ReadableStream<Uint8Array>
|
|
@@ -4930,7 +5744,7 @@ declare namespace Rpc {
|
|
|
4930
5744
|
: T extends ReadonlyArray<infer V>
|
|
4931
5745
|
? ReadonlyArray<Stubify<V>>
|
|
4932
5746
|
: T extends {
|
|
4933
|
-
[key: string | number]:
|
|
5747
|
+
[key: string | number]: any;
|
|
4934
5748
|
}
|
|
4935
5749
|
? {
|
|
4936
5750
|
[K in keyof T]: Stubify<T[K]>;
|
|
@@ -4973,7 +5787,7 @@ declare namespace Rpc {
|
|
|
4973
5787
|
// Intersecting with `(Maybe)Provider` allows pipelining.
|
|
4974
5788
|
type Result<R> = R extends Stubable
|
|
4975
5789
|
? Promise<Stub<R>> & Provider<R>
|
|
4976
|
-
: R extends Serializable
|
|
5790
|
+
: R extends Serializable<R>
|
|
4977
5791
|
? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R>
|
|
4978
5792
|
: never;
|
|
4979
5793
|
// Type for method or property on an RPC interface.
|
|
@@ -5033,7 +5847,7 @@ declare module "cloudflare:workers" {
|
|
|
5033
5847
|
protected env: Env;
|
|
5034
5848
|
constructor(ctx: DurableObjectState, env: Env);
|
|
5035
5849
|
fetch?(request: Request): Response | Promise<Response>;
|
|
5036
|
-
alarm?(): void | Promise<void>;
|
|
5850
|
+
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
|
|
5037
5851
|
webSocketMessage?(
|
|
5038
5852
|
ws: WebSocket,
|
|
5039
5853
|
message: string | ArrayBuffer,
|
|
@@ -5046,6 +5860,60 @@ declare module "cloudflare:workers" {
|
|
|
5046
5860
|
): void | Promise<void>;
|
|
5047
5861
|
webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
|
|
5048
5862
|
}
|
|
5863
|
+
export type WorkflowDurationLabel =
|
|
5864
|
+
| "second"
|
|
5865
|
+
| "minute"
|
|
5866
|
+
| "hour"
|
|
5867
|
+
| "day"
|
|
5868
|
+
| "week"
|
|
5869
|
+
| "month"
|
|
5870
|
+
| "year";
|
|
5871
|
+
export type WorkflowSleepDuration =
|
|
5872
|
+
| `${number} ${WorkflowDurationLabel}${"s" | ""}`
|
|
5873
|
+
| number;
|
|
5874
|
+
export type WorkflowDelayDuration = WorkflowSleepDuration;
|
|
5875
|
+
export type WorkflowTimeoutDuration = WorkflowSleepDuration;
|
|
5876
|
+
export type WorkflowBackoff = "constant" | "linear" | "exponential";
|
|
5877
|
+
export type WorkflowStepConfig = {
|
|
5878
|
+
retries?: {
|
|
5879
|
+
limit: number;
|
|
5880
|
+
delay: WorkflowDelayDuration | number;
|
|
5881
|
+
backoff?: WorkflowBackoff;
|
|
5882
|
+
};
|
|
5883
|
+
timeout?: WorkflowTimeoutDuration | number;
|
|
5884
|
+
};
|
|
5885
|
+
export type WorkflowEvent<T> = {
|
|
5886
|
+
payload: Readonly<T>;
|
|
5887
|
+
timestamp: Date;
|
|
5888
|
+
instanceId: string;
|
|
5889
|
+
};
|
|
5890
|
+
export abstract class WorkflowStep {
|
|
5891
|
+
do<T extends Rpc.Serializable<T>>(
|
|
5892
|
+
name: string,
|
|
5893
|
+
callback: () => Promise<T>,
|
|
5894
|
+
): Promise<T>;
|
|
5895
|
+
do<T extends Rpc.Serializable<T>>(
|
|
5896
|
+
name: string,
|
|
5897
|
+
config: WorkflowStepConfig,
|
|
5898
|
+
callback: () => Promise<T>,
|
|
5899
|
+
): Promise<T>;
|
|
5900
|
+
sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
|
|
5901
|
+
sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
|
|
5902
|
+
}
|
|
5903
|
+
export abstract class WorkflowEntrypoint<
|
|
5904
|
+
Env = unknown,
|
|
5905
|
+
T extends Rpc.Serializable<T> | unknown = unknown,
|
|
5906
|
+
> implements Rpc.WorkflowEntrypointBranded
|
|
5907
|
+
{
|
|
5908
|
+
[Rpc.__WORKFLOW_ENTRYPOINT_BRAND]: never;
|
|
5909
|
+
protected ctx: ExecutionContext;
|
|
5910
|
+
protected env: Env;
|
|
5911
|
+
constructor(ctx: ExecutionContext, env: Env);
|
|
5912
|
+
run(
|
|
5913
|
+
event: Readonly<WorkflowEvent<T>>,
|
|
5914
|
+
step: WorkflowStep,
|
|
5915
|
+
): Promise<unknown>;
|
|
5916
|
+
}
|
|
5049
5917
|
}
|
|
5050
5918
|
declare module "cloudflare:sockets" {
|
|
5051
5919
|
function _connect(
|
|
@@ -5054,6 +5922,198 @@ declare module "cloudflare:sockets" {
|
|
|
5054
5922
|
): Socket;
|
|
5055
5923
|
export { _connect as connect };
|
|
5056
5924
|
}
|
|
5925
|
+
declare namespace TailStream {
|
|
5926
|
+
interface Header {
|
|
5927
|
+
readonly name: string;
|
|
5928
|
+
readonly value: string;
|
|
5929
|
+
}
|
|
5930
|
+
interface FetchEventInfo {
|
|
5931
|
+
readonly type: "fetch";
|
|
5932
|
+
readonly method: string;
|
|
5933
|
+
readonly url: string;
|
|
5934
|
+
readonly cfJson: string;
|
|
5935
|
+
readonly headers: Header[];
|
|
5936
|
+
}
|
|
5937
|
+
interface JsRpcEventInfo {
|
|
5938
|
+
readonly type: "jsrpc";
|
|
5939
|
+
readonly methodName: string;
|
|
5940
|
+
}
|
|
5941
|
+
interface ScheduledEventInfo {
|
|
5942
|
+
readonly type: "scheduled";
|
|
5943
|
+
readonly scheduledTime: Date;
|
|
5944
|
+
readonly cron: string;
|
|
5945
|
+
}
|
|
5946
|
+
interface AlarmEventInfo {
|
|
5947
|
+
readonly type: "alarm";
|
|
5948
|
+
readonly scheduledTime: Date;
|
|
5949
|
+
}
|
|
5950
|
+
interface QueueEventInfo {
|
|
5951
|
+
readonly type: "queue";
|
|
5952
|
+
readonly queueName: string;
|
|
5953
|
+
readonly batchSize: number;
|
|
5954
|
+
}
|
|
5955
|
+
interface EmailEventInfo {
|
|
5956
|
+
readonly type: "email";
|
|
5957
|
+
readonly mailFrom: string;
|
|
5958
|
+
readonly rcptTo: string;
|
|
5959
|
+
readonly rawSize: number;
|
|
5960
|
+
}
|
|
5961
|
+
interface TraceEventInfo {
|
|
5962
|
+
readonly type: "trace";
|
|
5963
|
+
readonly traces: (string | null)[];
|
|
5964
|
+
}
|
|
5965
|
+
interface HibernatableWebSocketEventInfoMessage {
|
|
5966
|
+
readonly type: "message";
|
|
5967
|
+
}
|
|
5968
|
+
interface HibernatableWebSocketEventInfoError {
|
|
5969
|
+
readonly type: "error";
|
|
5970
|
+
}
|
|
5971
|
+
interface HibernatableWebSocketEventInfoClose {
|
|
5972
|
+
readonly type: "close";
|
|
5973
|
+
readonly code: number;
|
|
5974
|
+
readonly wasClean: boolean;
|
|
5975
|
+
}
|
|
5976
|
+
interface HibernatableWebSocketEventInfo {
|
|
5977
|
+
readonly type: "hibernatableWebSocket";
|
|
5978
|
+
readonly info:
|
|
5979
|
+
| HibernatableWebSocketEventInfoClose
|
|
5980
|
+
| HibernatableWebSocketEventInfoError
|
|
5981
|
+
| HibernatableWebSocketEventInfoMessage;
|
|
5982
|
+
}
|
|
5983
|
+
interface Resume {
|
|
5984
|
+
readonly type: "resume";
|
|
5985
|
+
readonly attachment?: any;
|
|
5986
|
+
}
|
|
5987
|
+
interface CustomEventInfo {
|
|
5988
|
+
readonly type: "custom";
|
|
5989
|
+
}
|
|
5990
|
+
interface FetchResponseInfo {
|
|
5991
|
+
readonly type: "fetch";
|
|
5992
|
+
readonly statusCode: number;
|
|
5993
|
+
}
|
|
5994
|
+
type EventOutcome =
|
|
5995
|
+
| "ok"
|
|
5996
|
+
| "canceled"
|
|
5997
|
+
| "exception"
|
|
5998
|
+
| "unknown"
|
|
5999
|
+
| "killSwitch"
|
|
6000
|
+
| "daemonDown"
|
|
6001
|
+
| "exceededCpu"
|
|
6002
|
+
| "exceededMemory"
|
|
6003
|
+
| "loadShed"
|
|
6004
|
+
| "responseStreamDisconnected"
|
|
6005
|
+
| "scriptNotFound";
|
|
6006
|
+
interface ScriptVersion {
|
|
6007
|
+
readonly id: string;
|
|
6008
|
+
readonly tag?: string;
|
|
6009
|
+
readonly message?: string;
|
|
6010
|
+
}
|
|
6011
|
+
interface Trigger {
|
|
6012
|
+
readonly traceId: string;
|
|
6013
|
+
readonly invocationId: string;
|
|
6014
|
+
readonly spanId: string;
|
|
6015
|
+
}
|
|
6016
|
+
interface Onset {
|
|
6017
|
+
readonly type: "onset";
|
|
6018
|
+
readonly dispatchNamespace?: string;
|
|
6019
|
+
readonly entrypoint?: string;
|
|
6020
|
+
readonly scriptName?: string;
|
|
6021
|
+
readonly scriptTags?: string[];
|
|
6022
|
+
readonly scriptVersion?: ScriptVersion;
|
|
6023
|
+
readonly trigger?: Trigger;
|
|
6024
|
+
readonly info:
|
|
6025
|
+
| FetchEventInfo
|
|
6026
|
+
| JsRpcEventInfo
|
|
6027
|
+
| ScheduledEventInfo
|
|
6028
|
+
| AlarmEventInfo
|
|
6029
|
+
| QueueEventInfo
|
|
6030
|
+
| EmailEventInfo
|
|
6031
|
+
| TraceEventInfo
|
|
6032
|
+
| HibernatableWebSocketEventInfo
|
|
6033
|
+
| Resume
|
|
6034
|
+
| CustomEventInfo;
|
|
6035
|
+
}
|
|
6036
|
+
interface Outcome {
|
|
6037
|
+
readonly type: "outcome";
|
|
6038
|
+
readonly outcome: EventOutcome;
|
|
6039
|
+
readonly cpuTime: number;
|
|
6040
|
+
readonly wallTime: number;
|
|
6041
|
+
}
|
|
6042
|
+
interface Hibernate {
|
|
6043
|
+
readonly type: "hibernate";
|
|
6044
|
+
}
|
|
6045
|
+
interface SpanOpen {
|
|
6046
|
+
readonly type: "spanOpen";
|
|
6047
|
+
readonly op?: string;
|
|
6048
|
+
readonly info?: FetchEventInfo | JsRpcEventInfo | Attribute[];
|
|
6049
|
+
}
|
|
6050
|
+
interface SpanClose {
|
|
6051
|
+
readonly type: "spanClose";
|
|
6052
|
+
readonly outcome: EventOutcome;
|
|
6053
|
+
}
|
|
6054
|
+
interface DiagnosticChannelEvent {
|
|
6055
|
+
readonly type: "diagnosticChannel";
|
|
6056
|
+
readonly channel: string;
|
|
6057
|
+
readonly message: any;
|
|
6058
|
+
}
|
|
6059
|
+
interface Exception {
|
|
6060
|
+
readonly type: "exception";
|
|
6061
|
+
readonly name: string;
|
|
6062
|
+
readonly message: string;
|
|
6063
|
+
readonly stack?: string;
|
|
6064
|
+
}
|
|
6065
|
+
interface Log {
|
|
6066
|
+
readonly type: "log";
|
|
6067
|
+
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
6068
|
+
readonly message: string;
|
|
6069
|
+
}
|
|
6070
|
+
interface Return {
|
|
6071
|
+
readonly type: "return";
|
|
6072
|
+
readonly info?: FetchResponseInfo | Attribute[];
|
|
6073
|
+
}
|
|
6074
|
+
interface Link {
|
|
6075
|
+
readonly type: "link";
|
|
6076
|
+
readonly label?: string;
|
|
6077
|
+
readonly traceId: string;
|
|
6078
|
+
readonly invocationId: string;
|
|
6079
|
+
readonly spanId: string;
|
|
6080
|
+
}
|
|
6081
|
+
interface Attribute {
|
|
6082
|
+
readonly type: "attribute";
|
|
6083
|
+
readonly name: string;
|
|
6084
|
+
readonly value: string | string[] | boolean | boolean[] | number | number[];
|
|
6085
|
+
}
|
|
6086
|
+
type Mark =
|
|
6087
|
+
| DiagnosticChannelEvent
|
|
6088
|
+
| Exception
|
|
6089
|
+
| Log
|
|
6090
|
+
| Return
|
|
6091
|
+
| Link
|
|
6092
|
+
| Attribute[];
|
|
6093
|
+
interface TailEvent {
|
|
6094
|
+
readonly traceId: string;
|
|
6095
|
+
readonly invocationId: string;
|
|
6096
|
+
readonly spanId: string;
|
|
6097
|
+
readonly timestamp: Date;
|
|
6098
|
+
readonly sequence: number;
|
|
6099
|
+
readonly event: Onset | Outcome | Hibernate | SpanOpen | SpanClose | Mark;
|
|
6100
|
+
}
|
|
6101
|
+
type TailEventHandler = (event: TailEvent) => void | Promise<void>;
|
|
6102
|
+
type TailEventHandlerName =
|
|
6103
|
+
| "onset"
|
|
6104
|
+
| "outcome"
|
|
6105
|
+
| "hibernate"
|
|
6106
|
+
| "spanOpen"
|
|
6107
|
+
| "spanClose"
|
|
6108
|
+
| "diagnosticChannel"
|
|
6109
|
+
| "exception"
|
|
6110
|
+
| "log"
|
|
6111
|
+
| "return"
|
|
6112
|
+
| "link"
|
|
6113
|
+
| "attribute";
|
|
6114
|
+
type TailEventHandlerObject = Record<TailEventHandlerName, TailEventHandler>;
|
|
6115
|
+
type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;
|
|
6116
|
+
}
|
|
5057
6117
|
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5058
6118
|
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5059
6119
|
// https://opensource.org/licenses/Apache-2.0
|
|
@@ -5097,11 +6157,21 @@ type VectorizeVectorMetadataFilter = {
|
|
|
5097
6157
|
* Distance metrics determine how other "similar" vectors are determined.
|
|
5098
6158
|
*/
|
|
5099
6159
|
type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
|
|
6160
|
+
/**
|
|
6161
|
+
* Metadata return levels for a Vectorize query.
|
|
6162
|
+
*
|
|
6163
|
+
* Default to "none".
|
|
6164
|
+
*
|
|
6165
|
+
* @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.
|
|
6166
|
+
* @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).
|
|
6167
|
+
* @property none No indexed metadata will be returned.
|
|
6168
|
+
*/
|
|
6169
|
+
type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
|
|
5100
6170
|
interface VectorizeQueryOptions {
|
|
5101
6171
|
topK?: number;
|
|
5102
6172
|
namespace?: string;
|
|
5103
6173
|
returnValues?: boolean;
|
|
5104
|
-
returnMetadata?: boolean;
|
|
6174
|
+
returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
|
|
5105
6175
|
filter?: VectorizeVectorMetadataFilter;
|
|
5106
6176
|
}
|
|
5107
6177
|
/**
|
|
@@ -5117,6 +6187,9 @@ type VectorizeIndexConfig =
|
|
|
5117
6187
|
};
|
|
5118
6188
|
/**
|
|
5119
6189
|
* Metadata about an existing index.
|
|
6190
|
+
*
|
|
6191
|
+
* This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
|
|
6192
|
+
* See {@link VectorizeIndexInfo} for its post-beta equivalent.
|
|
5120
6193
|
*/
|
|
5121
6194
|
interface VectorizeIndexDetails {
|
|
5122
6195
|
/** The unique ID of the index */
|
|
@@ -5130,6 +6203,19 @@ interface VectorizeIndexDetails {
|
|
|
5130
6203
|
/** The number of records containing vectors within the index. */
|
|
5131
6204
|
vectorsCount: number;
|
|
5132
6205
|
}
|
|
6206
|
+
/**
|
|
6207
|
+
* Metadata about an existing index.
|
|
6208
|
+
*/
|
|
6209
|
+
interface VectorizeIndexInfo {
|
|
6210
|
+
/** The number of records containing vectors within the index. */
|
|
6211
|
+
vectorCount: number;
|
|
6212
|
+
/** Number of dimensions the index has been configured for. */
|
|
6213
|
+
dimensions: number;
|
|
6214
|
+
/** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
|
|
6215
|
+
processedUpToDatetime: number;
|
|
6216
|
+
/** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
|
|
6217
|
+
processedUpToMutation: number;
|
|
6218
|
+
}
|
|
5133
6219
|
/**
|
|
5134
6220
|
* Represents a single vector value set along with its associated metadata.
|
|
5135
6221
|
*/
|
|
@@ -5140,7 +6226,7 @@ interface VectorizeVector {
|
|
|
5140
6226
|
values: VectorFloatArray | number[];
|
|
5141
6227
|
/** The namespace this vector belongs to. */
|
|
5142
6228
|
namespace?: string;
|
|
5143
|
-
/** Metadata associated with the vector. Includes the values of
|
|
6229
|
+
/** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
|
|
5144
6230
|
metadata?: Record<string, VectorizeVectorMetadata>;
|
|
5145
6231
|
}
|
|
5146
6232
|
/**
|
|
@@ -5152,7 +6238,7 @@ type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
|
|
|
5152
6238
|
score: number;
|
|
5153
6239
|
};
|
|
5154
6240
|
/**
|
|
5155
|
-
* A set of
|
|
6241
|
+
* A set of matching {@link VectorizeMatch} for a particular query.
|
|
5156
6242
|
*/
|
|
5157
6243
|
interface VectorizeMatches {
|
|
5158
6244
|
matches: VectorizeMatch[];
|
|
@@ -5161,6 +6247,9 @@ interface VectorizeMatches {
|
|
|
5161
6247
|
/**
|
|
5162
6248
|
* Results of an operation that performed a mutation on a set of vectors.
|
|
5163
6249
|
* Here, `ids` is a list of vectors that were successfully processed.
|
|
6250
|
+
*
|
|
6251
|
+
* This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
|
|
6252
|
+
* See {@link VectorizeAsyncMutation} for its post-beta equivalent.
|
|
5164
6253
|
*/
|
|
5165
6254
|
interface VectorizeVectorMutation {
|
|
5166
6255
|
/* List of ids of vectors that were successfully processed. */
|
|
@@ -5169,14 +6258,19 @@ interface VectorizeVectorMutation {
|
|
|
5169
6258
|
count: number;
|
|
5170
6259
|
}
|
|
5171
6260
|
/**
|
|
5172
|
-
*
|
|
5173
|
-
*
|
|
5174
|
-
* Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
|
|
6261
|
+
* Result type indicating a mutation on the Vectorize Index.
|
|
6262
|
+
* Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
|
|
5175
6263
|
*/
|
|
5176
|
-
interface
|
|
5177
|
-
|
|
6264
|
+
interface VectorizeAsyncMutation {
|
|
6265
|
+
/** The unique identifier for the async mutation operation containing the changeset. */
|
|
5178
6266
|
mutationId: string;
|
|
5179
6267
|
}
|
|
6268
|
+
/**
|
|
6269
|
+
* A Vectorize Vector Search Index for querying vectors/embeddings.
|
|
6270
|
+
*
|
|
6271
|
+
* This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
|
|
6272
|
+
* See {@link Vectorize} for its new implementation.
|
|
6273
|
+
*/
|
|
5180
6274
|
declare abstract class VectorizeIndex {
|
|
5181
6275
|
/**
|
|
5182
6276
|
* Get information about the currently bound index.
|
|
@@ -5191,7 +6285,7 @@ declare abstract class VectorizeIndex {
|
|
|
5191
6285
|
*/
|
|
5192
6286
|
public query(
|
|
5193
6287
|
vector: VectorFloatArray | number[],
|
|
5194
|
-
options
|
|
6288
|
+
options?: VectorizeQueryOptions,
|
|
5195
6289
|
): Promise<VectorizeMatches>;
|
|
5196
6290
|
/**
|
|
5197
6291
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
@@ -5218,6 +6312,62 @@ declare abstract class VectorizeIndex {
|
|
|
5218
6312
|
*/
|
|
5219
6313
|
public getByIds(ids: string[]): Promise<VectorizeVector[]>;
|
|
5220
6314
|
}
|
|
6315
|
+
/**
|
|
6316
|
+
* A Vectorize Vector Search Index for querying vectors/embeddings.
|
|
6317
|
+
*
|
|
6318
|
+
* Mutations in this version are async, returning a mutation id.
|
|
6319
|
+
*/
|
|
6320
|
+
declare abstract class Vectorize {
|
|
6321
|
+
/**
|
|
6322
|
+
* Get information about the currently bound index.
|
|
6323
|
+
* @returns A promise that resolves with information about the current index.
|
|
6324
|
+
*/
|
|
6325
|
+
public describe(): Promise<VectorizeIndexInfo>;
|
|
6326
|
+
/**
|
|
6327
|
+
* Use the provided vector to perform a similarity search across the index.
|
|
6328
|
+
* @param vector Input vector that will be used to drive the similarity search.
|
|
6329
|
+
* @param options Configuration options to massage the returned data.
|
|
6330
|
+
* @returns A promise that resolves with matched and scored vectors.
|
|
6331
|
+
*/
|
|
6332
|
+
public query(
|
|
6333
|
+
vector: VectorFloatArray | number[],
|
|
6334
|
+
options?: VectorizeQueryOptions,
|
|
6335
|
+
): Promise<VectorizeMatches>;
|
|
6336
|
+
/**
|
|
6337
|
+
* Use the provided vector-id to perform a similarity search across the index.
|
|
6338
|
+
* @param vectorId Id for a vector in the index against which the index should be queried.
|
|
6339
|
+
* @param options Configuration options to massage the returned data.
|
|
6340
|
+
* @returns A promise that resolves with matched and scored vectors.
|
|
6341
|
+
*/
|
|
6342
|
+
public queryById(
|
|
6343
|
+
vectorId: string,
|
|
6344
|
+
options?: VectorizeQueryOptions,
|
|
6345
|
+
): Promise<VectorizeMatches>;
|
|
6346
|
+
/**
|
|
6347
|
+
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
6348
|
+
* @param vectors List of vectors that will be inserted.
|
|
6349
|
+
* @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
|
|
6350
|
+
*/
|
|
6351
|
+
public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
|
|
6352
|
+
/**
|
|
6353
|
+
* Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
|
|
6354
|
+
* @param vectors List of vectors that will be upserted.
|
|
6355
|
+
* @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
|
|
6356
|
+
*/
|
|
6357
|
+
public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
|
|
6358
|
+
/**
|
|
6359
|
+
* Delete a list of vectors with a matching id.
|
|
6360
|
+
* @param ids List of vector ids that should be deleted.
|
|
6361
|
+
* @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
|
|
6362
|
+
*/
|
|
6363
|
+
public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
|
|
6364
|
+
/**
|
|
6365
|
+
* Get a list of vectors with a matching id.
|
|
6366
|
+
* @param ids List of vector ids that should be returned.
|
|
6367
|
+
* @returns A promise that resolves with the raw unscored vectors matching the id set.
|
|
6368
|
+
*/
|
|
6369
|
+
public getByIds(ids: string[]): Promise<VectorizeVector[]>;
|
|
6370
|
+
}
|
|
5221
6371
|
/**
|
|
5222
6372
|
* The interface for "version_metadata" binding
|
|
5223
6373
|
* providing metadata about the Worker Version using this binding.
|
|
@@ -5268,3 +6418,79 @@ interface DispatchNamespace {
|
|
|
5268
6418
|
options?: DynamicDispatchOptions,
|
|
5269
6419
|
): Fetcher;
|
|
5270
6420
|
}
|
|
6421
|
+
declare module "cloudflare:workflows" {
|
|
6422
|
+
/**
|
|
6423
|
+
* NonRetryableError allows for a user to throw a fatal error
|
|
6424
|
+
* that makes a Workflow instance fail immediately without triggering a retry
|
|
6425
|
+
*/
|
|
6426
|
+
export class NonRetryableError extends Error {
|
|
6427
|
+
public constructor(message: string, name?: string);
|
|
6428
|
+
}
|
|
6429
|
+
}
|
|
6430
|
+
declare abstract class Workflow<PARAMS = unknown> {
|
|
6431
|
+
/**
|
|
6432
|
+
* Get a handle to an existing instance of the Workflow.
|
|
6433
|
+
* @param id Id for the instance of this Workflow
|
|
6434
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
6435
|
+
*/
|
|
6436
|
+
public get(id: string): Promise<WorkflowInstance>;
|
|
6437
|
+
/**
|
|
6438
|
+
* Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.
|
|
6439
|
+
* @param options Options when creating an instance including id and params
|
|
6440
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
6441
|
+
*/
|
|
6442
|
+
public create(
|
|
6443
|
+
options?: WorkflowInstanceCreateOptions<PARAMS>,
|
|
6444
|
+
): Promise<WorkflowInstance>;
|
|
6445
|
+
}
|
|
6446
|
+
interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
|
|
6447
|
+
/**
|
|
6448
|
+
* An id for your Workflow instance. Must be unique within the Workflow.
|
|
6449
|
+
*/
|
|
6450
|
+
id?: string;
|
|
6451
|
+
/**
|
|
6452
|
+
* The event payload the Workflow instance is triggered with
|
|
6453
|
+
*/
|
|
6454
|
+
params?: PARAMS;
|
|
6455
|
+
}
|
|
6456
|
+
type InstanceStatus = {
|
|
6457
|
+
status:
|
|
6458
|
+
| "queued" // means that instance is waiting to be started (see concurrency limits)
|
|
6459
|
+
| "running"
|
|
6460
|
+
| "paused"
|
|
6461
|
+
| "errored"
|
|
6462
|
+
| "terminated" // user terminated the instance while it was running
|
|
6463
|
+
| "complete"
|
|
6464
|
+
| "waiting" // instance is hibernating and waiting for sleep or event to finish
|
|
6465
|
+
| "waitingForPause" // instance is finishing the current work to pause
|
|
6466
|
+
| "unknown";
|
|
6467
|
+
error?: string;
|
|
6468
|
+
output?: object;
|
|
6469
|
+
};
|
|
6470
|
+
interface WorkflowError {
|
|
6471
|
+
code?: number;
|
|
6472
|
+
message: string;
|
|
6473
|
+
}
|
|
6474
|
+
declare abstract class WorkflowInstance {
|
|
6475
|
+
public id: string;
|
|
6476
|
+
/**
|
|
6477
|
+
* Pause the instance.
|
|
6478
|
+
*/
|
|
6479
|
+
public pause(): Promise<void>;
|
|
6480
|
+
/**
|
|
6481
|
+
* Resume the instance. If it is already running, an error will be thrown.
|
|
6482
|
+
*/
|
|
6483
|
+
public resume(): Promise<void>;
|
|
6484
|
+
/**
|
|
6485
|
+
* Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
|
|
6486
|
+
*/
|
|
6487
|
+
public terminate(): Promise<void>;
|
|
6488
|
+
/**
|
|
6489
|
+
* Restart the instance.
|
|
6490
|
+
*/
|
|
6491
|
+
public restart(): Promise<void>;
|
|
6492
|
+
/**
|
|
6493
|
+
* Returns the current status of the instance.
|
|
6494
|
+
*/
|
|
6495
|
+
public status(): Promise<InstanceStatus>;
|
|
6496
|
+
}
|