Skip to content

Commit

Permalink
Merge branch 'master' into issue-12547
Browse files Browse the repository at this point in the history
  • Loading branch information
luancazarine committed Jun 25, 2024
2 parents 02dabb2 + 86e2d76 commit 762c5d4
Show file tree
Hide file tree
Showing 55 changed files with 3,997 additions and 187 deletions.
11 changes: 11 additions & 0 deletions components/adobe_photoshop/adobe_photoshop.app.mjs
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));
},
},
};
15 changes: 15 additions & 0 deletions components/adobe_photoshop/package.json
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"
}
}
11 changes: 11 additions & 0 deletions components/airship/airship.app.mjs
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));
},
},
};
15 changes: 15 additions & 0 deletions components/airship/package.json
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"
}
}
2 changes: 1 addition & 1 deletion components/anthropic/actions/chat/chat.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import constants from "../common/constants.mjs";

export default {
name: "Chat",
version: "0.0.7",
version: "0.0.8",
key: "anthropic-chat",
description: "The Chat API. [See the documentation](https://docs.anthropic.com/claude/reference/messages_post)",
type: "action",
Expand Down
1 change: 1 addition & 0 deletions components/anthropic/actions/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default {
MESSAGE_MODELS: [
"claude-3-5-sonnet-20240620",
"claude-3-opus-20240229",
"claude-3-sonnet-20240229",
"claude-3-haiku-20240307",
Expand Down
2 changes: 1 addition & 1 deletion components/anthropic/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/anthropic",
"version": "0.0.9",
"version": "0.0.10",
"description": "Pipedream Anthropic (Claude) Components",
"main": "anthropic.app.mjs",
"keywords": [
Expand Down
41 changes: 41 additions & 0 deletions components/documentpro/actions/new-document/new-document.mjs
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;
},
};
6 changes: 6 additions & 0 deletions components/documentpro/common/utils.mjs
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;
};
70 changes: 65 additions & 5 deletions components/documentpro/documentpro.app.mjs
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,
});
},
},
};
};
8 changes: 6 additions & 2 deletions components/documentpro/package.json
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": [
Expand All @@ -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"
}
}
}
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,
};
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"
}
}
11 changes: 11 additions & 0 deletions components/dropboard/dropboard.app.mjs
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));
},
},
};
15 changes: 15 additions & 0 deletions components/dropboard/package.json
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"
}
}
11 changes: 11 additions & 0 deletions components/fatture_in_cloud/fatture_in_cloud.app.mjs
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));
},
},
};
15 changes: 15 additions & 0 deletions components/fatture_in_cloud/package.json
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"
}
}
11 changes: 11 additions & 0 deletions components/fillout/fillout.app.mjs
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));
},
},
};
Loading

0 comments on commit 762c5d4

Please sign in to comment.