@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.
- package/LICENSE.md +23 -0
- package/README.md +122 -0
- package/dist/credentials/PaperlessApi.credentials.d.ts +8 -0
- package/dist/credentials/PaperlessApi.credentials.js +38 -0
- package/dist/credentials/PaperlessApi.credentials.js.map +1 -0
- package/dist/nodes/Paperless/Paperless.node.d.ts +4 -0
- package/dist/nodes/Paperless/Paperless.node.js +24 -0
- package/dist/nodes/Paperless/Paperless.node.js.map +1 -0
- package/dist/nodes/Paperless/Paperless.node.json +14 -0
- package/dist/nodes/Paperless/v2/PaperlessV2.node.d.ts +10 -0
- package/dist/nodes/Paperless/v2/PaperlessV2.node.js +56 -0
- package/dist/nodes/Paperless/v2/PaperlessV2.node.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/asn/asn.resource.d.ts +4 -0
- package/dist/nodes/Paperless/v2/actions/asn/asn.resource.js +60 -0
- package/dist/nodes/Paperless/v2/actions/asn/asn.resource.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/asn/next.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/asn/next.operation.js +14 -0
- package/dist/nodes/Paperless/v2/actions/asn/next.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/correspondent.resource.d.ts +8 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/correspondent.resource.js +91 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/correspondent.resource.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/create.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/create.operation.js +67 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/create.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/get.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/get.operation.js +56 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/get.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/list.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/list.operation.js +21 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/list.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/remove.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/remove.operation.js +56 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/remove.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/update.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/update.operation.js +107 -0
- package/dist/nodes/Paperless/v2/actions/correspondent/update.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/create.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/create.operation.js +116 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/create.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/custom_field.resource.d.ts +8 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/custom_field.resource.js +91 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/custom_field.resource.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/get.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/get.operation.js +56 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/get.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/list.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/list.operation.js +21 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/list.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/remove.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/remove.operation.js +56 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/remove.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/update.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/update.operation.js +128 -0
- package/dist/nodes/Paperless/v2/actions/custom_field/update.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document/create.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document/create.operation.js +209 -0
- package/dist/nodes/Paperless/v2/actions/document/create.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document/document.resource.d.ts +13 -0
- package/dist/nodes/Paperless/v2/actions/document/document.resource.js +131 -0
- package/dist/nodes/Paperless/v2/actions/document/document.resource.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document/get.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document/get.operation.js +77 -0
- package/dist/nodes/Paperless/v2/actions/document/get.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document/get_history.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document/get_history.operation.js +86 -0
- package/dist/nodes/Paperless/v2/actions/document/get_history.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document/get_metadata.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document/get_metadata.operation.js +79 -0
- package/dist/nodes/Paperless/v2/actions/document/get_metadata.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document/get_metadata_suggestions.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document/get_metadata_suggestions.operation.js +119 -0
- package/dist/nodes/Paperless/v2/actions/document/get_metadata_suggestions.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document/get_preview.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document/get_preview.operation.js +84 -0
- package/dist/nodes/Paperless/v2/actions/document/get_preview.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document/get_sharelink.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document/get_sharelink.operation.js +79 -0
- package/dist/nodes/Paperless/v2/actions/document/get_sharelink.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document/list.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document/list.operation.js +21 -0
- package/dist/nodes/Paperless/v2/actions/document/list.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document/remove.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document/remove.operation.js +77 -0
- package/dist/nodes/Paperless/v2/actions/document/remove.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document/update.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document/update.operation.js +368 -0
- package/dist/nodes/Paperless/v2/actions/document/update.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document_note/create.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document_note/create.operation.js +98 -0
- package/dist/nodes/Paperless/v2/actions/document_note/create.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document_note/document_note.resource.d.ts +6 -0
- package/dist/nodes/Paperless/v2/actions/document_note/document_note.resource.js +75 -0
- package/dist/nodes/Paperless/v2/actions/document_note/document_note.resource.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document_note/list.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document_note/list.operation.js +86 -0
- package/dist/nodes/Paperless/v2/actions/document_note/list.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document_note/remove.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document_note/remove.operation.js +123 -0
- package/dist/nodes/Paperless/v2/actions/document_note/remove.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document_type/create.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document_type/create.operation.js +67 -0
- package/dist/nodes/Paperless/v2/actions/document_type/create.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document_type/document_type.resource.d.ts +8 -0
- package/dist/nodes/Paperless/v2/actions/document_type/document_type.resource.js +91 -0
- package/dist/nodes/Paperless/v2/actions/document_type/document_type.resource.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document_type/get.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document_type/get.operation.js +56 -0
- package/dist/nodes/Paperless/v2/actions/document_type/get.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document_type/list.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document_type/list.operation.js +21 -0
- package/dist/nodes/Paperless/v2/actions/document_type/list.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document_type/remove.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document_type/remove.operation.js +56 -0
- package/dist/nodes/Paperless/v2/actions/document_type/remove.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/document_type/update.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/document_type/update.operation.js +111 -0
- package/dist/nodes/Paperless/v2/actions/document_type/update.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/node.type.d.ts +12 -0
- package/dist/nodes/Paperless/v2/actions/node.type.js +3 -0
- package/dist/nodes/Paperless/v2/actions/node.type.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/router.d.ts +2 -0
- package/dist/nodes/Paperless/v2/actions/router.js +92 -0
- package/dist/nodes/Paperless/v2/actions/router.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/tag/create.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/tag/create.operation.js +67 -0
- package/dist/nodes/Paperless/v2/actions/tag/create.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/tag/get.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/tag/get.operation.js +56 -0
- package/dist/nodes/Paperless/v2/actions/tag/get.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/tag/list.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/tag/list.operation.js +21 -0
- package/dist/nodes/Paperless/v2/actions/tag/list.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/tag/remove.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/tag/remove.operation.js +56 -0
- package/dist/nodes/Paperless/v2/actions/tag/remove.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/tag/tag.resource.d.ts +8 -0
- package/dist/nodes/Paperless/v2/actions/tag/tag.resource.js +91 -0
- package/dist/nodes/Paperless/v2/actions/tag/tag.resource.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/tag/update.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/tag/update.operation.js +107 -0
- package/dist/nodes/Paperless/v2/actions/tag/update.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/task/get.operation.d.ts +3 -0
- package/dist/nodes/Paperless/v2/actions/task/get.operation.js +38 -0
- package/dist/nodes/Paperless/v2/actions/task/get.operation.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/task/task.resource.d.ts +4 -0
- package/dist/nodes/Paperless/v2/actions/task/task.resource.js +59 -0
- package/dist/nodes/Paperless/v2/actions/task/task.resource.js.map +1 -0
- package/dist/nodes/Paperless/v2/actions/version.d.ts +2 -0
- package/dist/nodes/Paperless/v2/actions/version.js +117 -0
- package/dist/nodes/Paperless/v2/actions/version.js.map +1 -0
- package/dist/nodes/Paperless/v2/methods/index.d.ts +1 -0
- package/dist/nodes/Paperless/v2/methods/index.js +38 -0
- package/dist/nodes/Paperless/v2/methods/index.js.map +1 -0
- package/dist/nodes/Paperless/v2/methods/listSearch.d.ts +8 -0
- package/dist/nodes/Paperless/v2/methods/listSearch.js +71 -0
- package/dist/nodes/Paperless/v2/methods/listSearch.js.map +1 -0
- package/dist/nodes/Paperless/v2/paperless-ngx.svg +1 -0
- package/dist/nodes/Paperless/v2/transport/index.d.ts +3 -0
- package/dist/nodes/Paperless/v2/transport/index.js +50 -0
- package/dist/nodes/Paperless/v2/transport/index.js.map +1 -0
- package/dist/package.json +74 -0
- package/index.js +0 -0
- package/package.json +74 -0
|
@@ -0,0 +1,368 @@
|
|
|
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: ['update'],
|
|
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
|
+
displayName: 'Update Fields',
|
|
72
|
+
name: 'update_fields',
|
|
73
|
+
type: 'collection',
|
|
74
|
+
default: {},
|
|
75
|
+
hint: 'All additional fields are automatically added to the document by Paperless if they are not set',
|
|
76
|
+
displayOptions: {
|
|
77
|
+
show: {
|
|
78
|
+
resource: ['document'],
|
|
79
|
+
operation: ['update'],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
placeholder: 'Add Field',
|
|
83
|
+
options: [
|
|
84
|
+
{
|
|
85
|
+
displayName: 'Append Tags',
|
|
86
|
+
name: 'append_tags',
|
|
87
|
+
type: 'boolean',
|
|
88
|
+
default: false,
|
|
89
|
+
description: 'Whether to append the new tags to the existing ones instead of replacing them',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
displayName: 'Archive Serial Number',
|
|
93
|
+
name: 'archive_serial_number',
|
|
94
|
+
default: '',
|
|
95
|
+
description: 'The archive serial number of the document',
|
|
96
|
+
type: 'number',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
displayName: 'Correspondent',
|
|
100
|
+
name: 'correspondent',
|
|
101
|
+
default: { mode: 'list', value: '' },
|
|
102
|
+
description: 'The correspondent ID of the document',
|
|
103
|
+
modes: [
|
|
104
|
+
{
|
|
105
|
+
displayName: 'From List',
|
|
106
|
+
name: 'list',
|
|
107
|
+
placeholder: `Select a Correspondent...`,
|
|
108
|
+
type: 'list',
|
|
109
|
+
typeOptions: {
|
|
110
|
+
searchListMethod: 'correspondentSearch',
|
|
111
|
+
searchFilterRequired: false,
|
|
112
|
+
searchable: true,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
displayName: 'By ID',
|
|
117
|
+
name: 'id',
|
|
118
|
+
placeholder: `Enter Correspondent ID...`,
|
|
119
|
+
type: 'string',
|
|
120
|
+
validation: [
|
|
121
|
+
{
|
|
122
|
+
type: 'regex',
|
|
123
|
+
properties: {
|
|
124
|
+
regex: '^[1-9][0-9]*$',
|
|
125
|
+
errorMessage: 'The ID must be a positive integer',
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
type: 'resourceLocator',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
displayName: 'Created',
|
|
135
|
+
name: 'created',
|
|
136
|
+
default: '',
|
|
137
|
+
description: 'The date and time the document was created',
|
|
138
|
+
type: 'dateTime',
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
displayName: 'Custom Fields',
|
|
142
|
+
name: 'custom_fields',
|
|
143
|
+
default: {},
|
|
144
|
+
description: 'The custom field of the document',
|
|
145
|
+
options: [
|
|
146
|
+
{
|
|
147
|
+
displayName: 'Custom Field',
|
|
148
|
+
name: 'values',
|
|
149
|
+
values: [
|
|
150
|
+
{
|
|
151
|
+
displayName: 'Field',
|
|
152
|
+
name: 'field',
|
|
153
|
+
default: { mode: 'list', value: '' },
|
|
154
|
+
description: 'The custom field ID',
|
|
155
|
+
modes: [
|
|
156
|
+
{
|
|
157
|
+
displayName: 'From List',
|
|
158
|
+
name: 'list',
|
|
159
|
+
placeholder: `Select a Custom Field...`,
|
|
160
|
+
type: 'list',
|
|
161
|
+
typeOptions: {
|
|
162
|
+
searchListMethod: 'customFieldSearch',
|
|
163
|
+
searchFilterRequired: false,
|
|
164
|
+
searchable: true,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
displayName: 'By ID',
|
|
169
|
+
name: 'id',
|
|
170
|
+
placeholder: `Enter Custom Field ID...`,
|
|
171
|
+
type: 'string',
|
|
172
|
+
validation: [
|
|
173
|
+
{
|
|
174
|
+
type: 'regex',
|
|
175
|
+
properties: {
|
|
176
|
+
regex: '^[1-9][0-9]*$',
|
|
177
|
+
errorMessage: 'The ID must be a positive integer',
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
type: 'resourceLocator',
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
displayName: 'Value',
|
|
187
|
+
name: 'value',
|
|
188
|
+
default: '',
|
|
189
|
+
description: 'The custom field value',
|
|
190
|
+
type: 'string',
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
},
|
|
194
|
+
],
|
|
195
|
+
placeholder: 'Add Custom Field',
|
|
196
|
+
type: 'fixedCollection',
|
|
197
|
+
typeOptions: {
|
|
198
|
+
multipleValues: true,
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
displayName: 'Document Type',
|
|
203
|
+
name: 'document_type',
|
|
204
|
+
default: { mode: 'list', value: '' },
|
|
205
|
+
description: 'The document type ID of the document',
|
|
206
|
+
modes: [
|
|
207
|
+
{
|
|
208
|
+
displayName: 'From List',
|
|
209
|
+
name: 'list',
|
|
210
|
+
placeholder: `Select a Document Type...`,
|
|
211
|
+
type: 'list',
|
|
212
|
+
typeOptions: {
|
|
213
|
+
searchListMethod: 'documentTypeSearch',
|
|
214
|
+
searchFilterRequired: false,
|
|
215
|
+
searchable: true,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
displayName: 'By ID',
|
|
220
|
+
name: 'id',
|
|
221
|
+
placeholder: `Enter Document Type ID...`,
|
|
222
|
+
type: 'string',
|
|
223
|
+
validation: [
|
|
224
|
+
{
|
|
225
|
+
type: 'regex',
|
|
226
|
+
properties: {
|
|
227
|
+
regex: '^[1-9][0-9]*$',
|
|
228
|
+
errorMessage: 'The ID must be a positive integer',
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
type: 'resourceLocator',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
displayName: 'Storage Path',
|
|
238
|
+
name: 'storage_path',
|
|
239
|
+
default: { mode: 'list', value: '' },
|
|
240
|
+
description: 'The storage path ID of the document',
|
|
241
|
+
modes: [
|
|
242
|
+
{
|
|
243
|
+
displayName: 'From List',
|
|
244
|
+
name: 'list',
|
|
245
|
+
placeholder: `Select a Storage Path...`,
|
|
246
|
+
type: 'list',
|
|
247
|
+
typeOptions: {
|
|
248
|
+
searchListMethod: 'storagePathSearch',
|
|
249
|
+
searchFilterRequired: false,
|
|
250
|
+
searchable: true,
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
displayName: 'By ID',
|
|
255
|
+
name: 'id',
|
|
256
|
+
placeholder: `Enter Storage Path ID...`,
|
|
257
|
+
type: 'string',
|
|
258
|
+
validation: [
|
|
259
|
+
{
|
|
260
|
+
type: 'regex',
|
|
261
|
+
properties: {
|
|
262
|
+
regex: '^[1-9][0-9]*$',
|
|
263
|
+
errorMessage: 'The ID must be a positive integer',
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
type: 'resourceLocator',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
displayName: 'Tags',
|
|
273
|
+
name: 'tags',
|
|
274
|
+
default: {},
|
|
275
|
+
description: 'The tag IDs of the document',
|
|
276
|
+
options: [
|
|
277
|
+
{
|
|
278
|
+
displayName: 'Tag',
|
|
279
|
+
name: 'values',
|
|
280
|
+
values: [
|
|
281
|
+
{
|
|
282
|
+
displayName: 'Tag',
|
|
283
|
+
name: 'tag',
|
|
284
|
+
default: { mode: 'list', value: '' },
|
|
285
|
+
description: 'The tag ID',
|
|
286
|
+
modes: [
|
|
287
|
+
{
|
|
288
|
+
displayName: 'From List',
|
|
289
|
+
name: 'list',
|
|
290
|
+
placeholder: `Select a Tag...`,
|
|
291
|
+
type: 'list',
|
|
292
|
+
typeOptions: {
|
|
293
|
+
searchListMethod: 'tagSearch',
|
|
294
|
+
searchFilterRequired: false,
|
|
295
|
+
searchable: true,
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
displayName: 'By ID',
|
|
300
|
+
name: 'id',
|
|
301
|
+
placeholder: `Enter Tag ID...`,
|
|
302
|
+
type: 'string',
|
|
303
|
+
validation: [
|
|
304
|
+
{
|
|
305
|
+
type: 'regex',
|
|
306
|
+
properties: {
|
|
307
|
+
regex: '^[1-9][0-9]*$',
|
|
308
|
+
errorMessage: 'The ID must be a positive integer',
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
},
|
|
313
|
+
],
|
|
314
|
+
type: 'resourceLocator',
|
|
315
|
+
},
|
|
316
|
+
],
|
|
317
|
+
},
|
|
318
|
+
],
|
|
319
|
+
placeholder: 'Add Tag',
|
|
320
|
+
type: 'fixedCollection',
|
|
321
|
+
typeOptions: {
|
|
322
|
+
multipleValues: true,
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
displayName: 'Title',
|
|
327
|
+
name: 'title',
|
|
328
|
+
default: '',
|
|
329
|
+
description: 'The title of the document',
|
|
330
|
+
type: 'string',
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
},
|
|
334
|
+
];
|
|
335
|
+
async function execute(itemIndex) {
|
|
336
|
+
var _a, _b, _c, _d, _e;
|
|
337
|
+
const id = this.getNodeParameter('id', itemIndex).value;
|
|
338
|
+
const endpoint = `/documents/${id}/`;
|
|
339
|
+
const updateFields = this.getNodeParameter('update_fields', itemIndex, {});
|
|
340
|
+
let tags;
|
|
341
|
+
if (Array.isArray(updateFields.tags)) {
|
|
342
|
+
tags = updateFields.tags.map(Number);
|
|
343
|
+
}
|
|
344
|
+
else if ((_a = updateFields.tags) === null || _a === void 0 ? void 0 : _a.values) {
|
|
345
|
+
tags = updateFields.tags.values.map((tag) => Number(tag.tag.value));
|
|
346
|
+
}
|
|
347
|
+
if (updateFields.append_tags && tags && tags.length > 0) {
|
|
348
|
+
const currentDocument = (await transport_1.apiRequest.call(this, itemIndex, 'GET', endpoint));
|
|
349
|
+
const currentTags = (currentDocument.tags || []).map((t) => Number(t));
|
|
350
|
+
tags = [...new Set([...currentTags, ...tags])];
|
|
351
|
+
}
|
|
352
|
+
const body = {
|
|
353
|
+
archive_serial_number: updateFields.archive_serial_number,
|
|
354
|
+
correspondent: (_b = updateFields.correspondent) === null || _b === void 0 ? void 0 : _b.value,
|
|
355
|
+
created: updateFields.created,
|
|
356
|
+
custom_fields: (_c = updateFields.custom_fields) === null || _c === void 0 ? void 0 : _c.values.map((customField) => ({
|
|
357
|
+
field: customField.field.value,
|
|
358
|
+
value: customField.value,
|
|
359
|
+
})),
|
|
360
|
+
document_type: (_d = updateFields.document_type) === null || _d === void 0 ? void 0 : _d.value,
|
|
361
|
+
storage_path: (_e = updateFields.storage_path) === null || _e === void 0 ? void 0 : _e.value,
|
|
362
|
+
tags,
|
|
363
|
+
title: updateFields.title,
|
|
364
|
+
};
|
|
365
|
+
const response = (await transport_1.apiRequest.call(this, itemIndex, 'PATCH', endpoint, body));
|
|
366
|
+
return { json: { results: [response] } };
|
|
367
|
+
}
|
|
368
|
+
//# sourceMappingURL=update.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Paperless/v2/actions/document/update.operation.ts"],"names":[],"mappings":";;;AAoVA,0BAuCC;AArXD,+CAA6C;AAEhC,QAAA,WAAW,GAAsB;IAC7C;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C,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,WAAW,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,IAAI,GAAG;QACZ,qBAAqB,EAAE,YAAY,CAAC,qBAAqB;QACzD,aAAa,EAAE,MAAA,YAAY,CAAC,aAAa,0CAAE,KAAK;QAChD,OAAO,EAAE,YAAY,CAAC,OAAO;QAC7B,aAAa,EAAE,MAAA,YAAY,CAAC,aAAa,0CAAE,MAAM,CAAC,GAAG,CAAC,CAAC,WAAgB,EAAE,EAAE,CAAC,CAAC;YAC5E,KAAK,EAAE,WAAW,CAAC,KAAK,CAAC,KAAK;YAC9B,KAAK,EAAE,WAAW,CAAC,KAAK;SACxB,CAAC,CAAC;QACH,aAAa,EAAE,MAAA,YAAY,CAAC,aAAa,0CAAE,KAAK;QAChD,YAAY,EAAE,MAAA,YAAY,CAAC,YAAY,0CAAE,KAAK;QAC9C,IAAI;QACJ,KAAK,EAAE,YAAY,CAAC,KAAK;KACzB,CAAC;IAEF,MAAM,QAAQ,GAAG,CAAC,MAAM,sBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAQ,CAAC;IAE1F,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
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 associated with the note',
|
|
12
|
+
displayOptions: {
|
|
13
|
+
show: {
|
|
14
|
+
resource: ['document_note'],
|
|
15
|
+
operation: ['create'],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
hint: 'The ID of the document associated with the note',
|
|
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
|
+
displayName: 'Note',
|
|
72
|
+
name: 'note',
|
|
73
|
+
default: '',
|
|
74
|
+
description: 'Content of the note to add',
|
|
75
|
+
displayOptions: {
|
|
76
|
+
show: {
|
|
77
|
+
resource: ['document_note'],
|
|
78
|
+
operation: ['create'],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
placeholder: 'Content of the note to add',
|
|
82
|
+
required: true,
|
|
83
|
+
type: 'string',
|
|
84
|
+
typeOptions: {
|
|
85
|
+
rows: 5,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
async function execute(itemIndex) {
|
|
90
|
+
const id = this.getNodeParameter('id', itemIndex).value;
|
|
91
|
+
const endpoint = `/documents/${id}/notes/`;
|
|
92
|
+
const body = {
|
|
93
|
+
note: this.getNodeParameter('note', itemIndex),
|
|
94
|
+
};
|
|
95
|
+
const response = (await transport_1.apiRequest.call(this, itemIndex, 'POST', endpoint, body));
|
|
96
|
+
return { json: { results: [response] } };
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=create.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Paperless/v2/actions/document_note/create.operation.ts"],"names":[],"mappings":";;;AA6FA,0BAaC;AApGD,+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,6CAA6C;QAC1D,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,eAAe,CAAC;gBAC3B,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,IAAI,EAAE,iDAAiD;QACvD,KAAK,EAAE;YACN;gBACC,WAAW,EAA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K,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,SAAS,CAAC;IAC3C,MAAM,IAAI,GAAG;QACZ,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC;KAC9C,CAAC;IAEF,MAAM,QAAQ,GAAG,CAAC,MAAM,sBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAQ,CAAC;IAEzF,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import * as create from './create.operation';
|
|
3
|
+
import * as list from './list.operation';
|
|
4
|
+
import * as remove from './remove.operation';
|
|
5
|
+
export { create, list, remove };
|
|
6
|
+
export declare const description: INodeProperties[];
|
|
@@ -0,0 +1,75 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.description = exports.remove = exports.list = exports.create = void 0;
|
|
37
|
+
const create = __importStar(require("./create.operation"));
|
|
38
|
+
exports.create = create;
|
|
39
|
+
const list = __importStar(require("./list.operation"));
|
|
40
|
+
exports.list = list;
|
|
41
|
+
const remove = __importStar(require("./remove.operation"));
|
|
42
|
+
exports.remove = remove;
|
|
43
|
+
exports.description = [
|
|
44
|
+
{
|
|
45
|
+
displayName: 'Operation',
|
|
46
|
+
name: 'operation',
|
|
47
|
+
default: 'list',
|
|
48
|
+
displayOptions: {
|
|
49
|
+
show: { resource: ['document_note'] },
|
|
50
|
+
},
|
|
51
|
+
noDataExpression: true,
|
|
52
|
+
options: [
|
|
53
|
+
{
|
|
54
|
+
name: 'Create a Document Note',
|
|
55
|
+
value: 'create',
|
|
56
|
+
action: 'Create a new document note',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'Delete a Document Note',
|
|
60
|
+
value: 'remove',
|
|
61
|
+
action: 'Delete a document note',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'List Document Notes',
|
|
65
|
+
value: 'list',
|
|
66
|
+
action: 'List all document notes',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
type: 'options',
|
|
70
|
+
},
|
|
71
|
+
...create.description,
|
|
72
|
+
...list.description,
|
|
73
|
+
...remove.description,
|
|
74
|
+
];
|
|
75
|
+
//# sourceMappingURL=document_note.resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document_note.resource.js","sourceRoot":"","sources":["../../../../../../nodes/Paperless/v2/actions/document_note/document_note.resource.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,2DAA6C;AAIpC,wBAAM;AAHf,uDAAyC;AAGxB,oBAAI;AAFrB,2DAA6C;AAEtB,wBAAM;AAEhB,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,MAAM;QACf,cAAc,EAAE;YACf,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,eAAe,CAAC,EAAE;SACrC;QACD,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,wBAAwB;gBAC9B,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,4BAA4B;aACpC;YACD;gBACC,IAAI,EAAE,wBAAwB;gBAC9B,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,wBAAwB;aAChC;YACD;gBACC,IAAI,EAAE,qBAAqB;gBAC3B,KAAK,EAAE,MAAM;gBACb,MAAM,EAAE,yBAAyB;aACjC;SACD;QACD,IAAI,EAAE,SAAS;KACf;IACD,GAAG,MAAM,CAAC,WAAW;IACrB,GAAG,IAAI,CAAC,WAAW;IACnB,GAAG,MAAM,CAAC,WAAW;CACrB,CAAC"}
|
|
@@ -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 associated with the notes',
|
|
13
|
+
displayOptions: {
|
|
14
|
+
show: {
|
|
15
|
+
resource: ['document_note'],
|
|
16
|
+
operation: ['list'],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
hint: 'The ID of the document associated with the notes',
|
|
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}/notes/`;
|
|
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 document notes 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).flat() },
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=list.operation.js.map
|