@activepieces/piece-mindee 0.0.3 → 0.1.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/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-mindee",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@sinclair/typebox": "0.26.8",
|
|
6
|
-
"axios": "1.
|
|
6
|
+
"axios": "^1.6.3",
|
|
7
|
+
"dayjs": "1.11.9",
|
|
7
8
|
"form-data": "4.0.0",
|
|
9
|
+
"is-base64": "1.1.0",
|
|
8
10
|
"lodash": "4.17.21",
|
|
9
|
-
"nanoid": "3.3.
|
|
10
|
-
"
|
|
11
|
-
"@activepieces/
|
|
12
|
-
"@activepieces/pieces-
|
|
13
|
-
"
|
|
11
|
+
"nanoid": "3.3.6",
|
|
12
|
+
"semver": "7.5.4",
|
|
13
|
+
"@activepieces/pieces-common": "0.2.8",
|
|
14
|
+
"@activepieces/pieces-framework": "0.7.14",
|
|
15
|
+
"@activepieces/shared": "0.10.66",
|
|
16
|
+
"tslib": "2.6.2"
|
|
14
17
|
},
|
|
15
18
|
"main": "./src/index.js",
|
|
16
|
-
"
|
|
19
|
+
"type": "commonjs"
|
|
17
20
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const mindeeAuth: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
2
|
+
export declare const mindee: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
package/src/index.js
CHANGED
|
@@ -1,13 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mindee = void 0;
|
|
3
|
+
exports.mindee = exports.mindeeAuth = void 0;
|
|
4
4
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
5
5
|
const predict_document_1 = require("./lib/actions/predict-document");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
exports.mindeeAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
8
|
+
displayName: 'Api Key',
|
|
9
|
+
description: `
|
|
10
|
+
#### To obtain access your Api Key
|
|
11
|
+
1. Sign up and log in to Mindee
|
|
12
|
+
2. Go to [API Key page](https://platform.mindee.com/api-keys)
|
|
13
|
+
3. Copy the Key and paste below.
|
|
14
|
+
`,
|
|
15
|
+
required: true,
|
|
16
|
+
});
|
|
6
17
|
exports.mindee = (0, pieces_framework_1.createPiece)({
|
|
7
|
-
displayName:
|
|
8
|
-
|
|
18
|
+
displayName: 'Mindee',
|
|
19
|
+
minimumSupportedRelease: '0.5.0',
|
|
20
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/mindee.png',
|
|
9
21
|
authors: ['kanarelo'],
|
|
10
|
-
|
|
22
|
+
auth: exports.mindeeAuth,
|
|
23
|
+
actions: [
|
|
24
|
+
predict_document_1.mindeePredictDocumentAction,
|
|
25
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
26
|
+
baseUrl: () => 'https://api.mindee.net/v1',
|
|
27
|
+
auth: exports.mindeeAuth,
|
|
28
|
+
authMapping: (auth) => ({
|
|
29
|
+
Authorization: `Token ${auth}`,
|
|
30
|
+
}),
|
|
31
|
+
}),
|
|
32
|
+
],
|
|
11
33
|
triggers: [],
|
|
12
34
|
});
|
|
13
35
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/mindee/src/index.ts"],"names":[],"mappings":";;;AAAA,qEAAwE;AACxE,qEAA6E;AAC7E,+DAAwE;AAE3D,QAAA,UAAU,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC7C,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE;;;;;GAKZ;IACD,QAAQ,EAAE,IAAI;CACf,CAAC,CAAC;AAEU,QAAA,MAAM,GAAG,IAAA,8BAAW,EAAC;IAChC,WAAW,EAAE,QAAQ;IACrB,uBAAuB,EAAE,OAAO;IAChC,OAAO,EAAE,gDAAgD;IACzD,OAAO,EAAE,CAAC,UAAU,CAAC;IACrB,IAAI,EAAE,kBAAU;IAChB,OAAO,EAAE;QACP,8CAA2B;QAC3B,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,2BAA2B;YAC1C,IAAI,EAAE,kBAAU;YAChB,WAAW,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACtB,aAAa,EAAE,SAAS,IAAI,EAAE;aAC/B,CAAC;SACH,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
export declare const mindeePredictDocumentAction: import("@activepieces/pieces-framework").
|
|
1
|
+
export declare const mindeePredictDocumentAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
account_name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_name: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
4
|
+
file: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
5
|
+
}>;
|
|
@@ -6,26 +6,18 @@ const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
|
6
6
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
7
|
const fs_1 = require("fs");
|
|
8
8
|
const form_data_1 = tslib_1.__importDefault(require("form-data"));
|
|
9
|
+
const __1 = require("../..");
|
|
9
10
|
exports.mindeePredictDocumentAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: __1.mindeeAuth,
|
|
10
12
|
name: 'mindee_predict_document',
|
|
11
13
|
displayName: 'Extract Document',
|
|
12
14
|
description: 'Parse details of a document using OCR.',
|
|
13
15
|
props: {
|
|
14
|
-
authentication: pieces_framework_1.Property.SecretText({
|
|
15
|
-
displayName: 'Api Key',
|
|
16
|
-
description: `
|
|
17
|
-
#### To obtain access your Api Key
|
|
18
|
-
1. Sign up and log in to Mindee
|
|
19
|
-
2. Go to [API Key page](https://platform.mindee.com/api-keys)
|
|
20
|
-
3. Copy the Key and paste below.
|
|
21
|
-
`,
|
|
22
|
-
required: true,
|
|
23
|
-
}),
|
|
24
16
|
account_name: pieces_framework_1.Property.ShortText({
|
|
25
17
|
displayName: 'Account Name',
|
|
26
18
|
description: 'Refers to your username or organization name with which you signed up with.',
|
|
27
19
|
required: true,
|
|
28
|
-
defaultValue: 'mindee'
|
|
20
|
+
defaultValue: 'mindee',
|
|
29
21
|
}),
|
|
30
22
|
api_name: pieces_framework_1.Property.StaticDropdown({
|
|
31
23
|
displayName: 'API Name',
|
|
@@ -35,54 +27,25 @@ exports.mindeePredictDocumentAction = (0, pieces_framework_1.createAction)({
|
|
|
35
27
|
options: {
|
|
36
28
|
disabled: false,
|
|
37
29
|
options: [
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{ value: '
|
|
43
|
-
{ value: '
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
{
|
|
31
|
+
value: 'bank_account_details/v1',
|
|
32
|
+
label: 'Bank Account Details OCR',
|
|
33
|
+
},
|
|
34
|
+
{ value: 'expense_reports/v4', label: 'Receipt OCR' },
|
|
35
|
+
{ value: 'passport/v1', label: 'Passport OCR' },
|
|
36
|
+
{ value: 'invoices/v3', label: 'Invoice OCR' },
|
|
37
|
+
{ value: 'proof_of_address/v1', label: 'Proof of Address OCR' },
|
|
38
|
+
{ value: 'financial_document/v1', label: 'Financial Documents OCR' },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
46
41
|
}),
|
|
47
42
|
file: pieces_framework_1.Property.LongText({
|
|
48
43
|
displayName: 'File URL',
|
|
49
44
|
description: 'Remote file URL or Base64 string. We currently support .pdf (slower), .jpg, .png, .webp, .tiff and .heic formats',
|
|
50
|
-
required: true
|
|
51
|
-
})
|
|
52
|
-
},
|
|
53
|
-
sampleData: {
|
|
54
|
-
"api_request": {
|
|
55
|
-
"error": {},
|
|
56
|
-
"resources": [
|
|
57
|
-
"document"
|
|
58
|
-
],
|
|
59
|
-
"status": "success",
|
|
60
|
-
"status_code": 201,
|
|
61
|
-
"url": "http://api.mindee.net/v1/products/mindee/invoices/v3/predict"
|
|
62
|
-
},
|
|
63
|
-
"document": {
|
|
64
|
-
"id": "ecdbe7bd-1037-47a5-87a8-b90d49475a1f",
|
|
65
|
-
"name": "sample_invoce.jpeg",
|
|
66
|
-
"n_pages": 1,
|
|
67
|
-
"is_rotation_applied": true,
|
|
68
|
-
"inference": {
|
|
69
|
-
"started_at": "2021-05-06T16:37:28+00:00",
|
|
70
|
-
"finished_at": "2021-05-06T16:37:29+00:00",
|
|
71
|
-
"processing_time": 1.125,
|
|
72
|
-
"pages": [
|
|
73
|
-
{
|
|
74
|
-
"id": 0,
|
|
75
|
-
"orientation": { "value": 0 },
|
|
76
|
-
"prediction": {},
|
|
77
|
-
"extras": {}
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
"prediction": {},
|
|
81
|
-
"extras": {}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
45
|
+
required: true,
|
|
46
|
+
}),
|
|
84
47
|
},
|
|
85
|
-
run: ({ propsValue: {
|
|
48
|
+
run: ({ auth, propsValue: { api_name, account_name, file } }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
86
49
|
let headers, body = {};
|
|
87
50
|
try {
|
|
88
51
|
const form = new form_data_1.default();
|
|
@@ -94,17 +57,17 @@ exports.mindeePredictDocumentAction = (0, pieces_framework_1.createAction)({
|
|
|
94
57
|
headers = Object.assign({}, form.getHeaders());
|
|
95
58
|
}
|
|
96
59
|
catch (_) {
|
|
97
|
-
body = {
|
|
60
|
+
body = { document: file };
|
|
98
61
|
headers = { 'Content-Type': 'application/json' };
|
|
99
62
|
}
|
|
100
63
|
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
101
64
|
method: pieces_common_1.HttpMethod.POST,
|
|
102
65
|
url: `https://api.mindee.net/v1/products/${account_name}/${api_name}/predict`,
|
|
103
|
-
headers: Object.assign({ Authorization: `Token ${
|
|
104
|
-
body: body
|
|
66
|
+
headers: Object.assign({ Authorization: `Token ${auth}` }, headers),
|
|
67
|
+
body: body,
|
|
105
68
|
});
|
|
106
69
|
return response.body;
|
|
107
|
-
})
|
|
70
|
+
}),
|
|
108
71
|
});
|
|
109
72
|
function getRemoteFile(url) {
|
|
110
73
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predict-document.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"predict-document.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/mindee/src/lib/actions/predict-document.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AACrE,2BAAsC;AACtC,kEAAiC;AACjC,6BAAmC;AAEtB,QAAA,2BAA2B,GAAG,IAAA,+BAAY,EAAC;IACtD,IAAI,EAAE,cAAU;IAChB,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,kBAAkB;IAC/B,WAAW,EAAE,wCAAwC;IACrD,KAAK,EAAE;QACL,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC/B,WAAW,EAAE,cAAc;YAC3B,WAAW,EACT,6EAA6E;YAC/E,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,QAAQ;SACvB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAChC,WAAW,EAAE,UAAU;YACvB,WAAW,EAAE,+CAA+C;YAC5D,QAAQ,EAAE,IAA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