@klardaten/n8n-nodes-datevconnect 1.0.2 → 1.0.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/README.md +7 -10
- package/dist/credentials/DatevConnectApi.credentials.js +68 -95
- package/dist/nodes/Accounting/Accounting.config.js +1373 -0
- package/dist/nodes/Accounting/Accounting.node.js +180 -5153
- package/dist/nodes/Accounting/handlers/AccountPostingResourceHandler.js +40 -0
- package/dist/nodes/Accounting/handlers/AccountingSequenceResourceHandler.js +72 -0
- package/dist/nodes/Accounting/handlers/AccountingStatisticsResourceHandler.js +38 -0
- package/dist/nodes/Accounting/handlers/AccountingSumsAndBalancesResourceHandler.js +52 -0
- package/dist/nodes/Accounting/handlers/AccountingTransactionKeysResourceHandler.js +53 -0
- package/dist/nodes/Accounting/handlers/AccountsPayableResourceHandler.js +67 -0
- package/dist/nodes/Accounting/handlers/AccountsReceivableResourceHandler.js +48 -0
- package/dist/nodes/Accounting/handlers/BaseResourceHandler.js +148 -0
- package/dist/nodes/Accounting/handlers/BusinessPartnersResourceHandler.js +207 -0
- package/dist/nodes/Accounting/handlers/ClientResourceHandler.js +52 -0
- package/dist/nodes/Accounting/handlers/CostCenterPropertiesResourceHandler.js +55 -0
- package/dist/nodes/Accounting/handlers/CostCentersUnitsResourceHandler.js +55 -0
- package/dist/nodes/Accounting/handlers/CostSequencesResourceHandler.js +88 -0
- package/dist/nodes/Accounting/handlers/CostSystemsResourceHandler.js +62 -0
- package/dist/nodes/Accounting/handlers/FiscalYearResourceHandler.js +49 -0
- package/dist/nodes/Accounting/handlers/GeneralLedgerAccountsResourceHandler.js +67 -0
- package/dist/nodes/Accounting/handlers/InternalCostServicesResourceHandler.js +40 -0
- package/dist/nodes/Accounting/handlers/PostingProposalsResourceHandler.js +98 -0
- package/dist/nodes/Accounting/handlers/StocktakingDataResourceHandler.js +57 -0
- package/dist/nodes/Accounting/handlers/TermsOfPaymentResourceHandler.js +69 -0
- package/dist/nodes/Accounting/handlers/VariousAddressesResourceHandler.js +56 -0
- package/dist/nodes/Accounting/handlers/index.js +45 -0
- package/dist/nodes/Accounting/types.js +5 -0
- package/dist/nodes/DocumentManagement/DocumentManagement.config.js +598 -0
- package/dist/nodes/DocumentManagement/DocumentManagement.node.js +96 -3513
- package/dist/nodes/DocumentManagement/handlers/BaseResourceHandler.js +121 -0
- package/dist/nodes/DocumentManagement/handlers/DocumentFileResourceHandler.js +126 -0
- package/dist/nodes/DocumentManagement/handlers/DocumentResourceHandler.js +184 -0
- package/dist/nodes/DocumentManagement/handlers/DocumentStateResourceHandler.js +58 -0
- package/dist/nodes/DocumentManagement/handlers/DomainResourceHandler.js +32 -0
- package/dist/nodes/DocumentManagement/handlers/IndividualPropertyResourceHandler.js +32 -0
- package/dist/nodes/DocumentManagement/handlers/IndividualReference1ResourceHandler.js +49 -0
- package/dist/nodes/DocumentManagement/handlers/IndividualReference2ResourceHandler.js +49 -0
- package/dist/nodes/DocumentManagement/handlers/InfoResourceHandler.js +30 -0
- package/dist/nodes/DocumentManagement/handlers/PropertyTemplateResourceHandler.js +34 -0
- package/dist/nodes/DocumentManagement/handlers/SecureAreaResourceHandler.js +32 -0
- package/dist/nodes/DocumentManagement/types.js +2 -0
- package/dist/nodes/DocumentManagement/utils.js +116 -0
- package/dist/nodes/IdentityAndAccessManagement/IdentityAndAccessManagement.config.js +368 -0
- package/dist/nodes/IdentityAndAccessManagement/IdentityAndAccessManagement.node.js +77 -2774
- package/dist/nodes/IdentityAndAccessManagement/handlers/BaseResourceHandler.js +87 -0
- package/dist/nodes/IdentityAndAccessManagement/handlers/CurrentUserResourceHandler.js +17 -0
- package/dist/nodes/IdentityAndAccessManagement/handlers/GroupResourceHandler.js +63 -0
- package/dist/nodes/IdentityAndAccessManagement/handlers/ResourceTypeResourceHandler.js +17 -0
- package/dist/nodes/IdentityAndAccessManagement/handlers/SchemaResourceHandler.js +30 -0
- package/dist/nodes/IdentityAndAccessManagement/handlers/ServiceProviderConfigResourceHandler.js +17 -0
- package/dist/nodes/IdentityAndAccessManagement/handlers/UserResourceHandler.js +73 -0
- package/dist/nodes/IdentityAndAccessManagement/types.js +2 -0
- package/dist/nodes/IdentityAndAccessManagement/utils.js +89 -0
- package/dist/nodes/MasterData/MasterData.config.js +902 -0
- package/dist/nodes/MasterData/MasterData.node.js +107 -3561
- package/dist/nodes/MasterData/handlers/AddresseeResourceHandler.js +98 -0
- package/dist/nodes/MasterData/handlers/AreaOfResponsibilityResourceHandler.js +42 -0
- package/dist/nodes/MasterData/handlers/BankResourceHandler.js +42 -0
- package/dist/nodes/MasterData/handlers/BaseResourceHandler.js +91 -0
- package/dist/nodes/MasterData/handlers/ClientCategoryTypeResourceHandler.js +78 -0
- package/dist/nodes/MasterData/handlers/ClientGroupTypeResourceHandler.js +78 -0
- package/dist/nodes/MasterData/handlers/ClientResourceHandler.js +183 -0
- package/dist/nodes/MasterData/handlers/CorporateStructureResourceHandler.js +68 -0
- package/dist/nodes/MasterData/handlers/CountryCodeResourceHandler.js +42 -0
- package/dist/nodes/MasterData/handlers/EmployeeResourceHandler.js +78 -0
- package/dist/nodes/MasterData/handlers/LegalFormResourceHandler.js +42 -0
- package/dist/nodes/MasterData/handlers/RelationshipResourceHandler.js +54 -0
- package/dist/nodes/MasterData/handlers/TaxAuthorityResourceHandler.js +42 -0
- package/dist/nodes/MasterData/types.js +2 -0
- package/dist/nodes/MasterData/utils.js +92 -0
- package/dist/src/services/accountingClient.js +766 -0
- package/dist/src/services/datevConnectClient.js +1809 -0
- package/dist/src/services/documentManagementClient.js +546 -0
- package/dist/src/services/identityAndAccessManagementClient.js +293 -0
- package/package.json +38 -39
- package/dist/nodes/Accounting/Accounting.node.json +0 -25
- package/dist/nodes/DocumentManagement/DocumentManagement.node.json +0 -25
- package/dist/nodes/IdentityAndAccessManagement/IdentityAndAccessManagement.node.json +0 -25
- package/dist/nodes/MasterData/MasterData.node.json +0 -25
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
/**
|
|
7
|
+
* Abstract base class for resource handlers
|
|
8
|
+
* Provides common functionality for authentication, parameter parsing, and response handling
|
|
9
|
+
*/
|
|
10
|
+
class BaseResourceHandler {
|
|
11
|
+
constructor(context, itemIndex) {
|
|
12
|
+
this.context = context;
|
|
13
|
+
this.itemIndex = itemIndex;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Main execution method that handles operation routing and error handling
|
|
17
|
+
*/
|
|
18
|
+
async execute(operation, authContext, returnData) {
|
|
19
|
+
try {
|
|
20
|
+
const sendSuccess = (payload) => {
|
|
21
|
+
const data = payload ? (0, utils_1.normaliseToObjects)(payload) : [{}];
|
|
22
|
+
data.forEach((item) => {
|
|
23
|
+
returnData.push({
|
|
24
|
+
json: {
|
|
25
|
+
success: true,
|
|
26
|
+
...item,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
await this.executeOperation(operation, authContext, sendSuccess);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
const continueOnFail = this.context.continueOnFail();
|
|
35
|
+
if (continueOnFail) {
|
|
36
|
+
returnData.push({
|
|
37
|
+
json: {
|
|
38
|
+
error: (0, utils_1.toErrorMessage)(error),
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
if (error instanceof n8n_workflow_1.NodeApiError || error instanceof n8n_workflow_1.NodeOperationError) {
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
throw new n8n_workflow_1.NodeApiError(this.context.getNode(), (0, utils_1.toErrorObject)(error), {
|
|
47
|
+
itemIndex: this.itemIndex,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Gets DATEVconnect credentials and validates them
|
|
54
|
+
*/
|
|
55
|
+
async getCredentials() {
|
|
56
|
+
const credentials = (await this.context.getCredentials("datevConnectApi"));
|
|
57
|
+
if (!credentials) {
|
|
58
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), "DATEVconnect credentials are missing");
|
|
59
|
+
}
|
|
60
|
+
const { host, email, password, clientInstanceId } = credentials;
|
|
61
|
+
if (!host || !email || !password || !clientInstanceId) {
|
|
62
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), "All DATEVconnect credential fields must be provided");
|
|
63
|
+
}
|
|
64
|
+
return credentials;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Creates an authentication context with token
|
|
68
|
+
*/
|
|
69
|
+
createAuthContext(credentials, token) {
|
|
70
|
+
return {
|
|
71
|
+
host: credentials.host,
|
|
72
|
+
token,
|
|
73
|
+
clientInstanceId: credentials.clientInstanceId,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Gets an optional string parameter
|
|
78
|
+
*/
|
|
79
|
+
getOptionalString(name) {
|
|
80
|
+
return (0, utils_1.getOptionalString)(this.context, name, this.itemIndex);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Gets a required string parameter
|
|
84
|
+
*/
|
|
85
|
+
getRequiredString(name) {
|
|
86
|
+
return (0, utils_1.getRequiredString)(this.context, name, this.itemIndex);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Gets a number parameter with default value
|
|
90
|
+
*/
|
|
91
|
+
getNumberParameter(name, defaultValue) {
|
|
92
|
+
return (0, utils_1.getNumberParameter)(this.context, name, this.itemIndex, defaultValue);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Parses a JSON parameter
|
|
96
|
+
*/
|
|
97
|
+
parseJsonParameter(rawValue, parameterLabel) {
|
|
98
|
+
return (0, utils_1.parseJsonParameter)(rawValue, parameterLabel, this.context, this.itemIndex);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Gets required JSON data from parameter
|
|
102
|
+
*/
|
|
103
|
+
getRequiredJsonData(name) {
|
|
104
|
+
return (0, utils_1.getRequiredJsonData)(this.context, name, this.itemIndex);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Builds query parameters from optional values
|
|
108
|
+
*/
|
|
109
|
+
buildQueryParams(params) {
|
|
110
|
+
return (0, utils_1.buildQueryParams)(params);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Validates that request context has required authentication
|
|
114
|
+
*/
|
|
115
|
+
validateRequestContext(authContext) {
|
|
116
|
+
if (!authContext.host || !authContext.token || !authContext.clientInstanceId) {
|
|
117
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), "Authentication context is incomplete");
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.BaseResourceHandler = BaseResourceHandler;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentFileResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const documentManagementClient_1 = require("../../../src/services/documentManagementClient");
|
|
6
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
/**
|
|
9
|
+
* Handler for document file operations
|
|
10
|
+
*
|
|
11
|
+
* IMPORTANT: This handler deals with binary file transfers that require special headers:
|
|
12
|
+
* - GET /document-files/{file-id}: Returns application/octet-stream binary data
|
|
13
|
+
* - POST /document-files: Accepts application/octet-stream binary data
|
|
14
|
+
*
|
|
15
|
+
* The DATEV Document Management API uses octet-stream for all file operations
|
|
16
|
+
* as specified in the document management-2.3.1.yaml specification.
|
|
17
|
+
*/
|
|
18
|
+
class DocumentFileResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
19
|
+
executeOperation() {
|
|
20
|
+
throw new Error("Method not implemented.");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Override execute method to handle binary data for document file operations
|
|
24
|
+
*/
|
|
25
|
+
async execute(operation, authContext, returnData) {
|
|
26
|
+
try {
|
|
27
|
+
this.validateRequestContext(authContext);
|
|
28
|
+
switch (operation) {
|
|
29
|
+
case "get":
|
|
30
|
+
await this.getDocumentFileBinary(authContext, returnData);
|
|
31
|
+
break;
|
|
32
|
+
case "upload":
|
|
33
|
+
{
|
|
34
|
+
// Use the standard base handler for upload operations
|
|
35
|
+
const sendSuccess = (payload) => {
|
|
36
|
+
const data = payload ? (0, utils_1.normaliseToObjects)(payload) : [{}];
|
|
37
|
+
data.forEach((item) => {
|
|
38
|
+
returnData.push({
|
|
39
|
+
json: {
|
|
40
|
+
success: true,
|
|
41
|
+
...item,
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
await this.uploadDocumentFile(authContext, sendSuccess);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
default:
|
|
50
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `The operation "${operation}" is not supported for document files`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
const continueOnFail = this.context.continueOnFail();
|
|
55
|
+
if (continueOnFail) {
|
|
56
|
+
returnData.push({
|
|
57
|
+
json: {
|
|
58
|
+
error: (0, utils_1.toErrorMessage)(error),
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
if (error instanceof Error) {
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), String(error), {
|
|
67
|
+
itemIndex: this.itemIndex,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Get document file and return it as binary data
|
|
74
|
+
*/
|
|
75
|
+
async getDocumentFileBinary(authContext, returnData) {
|
|
76
|
+
const documentFileId = this.getRequiredString("documentFileId");
|
|
77
|
+
const response = await documentManagementClient_1.DocumentManagementClient.fetchDocumentFile({
|
|
78
|
+
host: authContext.host,
|
|
79
|
+
token: authContext.token,
|
|
80
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
81
|
+
fileId: documentFileId,
|
|
82
|
+
});
|
|
83
|
+
// Handle binary response - return as actual binary data
|
|
84
|
+
const binaryData = await response.arrayBuffer();
|
|
85
|
+
const contentType = response.headers.get('content-type') || 'application/octet-stream';
|
|
86
|
+
// Create binary data object for n8n
|
|
87
|
+
const binaryDataObject = {
|
|
88
|
+
data: Buffer.from(binaryData).toString('base64'),
|
|
89
|
+
mimeType: contentType,
|
|
90
|
+
fileName: documentFileId, // Use the file ID as filename
|
|
91
|
+
fileSize: binaryData.byteLength.toString(),
|
|
92
|
+
};
|
|
93
|
+
// Add execution data with binary content
|
|
94
|
+
returnData.push({
|
|
95
|
+
json: {
|
|
96
|
+
success: true,
|
|
97
|
+
id: documentFileId,
|
|
98
|
+
contentType,
|
|
99
|
+
size: binaryData.byteLength,
|
|
100
|
+
},
|
|
101
|
+
binary: {
|
|
102
|
+
data: binaryDataObject,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
async uploadDocumentFile(authContext, sendSuccess) {
|
|
107
|
+
var _a;
|
|
108
|
+
// Get binary data from the input data
|
|
109
|
+
const inputData = this.context.getInputData();
|
|
110
|
+
const currentItem = inputData[this.itemIndex];
|
|
111
|
+
if (!((_a = currentItem === null || currentItem === void 0 ? void 0 : currentItem.binary) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
112
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), "No binary data found. Please provide binary data through the 'data' binary property.", { itemIndex: this.itemIndex });
|
|
113
|
+
}
|
|
114
|
+
// Get from binary property
|
|
115
|
+
const binaryDataObj = currentItem.binary.data;
|
|
116
|
+
const bufferData = Buffer.from(binaryDataObj.data, 'base64');
|
|
117
|
+
const response = await documentManagementClient_1.DocumentManagementClient.uploadDocumentFile({
|
|
118
|
+
host: authContext.host,
|
|
119
|
+
token: authContext.token,
|
|
120
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
121
|
+
binaryData: bufferData,
|
|
122
|
+
});
|
|
123
|
+
sendSuccess(response);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
exports.DocumentFileResourceHandler = DocumentFileResourceHandler;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const documentManagementClient_1 = require("../../../src/services/documentManagementClient");
|
|
6
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
7
|
+
/**
|
|
8
|
+
* Handler for document operations
|
|
9
|
+
*/
|
|
10
|
+
class DocumentResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
11
|
+
async executeOperation(operation, authContext, sendSuccess) {
|
|
12
|
+
this.validateRequestContext(authContext);
|
|
13
|
+
switch (operation) {
|
|
14
|
+
case "getAll":
|
|
15
|
+
await this.getDocuments(authContext, sendSuccess);
|
|
16
|
+
break;
|
|
17
|
+
case "get":
|
|
18
|
+
await this.getDocument(authContext, sendSuccess);
|
|
19
|
+
break;
|
|
20
|
+
case "create":
|
|
21
|
+
await this.createDocument(authContext, sendSuccess);
|
|
22
|
+
break;
|
|
23
|
+
case "update":
|
|
24
|
+
await this.updateDocument(authContext, sendSuccess);
|
|
25
|
+
break;
|
|
26
|
+
case "delete":
|
|
27
|
+
await this.deleteDocument(authContext, sendSuccess);
|
|
28
|
+
break;
|
|
29
|
+
case "deletePermanently":
|
|
30
|
+
await this.deleteDocumentPermanently(authContext, sendSuccess);
|
|
31
|
+
break;
|
|
32
|
+
case "getStructureItems":
|
|
33
|
+
await this.getStructureItems(authContext, sendSuccess);
|
|
34
|
+
break;
|
|
35
|
+
case "addStructureItem":
|
|
36
|
+
await this.addStructureItem(authContext, sendSuccess);
|
|
37
|
+
break;
|
|
38
|
+
case "getStructureItem":
|
|
39
|
+
await this.getStructureItem(authContext, sendSuccess);
|
|
40
|
+
break;
|
|
41
|
+
case "updateStructureItem":
|
|
42
|
+
await this.updateStructureItem(authContext, sendSuccess);
|
|
43
|
+
break;
|
|
44
|
+
case "createDispatcherInformation":
|
|
45
|
+
await this.createDispatcherInformation(authContext, sendSuccess);
|
|
46
|
+
break;
|
|
47
|
+
default:
|
|
48
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `The operation "${operation}" is not supported for documents`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async getDocuments(authContext, sendSuccess) {
|
|
52
|
+
const filter = this.getOptionalString("filter");
|
|
53
|
+
const top = this.getNumberParameter("top", 0);
|
|
54
|
+
const skip = this.getNumberParameter("skip", 0);
|
|
55
|
+
const response = await documentManagementClient_1.DocumentManagementClient.fetchDocuments({
|
|
56
|
+
host: authContext.host,
|
|
57
|
+
token: authContext.token,
|
|
58
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
59
|
+
filter,
|
|
60
|
+
top: top || undefined,
|
|
61
|
+
skip: skip || undefined,
|
|
62
|
+
});
|
|
63
|
+
sendSuccess(response);
|
|
64
|
+
}
|
|
65
|
+
async getDocument(authContext, sendSuccess) {
|
|
66
|
+
const documentId = this.getRequiredString("documentId");
|
|
67
|
+
const response = await documentManagementClient_1.DocumentManagementClient.fetchDocument({
|
|
68
|
+
host: authContext.host,
|
|
69
|
+
token: authContext.token,
|
|
70
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
71
|
+
documentId,
|
|
72
|
+
});
|
|
73
|
+
sendSuccess(response);
|
|
74
|
+
}
|
|
75
|
+
async createDocument(authContext, sendSuccess) {
|
|
76
|
+
const documentData = this.getRequiredJsonData("documentData");
|
|
77
|
+
const response = await documentManagementClient_1.DocumentManagementClient.createDocument({
|
|
78
|
+
host: authContext.host,
|
|
79
|
+
token: authContext.token,
|
|
80
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
81
|
+
document: documentData,
|
|
82
|
+
});
|
|
83
|
+
sendSuccess(response);
|
|
84
|
+
}
|
|
85
|
+
async updateDocument(authContext, sendSuccess) {
|
|
86
|
+
const documentId = this.getRequiredString("documentId");
|
|
87
|
+
const documentData = this.getRequiredJsonData("documentData");
|
|
88
|
+
const response = await documentManagementClient_1.DocumentManagementClient.updateDocument({
|
|
89
|
+
host: authContext.host,
|
|
90
|
+
token: authContext.token,
|
|
91
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
92
|
+
documentId,
|
|
93
|
+
document: documentData,
|
|
94
|
+
});
|
|
95
|
+
sendSuccess(response);
|
|
96
|
+
}
|
|
97
|
+
async deleteDocument(authContext, sendSuccess) {
|
|
98
|
+
const documentId = this.getRequiredString("documentId");
|
|
99
|
+
await documentManagementClient_1.DocumentManagementClient.deleteDocument({
|
|
100
|
+
host: authContext.host,
|
|
101
|
+
token: authContext.token,
|
|
102
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
103
|
+
documentId,
|
|
104
|
+
});
|
|
105
|
+
sendSuccess({ success: true, documentId, deleted: true });
|
|
106
|
+
}
|
|
107
|
+
async deleteDocumentPermanently(authContext, sendSuccess) {
|
|
108
|
+
const documentId = this.getRequiredString("documentId");
|
|
109
|
+
await documentManagementClient_1.DocumentManagementClient.deleteDocumentPermanently({
|
|
110
|
+
host: authContext.host,
|
|
111
|
+
token: authContext.token,
|
|
112
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
113
|
+
documentId,
|
|
114
|
+
});
|
|
115
|
+
sendSuccess({ success: true, documentId, permanentlyDeleted: true });
|
|
116
|
+
}
|
|
117
|
+
async getStructureItems(authContext, sendSuccess) {
|
|
118
|
+
const documentId = this.getRequiredString("documentId");
|
|
119
|
+
const top = this.getNumberParameter("top", 0);
|
|
120
|
+
const skip = this.getNumberParameter("skip", 0);
|
|
121
|
+
const response = await documentManagementClient_1.DocumentManagementClient.fetchStructureItems({
|
|
122
|
+
host: authContext.host,
|
|
123
|
+
token: authContext.token,
|
|
124
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
125
|
+
documentId,
|
|
126
|
+
top: top || undefined,
|
|
127
|
+
skip: skip || undefined,
|
|
128
|
+
});
|
|
129
|
+
sendSuccess(response);
|
|
130
|
+
}
|
|
131
|
+
async addStructureItem(authContext, sendSuccess) {
|
|
132
|
+
const documentId = this.getRequiredString("documentId");
|
|
133
|
+
const structureItemData = this.getRequiredJsonData("structureItemData");
|
|
134
|
+
const insertPosition = this.getOptionalString("insertPosition") || "last";
|
|
135
|
+
const response = await documentManagementClient_1.DocumentManagementClient.addStructureItem({
|
|
136
|
+
host: authContext.host,
|
|
137
|
+
token: authContext.token,
|
|
138
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
139
|
+
documentId,
|
|
140
|
+
structureItem: structureItemData,
|
|
141
|
+
insertPosition,
|
|
142
|
+
});
|
|
143
|
+
sendSuccess(response);
|
|
144
|
+
}
|
|
145
|
+
async getStructureItem(authContext, sendSuccess) {
|
|
146
|
+
const documentId = this.getRequiredString("documentId");
|
|
147
|
+
const structureItemId = this.getRequiredString("structureItemId");
|
|
148
|
+
const response = await documentManagementClient_1.DocumentManagementClient.fetchStructureItem({
|
|
149
|
+
host: authContext.host,
|
|
150
|
+
token: authContext.token,
|
|
151
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
152
|
+
documentId,
|
|
153
|
+
structureItemId,
|
|
154
|
+
});
|
|
155
|
+
sendSuccess(response);
|
|
156
|
+
}
|
|
157
|
+
async updateStructureItem(authContext, sendSuccess) {
|
|
158
|
+
const documentId = this.getRequiredString("documentId");
|
|
159
|
+
const structureItemId = this.getRequiredString("structureItemId");
|
|
160
|
+
const structureItemData = this.getRequiredJsonData("structureItemData");
|
|
161
|
+
const response = await documentManagementClient_1.DocumentManagementClient.updateStructureItem({
|
|
162
|
+
host: authContext.host,
|
|
163
|
+
token: authContext.token,
|
|
164
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
165
|
+
documentId,
|
|
166
|
+
structureItemId,
|
|
167
|
+
structureItem: structureItemData,
|
|
168
|
+
});
|
|
169
|
+
sendSuccess(response);
|
|
170
|
+
}
|
|
171
|
+
async createDispatcherInformation(authContext, sendSuccess) {
|
|
172
|
+
const documentId = this.getRequiredString("documentId");
|
|
173
|
+
const dispatcherData = this.getRequiredJsonData("dispatcherData");
|
|
174
|
+
const response = await documentManagementClient_1.DocumentManagementClient.createDispatcherInformation({
|
|
175
|
+
host: authContext.host,
|
|
176
|
+
token: authContext.token,
|
|
177
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
178
|
+
documentId,
|
|
179
|
+
dispatcherInformation: dispatcherData,
|
|
180
|
+
});
|
|
181
|
+
sendSuccess(response);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
exports.DocumentResourceHandler = DocumentResourceHandler;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentStateResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const documentManagementClient_1 = require("../../../src/services/documentManagementClient");
|
|
6
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
7
|
+
/**
|
|
8
|
+
* Handler for document state operations
|
|
9
|
+
*/
|
|
10
|
+
class DocumentStateResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
11
|
+
async executeOperation(operation, authContext, sendSuccess) {
|
|
12
|
+
this.validateRequestContext(authContext);
|
|
13
|
+
switch (operation) {
|
|
14
|
+
case "getAll":
|
|
15
|
+
await this.getDocumentStates(authContext, sendSuccess);
|
|
16
|
+
break;
|
|
17
|
+
case "get":
|
|
18
|
+
await this.getDocumentState(authContext, sendSuccess);
|
|
19
|
+
break;
|
|
20
|
+
case "create":
|
|
21
|
+
await this.createDocumentState(authContext, sendSuccess);
|
|
22
|
+
break;
|
|
23
|
+
default:
|
|
24
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `The operation "${operation}" is not supported for document states`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async getDocumentStates(authContext, sendSuccess) {
|
|
28
|
+
const filter = this.getOptionalString("filter");
|
|
29
|
+
const response = await documentManagementClient_1.DocumentManagementClient.fetchDocumentStates({
|
|
30
|
+
host: authContext.host,
|
|
31
|
+
token: authContext.token,
|
|
32
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
33
|
+
filter,
|
|
34
|
+
});
|
|
35
|
+
sendSuccess(response);
|
|
36
|
+
}
|
|
37
|
+
async getDocumentState(authContext, sendSuccess) {
|
|
38
|
+
const stateId = this.getRequiredString("stateId");
|
|
39
|
+
const response = await documentManagementClient_1.DocumentManagementClient.fetchDocumentState({
|
|
40
|
+
host: authContext.host,
|
|
41
|
+
token: authContext.token,
|
|
42
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
43
|
+
stateId,
|
|
44
|
+
});
|
|
45
|
+
sendSuccess(response);
|
|
46
|
+
}
|
|
47
|
+
async createDocumentState(authContext, sendSuccess) {
|
|
48
|
+
const stateData = this.getRequiredJsonData("stateData");
|
|
49
|
+
const response = await documentManagementClient_1.DocumentManagementClient.createDocumentState({
|
|
50
|
+
host: authContext.host,
|
|
51
|
+
token: authContext.token,
|
|
52
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
53
|
+
state: stateData,
|
|
54
|
+
});
|
|
55
|
+
sendSuccess(response);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.DocumentStateResourceHandler = DocumentStateResourceHandler;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DomainResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const documentManagementClient_1 = require("../../../src/services/documentManagementClient");
|
|
6
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
7
|
+
/**
|
|
8
|
+
* Handler for domain operations
|
|
9
|
+
*/
|
|
10
|
+
class DomainResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
11
|
+
async executeOperation(operation, authContext, sendSuccess) {
|
|
12
|
+
this.validateRequestContext(authContext);
|
|
13
|
+
switch (operation) {
|
|
14
|
+
case "getAll":
|
|
15
|
+
await this.getDomains(authContext, sendSuccess);
|
|
16
|
+
break;
|
|
17
|
+
default:
|
|
18
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `The operation "${operation}" is not supported for domains`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async getDomains(authContext, sendSuccess) {
|
|
22
|
+
const filter = this.getOptionalString("filter");
|
|
23
|
+
const response = await documentManagementClient_1.DocumentManagementClient.fetchDomains({
|
|
24
|
+
host: authContext.host,
|
|
25
|
+
token: authContext.token,
|
|
26
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
27
|
+
filter,
|
|
28
|
+
});
|
|
29
|
+
sendSuccess(response);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.DomainResourceHandler = DomainResourceHandler;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IndividualPropertyResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const documentManagementClient_1 = require("../../../src/services/documentManagementClient");
|
|
6
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
7
|
+
/**
|
|
8
|
+
* Handler for individual property operations
|
|
9
|
+
*/
|
|
10
|
+
class IndividualPropertyResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
11
|
+
async executeOperation(operation, authContext, sendSuccess) {
|
|
12
|
+
this.validateRequestContext(authContext);
|
|
13
|
+
switch (operation) {
|
|
14
|
+
case 'getAll':
|
|
15
|
+
await this.getIndividualProperties(authContext, sendSuccess);
|
|
16
|
+
break;
|
|
17
|
+
default:
|
|
18
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `Unsupported operation: ${operation}`, {
|
|
19
|
+
itemIndex: this.itemIndex,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async getIndividualProperties(authContext, sendSuccess) {
|
|
24
|
+
const response = await documentManagementClient_1.DocumentManagementClient.fetchIndividualProperties({
|
|
25
|
+
host: authContext.host,
|
|
26
|
+
token: authContext.token,
|
|
27
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
28
|
+
});
|
|
29
|
+
sendSuccess(response);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.IndividualPropertyResourceHandler = IndividualPropertyResourceHandler;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IndividualReference1ResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const documentManagementClient_1 = require("../../../src/services/documentManagementClient");
|
|
6
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
7
|
+
/**
|
|
8
|
+
* Handler for individual references 1 operations
|
|
9
|
+
*/
|
|
10
|
+
class IndividualReference1ResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
11
|
+
async executeOperation(operation, authContext, sendSuccess) {
|
|
12
|
+
this.validateRequestContext(authContext);
|
|
13
|
+
switch (operation) {
|
|
14
|
+
case 'getAll':
|
|
15
|
+
await this.getIndividualReferences1(authContext, sendSuccess);
|
|
16
|
+
break;
|
|
17
|
+
case 'create':
|
|
18
|
+
await this.createIndividualReference1(authContext, sendSuccess);
|
|
19
|
+
break;
|
|
20
|
+
default:
|
|
21
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `Unsupported operation: ${operation}`, {
|
|
22
|
+
itemIndex: this.itemIndex,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async getIndividualReferences1(authContext, sendSuccess) {
|
|
27
|
+
const top = this.getNumberParameter('top', 0);
|
|
28
|
+
const skip = this.getNumberParameter('skip', 0);
|
|
29
|
+
const response = await documentManagementClient_1.DocumentManagementClient.fetchIndividualReferences1({
|
|
30
|
+
host: authContext.host,
|
|
31
|
+
token: authContext.token,
|
|
32
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
33
|
+
top: top || undefined,
|
|
34
|
+
skip: skip || undefined,
|
|
35
|
+
});
|
|
36
|
+
sendSuccess(response);
|
|
37
|
+
}
|
|
38
|
+
async createIndividualReference1(authContext, sendSuccess) {
|
|
39
|
+
const individualReferenceData = this.getRequiredJsonData('individualReferenceData');
|
|
40
|
+
const response = await documentManagementClient_1.DocumentManagementClient.createIndividualReference1({
|
|
41
|
+
host: authContext.host,
|
|
42
|
+
token: authContext.token,
|
|
43
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
44
|
+
individualReference: individualReferenceData,
|
|
45
|
+
});
|
|
46
|
+
sendSuccess(response);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.IndividualReference1ResourceHandler = IndividualReference1ResourceHandler;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IndividualReference2ResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const documentManagementClient_1 = require("../../../src/services/documentManagementClient");
|
|
6
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
7
|
+
/**
|
|
8
|
+
* Handler for individual references 2 operations
|
|
9
|
+
*/
|
|
10
|
+
class IndividualReference2ResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
11
|
+
async executeOperation(operation, authContext, sendSuccess) {
|
|
12
|
+
this.validateRequestContext(authContext);
|
|
13
|
+
switch (operation) {
|
|
14
|
+
case 'getAll':
|
|
15
|
+
await this.getIndividualReferences2(authContext, sendSuccess);
|
|
16
|
+
break;
|
|
17
|
+
case 'create':
|
|
18
|
+
await this.createIndividualReference2(authContext, sendSuccess);
|
|
19
|
+
break;
|
|
20
|
+
default:
|
|
21
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `Unsupported operation: ${operation}`, {
|
|
22
|
+
itemIndex: this.itemIndex,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async getIndividualReferences2(authContext, sendSuccess) {
|
|
27
|
+
const top = this.getNumberParameter('top', 0);
|
|
28
|
+
const skip = this.getNumberParameter('skip', 0);
|
|
29
|
+
const response = await documentManagementClient_1.DocumentManagementClient.fetchIndividualReferences2({
|
|
30
|
+
host: authContext.host,
|
|
31
|
+
token: authContext.token,
|
|
32
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
33
|
+
top: top || undefined,
|
|
34
|
+
skip: skip || undefined,
|
|
35
|
+
});
|
|
36
|
+
sendSuccess(response);
|
|
37
|
+
}
|
|
38
|
+
async createIndividualReference2(authContext, sendSuccess) {
|
|
39
|
+
const individualReferenceData = this.getRequiredJsonData('individualReferenceData');
|
|
40
|
+
const response = await documentManagementClient_1.DocumentManagementClient.createIndividualReference2({
|
|
41
|
+
host: authContext.host,
|
|
42
|
+
token: authContext.token,
|
|
43
|
+
clientInstanceId: authContext.clientInstanceId,
|
|
44
|
+
individualReference: individualReferenceData,
|
|
45
|
+
});
|
|
46
|
+
sendSuccess(response);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.IndividualReference2ResourceHandler = IndividualReference2ResourceHandler;
|