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
@@ -0,0 +1,9 @@
1
+ import type { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
2
+ export declare const loadOptions: {
3
+ getTags(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
4
+ getFolders(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
5
+ getOrganizations(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
6
+ getPersons(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
7
+ getEquipment(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
8
+ getCustomFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
9
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadOptions = void 0;
4
+ const GenericFunctions_1 = require("../../Common/GenericFunctions");
5
+ async function entries(context, endpoint) {
6
+ var _a;
7
+ return (_a = (await (0, GenericFunctions_1.docspellApiRequest)(context, { method: 'GET', endpoint })).items) !== null && _a !== void 0 ? _a : [];
8
+ }
9
+ const none = { name: 'None', value: '' };
10
+ async function pickOne(context, endpoint) {
11
+ const options = (await entries(context, endpoint)).map(({ id, name }) => ({ name, value: id }));
12
+ return [none, ...options];
13
+ }
14
+ exports.loadOptions = {
15
+ async getTags() {
16
+ const options = (await entries(this, '/sec/tag')).map(({ id, name, category }) => ({
17
+ name,
18
+ value: id,
19
+ ...(category ? { description: `Category: ${category}` } : {}),
20
+ }));
21
+ return options;
22
+ },
23
+ getFolders() {
24
+ return pickOne(this, '/sec/folder');
25
+ },
26
+ getOrganizations() {
27
+ return pickOne(this, '/sec/organization');
28
+ },
29
+ getPersons() {
30
+ return pickOne(this, '/sec/person');
31
+ },
32
+ getEquipment() {
33
+ return pickOne(this, '/sec/equipment');
34
+ },
35
+ async getCustomFields() {
36
+ const options = (await entries(this, '/sec/customfield')).map(({ name, label }) => ({
37
+ name: label || name,
38
+ value: name,
39
+ description: label ? `Field name: ${name}` : undefined,
40
+ }));
41
+ return options;
42
+ },
43
+ };
44
+ //# sourceMappingURL=loadOptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadOptions.js","sourceRoot":"","sources":["../../../../nodes/Docspell/methods/loadOptions.ts"],"names":[],"mappings":";;;AAEA,oEAAmE;AASnE,KAAK,UAAU,OAAO,CAAC,OAA8B,EAAE,QAAgB;;IACtE,OAAO,MAAC,CAAC,MAAM,IAA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,OAAO,OAAO,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IACxC,CAAC;IAGD,KAAK,CAAC,eAAe;QACpB,MAAM,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;YACnF,IAAI,EAAE,KAAK,IAAI,IAAI;YACnB,KAAK,EAAE,IAAI;YACX,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;SACtD,CAAC,CAAC,CAAC;QACJ,OAAO,OAAO,CAAC;IAChB,CAAC;CACD,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
2
+ export declare const attachmentDownloadDescription: INodeProperties[];
3
+ export declare function fileNameOf(disposition: string | undefined): string | undefined;
4
+ export declare function executeAttachmentDownload(context: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData[]>;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.attachmentDownloadDescription = void 0;
4
+ exports.fileNameOf = fileNameOf;
5
+ exports.executeAttachmentDownload = executeAttachmentDownload;
6
+ const n8n_workflow_1 = require("n8n-workflow");
7
+ const GenericFunctions_1 = require("../../../Common/GenericFunctions");
8
+ const show = { resource: ['attachment'], operation: ['download'] };
9
+ const VERSIONS = {
10
+ file: '',
11
+ original: '/original',
12
+ archive: '/archive',
13
+ preview: '/preview',
14
+ };
15
+ exports.attachmentDownloadDescription = [
16
+ {
17
+ displayName: 'Attachment ID',
18
+ name: 'attachmentId',
19
+ type: 'string',
20
+ required: true,
21
+ default: '',
22
+ description: 'The ID of the attachment, as listed in the attachments of an item (Item > Get)',
23
+ displayOptions: { show },
24
+ },
25
+ {
26
+ displayName: 'Version',
27
+ name: 'version',
28
+ type: 'options',
29
+ options: [
30
+ { name: 'Archive', value: 'archive', description: 'The archived PDF, if Docspell made one' },
31
+ { name: 'File', value: 'file', description: 'The file as Docspell shows it, the converted PDF where there is one' },
32
+ { name: 'Original', value: 'original', description: 'The file as it was uploaded' },
33
+ { name: 'Preview', value: 'preview', description: 'The preview image' },
34
+ ],
35
+ default: 'file',
36
+ displayOptions: { show },
37
+ },
38
+ {
39
+ displayName: 'Put Output File in Field',
40
+ name: 'binaryPropertyName',
41
+ type: 'string',
42
+ default: 'data',
43
+ description: 'Name of the binary field that receives the file',
44
+ displayOptions: { show },
45
+ },
46
+ ];
47
+ function fileNameOf(disposition) {
48
+ if (!disposition)
49
+ return undefined;
50
+ const encoded = /filename\*\s*=\s*[^']*'[^']*'([^;]+)/i.exec(disposition);
51
+ if (encoded) {
52
+ try {
53
+ return decodeURIComponent(encoded[1].trim());
54
+ }
55
+ catch {
56
+ }
57
+ }
58
+ const plain = /(?:^|[;\s])filename\s*=\s*(?:"((?:[^"\\]|\\.)*)"|([^;]*))/i.exec(disposition);
59
+ if (!plain)
60
+ return undefined;
61
+ const name = plain[1] !== undefined ? plain[1].replace(/\\(.)/g, '$1') : plain[2].trim();
62
+ return name === '' ? undefined : name;
63
+ }
64
+ async function executeAttachmentDownload(context, itemIndex) {
65
+ var _a, _b;
66
+ const attachmentId = context.getNodeParameter('attachmentId', itemIndex, '').trim();
67
+ if (!attachmentId) {
68
+ throw new n8n_workflow_1.NodeOperationError(context.getNode(), 'The Attachment ID is empty', { itemIndex });
69
+ }
70
+ const requested = context.getNodeParameter('version', itemIndex, 'file');
71
+ const version = requested in VERSIONS ? requested : 'file';
72
+ const binaryPropertyName = context.getNodeParameter('binaryPropertyName', itemIndex, 'data').trim() || 'data';
73
+ const notFound = version === 'file'
74
+ ? `Attachment "${attachmentId}" was not found`
75
+ : `Attachment "${attachmentId}" was not found, or it has no ${version} version`;
76
+ const { buffer, headers } = await (0, GenericFunctions_1.docspellDownload)(context, `/sec/attachment/${encodeURIComponent(attachmentId)}${VERSIONS[version]}`, { 404: notFound });
77
+ const lower = Object.fromEntries(Object.entries(headers).map(([name, value]) => [name.toLowerCase(), value]));
78
+ const fileName = (_a = fileNameOf(lower['content-disposition'])) !== null && _a !== void 0 ? _a : attachmentId;
79
+ const mimeType = ((_b = lower['content-type']) !== null && _b !== void 0 ? _b : 'application/octet-stream').split(';')[0].trim();
80
+ const binary = await context.helpers.prepareBinaryData(buffer, fileName, mimeType);
81
+ return [
82
+ {
83
+ json: { id: attachmentId, fileName, mimeType, size: buffer.length, version },
84
+ binary: { [binaryPropertyName]: binary },
85
+ pairedItem: { item: itemIndex },
86
+ },
87
+ ];
88
+ }
89
+ //# sourceMappingURL=download.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download.js","sourceRoot":"","sources":["../../../../../nodes/Docspell/resources/attachment/download.ts"],"names":[],"mappings":";;;AAkDA,gCAeC;AAED,8DAkCC;AApGD,+CAAkD;AAElD,uEAAoE;AAEpE,MAAM,IAAI,GAAG,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,SAAS,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC;AAEnE,MAAM,QAAQ,GAAG;IAChB,IAAI,EAAE,EAAE;IACR,QAAQ,EAAE,WAAW;IACrB,OAAO,EAAE,UAAU;IACnB,OAAO,EAAE,UAAU;CACV,CAAC;AAIE,QAAA,6BAA6B,GAAsB;IAC/D;QACC,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,gFAAgF;QAC7F,cAAc,EAAE,EAAE,IAAI,EAAE;KACxB;IACD;QACC,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS;QACf,OAAO,EAAE;YACR,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,WA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W,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9G,MAAM,QAAQ,GAAG,MAAA,UAAU,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,mCAAI,YAAY,CAAC;IAC1E,MAAM,QAAQ,GAAG,CAAC,MAAA,KAAK,CAAC,cAAc,CAAC,mCAAI,0BAA0B,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5F,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEnF,OAAO;QACN;YACC,IAAI,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE;YAC5E,MAAM,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,MAAM,EAAE;YACxC,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;SAC/B;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const attachmentDescription: INodeProperties[];
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.attachmentDescription = void 0;
4
+ const download_1 = require("./download");
5
+ exports.attachmentDescription = [
6
+ {
7
+ displayName: 'Operation',
8
+ name: 'operation',
9
+ type: 'options',
10
+ noDataExpression: true,
11
+ displayOptions: { show: { resource: ['attachment'] } },
12
+ options: [
13
+ {
14
+ name: 'Download',
15
+ value: 'download',
16
+ description: 'Download the file of an attachment',
17
+ action: 'Download an attachment',
18
+ },
19
+ ],
20
+ default: 'download',
21
+ },
22
+ ...download_1.attachmentDownloadDescription,
23
+ ];
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Docspell/resources/attachment/index.ts"],"names":[],"mappings":";;;AAEA,yCAA2D;AAE9C,QAAA,qBAAqB,GAAsB;IACvD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE;QACtD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,UAAU;gBACjB,WAAW,EAAE,oCAAoC;gBACjD,MAAM,EAAE,wBAAwB;aAChC;SACD;QACD,OAAO,EAAE,UAAU;KACnB;IACD,GAAG,wCAA6B;CAChC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
2
+ export declare const itemGetDescription: INodeProperties[];
3
+ export declare function executeItemGet(context: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData[]>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.itemGetDescription = void 0;
4
+ exports.executeItemGet = executeItemGet;
5
+ const n8n_workflow_1 = require("n8n-workflow");
6
+ const GenericFunctions_1 = require("../../../Common/GenericFunctions");
7
+ exports.itemGetDescription = [
8
+ {
9
+ displayName: 'Item ID',
10
+ name: 'itemId',
11
+ type: 'string',
12
+ required: true,
13
+ default: '',
14
+ description: 'The ID of the item, as returned by Search',
15
+ displayOptions: { show: { resource: ['item'], operation: ['get'] } },
16
+ },
17
+ ];
18
+ async function executeItemGet(context, itemIndex) {
19
+ const itemId = context.getNodeParameter('itemId', itemIndex, '').trim();
20
+ if (!itemId) {
21
+ throw new n8n_workflow_1.NodeOperationError(context.getNode(), 'The Item ID is empty', { itemIndex });
22
+ }
23
+ const item = await (0, GenericFunctions_1.docspellApiRequest)(context, { method: 'GET', endpoint: `/sec/item/${encodeURIComponent(itemId)}` }, { 404: `Item "${itemId}" was not found` });
24
+ return context.helpers.constructExecutionMetaData(context.helpers.returnJsonArray(item), {
25
+ itemData: { item: itemIndex },
26
+ });
27
+ }
28
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../../nodes/Docspell/resources/item/get.ts"],"names":[],"mappings":";;;AAiBA,wCAkBC;AAlCD,+CAAkD;AAElD,uEAAsE;AAEzD,QAAA,kBAAkB,GAAsB;IACpD;QACC,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,2CAA2C;QACxD,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE;KACpE;CACD,CAAC;AAEK,KAAK,UAAU,cAAc,CACnC,OAA0B,EAC1B,SAAiB;IAEjB,MAAM,MAAM,GAAI,OAAO,CAAC,gBAAgB,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,CAAY,CAAC,IAAI,EAAE,CAAC;IACpF,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,MAAM,IAAI,iCAAkB,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,sBAAsB,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;IACxF,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,IAAA,qCAAkB,EACpC,OAAO,EACP,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,kBAAkB,CAAC,MAAM,CAAC,EAAE,EAAE,EACtE,EAAE,GAAG,EAAE,SAAS,MAAM,iBAAiB,EAAE,CACzC,CAAC;IAEF,OAAO,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,IAAmB,CAAC,EAAE;QACvG,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC7B,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const itemDescription: INodeProperties[];
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.itemDescription = void 0;
4
+ const get_1 = require("./get");
5
+ const search_1 = require("./search");
6
+ const update_1 = require("./update");
7
+ const updateMany_1 = require("./updateMany");
8
+ const upload_1 = require("./upload");
9
+ exports.itemDescription = [
10
+ {
11
+ displayName: 'Operation',
12
+ name: 'operation',
13
+ type: 'options',
14
+ noDataExpression: true,
15
+ displayOptions: { show: { resource: ['item'] } },
16
+ options: [
17
+ {
18
+ name: 'Get',
19
+ value: 'get',
20
+ description: 'Get the details of one item',
21
+ action: 'Get an item',
22
+ },
23
+ {
24
+ name: 'Search',
25
+ value: 'search',
26
+ description: 'Search items with a Docspell query',
27
+ action: 'Search items',
28
+ },
29
+ {
30
+ name: 'Update',
31
+ value: 'update',
32
+ description: 'Change the fields of an item',
33
+ action: 'Update an item',
34
+ },
35
+ {
36
+ name: 'Update Many',
37
+ value: 'updateMany',
38
+ description: 'Apply the same changes to several items at once',
39
+ action: 'Update many items',
40
+ },
41
+ {
42
+ name: 'Upload',
43
+ value: 'upload',
44
+ description: 'Upload files to Docspell, which makes items of them',
45
+ action: 'Upload files',
46
+ },
47
+ ],
48
+ default: 'get',
49
+ },
50
+ ...get_1.itemGetDescription,
51
+ ...search_1.itemSearchDescription,
52
+ ...update_1.itemUpdateDescription,
53
+ ...updateMany_1.itemUpdateManyDescription,
54
+ ...upload_1.itemUploadDescription,
55
+ ];
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Docspell/resources/item/index.ts"],"names":[],"mappings":";;;AAEA,+BAA2C;AAC3C,qCAAiD;AACjD,qCAAiD;AACjD,6CAAyD;AACzD,qCAAiD;AAEpC,QAAA,eAAe,GAAsB;IACjD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE;QAChD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;gBACZ,WAAW,EAAE,6BAA6B;gBAC1C,MAAM,EAAE,aAAa;aACrB;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,oCAAoC;gBACjD,MAAM,EAAE,cAAc;aACtB;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,8BAA8B;gBAC3C,MAAM,EAAE,gBAAgB;aACxB;YACD;gBACC,IAAI,EAAE,aAAa;gBACnB,KAAK,EAAE,YAAY;gBACnB,WAAW,EAAE,iDAAiD;gBAC9D,MAAM,EAAE,mBAAmB;aAC3B;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,qDAAqD;gBAClE,MAAM,EAAE,cAAc;aACtB;SACD;QACD,OAAO,EAAE,KAAK;KACd;IACD,GAAG,wBAAkB;IACrB,GAAG,8BAAqB;IACxB,GAAG,8BAAqB;IACxB,GAAG,sCAAyB;IAC5B,GAAG,8BAAqB;CACxB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { IDataObject, IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
2
+ export declare const itemSearchDescription: INodeProperties[];
3
+ interface SearchBody extends IDataObject {
4
+ query: string;
5
+ withDetails?: boolean;
6
+ searchMode?: string;
7
+ }
8
+ export declare function searchAllPages(context: IExecuteFunctions, body: SearchBody, pageSize?: number, startOffset?: number): Promise<IDataObject[]>;
9
+ export declare function executeItemSearch(context: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData[]>;
10
+ export {};
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.itemSearchDescription = void 0;
4
+ exports.searchAllPages = searchAllPages;
5
+ exports.executeItemSearch = executeItemSearch;
6
+ const GenericFunctions_1 = require("../../../Common/GenericFunctions");
7
+ const show = { resource: ['item'], operation: ['search'] };
8
+ exports.itemSearchDescription = [
9
+ {
10
+ displayName: 'Query',
11
+ name: 'query',
12
+ type: 'string',
13
+ default: '',
14
+ placeholder: 'tag:invoice date>2026-01-01',
15
+ description: 'Search query in Docspell\'s query language. Leave empty to match all items. <a href="https://docspell.org/docs/query/">Query syntax</a>.',
16
+ displayOptions: { show },
17
+ },
18
+ {
19
+ displayName: 'Return All',
20
+ name: 'returnAll',
21
+ type: 'boolean',
22
+ default: false,
23
+ description: 'Whether to return all results or only up to a given limit',
24
+ displayOptions: { show },
25
+ },
26
+ {
27
+ displayName: 'Limit',
28
+ name: 'limit',
29
+ type: 'number',
30
+ default: 50,
31
+ typeOptions: { minValue: 1 },
32
+ description: 'Max number of results to return',
33
+ displayOptions: { show: { ...show, returnAll: [false] } },
34
+ },
35
+ {
36
+ displayName: 'Options',
37
+ name: 'options',
38
+ type: 'collection',
39
+ placeholder: 'Add Option',
40
+ default: {},
41
+ displayOptions: { show },
42
+ options: [
43
+ {
44
+ displayName: 'Include Details',
45
+ name: 'withDetails',
46
+ type: 'boolean',
47
+ default: false,
48
+ description: 'Whether to include the tags and attachments of each item',
49
+ },
50
+ {
51
+ displayName: 'Offset',
52
+ name: 'offset',
53
+ type: 'number',
54
+ default: 0,
55
+ typeOptions: { minValue: 0 },
56
+ description: 'Number of items to skip',
57
+ },
58
+ {
59
+ displayName: 'Search In',
60
+ name: 'searchMode',
61
+ type: 'options',
62
+ default: 'normal',
63
+ options: [
64
+ { name: 'Items', value: 'normal', description: 'Items that are not deleted' },
65
+ { name: 'Trash', value: 'trashed', description: 'Only deleted items' },
66
+ { name: 'Items and Trash', value: 'all' },
67
+ ],
68
+ },
69
+ ],
70
+ },
71
+ ];
72
+ const QUERY_REJECTED = 'Docspell could not parse the search query. See https://docspell.org/docs/query/ for the syntax.';
73
+ async function searchPage(context, body, limit, offset) {
74
+ const result = (await (0, GenericFunctions_1.docspellApiRequest)(context, { method: 'POST', endpoint: '/sec/item/search', body: { ...body, limit, offset } }, { 400: QUERY_REJECTED }));
75
+ return { items: result.groups.flatMap((group) => group.items), serverLimit: result.limit };
76
+ }
77
+ async function searchAllPages(context, body, pageSize = 100, startOffset = 0) {
78
+ const items = [];
79
+ let offset = startOffset;
80
+ for (;;) {
81
+ const page = await searchPage(context, body, pageSize, offset);
82
+ items.push(...page.items);
83
+ if (page.items.length === 0 || page.items.length < page.serverLimit)
84
+ return items;
85
+ offset += page.items.length;
86
+ }
87
+ }
88
+ async function executeItemSearch(context, itemIndex) {
89
+ var _a, _b, _c;
90
+ const options = context.getNodeParameter('options', itemIndex, {});
91
+ const body = {
92
+ query: context.getNodeParameter('query', itemIndex, ''),
93
+ withDetails: (_a = options.withDetails) !== null && _a !== void 0 ? _a : false,
94
+ searchMode: (_b = options.searchMode) !== null && _b !== void 0 ? _b : 'normal',
95
+ };
96
+ const offset = (_c = options.offset) !== null && _c !== void 0 ? _c : 0;
97
+ const items = context.getNodeParameter('returnAll', itemIndex, false)
98
+ ? await searchAllPages(context, body, 100, offset)
99
+ : (await searchPage(context, body, context.getNodeParameter('limit', itemIndex, 50), offset)).items;
100
+ return context.helpers.constructExecutionMetaData(context.helpers.returnJsonArray(items), {
101
+ itemData: { item: itemIndex },
102
+ });
103
+ }
104
+ //# sourceMappingURL=search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.js","sourceRoot":"","sources":["../../../../../nodes/Docspell/resources/item/search.ts"],"names":[],"m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OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE;QACzF,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KAC7B,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
2
+ export declare const updateFieldOptions: INodeProperties[];
3
+ export declare const customFieldsProperty: (name: string, show: Record<string, string[]>) => INodeProperties;
4
+ export declare const removeCustomFieldsProperty: (show: Record<string, string[]>) => INodeProperties;
5
+ export declare const itemUpdateDescription: INodeProperties[];
6
+ export declare const ENDPOINT_OF: {
7
+ readonly concEquipment: "concEquipment";
8
+ readonly concPerson: "concPerson";
9
+ readonly corrOrg: "corrOrg";
10
+ readonly corrPerson: "corrPerson";
11
+ };
12
+ export declare const LABEL_OF: Record<string, string>;
13
+ export declare function executeItemUpdate(context: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData[]>;