Open dylburger opened 5 years ago
Likewise
Bumping 😃
Hello @todsac, any plans for getting this prioritized?
@hhimanshu this isn't on the immediate roadmap, but we hear you and plan to add support for other languages like TypeScript in the future!
For anyone looking to get Typescript support - you can get it by compiling your TS into a commonjs module, then uploading that to pipedream via cli. Something like this:
// myAction.ts
export default {
name: "GBucket - Upload File",
description: "Uploads a file to a GBucket route",
key: "myGBucketUploader",
version: "1.0.0",
type: "action",
props: {
googleCloud: { // passed in app object https://pipedream.com/docs/apps/all-apps/#apps
type: "app",
app: "google_cloud",
},
webhookTrigger: { // passed in param https://pipedream.com/docs/workflows/steps/params/#entering-expressions
type: "object",
},
},
async run() {
// access your passed in variables, which can come from a previous code step
const { myData } = (this as any).webhookTrigger.object;
// access your auth passed in from apps
const { Storage } = require("@google-cloud/storage");
const key = JSON.parse((this as any).googleCloud.$auth.key_json);
const storage = new Storage({
projectId: key.project_id,
credentials: {
client_email: key.client_email,
private_key: key.private_key,
},
});
await storage.upload(myData)
}
}
// rollup.config.js (or webpack.config.js)
const configAction = {
input: "src/actions/myAction.ts",
output: {
file: "lib/actions/myAction.js",
format: "cjs",
sourcemap: true,
exports: "default",
},
plugins: [
commonjs(), // enable CommonJS modules
nodePolyfills(), // enable NodeJS polyfills
resolve({ preferBuiltins: true, browser: true }), // enable importing from node_modules
typescript(), // enable TypeScript
json(), // enable JSON
globals(), // allows globals to be imported (process.env)
builtins(), // allows builtins to be imported via require/import
],
};
echo "Deploying Pipedream..."
yarn build
NODE_ENV=production pd publish ./lib/actions/myAction.js
Which will end up looking like re-useable action this in the Pipedream UI.
Typescript. Yes please.
Powered by Deno and able to define the type that the code block will receive would be 🎉
Is there any news on this? It's been almost a year and the only other resource I can find is https://pipedream.com/docs/components/typescript which is a start but there's not a lot of movement: https://github.com/PipedreamHQ/pipedream/commits/master/types/src/index.ts ?
For anyone interested in using Parcel for their build, here is a sample configuration: https://gist.github.com/joscha/bd630f90adaa0cb1ce2f9c4714ba3d7a
I'd like to author TypeScript code steps on Pipedream, similar to how I can choose to "Run Node.js code" today.