@workers-community/workers-types 4.20250905.0 → 4.20250909.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 +34 -7
  2. package/index.ts +34 -7
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -7247,6 +7247,11 @@ interface D1Meta {
7247
7247
  */
7248
7248
  sql_duration_ms: number;
7249
7249
  };
7250
+ /**
7251
+ * Number of total attempts to execute the query, due to automatic retries.
7252
+ * Note: All other fields in the response like `timings` only apply to the last attempt.
7253
+ */
7254
+ total_attempts?: number;
7250
7255
  }
7251
7256
  interface D1Response {
7252
7257
  success: true;
@@ -7541,6 +7546,7 @@ type ImageOutputOptions = {
7541
7546
  | "rgba";
7542
7547
  quality?: number;
7543
7548
  background?: string;
7549
+ anim?: boolean;
7544
7550
  };
7545
7551
  interface ImagesBinding {
7546
7552
  /**
@@ -8237,21 +8243,17 @@ declare namespace TailStream {
8237
8243
  readonly tag?: string;
8238
8244
  readonly message?: string;
8239
8245
  }
8240
- interface Trigger {
8241
- readonly traceId: string;
8242
- readonly invocationId: string;
8243
- readonly spanId: string;
8244
- }
8245
8246
  interface Onset {
8246
8247
  readonly type: "onset";
8247
8248
  readonly attributes: Attribute[];
8249
+ // id for the span being opened by this Onset event.
8250
+ readonly spanId: string;
8248
8251
  readonly dispatchNamespace?: string;
8249
8252
  readonly entrypoint?: string;
8250
8253
  readonly executionModel: string;
8251
8254
  readonly scriptName?: string;
8252
8255
  readonly scriptTags?: string[];
8253
8256
  readonly scriptVersion?: ScriptVersion;
8254
- readonly trigger?: Trigger;
8255
8257
  readonly info:
8256
8258
  | FetchEventInfo
8257
8259
  | JsRpcEventInfo
@@ -8272,6 +8274,8 @@ declare namespace TailStream {
8272
8274
  interface SpanOpen {
8273
8275
  readonly type: "spanOpen";
8274
8276
  readonly name: string;
8277
+ // id for the span being opened by this SpanOpen event.
8278
+ readonly spanId: string;
8275
8279
  readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
8276
8280
  }
8277
8281
  interface SpanClose {
@@ -8294,6 +8298,10 @@ declare namespace TailStream {
8294
8298
  readonly level: "debug" | "error" | "info" | "log" | "warn";
8295
8299
  readonly message: object;
8296
8300
  }
8301
+ // This marks the worker handler return information.
8302
+ // This is separate from Outcome because the worker invocation can live for a long time after
8303
+ // returning. For example - Websockets that return an http upgrade response but then continue
8304
+ // streaming information or SSE http connections.
8297
8305
  interface Return {
8298
8306
  readonly type: "return";
8299
8307
  readonly info?: FetchResponseInfo;
@@ -8324,9 +8332,28 @@ declare namespace TailStream {
8324
8332
  | Log
8325
8333
  | Return
8326
8334
  | Attributes;
8335
+ // Context in which this trace event lives.
8336
+ interface SpanContext {
8337
+ // Single id for the entire top-level invocation
8338
+ // This should be a new traceId for the first worker stage invoked in the eyeball request and then
8339
+ // same-account service-bindings should reuse the same traceId but cross-account service-bindings
8340
+ // should use a new traceId.
8341
+ readonly traceId: string;
8342
+ // spanId in which this event is handled
8343
+ // for Onset and SpanOpen events this would be the parent span id
8344
+ // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
8345
+ // For Hibernate and Mark this would be the span under which they were emitted.
8346
+ // spanId is not set ONLY if:
8347
+ // 1. This is an Onset event
8348
+ // 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
8349
+ readonly spanId?: string;
8350
+ }
8327
8351
  interface TailEvent<Event extends EventType> {
8352
+ // invocation id of the currently invoked worker stage.
8353
+ // invocation id will always be unique to every Onset event and will be the same until the Outcome event.
8328
8354
  readonly invocationId: string;
8329
- readonly spanId: string;
8355
+ // Inherited spanContext for this event.
8356
+ readonly spanContext: SpanContext;
8330
8357
  readonly timestamp: Date;
8331
8358
  readonly sequence: number;
8332
8359
  readonly event: Event;
package/index.ts CHANGED
@@ -7274,6 +7274,11 @@ export interface D1Meta {
7274
7274
  */
7275
7275
  sql_duration_ms: number;
7276
7276
  };
7277
+ /**
7278
+ * Number of total attempts to execute the query, due to automatic retries.
7279
+ * Note: All other fields in the response like `timings` only apply to the last attempt.
7280
+ */
7281
+ total_attempts?: number;
7277
7282
  }
