-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into issue-12547
- Loading branch information
Showing
55 changed files
with
3,997 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default { | ||
type: "app", | ||
app: "adobe_photoshop", | ||
propDefinitions: {}, | ||
methods: { | ||
// this.$auth contains connected account data | ||
authKeys() { | ||
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "@pipedream/adobe_photoshop", | ||
"version": "0.0.1", | ||
"description": "Pipedream Adobe Photoshop Components", | ||
"main": "adobe_photoshop.app.mjs", | ||
"keywords": [ | ||
"pipedream", | ||
"adobe_photoshop" | ||
], | ||
"homepage": "https://pipedream.com/apps/adobe_photoshop", | ||
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default { | ||
type: "app", | ||
app: "airship", | ||
propDefinitions: {}, | ||
methods: { | ||
// this.$auth contains connected account data | ||
authKeys() { | ||
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "@pipedream/airship", | ||
"version": "0.0.1", | ||
"description": "Pipedream Airship Components", | ||
"main": "airship.app.mjs", | ||
"keywords": [ | ||
"pipedream", | ||
"airship" | ||
], | ||
"homepage": "https://pipedream.com/apps/airship", | ||
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
components/documentpro/actions/new-document/new-document.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import FormData from "form-data"; | ||
import fs from "fs"; | ||
import { checkTmp } from "../../common/utils.mjs"; | ||
import documentpro from "../../documentpro.app.mjs"; | ||
|
||
export default { | ||
key: "documentpro-new-document", | ||
name: "Upload New Document", | ||
description: "Uploads a document to DocumentPro's parser. [See the documentation](https://docs.documentpro.ai/docs/using-api/manage-documents/import-files)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
documentpro, | ||
parserId: { | ||
propDefinition: [ | ||
documentpro, | ||
"parserId", | ||
], | ||
}, | ||
document: { | ||
propDefinition: [ | ||
documentpro, | ||
"document", | ||
], | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const formData = new FormData(); | ||
const file = fs.createReadStream(checkTmp(this.document)); | ||
formData.append("file", file); | ||
|
||
const response = await this.documentpro.uploadDocument({ | ||
parserId: this.parserId, | ||
data: formData, | ||
headers: formData.getHeaders(), | ||
}); | ||
|
||
$.export("$summary", `Successfully uploaded document with Id: ${response.request_id}`); | ||
return response; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const checkTmp = (filename) => { | ||
if (filename.indexOf("/tmp") === -1) { | ||
return `/tmp/${filename}`; | ||
} | ||
return filename; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,71 @@ | ||
import { axios } from "@pipedream/platform"; | ||
|
||
export default { | ||
type: "app", | ||
app: "documentpro", | ||
propDefinitions: {}, | ||
propDefinitions: { | ||
document: { | ||
type: "string", | ||
label: "Document", | ||
description: "The path to the file saved to the `/tmp` directory (e.g. `/tmp/example.pdf`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory).", | ||
}, | ||
parserId: { | ||
type: "string", | ||
label: "Parser ID", | ||
description: "The ID of the parser to use for uploading the document", | ||
async options() { | ||
const { items } = await this.getParsers(); | ||
return items.map(({ | ||
template_title: label, template_id: value, | ||
}) => ({ | ||
label, | ||
value, | ||
})); | ||
}, | ||
}, | ||
}, | ||
methods: { | ||
// this.$auth contains connected account data | ||
authKeys() { | ||
console.log(Object.keys(this.$auth)); | ||
_baseUrl() { | ||
return "https://api.documentpro.ai"; | ||
}, | ||
_headers(headers = {}) { | ||
return { | ||
...headers, | ||
"x-api-key": this.$auth.api_key, | ||
}; | ||
}, | ||
_makeRequest({ | ||
$ = this, path = "", headers, ...opts | ||
}) { | ||
return axios($, { | ||
url: this._baseUrl() + path, | ||
headers: this._headers(headers), | ||
...opts, | ||
}); | ||
}, | ||
getParsers(opts = {}) { | ||
return this._makeRequest({ | ||
path: "/v1/templates", | ||
...opts, | ||
}); | ||
}, | ||
updateParser({ | ||
parserId, ...opts | ||
}) { | ||
return this._makeRequest({ | ||
method: "PUT", | ||
path: `/v1/templates/${parserId}`, | ||
...opts, | ||
}); | ||
}, | ||
uploadDocument({ | ||
parserId, ...opts | ||
}) { | ||
return this._makeRequest({ | ||
method: "POST", | ||
path: `/files/upload/${parserId}`, | ||
...opts, | ||
}); | ||
}, | ||
}, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@pipedream/documentpro", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Pipedream DocumentPro Components", | ||
"main": "documentpro.app.mjs", | ||
"keywords": [ | ||
|
@@ -11,5 +11,9 @@ | |
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"dependencies": { | ||
"@pipedream/platform": "^3.0.0", | ||
"form-data": "^4.0.0" | ||
} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
components/documentpro/sources/new-document-updated-instant/new-document-updated-instant.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import documentpro from "../../documentpro.app.mjs"; | ||
import sampleEmit from "./test-event.mjs"; | ||
|
||
export default { | ||
key: "documentpro-new-document-updated-instant", | ||
name: "New Document Updated (Instant)", | ||
description: "Emit new event when a file request status changes. You can only create one webhook in a parser at a time.", | ||
version: "0.0.1", | ||
type: "source", | ||
dedupe: "unique", | ||
props: { | ||
documentpro, | ||
http: { | ||
type: "$.interface.http", | ||
customResponse: true, | ||
}, | ||
db: "$.service.db", | ||
parserId: { | ||
propDefinition: [ | ||
documentpro, | ||
"parserId", | ||
], | ||
}, | ||
}, | ||
hooks: { | ||
async activate() { | ||
await this.documentpro.updateParser({ | ||
parserId: this.parserId, | ||
data: { | ||
webhook_url: this.http.endpoint, | ||
}, | ||
}); | ||
}, | ||
async deactivate() { | ||
await this.documentpro.updateParser({ | ||
parserId: this.parserId, | ||
data: { | ||
webhook_url: null, | ||
}, | ||
}); | ||
}, | ||
}, | ||
async run({ body }) { | ||
this.$emit(body, { | ||
id: `${body.data.request_id}-${body.timestamp}`, | ||
summary: `New document (${body.data.response_body.file_name}) status updated: ${body.event} - ${body.data.request_status}`, | ||
ts: Date.parse(body.timestamp), | ||
}); | ||
|
||
this.http.respond({ | ||
status: 200, | ||
body: { | ||
message: "Received", | ||
}, | ||
}); | ||
}, | ||
sampleEmit, | ||
}; |
20 changes: 20 additions & 0 deletions
20
components/documentpro/sources/new-document-updated-instant/test-event.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export default { | ||
"event": "file_request_status_change", | ||
"timestamp": "2023-07-30T19:05:29.565249", | ||
"data": { | ||
"request_id": "your-request-id", | ||
"request_status": "completed", | ||
"response_body": { | ||
"file_name": "your-file-name", | ||
"file_presigned_url": "temporary-url-to-your-file", | ||
"user_error_msg": null, | ||
"template_id": "your-template-id", | ||
"template_type": "receipt", | ||
"template_title": "Receipt", | ||
"num_pages": 2, | ||
"result_json_data": {} | ||
}, | ||
"created_at": "2023-07-30T19:05:10.696893", | ||
"updated_at": "2023-07-30T19:05:29.565249" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default { | ||
type: "app", | ||
app: "dropboard", | ||
propDefinitions: {}, | ||
methods: { | ||
// this.$auth contains connected account data | ||
authKeys() { | ||
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "@pipedream/dropboard", | ||
"version": "0.0.1", | ||
"description": "Pipedream Dropboard Components", | ||
"main": "dropboard.app.mjs", | ||
"keywords": [ | ||
"pipedream", | ||
"dropboard" | ||
], | ||
"homepage": "https://pipedream.com/apps/dropboard", | ||
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default { | ||
type: "app", | ||
app: "fatture_in_cloud", | ||
propDefinitions: {}, | ||
methods: { | ||
// this.$auth contains connected account data | ||
authKeys() { | ||
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "@pipedream/fatture_in_cloud", | ||
"version": "0.0.1", | ||
"description": "Pipedream Fatture in Cloud Components", | ||
"main": "fatture_in_cloud.app.mjs", | ||
"keywords": [ | ||
"pipedream", | ||
"fatture_in_cloud" | ||
], | ||
"homepage": "https://pipedream.com/apps/fatture_in_cloud", | ||
"author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export default { | ||
type: "app", | ||
app: "fillout", | ||
propDefinitions: {}, | ||
methods: { | ||
// this.$auth contains connected account data | ||
authKeys() { | ||
console.log(Object.keys(this.$auth)); | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.