n8n-nodes-docspell 0.1.0 → 0.43.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.
Files changed (54) hide show
  1. package/README.md +31 -3
  2. package/dist/credentials/DocspellApi.credentials.d.ts +2 -1
  3. package/dist/credentials/DocspellApi.credentials.js +20 -36
  4. package/dist/credentials/DocspellApi.credentials.js.map +1 -1
  5. package/dist/credentials/DocspellSession.d.ts +7 -0
  6. package/dist/credentials/DocspellSession.js +91 -0
  7. package/dist/credentials/DocspellSession.js.map +1 -0
  8. package/dist/credentials/docspell.svg +1 -0
  9. package/dist/nodes/Common/GenericFunctions.d.ts +31 -0
  10. package/dist/nodes/Common/GenericFunctions.js +125 -0
  11. package/dist/nodes/Common/GenericFunctions.js.map +1 -0
  12. package/dist/nodes/Docspell/Docspell.node.d.ts +12 -2
  13. package/dist/nodes/Docspell/Docspell.node.js +88 -37
  14. package/dist/nodes/Docspell/Docspell.node.js.map +1 -1
  15. package/dist/nodes/Docspell/methods/loadOptions.d.ts +9 -0
  16. package/dist/nodes/Docspell/methods/loadOptions.js +44 -0
  17. package/dist/nodes/Docspell/methods/loadOptions.js.map +1 -0
  18. package/dist/nodes/Docspell/resources/attachment/download.d.ts +4 -0
  19. package/dist/nodes/Docspell/resources/attachment/download.js +89 -0
  20. package/dist/nodes/Docspell/resources/attachment/download.js.map +1 -0
  21. package/dist/nodes/Docspell/resources/attachment/index.d.ts +2 -0
  22. package/dist/nodes/Docspell/resources/attachment/index.js +24 -0
  23. package/dist/nodes/Docspell/resources/attachment/index.js.map +1 -0
  24. package/dist/nodes/Docspell/resources/item/get.d.ts +3 -0
  25. package/dist/nodes/Docspell/resources/item/get.js +28 -0
  26. package/dist/nodes/Docspell/resources/item/get.js.map +1 -0
  27. package/dist/nodes/Docspell/resources/item/index.d.ts +2 -0
  28. package/dist/nodes/Docspell/resources/item/index.js +56 -0
  29. package/dist/nodes/Docspell/resources/item/index.js.map +1 -0
  30. package/dist/nodes/Docspell/resources/item/search.d.ts +10 -0
  31. package/dist/nodes/Docspell/resources/item/search.js +104 -0
  32. package/dist/nodes/Docspell/resources/item/search.js.map +1 -0
  33. package/dist/nodes/Docspell/resources/item/update.d.ts +13 -0
  34. package/dist/nodes/Docspell/resources/item/update.js +271 -0
  35. package/dist/nodes/Docspell/resources/item/update.js.map +1 -0
  36. package/dist/nodes/Docspell/resources/item/updateMany.d.ts +3 -0
  37. package/dist/nodes/Docspell/resources/item/updateMany.js +147 -0
  38. package/dist/nodes/Docspell/resources/item/updateMany.js.map +1 -0
  39. package/dist/nodes/Docspell/resources/item/upload.d.ts +3 -0
  40. package/dist/nodes/Docspell/resources/item/upload.js +163 -0
  41. package/dist/nodes/Docspell/resources/item/upload.js.map +1 -0
  42. package/dist/nodes/Docspell/resources/organization/get.d.ts +3 -0
  43. package/dist/nodes/Docspell/resources/organization/get.js +28 -0
  44. package/dist/nodes/Docspell/resources/organization/get.js.map +1 -0
  45. package/dist/nodes/Docspell/resources/organization/getAll.d.ts +3 -0
  46. package/dist/nodes/Docspell/resources/organization/getAll.js +50 -0
  47. package/dist/nodes/Docspell/resources/organization/getAll.js.map +1 -0
  48. package/dist/nodes/Docspell/resources/organization/index.d.ts +2 -0
  49. package/dist/nodes/Docspell/resources/organization/index.js +32 -0
  50. package/dist/nodes/Docspell/resources/organization/index.js.map +1 -0
  51. package/dist/package.json +58 -22
  52. package/dist/tsconfig.tsbuildinfo +1 -1
  53. package/package.json +58 -22
  54. package/dist/nodes/Docspell/openapi.json +0 -12493
package/README.md CHANGED
@@ -18,15 +18,43 @@ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes
18
18
 
19
19
  ## Operations
