Skip to content

Commit 2a43cdc

Browse files
cmackenzie1penalosa
andauthoredMar 20, 2025··
Support wrangler types for Pipelines (#8528)
* Support wrangler types for Pipelines Adds support for `wrangler types` command to generate the necessary types for Workers Pipelines. Closes: https://jira.cfdata.org/browse/PIPE-181 Create swift-beers-battle.md * fix type generic --------- Co-authored-by: Samuel Macleod <smacleod@cloudflare.com>
1 parent 29015e5 commit 2a43cdc

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed
 

‎.changeset/swift-beers-battle.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
Support wrangler types for Pipelines

‎packages/wrangler/src/__tests__/type-generation.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ const bindingsConfigMock: Omit<
203203
},
204204
{ type: "CompiledWasm", globs: ["**/*.wasm"], fallthrough: true },
205205
],
206-
pipelines: [],
206+
pipelines: [{ binding: "PIPELINE", pipeline: "my-pipeline" }],
207207
assets: {
208208
binding: "ASSETS_BINDING",
209209
directory: "/assets",
@@ -437,6 +437,7 @@ describe("generate types", () => {
437437
IMAGES_BINDING: ImagesBinding;
438438
VERSION_METADATA_BINDING: { id: string; tag: string };
439439
ASSETS_BINDING: Fetcher;
440+
PIPELINE: import(\\"cloudflare:pipelines\\").Pipeline<import(\\"cloudflare:pipelines\\").PipelineRecord>;
440441
}
441442
}
442443
interface Env extends Cloudflare.Env {}
@@ -525,6 +526,7 @@ describe("generate types", () => {
525526
IMAGES_BINDING: ImagesBinding;
526527
VERSION_METADATA_BINDING: { id: string; tag: string };
527528
ASSETS_BINDING: Fetcher;
529+
PIPELINE: import(\\"cloudflare:pipelines\\").Pipeline<import(\\"cloudflare:pipelines\\").PipelineRecord>;
528530
}
529531
}
530532
interface Env extends Cloudflare.Env {}

‎packages/wrangler/src/type-generation/index.ts

+10
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ export async function generateEnvTypes(
294294
secrets,
295295
assets: config.assets,
296296
workflows: config.workflows,
297+
pipelines: config.pipelines,
297298
};
298299

299300
const entrypointFormat = entrypoint?.format ?? "modules";
@@ -511,6 +512,15 @@ export async function generateEnvTypes(
511512
}
512513
}
513514

515+
if (configToDTS.pipelines) {
516+
for (const pipeline of configToDTS.pipelines) {
517+
envTypeStructure.push([
518+
constructTypeKey(pipeline.binding),
519+
`import("cloudflare:pipelines").Pipeline<import("cloudflare:pipelines").PipelineRecord>`,
520+
]);
521+
}
522+
}
523+
514524
const modulesTypeStructure: string[] = [];
515525
if (configToDTS.rules) {
516526
const moduleTypeMap = {

0 commit comments

Comments
 (0)
Please sign in to comment.