Skip to content

Commit 55335fe

Browse files
committed
Merge branch 'master' into fix/update_apify
# Conflicts: # pnpm-lock.yaml
2 parents 0fb0d00 + 9f30f8b commit 55335fe

File tree

1,950 files changed

+63497
-6896
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,950 files changed

+63497
-6896
lines changed

.github/workflows/pull-request-checks.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ jobs:
9696
format: 'csv'
9797
# NOTE: These steps are kept in this workflow to avoid re-rerunning the rest of the lint job
9898
# in the Components Checks workflow
99+
- name: Build TypeScript Components
100+
run: pnpm build
99101
- name: Check component keys
100102
run: node scripts/findBadKeys.js ${{ steps.changed_files.outputs.added_modified }} ${{ steps.changed_files.outputs.renamed }}
101103
- name: Check component app prop

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ components/**/package-lock.json
2020
/packages/sdk/examples/.next/
2121

2222
**/.claude/settings.local.json
23+
24+
.cursor

components/_2markdown/_2markdown.app.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export default {
66
propDefinitions: {
77
filePath: {
88
type: "string",
9-
label: "File Path",
10-
description: "The path to an HTML file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)",
9+
label: "File Path or URL",
10+
description: "An HTML file. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.html`)",
1111
},
1212
},
1313
methods: {

components/_2markdown/actions/html-file-to-markdown/html-file-to-markdown.mjs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import _2markdown from "../../_2markdown.app.mjs";
2-
import fs from "fs";
2+
import { getFileStreamAndMetadata } from "@pipedream/platform";
33
import FormData from "form-data";
44

55
export default {
66
key: "_2markdown-html-file-to-markdown",
77
name: "HTML File to Markdown",
88
description: "Convert an HTML file to Markdown format. [See the documentation](https://2markdown.com/docs#file2md)",
9-
version: "0.0.1",
9+
version: "0.1.0",
1010
type: "action",
1111
props: {
1212
_2markdown,
@@ -20,9 +20,14 @@ export default {
2020
async run({ $ }) {
2121
const form = new FormData();
2222

23-
form.append("document", fs.createReadStream(this.filePath.includes("tmp/")
24-
? this.filePath
25-
: `/tmp/${this.filePath}`));
23+
const {
24+
stream, metadata,
25+
} = await getFileStreamAndMetadata(this.filePath);
26+
form.append("document", stream, {
27+
contentType: metadata.contentType,
28+
knownLength: metadata.size,
29+
filename: metadata.name,
30+
});
2631

2732
const response = await this._2markdown.htmlFileToMarkdown({
2833
$,

components/_2markdown/actions/pdf-to-markdown/pdf-to-markdown.mjs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import _2markdown from "../../_2markdown.app.mjs";
2-
import fs from "fs";
2+
import { getFileStreamAndMetadata } from "@pipedream/platform";
33
import FormData from "form-data";
44

55
export default {
66
key: "_2markdown-pdf-to-markdown",
77
name: "PDF to Markdown",
88
description: "Convert a PDF document to Markdown format. [See the documentation](https://2markdown.com/docs#pdf2md)",
9-
version: "0.0.1",
9+
version: "0.1.0",
1010
type: "action",
1111
props: {
1212
_2markdown,
@@ -15,7 +15,7 @@ export default {
1515
_2markdown,
1616
"filePath",
1717
],
18-
description: "The path to a PDF file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)",
18+
description: "A PDF file. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.pdf`)",
1919
},
2020
waitForCompletion: {
2121
type: "boolean",
@@ -27,9 +27,14 @@ export default {
2727
async run({ $ }) {
2828
const form = new FormData();
2929

30-
form.append("document", fs.createReadStream(this.filePath.includes("tmp/")
31-
? this.filePath
32-
: `/tmp/${this.filePath}`));
30+
const {
31+
stream, metadata,
32+
} = await getFileStreamAndMetadata(this.filePath);
33+
form.append("document", stream, {
34+
contentType: metadata.contentType,
35+
knownLength: metadata.size,
36+
filename: metadata.name,
37+
});
3338

3439
let response = await this._2markdown.pdfToMarkdown({
3540
$,

components/_2markdown/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/_2markdown",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Pipedream 2markdown Components",
55
"main": "_2markdown.app.mjs",
66
"keywords": [
@@ -13,7 +13,7 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^3.0.3",
16+
"@pipedream/platform": "^3.1.0",
1717
"form-data": "^4.0.1"
1818
}
1919
}
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
import { defineApp } from "@pipedream/types";
2-
3-
export default defineApp({
1+
export default {
42
type: "app",
5-
app: "scalr",
3+
app: "action1",
64
propDefinitions: {},
75
methods: {
86
// this.$auth contains connected account data
97
authKeys() {
108
console.log(Object.keys(this.$auth));
119
},
1210
},
13-
});
11+
};

components/action1/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@pipedream/action1",
3+
"version": "0.0.1",
4+
"description": "Pipedream Action1 Components",
5+
"main": "action1.app.mjs",
6+
"keywords": [
7+
"pipedream",
8+
"action1"
9+
],
10+
"homepage": "https://pipedream.com/apps/action1",
11+
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
12+
"publishConfig": {
13+
"access": "public"
14+
}
15+
}

components/acuity_scheduling/actions/add-blocked-off-time/add-blocked-off-time.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "acuity_scheduling-add-blocked-off-time",
55
name: "Add Blocked Off Time",
66
description: "Blocks a specific time slot on your schedule to prevent the scheduling of any appointments during this particular time range. [See the documentation](https://developers.acuityscheduling.com/reference/post-blocks)",
7-
version: "0.0.1",
7+
version: "0.0.2",
88
type: "action",
99
props: {
1010
acuityScheduling,
Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
import acuityScheduling from "../../acuity_scheduling.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "acuity_scheduling-book-appointment",
6+
name: "Book Appointment",
7+
description: "Book an appointment. [See the documentation](https://developers.acuityscheduling.com/reference/post-appointments)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
acuityScheduling,
12+
datetime: {
13+
type: "string",
14+
label: "Datetime",
15+
description: "Date and time of the appointment. E.g. `2016-02-03T14:00:00-0800`",
16+
},
17+
appointmentTypeId: {
18+
propDefinition: [
19+
acuityScheduling,
20+
"appointmentTypeId",
21+
],
22+
description: "The type of appointment to book",
23+
},
24+
firstName: {
25+
type: "string",
26+
label: "First Name",
27+
description: "First name of the client",
28+
},
29+
lastName: {
30+
type: "string",
31+
label: "Last Name",
32+
description: "Last name of the client",
33+
},
34+
isAdmin: {
35+
type: "boolean",
36+
label: "Is Admin",
37+
description: "By default appointments are created as if they are being booked by a client. Booking as an admin disables availability and attribute validations, and allows setting the notes attribute. This also requires a valid `calendarID` to be included in the request.",
38+
optional: true,
39+
},
40+
email: {
41+
type: "string",
42+
label: "Email",
43+
description: "Email address of the client",
44+
optional: true,
45+
},
46+
calendarId: {
47+
propDefinition: [
48+
acuityScheduling,
49+
"calendarId",
50+
],
51+
description: "The calendar to book the appointment on. If not provided we'll try to find an available calendar automatically.",
52+
optional: true,
53+
},
54+
phone: {
55+
type: "string",
56+
label: "Phone",
57+
description: "Phone number of the client",
58+
optional: true,
59+
},
60+
timezone: {
61+
propDefinition: [
62+
acuityScheduling,
63+
"timezone",
64+
],
65+
},
66+
certificate: {
67+
propDefinition: [
68+
acuityScheduling,
69+
"certificate",
70+
(c) => ({
71+
appointmentTypeId: c.appointmentTypeId,
72+
}),
73+
],
74+
optional: true,
75+
},
76+
notes: {
77+
type: "string",
78+
label: "Notes",
79+
description: "Notes to be added to the appointment. Settable when booking as an admin.",
80+
optional: true,
81+
},
82+
labelId: {
83+
propDefinition: [
84+
acuityScheduling,
85+
"labelId",
86+
],
87+
optional: true,
88+
},
89+
smsOptin: {
90+
type: "boolean",
91+
label: "SMS Opt-in",
92+
description: "Indicates whether the client has explicitly given their permission to receive SMS messages. This parameter is only applicable to Appointments with an Appointment Type that requires Opt In and can be omitted (and will be ignored) for all other Appointments. If omitted or set to false on an applicable Appointment, an SMS reminder will not be sent. For more information on SMS Opt In settings for Appointment Types, see the article in our [Knowledge Base](https://support.squarespace.com/hc/en-us/articles/360040093611).",
93+
optional: true,
94+
},
95+
formId: {
96+
propDefinition: [
97+
acuityScheduling,
98+
"formId",
99+
],
100+
optional: true,
101+
reloadProps: true,
102+
},
103+
},
104+
async additionalProps() {
105+
const props = {};
106+
if (!this.formId) {
107+
return props;
108+
}
109+
const forms = await this.acuityScheduling.listForms();
110+
const form = forms.find((f) => f.id === this.formId);
111+
const { fields } = form;
112+
for (const field of fields) {
113+
props[`${field.id}`] = {
114+
type: "string",
115+
label: field.name,
116+
};
117+
if (field.options) {
118+
props[`${field.id}`].options = field.options;
119+
}
120+
}
121+
return props;
122+
},
123+
async run({ $ }) {
124+
const {
125+
acuityScheduling,
126+
datetime,
127+
appointmentTypeId,
128+
firstName,
129+
lastName,
130+
isAdmin,
131+
email,
132+
calendarId,
133+
phone,
134+
timezone,
135+
certificate,
136+
notes,
137+
labelId,
138+
smsOptin,
139+
formId,
140+
...fieldValues
141+
} = this;
142+
143+
if (isAdmin && !calendarId) {
144+
throw new ConfigurationError("`calendarID` is required when booking as an admin");
145+
}
146+
147+
if (!isAdmin && !email) {
148+
throw new ConfigurationError("`email` is required when booking as a client");
149+
}
150+
151+
if (!isAdmin && notes) {
152+
throw new ConfigurationError("`notes` is only available when booking as an admin");
153+
}
154+
155+
if (formId && !appointmentTypeId) {
156+
throw new ConfigurationError("`formId` is required when booking an appointment with a form");
157+
}
158+
159+
const fields = [];
160+
if (Object.keys(fieldValues).length > 0) {
161+
for (const [
162+
fieldId,
163+
value,
164+
] of Object.entries(fieldValues)) {
165+
fields.push({
166+
id: fieldId,
167+
value,
168+
});
169+
}
170+
}
171+
172+
const response = await acuityScheduling.createAppointment({
173+
$,
174+
params: {
175+
admin: isAdmin,
176+
},
177+
data: {
178+
datetime,
179+
appointmentTypeID: appointmentTypeId,
180+
firstName,
181+
lastName,
182+
email,
183+
calendarID: calendarId,
184+
phone,
185+
timezone,
186+
certificate,
187+
notes,
188+
labels: labelId
189+
? [
190+
{
191+
id: labelId,
192+
},
193+
]
194+
: undefined,
195+
smsOptin,
196+
fields,
197+
},
198+
});
199+
$.export("$summary", `Successfully booked appointment with ID: ${response.id}`);
200+
return response;
201+
},
202+
};

0 commit comments

Comments
 (0)