@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,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BusinessPartnersResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
6
|
+
const accountingClient_1 = require("../../../src/services/accountingClient");
|
|
7
|
+
/**
|
|
8
|
+
* Handler for Business Partners operations
|
|
9
|
+
* Manages operations related to debitors (customers) and creditors (suppliers)
|
|
10
|
+
*/
|
|
11
|
+
class BusinessPartnersResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
12
|
+
constructor(context, itemIndex) {
|
|
13
|
+
super(context, itemIndex);
|
|
14
|
+
}
|
|
15
|
+
validateRequiredParameters(requestContext) {
|
|
16
|
+
if (!requestContext.clientId || !requestContext.fiscalYearId) {
|
|
17
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), 'Client ID and Fiscal Year ID are required for business partner operations', {
|
|
18
|
+
itemIndex: this.itemIndex,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async execute(operation, requestContext, returnData) {
|
|
23
|
+
switch (operation) {
|
|
24
|
+
case "getDebitors":
|
|
25
|
+
await this.handleGetDebitors(requestContext, returnData);
|
|
26
|
+
break;
|
|
27
|
+
case "getDebitor":
|
|
28
|
+
await this.handleGetDebitor(requestContext, returnData);
|
|
29
|
+
break;
|
|
30
|
+
case "createDebitor":
|
|
31
|
+
await this.handleCreateDebitor(requestContext, returnData);
|
|
32
|
+
break;
|
|
33
|
+
case "updateDebitor":
|
|
34
|
+
await this.handleUpdateDebitor(requestContext, returnData);
|
|
35
|
+
break;
|
|
36
|
+
case "getNextAvailableDebitor":
|
|
37
|
+
await this.handleGetNextAvailableDebitor(requestContext, returnData);
|
|
38
|
+
break;
|
|
39
|
+
case "getCreditors":
|
|
40
|
+
await this.handleGetCreditors(requestContext, returnData);
|
|
41
|
+
break;
|
|
42
|
+
case "getCreditor":
|
|
43
|
+
await this.handleGetCreditor(requestContext, returnData);
|
|
44
|
+
break;
|
|
45
|
+
case "createCreditor":
|
|
46
|
+
await this.handleCreateCreditor(requestContext, returnData);
|
|
47
|
+
break;
|
|
48
|
+
case "updateCreditor":
|
|
49
|
+
await this.handleUpdateCreditor(requestContext, returnData);
|
|
50
|
+
break;
|
|
51
|
+
case "getNextAvailableCreditor":
|
|
52
|
+
await this.handleGetNextAvailableCreditor(requestContext, returnData);
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `Unknown operation: ${operation}`, {
|
|
56
|
+
itemIndex: this.itemIndex,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// New handle methods for the converted pattern
|
|
61
|
+
async handleGetDebitors(requestContext, returnData) {
|
|
62
|
+
this.validateRequiredParameters(requestContext);
|
|
63
|
+
try {
|
|
64
|
+
if (!requestContext.clientId || !requestContext.fiscalYearId) {
|
|
65
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), 'Client ID and Fiscal Year ID are required for this operation', {
|
|
66
|
+
itemIndex: this.itemIndex,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const queryParams = this.buildQueryParams();
|
|
70
|
+
const debitors = await accountingClient_1.datevConnectClient.accounting.getDebitors(this.context, requestContext.clientId, requestContext.fiscalYearId, queryParams);
|
|
71
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
72
|
+
sendSuccess(debitors);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
this.handleError(error, returnData);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
async handleGetDebitor(requestContext, returnData) {
|
|
79
|
+
this.validateRequiredParameters(requestContext);
|
|
80
|
+
try {
|
|
81
|
+
const id = this.context.getNodeParameter("debitorId", this.itemIndex);
|
|
82
|
+
const queryParams = this.buildQueryParams();
|
|
83
|
+
const debitor = await accountingClient_1.datevConnectClient.accounting.getDebitor(this.context, requestContext.clientId, requestContext.fiscalYearId, id, queryParams);
|
|
84
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
85
|
+
sendSuccess(debitor);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
this.handleError(error, returnData);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async handleCreateDebitor(requestContext, returnData) {
|
|
92
|
+
this.validateRequiredParameters(requestContext);
|
|
93
|
+
try {
|
|
94
|
+
const debitorDataRaw = this.context.getNodeParameter("debitorData", this.itemIndex);
|
|
95
|
+
const debitorData = this.parseJsonParameter(debitorDataRaw, "debitorData");
|
|
96
|
+
if (debitorData === undefined) {
|
|
97
|
+
throw new Error("debitorData is required for creating debitor");
|
|
98
|
+
}
|
|
99
|
+
const result = await accountingClient_1.datevConnectClient.accounting.createDebitor(this.context, requestContext.clientId, requestContext.fiscalYearId, debitorData);
|
|
100
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
101
|
+
sendSuccess(result);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
this.handleError(error, returnData);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async handleUpdateDebitor(requestContext, returnData) {
|
|
108
|
+
this.validateRequiredParameters(requestContext);
|
|
109
|
+
try {
|
|
110
|
+
const debitorId = this.getRequiredString("debitorId");
|
|
111
|
+
const debitorDataRaw = this.context.getNodeParameter("debitorData", this.itemIndex);
|
|
112
|
+
const debitorData = this.parseJsonParameter(debitorDataRaw, "debitorData");
|
|
113
|
+
if (debitorData === undefined) {
|
|
114
|
+
throw new Error("debitorData is required for updating debitor");
|
|
115
|
+
}
|
|
116
|
+
const result = await accountingClient_1.datevConnectClient.accounting.updateDebitor(this.context, requestContext.clientId, requestContext.fiscalYearId, debitorId, debitorData);
|
|
117
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
118
|
+
sendSuccess(result);
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
this.handleError(error, returnData);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async handleGetNextAvailableDebitor(requestContext, returnData) {
|
|
125
|
+
this.validateRequiredParameters(requestContext);
|
|
126
|
+
try {
|
|
127
|
+
const queryParams = this.buildQueryParams();
|
|
128
|
+
const nextAvailable = await accountingClient_1.datevConnectClient.accounting.getNextAvailableDebitor(this.context, requestContext.clientId, requestContext.fiscalYearId, queryParams);
|
|
129
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
130
|
+
sendSuccess(nextAvailable);
|
|
131
|
+
}
|
|
132
|
+
catch (error) {
|
|
133
|
+
this.handleError(error, returnData);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
async handleGetCreditors(requestContext, returnData) {
|
|
137
|
+
this.validateRequiredParameters(requestContext);
|
|
138
|
+
try {
|
|
139
|
+
const queryParams = this.buildQueryParams();
|
|
140
|
+
const creditors = await accountingClient_1.datevConnectClient.accounting.getCreditors(this.context, requestContext.clientId, requestContext.fiscalYearId, queryParams);
|
|
141
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
142
|
+
sendSuccess(creditors);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
this.handleError(error, returnData);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async handleGetCreditor(requestContext, returnData) {
|
|
149
|
+
this.validateRequiredParameters(requestContext);
|
|
150
|
+
try {
|
|
151
|
+
const creditorId = this.getRequiredString("creditorId");
|
|
152
|
+
const queryParams = this.buildQueryParams();
|
|
153
|
+
const creditor = await accountingClient_1.datevConnectClient.accounting.getCreditor(this.context, requestContext.clientId, requestContext.fiscalYearId, creditorId, queryParams);
|
|
154
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
155
|
+
sendSuccess(creditor);
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
this.handleError(error, returnData);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
async handleCreateCreditor(requestContext, returnData) {
|
|
162
|
+
this.validateRequiredParameters(requestContext);
|
|
163
|
+
try {
|
|
164
|
+
const creditorDataRaw = this.context.getNodeParameter("creditorData", this.itemIndex);
|
|
165
|
+
const creditorData = this.parseJsonParameter(creditorDataRaw, "creditorData");
|
|
166
|
+
if (creditorData === undefined) {
|
|
167
|
+
throw new Error("creditorData is required for creating creditor");
|
|
168
|
+
}
|
|
169
|
+
const result = await accountingClient_1.datevConnectClient.accounting.createCreditor(this.context, requestContext.clientId, requestContext.fiscalYearId, creditorData);
|
|
170
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
171
|
+
sendSuccess(result);
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
this.handleError(error, returnData);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
async handleUpdateCreditor(requestContext, returnData) {
|
|
178
|
+
this.validateRequiredParameters(requestContext);
|
|
179
|
+
try {
|
|
180
|
+
const creditorId = this.getRequiredString("creditorId");
|
|
181
|
+
const creditorDataRaw = this.context.getNodeParameter("creditorData", this.itemIndex);
|
|
182
|
+
const creditorData = this.parseJsonParameter(creditorDataRaw, "creditorData");
|
|
183
|
+
if (creditorData === undefined) {
|
|
184
|
+
throw new Error("creditorData is required for updating creditor");
|
|
185
|
+
}
|
|
186
|
+
const result = await accountingClient_1.datevConnectClient.accounting.updateCreditor(this.context, requestContext.clientId, requestContext.fiscalYearId, creditorId, creditorData);
|
|
187
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
188
|
+
sendSuccess(result);
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
this.handleError(error, returnData);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
async handleGetNextAvailableCreditor(requestContext, returnData) {
|
|
195
|
+
this.validateRequiredParameters(requestContext);
|
|
196
|
+
try {
|
|
197
|
+
const queryParams = this.buildQueryParams();
|
|
198
|
+
const nextAvailable = await accountingClient_1.datevConnectClient.accounting.getNextAvailableCreditor(this.context, requestContext.clientId, requestContext.fiscalYearId, queryParams);
|
|
199
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
200
|
+
sendSuccess(nextAvailable);
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
this.handleError(error, returnData);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
exports.BusinessPartnersResourceHandler = BusinessPartnersResourceHandler;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const accountingClient_1 = require("../../../src/services/accountingClient");
|
|
6
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
7
|
+
/**
|
|
8
|
+
* Handler for all accounting client-related operations
|
|
9
|
+
*/
|
|
10
|
+
class ClientResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
11
|
+
async execute(operation, requestContext, returnData) {
|
|
12
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
13
|
+
try {
|
|
14
|
+
let response;
|
|
15
|
+
switch (operation) {
|
|
16
|
+
case "getAll":
|
|
17
|
+
response = await this.handleGetAll();
|
|
18
|
+
break;
|
|
19
|
+
case "get":
|
|
20
|
+
response = await this.handleGet(requestContext);
|
|
21
|
+
break;
|
|
22
|
+
default:
|
|
23
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `The operation "${operation}" is not supported for resource "client".`, { itemIndex: this.itemIndex });
|
|
24
|
+
}
|
|
25
|
+
sendSuccess(response);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
this.handleError(error, returnData);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async handleGetAll() {
|
|
32
|
+
const top = this.getNumberParameter("top", 100);
|
|
33
|
+
const skip = this.getNumberParameter("skip", 0);
|
|
34
|
+
const select = this.getOptionalString("select");
|
|
35
|
+
const filter = this.getOptionalString("filter");
|
|
36
|
+
return await accountingClient_1.datevConnectClient.accounting.getClients(this.context, {
|
|
37
|
+
top,
|
|
38
|
+
skip,
|
|
39
|
+
select,
|
|
40
|
+
filter,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
async handleGet(requestContext) {
|
|
44
|
+
const clientId = this.getRequiredString("clientId");
|
|
45
|
+
const select = this.getOptionalString("select");
|
|
46
|
+
return await accountingClient_1.datevConnectClient.accounting.getClient(this.context, clientId, {
|
|
47
|
+
...requestContext,
|
|
48
|
+
select: select,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.ClientResourceHandler = ClientResourceHandler;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CostCenterPropertiesResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
6
|
+
const accountingClient_1 = require("../../../src/services/accountingClient");
|
|
7
|
+
/**
|
|
8
|
+
* Handler for Cost Center Properties operations
|
|
9
|
+
* Manages operations related to cost center property management
|
|
10
|
+
*/
|
|
11
|
+
class CostCenterPropertiesResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
12
|
+
constructor(context, itemIndex) {
|
|
13
|
+
super(context, itemIndex);
|
|
14
|
+
}
|
|
15
|
+
async execute(operation, requestContext, returnData) {
|
|
16
|
+
switch (operation) {
|
|
17
|
+
case "getAll":
|
|
18
|
+
await this.handleGetAll(requestContext, returnData);
|
|
19
|
+
break;
|
|
20
|
+
case "get":
|
|
21
|
+
await this.handleGet(requestContext, returnData);
|
|
22
|
+
break;
|
|
23
|
+
default:
|
|
24
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `Unknown operation: ${operation}`, {
|
|
25
|
+
itemIndex: this.itemIndex,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async handleGetAll(requestContext, returnData) {
|
|
30
|
+
try {
|
|
31
|
+
const costSystemId = this.getRequiredString("costSystemId");
|
|
32
|
+
const queryParams = this.buildQueryParams();
|
|
33
|
+
const costCenterProperties = await accountingClient_1.datevConnectClient.accounting.getCostCenterProperties(this.context, requestContext.clientId, requestContext.fiscalYearId, costSystemId, queryParams);
|
|
34
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
35
|
+
sendSuccess(costCenterProperties);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
this.handleError(error, returnData);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async handleGet(requestContext, returnData) {
|
|
42
|
+
try {
|
|
43
|
+
const costSystemId = this.getRequiredString("costSystemId");
|
|
44
|
+
const costCenterPropertyId = this.getRequiredString("costCenterPropertyId");
|
|
45
|
+
const queryParams = this.buildQueryParams();
|
|
46
|
+
const costCenterProperty = await accountingClient_1.datevConnectClient.accounting.getCostCenterProperty(this.context, requestContext.clientId, requestContext.fiscalYearId, costSystemId, costCenterPropertyId, queryParams);
|
|
47
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
48
|
+
sendSuccess(costCenterProperty);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
this.handleError(error, returnData);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.CostCenterPropertiesResourceHandler = CostCenterPropertiesResourceHandler;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CostCentersUnitsResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
6
|
+
const accountingClient_1 = require("../../../src/services/accountingClient");
|
|
7
|
+
/**
|
|
8
|
+
* Handler for Cost Centers/Units operations
|
|
9
|
+
* Manages operations related to cost center and cost unit management
|
|
10
|
+
*/
|
|
11
|
+
class CostCentersUnitsResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
12
|
+
constructor(context, itemIndex) {
|
|
13
|
+
super(context, itemIndex);
|
|
14
|
+
}
|
|
15
|
+
async execute(operation, requestContext, returnData) {
|
|
16
|
+
switch (operation) {
|
|
17
|
+
case "getAll":
|
|
18
|
+
await this.handleGetAll(requestContext, returnData);
|
|
19
|
+
break;
|
|
20
|
+
case "get":
|
|
21
|
+
await this.handleGet(requestContext, returnData);
|
|
22
|
+
break;
|
|
23
|
+
default:
|
|
24
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `Unknown operation: ${operation}`, {
|
|
25
|
+
itemIndex: this.itemIndex,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async handleGetAll(requestContext, returnData) {
|
|
30
|
+
try {
|
|
31
|
+
const costSystemId = this.getRequiredString("costSystemId");
|
|
32
|
+
const queryParams = this.buildQueryParams();
|
|
33
|
+
const costCenters = await accountingClient_1.datevConnectClient.accounting.getCostCenters(this.context, requestContext.clientId, requestContext.fiscalYearId, costSystemId, queryParams);
|
|
34
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
35
|
+
sendSuccess(costCenters);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
this.handleError(error, returnData);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async handleGet(requestContext, returnData) {
|
|
42
|
+
try {
|
|
43
|
+
const costSystemId = this.getRequiredString("costSystemId");
|
|
44
|
+
const costCenterId = this.getRequiredString("costCenterId");
|
|
45
|
+
const queryParams = this.buildQueryParams();
|
|
46
|
+
const costCenter = await accountingClient_1.datevConnectClient.accounting.getCostCenter(this.context, requestContext.clientId, requestContext.fiscalYearId, costSystemId, costCenterId, queryParams);
|
|
47
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
48
|
+
sendSuccess(costCenter);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
this.handleError(error, returnData);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.CostCentersUnitsResourceHandler = CostCentersUnitsResourceHandler;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CostSequencesResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
6
|
+
const accountingClient_1 = require("../../../src/services/accountingClient");
|
|
7
|
+
/**
|
|
8
|
+
* Handler for Cost Sequences operations
|
|
9
|
+
* Manages operations related to cost accounting sequences
|
|
10
|
+
*/
|
|
11
|
+
class CostSequencesResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
12
|
+
constructor(context, itemIndex) {
|
|
13
|
+
super(context, itemIndex);
|
|
14
|
+
}
|
|
15
|
+
async execute(operation, requestContext, returnData) {
|
|
16
|
+
switch (operation) {
|
|
17
|
+
case "getAll":
|
|
18
|
+
await this.handleGetAll(requestContext, returnData);
|
|
19
|
+
break;
|
|
20
|
+
case "get":
|
|
21
|
+
await this.handleGet(requestContext, returnData);
|
|
22
|
+
break;
|
|
23
|
+
case "create":
|
|
24
|
+
await this.handleCreate(requestContext, returnData);
|
|
25
|
+
break;
|
|
26
|
+
case "getCostAccountingRecords":
|
|
27
|
+
await this.handleGetCostAccountingRecords(requestContext, returnData);
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `Unknown operation: ${operation}`, {
|
|
31
|
+
itemIndex: this.itemIndex,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async handleGetAll(requestContext, returnData) {
|
|
36
|
+
try {
|
|
37
|
+
const costSystemId = this.getRequiredString("costSystemId");
|
|
38
|
+
const queryParams = this.buildQueryParams();
|
|
39
|
+
const costSequences = await accountingClient_1.datevConnectClient.accounting.getCostSequences(this.context, requestContext.clientId, requestContext.fiscalYearId, costSystemId, queryParams);
|
|
40
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
41
|
+
sendSuccess(costSequences);
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
this.handleError(error, returnData);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async handleGet(requestContext, returnData) {
|
|
48
|
+
try {
|
|
49
|
+
const costSystemId = this.getRequiredString("costSystemId");
|
|
50
|
+
const costSequenceId = this.getRequiredString("costSequenceId");
|
|
51
|
+
const queryParams = this.buildQueryParams();
|
|
52
|
+
const costSequence = await accountingClient_1.datevConnectClient.accounting.getCostSequence(this.context, requestContext.clientId, requestContext.fiscalYearId, costSystemId, costSequenceId, queryParams);
|
|
53
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
54
|
+
sendSuccess(costSequence);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
this.handleError(error, returnData);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async handleCreate(requestContext, returnData) {
|
|
61
|
+
try {
|
|
62
|
+
const costSystemId = this.getRequiredString("costSystemId");
|
|
63
|
+
const costSequenceId = this.getRequiredString("costSequenceId");
|
|
64
|
+
const costSequenceDataRaw = this.context.getNodeParameter("costSequenceData", this.itemIndex);
|
|
65
|
+
const costSequenceData = this.parseJsonParameter(costSequenceDataRaw, "costSequenceData");
|
|
66
|
+
const result = await accountingClient_1.datevConnectClient.accounting.createCostSequence(this.context, requestContext.clientId, requestContext.fiscalYearId, costSystemId, costSequenceId, costSequenceData);
|
|
67
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
68
|
+
sendSuccess(result);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
this.handleError(error, returnData);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async handleGetCostAccountingRecords(requestContext, returnData) {
|
|
75
|
+
try {
|
|
76
|
+
const costSystemId = this.getRequiredString("costSystemId");
|
|
77
|
+
const costSequenceId = this.getRequiredString("costSequenceId");
|
|
78
|
+
const queryParams = this.buildQueryParams();
|
|
79
|
+
const costAccountingRecords = await accountingClient_1.datevConnectClient.accounting.getCostAccountingRecords(this.context, requestContext.clientId, requestContext.fiscalYearId, costSystemId, costSequenceId, queryParams);
|
|
80
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
81
|
+
sendSuccess(costAccountingRecords);
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
this.handleError(error, returnData);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.CostSequencesResourceHandler = CostSequencesResourceHandler;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CostSystemsResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
6
|
+
const accountingClient_1 = require("../../../src/services/accountingClient");
|
|
7
|
+
/**
|
|
8
|
+
* Handler for Cost Systems operations
|
|
9
|
+
* Manages operations related to cost accounting system configurations
|
|
10
|
+
*/
|
|
11
|
+
class CostSystemsResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
12
|
+
constructor(context, itemIndex) {
|
|
13
|
+
super(context, itemIndex);
|
|
14
|
+
}
|
|
15
|
+
async execute(operation, requestContext, returnData) {
|
|
16
|
+
switch (operation) {
|
|
17
|
+
case "getAll":
|
|
18
|
+
await this.handleGetAll(requestContext, returnData);
|
|
19
|
+
break;
|
|
20
|
+
case "get":
|
|
21
|
+
await this.handleGet(requestContext, returnData);
|
|
22
|
+
break;
|
|
23
|
+
default:
|
|
24
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `Unknown operation: ${operation}`, {
|
|
25
|
+
itemIndex: this.itemIndex,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async handleGetAll(requestContext, returnData) {
|
|
30
|
+
try {
|
|
31
|
+
this.validateRequiredParameters(requestContext);
|
|
32
|
+
const queryParams = this.buildQueryParams();
|
|
33
|
+
const costSystems = await accountingClient_1.datevConnectClient.accounting.getCostSystems(this.context, requestContext.clientId, requestContext.fiscalYearId, queryParams);
|
|
34
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
35
|
+
sendSuccess(costSystems);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
this.handleError(error, returnData);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async handleGet(requestContext, returnData) {
|
|
42
|
+
try {
|
|
43
|
+
this.validateRequiredParameters(requestContext);
|
|
44
|
+
const costSystemId = this.getRequiredString("costSystemId");
|
|
45
|
+
const queryParams = this.buildQueryParams();
|
|
46
|
+
const costSystem = await accountingClient_1.datevConnectClient.accounting.getCostSystem(this.context, requestContext.clientId, requestContext.fiscalYearId, costSystemId, queryParams);
|
|
47
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
48
|
+
sendSuccess(costSystem);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
this.handleError(error, returnData);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
validateRequiredParameters(requestContext) {
|
|
55
|
+
if (!requestContext.clientId || !requestContext.fiscalYearId) {
|
|
56
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), "Client ID and Fiscal Year ID are required for this operation", {
|
|
57
|
+
itemIndex: this.itemIndex,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.CostSystemsResourceHandler = CostSystemsResourceHandler;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FiscalYearResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const accountingClient_1 = require("../../../src/services/accountingClient");
|
|
6
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
7
|
+
class FiscalYearResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
8
|
+
async execute(operation, requestContext, returnData) {
|
|
9
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
10
|
+
try {
|
|
11
|
+
let response;
|
|
12
|
+
switch (operation) {
|
|
13
|
+
case "getAll":
|
|
14
|
+
response = await this.handleGetAll(requestContext);
|
|
15
|
+
break;
|
|
16
|
+
case "get":
|
|
17
|
+
response = await this.handleGet(requestContext);
|
|
18
|
+
break;
|
|
19
|
+
default:
|
|
20
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `The operation "${operation}" is not supported for resource "fiscalYear".`, { itemIndex: this.itemIndex });
|
|
21
|
+
}
|
|
22
|
+
sendSuccess(response);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
this.handleError(error, returnData);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async handleGetAll(requestContext) {
|
|
29
|
+
if (!requestContext.clientId) {
|
|
30
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), 'Client ID is required for this operation', {
|
|
31
|
+
itemIndex: this.itemIndex,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const queryParams = this.buildQueryParams();
|
|
35
|
+
const result = await accountingClient_1.datevConnectClient.accounting.getFiscalYears(this.context, requestContext.clientId, queryParams);
|
|
36
|
+
return result !== null && result !== void 0 ? result : null;
|
|
37
|
+
}
|
|
38
|
+
async handleGet(requestContext) {
|
|
39
|
+
if (!requestContext.clientId || !requestContext.fiscalYearId) {
|
|
40
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), 'Client ID and Fiscal Year ID are required for this operation', {
|
|
41
|
+
itemIndex: this.itemIndex,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const queryParams = this.buildQueryParams();
|
|
45
|
+
const result = await accountingClient_1.datevConnectClient.accounting.getFiscalYear(this.context, requestContext.clientId, requestContext.fiscalYearId, queryParams);
|
|
46
|
+
return result !== null && result !== void 0 ? result : null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.FiscalYearResourceHandler = FiscalYearResourceHandler;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GeneralLedgerAccountsResourceHandler = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const BaseResourceHandler_1 = require("./BaseResourceHandler");
|
|
6
|
+
const accountingClient_1 = require("../../../src/services/accountingClient");
|
|
7
|
+
/**
|
|
8
|
+
* Handler for General Ledger Accounts operations
|
|
9
|
+
* Manages operations related to chart of accounts
|
|
10
|
+
*/
|
|
11
|
+
class GeneralLedgerAccountsResourceHandler extends BaseResourceHandler_1.BaseResourceHandler {
|
|
12
|
+
constructor(context, itemIndex) {
|
|
13
|
+
super(context, itemIndex);
|
|
14
|
+
}
|
|
15
|
+
async execute(operation, requestContext, returnData) {
|
|
16
|
+
switch (operation) {
|
|
17
|
+
case "getAll":
|
|
18
|
+
await this.handleGetAll(requestContext, returnData);
|
|
19
|
+
break;
|
|
20
|
+
case "get":
|
|
21
|
+
await this.handleGet(requestContext, returnData);
|
|
22
|
+
break;
|
|
23
|
+
case "getUtilized":
|
|
24
|
+
await this.handleGetUtilized(requestContext, returnData);
|
|
25
|
+
break;
|
|
26
|
+
default:
|
|
27
|
+
throw new n8n_workflow_1.NodeOperationError(this.context.getNode(), `Unknown operation: ${operation}`, {
|
|
28
|
+
itemIndex: this.itemIndex,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async handleGetAll(requestContext, returnData) {
|
|
33
|
+
try {
|
|
34
|
+
const queryParams = this.buildQueryParams();
|
|
35
|
+
const accounts = await accountingClient_1.datevConnectClient.accounting.getGeneralLedgerAccounts(this.context, requestContext.clientId, requestContext.fiscalYearId, queryParams);
|
|
36
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
37
|
+
sendSuccess(accounts);
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
this.handleError(error, returnData);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async handleGet(requestContext, returnData) {
|
|
44
|
+
try {
|
|
45
|
+
const generalLedgerAccountId = this.getRequiredString("generalLedgerAccountId");
|
|
46
|
+
const queryParams = this.buildQueryParams();
|
|
47
|
+
const account = await accountingClient_1.datevConnectClient.accounting.getGeneralLedgerAccount(this.context, requestContext.clientId, requestContext.fiscalYearId, generalLedgerAccountId, queryParams);
|
|
48
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
49
|
+
sendSuccess(account);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
this.handleError(error, returnData);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async handleGetUtilized(requestContext, returnData) {
|
|
56
|
+
try {
|
|
57
|
+
const queryParams = this.buildQueryParams();
|
|
58
|
+
const accounts = await accountingClient_1.datevConnectClient.accounting.getUtilizedGeneralLedgerAccounts(this.context, requestContext.clientId, requestContext.fiscalYearId, queryParams);
|
|
59
|
+
const sendSuccess = this.createSendSuccess(returnData);
|
|
60
|
+
sendSuccess(accounts);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
this.handleError(error, returnData);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.GeneralLedgerAccountsResourceHandler = GeneralLedgerAccountsResourceHandler;
|