Skip to content

Commit 97b06f0

Browse files
authored
Merge branch 'master' into issue-13445
2 parents 97cad93 + d4900ad commit 97b06f0

File tree

112 files changed

+1419
-309
lines changed

Some content is hidden

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

112 files changed

+1419
-309
lines changed

components/aircall/actions/create-contact/create-contact.mjs

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,64 @@ import common from "../common/common-create-update.mjs";
33
export default {
44
...common,
55
name: "Create Contact",
6-
description: "Create a contact in Aircall. [See the documentation](https://developer.aircall.io/api-references/#create-a-contact)",
6+
description:
7+
"Create a contact in Aircall. [See the documentation](https://developer.aircall.io/api-references/#create-a-contact)",
78
key: "aircall-create-contact",
8-
version: "0.0.1",
9+
version: "0.0.2",
910
type: "action",
1011
props: {
1112
...common.props,
1213
emails: {
1314
type: "string[]",
1415
label: "Emails",
15-
description: "Array of email address objects (max 20). Each should contain `label` and `value`. If a string is provided, it will be used as both the label and value.",
16+
description:
17+
"Array of email address objects (max 20). Each should contain `label` and `value`. If a string is provided, it will be used as both the label and value. For example, `{{ [{\"label\": \"Work\", \"value\": \"[email protected]\"}] }}`, or `{{ [\"[email protected]\"] }}`",
1618
optional: true,
1719
},
1820
phoneNumbers: {
1921
type: "string[]",
2022
label: "Phone Numbers",
21-
description: "Array of phone number objects (max 20). Each should contain `label` and `value`. If a string is provided, it will be used as both the label and value.",
23+
description:
24+
"Array of phone number objects (max 20). Each should contain `label` and `value`. If a string is provided, it will be used as both the label and value. For example, `{{ [{\"label\": \"Work\", \"value\": \"+1 812-641-5139\"}] }}`, or `{{ [\"+1 812-641-5139\"] }}`",
2225
},
2326
},
2427
async run({ $ }) {
28+
const refinedPhoneNumbers = (this.phoneNumbers || []).map((item) => {
29+
if (typeof item === "object" && item !== null) {
30+
return item;
31+
}
32+
33+
return {
34+
label: item,
35+
value: item,
36+
};
37+
});
38+
const refinedEmails = (this.emails || []).map((item) => {
39+
if (typeof item === "object" && item !== null) {
40+
return item;
41+
}
42+
43+
return {
44+
label: item,
45+
value: item,
46+
};
47+
});
48+
2549
const data = {
2650
...this.getCommonData(),
27-
emails: this.emails,
28-
phone_numbers: this.phoneNumbers,
51+
emails: refinedEmails,
52+
phone_numbers: refinedPhoneNumbers,
2953
};
54+
3055
const response = await this.aircall.createContact({
3156
$,
3257
data,
3358
});
3459

35-
$.export("$summary", `Successfully created contact (ID: ${response?.contact?.id})`);
60+
$.export(
61+
"$summary",
62+
`Successfully created contact (ID: ${response?.contact?.id})`,
63+
);
3664

3765
return response;
3866
},

components/aircall/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/aircall",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Pipedream Aircall Components",
55
"main": "aircall.app.mjs",
66
"keywords": [

components/airtable_oauth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/airtable_oauth",
3-
"version": "0.4.1",
3+
"version": "0.4.2",
44
"description": "Pipedream Airtable (OAuth) Components",
55
"main": "airtable_oauth.app.mjs",
66
"keywords": [

components/airtable_oauth/sources/common/common.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,12 @@ export default {
4242
const formattedTimestamp = new Date(timestampMillis).toISOString();
4343
this._setLastTimestamp(formattedTimestamp);
4444
},
45+
getListRecordsParams(params) {
46+
return {
47+
filterByFormula: `LAST_MODIFIED_TIME() > "${this._getLastTimestamp()}"`,
48+
returnFieldsByFieldId: this.returnFieldsByFieldId || false,
49+
...params,
50+
};
51+
},
4552
},
4653
};

components/airtable_oauth/sources/new-modified-or-deleted-records/new-modified-or-deleted-records.mjs

Lines changed: 39 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
name: "New, Modified or Deleted Records",
77
description: "Emit new event each time a record is added, updated, or deleted in an Airtable table. Supports tables up to 10,000 records",
88
key: "airtable_oauth-new-modified-or-deleted-records",
9-
version: "0.0.8",
9+
version: "0.0.9",
1010
type: "source",
1111
dedupe: "unique",
1212
props: {
@@ -53,38 +53,46 @@ export default {
5353
const prevAllRecordIds = this._getPrevAllRecordIds();
5454

5555
const lastTimestamp = this._getLastTimestamp();
56-
const params = {
57-
filterByFormula: `LAST_MODIFIED_TIME() > "${lastTimestamp}"`,
58-
returnFieldsByFieldId: this.returnFieldsByFieldId || false,
59-
};
56+
const params = this.getListRecordsParams();
6057

6158
const records = await this.airtable.listRecords({
6259
baseId,
6360
tableId,
6461
params,
6562
});
6663

67-
let allRecordIds = [],
68-
newRecordsCount = 0,
64+
let newRecordsCount = 0,
6965
modifiedRecordsCount = 0,
7066
deletedRecordsCount = 0;
7167

7268
if (records) {
7369
for (const record of records) {
74-
if (!lastTimestamp || moment(record.createdTime) > moment(lastTimestamp)) {
75-
record.type = "new_record";
70+
if (!lastTimestamp || moment(record.createdTime) > moment(lastTimestamp)) {;
71+
this.$emit({
72+
...record,
73+
type: "new_record",
74+
metadata,
75+
}, {
76+
id: record.id,
77+
summary: `New record: ${record.id}`,
78+
ts: moment(record.createdTime).valueOf(),
79+
});
7680
newRecordsCount++;
81+
7782
} else {
78-
record.type = "record_modified";
83+
const ts = Date.now();
84+
const id = `${record.id}-${ts}`;
85+
this.$emit({
86+
...record,
87+
type: "record_modified",
88+
metadata,
89+
}, {
90+
id,
91+
summary: `Record modified: ${record.id}`,
92+
ts,
93+
});
7994
modifiedRecordsCount++;
8095
}
81-
82-
record.metadata = metadata;
83-
84-
this.$emit(record, {
85-
summary: `${record.type}: ${JSON.stringify(record.fields)}`,
86-
id: record.id,
87-
});
8896
}
8997
}
9098

@@ -95,26 +103,27 @@ export default {
95103
tableId,
96104
params,
97105
});
98-
if (!data.length || data.length === 0) return;
99-
allRecordIds = [
100-
...data.map((record) => record.id),
101-
];
106+
107+
const allRecordIds = data.map((record) => record.id);
102108

103109
if (prevAllRecordIds) {
104-
const deletedRecordIds = prevAllRecordIds.filter(
105-
(prevRecord) => !allRecordIds.includes(prevRecord),
106-
);
110+
const currentRecordIdSet = new Set(allRecordIds);
111+
const deletedRecordIds =
112+
prevAllRecordIds.filter((prevRecord) => !currentRecordIdSet.has(prevRecord));
113+
107114
for (const recordID of deletedRecordIds) {
108-
deletedRecordsCount++;
109-
const deletedRecordObj = {
115+
const ts = Date.now();
116+
const id = `${recordID}-${ts}`;
117+
this.$emit({
118+
id: recordID,
110119
metadata,
111120
type: "record_deleted",
112-
id: recordID,
113-
};
114-
this.$emit(deletedRecordObj, {
121+
}, {
122+
id,
115123
summary: `Record deleted: ${recordID}`,
116-
id: recordID,
124+
ts,
117125
});
126+
deletedRecordsCount++;
118127
}
119128
}
120129

components/airtable_oauth/sources/new-or-modified-records-in-view/new-or-modified-records-in-view.mjs

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
name: "New or Modified Records in View",
77
description: "Emit new event for each new or modified record in a view",
88
key: "airtable_oauth-new-or-modified-records-in-view",
9-
version: "0.0.9",
9+
version: "0.0.10",
1010
type: "source",
1111
props: {
1212
...base.props,
@@ -48,11 +48,9 @@ export default {
4848
} = this;
4949

5050
const lastTimestamp = this._getLastTimestamp();
51-
const params = {
51+
const params = this.getListRecordsParams({
5252
view: viewId,
53-
filterByFormula: `LAST_MODIFIED_TIME() > "${lastTimestamp}"`,
54-
returnFieldsByFieldId: this.returnFieldsByFieldId || false,
55-
};
53+
});
5654

5755
const records = await this.airtable.listRecords({
5856
baseId,
@@ -74,19 +72,31 @@ export default {
7472
let newRecords = 0, modifiedRecords = 0;
7573
for (const record of records) {
7674
if (!lastTimestamp || moment(record.createdTime) > moment(lastTimestamp)) {
77-
record.type = "new_record";
75+
this.$emit({
76+
...record,
77+
type: "new_record",
78+
metadata,
79+
}, {
80+
id: record.id,
81+
summary: `New record: ${record.id}`,
82+
ts: moment(record.createdTime).valueOf(),
83+
});
7884
newRecords++;
85+
7986
} else {
80-
record.type = "record_modified";
87+
const ts = Date.now();
88+
const id = `${record.id}-${ts}`;
89+
this.$emit({
90+
...record,
91+
type: "record_modified",
92+
metadata,
93+
}, {
94+
id,
95+
summary: `Record modified: ${record.id}`,
96+
ts,
97+
});
8198
modifiedRecords++;
8299
}
83-
84-
record.metadata = metadata;
85-
86-
this.$emit(record, {
87-
summary: `${record.type}: ${JSON.stringify(record.fields)}`,
88-
id: record.id,
89-
});
90100
}
91101
console.log(`Emitted ${newRecords} new records(s) and ${modifiedRecords} modified record(s).`);
92102

components/airtable_oauth/sources/new-records-in-view/new-records-in-view.mjs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
name: "New Records in View",
77
description: "Emit new event for each new record in a view",
88
key: "airtable_oauth-new-records-in-view",
9-
version: "0.0.8",
9+
version: "0.0.9",
1010
type: "source",
1111
dedupe: "unique",
1212
props: {
@@ -49,11 +49,10 @@ export default {
4949
} = this;
5050

5151
const lastTimestamp = this._getLastTimestamp();
52-
const params = {
52+
const params = this.getListRecordsParams({
5353
view: viewId,
5454
filterByFormula: `CREATED_TIME() > "${lastTimestamp}"`,
55-
returnFieldsByFieldId: this.returnFieldsByFieldId || false,
56-
};
55+
});
5756

5857
const records = await this.airtable.listRecords({
5958
baseId,

components/asana/actions/add-task-to-section/add-task-to-section.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
name: "Add Task To Section",
66
description: "Add a task to a specific, existing section. This will remove the task from other sections of the project. [See the documentation](https://developers.asana.com/docs/add-task-to-section)",
77
key: "asana-add-task-to-section",
8-
version: "0.2.7",
8+
version: "0.2.8",
99
type: "action",
1010
props: {
1111
...common.props,

components/asana/actions/create-project/create-project.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "asana-create-project",
66
name: "Create Project",
77
description: "Create a new project in a workspace or team. [See the documentation](https://developers.asana.com/docs/create-a-project)",
8-
version: "0.10.0",
8+
version: "0.10.1",
99
type: "action",
1010
props: {
1111
asana,

components/asana/actions/create-subtask/create-subtask.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "asana-create-subtask",
66
name: "Create Subtask",
77
description: "Creates a new subtask and adds it to the parent task. [See the documentation](https://developers.asana.com/docs/create-a-subtask)",
8-
version: "0.4.0",
8+
version: "0.4.1",
99
type: "action",
1010
props: {
1111
...common.props,
@@ -105,6 +105,9 @@ export default {
105105
propDefinition: [
106106
asana,
107107
"tags",
108+
({ workspace }) => ({
109+
workspace,
110+
}),
108111
],
109112
optional: true,
110113
},

0 commit comments

Comments
 (0)