n8n-nodes-docspell 0.1.0

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/LICENSE.md ADDED
@@ -0,0 +1,19 @@
1
+ Copyright 2022 n8n
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # n8n-nodes-docspell
2
+
3
+ This is a n8n community node. It lets you use Docspell in your n8n workflows.
4
+
5
+ Docspell assists in organizing your piles of digital documents, resulting from scanners, e-mails and other sources with minimal effort.
6
+
7
+ [n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/reference/license/) workflow automation platform.
8
+
9
+ [Installation](#installation)
10
+ [Operations](#operations)
11
+ [Credentials](#credentials)
12
+ [Compatibility](#compatibility)
13
+ [Resources](#resources)
14
+
15
+ ## Installation
16
+
17
+ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
18
+
19
+ ## Operations
20
+
21
+ All operations are listed, only a handful are fully tested.
22
+
23
+ ## Credentials
24
+
25
+ Use your full account name collection/username.
26
+
27
+ ## Compatibility
28
+
29
+ This was developed for version 1.99.0 of n8n and version 0.43.0 of Docspell.
30
+
31
+ ## Resources
32
+
33
+ * [n8n community nodes documentation](https://docs.n8n.io/integrations/community-nodes/)
34
+ * [Docspell Introduction](https://docspell.org/docs/)
35
+
36
+
37
+
@@ -0,0 +1,9 @@
1
+ import { IAuthenticate, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class DocspellApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ test: ICredentialTestRequest;
8
+ authenticate: IAuthenticate;
9
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DocspellApi = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ class DocspellApi {
9
+ constructor() {
10
+ this.name = 'docspellApi';
11
+ this.displayName = 'Docspell API';
12
+ this.documentationUrl = 'https://docspell.org/docs/api/intro/#authentication';
13
+ this.properties = [
14
+ {
15
+ displayName: 'URL',
16
+ name: 'url',
17
+ type: 'string',
18
+ default: '',
19
+ required: true
20
+ },
21
+ {
22
+ displayName: 'Account name',
23
+ name: 'account',
24
+ type: 'string',
25
+ default: '',
26
+ required: true
27
+ },
28
+ {
29
+ displayName: 'Password',
30
+ name: 'password',
31
+ type: 'string',
32
+ typeOptions: {
33
+ password: true,
34
+ },
35
+ default: '',
36
+ required: true
37
+ }
38
+ ];
39
+ this.test = {
40
+ request: {
41
+ baseURL: '={{$credentials?.url}}/api/v1',
42
+ url: '/open/auth/login',
43
+ method: 'POST',
44
+ body: {
45
+ account: '={{$credentials?.account}}',
46
+ password: '={{$credentials?.password}}'
47
+ }
48
+ },
49
+ rules: [
50
+ {
51
+ type: 'responseSuccessBody',
52
+ properties: {
53
+ message: 'Login wasn\'t successful',
54
+ key: 'success',
55
+ value: false
56
+ }
57
+ }
58
+ ]
59
+ };
60
+ this.authenticate = async (rawCredentials, requestOptions) => {
61
+ const creds = rawCredentials;
62
+ const axiosRequestConfig = {
63
+ headers: {
64
+ 'Content-Type': 'application/json',
65
+ },
66
+ method: 'POST',
67
+ data: {
68
+ account: creds.account,
69
+ password: creds.password
70
+ },
71
+ url: `${creds.url}/api/v1/open/auth/login`,
72
+ };
73
+ const result = await (0, axios_1.default)(axiosRequestConfig);
74
+ const { token } = result.data;
75
+ requestOptions.headers = {
76
+ ...requestOptions.headers,
77
+ 'X-Docspell-Auth': token,
78
+ };
79
+ return requestOptions;
80
+ };
81
+ }
82
+ }
83
+ exports.DocspellApi = DocspellApi;
84
+ //# sourceMappingURL=DocspellApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocspellApi.credentials.js","sourceRoot":"","sources":["../../credentials/DocspellApi.credentials.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAkD;AAelD,MAAa,WAAW;IAAxB;QACC,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,cAAc,CAAC;QAC7B,qBAAgB,GAAG,qDAAqD,CAAC;QACzE,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,KAAK;gBAClB,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,cAAc;gBAC3B,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,UAAU;gBACvB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;o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ill';
3
+ export declare class Docspell implements INodeType {
4
+ description: INodeTypeDescription;
5
+ }
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.Docspell = void 0;
27
+ require("cross-fetch/polyfill");
28
+ const doc = __importStar(require("./openapi.json"));
29
+ const n8n_openapi_node_1 = require("@devlikeapro/n8n-openapi-node");
30
+ const config = {};
31
+ const parser = new n8n_openapi_node_1.N8NPropertiesBuilder(doc, config);
32
+ const properties = parser.build();
33
+ class Docspell {
34
+ constructor() {
35
+ this.description = {
36
+ displayName: 'Docspell',
37
+ name: 'docspell',
38
+ icon: 'file:docspell.svg',
39
+ group: ['transform'],
40
+ version: 1,
41
+ subtitle: '={{$parameter["operation"] + " " + $parameter["resource"]}}',
42
+ description: 'Consume Docspell API',
43
+ defaults: {
44
+ name: 'Docspell',
45
+ },
46
+ inputs: ['main'],
47
+ outputs: ['main'],
48
+ credentials: [
49
+ {
50
+ name: 'docspellApi',
51
+ required: true,
52
+ },
53
+ ],
54
+ requestDefaults: {
55
+ baseURL: '={{$credentials.url}}/api/v1'
56
+ },
57
+ properties: properties
58
+ };
59
+ }
60
+ }
61
+ exports.Docspell = Docspell;
62
+ //# sourceMappingURL=Docspell.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Docspell.node.js","sourceRoot":"","sources":["../../../nodes/Docspell/Docspell.node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,gCAA8B;AAC9B,oDAAsC;AACtC,oEAAiG;AAEjG,MAAM,MAAM,GAA+B,EAAE,CAAA;AAC7C,MAAM,MAAM,GAAG,IAAI,uCAAoB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACrD,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,EAAE,CAAA;AAEjC,MAAa,QAAQ;IAArB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,mBAAmB;YACzB,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,6DAA6D;YACvE,WAAW,EAAE,sBAAsB;YACnC,QAAQ,EAAE;gBACT,IAAI,EAAE,UAAU;aAChB;YACD,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,aAAa;oBACnB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,eAAe,EAAE;gBAChB,OAAO,EAAE,8BAA8B;aACvC;YACD,UAAU,EAAE,UAAU;SACtB,CAAC;IACH,CAAC;CAAA;AAzBD,4BAyBC"}
@@ -0,0 +1,20 @@
1
+ {
2
+ "node": "n8n-nodes-base.Docspell",
3
+ "nodeVersion": "1.0",
4
+ "codexVersion": "1.0",
5
+ "categories": [
6
+ "Miscellaneous"
7
+ ],
8
+ "resources": {
9
+ "credentialDocumentation": [
10
+ {
11
+ "url": "https://docspell.org/docs/api/intro/#authentication"
12
+ }
13
+ ],
14
+ "primaryDocumentation": [
15
+ {
16
+ "url": "https://docspell.org/docs/api/intro/"
17
+ }
18
+ ]
19
+ }
20
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" id="svg8" x="0" y="0" version="1.1" viewBox="0 0 512 512"><style>.st2{fill:#9c0011}</style><g id="layer1" transform="translate(-36.018 -22.72)"><path id="path4746" d="M540.2 216.2c34.5 137-48.6 276.1-185.6 310.7S78.5 478.4 43.9 341.4 92.3 65.2 229.3 30.6c137-34.7 276.2 48.3 310.9 185.3" style="fill:#1c2d61"/><path id="path4746-6" d="M473.5 233.2c25.1 99.7-35.3 200.8-135 225.9s-200.8-35.3-226-134.9 35.2-200.8 134.8-226C347 73 448.3 133.4 473.5 233" style="fill:#f0f8ff"/><g id="g4744" transform="translate(8.557 109.2)"><path id="path4677-7-3-9" d="M408.8 136.3c17.7 73.3-24.8 147.8-95 166.2s-141.3-25.9-159-99.3 24.8-147.8 94.8-166.3 141.3 25.8 159 99.1" class="st2"/><path id="rect4736-4" d="m418.2-57.9 7.8.9c13.5 1.6 23.1 13.8 21.3 27.4l-41.9 320c-1.8 13.5-14.2 23.2-27.7 21.6l-7.8-.9c-13.5-1.6-23.1-13.8-21.3-27.4l41.9-320c1.7-13.5 14.2-23.1 27.7-21.6" class="st2"/></g></g></svg>