@workers-community/workers-types 4.20250403.0 → 4.20250405.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 +64 -557
  2. package/index.ts +52 -557
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -294,16 +294,6 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
294
294
  FixedLengthStream: typeof FixedLengthStream;
295
295
  IdentityTransformStream: typeof IdentityTransformStream;
296
296
  HTMLRewriter: typeof HTMLRewriter;
297
- GPUAdapter: typeof GPUAdapter;
298
- GPUOutOfMemoryError: typeof GPUOutOfMemoryError;
299
- GPUValidationError: typeof GPUValidationError;
300
- GPUInternalError: typeof GPUInternalError;
301
- GPUDeviceLostInfo: typeof GPUDeviceLostInfo;
302
- GPUBufferUsage: typeof GPUBufferUsage;
303
- GPUShaderStage: typeof GPUShaderStage;
304
- GPUMapMode: typeof GPUMapMode;
305
- GPUTextureUsage: typeof GPUTextureUsage;
306
- GPUColorWrite: typeof GPUColorWrite;
307
297
  }
308
298
  declare function addEventListener<Type extends keyof WorkerGlobalScopeEventMap>(
309
299
  type: Type,
@@ -474,7 +464,7 @@ declare abstract class Navigator {
474
464
  | URLSearchParams,
475
465
  ): boolean;
476
466
  readonly userAgent: string;
477
- readonly gpu?: GPU;
467
+ readonly hardwareConcurrency: number;
478
468
  }
479
469
  /**
480
470
  * The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
@@ -1282,7 +1272,7 @@ declare class DigestStream extends WritableStream<
1282
1272
  ArrayBuffer | ArrayBufferView
1283
1273
  > {
1284
1274
  constructor(algorithm: string | SubtleCryptoHashAlgorithm);
1285
- get digest(): Promise<ArrayBuffer | ArrayBufferView>;
1275
+ readonly digest: Promise<ArrayBuffer>;
1286
1276
  get bytesWritten(): number | bigint;
1287
1277
  }
1288
1278
  /**
@@ -1291,7 +1281,7 @@ declare class DigestStream extends WritableStream<
1291
1281
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
1292
1282
  */
