@workers-community/workers-types 4.20250905.0 → 4.20250906.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.
Files changed (3) hide show
  1. package/index.d.ts +29 -7
  2. package/index.ts +29 -7
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -7541,6 +7541,7 @@ type ImageOutputOptions = {
7541
7541
  | "rgba";
7542
7542
  quality?: number;
7543
7543
  background?: string;
7544
+ anim?: boolean;
7544
7545
  };
7545
7546
  interface ImagesBinding {
7546
7547
  /**
@@ -8237,21 +8238,17 @@ declare namespace TailStream {
8237
8238
  readonly tag?: string;
8238
8239
  readonly message?: string;
8239
8240
  }
8240
- interface Trigger {
8241
- readonly traceId: string;
8242
- readonly invocationId: string;
8243
- readonly spanId: string;
8244
- }
8245
8241
  interface Onset {
8246
8242
  readonly type: "onset";
8247
8243
  readonly attributes: Attribute[];
8244
+ // id for the span being opened by this Onset event.
8245
+ readonly spanId: string;
8248
8246
  readonly dispatchNamespace?: string;
8249
8247
  readonly entrypoint?: string;
8250
8248
  readonly executionModel: string;
8251
8249
  readonly scriptName?: string;
8252
8250
  readonly scriptTags?: string[];
8253
8251
  readonly scriptVersion?: ScriptVersion;
8254
- readonly trigger?: Trigger;
8255
8252
  readonly info:
8256
8253
  | FetchEventInfo
8257
8254
  | JsRpcEventInfo
@@ -8272,6 +8269,8 @@ declare namespace TailStream {
8272
8269
  interface SpanOpen {
8273
8270
  readonly type: "spanOpen";
8274
8271
  readonly name: string;
8272
+ // id for the span being opened by this SpanOpen event.
8273
+ readonly spanId: string;
8275
8274
  readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
8276
8275
  }
8277
8276
  interface SpanClose {
@@ -8294,6 +8293,10 @@ declare namespace TailStream {
8294
8293
  readonly level: "debug" | "error" | "info" | "log" | "warn";
8295
8294
  readonly message: object;
8296
8295
  }
8296
+ // This marks the worker handler return information.
8297
+ // This is separate from Outcome because the worker invocation can live for a long time after
8298
+ // returning. For example - Websockets that return an http upgrade response but then continue
8299
+ // streaming information or SSE http connections.
8297
8300
  interface Return {
8298
8301
  readonly type: "return";
8299
8302
  readonly info?: FetchResponseInfo;
@@ -8324,9 +8327,28 @@ declare namespace TailStream {
8324
8327
  | Log
8325
8328
  | Return
8326
8329
  | Attributes;
8330
+ // Context in which this trace event lives.
8331
+ interface SpanContext {
8332
+ // Single id for the entire top-level invocation
8333
+ // This should be a new traceId for the first worker stage invoked in the eyeball request and then
8334
+ // same-account service-bindings should reuse the same traceId but cross-account service-bindings
8335
+ // should use a new traceId.
8336
+ readonly traceId: string;
8337
+ // spanId in which this event is handled
8338
+ // for Onset and SpanOpen events this would be the parent span id
8339
+ // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
8340
+ // For Hibernate and Mark this would be the span under which they were emitted.
8341
+ // spanId is not set ONLY if:
8342
+ // 1. This is an Onset event
8343
+ // 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
8344
+ readonly spanId?: string;
8345
+ }
8327
8346
  interface TailEvent<Event extends EventType> {
8347
+ // invocation id of the currently invoked worker stage.
8348
+ // invocation id will always be unique to every Onset event and will be the same until the Outcome event.
8328
8349
  readonly invocationId: string;
8329
- readonly spanId: string;
8350
+ // Inherited spanContext for this event.
8351
+ readonly spanContext: SpanContext;
8330
8352
  readonly timestamp: Date;
8331
8353
  readonly sequence: number;
8332
8354
  readonly event: Event;
package/index.ts CHANGED
@@ -7561,6 +7561,7 @@ export type ImageOutputOptions = {
7561
7561
  | "rgba";
7562
7562
  quality?: number;
7563
7563
  background?: string;
7564
+ anim?: boolean;
7564
7565
  };
7565
7566
  export interface ImagesBinding {
7566
7567
  /**
@@ -8082,21 +8083,17 @@ export declare namespace TailStream {
8082
8083
  readonly tag?: string;
8083
8084
  readonly message?: string;
8084
8085
  }
8085
- interface Trigger {
8086
- readonly traceId: string;
8087
- readonly invocationId: string;
8088
- readonly spanId: string;
8089
- }
8090
8086
  interface Onset {
8091
8087
  readonly type: "onset";
8092
8088
  readonly attributes: Attribute[];
8089
+ // id for the span being opened by this Onset event.
8090
+ readonly spanId: string;
8093
8091
  readonly dispatchNamespace?: string;
8094
8092
  readonly entrypoint?: string;
8095
8093
  readonly executionModel: string;
8096
8094
  readonly scriptName?: string;
8097
8095
  readonly scriptTags?: string[];
8098
8096
  readonly scriptVersion?: ScriptVersion;
8099
- readonly trigger?: Trigger;
8100
8097
  readonly info:
8101
8098
  | FetchEventInfo
8102
8099
  | JsRpcEventInfo
@@ -8117,6 +8114,8 @@ export declare namespace TailStream {
8117
8114
  interface SpanOpen {
8118
8115
  readonly type: "spanOpen";
8119
8116
  readonly name: string;
8117
+ // id for the span being opened by this SpanOpen event.
8118
+ readonly spanId: string;
8120
8119
  readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
8121
8120
  }
8122
8121
  interface SpanClose {
@@ -8139,6 +8138,10 @@ export declare namespace TailStream {
8139
8138
  readonly level: "debug" | "error" | "info" | "log" | "warn";
8140
8139
  readonly message: object;
8141
8140
  }
8141
+ // This marks the worker handler return information.
8142
+ // This is separate from Outcome because the worker invocation can live for a long time after
8143
+ // returning. For example - Websockets that return an http upgrade response but then continue
8144
+ // streaming information or SSE http connections.
8142
8145
  interface Return {
8143
8146
  readonly type: "return";
8144
8147
  readonly info?: FetchResponseInfo;
@@ -8169,9 +8172,28 @@ export declare namespace TailStream {
8169
8172
  | Log
8170
8173
  | Return
8171
8174
  | Attributes;
8175
+ // Context in which this trace event lives.
8176
+ interface SpanContext {
8177
+ // Single id for the entire top-level invocation
8178
+ // This should be a new traceId for the first worker stage invoked in the eyeball request and then
8179
+ // same-account service-bindings should reuse the same traceId but cross-account service-bindings
8180
+ // should use a new traceId.
8181
+ readonly traceId: string;
8182
+ // spanId in which this event is handled
8183
+ // for Onset and SpanOpen events this would be the parent span id
8184
+ // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
8185
+ // For Hibernate and Mark this would be the span under which they were emitted.
8186
+ // spanId is not set ONLY if:
8187
+ // 1. This is an Onset event
8188
+ // 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
8189
+ readonly spanId?: string;
8190
+ }
8172
8191
  interface TailEvent<Event extends EventType> {
8192
+ // invocation id of the currently invoked worker stage.
8193
+ // invocation id will always be unique to every Onset event and will be the same until the Outcome event.
8173
8194
  readonly invocationId: string;
8174
- readonly spanId: string;
8195
+ // Inherited spanContext for this event.
8196
+ readonly spanContext: SpanContext;
8175
8197
  readonly timestamp: Date;
8176
8198
  readonly sequence: number;
8177
8199
  readonly event: Event;
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "author": "Workers Community",
9
9
  "license": "MIT OR Apache-2.0",
10
- "version": "4.20250905.0",
10
+ "version": "4.20250906.0",
11
11
  "exports": {
12
12
  ".": {
13
13
  "types": "./index.d.ts",