@activepieces/piece-documentpro 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # pieces-documentpro
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build pieces-documentpro` to build the library.
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@activepieces/piece-documentpro",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "dependencies": {
8
+ "@sinclair/typebox": "0.34.11",
9
+ "axios": "1.8.3",
10
+ "axios-retry": "4.4.1",
11
+ "deepmerge-ts": "7.1.0",
12
+ "mime-types": "2.1.35",
13
+ "nanoid": "3.3.8",
14
+ "semver": "7.6.0",
15
+ "socket.io-client": "4.8.1",
16
+ "tslib": "^2.3.0",
17
+ "zod": "3.25.76",
18
+ "@activepieces/pieces-common": "0.8.1",
19
+ "@activepieces/pieces-framework": "0.20.2",
20
+ "@activepieces/shared": "0.26.0"
21
+ },
22
+ "resolutions": {
23
+ "rollup": "npm:@rollup/wasm-node"
24
+ }
25
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export declare const documentpro: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
package/src/index.js ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.documentpro = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("./lib/common/auth");
7
+ const upload_document_1 = require("./lib/actions/upload-document");
8
+ const run_extract_1 = require("./lib/actions/run-extract");
9
+ const new_document_1 = require("./lib/triggers/new-document");
10
+ const shared_1 = require("@activepieces/shared");
11
+ const pieces_common_1 = require("@activepieces/pieces-common");
12
+ exports.documentpro = (0, pieces_framework_1.createPiece)({
13
+ displayName: 'DocumentPro',
14
+ auth: auth_1.documentproAuth,
15
+ minimumSupportedRelease: '0.36.1',
16
+ logoUrl: 'https://cdn.activepieces.com/pieces/documentpro.png',
17
+ description: 'DocumentPro is an AI-powered document processing platform that automates data extraction from various document types using advanced machine learning algorithms.',
18
+ categories: [shared_1.PieceCategory.ARTIFICIAL_INTELLIGENCE],
19
+ authors: ['sanket-a11y'],
20
+ actions: [
21
+ upload_document_1.uploaddocument,
22
+ run_extract_1.runExtract,
23
+ (0, pieces_common_1.createCustomApiCallAction)({
24
+ auth: auth_1.documentproAuth,
25
+ baseUrl: () => 'https://api.documentpro.ai/v1',
26
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
27
+ return {
28
+ 'x-api-key': `${auth}`,
29
+ };
30
+ }),
31
+ }),
32
+ ],
33
+ triggers: [new_document_1.newDocument],
34
+ });
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/documentpro/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,4CAAoD;AACpD,mEAA+D;AAC/D,2DAAuD;AACvD,8DAA0D;AAC1D,iDAAqD;AACrD,+DAAwE;AAC3D,QAAA,WAAW,GAAG,IAAA,8BAAW,EAAC;IACrC,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,sBAAe;IACrB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,qDAAqD;IAC9D,WAAW,EACT,kKAAkK;IACpK,UAAU,EAAE,CAAC,sBAAa,CAAC,uBAAuB,CAAC;IACnD,OAAO,EAAE,CAAC,aAAa,CAAC;IACxB,OAAO,EAAE;QACP,gCAAc;QACd,wBAAU;QACV,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,sBAAe;YACrB,OAAO,EAAE,GAAG,EAAE,CAAC,+BAA+B;YAC9C,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,OAAO;oBACL,WAAW,EAAE,GAAG,IAAI,EAAE;iBACvB,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,CAAC,0BAAW,CAAC;CACxB,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ export declare const runExtract: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ document_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ template_id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ use_ocr: import("@activepieces/pieces-framework").CheckboxProperty<false>;
5
+ query_model: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
6
+ detect_layout: import("@activepieces/pieces-framework").CheckboxProperty<false>;
7
+ detect_tables: import("@activepieces/pieces-framework").CheckboxProperty<false>;
8
+ page_ranges: import("@activepieces/pieces-framework").ShortTextProperty<false>;
9
+ chunk_by_pages: import("@activepieces/pieces-framework").NumberProperty<false>;
10
+ rolling_window: import("@activepieces/pieces-framework").NumberProperty<false>;
11
+ start_regex: import("@activepieces/pieces-framework").ShortTextProperty<false>;
12
+ end_regex: import("@activepieces/pieces-framework").ShortTextProperty<false>;
13
+ split_regex: import("@activepieces/pieces-framework").ShortTextProperty<false>;
14
+ use_all_matches: import("@activepieces/pieces-framework").CheckboxProperty<false>;
15
+ }>;
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runExtract = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const auth_1 = require("../common/auth");
8
+ exports.runExtract = (0, pieces_framework_1.createAction)({
9
+ auth: auth_1.documentproAuth,
10
+ name: 'runExtract',
11
+ displayName: 'Run Extract',
12
+ description: 'Run an extract/workflow on an uploaded document',
13
+ props: {
14
+ document_id: pieces_framework_1.Property.ShortText({
15
+ displayName: 'Document ID',
16
+ description: 'The unique identifier of the document to parse',
17
+ required: true,
18
+ }),
19
+ template_id: pieces_framework_1.Property.ShortText({
20
+ displayName: 'Template ID',
21
+ description: 'The unique identifier of the Workflow/template to use',
22
+ required: true,
23
+ }),
24
+ use_ocr: pieces_framework_1.Property.Checkbox({
25
+ displayName: 'Use OCR',
26
+ description: 'Enable OCR processing (required for gpt-3.5-turbo or OCR-related parameters)',
27
+ required: false,
28
+ defaultValue: false,
29
+ }),
30
+ query_model: pieces_framework_1.Property.StaticDropdown({
31
+ displayName: 'Query Model',
32
+ description: 'The AI model to use for parsing',
33
+ required: false,
34
+ defaultValue: 'gpt-4o-mini',
35
+ options: {
36
+ options: [
37
+ { label: 'GPT-4o Mini', value: 'gpt-4o-mini' },
38
+ { label: 'GPT-4o', value: 'gpt-4o' },
39
+ { label: 'GPT-3.5 Turbo', value: 'gpt-3.5-turbo' },
40
+ ],
41
+ },
42
+ }),
43
+ detect_layout: pieces_framework_1.Property.Checkbox({
44
+ displayName: 'Detect Layout',
45
+ description: 'Detect document layout (requires use_ocr=true)',
46
+ required: false,
47
+ defaultValue: false,
48
+ }),
49
+ detect_tables: pieces_framework_1.Property.Checkbox({
50
+ displayName: 'Detect Tables',
51
+ description: 'Detect tables in the document (requires use_ocr=true)',
52
+ required: false,
53
+ defaultValue: false,
54
+ }),
55
+ page_ranges: pieces_framework_1.Property.ShortText({
56
+ displayName: 'Page Ranges',
57
+ description: 'Specify which pages to parse (e.g., "1-3,5,7-9")',
58
+ required: false,
59
+ }),
60
+ chunk_by_pages: pieces_framework_1.Property.Number({
61
+ displayName: 'Chunk by Pages',
62
+ description: 'Number of pages per segment for method 1 segmentation',
63
+ required: false,
64
+ }),
65
+ rolling_window: pieces_framework_1.Property.Number({
66
+ displayName: 'Rolling Window',
67
+ description: 'Window size for method 2 segmentation',
68
+ required: false,
69
+ }),
70
+ start_regex: pieces_framework_1.Property.ShortText({
71
+ displayName: 'Start Regex',
72
+ description: 'Regex pattern for where parsing should begin (requires use_ocr=true)',
73
+ required: false,
74
+ }),
75
+ end_regex: pieces_framework_1.Property.ShortText({
76
+ displayName: 'End Regex',
77
+ description: 'Regex pattern for where parsing should end (requires use_ocr=true)',
78
+ required: false,
79
+ }),
80
+ split_regex: pieces_framework_1.Property.ShortText({
81
+ displayName: 'Split Regex',
82
+ description: 'Regex pattern to split the document into sections (requires use_ocr=true)',
83
+ required: false,
84
+ }),
85
+ use_all_matches: pieces_framework_1.Property.Checkbox({
86
+ displayName: 'Use All Matches',
87
+ description: 'Use all regex matches instead of just the first (requires use_ocr=true)',
88
+ required: false,
89
+ defaultValue: false,
90
+ }),
91
+ },
92
+ run(context) {
93
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
94
+ const params = new URLSearchParams();
95
+ params.append('template_id', context.propsValue.template_id);
96
+ if (context.propsValue.use_ocr) {
97
+ params.append('use_ocr', 'true');
98
+ }
99
+ if (context.propsValue.query_model) {
100
+ params.append('query_model', context.propsValue.query_model);
101
+ }
102
+ if (context.propsValue.detect_layout) {
103
+ params.append('detect_layout', 'true');
104
+ }
105
+ if (context.propsValue.detect_tables) {
106
+ params.append('detect_tables', 'true');
107
+ }
108
+ if (context.propsValue.page_ranges) {
109
+ params.append('page_ranges', context.propsValue.page_ranges);
110
+ }
111
+ if (context.propsValue.chunk_by_pages) {
112
+ params.append('chunk_by_pages', context.propsValue.chunk_by_pages.toString());
113
+ }
114
+ if (context.propsValue.rolling_window) {
115
+ params.append('rolling_window', context.propsValue.rolling_window.toString());
116
+ }
117
+ if (context.propsValue.start_regex) {
118
+ params.append('start_regex', context.propsValue.start_regex);
119
+ }
120
+ if (context.propsValue.end_regex) {
121
+ params.append('end_regex', context.propsValue.end_regex);
122
+ }
123
+ if (context.propsValue.split_regex) {
124
+ params.append('split_regex', context.propsValue.split_regex);
125
+ }
126
+ if (context.propsValue.use_all_matches) {
127
+ params.append('use_all_matches', 'true');
128
+ }
129
+ const response = yield pieces_common_1.httpClient.sendRequest({
130
+ method: pieces_common_1.HttpMethod.GET,
131
+ url: `https://api.documentpro.ai/v1/documents/${context.propsValue.document_id}/run_parser?${params.toString()}`,
132
+ headers: {
133
+ 'x-api-key': context.auth,
134
+ Accept: 'application/json',
135
+ },
136
+ });
137
+ return response.body;
138
+ });
139
+ },
140
+ });
141
+ //# sourceMappingURL=run-extract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-extract.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/documentpro/src/lib/actions/run-extract.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,yCAAiD;AAEpC,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,iDAAiD;IAC9D,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,gDAAgD;YAC7D,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EACT,8EAA8E;YAChF,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACpB,CAAC;QACF,WAAW,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACnC,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,iCAAiC;YAC9C,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,aAAa;YAC3B,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aA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I,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;gBACtC,MAAM,CAAC,MAAM,CACX,gBAAgB,EAChB,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,QAAQ,EAAE,CAC7C,CAAC;YACJ,CAAC;YACD,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;gBACnC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;YAC/D,CAAC;YACD,IAAI,OAAO,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;gBACjC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;YAC3D,CAAC;YACD,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;gBACnC,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;YAC/D,CAAC;YACD,IAAI,OAAO,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;gBACvC,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;YAC3C,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,2CACH,OAAO,CAAC,UAAU,CAAC,WACrB,eAAe,MAAM,CAAC,QAAQ,EAAE,EAAE;gBAClC,OAAO,EAAE;oBACP,WAAW,EAAE,OAAO,CAAC,IAAI;oBACzB,MAAM,EAAE,kBAAkB;iBAC3B;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const uploaddocument: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
2
+ file: import("@activepieces/pieces-framework").FileProperty<true>;
3
+ }>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.uploaddocument = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const pieces_common_1 = require("@activepieces/pieces-common");
7
+ const auth_1 = require("../common/auth");
8
+ exports.uploaddocument = (0, pieces_framework_1.createAction)({
9
+ auth: auth_1.documentproAuth,
10
+ name: 'uploadDocument',
11
+ displayName: 'Upload document',
12
+ description: 'Uploads a document to a DocumentPro parser',
13
+ props: {
14
+ file: pieces_framework_1.Property.File({
15
+ displayName: 'File',
16
+ description: 'The document file to upload (PDF, JPEG, PNG, or TIFF, max 6MB)',
17
+ required: true,
18
+ }),
19
+ },
20
+ run(context) {
21
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ const file = context.propsValue.file;
23
+ const formData = new FormData();
24
+ const fileBuffer = Buffer.from(file.base64, 'base64');
25
+ const mimeType = file.extension ? `application/${file.extension}` : 'application/octet-stream';
26
+ const blob = new Blob([fileBuffer], { type: mimeType });
27
+ formData.append('file', blob, file.filename);
28
+ const response = yield pieces_common_1.httpClient.sendRequest({
29
+ method: pieces_common_1.HttpMethod.POST,
30
+ url: 'https://api.documentpro.ai/v1/documents',
31
+ headers: {
32
+ 'x-api-key': context.auth,
33
+ 'Content-Type': 'multipart/form-data',
34
+ },
35
+ body: formData,
36
+ });
37
+ return response.body;
38
+ });
39
+ },
40
+ });
41
+ //# sourceMappingURL=upload-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-document.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/documentpro/src/lib/actions/upload-document.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,yCAAiD;AAEpC,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,4CAA4C;IACzD,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,IAAI,CAAC;YAClB,WAAW,EAAE,MAAM;YACnB,WAAW,EACT,gEAAgE;YAClE,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;YAErC,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;YAChC,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,0BAA0B,CAAC;YAC/F,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;YACxD,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YAE7C,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,yCAAyC;gBAC9C,OAAO,EAAE;oBACP,WAAW,EAAE,OAAO,CAAC,IAAI;oBACzB,cAAc,EAAE,qBAAqB;iBACtC;gBACD,IAAI,EAAE,QAAQ;aACf,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const documentproAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.documentproAuth = void 0;
4
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
5
+ exports.documentproAuth = pieces_framework_1.PieceAuth.SecretText({
6
+ displayName: 'API Key',
7
+ description: `
8
+ To get your DocumentPro API Key:
9
+
10
+ 1. **Login** to your DocumentPro account
11
+ 2. **Go to** https://app.documentpro.ai/workflows
12
+ 3. **Select** a workflow
13
+ 4. **Change tab** to "Workflow" from the top bar
14
+ 5. **Find** the "Upload" tab
15
+ 6. **Click** "Upload via API"
16
+ 7. **Click** the "Generate API Key" button
17
+ 8. **Copy** your API key and paste it here
18
+ `,
19
+ required: true,
20
+ });
21
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/documentpro/src/lib/common/auth.ts"],"names":[],"mappings":";;;AAAA,qEAA2D;AAE9C,QAAA,eAAe,GAAG,4BAAS,CAAC,UAAU,CAAC;IAClD,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE;;;;;;;;;;;GAWZ;IACD,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { TriggerStrategy } from '@activepieces/pieces-framework';
2
+ export declare const newDocument: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
+ webhook_info: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
4
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
5
+ webhook_info: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
6
+ }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
7
+ webhook_info: import("dist/packages/pieces/community/framework/src/lib/property/input/markdown-property").MarkDownProperty;
8
+ }>;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.newDocument = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ exports.newDocument = (0, pieces_framework_1.createTrigger)({
8
+ auth: auth_1.documentproAuth,
9
+ name: 'newDocument',
10
+ displayName: 'New Document',
11
+ description: 'Triggers when a new document is uploaded to DocumentPro',
12
+ props: {
13
+ webhook_info: pieces_framework_1.Property.MarkDown({
14
+ value: `
15
+ **In DocumentPro Dashboard:**
16
+ - Navigate to your desired Workflow
17
+ - Go to the "Workflow" tab
18
+ - Find the "Webhook Notification" option in the export section
19
+ - Set the Webhook Endpoint URL to:
20
+ \`\`\`text
21
+ {{webhookUrl}}
22
+ \`\`\`
23
+ - Click Save
24
+
25
+ `,
26
+ }),
27
+ },
28
+ sampleData: {
29
+ event: 'file_request_status_change',
30
+ timestamp: '2024-07-25T14:30:29.565249',
31
+ data: {
32
+ request_id: 'a7813466-6f9a-4c33-8128-427e7a4df755',
33
+ request_status: 'completed',
34
+ response_body: {
35
+ file_name: 'sample_document.pdf',
36
+ template_id: '8e9beda9-5cba-42eb-a70a-b3e5eec9120a',
37
+ template_title: 'Sample Parser',
38
+ num_pages: 5,
39
+ result_json_data: {
40
+ field1: 'value1',
41
+ field2: 'value2',
42
+ },
43
+ },
44
+ },
45
+ },
46
+ type: pieces_framework_1.TriggerStrategy.WEBHOOK,
47
+ onEnable(context) {
48
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
49
+ // Webhook URL is automatically provided by Activepieces
50
+ // User needs to manually configure the webhook URL in DocumentPro dashboard
51
+ });
52
+ },
53
+ onDisable(context) {
54
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
55
+ // User should remove webhook from DocumentPro dashboard
56
+ });
57
+ },
58
+ run(context) {
59
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
60
+ return [context.payload.body];
61
+ });
62
+ },
63
+ });
64
+ //# sourceMappingURL=new-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-document.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/documentpro/src/lib/triggers/new-document.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,yCAAiD;AAEpC,QAAA,WAAW,GAAG,IAAA,gCAAa,EAAC;IACvC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,yDAAyD;IACtE,KAAK,EAAE;QACL,YAAY,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC9B,KAAK,EAAE;;;;;;;;;;;EAWX;SACG,CAAC;KACH;IACD,UAAU,EAAE;QACV,KAAK,EAAE,4BAA4B;QACnC,SAAS,EAAE,4BAA4B;QACvC,IAAI,EAAE;YACJ,UAAU,EAAE,sCAAsC;YAClD,cAAc,EAAE,WAAW;YAC3B,aAAa,EAAE;gBACb,SAAS,EAAE,qBAAqB;gBAChC,WAAW,EAAE,sCAAsC;gBACnD,cAAc,EAAE,eAAe;gBAC/B,SAAS,EAAE,CAAC;gBACZ,gBAAgB,EAAE;oBAChB,MAAM,EAAE,QAAQ;oBAChB,MAAM,EAAE,QAAQ;iBACjB;aACF;SACF;KACF;IACD,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ,CAAC,OAAO;;YACpB,wDAAwD;YACxD,4EAA4E;QAC9E,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,wDAAwD;QAC1D,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}