1293
1283
  declare class TextDecoder {
1294
- constructor(decoder?: string, options?: TextDecoderConstructorOptions);
1284
+ constructor(label?: string, options?: TextDecoderConstructorOptions);
1295
1285
  /**
1296
1286
  * Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented input. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments.
1297
1287
  *
@@ -2949,518 +2939,6 @@ interface SocketInfo {
2949
2939
  remoteAddress?: string;
2950
2940
  localAddress?: string;
2951
2941
  }
2952
- interface GPU {
2953
- requestAdapter(param1?: GPURequestAdapterOptions): Promise<GPUAdapter | null>;
2954
- }
2955
- declare abstract class GPUAdapter {
2956
- requestDevice(param1?: GPUDeviceDescriptor): Promise<GPUDevice>;
2957
- requestAdapterInfo(unmaskHints?: string[]): Promise<GPUAdapterInfo>;
2958
- get features(): GPUSupportedFeatures;
2959
- get limits(): GPUSupportedLimits;
2960
- }
2961
- interface GPUDevice extends EventTarget {
2962
- createBuffer(param1: GPUBufferDescriptor): GPUBuffer;
2963
- createBindGroupLayout(
2964
- descriptor: GPUBindGroupLayoutDescriptor,
2965
- ): GPUBindGroupLayout;
2966
- createBindGroup(descriptor: GPUBindGroupDescriptor): GPUBindGroup;
2967
- createSampler(descriptor: GPUSamplerDescriptor): GPUSampler;
2968
- createShaderModule(descriptor: GPUShaderModuleDescriptor): GPUShaderModule;
2969
- createPipelineLayout(
2970
- descriptor: GPUPipelineLayoutDescriptor,
2971
- ): GPUPipelineLayout;
2972
- createComputePipeline(
2973
- descriptor: GPUComputePipelineDescriptor,
2974
- ): GPUComputePipeline;
2975
- createRenderPipeline(
2976
- descriptor: GPURenderPipelineDescriptor,
2977
- ): GPURenderPipeline;
2978
- createCommandEncoder(
2979
- descriptor?: GPUCommandEncoderDescriptor,
2980
- ): GPUCommandEncoder;
2981
- createTexture(param1: GPUTextureDescriptor): GPUTexture;
2982
- destroy(): void;
2983
- createQuerySet(descriptor: GPUQuerySetDescriptor): GPUQuerySet;
2984
- pushErrorScope(filter: string): void;
2985
- popErrorScope(): Promise<GPUError | null>;
2986
- get queue(): GPUQueue;
2987
- get lost(): Promise<GPUDeviceLostInfo>;
2988
- get features(): GPUSupportedFeatures;
2989
- get limits(): GPUSupportedLimits;
2990
- }
2991
- interface GPUDeviceDescriptor {
2992
- label?: string;
2993
- requiredFeatures?: string[];
2994
- requiredLimits?: Record<string, number | bigint>;
2995
- defaultQueue?: GPUQueueDescriptor;
2996
- }
2997
- interface GPUBufferDescriptor {
2998
- label: string;
2999
- size: number | bigint;
3000
- usage: number;
3001
- mappedAtCreation: boolean;
3002
- }
3003
- interface GPUQueueDescriptor {
3004
- label?: string;
3005
- }
3006
- declare abstract class GPUBufferUsage {
3007
- static readonly MAP_READ: number;
3008
- static readonly MAP_WRITE: number;
3009
- static readonly COPY_SRC: number;
3010
- static readonly COPY_DST: number;
3011
- static readonly INDEX: number;
3012
- static readonly VERTEX: number;
3013
- static readonly UNIFORM: number;
3014
- static readonly STORAGE: number;
3015
- static readonly INDIRECT: number;
3016
- static readonly QUERY_RESOLVE: number;
3017
- }
3018
- interface GPUBuffer {
3019
- getMappedRange(size?: number | bigint, param2?: number | bigint): ArrayBuffer;
3020
- unmap(): void;
3021
- destroy(): void;
3022
- mapAsync(
3023
- offset: number,
3024
- size?: number | bigint,
3025
- param3?: number | bigint,
3026
- ): Promise<void>;
3027
- get size(): number | bigint;
3028
- get usage(): number;
3029
- get mapState(): string;
3030
- }
3031
- declare abstract class GPUShaderStage {
3032
- static readonly VERTEX: number;
3033
- static readonly FRAGMENT: number;
3034
- static readonly COMPUTE: number;
3035
- }
3036
- interface GPUBindGroupLayoutDescriptor {
3037
- label?: string;
3038
- entries: GPUBindGroupLayoutEntry[];
3039
- }
3040
- interface GPUBindGroupLayoutEntry {
3041
- binding: number;
3042
- visibility: number;
3043
- buffer?: GPUBufferBindingLayout;
3044
- sampler?: GPUSamplerBindingLayout;
3045
- texture?: GPUTextureBindingLayout;
3046
- storageTexture?: GPUStorageTextureBindingLayout;
3047
- }
3048
- interface GPUStorageTextureBindingLayout {
3049
- access?: string;
3050
- format: string;
3051
- viewDimension?: string;
3052
- }
3053
- interface GPUTextureBindingLayout {
3054
- sampleType?: string;
3055
- viewDimension?: string;
3056
- multisampled?: boolean;
3057
- }
3058
- interface GPUSamplerBindingLayout {
3059
- type?: string;
3060
- }
3061
- interface GPUBufferBindingLayout {
3062
- type?: string;
3063
- hasDynamicOffset?: boolean;
3064
- minBindingSize?: number | bigint;
3065
- }
3066
- interface GPUBindGroupLayout {}
3067
- interface GPUBindGroup {}
3068
- interface GPUBindGroupDescriptor {
3069
- label?: string;
3070
- layout: GPUBindGroupLayout;
3071
- entries: GPUBindGroupEntry[];
3072
- }
3073
- interface GPUBindGroupEntry {
3074
- binding: number;
3075
- resource: GPUBufferBinding | GPUSampler;
3076
- }
3077
- interface GPUBufferBinding {
3078
- buffer: GPUBuffer;
3079
- offset?: number | bigint;
3080
- size?: number | bigint;
3081
- }
3082
- interface GPUSampler {}
3083
- interface GPUSamplerDescriptor {
3084
- label?: string;
3085
- addressModeU?: string;
3086
- addressModeV?: string;
3087
- addressModeW?: string;
3088
- magFilter?: string;
3089
- minFilter?: string;
3090
- mipmapFilter?: string;
3091
- lodMinClamp?: number;
3092
- lodMaxClamp?: number;
3093
- compare: string;
3094
- maxAnisotropy?: number;
3095
- }
3096
- interface GPUShaderModule {
3097
- getCompilationInfo(): Promise<GPUCompilationInfo>;
3098
- }
3099
- interface GPUShaderModuleDescriptor {
3100
- label?: string;
3101
- code: string;
3102
- }
3103
- interface GPUPipelineLayout {}
3104
- interface GPUPipelineLayoutDescriptor {
3105
- label?: string;
3106
- bindGroupLayouts: GPUBindGroupLayout[];
3107
- }
3108
- interface GPUComputePipeline {
3109
- getBindGroupLayout(index: number): GPUBindGroupLayout;
3110
- }
3111
- interface GPUComputePipelineDescriptor {
3112
- label?: string;
3113
- compute: GPUProgrammableStage;
3114
- layout: string | GPUPipelineLayout;
3115
- }
3116
- interface GPUProgrammableStage {
3117
- module: GPUShaderModule;
3118
- entryPoint: string;
3119
- constants?: Record<string, number>;
3120
- }
3121
- interface GPUCommandEncoder {
3122
- get label(): string;
3123
- beginComputePass(
3124
- descriptor?: GPUComputePassDescriptor,
3125
- ): GPUComputePassEncoder;
3126
- beginRenderPass(descriptor: GPURenderPassDescriptor): GPURenderPassEncoder;
3127
- copyBufferToBuffer(
3128
- source: GPUBuffer,
3129
- sourceOffset: number | bigint,
3130
- destination: GPUBuffer,
3131
- destinationOffset: number | bigint,
3132
- size: number | bigint,
3133
- ): void;
3134
- finish(param0?: GPUCommandBufferDescriptor): GPUCommandBuffer;
3135
- copyTextureToBuffer(
3136
- source: GPUImageCopyTexture,
3137
- destination: GPUImageCopyBuffer,
3138
- copySize: Iterable<number> | GPUExtent3DDict,
3139
- ): void;
3140
- copyBufferToTexture(
3141
- source: GPUImageCopyBuffer,
3142
- destination: GPUImageCopyTexture,
3143
- copySize: Iterable<number> | GPUExtent3DDict,
3144
- ): void;
3145
- copyTextureToTexture(
3146
- source: GPUImageCopyTexture,
3147
- destination: GPUImageCopyTexture,
3148
- copySize: Iterable<number> | GPUExtent3DDict,
3149
- ): void;
3150
- clearBuffer(
3151
- buffer: GPUBuffer,
3152
- offset?: number | bigint,
3153
- size?: number | bigint,
3154
- ): void;
3155
- }
3156
- interface GPUCommandEncoderDescriptor {
3157
- label?: string;
3158
- }
3159
- interface GPUComputePassEncoder {
3160
- setPipeline(pipeline: GPUComputePipeline): void;
3161
- setBindGroup(
3162
- index: number,
3163
- bindGroup: GPUBindGroup | null,
3164
- dynamicOffsets?: Iterable<number>,
3165
- ): void;
3166
- dispatchWorkgroups(
3167
- workgroupCountX: number,
3168
- workgroupCountY?: number,
3169
- workgroupCountZ?: number,
3170
- ): void;
3171
- end(): void;
3172
- }
3173
- interface GPUComputePassDescriptor {
3174
- label?: string;
3175
- timestampWrites?: GPUComputePassTimestampWrites;
3176
- }
3177
- interface GPUQuerySet {}
3178
- interface GPUQuerySetDescriptor {
3179
- label?: string;
3180
- }
3181
- interface GPUComputePassTimestampWrites {
3182
- querySet: GPUQuerySet;
3183
- beginningOfPassWriteIndex?: number;
3184
- endOfPassWriteIndex?: number;
3185
- }
3186
- interface GPUCommandBufferDescriptor {
3187
- label?: string;
3188
- }
3189
- interface GPUCommandBuffer {}
3190
- interface GPUQueue {
3191
- submit(commandBuffers: GPUCommandBuffer[]): void;
3192
- writeBuffer(
3193
- buffer: GPUBuffer,
3194
- bufferOffset: number | bigint,
3195
- data: ArrayBuffer | ArrayBufferView,
3196
- dataOffset?: number | bigint,
3197
- size?: number | bigint,
3198
- ): void;
3199
- }
3200
- declare abstract class GPUMapMode {
3201
- static readonly READ: number;
3202
- static readonly WRITE: number;
3203
- }
3204
- interface GPURequestAdapterOptions {
3205
- powerPreference: string;
3206
- forceFallbackAdapter?: boolean;
3207
- }
3208
- interface GPUAdapterInfo {
3209
- get vendor(): string;
3210
- get architecture(): string;
3211
- get device(): string;
3212
- get description(): string;
3213
- }
3214
- interface GPUSupportedFeatures {
3215
- has(name: string): boolean;
3216
- keys(): string[];
3217
- }
3218
- interface GPUSupportedLimits {
3219
- get maxTextureDimension1D(): number;
3220
- get maxTextureDimension2D(): number;
3221
- get maxTextureDimension3D(): number;
3222
- get maxTextureArrayLayers(): number;
3223
- get maxBindGroups(): number;
3224
- get maxBindingsPerBindGroup(): number;
3225
- get maxDynamicUniformBuffersPerPipelineLayout(): number;
3226
- get maxDynamicStorageBuffersPerPipelineLayout(): number;
3227
- get maxSampledTexturesPerShaderStage(): number;
3228
- get maxSamplersPerShaderStage(): number;
3229
- get maxStorageBuffersPerShaderStage(): number;
3230
- get maxStorageTexturesPerShaderStage(): number;
3231
- get maxUniformBuffersPerShaderStage(): number;
3232
- get maxUniformBufferBindingSize(): number | bigint;
3233
- get maxStorageBufferBindingSize(): number | bigint;
3234
- get minUniformBufferOffsetAlignment(): number;
3235
- get minStorageBufferOffsetAlignment(): number;
3236
- get maxVertexBuffers(): number;
3237
- get maxBufferSize(): number | bigint;
3238
- get maxVertexAttributes(): number;
3239
- get maxVertexBufferArrayStride(): number;
3240
- get maxInterStageShaderComponents(): number;
3241
- get maxInterStageShaderVariables(): number;
3242
- get maxColorAttachments(): number;
3243
- get maxColorAttachmentBytesPerSample(): number;
3244
- get maxComputeWorkgroupStorageSize(): number;
3245
- get maxComputeInvocationsPerWorkgroup(): number;
3246
- get maxComputeWorkgroupSizeX(): number;
3247
- get maxComputeWorkgroupSizeY(): number;
3248
- get maxComputeWorkgroupSizeZ(): number;
3249
- get maxComputeWorkgroupsPerDimension(): number;
3250
- }
3251
- declare abstract class GPUError {
3252
- get message(): string;
3253
- }
3254
- declare abstract class GPUOutOfMemoryError extends GPUError {}
3255
- declare abstract class GPUInternalError extends GPUError {}
3256
- declare abstract class GPUValidationError extends GPUError {}
3257
- declare abstract class GPUDeviceLostInfo {
3258
- get message(): string;
3259
- get reason(): string;
3260
- }
3261
- interface GPUCompilationMessage {
3262
- get message(): string;
3263
- get type(): string;
3264
- get lineNum(): number;
3265
- get linePos(): number;
3266
- get offset(): number;
3267
- get length(): number;
3268
- }
3269
- interface GPUCompilationInfo {
3270
- get messages(): GPUCompilationMessage[];
3271
- }
3272
- declare abstract class GPUTextureUsage {
3273
- static readonly COPY_SRC: number;
3274
- static readonly COPY_DST: number;
3275
- static readonly TEXTURE_BINDING: number;
3276
- static readonly STORAGE_BINDING: number;
3277
- static readonly RENDER_ATTACHMENT: number;
3278
- }
3279
- interface GPUTextureDescriptor {
3280
- label: string;
3281
- size: number[] | GPUExtent3DDict;
3282
- mipLevelCount?: number;
3283
- sampleCount?: number;
3284
- dimension?: string;
3285
- format: string;
3286
- usage: number;
3287
- viewFormats?: string[];
3288
- }
3289
- interface GPUExtent3DDict {
3290
- width: number;
3291
- height?: number;
3292
- depthOrArrayLayers?: number;
3293
- }
3294
- interface GPUTexture {
3295
- createView(descriptor?: GPUTextureViewDescriptor): GPUTextureView;
3296
- destroy(): void;
3297
- get width(): number;
3298
- get height(): number;
3299
- get depthOrArrayLayers(): number;
3300
- get mipLevelCount(): number;
3301
- get dimension(): string;
3302
- get format(): string;
3303
- get usage(): number;
3304
- }
3305
- interface GPUTextureView {}
3306
- interface GPUTextureViewDescriptor {
3307
- label: string;
3308
- format: string;
3309
- dimension: string;
3310
- aspect?: string;
3311
- baseMipLevel?: number;
3312
- mipLevelCount: number;
3313
- baseArrayLayer?: number;
3314
- arrayLayerCount: number;
3315
- }
3316
- declare abstract class GPUColorWrite {
3317
- static readonly RED: number;
3318
- static readonly GREEN: number;
3319
- static readonly BLUE: number;
3320
- static readonly ALPHA: number;
3321
- static readonly ALL: number;
3322
- }
3323
- interface GPURenderPipeline {}
3324
- interface GPURenderPipelineDescriptor {
3325
- label?: string;
3326
- layout: string | GPUPipelineLayout;
3327
- vertex: GPUVertexState;
3328
- primitive?: GPUPrimitiveState;
3329
- depthStencil?: GPUDepthStencilState;
3330
- multisample?: GPUMultisampleState;
3331
- fragment?: GPUFragmentState;
3332
- }
3333
- interface GPUVertexState {
3334
- module: GPUShaderModule;
3335
- entryPoint: string;
3336
- constants?: Record<string, number>;
3337
- buffers?: GPUVertexBufferLayout[];
3338
- }
3339
- interface GPUVertexBufferLayout {
3340
- arrayStride: number | bigint;
3341
- stepMode?: string;
3342
- attributes: GPUVertexAttribute[];
3343
- }
3344
- interface GPUVertexAttribute {
3345
- format: string;
3346
- offset: number | bigint;
3347
- shaderLocation: number;
3348
- }
3349
- interface GPUPrimitiveState {
3350
- topology?: string;
3351
- stripIndexFormat?: string;
3352
- frontFace?: string;
3353
- cullMode?: string;
3354
- unclippedDepth?: boolean;
3355
- }
3356
- interface GPUStencilFaceState {
3357
- compare?: string;
3358
- failOp?: string;
3359
- depthFailOp?: string;
3360
- passOp?: string;
3361
- }
3362
- interface GPUDepthStencilState {
3363
- format: string;
3364
- depthWriteEnabled: boolean;
3365
- depthCompare: string;
3366
- stencilFront?: GPUStencilFaceState;
3367
- stencilBack?: GPUStencilFaceState;
3368
- stencilReadMask?: number;
3369
- stencilWriteMask?: number;
3370
- depthBias?: number;
3371
- depthBiasSlopeScale?: number;
3372
- depthBiasClamp?: number;
3373
- }
3374
- interface GPUMultisampleState {
3375
- count?: number;
3376
- mask?: number;
3377
- alphaToCoverageEnabled?: boolean;
3378
- }
3379
- interface GPUFragmentState {
3380
- module: GPUShaderModule;
3381
- entryPoint: string;
3382
- constants?: Record<string, number>;
3383
- targets: GPUColorTargetState[];
3384
- }
3385
- interface GPUColorTargetState {
3386
- format: string;
3387
- blend: GPUBlendState;
3388
- writeMask?: number;
3389
- }
3390
- interface GPUBlendState {
3391
- color: GPUBlendComponent;
3392
- alpha: GPUBlendComponent;
3393
- }
3394
- interface GPUBlendComponent {
3395
- operation?: string;
3396
- srcFactor?: string;
3397
- dstFactor?: string;
3398
- }
3399
- interface GPURenderPassEncoder {
3400
- setPipeline(pipeline: GPURenderPipeline): void;
3401
- draw(
3402
- vertexCount: number,
3403
- instanceCount?: number,
3404
- firstVertex?: number,
3405
- firstInstance?: number,
3406
- ): void;
3407
- end(): void;
3408
- }
3409
- interface GPURenderPassDescriptor {
3410
- label?: string;
3411
- colorAttachments: GPURenderPassColorAttachment[];
3412
- depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
3413
- occlusionQuerySet?: GPUQuerySet;
3414
- timestampWrites?: GPURenderPassTimestampWrites;
3415
- maxDrawCount?: number | bigint;
3416
- }
3417
- interface GPURenderPassColorAttachment {
3418
- view: GPUTextureView;
3419
- depthSlice?: number;
3420
- resolveTarget?: GPUTextureView;
3421
- clearValue?: number[] | GPUColorDict;
3422
- loadOp: string;
3423
- storeOp: string;
3424
- }
3425
- interface GPUColorDict {
3426
- r: number;
3427
- g: number;
3428
- b: number;
3429
- a: number;
3430
- }
3431
- interface GPURenderPassDepthStencilAttachment {
3432
- view: GPUTextureView;
3433
- depthClearValue?: number;
3434
- depthLoadOp?: string;
3435
- depthStoreOp?: string;
3436
- depthReadOnly?: boolean;
3437
- stencilClearValue?: number;
3438
- stencilLoadOp?: string;
3439
- stencilStoreOp?: string;
3440
- stencilReadOnly?: boolean;
3441
- }
3442
- interface GPURenderPassTimestampWrites {
3443
- querySet: GPUQuerySet;
3444
- beginningOfPassWriteIndex?: number;
3445
- endOfPassWriteIndex?: number;
3446
- }
3447
- interface GPUImageCopyTexture {
3448
- texture: GPUTexture;
3449
- mipLevel?: number;
3450
- origin?: number[] | GPUOrigin3DDict;
3451
- aspect?: string;
3452
- }
3453
- interface GPUImageCopyBuffer {
3454
- buffer: GPUBuffer;
3455
- offset?: number | bigint;
3456
- bytesPerRow?: number;
3457
- rowsPerImage?: number;
3458
- }
3459
- interface GPUOrigin3DDict {
3460
- x?: number;
3461
- y?: number;
3462
- z?: number;
3463
- }
3464
2942
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
3465
2943
  declare class EventSource extends EventTarget {
3466
2944
  constructor(url: string, init?: EventSourceEventSourceInit);
@@ -6210,19 +5688,7 @@ declare namespace Rpc {
6210
5688
  // serializable check as well. Otherwise, only types defined with the "type" keyword would pass.
6211
5689
  type Serializable<T> =
6212
5690
  // Structured cloneables
6213
- | void
6214
- | undefined
6215
- | null
6216
- | boolean
6217
- | number
6218
- | bigint
6219
- | string
6220
- | TypedArray
6221
- | ArrayBuffer
6222
- | DataView
6223
- | Date
6224
- | Error
6225
- | RegExp
5691
+ | BaseType
6226
5692
  // Structured cloneable composites
6227
5693
  | Map<
6228
5694
  T extends Map<infer U, unknown> ? Serializable<U> : never,
@@ -6234,11 +5700,6 @@ declare namespace Rpc {
6234
5700
  [K in keyof T]: K extends number | string ? Serializable<T[K]> : never;
6235
5701
  }
6236
5702
  // Special types
6237
- | ReadableStream<Uint8Array>
6238
- | WritableStream<Uint8Array>
6239
- | Request
6240
- | Response
6241
- | Headers
6242
5703
  | Stub<Stubable>
6243
5704
  // Serialized as stubs, see `Stubify`
6244
5705
  | Stubable;
@@ -6249,6 +5710,26 @@ declare namespace Rpc {
6249
5710
  dup(): this;
6250
5711
  }
6251
5712
  export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;
5713
+ // This represents all the types that can be sent as-is over an RPC boundary
5714
+ type BaseType =
5715
+ | void
5716
+ | undefined
5717
+ | null
5718
+ | boolean
5719
+ | number
5720
+ | bigint
5721
+ | string
5722
+ | TypedArray
5723
+ | ArrayBuffer
5724
+ | DataView
5725
+ | Date
5726
+ | Error
5727
+ | RegExp
5728
+ | ReadableStream<Uint8Array>
5729
+ | WritableStream<Uint8Array>
5730
+ | Request
5731
+ | Response
5732
+ | Headers;
6252
5733
  // Recursively rewrite all `Stubable` types with `Stub`s
6253
5734
  type Stubify<T> = T extends Stubable
6254
5735
  ? Stub<T>
@@ -6260,13 +5741,15 @@ declare namespace Rpc {
6260
5741
  ? Array<Stubify<V>>
6261
5742
  : T extends ReadonlyArray<infer V>
6262
5743
  ? ReadonlyArray<Stubify<V>>
6263
- : T extends {
6264
- [key: string | number]: any;
6265
- }
6266
- ? {
6267
- [K in keyof T]: Stubify<T[K]>;
6268
- }
6269
- : T;
5744
+ : T extends BaseType
5745
+ ? T
5746
+ : T extends {
5747
+ [key: string | number]: any;
5748
+ }
5749
+ ? {
5750
+ [K in keyof T]: Stubify<T[K]>;
5751
+ }
5752
+ : T;
6270
5753
  // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.
6271
5754
  // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:
6272
5755
  // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.
@@ -6281,13 +5764,15 @@ declare namespace Rpc {
6281
5764
  ? Array<Unstubify<V>>
6282
5765
  : T extends ReadonlyArray<infer V>
6283
5766
  ? ReadonlyArray<Unstubify<V>>
6284
- : T extends {
6285
- [key: string | number]: unknown;
6286
- }
6287
- ? {
6288
- [K in keyof T]: Unstubify<T[K]>;
6289
- }
6290
- : T;
5767
+ : T extends BaseType
5768
+ ? T
5769
+ : T extends {
5770
+ [key: string | number]: unknown;
5771
+ }
5772
+ ? {
5773
+ [K in keyof T]: Unstubify<T[K]>;
5774
+ }
5775
+ : T;
6291
5776
  type UnstubifyAll<A extends any[]> = {
6292
5777
  [I in keyof A]: Unstubify<A[I]>;
6293
5778
  };
@@ -6407,6 +5892,11 @@ declare module "cloudflare:workers" {
6407
5892
  timestamp: Date;
6408
5893
  instanceId: string;
6409
5894
  };
5895
+ export type WorkflowStepEvent<T> = {
5896
+ payload: Readonly<T>;
5897
+ timestamp: Date;
5898
+ type: string;
5899
+ };
6410
5900
  export abstract class WorkflowStep {
6411
5901
  do<T extends Rpc.Serializable<T>>(
6412
5902
  name: string,
@@ -6419,6 +5909,13 @@ declare module "cloudflare:workers" {
6419
5909
  ): Promise<T>;
6420
5910
  sleep: (name: string, duration: WorkflowSleepDuration) => Promise<void>;
6421
5911
  sleepUntil: (name: string, timestamp: Date | number) => Promise<void>;
5912
+ waitForEvent<T extends Rpc.Serializable<T>>(
5913
+ name: string,
5914
+ options: {
5915
+ type: string;
5916
+ timeout?: WorkflowTimeoutDuration | number;
5917
+ },
5918
+ ): Promise<WorkflowStepEvent<T>>;
6422
5919
  }
6423
5920
  export abstract class WorkflowEntrypoint<
6424
5921
  Env = unknown,
@@ -7030,4 +6527,14 @@ declare abstract class WorkflowInstance {
7030
6527
  * Returns the current status of the instance.
7031
6528
  */
7032
6529
  public status(): Promise<InstanceStatus>;
6530
+ /**
6531
+ * Send an event to this instance.
6532
+ */
6533
+ public sendEvent({
6534
+ type,
6535
+ payload,
6536
+ }: {
6537
+ type: string;
6538
+ payload: unknown;
6539
+ }): Promise<void>;
7033
6540
  }