7278
7283
  export interface D1Response {
7279
7284
  success: true;
@@ -7561,6 +7566,7 @@ export type ImageOutputOptions = {
7561
7566
  | "rgba";
7562
7567
  quality?: number;
7563
7568
  background?: string;
7569
+ anim?: boolean;
7564
7570
  };
7565
7571
  export interface ImagesBinding {
7566
7572
  /**
@@ -8082,21 +8088,17 @@ export declare namespace TailStream {
8082
8088
  readonly tag?: string;
8083
8089
  readonly message?: string;
8084
8090
  }
8085
- interface Trigger {
8086
- readonly traceId: string;
8087
- readonly invocationId: string;
8088
- readonly spanId: string;
8089
- }
8090
8091
  interface Onset {
8091
8092
  readonly type: "onset";
8092
8093
  readonly attributes: Attribute[];
8094
+ // id for the span being opened by this Onset event.
8095
+ readonly spanId: string;
8093
8096
  readonly dispatchNamespace?: string;
8094
8097
  readonly entrypoint?: string;
8095
8098
  readonly executionModel: string;
8096
8099
  readonly scriptName?: string;
8097
8100
  readonly scriptTags?: string[];
8098
8101
  readonly scriptVersion?: ScriptVersion;
8099
- readonly trigger?: Trigger;
8100
8102
  readonly info:
8101
8103
  | FetchEventInfo
8102
8104
  | JsRpcEventInfo
@@ -8117,6 +8119,8 @@ export declare namespace TailStream {
8117
8119
  interface SpanOpen {
8118
8120
  readonly type: "spanOpen";
8119
8121
  readonly name: string;
8122
+ // id for the span being opened by this SpanOpen event.
8123
+ readonly spanId: string;
8120
8124
  readonly info?: FetchEventInfo | JsRpcEventInfo | Attributes;
8121
8125
  }
8122
8126
  interface SpanClose {
@@ -8139,6 +8143,10 @@ export declare namespace TailStream {
8139
8143
  readonly level: "debug" | "error" | "info" | "log" | "warn";
8140
8144
  readonly message: object;
8141
8145
  }
8146
+ // This marks the worker handler return information.
8147
+ // This is separate from Outcome because the worker invocation can live for a long time after
8148
+ // returning. For example - Websockets that return an http upgrade response but then continue
8149
+ // streaming information or SSE http connections.
8142
8150
  interface Return {
8143
8151
  readonly type: "return";
8144
8152
  readonly info?: FetchResponseInfo;
@@ -8169,9 +8177,28 @@ export declare namespace TailStream {
8169
8177
  | Log
8170
8178
  | Return
8171
8179
  | Attributes;
8180
+ // Context in which this trace event lives.
8181
+ interface SpanContext {
8182
+ // Single id for the entire top-level invocation
8183
+ // This should be a new traceId for the first worker stage invoked in the eyeball request and then
8184
+ // same-account service-bindings should reuse the same traceId but cross-account service-bindings
8185
+ // should use a new traceId.
8186
+ readonly traceId: string;
8187
+ // spanId in which this event is handled
8188
+ // for Onset and SpanOpen events this would be the parent span id
8189
+ // for Outcome and SpanClose these this would be the span id of the opening Onset and SpanOpen events
8190
+ // For Hibernate and Mark this would be the span under which they were emitted.
8191
+ // spanId is not set ONLY if:
8192
+ // 1. This is an Onset event
8193
+ // 2. We are not inherting any SpanContext. (e.g. this is a cross-account service binding or a new top-level invocation)
8194
+ readonly spanId?: string;
8195
+ }
8172
8196
  interface TailEvent<Event extends EventType> {
8197
+ // invocation id of the currently invoked worker stage.
8198
+ // invocation id will always be unique to every Onset event and will be the same until the Outcome event.
8173
8199
  readonly invocationId: string;
8174
- readonly spanId: string;
8200
+ // Inherited spanContext for this event.
8201
+ readonly spanContext: SpanContext;
8175
8202
  readonly timestamp: Date;
8176
8203
  readonly sequence: number;
8177
8204
  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.20250909.0",
11
11
  "exports": {
12
12
  ".": {
13
13
  "types": "./index.d.ts",