@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/experimental/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
|
abort(reason?: any): void;
|
|
403
407
|
}
|
|
404
408
|
export type ExportedHandlerFetchHandler<
|
|
@@ -419,6 +423,11 @@ export type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
|
419
423
|
env: Env,
|
|
420
424
|
ctx: ExecutionContext,
|
|
421
425
|
) => void | Promise<void>;
|
|
426
|
+
export type ExportedHandlerTailStreamHandler<Env = unknown> = (
|
|
427
|
+
event: TailStream.TailEvent,
|
|
428
|
+
env: Env,
|
|
429
|
+
ctx: ExecutionContext,
|
|
430
|
+
) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
|
|
422
431
|
export type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
423
432
|
controller: ScheduledController,
|
|
424
433
|
env: Env,
|
|
@@ -442,6 +451,7 @@ export interface ExportedHandler<
|
|
|
442
451
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
443
452
|
tail?: ExportedHandlerTailHandler<Env>;
|
|
444
453
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
454
|
+
tailStream?: ExportedHandlerTailStreamHandler<Env>;
|
|
445
455
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
446
456
|
test?: ExportedHandlerTestHandler<Env>;
|
|
447
457
|
email?: EmailExportedHandler<Env>;
|
|
@@ -465,8 +475,9 @@ export declare abstract class Navigator {
|
|
|
465
475
|
| string
|
|
466
476
|
| (ArrayBuffer | ArrayBufferView)
|
|
467
477
|
| Blob
|
|
478
|
+
| FormData
|
|
468
479
|
| URLSearchParams
|
|
469
|
-
|
|
|
480
|
+
| URLSearchParams,
|
|
470
481
|
): boolean;
|
|
471
482
|
readonly userAgent: string;
|
|
472
483
|
readonly gpu: GPU;
|
|
@@ -487,9 +498,12 @@ export interface AlarmInvocationInfo {
|
|
|
487
498
|
readonly isRetry: boolean;
|
|
488
499
|
readonly retryCount: number;
|
|
489
500
|
}
|
|
501
|
+
export interface Cloudflare {
|
|
502
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
503
|
+
}
|
|
490
504
|
export interface DurableObject {
|
|
491
505
|
fetch(request: Request): Response | Promise<Response>;
|
|
492
|
-
alarm?(): void | Promise<void>;
|
|
506
|
+
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
|
|
493
507
|
webSocketMessage?(
|
|
494
508
|
ws: WebSocket,
|
|
495
509
|
message: string | ArrayBuffer,
|
|
@@ -638,6 +652,9 @@ export interface DurableObjectStorage {
|
|
|
638
652
|
getCurrentBookmark(): Promise<string>;
|
|
639
653
|
getBookmarkForTime(timestamp: number | Date): Promise<string>;
|
|
640
654
|
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
|
|
655
|
+
waitForBookmark(bookmark: string): Promise<void>;
|
|
656
|
+
readonly primary?: DurableObjectStub;
|
|
657
|
+
ensureReplicas(): void;
|
|
641
658
|
}
|
|
642
659
|
export interface DurableObjectListOptions {
|
|
643
660
|
start?: string;
|
|
@@ -1008,14 +1025,17 @@ export declare abstract class CacheStorage {
|
|
|
1008
1025
|
*/
|
|
1009
1026
|
export declare abstract class Cache {
|
|
1010
1027
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
|
|
1011
|
-
delete(
|
|
1028
|
+
delete(
|
|
1029
|
+
request: RequestInfo | URL,
|
|
1030
|
+
options?: CacheQueryOptions,
|
|
1031
|
+
): Promise<boolean>;
|
|
1012
1032
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
|
|
1013
1033
|
match(
|
|
1014
|
-
request: RequestInfo,
|
|
1034
|
+
request: RequestInfo | URL,
|
|
1015
1035
|
options?: CacheQueryOptions,
|
|
1016
1036
|
): Promise<Response | undefined>;
|
|
1017
1037
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
|
|
1018
|
-
put(request: RequestInfo, response: Response): Promise<void>;
|
|
1038
|
+
put(request: RequestInfo | URL, response: Response): Promise<void>;
|
|
1019
1039
|
}
|
|
1020
1040
|
export interface CacheQueryOptions {
|
|
1021
1041
|
ignoreMethod?: boolean;
|
|
@@ -1438,20 +1458,44 @@ export interface Element {
|
|
|
1438
1458
|
hasAttribute(name: string): boolean;
|
|
1439
1459
|
setAttribute(name: string, value: string): Element;
|
|
1440
1460
|
removeAttribute(name: string): Element;
|
|
1441
|
-
before(
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1461
|
+
before(
|
|
1462
|
+
content: string | ReadableStream | Response,
|
|
1463
|
+
options?: ContentOptions,
|
|
1464
|
+
): Element;
|
|
1465
|
+
after(
|
|
1466
|
+
content: string | ReadableStream | Response,
|
|
1467
|
+
options?: ContentOptions,
|
|
1468
|
+
): Element;
|
|
1469
|
+
prepend(
|
|
1470
|
+
content: string | ReadableStream | Response,
|
|
1471
|
+
options?: ContentOptions,
|
|
1472
|
+
): Element;
|
|
1473
|
+
append(
|
|
1474
|
+
content: string | ReadableStream | Response,
|
|
1475
|
+
options?: ContentOptions,
|
|
1476
|
+
): Element;
|
|
1477
|
+
replace(
|
|
1478
|
+
content: string | ReadableStream | Response,
|
|
1479
|
+
options?: ContentOptions,
|
|
1480
|
+
): Element;
|
|
1446
1481
|
remove(): Element;
|
|
1447
1482
|
removeAndKeepContent(): Element;
|
|
1448
|
-
setInnerContent(
|
|
1483
|
+
setInnerContent(
|
|
1484
|
+
content: string | ReadableStream | Response,
|
|
1485
|
+
options?: ContentOptions,
|
|
1486
|
+
): Element;
|
|
1449
1487
|
onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
|
|
1450
1488
|
}
|
|
1451
1489
|
export interface EndTag {
|
|
1452
1490
|
name: string;
|
|
1453
|
-
before(
|
|
1454
|
-
|
|
1491
|
+
before(
|
|
1492
|
+
content: string | ReadableStream | Response,
|
|
1493
|
+
options?: ContentOptions,
|
|
1494
|
+
): EndTag;
|
|
1495
|
+
after(
|
|
1496
|
+
content: string | ReadableStream | Response,
|
|
1497
|
+
options?: ContentOptions,
|
|
1498
|
+
): EndTag;
|
|
1455
1499
|
remove(): EndTag;
|
|
1456
1500
|
}
|
|
1457
1501
|
export interface Comment {
|
|
@@ -1466,9 +1510,18 @@ export interface Text {
|
|
|
1466
1510
|
readonly text: string;
|
|
1467
1511
|
readonly lastInTextNode: boolean;
|
|
1468
1512
|
readonly removed: boolean;
|
|
1469
|
-
before(
|
|
1470
|
-
|
|
1471
|
-
|
|
1513
|
+
before(
|
|
1514
|
+
content: string | ReadableStream | Response,
|
|
1515
|
+
options?: ContentOptions,
|
|
1516
|
+
): Text;
|
|
1517
|
+
after(
|
|
1518
|
+
content: string | ReadableStream | Response,
|
|
1519
|
+
options?: ContentOptions,
|
|
1520
|
+
): Text;
|
|
1521
|
+
replace(
|
|
1522
|
+
content: string | ReadableStream | Response,
|
|
1523
|
+
options?: ContentOptions,
|
|
1524
|
+
): Text;
|
|
1472
1525
|
remove(): Text;
|
|
1473
1526
|
}
|
|
1474
1527
|
export interface DocumentEnd {
|
|
@@ -1552,28 +1605,34 @@ export declare abstract class Body {
|
|
|
1552
1605
|
*
|
|
1553
1606
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1554
1607
|
*/
|
|
1555
|
-
export declare
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1608
|
+
export declare var Response: {
|
|
1609
|
+
prototype: Response;
|
|
1610
|
+
new (body?: BodyInit | null, init?: ResponseInit): Response;
|
|
1611
|
+
redirect(url: string, status?: number): Response;
|
|
1612
|
+
json(any: any, maybeInit?: ResponseInit | Response): Response;
|
|
1613
|
+
};
|
|
1614
|
+
/**
|
|
1615
|
+
* This Fetch API interface represents the response to a request.
|
|
1616
|
+
*
|
|
1617
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1618
|
+
*/
|
|
1619
|
+
export interface Response extends Body {
|
|
1561
1620
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
|
|
1562
1621
|
clone(): Response;
|
|
1563
1622
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
|
|
1564
|
-
|
|
1623
|
+
status: number;
|
|
1565
1624
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
|
|
1566
|
-
|
|
1625
|
+
statusText: string;
|
|
1567
1626
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
|
|
1568
|
-
|
|
1627
|
+
headers: Headers;
|
|
1569
1628
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
|
|
1570
|
-
|
|
1629
|
+
ok: boolean;
|
|
1571
1630
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
|
|
1572
|
-
|
|
1631
|
+
redirected: boolean;
|
|
1573
1632
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1633
|
+
url: string;
|
|
1634
|
+
webSocket: WebSocket | null;
|
|
1635
|
+
cf: any | undefined;
|
|
1577
1636
|
}
|
|
1578
1637
|
export interface ResponseInit {
|
|
1579
1638
|
status?: number;
|
|
@@ -1586,17 +1645,28 @@ export interface ResponseInit {
|
|
|
1586
1645
|
export type RequestInfo<
|
|
1587
1646
|
CfHostMetadata = unknown,
|
|
1588
1647
|
Cf = CfProperties<CfHostMetadata>,
|
|
1589
|
-
> = Request<CfHostMetadata, Cf> | string
|
|
1648
|
+
> = Request<CfHostMetadata, Cf> | string;
|
|
1649
|
+
/**
|
|
1650
|
+
* This Fetch API interface represents a resource request.
|
|
1651
|
+
*
|
|
1652
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
|
|
1653
|
+
*/
|
|
1654
|
+
export declare var Request: {
|
|
1655
|
+
prototype: Request;
|
|
1656
|
+
new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
|
|
1657
|
+
input: RequestInfo<CfProperties> | URL,
|
|
1658
|
+
init?: RequestInit<Cf>,
|
|
1659
|
+
): Request<CfHostMetadata, Cf>;
|
|
1660
|
+
};
|
|
1590
1661
|
/**
|
|
1591
1662
|
* This Fetch API interface represents a resource request.
|
|
1592
1663
|
*
|
|
1593
1664
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
|
|
1594
1665
|
*/
|
|
1595
|
-
export
|
|
1666
|
+
export interface Request<
|
|
1596
1667
|
CfHostMetadata = unknown,
|
|
1597
1668
|
Cf = CfProperties<CfHostMetadata>,
|
|
1598
1669
|
> extends Body {
|
|
1599
|
-
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1600
1670
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
|
|
1601
1671
|
clone(): Request<CfHostMetadata, Cf>;
|
|
1602
1672
|
/**
|
|
@@ -1604,45 +1674,51 @@ export declare class Request<
|
|
|
1604
1674
|
*
|
|
1605
1675
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
|
|
1606
1676
|
*/
|
|
1607
|
-
|
|
1677
|
+
method: string;
|
|
1608
1678
|
/**
|
|
1609
1679
|
* Returns the URL of request as a string.
|
|
1610
1680
|
*
|
|
1611
1681
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
|
|
1612
1682
|
*/
|
|
1613
|
-
|
|
1683
|
+
url: string;
|
|
1614
1684
|
/**
|
|
1615
1685
|
* 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.
|
|
1616
1686
|
*
|
|
1617
1687
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
|
|
1618
1688
|
*/
|
|
1619
|
-
|
|
1689
|
+
headers: Headers;
|
|
1620
1690
|
/**
|
|
1621
1691
|
* 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.
|
|
1622
1692
|
*
|
|
1623
1693
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
|
|
1624
1694
|
*/
|
|
1625
|
-
|
|
1626
|
-
|
|
1695
|
+
redirect: string;
|
|
1696
|
+
fetcher: Fetcher | null;
|
|
1627
1697
|
/**
|
|
1628
1698
|
* Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
|
|
1629
1699
|
*
|
|
1630
1700
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
|
|
1631
1701
|
*/
|
|
1632
|
-
|
|
1633
|
-
|
|
1702
|
+
signal: AbortSignal;
|
|
1703
|
+
cf: Cf | undefined;
|
|
1634
1704
|
/**
|
|
1635
1705
|
* 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]
|
|
1636
1706
|
*
|
|
1637
1707
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
|
|
1638
1708
|
*/
|
|
1639
|
-
|
|
1709
|
+
integrity: string;
|
|
1640
1710
|
/**
|
|
1641
1711
|
* Returns a boolean indicating whether or not request can outlive the global in which it was created.
|
|
1642
1712
|
*
|
|
1643
1713
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
|
|
1644
1714
|
*/
|
|
1645
|
-
|
|
1715
|
+
keepalive: boolean;
|
|
1716
|
+
/**
|
|
1717
|
+
* Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.
|
|
1718
|
+
*
|
|
1719
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/cache)
|
|
1720
|
+
*/
|
|
1721
|
+
cache?: "no-store" | "no-cache";
|
|
1646
1722
|
}
|
|
1647
1723
|
export interface RequestInit<Cf = CfProperties> {
|
|
1648
1724
|
/* A string to set request's method. */
|
|
@@ -1655,6 +1731,8 @@ export interface RequestInit<Cf = CfProperties> {
|
|
|
1655
1731
|
redirect?: string;
|
|
1656
1732
|
fetcher?: Fetcher | null;
|
|
1657
1733
|
cf?: Cf;
|
|
1734
|
+
/* A string indicating how the request will interact with the browser's cache to set request's cache. */
|
|
1735
|
+
cache?: "no-store" | "no-cache";
|
|
1658
1736
|
/* A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */
|
|
1659
1737
|
integrity?: string;
|
|
1660
1738
|
/* An AbortSignal to set request's signal. */
|
|
@@ -1669,7 +1747,7 @@ export type Fetcher<
|
|
|
1669
1747
|
> = (T extends Rpc.EntrypointBranded
|
|
1670
1748
|
? Rpc.Provider<T, Reserved | "fetch" | "connect" | "queue" | "scheduled">
|
|
1671
1749
|
: unknown) & {
|
|
1672
|
-
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1750
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1673
1751
|
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1674
1752
|
queue(
|
|
1675
1753
|
queueName: string,
|
|
@@ -1927,6 +2005,7 @@ export interface R2MultipartUpload {
|
|
|
1927
2005
|
uploadPart(
|
|
1928
2006
|
partNumber: number,
|
|
1929
2007
|
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
|
|
2008
|
+
options?: R2UploadPartOptions,
|
|
1930
2009
|
): Promise<R2UploadedPart>;
|
|
1931
2010
|
abort(): Promise<void>;
|
|
1932
2011
|
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
|
|
@@ -1947,6 +2026,7 @@ export declare abstract class R2Object {
|
|
|
1947
2026
|
readonly customMetadata?: Record<string, string>;
|
|
1948
2027
|
readonly range?: R2Range;
|
|
1949
2028
|
readonly storageClass: string;
|
|
2029
|
+
readonly ssecKeyMd5?: string;
|
|
1950
2030
|
writeHttpMetadata(headers: Headers): void;
|
|
1951
2031
|
}
|
|
1952
2032
|
export interface R2ObjectBody extends R2Object {
|
|
@@ -1979,6 +2059,7 @@ export interface R2Conditional {
|
|
|
1979
2059
|
export interface R2GetOptions {
|
|
1980
2060
|
onlyIf?: R2Conditional | Headers;
|
|
1981
2061
|
range?: R2Range | Headers;
|
|
2062
|
+
ssecKey?: ArrayBuffer | string;
|
|
1982
2063
|
}
|
|
1983
2064
|
export interface R2PutOptions {
|
|
1984
2065
|
onlyIf?: R2Conditional | Headers;
|
|
@@ -1990,11 +2071,13 @@ export interface R2PutOptions {
|
|
|
1990
2071
|
sha384?: ArrayBuffer | string;
|
|
1991
2072
|
sha512?: ArrayBuffer | string;
|
|
1992
2073
|
storageClass?: string;
|
|
2074
|
+
ssecKey?: ArrayBuffer | string;
|
|
1993
2075
|
}
|
|
1994
2076
|
export interface R2MultipartOptions {
|
|
1995
2077
|
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1996
2078
|
customMetadata?: Record<string, string>;
|
|
1997
2079
|
storageClass?: string;
|
|
2080
|
+
ssecKey?: ArrayBuffer | string;
|
|
1998
2081
|
}
|
|
1999
2082
|
export interface R2Checksums {
|
|
2000
2083
|
readonly md5?: ArrayBuffer;
|
|
@@ -2031,6 +2114,9 @@ export type R2Objects = {
|
|
|
2031
2114
|
truncated: false;
|
|
2032
2115
|
}
|
|
2033
2116
|
);
|
|
2117
|
+
export interface R2UploadPartOptions {
|
|
2118
|
+
ssecKey?: ArrayBuffer | string;
|
|
2119
|
+
}
|
|
2034
2120
|
export declare abstract class JsRpcProperty {
|
|
2035
2121
|
then(handler: Function, errorHandler?: Function): any;
|
|
2036
2122
|
catch(errorHandler: Function): any;
|
|
@@ -2441,6 +2527,7 @@ export interface TraceItem {
|
|
|
2441
2527
|
| null;
|
|
2442
2528
|
readonly eventTimestamp: number | null;
|
|
2443
2529
|
readonly logs: TraceLog[];
|
|
2530
|
+
readonly spans: OTelSpan[];
|
|
2444
2531
|
readonly exceptions: TraceException[];
|
|
2445
2532
|
readonly diagnosticsChannelEvents: TraceDiagnosticChannelEvent[];
|
|
2446
2533
|
readonly scriptName: string | null;
|
|
@@ -2449,6 +2536,8 @@ export interface TraceItem {
|
|
|
2449
2536
|
readonly dispatchNamespace?: string;
|
|
2450
2537
|
readonly scriptTags?: string[];
|
|
2451
2538
|
readonly outcome: string;
|
|
2539
|
+
readonly executionModel: string;
|
|
2540
|
+
readonly truncated: boolean;
|
|
2452
2541
|
}
|
|
2453
2542
|
export interface TraceItemAlarmEventInfo {
|
|
2454
2543
|
readonly scheduledTime: Date;
|
|
@@ -2512,6 +2601,18 @@ export interface TraceLog {
|
|
|
2512
2601
|
readonly level: string;
|
|
2513
2602
|
readonly message: any;
|
|
2514
2603
|
}
|
|
2604
|
+
export interface OTelSpan {
|
|
2605
|
+
readonly spanId: string;
|
|
2606
|
+
readonly parentSpanId: string;
|
|
2607
|
+
readonly operation: string;
|
|
2608
|
+
readonly tags: OTelSpanTag[];
|
|
2609
|
+
readonly startTime: Date;
|
|
2610
|
+
readonly endTime: Date;
|
|
2611
|
+
}
|
|
2612
|
+
export interface OTelSpanTag {
|
|
2613
|
+
key: string;
|
|
2614
|
+
value: boolean | (number | bigint) | number | string;
|
|
2615
|
+
}
|
|
2515
2616
|
export interface TraceException {
|
|
2516
2617
|
readonly timestamp: number;
|
|
2517
2618
|
readonly message: string;
|
|
@@ -2588,6 +2689,10 @@ export declare class URL {
|
|
|
2588
2689
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
|
|
2589
2690
|
static canParse(url: string, base?: string): boolean;
|
|
2590
2691
|
static parse(url: string, base?: string): URL | null;
|
|
2692
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static) */
|
|
2693
|
+
static createObjectURL(object: File | Blob): string;
|
|
2694
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static) */
|
|
2695
|
+
static revokeObjectURL(object_url: string): void;
|
|
2591
2696
|
}
|
|
2592
2697
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
|
|
2593
2698
|
export declare class URLSearchParams {
|
|
@@ -2761,8 +2866,24 @@ export type WebSocketEventMap = {
|
|
|
2761
2866
|
*
|
|
2762
2867
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
2763
2868
|
*/
|
|
2764
|
-
export declare
|
|
2765
|
-
|
|
2869
|
+
export declare var WebSocket: {
|
|
2870
|
+
prototype: WebSocket;
|
|
2871
|
+
new (url: string, protocols?: string[] | string): WebSocket;
|
|
2872
|
+
readonly READY_STATE_CONNECTING: number;
|
|
2873
|
+
readonly CONNECTING: number;
|
|
2874
|
+
readonly READY_STATE_OPEN: number;
|
|
2875
|
+
readonly OPEN: number;
|
|
2876
|
+
readonly READY_STATE_CLOSING: number;
|
|
2877
|
+
readonly CLOSING: number;
|
|
2878
|
+
readonly READY_STATE_CLOSED: number;
|
|
2879
|
+
readonly CLOSED: number;
|
|
2880
|
+
};
|
|
2881
|
+
/**
|
|
2882
|
+
* Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
|
|
2883
|
+
*
|
|
2884
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
2885
|
+
*/
|
|
2886
|
+
export interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
2766
2887
|
accept(): void;
|
|
2767
2888
|
/**
|
|
2768
2889
|
* Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
|
|
@@ -2778,38 +2899,30 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
2778
2899
|
close(code?: number, reason?: string): void;
|
|
2779
2900
|
serializeAttachment(attachment: any): void;
|
|
2780
2901
|
deserializeAttachment(): any | null;
|
|
2781
|
-
static readonly READY_STATE_CONNECTING: number;
|
|
2782
|
-
static readonly CONNECTING: number;
|
|
2783
|
-
static readonly READY_STATE_OPEN: number;
|
|
2784
|
-
static readonly OPEN: number;
|
|
2785
|
-
static readonly READY_STATE_CLOSING: number;
|
|
2786
|
-
static readonly CLOSING: number;
|
|
2787
|
-
static readonly READY_STATE_CLOSED: number;
|
|
2788
|
-
static readonly CLOSED: number;
|
|
2789
2902
|
/**
|
|
2790
2903
|
* Returns the state of the WebSocket object's connection. It can have the values described below.
|
|
2791
2904
|
*
|
|
2792
2905
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
|
|
2793
2906
|
*/
|
|
2794
|
-
|
|
2907
|
+
readyState: number;
|
|
2795
2908
|
/**
|
|
2796
2909
|
* Returns the URL that was used to establish the WebSocket connection.
|
|
2797
2910
|
*
|
|
2798
2911
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
|
|
2799
2912
|
*/
|
|
2800
|
-
|
|
2913
|
+
url: string | null;
|
|
2801
2914
|
/**
|
|
2802
2915
|
* 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.
|
|
2803
2916
|
*
|
|
2804
2917
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
|
|
2805
2918
|
*/
|
|
2806
|
-
|
|
2919
|
+
protocol: string | null;
|
|
2807
2920
|
/**
|
|
2808
2921
|
* Returns the extensions selected by the server, if any.
|
|
2809
2922
|
*
|
|
2810
2923
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
|
|
2811
2924
|
*/
|
|
2812
|
-
|
|
2925
|
+
extensions: string | null;
|
|
2813
2926
|
}
|
|
2814
2927
|
export declare const WebSocketPair: {
|
|
2815
2928
|
new (): {
|
|
@@ -2818,7 +2931,10 @@ export declare const WebSocketPair: {
|
|
|
2818
2931
|
};
|
|
2819
2932
|
};
|
|
2820
2933
|
export interface SqlStorage {
|
|
2821
|
-
exec
|
|
2934
|
+
exec<T extends Record<string, SqlStorageValue>>(
|
|
2935
|
+
query: string,
|
|
2936
|
+
...bindings: any[]
|
|
2937
|
+
): SqlStorageCursor<T>;
|
|
2822
2938
|
prepare(query: string): SqlStorageStatement;
|
|
2823
2939
|
ingest(query: string): SqlStorageIngestResult;
|
|
2824
2940
|
get databaseSize(): number;
|
|
@@ -2826,14 +2942,27 @@ export interface SqlStorage {
|
|
|
2826
2942
|
Statement: typeof SqlStorageStatement;
|
|
2827
2943
|
}
|
|
2828
2944
|
export declare abstract class SqlStorageStatement {}
|
|
2829
|
-
export
|
|
2830
|
-
|
|
2831
|
-
|
|
2945
|
+
export type SqlStorageValue = ArrayBuffer | string | number | null;
|
|
2946
|
+
export declare abstract class SqlStorageCursor<
|
|
2947
|
+
T extends Record<string, SqlStorageValue>,
|
|
2948
|
+
> {
|
|
2949
|
+
next():
|
|
2950
|
+
| {
|
|
2951
|
+
done?: false;
|
|
2952
|
+
value: T;
|
|
2953
|
+
}
|
|
2954
|
+
| {
|
|
2955
|
+
done: true;
|
|
2956
|
+
value?: never;
|
|
2957
|
+
};
|
|
2958
|
+
toArray(): T[];
|
|
2959
|
+
one(): T;
|
|
2960
|
+
raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
|
|
2961
|
+
columnNames: string[];
|
|
2832
2962
|
get rowsRead(): number;
|
|
2833
2963
|
get rowsWritten(): number;
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
>;
|
|
2964
|
+
get reusedCachedQueryForTest(): boolean;
|
|
2965
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
2837
2966
|
}
|
|
2838
2967
|
export interface SqlStorageIngestResult {
|
|
2839
2968
|
remainder: string;
|
|
@@ -3378,7 +3507,7 @@ export interface GPUOrigin3DDict {
|
|
|
3378
3507
|
z?: number;
|
|
3379
3508
|
}
|
|
3380
3509
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
|
|
3381
|
-
export declare class EventSource {
|
|
3510
|
+
export declare class EventSource extends EventTarget {
|
|
3382
3511
|
constructor(url: string, init?: EventSourceEventSourceInit);
|
|
3383
3512
|
/**
|
|
3384
3513
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -3477,10 +3606,10 @@ export declare abstract class BaseAiSentenceSimilarity {
|
|
|
3477
3606
|
inputs: AiSentenceSimilarityInput;
|
|
3478
3607
|
postProcessedOutputs: AiSentenceSimilarityOutput;
|
|
3479
3608
|
}
|
|
3480
|
-
export type
|
|
3609
|
+
export type AiAutomaticSpeechRecognitionInput = {
|
|
3481
3610
|
audio: number[];
|
|
3482
3611
|
};
|
|
3483
|
-
export type
|
|
3612
|
+
export type AiAutomaticSpeechRecognitionOutput = {
|
|
3484
3613
|
text?: string;
|
|
3485
3614
|
words?: {
|
|
3486
3615
|
word: string;
|
|
@@ -3489,9 +3618,9 @@ export type AiSpeechRecognitionOutput = {
|
|
|
3489
3618
|
}[];
|
|
3490
3619
|
vtt?: string;
|
|
3491
3620
|
};
|
|
3492
|
-
export declare abstract class
|
|
3493
|
-
inputs:
|
|
3494
|
-
postProcessedOutputs:
|
|
3621
|
+
export declare abstract class BaseAiAutomaticSpeechRecognition {
|
|
3622
|
+
inputs: AiAutomaticSpeechRecognitionInput;
|
|
3623
|
+
postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;
|
|
3495
3624
|
}
|
|
3496
3625
|
export type AiSummarizationInput = {
|
|
3497
3626
|
input_text: string;
|
|
@@ -3527,16 +3656,36 @@ export declare abstract class BaseAiTextEmbeddings {
|
|
|
3527
3656
|
postProcessedOutputs: AiTextEmbeddingsOutput;
|
|
3528
3657
|
}
|
|
3529
3658
|
export type RoleScopedChatInput = {
|
|
3530
|
-
role:
|
|
3659
|
+
role:
|
|
3660
|
+
| "user"
|
|
3661
|
+
| "assistant"
|
|
3662
|
+
| "system"
|
|
3663
|
+
| "tool"
|
|
3664
|
+
| (string & NonNullable<unknown>);
|
|
3531
3665
|
content: string;
|
|
3666
|
+
name?: string;
|
|
3667
|
+
};
|
|
3668
|
+
export type AiTextGenerationToolLegacyInput = {
|
|
3669
|
+
name: string;
|
|
3670
|
+
description: string;
|
|
3671
|
+
parameters?: {
|
|
3672
|
+
type: "object" | (string & NonNullable<unknown>);
|
|
3673
|
+
properties: {
|
|
3674
|
+
[key: string]: {
|
|
3675
|
+
type: string;
|
|
3676
|
+
description?: string;
|
|
3677
|
+
};
|
|
3678
|
+
};
|
|
3679
|
+
required: string[];
|
|
3680
|
+
};
|
|
3532
3681
|
};
|
|
3533
3682
|
export type AiTextGenerationToolInput = {
|
|
3534
|
-
type: "function";
|
|
3683
|
+
type: "function" | (string & NonNullable<unknown>);
|
|
3535
3684
|
function: {
|
|
3536
3685
|
name: string;
|
|
3537
3686
|
description: string;
|
|
3538
3687
|
parameters?: {
|
|
3539
|
-
type: "object";
|
|
3688
|
+
type: "object" | (string & NonNullable<unknown>);
|
|
3540
3689
|
properties: {
|
|
3541
3690
|
[key: string]: {
|
|
3542
3691
|
type: string;
|
|
@@ -3547,6 +3696,10 @@ export type AiTextGenerationToolInput = {
|
|
|
3547
3696
|
};
|
|
3548
3697
|
};
|
|
3549
3698
|
};
|
|
3699
|
+
export type AiTextGenerationFunctionsInput = {
|
|
3700
|
+
name: string;
|
|
3701
|
+
code: string;
|
|
3702
|
+
};
|
|
3550
3703
|
export type AiTextGenerationInput = {
|
|
3551
3704
|
prompt?: string;
|
|
3552
3705
|
raw?: boolean;
|
|
@@ -3560,7 +3713,11 @@ export type AiTextGenerationInput = {
|
|
|
3560
3713
|
frequency_penalty?: number;
|
|
3561
3714
|
presence_penalty?: number;
|
|
3562
3715
|
messages?: RoleScopedChatInput[];
|
|
3563
|
-
tools?:
|
|
3716
|
+
tools?:
|
|
3717
|
+
| AiTextGenerationToolInput[]
|
|
3718
|
+
| AiTextGenerationToolLegacyInput[]
|
|
3719
|
+
| (object & NonNullable<unknown>);
|
|
3720
|
+
functions?: AiTextGenerationFunctionsInput[];
|
|
3564
3721
|
};
|
|
3565
3722
|
export type AiTextGenerationOutput =
|
|
3566
3723
|
| {
|
|
@@ -3575,15 +3732,33 @@ export declare abstract class BaseAiTextGeneration {
|
|
|
3575
3732
|
inputs: AiTextGenerationInput;
|
|
3576
3733
|
postProcessedOutputs: AiTextGenerationOutput;
|
|
3577
3734
|
}
|
|
3735
|
+
export type AiTextToSpeechInput = {
|
|
3736
|
+
prompt: string;
|
|
3737
|
+
lang?: string;
|
|
3738
|
+
};
|
|
3739
|
+
export type AiTextToSpeechOutput =
|
|
3740
|
+
| Uint8Array
|
|
3741
|
+
| {
|
|
3742
|
+
audio: string;
|
|
3743
|
+
};
|
|
3744
|
+
export declare abstract class BaseAiTextToSpeech {
|
|
3745
|
+
inputs: AiTextToSpeechInput;
|
|
3746
|
+
postProcessedOutputs: AiTextToSpeechOutput;
|
|
3747
|
+
}
|
|
3578
3748
|
export type AiTextToImageInput = {
|
|
3579
3749
|
prompt: string;
|
|
3750
|
+
negative_prompt?: string;
|
|
3751
|
+
height?: number;
|
|
3752
|
+
width?: number;
|
|
3580
3753
|
image?: number[];
|
|
3754
|
+
image_b64?: string;
|
|
3581
3755
|
mask?: number[];
|
|
3582
3756
|
num_steps?: number;
|
|
3583
3757
|
strength?: number;
|
|
3584
3758
|
guidance?: number;
|
|
3759
|
+
seed?: number;
|
|
3585
3760
|
};
|
|
3586
|
-
export type AiTextToImageOutput = Uint8Array
|
|
3761
|
+
export type AiTextToImageOutput = ReadableStream<Uint8Array>;
|
|
3587
3762
|
export declare abstract class BaseAiTextToImage {
|
|
3588
3763
|
inputs: AiTextToImageInput;
|
|
3589
3764
|
postProcessedOutputs: AiTextToImageOutput;
|
|
@@ -3600,127 +3775,615 @@ export declare abstract class BaseAiTranslation {
|
|
|
3600
3775
|
inputs: AiTranslationInput;
|
|
3601
3776
|
postProcessedOutputs: AiTranslationOutput;
|
|
3602
3777
|
}
|
|
3778
|
+
export type Ai_Cf_Openai_Whisper_Input =
|
|
3779
|
+
| string
|
|
3780
|
+
| {
|
|
3781
|
+
/**
|
|
3782
|
+
* An array of integers that represent the audio data constrained to 8-bit unsigned integer values
|
|
3783
|
+
*/
|
|
3784
|
+
audio: number[];
|
|
3785
|
+
};
|
|
3786
|
+
export interface Ai_Cf_Openai_Whisper_Output {
|
|
3787
|
+
/**
|
|
3788
|
+
* The transcription
|
|
3789
|
+
*/
|
|
3790
|
+
text: string;
|
|
3791
|
+
word_count?: number;
|
|
3792
|
+
words?: {
|
|
3793
|
+
word?: string;
|
|
3794
|
+
/**
|
|
3795
|
+
* The second this word begins in the recording
|
|
3796
|
+
*/
|
|
3797
|
+
start?: number;
|
|
3798
|
+
/**
|
|
3799
|
+
* The ending second when the word completes
|
|
3800
|
+
*/
|
|
3801
|
+
end?: number;
|
|
3802
|
+
}[];
|
|
3803
|
+
vtt?: string;
|
|
3804
|
+
}
|
|
3805
|
+
export declare abstract class Base_Ai_Cf_Openai_Whisper {
|
|
3806
|
+
inputs: Ai_Cf_Openai_Whisper_Input;
|
|
3807
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;
|
|
3808
|
+
}
|
|
3809
|
+
export type Ai_Cf_Openai_Whisper_Tiny_En_Input =
|
|
3810
|
+
| string
|
|
3811
|
+
| {
|
|
3812
|
+
/**
|
|
3813
|
+
* An array of integers that represent the audio data constrained to 8-bit unsigned integer values
|
|
3814
|
+
*/
|
|
3815
|
+
audio: number[];
|
|
3816
|
+
};
|
|
3817
|
+
export interface Ai_Cf_Openai_Whisper_Tiny_En_Output {
|
|
3818
|
+
/**
|
|
3819
|
+
* The transcription
|
|
3820
|
+
*/
|
|
3821
|
+
text: string;
|
|
3822
|
+
word_count?: number;
|
|
3823
|
+
words?: {
|
|
3824
|
+
word?: string;
|
|
3825
|
+
/**
|
|
3826
|
+
* The second this word begins in the recording
|
|
3827
|
+
*/
|
|
3828
|
+
start?: number;
|
|
3829
|
+
/**
|
|
3830
|
+
* The ending second when the word completes
|
|
3831
|
+
*/
|
|
3832
|
+
end?: number;
|
|
3833
|
+
}[];
|
|
3834
|
+
vtt?: string;
|
|
3835
|
+
}
|
|
3836
|
+
export declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
|
|
3837
|
+
inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;
|
|
3838
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
|
|
3839
|
+
}
|
|
3840
|
+
export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
|
|
3841
|
+
/**
|
|
3842
|
+
* Base64 encoded value of the audio data.
|
|
3843
|
+
*/
|
|
3844
|
+
audio: string;
|
|
3845
|
+
/**
|
|
3846
|
+
* Supported tasks are 'translate' or 'transcribe'.
|
|
3847
|
+
*/
|
|
3848
|
+
task?: string;
|
|
3849
|
+
/**
|
|
3850
|
+
* The language of the audio being transcribed or translated.
|
|
3851
|
+
*/
|
|
3852
|
+
language?: string;
|
|
3853
|
+
/**
|
|
3854
|
+
* Preprocess the audio with a voice activity detection model.
|
|
3855
|
+
*/
|
|
3856
|
+
vad_filter?: string;
|
|
3857
|
+
/**
|
|
3858
|
+
* A text prompt to help provide context to the model on the contents of the audio.
|
|
3859
|
+
*/
|
|
3860
|
+
initial_prompt?: string;
|
|
3861
|
+
/**
|
|
3862
|
+
* The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
|
|
3863
|
+
*/
|
|
3864
|
+
prefix?: string;
|
|
3865
|
+
}
|
|
3866
|
+
export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
|
|
3867
|
+
transcription_info?: {
|
|
3868
|
+
/**
|
|
3869
|
+
* The language of the audio being transcribed or translated.
|
|
3870
|
+
*/
|
|
3871
|
+
language?: string;
|
|
3872
|
+
/**
|
|
3873
|
+
* The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.
|
|
3874
|
+
*/
|
|
3875
|
+
language_probability?: number;
|
|
3876
|
+
/**
|
|
3877
|
+
* The total duration of the original audio file, in seconds.
|
|
3878
|
+
*/
|
|
3879
|
+
duration?: number;
|
|
3880
|
+
/**
|
|
3881
|
+
* The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.
|
|
3882
|
+
*/
|
|
3883
|
+
duration_after_vad?: number;
|
|
3884
|
+
};
|
|
3885
|
+
/**
|
|
3886
|
+
* The complete transcription of the audio.
|
|
3887
|
+
*/
|
|
3888
|
+
text: string;
|
|
3889
|
+
/**
|
|
3890
|
+
* The total number of words in the transcription.
|
|
3891
|
+
*/
|
|
3892
|
+
word_count?: number;
|
|
3893
|
+
segments?: {
|
|
3894
|
+
/**
|
|
3895
|
+
* The starting time of the segment within the audio, in seconds.
|
|
3896
|
+
*/
|
|
3897
|
+
start?: number;
|
|
3898
|
+
/**
|
|
3899
|
+
* The ending time of the segment within the audio, in seconds.
|
|
3900
|
+
*/
|
|
3901
|
+
end?: number;
|
|
3902
|
+
/**
|
|
3903
|
+
* The transcription of the segment.
|
|
3904
|
+
*/
|
|
3905
|
+
text?: string;
|
|
3906
|
+
/**
|
|
3907
|
+
* The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.
|
|
3908
|
+
*/
|
|
3909
|
+
temperature?: number;
|
|
3910
|
+
/**
|
|
3911
|
+
* The average log probability of the predictions for the words in this segment, indicating overall confidence.
|
|
3912
|
+
*/
|
|
3913
|
+
avg_logprob?: number;
|
|
3914
|
+
/**
|
|
3915
|
+
* The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.
|
|
3916
|
+
*/
|
|
3917
|
+
compression_ratio?: number;
|
|
3918
|
+
/**
|
|
3919
|
+
* The probability that the segment contains no speech, represented as a decimal between 0 and 1.
|
|
3920
|
+
*/
|
|
3921
|
+
no_speech_prob?: number;
|
|
3922
|
+
words?: {
|
|
3923
|
+
/**
|
|
3924
|
+
* The individual word transcribed from the audio.
|
|
3925
|
+
*/
|
|
3926
|
+
word?: string;
|
|
3927
|
+
/**
|
|
3928
|
+
* The starting time of the word within the audio, in seconds.
|
|
3929
|
+
*/
|
|
3930
|
+
start?: number;
|
|
3931
|
+
/**
|
|
3932
|
+
* The ending time of the word within the audio, in seconds.
|
|
3933
|
+
*/
|
|
3934
|
+
end?: number;
|
|
3935
|
+
}[];
|
|
3936
|
+
};
|
|
3937
|
+
/**
|
|
3938
|
+
* The transcription in WebVTT format, which includes timing and text information for use in subtitles.
|
|
3939
|
+
*/
|
|
3940
|
+
vtt?: string;
|
|
3941
|
+
}
|
|
3942
|
+
export declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {
|
|
3943
|
+
inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;
|
|
3944
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;
|
|
3945
|
+
}
|
|
3946
|
+
export interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {
|
|
3947
|
+
/**
|
|
3948
|
+
* A text description of the image you want to generate.
|
|
3949
|
+
*/
|
|
3950
|
+
prompt: string;
|
|
3951
|
+
/**
|
|
3952
|
+
* The number of diffusion steps; higher values can improve quality but take longer.
|
|
3953
|
+
*/
|
|
3954
|
+
steps?: number;
|
|
3955
|
+
}
|
|
3956
|
+
export interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {
|
|
3957
|
+
/**
|
|
3958
|
+
* The generated image in Base64 format.
|
|
3959
|
+
*/
|
|
3960
|
+
image?: string;
|
|
3961
|
+
}
|
|
3962
|
+
export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {
|
|
3963
|
+
inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;
|
|
3964
|
+
postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;
|
|
3965
|
+
}
|
|
3966
|
+
export type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Prompt | Messages;
|
|
3967
|
+
export interface Prompt {
|
|
3968
|
+
/**
|
|
3969
|
+
* The input text prompt for the model to generate a response.
|
|
3970
|
+
*/
|
|
3971
|
+
prompt: string;
|
|
3972
|
+
image?: number[] | (string & NonNullable<unknown>);
|
|
3973
|
+
/**
|
|
3974
|
+
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
|
|
3975
|
+
*/
|
|
3976
|
+
raw?: boolean;
|
|
3977
|
+
/**
|
|
3978
|
+
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
|
|
3979
|
+
*/
|
|
3980
|
+
stream?: boolean;
|
|
3981
|
+
/**
|
|
3982
|
+
* The maximum number of tokens to generate in the response.
|
|
3983
|
+
*/
|
|
3984
|
+
max_tokens?: number;
|
|
3985
|
+
/**
|
|
3986
|
+
* Controls the randomness of the output; higher values produce more random results.
|
|
3987
|
+
*/
|
|
3988
|
+
temperature?: number;
|
|
3989
|
+
/**
|
|
3990
|
+
* 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.
|
|
3991
|
+
*/
|
|
3992
|
+
top_p?: number;
|
|
3993
|
+
/**
|
|
3994
|
+
* 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.
|
|
3995
|
+
*/
|
|
3996
|
+
top_k?: number;
|
|
3997
|
+
/**
|
|
3998
|
+
* Random seed for reproducibility of the generation.
|
|
3999
|
+
*/
|
|
4000
|
+
seed?: number;
|
|
4001
|
+
/**
|
|
4002
|
+
* Penalty for repeated tokens; higher values discourage repetition.
|
|
4003
|
+
*/
|
|
4004
|
+
repetition_penalty?: number;
|
|
4005
|
+
/**
|
|
4006
|
+
* Decreases the likelihood of the model repeating the same lines verbatim.
|
|
4007
|
+
*/
|
|
4008
|
+
frequency_penalty?: number;
|
|
4009
|
+
/**
|
|
4010
|
+
* Increases the likelihood of the model introducing new topics.
|
|
4011
|
+
*/
|
|
4012
|
+
presence_penalty?: number;
|
|
4013
|
+
/**
|
|
4014
|
+
* Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
|
|
4015
|
+
*/
|
|
4016
|
+
lora?: string;
|
|
4017
|
+
}
|
|
4018
|
+
export interface Messages {
|
|
4019
|
+
/**
|
|
4020
|
+
* An array of message objects representing the conversation history.
|
|
4021
|
+
*/
|
|
4022
|
+
messages: {
|
|
4023
|
+
/**
|
|
4024
|
+
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
4025
|
+
*/
|
|
4026
|
+
role: string;
|
|
4027
|
+
/**
|
|
4028
|
+
* The content of the message as a string.
|
|
4029
|
+
*/
|
|
4030
|
+
content: string;
|
|
4031
|
+
}[];
|
|
4032
|
+
image?: number[] | string;
|
|
4033
|
+
functions?: {
|
|
4034
|
+
name: string;
|
|
4035
|
+
code: string;
|
|
4036
|
+
}[];
|
|
4037
|
+
/**
|
|
4038
|
+
* A list of tools available for the assistant to use.
|
|
4039
|
+
*/
|
|
4040
|
+
tools?: (
|
|
4041
|
+
| {
|
|
4042
|
+
/**
|
|
4043
|
+
* The name of the tool. More descriptive the better.
|
|
4044
|
+
*/
|
|
4045
|
+
name: string;
|
|
4046
|
+
/**
|
|
4047
|
+
* A brief description of what the tool does.
|
|
4048
|
+
*/
|
|
4049
|
+
description: string;
|
|
4050
|
+
/**
|
|
4051
|
+
* Schema defining the parameters accepted by the tool.
|
|
4052
|
+
*/
|
|
4053
|
+
parameters: {
|
|
4054
|
+
/**
|
|
4055
|
+
* The type of the parameters object (usually 'object').
|
|
4056
|
+
*/
|
|
4057
|
+
type: string;
|
|
4058
|
+
/**
|
|
4059
|
+
* List of required parameter names.
|
|
4060
|
+
*/
|
|
4061
|
+
required?: string[];
|
|
4062
|
+
/**
|
|
4063
|
+
* Definitions of each parameter.
|
|
4064
|
+
*/
|
|
4065
|
+
properties: {
|
|
4066
|
+
[k: string]: {
|
|
4067
|
+
/**
|
|
4068
|
+
* The data type of the parameter.
|
|
4069
|
+
*/
|
|
4070
|
+
type: string;
|
|
4071
|
+
/**
|
|
4072
|
+
* A description of the expected parameter.
|
|
4073
|
+
*/
|
|
4074
|
+
description: string;
|
|
4075
|
+
};
|
|
4076
|
+
};
|
|
4077
|
+
};
|
|
4078
|
+
}
|
|
4079
|
+
| {
|
|
4080
|
+
/**
|
|
4081
|
+
* Specifies the type of tool (e.g., 'function').
|
|
4082
|
+
*/
|
|
4083
|
+
type: string;
|
|
4084
|
+
/**
|
|
4085
|
+
* Details of the function tool.
|
|
4086
|
+
*/
|
|
4087
|
+
function: {
|
|
4088
|
+
/**
|
|
4089
|
+
* The name of the function.
|
|
4090
|
+
*/
|
|
4091
|
+
name: string;
|
|
4092
|
+
/**
|
|
4093
|
+
* A brief description of what the function does.
|
|
4094
|
+
*/
|
|
4095
|
+
description: string;
|
|
4096
|
+
/**
|
|
4097
|
+
* Schema defining the parameters accepted by the function.
|
|
4098
|
+
*/
|
|
4099
|
+
parameters: {
|
|
4100
|
+
/**
|
|
4101
|
+
* The type of the parameters object (usually 'object').
|
|
4102
|
+
*/
|
|
4103
|
+
type: string;
|
|
4104
|
+
/**
|
|
4105
|
+
* List of required parameter names.
|
|
4106
|
+
*/
|
|
4107
|
+
required?: string[];
|
|
4108
|
+
/**
|
|
4109
|
+
* Definitions of each parameter.
|
|
4110
|
+
*/
|
|
4111
|
+
properties: {
|
|
4112
|
+
[k: string]: {
|
|
4113
|
+
/**
|
|
4114
|
+
* The data type of the parameter.
|
|
4115
|
+
*/
|
|
4116
|
+
type: string;
|
|
4117
|
+
/**
|
|
4118
|
+
* A description of the expected parameter.
|
|
4119
|
+
*/
|
|
4120
|
+
description: string;
|
|
4121
|
+
};
|
|
4122
|
+
};
|
|
4123
|
+
};
|
|
4124
|
+
};
|
|
4125
|
+
}
|
|
4126
|
+
)[];
|
|
4127
|
+
/**
|
|
4128
|
+
* If true, the response will be streamed back incrementally.
|
|
4129
|
+
*/
|
|
4130
|
+
stream?: boolean;
|
|
4131
|
+
/**
|
|
4132
|
+
* The maximum number of tokens to generate in the response.
|
|
4133
|
+
*/
|
|
4134
|
+
max_tokens?: number;
|
|
4135
|
+
/**
|
|
4136
|
+
* Controls the randomness of the output; higher values produce more random results.
|
|
4137
|
+
*/
|
|
4138
|
+
temperature?: number;
|
|
4139
|
+
/**
|
|
4140
|
+
* 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.
|
|
4141
|
+
*/
|
|
4142
|
+
top_p?: number;
|
|
4143
|
+
/**
|
|
4144
|
+
* 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.
|
|
4145
|
+
*/
|
|
4146
|
+
top_k?: number;
|
|
4147
|
+
/**
|
|
4148
|
+
* Random seed for reproducibility of the generation.
|
|
4149
|
+
*/
|
|
4150
|
+
seed?: number;
|
|
4151
|
+
/**
|
|
4152
|
+
* Penalty for repeated tokens; higher values discourage repetition.
|
|
4153
|
+
*/
|
|
4154
|
+
repetition_penalty?: number;
|
|
4155
|
+
/**
|
|
4156
|
+
* Decreases the likelihood of the model repeating the same lines verbatim.
|
|
4157
|
+
*/
|
|
4158
|
+
frequency_penalty?: number;
|
|
4159
|
+
/**
|
|
4160
|
+
* Increases the likelihood of the model introducing new topics.
|
|
4161
|
+
*/
|
|
4162
|
+
presence_penalty?: number;
|
|
4163
|
+
}
|
|
4164
|
+
export type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output =
|
|
4165
|
+
| {
|
|
4166
|
+
/**
|
|
4167
|
+
* The generated text response from the model
|
|
4168
|
+
*/
|
|
4169
|
+
response?: string;
|
|
4170
|
+
/**
|
|
4171
|
+
* An array of tool calls requests made during the response generation
|
|
4172
|
+
*/
|
|
4173
|
+
tool_calls?: {
|
|
4174
|
+
/**
|
|
4175
|
+
* The arguments passed to be passed to the tool call request
|
|
4176
|
+
*/
|
|
4177
|
+
arguments?: object;
|
|
4178
|
+
/**
|
|
4179
|
+
* The name of the tool to be called
|
|
4180
|
+
*/
|
|
4181
|
+
name?: string;
|
|
4182
|
+
}[];
|
|
4183
|
+
}
|
|
4184
|
+
| ReadableStream;
|
|
4185
|
+
export declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {
|
|
4186
|
+
inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;
|
|
4187
|
+
postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;
|
|
4188
|
+
}
|
|
4189
|
+
export interface AiModels {
|
|
4190
|
+
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
4191
|
+
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
4192
|
+
"@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage;
|
|
4193
|
+
"@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage;
|
|
4194
|
+
"@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage;
|
|
4195
|
+
"@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage;
|
|
4196
|
+
"@cf/baai/bge-base-en-v1.5": BaseAiTextEmbeddings;
|
|
4197
|
+
"@cf/baai/bge-small-en-v1.5": BaseAiTextEmbeddings;
|
|
4198
|
+
"@cf/baai/bge-large-en-v1.5": BaseAiTextEmbeddings;
|
|
4199
|
+
"@cf/microsoft/resnet-50": BaseAiImageClassification;
|
|
4200
|
+
"@cf/facebook/detr-resnet-50": BaseAiObjectDetection;
|
|
4201
|
+
"@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration;
|
|
4202
|
+
"@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration;
|
|
4203
|
+
"@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration;
|
|
4204
|
+
"@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration;
|
|
4205
|
+
"@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration;
|
|
4206
|
+
"@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
|
|
4207
|
+
"@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
|
|
4208
|
+
"@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
|
|
4209
|
+
"@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
|
|
4210
|
+
"@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
|
|
4211
|
+
"@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
|
|
4212
|
+
"@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
|
|
4213
|
+
"@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration;
|
|
4214
|
+
"@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration;
|
|
4215
|
+
"@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration;
|
|
4216
|
+
"@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration;
|
|
4217
|
+
"@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration;
|
|
4218
|
+
"@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration;
|
|
4219
|
+
"@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration;
|
|
4220
|
+
"@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration;
|
|
4221
|
+
"@cf/microsoft/phi-2": BaseAiTextGeneration;
|
|
4222
|
+
"@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration;
|
|
4223
|
+
"@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration;
|
|
4224
|
+
"@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration;
|
|
4225
|
+
"@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration;
|
|
4226
|
+
"@hf/google/gemma-7b-it": BaseAiTextGeneration;
|
|
4227
|
+
"@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration;
|
|
4228
|
+
"@cf/google/gemma-2b-it-lora": BaseAiTextGeneration;
|
|
4229
|
+
"@cf/google/gemma-7b-it-lora": BaseAiTextGeneration;
|
|
4230
|
+
"@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration;
|
|
4231
|
+
"@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration;
|
|
4232
|
+
"@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration;
|
|
4233
|
+
"@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration;
|
|
4234
|
+
"@hf/meta-llama/meta-llama-3-8b-instruct": BaseAiTextGeneration;
|
|
4235
|
+
"@cf/meta/llama-3.1-8b-instruct": BaseAiTextGeneration;
|
|
4236
|
+
"@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration;
|
|
4237
|
+
"@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration;
|
|
4238
|
+
"@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration;
|
|
4239
|
+
"@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration;
|
|
4240
|
+
"@cf/meta/llama-3.3-70b-instruct-fp8-fast": BaseAiTextGeneration;
|
|
4241
|
+
"@cf/meta/m2m100-1.2b": BaseAiTranslation;
|
|
4242
|
+
"@cf/facebook/bart-large-cnn": BaseAiSummarization;
|
|
4243
|
+
"@cf/unum/uform-gen2-qwen-500m": BaseAiImageToText;
|
|
4244
|
+
"@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText;
|
|
4245
|
+
"@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper;
|
|
4246
|
+
"@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En;
|
|
4247
|
+
"@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;
|
|
4248
|
+
"@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;
|
|
4249
|
+
"@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;
|
|
4250
|
+
}
|
|
4251
|
+
export type AiOptions = {
|
|
4252
|
+
gateway?: GatewayOptions;
|
|
4253
|
+
prefix?: string;
|
|
4254
|
+
extraHeaders?: object;
|
|
4255
|
+
};
|
|
4256
|
+
export type AiModelsSearchParams = {
|
|
4257
|
+
author?: string;
|
|
4258
|
+
hide_experimental?: boolean;
|
|
4259
|
+
page?: number;
|
|
4260
|
+
per_page?: number;
|
|
4261
|
+
search?: string;
|
|
4262
|
+
source?: number;
|
|
4263
|
+
task?: string;
|
|
4264
|
+
};
|
|
4265
|
+
export type AiModelsSearchObject = {
|
|
4266
|
+
id: string;
|
|
4267
|
+
source: number;
|
|
4268
|
+
name: string;
|
|
4269
|
+
description: string;
|
|
4270
|
+
task: {
|
|
4271
|
+
id: string;
|
|
4272
|
+
name: string;
|
|
4273
|
+
description: string;
|
|
4274
|
+
};
|
|
4275
|
+
tags: string[];
|
|
4276
|
+
properties: {
|
|
4277
|
+
property_id: string;
|
|
4278
|
+
value: string;
|
|
4279
|
+
}[];
|
|
4280
|
+
};
|
|
4281
|
+
export interface InferenceUpstreamError extends Error {}
|
|
4282
|
+
export interface AiInternalError extends Error {}
|
|
4283
|
+
export type AiModelListType = Record<string, any>;
|
|
4284
|
+
export declare abstract class Ai<
|
|
4285
|
+
AiModelList extends AiModelListType = AiModels,
|
|
4286
|
+
> {
|
|
4287
|
+
aiGatewayLogId: string | null;
|
|
4288
|
+
gateway(gatewayId: string): AiGateway;
|
|
4289
|
+
run<Name extends keyof AiModelList>(
|
|
4290
|
+
model: Name,
|
|
4291
|
+
inputs: AiModelList[Name]["inputs"],
|
|
4292
|
+
options?: AiOptions,
|
|
4293
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
4294
|
+
public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
4295
|
+
}
|
|
3603
4296
|
export type GatewayOptions = {
|
|
3604
4297
|
id: string;
|
|
4298
|
+
cacheKey?: string;
|
|
3605
4299
|
cacheTtl?: number;
|
|
3606
4300
|
skipCache?: boolean;
|
|
3607
4301
|
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
4302
|
+
collectLog?: boolean;
|
|
3608
4303
|
};
|
|
3609
|
-
export type
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
4304
|
+
export type AiGatewayPatchLog = {
|
|
4305
|
+
score?: number | null;
|
|
4306
|
+
feedback?: -1 | 1 | null;
|
|
4307
|
+
metadata?: Record<string, number | string | boolean | null | bigint> | null;
|
|
3613
4308
|
};
|
|
3614
|
-
export type
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
| "
|
|
3643
|
-
| "
|
|
3644
|
-
| "
|
|
3645
|
-
| "
|
|
3646
|
-
| "
|
|
3647
|
-
| "
|
|
3648
|
-
| "
|
|
3649
|
-
| "
|
|
3650
|
-
| "
|
|
3651
|
-
| "
|
|
3652
|
-
| "
|
|
3653
|
-
| "
|
|
3654
|
-
| "
|
|
3655
|
-
| "
|
|
3656
|
-
| "
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
): Promise<
|
|
3689
|
-
run(
|
|
3690
|
-
model: BaseAiSpeechRecognitionModels,
|
|
3691
|
-
inputs: BaseAiSpeechRecognition["inputs"],
|
|
3692
|
-
options?: AiOptions,
|
|
3693
|
-
): Promise<BaseAiSpeechRecognition["postProcessedOutputs"]>;
|
|
3694
|
-
run(
|
|
3695
|
-
model: BaseAiImageClassificationModels,
|
|
3696
|
-
inputs: BaseAiImageClassification["inputs"],
|
|
3697
|
-
options?: AiOptions,
|
|
3698
|
-
): Promise<BaseAiImageClassification["postProcessedOutputs"]>;
|
|
3699
|
-
run(
|
|
3700
|
-
model: BaseAiObjectDetectionModels,
|
|
3701
|
-
inputs: BaseAiObjectDetection["inputs"],
|
|
3702
|
-
options?: AiOptions,
|
|
3703
|
-
): Promise<BaseAiObjectDetection["postProcessedOutputs"]>;
|
|
3704
|
-
run(
|
|
3705
|
-
model: BaseAiTextGenerationModels,
|
|
3706
|
-
inputs: BaseAiTextGeneration["inputs"],
|
|
3707
|
-
options?: AiOptions,
|
|
3708
|
-
): Promise<BaseAiTextGeneration["postProcessedOutputs"]>;
|
|
3709
|
-
run(
|
|
3710
|
-
model: BaseAiTranslationModels,
|
|
3711
|
-
inputs: BaseAiTranslation["inputs"],
|
|
3712
|
-
options?: AiOptions,
|
|
3713
|
-
): Promise<BaseAiTranslation["postProcessedOutputs"]>;
|
|
3714
|
-
run(
|
|
3715
|
-
model: BaseAiSummarizationModels,
|
|
3716
|
-
inputs: BaseAiSummarization["inputs"],
|
|
3717
|
-
options?: AiOptions,
|
|
3718
|
-
): Promise<BaseAiSummarization["postProcessedOutputs"]>;
|
|
4309
|
+
export type AiGatewayLog = {
|
|
4310
|
+
id: string;
|
|
4311
|
+
provider: string;
|
|
4312
|
+
model: string;
|
|
4313
|
+
model_type?: string;
|
|
4314
|
+
path: string;
|
|
4315
|
+
duration: number;
|
|
4316
|
+
request_type?: string;
|
|
4317
|
+
request_content_type?: string;
|
|
4318
|
+
status_code: number;
|
|
4319
|
+
response_content_type?: string;
|
|
4320
|
+
success: boolean;
|
|
4321
|
+
cached: boolean;
|
|
4322
|
+
tokens_in?: number;
|
|
4323
|
+
tokens_out?: number;
|
|
4324
|
+
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
4325
|
+
step?: number;
|
|
4326
|
+
cost?: number;
|
|
4327
|
+
custom_cost?: boolean;
|
|
4328
|
+
request_size: number;
|
|
4329
|
+
request_head?: string;
|
|
4330
|
+
request_head_complete: boolean;
|
|
4331
|
+
response_size: number;
|
|
4332
|
+
response_head?: string;
|
|
4333
|
+
response_head_complete: boolean;
|
|
4334
|
+
created_at: Date;
|
|
4335
|
+
};
|
|
4336
|
+
export type AIGatewayProviders =
|
|
4337
|
+
| "workers-ai"
|
|
4338
|
+
| "anthropic"
|
|
4339
|
+
| "aws-bedrock"
|
|
4340
|
+
| "azure-openai"
|
|
4341
|
+
| "google-vertex-ai"
|
|
4342
|
+
| "huggingface"
|
|
4343
|
+
| "openai"
|
|
4344
|
+
| "perplexity-ai"
|
|
4345
|
+
| "replicate"
|
|
4346
|
+
| "groq"
|
|
4347
|
+
| "cohere"
|
|
4348
|
+
| "google-ai-studio"
|
|
4349
|
+
| "mistral"
|
|
4350
|
+
| "grok"
|
|
4351
|
+
| "openrouter";
|
|
4352
|
+
export type AIGatewayHeaders = {
|
|
4353
|
+
"cf-aig-metadata":
|
|
4354
|
+
| Record<string, number | string | boolean | null | bigint>
|
|
4355
|
+
| string;
|
|
4356
|
+
"cf-aig-custom-cost":
|
|
4357
|
+
| {
|
|
4358
|
+
per_token_in?: number;
|
|
4359
|
+
per_token_out?: number;
|
|
4360
|
+
}
|
|
4361
|
+
| {
|
|
4362
|
+
total_cost?: number;
|
|
4363
|
+
}
|
|
4364
|
+
| string;
|
|
4365
|
+
"cf-aig-cache-ttl": number | string;
|
|
4366
|
+
"cf-aig-skip-cache": boolean | string;
|
|
4367
|
+
"cf-aig-cache-key": string;
|
|
4368
|
+
"cf-aig-collect-log": boolean | string;
|
|
4369
|
+
Authorization: string;
|
|
4370
|
+
"Content-Type": string;
|
|
4371
|
+
[key: string]: string | number | boolean | object;
|
|
4372
|
+
};
|
|
4373
|
+
export type AIGatewayUniversalRequest = {
|
|
4374
|
+
provider: AIGatewayProviders | string; // eslint-disable-line
|
|
4375
|
+
endpoint: string;
|
|
4376
|
+
headers: Partial<AIGatewayHeaders>;
|
|
4377
|
+
query: unknown;
|
|
4378
|
+
};
|
|
4379
|
+
export interface AiGatewayInternalError extends Error {}
|
|
4380
|
+
export interface AiGatewayLogNotFound extends Error {}
|
|
4381
|
+
export declare abstract class AiGateway {
|
|
4382
|
+
patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
|
|
4383
|
+
getLog(logId: string): Promise<AiGatewayLog>;
|
|
3719
4384
|
run(
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
options?: AiOptions,
|
|
3723
|
-
): Promise<BaseAiImageToText["postProcessedOutputs"]>;
|
|
4385
|
+
data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
|
|
4386
|
+
): Promise<Response>;
|
|
3724
4387
|
}
|
|
3725
4388
|
export interface BasicImageTransformations {
|
|
3726
4389
|
/**
|
|
@@ -4738,7 +5401,7 @@ export declare abstract class D1PreparedStatement {
|
|
|
4738
5401
|
bind(...values: unknown[]): D1PreparedStatement;
|
|
4739
5402
|
first<T = unknown>(colName: string): Promise<T | null>;
|
|
4740
5403
|
first<T = Record<string, unknown>>(): Promise<T | null>;
|
|
4741
|
-
run(): Promise<
|
|
5404
|
+
run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
|
|
4742
5405
|
all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
|
|
4743
5406
|
raw<T = unknown[]>(options: {
|
|
4744
5407
|
columnNames: true;
|
|
@@ -4794,6 +5457,12 @@ export interface ForwardableEmailMessage extends EmailMessage {
|
|
|
4794
5457
|
* @returns A promise that resolves when the email message is forwarded.
|
|
4795
5458
|
*/
|
|
4796
5459
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
5460
|
+
/**
|
|
5461
|
+
* Reply to the sender of this email message with a new EmailMessage object.
|
|
5462
|
+
* @param message The reply message.
|
|
5463
|
+
* @returns A promise that resolves when the email message is replied.
|
|
5464
|
+
*/
|
|
5465
|
+
reply(message: EmailMessage): Promise<void>;
|
|
4797
5466
|
}
|
|
4798
5467
|
/**
|
|
4799
5468
|
* A binding that allows a Worker to send email messages.
|
|
@@ -4856,6 +5525,128 @@ export interface Hyperdrive {
|
|
|
4856
5525
|
*/
|
|
4857
5526
|
readonly database: string;
|
|
4858
5527
|
}
|
|
5528
|
+
// Copyright (c) 2024 Cloudflare, Inc.
|
|
5529
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5530
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5531
|
+
export type ImageInfoResponse =
|
|
5532
|
+
| {
|
|
5533
|
+
format: "image/svg+xml";
|
|
5534
|
+
}
|
|
5535
|
+
| {
|
|
5536
|
+
format: string;
|
|
5537
|
+
fileSize: number;
|
|
5538
|
+
width: number;
|
|
5539
|
+
height: number;
|
|
5540
|
+
};
|
|
5541
|
+
export type ImageTransform = {
|
|
5542
|
+
fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
|
|
5543
|
+
gravity?:
|
|
5544
|
+
| "left"
|
|
5545
|
+
| "right"
|
|
5546
|
+
| "top"
|
|
5547
|
+
| "bottom"
|
|
5548
|
+
| "center"
|
|
5549
|
+
| "auto"
|
|
5550
|
+
| "entropy"
|
|
5551
|
+
| "face"
|
|
5552
|
+
| {
|
|
5553
|
+
x?: number;
|
|
5554
|
+
y?: number;
|
|
5555
|
+
mode: "remainder" | "box-center";
|
|
5556
|
+
};
|
|
5557
|
+
trim?: {
|
|
5558
|
+
top?: number;
|
|
5559
|
+
bottom?: number;
|
|
5560
|
+
left?: number;
|
|
5561
|
+
right?: number;
|
|
5562
|
+
width?: number;
|
|
5563
|
+
height?: number;
|
|
5564
|
+
border?:
|
|
5565
|
+
| boolean
|
|
5566
|
+
| {
|
|
5567
|
+
color?: string;
|
|
5568
|
+
tolerance?: number;
|
|
5569
|
+
keep?: number;
|
|
5570
|
+
};
|
|
5571
|
+
};
|
|
5572
|
+
width?: number;
|
|
5573
|
+
height?: number;
|
|
5574
|
+
background?: string;
|
|
5575
|
+
rotate?: number;
|
|
5576
|
+
sharpen?: number;
|
|
5577
|
+
blur?: number;
|
|
5578
|
+
contrast?: number;
|
|
5579
|
+
brightness?: number;
|
|
5580
|
+
gamma?: number;
|
|
5581
|
+
border?: {
|
|
5582
|
+
color?: string;
|
|
5583
|
+
width?: number;
|
|
5584
|
+
top?: number;
|
|
5585
|
+
bottom?: number;
|
|
5586
|
+
left?: number;
|
|
5587
|
+
right?: number;
|
|
5588
|
+
};
|
|
5589
|
+
zoom?: number;
|
|
5590
|
+
};
|
|
5591
|
+
export type ImageOutputOptions = {
|
|
5592
|
+
format:
|
|
5593
|
+
| "image/jpeg"
|
|
5594
|
+
| "image/png"
|
|
5595
|
+
| "image/gif"
|
|
5596
|
+
| "image/webp"
|
|
5597
|
+
| "image/avif"
|
|
5598
|
+
| "rgb"
|
|
5599
|
+
| "rgba";
|
|
5600
|
+
quality?: number;
|
|
5601
|
+
background?: string;
|
|
5602
|
+
};
|
|
5603
|
+
export interface ImagesBinding {
|
|
5604
|
+
/**
|
|
5605
|
+
* Get image metadata (type, width and height)
|
|
5606
|
+
* @throws {@link ImagesError} with code 9412 if input is not an image
|
|
5607
|
+
* @param stream The image bytes
|
|
5608
|
+
*/
|
|
5609
|
+
info(stream: ReadableStream<Uint8Array>): Promise<ImageInfoResponse>;
|
|
5610
|
+
/**
|
|
5611
|
+
* Begin applying a series of transformations to an image
|
|
5612
|
+
* @param stream The image bytes
|
|
5613
|
+
* @returns A transform handle
|
|
5614
|
+
*/
|
|
5615
|
+
input(stream: ReadableStream<Uint8Array>): ImageTransformer;
|
|
5616
|
+
}
|
|
5617
|
+
export interface ImageTransformer {
|
|
5618
|
+
/**
|
|
5619
|
+
* Apply transform next, returning a transform handle.
|
|
5620
|
+
* You can then apply more transformations or retrieve the output.
|
|
5621
|
+
* @param transform
|
|
5622
|
+
*/
|
|
5623
|
+
transform(transform: ImageTransform): ImageTransformer;
|
|
5624
|
+
/**
|
|
5625
|
+
* Retrieve the image that results from applying the transforms to the
|
|
5626
|
+
* provided input
|
|
5627
|
+
* @param options Options that apply to the output e.g. output format
|
|
5628
|
+
*/
|
|
5629
|
+
output(options: ImageOutputOptions): Promise<ImageTransformationResult>;
|
|
5630
|
+
}
|
|
5631
|
+
export interface ImageTransformationResult {
|
|
5632
|
+
/**
|
|
5633
|
+
* The image as a response, ready to store in cache or return to users
|
|
5634
|
+
*/
|
|
5635
|
+
response(): Response;
|
|
5636
|
+
/**
|
|
5637
|
+
* The content type of the returned image
|
|
5638
|
+
*/
|
|
5639
|
+
contentType(): string;
|
|
5640
|
+
/**
|
|
5641
|
+
* The bytes of the response
|
|
5642
|
+
*/
|
|
5643
|
+
image(): ReadableStream<Uint8Array>;
|
|
5644
|
+
}
|
|
5645
|
+
export interface ImagesError extends Error {
|
|
5646
|
+
readonly code: number;
|
|
5647
|
+
readonly message: string;
|
|
5648
|
+
readonly stack?: string;
|
|
5649
|
+
}
|
|
4859
5650
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
4860
5651
|
export type EventContext<Env, P extends string, Data> = {
|
|
4861
5652
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -4899,6 +5690,30 @@ export type PagesPluginFunction<
|
|
|
4899
5690
|
> = (
|
|
4900
5691
|
context: EventPluginContext<Env, Params, Data, PluginArgs>,
|
|
4901
5692
|
) => Response | Promise<Response>;
|
|
5693
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5694
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5695
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5696
|
+
export declare abstract class PipelineTransform {
|
|
5697
|
+
/**
|
|
5698
|
+
* transformJson recieves an array of javascript objects which can be
|
|
5699
|
+
* mutated and returned to the pipeline
|
|
5700
|
+
* @param data The data to be mutated
|
|
5701
|
+
* @returns A promise containing the mutated data
|
|
5702
|
+
*/
|
|
5703
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
5704
|
+
}
|
|
5705
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5706
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5707
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5708
|
+
export interface Pipeline {
|
|
5709
|
+
/**
|
|
5710
|
+
* send takes an array of javascript objects which are
|
|
5711
|
+
* then received by the pipeline for processing
|
|
5712
|
+
*
|
|
5713
|
+
* @param data The data to be sent
|
|
5714
|
+
*/
|
|
5715
|
+
send(data: object[]): Promise<void>;
|
|
5716
|
+
}
|
|
4902
5717
|
// PubSubMessage represents an incoming PubSub message.
|
|
4903
5718
|
// The message includes metadata about the broker, the client, and the payload
|
|
4904
5719
|
// itself.
|
|
@@ -4959,6 +5774,7 @@ export declare namespace Rpc {
|
|
|
4959
5774
|
export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
|
|
4960
5775
|
export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
|
|
4961
5776
|
export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
|
|
5777
|
+
export const __WORKFLOW_ENTRYPOINT_BRAND: "__WORKFLOW_ENTRYPOINT_BRAND";
|
|
4962
5778
|
export interface RpcTargetBranded {
|
|
4963
5779
|
[__RPC_TARGET_BRAND]: never;
|
|
4964
5780
|
}
|
|
@@ -4968,13 +5784,20 @@ export declare namespace Rpc {
|
|
|
4968
5784
|
export interface DurableObjectBranded {
|
|
4969
5785
|
[__DURABLE_OBJECT_BRAND]: never;
|
|
4970
5786
|
}
|
|
5787
|
+
export interface WorkflowEntrypointBranded {
|
|
5788
|
+
[__WORKFLOW_ENTRYPOINT_BRAND]: never;
|
|
5789
|
+
}
|
|
4971
5790
|
export type EntrypointBranded =
|
|
4972
5791
|
| WorkerEntrypointBranded
|
|
4973
|
-
| DurableObjectBranded
|
|
5792
|
+
| DurableObjectBranded
|
|
5793
|
+
| WorkflowEntrypointBranded;
|
|
4974
5794
|
// Types that can be used through `Stub`s
|
|
4975
5795
|
export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
|
|
4976
5796
|
// Types that can be passed over RPC
|
|
4977
|
-
type
|
|
5797
|
+
// The reason for using a generic type here is to build a serializable subset of structured
|
|
5798
|
+
// cloneable composite types. This allows types defined with the "interface" keyword to pass the
|
|
5799
|
+
// serializable check as well. Otherwise, only types defined with the "type" keyword would pass.
|
|
5800
|
+
type Serializable<T> =
|
|
4978
5801
|
// Structured cloneables
|
|
4979
5802
|
| void
|
|
4980
5803
|
| undefined
|
|
@@ -4990,11 +5813,14 @@ export declare namespace Rpc {
|
|
|
4990
5813
|
| Error
|
|
4991
5814
|
| RegExp
|
|
4992
5815
|
// Structured cloneable composites
|
|
4993
|
-
| Map<
|
|
4994
|
-
|
|
4995
|
-
|
|
5816
|
+
| Map<
|
|
5817
|
+
T extends Map<infer U, unknown> ? Serializable<U> : never,
|
|
5818
|
+
T extends Map<unknown, infer U> ? Serializable<U> : never
|
|
5819
|
+
>
|
|
5820
|
+
| Set<T extends Set<infer U> ? Serializable<U> : never>
|
|
5821
|
+
| ReadonlyArray<T extends ReadonlyArray<infer U> ? Serializable<U> : never>
|
|
4996
5822
|
| {
|
|
4997
|
-
[
|
|
5823
|
+
[K in keyof T]: K extends number | string ? Serializable<T[K]> : never;
|
|
4998
5824
|
}
|
|
4999
5825
|
// Special types
|
|
5000
5826
|
| ReadableStream<Uint8Array>
|
|
@@ -5024,7 +5850,7 @@ export declare namespace Rpc {
|
|
|
5024
5850
|
: T extends ReadonlyArray<infer V>
|
|
5025
5851
|
? ReadonlyArray<Stubify<V>>
|
|
5026
5852
|
: T extends {
|
|
5027
|
-
[key: string | number]:
|
|
5853
|
+
[key: string | number]: any;
|
|
5028
5854
|
}
|
|
5029
5855
|
? {
|
|
5030
5856
|
[K in keyof T]: Stubify<T[K]>;
|
|
@@ -5067,7 +5893,7 @@ export declare namespace Rpc {
|
|
|
5067
5893
|
// Intersecting with `(Maybe)Provider` allows pipelining.
|
|
5068
5894
|
type Result<R> = R extends Stubable
|
|
5069
5895
|
? Promise<Stub<R>> & Provider<R>
|
|
5070
|
-
: R extends Serializable
|
|
5896
|
+
: R extends Serializable<R>
|
|
5071
5897
|
? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R>
|
|
5072
5898
|
: never;
|
|
5073
5899
|
// Type for method or property on an RPC interface.
|
|
@@ -5096,6 +5922,198 @@ export declare namespace Rpc {
|
|
|
5096
5922
|
>]: MethodOrProperty<T[K]>;
|
|
5097
5923
|
};
|
|
5098
5924
|
}
|
|
5925
|
+
export 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
|
+
}
|
|
5099
6117
|
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5100
6118
|
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5101
6119
|
// https://opensource.org/licenses/Apache-2.0
|
|
@@ -5139,11 +6157,21 @@ export type VectorizeVectorMetadataFilter = {
|
|
|
5139
6157
|
* Distance metrics determine how other "similar" vectors are determined.
|
|
5140
6158
|
*/
|
|
5141
6159
|
export 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
|
+
export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
|
|
5142
6170
|
export interface VectorizeQueryOptions {
|
|
5143
6171
|
topK?: number;
|
|
5144
6172
|
namespace?: string;
|
|
5145
6173
|
returnValues?: boolean;
|
|
5146
|
-
returnMetadata?: boolean;
|
|
6174
|
+
returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
|
|
5147
6175
|
filter?: VectorizeVectorMetadataFilter;
|
|
5148
6176
|
}
|
|
5149
6177
|
/**
|
|
@@ -5159,6 +6187,9 @@ export type VectorizeIndexConfig =
|
|
|
5159
6187
|
};
|
|
5160
6188
|
/**
|
|
5161
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.
|
|
5162
6193
|
*/
|
|
5163
6194
|
export interface VectorizeIndexDetails {
|
|
5164
6195
|
/** The unique ID of the index */
|
|
@@ -5172,6 +6203,19 @@ export interface VectorizeIndexDetails {
|
|
|
5172
6203
|
/** The number of records containing vectors within the index. */
|
|
5173
6204
|
vectorsCount: number;
|
|
5174
6205
|
}
|
|
6206
|
+
/**
|
|
6207
|
+
* Metadata about an existing index.
|
|
6208
|
+
*/
|
|
6209
|
+
export 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
|
+
}
|
|
5175
6219
|
/**
|
|
5176
6220
|
* Represents a single vector value set along with its associated metadata.
|
|
5177
6221
|
*/
|
|
@@ -5182,7 +6226,7 @@ export interface VectorizeVector {
|
|
|
5182
6226
|
values: VectorFloatArray | number[];
|
|
5183
6227
|
/** The namespace this vector belongs to. */
|
|
5184
6228
|
namespace?: string;
|
|
5185
|
-
/** 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. */
|
|
5186
6230
|
metadata?: Record<string, VectorizeVectorMetadata>;
|
|
5187
6231
|
}
|
|
5188
6232
|
/**
|
|
@@ -5194,7 +6238,7 @@ export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
|
|
|
5194
6238
|
score: number;
|
|
5195
6239
|
};
|
|
5196
6240
|
/**
|
|
5197
|
-
* A set of
|
|
6241
|
+
* A set of matching {@link VectorizeMatch} for a particular query.
|
|
5198
6242
|
*/
|
|
5199
6243
|
export interface VectorizeMatches {
|
|
5200
6244
|
matches: VectorizeMatch[];
|
|
@@ -5203,6 +6247,9 @@ export interface VectorizeMatches {
|
|
|
5203
6247
|
/**
|
|
5204
6248
|
* Results of an operation that performed a mutation on a set of vectors.
|
|
5205
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.
|
|
5206
6253
|
*/
|
|
5207
6254
|
export interface VectorizeVectorMutation {
|
|
5208
6255
|
/* List of ids of vectors that were successfully processed. */
|
|
@@ -5211,14 +6258,19 @@ export interface VectorizeVectorMutation {
|
|
|
5211
6258
|
count: number;
|
|
5212
6259
|
}
|
|
5213
6260
|
/**
|
|
5214
|
-
*
|
|
5215
|
-
*
|
|
5216
|
-
* 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.
|
|
5217
6263
|
*/
|
|
5218
|
-
export interface
|
|
5219
|
-
|
|
6264
|
+
export interface VectorizeAsyncMutation {
|
|
6265
|
+
/** The unique identifier for the async mutation operation containing the changeset. */
|
|
5220
6266
|
mutationId: string;
|
|
5221
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
|
+
*/
|
|
5222
6274
|
export declare abstract class VectorizeIndex {
|
|
5223
6275
|
/**
|
|
5224
6276
|
* Get information about the currently bound index.
|
|
@@ -5233,7 +6285,7 @@ export declare abstract class VectorizeIndex {
|
|
|
5233
6285
|
*/
|
|
5234
6286
|
public query(
|
|
5235
6287
|
vector: VectorFloatArray | number[],
|
|
5236
|
-
options
|
|
6288
|
+
options?: VectorizeQueryOptions,
|
|
5237
6289
|
): Promise<VectorizeMatches>;
|
|
5238
6290
|
/**
|
|
5239
6291
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
@@ -5260,6 +6312,62 @@ export declare abstract class VectorizeIndex {
|
|
|
5260
6312
|
*/
|
|
5261
6313
|
public getByIds(ids: string[]): Promise<VectorizeVector[]>;
|
|
5262
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
|
+
export 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
|
+
}
|
|
5263
6371
|
/**
|
|
5264
6372
|
* The interface for "version_metadata" binding
|
|
5265
6373
|
* providing metadata about the Worker Version using this binding.
|
|
@@ -5310,3 +6418,70 @@ export interface DispatchNamespace {
|
|
|
5310
6418
|
options?: DynamicDispatchOptions,
|
|
5311
6419
|
): Fetcher;
|
|
5312
6420
|
}
|
|
6421
|
+
export declare abstract class Workflow<PARAMS = unknown> {
|
|
6422
|
+
/**
|
|
6423
|
+
* Get a handle to an existing instance of the Workflow.
|
|
6424
|
+
* @param id Id for the instance of this Workflow
|
|
6425
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
6426
|
+
*/
|
|
6427
|
+
public get(id: string): Promise<WorkflowInstance>;
|
|
6428
|
+
/**
|
|
6429
|
+
* Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.
|
|
6430
|
+
* @param options Options when creating an instance including id and params
|
|
6431
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
6432
|
+
*/
|
|
6433
|
+
public create(
|
|
6434
|
+
options?: WorkflowInstanceCreateOptions<PARAMS>,
|
|
6435
|
+
): Promise<WorkflowInstance>;
|
|
6436
|
+
}
|
|
6437
|
+
export interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
|
|
6438
|
+
/**
|
|
6439
|
+
* An id for your Workflow instance. Must be unique within the Workflow.
|
|
6440
|
+
*/
|
|
6441
|
+
id?: string;
|
|
6442
|
+
/**
|
|
6443
|
+
* The event payload the Workflow instance is triggered with
|
|
6444
|
+
*/
|
|
6445
|
+
params?: PARAMS;
|
|
6446
|
+
}
|
|
6447
|
+
export type InstanceStatus = {
|
|
6448
|
+
status:
|
|
6449
|
+
| "queued" // means that instance is waiting to be started (see concurrency limits)
|
|
6450
|
+
| "running"
|
|
6451
|
+
| "paused"
|
|
6452
|
+
| "errored"
|
|
6453
|
+
| "terminated" // user terminated the instance while it was running
|
|
6454
|
+
| "complete"
|
|
6455
|
+
| "waiting" // instance is hibernating and waiting for sleep or event to finish
|
|
6456
|
+
| "waitingForPause" // instance is finishing the current work to pause
|
|
6457
|
+
| "unknown";
|
|
6458
|
+
error?: string;
|
|
6459
|
+
output?: object;
|
|
6460
|
+
};
|
|
6461
|
+
export interface WorkflowError {
|
|
6462
|
+
code?: number;
|
|
6463
|
+
message: string;
|
|
6464
|
+
}
|
|
6465
|
+
export declare abstract class WorkflowInstance {
|
|
6466
|
+
public id: string;
|
|
6467
|
+
/**
|
|
6468
|
+
* Pause the instance.
|
|
6469
|
+
*/
|
|
6470
|
+
public pause(): Promise<void>;
|
|
6471
|
+
/**
|
|
6472
|
+
* Resume the instance. If it is already running, an error will be thrown.
|
|
6473
|
+
*/
|
|
6474
|
+
public resume(): Promise<void>;
|
|
6475
|
+
/**
|
|
6476
|
+
* Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
|
|
6477
|
+
*/
|
|
6478
|
+
public terminate(): Promise<void>;
|
|
6479
|
+
/**
|
|
6480
|
+
* Restart the instance.
|
|
6481
|
+
*/
|
|
6482
|
+
public restart(): Promise<void>;
|
|
6483
|
+
/**
|
|
6484
|
+
* Returns the current status of the instance.
|
|
6485
|
+
*/
|
|
6486
|
+
public status(): Promise<InstanceStatus>;
|
|
6487
|
+
}
|