Gathering detailed insights and metrics for @js07/pd-convert-actions
Gathering detailed insights and metrics for @js07/pd-convert-actions
Gathering detailed insights and metrics for @js07/pd-convert-actions
Gathering detailed insights and metrics for @js07/pd-convert-actions
npm install @js07/pd-convert-actions
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
1 Stars
85 Commits
2 Watchers
4 Branches
3 Contributors
Updated on May 09, 2025
Latest Version
0.7.4
Package Id
@js07/pd-convert-actions@0.7.4
Unpacked Size
169.99 kB
Size
43.39 kB
File Count
63
NPM Version
8.19.2
Node Version
16.18.0
Published on
Aug 03, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
23
3
Clone repo
git clone https://github.com/js07/pd-convert-actions.git
Install dependencies
cd pd-convert-actions
npm install
Run CLI
1$ node bin/cli.js ./test/data/actions.csv 2? Output as separate javascript files or a single CSV file? JavaScript 3? Path to components directory to write files to ./test/output 4? Wrap the component with `defineComponent()`? No 5? Generate labels for component props without labels? No 6? Convert generated component to ESM? (Y/n)
USAGE
$ bin/cli.js FILE
ARGUMENTS
FILE csv file containing legacy action configs
OPTIONS
--outputType=js/csv Output actions as a csv file or js files
--out CSV output path
--componentsDirPath Path to components directory to write js files
--defineComponent Wrap the component with defineComponent()
--createLabel Generate labels for component props without labels
--[no-]toEsm Convert generated component to ESM (default: Yes)
--appPlaceholder App name slug to use if legacy code is authless
--addPlaceholderAppProp Add an appPlaceholder app prop if no apps are found
Install
npm install @js07/pd-convert-actions
Convert action
1const convert = require("@js07/pd-convert-actions"); 2const actionConfig = { 3 code: "raw legacy action code;", 4 title: "Title/Name of the action", 5 description: "Description of the action", 6 namespace: "component_slug", 7 codeConfig: "{ params_schema: { ... } }", 8 versionMajor: "0", 9 versionMinor: "2", 10 hashId: "a_67imr8" 11}; 12const { 13 code, 14 appSlug, 15 componentSlug, 16} = await convert(actionConfig);
Config
version: "<MAJOR>.<MINOR>.1"
auths.<app_name_slug>
-> app_name_slug (defaults to app_placeholder
)Code
this.$checkpoint = "value
-> let stepCheckpoint = await this.db.get("scp_${uid}"); try { stepCheckpoint = "value" } finally { await this.db.set("scp_${uid}", stepCheckpoint) }
(+ data_store
prop)$checkpoint = "value
-> let $checkpoint = await this.db.get("$checkpoint"); try { $checkpoint = "value" } finally { await this.db.set("$checkpint", $checkpoint) }
(+ data_store
prop)$send
-> $.send
$respond
-> $.respond
$end
-> $.flow.exit
this.name = "value"
-> let name; try { name = "value" } finally { $.export("name", name) }
params
-> this
auths.app_name
-> this.app_name.$auth
(+ app_name
prop)$attachments
-> steps.trigger.context.attachments
event
-> steps.trigger.event
require("@pipedreamhq/platform")
-> require("@pipedream/platform")
.axios(this,
-> .axios($,
Fixes
const axios = require("axios")
'
The examples directory contains examples of converted actions, in addition to the ones below. Action config can be found in actions.csv.
segment-track
Before
1return await require("@pipedreamhq/platform").axios(this, { 2 method: 'post', 3 url: `https://api.segment.io/v1/track`, 4 auth: { 5 username: auths.segment.write_key, 6 }, 7 data: { 8 anonymousId: params.anonymousId, 9 context: params.context, 10 event: params.event, 11 integrations: params.integrations, 12 properties: params.properties, 13 timestamp: params.timestamp, 14 userId: params.userId, 15 }, 16})
After
1// legacy_hash_id: a_2wim5R 2import { axios } from "@pipedream/platform"; 3 4export default { 5 key: "segment-track", 6 name: "Track actions your users perform", 7 description: "Track lets you record the actions your users perform (note requires userId or anonymousId)", 8 version: "0.3.1", 9 type: "action", 10 props: { 11 segment: { 12 type: "app", 13 app: "segment", 14 }, 15 anonymousId: { 16 type: "string", 17 description: "A pseudo-unique substitute for a User ID, for cases when you don't have an absolutely unique identifier. A userId or an anonymousId is required.", 18 optional: true, 19 }, 20 context: { 21 type: "object", 22 description: "Dictionary of extra information that provides useful context about a message, but is not directly related to the API call like ip address or locale", 23 optional: true, 24 }, 25 event: { 26 type: "string", 27 description: "Name of the action that a user has performed.", 28 }, 29 integrations: { 30 type: "object", 31 description: "Dictionary of destinations to either enable or disable", 32 optional: true, 33 }, 34 properties: { 35 type: "object", 36 description: "Free-form dictionary of properties of the event, like revenue", 37 optional: true, 38 }, 39 timestamp: { 40 type: "string", 41 description: "ISO-8601 date string", 42 optional: true, 43 }, 44 userId: { 45 type: "string", 46 description: "Unique identifier for the user in your database. A userId or an anonymousId is required.", 47 optional: true, 48 }, 49 }, 50 async run({ $ }) { 51 return await axios($, { 52 method: "post", 53 url: "https://api.segment.io/v1/track", 54 auth: { 55 username: this.segment.$auth.write_key, 56 }, 57 data: { 58 anonymousId: this.anonymousId, 59 context: this.context, 60 event: this.event, 61 integrations: this.integrations, 62 properties: this.properties, 63 timestamp: this.timestamp, 64 userId: this.userId, 65 }, 66 }); 67 }, 68};
mailchimp-add_or_update_subscriber
Before
1const axios = require('axios') 2 3list_id = params.list_id 4subscriber_hash = params.subscriber_hash 5skip_merge_validation = params.skip_merge_validation 6 7return await require("@pipedreamhq/platform").axios(this, { 8 url: `https://${auths.mailchimp.dc}.api.mailchimp.com/3.0/lists/${list_id}/members/${subscriber_hash}?skip_merge_validation=${skip_merge_validation}`, 9 headers: { 10 Authorization: `Bearer ${auths.mailchimp.oauth_access_token}`, 11 }, 12 method: 'PUT', 13 data: { 14 "email_address": params.email_address, 15 "status_if_new": params.statu_if_new, 16 "email_type": params.email_type, 17 "status": params.status, 18 "merge_fields": params.merge_fields, 19 "interests": params.interests, 20 "language": params.language, 21 "vip": params.vip, 22 "location": { 23 "latitude": params.latitude, 24 "longitude": params.longitude 25 }, 26 "marketing_permissions": [{ 27 "marketing_permission_id": params.marketing_permission_id, 28 "enabled": params.marketing_permissions_enabled 29 }], 30 "ip_signup": params.ip_signup, 31 "timestamp_signup": params.timestamp_signup, 32 "ip_opt": params.ip_opt, 33 "timestamp_opt": params.timestamp_opt 34 } 35})
After
1// legacy_hash_id: a_RAiaJ1 2import { axios } from "@pipedream/platform"; 3 4export default { 5 key: "mailchimp-add-or-update-subscriber", 6 name: "Add or Update Subscriber", 7 description: "Adds a new subscriber to an audience or updates existing subscriber.", 8 version: "0.2.1", 9 type: "action", 10 props: { 11 mailchimp: { 12 type: "app", 13 app: "mailchimp", 14 }, 15 list_id: { 16 type: "string", 17 description: "The unique ID for the list.", 18 }, 19 subscriber_hash: { 20 type: "string", 21 description: "The MD5 hash of the lowercase version of the list member's email address.", 22 }, 23 skip_merge_validation: { 24 type: "boolean", 25 description: "If skip_merge_validation is true, member data will be accepted without merge field values, even if the merge field is usually required. This defaults to False.", 26 optional: true, 27 }, 28 email_address: { 29 type: "string", 30 description: "Email address for a subscriber. This value is required only if the email address is not already present on the list.", 31 }, 32 statu_if_new: { 33 type: "string", 34 description: "Subscriber's status. This value is required only if the email address is not already present on the list.", 35 options: [ 36 "subscribed", 37 "unsubscribed", 38 "cleaned", 39 "pending", 40 "transactional", 41 ], 42 }, 43 email_type: { 44 type: "string", 45 description: "Type of email this member asked to get ('html' or 'text').", 46 optional: true, 47 options: [ 48 "html", 49 "text", 50 ], 51 }, 52 status: { 53 type: "string", 54 description: "Subscriber's current status.", 55 optional: true, 56 options: [ 57 "subscribed", 58 "unsubscribed", 59 "cleaned", 60 "pending", 61 "transactional", 62 ], 63 }, 64 merge_fields: { 65 type: "object", 66 description: "An individual merge var and value for a member.", 67 optional: true, 68 }, 69 interests: { 70 type: "object", 71 description: "The key of this object's properties is the ID of the interest in question.", 72 optional: true, 73 }, 74 language: { 75 type: "string", 76 description: "If set/detected, the subscriber's language.", 77 optional: true, 78 }, 79 vip: { 80 type: "boolean", 81 description: "VIP status for subscriber.", 82 optional: true, 83 }, 84 latitude: { 85 type: "integer", 86 description: "The location latitude.", 87 optional: true, 88 }, 89 longitude: { 90 type: "integer", 91 description: "The location longitude.", 92 optional: true, 93 }, 94 marketing_permission_id: { 95 type: "string", 96 description: "The id for the marketing permission on the list.", 97 optional: true, 98 }, 99 marketing_permissions_enabled: { 100 type: "boolean", 101 description: "If the subscriber has opted-in to the marketing permission.", 102 optional: true, 103 }, 104 ip_signup: { 105 type: "string", 106 description: "IP address the subscriber signed up from.", 107 optional: true, 108 }, 109 timestamp_signup: { 110 type: "string", 111 description: "The date and time the subscriber signed up for the list in ISO 8601 format.", 112 optional: true, 113 }, 114 ip_opt: { 115 type: "string", 116 description: "The IP address the subscriber used to confirm their opt-in status.", 117 optional: true, 118 }, 119 timestamp_opt: { 120 type: "string", 121 description: "The date and time the subscriber confirmed their opt-in status in ISO 8601 format.", 122 optional: true, 123 }, 124 }, 125 async run({ $ }) { 126 let listId = this.list_id; 127 let subscriberHash = this.subscriber_hash; 128 let skipMergeValidation = this.skip_merge_validation; 129 130 return await axios($, { 131 url: `https://${this.mailchimp.$auth.dc}.api.mailchimp.com/3.0/lists/${listId}/members/${subscriberHash}?skip_merge_validation=${skipMergeValidation}`, 132 headers: { 133 Authorization: `Bearer ${this.mailchimp.$auth.oauth_access_token}`, 134 }, 135 method: "PUT", 136 data: { 137 "email_address": this.email_address, 138 "status_if_new": this.statu_if_new, 139 "email_type": this.email_type, 140 "status": this.status, 141 "merge_fields": this.merge_fields, 142 "interests": this.interests, 143 "language": this.language, 144 "vip": this.vip, 145 "location": { 146 "latitude": this.latitude, 147 "longitude": this.longitude, 148 }, 149 "marketing_permissions": [ 150 { 151 "marketing_permission_id": this.marketing_permission_id, 152 "enabled": this.marketing_permissions_enabled, 153 }, 154 ], 155 "ip_signup": this.ip_signup, 156 "timestamp_signup": this.timestamp_signup, 157 "ip_opt": this.ip_opt, 158 "timestamp_opt": this.timestamp_opt, 159 }, 160 }); 161 }, 162};
No vulnerabilities found.
No security vulnerabilities found.