@tom-schorn/n8n-nodes-paperless 0.1.3

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 (163) hide show
  1. package/LICENSE.md +23 -0
  2. package/README.md +122 -0
  3. package/dist/credentials/PaperlessApi.credentials.d.ts +8 -0
  4. package/dist/credentials/PaperlessApi.credentials.js +38 -0
  5. package/dist/credentials/PaperlessApi.credentials.js.map +1 -0
  6. package/dist/nodes/Paperless/Paperless.node.d.ts +4 -0
  7. package/dist/nodes/Paperless/Paperless.node.js +24 -0
  8. package/dist/nodes/Paperless/Paperless.node.js.map +1 -0
  9. package/dist/nodes/Paperless/Paperless.node.json +14 -0
  10. package/dist/nodes/Paperless/v2/PaperlessV2.node.d.ts +10 -0
  11. package/dist/nodes/Paperless/v2/PaperlessV2.node.js +56 -0
  12. package/dist/nodes/Paperless/v2/PaperlessV2.node.js.map +1 -0
  13. package/dist/nodes/Paperless/v2/actions/asn/asn.resource.d.ts +4 -0
  14. package/dist/nodes/Paperless/v2/actions/asn/asn.resource.js +60 -0
  15. package/dist/nodes/Paperless/v2/actions/asn/asn.resource.js.map +1 -0
  16. package/dist/nodes/Paperless/v2/actions/asn/next.operation.d.ts +3 -0
  17. package/dist/nodes/Paperless/v2/actions/asn/next.operation.js +14 -0
  18. package/dist/nodes/Paperless/v2/actions/asn/next.operation.js.map +1 -0
  19. package/dist/nodes/Paperless/v2/actions/correspondent/correspondent.resource.d.ts +8 -0
  20. package/dist/nodes/Paperless/v2/actions/correspondent/correspondent.resource.js +91 -0
  21. package/dist/nodes/Paperless/v2/actions/correspondent/correspondent.resource.js.map +1 -0
  22. package/dist/nodes/Paperless/v2/actions/correspondent/create.operation.d.ts +3 -0
  23. package/dist/nodes/Paperless/v2/actions/correspondent/create.operation.js +67 -0
  24. package/dist/nodes/Paperless/v2/actions/correspondent/create.operation.js.map +1 -0
  25. package/dist/nodes/Paperless/v2/actions/correspondent/get.operation.d.ts +3 -0
  26. package/dist/nodes/Paperless/v2/actions/correspondent/get.operation.js +56 -0
  27. package/dist/nodes/Paperless/v2/actions/correspondent/get.operation.js.map +1 -0
  28. package/dist/nodes/Paperless/v2/actions/correspondent/list.operation.d.ts +3 -0
  29. package/dist/nodes/Paperless/v2/actions/correspondent/list.operation.js +21 -0
  30. package/dist/nodes/Paperless/v2/actions/correspondent/list.operation.js.map +1 -0
  31. package/dist/nodes/Paperless/v2/actions/correspondent/remove.operation.d.ts +3 -0
  32. package/dist/nodes/Paperless/v2/actions/correspondent/remove.operation.js +56 -0
  33. package/dist/nodes/Paperless/v2/actions/correspondent/remove.operation.js.map +1 -0
  34. package/dist/nodes/Paperless/v2/actions/correspondent/update.operation.d.ts +3 -0
  35. package/dist/nodes/Paperless/v2/actions/correspondent/update.operation.js +107 -0
  36. package/dist/nodes/Paperless/v2/actions/correspondent/update.operation.js.map +1 -0
  37. package/dist/nodes/Paperless/v2/actions/custom_field/create.operation.d.ts +3 -0
  38. package/dist/nodes/Paperless/v2/actions/custom_field/create.operation.js +116 -0
  39. package/dist/nodes/Paperless/v2/actions/custom_field/create.operation.js.map +1 -0
  40. package/dist/nodes/Paperless/v2/actions/custom_field/custom_field.resource.d.ts +8 -0
  41. package/dist/nodes/Paperless/v2/actions/custom_field/custom_field.resource.js +91 -0
  42. package/dist/nodes/Paperless/v2/actions/custom_field/custom_field.resource.js.map +1 -0
  43. package/dist/nodes/Paperless/v2/actions/custom_field/get.operation.d.ts +3 -0
  44. package/dist/nodes/Paperless/v2/actions/custom_field/get.operation.js +56 -0
  45. package/dist/nodes/Paperless/v2/actions/custom_field/get.operation.js.map +1 -0
  46. package/dist/nodes/Paperless/v2/actions/custom_field/list.operation.d.ts +3 -0
  47. package/dist/nodes/Paperless/v2/actions/custom_field/list.operation.js +21 -0
  48. package/dist/nodes/Paperless/v2/actions/custom_field/list.operation.js.map +1 -0
  49. package/dist/nodes/Paperless/v2/actions/custom_field/remove.operation.d.ts +3 -0
  50. package/dist/nodes/Paperless/v2/actions/custom_field/remove.operation.js +56 -0
  51. package/dist/nodes/Paperless/v2/actions/custom_field/remove.operation.js.map +1 -0
  52. package/dist/nodes/Paperless/v2/actions/custom_field/update.operation.d.ts +3 -0
  53. package/dist/nodes/Paperless/v2/actions/custom_field/update.operation.js +128 -0
  54. package/dist/nodes/Paperless/v2/actions/custom_field/update.operation.js.map +1 -0
  55. package/dist/nodes/Paperless/v2/actions/document/create.operation.d.ts +3 -0
  56. package/dist/nodes/Paperless/v2/actions/document/create.operation.js +209 -0
  57. package/dist/nodes/Paperless/v2/actions/document/create.operation.js.map +1 -0
  58. package/dist/nodes/Paperless/v2/actions/document/document.resource.d.ts +13 -0
  59. package/dist/nodes/Paperless/v2/actions/document/document.resource.js +131 -0
  60. package/dist/nodes/Paperless/v2/actions/document/document.resource.js.map +1 -0
  61. package/dist/nodes/Paperless/v2/actions/document/get.operation.d.ts +3 -0
  62. package/dist/nodes/Paperless/v2/actions/document/get.operation.js +77 -0
  63. package/dist/nodes/Paperless/v2/actions/document/get.operation.js.map +1 -0
  64. package/dist/nodes/Paperless/v2/actions/document/get_history.operation.d.ts +3 -0
  65. package/dist/nodes/Paperless/v2/actions/document/get_history.operation.js +86 -0
  66. package/dist/nodes/Paperless/v2/actions/document/get_history.operation.js.map +1 -0
  67. package/dist/nodes/Paperless/v2/actions/document/get_metadata.operation.d.ts +3 -0
  68. package/dist/nodes/Paperless/v2/actions/document/get_metadata.operation.js +79 -0
  69. package/dist/nodes/Paperless/v2/actions/document/get_metadata.operation.js.map +1 -0
  70. package/dist/nodes/Paperless/v2/actions/document/get_metadata_suggestions.operation.d.ts +3 -0
  71. package/dist/nodes/Paperless/v2/actions/document/get_metadata_suggestions.operation.js +119 -0
  72. package/dist/nodes/Paperless/v2/actions/document/get_metadata_suggestions.operation.js.map +1 -0
  73. package/dist/nodes/Paperless/v2/actions/document/get_preview.operation.d.ts +3 -0
  74. package/dist/nodes/Paperless/v2/actions/document/get_preview.operation.js +84 -0
  75. package/dist/nodes/Paperless/v2/actions/document/get_preview.operation.js.map +1 -0
  76. package/dist/nodes/Paperless/v2/actions/document/get_sharelink.operation.d.ts +3 -0
  77. package/dist/nodes/Paperless/v2/actions/document/get_sharelink.operation.js +79 -0
  78. package/dist/nodes/Paperless/v2/actions/document/get_sharelink.operation.js.map +1 -0
  79. package/dist/nodes/Paperless/v2/actions/document/list.operation.d.ts +3 -0
  80. package/dist/nodes/Paperless/v2/actions/document/list.operation.js +21 -0
  81. package/dist/nodes/Paperless/v2/actions/document/list.operation.js.map +1 -0
  82. package/dist/nodes/Paperless/v2/actions/document/remove.operation.d.ts +3 -0
  83. package/dist/nodes/Paperless/v2/actions/document/remove.operation.js +77 -0
  84. package/dist/nodes/Paperless/v2/actions/document/remove.operation.js.map +1 -0
  85. package/dist/nodes/Paperless/v2/actions/document/update.operation.d.ts +3 -0
  86. package/dist/nodes/Paperless/v2/actions/document/update.operation.js +368 -0
  87. package/dist/nodes/Paperless/v2/actions/document/update.operation.js.map +1 -0
  88. package/dist/nodes/Paperless/v2/actions/document_note/create.operation.d.ts +3 -0
  89. package/dist/nodes/Paperless/v2/actions/document_note/create.operation.js +98 -0
  90. package/dist/nodes/Paperless/v2/actions/document_note/create.operation.js.map +1 -0
  91. package/dist/nodes/Paperless/v2/actions/document_note/document_note.resource.d.ts +6 -0
  92. package/dist/nodes/Paperless/v2/actions/document_note/document_note.resource.js +75 -0
  93. package/dist/nodes/Paperless/v2/actions/document_note/document_note.resource.js.map +1 -0
  94. package/dist/nodes/Paperless/v2/actions/document_note/list.operation.d.ts +3 -0
  95. package/dist/nodes/Paperless/v2/actions/document_note/list.operation.js +86 -0
  96. package/dist/nodes/Paperless/v2/actions/document_note/list.operation.js.map +1 -0
  97. package/dist/nodes/Paperless/v2/actions/document_note/remove.operation.d.ts +3 -0
  98. package/dist/nodes/Paperless/v2/actions/document_note/remove.operation.js +123 -0
  99. package/dist/nodes/Paperless/v2/actions/document_note/remove.operation.js.map +1 -0
  100. package/dist/nodes/Paperless/v2/actions/document_type/create.operation.d.ts +3 -0
  101. package/dist/nodes/Paperless/v2/actions/document_type/create.operation.js +67 -0
  102. package/dist/nodes/Paperless/v2/actions/document_type/create.operation.js.map +1 -0
  103. package/dist/nodes/Paperless/v2/actions/document_type/document_type.resource.d.ts +8 -0
  104. package/dist/nodes/Paperless/v2/actions/document_type/document_type.resource.js +91 -0
  105. package/dist/nodes/Paperless/v2/actions/document_type/document_type.resource.js.map +1 -0
  106. package/dist/nodes/Paperless/v2/actions/document_type/get.operation.d.ts +3 -0
  107. package/dist/nodes/Paperless/v2/actions/document_type/get.operation.js +56 -0
  108. package/dist/nodes/Paperless/v2/actions/document_type/get.operation.js.map +1 -0
  109. package/dist/nodes/Paperless/v2/actions/document_type/list.operation.d.ts +3 -0
  110. package/dist/nodes/Paperless/v2/actions/document_type/list.operation.js +21 -0
  111. package/dist/nodes/Paperless/v2/actions/document_type/list.operation.js.map +1 -0
  112. package/dist/nodes/Paperless/v2/actions/document_type/remove.operation.d.ts +3 -0
  113. package/dist/nodes/Paperless/v2/actions/document_type/remove.operation.js +56 -0
  114. package/dist/nodes/Paperless/v2/actions/document_type/remove.operation.js.map +1 -0
  115. package/dist/nodes/Paperless/v2/actions/document_type/update.operation.d.ts +3 -0
  116. package/dist/nodes/Paperless/v2/actions/document_type/update.operation.js +111 -0
  117. package/dist/nodes/Paperless/v2/actions/document_type/update.operation.js.map +1 -0
  118. package/dist/nodes/Paperless/v2/actions/node.type.d.ts +12 -0
  119. package/dist/nodes/Paperless/v2/actions/node.type.js +3 -0
  120. package/dist/nodes/Paperless/v2/actions/node.type.js.map +1 -0
  121. package/dist/nodes/Paperless/v2/actions/router.d.ts +2 -0
  122. package/dist/nodes/Paperless/v2/actions/router.js +92 -0
  123. package/dist/nodes/Paperless/v2/actions/router.js.map +1 -0
  124. package/dist/nodes/Paperless/v2/actions/tag/create.operation.d.ts +3 -0
  125. package/dist/nodes/Paperless/v2/actions/tag/create.operation.js +67 -0
  126. package/dist/nodes/Paperless/v2/actions/tag/create.operation.js.map +1 -0
  127. package/dist/nodes/Paperless/v2/actions/tag/get.operation.d.ts +3 -0
  128. package/dist/nodes/Paperless/v2/actions/tag/get.operation.js +56 -0
  129. package/dist/nodes/Paperless/v2/actions/tag/get.operation.js.map +1 -0
  130. package/dist/nodes/Paperless/v2/actions/tag/list.operation.d.ts +3 -0
  131. package/dist/nodes/Paperless/v2/actions/tag/list.operation.js +21 -0
  132. package/dist/nodes/Paperless/v2/actions/tag/list.operation.js.map +1 -0
  133. package/dist/nodes/Paperless/v2/actions/tag/remove.operation.d.ts +3 -0
  134. package/dist/nodes/Paperless/v2/actions/tag/remove.operation.js +56 -0
  135. package/dist/nodes/Paperless/v2/actions/tag/remove.operation.js.map +1 -0
  136. package/dist/nodes/Paperless/v2/actions/tag/tag.resource.d.ts +8 -0
  137. package/dist/nodes/Paperless/v2/actions/tag/tag.resource.js +91 -0
  138. package/dist/nodes/Paperless/v2/actions/tag/tag.resource.js.map +1 -0
  139. package/dist/nodes/Paperless/v2/actions/tag/update.operation.d.ts +3 -0
  140. package/dist/nodes/Paperless/v2/actions/tag/update.operation.js +107 -0
  141. package/dist/nodes/Paperless/v2/actions/tag/update.operation.js.map +1 -0
  142. package/dist/nodes/Paperless/v2/actions/task/get.operation.d.ts +3 -0
  143. package/dist/nodes/Paperless/v2/actions/task/get.operation.js +38 -0
  144. package/dist/nodes/Paperless/v2/actions/task/get.operation.js.map +1 -0
  145. package/dist/nodes/Paperless/v2/actions/task/task.resource.d.ts +4 -0
  146. package/dist/nodes/Paperless/v2/actions/task/task.resource.js +59 -0
  147. package/dist/nodes/Paperless/v2/actions/task/task.resource.js.map +1 -0
  148. package/dist/nodes/Paperless/v2/actions/version.d.ts +2 -0
  149. package/dist/nodes/Paperless/v2/actions/version.js +117 -0
  150. package/dist/nodes/Paperless/v2/actions/version.js.map +1 -0
  151. package/dist/nodes/Paperless/v2/methods/index.d.ts +1 -0
  152. package/dist/nodes/Paperless/v2/methods/index.js +38 -0
  153. package/dist/nodes/Paperless/v2/methods/index.js.map +1 -0
  154. package/dist/nodes/Paperless/v2/methods/listSearch.d.ts +8 -0
  155. package/dist/nodes/Paperless/v2/methods/listSearch.js +71 -0
  156. package/dist/nodes/Paperless/v2/methods/listSearch.js.map +1 -0
  157. package/dist/nodes/Paperless/v2/paperless-ngx.svg +1 -0
  158. package/dist/nodes/Paperless/v2/transport/index.d.ts +3 -0
  159. package/dist/nodes/Paperless/v2/transport/index.js +50 -0
  160. package/dist/nodes/Paperless/v2/transport/index.js.map +1 -0
  161. package/dist/package.json +74 -0
  162. package/index.js +0 -0
  163. package/package.json +74 -0
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.description = void 0;
4
+ exports.execute = execute;
5
+ const n8n_workflow_1 = require("n8n-workflow");
6
+ const transport_1 = require("../../transport");
7
+ exports.description = [
8
+ {
9
+ displayName: 'ID',
10
+ name: 'id',
11
+ default: { mode: 'list', value: '' },
12
+ description: 'ID of the document to get history for',
13
+ displayOptions: {
14
+ show: {
15
+ resource: ['document'],
16
+ operation: ['get_history'],
17
+ },
18
+ },
19
+ hint: 'The ID of the document to get history for',
20
+ modes: [
21
+ {
22
+ displayName: 'From List',
23
+ name: 'list',
24
+ placeholder: `Select a Document...`,
25
+ type: 'list',
26
+ typeOptions: {
27
+ searchListMethod: 'documentSearch',
28
+ searchFilterRequired: false,
29
+ searchable: true,
30
+ },
31
+ },
32
+ {
33
+ displayName: 'By ID',
34
+ name: 'id',
35
+ placeholder: `Enter Document ID...`,
36
+ type: 'string',
37
+ validation: [
38
+ {
39
+ type: 'regex',
40
+ properties: {
41
+ regex: '^[1-9][0-9]*$',
42
+ errorMessage: 'The ID must be a positive integer',
43
+ },
44
+ },
45
+ ],
46
+ },
47
+ {
48
+ displayName: 'By URL',
49
+ name: 'url',
50
+ placeholder: `Enter Document URL...`,
51
+ type: 'string',
52
+ validation: [
53
+ {
54
+ type: 'regex',
55
+ properties: {
56
+ regex: '^(?:http|https)://(?:.+?)/documents/(\\d+)/details$',
57
+ errorMessage: 'The URL must be a valid Paperless document URL (e.g. https://paperless.example.com/documents/123/details)',
58
+ },
59
+ },
60
+ ],
61
+ extractValue: {
62
+ type: 'regex',
63
+ regex: '^(?:http|https)://(?:.+?)/documents/(\\d+)/details$',
64
+ },
65
+ },
66
+ ],
67
+ placeholder: 'ID of the document',
68
+ required: true,
69
+ type: 'resourceLocator',
70
+ },
71
+ ];
72
+ async function execute(itemIndex) {
73
+ const id = this.getNodeParameter('id', itemIndex).value;
74
+ const endpoint = `/documents/${id}/history/`;
75
+ const responses = (await transport_1.apiRequestPaginated.call(this, itemIndex, 'GET', endpoint));
76
+ const statusCode = responses.reduce((acc, response) => acc + response.statusCode, 0) / responses.length;
77
+ if (statusCode !== 200) {
78
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The documents you are requesting could not be found`, {
79
+ description: JSON.stringify(responses.map((response) => { var _a, _b; return (_b = (_a = response === null || response === void 0 ? void 0 : response.body) === null || _a === void 0 ? void 0 : _a.details) !== null && _b !== void 0 ? _b : response === null || response === void 0 ? void 0 : response.statusMessage; })),
80
+ });
81
+ }
82
+ return {
83
+ json: { results: responses.map((response) => response.body) },
84
+ };
85
+ }
86
+ //# sourceMappingURL=get_history.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_history.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Paperless/v2/actions/document/get_history.operation.ts"],"names":[],"mappings":";;;AA4EA,0BAwBC;AApGD,+CAMsB;AACtB,+CAAsD;AAEzC,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,IAAI;QACjB,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;QACpC,WAAW,EAAE,uCAAuC;QACpD,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,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+BAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAU,CAAC;IAE9F,MAAM,UAAU,GACf,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,GAAG,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;IACtF,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;QACxB,MAAM,IAAI,iCAAkB,CAC3B,IAAI,CAAC,OAAO,EAAE,EACd,qDAAqD,EACrD;YACC,WAAW,EAAE,IAAI,CAAC,SAAS,CAC1B,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,eAAC,OAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,OAAO,mCAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,aAAa,CAAA,EAAA,CAAC,CAC/E;SACD,CACD,CAAC;IACH,CAAC;IACD,OAAO;QACN,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;KAC7D,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
2
+ export declare const description: INodeProperties[];
3
+ export declare function execute(this: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData>;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.description = void 0;
4
+ exports.execute = execute;
5
+ const transport_1 = require("../../transport");
6
+ exports.description = [
7
+ {
8
+ displayName: 'ID',
9
+ name: 'id',
10
+ default: { mode: 'list', value: '' },
11
+ description: 'ID of the document to retrieve metadata for',
12
+ displayOptions: {
13
+ show: {
14
+ resource: ['document'],
15
+ operation: ['get_metadata'],
16
+ },
17
+ },
18
+ hint: 'The ID of the document to retrieve metadata for',
19
+ modes: [
20
+ {
21
+ displayName: 'From List',
22
+ name: 'list',
23
+ placeholder: `Select a Document...`,
24
+ type: 'list',
25
+ typeOptions: {
26
+ searchListMethod: 'documentSearch',
27
+ searchFilterRequired: false,
28
+ searchable: true,
29
+ },
30
+ },
31
+ {
32
+ displayName: 'By ID',
33
+ name: 'id',
34
+ placeholder: `Enter Document ID...`,
35
+ type: 'string',
36
+ validation: [
37
+ {
38
+ type: 'regex',
39
+ properties: {
40
+ regex: '^[1-9][0-9]*$',
41
+ errorMessage: 'The ID must be a positive integer',
42
+ },
43
+ },
44
+ ],
45
+ },
46
+ {
47
+ displayName: 'By URL',
48
+ name: 'url',
49
+ placeholder: `Enter Document URL...`,
50
+ type: 'string',
51
+ validation: [
52
+ {
53
+ type: 'regex',
54
+ properties: {
55
+ regex: '^(?:http|https)://(?:.+?)/documents/(\\d+)/details$',
56
+ errorMessage: 'The URL must be a valid Paperless document URL (e.g. https://paperless.example.com/documents/123/details)',
57
+ },
58
+ },
59
+ ],
60
+ extractValue: {
61
+ type: 'regex',
62
+ regex: '^(?:http|https)://(?:.+?)/documents/(\\d+)/details$',
63
+ },
64
+ },
65
+ ],
66
+ placeholder: 'ID of the document',
67
+ required: true,
68
+ type: 'resourceLocator',
69
+ },
70
+ ];
71
+ async function execute(itemIndex) {
72
+ const id = this.getNodeParameter('id', itemIndex).value;
73
+ const endpoint = `/documents/${id}/metadata/`;
74
+ const response = (await transport_1.apiRequest.call(this, itemIndex, 'GET', endpoint));
75
+ return {
76
+ json: { results: [response] },
77
+ };
78
+ }
79
+ //# sourceMappingURL=get_metadata.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_metadata.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Paperless/v2/actions/document/get_metadata.operation.ts"],"names":[],"mappings":";;;AA2EA,0BAWC;AAhFD,+CAA6C;AAEhC,QAAA,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AEK,KAAK,UAAU,OAAO,CAE5B,SAAiB;IAEjB,MAAM,EAAE,GAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAmC,CAAC,KAAK,CAAC;IAC3F,MAAM,QAAQ,GAAG,cAAc,EAAE,YAAY,CAAC;IAC9C,MAAM,QAAQ,GAAG,CAAC,MAAM,sBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAU,CAAC;IAEpF,OAAO;QACN,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE;KAC7B,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
2
+ export declare const description: INodeProperties[];
3
+ export declare function execute(this: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData>;
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.description = void 0;
4
+ exports.execute = execute;
5
+ const n8n_workflow_1 = require("n8n-workflow");
6
+ const transport_1 = require("../../transport");
7
+ exports.description = [
8
+ {
9
+ displayName: 'ID',
10
+ name: 'id',
11
+ default: { mode: 'list', value: '' },
12
+ description: 'ID of the document to get suggestions for',
13
+ displayOptions: {
14
+ show: {
15
+ resource: ['document'],
16
+ operation: ['get_metadata_suggestions'],
17
+ },
18
+ },
19
+ hint: 'The ID of the document to get suggestions for',
20
+ modes: [
21
+ {
22
+ displayName: 'From List',
23
+ name: 'list',
24
+ placeholder: `Select a Document...`,
25
+ type: 'list',
26
+ typeOptions: {
27
+ searchListMethod: 'documentSearch',
28
+ searchFilterRequired: false,
29
+ searchable: true,
30
+ },
31
+ },
32
+ {
33
+ displayName: 'By ID',
34
+ name: 'id',
35
+ placeholder: `Enter Document ID...`,
36
+ type: 'string',
37
+ validation: [
38
+ {
39
+ type: 'regex',
40
+ properties: {
41
+ regex: '^[1-9][0-9]*$',
42
+ errorMessage: 'The ID must be a positive integer',
43
+ },
44
+ },
45
+ ],
46
+ },
47
+ {
48
+ displayName: 'By URL',
49
+ name: 'url',
50
+ placeholder: `Enter Document URL...`,
51
+ type: 'string',
52
+ validation: [
53
+ {
54
+ type: 'regex',
55
+ properties: {
56
+ regex: '^(?:http|https)://(?:.+?)/documents/(\\d+)/details$',
57
+ errorMessage: 'The URL must be a valid Paperless document URL (e.g. https://paperless.example.com/documents/123/details)',
58
+ },
59
+ },
60
+ ],
61
+ extractValue: {
62
+ type: 'regex',
63
+ regex: '^(?:http|https)://(?:.+?)/documents/(\\d+)/details$',
64
+ },
65
+ },
66
+ ],
67
+ placeholder: 'ID of the document',
68
+ required: true,
69
+ type: 'resourceLocator',
70
+ },
71
+ {
72
+ displayName: 'Options',
73
+ name: 'options',
74
+ default: {},
75
+ displayOptions: {
76
+ show: {
77
+ resource: ['document'],
78
+ operation: ['get_metadata_suggestions'],
79
+ },
80
+ },
81
+ hint: 'Additional options to include in the suggestion',
82
+ options: [
83
+ {
84
+ displayName: 'Return Metadata Values',
85
+ name: 'use_metadata_values',
86
+ default: false,
87
+ description: 'Whether to return metadata values instead of only metadata IDs. By default, only metadata IDs are returned.',
88
+ type: 'boolean',
89
+ },
90
+ ],
91
+ placeholder: 'Add options',
92
+ type: 'collection',
93
+ },
94
+ ];
95
+ async function execute(itemIndex) {
96
+ const id = this.getNodeParameter('id', itemIndex).value;
97
+ const endpoint = `/documents/${id}/suggestions/`;
98
+ const response = (await transport_1.apiRequest.call(this, itemIndex, 'GET', endpoint));
99
+ const enrichedResponse = { ...response };
100
+ const options = this.getNodeParameter('options', itemIndex, null);
101
+ if (options.use_metadata_values) {
102
+ const fetchMetadata = async (id, endpoint) => {
103
+ const response = (await transport_1.apiRequest.call(this, itemIndex, 'GET', endpoint));
104
+ return response.name;
105
+ };
106
+ try {
107
+ enrichedResponse.correspondents = await Promise.all(response.correspondents.map((id) => fetchMetadata(id, `/correspondents/${id}/`)));
108
+ enrichedResponse.tags = await Promise.all(response.tags.map((id) => fetchMetadata(id, `/tags/${id}/`)));
109
+ enrichedResponse.document_types = await Promise.all(response.document_types.map((id) => fetchMetadata(id, `/document_types/${id}/`)));
110
+ }
111
+ catch (error) {
112
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Failed to retrieve metadata values: ${error}`);
113
+ }
114
+ }
115
+ return {
116
+ json: { results: [enrichedResponse] },
117
+ };
118
+ }
119
+ //# sourceMappingURL=get_metadata_suggestions.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_metadata_suggestions.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Paperless/v2/actions/document/get_metadata_suggestions.operation.ts"],"names":[],"mappings":";;;AAoGA,0BA4CC;AAhJD,+CAMsB;AACtB,+CAA6C;AAEhC,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,IAAI;QACjB,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;QACpC,WAAW,EAAE,2CAA2C;QACxD,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,UAAU,CAAC;gBACtB,SAAS,EAAE,CAAC,0BAA0B,CAAC;aACvC;SACD;QACD,IAAI,EAAE,+CAA+C;QACrD,KAAK,EAAE;YACN;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,sBAAsB;gBACnC,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE;oBACZ,gBAAgB,EAAE,gBAAgB;oBAClC,oBAAoB,EAAE,KAAK;oBAC3B,UAAU,EAAE,IAAI;iBAChB;aACD;YACD;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,IAAI;gBACV,WAAW,EAAE,sBAAsB;gBACnC,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACX;wBACC,IAAI,EAAE,OAAO;wBACb,UAAU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AC;IACF,CAAC;IAED,OAAO;QACN,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,gBAAgB,CAAC,EAAE;KACrC,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
2
+ export declare const description: INodeProperties[];
3
+ export declare function execute(this: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData>;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.description = void 0;
4
+ exports.execute = execute;
5
+ const transport_1 = require("../../transport");
6
+ exports.description = [
7
+ {
8
+ displayName: 'ID',
9
+ name: 'id',
10
+ default: { mode: 'list', value: '' },
11
+ description: 'The ID of the document for which to retrieve a preview',
12
+ displayOptions: {
13
+ show: {
14
+ resource: ['document'],
15
+ operation: ['get_preview'],
16
+ },
17
+ },
18
+ hint: 'The ID of the document for which to retrieve a preview',
19
+ modes: [
20
+ {
21
+ displayName: 'From List',
22
+ name: 'list',
23
+ placeholder: `Select a Document...`,
24
+ type: 'list',
25
+ typeOptions: {
26
+ searchListMethod: 'documentSearch',
27
+ searchFilterRequired: false,
28
+ searchable: true,
29
+ },
30
+ },
31
+ {
32
+ displayName: 'By ID',
33
+ name: 'id',
34
+ placeholder: `Enter Document ID...`,
35
+ type: 'string',
36
+ validation: [
37
+ {
38
+ type: 'regex',
39
+ properties: {
40
+ regex: '^[1-9][0-9]*$',
41
+ errorMessage: 'The ID must be a positive integer',
42
+ },
43
+ },
44
+ ],
45
+ },
46
+ {
47
+ displayName: 'By URL',
48
+ name: 'url',
49
+ placeholder: `Enter Document URL...`,
50
+ type: 'string',
51
+ validation: [
52
+ {
53
+ type: 'regex',
54
+ properties: {
55
+ regex: '^(?:http|https)://(?:.+?)/documents/(\\d+)/details$',
56
+ errorMessage: 'The URL must be a valid Paperless document URL (e.g. https://paperless.example.com/documents/123/details)',
57
+ },
58
+ },
59
+ ],
60
+ extractValue: {
61
+ type: 'regex',
62
+ regex: '^(?:http|https)://(?:.+?)/documents/(\\d+)/details$',
63
+ },
64
+ },
65
+ ],
66
+ placeholder: 'ID of the document',
67
+ required: true,
68
+ type: 'resourceLocator',
69
+ },
70
+ ];
71
+ async function execute(itemIndex) {
72
+ var _a, _b, _c, _d;
73
+ const id = this.getNodeParameter('id', itemIndex).value;
74
+ const endpoint = `/documents/${id}`;
75
+ const preview = (await transport_1.apiRequest.call(this, itemIndex, 'GET', `${endpoint}/preview/`, undefined, undefined, { resolveWithFullResponse: true }));
76
+ const filename = (_d = (_c = (_b = (_a = preview.headers['content-disposition']) === null || _a === void 0 ? void 0 : _a.match(/filename="(?:b['"])?([^"]+)(?:['"])?"/)) === null || _b === void 0 ? void 0 : _b[1]) === null || _c === void 0 ? void 0 : _c.replace(/^['"]|['"]$/g, '')) !== null && _d !== void 0 ? _d : `${id}.pdf`;
77
+ return {
78
+ json: {},
79
+ binary: {
80
+ data: await this.helpers.prepareBinaryData(Buffer.from(preview.body), filename, 'application/pdf'),
81
+ },
82
+ };
83
+ }
84
+ //# sourceMappingURL=get_preview.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_preview.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Paperless/v2/actions/document/get_preview.operation.ts"],"names":[],"mappings":";;;AA2EA,0BA8BC;AAnGD,+CAA6C;AAEhC,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,IAAI;QACjB,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;QACpC,WAAW,EAAE,wDAAwD;QACrE,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,UAAU,CAAC;gBACtB,SAAS,EAAE,CAAC,aAAa,CAAC;aAC1B;SACD;QACD,IAAI,EAAE,wDAAwD;QAC9D,KAAK,EAAE;YACN;gBACC,WAAW,EAAE,WAAW;gBACxB,IA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,CAAC;IACV,MAAM,QAAQ,GACb,MAAA,MAAA,MAAA,MAAA,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,0CACnC,KAAK,CAAC,uCAAuC,CAAC,0CAAG,CAAC,CAAC,0CACnD,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,mCAAI,GAAG,EAAE,MAAM,CAAC;IAE/C,OAAO;QACN,IAAI,EAAE,EAAE;QACR,MAAM,EAAE;YACP,IAAI,EAAE,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CACzC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EACzB,QAAQ,EACR,iBAAiB,CACjB;SACD;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
2
+ export declare const description: INodeProperties[];
3
+ export declare function execute(this: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData>;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.description = void 0;
4
+ exports.execute = execute;
5
+ const transport_1 = require("../../transport");
6
+ exports.description = [
7
+ {
8
+ displayName: 'ID',
9
+ name: 'id',
10
+ default: { mode: 'list', value: '' },
11
+ description: 'ID of the document to retrieve share links for',
12
+ displayOptions: {
13
+ show: {
14
+ resource: ['document'],
15
+ operation: ['get_sharelink'],
16
+ },
17
+ },
18
+ hint: 'The ID of the document to retrieve share links for',
19
+ modes: [
20
+ {
21
+ displayName: 'From List',
22
+ name: 'list',
23
+ placeholder: `Select a Document...`,
24
+ type: 'list',
25
+ typeOptions: {
26
+ searchListMethod: 'documentSearch',
27
+ searchFilterRequired: false,
28
+ searchable: true,
29
+ },
30
+ },
31
+ {
32
+ displayName: 'By ID',
33
+ name: 'id',
34
+ placeholder: `Enter Document ID...`,
35
+ type: 'string',
36
+ validation: [
37
+ {
38
+ type: 'regex',
39
+ properties: {
40
+ regex: '^[1-9][0-9]*$',
41
+ errorMessage: 'The ID must be a positive integer',
42
+ },
43
+ },
44
+ ],
45
+ },
46
+ {
47
+ displayName: 'By URL',
48
+ name: 'url',
49
+ placeholder: `Enter Document URL...`,
50
+ type: 'string',
51
+ validation: [
52
+ {
53
+ type: 'regex',
54
+ properties: {
55
+ regex: '^(?:http|https)://(?:.+?)/documents/(\\d+)/details$',
56
+ errorMessage: 'The URL must be a valid Paperless document URL (e.g. https://paperless.example.com/documents/123/details)',
57
+ },
58
+ },
59
+ ],
60
+ extractValue: {
61
+ type: 'regex',
62
+ regex: '^(?:http|https)://(?:.+?)/documents/(\\d+)/details$',
63
+ },
64
+ },
65
+ ],
66
+ placeholder: 'ID of the document',
67
+ required: true,
68
+ type: 'resourceLocator',
69
+ },
70
+ ];
71
+ async function execute(itemIndex) {
72
+ const id = this.getNodeParameter('id', itemIndex).value;
73
+ const endpoint = `/documents/${id}/share_links/`;
74
+ const response = (await transport_1.apiRequest.call(this, itemIndex, 'GET', endpoint));
75
+ return {
76
+ json: { results: response },
77
+ };
78
+ }
79
+ //# sourceMappingURL=get_sharelink.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get_sharelink.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Paperless/v2/actions/document/get_sharelink.operation.ts"],"names":[],"mappings":";;;AA2EA,0BAWC;AAhFD,+CAA6C;AAEhC,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,IAAI;QACjB,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;QACpC,WAAW,EAAE,gDAAgD;QAC7D,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,UAAU,CAAC;gBACtB,SAAS,EAAE,CAAC,eAAe,CAAC;aAC5B;SACD;QACD,IAAI,EAAE,oDAAoD;QAC1D,KAAK,EAAE;YACN;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI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3B,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
2
+ export declare const description: INodeProperties[];
3
+ export declare function execute(this: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.description = void 0;
4
+ exports.execute = execute;
5
+ const n8n_workflow_1 = require("n8n-workflow");
6
+ const transport_1 = require("../../transport");
7
+ exports.description = [];
8
+ async function execute(itemIndex) {
9
+ const endpoint = '/documents/';
10
+ const responses = (await transport_1.apiRequestPaginated.call(this, itemIndex, 'GET', endpoint));
11
+ const statusCode = responses.reduce((acc, response) => acc + response.statusCode, 0) / responses.length;
12
+ if (statusCode !== 200) {
13
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The documents you are requesting could not be found`, {
14
+ description: JSON.stringify(responses.map((response) => { var _a, _b; return (_b = (_a = response === null || response === void 0 ? void 0 : response.body) === null || _a === void 0 ? void 0 : _a.details) !== null && _b !== void 0 ? _b : response === null || response === void 0 ? void 0 : response.statusMessage; })),
15
+ });
16
+ }
17
+ return {
18
+ json: { results: responses.map((response) => response.body.results).flat() },
19
+ };
20
+ }
21
+ //# sourceMappingURL=list.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Paperless/v2/actions/document/list.operation.ts"],"names":[],"mappings":";;;AAUA,0BAuBC;AAjCD,+CAKsB;AACtB,+CAAsD;AAEzC,QAAA,WAAW,GAAsB,EAAE,CAAC;AAE1C,KAAK,UAAU,OAAO,CAE5B,SAAiB;IAEjB,MAAM,QAAQ,GAAG,aAAa,CAAC;IAC/B,MAAM,SAAS,GAAG,CAAC,MAAM,+BAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAU,CAAC;IAE9F,MAAM,UAAU,GACf,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,GAAG,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;IACtF,IAAI,UAAU,KAAK,GAAG,EAAE,CAAC;QACxB,MAAM,IAAI,iCAAkB,CAC3B,IAAI,CAAC,OAAO,EAAE,EACd,qDAAqD,EACrD;YACC,WAAW,EAAE,IAAI,CAAC,SAAS,CAC1B,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,eAAC,OAAA,MAAA,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,0CAAE,OAAO,mCAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,aAAa,CAAA,EAAA,CAAC,CAC/E;SACD,CACD,CAAC;IACH,CAAC;IACD,OAAO;QACN,IAAI,EAAE,EAAE,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;KAC5E,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
2
+ export declare const description: INodeProperties[];
3
+ export declare function execute(this: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData>;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.description = void 0;
4
+ exports.execute = execute;
5
+ const transport_1 = require("../../transport");
6
+ exports.description = [
7
+ {
8
+ displayName: 'ID',
9
+ name: 'id',
10
+ default: { mode: 'list', value: '' },
11
+ description: 'ID of the document',
12
+ displayOptions: {
13
+ show: {
14
+ resource: ['document'],
15
+ operation: ['remove'],
16
+ },
17
+ },
18
+ hint: 'The ID of the document',
19
+ modes: [
20
+ {
21
+ displayName: 'From List',
22
+ name: 'list',
23
+ placeholder: `Select a Document...`,
24
+ type: 'list',
25
+ typeOptions: {
26
+ searchListMethod: 'documentSearch',
27
+ searchFilterRequired: false,
28
+ searchable: true,
29
+ },
30
+ },
31
+ {
32
+ displayName: 'By ID',
33
+ name: 'id',
34
+ placeholder: `Enter Document ID...`,
35
+ type: 'string',
36
+ validation: [
37
+ {
38
+ type: 'regex',
39
+ properties: {
40
+ regex: '^[1-9][0-9]*$',
41
+ errorMessage: 'The ID must be a positive integer',
42
+ },
43
+ },
44
+ ],
45
+ },
46
+ {
47
+ displayName: 'By URL',
48
+ name: 'url',
49
+ placeholder: `Enter Document URL...`,
50
+ type: 'string',
51
+ validation: [
52
+ {
53
+ type: 'regex',
54
+ properties: {
55
+ regex: '^(?:http|https)://(?:.+?)/documents/(\\d+)/details$',
56
+ errorMessage: 'The URL must be a valid Paperless document URL (e.g. https://paperless.example.com/documents/123/details)',
57
+ },
58
+ },
59
+ ],
60
+ extractValue: {
61
+ type: 'regex',
62
+ regex: '^(?:http|https)://(?:.+?)/documents/(\\d+)/details$',
63
+ },
64
+ },
65
+ ],
66
+ placeholder: 'ID of the document',
67
+ required: true,
68
+ type: 'resourceLocator',
69
+ },
70
+ ];
71
+ async function execute(itemIndex) {
72
+ const id = this.getNodeParameter('id', itemIndex).value;
73
+ const endpoint = `/documents/${id}/`;
74
+ await transport_1.apiRequest.call(this, itemIndex, 'DELETE', endpoint);
75
+ return { json: { results: [true] } };
76
+ }
77
+ //# sourceMappingURL=remove.operation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remove.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Paperless/v2/actions/document/remove.operation.ts"],"names":[],"mappings":";;;AA2EA,0BASC;AA9ED,+CAA6C;AAEhC,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,IAAI;QACjB,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,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CAAC;IAC3F,MAAM,QAAQ,GAAG,cAAc,EAAE,GAAG,CAAC;IACrC,MAAM,sBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAE3D,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;AACtC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
2
+ export declare const description: INodeProperties[];
3
+ export declare function execute(this: IExecuteFunctions, itemIndex: number): Promise<INodeExecutionData>;