Skip to content

Commit 1b85293

Browse files
authored
Merge branch 'master' into 13965-bug-linkedin-components-api-version-update
2 parents b9be91e + a407a12 commit 1b85293

File tree

25 files changed

+519
-154
lines changed

25 files changed

+519
-154
lines changed

components/dust/dust.app.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
type: "app",
3+
app: "dust",
4+
propDefinitions: {},
5+
methods: {
6+
// this.$auth contains connected account data
7+
authKeys() {
8+
console.log(Object.keys(this.$auth));
9+
},
10+
},
11+
};

components/dust/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@pipedream/dust",
3+
"version": "0.0.1",
4+
"description": "Pipedream Dust Components",
5+
"main": "dust.app.mjs",
6+
"keywords": [
7+
"pipedream",
8+
"dust"
9+
],
10+
"homepage": "https://pipedream.com/apps/dust",
11+
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
12+
"publishConfig": {
13+
"access": "public"
14+
}
15+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import error from "../../error.app.mjs";
2+
3+
export default {
4+
name: "Throw Error",
5+
version: "0.0.1",
6+
key: "error-throw-error",
7+
description: "Quickly throw an error from your workflow.",
8+
props: {
9+
error,
10+
name: {
11+
propDefinition: [
12+
error,
13+
"name",
14+
],
15+
},
16+
errorMessage: {
17+
propDefinition: [
18+
error,
19+
"errorMessage",
20+
],
21+
},
22+
},
23+
type: "action",
24+
async run() {
25+
this.error.maybeCreateAndThrowError(this.name, this.errorMessage);
26+
},
27+
};

components/error/error.app.mjs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
export default {
2+
type: "app",
3+
app: "error",
4+
propDefinitions: {
5+
name: {
6+
type: "string",
7+
label: "Error Name",
8+
description:
9+
"The **name** (class) of error to throw, which you can define as any custom string. This will show up in all of the standard Pipedream error handling destinations.",
10+
default: "Error",
11+
},
12+
errorMessage: {
13+
type: "string",
14+
label: "Error Message",
15+
description:
16+
"The error **message** to throw. This will show up in all of the standard Pipedream error handling destinations.",
17+
optional: true,
18+
},
19+
},
20+
methods: {
21+
maybeCreateAndThrowError(name, message) {
22+
const errorClass = global[name];
23+
24+
// Check if the error class exists and is a subclass of Error
25+
if (
26+
typeof errorClass === "function" &&
27+
errorClass.prototype.isPrototypeOf.call(Error)
28+
) {
29+
throw new errorClass(message);
30+
}
31+
32+
class DynamicError extends Error {
33+
constructor(msg) {
34+
super(msg);
35+
this.name = name;
36+
}
37+
}
38+
throw new DynamicError(message);
39+
},
40+
},
41+
};

components/error/package.json

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

components/google_docs/actions/append-image/append-image.mjs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import googleDocs from "../../google_docs.app.mjs";
33
export default {
44
key: "google_docs-append-image",
55
name: "Append Image to Document",
6-
description: "Appends an image to the end of a document. [See the docs](https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertInlineImageRequest)",
7-
version: "0.0.3",
6+
description: "Appends an image to the end of a document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertInlineImageRequest)",
7+
version: "0.0.4",
88
type: "action",
99
props: {
1010
googleDocs,
@@ -28,13 +28,11 @@ export default {
2828
},
2929
},
3030
async run({ $ }) {
31-
const image = {
31+
await this.googleDocs.appendImage(this.docId, {
3232
uri: this.imageUri,
33-
};
34-
const { data } = await this.googleDocs.appendImage(this.docId, image, this.appendAtBeginning);
35-
$.export("$summary", "Successfully appended image to doc");
36-
return {
37-
documentId: data.documentId,
38-
};
33+
}, this.appendAtBeginning);
34+
const doc = this.googleDocs.getDocument(this.docId);
35+
$.export("$summary", `Successfully appended image to document with ID: ${this.docId}`);
36+
return doc;
3937
},
4038
};