20
20
 
21
- All operations are listed, only a handful are fully tested.
21
+ **Item**
22
+
23
+ - **Get**: fetch the full detail of one item by its ID (tags, attachments, notes, custom fields, correspondents). Chain it after Search with `{{ $json.id }}`.
24
+ - **Update**: change an item's name, notes, direction, item date, due date, folder, correspondent organization and person, concerning person and equipment, tags and custom fields. Only the fields you add are touched, and an empty value removes the current one where that makes sense. Tags can be replaced, added to or removed, by name or ID, and a tag that does not exist is an error instead of being ignored. Folder, organization, person, equipment, tags and custom fields are chosen from lists loaded from your Docspell; an expression can still supply a name or ID. Custom fields can also be removed from the item (an item without the field is left as it is). The updated item is returned. If a change fails part-way, the error lists what was already applied.
25
+ - **Update Many**: apply the same changes to several items at once, by a list of item IDs (separated by commas, spaces or new lines; take them from a Search with an expression). The fields are those of Update except the notes, which Docspell cannot change in bulk. You can also remove a custom field from all of them. Every ID is checked first, because Docspell silently ignores IDs it does not know. Nothing is changed if one is missing. Returns the updated items.
26
+ - **Upload**: upload files from the incoming binary data, either one file per input item or several at once (comma-separated binary field names). Docspell turns them into items after processing, so the result lists the uploaded file names rather than item IDs; use Search to find the items afterwards. Options (folder and tags are chosen from lists): direction, folder, tags, language, one item for all files, skip duplicates, flatten archives, file filter and attachments only. A folder or tag that does not exist is an error instead of being ignored.
27
+ - **Search**: find items with Docspell's [query language](https://docspell.org/docs/query/). Returns one n8n item per Docspell item. Supports *Return All*, a limit, an offset, searching the trash, and *Include Details* to also resolve tags and attachments.
28
+
29
+ **Attachment**
30
+
31
+ - **Download**: download the file of an attachment as binary data, ready for other nodes (save it, send it, attach it). Take the attachment ID from the `attachments` of Item > Get or of a Search with details. Choose the version: the file as Docspell shows it (the converted PDF where there is one), the original upload, the archive, or the preview image. The file is kept byte for byte. It is read into memory as a whole, so very large files need that much memory in n8n.
32
+
33
+ **Organization**
34
+
35
+ - **Get**: fetch one organization by its ID, including its short name, address and contacts. An item only carries the ID and name of its correspondent organization, so use this to get the rest.
36
+ - **Get Many**: list the organizations. The filter matches the name or short name. Returns one n8n item per organization.
37
+
38
+ More operations are planned.
22
39
 
23
40
  ## Credentials
24
41
 
25
- Use your full account name collection/username.
42
+ Use the URL of your Docspell instance, your full account name (`collective/username`) and your password. Accounts with two-factor authentication are not supported. The node logs in once and reuses the session until shortly before it expires.
26
43
 
27
44
  ## Compatibility
28
45
 
29
- This was developed for version 1.99.0 of n8n and version 0.43.0 of Docspell.
46
+ <!-- n8n-node-tooling:compatibility -->
47
+ Last tested with n8n 2.45.7 and Docspell 0.43.0.
48
+ <!-- /n8n-node-tooling:compatibility -->
49
+
50
+ ## Versioning
51
+
52
+ The package version mirrors the Docspell it was last tested with: `major.minor` is Docspell's, so `0.43.x` goes with Docspell `0.43`. The patch number is this package's own counter.
53
+
54
+ - Every change to the node, **including breaking ones**, only bumps the patch. Breaking changes are called out in the release notes, not in the version number. Read the notes before updating.
55
+ - When Docspell's major or minor version changes, the next release is `<major>.<minor>.0`, after the nightly compatibility check has passed against the new Docspell.
56
+
57
+ Versions before `0.43.0` (the single `0.1.0` release) used an independent numbering and were a different, generated node. `0.43.0` is the first release under this scheme; it is numerically higher than `0.1.0`, so updates are not blocked.
30
58
 
31
59
  ## Resources
32
60
 