package/index.ts CHANGED
@@ -294,16 +294,6 @@ export interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
294
294
  FixedLengthStream: typeof FixedLengthStream;
295
295
  IdentityTransformStream: typeof IdentityTransformStream;
296
296
  HTMLRewriter: typeof HTMLRewriter;
297
- GPUAdapter: typeof GPUAdapter;
298
- GPUOutOfMemoryError: typeof GPUOutOfMemoryError;
299
- GPUValidationError: typeof GPUValidationError;
300
- GPUInternalError: typeof GPUInternalError;
301
- GPUDeviceLostInfo: typeof GPUDeviceLostInfo;
302
- GPUBufferUsage: typeof GPUBufferUsage;
303
- GPUShaderStage: typeof GPUShaderStage;
304
- GPUMapMode: typeof GPUMapMode;
305
- GPUTextureUsage: typeof GPUTextureUsage;
306
- GPUColorWrite: typeof GPUColorWrite;
307
297
  }
308
298
  export declare function addEventListener<
309
299
  Type extends keyof WorkerGlobalScopeEventMap,
@@ -479,7 +469,7 @@ export declare abstract class Navigator {
479
469
  | URLSearchParams,
480
470
  ): boolean;
481
471
  readonly userAgent: string;
482
- readonly gpu?: GPU;
472
+ readonly hardwareConcurrency: number;
483
473
  }
