@cloudflare/workers-types 4.20241205.0 → 4.20241216.0
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 +248 -3
- package/2021-11-03/index.ts +247 -2
- package/2022-01-31/index.d.ts +248 -3
- package/2022-01-31/index.ts +247 -2
- package/2022-03-21/index.d.ts +248 -3
- package/2022-03-21/index.ts +247 -2
- package/2022-08-04/index.d.ts +248 -3
- package/2022-08-04/index.ts +247 -2
- package/2022-10-31/index.d.ts +248 -3
- package/2022-10-31/index.ts +247 -2
- package/2022-11-30/index.d.ts +248 -3
- package/2022-11-30/index.ts +247 -2
- package/2023-03-01/index.d.ts +248 -3
- package/2023-03-01/index.ts +247 -2
- package/2023-07-01/index.d.ts +248 -3
- package/2023-07-01/index.ts +247 -2
- package/experimental/index.d.ts +249 -3
- package/experimental/index.ts +248 -2
- package/index.d.ts +248 -3
- package/index.ts +247 -2
- package/oldest/index.d.ts +248 -3
- package/oldest/index.ts +247 -2
- package/package.json +1 -1
package/2021-11-03/index.d.ts
CHANGED
|
@@ -392,6 +392,7 @@ interface TestController {}
|
|
|
392
392
|
interface ExecutionContext {
|
|
393
393
|
waitUntil(promise: Promise<any>): void;
|
|
394
394
|
passThroughOnException(): void;
|
|
395
|
+
props: any;
|
|
395
396
|
}
|
|
396
397
|
type ExportedHandlerFetchHandler<Env = unknown, CfHostMetadata = unknown> = (
|
|
397
398
|
request: Request<CfHostMetadata, IncomingRequestCfProperties<CfHostMetadata>>,
|
|
@@ -408,6 +409,11 @@ type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
|
408
409
|
env: Env,
|
|
409
410
|
ctx: ExecutionContext,
|
|
410
411
|
) => void | Promise<void>;
|
|
412
|
+
type ExportedHandlerTailStreamHandler<Env = unknown> = (
|
|
413
|
+
event: TailStream.TailEvent,
|
|
414
|
+
env: Env,
|
|
415
|
+
ctx: ExecutionContext,
|
|
416
|
+
) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
|
|
411
417
|
type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
412
418
|
controller: ScheduledController,
|
|
413
419
|
env: Env,
|
|
@@ -431,6 +437,7 @@ interface ExportedHandler<
|
|
|
431
437
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
432
438
|
tail?: ExportedHandlerTailHandler<Env>;
|
|
433
439
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
440
|
+
tailStream?: ExportedHandlerTailStreamHandler<Env>;
|
|
434
441
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
435
442
|
test?: ExportedHandlerTestHandler<Env>;
|
|
436
443
|
email?: EmailExportedHandler<Env>;
|
|
@@ -467,7 +474,7 @@ interface Cloudflare {
|
|
|
467
474
|
}
|
|
468
475
|
interface DurableObject {
|
|
469
476
|
fetch(request: Request): Response | Promise<Response>;
|
|
470
|
-
alarm?(): void | Promise<void>;
|
|
477
|
+
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
|
|
471
478
|
webSocketMessage?(
|
|
472
479
|
ws: WebSocket,
|
|
473
480
|
message: string | ArrayBuffer,
|
|
@@ -3664,7 +3671,7 @@ type GatewayOptions = {
|
|
|
3664
3671
|
};
|
|
3665
3672
|
type AiGatewayPatchLog = {
|
|
3666
3673
|
score?: number | null;
|
|
3667
|
-
feedback?: -1 | 1 |
|
|
3674
|
+
feedback?: -1 | 1 | null;
|
|
3668
3675
|
metadata?: Record<string, number | string | boolean | null | bigint> | null;
|
|
3669
3676
|
};
|
|
3670
3677
|
type AiGatewayLog = {
|
|
@@ -3694,11 +3701,57 @@ type AiGatewayLog = {
|
|
|
3694
3701
|
response_head_complete: boolean;
|
|
3695
3702
|
created_at: Date;
|
|
3696
3703
|
};
|
|
3704
|
+
type AIGatewayProviders =
|
|
3705
|
+
| "workers-ai"
|
|
3706
|
+
| "anthropic"
|
|
3707
|
+
| "aws-bedrock"
|
|
3708
|
+
| "azure-openai"
|
|
3709
|
+
| "google-vertex-ai"
|
|
3710
|
+
| "huggingface"
|
|
3711
|
+
| "openai"
|
|
3712
|
+
| "perplexity-ai"
|
|
3713
|
+
| "replicate"
|
|
3714
|
+
| "groq"
|
|
3715
|
+
| "cohere"
|
|
3716
|
+
| "google-ai-studio"
|
|
3717
|
+
| "mistral"
|
|
3718
|
+
| "grok"
|
|
3719
|
+
| "openrouter";
|
|
3720
|
+
type AIGatewayHeaders = {
|
|
3721
|
+
"cf-aig-metadata":
|
|
3722
|
+
| Record<string, number | string | boolean | null | bigint>
|
|
3723
|
+
| string;
|
|
3724
|
+
"cf-aig-custom-cost":
|
|
3725
|
+
| {
|
|
3726
|
+
per_token_in?: number;
|
|
3727
|
+
per_token_out?: number;
|
|
3728
|
+
}
|
|
3729
|
+
| {
|
|
3730
|
+
total_cost?: number;
|
|
3731
|
+
}
|
|
3732
|
+
| string;
|
|
3733
|
+
"cf-aig-cache-ttl": number | string;
|
|
3734
|
+
"cf-aig-skip-cache": boolean | string;
|
|
3735
|
+
"cf-aig-cache-key": string;
|
|
3736
|
+
"cf-aig-collect-log": boolean | string;
|
|
3737
|
+
Authorization: string;
|
|
3738
|
+
"Content-Type": string;
|
|
3739
|
+
[key: string]: string | number | boolean | object;
|
|
3740
|
+
};
|
|
3741
|
+
type AIGatewayUniversalRequest = {
|
|
3742
|
+
provider: AIGatewayProviders | string; // eslint-disable-line
|
|
3743
|
+
endpoint: string;
|
|
3744
|
+
headers: Partial<AIGatewayHeaders>;
|
|
3745
|
+
query: unknown;
|
|
3746
|
+
};
|
|
3697
3747
|
interface AiGatewayInternalError extends Error {}
|
|
3698
3748
|
interface AiGatewayLogNotFound extends Error {}
|
|
3699
3749
|
declare abstract class AiGateway {
|
|
3700
3750
|
patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
|
|
3701
3751
|
getLog(logId: string): Promise<AiGatewayLog>;
|
|
3752
|
+
run(
|
|
3753
|
+
data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
|
|
3754
|
+
): Promise<Response>;
|
|
3702
3755
|
}
|
|
3703
3756
|
interface BasicImageTransformations {
|
|
3704
3757
|
/**
|
|
@@ -5266,7 +5319,7 @@ declare module "cloudflare:workers" {
|
|
|
5266
5319
|
protected env: Env;
|
|
5267
5320
|
constructor(ctx: DurableObjectState, env: Env);
|
|
5268
5321
|
fetch?(request: Request): Response | Promise<Response>;
|
|
5269
|
-
alarm?(): void | Promise<void>;
|
|
5322
|
+
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
|
|
5270
5323
|
webSocketMessage?(
|
|
5271
5324
|
ws: WebSocket,
|
|
5272
5325
|
message: string | ArrayBuffer,
|
|
@@ -5339,6 +5392,198 @@ declare module "cloudflare:sockets" {
|
|
|
5339
5392
|
): Socket;
|
|
5340
5393
|
export { _connect as connect };
|
|
5341
5394
|
}
|
|
5395
|
+
declare namespace TailStream {
|
|
5396
|
+
interface Header {
|
|
5397
|
+
readonly name: string;
|
|
5398
|
+
readonly value: string;
|
|
5399
|
+
}
|
|
5400
|
+
interface FetchEventInfo {
|
|
5401
|
+
readonly type: "fetch";
|
|
5402
|
+
readonly method: string;
|
|
5403
|
+
readonly url: string;
|
|
5404
|
+
readonly cfJson: string;
|
|
5405
|
+
readonly headers: Header[];
|
|
5406
|
+
}
|
|
5407
|
+
interface JsRpcEventInfo {
|
|
5408
|
+
readonly type: "jsrpc";
|
|
5409
|
+
readonly methodName: string;
|
|
5410
|
+
}
|
|
5411
|
+
interface ScheduledEventInfo {
|
|
5412
|
+
readonly type: "scheduled";
|
|
5413
|
+
readonly scheduledTime: Date;
|
|
5414
|
+
readonly cron: string;
|
|
5415
|
+
}
|
|
5416
|
+
interface AlarmEventInfo {
|
|
5417
|
+
readonly type: "alarm";
|
|
5418
|
+
readonly scheduledTime: Date;
|
|
5419
|
+
}
|
|
5420
|
+
interface QueueEventInfo {
|
|
5421
|
+
readonly type: "queue";
|
|
5422
|
+
readonly queueName: string;
|
|
5423
|
+
readonly batchSize: number;
|
|
5424
|
+
}
|
|
5425
|
+
interface EmailEventInfo {
|
|
5426
|
+
readonly type: "email";
|
|
5427
|
+
readonly mailFrom: string;
|
|
5428
|
+
readonly rcptTo: string;
|
|
5429
|
+
readonly rawSize: number;
|
|
5430
|
+
}
|
|
5431
|
+
interface TraceEventInfo {
|
|
5432
|
+
readonly type: "trace";
|
|
5433
|
+
readonly traces: (string | null)[];
|
|
5434
|
+
}
|
|
5435
|
+
interface HibernatableWebSocketEventInfoMessage {
|
|
5436
|
+
readonly type: "message";
|
|
5437
|
+
}
|
|
5438
|
+
interface HibernatableWebSocketEventInfoError {
|
|
5439
|
+
readonly type: "error";
|
|
5440
|
+
}
|
|
5441
|
+
interface HibernatableWebSocketEventInfoClose {
|
|
5442
|
+
readonly type: "close";
|
|
5443
|
+
readonly code: number;
|
|
5444
|
+
readonly wasClean: boolean;
|
|
5445
|
+
}
|
|
5446
|
+
interface HibernatableWebSocketEventInfo {
|
|
5447
|
+
readonly type: "hibernatableWebSocket";
|
|
5448
|
+
readonly info:
|
|
5449
|
+
| HibernatableWebSocketEventInfoClose
|
|
5450
|
+
| HibernatableWebSocketEventInfoError
|
|
5451
|
+
| HibernatableWebSocketEventInfoMessage;
|
|
5452
|
+
}
|
|
5453
|
+
interface Resume {
|
|
5454
|
+
readonly type: "resume";
|
|
5455
|
+
readonly attachment?: any;
|
|
5456
|
+
}
|
|
5457
|
+
interface CustomEventInfo {
|
|
5458
|
+
readonly type: "custom";
|
|
5459
|
+
}
|
|
5460
|
+
interface FetchResponseInfo {
|
|
5461
|
+
readonly type: "fetch";
|
|
5462
|
+
readonly statusCode: number;
|
|
5463
|
+
}
|
|
5464
|
+
type EventOutcome =
|
|
5465
|
+
| "ok"
|
|
5466
|
+
| "canceled"
|
|
5467
|
+
| "exception"
|
|
5468
|
+
| "unknown"
|
|
5469
|
+
| "killSwitch"
|
|
5470
|
+
| "daemonDown"
|
|
5471
|
+
| "exceededCpu"
|
|
5472
|
+
| "exceededMemory"
|
|
5473
|
+
| "loadShed"
|
|
5474
|
+
| "responseStreamDisconnected"
|
|
5475
|
+
| "scriptNotFound";
|
|
5476
|
+
interface ScriptVersion {
|
|
5477
|
+
readonly id: string;
|
|
5478
|
+
readonly tag?: string;
|
|
5479
|
+
readonly message?: string;
|
|
5480
|
+
}
|
|
5481
|
+
interface Trigger {
|
|
5482
|
+
readonly traceId: string;
|
|
5483
|
+
readonly invocationId: string;
|
|
5484
|
+
readonly spanId: string;
|
|
5485
|
+
}
|
|
5486
|
+
interface Onset {
|
|
5487
|
+
readonly type: "onset";
|
|
5488
|
+
readonly dispatchNamespace?: string;
|
|
5489
|
+
readonly entrypoint?: string;
|
|
5490
|
+
readonly scriptName?: string;
|
|
5491
|
+
readonly scriptTags?: string[];
|
|
5492
|
+
readonly scriptVersion?: ScriptVersion;
|
|
5493
|
+
readonly trigger?: Trigger;
|
|
5494
|
+
readonly info:
|
|
5495
|
+
| FetchEventInfo
|
|
5496
|
+
| JsRpcEventInfo
|
|
5497
|
+
| ScheduledEventInfo
|
|
5498
|
+
| AlarmEventInfo
|
|
5499
|
+
| QueueEventInfo
|
|
5500
|
+
| EmailEventInfo
|
|
5501
|
+
| TraceEventInfo
|
|
5502
|
+
| HibernatableWebSocketEventInfo
|
|
5503
|
+
| Resume
|
|
5504
|
+
| CustomEventInfo;
|
|
5505
|
+
}
|
|
5506
|
+
interface Outcome {
|
|
5507
|
+
readonly type: "outcome";
|
|
5508
|
+
readonly outcome: EventOutcome;
|
|
5509
|
+
readonly cpuTime: number;
|
|
5510
|
+
readonly wallTime: number;
|
|
5511
|
+
}
|
|
5512
|
+
interface Hibernate {
|
|
5513
|
+
readonly type: "hibernate";
|
|
5514
|
+
}
|
|
5515
|
+
interface SpanOpen {
|
|
5516
|
+
readonly type: "spanOpen";
|
|
5517
|
+
readonly op?: string;
|
|
5518
|
+
readonly info?: FetchEventInfo | JsRpcEventInfo | Attribute[];
|
|
5519
|
+
}
|
|
5520
|
+
interface SpanClose {
|
|
5521
|
+
readonly type: "spanClose";
|
|
5522
|
+
readonly outcome: EventOutcome;
|
|
5523
|
+
}
|
|
5524
|
+
interface DiagnosticChannelEvent {
|
|
5525
|
+
readonly type: "diagnosticChannel";
|
|
5526
|
+
readonly channel: string;
|
|
5527
|
+
readonly message: any;
|
|
5528
|
+
}
|
|
5529
|
+
interface Exception {
|
|
5530
|
+
readonly type: "exception";
|
|
5531
|
+
readonly name: string;
|
|
5532
|
+
readonly message: string;
|
|
5533
|
+
readonly stack?: string;
|
|
5534
|
+
}
|
|
5535
|
+
interface Log {
|
|
5536
|
+
readonly type: "log";
|
|
5537
|
+
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
5538
|
+
readonly message: string;
|
|
5539
|
+
}
|
|
5540
|
+
interface Return {
|
|
5541
|
+
readonly type: "return";
|
|
5542
|
+
readonly info?: FetchResponseInfo | Attribute[];
|
|
5543
|
+
}
|
|
5544
|
+
interface Link {
|
|
5545
|
+
readonly type: "link";
|
|
5546
|
+
readonly label?: string;
|
|
5547
|
+
readonly traceId: string;
|
|
5548
|
+
readonly invocationId: string;
|
|
5549
|
+
readonly spanId: string;
|
|
5550
|
+
}
|
|
5551
|
+
interface Attribute {
|
|
5552
|
+
readonly type: "attribute";
|
|
5553
|
+
readonly name: string;
|
|
5554
|
+
readonly value: string | string[] | boolean | boolean[] | number | number[];
|
|
5555
|
+
}
|
|
5556
|
+
type Mark =
|
|
5557
|
+
| DiagnosticChannelEvent
|
|
5558
|
+
| Exception
|
|
5559
|
+
| Log
|
|
5560
|
+
| Return
|
|
5561
|
+
| Link
|
|
5562
|
+
| Attribute[];
|
|
5563
|
+
interface TailEvent {
|
|
5564
|
+
readonly traceId: string;
|
|
5565
|
+
readonly invocationId: string;
|
|
5566
|
+
readonly spanId: string;
|
|
5567
|
+
readonly timestamp: Date;
|
|
5568
|
+
readonly sequence: number;
|
|
5569
|
+
readonly event: Onset | Outcome | Hibernate | SpanOpen | SpanClose | Mark;
|
|
5570
|
+
}
|
|
5571
|
+
type TailEventHandler = (event: TailEvent) => void | Promise<void>;
|
|
5572
|
+
type TailEventHandlerName =
|
|
5573
|
+
| "onset"
|
|
5574
|
+
| "outcome"
|
|
5575
|
+
| "hibernate"
|
|
5576
|
+
| "spanOpen"
|
|
5577
|
+
| "spanClose"
|
|
5578
|
+
| "diagnosticChannel"
|
|
5579
|
+
| "exception"
|
|
5580
|
+
| "log"
|
|
5581
|
+
| "return"
|
|
5582
|
+
| "link"
|
|
5583
|
+
| "attribute";
|
|
5584
|
+
type TailEventHandlerObject = Record<TailEventHandlerName, TailEventHandler>;
|
|
5585
|
+
type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;
|
|
5586
|
+
}
|
|
5342
5587
|
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5343
5588
|
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5344
5589
|
// https://opensource.org/licenses/Apache-2.0
|
package/2021-11-03/index.ts
CHANGED
|
@@ -394,6 +394,7 @@ export interface TestController {}
|
|
|
394
394
|
export interface ExecutionContext {
|
|
395
395
|
waitUntil(promise: Promise<any>): void;
|
|
396
396
|
passThroughOnException(): void;
|
|
397
|
+
props: any;
|
|
397
398
|
}
|
|
398
399
|
export type ExportedHandlerFetchHandler<
|
|
399
400
|
Env = unknown,
|
|
@@ -413,6 +414,11 @@ export type ExportedHandlerTraceHandler<Env = unknown> = (
|
|
|
413
414
|
env: Env,
|
|
414
415
|
ctx: ExecutionContext,
|
|
415
416
|
) => void | Promise<void>;
|
|
417
|
+
export type ExportedHandlerTailStreamHandler<Env = unknown> = (
|
|
418
|
+
event: TailStream.TailEvent,
|
|
419
|
+
env: Env,
|
|
420
|
+
ctx: ExecutionContext,
|
|
421
|
+
) => TailStream.TailEventHandlerType | Promise<TailStream.TailEventHandlerType>;
|
|
416
422
|
export type ExportedHandlerScheduledHandler<Env = unknown> = (
|
|
417
423
|
controller: ScheduledController,
|
|
418
424
|
env: Env,
|
|
@@ -436,6 +442,7 @@ export interface ExportedHandler<
|
|
|
436
442
|
fetch?: ExportedHandlerFetchHandler<Env, CfHostMetadata>;
|
|
437
443
|
tail?: ExportedHandlerTailHandler<Env>;
|
|
438
444
|
trace?: ExportedHandlerTraceHandler<Env>;
|
|
445
|
+
tailStream?: ExportedHandlerTailStreamHandler<Env>;
|
|
439
446
|
scheduled?: ExportedHandlerScheduledHandler<Env>;
|
|
440
447
|
test?: ExportedHandlerTestHandler<Env>;
|
|
441
448
|
email?: EmailExportedHandler<Env>;
|
|
@@ -472,7 +479,7 @@ export interface Cloudflare {
|
|
|
472
479
|
}
|
|
473
480
|
export interface DurableObject {
|
|
474
481
|
fetch(request: Request): Response | Promise<Response>;
|
|
475
|
-
alarm?(): void | Promise<void>;
|
|
482
|
+
alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
|
|
476
483
|
webSocketMessage?(
|
|
477
484
|
ws: WebSocket,
|
|
478
485
|
message: string | ArrayBuffer,
|
|
@@ -3677,7 +3684,7 @@ export type GatewayOptions = {
|
|
|
3677
3684
|
};
|
|
3678
3685
|
export type AiGatewayPatchLog = {
|
|
3679
3686
|
score?: number | null;
|
|
3680
|
-
feedback?: -1 | 1 |
|
|
3687
|
+
feedback?: -1 | 1 | null;
|
|
3681
3688
|
metadata?: Record<string, number | string | boolean | null | bigint> | null;
|
|
3682
3689
|
};
|
|
3683
3690
|
export type AiGatewayLog = {
|
|
@@ -3707,11 +3714,57 @@ export type AiGatewayLog = {
|
|
|
3707
3714
|
response_head_complete: boolean;
|
|
3708
3715
|
created_at: Date;
|
|
3709
3716
|
};
|
|
3717
|
+
export type AIGatewayProviders =
|
|
3718
|
+
| "workers-ai"
|
|
3719
|
+
| "anthropic"
|
|
3720
|
+
| "aws-bedrock"
|
|
3721
|
+
| "azure-openai"
|
|
3722
|
+
| "google-vertex-ai"
|
|
3723
|
+
| "huggingface"
|
|
3724
|
+
| "openai"
|
|
3725
|
+
| "perplexity-ai"
|
|
3726
|
+
| "replicate"
|
|
3727
|
+
| "groq"
|
|
3728
|
+
| "cohere"
|
|
3729
|
+
| "google-ai-studio"
|
|
3730
|
+
| "mistral"
|
|
3731
|
+
| "grok"
|
|
3732
|
+
| "openrouter";
|
|
3733
|
+
export type AIGatewayHeaders = {
|
|
3734
|
+
"cf-aig-metadata":
|
|
3735
|
+
| Record<string, number | string | boolean | null | bigint>
|
|
3736
|
+
| string;
|
|
3737
|
+
"cf-aig-custom-cost":
|
|
3738
|
+
| {
|
|
3739
|
+
per_token_in?: number;
|
|
3740
|
+
per_token_out?: number;
|
|
3741
|
+
}
|
|
3742
|
+
| {
|
|
3743
|
+
total_cost?: number;
|
|
3744
|
+
}
|
|
3745
|
+
| string;
|
|
3746
|
+
"cf-aig-cache-ttl": number | string;
|
|
3747
|
+
"cf-aig-skip-cache": boolean | string;
|
|
3748
|
+
"cf-aig-cache-key": string;
|
|
3749
|
+
"cf-aig-collect-log": boolean | string;
|
|
3750
|
+
Authorization: string;
|
|
3751
|
+
"Content-Type": string;
|
|
3752
|
+
[key: string]: string | number | boolean | object;
|
|
3753
|
+
};
|
|
3754
|
+
export type AIGatewayUniversalRequest = {
|
|
3755
|
+
provider: AIGatewayProviders | string; // eslint-disable-line
|
|
3756
|
+
endpoint: string;
|
|
3757
|
+
headers: Partial<AIGatewayHeaders>;
|
|
3758
|
+
query: unknown;
|
|
3759
|
+
};
|
|
3710
3760
|
export interface AiGatewayInternalError extends Error {}
|
|
3711
3761
|
export interface AiGatewayLogNotFound extends Error {}
|
|
3712
3762
|
export declare abstract class AiGateway {
|
|
3713
3763
|
patchLog(logId: string, data: AiGatewayPatchLog): Promise<void>;
|
|
3714
3764
|
getLog(logId: string): Promise<AiGatewayLog>;
|
|
3765
|
+
run(
|
|
3766
|
+
data: AIGatewayUniversalRequest | AIGatewayUniversalRequest[],
|
|
3767
|
+
): Promise<Response>;
|
|
3715
3768
|
}
|
|
3716
3769
|
export interface BasicImageTransformations {
|
|
3717
3770
|
/**
|
|
@@ -5250,6 +5303,198 @@ export declare namespace Rpc {
|
|
|
5250
5303
|
>]: MethodOrProperty<T[K]>;
|
|
5251
5304
|
};
|
|
5252
5305
|
}
|
|
5306
|
+
export declare namespace TailStream {
|
|
5307
|
+
interface Header {
|
|
5308
|
+
readonly name: string;
|
|
5309
|
+
readonly value: string;
|
|
5310
|
+
}
|
|
5311
|
+
interface FetchEventInfo {
|
|
5312
|
+
readonly type: "fetch";
|
|
5313
|
+
readonly method: string;
|
|
5314
|
+
readonly url: string;
|
|
5315
|
+
readonly cfJson: string;
|
|
5316
|
+
readonly headers: Header[];
|
|
5317
|
+
}
|
|
5318
|
+
interface JsRpcEventInfo {
|
|
5319
|
+
readonly type: "jsrpc";
|
|
5320
|
+
readonly methodName: string;
|
|
5321
|
+
}
|
|
5322
|
+
interface ScheduledEventInfo {
|
|
5323
|
+
readonly type: "scheduled";
|
|
5324
|
+
readonly scheduledTime: Date;
|
|
5325
|
+
readonly cron: string;
|
|
5326
|
+
}
|
|
5327
|
+
interface AlarmEventInfo {
|
|
5328
|
+
readonly type: "alarm";
|
|
5329
|
+
readonly scheduledTime: Date;
|
|
5330
|
+
}
|
|
5331
|
+
interface QueueEventInfo {
|
|
5332
|
+
readonly type: "queue";
|
|
5333
|
+
readonly queueName: string;
|
|
5334
|
+
readonly batchSize: number;
|
|
5335
|
+
}
|
|
5336
|
+
interface EmailEventInfo {
|
|
5337
|
+
readonly type: "email";
|
|
5338
|
+
readonly mailFrom: string;
|
|
5339
|
+
readonly rcptTo: string;
|
|
5340
|
+
readonly rawSize: number;
|
|
5341
|
+
}
|
|
5342
|
+
interface TraceEventInfo {
|
|
5343
|
+
readonly type: "trace";
|
|
5344
|
+
readonly traces: (string | null)[];
|
|
5345
|
+
}
|
|
5346
|
+
interface HibernatableWebSocketEventInfoMessage {
|
|
5347
|
+
readonly type: "message";
|
|
5348
|
+
}
|
|
5349
|
+
interface HibernatableWebSocketEventInfoError {
|
|
5350
|
+
readonly type: "error";
|
|
5351
|
+
}
|
|
5352
|
+
interface HibernatableWebSocketEventInfoClose {
|
|
5353
|
+
readonly type: "close";
|
|
5354
|
+
readonly code: number;
|
|
5355
|
+
readonly wasClean: boolean;
|
|
5356
|
+
}
|
|
5357
|
+
interface HibernatableWebSocketEventInfo {
|
|
5358
|
+
readonly type: "hibernatableWebSocket";
|
|
5359
|
+
readonly info:
|
|
5360
|
+
| HibernatableWebSocketEventInfoClose
|
|
5361
|
+
| HibernatableWebSocketEventInfoError
|
|
5362
|
+
| HibernatableWebSocketEventInfoMessage;
|
|
5363
|
+
}
|
|
5364
|
+
interface Resume {
|
|
5365
|
+
readonly type: "resume";
|
|
5366
|
+
readonly attachment?: any;
|
|
5367
|
+
}
|
|
5368
|
+
interface CustomEventInfo {
|
|
5369
|
+
readonly type: "custom";
|
|
5370
|
+
}
|
|
5371
|
+
interface FetchResponseInfo {
|
|
5372
|
+
readonly type: "fetch";
|
|
5373
|
+
readonly statusCode: number;
|
|
5374
|
+
}
|
|
5375
|
+
type EventOutcome =
|
|
5376
|
+
| "ok"
|
|
5377
|
+
| "canceled"
|
|
5378
|
+
| "exception"
|
|
5379
|
+
| "unknown"
|
|
5380
|
+
| "killSwitch"
|
|
5381
|
+
| "daemonDown"
|
|
5382
|
+
| "exceededCpu"
|
|
5383
|
+
| "exceededMemory"
|
|
5384
|
+
| "loadShed"
|
|
5385
|
+
| "responseStreamDisconnected"
|
|
5386
|
+
| "scriptNotFound";
|
|
5387
|
+
interface ScriptVersion {
|
|
5388
|
+
readonly id: string;
|
|
5389
|
+
readonly tag?: string;
|
|
5390
|
+
readonly message?: string;
|
|
5391
|
+
}
|
|
5392
|
+
interface Trigger {
|
|
5393
|
+
readonly traceId: string;
|
|
5394
|
+
readonly invocationId: string;
|
|
5395
|
+
readonly spanId: string;
|
|
5396
|
+
}
|
|
5397
|
+
interface Onset {
|
|
5398
|
+
readonly type: "onset";
|
|
5399
|
+
readonly dispatchNamespace?: string;
|
|
5400
|
+
readonly entrypoint?: string;
|
|
5401
|
+
readonly scriptName?: string;
|
|
5402
|
+
readonly scriptTags?: string[];
|
|
5403
|
+
readonly scriptVersion?: ScriptVersion;
|
|
5404
|
+
readonly trigger?: Trigger;
|
|
5405
|
+
readonly info:
|
|
5406
|
+
| FetchEventInfo
|
|
5407
|
+
| JsRpcEventInfo
|
|
5408
|
+
| ScheduledEventInfo
|
|
5409
|
+
| AlarmEventInfo
|
|
5410
|
+
| QueueEventInfo
|
|
5411
|
+
| EmailEventInfo
|
|
5412
|
+
| TraceEventInfo
|
|
5413
|
+
| HibernatableWebSocketEventInfo
|
|
5414
|
+
| Resume
|
|
5415
|
+
| CustomEventInfo;
|
|
5416
|
+
}
|
|
5417
|
+
interface Outcome {
|
|
5418
|
+
readonly type: "outcome";
|
|
5419
|
+
readonly outcome: EventOutcome;
|
|
5420
|
+
readonly cpuTime: number;
|
|
5421
|
+
readonly wallTime: number;
|
|
5422
|
+
}
|
|
5423
|
+
interface Hibernate {
|
|
5424
|
+
readonly type: "hibernate";
|
|
5425
|
+
}
|
|
5426
|
+
interface SpanOpen {
|
|
5427
|
+
readonly type: "spanOpen";
|
|
5428
|
+
readonly op?: string;
|
|
5429
|
+
readonly info?: FetchEventInfo | JsRpcEventInfo | Attribute[];
|
|
5430
|
+
}
|
|
5431
|
+
interface SpanClose {
|
|
5432
|
+
readonly type: "spanClose";
|
|
5433
|
+
readonly outcome: EventOutcome;
|
|
5434
|
+
}
|
|
5435
|
+
interface DiagnosticChannelEvent {
|
|
5436
|
+
readonly type: "diagnosticChannel";
|
|
5437
|
+
readonly channel: string;
|
|
5438
|
+
readonly message: any;
|
|
5439
|
+
}
|
|
5440
|
+
interface Exception {
|
|
5441
|
+
readonly type: "exception";
|
|
5442
|
+
readonly name: string;
|
|
5443
|
+
readonly message: string;
|
|
5444
|
+
readonly stack?: string;
|
|
5445
|
+
}
|
|
5446
|
+
interface Log {
|
|
5447
|
+
readonly type: "log";
|
|
5448
|
+
readonly level: "debug" | "error" | "info" | "log" | "warn";
|
|
5449
|
+
readonly message: string;
|
|
5450
|
+
}
|
|
5451
|
+
interface Return {
|
|
5452
|
+
readonly type: "return";
|
|
5453
|
+
readonly info?: FetchResponseInfo | Attribute[];
|
|
5454
|
+
}
|
|
5455
|
+
interface Link {
|
|
5456
|
+
readonly type: "link";
|
|
5457
|
+
readonly label?: string;
|
|
5458
|
+
readonly traceId: string;
|
|
5459
|
+
readonly invocationId: string;
|
|
5460
|
+
readonly spanId: string;
|
|
5461
|
+
}
|
|
5462
|
+
interface Attribute {
|
|
5463
|
+
readonly type: "attribute";
|
|
5464
|
+
readonly name: string;
|
|
5465
|
+
readonly value: string | string[] | boolean | boolean[] | number | number[];
|
|
5466
|
+
}
|
|
5467
|
+
type Mark =
|
|
5468
|
+
| DiagnosticChannelEvent
|
|
5469
|
+
| Exception
|
|
5470
|
+
| Log
|
|
5471
|
+
| Return
|
|
5472
|
+
| Link
|
|
5473
|
+
| Attribute[];
|
|
5474
|
+
interface TailEvent {
|
|
5475
|
+
readonly traceId: string;
|
|
5476
|
+
readonly invocationId: string;
|
|
5477
|
+
readonly spanId: string;
|
|
5478
|
+
readonly timestamp: Date;
|
|
5479
|
+
readonly sequence: number;
|
|
5480
|
+
readonly event: Onset | Outcome | Hibernate | SpanOpen | SpanClose | Mark;
|
|
5481
|
+
}
|
|
5482
|
+
type TailEventHandler = (event: TailEvent) => void | Promise<void>;
|
|
5483
|
+
type TailEventHandlerName =
|
|
5484
|
+
| "onset"
|
|
5485
|
+
| "outcome"
|
|
5486
|
+
| "hibernate"
|
|
5487
|
+
| "spanOpen"
|
|
5488
|
+
| "spanClose"
|
|
5489
|
+
| "diagnosticChannel"
|
|
5490
|
+
| "exception"
|
|
5491
|
+
| "log"
|
|
5492
|
+
| "return"
|
|
5493
|
+
| "link"
|
|
5494
|
+
| "attribute";
|
|
5495
|
+
type TailEventHandlerObject = Record<TailEventHandlerName, TailEventHandler>;
|
|
5496
|
+
type TailEventHandlerType = TailEventHandler | TailEventHandlerObject;
|
|
5497
|
+
}
|
|
5253
5498
|
// Copyright (c) 2022-2023 Cloudflare, Inc.
|
|
5254
5499
|
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
5255
5500
|
// https://opensource.org/licenses/Apache-2.0
|