runline 0.2.1 → 0.2.2
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.
- package/dist/plugins/actionNetwork/src/index.js +118 -25
- package/dist/plugins/activeCampaign/src/index.js +184 -38
- package/dist/plugins/adalo/src/index.js +40 -8
- package/dist/plugins/affinity/src/index.js +100 -20
- package/dist/plugins/agileCrm/src/index.js +115 -27
- package/dist/plugins/airtable/src/index.js +94 -19
- package/dist/plugins/airtop/src/index.js +266 -62
- package/dist/plugins/apiTemplateIo/src/index.js +25 -5
- package/dist/plugins/asana/src/index.js +195 -41
- package/dist/plugins/autopilot/src/index.js +39 -8
- package/dist/plugins/bambooHr/src/index.js +109 -22
- package/dist/plugins/bannerbear/src/index.js +36 -8
- package/dist/plugins/baserow/src/index.js +35 -7
- package/dist/plugins/beeminder/src/index.js +198 -40
- package/dist/plugins/bitly/src/index.js +46 -10
- package/dist/plugins/bitwarden/src/index.js +167 -36
- package/dist/plugins/box/src/index.js +172 -37
- package/dist/plugins/brandfetch/src/index.js +5 -1
- package/dist/plugins/brevo/src/index.js +136 -29
- package/dist/plugins/bubble/src/index.js +76 -17
- package/dist/plugins/chargebee/src/index.js +35 -7
- package/dist/plugins/circleci/src/index.js +50 -10
- package/dist/plugins/ciscoWebex/src/index.js +131 -27
- package/dist/plugins/clearbit/src/index.js +76 -17
- package/dist/plugins/clickup/src/index.js +500 -107
- package/dist/plugins/clockify/src/index.js +229 -47
- package/dist/plugins/cloudflare/src/index.js +28 -6
- package/dist/plugins/cockpit/src/index.js +54 -12
- package/dist/plugins/coda/src/index.js +81 -19
- package/dist/plugins/coingecko/src/index.js +157 -33
- package/dist/plugins/contentful/src/index.js +85 -17
- package/dist/plugins/convertkit/src/index.js +74 -18
- package/dist/plugins/copper/src/index.js +59 -11
- package/dist/plugins/cortex/src/index.js +55 -13
- package/dist/plugins/currents/src/index.js +310 -71
- package/dist/plugins/customerIo/src/index.js +112 -23
- package/dist/plugins/databricks/src/index.js +549 -115
- package/dist/plugins/deepl/src/index.js +26 -6
- package/dist/plugins/demio/src/index.js +56 -11
- package/dist/plugins/dhl/src/index.js +16 -3
- package/dist/plugins/discord/src/index.js +141 -31
- package/dist/plugins/discourse/src/index.js +136 -31
- package/dist/plugins/disqus/src/index.js +96 -20
- package/dist/plugins/docker/src/index.js +20 -4
- package/dist/plugins/drift/src/index.js +19 -5
- package/dist/plugins/dropbox/src/index.js +139 -30
- package/dist/plugins/dropcontact/src/index.js +21 -4
- package/dist/plugins/egoi/src/index.js +61 -15
- package/dist/plugins/elasticsearch/src/index.js +59 -13
- package/dist/plugins/emelia/src/index.js +95 -19
- package/dist/plugins/erpnext/src/index.js +74 -15
- package/dist/plugins/facebookGraph/src/index.js +52 -11
- package/dist/plugins/freshdesk/src/index.js +220 -48
- package/dist/plugins/freshservice/src/index.js +39 -9
- package/dist/plugins/freshworksCrm/src/index.js +58 -12
- package/dist/plugins/getresponse/src/index.js +87 -18
- package/dist/plugins/ghost/src/index.js +114 -26
- package/dist/plugins/github/src/index.js +483 -109
- package/dist/plugins/gitlab/src/index.js +193 -45
- package/dist/plugins/gong/src/index.js +68 -14
- package/dist/plugins/gotify/src/index.js +43 -9
- package/dist/plugins/gotowebinar/src/index.js +233 -47
- package/dist/plugins/grafana/src/index.js +92 -21
- package/dist/plugins/graphql/src/index.js +38 -8
- package/dist/plugins/grist/src/index.js +52 -10
- package/dist/plugins/hackernews/src/index.js +32 -6
- package/dist/plugins/halopsa/src/index.js +131 -26
- package/dist/plugins/harvest/src/index.js +182 -42
- package/dist/plugins/helpscout/src/index.js +153 -31
- package/dist/plugins/highlevel/src/index.js +291 -58
- package/dist/plugins/homeAssistant/src/index.js +124 -26
- package/dist/plugins/hubspot/src/index.js +163 -29
- package/dist/plugins/humanticAi/src/index.js +54 -5
- package/dist/plugins/hunter/src/index.js +21 -4
- package/dist/plugins/intercom/src/index.js +95 -20
- package/dist/plugins/iterable/src/index.js +96 -20
- package/dist/plugins/jenkins/src/index.js +75 -17
- package/dist/plugins/jira/src/index.js +193 -43
- package/dist/plugins/keap/src/index.js +222 -56
- package/dist/plugins/kobotoolbox/src/index.js +113 -25
- package/dist/plugins/lemlist/src/index.js +79 -18
- package/dist/plugins/linear/src/index.js +86 -19
- package/dist/plugins/lingvanex/src/index.js +38 -8
- package/dist/plugins/linkedin/src/index.js +37 -8
- package/dist/plugins/lonescale/src/index.js +41 -9
- package/dist/plugins/magento/src/index.js +98 -27
- package/dist/plugins/mailcheck/src/index.js +11 -2
- package/dist/plugins/mailchimp/src/index.js +193 -42
- package/dist/plugins/mailerlite/src/index.js +61 -12
- package/dist/plugins/mailgun/src/index.js +39 -7
- package/dist/plugins/mailjet/src/index.js +141 -30
- package/dist/plugins/mandrill/src/index.js +67 -14
- package/dist/plugins/marketstack/src/index.js +56 -10
- package/dist/plugins/matrix/src/index.js +97 -20
- package/dist/plugins/mattermost/src/index.js +124 -26
- package/dist/plugins/mautic/src/index.js +129 -26
- package/dist/plugins/medium/src/index.js +64 -13
- package/dist/plugins/messagebird/src/index.js +80 -15
- package/dist/plugins/metabase/src/index.js +57 -12
- package/dist/plugins/misp/src/index.js +135 -33
- package/dist/plugins/mocean/src/index.js +33 -7
- package/dist/plugins/monday/src/index.js +97 -23
- package/dist/plugins/monicaCrm/src/index.js +112 -23
- package/dist/plugins/msg91/src/index.js +11 -2
- package/dist/plugins/nasa/src/index.js +108 -21
- package/dist/plugins/netlify/src/index.js +28 -6
- package/dist/plugins/netscalerAdc/src/index.js +144 -29
- package/dist/plugins/nextcloud/src/index.js +103 -20
- package/dist/plugins/nocodb/src/index.js +57 -11
- package/dist/plugins/notion/src/index.js +148 -37
- package/dist/plugins/npm/src/index.js +59 -12
- package/dist/plugins/odoo/src/index.js +102 -20
- package/dist/plugins/okta/src/index.js +50 -10
- package/dist/plugins/oneSimpleApi/src/index.js +84 -17
- package/dist/plugins/onfleet/src/index.js +139 -32
- package/dist/plugins/openThesaurus/src/index.js +46 -9
- package/dist/plugins/openweathermap/src/index.js +31 -6
- package/dist/plugins/oura/src/index.js +36 -7
- package/dist/plugins/paddle/src/index.js +80 -17
- package/dist/plugins/pagerduty/src/index.js +53 -12
- package/dist/plugins/paypal/src/index.js +51 -11
- package/dist/plugins/peekalink/src/index.js +12 -3
- package/dist/plugins/phantombuster/src/index.js +39 -8
- package/dist/plugins/philipsHue/src/index.js +64 -13
- package/dist/plugins/pipedrive/src/index.js +167 -45
- package/dist/plugins/plivo/src/index.js +43 -8
- package/dist/plugins/postbin/src/index.js +9 -2
- package/dist/plugins/posthog/src/index.js +50 -13
- package/dist/plugins/profitwell/src/index.js +24 -5
- package/dist/plugins/pushbullet/src/index.js +45 -9
- package/dist/plugins/pushcut/src/index.js +31 -6
- package/dist/plugins/pushover/src/index.js +51 -10
- package/dist/plugins/quickbase/src/index.js +66 -13
- package/dist/plugins/quickbooks/src/index.js +86 -19
- package/dist/plugins/quickchart/src/index.js +35 -7
- package/dist/plugins/raindrop/src/index.js +54 -13
- package/dist/plugins/reddit/src/index.js +73 -18
- package/dist/plugins/rocketchat/src/index.js +47 -9
- package/dist/plugins/rundeck/src/index.js +26 -5
- package/dist/plugins/salesforce/src/index.js +161 -31
- package/dist/plugins/salesmate/src/index.js +75 -16
- package/dist/plugins/securityScorecard/src/index.js +73 -15
- package/dist/plugins/segment/src/index.js +21 -4
- package/dist/plugins/sendgrid/src/index.js +102 -24
- package/dist/plugins/sendy/src/index.js +54 -11
- package/dist/plugins/sentry/src/index.js +174 -34
- package/dist/plugins/servicenow/src/index.js +120 -27
- package/dist/plugins/shopify/src/index.js +53 -12
- package/dist/plugins/signl4/src/index.js +16 -3
- package/dist/plugins/slack/src/index.js +407 -105
- package/dist/plugins/sms77/src/index.js +26 -5
- package/dist/plugins/splunk/src/index.js +186 -45
- package/dist/plugins/spotify/src/index.js +265 -66
- package/dist/plugins/stackby/src/index.js +18 -6
- package/dist/plugins/storyblok/src/index.js +57 -11
- package/dist/plugins/strapi/src/index.js +63 -12
- package/dist/plugins/strava/src/index.js +58 -13
- package/dist/plugins/stripe/src/index.js +143 -30
- package/dist/plugins/supabase/src/index.js +49 -10
- package/dist/plugins/syncromsp/src/index.js +245 -67
- package/dist/plugins/tapfiliate/src/index.js +57 -14
- package/dist/plugins/telegram/src/index.js +202 -39
- package/dist/plugins/thehive/src/index.js +271 -66
- package/dist/plugins/thehiveProject/src/index.js +457 -89
- package/dist/plugins/todoist/src/index.js +326 -77
- package/dist/plugins/travisci/src/index.js +35 -8
- package/dist/plugins/trello/src/index.js +204 -46
- package/dist/plugins/twake/src/index.js +10 -2
- package/dist/plugins/twilio/src/index.js +56 -11
- package/dist/plugins/twist/src/index.js +241 -48
- package/dist/plugins/twitter/src/index.js +128 -30
- package/dist/plugins/unleashedSoftware/src/index.js +30 -6
- package/dist/plugins/uplead/src/index.js +9 -2
- package/dist/plugins/uproc/src/index.js +31 -6
- package/dist/plugins/uptimerobot/src/index.js +119 -25
- package/dist/plugins/urlscanio/src/index.js +25 -6
- package/dist/plugins/vero/src/index.js +68 -13
- package/dist/plugins/vonage/src/index.js +32 -6
- package/dist/plugins/wekan/src/index.js +297 -52
- package/dist/plugins/woocommerce/src/index.js +57 -12
- package/dist/plugins/wordpress/src/index.js +94 -18
- package/dist/plugins/xero/src/index.js +79 -13
- package/dist/plugins/yourls/src/index.js +33 -6
- package/dist/plugins/zammad/src/index.js +139 -36
- package/dist/plugins/zendesk/src/index.js +201 -48
- package/dist/plugins/zoho/src/index.js +88 -21
- package/dist/plugins/zoom/src/index.js +41 -7
- package/dist/plugins/zulip/src/index.js +101 -20
- package/package.json +1 -1
|
@@ -41,7 +41,13 @@ async function apiRequest(conn, method, endpoint, body, qs) {
|
|
|
41
41
|
url.searchParams.set(k, String(v));
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
const init = {
|
|
44
|
+
const init = {
|
|
45
|
+
method,
|
|
46
|
+
headers: {
|
|
47
|
+
Authorization: `Bearer ${token}`,
|
|
48
|
+
"Content-Type": "application/json",
|
|
49
|
+
},
|
|
50
|
+
};
|
|
45
51
|
if (body && Object.keys(body).length > 0)
|
|
46
52
|
init.body = JSON.stringify(body);
|
|
47
53
|
const res = await fetch(url.toString(), init);
|
|
@@ -54,22 +60,53 @@ export default function strapi(rl) {
|
|
|
54
60
|
rl.setName("strapi");
|
|
55
61
|
rl.setVersion("0.1.0");
|
|
56
62
|
rl.setConnectionSchema({
|
|
57
|
-
url: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
url: {
|
|
64
|
+
type: "string",
|
|
65
|
+
required: true,
|
|
66
|
+
description: "Strapi base URL",
|
|
67
|
+
env: "STRAPI_URL",
|
|
68
|
+
},
|
|
69
|
+
apiVersion: {
|
|
70
|
+
type: "string",
|
|
71
|
+
required: false,
|
|
72
|
+
description: "v3 or v4 (default: v4)",
|
|
73
|
+
env: "STRAPI_API_VERSION",
|
|
74
|
+
},
|
|
75
|
+
apiToken: {
|
|
76
|
+
type: "string",
|
|
77
|
+
required: false,
|
|
78
|
+
description: "Strapi API token (preferred)",
|
|
79
|
+
env: "STRAPI_API_TOKEN",
|
|
80
|
+
},
|
|
81
|
+
email: {
|
|
82
|
+
type: "string",
|
|
83
|
+
required: false,
|
|
84
|
+
description: "Email for password auth",
|
|
85
|
+
env: "STRAPI_EMAIL",
|
|
86
|
+
},
|
|
87
|
+
password: {
|
|
88
|
+
type: "string",
|
|
89
|
+
required: false,
|
|
90
|
+
description: "Password for password auth",
|
|
91
|
+
env: "STRAPI_PASSWORD",
|
|
92
|
+
},
|
|
62
93
|
});
|
|
63
94
|
rl.registerAction("entry.create", {
|
|
64
95
|
description: "Create an entry in a content type",
|
|
65
96
|
inputSchema: {
|
|
66
|
-
contentType: {
|
|
97
|
+
contentType: {
|
|
98
|
+
type: "string",
|
|
99
|
+
required: true,
|
|
100
|
+
description: "Content type plural name (e.g. articles)",
|
|
101
|
+
},
|
|
67
102
|
data: { type: "object", required: true, description: "Entry fields" },
|
|
68
103
|
},
|
|
69
104
|
async execute(input, ctx) {
|
|
70
105
|
const conn = getConn(ctx);
|
|
71
106
|
const p = input;
|
|
72
|
-
const body = conn.apiVersion === "v4"
|
|
107
|
+
const body = conn.apiVersion === "v4"
|
|
108
|
+
? { data: p.data }
|
|
109
|
+
: p.data;
|
|
73
110
|
return apiRequest(conn, "POST", `/${p.contentType}`, body);
|
|
74
111
|
},
|
|
75
112
|
});
|
|
@@ -91,9 +128,21 @@ export default function strapi(rl) {
|
|
|
91
128
|
inputSchema: {
|
|
92
129
|
contentType: { type: "string", required: true },
|
|
93
130
|
limit: { type: "number", required: false },
|
|
94
|
-
sort: {
|
|
95
|
-
|
|
96
|
-
|
|
131
|
+
sort: {
|
|
132
|
+
type: "string",
|
|
133
|
+
required: false,
|
|
134
|
+
description: "Comma-separated sort fields",
|
|
135
|
+
},
|
|
136
|
+
filters: {
|
|
137
|
+
type: "string",
|
|
138
|
+
required: false,
|
|
139
|
+
description: "JSON filter object",
|
|
140
|
+
},
|
|
141
|
+
publicationState: {
|
|
142
|
+
type: "string",
|
|
143
|
+
required: false,
|
|
144
|
+
description: "live or preview",
|
|
145
|
+
},
|
|
97
146
|
},
|
|
98
147
|
async execute(input, ctx) {
|
|
99
148
|
const conn = getConn(ctx);
|
|
@@ -132,7 +181,9 @@ export default function strapi(rl) {
|
|
|
132
181
|
async execute(input, ctx) {
|
|
133
182
|
const conn = getConn(ctx);
|
|
134
183
|
const p = input;
|
|
135
|
-
const body = conn.apiVersion === "v4"
|
|
184
|
+
const body = conn.apiVersion === "v4"
|
|
185
|
+
? { data: p.data }
|
|
186
|
+
: p.data;
|
|
136
187
|
const result = (await apiRequest(conn, "PUT", `/${p.contentType}/${p.entryId}`, body));
|
|
137
188
|
return conn.apiVersion === "v4" ? result.data : result;
|
|
138
189
|
},
|
|
@@ -7,7 +7,10 @@ async function apiRequest(token, method, endpoint, body, qs) {
|
|
|
7
7
|
url.searchParams.set(k, String(v));
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
const init = {
|
|
10
|
+
const init = {
|
|
11
|
+
method,
|
|
12
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
13
|
+
};
|
|
11
14
|
if (body && Object.keys(body).length > 0) {
|
|
12
15
|
const form = new URLSearchParams();
|
|
13
16
|
for (const [k, v] of Object.entries(body)) {
|
|
@@ -15,7 +18,8 @@ async function apiRequest(token, method, endpoint, body, qs) {
|
|
|
15
18
|
form.set(k, String(v));
|
|
16
19
|
}
|
|
17
20
|
init.body = form;
|
|
18
|
-
init.headers["Content-Type"] =
|
|
21
|
+
init.headers["Content-Type"] =
|
|
22
|
+
"application/x-www-form-urlencoded";
|
|
19
23
|
}
|
|
20
24
|
const res = await fetch(url.toString(), init);
|
|
21
25
|
if (!res.ok)
|
|
@@ -26,25 +30,47 @@ export default function strava(rl) {
|
|
|
26
30
|
rl.setName("strava");
|
|
27
31
|
rl.setVersion("0.1.0");
|
|
28
32
|
rl.setConnectionSchema({
|
|
29
|
-
accessToken: {
|
|
33
|
+
accessToken: {
|
|
34
|
+
type: "string",
|
|
35
|
+
required: true,
|
|
36
|
+
description: "Strava OAuth2 access token",
|
|
37
|
+
env: "STRAVA_ACCESS_TOKEN",
|
|
38
|
+
},
|
|
30
39
|
});
|
|
31
40
|
const key = (ctx) => ctx.connection.config.accessToken;
|
|
32
41
|
rl.registerAction("activity.create", {
|
|
33
42
|
description: "Create an activity",
|
|
34
43
|
inputSchema: {
|
|
35
44
|
name: { type: "string", required: true },
|
|
36
|
-
sportType: {
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
sportType: {
|
|
46
|
+
type: "string",
|
|
47
|
+
required: true,
|
|
48
|
+
description: "e.g. Run, Ride, Swim, Hike",
|
|
49
|
+
},
|
|
50
|
+
startDateLocal: {
|
|
51
|
+
type: "string",
|
|
52
|
+
required: true,
|
|
53
|
+
description: "ISO 8601 start time",
|
|
54
|
+
},
|
|
55
|
+
elapsedTime: {
|
|
56
|
+
type: "number",
|
|
57
|
+
required: true,
|
|
58
|
+
description: "Duration in seconds",
|
|
59
|
+
},
|
|
39
60
|
description: { type: "string", required: false },
|
|
40
|
-
distance: {
|
|
61
|
+
distance: {
|
|
62
|
+
type: "number",
|
|
63
|
+
required: false,
|
|
64
|
+
description: "Distance in meters",
|
|
65
|
+
},
|
|
41
66
|
trainer: { type: "boolean", required: false },
|
|
42
67
|
commute: { type: "boolean", required: false },
|
|
43
68
|
},
|
|
44
69
|
async execute(input, ctx) {
|
|
45
70
|
const p = input;
|
|
46
71
|
const body = {
|
|
47
|
-
name: p.name,
|
|
72
|
+
name: p.name,
|
|
73
|
+
sport_type: p.sportType,
|
|
48
74
|
start_date_local: new Date(p.startDateLocal).toISOString(),
|
|
49
75
|
elapsed_time: p.elapsedTime,
|
|
50
76
|
};
|
|
@@ -107,13 +133,28 @@ export default function strava(rl) {
|
|
|
107
133
|
});
|
|
108
134
|
for (const sub of [
|
|
109
135
|
{ name: "getLaps", path: "laps", description: "Get laps for an activity" },
|
|
110
|
-
{
|
|
111
|
-
|
|
112
|
-
|
|
136
|
+
{
|
|
137
|
+
name: "getZones",
|
|
138
|
+
path: "zones",
|
|
139
|
+
description: "Get zones for an activity",
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "getKudos",
|
|
143
|
+
path: "kudos",
|
|
144
|
+
description: "Get kudos for an activity",
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "getComments",
|
|
148
|
+
path: "comments",
|
|
149
|
+
description: "Get comments for an activity",
|
|
150
|
+
},
|
|
113
151
|
]) {
|
|
114
152
|
rl.registerAction(`activity.${sub.name}`, {
|
|
115
153
|
description: sub.description,
|
|
116
|
-
inputSchema: {
|
|
154
|
+
inputSchema: {
|
|
155
|
+
activityId: { type: "string", required: true },
|
|
156
|
+
limit: { type: "number", required: false },
|
|
157
|
+
},
|
|
117
158
|
async execute(input, ctx) {
|
|
118
159
|
const p = input;
|
|
119
160
|
const data = (await apiRequest(key(ctx), "GET", `/activities/${p.activityId}/${sub.path}`));
|
|
@@ -127,7 +168,11 @@ export default function strava(rl) {
|
|
|
127
168
|
description: "Get activity streams (time-series data)",
|
|
128
169
|
inputSchema: {
|
|
129
170
|
activityId: { type: "string", required: true },
|
|
130
|
-
keys: {
|
|
171
|
+
keys: {
|
|
172
|
+
type: "string",
|
|
173
|
+
required: true,
|
|
174
|
+
description: "Comma-separated stream types: time, distance, latlng, altitude, heartrate, cadence, watts, temp, moving, grade_smooth",
|
|
175
|
+
},
|
|
131
176
|
},
|
|
132
177
|
async execute(input, ctx) {
|
|
133
178
|
const p = input;
|
|
@@ -7,13 +7,19 @@ async function apiRequest(secretKey, method, endpoint, body, qs) {
|
|
|
7
7
|
url.searchParams.set(k, String(v));
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
const init = {
|
|
10
|
+
const init = {
|
|
11
|
+
method,
|
|
12
|
+
headers: { Authorization: `Bearer ${secretKey}` },
|
|
13
|
+
};
|
|
11
14
|
if (body && Object.keys(body).length > 0) {
|
|
12
15
|
const form = new URLSearchParams();
|
|
13
16
|
function flatten(obj, prefix = "") {
|
|
14
17
|
for (const [k, v] of Object.entries(obj)) {
|
|
15
18
|
const key = prefix ? `${prefix}[${k}]` : k;
|
|
16
|
-
if (v !== null &&
|
|
19
|
+
if (v !== null &&
|
|
20
|
+
v !== undefined &&
|
|
21
|
+
typeof v === "object" &&
|
|
22
|
+
!Array.isArray(v)) {
|
|
17
23
|
flatten(v, key);
|
|
18
24
|
}
|
|
19
25
|
else if (v !== null && v !== undefined) {
|
|
@@ -23,7 +29,8 @@ async function apiRequest(secretKey, method, endpoint, body, qs) {
|
|
|
23
29
|
}
|
|
24
30
|
flatten(body);
|
|
25
31
|
init.body = form;
|
|
26
|
-
init.headers["Content-Type"] =
|
|
32
|
+
init.headers["Content-Type"] =
|
|
33
|
+
"application/x-www-form-urlencoded";
|
|
27
34
|
}
|
|
28
35
|
const res = await fetch(url.toString(), init);
|
|
29
36
|
if (!res.ok)
|
|
@@ -33,28 +40,49 @@ async function apiRequest(secretKey, method, endpoint, body, qs) {
|
|
|
33
40
|
export default function stripe(rl) {
|
|
34
41
|
rl.setName("stripe");
|
|
35
42
|
rl.setVersion("0.1.0");
|
|
36
|
-
rl.setConnectionSchema({
|
|
43
|
+
rl.setConnectionSchema({
|
|
44
|
+
secretKey: {
|
|
45
|
+
type: "string",
|
|
46
|
+
required: true,
|
|
47
|
+
description: "Stripe secret API key",
|
|
48
|
+
env: "STRIPE_SECRET_KEY",
|
|
49
|
+
},
|
|
50
|
+
});
|
|
37
51
|
const key = (ctx) => ctx.connection.config.secretKey;
|
|
38
52
|
// ── Balance ─────────────────────────────────────────
|
|
39
53
|
rl.registerAction("balance.get", {
|
|
40
54
|
description: "Get current balance",
|
|
41
55
|
inputSchema: {},
|
|
42
|
-
async execute(_input, ctx) {
|
|
56
|
+
async execute(_input, ctx) {
|
|
57
|
+
return apiRequest(key(ctx), "GET", "/balance");
|
|
58
|
+
},
|
|
43
59
|
});
|
|
44
60
|
// ── Customer ────────────────────────────────────────
|
|
45
61
|
rl.registerAction("customer.create", {
|
|
46
62
|
description: "Create a customer",
|
|
47
|
-
inputSchema: {
|
|
48
|
-
|
|
63
|
+
inputSchema: {
|
|
64
|
+
name: { type: "string", required: true },
|
|
65
|
+
email: { type: "string", required: false },
|
|
66
|
+
phone: { type: "string", required: false },
|
|
67
|
+
description: { type: "string", required: false },
|
|
68
|
+
},
|
|
69
|
+
async execute(input, ctx) {
|
|
70
|
+
return apiRequest(key(ctx), "POST", "/customers", input);
|
|
71
|
+
},
|
|
49
72
|
});
|
|
50
73
|
rl.registerAction("customer.get", {
|
|
51
74
|
description: "Get a customer by ID",
|
|
52
75
|
inputSchema: { customerId: { type: "string", required: true } },
|
|
53
|
-
async execute(input, ctx) {
|
|
76
|
+
async execute(input, ctx) {
|
|
77
|
+
return apiRequest(key(ctx), "GET", `/customers/${input.customerId}`);
|
|
78
|
+
},
|
|
54
79
|
});
|
|
55
80
|
rl.registerAction("customer.list", {
|
|
56
81
|
description: "List customers",
|
|
57
|
-
inputSchema: {
|
|
82
|
+
inputSchema: {
|
|
83
|
+
limit: { type: "number", required: false },
|
|
84
|
+
email: { type: "string", required: false },
|
|
85
|
+
},
|
|
58
86
|
async execute(input, ctx) {
|
|
59
87
|
const p = (input ?? {});
|
|
60
88
|
const qs = {};
|
|
@@ -68,7 +96,13 @@ export default function stripe(rl) {
|
|
|
68
96
|
});
|
|
69
97
|
rl.registerAction("customer.update", {
|
|
70
98
|
description: "Update a customer",
|
|
71
|
-
inputSchema: {
|
|
99
|
+
inputSchema: {
|
|
100
|
+
customerId: { type: "string", required: true },
|
|
101
|
+
name: { type: "string", required: false },
|
|
102
|
+
email: { type: "string", required: false },
|
|
103
|
+
phone: { type: "string", required: false },
|
|
104
|
+
description: { type: "string", required: false },
|
|
105
|
+
},
|
|
72
106
|
async execute(input, ctx) {
|
|
73
107
|
const { customerId, ...fields } = input;
|
|
74
108
|
return apiRequest(key(ctx), "POST", `/customers/${customerId}`, fields);
|
|
@@ -77,24 +111,38 @@ export default function stripe(rl) {
|
|
|
77
111
|
rl.registerAction("customer.delete", {
|
|
78
112
|
description: "Delete a customer",
|
|
79
113
|
inputSchema: { customerId: { type: "string", required: true } },
|
|
80
|
-
async execute(input, ctx) {
|
|
114
|
+
async execute(input, ctx) {
|
|
115
|
+
return apiRequest(key(ctx), "DELETE", `/customers/${input.customerId}`);
|
|
116
|
+
},
|
|
81
117
|
});
|
|
82
118
|
// ── Charge ──────────────────────────────────────────
|
|
83
119
|
rl.registerAction("charge.create", {
|
|
84
120
|
description: "Create a charge",
|
|
85
121
|
inputSchema: {
|
|
86
|
-
amount: {
|
|
122
|
+
amount: {
|
|
123
|
+
type: "number",
|
|
124
|
+
required: true,
|
|
125
|
+
description: "Amount in smallest currency unit (e.g. cents)",
|
|
126
|
+
},
|
|
87
127
|
currency: { type: "string", required: true },
|
|
88
|
-
source: {
|
|
128
|
+
source: {
|
|
129
|
+
type: "string",
|
|
130
|
+
required: true,
|
|
131
|
+
description: "Payment source token or ID",
|
|
132
|
+
},
|
|
89
133
|
customer: { type: "string", required: false },
|
|
90
134
|
description: { type: "string", required: false },
|
|
91
135
|
},
|
|
92
|
-
async execute(input, ctx) {
|
|
136
|
+
async execute(input, ctx) {
|
|
137
|
+
return apiRequest(key(ctx), "POST", "/charges", input);
|
|
138
|
+
},
|
|
93
139
|
});
|
|
94
140
|
rl.registerAction("charge.get", {
|
|
95
141
|
description: "Get a charge by ID",
|
|
96
142
|
inputSchema: { chargeId: { type: "string", required: true } },
|
|
97
|
-
async execute(input, ctx) {
|
|
143
|
+
async execute(input, ctx) {
|
|
144
|
+
return apiRequest(key(ctx), "GET", `/charges/${input.chargeId}`);
|
|
145
|
+
},
|
|
98
146
|
});
|
|
99
147
|
rl.registerAction("charge.list", {
|
|
100
148
|
description: "List charges",
|
|
@@ -109,7 +157,10 @@ export default function stripe(rl) {
|
|
|
109
157
|
});
|
|
110
158
|
rl.registerAction("charge.update", {
|
|
111
159
|
description: "Update a charge",
|
|
112
|
-
inputSchema: {
|
|
160
|
+
inputSchema: {
|
|
161
|
+
chargeId: { type: "string", required: true },
|
|
162
|
+
description: { type: "string", required: false },
|
|
163
|
+
},
|
|
113
164
|
async execute(input, ctx) {
|
|
114
165
|
const { chargeId, ...fields } = input;
|
|
115
166
|
return apiRequest(key(ctx), "POST", `/charges/${chargeId}`, fields);
|
|
@@ -119,9 +170,17 @@ export default function stripe(rl) {
|
|
|
119
170
|
rl.registerAction("coupon.create", {
|
|
120
171
|
description: "Create a coupon",
|
|
121
172
|
inputSchema: {
|
|
122
|
-
duration: {
|
|
173
|
+
duration: {
|
|
174
|
+
type: "string",
|
|
175
|
+
required: true,
|
|
176
|
+
description: "forever, once, or repeating",
|
|
177
|
+
},
|
|
123
178
|
percentOff: { type: "number", required: false },
|
|
124
|
-
amountOff: {
|
|
179
|
+
amountOff: {
|
|
180
|
+
type: "number",
|
|
181
|
+
required: false,
|
|
182
|
+
description: "In smallest currency unit",
|
|
183
|
+
},
|
|
125
184
|
currency: { type: "string", required: false },
|
|
126
185
|
},
|
|
127
186
|
async execute(input, ctx) {
|
|
@@ -150,7 +209,14 @@ export default function stripe(rl) {
|
|
|
150
209
|
// ── Customer Card ───────────────────────────────────
|
|
151
210
|
rl.registerAction("customerCard.add", {
|
|
152
211
|
description: "Add a card to a customer",
|
|
153
|
-
inputSchema: {
|
|
212
|
+
inputSchema: {
|
|
213
|
+
customerId: { type: "string", required: true },
|
|
214
|
+
token: {
|
|
215
|
+
type: "string",
|
|
216
|
+
required: true,
|
|
217
|
+
description: "Card token from Stripe.js/Elements",
|
|
218
|
+
},
|
|
219
|
+
},
|
|
154
220
|
async execute(input, ctx) {
|
|
155
221
|
const p = input;
|
|
156
222
|
return apiRequest(key(ctx), "POST", `/customers/${p.customerId}/sources`, { source: p.token });
|
|
@@ -158,7 +224,10 @@ export default function stripe(rl) {
|
|
|
158
224
|
});
|
|
159
225
|
rl.registerAction("customerCard.get", {
|
|
160
226
|
description: "Get a customer's card/source",
|
|
161
|
-
inputSchema: {
|
|
227
|
+
inputSchema: {
|
|
228
|
+
customerId: { type: "string", required: true },
|
|
229
|
+
sourceId: { type: "string", required: true },
|
|
230
|
+
},
|
|
162
231
|
async execute(input, ctx) {
|
|
163
232
|
const p = input;
|
|
164
233
|
return apiRequest(key(ctx), "GET", `/customers/${p.customerId}/sources/${p.sourceId}`);
|
|
@@ -166,7 +235,10 @@ export default function stripe(rl) {
|
|
|
166
235
|
});
|
|
167
236
|
rl.registerAction("customerCard.remove", {
|
|
168
237
|
description: "Remove a card from a customer",
|
|
169
|
-
inputSchema: {
|
|
238
|
+
inputSchema: {
|
|
239
|
+
customerId: { type: "string", required: true },
|
|
240
|
+
cardId: { type: "string", required: true },
|
|
241
|
+
},
|
|
170
242
|
async execute(input, ctx) {
|
|
171
243
|
const p = input;
|
|
172
244
|
return apiRequest(key(ctx), "DELETE", `/customers/${p.customerId}/sources/${p.cardId}`);
|
|
@@ -175,22 +247,38 @@ export default function stripe(rl) {
|
|
|
175
247
|
// ── Source ──────────────────────────────────────────
|
|
176
248
|
rl.registerAction("source.create", {
|
|
177
249
|
description: "Create a source and attach to customer",
|
|
178
|
-
inputSchema: {
|
|
250
|
+
inputSchema: {
|
|
251
|
+
customerId: { type: "string", required: true },
|
|
252
|
+
type: { type: "string", required: true },
|
|
253
|
+
amount: { type: "number", required: true },
|
|
254
|
+
currency: { type: "string", required: true },
|
|
255
|
+
},
|
|
179
256
|
async execute(input, ctx) {
|
|
180
257
|
const p = input;
|
|
181
|
-
const source = (await apiRequest(key(ctx), "POST", "/sources", {
|
|
182
|
-
|
|
258
|
+
const source = (await apiRequest(key(ctx), "POST", "/sources", {
|
|
259
|
+
type: p.type,
|
|
260
|
+
amount: p.amount,
|
|
261
|
+
currency: p.currency,
|
|
262
|
+
}));
|
|
263
|
+
await apiRequest(key(ctx), "POST", `/customers/${p.customerId}/sources`, {
|
|
264
|
+
source: source.id,
|
|
265
|
+
});
|
|
183
266
|
return source;
|
|
184
267
|
},
|
|
185
268
|
});
|
|
186
269
|
rl.registerAction("source.get", {
|
|
187
270
|
description: "Get a source by ID",
|
|
188
271
|
inputSchema: { sourceId: { type: "string", required: true } },
|
|
189
|
-
async execute(input, ctx) {
|
|
272
|
+
async execute(input, ctx) {
|
|
273
|
+
return apiRequest(key(ctx), "GET", `/sources/${input.sourceId}`);
|
|
274
|
+
},
|
|
190
275
|
});
|
|
191
276
|
rl.registerAction("source.delete", {
|
|
192
277
|
description: "Detach a source from a customer",
|
|
193
|
-
inputSchema: {
|
|
278
|
+
inputSchema: {
|
|
279
|
+
customerId: { type: "string", required: true },
|
|
280
|
+
sourceId: { type: "string", required: true },
|
|
281
|
+
},
|
|
194
282
|
async execute(input, ctx) {
|
|
195
283
|
const p = input;
|
|
196
284
|
return apiRequest(key(ctx), "DELETE", `/customers/${p.customerId}/sources/${p.sourceId}`);
|
|
@@ -199,19 +287,44 @@ export default function stripe(rl) {
|
|
|
199
287
|
// ── Token ───────────────────────────────────────────
|
|
200
288
|
rl.registerAction("token.createCard", {
|
|
201
289
|
description: "Create a card token",
|
|
202
|
-
inputSchema: {
|
|
290
|
+
inputSchema: {
|
|
291
|
+
number: { type: "string", required: true },
|
|
292
|
+
expMonth: { type: "number", required: true },
|
|
293
|
+
expYear: { type: "number", required: true },
|
|
294
|
+
cvc: { type: "string", required: true },
|
|
295
|
+
},
|
|
203
296
|
async execute(input, ctx) {
|
|
204
297
|
const p = input;
|
|
205
|
-
return apiRequest(key(ctx), "POST", "/tokens", {
|
|
298
|
+
return apiRequest(key(ctx), "POST", "/tokens", {
|
|
299
|
+
card: {
|
|
300
|
+
number: p.number,
|
|
301
|
+
exp_month: p.expMonth,
|
|
302
|
+
exp_year: p.expYear,
|
|
303
|
+
cvc: p.cvc,
|
|
304
|
+
},
|
|
305
|
+
});
|
|
206
306
|
},
|
|
207
307
|
});
|
|
208
308
|
// ── Meter Event ─────────────────────────────────────
|
|
209
309
|
rl.registerAction("meterEvent.create", {
|
|
210
310
|
description: "Create a billing meter event",
|
|
211
|
-
inputSchema: {
|
|
311
|
+
inputSchema: {
|
|
312
|
+
eventName: { type: "string", required: true },
|
|
313
|
+
customerId: { type: "string", required: true },
|
|
314
|
+
value: { type: "number", required: true },
|
|
315
|
+
identifier: { type: "string", required: false },
|
|
316
|
+
timestamp: {
|
|
317
|
+
type: "string",
|
|
318
|
+
required: false,
|
|
319
|
+
description: "ISO datetime",
|
|
320
|
+
},
|
|
321
|
+
},
|
|
212
322
|
async execute(input, ctx) {
|
|
213
323
|
const p = input;
|
|
214
|
-
const body = {
|
|
324
|
+
const body = {
|
|
325
|
+
event_name: p.eventName,
|
|
326
|
+
payload: { stripe_customer_id: p.customerId, value: p.value },
|
|
327
|
+
};
|
|
215
328
|
if (p.identifier)
|
|
216
329
|
body.identifier = p.identifier;
|
|
217
330
|
if (p.timestamp)
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
function getConn(ctx) {
|
|
2
2
|
const c = ctx.connection.config;
|
|
3
|
-
return {
|
|
3
|
+
return {
|
|
4
|
+
host: c.host.replace(/\/$/, ""),
|
|
5
|
+
serviceRole: c.serviceRole,
|
|
6
|
+
};
|
|
4
7
|
}
|
|
5
8
|
async function apiRequest(conn, method, endpoint, body, qs, extraHeaders) {
|
|
6
9
|
const url = new URL(`${conn.host}/rest/v1${endpoint}`);
|
|
@@ -30,15 +33,33 @@ export default function supabase(rl) {
|
|
|
30
33
|
rl.setName("supabase");
|
|
31
34
|
rl.setVersion("0.1.0");
|
|
32
35
|
rl.setConnectionSchema({
|
|
33
|
-
host: {
|
|
34
|
-
|
|
36
|
+
host: {
|
|
37
|
+
type: "string",
|
|
38
|
+
required: true,
|
|
39
|
+
description: "Supabase project URL (e.g. https://xxx.supabase.co)",
|
|
40
|
+
env: "SUPABASE_URL",
|
|
41
|
+
},
|
|
42
|
+
serviceRole: {
|
|
43
|
+
type: "string",
|
|
44
|
+
required: true,
|
|
45
|
+
description: "Supabase service_role key",
|
|
46
|
+
env: "SUPABASE_SERVICE_ROLE_KEY",
|
|
47
|
+
},
|
|
35
48
|
});
|
|
36
49
|
rl.registerAction("row.create", {
|
|
37
50
|
description: "Insert rows into a table",
|
|
38
51
|
inputSchema: {
|
|
39
52
|
table: { type: "string", required: true },
|
|
40
|
-
data: {
|
|
41
|
-
|
|
53
|
+
data: {
|
|
54
|
+
type: "object",
|
|
55
|
+
required: true,
|
|
56
|
+
description: "Row data (or array of rows)",
|
|
57
|
+
},
|
|
58
|
+
schema: {
|
|
59
|
+
type: "string",
|
|
60
|
+
required: false,
|
|
61
|
+
description: "Database schema (default: public)",
|
|
62
|
+
},
|
|
42
63
|
},
|
|
43
64
|
async execute(input, ctx) {
|
|
44
65
|
const conn = getConn(ctx);
|
|
@@ -53,7 +74,11 @@ export default function supabase(rl) {
|
|
|
53
74
|
description: "Get rows by filter (PostgREST query params)",
|
|
54
75
|
inputSchema: {
|
|
55
76
|
table: { type: "string", required: true },
|
|
56
|
-
filters: {
|
|
77
|
+
filters: {
|
|
78
|
+
type: "object",
|
|
79
|
+
required: true,
|
|
80
|
+
description: "PostgREST filters, e.g. { id: 'eq.5' }",
|
|
81
|
+
},
|
|
57
82
|
schema: { type: "string", required: false },
|
|
58
83
|
},
|
|
59
84
|
async execute(input, ctx) {
|
|
@@ -70,13 +95,19 @@ export default function supabase(rl) {
|
|
|
70
95
|
inputSchema: {
|
|
71
96
|
table: { type: "string", required: true },
|
|
72
97
|
limit: { type: "number", required: false },
|
|
73
|
-
filters: {
|
|
98
|
+
filters: {
|
|
99
|
+
type: "object",
|
|
100
|
+
required: false,
|
|
101
|
+
description: "PostgREST filters",
|
|
102
|
+
},
|
|
74
103
|
schema: { type: "string", required: false },
|
|
75
104
|
},
|
|
76
105
|
async execute(input, ctx) {
|
|
77
106
|
const conn = getConn(ctx);
|
|
78
107
|
const p = (input ?? {});
|
|
79
|
-
const qs = {
|
|
108
|
+
const qs = {
|
|
109
|
+
...(p.filters ?? {}),
|
|
110
|
+
};
|
|
80
111
|
if (p.limit)
|
|
81
112
|
qs.limit = p.limit;
|
|
82
113
|
const headers = {};
|
|
@@ -90,7 +121,11 @@ export default function supabase(rl) {
|
|
|
90
121
|
inputSchema: {
|
|
91
122
|
table: { type: "string", required: true },
|
|
92
123
|
data: { type: "object", required: true, description: "Fields to update" },
|
|
93
|
-
filters: {
|
|
124
|
+
filters: {
|
|
125
|
+
type: "object",
|
|
126
|
+
required: true,
|
|
127
|
+
description: "PostgREST filters to match rows",
|
|
128
|
+
},
|
|
94
129
|
schema: { type: "string", required: false },
|
|
95
130
|
},
|
|
96
131
|
async execute(input, ctx) {
|
|
@@ -106,7 +141,11 @@ export default function supabase(rl) {
|
|
|
106
141
|
description: "Delete rows matching a filter",
|
|
107
142
|
inputSchema: {
|
|
108
143
|
table: { type: "string", required: true },
|
|
109
|
-
filters: {
|
|
144
|
+
filters: {
|
|
145
|
+
type: "object",
|
|
146
|
+
required: true,
|
|
147
|
+
description: "PostgREST filters to match rows",
|
|
148
|
+
},
|
|
110
149
|
schema: { type: "string", required: false },
|
|
111
150
|
},
|
|
112
151
|
async execute(input, ctx) {
|