@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,128 @@
|
|
|
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
|
+
const crypto_1 = require("crypto");
|
|
7
|
+
exports.description = [
|
|
8
|
+
{
|
|
9
|
+
displayName: 'ID',
|
|
10
|
+
name: 'id',
|
|
11
|
+
default: { mode: 'list', value: '' },
|
|
12
|
+
displayOptions: {
|
|
13
|
+
show: {
|
|
14
|
+
resource: ['custom_field'],
|
|
15
|
+
operation: ['update'],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
modes: [
|
|
19
|
+
{
|
|
20
|
+
displayName: 'From List',
|
|
21
|
+
name: 'list',
|
|
22
|
+
placeholder: `Select a Custom Field...`,
|
|
23
|
+
type: 'list',
|
|
24
|
+
typeOptions: {
|
|
25
|
+
searchListMethod: 'customFieldSearch',
|
|
26
|
+
searchFilterRequired: false,
|
|
27
|
+
searchable: true,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
displayName: 'By ID',
|
|
32
|
+
name: 'id',
|
|
33
|
+
placeholder: `Enter Custom Field ID...`,
|
|
34
|
+
type: 'string',
|
|
35
|
+
validation: [
|
|
36
|
+
{
|
|
37
|
+
type: 'regex',
|
|
38
|
+
properties: {
|
|
39
|
+
regex: '^[1-9][0-9]*$',
|
|
40
|
+
errorMessage: 'The ID must be a positive integer',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
placeholder: 'ID of the custom_field',
|
|
47
|
+
required: true,
|
|
48
|
+
type: 'resourceLocator',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
displayName: 'Update Fields',
|
|
52
|
+
name: 'update_fields',
|
|
53
|
+
default: {},
|
|
54
|
+
displayOptions: {
|
|
55
|
+
show: {
|
|
56
|
+
resource: ['custom_field'],
|
|
57
|
+
operation: ['update'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
options: [
|
|
61
|
+
{
|
|
62
|
+
displayName: 'Name',
|
|
63
|
+
name: 'name',
|
|
64
|
+
placeholder: 'Name of the custom field',
|
|
65
|
+
type: 'string',
|
|
66
|
+
default: '',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
displayName: 'Select Options',
|
|
70
|
+
name: 'select_options',
|
|
71
|
+
default: [],
|
|
72
|
+
description: 'The options for the select data type',
|
|
73
|
+
options: [
|
|
74
|
+
{
|
|
75
|
+
displayName: 'Option',
|
|
76
|
+
name: 'option',
|
|
77
|
+
values: [
|
|
78
|
+
{
|
|
79
|
+
displayName: 'Name',
|
|
80
|
+
name: 'name',
|
|
81
|
+
type: 'string',
|
|
82
|
+
default: '',
|
|
83
|
+
description: 'The name of the select option',
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
placeholder: 'Add Option',
|
|
89
|
+
type: 'fixedCollection',
|
|
90
|
+
typeOptions: {
|
|
91
|
+
multipleValues: true,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Default Currency',
|
|
96
|
+
name: 'default_currency',
|
|
97
|
+
default: '',
|
|
98
|
+
description: 'The default currency for the monetary data type',
|
|
99
|
+
type: 'string',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
placeholder: 'Add Field',
|
|
103
|
+
type: 'collection',
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
async function execute(itemIndex) {
|
|
107
|
+
const id = this.getNodeParameter('id', itemIndex).value;
|
|
108
|
+
const endpoint = `/custom_fields/${id}/`;
|
|
109
|
+
const updateFields = this.getNodeParameter('update_fields', itemIndex, {});
|
|
110
|
+
const body = {};
|
|
111
|
+
if (updateFields.name) {
|
|
112
|
+
body.name = updateFields.name;
|
|
113
|
+
}
|
|
114
|
+
if (updateFields.select_options) {
|
|
115
|
+
body.extra_data = {};
|
|
116
|
+
body.extra_data.select_options = updateFields.select_options.option.map((option) => ({
|
|
117
|
+
label: option.name.trim(),
|
|
118
|
+
id: (0, crypto_1.createHash)('sha256').update(option.name.trim()).digest('hex'),
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
if (updateFields.default_currency) {
|
|
122
|
+
body.extra_data = body.extra_data || {};
|
|
123
|
+
body.extra_data.default_currency = updateFields.default_currency;
|
|
124
|
+
}
|
|
125
|
+
const response = (await transport_1.apiRequest.call(this, itemIndex, 'PATCH', endpoint, body));
|
|
126
|
+
return { json: { results: [response] } };
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=update.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Paperless/v2/actions/custom_field/update.operation.ts"],"names":[],"mappings":";;;AA6GA,0BA8BC;AArID,+CAA6C;AAC7C,mCAAoC;AAEvB,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,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,cAAc,CAAC;gBAC1B,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,KAAK,EAAE;YACN;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE,0BAA0B;gBACvC,IAAI,EAAE,MAAM;gBACZ,WAAW,EAAE;oBACZ,gBAAgB,EAAE,mBAAmB;oBACrC,oBAAoB,EAAE,KAAK;oBAC3B,UAAU,EAAE,IAAI;iBAChB;aACD;YACD;gBACC,WAAW,EAAE,OAAO;gBACpB,IAAI,EAAE,IAAI;gBACV,WAAW,EAAE,0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Q,EAAE,IAAI,CAAC,CAAQ,CAAC;IAE1F,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.description = void 0;
|
|
7
|
+
exports.execute = execute;
|
|
8
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
9
|
+
const transport_1 = require("../../transport");
|
|
10
|
+
exports.description = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'Input Binary Field',
|
|
13
|
+
name: 'binary_property_name',
|
|
14
|
+
default: 'data',
|
|
15
|
+
displayOptions: {
|
|
16
|
+
show: {
|
|
17
|
+
resource: ['document'],
|
|
18
|
+
operation: ['create'],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
hint: 'The name of the input field containing the file data to be processed',
|
|
22
|
+
required: true,
|
|
23
|
+
type: 'string',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
displayName: 'Additional Fields',
|
|
27
|
+
name: 'additional_fields',
|
|
28
|
+
type: 'collection',
|
|
29
|
+
default: {},
|
|
30
|
+
hint: 'All additional fields are automatically added to the document by Paperless if they are not set',
|
|
31
|
+
displayOptions: {
|
|
32
|
+
show: {
|
|
33
|
+
resource: ['document'],
|
|
34
|
+
operation: ['create'],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
placeholder: 'Add Field',
|
|
38
|
+
options: [
|
|
39
|
+
{
|
|
40
|
+
displayName: 'Archive Serial Number',
|
|
41
|
+
name: 'archive_serial_number',
|
|
42
|
+
default: '',
|
|
43
|
+
description: 'The archive serial number of the document',
|
|
44
|
+
type: 'number',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
displayName: 'Correspondent',
|
|
48
|
+
name: 'correspondent',
|
|
49
|
+
default: { mode: 'list', value: '' },
|
|
50
|
+
description: 'The correspondent ID of the document',
|
|
51
|
+
modes: [
|
|
52
|
+
{
|
|
53
|
+
displayName: 'From List',
|
|
54
|
+
name: 'list',
|
|
55
|
+
placeholder: `Select a Correspondent...`,
|
|
56
|
+
type: 'list',
|
|
57
|
+
typeOptions: {
|
|
58
|
+
searchListMethod: 'correspondentSearch',
|
|
59
|
+
searchFilterRequired: false,
|
|
60
|
+
searchable: true,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
displayName: 'By ID',
|
|
65
|
+
name: 'id',
|
|
66
|
+
placeholder: `Enter Correspondent ID...`,
|
|
67
|
+
type: 'string',
|
|
68
|
+
validation: [
|
|
69
|
+
{
|
|
70
|
+
type: 'regex',
|
|
71
|
+
properties: {
|
|
72
|
+
regex: '^[1-9][0-9]*$',
|
|
73
|
+
errorMessage: 'The ID must be a positive integer',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
type: 'resourceLocator',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
displayName: 'Created',
|
|
83
|
+
name: 'created',
|
|
84
|
+
default: '',
|
|
85
|
+
description: 'The date and time the document was created',
|
|
86
|
+
type: 'dateTime',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
displayName: 'Document Type',
|
|
90
|
+
name: 'document_type',
|
|
91
|
+
default: { mode: 'list', value: '' },
|
|
92
|
+
description: 'The document type ID of the document',
|
|
93
|
+
modes: [
|
|
94
|
+
{
|
|
95
|
+
displayName: 'From List',
|
|
96
|
+
name: 'list',
|
|
97
|
+
placeholder: `Select a Document Type...`,
|
|
98
|
+
type: 'list',
|
|
99
|
+
typeOptions: {
|
|
100
|
+
searchListMethod: 'documentTypeSearch',
|
|
101
|
+
searchFilterRequired: false,
|
|
102
|
+
searchable: true,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
displayName: 'By ID',
|
|
107
|
+
name: 'id',
|
|
108
|
+
placeholder: `Enter Document Type ID...`,
|
|
109
|
+
type: 'string',
|
|
110
|
+
validation: [
|
|
111
|
+
{
|
|
112
|
+
type: 'regex',
|
|
113
|
+
properties: {
|
|
114
|
+
regex: '^[1-9][0-9]*$',
|
|
115
|
+
errorMessage: 'The ID must be a positive integer',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
type: 'resourceLocator',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
displayName: 'Storage Path',
|
|
125
|
+
name: 'storage_path',
|
|
126
|
+
default: { mode: 'list', value: '' },
|
|
127
|
+
description: 'The storage path ID of the document',
|
|
128
|
+
modes: [
|
|
129
|
+
{
|
|
130
|
+
displayName: 'From List',
|
|
131
|
+
name: 'list',
|
|
132
|
+
placeholder: `Select a Storage Path...`,
|
|
133
|
+
type: 'list',
|
|
134
|
+
typeOptions: {
|
|
135
|
+
searchListMethod: 'storagePathSearch',
|
|
136
|
+
searchFilterRequired: false,
|
|
137
|
+
searchable: true,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
displayName: 'By ID',
|
|
142
|
+
name: 'id',
|
|
143
|
+
placeholder: `Enter Storage Path ID...`,
|
|
144
|
+
type: 'string',
|
|
145
|
+
validation: [
|
|
146
|
+
{
|
|
147
|
+
type: 'regex',
|
|
148
|
+
properties: {
|
|
149
|
+
regex: '^[1-9][0-9]*$',
|
|
150
|
+
errorMessage: 'The ID must be a positive integer',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
],
|
|
156
|
+
type: 'resourceLocator',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
displayName: 'Title',
|
|
160
|
+
name: 'title',
|
|
161
|
+
default: '',
|
|
162
|
+
description: 'The title of the document',
|
|
163
|
+
type: 'string',
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
displayName: 'Custom fields and tags are not yet supported on document creation... Use the update operation to set these values',
|
|
169
|
+
name: 'notice_not_supported',
|
|
170
|
+
default: '',
|
|
171
|
+
displayOptions: {
|
|
172
|
+
show: {
|
|
173
|
+
resource: ['document'],
|
|
174
|
+
operation: ['create'],
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
type: 'notice',
|
|
178
|
+
},
|
|
179
|
+
];
|
|
180
|
+
async function execute(itemIndex) {
|
|
181
|
+
var _a, _b, _c;
|
|
182
|
+
const endpoint = `/documents/post_document/`;
|
|
183
|
+
const formData = new form_data_1.default();
|
|
184
|
+
const binaryPropertyName = this.getNodeParameter('binary_property_name', itemIndex);
|
|
185
|
+
const binaryData = this.helpers.assertBinaryData(itemIndex, binaryPropertyName);
|
|
186
|
+
const data = binaryData.id
|
|
187
|
+
? await this.helpers.getBinaryStream(binaryData.id)
|
|
188
|
+
: Buffer.from(binaryData.data, 'base64');
|
|
189
|
+
formData.append('document', data, {
|
|
190
|
+
filename: binaryData.fileName,
|
|
191
|
+
contentType: binaryData.mimeType,
|
|
192
|
+
});
|
|
193
|
+
const additionalFields = this.getNodeParameter('additional_fields', itemIndex);
|
|
194
|
+
Object.entries({
|
|
195
|
+
archive_serial_number: additionalFields.archive_serial_number,
|
|
196
|
+
correspondent: (_a = additionalFields.correspondent) === null || _a === void 0 ? void 0 : _a.value,
|
|
197
|
+
created: additionalFields.created,
|
|
198
|
+
document_type: (_b = additionalFields.document_type) === null || _b === void 0 ? void 0 : _b.value,
|
|
199
|
+
storage_path: (_c = additionalFields.storage_path) === null || _c === void 0 ? void 0 : _c.value,
|
|
200
|
+
title: additionalFields.title,
|
|
201
|
+
})
|
|
202
|
+
.filter(([, value]) => value !== undefined && value !== '')
|
|
203
|
+
.forEach(([key, value]) => {
|
|
204
|
+
formData.append(key, value);
|
|
205
|
+
});
|
|
206
|
+
const response = (await transport_1.apiRequest.call(this, itemIndex, 'POST', endpoint, undefined, undefined, { headers: formData.getHeaders(), formData }));
|
|
207
|
+
return { json: { results: [response] } };
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=create.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Paperless/v2/actions/document/create.operation.ts"],"names":[],"mappings":";;;;;;AAgLA,0BA2CC;AA3ND,0DAAiC;AAEjC,+CAA6C;AAEhC,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,oBAAoB;QACjC,IAAI,EAAE,sBAAsB;QAC5B,OAAO,EAAE,MAAM;QACf,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,UAAU,CAAC;gBACtB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,IAAI,EAAE,sEAAsE;QAC5E,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,QAAQ;KACd;IACD;QACC,WAAW,EAAE,mBAAmB;QAChC,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,EAAE;QACX,IAAI,EAAE,gGAAgG;QACtG,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,UAAU,CAAC;gBACtB,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,WAAW,EAAE,WAAW;QACxB,OAAO,EAAE;YACR;gBACC,WAAW,EAAE,uBAAuB;gBACpC,IAAI,EAAE,uBAAuB;gBAC7B,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,2CAA2C;gBACxD,IAAI,EAAE,QAAQ;aACd;YACD;gBACC,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,EA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,SAAS,IAAI,KAAK,KAAK,EAAE,CAAC;SAC1D,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACzB,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEJ,MAAM,QAAQ,GAAG,CAAC,MAAM,sBAAU,CAAC,IAAI,CACtC,IAAI,EACJ,SAAS,EACT,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,EAAE,OAAO,EAAE,QAAQ,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,CAE5C,CAAQ,CAAC;IAEV,OAAO,EAAE,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import * as create from './create.operation';
|
|
3
|
+
import * as get from './get.operation';
|
|
4
|
+
import * as get_history from './get_history.operation';
|
|
5
|
+
import * as get_metadata from './get_metadata.operation';
|
|
6
|
+
import * as get_metadata_suggestions from './get_metadata_suggestions.operation';
|
|
7
|
+
import * as get_preview from './get_preview.operation';
|
|
8
|
+
import * as get_sharelink from './get_sharelink.operation';
|
|
9
|
+
import * as list from './list.operation';
|
|
10
|
+
import * as remove from './remove.operation';
|
|
11
|
+
import * as update from './update.operation';
|
|
12
|
+
export { create, get, get_history, get_metadata, get_metadata_suggestions, get_preview, get_sharelink, list, remove, update, };
|
|
13
|
+
export declare const description: INodeProperties[];
|
|
@@ -0,0 +1,131 @@
|
|
|
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.update = exports.remove = exports.list = exports.get_sharelink = exports.get_preview = exports.get_metadata_suggestions = exports.get_metadata = exports.get_history = exports.get = exports.create = void 0;
|
|
37
|
+
const create = __importStar(require("./create.operation"));
|
|
38
|
+
exports.create = create;
|
|
39
|
+
const get = __importStar(require("./get.operation"));
|
|
40
|
+
exports.get = get;
|
|
41
|
+
const get_history = __importStar(require("./get_history.operation"));
|
|
42
|
+
exports.get_history = get_history;
|
|
43
|
+
const get_metadata = __importStar(require("./get_metadata.operation"));
|
|
44
|
+
exports.get_metadata = get_metadata;
|
|
45
|
+
const get_metadata_suggestions = __importStar(require("./get_metadata_suggestions.operation"));
|
|
46
|
+
exports.get_metadata_suggestions = get_metadata_suggestions;
|
|
47
|
+
const get_preview = __importStar(require("./get_preview.operation"));
|
|
48
|
+
exports.get_preview = get_preview;
|
|
49
|
+
const get_sharelink = __importStar(require("./get_sharelink.operation"));
|
|
50
|
+
exports.get_sharelink = get_sharelink;
|
|
51
|
+
const list = __importStar(require("./list.operation"));
|
|
52
|
+
exports.list = list;
|
|
53
|
+
const remove = __importStar(require("./remove.operation"));
|
|
54
|
+
exports.remove = remove;
|
|
55
|
+
const update = __importStar(require("./update.operation"));
|
|
56
|
+
exports.update = update;
|
|
57
|
+
exports.description = [
|
|
58
|
+
{
|
|
59
|
+
displayName: 'Operation',
|
|
60
|
+
name: 'operation',
|
|
61
|
+
default: 'list',
|
|
62
|
+
displayOptions: {
|
|
63
|
+
show: { resource: ['document'] },
|
|
64
|
+
},
|
|
65
|
+
noDataExpression: true,
|
|
66
|
+
options: [
|
|
67
|
+
{
|
|
68
|
+
name: 'Create a Document',
|
|
69
|
+
value: 'create',
|
|
70
|
+
action: 'Create a new document',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'Delete a Document',
|
|
74
|
+
value: 'remove',
|
|
75
|
+
action: 'Delete a document',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'Get a Document',
|
|
79
|
+
value: 'get',
|
|
80
|
+
action: 'Get a document',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'Get some Metadata Suggestions',
|
|
84
|
+
value: 'get_metadata_suggestions',
|
|
85
|
+
action: 'Get some metadata suggestions for a document',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'Get the Document History',
|
|
89
|
+
value: 'get_history',
|
|
90
|
+
action: 'Get the list of changes made to a document',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'Get the Document Metadata',
|
|
94
|
+
value: 'get_metadata',
|
|
95
|
+
action: 'Get the metadata of the document',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'Get the Document Preview',
|
|
99
|
+
value: 'get_preview',
|
|
100
|
+
action: 'Get a preview of the document',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'Get the Document Share Link',
|
|
104
|
+
value: 'get_sharelink',
|
|
105
|
+
action: 'Get the share link of the document',
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'List Documents',
|
|
109
|
+
value: 'list',
|
|
110
|
+
action: 'List all documents',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'Update a Document',
|
|
114
|
+
value: 'update',
|
|
115
|
+
action: 'Update a document',
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
type: 'options',
|
|
119
|
+
},
|
|
120
|
+
...create.description,
|
|
121
|
+
...get.description,
|
|
122
|
+
...get_history.description,
|
|
123
|
+
...get_metadata.description,
|
|
124
|
+
...get_metadata_suggestions.description,
|
|
125
|
+
...get_preview.description,
|
|
126
|
+
...get_sharelink.description,
|
|
127
|
+
...list.description,
|
|
128
|
+
...remove.description,
|
|
129
|
+
...update.description,
|
|
130
|
+
];
|
|
131
|
+
//# sourceMappingURL=document.resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.resource.js","sourceRoot":"","sources":["../../../../../../nodes/Paperless/v2/actions/document/document.resource.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,2DAA6C;AAY5C,wBAAM;AAXP,qDAAuC;AAYtC,kBAAG;AAXJ,qEAAuD;AAYtD,kCAAW;AAXZ,uEAAyD;AAYxD,oCAAY;AAXb,+FAAiF;AAYhF,4DAAwB;AAXzB,qEAAuD;AAYtD,kCAAW;AAXZ,yEAA2D;AAY1D,sCAAa;AAXd,uDAAyC;AAYxC,oB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ACf;IACD,GAAG,MAAM,CAAC,WAAW;IACrB,GAAG,GAAG,CAAC,WAAW;IAClB,GAAG,WAAW,CAAC,WAAW;IAC1B,GAAG,YAAY,CAAC,WAAW;IAC3B,GAAG,wBAAwB,CAAC,WAAW;IACvC,GAAG,WAAW,CAAC,WAAW;IAC1B,GAAG,aAAa,CAAC,WAAW;IAC5B,GAAG,IAAI,CAAC,WAAW;IACnB,GAAG,MAAM,CAAC,WAAW;IACrB,GAAG,MAAM,CAAC,WAAW;CACrB,CAAC"}
|
|
@@ -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: ['get'],
|
|
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
|
+
const response = (await transport_1.apiRequest.call(this, itemIndex, 'GET', endpoint));
|
|
75
|
+
return { json: { results: [response] } };
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=get.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Paperless/v2/actions/document/get.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,EAA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