484
474
  /**
485
475
  * The Workers runtime supports a subset of the Performance API, used to measure timing and performance,
@@ -1287,7 +1277,7 @@ export declare class DigestStream extends WritableStream<
1287
1277
  ArrayBuffer | ArrayBufferView
1288
1278
  > {
1289
1279
  constructor(algorithm: string | SubtleCryptoHashAlgorithm);
1290
- get digest(): Promise<ArrayBuffer | ArrayBufferView>;
1280
+ readonly digest: Promise<ArrayBuffer>;
1291
1281
  get bytesWritten(): number | bigint;
1292
1282
  }
1293
1283
  /**
@@ -1296,7 +1286,7 @@ export declare class DigestStream extends WritableStream<
1296
1286
  * [MDN Reference](https://developer.mozilla.org/docs/Web/API/TextDecoder)
1297
1287
  */
1298
1288
  export declare class TextDecoder {
1299
- constructor(decoder?: string, options?: TextDecoderConstructorOptions);
1289
+ constructor(label?: string, options?: TextDecoderConstructorOptions);
1300
1290
  /**
1301
1291
  * Returns the result of running encoding's decoder. The method can be invoked zero or more times with options's stream set to true, and then once without options's stream (or set to false), to process a fragmented input. If the invocation without options's stream (or set to false) has no input, it's clearest to omit both arguments.
1302
1292
  *
@@ -2961,518 +2951,6 @@ export interface SocketInfo {
2961
2951
  remoteAddress?: string;
2962
2952
  localAddress?: string;
2963
2953
  }
2964
- export interface GPU {
2965
- requestAdapter(param1?: GPURequestAdapterOptions): Promise<GPUAdapter | null>;
2966
- }
2967
- export declare abstract class GPUAdapter {
2968
- requestDevice(param1?: GPUDeviceDescriptor): Promise<GPUDevice>;
2969
- requestAdapterInfo(unmaskHints?: string[]): Promise<GPUAdapterInfo>;
2970
- get features(): GPUSupportedFeatures;
2971
- get limits(): GPUSupportedLimits;
2972
- }
2973
- export interface GPUDevice extends EventTarget {
2974
- createBuffer(param1: GPUBufferDescriptor): GPUBuffer;
2975
- createBindGroupLayout(
2976
- descriptor: GPUBindGroupLayoutDescriptor,
2977
- ): GPUBindGroupLayout;
2978
- createBindGroup(descriptor: GPUBindGroupDescriptor): GPUBindGroup;
2979
- createSampler(descriptor: GPUSamplerDescriptor): GPUSampler;
2980
- createShaderModule(descriptor: GPUShaderModuleDescriptor): GPUShaderModule;
2981
- createPipelineLayout(
2982
- descriptor: GPUPipelineLayoutDescriptor,
2983
- ): GPUPipelineLayout;
2984
- createComputePipeline(
2985
- descriptor: GPUComputePipelineDescriptor,
2986
- ): GPUComputePipeline;
2987
- createRenderPipeline(
2988
- descriptor: GPURenderPipelineDescriptor,
2989
- ): GPURenderPipeline;
2990
- createCommandEncoder(
2991
- descriptor?: GPUCommandEncoderDescriptor,
2992
- ): GPUCommandEncoder;
2993
- createTexture(param1: GPUTextureDescriptor): GPUTexture;
2994
- destroy(): void;
2995
- createQuerySet(descriptor: GPUQuerySetDescriptor): GPUQuerySet;
2996
- pushErrorScope(filter: string): void;
2997
- popErrorScope(): Promise<GPUError | null>;
2998
- get queue(): GPUQueue;
2999
- get lost(): Promise<GPUDeviceLostInfo>;
3000
- get features(): GPUSupportedFeatures;
3001
- get limits(): GPUSupportedLimits;
3002
- }
3003
- export interface GPUDeviceDescriptor {
3004
- label?: string;
3005
- requiredFeatures?: string[];
3006
- requiredLimits?: Record<string, number | bigint>;
3007
- defaultQueue?: GPUQueueDescriptor;
3008
- }
3009
- export interface GPUBufferDescriptor {
3010
- label: string;
3011
- size: number | bigint;
3012
- usage: number;
3013
- mappedAtCreation: boolean;
3014
- }
3015
- export interface GPUQueueDescriptor {
3016
- label?: string;
3017
- }
3018
- export declare abstract class GPUBufferUsage {
3019
- static readonly MAP_READ: number;
3020
- static readonly MAP_WRITE: number;
3021
- static readonly COPY_SRC: number;
3022
- static readonly COPY_DST: number;
3023
- static readonly INDEX: number;
3024
- static readonly VERTEX: number;
3025
- static readonly UNIFORM: number;
3026
- static readonly STORAGE: number;
3027
- static readonly INDIRECT: number;
3028
- static readonly QUERY_RESOLVE: number;
3029
- }
3030
- export interface GPUBuffer {
3031
- getMappedRange(size?: number | bigint, param2?: number | bigint): ArrayBuffer;
3032
- unmap(): void;
3033
- destroy(): void;
3034
- mapAsync(
3035
- offset: number,
3036
- size?: number | bigint,
3037
- param3?: number | bigint,
3038
- ): Promise<void>;
3039
- get size(): number | bigint;
3040
- get usage(): number;
3041
- get mapState(): string;
3042
- }
3043
- export declare abstract class GPUShaderStage {
3044
- static readonly VERTEX: number;
3045
- static readonly FRAGMENT: number;
3046
- static readonly COMPUTE: number;
3047
- }
3048
- export interface GPUBindGroupLayoutDescriptor {
3049
- label?: string;
3050
- entries: GPUBindGroupLayoutEntry[];
3051
- }
3052
- export interface GPUBindGroupLayoutEntry {
3053
- binding: number;
3054
- visibility: number;
3055
- buffer?: GPUBufferBindingLayout;
3056
- sampler?: GPUSamplerBindingLayout;
3057
- texture?: GPUTextureBindingLayout;
3058
- storageTexture?: GPUStorageTextureBindingLayout;
3059
- }
3060
- export interface GPUStorageTextureBindingLayout {
3061
- access?: string;
3062
- format: string;
3063
- viewDimension?: string;
3064
- }
3065
- export interface GPUTextureBindingLayout {
3066
- sampleType?: string;
3067
- viewDimension?: string;
3068
- multisampled?: boolean;
3069
- }
3070
- export interface GPUSamplerBindingLayout {
3071
- type?: string;
3072
- }
3073
- export interface GPUBufferBindingLayout {
3074
- type?: string;
3075
- hasDynamicOffset?: boolean;
3076
- minBindingSize?: number | bigint;
3077
- }
3078
- export interface GPUBindGroupLayout {}
3079
- export interface GPUBindGroup {}
3080
- export interface GPUBindGroupDescriptor {
3081
- label?: string;
3082
- layout: GPUBindGroupLayout;
3083
- entries: GPUBindGroupEntry[];
3084
- }
3085
- export interface GPUBindGroupEntry {
3086
- binding: number;
3087
- resource: GPUBufferBinding | GPUSampler;
3088
- }
3089
- export interface GPUBufferBinding {
3090
- buffer: GPUBuffer;
3091
- offset?: number | bigint;
3092
- size?: number | bigint;
3093
- }
3094
- export interface GPUSampler {}
3095
- export interface GPUSamplerDescriptor {
3096
- label?: string;
3097
- addressModeU?: string;
3098
- addressModeV?: string;
3099
- addressModeW?: string;
3100
- magFilter?: string;
3101
- minFilter?: string;
3102
- mipmapFilter?: string;
3103
- lodMinClamp?: number;
3104
- lodMaxClamp?: number;
3105
- compare: string;
3106
- maxAnisotropy?: number;
3107
- }
3108
- export interface GPUShaderModule {
3109
- getCompilationInfo(): Promise<GPUCompilationInfo>;
3110
- }
3111
- export interface GPUShaderModuleDescriptor {
3112
- label?: string;
3113
- code: string;
3114
- }
3115
- export interface GPUPipelineLayout {}
3116
- export interface GPUPipelineLayoutDescriptor {
3117
- label?: string;
3118
- bindGroupLayouts: GPUBindGroupLayout[];
3119
- }
3120
- export interface GPUComputePipeline {
3121
- getBindGroupLayout(index: number): GPUBindGroupLayout;
3122
- }
3123
- export interface GPUComputePipelineDescriptor {
3124
- label?: string;
3125
- compute: GPUProgrammableStage;
3126
- layout: string | GPUPipelineLayout;
3127
- }
3128
- export interface GPUProgrammableStage {
3129
- module: GPUShaderModule;
3130
- entryPoint: string;
3131
- constants?: Record<string, number>;
3132
- }
3133
- export interface GPUCommandEncoder {
3134
- get label(): string;
3135
- beginComputePass(
3136
- descriptor?: GPUComputePassDescriptor,
3137
- ): GPUComputePassEncoder;
3138
- beginRenderPass(descriptor: GPURenderPassDescriptor): GPURenderPassEncoder;
3139
- copyBufferToBuffer(
3140
- source: GPUBuffer,
3141
- sourceOffset: number | bigint,
3142
- destination: GPUBuffer,
3143
- destinationOffset: number | bigint,
3144
- size: number | bigint,
3145
- ): void;
3146
- finish(param0?: GPUCommandBufferDescriptor): GPUCommandBuffer;
3147
- copyTextureToBuffer(
3148
- source: GPUImageCopyTexture,
3149
- destination: GPUImageCopyBuffer,
3150
- copySize: Iterable<number> | GPUExtent3DDict,
3151
- ): void;
3152
- copyBufferToTexture(
3153
- source: GPUImageCopyBuffer,
3154
- destination: GPUImageCopyTexture,
3155
- copySize: Iterable<number> | GPUExtent3DDict,
3156
- ): void;
3157
- copyTextureToTexture(
3158
- source: GPUImageCopyTexture,
3159
- destination: GPUImageCopyTexture,
3160
- copySize: Iterable<number> | GPUExtent3DDict,
3161
- ): void;
3162
- clearBuffer(
3163
- buffer: GPUBuffer,
3164
- offset?: number | bigint,
3165
- size?: number | bigint,
3166
- ): void;
3167
- }
3168
- export interface GPUCommandEncoderDescriptor {
3169
- label?: string;
3170
- }
3171
- export interface GPUComputePassEncoder {
3172
- setPipeline(pipeline: GPUComputePipeline): void;
3173
- setBindGroup(
3174
- index: number,
3175
- bindGroup: GPUBindGroup | null,
3176
- dynamicOffsets?: Iterable<number>,
3177
- ): void;
3178
- dispatchWorkgroups(
3179
- workgroupCountX: number,
3180
- workgroupCountY?: number,
3181
- workgroupCountZ?: number,
3182
- ): void;
3183
- end(): void;
3184
- }
3185
- export interface GPUComputePassDescriptor {
3186
- label?: string;
3187
- timestampWrites?: GPUComputePassTimestampWrites;
3188
- }
3189
- export interface GPUQuerySet {}
3190
- export interface GPUQuerySetDescriptor {
3191
- label?: string;
3192
- }
3193
- export interface GPUComputePassTimestampWrites {
3194
- querySet: GPUQuerySet;
3195
- beginningOfPassWriteIndex?: number;
3196
- endOfPassWriteIndex?: number;
3197
- }
3198
- export interface GPUCommandBufferDescriptor {
3199
- label?: string;
3200
- }
3201
- export interface GPUCommandBuffer {}
3202
- export interface GPUQueue {
3203
- submit(commandBuffers: GPUCommandBuffer[]): void;
3204
- writeBuffer(
3205
- buffer: GPUBuffer,
3206
- bufferOffset: number | bigint,
3207
- data: ArrayBuffer | ArrayBufferView,
3208
- dataOffset?: number | bigint,
3209
- size?: number | bigint,
3210
- ): void;
3211
- }
3212
- export declare abstract class GPUMapMode {
3213
- static readonly READ: number;
3214
- static readonly WRITE: number;
3215
- }
3216
- export interface GPURequestAdapterOptions {
3217
- powerPreference: string;
3218
- forceFallbackAdapter?: boolean;
3219
- }
3220
- export interface GPUAdapterInfo {
3221
- get vendor(): string;
3222
- get architecture(): string;
3223
- get device(): string;
3224
- get description(): string;
3225
- }
3226
- export interface GPUSupportedFeatures {
3227
- has(name: string): boolean;
3228
- keys(): string[];
3229
- }
3230
- export interface GPUSupportedLimits {
3231
- get maxTextureDimension1D(): number;
3232
- get maxTextureDimension2D(): number;
3233
- get maxTextureDimension3D(): number;
3234
- get maxTextureArrayLayers(): number;
3235
- get maxBindGroups(): number;
3236
- get maxBindingsPerBindGroup(): number;
3237
- get maxDynamicUniformBuffersPerPipelineLayout(): number;
3238
- get maxDynamicStorageBuffersPerPipelineLayout(): number;
3239
- get maxSampledTexturesPerShaderStage(): number;
3240
- get maxSamplersPerShaderStage(): number;
3241
- get maxStorageBuffersPerShaderStage(): number;
3242
- get maxStorageTexturesPerShaderStage(): number;
3243
- get maxUniformBuffersPerShaderStage(): number;
3244
- get maxUniformBufferBindingSize(): number | bigint;
3245
- get maxStorageBufferBindingSize(): number | bigint;
3246
- get minUniformBufferOffsetAlignment(): number;
3247
- get minStorageBufferOffsetAlignment(): number;
3248
- get maxVertexBuffers(): number;
3249
- get maxBufferSize(): number | bigint;
3250
- get maxVertexAttributes(): number;
3251
- get maxVertexBufferArrayStride(): number;
3252
- get maxInterStageShaderComponents(): number;
3253
- get maxInterStageShaderVariables(): number;
3254
- get maxColorAttachments(): number;
3255
- get maxColorAttachmentBytesPerSample(): number;
3256
- get maxComputeWorkgroupStorageSize(): number;
3257
- get maxComputeInvocationsPerWorkgroup(): number;
3258
- get maxComputeWorkgroupSizeX(): number;
3259
- get maxComputeWorkgroupSizeY(): number;
3260
- get maxComputeWorkgroupSizeZ(): number;
3261
- get maxComputeWorkgroupsPerDimension(): number;
3262
- }
3263
- export declare abstract class GPUError {
3264
- get message(): string;
3265
- }
3266
- export declare abstract class GPUOutOfMemoryError extends GPUError {}
3267
- export declare abstract class GPUInternalError extends GPUError {}
3268
- export declare abstract class GPUValidationError extends GPUError {}
3269
- export declare abstract class GPUDeviceLostInfo {
3270
- get message(): string;
3271
- get reason(): string;
3272
- }
3273
- export interface GPUCompilationMessage {
3274
- get message(): string;
3275
- get type(): string;
3276
- get lineNum(): number;
3277
- get linePos(): number;
3278
- get offset(): number;
3279
- get length(): number;
3280
- }
3281
- export interface GPUCompilationInfo {
3282
- get messages(): GPUCompilationMessage[];
3283
- }
3284
- export declare abstract class GPUTextureUsage {
3285
- static readonly COPY_SRC: number;
3286
- static readonly COPY_DST: number;
3287
- static readonly TEXTURE_BINDING: number;
3288
- static readonly STORAGE_BINDING: number;
3289
- static readonly RENDER_ATTACHMENT: number;
3290
- }
3291
- export interface GPUTextureDescriptor {
3292
- label: string;
3293
- size: number[] | GPUExtent3DDict;
3294
- mipLevelCount?: number;
3295
- sampleCount?: number;
3296
- dimension?: string;
3297
- format: string;
3298
- usage: number;
3299
- viewFormats?: string[];
3300
- }
3301
- export interface GPUExtent3DDict {
3302
- width: number;
3303
- height?: number;
3304
- depthOrArrayLayers?: number;
3305
- }
3306
- export interface GPUTexture {
3307
- createView(descriptor?: GPUTextureViewDescriptor): GPUTextureView;
3308
- destroy(): void;
3309
- get width(): number;
3310
- get height(): number;
3311
- get depthOrArrayLayers(): number;
3312
- get mipLevelCount(): number;
3313
- get dimension(): string;
3314
- get format(): string;
3315
- get usage(): number;
3316
- }
3317
- export interface GPUTextureView {}
3318
- export interface GPUTextureViewDescriptor {
3319
- label: string;
3320
- format: string;
3321
- dimension: string;
3322
- aspect?: string;
3323
- baseMipLevel?: number;
3324
- mipLevelCount: number;
3325
- baseArrayLayer?: number;
3326
- arrayLayerCount: number;
3327
- }
3328
- export declare abstract class GPUColorWrite {
3329
- static readonly RED: number;
3330
- static readonly GREEN: number;
3331
- static readonly BLUE: number;
3332
- static readonly ALPHA: number;
3333
- static readonly ALL: number;
3334
- }
3335
- export interface GPURenderPipeline {}
3336
- export interface GPURenderPipelineDescriptor {
3337
- label?: string;
3338
- layout: string | GPUPipelineLayout;
3339
- vertex: GPUVertexState;
3340
- primitive?: GPUPrimitiveState;
3341
- depthStencil?: GPUDepthStencilState;
3342
- multisample?: GPUMultisampleState;
3343
- fragment?: GPUFragmentState;
3344
- }
3345
- export interface GPUVertexState {
3346
- module: GPUShaderModule;
3347
- entryPoint: string;
3348
- constants?: Record<string, number>;
3349
- buffers?: GPUVertexBufferLayout[];
3350
- }
3351
- export interface GPUVertexBufferLayout {
3352
- arrayStride: number | bigint;
3353
- stepMode?: string;
3354
- attributes: GPUVertexAttribute[];
3355
- }
3356
- export interface GPUVertexAttribute {
3357
- format: string;
3358
- offset: number | bigint;
3359
- shaderLocation: number;
3360
- }
3361
- export interface GPUPrimitiveState {
3362
- topology?: string;
3363
- stripIndexFormat?: string;
3364
- frontFace?: string;
3365
- cullMode?: string;
3366
- unclippedDepth?: boolean;
3367
- }
3368
- export interface GPUStencilFaceState {
3369
- compare?: string;
3370
- failOp?: string;
3371
- depthFailOp?: string;
3372
- passOp?: string;
3373
- }
3374
- export interface GPUDepthStencilState {
3375
- format: string;
3376
- depthWriteEnabled: boolean;
3377
- depthCompare: string;
3378
- stencilFront?: GPUStencilFaceState;
3379
- stencilBack?: GPUStencilFaceState;
3380
- stencilReadMask?: number;
3381
- stencilWriteMask?: number;
3382
- depthBias?: number;
3383
- depthBiasSlopeScale?: number;
3384
- depthBiasClamp?: number;
3385
- }
3386
- export interface GPUMultisampleState {
3387
- count?: number;
3388
- mask?: number;
3389
- alphaToCoverageEnabled?: boolean;
3390
- }
3391
- export interface GPUFragmentState {
3392
- module: GPUShaderModule;
3393
- entryPoint: string;
3394
- constants?: Record<string, number>;
3395
- targets: GPUColorTargetState[];
3396
- }
3397
- export interface GPUColorTargetState {
3398
- format: string;
3399
- blend: GPUBlendState;
3400
- writeMask?: number;
3401
- }
3402
- export interface GPUBlendState {
3403
- color: GPUBlendComponent;
3404
- alpha: GPUBlendComponent;
3405
- }
3406
- export interface GPUBlendComponent {
3407
- operation?: string;
3408
- srcFactor?: string;
3409
- dstFactor?: string;
3410
- }
3411
- export interface GPURenderPassEncoder {
3412
- setPipeline(pipeline: GPURenderPipeline): void;
3413
- draw(
3414
- vertexCount: number,
3415
- instanceCount?: number,
3416
- firstVertex?: number,
3417
- firstInstance?: number,
3418
- ): void;
3419
- end(): void;
3420
- }
3421
- export interface GPURenderPassDescriptor {
3422
- label?: string;
3423
- colorAttachments: GPURenderPassColorAttachment[];
3424
- depthStencilAttachment?: GPURenderPassDepthStencilAttachment;
3425
- occlusionQuerySet?: GPUQuerySet;
3426
- timestampWrites?: GPURenderPassTimestampWrites;
3427
- maxDrawCount?: number | bigint;
3428
- }
3429
- export interface GPURenderPassColorAttachment {
3430
- view: GPUTextureView;
3431
- depthSlice?: number;
3432
- resolveTarget?: GPUTextureView;
3433
- clearValue?: number[] | GPUColorDict;
3434
- loadOp: string;
3435
- storeOp: string;
3436
- }
3437
- export interface GPUColorDict {
3438
- r: number;
3439
- g: number;
3440
- b: number;
3441
- a: number;
3442
- }
3443
- export interface GPURenderPassDepthStencilAttachment {
3444
- view: GPUTextureView;
3445
- depthClearValue?: number;
3446
- depthLoadOp?: string;
3447
- depthStoreOp?: string;
3448
- depthReadOnly?: boolean;
3449
- stencilClearValue?: number;
3450
- stencilLoadOp?: string;
3451
- stencilStoreOp?: string;
3452
- stencilReadOnly?: boolean;
3453
- }
3454
- export interface GPURenderPassTimestampWrites {
3455
- querySet: GPUQuerySet;
3456
- beginningOfPassWriteIndex?: number;
3457
- endOfPassWriteIndex?: number;
3458
- }
3459
- export interface GPUImageCopyTexture {
3460
- texture: GPUTexture;
3461
- mipLevel?: number;
3462
- origin?: number[] | GPUOrigin3DDict;
3463
- aspect?: string;
3464
- }
3465
- export interface GPUImageCopyBuffer {
3466
- buffer: GPUBuffer;
3467
- offset?: number | bigint;
3468
- bytesPerRow?: number;
3469
- rowsPerImage?: number;
3470
- }
3471
- export interface GPUOrigin3DDict {
3472
- x?: number;
3473
- y?: number;
3474
- z?: number;
3475
- }
3476
2954
  /* [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */
3477
2955
  export declare class EventSource extends EventTarget {
3478
2956
  constructor(url: string, init?: EventSourceEventSourceInit);
@@ -6193,19 +5671,7 @@ export declare namespace Rpc {
6193
5671
  // serializable check as well. Otherwise, only types defined with the "type" keyword would pass.
6194
5672
  type Serializable<T> =
6195
5673
  // Structured cloneables
6196
- | void
6197
- | undefined
6198
- | null
6199
- | boolean
6200
- | number
6201
- | bigint
6202
- | string
6203
- | TypedArray
6204
- | ArrayBuffer
6205
- | DataView
6206
- | Date
6207
- | Error
6208
- | RegExp
5674
+ | BaseType
6209
5675
  // Structured cloneable composites
6210
5676
  | Map<
6211
5677
  T extends Map<infer U, unknown> ? Serializable<U> : never,
@@ -6217,11 +5683,6 @@ export declare namespace Rpc {
6217
5683
  [K in keyof T]: K extends number | string ? Serializable<T[K]> : never;
6218
5684
  }
6219
5685
  // Special types
6220
- | ReadableStream<Uint8Array>
6221
- | WritableStream<Uint8Array>
6222
- | Request
6223
- | Response
6224
- | Headers
6225
5686
  | Stub<Stubable>
6226
5687
  // Serialized as stubs, see `Stubify`
6227
5688
  | Stubable;
@@ -6232,6 +5693,26 @@ export declare namespace Rpc {
6232
5693
  dup(): this;
6233
5694
  }
6234
5695
  export type Stub<T extends Stubable> = Provider<T> & StubBase<T>;
5696
+ // This represents all the types that can be sent as-is over an RPC boundary
5697
+ type BaseType =
5698
+ | void
5699
+ | undefined
5700
+ | null
5701
+ | boolean
5702
+ | number
5703
+ | bigint
5704
+ | string
5705
+ | TypedArray
5706
+ | ArrayBuffer
5707
+ | DataView
5708
+ | Date
5709
+ | Error
5710
+ | RegExp
5711
+ | ReadableStream<Uint8Array>
5712
+ | WritableStream<Uint8Array>
5713
+ | Request
5714
+ | Response
5715
+ | Headers;
6235
5716
  // Recursively rewrite all `Stubable` types with `Stub`s
6236
5717
  type Stubify<T> = T extends Stubable
6237
5718
  ? Stub<T>
@@ -6243,13 +5724,15 @@ export declare namespace Rpc {
6243
5724
  ? Array<Stubify<V>>
6244
5725
  : T extends ReadonlyArray<infer V>
6245
5726
  ? ReadonlyArray<Stubify<V>>
6246
- : T extends {
6247
- [key: string | number]: any;
6248
- }
6249
- ? {
6250
- [K in keyof T]: Stubify<T[K]>;
6251
- }
6252
- : T;
5727
+ : T extends BaseType
5728
+ ? T
5729
+ : T extends {
5730
+ [key: string | number]: any;
5731
+ }
5732
+ ? {
5733
+ [K in keyof T]: Stubify<T[K]>;
5734
+ }
5735
+ : T;
6253
5736
  // Recursively rewrite all `Stub<T>`s with the corresponding `T`s.
6254
5737
  // Note we use `StubBase` instead of `Stub` here to avoid circular dependencies:
6255
5738
  // `Stub` depends on `Provider`, which depends on `Unstubify`, which would depend on `Stub`.
@@ -6264,13 +5747,15 @@ export declare namespace Rpc {
6264
5747
  ? Array<Unstubify<V>>
6265
5748
  : T extends ReadonlyArray<infer V>
6266
5749
  ? ReadonlyArray<Unstubify<V>>
6267
- : T extends {
6268
- [key: string | number]: unknown;
6269
- }
6270
- ? {
6271
- [K in keyof T]: Unstubify<T[K]>;
6272
- }
6273
- : T;
5750
+ : T extends BaseType
5751
+ ? T
5752
+ : T extends {
5753
+ [key: string | number]: unknown;
5754
+ }
5755
+ ? {
5756
+ [K in keyof T]: Unstubify<T[K]>;
5757
+ }
5758
+ : T;
6274
5759
  type UnstubifyAll<A extends any[]> = {
6275
5760
  [I in keyof A]: Unstubify<A[I]>;
6276
5761
  };
@@ -6897,4 +6382,14 @@ export declare abstract class WorkflowInstance {
6897
6382
  * Returns the current status of the instance.
6898
6383
  */
6899
6384
  public status(): Promise<InstanceStatus>;
6385
+ /**
6386
+ * Send an event to this instance.
6387
+ */
6388
+ public sendEvent({
6389
+ type,
6390
+ payload,
6391
+ }: {
6392
+ type: string;
6393
+ payload: unknown;
6394
+ }): Promise<void>;
6900
6395
  }
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.20250403.0",
10
+ "version": "4.20250405.0",
11
11
  "exports": {
12
12
  ".": {
13
13
  "types": "./index.d.ts",