components/google_docs/actions/append-text/append-text.mjs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import googleDocs from "../../google_docs.app.mjs";
33
export default {
44
key: "google_docs-append-text",
55
name: "Append Text",
6-
description: "Append text to an existing document. [See the docs](https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertTextRequest)",
7-
version: "0.1.2",
6+
description: "Append text to an existing document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertTextRequest)",
7+
version: "0.1.3",
88
type: "action",
99
props: {
1010
googleDocs,
@@ -28,13 +28,11 @@ export default {
2828
},
2929
},
3030
async run({ $ }) {
31-
const text = {
31+
await this.googleDocs.insertText(this.docId, {
3232
text: this.text,
33-
};
34-
await this.googleDocs.insertText(this.docId, text, this.appendAtBeginning);
35-
$.export("$summary", "Successfully appended text to doc");
36-
return {
37-
documentId: this.docId,
38-
};
33+
}, this.appendAtBeginning);
34+
const doc = this.googleDocs.getDocument(this.docId);
35+
$.export("$summary", `Successfully appended text to document with ID: ${this.docId}`);
36+
return doc;
3937
},
4038
};

components/google_docs/actions/create-document-from-text/create-document-from-text.mjs

Lines changed: 0 additions & 30 deletions
This file was deleted.

components/google_docs/actions/create-document/create-document.mjs

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,59 @@ import googleDocs from "../../google_docs.app.mjs";
33
export default {
44
key: "google_docs-create-document",
55
name: "Create a New Document",
6-
description: "Create a new, empty document. To add content after creating the document, pass the document ID exported by this step to the Append Text action. [See the docs](https://developers.google.com/docs/api/reference/rest/v1/documents/create)",
7-
version: "0.1.2",
6+
description: "Create a new document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/create)",
7+
version: "0.1.3",
88
type: "action",
99
props: {
1010
googleDocs,
11-
title: "string",
11+
title: {
12+
type: "string",
13+
label: "Title",
14+
description: "Title of the new document",
15+
},
16+
text: {
17+
propDefinition: [
18+
googleDocs,
19+
"text",
20+
],
21+
optional: true,
22+
},
23+
folderId: {
24+
propDefinition: [
25+
googleDocs,
26+
"folderId",
27+
],
28+
optional: true,
29+
},
1230
},
1331
async run({ $ }) {
14-
const createdDoc = await this.googleDocs.createEmptyDoc(this.title);
15-
$.export("$summary", "Successfully created doc");
16-
return createdDoc;
32+
// Create Doc
33+
const { documentId } = await this.googleDocs.createEmptyDoc(this.title);
34+
35+
// Insert text
36+
if (this.text) {
37+
await this.googleDocs.insertText(documentId, {
38+
text: this.text,
39+
});
40+
}
41+
42+
// Move file
43+
if (this.folderId) {
44+
// Get file to get parents to remove
45+
const file = await this.googleDocs.getFile(documentId);
46+
47+
// Move file, removing old parents, adding new parent folder
48+
await this.googleDocs.updateFile(documentId, {
49+
fields: "*",
50+
removeParents: file.parents.join(","),
51+
addParents: this.folderId,
52+
});
53+
}
54+
55+
// Get updated doc resource to return
56+
const doc = await this.googleDocs.getDocument(documentId);
57+
58+
$.export("$summary", `Successfully created document with ID: ${documentId}`);
59+
return doc;
1760
},
1861
};

components/google_docs/actions/get-document/get-document.mjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import googleDocs from "../../google_docs.app.mjs";
33
export default {
44
key: "google_docs-get-document",
55
name: "Get Document",
6-
description: "Get the contents of the latest version of a document. [See the docs](https://developers.google.com/docs/api/reference/rest/v1/documents/get)",
7-
version: "0.1.1",
6+
description: "Get the contents of the latest version of a document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/get)",
7+
version: "0.1.2",
88
type: "action",
99
props: {
1010
googleDocs,
@@ -15,7 +15,9 @@ export default {
1515
],
1616
},
1717
},
18-
async run() {
19-
return this.googleDocs.getDocument(this.docId);
18+
async run({ $ }) {
19+
const response = await this.googleDocs.getDocument(this.docId);
20+
$.export("$summary", `Successfully retrieved document with ID: ${this.docId}`);
21+
return response;
2022
},
2123
};

0 commit comments

Comments
 (0)