@@ -1,7 +1,8 @@
1
- import { IAuthenticate, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
1
+ import { IAuthenticate, IconFile, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
2
  export declare class DocspellApi implements ICredentialType {
3
3
  name: string;
4
4
  displayName: string;
5
+ icon: IconFile;
5
6
  documentationUrl: string;
6
7
  properties: INodeProperties[];
7
8
  test: ICredentialTestRequest;
@@ -1,14 +1,12 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.DocspellApi = void 0;
7
- const axios_1 = __importDefault(require("axios"));
4
+ const DocspellSession_1 = require("./DocspellSession");
8
5
  class DocspellApi {
9
6
  constructor() {
10
7
  this.name = 'docspellApi';
11
8
  this.displayName = 'Docspell API';
9
+ this.icon = 'file:docspell.svg';
12
10
  this.documentationUrl = 'https://docspell.org/docs/api/intro/#authentication';
13
11
  this.properties = [
14
12
  {
@@ -16,14 +14,14 @@ class DocspellApi {
16
14
  name: 'url',
17
15
  type: 'string',
18
16
  default: '',
19
- required: true
17
+ required: true,
20
18
  },
21
19
  {
22
- displayName: 'Account name',
20
+ displayName: 'Account Name',
23
21
  name: 'account',
24
22
  type: 'string',
25
23
  default: '',
26
- required: true
24
+ required: true,
27
25
  },
28
26
  {
29
27
  displayName: 'Password',
@@ -33,50 +31,36 @@ class DocspellApi {
33
31
  password: true,
34
32
  },
35
33
  default: '',
36
- required: true
37
- }
34
+ required: true,
35
+ },
38
36
  ];
39
37
  this.test = {
40
38
  request: {
41
- baseURL: '={{$credentials?.url}}/api/v1',
42
- url: '/open/auth/login',
39
+ baseURL: '={{$credentials?.url?.replace(/\\/$/, \'\')}}',
40
+ url: '/api/v1/open/auth/login',
43
41
  method: 'POST',
44
42
  body: {
45
43
  account: '={{$credentials?.account}}',
46
- password: '={{$credentials?.password}}'
47
- }
44
+ password: '={{$credentials?.password}}',
45
+ },
48
46
  },
49
47
  rules: [
50
48
  {
51
49
  type: 'responseSuccessBody',
52
50
  properties: {
53
- message: 'Login wasn\'t successful',
51
+ message: "Login wasn't successful",
54
52
  key: 'success',
55
- value: false
56
- }
57
- }
58
- ]
53
+ value: false,
54
+ },
55
+ },
56
+ ],
59
57
  };
60
58
  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,
59
+ const token = await (0, DocspellSession_1.getSessionToken)(rawCredentials);
60
+ return {
61
+ ...requestOptions,
62
+ headers: { ...requestOptions.headers, 'X-Docspell-Auth': token },
78
63
  };
79
- return requestOptions;
80
64
  };
81
65
  }
82
66
  }
