@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-10-31/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;
|
|
@@ -361,7 +363,7 @@ export declare function structuredClone<T>(
|
|
|
361
363
|
export declare function reportError(error: any): void;
|
|
362
364
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/fetch) */
|
|
363
365
|
export declare function fetch(
|
|
364
|
-
input: RequestInfo,
|
|
366
|
+
input: RequestInfo | URL,
|
|
365
367
|
init?: RequestInit<RequestInitCfProperties>,
|
|
366
368
|
): Promise<Response>;
|
|
367
369
|
export declare const self: ServiceWorkerGlobalScope;
|
|
@@ -388,12 +390,14 @@ export declare const scheduler: Scheduler;
|
|
|
388
390
|
* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/performance/)
|
|
389
391
|
*/
|
|
390
392
|
export declare const performance: Performance;
|
|
393
|
+
export declare const Cloudflare: Cloudflare;
|
|
391
394
|
export declare const origin: string;
|
|
392
395
|
export declare const navigator: Navigator;
|
|
393
396
|
export interface TestController {}
|
|
394
397
|
export interface ExecutionContext {
|
|
395
398
|
waitUntil(promise: Promise<any>): void;
|
|
396
399
|
passThroughOnException(): void;
|
|
400
|
+
props: any;
|
|
397
401
|
}
|
|
398
402
|
export type ExportedHandlerFetchHandler<
|
|
399
403
|
Env = unknown,
|
|
@@ -413,6 +417,11 @@ export type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
|
413
417
|
env: Env,
|
|
414
418
|
ctx: ExecutionContext,
|
|
415
419
|
) => void | Promise<void>;
|
|
420
|
+
export type ExportedHandlerTailStreamHandler<Env = unknown> = (
|
|
421
|
+
event: TailStream.TailEvent,
|
|
422
|
+
env: Env,
|
|
423
|
+
ctx: ExecutionContext,
|
|
424
|
+
) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
|
|
416
425
|
export type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
417
426
|
controller: ScheduledController,
|
|
418
427
|
env: Env,
|
|
@@ -436,6 +445,7 @@ export interface ExportedHandler<
|
|
|
436
445
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
437
446
|
tail?: ExportedHandlerTailHandler<Env>;
|
|
438
447
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
448
|
+
tailStream?: ExportedHandlerTailStreamHandler<Env>;
|
|
439
449
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
440
450
|
test?: ExportedHandlerTestHandler<Env>;
|
|
441
451
|
email?: EmailExportedHandler<Env>;
|
|
@@ -459,8 +469,9 @@ export declare abstract class Navigator {
|
|
|
459
469
|
| string
|
|
460
470
|
| (ArrayBuffer | ArrayBufferView)
|
|
461
471
|
| Blob
|
|
472
|
+
| FormData
|
|
462
473
|
| URLSearchParams
|
|
463
|
-
|
|
|
474
|
+
| URLSearchParams,
|
|
464
475
|
): boolean;
|
|
465
476
|
readonly userAgent: string;
|
|
466
477
|
readonly gpu: GPU;
|
|
@@ -481,9 +492,12 @@ export interface AlarmInvocationInfo {
|
|
|
481
492
|
readonly isRetry: boolean;
|
|
482
493
|
readonly retryCount: number;
|
|
483
494
|
}
|
|
495
|
+
export interface Cloudflare {
|
|
496
|
+
readonly compatibilityFlags: Record<string, boolean>;
|
|
497
|
+
}
|
|
484
498
|
export interface DurableObject {
|
|
485
499
|
fetch(request: Request): Response | Promise<Response>;
|
|
486
|
-
alarm?(): void | Promise<void>;
|
|
500
|
+
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
|
|
487
501
|
webSocketMessage?(
|
|
488
502
|
ws: WebSocket,
|
|
489
503
|
message: string | ArrayBuffer,
|
|
@@ -556,6 +570,7 @@ export interface DurableObjectState {
|
|
|
556
570
|
setHibernatableWebSocketEventTimeout(timeoutMs?: number): void;
|
|
557
571
|
getHibernatableWebSocketEventTimeout(): number | null;
|
|
558
572
|
getTags(ws: WebSocket): string[];
|
|
573
|
+
abort(reason?: string): void;
|
|
559
574
|
}
|
|
560
575
|
export interface DurableObjectTransaction {
|
|
561
576
|
get<T = unknown>(
|
|
@@ -622,7 +637,11 @@ export interface DurableObjectStorage {
|
|
|
622
637
|
): Promise<void>;
|
|
623
638
|
deleteAlarm(options?: DurableObjectSetAlarmOptions): Promise<void>;
|
|
624
639
|
sync(): Promise<void>;
|
|
640
|
+
sql: SqlStorage;
|
|
625
641
|
transactionSync<T>(closure: () => T): T;
|
|
642
|
+
getCurrentBookmark(): Promise<string>;
|
|
643
|
+
getBookmarkForTime(timestamp: number | Date): Promise<string>;
|
|
644
|
+
onNextSessionRestoreBookmark(bookmark: string): Promise<string>;
|
|
626
645
|
}
|
|
627
646
|
export interface DurableObjectListOptions {
|
|
628
647
|
start?: string;
|
|
@@ -993,14 +1012,17 @@ export declare abstract class CacheStorage {
|
|
|
993
1012
|
*/
|
|
994
1013
|
export declare abstract class Cache {
|
|
995
1014
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#delete) */
|
|
996
|
-
delete(
|
|
1015
|
+
delete(
|
|
1016
|
+
request: RequestInfo | URL,
|
|
1017
|
+
options?: CacheQueryOptions,
|
|
1018
|
+
): Promise<boolean>;
|
|
997
1019
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#match) */
|
|
998
1020
|
match(
|
|
999
|
-
request: RequestInfo,
|
|
1021
|
+
request: RequestInfo | URL,
|
|
1000
1022
|
options?: CacheQueryOptions,
|
|
1001
1023
|
): Promise<Response | undefined>;
|
|
1002
1024
|
/* [Cloudflare Docs Reference](https://developers.cloudflare.com/workers/runtime-apis/cache/#put) */
|
|
1003
|
-
put(request: RequestInfo, response: Response): Promise<void>;
|
|
1025
|
+
put(request: RequestInfo | URL, response: Response): Promise<void>;
|
|
1004
1026
|
}
|
|
1005
1027
|
export interface CacheQueryOptions {
|
|
1006
1028
|
ignoreMethod?: boolean;
|
|
@@ -1423,20 +1445,44 @@ export interface Element {
|
|
|
1423
1445
|
hasAttribute(name: string): boolean;
|
|
1424
1446
|
setAttribute(name: string, value: string): Element;
|
|
1425
1447
|
removeAttribute(name: string): Element;
|
|
1426
|
-
before(
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1448
|
+
before(
|
|
1449
|
+
content: string | ReadableStream | Response,
|
|
1450
|
+
options?: ContentOptions,
|
|
1451
|
+
): Element;
|
|
1452
|
+
after(
|
|
1453
|
+
content: string | ReadableStream | Response,
|
|
1454
|
+
options?: ContentOptions,
|
|
1455
|
+
): Element;
|
|
1456
|
+
prepend(
|
|
1457
|
+
content: string | ReadableStream | Response,
|
|
1458
|
+
options?: ContentOptions,
|
|
1459
|
+
): Element;
|
|
1460
|
+
append(
|
|
1461
|
+
content: string | ReadableStream | Response,
|
|
1462
|
+
options?: ContentOptions,
|
|
1463
|
+
): Element;
|
|
1464
|
+
replace(
|
|
1465
|
+
content: string | ReadableStream | Response,
|
|
1466
|
+
options?: ContentOptions,
|
|
1467
|
+
): Element;
|
|
1431
1468
|
remove(): Element;
|
|
1432
1469
|
removeAndKeepContent(): Element;
|
|
1433
|
-
setInnerContent(
|
|
1470
|
+
setInnerContent(
|
|
1471
|
+
content: string | ReadableStream | Response,
|
|
1472
|
+
options?: ContentOptions,
|
|
1473
|
+
): Element;
|
|
1434
1474
|
onEndTag(handler: (tag: EndTag) => void | Promise<void>): void;
|
|
1435
1475
|
}
|
|
1436
1476
|
export interface EndTag {
|
|
1437
1477
|
name: string;
|
|
1438
|
-
before(
|
|
1439
|
-
|
|
1478
|
+
before(
|
|
1479
|
+
content: string | ReadableStream | Response,
|
|
1480
|
+
options?: ContentOptions,
|
|
1481
|
+
): EndTag;
|
|
1482
|
+
after(
|
|
1483
|
+
content: string | ReadableStream | Response,
|
|
1484
|
+
options?: ContentOptions,
|
|
1485
|
+
): EndTag;
|
|
1440
1486
|
remove(): EndTag;
|
|
1441
1487
|
}
|
|
1442
1488
|
export interface Comment {
|
|
@@ -1451,9 +1497,18 @@ export interface Text {
|
|
|
1451
1497
|
readonly text: string;
|
|
1452
1498
|
readonly lastInTextNode: boolean;
|
|
1453
1499
|
readonly removed: boolean;
|
|
1454
|
-
before(
|
|
1455
|
-
|
|
1456
|
-
|
|
1500
|
+
before(
|
|
1501
|
+
content: string | ReadableStream | Response,
|
|
1502
|
+
options?: ContentOptions,
|
|
1503
|
+
): Text;
|
|
1504
|
+
after(
|
|
1505
|
+
content: string | ReadableStream | Response,
|
|
1506
|
+
options?: ContentOptions,
|
|
1507
|
+
): Text;
|
|
1508
|
+
replace(
|
|
1509
|
+
content: string | ReadableStream | Response,
|
|
1510
|
+
options?: ContentOptions,
|
|
1511
|
+
): Text;
|
|
1457
1512
|
remove(): Text;
|
|
1458
1513
|
}
|
|
1459
1514
|
export interface DocumentEnd {
|
|
@@ -1535,28 +1590,34 @@ export declare abstract class Body {
|
|
|
1535
1590
|
*
|
|
1536
1591
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1537
1592
|
*/
|
|
1538
|
-
export declare
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1593
|
+
export declare var Response: {
|
|
1594
|
+
prototype: Response;
|
|
1595
|
+
new (body?: BodyInit | null, init?: ResponseInit): Response;
|
|
1596
|
+
redirect(url: string, status?: number): Response;
|
|
1597
|
+
json(any: any, maybeInit?: ResponseInit | Response): Response;
|
|
1598
|
+
};
|
|
1599
|
+
/**
|
|
1600
|
+
* This Fetch API interface represents the response to a request.
|
|
1601
|
+
*
|
|
1602
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response)
|
|
1603
|
+
*/
|
|
1604
|
+
export interface Response extends Body {
|
|
1544
1605
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/clone) */
|
|
1545
1606
|
clone(): Response;
|
|
1546
1607
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/status) */
|
|
1547
|
-
|
|
1608
|
+
status: number;
|
|
1548
1609
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/statusText) */
|
|
1549
|
-
|
|
1610
|
+
statusText: string;
|
|
1550
1611
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/headers) */
|
|
1551
|
-
|
|
1612
|
+
headers: Headers;
|
|
1552
1613
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/ok) */
|
|
1553
|
-
|
|
1614
|
+
ok: boolean;
|
|
1554
1615
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/redirected) */
|
|
1555
|
-
|
|
1616
|
+
redirected: boolean;
|
|
1556
1617
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Response/url) */
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1618
|
+
url: string;
|
|
1619
|
+
webSocket: WebSocket | null;
|
|
1620
|
+
cf: any | undefined;
|
|
1560
1621
|
}
|
|
1561
1622
|
export interface ResponseInit {
|
|
1562
1623
|
status?: number;
|
|
@@ -1569,17 +1630,28 @@ export interface ResponseInit {
|
|
|
1569
1630
|
export type RequestInfo<
|
|
1570
1631
|
CfHostMetadata = unknown,
|
|
1571
1632
|
Cf = CfProperties<CfHostMetadata>,
|
|
1572
|
-
> = Request<CfHostMetadata, Cf> | string
|
|
1633
|
+
> = Request<CfHostMetadata, Cf> | string;
|
|
1634
|
+
/**
|
|
1635
|
+
* This Fetch API interface represents a resource request.
|
|
1636
|
+
*
|
|
1637
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
|
|
1638
|
+
*/
|
|
1639
|
+
export declare var Request: {
|
|
1640
|
+
prototype: Request;
|
|
1641
|
+
new <CfHostMetadata = unknown, Cf = CfProperties<CfHostMetadata>>(
|
|
1642
|
+
input: RequestInfo<CfProperties> | URL,
|
|
1643
|
+
init?: RequestInit<Cf>,
|
|
1644
|
+
): Request<CfHostMetadata, Cf>;
|
|
1645
|
+
};
|
|
1573
1646
|
/**
|
|
1574
1647
|
* This Fetch API interface represents a resource request.
|
|
1575
1648
|
*
|
|
1576
1649
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request)
|
|
1577
1650
|
*/
|
|
1578
|
-
export
|
|
1651
|
+
export interface Request<
|
|
1579
1652
|
CfHostMetadata = unknown,
|
|
1580
1653
|
Cf = CfProperties<CfHostMetadata>,
|
|
1581
1654
|
> extends Body {
|
|
1582
|
-
constructor(input: RequestInfo<CfProperties>, init?: RequestInit<Cf>);
|
|
1583
1655
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/clone) */
|
|
1584
1656
|
clone(): Request<CfHostMetadata, Cf>;
|
|
1585
1657
|
/**
|
|
@@ -1587,45 +1659,45 @@ export declare class Request<
|
|
|
1587
1659
|
*
|
|
1588
1660
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/method)
|
|
1589
1661
|
*/
|
|
1590
|
-
|
|
1662
|
+
method: string;
|
|
1591
1663
|
/**
|
|
1592
1664
|
* Returns the URL of request as a string.
|
|
1593
1665
|
*
|
|
1594
1666
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/url)
|
|
1595
1667
|
*/
|
|
1596
|
-
|
|
1668
|
+
url: string;
|
|
1597
1669
|
/**
|
|
1598
1670
|
* 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.
|
|
1599
1671
|
*
|
|
1600
1672
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/headers)
|
|
1601
1673
|
*/
|
|
1602
|
-
|
|
1674
|
+
headers: Headers;
|
|
1603
1675
|
/**
|
|
1604
1676
|
* 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.
|
|
1605
1677
|
*
|
|
1606
1678
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/redirect)
|
|
1607
1679
|
*/
|
|
1608
|
-
|
|
1609
|
-
|
|
1680
|
+
redirect: string;
|
|
1681
|
+
fetcher: Fetcher | null;
|
|
1610
1682
|
/**
|
|
1611
1683
|
* Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.
|
|
1612
1684
|
*
|
|
1613
1685
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/signal)
|
|
1614
1686
|
*/
|
|
1615
|
-
|
|
1616
|
-
|
|
1687
|
+
signal: AbortSignal;
|
|
1688
|
+
cf: Cf | undefined;
|
|
1617
1689
|
/**
|
|
1618
1690
|
* 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]
|
|
1619
1691
|
*
|
|
1620
1692
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/integrity)
|
|
1621
1693
|
*/
|
|
1622
|
-
|
|
1694
|
+
integrity: string;
|
|
1623
1695
|
/**
|
|
1624
1696
|
* Returns a boolean indicating whether or not request can outlive the global in which it was created.
|
|
1625
1697
|
*
|
|
1626
1698
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/keepalive)
|
|
1627
1699
|
*/
|
|
1628
|
-
|
|
1700
|
+
keepalive: boolean;
|
|
1629
1701
|
}
|
|
1630
1702
|
export interface RequestInit<Cf = CfProperties> {
|
|
1631
1703
|
/* A string to set request's method. */
|
|
@@ -1652,7 +1724,7 @@ export type Fetcher<
|
|
|
1652
1724
|
> = (T extends Rpc.EntrypointBranded
|
|
1653
1725
|
? Rpc.Provider<T, Reserved | "fetch" | "connect">
|
|
1654
1726
|
: unknown) & {
|
|
1655
|
-
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
1727
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
1656
1728
|
connect(address: SocketAddress | string, options?: SocketOptions): Socket;
|
|
1657
1729
|
};
|
|
1658
1730
|
export interface FetcherPutOptions {
|
|
@@ -1874,6 +1946,7 @@ export interface R2MultipartUpload {
|
|
|
1874
1946
|
uploadPart(
|
|
1875
1947
|
partNumber: number,
|
|
1876
1948
|
value: ReadableStream | (ArrayBuffer | ArrayBufferView) | string | Blob,
|
|
1949
|
+
options?: R2UploadPartOptions,
|
|
1877
1950
|
): Promise<R2UploadedPart>;
|
|
1878
1951
|
abort(): Promise<void>;
|
|
1879
1952
|
complete(uploadedParts: R2UploadedPart[]): Promise<R2Object>;
|
|
@@ -1894,6 +1967,7 @@ export declare abstract class R2Object {
|
|
|
1894
1967
|
readonly customMetadata?: Record<string, string>;
|
|
1895
1968
|
readonly range?: R2Range;
|
|
1896
1969
|
readonly storageClass: string;
|
|
1970
|
+
readonly ssecKeyMd5?: string;
|
|
1897
1971
|
writeHttpMetadata(headers: Headers): void;
|
|
1898
1972
|
}
|
|
1899
1973
|
export interface R2ObjectBody extends R2Object {
|
|
@@ -1926,6 +2000,7 @@ export interface R2Conditional {
|
|
|
1926
2000
|
export interface R2GetOptions {
|
|
1927
2001
|
onlyIf?: R2Conditional | Headers;
|
|
1928
2002
|
range?: R2Range | Headers;
|
|
2003
|
+
ssecKey?: ArrayBuffer | string;
|
|
1929
2004
|
}
|
|
1930
2005
|
export interface R2PutOptions {
|
|
1931
2006
|
onlyIf?: R2Conditional | Headers;
|
|
@@ -1937,11 +2012,13 @@ export interface R2PutOptions {
|
|
|
1937
2012
|
sha384?: ArrayBuffer | string;
|
|
1938
2013
|
sha512?: ArrayBuffer | string;
|
|
1939
2014
|
storageClass?: string;
|
|
2015
|
+
ssecKey?: ArrayBuffer | string;
|
|
1940
2016
|
}
|
|
1941
2017
|
export interface R2MultipartOptions {
|
|
1942
2018
|
httpMetadata?: R2HTTPMetadata | Headers;
|
|
1943
2019
|
customMetadata?: Record<string, string>;
|
|
1944
2020
|
storageClass?: string;
|
|
2021
|
+
ssecKey?: ArrayBuffer | string;
|
|
1945
2022
|
}
|
|
1946
2023
|
export interface R2Checksums {
|
|
1947
2024
|
readonly md5?: ArrayBuffer;
|
|
@@ -1978,6 +2055,9 @@ export type R2Objects = {
|
|
|
1978
2055
|
truncated: false;
|
|
1979
2056
|
}
|
|
1980
2057
|
);
|
|
2058
|
+
export interface R2UploadPartOptions {
|
|
2059
|
+
ssecKey?: ArrayBuffer | string;
|
|
2060
|
+
}
|
|
1981
2061
|
export declare abstract class ScheduledEvent extends ExtendableEvent {
|
|
1982
2062
|
readonly scheduledTime: number;
|
|
1983
2063
|
readonly cron: string;
|
|
@@ -2391,6 +2471,8 @@ export interface TraceItem {
|
|
|
2391
2471
|
readonly dispatchNamespace?: string;
|
|
2392
2472
|
readonly scriptTags?: string[];
|
|
2393
2473
|
readonly outcome: string;
|
|
2474
|
+
readonly executionModel: string;
|
|
2475
|
+
readonly truncated: boolean;
|
|
2394
2476
|
}
|
|
2395
2477
|
export interface TraceItemAlarmEventInfo {
|
|
2396
2478
|
readonly scheduledTime: Date;
|
|
@@ -2530,6 +2612,10 @@ export declare class URL {
|
|
|
2530
2612
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/canParse_static) */
|
|
2531
2613
|
static canParse(url: string, base?: string): boolean;
|
|
2532
2614
|
static parse(url: string, base?: string): URL | null;
|
|
2615
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL_static) */
|
|
2616
|
+
static createObjectURL(object: File | Blob): string;
|
|
2617
|
+
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URL/revokeObjectURL_static) */
|
|
2618
|
+
static revokeObjectURL(object_url: string): void;
|
|
2533
2619
|
}
|
|
2534
2620
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/URLSearchParams) */
|
|
2535
2621
|
export declare class URLSearchParams {
|
|
@@ -2703,8 +2789,24 @@ export type WebSocketEventMap = {
|
|
|
2703
2789
|
*
|
|
2704
2790
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
2705
2791
|
*/
|
|
2706
|
-
export declare
|
|
2707
|
-
|
|
2792
|
+
export declare var WebSocket: {
|
|
2793
|
+
prototype: WebSocket;
|
|
2794
|
+
new (url: string, protocols?: string[] | string): WebSocket;
|
|
2795
|
+
readonly READY_STATE_CONNECTING: number;
|
|
2796
|
+
readonly CONNECTING: number;
|
|
2797
|
+
readonly READY_STATE_OPEN: number;
|
|
2798
|
+
readonly OPEN: number;
|
|
2799
|
+
readonly READY_STATE_CLOSING: number;
|
|
2800
|
+
readonly CLOSING: number;
|
|
2801
|
+
readonly READY_STATE_CLOSED: number;
|
|
2802
|
+
readonly CLOSED: number;
|
|
2803
|
+
};
|
|
2804
|
+
/**
|
|
2805
|
+
* Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.
|
|
2806
|
+
*
|
|
2807
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket)
|
|
2808
|
+
*/
|
|
2809
|
+
export interface WebSocket extends EventTarget<WebSocketEventMap> {
|
|
2708
2810
|
accept(): void;
|
|
2709
2811
|
/**
|
|
2710
2812
|
* Transmits data using the WebSocket connection. data can be a string, a Blob, an ArrayBuffer, or an ArrayBufferView.
|
|
@@ -2720,38 +2822,30 @@ export declare class WebSocket extends EventTarget<WebSocketEventMap> {
|
|
|
2720
2822
|
close(code?: number, reason?: string): void;
|
|
2721
2823
|
serializeAttachment(attachment: any): void;
|
|
2722
2824
|
deserializeAttachment(): any | null;
|
|
2723
|
-
static readonly READY_STATE_CONNECTING: number;
|
|
2724
|
-
static readonly CONNECTING: number;
|
|
2725
|
-
static readonly READY_STATE_OPEN: number;
|
|
2726
|
-
static readonly OPEN: number;
|
|
2727
|
-
static readonly READY_STATE_CLOSING: number;
|
|
2728
|
-
static readonly CLOSING: number;
|
|
2729
|
-
static readonly READY_STATE_CLOSED: number;
|
|
2730
|
-
static readonly CLOSED: number;
|
|
2731
2825
|
/**
|
|
2732
2826
|
* Returns the state of the WebSocket object's connection. It can have the values described below.
|
|
2733
2827
|
*
|
|
2734
2828
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/readyState)
|
|
2735
2829
|
*/
|
|
2736
|
-
|
|
2830
|
+
readyState: number;
|
|
2737
2831
|
/**
|
|
2738
2832
|
* Returns the URL that was used to establish the WebSocket connection.
|
|
2739
2833
|
*
|
|
2740
2834
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/url)
|
|
2741
2835
|
*/
|
|
2742
|
-
|
|
2836
|
+
url: string | null;
|
|
2743
2837
|
/**
|
|
2744
2838
|
* 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.
|
|
2745
2839
|
*
|
|
2746
2840
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/protocol)
|
|
2747
2841
|
*/
|
|
2748
|
-
|
|
2842
|
+
protocol: string | null;
|
|
2749
2843
|
/**
|
|
2750
2844
|
* Returns the extensions selected by the server, if any.
|
|
2751
2845
|
*
|
|
2752
2846
|
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/WebSocket/extensions)
|
|
2753
2847
|
*/
|
|
2754
|
-
|
|
2848
|
+
extensions: string | null;
|
|
2755
2849
|
}
|
|
2756
2850
|
export declare const WebSocketPair: {
|
|
2757
2851
|
new (): {
|
|
@@ -2759,6 +2853,37 @@ export declare const WebSocketPair: {
|
|
|
2759
2853
|
1: WebSocket;
|
|
2760
2854
|
};
|
|
2761
2855
|
};
|
|
2856
|
+
export interface SqlStorage {
|
|
2857
|
+
exec<T extends Record<string, SqlStorageValue>>(
|
|
2858
|
+
query: string,
|
|
2859
|
+
...bindings: any[]
|
|
2860
|
+
): SqlStorageCursor<T>;
|
|
2861
|
+
get databaseSize(): number;
|
|
2862
|
+
Cursor: typeof SqlStorageCursor;
|
|
2863
|
+
Statement: typeof SqlStorageStatement;
|
|
2864
|
+
}
|
|
2865
|
+
export declare abstract class SqlStorageStatement {}
|
|
2866
|
+
export type SqlStorageValue = ArrayBuffer | string | number | null;
|
|
2867
|
+
export declare abstract class SqlStorageCursor<
|
|
2868
|
+
T extends Record<string, SqlStorageValue>,
|
|
2869
|
+
> {
|
|
2870
|
+
next():
|
|
2871
|
+
| {
|
|
2872
|
+
done?: false;
|
|
2873
|
+
value: T;
|
|
2874
|
+
}
|
|
2875
|
+
| {
|
|
2876
|
+
done: true;
|
|
2877
|
+
value?: never;
|
|
2878
|
+
};
|
|
2879
|
+
toArray(): T[];
|
|
2880
|
+
one(): T;
|
|
2881
|
+
raw<U extends SqlStorageValue[]>(): IterableIterator<U>;
|
|
2882
|
+
columnNames: string[];
|
|
2883
|
+
get rowsRead(): number;
|
|
2884
|
+
get rowsWritten(): number;
|
|
2885
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
2886
|
+
}
|
|
2762
2887
|
export interface Socket {
|
|
2763
2888
|
get readable(): ReadableStream;
|
|
2764
2889
|
get writable(): WritableStream;
|
|
@@ -3296,7 +3421,7 @@ export interface GPUOrigin3DDict {
|
|
|
3296
3421
|
z?: number;
|
|
3297
3422
|
}
|
|
3298
3423
|
/* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
|
|
3299
|
-
export declare class EventSource {
|
|
3424
|
+
export declare class EventSource extends EventTarget {
|
|
3300
3425
|
constructor(url: string, init?: EventSourceEventSourceInit);
|
|
3301
3426
|
/**
|
|
3302
3427
|
* Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
|
|
@@ -3395,10 +3520,10 @@ export declare abstract class BaseAiSentenceSimilarity {
|
|
|
3395
3520
|
inputs: AiSentenceSimilarityInput;
|
|
3396
3521
|
postProcessedOutputs: AiSentenceSimilarityOutput;
|
|
3397
3522
|
}
|
|
3398
|
-
export type
|
|
3523
|
+
export type AiAutomaticSpeechRecognitionInput = {
|
|
3399
3524
|
audio: number[];
|
|
3400
3525
|
};
|
|
3401
|
-
export type
|
|
3526
|
+
export type AiAutomaticSpeechRecognitionOutput = {
|
|
3402
3527
|
text?: string;
|
|
3403
3528
|
words?: {
|
|
3404
3529
|
word: string;
|
|
@@ -3407,9 +3532,9 @@ export type AiSpeechRecognitionOutput = {
|
|
|
3407
3532
|
}[];
|
|
3408
3533
|
vtt?: string;
|
|
3409
3534
|
};
|
|
3410
|
-
export declare abstract class
|
|
3411
|
-
inputs:
|
|
3412
|
-
postProcessedOutputs:
|
|
3535
|
+
export declare abstract class BaseAiAutomaticSpeechRecognition {
|
|
3536
|
+
inputs: AiAutomaticSpeechRecognitionInput;
|
|
3537
|
+
postProcessedOutputs: AiAutomaticSpeechRecognitionOutput;
|
|
3413
3538
|
}
|
|
3414
3539
|
export type AiSummarizationInput = {
|
|
3415
3540
|
input_text: string;
|
|
@@ -3445,16 +3570,36 @@ export declare abstract class BaseAiTextEmbeddings {
|
|
|
3445
3570
|
postProcessedOutputs: AiTextEmbeddingsOutput;
|
|
3446
3571
|
}
|
|
3447
3572
|
export type RoleScopedChatInput = {
|
|
3448
|
-
role:
|
|
3573
|
+
role:
|
|
3574
|
+
| "user"
|
|
3575
|
+
| "assistant"
|
|
3576
|
+
| "system"
|
|
3577
|
+
| "tool"
|
|
3578
|
+
| (string & NonNullable<unknown>);
|
|
3449
3579
|
content: string;
|
|
3580
|
+
name?: string;
|
|
3581
|
+
};
|
|
3582
|
+
export type AiTextGenerationToolLegacyInput = {
|
|
3583
|
+
name: string;
|
|
3584
|
+
description: string;
|
|
3585
|
+
parameters?: {
|
|
3586
|
+
type: "object" | (string & NonNullable<unknown>);
|
|
3587
|
+
properties: {
|
|
3588
|
+
[key: string]: {
|
|
3589
|
+
type: string;
|
|
3590
|
+
description?: string;
|
|
3591
|
+
};
|
|
3592
|
+
};
|
|
3593
|
+
required: string[];
|
|
3594
|
+
};
|
|
3450
3595
|
};
|
|
3451
3596
|
export type AiTextGenerationToolInput = {
|
|
3452
|
-
type: "function";
|
|
3597
|
+
type: "function" | (string & NonNullable<unknown>);
|
|
3453
3598
|
function: {
|
|
3454
3599
|
name: string;
|
|
3455
3600
|
description: string;
|
|
3456
3601
|
parameters?: {
|
|
3457
|
-
type: "object";
|
|
3602
|
+
type: "object" | (string & NonNullable<unknown>);
|
|
3458
3603
|
properties: {
|
|
3459
3604
|
[key: string]: {
|
|
3460
3605
|
type: string;
|
|
@@ -3465,6 +3610,10 @@ export type AiTextGenerationToolInput = {
|
|
|
3465
3610
|
};
|
|
3466
3611
|
};
|
|
3467
3612
|
};
|
|
3613
|
+
export type AiTextGenerationFunctionsInput = {
|
|
3614
|
+
name: string;
|
|
3615
|
+
code: string;
|
|
3616
|
+
};
|
|
3468
3617
|
export type AiTextGenerationInput = {
|
|
3469
3618
|
prompt?: string;
|
|
3470
3619
|
raw?: boolean;
|
|
@@ -3478,7 +3627,11 @@ export type AiTextGenerationInput = {
|
|
|
3478
3627
|
frequency_penalty?: number;
|
|
3479
3628
|
presence_penalty?: number;
|
|
3480
3629
|
messages?: RoleScopedChatInput[];
|
|
3481
|
-
tools?:
|
|
3630
|
+
tools?:
|
|
3631
|
+
| AiTextGenerationToolInput[]
|
|
3632
|
+
| AiTextGenerationToolLegacyInput[]
|
|
3633
|
+
| (object & NonNullable<unknown>);
|
|
3634
|
+
functions?: AiTextGenerationFunctionsInput[];
|
|
3482
3635
|
};
|
|
3483
3636
|
export type AiTextGenerationOutput =
|
|
3484
3637
|
| {
|
|
@@ -3493,15 +3646,33 @@ export declare abstract class BaseAiTextGeneration {
|
|
|
3493
3646
|
inputs: AiTextGenerationInput;
|
|
3494
3647
|
postProcessedOutputs: AiTextGenerationOutput;
|
|
3495
3648
|
}
|
|
3649
|
+
export type AiTextToSpeechInput = {
|
|
3650
|
+
prompt: string;
|
|
3651
|
+
lang?: string;
|
|
3652
|
+
};
|
|
3653
|
+
export type AiTextToSpeechOutput =
|
|
3654
|
+
| Uint8Array
|
|
3655
|
+
| {
|
|
3656
|
+
audio: string;
|
|
3657
|
+
};
|
|
3658
|
+
export declare abstract class BaseAiTextToSpeech {
|
|
3659
|
+
inputs: AiTextToSpeechInput;
|
|
3660
|
+
postProcessedOutputs: AiTextToSpeechOutput;
|
|
3661
|
+
}
|
|
3496
3662
|
export type AiTextToImageInput = {
|
|
3497
3663
|
prompt: string;
|
|
3664
|
+
negative_prompt?: string;
|
|
3665
|
+
height?: number;
|
|
3666
|
+
width?: number;
|
|
3498
3667
|
image?: number[];
|
|
3668
|
+
image_b64?: string;
|
|
3499
3669
|
mask?: number[];
|
|
3500
3670
|
num_steps?: number;
|
|
3501
3671
|
strength?: number;
|
|
3502
3672
|
guidance?: number;
|
|
3673
|
+
seed?: number;
|
|
3503
3674
|
};
|
|
3504
|
-
export type AiTextToImageOutput = Uint8Array
|
|
3675
|
+
export type AiTextToImageOutput = ReadableStream<Uint8Array>;
|
|
3505
3676
|
export declare abstract class BaseAiTextToImage {
|
|
3506
3677
|
inputs: AiTextToImageInput;
|
|
3507
3678
|
postProcessedOutputs: AiTextToImageOutput;
|
|
@@ -3518,127 +3689,615 @@ export declare abstract class BaseAiTranslation {
|
|
|
3518
3689
|
inputs: AiTranslationInput;
|
|
3519
3690
|
postProcessedOutputs: AiTranslationOutput;
|
|
3520
3691
|
}
|
|
3692
|
+
export type Ai_Cf_Openai_Whisper_Input =
|
|
3693
|
+
| string
|
|
3694
|
+
| {
|
|
3695
|
+
/**
|
|
3696
|
+
* An array of integers that represent the audio data constrained to 8-bit unsigned integer values
|
|
3697
|
+
*/
|
|
3698
|
+
audio: number[];
|
|
3699
|
+
};
|
|
3700
|
+
export interface Ai_Cf_Openai_Whisper_Output {
|
|
3701
|
+
/**
|
|
3702
|
+
* The transcription
|
|
3703
|
+
*/
|
|
3704
|
+
text: string;
|
|
3705
|
+
word_count?: number;
|
|
3706
|
+
words?: {
|
|
3707
|
+
word?: string;
|
|
3708
|
+
/**
|
|
3709
|
+
* The second this word begins in the recording
|
|
3710
|
+
*/
|
|
3711
|
+
start?: number;
|
|
3712
|
+
/**
|
|
3713
|
+
* The ending second when the word completes
|
|
3714
|
+
*/
|
|
3715
|
+
end?: number;
|
|
3716
|
+
}[];
|
|
3717
|
+
vtt?: string;
|
|
3718
|
+
}
|
|
3719
|
+
export declare abstract class Base_Ai_Cf_Openai_Whisper {
|
|
3720
|
+
inputs: Ai_Cf_Openai_Whisper_Input;
|
|
3721
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Output;
|
|
3722
|
+
}
|
|
3723
|
+
export type Ai_Cf_Openai_Whisper_Tiny_En_Input =
|
|
3724
|
+
| string
|
|
3725
|
+
| {
|
|
3726
|
+
/**
|
|
3727
|
+
* An array of integers that represent the audio data constrained to 8-bit unsigned integer values
|
|
3728
|
+
*/
|
|
3729
|
+
audio: number[];
|
|
3730
|
+
};
|
|
3731
|
+
export interface Ai_Cf_Openai_Whisper_Tiny_En_Output {
|
|
3732
|
+
/**
|
|
3733
|
+
* The transcription
|
|
3734
|
+
*/
|
|
3735
|
+
text: string;
|
|
3736
|
+
word_count?: number;
|
|
3737
|
+
words?: {
|
|
3738
|
+
word?: string;
|
|
3739
|
+
/**
|
|
3740
|
+
* The second this word begins in the recording
|
|
3741
|
+
*/
|
|
3742
|
+
start?: number;
|
|
3743
|
+
/**
|
|
3744
|
+
* The ending second when the word completes
|
|
3745
|
+
*/
|
|
3746
|
+
end?: number;
|
|
3747
|
+
}[];
|
|
3748
|
+
vtt?: string;
|
|
3749
|
+
}
|
|
3750
|
+
export declare abstract class Base_Ai_Cf_Openai_Whisper_Tiny_En {
|
|
3751
|
+
inputs: Ai_Cf_Openai_Whisper_Tiny_En_Input;
|
|
3752
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Tiny_En_Output;
|
|
3753
|
+
}
|
|
3754
|
+
export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input {
|
|
3755
|
+
/**
|
|
3756
|
+
* Base64 encoded value of the audio data.
|
|
3757
|
+
*/
|
|
3758
|
+
audio: string;
|
|
3759
|
+
/**
|
|
3760
|
+
* Supported tasks are 'translate' or 'transcribe'.
|
|
3761
|
+
*/
|
|
3762
|
+
task?: string;
|
|
3763
|
+
/**
|
|
3764
|
+
* The language of the audio being transcribed or translated.
|
|
3765
|
+
*/
|
|
3766
|
+
language?: string;
|
|
3767
|
+
/**
|
|
3768
|
+
* Preprocess the audio with a voice activity detection model.
|
|
3769
|
+
*/
|
|
3770
|
+
vad_filter?: string;
|
|
3771
|
+
/**
|
|
3772
|
+
* A text prompt to help provide context to the model on the contents of the audio.
|
|
3773
|
+
*/
|
|
3774
|
+
initial_prompt?: string;
|
|
3775
|
+
/**
|
|
3776
|
+
* The prefix it appended the the beginning of the output of the transcription and can guide the transcription result.
|
|
3777
|
+
*/
|
|
3778
|
+
prefix?: string;
|
|
3779
|
+
}
|
|
3780
|
+
export interface Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output {
|
|
3781
|
+
transcription_info?: {
|
|
3782
|
+
/**
|
|
3783
|
+
* The language of the audio being transcribed or translated.
|
|
3784
|
+
*/
|
|
3785
|
+
language?: string;
|
|
3786
|
+
/**
|
|
3787
|
+
* The confidence level or probability of the detected language being accurate, represented as a decimal between 0 and 1.
|
|
3788
|
+
*/
|
|
3789
|
+
language_probability?: number;
|
|
3790
|
+
/**
|
|
3791
|
+
* The total duration of the original audio file, in seconds.
|
|
3792
|
+
*/
|
|
3793
|
+
duration?: number;
|
|
3794
|
+
/**
|
|
3795
|
+
* The duration of the audio after applying Voice Activity Detection (VAD) to remove silent or irrelevant sections, in seconds.
|
|
3796
|
+
*/
|
|
3797
|
+
duration_after_vad?: number;
|
|
3798
|
+
};
|
|
3799
|
+
/**
|
|
3800
|
+
* The complete transcription of the audio.
|
|
3801
|
+
*/
|
|
3802
|
+
text: string;
|
|
3803
|
+
/**
|
|
3804
|
+
* The total number of words in the transcription.
|
|
3805
|
+
*/
|
|
3806
|
+
word_count?: number;
|
|
3807
|
+
segments?: {
|
|
3808
|
+
/**
|
|
3809
|
+
* The starting time of the segment within the audio, in seconds.
|
|
3810
|
+
*/
|
|
3811
|
+
start?: number;
|
|
3812
|
+
/**
|
|
3813
|
+
* The ending time of the segment within the audio, in seconds.
|
|
3814
|
+
*/
|
|
3815
|
+
end?: number;
|
|
3816
|
+
/**
|
|
3817
|
+
* The transcription of the segment.
|
|
3818
|
+
*/
|
|
3819
|
+
text?: string;
|
|
3820
|
+
/**
|
|
3821
|
+
* The temperature used in the decoding process, controlling randomness in predictions. Lower values result in more deterministic outputs.
|
|
3822
|
+
*/
|
|
3823
|
+
temperature?: number;
|
|
3824
|
+
/**
|
|
3825
|
+
* The average log probability of the predictions for the words in this segment, indicating overall confidence.
|
|
3826
|
+
*/
|
|
3827
|
+
avg_logprob?: number;
|
|
3828
|
+
/**
|
|
3829
|
+
* The compression ratio of the input to the output, measuring how much the text was compressed during the transcription process.
|
|
3830
|
+
*/
|
|
3831
|
+
compression_ratio?: number;
|
|
3832
|
+
/**
|
|
3833
|
+
* The probability that the segment contains no speech, represented as a decimal between 0 and 1.
|
|
3834
|
+
*/
|
|
3835
|
+
no_speech_prob?: number;
|
|
3836
|
+
words?: {
|
|
3837
|
+
/**
|
|
3838
|
+
* The individual word transcribed from the audio.
|
|
3839
|
+
*/
|
|
3840
|
+
word?: string;
|
|
3841
|
+
/**
|
|
3842
|
+
* The starting time of the word within the audio, in seconds.
|
|
3843
|
+
*/
|
|
3844
|
+
start?: number;
|
|
3845
|
+
/**
|
|
3846
|
+
* The ending time of the word within the audio, in seconds.
|
|
3847
|
+
*/
|
|
3848
|
+
end?: number;
|
|
3849
|
+
}[];
|
|
3850
|
+
};
|
|
3851
|
+
/**
|
|
3852
|
+
* The transcription in WebVTT format, which includes timing and text information for use in subtitles.
|
|
3853
|
+
*/
|
|
3854
|
+
vtt?: string;
|
|
3855
|
+
}
|
|
3856
|
+
export declare abstract class Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo {
|
|
3857
|
+
inputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Input;
|
|
3858
|
+
postProcessedOutputs: Ai_Cf_Openai_Whisper_Large_V3_Turbo_Output;
|
|
3859
|
+
}
|
|
3860
|
+
export interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input {
|
|
3861
|
+
/**
|
|
3862
|
+
* A text description of the image you want to generate.
|
|
3863
|
+
*/
|
|
3864
|
+
prompt: string;
|
|
3865
|
+
/**
|
|
3866
|
+
* The number of diffusion steps; higher values can improve quality but take longer.
|
|
3867
|
+
*/
|
|
3868
|
+
steps?: number;
|
|
3869
|
+
}
|
|
3870
|
+
export interface Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output {
|
|
3871
|
+
/**
|
|
3872
|
+
* The generated image in Base64 format.
|
|
3873
|
+
*/
|
|
3874
|
+
image?: string;
|
|
3875
|
+
}
|
|
3876
|
+
export declare abstract class Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell {
|
|
3877
|
+
inputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Input;
|
|
3878
|
+
postProcessedOutputs: Ai_Cf_Black_Forest_Labs_Flux_1_Schnell_Output;
|
|
3879
|
+
}
|
|
3880
|
+
export type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input = Prompt | Messages;
|
|
3881
|
+
export interface Prompt {
|
|
3882
|
+
/**
|
|
3883
|
+
* The input text prompt for the model to generate a response.
|
|
3884
|
+
*/
|
|
3885
|
+
prompt: string;
|
|
3886
|
+
image?: number[] | (string & NonNullable<unknown>);
|
|
3887
|
+
/**
|
|
3888
|
+
* If true, a chat template is not applied and you must adhere to the specific model's expected formatting.
|
|
3889
|
+
*/
|
|
3890
|
+
raw?: boolean;
|
|
3891
|
+
/**
|
|
3892
|
+
* If true, the response will be streamed back incrementally using SSE, Server Sent Events.
|
|
3893
|
+
*/
|
|
3894
|
+
stream?: boolean;
|
|
3895
|
+
/**
|
|
3896
|
+
* The maximum number of tokens to generate in the response.
|
|
3897
|
+
*/
|
|
3898
|
+
max_tokens?: number;
|
|
3899
|
+
/**
|
|
3900
|
+
* Controls the randomness of the output; higher values produce more random results.
|
|
3901
|
+
*/
|
|
3902
|
+
temperature?: number;
|
|
3903
|
+
/**
|
|
3904
|
+
* 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.
|
|
3905
|
+
*/
|
|
3906
|
+
top_p?: number;
|
|
3907
|
+
/**
|
|
3908
|
+
* 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.
|
|
3909
|
+
*/
|
|
3910
|
+
top_k?: number;
|
|
3911
|
+
/**
|
|
3912
|
+
* Random seed for reproducibility of the generation.
|
|
3913
|
+
*/
|
|
3914
|
+
seed?: number;
|
|
3915
|
+
/**
|
|
3916
|
+
* Penalty for repeated tokens; higher values discourage repetition.
|
|
3917
|
+
*/
|
|
3918
|
+
repetition_penalty?: number;
|
|
3919
|
+
/**
|
|
3920
|
+
* Decreases the likelihood of the model repeating the same lines verbatim.
|
|
3921
|
+
*/
|
|
3922
|
+
frequency_penalty?: number;
|
|
3923
|
+
/**
|
|
3924
|
+
* Increases the likelihood of the model introducing new topics.
|
|
3925
|
+
*/
|
|
3926
|
+
presence_penalty?: number;
|
|
3927
|
+
/**
|
|
3928
|
+
* Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base model.
|
|
3929
|
+
*/
|
|
3930
|
+
lora?: string;
|
|
3931
|
+
}
|
|
3932
|
+
export interface Messages {
|
|
3933
|
+
/**
|
|
3934
|
+
* An array of message objects representing the conversation history.
|
|
3935
|
+
*/
|
|
3936
|
+
messages: {
|
|
3937
|
+
/**
|
|
3938
|
+
* The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool').
|
|
3939
|
+
*/
|
|
3940
|
+
role: string;
|
|
3941
|
+
/**
|
|
3942
|
+
* The content of the message as a string.
|
|
3943
|
+
*/
|
|
3944
|
+
content: string;
|
|
3945
|
+
}[];
|
|
3946
|
+
image?: number[] | string;
|
|
3947
|
+
functions?: {
|
|
3948
|
+
name: string;
|
|
3949
|
+
code: string;
|
|
3950
|
+
}[];
|
|
3951
|
+
/**
|
|
3952
|
+
* A list of tools available for the assistant to use.
|
|
3953
|
+
*/
|
|
3954
|
+
tools?: (
|
|
3955
|
+
| {
|
|
3956
|
+
/**
|
|
3957
|
+
* The name of the tool. More descriptive the better.
|
|
3958
|
+
*/
|
|
3959
|
+
name: string;
|
|
3960
|
+
/**
|
|
3961
|
+
* A brief description of what the tool does.
|
|
3962
|
+
*/
|
|
3963
|
+
description: string;
|
|
3964
|
+
/**
|
|
3965
|
+
* Schema defining the parameters accepted by the tool.
|
|
3966
|
+
*/
|
|
3967
|
+
parameters: {
|
|
3968
|
+
/**
|
|
3969
|
+
* The type of the parameters object (usually 'object').
|
|
3970
|
+
*/
|
|
3971
|
+
type: string;
|
|
3972
|
+
/**
|
|
3973
|
+
* List of required parameter names.
|
|
3974
|
+
*/
|
|
3975
|
+
required?: string[];
|
|
3976
|
+
/**
|
|
3977
|
+
* Definitions of each parameter.
|
|
3978
|
+
*/
|
|
3979
|
+
properties: {
|
|
3980
|
+
[k: string]: {
|
|
3981
|
+
/**
|
|
3982
|
+
* The data type of the parameter.
|
|
3983
|
+
*/
|
|
3984
|
+
type: string;
|
|
3985
|
+
/**
|
|
3986
|
+
* A description of the expected parameter.
|
|
3987
|
+
*/
|
|
3988
|
+
description: string;
|
|
3989
|
+
};
|
|
3990
|
+
};
|
|
3991
|
+
};
|
|
3992
|
+
}
|
|
3993
|
+
| {
|
|
3994
|
+
/**
|
|
3995
|
+
* Specifies the type of tool (e.g., 'function').
|
|
3996
|
+
*/
|
|
3997
|
+
type: string;
|
|
3998
|
+
/**
|
|
3999
|
+
* Details of the function tool.
|
|
4000
|
+
*/
|
|
4001
|
+
function: {
|
|
4002
|
+
/**
|
|
4003
|
+
* The name of the function.
|
|
4004
|
+
*/
|
|
4005
|
+
name: string;
|
|
4006
|
+
/**
|
|
4007
|
+
* A brief description of what the function does.
|
|
4008
|
+
*/
|
|
4009
|
+
description: string;
|
|
4010
|
+
/**
|
|
4011
|
+
* Schema defining the parameters accepted by the function.
|
|
4012
|
+
*/
|
|
4013
|
+
parameters: {
|
|
4014
|
+
/**
|
|
4015
|
+
* The type of the parameters object (usually 'object').
|
|
4016
|
+
*/
|
|
4017
|
+
type: string;
|
|
4018
|
+
/**
|
|
4019
|
+
* List of required parameter names.
|
|
4020
|
+
*/
|
|
4021
|
+
required?: string[];
|
|
4022
|
+
/**
|
|
4023
|
+
* Definitions of each parameter.
|
|
4024
|
+
*/
|
|
4025
|
+
properties: {
|
|
4026
|
+
[k: string]: {
|
|
4027
|
+
/**
|
|
4028
|
+
* The data type of the parameter.
|
|
4029
|
+
*/
|
|
4030
|
+
type: string;
|
|
4031
|
+
/**
|
|
4032
|
+
* A description of the expected parameter.
|
|
4033
|
+
*/
|
|
4034
|
+
description: string;
|
|
4035
|
+
};
|
|
4036
|
+
};
|
|
4037
|
+
};
|
|
4038
|
+
};
|
|
4039
|
+
}
|
|
4040
|
+
)[];
|
|
4041
|
+
/**
|
|
4042
|
+
* If true, the response will be streamed back incrementally.
|
|
4043
|
+
*/
|
|
4044
|
+
stream?: boolean;
|
|
4045
|
+
/**
|
|
4046
|
+
* The maximum number of tokens to generate in the response.
|
|
4047
|
+
*/
|
|
4048
|
+
max_tokens?: number;
|
|
4049
|
+
/**
|
|
4050
|
+
* Controls the randomness of the output; higher values produce more random results.
|
|
4051
|
+
*/
|
|
4052
|
+
temperature?: number;
|
|
4053
|
+
/**
|
|
4054
|
+
* 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.
|
|
4055
|
+
*/
|
|
4056
|
+
top_p?: number;
|
|
4057
|
+
/**
|
|
4058
|
+
* 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.
|
|
4059
|
+
*/
|
|
4060
|
+
top_k?: number;
|
|
4061
|
+
/**
|
|
4062
|
+
* Random seed for reproducibility of the generation.
|
|
4063
|
+
*/
|
|
4064
|
+
seed?: number;
|
|
4065
|
+
/**
|
|
4066
|
+
* Penalty for repeated tokens; higher values discourage repetition.
|
|
4067
|
+
*/
|
|
4068
|
+
repetition_penalty?: number;
|
|
4069
|
+
/**
|
|
4070
|
+
* Decreases the likelihood of the model repeating the same lines verbatim.
|
|
4071
|
+
*/
|
|
4072
|
+
frequency_penalty?: number;
|
|
4073
|
+
/**
|
|
4074
|
+
* Increases the likelihood of the model introducing new topics.
|
|
4075
|
+
*/
|
|
4076
|
+
presence_penalty?: number;
|
|
4077
|
+
}
|
|
4078
|
+
export type Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output =
|
|
4079
|
+
| {
|
|
4080
|
+
/**
|
|
4081
|
+
* The generated text response from the model
|
|
4082
|
+
*/
|
|
4083
|
+
response?: string;
|
|
4084
|
+
/**
|
|
4085
|
+
* An array of tool calls requests made during the response generation
|
|
4086
|
+
*/
|
|
4087
|
+
tool_calls?: {
|
|
4088
|
+
/**
|
|
4089
|
+
* The arguments passed to be passed to the tool call request
|
|
4090
|
+
*/
|
|
4091
|
+
arguments?: object;
|
|
4092
|
+
/**
|
|
4093
|
+
* The name of the tool to be called
|
|
4094
|
+
*/
|
|
4095
|
+
name?: string;
|
|
4096
|
+
}[];
|
|
4097
|
+
}
|
|
4098
|
+
| ReadableStream;
|
|
4099
|
+
export declare abstract class Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct {
|
|
4100
|
+
inputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Input;
|
|
4101
|
+
postProcessedOutputs: Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct_Output;
|
|
4102
|
+
}
|
|
4103
|
+
export interface AiModels {
|
|
4104
|
+
"@cf/huggingface/distilbert-sst-2-int8": BaseAiTextClassification;
|
|
4105
|
+
"@cf/stabilityai/stable-diffusion-xl-base-1.0": BaseAiTextToImage;
|
|
4106
|
+
"@cf/runwayml/stable-diffusion-v1-5-inpainting": BaseAiTextToImage;
|
|
4107
|
+
"@cf/runwayml/stable-diffusion-v1-5-img2img": BaseAiTextToImage;
|
|
4108
|
+
"@cf/lykon/dreamshaper-8-lcm": BaseAiTextToImage;
|
|
4109
|
+
"@cf/bytedance/stable-diffusion-xl-lightning": BaseAiTextToImage;
|
|
4110
|
+
"@cf/baai/bge-base-en-v1.5": BaseAiTextEmbeddings;
|
|
4111
|
+
"@cf/baai/bge-small-en-v1.5": BaseAiTextEmbeddings;
|
|
4112
|
+
"@cf/baai/bge-large-en-v1.5": BaseAiTextEmbeddings;
|
|
4113
|
+
"@cf/microsoft/resnet-50": BaseAiImageClassification;
|
|
4114
|
+
"@cf/facebook/detr-resnet-50": BaseAiObjectDetection;
|
|
4115
|
+
"@cf/meta/llama-2-7b-chat-int8": BaseAiTextGeneration;
|
|
4116
|
+
"@cf/mistral/mistral-7b-instruct-v0.1": BaseAiTextGeneration;
|
|
4117
|
+
"@cf/meta/llama-2-7b-chat-fp16": BaseAiTextGeneration;
|
|
4118
|
+
"@hf/thebloke/llama-2-13b-chat-awq": BaseAiTextGeneration;
|
|
4119
|
+
"@hf/thebloke/mistral-7b-instruct-v0.1-awq": BaseAiTextGeneration;
|
|
4120
|
+
"@hf/thebloke/zephyr-7b-beta-awq": BaseAiTextGeneration;
|
|
4121
|
+
"@hf/thebloke/openhermes-2.5-mistral-7b-awq": BaseAiTextGeneration;
|
|
4122
|
+
"@hf/thebloke/neural-chat-7b-v3-1-awq": BaseAiTextGeneration;
|
|
4123
|
+
"@hf/thebloke/llamaguard-7b-awq": BaseAiTextGeneration;
|
|
4124
|
+
"@hf/thebloke/deepseek-coder-6.7b-base-awq": BaseAiTextGeneration;
|
|
4125
|
+
"@hf/thebloke/deepseek-coder-6.7b-instruct-awq": BaseAiTextGeneration;
|
|
4126
|
+
"@cf/deepseek-ai/deepseek-math-7b-instruct": BaseAiTextGeneration;
|
|
4127
|
+
"@cf/defog/sqlcoder-7b-2": BaseAiTextGeneration;
|
|
4128
|
+
"@cf/openchat/openchat-3.5-0106": BaseAiTextGeneration;
|
|
4129
|
+
"@cf/tiiuae/falcon-7b-instruct": BaseAiTextGeneration;
|
|
4130
|
+
"@cf/thebloke/discolm-german-7b-v1-awq": BaseAiTextGeneration;
|
|
4131
|
+
"@cf/qwen/qwen1.5-0.5b-chat": BaseAiTextGeneration;
|
|
4132
|
+
"@cf/qwen/qwen1.5-7b-chat-awq": BaseAiTextGeneration;
|
|
4133
|
+
"@cf/qwen/qwen1.5-14b-chat-awq": BaseAiTextGeneration;
|
|
4134
|
+
"@cf/tinyllama/tinyllama-1.1b-chat-v1.0": BaseAiTextGeneration;
|
|
4135
|
+
"@cf/microsoft/phi-2": BaseAiTextGeneration;
|
|
4136
|
+
"@cf/qwen/qwen1.5-1.8b-chat": BaseAiTextGeneration;
|
|
4137
|
+
"@cf/mistral/mistral-7b-instruct-v0.2-lora": BaseAiTextGeneration;
|
|
4138
|
+
"@hf/nousresearch/hermes-2-pro-mistral-7b": BaseAiTextGeneration;
|
|
4139
|
+
"@hf/nexusflow/starling-lm-7b-beta": BaseAiTextGeneration;
|
|
4140
|
+
"@hf/google/gemma-7b-it": BaseAiTextGeneration;
|
|
4141
|
+
"@cf/meta-llama/llama-2-7b-chat-hf-lora": BaseAiTextGeneration;
|
|
4142
|
+
"@cf/google/gemma-2b-it-lora": BaseAiTextGeneration;
|
|
4143
|
+
"@cf/google/gemma-7b-it-lora": BaseAiTextGeneration;
|
|
4144
|
+
"@hf/mistral/mistral-7b-instruct-v0.2": BaseAiTextGeneration;
|
|
4145
|
+
"@cf/meta/llama-3-8b-instruct": BaseAiTextGeneration;
|
|
4146
|
+
"@cf/fblgit/una-cybertron-7b-v2-bf16": BaseAiTextGeneration;
|
|
4147
|
+
"@cf/meta/llama-3-8b-instruct-awq": BaseAiTextGeneration;
|
|
4148
|
+
"@hf/meta-llama/meta-llama-3-8b-instruct": BaseAiTextGeneration;
|
|
4149
|
+
"@cf/meta/llama-3.1-8b-instruct": BaseAiTextGeneration;
|
|
4150
|
+
"@cf/meta/llama-3.1-8b-instruct-fp8": BaseAiTextGeneration;
|
|
4151
|
+
"@cf/meta/llama-3.1-8b-instruct-awq": BaseAiTextGeneration;
|
|
4152
|
+
"@cf/meta/llama-3.2-3b-instruct": BaseAiTextGeneration;
|
|
4153
|
+
"@cf/meta/llama-3.2-1b-instruct": BaseAiTextGeneration;
|
|
4154
|
+
"@cf/meta/llama-3.3-70b-instruct-fp8-fast": BaseAiTextGeneration;
|
|
4155
|
+
"@cf/meta/m2m100-1.2b": BaseAiTranslation;
|
|
4156
|
+
"@cf/facebook/bart-large-cnn": BaseAiSummarization;
|
|
4157
|
+
"@cf/unum/uform-gen2-qwen-500m": BaseAiImageToText;
|
|
4158
|
+
"@cf/llava-hf/llava-1.5-7b-hf": BaseAiImageToText;
|
|
4159
|
+
"@cf/openai/whisper": Base_Ai_Cf_Openai_Whisper;
|
|
4160
|
+
"@cf/openai/whisper-tiny-en": Base_Ai_Cf_Openai_Whisper_Tiny_En;
|
|
4161
|
+
"@cf/openai/whisper-large-v3-turbo": Base_Ai_Cf_Openai_Whisper_Large_V3_Turbo;
|
|
4162
|
+
"@cf/black-forest-labs/flux-1-schnell": Base_Ai_Cf_Black_Forest_Labs_Flux_1_Schnell;
|
|
4163
|
+
"@cf/meta/llama-3.2-11b-vision-instruct": Base_Ai_Cf_Meta_Llama_3_2_11B_Vision_Instruct;
|
|
4164
|
+
}
|
|
4165
|
+
export type AiOptions = {
|
|
4166
|
+
gateway?: GatewayOptions;
|
|
4167
|
+
prefix?: string;
|
|
4168
|
+
extraHeaders?: object;
|
|
4169
|
+
};
|
|
4170
|
+
export type AiModelsSearchParams = {
|
|
4171
|
+
author?: string;
|
|
4172
|
+
hide_experimental?: boolean;
|
|
4173
|
+
page?: number;
|
|
4174
|
+
per_page?: number;
|
|
4175
|
+
search?: string;
|
|
4176
|
+
source?: number;
|
|
4177
|
+
task?: string;
|
|
4178
|
+
};
|
|
4179
|
+
export type AiModelsSearchObject = {
|
|
4180
|
+
id: string;
|
|
4181
|
+
source: number;
|
|
4182
|
+
name: string;
|
|
4183
|
+
description: string;
|
|
4184
|
+
task: {
|
|
4185
|
+
id: string;
|
|
4186
|
+
name: string;
|
|
4187
|
+
description: string;
|
|
4188
|
+
};
|
|
4189
|
+
tags: string[];
|
|
4190
|
+
properties: {
|
|
4191
|
+
property_id: string;
|
|
4192
|
+
value: string;
|
|
4193
|
+
}[];
|
|
4194
|
+
};
|
|
4195
|
+
export interface InferenceUpstreamError extends Error {}
|
|
4196
|
+
export interface AiInternalError extends Error {}
|
|
4197
|
+
export type AiModelListType = Record<string, any>;
|
|
4198
|
+
export declare abstract class Ai<
|
|
4199
|
+
AiModelList extends AiModelListType = AiModels,
|
|
4200
|
+
> {
|
|
4201
|
+
aiGatewayLogId: string | null;
|
|
4202
|
+
gateway(gatewayId: string): AiGateway;
|
|
4203
|
+
run<Name extends keyof AiModelList>(
|
|
4204
|
+
model: Name,
|
|
4205
|
+
inputs: AiModelList[Name]["inputs"],
|
|
4206
|
+
options?: AiOptions,
|
|
4207
|
+
): Promise<AiModelList[Name]["postProcessedOutputs"]>;
|
|
4208
|
+
public models(params?: AiModelsSearchParams): Promise<AiModelsSearchObject[]>;
|
|
4209
|
+
}
|
|
3521
4210
|
export type GatewayOptions = {
|
|
3522
4211
|
id: string;
|
|
4212
|
+
cacheKey?: string;
|
|
3523
4213
|
cacheTtl?: number;
|
|
3524
4214
|
skipCache?: boolean;
|
|
3525
4215
|
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
4216
|
+
collectLog?: boolean;
|
|
3526
4217
|
};
|
|
3527
|
-
export type
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
4218
|
+
export type AiGatewayPatchLog = {
|
|
4219
|
+
score?: number | null;
|
|
4220
|
+
feedback?: -1 | 1 | null;
|
|
4221
|
+
metadata?: Record<string, number | string | boolean | null | bigint> | null;
|
|
3531
4222
|
};
|
|
3532
|
-
export type
|
|
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
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
): Promise<
|
|
3607
|
-
run(
|
|
3608
|
-
model: BaseAiSpeechRecognitionModels,
|
|
3609
|
-
inputs: BaseAiSpeechRecognition["inputs"],
|
|
3610
|
-
options?: AiOptions,
|
|
3611
|
-
): Promise<BaseAiSpeechRecognition["postProcessedOutputs"]>;
|
|
3612
|
-
run(
|
|
3613
|
-
model: BaseAiImageClassificationModels,
|
|
3614
|
-
inputs: BaseAiImageClassification["inputs"],
|
|
3615
|
-
options?: AiOptions,
|
|
3616
|
-
): Promise<BaseAiImageClassification["postProcessedOutputs"]>;
|
|
3617
|
-
run(
|
|
3618
|
-
model: BaseAiObjectDetectionModels,
|
|
3619
|
-
inputs: BaseAiObjectDetection["inputs"],
|
|
3620
|
-
options?: AiOptions,
|
|
3621
|
-
): Promise<BaseAiObjectDetection["postProcessedOutputs"]>;
|
|
3622
|
-
run(
|
|
3623
|
-
model: BaseAiTextGenerationModels,
|
|
3624
|
-
inputs: BaseAiTextGeneration["inputs"],
|
|
3625
|
-
options?: AiOptions,
|
|
3626
|
-
): Promise<BaseAiTextGeneration["postProcessedOutputs"]>;
|
|
3627
|
-
run(
|
|
3628
|
-
model: BaseAiTranslationModels,
|
|
3629
|
-
inputs: BaseAiTranslation["inputs"],
|
|
3630
|
-
options?: AiOptions,
|
|
3631
|
-
): Promise<BaseAiTranslation["postProcessedOutputs"]>;
|
|
3632
|
-
run(
|
|
3633
|
-
model: BaseAiSummarizationModels,
|
|
3634
|
-
inputs: BaseAiSummarization["inputs"],
|
|
3635
|
-
options?: AiOptions,
|
|
3636
|
-
): Promise<BaseAiSummarization["postProcessedOutputs"]>;
|
|
4223
|
+
export type AiGatewayLog = {
|
|
4224
|
+
id: string;
|
|
4225
|
+
provider: string;
|
|
4226
|
+
model: string;
|
|
4227
|
+
model_type?: string;
|
|
4228
|
+
path: string;
|
|
4229
|
+
duration: number;
|
|
4230
|
+
request_type?: string;
|
|
4231
|
+
request_content_type?: string;
|
|
4232
|
+
status_code: number;
|
|
4233
|
+
response_content_type?: string;
|
|
4234
|
+
success: boolean;
|
|
4235
|
+
cached: boolean;
|
|
4236
|
+
tokens_in?: number;
|
|
4237
|
+
tokens_out?: number;
|
|
4238
|
+
metadata?: Record<string, number | string | boolean | null | bigint>;
|
|
4239
|
+
step?: number;
|
|
4240
|
+
cost?: number;
|
|
4241
|
+
custom_cost?: boolean;
|
|
4242
|
+
request_size: number;
|
|
4243
|
+
request_head?: string;
|
|
4244
|
+
request_head_complete: boolean;
|
|
4245
|
+
response_size: number;
|
|
4246
|
+
response_head?: string;
|
|
4247
|
+
response_head_complete: boolean;
|
|
4248
|
+
created_at: Date;
|
|
4249
|
+
};
|
|
4250
|
+
export type AIGatewayProviders =
|
|
4251
|
+
| "workers-ai"
|
|
4252
|
+
| "anthropic"
|
|
4253
|
+
| "aws-bedrock"
|
|
4254
|
+
| "azure-openai"
|
|
4255
|
+
| "google-vertex-ai"
|
|
4256
|
+
| "huggingface"
|
|
4257
|
+
| "openai"
|
|
4258
|
+
| "perplexity-ai"
|
|
4259
|
+
| "replicate"
|
|
4260
|
+
| "groq"
|
|
4261
|
+
| "cohere"
|
|
4262
|
+
| "google-ai-studio"
|
|
4263
|
+
| "mistral"
|
|
4264
|
+
| "grok"
|
|
4265
|
+
| "openrouter";
|
|
4266
|
+
export type AIGatewayHeaders = {
|
|
4267
|
+
"cf-aig-metadata":
|
|
4268
|
+
| Record<string, number | string | boolean | null | bigint>
|
|
4269
|
+
| string;
|
|
4270
|
+
"cf-aig-custom-cost":
|
|
4271
|
+
| {
|
|
4272
|
+
per_token_in?: number;
|
|
4273
|
+
per_token_out?: number;
|
|
4274
|
+
}
|
|
4275
|
+
| {
|
|
4276
|
+
total_cost?: number;
|
|
4277
|
+
}
|
|
4278
|
+
| string;
|
|
4279
|
+
"cf-aig-cache-ttl": number | string;
|
|
4280
|
+
"cf-aig-skip-cache": boolean | string;
|
|
4281
|
+
"cf-aig-cache-key": string;
|
|
4282
|
+
"cf-aig-collect-log": boolean | string;
|
|
4283
|
+
Authorization: string;
|
|
4284
|
+
"Content-Type": string;
|
|
4285
|
+
[key: string]: string | number | boolean | object;
|
|
4286
|
+
};
|
|
4287
|
+
export type AIGatewayUniversalRequest = {
|
|
4288
|
+
provider: AIGatewayProviders | string; // eslint-disable-line
|
|
4289
|
+
endpoint: string;
|
|
4290
|
+
headers: Partial<AIGatewayHeaders>;
|
|
4291
|
+
query: unknown;
|
|
4292
|
+
};
|
|
4293
|
+
export interface AiGatewayInternalError extends Error {}
|
|
4294
|
+
export interface AiGatewayLogNotFound extends Error {}
|
|
4295
|
+
export declare abstract class AiGateway {
|
|
4296
|
+
patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
|
|
4297
|
+
getLog(logId: string): Promise<AiGatewayLog>;
|
|
3637
4298
|
run(
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
options?: AiOptions,
|
|
3641
|
-
): Promise<BaseAiImageToText["postProcessedOutputs"]>;
|
|
4299
|
+
data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
|
|
4300
|
+
): Promise<Response>;
|
|
3642
4301
|
}
|
|
3643
4302
|
export interface BasicImageTransformations {
|
|
3644
4303
|
/**
|
|
@@ -4656,7 +5315,7 @@ export declare abstract class D1PreparedStatement {
|
|
|
4656
5315
|
bind(...values: unknown[]): D1PreparedStatement;
|
|
4657
5316
|
first<T = unknown>(colName: string): Promise<T | null>;
|
|
4658
5317
|
first<T = Record<string, unknown>>(): Promise<T | null>;
|
|
4659
|
-
run(): Promise<
|
|
5318
|
+
run<T = Record<string, unknown>>(): Promise<D1Result<T>>;
|
|
4660
5319
|
all<T = Record<string, unknown>>(): Promise<D1Result<T>>;
|
|
4661
5320
|
raw<T = unknown[]>(options: {
|
|
4662
5321
|
columnNames: true;
|
|
@@ -4712,6 +5371,12 @@ export interface ForwardableEmailMessage extends EmailMessage {
|
|
|
4712
5371
|
* @returns A promise that resolves when the email message is forwarded.
|
|
4713
5372
|
*/
|
|
4714
5373
|
forward(rcptTo: string, headers?: Headers): Promise<void>;
|
|
5374
|
+
/**
|
|
5375
|
+
* Reply to the sender of this email message with a new EmailMessage object.
|
|
5376
|
+
* @param message The reply message.
|
|
5377
|
+
* @returns A promise that resolves when the email message is replied.
|
|
5378
|
+
*/
|
|
5379
|
+
reply(message: EmailMessage): Promise<void>;
|
|
4715
5380
|
}
|
|
4716
5381
|
/**
|
|
4717
5382
|
* A binding that allows a Worker to send email messages.
|
|
@@ -4774,6 +5439,128 @@ export interface Hyperdrive {
|
|
|
4774
5439
|
*/
|
|
4775
5440
|
readonly database: string;
|
|
4776
5441
|
}
|
|
5442
|
+
// Copyright (c) 2024 Cloudflare, Inc.
|
|
5443
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5444
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5445
|
+
export type ImageInfoResponse =
|
|
5446
|
+
| {
|
|
5447
|
+
format: "image/svg+xml";
|
|
5448
|
+
}
|
|
5449
|
+
| {
|
|
5450
|
+
format: string;
|
|
5451
|
+
fileSize: number;
|
|
5452
|
+
width: number;
|
|
5453
|
+
height: number;
|
|
5454
|
+
};
|
|
5455
|
+
export type ImageTransform = {
|
|
5456
|
+
fit?: "scale-down" | "contain" | "pad" | "squeeze" | "cover" | "crop";
|
|
5457
|
+
gravity?:
|
|
5458
|
+
| "left"
|
|
5459
|
+
| "right"
|
|
5460
|
+
| "top"
|
|
5461
|
+
| "bottom"
|
|
5462
|
+
| "center"
|
|
5463
|
+
| "auto"
|
|
5464
|
+
| "entropy"
|
|
5465
|
+
| "face"
|
|
5466
|
+
| {
|
|
5467
|
+
x?: number;
|
|
5468
|
+
y?: number;
|
|
5469
|
+
mode: "remainder" | "box-center";
|
|
5470
|
+
};
|
|
5471
|
+
trim?: {
|
|
5472
|
+
top?: number;
|
|
5473
|
+
bottom?: number;
|
|
5474
|
+
left?: number;
|
|
5475
|
+
right?: number;
|
|
5476
|
+
width?: number;
|
|
5477
|
+
height?: number;
|
|
5478
|
+
border?:
|
|
5479
|
+
| boolean
|
|
5480
|
+
| {
|
|
5481
|
+
color?: string;
|
|
5482
|
+
tolerance?: number;
|
|
5483
|
+
keep?: number;
|
|
5484
|
+
};
|
|
5485
|
+
};
|
|
5486
|
+
width?: number;
|
|
5487
|
+
height?: number;
|
|
5488
|
+
background?: string;
|
|
5489
|
+
rotate?: number;
|
|
5490
|
+
sharpen?: number;
|
|
5491
|
+
blur?: number;
|
|
5492
|
+
contrast?: number;
|
|
5493
|
+
brightness?: number;
|
|
5494
|
+
gamma?: number;
|
|
5495
|
+
border?: {
|
|
5496
|
+
color?: string;
|
|
5497
|
+
width?: number;
|
|
5498
|
+
top?: number;
|
|
5499
|
+
bottom?: number;
|
|
5500
|
+
left?: number;
|
|
5501
|
+
right?: number;
|
|
5502
|
+
};
|
|
5503
|
+
zoom?: number;
|
|
5504
|
+
};
|
|
5505
|
+
export type ImageOutputOptions = {
|
|
5506
|
+
format:
|
|
5507
|
+
| "image/jpeg"
|
|
5508
|
+
| "image/png"
|
|
5509
|
+
| "image/gif"
|
|
5510
|
+
| "image/webp"
|
|
5511
|
+
| "image/avif"
|
|
5512
|
+
| "rgb"
|
|
5513
|
+
| "rgba";
|
|
5514
|
+
quality?: number;
|
|
5515
|
+
background?: string;
|
|
5516
|
+
};
|
|
5517
|
+
export interface ImagesBinding {
|
|
5518
|
+
/**
|
|
5519
|
+
* Get image metadata (type, width and height)
|
|
5520
|
+
* @throws {@link ImagesError} with code 9412 if input is not an image
|
|
5521
|
+
* @param stream The image bytes
|
|
5522
|
+
*/
|
|
5523
|
+
info(stream: ReadableStream<Uint8Array>): Promise<ImageInfoResponse>;
|
|
5524
|
+
/**
|
|
5525
|
+
* Begin applying a series of transformations to an image
|
|
5526
|
+
* @param stream The image bytes
|
|
5527
|
+
* @returns A transform handle
|
|
5528
|
+
*/
|
|
5529
|
+
input(stream: ReadableStream<Uint8Array>): ImageTransformer;
|
|
5530
|
+
}
|
|
5531
|
+
export interface ImageTransformer {
|
|
5532
|
+
/**
|
|
5533
|
+
* Apply transform next, returning a transform handle.
|
|
5534
|
+
* You can then apply more transformations or retrieve the output.
|
|
5535
|
+
* @param transform
|
|
5536
|
+
*/
|
|
5537
|
+
transform(transform: ImageTransform): ImageTransformer;
|
|
5538
|
+
/**
|
|
5539
|
+
* Retrieve the image that results from applying the transforms to the
|
|
5540
|
+
* provided input
|
|
5541
|
+
* @param options Options that apply to the output e.g. output format
|
|
5542
|
+
*/
|
|
5543
|
+
output(options: ImageOutputOptions): Promise<ImageTransformationResult>;
|
|
5544
|
+
}
|
|
5545
|
+
export interface ImageTransformationResult {
|
|
5546
|
+
/**
|
|
5547
|
+
* The image as a response, ready to store in cache or return to users
|
|
5548
|
+
*/
|
|
5549
|
+
response(): Response;
|
|
5550
|
+
/**
|
|
5551
|
+
* The content type of the returned image
|
|
5552
|
+
*/
|
|
5553
|
+
contentType(): string;
|
|
5554
|
+
/**
|
|
5555
|
+
* The bytes of the response
|
|
5556
|
+
*/
|
|
5557
|
+
image(): ReadableStream<Uint8Array>;
|
|
5558
|
+
}
|
|
5559
|
+
export interface ImagesError extends Error {
|
|
5560
|
+
readonly code: number;
|
|
5561
|
+
readonly message: string;
|
|
5562
|
+
readonly stack?: string;
|
|
5563
|
+
}
|
|
4777
5564
|
export type Params<P extends string = any> = Record<P, string | string[]>;
|
|
4778
5565
|
export type EventContext<Env, P extends string, Data> = {
|
|
4779
5566
|
request: Request<unknown, IncomingRequestCfProperties<unknown>>;
|
|
@@ -4817,6 +5604,30 @@ export type PagesPluginFunction<
|
|
|
4817
5604
|
> = (
|
|
4818
5605
|
context: EventPluginContext<Env, Params, Data, PluginArgs>,
|
|
4819
5606
|
) => Response | Promise<Response>;
|
|
5607
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5608
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5609
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5610
|
+
export declare abstract class PipelineTransform {
|
|
5611
|
+
/**
|
|
5612
|
+
* transformJson recieves an array of javascript objects which can be
|
|
5613
|
+
* mutated and returned to the pipeline
|
|
5614
|
+
* @param data The data to be mutated
|
|
5615
|
+
* @returns A promise containing the mutated data
|
|
5616
|
+
*/
|
|
5617
|
+
public transformJson(data: object[]): Promise<object[]>;
|
|
5618
|
+
}
|
|
5619
|
+
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5620
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5621
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5622
|
+
export interface Pipeline {
|
|
5623
|
+
/**
|
|
5624
|
+
* send takes an array of javascript objects which are
|
|
5625
|
+
* then received by the pipeline for processing
|
|
5626
|
+
*
|
|
5627
|
+
* @param data The data to be sent
|
|
5628
|
+
*/
|
|
5629
|
+
send(data: object[]): Promise<void>;
|
|
5630
|
+
}
|
|
4820
5631
|
// PubSubMessage represents an incoming PubSub message.
|
|
4821
5632
|
// The message includes metadata about the broker, the client, and the payload
|
|
4822
5633
|
// itself.
|
|
@@ -4877,6 +5688,7 @@ export declare namespace Rpc {
|
|
|
4877
5688
|
export const __RPC_TARGET_BRAND: "__RPC_TARGET_BRAND";
|
|
4878
5689
|
export const __WORKER_ENTRYPOINT_BRAND: "__WORKER_ENTRYPOINT_BRAND";
|
|
4879
5690
|
export const __DURABLE_OBJECT_BRAND: "__DURABLE_OBJECT_BRAND";
|
|
5691
|
+
export const __WORKFLOW_ENTRYPOINT_BRAND: "__WORKFLOW_ENTRYPOINT_BRAND";
|
|
4880
5692
|
export interface RpcTargetBranded {
|
|
4881
5693
|
[__RPC_TARGET_BRAND]: never;
|
|
4882
5694
|
}
|
|
@@ -4886,13 +5698,20 @@ export declare namespace Rpc {
|
|
|
4886
5698
|
export interface DurableObjectBranded {
|
|
4887
5699
|
[__DURABLE_OBJECT_BRAND]: never;
|
|
4888
5700
|
}
|
|
5701
|
+
export interface WorkflowEntrypointBranded {
|
|
5702
|
+
[__WORKFLOW_ENTRYPOINT_BRAND]: never;
|
|
5703
|
+
}
|
|
4889
5704
|
export type EntrypointBranded =
|
|
4890
5705
|
| WorkerEntrypointBranded
|
|
4891
|
-
| DurableObjectBranded
|
|
5706
|
+
| DurableObjectBranded
|
|
5707
|
+
| WorkflowEntrypointBranded;
|
|
4892
5708
|
// Types that can be used through `Stub`s
|
|
4893
5709
|
export type Stubable = RpcTargetBranded | ((...args: any[]) => any);
|
|
4894
5710
|
// Types that can be passed over RPC
|
|
4895
|
-
type
|
|
5711
|
+
// The reason for using a generic type here is to build a serializable subset of structured
|
|
5712
|
+
// cloneable composite types. This allows types defined with the "interface" keyword to pass the
|
|
5713
|
+
// serializable check as well. Otherwise, only types defined with the "type" keyword would pass.
|
|
5714
|
+
type Serializable<T> =
|
|
4896
5715
|
// Structured cloneables
|
|
4897
5716
|
| void
|
|
4898
5717
|
| undefined
|
|
@@ -4908,11 +5727,14 @@ export declare namespace Rpc {
|
|
|
4908
5727
|
| Error
|
|
4909
5728
|
| RegExp
|
|
4910
5729
|
// Structured cloneable composites
|
|
4911
|
-
| Map<
|
|
4912
|
-
|
|
4913
|
-
|
|
5730
|
+
| Map<
|
|
5731
|
+
T extends Map<infer U, unknown> ? Serializable<U> : never,
|
|
5732
|
+
T extends Map<unknown, infer U> ? Serializable<U> : never
|
|
5733
|
+
>
|
|
5734
|
+
| Set<T extends Set<infer U> ? Serializable<U> : never>
|
|
5735
|
+
| ReadonlyArray<T extends ReadonlyArray<infer U> ? Serializable<U> : never>
|
|
4914
5736
|
| {
|
|
4915
|
-
[
|
|
5737
|
+
[K in keyof T]: K extends number | string ? Serializable<T[K]> : never;
|
|
4916
5738
|
}
|
|
4917
5739
|
// Special types
|
|
4918
5740
|
| ReadableStream<Uint8Array>
|
|
@@ -4942,7 +5764,7 @@ export declare namespace Rpc {
|
|
|
4942
5764
|
: T extends ReadonlyArray<infer V>
|
|
4943
5765
|
? ReadonlyArray<Stubify<V>>
|
|
4944
5766
|
: T extends {
|
|
4945
|
-
[key: string | number]:
|
|
5767
|
+
[key: string | number]: any;
|
|
4946
5768
|
}
|
|
4947
5769
|
? {
|
|
4948
5770
|
[K in keyof T]: Stubify<T[K]>;
|
|
@@ -4985,7 +5807,7 @@ export declare namespace Rpc {
|
|
|
4985
5807
|
// Intersecting with `(Maybe)Provider` allows pipelining.
|
|
4986
5808
|
type Result<R> = R extends Stubable
|
|
4987
5809
|
? Promise<Stub<R>> & Provider<R>
|
|
4988
|
-
: R extends Serializable
|
|
5810
|
+
: R extends Serializable<R>
|
|
4989
5811
|
? Promise<Stubify<R> & MaybeDisposable<R>> & MaybeProvider<R>
|
|
4990
5812
|
: never;
|
|
4991
5813
|
// Type for method or property on an RPC interface.
|
|
@@ -5014,6 +5836,198 @@ export declare namespace Rpc {
|
|
|
5014
5836
|
>]: MethodOrProperty<T[K]>;
|
|
5015
5837
|
};
|
|
5016
5838
|
}
|
|
5839
|
+
export declare namespace TailStream {
|
|
5840
|
+
interface Header {
|
|
5841
|
+
readonly name: string;
|
|
5842
|
+
readonly value: string;
|
|
5843
|
+
}
|
|
5844
|
+
interface FetchEventInfo {
|
|
5845
|
+
readonly type: "fetch";
|
|
5846
|
+
readonly method: string;
|
|
5847
|
+
readonly url: string;
|
|
5848
|
+
readonly cfJson: string;
|
|
5849
|
+
readonly headers: Header[];
|
|
5850
|
+
}
|
|
5851
|
+
interface JsRpcEventInfo {
|
|
5852
|
+
readonly type: "jsrpc";
|
|
5853
|
+
readonly methodName: string;
|
|
5854
|
+
}
|
|
5855
|
+
interface ScheduledEventInfo {
|
|
5856
|
+
readonly type: "scheduled";
|
|
5857
|
+
readonly scheduledTime: Date;
|
|
5858
|
+
readonly cron: string;
|
|
5859
|
+
}
|
|
5860
|
+
interface AlarmEventInfo {
|
|
5861
|
+
readonly type: "alarm";
|
|
5862
|
+
readonly scheduledTime: Date;
|
|
5863
|
+
}
|
|
5864
|
+
interface QueueEventInfo {
|
|
5865
|
+
readonly type: "queue";
|
|
5866
|
+
readonly queueName: string;
|
|
5867
|
+
readonly batchSize: number;
|
|
5868
|
+
}
|
|
5869
|
+
interface EmailEventInfo {
|
|
5870
|
+
readonly type: "email";
|
|
5871
|
+
readonly mailFrom: string;
|
|
5872
|
+
readonly rcptTo: string;
|
|
5873
|
+
readonly rawSize: number;
|
|
5874
|
+
}
|
|
5875
|
+
interface TraceEventInfo {
|
|
5876
|
+
readonly type: "trace";
|
|
5877
|
+
readonly traces: (string | null)[];
|
|
5878
|
+
}
|
|
5879
|
+
interface HibernatableWebSocketEventInfoMessage {
|
|
5880
|
+
readonly type: "message";
|
|
5881
|
+
}
|
|
5882
|
+
interface HibernatableWebSocketEventInfoError {
|
|
5883
|
+
readonly type: "error";
|
|
5884
|
+
}
|
|
5885
|
+
interface HibernatableWebSocketEventInfoClose {
|
|
5886
|
+
readonly type: "close";
|
|
5887
|
+
readonly code: number;
|
|
5888
|
+
readonly wasClean: boolean;
|
|
5889
|
+
}
|
|
5890
|
+
interface HibernatableWebSocketEventInfo {
|
|
5891
|
+
readonly type: "hibernatableWebSocket";
|
|
5892
|
+
readonly info:
|
|
5893
|
+
| HibernatableWebSocketEventInfoClose
|
|
5894
|
+
| HibernatableWebSocketEventInfoError
|
|
5895
|
+
| HibernatableWebSocketEventInfoMessage;
|
|
5896
|
+
}
|
|
5897
|
+
interface Resume {
|
|
5898
|
+
readonly type: "resume";
|
|
5899
|
+
readonly attachment?: any;
|
|
5900
|
+
}
|
|
5901
|
+
interface CustomEventInfo {
|
|
5902
|
+
readonly type: "custom";
|
|
5903
|
+
}
|
|
5904
|
+
interface FetchResponseInfo {
|
|
5905
|
+
readonly type: "fetch";
|
|
5906
|
+
readonly statusCode: number;
|
|
5907
|
+
}
|
|
5908
|
+
type EventOutcome =
|
|
5909
|
+
| "ok"
|
|
5910
|
+
| "canceled"
|
|
5911
|
+
| "exception"
|
|
5912
|
+
| "unknown"
|
|
5913
|
+
| "killSwitch"
|
|
5914
|
+
| "daemonDown"
|
|
5915
|
+
| "exceededCpu"
|
|
5916
|
+
| "exceededMemory"
|
|
5917
|
+
| "loadShed"
|
|
5918
|
+
| "responseStreamDisconnected"
|
|
5919
|
+
| "scriptNotFound";
|
|
5920
|
+
interface ScriptVersion {
|
|
5921
|
+
readonly id: string;
|
|
5922
|
+
readonly tag?: string;
|
|
5923
|
+
readonly message?: string;
|
|
5924
|
+
}
|
|
5925
|
+
interface Trigger {
|
|
5926
|
+
readonly traceId: string;
|
|
5927
|
+
readonly invocationId: string;
|
|
5928
|
+
readonly spanId: string;
|
|
5929
|
+
}
|
|
5930
|
+
interface Onset {
|
|
5931
|
+
readonly type: "onset";
|
|
5932
|
+
readonly dispatchNamespace?: string;
|
|
5933
|
+
readonly entrypoint?: string;
|
|
5934
|
+
readonly scriptName?: string;
|
|
5935
|
+
readonly scriptTags?: string[];
|
|
5936
|
+
readonly scriptVersion?: ScriptVersion;
|
|
5937
|
+
readonly trigger?: Trigger;
|
|
5938
|
+
readonly info:
|
|
5939
|
+
| FetchEventInfo
|
|
5940
|
+
| JsRpcEventInfo
|
|
5941
|
+
| ScheduledEventInfo
|
|
5942
|
+
| AlarmEventInfo
|
|
5943
|
+
| QueueEventInfo
|
|
5944
|
+
| EmailEventInfo
|
|
5945
|
+
| TraceEventInfo
|
|
5946
|
+
| HibernatableWebSocketEventInfo
|
|
5947
|
+
| Resume
|
|
5948
|
+
| CustomEventInfo;
|
|
5949
|
+
}
|
|
5950
|
+
interface Outcome {
|
|
5951
|
+
readonly type: "outcome";
|
|
5952
|
+
readonly outcome: EventOutcome;
|
|
5953
|
+
readonly cpuTime: number;
|
|
5954
|
+
readonly wallTime: number;
|
|
5955
|
+
}
|
|
5956
|
+
interface Hibernate {
|
|
5957
|
+
readonly type: "hibernate";
|
|
5958
|
+
}
|
|
5959
|
+
interface SpanOpen {
|
|
5960
|
+
readonly type: "spanOpen";
|
|
5961
|
+
readonly op?: string;
|
|
5962
|
+
readonly info?: FetchEventInfo | JsRpcEventInfo | Attribute[];
|
|
5963
|
+
}
|
|
5964
|
+
interface SpanClose {
|
|
5965
|
+
readonly type: "spanClose";
|
|
5966
|
+
readonly outcome: EventOutcome;
|
|
5967
|
+
}
|
|
5968
|
+
interface DiagnosticChannelEvent {
|
|
5969
|
+
readonly type: "diagnosticChannel";
|
|
5970
|
+
readonly channel: string;
|
|
5971
|
+
readonly message: any;
|
|
5972
|
+
}
|
|
5973
|
+
interface Exception {
|
|
5974
|
+
readonly type: "exception";
|
|
5975
|
+
readonly name: string;
|
|
5976
|
+
readonly message: string;
|
|
5977
|
+
readonly stack?: string;
|
|
5978
|
+
}
|
|
5979
|
+
interface Log {
|
|
5980
|
+
readonly type: "log";
|
|
5981
|
+
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
5982
|
+
readonly message: string;
|
|
5983
|
+
}
|
|
5984
|
+
interface Return {
|
|
5985
|
+
readonly type: "return";
|
|
5986
|
+
readonly info?: FetchResponseInfo | Attribute[];
|
|
5987
|
+
}
|
|
5988
|
+
interface Link {
|
|
5989
|
+
readonly type: "link";
|
|
5990
|
+
readonly label?: string;
|
|
5991
|
+
readonly traceId: string;
|
|
5992
|
+
readonly invocationId: string;
|
|
5993
|
+
readonly spanId: string;
|
|
5994
|
+
}
|
|
5995
|
+
interface Attribute {
|
|
5996
|
+
readonly type: "attribute";
|
|
5997
|
+
readonly name: string;
|
|
5998
|
+
readonly value: string | string[] | boolean | boolean[] | number | number[];
|
|
5999
|
+
}
|
|
6000
|
+
type Mark =
|
|
6001
|
+
| DiagnosticChannelEvent
|
|
6002
|
+
| Exception
|
|
6003
|
+
| Log
|
|
6004
|
+
| Return
|
|
6005
|
+
| Link
|
|
6006
|
+
| Attribute[];
|
|
6007
|
+
interface TailEvent {
|
|
6008
|
+
readonly traceId: string;
|
|
6009
|
+
readonly invocationId: string;
|
|
6010
|
+
readonly spanId: string;
|
|
6011
|
+
readonly timestamp: Date;
|
|
6012
|
+
readonly sequence: number;
|
|
6013
|
+
readonly event: Onset | Outcome | Hibernate | SpanOpen | SpanClose | Mark;
|
|
6014
|
+
}
|
|
6015
|
+
type TailEventHandler = (event: TailEvent) => void | Promise<void>;
|
|
6016
|
+
type TailEventHandlerName =
|
|
6017
|
+
| "onset"
|
|
6018
|
+
| "outcome"
|
|
6019
|
+
| "hibernate"
|
|
6020
|
+
| "spanOpen"
|
|
6021
|
+
| "spanClose"
|
|
6022
|
+
| "diagnosticChannel"
|
|
6023
|
+
| "exception"
|
|
6024
|
+
| "log"
|
|
6025
|
+
| "return"
|
|
6026
|
+
| "link"
|
|
6027
|
+
| "attribute";
|
|
6028
|
+
type TailEventHandlerObject = Record<TailEventHandlerName, TailEventHandler>;
|
|
6029
|
+
type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;
|
|
6030
|
+
}
|
|
5017
6031
|
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5018
6032
|
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5019
6033
|
// https://opensource.org/licenses/Apache-2.0
|
|
@@ -5057,11 +6071,21 @@ export type VectorizeVectorMetadataFilter = {
|
|
|
5057
6071
|
* Distance metrics determine how other "similar" vectors are determined.
|
|
5058
6072
|
*/
|
|
5059
6073
|
export type VectorizeDistanceMetric = "euclidean" | "cosine" | "dot-product";
|
|
6074
|
+
/**
|
|
6075
|
+
* Metadata return levels for a Vectorize query.
|
|
6076
|
+
*
|
|
6077
|
+
* Default to "none".
|
|
6078
|
+
*
|
|
6079
|
+
* @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.
|
|
6080
|
+
* @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).
|
|
6081
|
+
* @property none No indexed metadata will be returned.
|
|
6082
|
+
*/
|
|
6083
|
+
export type VectorizeMetadataRetrievalLevel = "all" | "indexed" | "none";
|
|
5060
6084
|
export interface VectorizeQueryOptions {
|
|
5061
6085
|
topK?: number;
|
|
5062
6086
|
namespace?: string;
|
|
5063
6087
|
returnValues?: boolean;
|
|
5064
|
-
returnMetadata?: boolean;
|
|
6088
|
+
returnMetadata?: boolean | VectorizeMetadataRetrievalLevel;
|
|
5065
6089
|
filter?: VectorizeVectorMetadataFilter;
|
|
5066
6090
|
}
|
|
5067
6091
|
/**
|
|
@@ -5077,6 +6101,9 @@ export type VectorizeIndexConfig =
|
|
|
5077
6101
|
};
|
|
5078
6102
|
/**
|
|
5079
6103
|
* Metadata about an existing index.
|
|
6104
|
+
*
|
|
6105
|
+
* This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
|
|
6106
|
+
* See {@link VectorizeIndexInfo} for its post-beta equivalent.
|
|
5080
6107
|
*/
|
|
5081
6108
|
export interface VectorizeIndexDetails {
|
|
5082
6109
|
/** The unique ID of the index */
|
|
@@ -5090,6 +6117,19 @@ export interface VectorizeIndexDetails {
|
|
|
5090
6117
|
/** The number of records containing vectors within the index. */
|
|
5091
6118
|
vectorsCount: number;
|
|
5092
6119
|
}
|
|
6120
|
+
/**
|
|
6121
|
+
* Metadata about an existing index.
|
|
6122
|
+
*/
|
|
6123
|
+
export interface VectorizeIndexInfo {
|
|
6124
|
+
/** The number of records containing vectors within the index. */
|
|
6125
|
+
vectorCount: number;
|
|
6126
|
+
/** Number of dimensions the index has been configured for. */
|
|
6127
|
+
dimensions: number;
|
|
6128
|
+
/** ISO 8601 datetime of the last processed mutation on in the index. All changes before this mutation will be reflected in the index state. */
|
|
6129
|
+
processedUpToDatetime: number;
|
|
6130
|
+
/** UUIDv4 of the last mutation processed by the index. All changes before this mutation will be reflected in the index state. */
|
|
6131
|
+
processedUpToMutation: number;
|
|
6132
|
+
}
|
|
5093
6133
|
/**
|
|
5094
6134
|
* Represents a single vector value set along with its associated metadata.
|
|
5095
6135
|
*/
|
|
@@ -5100,7 +6140,7 @@ export interface VectorizeVector {
|
|
|
5100
6140
|
values: VectorFloatArray | number[];
|
|
5101
6141
|
/** The namespace this vector belongs to. */
|
|
5102
6142
|
namespace?: string;
|
|
5103
|
-
/** Metadata associated with the vector. Includes the values of
|
|
6143
|
+
/** Metadata associated with the vector. Includes the values of other fields and potentially additional details. */
|
|
5104
6144
|
metadata?: Record<string, VectorizeVectorMetadata>;
|
|
5105
6145
|
}
|
|
5106
6146
|
/**
|
|
@@ -5112,7 +6152,7 @@ export type VectorizeMatch = Pick<Partial<VectorizeVector>, "values"> &
|
|
|
5112
6152
|
score: number;
|
|
5113
6153
|
};
|
|
5114
6154
|
/**
|
|
5115
|
-
* A set of
|
|
6155
|
+
* A set of matching {@link VectorizeMatch} for a particular query.
|
|
5116
6156
|
*/
|
|
5117
6157
|
export interface VectorizeMatches {
|
|
5118
6158
|
matches: VectorizeMatch[];
|
|
@@ -5121,6 +6161,9 @@ export interface VectorizeMatches {
|
|
|
5121
6161
|
/**
|
|
5122
6162
|
* Results of an operation that performed a mutation on a set of vectors.
|
|
5123
6163
|
* Here, `ids` is a list of vectors that were successfully processed.
|
|
6164
|
+
*
|
|
6165
|
+
* This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
|
|
6166
|
+
* See {@link VectorizeAsyncMutation} for its post-beta equivalent.
|
|
5124
6167
|
*/
|
|
5125
6168
|
export interface VectorizeVectorMutation {
|
|
5126
6169
|
/* List of ids of vectors that were successfully processed. */
|
|
@@ -5129,14 +6172,19 @@ export interface VectorizeVectorMutation {
|
|
|
5129
6172
|
count: number;
|
|
5130
6173
|
}
|
|
5131
6174
|
/**
|
|
5132
|
-
*
|
|
5133
|
-
*
|
|
5134
|
-
* Here, `mutationId` is the identifier for the last mutation processed by Vectorize.
|
|
6175
|
+
* Result type indicating a mutation on the Vectorize Index.
|
|
6176
|
+
* Actual mutations are processed async where the `mutationId` is the unique identifier for the operation.
|
|
5135
6177
|
*/
|
|
5136
|
-
export interface
|
|
5137
|
-
|
|
6178
|
+
export interface VectorizeAsyncMutation {
|
|
6179
|
+
/** The unique identifier for the async mutation operation containing the changeset. */
|
|
5138
6180
|
mutationId: string;
|
|
5139
6181
|
}
|
|
6182
|
+
/**
|
|
6183
|
+
* A Vectorize Vector Search Index for querying vectors/embeddings.
|
|
6184
|
+
*
|
|
6185
|
+
* This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
|
|
6186
|
+
* See {@link Vectorize} for its new implementation.
|
|
6187
|
+
*/
|
|
5140
6188
|
export declare abstract class VectorizeIndex {
|
|
5141
6189
|
/**
|
|
5142
6190
|
* Get information about the currently bound index.
|
|
@@ -5151,7 +6199,7 @@ export declare abstract class VectorizeIndex {
|
|
|
5151
6199
|
*/
|
|
5152
6200
|
public query(
|
|
5153
6201
|
vector: VectorFloatArray | number[],
|
|
5154
|
-
options
|
|
6202
|
+
options?: VectorizeQueryOptions,
|
|
5155
6203
|
): Promise<VectorizeMatches>;
|
|
5156
6204
|
/**
|
|
5157
6205
|
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
@@ -5178,6 +6226,62 @@ export declare abstract class VectorizeIndex {
|
|
|
5178
6226
|
*/
|
|
5179
6227
|
public getByIds(ids: string[]): Promise<VectorizeVector[]>;
|
|
5180
6228
|
}
|
|
6229
|
+
/**
|
|
6230
|
+
* A Vectorize Vector Search Index for querying vectors/embeddings.
|
|
6231
|
+
*
|
|
6232
|
+
* Mutations in this version are async, returning a mutation id.
|
|
6233
|
+
*/
|
|
6234
|
+
export declare abstract class Vectorize {
|
|
6235
|
+
/**
|
|
6236
|
+
* Get information about the currently bound index.
|
|
6237
|
+
* @returns A promise that resolves with information about the current index.
|
|
6238
|
+
*/
|
|
6239
|
+
public describe(): Promise<VectorizeIndexInfo>;
|
|
6240
|
+
/**
|
|
6241
|
+
* Use the provided vector to perform a similarity search across the index.
|
|
6242
|
+
* @param vector Input vector that will be used to drive the similarity search.
|
|
6243
|
+
* @param options Configuration options to massage the returned data.
|
|
6244
|
+
* @returns A promise that resolves with matched and scored vectors.
|
|
6245
|
+
*/
|
|
6246
|
+
public query(
|
|
6247
|
+
vector: VectorFloatArray | number[],
|
|
6248
|
+
options?: VectorizeQueryOptions,
|
|
6249
|
+
): Promise<VectorizeMatches>;
|
|
6250
|
+
/**
|
|
6251
|
+
* Use the provided vector-id to perform a similarity search across the index.
|
|
6252
|
+
* @param vectorId Id for a vector in the index against which the index should be queried.
|
|
6253
|
+
* @param options Configuration options to massage the returned data.
|
|
6254
|
+
* @returns A promise that resolves with matched and scored vectors.
|
|
6255
|
+
*/
|
|
6256
|
+
public queryById(
|
|
6257
|
+
vectorId: string,
|
|
6258
|
+
options?: VectorizeQueryOptions,
|
|
6259
|
+
): Promise<VectorizeMatches>;
|
|
6260
|
+
/**
|
|
6261
|
+
* Insert a list of vectors into the index dataset. If a provided id exists, an error will be thrown.
|
|
6262
|
+
* @param vectors List of vectors that will be inserted.
|
|
6263
|
+
* @returns A promise that resolves with a unique identifier of a mutation containing the insert changeset.
|
|
6264
|
+
*/
|
|
6265
|
+
public insert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
|
|
6266
|
+
/**
|
|
6267
|
+
* Upsert a list of vectors into the index dataset. If a provided id exists, it will be replaced with the new values.
|
|
6268
|
+
* @param vectors List of vectors that will be upserted.
|
|
6269
|
+
* @returns A promise that resolves with a unique identifier of a mutation containing the upsert changeset.
|
|
6270
|
+
*/
|
|
6271
|
+
public upsert(vectors: VectorizeVector[]): Promise<VectorizeAsyncMutation>;
|
|
6272
|
+
/**
|
|
6273
|
+
* Delete a list of vectors with a matching id.
|
|
6274
|
+
* @param ids List of vector ids that should be deleted.
|
|
6275
|
+
* @returns A promise that resolves with a unique identifier of a mutation containing the delete changeset.
|
|
6276
|
+
*/
|
|
6277
|
+
public deleteByIds(ids: string[]): Promise<VectorizeAsyncMutation>;
|
|
6278
|
+
/**
|
|
6279
|
+
* Get a list of vectors with a matching id.
|
|
6280
|
+
* @param ids List of vector ids that should be returned.
|
|
6281
|
+
* @returns A promise that resolves with the raw unscored vectors matching the id set.
|
|
6282
|
+
*/
|
|
6283
|
+
public getByIds(ids: string[]): Promise<VectorizeVector[]>;
|
|
6284
|
+
}
|
|
5181
6285
|
/**
|
|
5182
6286
|
* The interface for "version_metadata" binding
|
|
5183
6287
|
* providing metadata about the Worker Version using this binding.
|
|
@@ -5228,3 +6332,70 @@ export interface DispatchNamespace {
|
|
|
5228
6332
|
options?: DynamicDispatchOptions,
|
|
5229
6333
|
): Fetcher;
|
|
5230
6334
|
}
|
|
6335
|
+
export declare abstract class Workflow<PARAMS = unknown> {
|
|
6336
|
+
/**
|
|
6337
|
+
* Get a handle to an existing instance of the Workflow.
|
|
6338
|
+
* @param id Id for the instance of this Workflow
|
|
6339
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
6340
|
+
*/
|
|
6341
|
+
public get(id: string): Promise<WorkflowInstance>;
|
|
6342
|
+
/**
|
|
6343
|
+
* Create a new instance and return a handle to it. If a provided id exists, an error will be thrown.
|
|
6344
|
+
* @param options Options when creating an instance including id and params
|
|
6345
|
+
* @returns A promise that resolves with a handle for the Instance
|
|
6346
|
+
*/
|
|
6347
|
+
public create(
|
|
6348
|
+
options?: WorkflowInstanceCreateOptions<PARAMS>,
|
|
6349
|
+
): Promise<WorkflowInstance>;
|
|
6350
|
+
}
|
|
6351
|
+
export interface WorkflowInstanceCreateOptions<PARAMS = unknown> {
|
|
6352
|
+
/**
|
|
6353
|
+
* An id for your Workflow instance. Must be unique within the Workflow.
|
|
6354
|
+
*/
|
|
6355
|
+
id?: string;
|
|
6356
|
+
/**
|
|
6357
|
+
* The event payload the Workflow instance is triggered with
|
|
6358
|
+
*/
|
|
6359
|
+
params?: PARAMS;
|
|
6360
|
+
}
|
|
6361
|
+
export type InstanceStatus = {
|
|
6362
|
+
status:
|
|
6363
|
+
| "queued" // means that instance is waiting to be started (see concurrency limits)
|
|
6364
|
+
| "running"
|
|
6365
|
+
| "paused"
|
|
6366
|
+
| "errored"
|
|
6367
|
+
| "terminated" // user terminated the instance while it was running
|
|
6368
|
+
| "complete"
|
|
6369
|
+
| "waiting" // instance is hibernating and waiting for sleep or event to finish
|
|
6370
|
+
| "waitingForPause" // instance is finishing the current work to pause
|
|
6371
|
+
| "unknown";
|
|
6372
|
+
error?: string;
|
|
6373
|
+
output?: object;
|
|
6374
|
+
};
|
|
6375
|
+
export interface WorkflowError {
|
|
6376
|
+
code?: number;
|
|
6377
|
+
message: string;
|
|
6378
|
+
}
|
|
6379
|
+
export declare abstract class WorkflowInstance {
|
|
6380
|
+
public id: string;
|
|
6381
|
+
/**
|
|
6382
|
+
* Pause the instance.
|
|
6383
|
+
*/
|
|
6384
|
+
public pause(): Promise<void>;
|
|
6385
|
+
/**
|
|
6386
|
+
* Resume the instance. If it is already running, an error will be thrown.
|
|
6387
|
+
*/
|
|
6388
|
+
public resume(): Promise<void>;
|
|
6389
|
+
/**
|
|
6390
|
+
* Terminate the instance. If it is errored, terminated or complete, an error will be thrown.
|
|
6391
|
+
*/
|
|
6392
|
+
public terminate(): Promise<void>;
|
|
6393
|
+
/**
|
|
6394
|
+
* Restart the instance.
|
|
6395
|
+
*/
|
|
6396
|
+
public restart(): Promise<void>;
|
|
6397
|
+
/**
|
|
6398
|
+
* Returns the current status of the instance.
|
|
6399
|
+
*/
|
|
6400
|
+
public status(): Promise<InstanceStatus>;
|
|
6401
|
+
}
|