@@ -1 +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;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACd;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,+BAA+B;gBACxC,GAAG,EAAE,kBAAkB;gBACvB,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACL,OAAO,EAAE,4BAA4B;oBACrC,QAAQ,EAAE,6BAA6B;iBACvC;aACD;YACD,KAAK,EAAE;gBACN;oBACC,IAAI,EAAE,qBAAqB;oBAC3B,UAAU,EAAE;wBACX,OAAO,EAAE,0BAA0B;wBACnC,GAAG,EAAE,SAAS;wBACd,KAAK,EAAE,KAAK;qBACZ;iBACD;aACD;SACD,CAAA;QAED,iBAAY,GAAkB,KAAK,EAAE,cAAc,EAAE,cAAc,EAAgC,EAAE;YACpG,MAAM,KAAK,GAAG,cAAwC,CAAC;YAEvD,MAAM,kBAAkB,GAAuB;gBAC9C,OAAO,EAAE;oBACR,cAAc,EAAE,kBAAkB;iBAClC;gBACD,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACL,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;iBACxB;gBACD,GAAG,EAAE,GAAG,KAAK,CAAC,GAAG,yBAAyB;aAC1C,CAAC;YACF,MAAM,MAAM,GAAG,MAAM,IAAA,eAAK,EAAC,kBAAkB,CAAC,CAAC;YAC/C,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,CAAC,IAAI,CAAC;YAE5B,cAAc,CAAC,OAAO,GAAG;gBACxB,GAAG,cAAc,CAAC,OAAO;gBACzB,iBAAiB,EAAE,KAAK;aACxB,CAAA;YAED,OAAO,cAAc,CAAC;QACvB,CAAC,CAAC;IACH,CAAC;CAAA;AA7ED,kCA6EC"}
1
+ {"version":3,"file":"DocspellApi.credentials.js","sourceRoot":"","sources":["../../credentials/DocspellApi.credentials.ts"],"names":[],"mappings":";;;AASA,uDAA8E;AAE9E,MAAa,WAAW;IAAxB;QACC,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,cAAc,CAAC;QAC7B,SAAI,GAAG,mBAA+B,CAAC;QACvC,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;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;aACd;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,+CAA+C;gBACxD,GAAG,EAAE,yBAAyB;gBAC9B,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACL,OAAO,EAAE,4BAA4B;oBACrC,QAAQ,EAAE,6BAA6B;iBACvC;aACD;YACD,KAAK,EAAE;gBACN;oBACC,IAAI,EAAE,qBAAqB;oBAC3B,UAAU,EAAE;wBACX,OAAO,EAAE,yBAAyB;wBAClC,GAAG,EAAE,SAAS;wBACd,KAAK,EAAE,KAAK;qBACZ;iBACD;aACD;SACD,CAAC;QAEF,iBAAY,GAAkB,KAAK,EAAE,cAAc,EAAE,cAAc,EAAgC,EAAE;YACpG,MAAM,KAAK,GAAG,MAAM,IAAA,iCAAe,EAAC,cAAqD,CAAC,CAAC;YAE3F,OAAO;gBACN,GAAG,cAAc;gBACjB,OAAO,EAAE,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE;aAChE,CAAC;QACH,CAAC,CAAC;IACH,CAAC;CAAA;AA9DD,kCA8DC"}
@@ -0,0 +1,7 @@
1
+ export interface DocspellLoginCredentials {
2
+ url: string;
3
+ account: string;
4
+ password: string;
5
+ }
6
+ export declare function getSessionToken(credentials: DocspellLoginCredentials, timeoutMs?: number): Promise<string>;
7
+ export declare function resetSessionCache(): void;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSessionToken = getSessionToken;
4
+ exports.resetSessionCache = resetSessionCache;
5
+ const node_crypto_1 = require("node:crypto");
6
+ const EXPIRY_MARGIN_MS = 30000;
7
+ const LOGIN_TIMEOUT_MS = 30000;
8
+ const sessions = new Map();
9
+ const logins = new Map();
10
+ function baseUrl(url) {
11
+ return url.replace(/\/+$/, '');
12
+ }
13
+ function cacheKey({ url, account, password }) {
14
+ return (0, node_crypto_1.createHash)('sha256')
15
+ .update([baseUrl(url), account, password].join('\0'))
16
+ .digest('hex');
17
+ }
18
+ function unreachable(url, error) {
19
+ var _a, _b;
20
+ const cause = error.cause;
21
+ const reason = (_b = (_a = cause === null || cause === void 0 ? void 0 : cause.code) !== null && _a !== void 0 ? _a : cause === null || cause === void 0 ? void 0 : cause.message) !== null && _b !== void 0 ? _b : error.message;
22
+ return new Error(`Could not reach Docspell at ${url}: ${reason}`);
23
+ }
24
+ async function login(credentials, timeoutMs) {
25
+ var _a, _b;
26
+ const url = baseUrl(credentials.url);
27
+ let response;
28
+ try {
29
+ response = await fetch(`${url}/api/v1/open/auth/login`, {
30
+ method: 'POST',
31
+ headers: { 'Content-Type': 'application/json' },
32
+ body: JSON.stringify({ account: credentials.account, password: credentials.password }),
33
+ signal: AbortSignal.timeout(timeoutMs),
34
+ });
35
+ }
36
+ catch (error) {
37
+ throw unreachable(url, error);
38
+ }
39
+ if (!response.ok) {
40
+ throw new Error(`Docspell login at ${url} failed with HTTP ${response.status}`);
41
+ }
42
+ let text;
43
+ try {
44
+ text = await response.text();
45
+ }
46
+ catch (error) {
47
+ throw unreachable(url, error);
48
+ }
49
+ let body;
50
+ try {
51
+ body = JSON.parse(text);
52
+ }
53
+ catch {
54
+ throw new Error(`Docspell login at ${url} returned a response that is not JSON`);
55
+ }
56
+ if (!body.success) {
57
+ throw new Error(`Docspell login failed for account "${credentials.account}": ${(_a = body.message) !== null && _a !== void 0 ? _a : 'no reason given'}`);
58
+ }
59
+ if (body.requireSecondFactor) {
60
+ throw new Error(`Docspell account "${credentials.account}" requires two-factor authentication, which this node does not support`);
61
+ }
62
+ if (!body.token) {
63
+ throw new Error(`Docspell login for account "${credentials.account}" returned no token`);
64
+ }
65
+ return {
66
+ token: body.token,
67
+ expiresAt: Date.now() + Math.max(0, ((_b = body.validMs) !== null && _b !== void 0 ? _b : 0) - EXPIRY_MARGIN_MS),
68
+ };
69
+ }
70
+ async function getSessionToken(credentials, timeoutMs = LOGIN_TIMEOUT_MS) {
71
+ const key = cacheKey(credentials);
72
+ const cached = sessions.get(key);
73
+ if (cached && cached.expiresAt > Date.now())
74
+ return cached.token;
75
+ const running = logins.get(key);
76
+ if (running)
77
+ return running;
78
+ const attempt = login(credentials, timeoutMs)
79
+ .then((session) => {
80
+ sessions.set(key, session);
81
+ return session.token;
82
+ })
83
+ .finally(() => logins.delete(key));
84
+ logins.set(key, attempt);
85
+ return attempt;
86
+ }
87
+ function resetSessionCache() {
88
+ sessions.clear();
89
+ logins.clear();
90
+ }
91
+ //# sourceMappingURL=DocspellSession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocspellSession.js","sourceRoot":"","sources":["../../credentials/DocspellSession.ts"],"names":[],"mappings":";;AA8GA,0CAqBC;AAED,8CAGC;AAxID,6CAAyC;AAuBzC,MAAM,gBAAgB,GAAG,KAAM,CAAC;AAIhC,MAAM,gBAAgB,GAAG,KAAM,CAAC;AAKhC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAyB,CAAC;AAClD,MAAM,MAAM,GAAG,IAAI,GAAG,EAA2B,CAAC;AAElD,SAAS,OAAO,CAAC,GAAW;IAC3B,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAID,SAAS,QAAQ,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAA4B;IACrE,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC;SACzB,MAAM,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACpD,MAAM,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC;AAID,SAAS,WAAW,CAAC,GAAW,EAAE,KAAc;;IAC/C,MAAM,KAAK,GAAI,KAAyD,CAAC,KAAK,CAAC;IAC/E,MAAM,MAAM,GAAG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O,OAAO,CAAC;IAE5B,MAAM,OAAO,GAAG,KAAK,CAAC,WAAW,EAAE,SAAS,CAAC;SAC3C,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE;QACjB,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAC3B,OAAO,OAAO,CAAC,KAAK,CAAC;IACtB,CAAC,CAAC;SACD,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACpC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACzB,OAAO,OAAO,CAAC;AAChB,CAAC;AAED,SAAgB,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACjB,MAAM,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC"}
@@ -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>
@@ -0,0 +1,31 @@
1
+ import type { IDataObject, IExecuteFunctions, IHttpRequestMethods, IHttpRequestOptions, ILoadOptionsFunctions } from 'n8n-workflow';
2
+ interface DocspellRequest {
3
+ method: IHttpRequestMethods;
4
+ endpoint: string;
5
+ body?: IHttpRequestOptions['body'];
6
+ qs?: IDataObject;
7
+ }
8
+ export type StatusMessages = Partial<Record<number, string>>;
9
+ export declare function docspellApiRequest(context: IExecuteFunctions | ILoadOptionsFunctions, { method, endpoint, body, qs }: DocspellRequest, statusMessages?: StatusMessages): Promise<IDataObject>;
10
+ export interface Named {
11
+ id: string;
12
+ name: string;
13
+ }
14
+ export interface ResolvedTags {
15
+ ids: string[];
16
+ names: string[];
17
+ unknown: string[];
18
+ }
19
+ export declare function resolveTags(context: IExecuteFunctions, tokens: string[]): Promise<ResolvedTags>;
20
+ export declare function splitList(text: string): string[];
21
+ export declare function tagTokens(value: unknown): string[];
22
+ export declare function hasMissingTag(value: unknown): boolean;
23
+ export interface DownloadedFile {
24
+ buffer: Buffer;
25
+ headers: Record<string, string>;
26
+ }
27
+ export declare function docspellDownload(context: IExecuteFunctions, endpoint: string, statusMessages?: StatusMessages): Promise<DownloadedFile>;
28
+ export declare function dateBody(label: string, value: unknown, fail: (message: string) => Error): IDataObject;
29
+ export declare function rethrowWithApplied(applied: string[], error: unknown, fail: (message: string) => Error): never;
30
+ export declare function resolveRemovedCustomFields(context: IExecuteFunctions, remove: string[], set: string[], fail: (message: string) => Error): Promise<Named[]>;
31
+ export {};
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.docspellApiRequest = docspellApiRequest;
4
+ exports.resolveTags = resolveTags;
5
+ exports.splitList = splitList;
6
+ exports.tagTokens = tagTokens;
7
+ exports.hasMissingTag = hasMissingTag;
8
+ exports.docspellDownload = docspellDownload;
9
+ exports.dateBody = dateBody;
10
+ exports.rethrowWithApplied = rethrowWithApplied;
11
+ exports.resolveRemovedCustomFields = resolveRemovedCustomFields;
12
+ const n8n_workflow_1 = require("n8n-workflow");
13
+ async function docspellApiRequest(context, { method, endpoint, body, qs }, statusMessages = {}) {
14
+ var _a, _b;
15
+ const { url } = await context.getCredentials('docspellApi');
16
+ const options = {
17
+ method,
18
+ baseURL: `${String(url).replace(/\/+$/, '')}/api/v1`,
19
+ url: endpoint,
20
+ body,
21
+ qs,
22
+ json: true,
23
+ };
24
+ try {
25
+ return (await context.helpers.httpRequestWithAuthentication.call(context, 'docspellApi', options));
26
+ }
27
+ catch (error) {
28
+ const status = Number((_a = error.httpCode) !== null && _a !== void 0 ? _a : (_b = error.response) === null || _b === void 0 ? void 0 : _b.status);
29
+ throw new n8n_workflow_1.NodeApiError(context.getNode(), error, {
30
+ message: statusMessages[status],
31
+ });
32
+ }
33
+ }
34
+ async function resolveTags(context, tokens) {
35
+ const known = (await docspellApiRequest(context, { method: 'GET', endpoint: '/sec/tag' })).items;
36
+ const resolved = tokens.map((token) => { var _a; return (_a = known.find((tag) => tag.id === token)) !== null && _a !== void 0 ? _a : known.find((tag) => tag.name === token); });
37
+ return {
38
+ ids: resolved.filter((tag) => tag !== undefined).map((tag) => tag.id),
39
+ names: resolved.filter((tag) => tag !== undefined).map((tag) => tag.name),
40
+ unknown: tokens.filter((_, index) => resolved[index] === undefined),
41
+ };
42
+ }
43
+ function splitList(text) {
44
+ return text
45
+ .split(',')
46
+ .map((token) => token.trim())
47
+ .filter((token) => token !== '');
48
+ }
49
+ function tagTokens(value) {
50
+ const entries = Array.isArray(value) ? value : [value];
51
+ return entries.flatMap((entry) => splitList(entry === undefined || entry === null ? '' : String(entry)));
52
+ }
53
+ function hasMissingTag(value) {
54
+ return (Array.isArray(value) ? value : [value]).some((entry) => entry === undefined || entry === null);
55
+ }
56
+ async function docspellDownload(context, endpoint, statusMessages = {}) {
57
+ var _a, _b;
58
+ const { url } = await context.getCredentials('docspellApi');
59
+ const options = {
60
+ method: 'GET',
61
+ baseURL: `${String(url).replace(/\/+$/, '')}/api/v1`,
62
+ url: endpoint,
63
+ encoding: 'arraybuffer',
64
+ returnFullResponse: true,
65
+ json: false,
66
+ };
67
+ try {
68
+ const response = (await context.helpers.httpRequestWithAuthentication.call(context, 'docspellApi', options));
69
+ return { buffer: Buffer.from(response.body), headers: response.headers };
70
+ }
71
+ catch (error) {
72
+ const status = Number((_a = error.httpCode) !== null && _a !== void 0 ? _a : (_b = error.response) === null || _b === void 0 ? void 0 : _b.status);
73
+ throw new n8n_workflow_1.NodeApiError(context.getNode(), error, {
74
+ message: statusMessages[status],
75
+ });
76
+ }
77
+ }
78
+ function dateBody(label, value, fail) {
79
+ if (value === '' || value === undefined || value === null)
80
+ return { date: null };
81
+ const text = String(value);
82
+ const time = new Date(text).getTime();
83
+ if (Number.isNaN(time))
84
+ throw fail(`${label} "${text}" is not a valid date`);
85
+ const day = /^(\d{4})-(\d{2})-(\d{2})/.exec(text.trim());
86
+ if (day) {
87
+ const [year, month, date] = day.slice(1).map(Number);
88
+ const check = new Date(Date.UTC(year, month - 1, date));
89
+ if (check.getUTCFullYear() !== year || check.getUTCMonth() !== month - 1 || check.getUTCDate() !== date) {
90
+ throw fail(`${label} "${text}" is not a valid date`);
91
+ }
92
+ }
93
+ return { date: time };
94
+ }
95
+ function rethrowWithApplied(applied, error, fail) {
96
+ var _a;
97
+ if (applied.length === 0)
98
+ throw error;
99
+ const note = `already applied: ${applied.join(', ')}`;
100
+ if (error instanceof n8n_workflow_1.NodeApiError || error instanceof n8n_workflow_1.NodeOperationError) {
101
+ if (!`${error.message} ${(_a = error.description) !== null && _a !== void 0 ? _a : ''}`.includes('already applied')) {
102
+ error.message = `${error.message} (${note})`;
103
+ error.description = error.description ? `${error.description} (${note})` : note;
104
+ }
105
+ throw error;
106
+ }
107
+ throw fail(`${error instanceof Error ? error.message : String(error)} (${note})`);
108
+ }
109
+ async function resolveRemovedCustomFields(context, remove, set, fail) {
110
+ if (remove.length === 0)
111
+ return [];
112
+ const known = (await docspellApiRequest(context, { method: 'GET', endpoint: '/sec/customfield' })).items;
113
+ const find = (token) => known.find((field) => field.name === token || field.id === token);
114
+ const unknown = remove.filter((token) => find(token) === undefined);
115
+ if (unknown.length > 0) {
116
+ throw fail(`Custom field${unknown.length > 1 ? 's' : ''} not found in Docspell: ${unknown.map((name) => `"${name}"`).join(', ')}`);
117
+ }
118
+ const fields = [...new Map(remove.map((token) => find(token)).map((field) => [field.id, field])).values()];
119
+ const setIds = new Set(set.map((token) => { var _a, _b; return (_b = (_a = find(token)) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : token; }));
120
+ const both = fields.filter((field) => setIds.has(field.id));
121
+ if (both.length > 0)
122
+ throw fail(`Custom field ${both.map((field) => `"${field.name}"`).join(', ')} is both set and removed`);
123
+ return fields;
124
+ }
125
+ //# sourceMappingURL=GenericFunctions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/Common/GenericFunctions.ts"],"names":[],"mappings":";;AAoBA,gDA8BC;AAeD,kCAQC;AAGD,8BAKC;AAID,8BAGC;AAID,sCAEC;AAQD,4CA8BC;AAID,4BAcC;AAGD,gDAYC;AAKD,gEAoBC;AAtLD,+CAAgE;AAYzD,KAAK,UAAU,kBAAkB,CACvC,OAAkD,EAClD,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAmB,EAC/C,iBAAiC,EAAE;;IAEnC,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,OAAO,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;IAE5D,MAAM,OAAO,GAAwB;QACpC,MAAM;QACN,OAAO,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS;QACpD,GAAG,EAAE,QAAQ;QACb,IAAI;QACJ,EAAE;QACF,IAAI,EAAE,IAAI;KACV,CAAC;IAE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EAAE,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpI,CAAC;IACD,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAE5G,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,eAAC,OAAA,MAAA,MAAA,IAAI,CAAC,KAAK,CAAC,0CAAE,EAAE,mCAAI,KAAK,CAAA,EAAA,CAAC,CAAC,CAAC;IACrE,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5D,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,CAAC,gBAAgB,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IAC7H,OAAO,MAAM,CAAC;AACf,CAAC"}
@@ -1,5 +1,15 @@
1
- import { INodeType, INodeTypeDescription } from 'n8n-workflow';
2
- import 'cross-fetch/polyfill';
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
3
2
  export declare class Docspell implements INodeType {
4
3
  description: INodeTypeDescription;
4
+ methods: {
5
+ loadOptions: {
6
+ getTags(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
7
+ getFolders(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
8
+ getOrganizations(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
9
+ getPersons(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
10
+ getEquipment(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
11
+ getCustomFields(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
12
+ };
13
+ };
14
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
15
  }
@@ -1,35 +1,19 @@
1
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
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
3
  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();
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const attachment_1 = require("./resources/attachment");
6
+ const download_1 = require("./resources/attachment/download");
7
+ const loadOptions_1 = require("./methods/loadOptions");
8
+ const item_1 = require("./resources/item");
9
+ const get_1 = require("./resources/item/get");
10
+ const search_1 = require("./resources/item/search");
11
+ const update_1 = require("./resources/item/update");
12
+ const updateMany_1 = require("./resources/item/updateMany");
13
+ const upload_1 = require("./resources/item/upload");
14
+ const organization_1 = require("./resources/organization");
15
+ const get_2 = require("./resources/organization/get");
16
+ const getAll_1 = require("./resources/organization/getAll");
33
17
  class Docspell {
34
18
  constructor() {
35
19
  this.description = {
@@ -38,24 +22,91 @@ class Docspell {
38
22
  icon: 'file:docspell.svg',
39
23
  group: ['transform'],
40
24
  version: 1,
41
- subtitle: '={{$parameter["operation"] + " " + $parameter["resource"]}}',
42
- description: 'Consume Docspell API',
25
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
26
+ description: 'Work with the documents in your Docspell instance',
27
+ usableAsTool: true,
43
28
  defaults: {
44
29
  name: 'Docspell',
45
30
  },
46
- inputs: ['main'],
47
- outputs: ['main'],
31
+ inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
32
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
48
33
  credentials: [
49
34
  {
50
35
  name: 'docspellApi',
51
36
  required: true,
52
37
  },
53
38
  ],
54
- requestDefaults: {
55
- baseURL: '={{$credentials.url}}/api/v1'
56
- },
57
- properties: properties
39
+ properties: [
40
+ {
41
+ displayName: 'Resource',
42
+ name: 'resource',
43
+ type: 'options',
44
+ noDataExpression: true,
45
+ options: [
46
+ { name: 'Attachment', value: 'attachment' },
47
+ { name: 'Item', value: 'item' },
48
+ { name: 'Organization', value: 'organization' },
49
+ ],
50
+ default: 'item',
51
+ },
52
+ ...attachment_1.attachmentDescription,
53
+ ...item_1.itemDescription,
54
+ ...organization_1.organizationDescription,
55
+ ],
58
56
  };
57
+ this.methods = { loadOptions: loadOptions_1.loadOptions };
58
+ }
59
+ async execute() {
60
+ const inputItems = this.getInputData();
61
+ const returnData = [];
62
+ for (let itemIndex = 0; itemIndex < inputItems.length; itemIndex++) {
63
+ try {
64
+ const resource = this.getNodeParameter('resource', itemIndex);
65
+ const operation = this.getNodeParameter('operation', itemIndex);
66
+ if (resource === 'item' && operation === 'get') {
67
+ returnData.push(...(await (0, get_1.executeItemGet)(this, itemIndex)));
68
+ }
69
+ else if (resource === 'item' && operation === 'search') {
70
+ returnData.push(...(await (0, search_1.executeItemSearch)(this, itemIndex)));
71
+ }
72
+ else if (resource === 'item' && operation === 'update') {
73
+ returnData.push(...(await (0, update_1.executeItemUpdate)(this, itemIndex)));
74
+ }
75
+ else if (resource === 'item' && operation === 'updateMany') {
76
+ returnData.push(...(await (0, updateMany_1.executeItemUpdateMany)(this, itemIndex)));
77
+ }
78
+ else if (resource === 'item' && operation === 'upload') {
79
+ returnData.push(...(await (0, upload_1.executeItemUpload)(this, itemIndex)));
80
+ }
81
+ else if (resource === 'attachment' && operation === 'download') {
82
+ returnData.push(...(await (0, download_1.executeAttachmentDownload)(this, itemIndex)));
83
+ }
84
+ else if (resource === 'organization' && operation === 'get') {
85
+ returnData.push(...(await (0, get_2.executeOrganizationGet)(this, itemIndex)));
86
+ }
87
+ else if (resource === 'organization' && operation === 'getAll') {
88
+ returnData.push(...(await (0, getAll_1.executeOrganizationGetAll)(this, itemIndex)));
89
+ }
90
+ else {
91
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unsupported operation: ${resource}/${operation}`, { itemIndex });
92
+ }
93
+ }
94
+ catch (error) {
95
+ if (this.continueOnFail()) {
96
+ returnData.push({
97
+ json: { error: error.message },
98
+ pairedItem: { item: itemIndex },
99
+ });
100
+ continue;
101
+ }
102
+ if (error instanceof n8n_workflow_1.NodeApiError || error instanceof n8n_workflow_1.NodeOperationError) {
103
+ error.context.itemIndex = itemIndex;
104
+ throw error;
105
+ }
106
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex });
107
+ }
108
+ }
109
+ return [returnData];
59
110
  }
60
111
  }
61
112
  exports.Docspell = Docspell;
@@ -1 +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"}
1
+ {"version":3,"file":"Docspell.node.js","sourceRoot":"","sources":["../../../nodes/Docspell/Docspell.node.ts"],"names":[],"mappings":";;;AAMA,+CAAqF;AAErF,uDAA+D;AAC/D,8DAA4E;AAC5E,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