@klardaten/n8n-nodes-datevconnect 1.0.1 → 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.
Files changed (79) hide show
  1. package/README.md +7 -10
  2. package/dist/credentials/DatevConnectApi.credentials.js +68 -95
  3. package/dist/nodes/Accounting/Accounting.config.js +1373 -0
  4. package/dist/nodes/Accounting/Accounting.node.js +180 -5153
  5. package/dist/nodes/Accounting/handlers/AccountPostingResourceHandler.js +40 -0
  6. package/dist/nodes/Accounting/handlers/AccountingSequenceResourceHandler.js +72 -0
  7. package/dist/nodes/Accounting/handlers/AccountingStatisticsResourceHandler.js +38 -0
  8. package/dist/nodes/Accounting/handlers/AccountingSumsAndBalancesResourceHandler.js +52 -0
  9. package/dist/nodes/Accounting/handlers/AccountingTransactionKeysResourceHandler.js +53 -0
  10. package/dist/nodes/Accounting/handlers/AccountsPayableResourceHandler.js +67 -0
  11. package/dist/nodes/Accounting/handlers/AccountsReceivableResourceHandler.js +48 -0
  12. package/dist/nodes/Accounting/handlers/BaseResourceHandler.js +148 -0
  13. package/dist/nodes/Accounting/handlers/BusinessPartnersResourceHandler.js +207 -0
  14. package/dist/nodes/Accounting/handlers/ClientResourceHandler.js +52 -0
  15. package/dist/nodes/Accounting/handlers/CostCenterPropertiesResourceHandler.js +55 -0
  16. package/dist/nodes/Accounting/handlers/CostCentersUnitsResourceHandler.js +55 -0
  17. package/dist/nodes/Accounting/handlers/CostSequencesResourceHandler.js +88 -0
  18. package/dist/nodes/Accounting/handlers/CostSystemsResourceHandler.js +62 -0
  19. package/dist/nodes/Accounting/handlers/FiscalYearResourceHandler.js +49 -0
  20. package/dist/nodes/Accounting/handlers/GeneralLedgerAccountsResourceHandler.js +67 -0
  21. package/dist/nodes/Accounting/handlers/InternalCostServicesResourceHandler.js +40 -0
  22. package/dist/nodes/Accounting/handlers/PostingProposalsResourceHandler.js +98 -0
  23. package/dist/nodes/Accounting/handlers/StocktakingDataResourceHandler.js +57 -0
  24. package/dist/nodes/Accounting/handlers/TermsOfPaymentResourceHandler.js +69 -0
  25. package/dist/nodes/Accounting/handlers/VariousAddressesResourceHandler.js +56 -0
  26. package/dist/nodes/Accounting/handlers/index.js +45 -0
  27. package/dist/nodes/Accounting/types.js +5 -0
  28. package/dist/nodes/DocumentManagement/DocumentManagement.config.js +598 -0
  29. package/dist/nodes/DocumentManagement/DocumentManagement.node.js +96 -3513
  30. package/dist/nodes/DocumentManagement/handlers/BaseResourceHandler.js +121 -0
  31. package/dist/nodes/DocumentManagement/handlers/DocumentFileResourceHandler.js +126 -0
  32. package/dist/nodes/DocumentManagement/handlers/DocumentResourceHandler.js +184 -0
  33. package/dist/nodes/DocumentManagement/handlers/DocumentStateResourceHandler.js +58 -0
  34. package/dist/nodes/DocumentManagement/handlers/DomainResourceHandler.js +32 -0
  35. package/dist/nodes/DocumentManagement/handlers/IndividualPropertyResourceHandler.js +32 -0
  36. package/dist/nodes/DocumentManagement/handlers/IndividualReference1ResourceHandler.js +49 -0
  37. package/dist/nodes/DocumentManagement/handlers/IndividualReference2ResourceHandler.js +49 -0
  38. package/dist/nodes/DocumentManagement/handlers/InfoResourceHandler.js +30 -0
  39. package/dist/nodes/DocumentManagement/handlers/PropertyTemplateResourceHandler.js +34 -0
  40. package/dist/nodes/DocumentManagement/handlers/SecureAreaResourceHandler.js +32 -0
  41. package/dist/nodes/DocumentManagement/types.js +2 -0
  42. package/dist/nodes/DocumentManagement/utils.js +116 -0
  43. package/dist/nodes/IdentityAndAccessManagement/IdentityAndAccessManagement.config.js +368 -0
  44. package/dist/nodes/IdentityAndAccessManagement/IdentityAndAccessManagement.node.js +77 -2774
  45. package/dist/nodes/IdentityAndAccessManagement/handlers/BaseResourceHandler.js +87 -0
  46. package/dist/nodes/IdentityAndAccessManagement/handlers/CurrentUserResourceHandler.js +17 -0
  47. package/dist/nodes/IdentityAndAccessManagement/handlers/GroupResourceHandler.js +63 -0
  48. package/dist/nodes/IdentityAndAccessManagement/handlers/ResourceTypeResourceHandler.js +17 -0
  49. package/dist/nodes/IdentityAndAccessManagement/handlers/SchemaResourceHandler.js +30 -0
  50. package/dist/nodes/IdentityAndAccessManagement/handlers/ServiceProviderConfigResourceHandler.js +17 -0
  51. package/dist/nodes/IdentityAndAccessManagement/handlers/UserResourceHandler.js +73 -0
  52. package/dist/nodes/IdentityAndAccessManagement/types.js +2 -0
  53. package/dist/nodes/IdentityAndAccessManagement/utils.js +89 -0
  54. package/dist/nodes/MasterData/MasterData.config.js +902 -0
  55. package/dist/nodes/MasterData/MasterData.node.js +107 -3561
  56. package/dist/nodes/MasterData/handlers/AddresseeResourceHandler.js +98 -0
  57. package/dist/nodes/MasterData/handlers/AreaOfResponsibilityResourceHandler.js +42 -0
  58. package/dist/nodes/MasterData/handlers/BankResourceHandler.js +42 -0
  59. package/dist/nodes/MasterData/handlers/BaseResourceHandler.js +91 -0
  60. package/dist/nodes/MasterData/handlers/ClientCategoryTypeResourceHandler.js +78 -0
  61. package/dist/nodes/MasterData/handlers/ClientGroupTypeResourceHandler.js +78 -0
  62. package/dist/nodes/MasterData/handlers/ClientResourceHandler.js +183 -0
  63. package/dist/nodes/MasterData/handlers/CorporateStructureResourceHandler.js +68 -0
  64. package/dist/nodes/MasterData/handlers/CountryCodeResourceHandler.js +42 -0
  65. package/dist/nodes/MasterData/handlers/EmployeeResourceHandler.js +78 -0
  66. package/dist/nodes/MasterData/handlers/LegalFormResourceHandler.js +42 -0
  67. package/dist/nodes/MasterData/handlers/RelationshipResourceHandler.js +54 -0
  68. package/dist/nodes/MasterData/handlers/TaxAuthorityResourceHandler.js +42 -0
  69. package/dist/nodes/MasterData/types.js +2 -0
  70. package/dist/nodes/MasterData/utils.js +92 -0
  71. package/dist/src/services/accountingClient.js +766 -0
  72. package/dist/src/services/datevConnectClient.js +1809 -0
  73. package/dist/src/services/documentManagementClient.js +546 -0
  74. package/dist/src/services/identityAndAccessManagementClient.js +293 -0
  75. package/package.json +38 -39
  76. package/dist/nodes/Accounting/Accounting.node.json +0 -25
  77. package/dist/nodes/DocumentManagement/DocumentManagement.node.json +0 -25
  78. package/dist/nodes/IdentityAndAccessManagement/IdentityAndAccessManagement.node.json +0 -25
  79. package/dist/nodes/MasterData/MasterData.node.json +0 -25
@@ -1,3517 +1,100 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropNames = Object.getOwnPropertyNames;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __moduleCache = /* @__PURE__ */ new WeakMap;
6
- var __toCommonJS = (from) => {
7
- var entry = __moduleCache.get(from), desc;
8
- if (entry)
9
- return entry;
10
- entry = __defProp({}, "__esModule", { value: true });
11
- if (from && typeof from === "object" || typeof from === "function")
12
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
13
- get: () => from[key],
14
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
- }));
16
- __moduleCache.set(from, entry);
17
- return entry;
18
- };
19
- var __export = (target, all) => {
20
- for (var name in all)
21
- __defProp(target, name, {
22
- get: all[name],
23
- enumerable: true,
24
- configurable: true,
25
- set: (newValue) => all[name] = () => newValue
26
- });
27
- };
28
-
29
- // nodes/DocumentManagement/DocumentManagement.node.ts
30
- var exports_DocumentManagement_node = {};
31
- __export(exports_DocumentManagement_node, {
32
- DocumentManagement: () => DocumentManagement
33
- });
34
- module.exports = __toCommonJS(exports_DocumentManagement_node);
35
- var import_n8n_workflow12 = require("n8n-workflow");
36
-
37
- // src/services/datevConnectClient.ts
38
- var JSON_CONTENT_TYPE = "application/json";
39
- var DEFAULT_ERROR_PREFIX = "DATEVconnect request failed";
40
- function normaliseBaseUrl(host) {
41
- if (!host) {
42
- throw new Error("DATEVconnect host must be provided");
43
- }
44
- return host.endsWith("/") ? host : `${host}/`;
45
- }
46
- function buildHeaders(headers) {
47
- return Object.entries(headers).reduce((acc, [key, value]) => {
48
- if (value) {
49
- acc[key] = value;
50
- }
51
- return acc;
52
- }, {});
53
- }
54
- async function readResponseBody(response) {
55
- const contentType = response.headers.get("content-type") ?? "";
56
- if (contentType.toLowerCase().includes(JSON_CONTENT_TYPE)) {
57
- try {
58
- return await response.json();
59
- } catch {
60
- return;
61
- }
62
- }
63
- try {
64
- const text = await response.text();
65
- return text.length > 0 ? text : undefined;
66
- } catch {
67
- return;
68
- }
69
- }
70
- function extractErrorMessage(response, body) {
71
- const statusPart = `${response.status}${response.statusText ? ` ${response.statusText}` : ""}`.trim();
72
- const prefix = `${DEFAULT_ERROR_PREFIX}${statusPart ? ` (${statusPart})` : ""}`;
73
- if (typeof body === "string" && body.trim().length > 0) {
74
- return `${prefix}: ${body.trim()}`;
75
- }
76
- if (body && typeof body === "object") {
77
- const errorDescription = "error_description" in body && typeof body.error_description === "string" ? body.error_description : undefined;
78
- const message = ("message" in body && typeof body.message === "string" ? body.message : undefined) || ("error" in body && typeof body.error === "string" ? body.error : undefined);
79
- if (message) {
80
- return `${prefix}: ${message}${errorDescription ? `: ${errorDescription}` : ""}`;
81
- }
82
- }
83
- return prefix;
84
- }
85
- async function ensureSuccess(response) {
86
- const body = await readResponseBody(response);
87
- if (!response.ok) {
88
- throw new Error(extractErrorMessage(response, body));
89
- }
90
- if (body && typeof body === "object") {
91
- return body;
92
- }
93
- if (body === undefined) {
94
- return;
95
- }
96
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected JSON response body.`);
97
- }
98
- async function authenticate(options) {
99
- const { host, email, password, fetchImpl = fetch } = options;
100
- const baseUrl = normaliseBaseUrl(host);
101
- const url = new URL("api/auth/login", baseUrl);
102
- const response = await fetchImpl(url, {
103
- method: "POST",
104
- headers: buildHeaders({
105
- "content-type": JSON_CONTENT_TYPE
106
- }),
107
- body: JSON.stringify({ email, password })
108
- });
109
- const body = await ensureSuccess(response);
110
- if (!body || typeof body !== "object" || !("access_token" in body) || typeof body.access_token !== "string") {
111
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Authentication response missing access_token.`);
112
- }
113
- return body;
114
- }
115
- var MASTER_DATA_BASE_PATH = "datevconnect/master-data/v1";
116
- var CLIENTS_PATH = `${MASTER_DATA_BASE_PATH}/clients`;
117
- var TAX_AUTHORITIES_PATH = `${MASTER_DATA_BASE_PATH}/tax-authorities`;
118
- var RELATIONSHIPS_PATH = `${MASTER_DATA_BASE_PATH}/relationships`;
119
- var RELATIONSHIP_TYPES_PATH = `${MASTER_DATA_BASE_PATH}/relationship-types`;
120
- var LEGAL_FORMS_PATH = `${MASTER_DATA_BASE_PATH}/legal-forms`;
121
- var CORPORATE_STRUCTURES_PATH = `${MASTER_DATA_BASE_PATH}/corporate-structures`;
122
- var EMPLOYEES_PATH = `${MASTER_DATA_BASE_PATH}/employees`;
123
- var COUNTRY_CODES_PATH = `${MASTER_DATA_BASE_PATH}/country-codes`;
124
- var CLIENT_GROUP_TYPES_PATH = `${MASTER_DATA_BASE_PATH}/client-group-types`;
125
- var CLIENT_CATEGORY_TYPES_PATH = `${MASTER_DATA_BASE_PATH}/client-category-types`;
126
- var BANKS_PATH = `${MASTER_DATA_BASE_PATH}/banks`;
127
- var AREA_OF_RESPONSIBILITIES_PATH = `${MASTER_DATA_BASE_PATH}/area-of-responsibilities`;
128
- var ADDRESSEES_PATH = `${MASTER_DATA_BASE_PATH}/addressees`;
129
- var ADDRESSEES_DELETION_LOG_PATH = `${ADDRESSEES_PATH}/deletion-log`;
130
- function buildApiUrl(host, path) {
131
- const baseUrl = normaliseBaseUrl(host);
132
- const trimmedPath = path.startsWith("/") ? path.slice(1) : path;
133
- return new URL(trimmedPath, baseUrl);
134
- }
135
- async function sendMasterDataRequest(options) {
136
- const { host, token, clientInstanceId, path, method, query, body, fetchImpl = fetch } = options;
137
- const url = buildApiUrl(host, path);
138
- if (query) {
139
- for (const [key, value] of Object.entries(query)) {
140
- if (value === undefined || value === null) {
141
- continue;
142
- }
143
- url.searchParams.set(key, String(value));
144
- }
145
- }
146
- const response = await fetchImpl(url, {
147
- method,
148
- headers: buildHeaders({
149
- accept: JSON_CONTENT_TYPE,
150
- authorization: `Bearer ${token}`,
151
- "content-type": JSON_CONTENT_TYPE,
152
- "x-client-instance-id": clientInstanceId
153
- }),
154
- body: body === undefined ? undefined : JSON.stringify(body)
155
- });
156
- return ensureSuccess(response);
157
- }
158
- async function fetchClients(options) {
159
- const { top, skip, select, filter } = options;
160
- const body = await sendMasterDataRequest({
161
- ...options,
162
- path: CLIENTS_PATH,
163
- method: "GET",
164
- query: {
165
- top,
166
- skip,
167
- select,
168
- filter
169
- }
170
- });
171
- if (body === undefined) {
172
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected clients payload.`);
173
- }
174
- return body;
175
- }
176
- async function fetchClient(options) {
177
- const { clientId, select } = options;
178
- const body = await sendMasterDataRequest({
179
- ...options,
180
- path: `${CLIENTS_PATH}/${encodeURIComponent(clientId)}`,
181
- method: "GET",
182
- query: {
183
- select
184
- }
185
- });
186
- if (body === undefined) {
187
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected client payload.`);
188
- }
189
- return body;
190
- }
191
- async function createClient(options) {
192
- const { client, maxNumber } = options;
193
- return sendMasterDataRequest({
194
- ...options,
195
- path: CLIENTS_PATH,
196
- method: "POST",
197
- query: {
198
- "max-number": maxNumber
199
- },
200
- body: client
201
- });
202
- }
203
- async function updateClient(options) {
204
- const { clientId, client } = options;
205
- return sendMasterDataRequest({
206
- ...options,
207
- path: `${CLIENTS_PATH}/${encodeURIComponent(clientId)}`,
208
- method: "PUT",
209
- body: client
210
- });
211
- }
212
- async function fetchClientResponsibilities(options) {
213
- const { clientId, select } = options;
214
- const body = await sendMasterDataRequest({
215
- ...options,
216
- path: `${CLIENTS_PATH}/${encodeURIComponent(clientId)}/responsibilities`,
217
- method: "GET",
218
- query: {
219
- select
220
- }
221
- });
222
- if (body === undefined) {
223
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected responsibilities payload.`);
224
- }
225
- return body;
226
- }
227
- async function updateClientResponsibilities(options) {
228
- const { clientId, responsibilities } = options;
229
- return sendMasterDataRequest({
230
- ...options,
231
- path: `${CLIENTS_PATH}/${encodeURIComponent(clientId)}/responsibilities`,
232
- method: "PUT",
233
- body: responsibilities
234
- });
235
- }
236
- async function fetchClientCategories(options) {
237
- const { clientId, select } = options;
238
- const body = await sendMasterDataRequest({
239
- ...options,
240
- path: `${CLIENTS_PATH}/${encodeURIComponent(clientId)}/client-categories`,
241
- method: "GET",
242
- query: {
243
- select
244
- }
245
- });
246
- if (body === undefined) {
247
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected client categories payload.`);
248
- }
249
- return body;
250
- }
251
- async function updateClientCategories(options) {
252
- const { clientId, categories } = options;
253
- return sendMasterDataRequest({
254
- ...options,
255
- path: `${CLIENTS_PATH}/${encodeURIComponent(clientId)}/client-categories`,
256
- method: "PUT",
257
- body: categories
258
- });
259
- }
260
- async function fetchClientGroups(options) {
261
- const { clientId, select } = options;
262
- const body = await sendMasterDataRequest({
263
- ...options,
264
- path: `${CLIENTS_PATH}/${encodeURIComponent(clientId)}/client-groups`,
265
- method: "GET",
266
- query: {
267
- select
268
- }
269
- });
270
- if (body === undefined) {
271
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected client groups payload.`);
272
- }
273
- return body;
274
- }
275
- async function updateClientGroups(options) {
276
- const { clientId, groups } = options;
277
- return sendMasterDataRequest({
278
- ...options,
279
- path: `${CLIENTS_PATH}/${encodeURIComponent(clientId)}/client-groups`,
280
- method: "PUT",
281
- body: groups
282
- });
283
- }
284
- async function fetchClientDeletionLog(options) {
285
- const { select, filter, top, skip } = options;
286
- const body = await sendMasterDataRequest({
287
- ...options,
288
- path: `${CLIENTS_PATH}/deletion-log`,
289
- method: "GET",
290
- query: {
291
- select,
292
- filter,
293
- top,
294
- skip
295
- }
296
- });
297
- if (body === undefined) {
298
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected client deletion log payload.`);
299
- }
300
- return body;
301
- }
302
- async function fetchNextFreeClientNumber(options) {
303
- const { start, range } = options;
304
- const body = await sendMasterDataRequest({
305
- ...options,
306
- path: `${CLIENTS_PATH}/next-free-number`,
307
- method: "GET",
308
- query: {
309
- start,
310
- range
311
- }
312
- });
313
- if (body === undefined) {
314
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected next free number payload.`);
315
- }
316
- return body;
317
- }
318
- async function fetchTaxAuthorities(options) {
319
- const { select, filter, top, skip } = options;
320
- const body = await sendMasterDataRequest({
321
- ...options,
322
- path: TAX_AUTHORITIES_PATH,
323
- method: "GET",
324
- query: {
325
- select,
326
- filter,
327
- top,
328
- skip
329
- }
330
- });
331
- if (body === undefined) {
332
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected tax authorities payload.`);
333
- }
334
- return body;
335
- }
336
- async function fetchRelationships(options) {
337
- const { select, filter, top, skip } = options;
338
- const body = await sendMasterDataRequest({
339
- ...options,
340
- path: RELATIONSHIPS_PATH,
341
- method: "GET",
342
- query: {
343
- select,
344
- filter,
345
- top,
346
- skip
347
- }
348
- });
349
- if (body === undefined) {
350
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected relationships payload.`);
351
- }
352
- return body;
353
- }
354
- async function fetchRelationshipTypes(options) {
355
- const { select, filter } = options;
356
- const body = await sendMasterDataRequest({
357
- ...options,
358
- path: RELATIONSHIP_TYPES_PATH,
359
- method: "GET",
360
- query: {
361
- select,
362
- filter
363
- }
364
- });
365
- if (body === undefined) {
366
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected relationship types payload.`);
367
- }
368
- return body;
369
- }
370
- async function fetchLegalForms(options) {
371
- const { select, nationalRight, top, skip } = options;
372
- const body = await sendMasterDataRequest({
373
- ...options,
374
- path: LEGAL_FORMS_PATH,
375
- method: "GET",
376
- query: {
377
- select,
378
- "national-right": nationalRight,
379
- top,
380
- skip
381
- }
382
- });
383
- if (body === undefined) {
384
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected legal forms payload.`);
385
- }
386
- return body;
387
- }
388
- async function fetchCorporateStructures(options) {
389
- const { select, filter, top, skip } = options;
390
- const body = await sendMasterDataRequest({
391
- ...options,
392
- path: CORPORATE_STRUCTURES_PATH,
393
- method: "GET",
394
- query: {
395
- select,
396
- filter,
397
- top,
398
- skip
399
- }
400
- });
401
- if (body === undefined) {
402
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected corporate structures payload.`);
403
- }
404
- return body;
405
- }
406
- async function fetchCorporateStructure(options) {
407
- const { organizationId, select } = options;
408
- const body = await sendMasterDataRequest({
409
- ...options,
410
- path: `${CORPORATE_STRUCTURES_PATH}/${encodeURIComponent(organizationId)}`,
411
- method: "GET",
412
- query: {
413
- select
414
- }
415
- });
416
- if (body === undefined) {
417
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected corporate structure payload.`);
418
- }
419
- return body;
420
- }
421
- async function fetchEstablishment(options) {
422
- const { organizationId, establishmentId, select } = options;
423
- const body = await sendMasterDataRequest({
424
- ...options,
425
- path: `${CORPORATE_STRUCTURES_PATH}/${encodeURIComponent(organizationId)}/establishments/${encodeURIComponent(establishmentId)}`,
426
- method: "GET",
427
- query: {
428
- select
429
- }
430
- });
431
- if (body === undefined) {
432
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected establishment payload.`);
433
- }
434
- return body;
435
- }
436
- async function fetchEmployees(options) {
437
- const { select, filter, top, skip } = options;
438
- const body = await sendMasterDataRequest({
439
- ...options,
440
- path: EMPLOYEES_PATH,
441
- method: "GET",
442
- query: {
443
- select,
444
- filter,
445
- top,
446
- skip
447
- }
448
- });
449
- if (body === undefined) {
450
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected employees payload.`);
451
- }
452
- return body;
453
- }
454
- async function fetchEmployee(options) {
455
- const { employeeId, select } = options;
456
- const body = await sendMasterDataRequest({
457
- ...options,
458
- path: `${EMPLOYEES_PATH}/${encodeURIComponent(employeeId)}`,
459
- method: "GET",
460
- query: {
461
- select
462
- }
463
- });
464
- if (body === undefined) {
465
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected employee payload.`);
466
- }
467
- return body;
468
- }
469
- async function createEmployee(options) {
470
- const { employee } = options;
471
- return sendMasterDataRequest({
472
- ...options,
473
- path: EMPLOYEES_PATH,
474
- method: "POST",
475
- body: employee
476
- });
477
- }
478
- async function updateEmployee(options) {
479
- const { employeeId, employee } = options;
480
- return sendMasterDataRequest({
481
- ...options,
482
- path: `${EMPLOYEES_PATH}/${encodeURIComponent(employeeId)}`,
483
- method: "PUT",
484
- body: employee
485
- });
486
- }
487
- async function fetchCountryCodes(options) {
488
- const { select, filter, top, skip } = options;
489
- const body = await sendMasterDataRequest({
490
- ...options,
491
- path: COUNTRY_CODES_PATH,
492
- method: "GET",
493
- query: {
494
- select,
495
- filter,
496
- top,
497
- skip
498
- }
499
- });
500
- if (body === undefined) {
501
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected country codes payload.`);
502
- }
503
- return body;
504
- }
505
- async function fetchClientGroupTypes(options) {
506
- const { select, filter, top, skip } = options;
507
- const body = await sendMasterDataRequest({
508
- ...options,
509
- path: CLIENT_GROUP_TYPES_PATH,
510
- method: "GET",
511
- query: {
512
- select,
513
- filter,
514
- top,
515
- skip
516
- }
517
- });
518
- if (body === undefined) {
519
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected client group types payload.`);
520
- }
521
- return body;
522
- }
523
- async function fetchClientGroupType(options) {
524
- const { clientGroupTypeId, select } = options;
525
- const body = await sendMasterDataRequest({
526
- ...options,
527
- path: `${CLIENT_GROUP_TYPES_PATH}/${clientGroupTypeId}`,
528
- method: "GET",
529
- query: {
530
- select
531
- }
532
- });
533
- if (body === undefined) {
534
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected client group type payload.`);
535
- }
536
- return body;
537
- }
538
- async function createClientGroupType(options) {
539
- const { clientGroupType } = options;
540
- const body = await sendMasterDataRequest({
541
- ...options,
542
- path: CLIENT_GROUP_TYPES_PATH,
543
- method: "POST",
544
- body: clientGroupType
545
- });
546
- return body;
547
- }
548
- async function updateClientGroupType(options) {
549
- const { clientGroupTypeId, clientGroupType } = options;
550
- const body = await sendMasterDataRequest({
551
- ...options,
552
- path: `${CLIENT_GROUP_TYPES_PATH}/${clientGroupTypeId}`,
553
- method: "PUT",
554
- body: clientGroupType
555
- });
556
- return body;
557
- }
558
- async function fetchClientCategoryTypes(options) {
559
- const { select, filter, top, skip } = options;
560
- const body = await sendMasterDataRequest({
561
- ...options,
562
- path: CLIENT_CATEGORY_TYPES_PATH,
563
- method: "GET",
564
- query: {
565
- select,
566
- filter,
567
- top,
568
- skip
569
- }
570
- });
571
- if (body === undefined) {
572
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected client category types payload.`);
573
- }
574
- return body;
575
- }
576
- async function fetchClientCategoryType(options) {
577
- const { clientCategoryTypeId, select } = options;
578
- const body = await sendMasterDataRequest({
579
- ...options,
580
- path: `${CLIENT_CATEGORY_TYPES_PATH}/${clientCategoryTypeId}`,
581
- method: "GET",
582
- query: {
583
- select
584
- }
585
- });
586
- if (body === undefined) {
587
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected client category type payload.`);
588
- }
589
- return body;
590
- }
591
- async function createClientCategoryType(options) {
592
- const { clientCategoryType } = options;
593
- const body = await sendMasterDataRequest({
594
- ...options,
595
- path: CLIENT_CATEGORY_TYPES_PATH,
596
- method: "POST",
597
- body: clientCategoryType
598
- });
599
- return body;
600
- }
601
- async function updateClientCategoryType(options) {
602
- const { clientCategoryTypeId, clientCategoryType } = options;
603
- const body = await sendMasterDataRequest({
604
- ...options,
605
- path: `${CLIENT_CATEGORY_TYPES_PATH}/${clientCategoryTypeId}`,
606
- method: "PUT",
607
- body: clientCategoryType
608
- });
609
- return body;
610
- }
611
- async function fetchBanks(options) {
612
- const { select, filter, top, skip } = options;
613
- const body = await sendMasterDataRequest({
614
- ...options,
615
- path: BANKS_PATH,
616
- method: "GET",
617
- query: {
618
- select,
619
- filter,
620
- top,
621
- skip
622
- }
623
- });
624
- if (body === undefined) {
625
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected banks payload.`);
626
- }
627
- return body;
628
- }
629
- async function fetchAreaOfResponsibilities(options) {
630
- const { select, filter, top, skip } = options;
631
- const body = await sendMasterDataRequest({
632
- ...options,
633
- path: AREA_OF_RESPONSIBILITIES_PATH,
634
- method: "GET",
635
- query: {
636
- select,
637
- filter,
638
- top,
639
- skip
640
- }
641
- });
642
- if (body === undefined) {
643
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected area of responsibilities payload.`);
644
- }
645
- return body;
646
- }
647
- async function fetchAddressees(options) {
648
- const { select, filter, top, skip } = options;
649
- const body = await sendMasterDataRequest({
650
- ...options,
651
- path: ADDRESSEES_PATH,
652
- method: "GET",
653
- query: {
654
- select,
655
- filter,
656
- top,
657
- skip
658
- }
659
- });
660
- if (body === undefined) {
661
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected addressees payload.`);
662
- }
663
- return body;
664
- }
665
- async function fetchAddressee(options) {
666
- const { addresseeId, select, expand } = options;
667
- const body = await sendMasterDataRequest({
668
- ...options,
669
- path: `${ADDRESSEES_PATH}/${addresseeId}`,
670
- method: "GET",
671
- query: {
672
- select,
673
- expand
674
- }
675
- });
676
- if (body === undefined) {
677
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected addressee payload.`);
678
- }
679
- return body;
680
- }
681
- async function createAddressee(options) {
682
- const { addressee, nationalRight } = options;
683
- const body = await sendMasterDataRequest({
684
- ...options,
685
- path: ADDRESSEES_PATH,
686
- method: "POST",
687
- query: {
688
- "national-right": nationalRight
689
- },
690
- body: addressee
691
- });
692
- return body;
693
- }
694
- async function updateAddressee(options) {
695
- const { addresseeId, addressee } = options;
696
- const body = await sendMasterDataRequest({
697
- ...options,
698
- path: `${ADDRESSEES_PATH}/${addresseeId}`,
699
- method: "PUT",
700
- body: addressee
701
- });
702
- return body;
703
- }
704
- async function fetchAddresseesDeletionLog(options) {
705
- const { select, filter, top, skip } = options;
706
- const body = await sendMasterDataRequest({
707
- ...options,
708
- path: ADDRESSEES_DELETION_LOG_PATH,
709
- method: "GET",
710
- query: {
711
- select,
712
- filter,
713
- top,
714
- skip
715
- }
716
- });
717
- if (body === undefined) {
718
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected addressees deletion log payload.`);
719
- }
720
- return body;
721
- }
722
- var ACCOUNTING_BASE_PATH = "datevconnect/accounting/v1";
723
- async function sendAccountingRequest(options) {
724
- const { host, token, clientInstanceId, path, method, query, body, fetchImpl = fetch } = options;
725
- const url = buildApiUrl(host, path);
726
- if (query) {
727
- for (const [key, value] of Object.entries(query)) {
728
- if (value === undefined || value === null) {
729
- continue;
730
- }
731
- url.searchParams.set(key, String(value));
732
- }
733
- }
734
- const response = await fetchImpl(url, {
735
- method,
736
- headers: buildHeaders({
737
- accept: JSON_CONTENT_TYPE,
738
- authorization: `Bearer ${token}`,
739
- "content-type": JSON_CONTENT_TYPE,
740
- "x-client-instance-id": clientInstanceId
741
- }),
742
- body: body === undefined ? undefined : JSON.stringify(body)
743
- });
744
- return ensureSuccess(response);
745
- }
746
- async function fetchAccountingClients(options) {
747
- const { select, filter, top, skip, expand } = options;
748
- const body = await sendAccountingRequest({
749
- ...options,
750
- path: `${ACCOUNTING_BASE_PATH}/clients`,
751
- method: "GET",
752
- query: {
753
- select,
754
- filter,
755
- top,
756
- skip,
757
- expand
758
- }
759
- });
760
- if (body === undefined) {
761
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected accounting clients payload.`);
762
- }
763
- return body;
764
- }
765
- async function fetchAccountingClient(options) {
766
- const { clientId, select, expand } = options;
767
- const body = await sendAccountingRequest({
768
- ...options,
769
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}`,
770
- method: "GET",
771
- query: {
772
- select,
773
- expand
774
- }
775
- });
776
- if (body === undefined) {
777
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected accounting client payload.`);
778
- }
779
- return body;
780
- }
781
- async function fetchFiscalYears(options) {
782
- const { clientId, select, filter, top, skip } = options;
783
- const body = await sendAccountingRequest({
784
- ...options,
785
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years`,
786
- method: "GET",
787
- query: {
788
- select,
789
- filter,
790
- top,
791
- skip
792
- }
793
- });
794
- if (body === undefined) {
795
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected fiscal years payload.`);
796
- }
797
- return body;
798
- }
799
- async function fetchFiscalYear(options) {
800
- const { clientId, fiscalYearId, select } = options;
801
- const body = await sendAccountingRequest({
802
- ...options,
803
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}`,
804
- method: "GET",
805
- query: {
806
- select
807
- }
808
- });
809
- if (body === undefined) {
810
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected fiscal year payload.`);
811
- }
812
- return body;
813
- }
814
- async function fetchAccountsReceivable(options) {
815
- const { clientId, fiscalYearId, select, filter, top, skip, expand } = options;
816
- const body = await sendAccountingRequest({
817
- ...options,
818
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounts-receivable`,
819
- method: "GET",
820
- query: {
821
- select,
822
- filter,
823
- top,
824
- skip,
825
- expand
826
- }
827
- });
828
- if (body === undefined) {
829
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected accounts receivable payload.`);
830
- }
831
- return body;
832
- }
833
- async function fetchAccountsReceivableCondensed(options) {
834
- const { clientId, fiscalYearId, select, filter, top, skip } = options;
835
- const body = await sendAccountingRequest({
836
- ...options,
837
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounts-receivable/condensed`,
838
- method: "GET",
839
- query: {
840
- select,
841
- filter,
842
- top,
843
- skip
844
- }
845
- });
846
- if (body === undefined) {
847
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected condensed accounts receivable payload.`);
848
- }
849
- return body;
850
- }
851
- async function fetchAccountReceivable(options) {
852
- const { clientId, fiscalYearId, accountsReceivableId, select, expand } = options;
853
- const body = await sendAccountingRequest({
854
- ...options,
855
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounts-receivable/${encodeURIComponent(accountsReceivableId)}`,
856
- method: "GET",
857
- query: {
858
- select,
859
- expand
860
- }
861
- });
862
- if (body === undefined) {
863
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected account receivable payload.`);
864
- }
865
- return body;
866
- }
867
- async function fetchAccountsPayable(options) {
868
- const { clientId, fiscalYearId, select, filter, top, skip, expand } = options;
869
- const body = await sendAccountingRequest({
870
- ...options,
871
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounts-payable`,
872
- method: "GET",
873
- query: {
874
- select,
875
- filter,
876
- top,
877
- skip,
878
- expand
879
- }
880
- });
881
- if (body === undefined) {
882
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected accounts payable payload.`);
883
- }
884
- return body;
885
- }
886
- async function fetchAccountsPayableCondensed(options) {
887
- const { clientId, fiscalYearId, select, filter, top, skip } = options;
888
- const body = await sendAccountingRequest({
889
- ...options,
890
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounts-payable/condense`,
891
- method: "GET",
892
- query: {
893
- select,
894
- filter,
895
- top,
896
- skip
897
- }
898
- });
899
- if (body === undefined) {
900
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected condensed accounts payable payload.`);
901
- }
902
- return body;
903
- }
904
- async function fetchAccountPayable(options) {
905
- const { clientId, fiscalYearId, accountsPayableId, select, expand } = options;
906
- const body = await sendAccountingRequest({
907
- ...options,
908
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounts-payable/${encodeURIComponent(accountsPayableId)}`,
909
- method: "GET",
910
- query: {
911
- select,
912
- expand
913
- }
914
- });
915
- if (body === undefined) {
916
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected account payable payload.`);
917
- }
918
- return body;
919
- }
920
- async function fetchAccountPostings(options) {
921
- const { clientId, fiscalYearId, select, filter, top, skip } = options;
922
- const body = await sendAccountingRequest({
923
- ...options,
924
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/account-postings`,
925
- method: "GET",
926
- query: {
927
- select,
928
- filter,
929
- top,
930
- skip
931
- }
932
- });
933
- if (body === undefined) {
934
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected account postings payload.`);
935
- }
936
- return body;
937
- }
938
- async function fetchAccountPosting(options) {
939
- const { clientId, fiscalYearId, accountPostingId, select } = options;
940
- const body = await sendAccountingRequest({
941
- ...options,
942
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/account-postings/${encodeURIComponent(accountPostingId)}`,
943
- method: "GET",
944
- query: {
945
- select
946
- }
947
- });
948
- if (body === undefined) {
949
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected account posting payload.`);
950
- }
951
- return body;
952
- }
953
- async function fetchAccountingSequences(options) {
954
- const { clientId, fiscalYearId, select, top, skip } = options;
955
- const body = await sendAccountingRequest({
956
- ...options,
957
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounting-sequences-processed`,
958
- method: "GET",
959
- query: {
960
- select,
961
- top,
962
- skip
963
- }
964
- });
965
- if (body === undefined) {
966
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected accounting sequences payload.`);
967
- }
968
- return body;
969
- }
970
- async function fetchAccountingSequence(options) {
971
- const { clientId, fiscalYearId, accountingSequenceId, select } = options;
972
- const body = await sendAccountingRequest({
973
- ...options,
974
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounting-sequences-processed/${encodeURIComponent(accountingSequenceId)}`,
975
- method: "GET",
976
- query: {
977
- select
978
- }
979
- });
980
- if (body === undefined) {
981
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected accounting sequence payload.`);
982
- }
983
- return body;
984
- }
985
- async function createAccountingSequence(options) {
986
- const { clientId, fiscalYearId, accountingSequence } = options;
987
- return sendAccountingRequest({
988
- ...options,
989
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounting-sequences`,
990
- method: "POST",
991
- body: accountingSequence
992
- });
993
- }
994
- async function fetchAccountingRecords(options) {
995
- const { clientId, fiscalYearId, accountingSequenceId, select, filter, top, skip } = options;
996
- const body = await sendAccountingRequest({
997
- ...options,
998
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounting-sequences-processed/${encodeURIComponent(accountingSequenceId)}/accounting-records`,
999
- method: "GET",
1000
- query: {
1001
- select,
1002
- filter,
1003
- top,
1004
- skip
1005
- }
1006
- });
1007
- if (body === undefined) {
1008
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected accounting records payload.`);
1009
- }
1010
- return body;
1011
- }
1012
- async function fetchAccountingRecord(options) {
1013
- const { clientId, fiscalYearId, accountingSequenceId, accountingRecordId, select } = options;
1014
- const body = await sendAccountingRequest({
1015
- ...options,
1016
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounting-sequences-processed/${encodeURIComponent(accountingSequenceId)}/accounting-records/${encodeURIComponent(accountingRecordId)}`,
1017
- method: "GET",
1018
- query: {
1019
- select
1020
- }
1021
- });
1022
- if (body === undefined) {
1023
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected accounting record payload.`);
1024
- }
1025
- return body;
1026
- }
1027
- async function fetchPostingProposalRulesIncoming(options) {
1028
- const { clientId, fiscalYearId, select, top, skip } = options;
1029
- const body = await sendAccountingRequest({
1030
- ...options,
1031
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/posting-proposal-rules-incoming-invoices`,
1032
- method: "GET",
1033
- query: {
1034
- select,
1035
- top,
1036
- skip
1037
- }
1038
- });
1039
- if (body === undefined) {
1040
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected posting proposal rules incoming payload.`);
1041
- }
1042
- return body;
1043
- }
1044
- async function fetchPostingProposalRulesOutgoing(options) {
1045
- const { clientId, fiscalYearId, select, top, skip } = options;
1046
- const body = await sendAccountingRequest({
1047
- ...options,
1048
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/posting-proposal-rules-outgoing-invoices`,
1049
- method: "GET",
1050
- query: {
1051
- select,
1052
- top,
1053
- skip
1054
- }
1055
- });
1056
- if (body === undefined) {
1057
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected posting proposal rules outgoing payload.`);
1058
- }
1059
- return body;
1060
- }
1061
- async function fetchPostingProposalRulesCashRegister(options) {
1062
- const { clientId, fiscalYearId, select, top, skip } = options;
1063
- const body = await sendAccountingRequest({
1064
- ...options,
1065
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/posting-proposal-rules-cash-register`,
1066
- method: "GET",
1067
- query: {
1068
- select,
1069
- top,
1070
- skip
1071
- }
1072
- });
1073
- if (body === undefined) {
1074
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected posting proposal rules cash register payload.`);
1075
- }
1076
- return body;
1077
- }
1078
- async function fetchPostingProposalRuleIncoming(options) {
1079
- const { clientId, fiscalYearId, ruleId, select } = options;
1080
- const body = await sendAccountingRequest({
1081
- ...options,
1082
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/posting-proposal-rules-incoming-invoices/${encodeURIComponent(ruleId)}`,
1083
- method: "GET",
1084
- query: {
1085
- select
1086
- }
1087
- });
1088
- if (body === undefined) {
1089
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected posting proposal rule incoming payload.`);
1090
- }
1091
- return body;
1092
- }
1093
- async function fetchPostingProposalRuleOutgoing(options) {
1094
- const { clientId, fiscalYearId, ruleId, select } = options;
1095
- const body = await sendAccountingRequest({
1096
- ...options,
1097
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/posting-proposal-rules-outgoing-invoices/${encodeURIComponent(ruleId)}`,
1098
- method: "GET",
1099
- query: {
1100
- select
1101
- }
1102
- });
1103
- if (body === undefined) {
1104
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected posting proposal rule outgoing payload.`);
1105
- }
1106
- return body;
1107
- }
1108
- async function fetchPostingProposalRuleCashRegister(options) {
1109
- const { clientId, fiscalYearId, ruleId, select } = options;
1110
- const body = await sendAccountingRequest({
1111
- ...options,
1112
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/posting-proposal-rules-cash-register/${encodeURIComponent(ruleId)}`,
1113
- method: "GET",
1114
- query: {
1115
- select
1116
- }
1117
- });
1118
- if (body === undefined) {
1119
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected posting proposal rule cash register payload.`);
1120
- }
1121
- return body;
1122
- }
1123
- async function batchPostingProposalsIncoming(options) {
1124
- const { clientId, fiscalYearId, postingProposals } = options;
1125
- return sendAccountingRequest({
1126
- ...options,
1127
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/posting-proposals-incoming-invoices/batch`,
1128
- method: "POST",
1129
- body: postingProposals
1130
- });
1131
- }
1132
- async function batchPostingProposalsOutgoing(options) {
1133
- const { clientId, fiscalYearId, postingProposals } = options;
1134
- return sendAccountingRequest({
1135
- ...options,
1136
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/posting-proposals-outgoing-invoices/batch`,
1137
- method: "POST",
1138
- body: postingProposals
1139
- });
1140
- }
1141
- async function batchPostingProposalsCashRegister(options) {
1142
- const { clientId, fiscalYearId, postingProposals } = options;
1143
- return sendAccountingRequest({
1144
- ...options,
1145
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/posting-proposals-cash-register/batch`,
1146
- method: "POST",
1147
- body: postingProposals
1148
- });
1149
- }
1150
- async function fetchAccountingSumsAndBalances(options) {
1151
- const { clientId, fiscalYearId, select, filter, top, skip } = options;
1152
- const body = await sendAccountingRequest({
1153
- ...options,
1154
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounting-sums-and-balances`,
1155
- method: "GET",
1156
- query: {
1157
- select,
1158
- filter,
1159
- top,
1160
- skip
1161
- }
1162
- });
1163
- if (body === undefined) {
1164
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected accounting sums and balances payload.`);
1165
- }
1166
- return body;
1167
- }
1168
- async function fetchAccountingSumsAndBalance(options) {
1169
- const { clientId, fiscalYearId, accountingSumsAndBalancesId } = options;
1170
- const body = await sendAccountingRequest({
1171
- ...options,
1172
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounting-sums-and-balances/${encodeURIComponent(accountingSumsAndBalancesId)}`,
1173
- method: "GET"
1174
- });
1175
- if (body === undefined) {
1176
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected accounting sums and balance payload.`);
1177
- }
1178
- return body;
1179
- }
1180
- async function fetchDebitors(options) {
1181
- const { clientId, fiscalYearId, select, filter, top, skip, expand } = options;
1182
- const body = await sendAccountingRequest({
1183
- ...options,
1184
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/debitors`,
1185
- method: "GET",
1186
- query: {
1187
- select,
1188
- filter,
1189
- top,
1190
- skip,
1191
- expand
1192
- }
1193
- });
1194
- if (body === undefined) {
1195
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected debitors payload.`);
1196
- }
1197
- return body;
1198
- }
1199
- async function fetchDebitor(options) {
1200
- const { clientId, fiscalYearId, debitorId, select, expand } = options;
1201
- const body = await sendAccountingRequest({
1202
- ...options,
1203
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/debitors/${encodeURIComponent(debitorId)}`,
1204
- method: "GET",
1205
- query: {
1206
- select,
1207
- expand
1208
- }
1209
- });
1210
- if (body === undefined) {
1211
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected debitor payload.`);
1212
- }
1213
- return body;
1214
- }
1215
- async function createDebitor(options) {
1216
- const { clientId, fiscalYearId, debitor } = options;
1217
- return sendAccountingRequest({
1218
- ...options,
1219
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/debitors`,
1220
- method: "POST",
1221
- body: debitor
1222
- });
1223
- }
1224
- async function updateDebitor(options) {
1225
- const { clientId, fiscalYearId, debitorId, debitor } = options;
1226
- return sendAccountingRequest({
1227
- ...options,
1228
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/debitors/${encodeURIComponent(debitorId)}`,
1229
- method: "PUT",
1230
- body: debitor
1231
- });
1232
- }
1233
- async function fetchNextAvailableDebitor(options) {
1234
- const { clientId, fiscalYearId, startAt } = options;
1235
- const body = await sendAccountingRequest({
1236
- ...options,
1237
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/debitors/next-available`,
1238
- method: "GET",
1239
- query: {
1240
- "start-at": startAt
1241
- }
1242
- });
1243
- if (body === undefined) {
1244
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected next available debitor payload.`);
1245
- }
1246
- return body;
1247
- }
1248
- async function fetchCreditors(options) {
1249
- const { clientId, fiscalYearId, select, filter, top, skip, expand } = options;
1250
- const body = await sendAccountingRequest({
1251
- ...options,
1252
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/creditors`,
1253
- method: "GET",
1254
- query: {
1255
- select,
1256
- filter,
1257
- top,
1258
- skip,
1259
- expand
1260
- }
1261
- });
1262
- if (body === undefined) {
1263
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected creditors payload.`);
1264
- }
1265
- return body;
1266
- }
1267
- async function fetchCreditor(options) {
1268
- const { clientId, fiscalYearId, creditorId, select, expand } = options;
1269
- const body = await sendAccountingRequest({
1270
- ...options,
1271
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/creditors/${encodeURIComponent(creditorId)}`,
1272
- method: "GET",
1273
- query: {
1274
- select,
1275
- expand
1276
- }
1277
- });
1278
- if (body === undefined) {
1279
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected creditor payload.`);
1280
- }
1281
- return body;
1282
- }
1283
- async function createCreditor(options) {
1284
- const { clientId, fiscalYearId, creditor } = options;
1285
- return sendAccountingRequest({
1286
- ...options,
1287
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/creditors`,
1288
- method: "POST",
1289
- body: creditor
1290
- });
1291
- }
1292
- async function updateCreditor(options) {
1293
- const { clientId, fiscalYearId, creditorId, creditor } = options;
1294
- return sendAccountingRequest({
1295
- ...options,
1296
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/creditors/${encodeURIComponent(creditorId)}`,
1297
- method: "PUT",
1298
- body: creditor
1299
- });
1300
- }
1301
- async function fetchNextAvailableCreditor(options) {
1302
- const { clientId, fiscalYearId, startAt } = options;
1303
- const body = await sendAccountingRequest({
1304
- ...options,
1305
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/creditors/next-available`,
1306
- method: "GET",
1307
- query: {
1308
- "start-at": startAt
1309
- }
1310
- });
1311
- if (body === undefined) {
1312
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected next available creditor payload.`);
1313
- }
1314
- return body;
1315
- }
1316
- async function fetchGeneralLedgerAccounts(options) {
1317
- const { clientId, fiscalYearId, select, filter, top, skip } = options;
1318
- const body = await sendAccountingRequest({
1319
- ...options,
1320
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/general-ledger-accounts`,
1321
- method: "GET",
1322
- query: {
1323
- select,
1324
- filter,
1325
- top,
1326
- skip
1327
- }
1328
- });
1329
- if (body === undefined) {
1330
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected general ledger accounts payload.`);
1331
- }
1332
- return body;
1333
- }
1334
- async function fetchGeneralLedgerAccount(options) {
1335
- const { clientId, fiscalYearId, generalLedgerAccountId, select } = options;
1336
- const body = await sendAccountingRequest({
1337
- ...options,
1338
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/general-ledger-accounts/${encodeURIComponent(generalLedgerAccountId)}`,
1339
- method: "GET",
1340
- query: {
1341
- select
1342
- }
1343
- });
1344
- if (body === undefined) {
1345
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected general ledger account payload.`);
1346
- }
1347
- return body;
1348
- }
1349
- async function fetchUtilizedGeneralLedgerAccounts(options) {
1350
- const { clientId, fiscalYearId, select, top, skip } = options;
1351
- const body = await sendAccountingRequest({
1352
- ...options,
1353
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/general-ledger-accounts/utilized`,
1354
- method: "GET",
1355
- query: {
1356
- select,
1357
- top,
1358
- skip
1359
- }
1360
- });
1361
- if (body === undefined) {
1362
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected utilized general ledger accounts payload.`);
1363
- }
1364
- return body;
1365
- }
1366
- async function fetchTermsOfPayment(options) {
1367
- const { clientId, fiscalYearId, select, filter, skip, top } = options;
1368
- const body = await sendAccountingRequest({
1369
- ...options,
1370
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/terms-of-payment`,
1371
- method: "GET",
1372
- query: {
1373
- select,
1374
- filter,
1375
- skip,
1376
- top
1377
- }
1378
- });
1379
- if (body === undefined) {
1380
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected terms of payment payload.`);
1381
- }
1382
- return body;
1383
- }
1384
- async function fetchTermOfPayment(options) {
1385
- const { clientId, fiscalYearId, termOfPaymentId, select } = options;
1386
- const body = await sendAccountingRequest({
1387
- ...options,
1388
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/terms-of-payment/${encodeURIComponent(termOfPaymentId)}`,
1389
- method: "GET",
1390
- query: {
1391
- select
1392
- }
1393
- });
1394
- if (body === undefined) {
1395
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected term of payment payload.`);
1396
- }
1397
- return body;
1398
- }
1399
- async function createTermOfPayment(options) {
1400
- const { clientId, fiscalYearId, termOfPaymentData } = options;
1401
- return sendAccountingRequest({
1402
- ...options,
1403
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/terms-of-payment`,
1404
- method: "POST",
1405
- body: termOfPaymentData
1406
- });
1407
- }
1408
- async function updateTermOfPayment(options) {
1409
- const { clientId, fiscalYearId, termOfPaymentId, termOfPaymentData } = options;
1410
- return sendAccountingRequest({
1411
- ...options,
1412
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/terms-of-payment/${encodeURIComponent(termOfPaymentId)}`,
1413
- method: "PUT",
1414
- body: termOfPaymentData
1415
- });
1416
- }
1417
- async function fetchStocktakingData(options) {
1418
- const { clientId, fiscalYearId, filter, select, skip, top } = options;
1419
- const body = await sendAccountingRequest({
1420
- ...options,
1421
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/assets/stocktakings`,
1422
- method: "GET",
1423
- query: {
1424
- filter,
1425
- select,
1426
- skip,
1427
- top
1428
- }
1429
- });
1430
- if (body === undefined) {
1431
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected stocktaking data payload.`);
1432
- }
1433
- return body;
1434
- }
1435
- async function fetchStocktakingDataByAsset(options) {
1436
- const { clientId, fiscalYearId, assetId, select, skip, top } = options;
1437
- const body = await sendAccountingRequest({
1438
- ...options,
1439
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/assets/${encodeURIComponent(assetId)}/stocktaking/`,
1440
- method: "GET",
1441
- query: {
1442
- select,
1443
- skip,
1444
- top
1445
- }
1446
- });
1447
- if (body === undefined) {
1448
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected stocktaking data by asset payload.`);
1449
- }
1450
- return body;
1451
- }
1452
- async function updateStocktakingData(options) {
1453
- const { clientId, fiscalYearId, assetId, stocktakingData } = options;
1454
- return sendAccountingRequest({
1455
- ...options,
1456
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/assets/${encodeURIComponent(assetId)}/stocktaking/`,
1457
- method: "PUT",
1458
- body: stocktakingData
1459
- });
1460
- }
1461
- async function fetchCostSystems(options) {
1462
- const { clientId, fiscalYearId, select, skip, top } = options;
1463
- const body = await sendAccountingRequest({
1464
- ...options,
1465
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/cost-systems`,
1466
- method: "GET",
1467
- query: {
1468
- select,
1469
- skip,
1470
- top
1471
- }
1472
- });
1473
- if (body === undefined) {
1474
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected cost systems payload.`);
1475
- }
1476
- return body;
1477
- }
1478
- async function fetchCostSystem(options) {
1479
- const { clientId, fiscalYearId, costSystemId, select } = options;
1480
- const body = await sendAccountingRequest({
1481
- ...options,
1482
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/cost-systems/${encodeURIComponent(costSystemId)}`,
1483
- method: "GET",
1484
- query: {
1485
- select
1486
- }
1487
- });
1488
- if (body === undefined) {
1489
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected cost system payload.`);
1490
- }
1491
- return body;
1492
- }
1493
- async function fetchCostCenters(options) {
1494
- const { clientId, fiscalYearId, costSystemId, select, top, skip } = options;
1495
- const body = await sendAccountingRequest({
1496
- ...options,
1497
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/cost-systems/${encodeURIComponent(costSystemId)}/cost-centers`,
1498
- method: "GET",
1499
- query: {
1500
- select,
1501
- top,
1502
- skip
1503
- }
1504
- });
1505
- if (body === undefined) {
1506
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected cost centers payload.`);
1507
- }
1508
- return body;
1509
- }
1510
- async function fetchCostCenter(options) {
1511
- const { clientId, fiscalYearId, costSystemId, costCenterId, select } = options;
1512
- const body = await sendAccountingRequest({
1513
- ...options,
1514
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/cost-systems/${encodeURIComponent(costSystemId)}/cost-centers/${encodeURIComponent(costCenterId)}`,
1515
- method: "GET",
1516
- query: {
1517
- select
1518
- }
1519
- });
1520
- if (body === undefined) {
1521
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected cost center payload.`);
1522
- }
1523
- return body;
1524
- }
1525
- async function fetchCostCenterProperties(options) {
1526
- const { clientId, fiscalYearId, costSystemId, select, skip, top } = options;
1527
- const body = await sendAccountingRequest({
1528
- ...options,
1529
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/cost-systems/${encodeURIComponent(costSystemId)}/cost-center-properties`,
1530
- method: "GET",
1531
- query: {
1532
- select,
1533
- skip,
1534
- top
1535
- }
1536
- });
1537
- if (body === undefined) {
1538
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected cost center properties payload.`);
1539
- }
1540
- return body;
1541
- }
1542
- async function fetchCostCenterProperty(options) {
1543
- const { clientId, fiscalYearId, costSystemId, costCenterPropertyId, select } = options;
1544
- const body = await sendAccountingRequest({
1545
- ...options,
1546
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/cost-systems/${encodeURIComponent(costSystemId)}/cost-center-properties/${encodeURIComponent(costCenterPropertyId)}`,
1547
- method: "GET",
1548
- query: {
1549
- select
1550
- }
1551
- });
1552
- if (body === undefined) {
1553
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected cost center property payload.`);
1554
- }
1555
- return body;
1556
- }
1557
- async function createInternalCostService(options) {
1558
- const { clientId, fiscalYearId, costSystemId, internalCostServiceData } = options;
1559
- return sendAccountingRequest({
1560
- ...options,
1561
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/cost-systems/${encodeURIComponent(costSystemId)}/internal-cost-services`,
1562
- method: "POST",
1563
- body: internalCostServiceData
1564
- });
1565
- }
1566
- async function fetchCostSequences(options) {
1567
- const { clientId, fiscalYearId, costSystemId, select, skip, top } = options;
1568
- const body = await sendAccountingRequest({
1569
- ...options,
1570
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/cost-systems/${encodeURIComponent(costSystemId)}/cost-sequences`,
1571
- method: "GET",
1572
- query: {
1573
- select,
1574
- skip,
1575
- top
1576
- }
1577
- });
1578
- if (body === undefined) {
1579
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected cost sequences payload.`);
1580
- }
1581
- return body;
1582
- }
1583
- async function fetchCostSequence(options) {
1584
- const { clientId, fiscalYearId, costSystemId, costSequenceId, select } = options;
1585
- const body = await sendAccountingRequest({
1586
- ...options,
1587
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/cost-systems/${encodeURIComponent(costSystemId)}/cost-sequences/${encodeURIComponent(costSequenceId)}`,
1588
- method: "GET",
1589
- query: {
1590
- select
1591
- }
1592
- });
1593
- if (body === undefined) {
1594
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected cost sequence payload.`);
1595
- }
1596
- return body;
1597
- }
1598
- async function createCostSequence(options) {
1599
- const { clientId, fiscalYearId, costSystemId, costSequenceId, costSequenceData } = options;
1600
- return sendAccountingRequest({
1601
- ...options,
1602
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/cost-systems/${encodeURIComponent(costSystemId)}/cost-sequences/${encodeURIComponent(costSequenceId)}`,
1603
- method: "POST",
1604
- body: costSequenceData
1605
- });
1606
- }
1607
- async function fetchCostAccountingRecords(options) {
1608
- const { clientId, fiscalYearId, costSystemId, costSequenceId, select, skip, top } = options;
1609
- const body = await sendAccountingRequest({
1610
- ...options,
1611
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/cost-systems/${encodeURIComponent(costSystemId)}/cost-sequences/${encodeURIComponent(costSequenceId)}/cost-accounting-records`,
1612
- method: "GET",
1613
- query: {
1614
- select,
1615
- skip,
1616
- top
1617
- }
1618
- });
1619
- if (body === undefined) {
1620
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected cost accounting records payload.`);
1621
- }
1622
- return body;
1623
- }
1624
- async function fetchAccountingStatistics(options) {
1625
- const { clientId, fiscalYearId, select, filter, skip, top } = options;
1626
- const body = await sendAccountingRequest({
1627
- ...options,
1628
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounting-statistics`,
1629
- method: "GET",
1630
- query: {
1631
- select,
1632
- filter,
1633
- skip,
1634
- top
1635
- }
1636
- });
1637
- if (body === undefined) {
1638
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected accounting statistics payload.`);
1639
- }
1640
- return body;
1641
- }
1642
- async function fetchAccountingTransactionKeys(options) {
1643
- const { clientId, fiscalYearId, select, skip, top } = options;
1644
- const body = await sendAccountingRequest({
1645
- ...options,
1646
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounting-transaction-keys`,
1647
- method: "GET",
1648
- query: {
1649
- select,
1650
- skip,
1651
- top
1652
- }
1653
- });
1654
- if (body === undefined) {
1655
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected accounting transaction keys payload.`);
1656
- }
1657
- return body;
1658
- }
1659
- async function fetchAccountingTransactionKey(options) {
1660
- const { clientId, fiscalYearId, accountingTransactionKeyId, select, filter, skip, top } = options;
1661
- const body = await sendAccountingRequest({
1662
- ...options,
1663
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/accounting-transaction-keys/${encodeURIComponent(accountingTransactionKeyId)}`,
1664
- method: "GET",
1665
- query: {
1666
- select,
1667
- filter,
1668
- skip,
1669
- top
1670
- }
1671
- });
1672
- if (body === undefined) {
1673
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected accounting transaction key payload.`);
1674
- }
1675
- return body;
1676
- }
1677
- async function fetchVariousAddresses(options) {
1678
- const { clientId, fiscalYearId, select, skip, top, expand } = options;
1679
- const body = await sendAccountingRequest({
1680
- ...options,
1681
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/various-addresses`,
1682
- method: "GET",
1683
- query: {
1684
- select,
1685
- skip,
1686
- top,
1687
- expand
1688
- }
1689
- });
1690
- if (body === undefined) {
1691
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected various addresses payload.`);
1692
- }
1693
- return body;
1694
- }
1695
- async function fetchVariousAddress(options) {
1696
- const { clientId, fiscalYearId, variousAddressId, select, skip, top, expand } = options;
1697
- const body = await sendAccountingRequest({
1698
- ...options,
1699
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/various-addresses/${encodeURIComponent(variousAddressId)}`,
1700
- method: "GET",
1701
- query: {
1702
- select,
1703
- skip,
1704
- top,
1705
- expand
1706
- }
1707
- });
1708
- if (body === undefined) {
1709
- throw new Error(`${DEFAULT_ERROR_PREFIX}: Expected various address payload.`);
1710
- }
1711
- return body;
1712
- }
1713
- async function createVariousAddress(options) {
1714
- const { clientId, fiscalYearId, variousAddressData } = options;
1715
- return sendAccountingRequest({
1716
- ...options,
1717
- path: `${ACCOUNTING_BASE_PATH}/clients/${encodeURIComponent(clientId)}/fiscal-years/${encodeURIComponent(fiscalYearId)}/various-addresses`,
1718
- method: "POST",
1719
- body: variousAddressData
1720
- });
1721
- }
1722
-
1723
- // nodes/DocumentManagement/DocumentManagement.config.ts
1724
- var documentManagementNodeDescription = {
1725
- displayName: "Klardaten DATEVconnect: Document Management",
1726
- name: "documentManagement",
1727
- icon: "file:../klardaten.svg",
1728
- group: ["transform"],
1729
- version: 1,
1730
- description: "Interact with document management resources / DMS",
1731
- defaults: {
1732
- name: "Document Management"
1733
- },
1734
- inputs: ["main"],
1735
- outputs: ["main"],
1736
- credentials: [
1737
- {
1738
- name: "datevConnectApi",
1739
- required: true
1740
- }
1741
- ],
1742
- properties: [
1743
- {
1744
- displayName: "Resource",
1745
- name: "resource",
1746
- type: "options",
1747
- options: [
1748
- {
1749
- name: "Document",
1750
- value: "document"
1751
- },
1752
- {
1753
- name: "Document File",
1754
- value: "documentFile"
1755
- },
1756
- {
1757
- name: "Domain",
1758
- value: "domain"
1759
- },
1760
- {
1761
- name: "Document State",
1762
- value: "documentState"
1763
- },
1764
- {
1765
- name: "Secure Area",
1766
- value: "secureArea"
1767
- },
1768
- {
1769
- name: "Property Template",
1770
- value: "propertyTemplate"
1771
- },
1772
- {
1773
- name: "Individual Property",
1774
- value: "individualProperty"
1775
- },
1776
- {
1777
- name: "Individual Reference 1",
1778
- value: "individualReference1"
1779
- },
1780
- {
1781
- name: "Individual Reference 2",
1782
- value: "individualReference2"
1783
- },
1784
- {
1785
- name: "Info",
1786
- value: "info"
1787
- }
1788
- ],
1789
- default: "document"
1790
- },
1791
- {
1792
- displayName: "Operation",
1793
- name: "operation",
1794
- type: "options",
1795
- displayOptions: {
1796
- show: {
1797
- resource: ["document"]
1798
- }
1799
- },
1800
- options: [
1801
- {
1802
- name: "Get Many",
1803
- value: "getAll",
1804
- description: "Retrieve a list of documents",
1805
- action: "Get many documents"
1806
- },
1807
- {
1808
- name: "Get",
1809
- value: "get",
1810
- description: "Retrieve a specific document",
1811
- action: "Get a document"
1812
- },
1813
- {
1814
- name: "Create",
1815
- value: "create",
1816
- description: "Create a new document",
1817
- action: "Create a document"
1818
- },
1819
- {
1820
- name: "Update",
1821
- value: "update",
1822
- description: "Update a document",
1823
- action: "Update a document"
1824
- },
1825
- {
1826
- name: "Delete",
1827
- value: "delete",
1828
- description: "Delete a document",
1829
- action: "Delete a document"
1830
- },
1831
- {
1832
- name: "Delete Permanently",
1833
- value: "deletePermanently",
1834
- description: "Permanently delete a document",
1835
- action: "Delete a document permanently"
1836
- },
1837
- {
1838
- name: "Get Structure Items",
1839
- value: "getStructureItems",
1840
- description: "Get structure items of a document",
1841
- action: "Get structure items"
1842
- },
1843
- {
1844
- name: "Add Structure Item",
1845
- value: "addStructureItem",
1846
- description: "Add a structure item to a document",
1847
- action: "Add structure item"
1848
- },
1849
- {
1850
- name: "Get Structure Item",
1851
- value: "getStructureItem",
1852
- description: "Get a specific structure item",
1853
- action: "Get structure item"
1854
- },
1855
- {
1856
- name: "Update Structure Item",
1857
- value: "updateStructureItem",
1858
- description: "Update a structure item",
1859
- action: "Update structure item"
1860
- },
1861
- {
1862
- name: "Create Dispatcher Information",
1863
- value: "createDispatcherInformation",
1864
- description: "Create dispatcher information for a document",
1865
- action: "Create dispatcher information"
1866
- }
1867
- ],
1868
- default: "getAll"
1869
- },
1870
- {
1871
- displayName: "Operation",
1872
- name: "operation",
1873
- type: "options",
1874
- displayOptions: {
1875
- show: {
1876
- resource: ["documentFile"]
1877
- }
1878
- },
1879
- options: [
1880
- {
1881
- name: "Get",
1882
- value: "get",
1883
- description: "Get a document file",
1884
- action: "Get a document file"
1885
- },
1886
- {
1887
- name: "Upload",
1888
- value: "upload",
1889
- description: "Upload a document file",
1890
- action: "Upload a document file"
1891
- }
1892
- ],
1893
- default: "get"
1894
- },
1895
- {
1896
- displayName: "Operation",
1897
- name: "operation",
1898
- type: "options",
1899
- displayOptions: {
1900
- show: {
1901
- resource: ["domain"]
1902
- }
1903
- },
1904
- options: [
1905
- {
1906
- name: "Get Many",
1907
- value: "getAll",
1908
- description: "Get all domains",
1909
- action: "Get many domains"
1910
- }
1911
- ],
1912
- default: "getAll"
1913
- },
1914
- {
1915
- displayName: "Operation",
1916
- name: "operation",
1917
- type: "options",
1918
- displayOptions: {
1919
- show: {
1920
- resource: ["documentState"]
1921
- }
1922
- },
1923
- options: [
1924
- {
1925
- name: "Get Many",
1926
- value: "getAll",
1927
- description: "Get all document states",
1928
- action: "Get many document states"
1929
- },
1930
- {
1931
- name: "Get",
1932
- value: "get",
1933
- description: "Get a specific document state",
1934
- action: "Get a document state"
1935
- },
1936
- {
1937
- name: "Create",
1938
- value: "create",
1939
- description: "Create a new document state",
1940
- action: "Create a document state"
1941
- }
1942
- ],
1943
- default: "getAll"
1944
- },
1945
- {
1946
- displayName: "Operation",
1947
- name: "operation",
1948
- type: "options",
1949
- displayOptions: {
1950
- show: {
1951
- resource: ["secureArea"]
1952
- }
1953
- },
1954
- options: [
1955
- {
1956
- name: "Get Many",
1957
- value: "getAll",
1958
- description: "Retrieve all secure areas",
1959
- action: "Get many secure areas"
1960
- }
1961
- ],
1962
- default: "getAll"
1963
- },
1964
- {
1965
- displayName: "Operation",
1966
- name: "operation",
1967
- type: "options",
1968
- displayOptions: {
1969
- show: {
1970
- resource: ["propertyTemplate"]
1971
- }
1972
- },
1973
- options: [
1974
- {
1975
- name: "Get Many",
1976
- value: "getAll",
1977
- description: "Retrieve all property templates",
1978
- action: "Get many property templates"
1979
- }
1980
- ],
1981
- default: "getAll"
1982
- },
1983
- {
1984
- displayName: "Operation",
1985
- name: "operation",
1986
- type: "options",
1987
- displayOptions: {
1988
- show: {
1989
- resource: ["individualProperty"]
1990
- }
1991
- },
1992
- options: [
1993
- {
1994
- name: "Get Many",
1995
- value: "getAll",
1996
- description: "Retrieve all individual properties",
1997
- action: "Get many individual properties"
1998
- }
1999
- ],
2000
- default: "getAll"
2001
- },
2002
- {
2003
- displayName: "Operation",
2004
- name: "operation",
2005
- type: "options",
2006
- displayOptions: {
2007
- show: {
2008
- resource: ["individualReference1"]
2009
- }
2010
- },
2011
- options: [
2012
- {
2013
- name: "Get Many",
2014
- value: "getAll",
2015
- description: "Retrieve all individual references 1",
2016
- action: "Get many individual references 1"
2017
- },
2018
- {
2019
- name: "Create",
2020
- value: "create",
2021
- description: "Create a new individual reference 1",
2022
- action: "Create individual reference 1"
2023
- }
2024
- ],
2025
- default: "getAll"
2026
- },
2027
- {
2028
- displayName: "Operation",
2029
- name: "operation",
2030
- type: "options",
2031
- displayOptions: {
2032
- show: {
2033
- resource: ["individualReference2"]
2034
- }
2035
- },
2036
- options: [
2037
- {
2038
- name: "Get Many",
2039
- value: "getAll",
2040
- description: "Retrieve all individual references 2",
2041
- action: "Get many individual references 2"
2042
- },
2043
- {
2044
- name: "Create",
2045
- value: "create",
2046
- description: "Create a new individual reference 2",
2047
- action: "Create individual reference 2"
2048
- }
2049
- ],
2050
- default: "getAll"
2051
- },
2052
- {
2053
- displayName: "Operation",
2054
- name: "operation",
2055
- type: "options",
2056
- displayOptions: {
2057
- show: {
2058
- resource: ["info"]
2059
- }
2060
- },
2061
- options: [
2062
- {
2063
- name: "Get",
2064
- value: "get",
2065
- description: "Get system information",
2066
- action: "Get system info"
2067
- }
2068
- ],
2069
- default: "get"
2070
- },
2071
- {
2072
- displayName: "Document ID",
2073
- name: "documentId",
2074
- type: "string",
2075
- required: true,
2076
- displayOptions: {
2077
- show: {
2078
- resource: ["document"],
2079
- operation: [
2080
- "get",
2081
- "update",
2082
- "delete",
2083
- "deletePermanently",
2084
- "getStructureItems",
2085
- "addStructureItem",
2086
- "getStructureItem",
2087
- "updateStructureItem",
2088
- "createDispatcherInformation"
2089
- ]
2090
- }
2091
- },
2092
- default: "",
2093
- description: "The unique ID of the document"
2094
- },
2095
- {
2096
- displayName: "Document File ID",
2097
- name: "documentFileId",
2098
- type: "string",
2099
- required: true,
2100
- displayOptions: {
2101
- show: {
2102
- resource: ["documentFile"],
2103
- operation: ["get"]
2104
- }
2105
- },
2106
- default: "",
2107
- description: "The unique ID of the document file"
2108
- },
2109
- {
2110
- displayName: "State ID",
2111
- name: "stateId",
2112
- type: "string",
2113
- required: true,
2114
- displayOptions: {
2115
- show: {
2116
- resource: ["documentState"],
2117
- operation: ["get"]
2118
- }
2119
- },
2120
- default: "",
2121
- description: "The unique ID of the document state"
2122
- },
2123
- {
2124
- displayName: "Structure Item ID",
2125
- name: "structureItemId",
2126
- type: "string",
2127
- required: true,
2128
- displayOptions: {
2129
- show: {
2130
- resource: ["document"],
2131
- operation: ["getStructureItem", "updateStructureItem"]
2132
- }
2133
- },
2134
- default: "",
2135
- description: "The unique ID of the structure item"
2136
- },
2137
- {
2138
- displayName: "Document Data",
2139
- name: "documentData",
2140
- type: "json",
2141
- required: true,
2142
- displayOptions: {
2143
- show: {
2144
- resource: ["document"],
2145
- operation: ["create", "update"]
2146
- }
2147
- },
2148
- default: "{}",
2149
- description: "The document data as JSON"
2150
- },
2151
- {
2152
- displayName: "Binary Data",
2153
- name: "binaryData",
2154
- type: "string",
2155
- required: true,
2156
- displayOptions: {
2157
- show: {
2158
- resource: ["documentFile"],
2159
- operation: ["upload"]
2160
- }
2161
- },
2162
- default: "",
2163
- description: "The binary file data to upload (application/octet-stream format)",
2164
- placeholder: "Binary file content"
2165
- },
2166
- {
2167
- displayName: "Structure Item Data",
2168
- name: "structureItemData",
2169
- type: "json",
2170
- required: true,
2171
- displayOptions: {
2172
- show: {
2173
- resource: ["document"],
2174
- operation: ["addStructureItem", "updateStructureItem"]
2175
- }
2176
- },
2177
- default: "{}",
2178
- description: "The structure item data as JSON"
2179
- },
2180
- {
2181
- displayName: "State Data",
2182
- name: "stateData",
2183
- type: "json",
2184
- required: true,
2185
- displayOptions: {
2186
- show: {
2187
- resource: ["documentState"],
2188
- operation: ["create"]
2189
- }
2190
- },
2191
- default: "{}",
2192
- description: "The state data as JSON"
2193
- },
2194
- {
2195
- displayName: "Dispatcher Data",
2196
- name: "dispatcherData",
2197
- type: "json",
2198
- required: true,
2199
- displayOptions: {
2200
- show: {
2201
- resource: ["document"],
2202
- operation: ["createDispatcherInformation"]
2203
- }
2204
- },
2205
- default: "{}",
2206
- description: "The dispatcher information data as JSON"
2207
- },
2208
- {
2209
- displayName: "Individual Reference Data",
2210
- name: "individualReferenceData",
2211
- type: "json",
2212
- required: true,
2213
- displayOptions: {
2214
- show: {
2215
- resource: ["individualReference1", "individualReference2"],
2216
- operation: ["create"]
2217
- }
2218
- },
2219
- default: "{}",
2220
- description: "The individual reference data as JSON"
2221
- },
2222
- {
2223
- displayName: "Filter",
2224
- name: "filter",
2225
- type: "string",
2226
- displayOptions: {
2227
- show: {
2228
- resource: ["document", "domain", "documentState", "propertyTemplate"],
2229
- operation: ["getAll"]
2230
- }
2231
- },
2232
- default: "",
2233
- description: "Filter expression to limit results"
2234
- },
2235
- {
2236
- displayName: "Top",
2237
- name: "top",
2238
- type: "number",
2239
- typeOptions: {
2240
- minValue: 0
2241
- },
2242
- displayOptions: {
2243
- show: {
2244
- resource: ["document", "individualReference1", "individualReference2"],
2245
- operation: ["getAll", "getStructureItems"]
2246
- }
2247
- },
2248
- default: 0,
2249
- description: "Maximum number of results to return (0 = no limit)"
2250
- },
2251
- {
2252
- displayName: "Skip",
2253
- name: "skip",
2254
- type: "number",
2255
- typeOptions: {
2256
- minValue: 0
2257
- },
2258
- displayOptions: {
2259
- show: {
2260
- resource: ["document", "individualReference1", "individualReference2"],
2261
- operation: ["getAll", "getStructureItems"]
2262
- }
2263
- },
2264
- default: 0,
2265
- description: "Number of results to skip"
2266
- },
2267
- {
2268
- displayName: "Insert Position",
2269
- name: "insertPosition",
2270
- type: "options",
2271
- options: [
2272
- {
2273
- name: "First",
2274
- value: "first"
2275
- },
2276
- {
2277
- name: "Last",
2278
- value: "last"
2279
- }
2280
- ],
2281
- displayOptions: {
2282
- show: {
2283
- resource: ["document"],
2284
- operation: ["addStructureItem"]
2285
- }
2286
- },
2287
- default: "last",
2288
- description: "Position where to insert the structure item"
2289
- }
2290
- ]
2291
- };
2292
-
2293
- // nodes/DocumentManagement/handlers/DocumentResourceHandler.ts
2294
- var import_n8n_workflow2 = require("n8n-workflow");
2295
-
2296
- // src/services/documentManagementClient.ts
2297
- var DOCUMENT_MANAGEMENT_BASE_PATH = "/datevconnect/dms/v2";
2298
-
2299
- class DocumentManagementClient {
2300
- static async authenticate(options) {
2301
- return authenticate(options);
2302
- }
2303
- static async fetchDocuments(options) {
2304
- const fetchImpl = options.fetchImpl || fetch;
2305
- const queryParams = new URLSearchParams;
2306
- if (options.filter)
2307
- queryParams.append("filter", options.filter);
2308
- if (options.top)
2309
- queryParams.append("top", options.top.toString());
2310
- if (options.skip)
2311
- queryParams.append("skip", options.skip.toString());
2312
- const url = `${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
2313
- const response = await fetchImpl(url, {
2314
- method: "GET",
2315
- headers: {
2316
- Authorization: `Bearer ${options.token}`,
2317
- "x-client-instance-id": options.clientInstanceId,
2318
- Accept: "application/json;charset=utf-8"
2319
- }
2320
- });
2321
- if (!response.ok) {
2322
- throw new Error(`Failed to fetch documents: ${response.status} ${response.statusText}`);
2323
- }
2324
- return await response.json();
2325
- }
2326
- static async fetchDocument(options) {
2327
- const fetchImpl = options.fetchImpl || fetch;
2328
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${encodeURIComponent(options.documentId)}`, {
2329
- method: "GET",
2330
- headers: {
2331
- Authorization: `Bearer ${options.token}`,
2332
- "x-client-instance-id": options.clientInstanceId,
2333
- Accept: "application/json;charset=utf-8"
2334
- }
2335
- });
2336
- if (!response.ok) {
2337
- throw new Error(`Failed to fetch document: ${response.status} ${response.statusText}`);
2338
- }
2339
- return await response.json();
2340
- }
2341
- static async createDocument(options) {
2342
- const fetchImpl = options.fetchImpl || fetch;
2343
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents`, {
2344
- method: "POST",
2345
- headers: {
2346
- Authorization: `Bearer ${options.token}`,
2347
- "x-client-instance-id": options.clientInstanceId,
2348
- "Content-Type": "application/json;charset=utf-8",
2349
- Accept: "application/json;charset=utf-8"
2350
- },
2351
- body: JSON.stringify(options.document)
2352
- });
2353
- if (!response.ok) {
2354
- throw new Error(`Failed to create document: ${response.status} ${response.statusText}`);
2355
- }
2356
- if (response.status === 201) {
2357
- const location = response.headers.get("Location");
2358
- return { success: true, location };
2359
- }
2360
- return await response.json();
2361
- }
2362
- static async updateDocument(options) {
2363
- const fetchImpl = options.fetchImpl || fetch;
2364
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${encodeURIComponent(options.documentId)}`, {
2365
- method: "PUT",
2366
- headers: {
2367
- Authorization: `Bearer ${options.token}`,
2368
- "x-client-instance-id": options.clientInstanceId,
2369
- "Content-Type": "application/json;charset=utf-8",
2370
- Accept: "application/json;charset=utf-8"
2371
- },
2372
- body: JSON.stringify(options.document)
2373
- });
2374
- if (!response.ok) {
2375
- throw new Error(`Failed to update document: ${response.status} ${response.statusText}`);
2376
- }
2377
- if (response.status === 204) {
2378
- return { success: true, documentId: options.documentId };
2379
- }
2380
- return await response.json();
2381
- }
2382
- static async fetchDocumentFile(options) {
2383
- const fetchImpl = options.fetchImpl || fetch;
2384
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/document-files/${encodeURIComponent(options.fileId)}`, {
2385
- method: "GET",
2386
- headers: {
2387
- Authorization: `Bearer ${options.token}`,
2388
- "x-client-instance-id": options.clientInstanceId,
2389
- Accept: "application/octet-stream"
2390
- }
2391
- });
2392
- if (!response.ok) {
2393
- throw new Error(`Failed to fetch document file: ${response.status} ${response.statusText}`);
2394
- }
2395
- return response;
2396
- }
2397
- static async uploadDocumentFile(options) {
2398
- const fetchImpl = options.fetchImpl || fetch;
2399
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/document-files`, {
2400
- method: "POST",
2401
- headers: {
2402
- Authorization: `Bearer ${options.token}`,
2403
- "x-client-instance-id": options.clientInstanceId,
2404
- "Content-Type": "application/octet-stream",
2405
- Accept: "application/json;charset=utf-8"
2406
- },
2407
- body: options.binaryData
2408
- });
2409
- if (!response.ok) {
2410
- throw new Error(`Failed to upload document file: ${response.status} ${response.statusText}`);
2411
- }
2412
- return await response.json();
2413
- }
2414
- static async fetchDomains(options) {
2415
- const fetchImpl = options.fetchImpl || fetch;
2416
- const queryParams = new URLSearchParams;
2417
- if (options.filter)
2418
- queryParams.append("filter", options.filter);
2419
- const url = `${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/domains${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
2420
- const response = await fetchImpl(url, {
2421
- method: "GET",
2422
- headers: {
2423
- Authorization: `Bearer ${options.token}`,
2424
- "x-client-instance-id": options.clientInstanceId,
2425
- Accept: "application/json;charset=utf-8"
2426
- }
2427
- });
2428
- if (!response.ok) {
2429
- throw new Error(`Failed to fetch domains: ${response.status} ${response.statusText}`);
2430
- }
2431
- return await response.json();
2432
- }
2433
- static async fetchDocumentStates(options) {
2434
- const fetchImpl = options.fetchImpl || fetch;
2435
- const queryParams = new URLSearchParams;
2436
- if (options.filter)
2437
- queryParams.append("filter", options.filter);
2438
- const url = `${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documentstates${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
2439
- const response = await fetchImpl(url, {
2440
- method: "GET",
2441
- headers: {
2442
- Authorization: `Bearer ${options.token}`,
2443
- "x-client-instance-id": options.clientInstanceId,
2444
- Accept: "application/json;charset=utf-8"
2445
- }
2446
- });
2447
- if (!response.ok) {
2448
- throw new Error(`Failed to fetch document states: ${response.status} ${response.statusText}`);
2449
- }
2450
- return await response.json();
2451
- }
2452
- static async fetchDocumentState(options) {
2453
- const fetchImpl = options.fetchImpl || fetch;
2454
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documentstates/${encodeURIComponent(options.stateId)}`, {
2455
- method: "GET",
2456
- headers: {
2457
- Authorization: `Bearer ${options.token}`,
2458
- "x-client-instance-id": options.clientInstanceId,
2459
- Accept: "application/json;charset=utf-8"
2460
- }
2461
- });
2462
- if (!response.ok) {
2463
- throw new Error(`Failed to fetch document state: ${response.status} ${response.statusText}`);
2464
- }
2465
- return await response.json();
2466
- }
2467
- static async createDocumentState(options) {
2468
- const fetchImpl = options.fetchImpl || fetch;
2469
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documentstates`, {
2470
- method: "POST",
2471
- headers: {
2472
- Authorization: `Bearer ${options.token}`,
2473
- "x-client-instance-id": options.clientInstanceId,
2474
- "Content-Type": "application/json;charset=utf-8",
2475
- Accept: "application/json;charset=utf-8"
2476
- },
2477
- body: JSON.stringify(options.state)
2478
- });
2479
- if (!response.ok) {
2480
- throw new Error(`Failed to create document state: ${response.status} ${response.statusText}`);
2481
- }
2482
- return await response.json();
2483
- }
2484
- static async fetchInfo(options) {
2485
- const fetchImpl = options.fetchImpl || fetch;
2486
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/info`, {
2487
- method: "GET",
2488
- headers: {
2489
- Authorization: `Bearer ${options.token}`,
2490
- "x-client-instance-id": options.clientInstanceId,
2491
- Accept: "application/json;charset=utf-8"
2492
- }
2493
- });
2494
- if (!response.ok) {
2495
- throw new Error(`Failed to fetch info: ${response.status} ${response.statusText}`);
2496
- }
2497
- return await response.json();
2498
- }
2499
- static async deleteDocument(options) {
2500
- const fetchImpl = options.fetchImpl || fetch;
2501
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${options.documentId}`, {
2502
- method: "DELETE",
2503
- headers: {
2504
- Authorization: `Bearer ${options.token}`,
2505
- "x-client-instance-id": options.clientInstanceId
2506
- }
2507
- });
2508
- if (!response.ok) {
2509
- throw new Error(`Failed to delete document: ${response.status} ${response.statusText}`);
2510
- }
2511
- }
2512
- static async deleteDocumentPermanently(options) {
2513
- const fetchImpl = options.fetchImpl || fetch;
2514
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${options.documentId}/delete-permanently`, {
2515
- method: "DELETE",
2516
- headers: {
2517
- Authorization: `Bearer ${options.token}`,
2518
- "x-client-instance-id": options.clientInstanceId
2519
- }
2520
- });
2521
- if (!response.ok) {
2522
- throw new Error(`Failed to permanently delete document: ${response.status} ${response.statusText}`);
2523
- }
2524
- }
2525
- static async fetchSecureAreas(options) {
2526
- const fetchImpl = options.fetchImpl || fetch;
2527
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/secure-areas`, {
2528
- method: "GET",
2529
- headers: {
2530
- Authorization: `Bearer ${options.token}`,
2531
- "x-client-instance-id": options.clientInstanceId,
2532
- Accept: "application/json;charset=utf-8"
2533
- }
2534
- });
2535
- if (!response.ok) {
2536
- throw new Error(`Failed to fetch secure areas: ${response.status} ${response.statusText}`);
2537
- }
2538
- return await response.json();
2539
- }
2540
- static async fetchPropertyTemplates(options) {
2541
- const fetchImpl = options.fetchImpl || fetch;
2542
- const queryParams = new URLSearchParams;
2543
- if (options.filter)
2544
- queryParams.append("filter", options.filter);
2545
- const url = `${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/property-templates${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
2546
- const response = await fetchImpl(url, {
2547
- method: "GET",
2548
- headers: {
2549
- Authorization: `Bearer ${options.token}`,
2550
- "x-client-instance-id": options.clientInstanceId,
2551
- Accept: "application/json;charset=utf-8"
2552
- }
2553
- });
2554
- if (!response.ok) {
2555
- throw new Error(`Failed to fetch property templates: ${response.status} ${response.statusText}`);
2556
- }
2557
- return await response.json();
2558
- }
2559
- static async fetchIndividualProperties(options) {
2560
- const fetchImpl = options.fetchImpl || fetch;
2561
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/individual-properties`, {
2562
- method: "GET",
2563
- headers: {
2564
- Authorization: `Bearer ${options.token}`,
2565
- "x-client-instance-id": options.clientInstanceId,
2566
- Accept: "application/json;charset=utf-8"
2567
- }
2568
- });
2569
- if (!response.ok) {
2570
- throw new Error(`Failed to fetch individual properties: ${response.status} ${response.statusText}`);
2571
- }
2572
- return await response.json();
2573
- }
2574
- static async fetchIndividualReferences1(options) {
2575
- const fetchImpl = options.fetchImpl || fetch;
2576
- const queryParams = new URLSearchParams;
2577
- if (options.top)
2578
- queryParams.append("top", options.top.toString());
2579
- if (options.skip)
2580
- queryParams.append("skip", options.skip.toString());
2581
- const url = `${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/individual-references1${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
2582
- const response = await fetchImpl(url, {
2583
- method: "GET",
2584
- headers: {
2585
- Authorization: `Bearer ${options.token}`,
2586
- "x-client-instance-id": options.clientInstanceId,
2587
- Accept: "application/json;charset=utf-8"
2588
- }
2589
- });
2590
- if (!response.ok) {
2591
- throw new Error(`Failed to fetch individual references 1: ${response.status} ${response.statusText}`);
2592
- }
2593
- return await response.json();
2594
- }
2595
- static async createIndividualReference1(options) {
2596
- const fetchImpl = options.fetchImpl || fetch;
2597
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/individual-references1`, {
2598
- method: "POST",
2599
- headers: {
2600
- Authorization: `Bearer ${options.token}`,
2601
- "x-client-instance-id": options.clientInstanceId,
2602
- Accept: "application/json;charset=utf-8",
2603
- "Content-Type": "application/json;charset=utf-8"
2604
- },
2605
- body: JSON.stringify(options.individualReference)
2606
- });
2607
- if (!response.ok) {
2608
- throw new Error(`Failed to create individual reference 1: ${response.status} ${response.statusText}`);
2609
- }
2610
- return await response.json();
2611
- }
2612
- static async fetchIndividualReferences2(options) {
2613
- const fetchImpl = options.fetchImpl || fetch;
2614
- const queryParams = new URLSearchParams;
2615
- if (options.top)
2616
- queryParams.append("top", options.top.toString());
2617
- if (options.skip)
2618
- queryParams.append("skip", options.skip.toString());
2619
- const url = `${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/individual-references2${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
2620
- const response = await fetchImpl(url, {
2621
- method: "GET",
2622
- headers: {
2623
- Authorization: `Bearer ${options.token}`,
2624
- "x-client-instance-id": options.clientInstanceId,
2625
- Accept: "application/json;charset=utf-8"
2626
- }
2627
- });
2628
- if (!response.ok) {
2629
- throw new Error(`Failed to fetch individual references 2: ${response.status} ${response.statusText}`);
2630
- }
2631
- return await response.json();
2632
- }
2633
- static async createIndividualReference2(options) {
2634
- const fetchImpl = options.fetchImpl || fetch;
2635
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/individual-references2`, {
2636
- method: "POST",
2637
- headers: {
2638
- Authorization: `Bearer ${options.token}`,
2639
- "x-client-instance-id": options.clientInstanceId,
2640
- Accept: "application/json;charset=utf-8",
2641
- "Content-Type": "application/json;charset=utf-8"
2642
- },
2643
- body: JSON.stringify(options.individualReference)
2644
- });
2645
- if (!response.ok) {
2646
- throw new Error(`Failed to create individual reference 2: ${response.status} ${response.statusText}`);
2647
- }
2648
- return await response.json();
2649
- }
2650
- static async fetchStructureItems(options) {
2651
- const fetchImpl = options.fetchImpl || fetch;
2652
- const queryParams = new URLSearchParams;
2653
- if (options.top)
2654
- queryParams.append("top", options.top.toString());
2655
- if (options.skip)
2656
- queryParams.append("skip", options.skip.toString());
2657
- const url = `${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${encodeURIComponent(options.documentId)}/structure-items${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
2658
- const response = await fetchImpl(url, {
2659
- method: "GET",
2660
- headers: {
2661
- Authorization: `Bearer ${options.token}`,
2662
- "x-client-instance-id": options.clientInstanceId,
2663
- Accept: "application/json;charset=utf-8"
2664
- }
2665
- });
2666
- if (!response.ok) {
2667
- throw new Error(`Failed to fetch structure items: ${response.status} ${response.statusText}`);
2668
- }
2669
- return await response.json();
2670
- }
2671
- static async fetchStructureItem(options) {
2672
- const fetchImpl = options.fetchImpl || fetch;
2673
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${encodeURIComponent(options.documentId)}/structure-items/${encodeURIComponent(options.structureItemId)}`, {
2674
- method: "GET",
2675
- headers: {
2676
- Authorization: `Bearer ${options.token}`,
2677
- "x-client-instance-id": options.clientInstanceId,
2678
- Accept: "application/json;charset=utf-8"
2679
- }
2680
- });
2681
- if (!response.ok) {
2682
- throw new Error(`Failed to fetch structure item: ${response.status} ${response.statusText}`);
2683
- }
2684
- return await response.json();
2685
- }
2686
- static async addStructureItem(options) {
2687
- const fetchImpl = options.fetchImpl || fetch;
2688
- const queryParams = new URLSearchParams;
2689
- if (options.insertPosition)
2690
- queryParams.append("insertPosition", options.insertPosition);
2691
- const url = `${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${encodeURIComponent(options.documentId)}/structure-items${queryParams.toString() ? `?${queryParams.toString()}` : ""}`;
2692
- const response = await fetchImpl(url, {
2693
- method: "POST",
2694
- headers: {
2695
- Authorization: `Bearer ${options.token}`,
2696
- "x-client-instance-id": options.clientInstanceId,
2697
- "Content-Type": "application/json;charset=utf-8",
2698
- Accept: "application/json;charset=utf-8"
2699
- },
2700
- body: JSON.stringify(options.structureItem)
2701
- });
2702
- if (!response.ok) {
2703
- throw new Error(`Failed to add structure item: ${response.status} ${response.statusText}`);
2704
- }
2705
- if (response.status === 201) {
2706
- const location = response.headers.get("Location");
2707
- return { success: true, location };
2708
- }
2709
- return await response.json();
2710
- }
2711
- static async updateStructureItem(options) {
2712
- const fetchImpl = options.fetchImpl || fetch;
2713
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${encodeURIComponent(options.documentId)}/structure-items/${encodeURIComponent(options.structureItemId)}`, {
2714
- method: "PUT",
2715
- headers: {
2716
- Authorization: `Bearer ${options.token}`,
2717
- "x-client-instance-id": options.clientInstanceId,
2718
- "Content-Type": "application/json;charset=utf-8",
2719
- Accept: "application/json;charset=utf-8"
2720
- },
2721
- body: JSON.stringify(options.structureItem)
2722
- });
2723
- if (!response.ok) {
2724
- throw new Error(`Failed to update structure item: ${response.status} ${response.statusText}`);
2725
- }
2726
- if (response.status === 204) {
2727
- return { success: true, documentId: options.documentId, structureItemId: options.structureItemId };
2728
- }
2729
- return await response.json();
2730
- }
2731
- static async createDispatcherInformation(options) {
2732
- const fetchImpl = options.fetchImpl || fetch;
2733
- const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${encodeURIComponent(options.documentId)}/dispatcher-information`, {
2734
- method: "POST",
2735
- headers: {
2736
- Authorization: `Bearer ${options.token}`,
2737
- "x-client-instance-id": options.clientInstanceId,
2738
- "Content-Type": "application/json;charset=utf-8",
2739
- Accept: "application/json;charset=utf-8"
2740
- },
2741
- body: JSON.stringify(options.dispatcherInformation)
2742
- });
2743
- if (!response.ok) {
2744
- throw new Error(`Failed to create dispatcher information: ${response.status} ${response.statusText}`);
2745
- }
2746
- if (response.status === 201) {
2747
- const location = response.headers.get("Location");
2748
- return { success: true, location };
2749
- }
2750
- return await response.json();
2751
- }
2752
- }
2753
-
2754
- // nodes/DocumentManagement/handlers/BaseResourceHandler.ts
2755
- var import_n8n_workflow = require("n8n-workflow");
2756
-
2757
- // nodes/DocumentManagement/utils.ts
2758
- function toErrorObject(error) {
2759
- if (error instanceof Error) {
2760
- return { message: error.message };
2761
- }
2762
- if (typeof error === "string") {
2763
- return { message: error };
2764
- }
2765
- if (error && typeof error === "object" && "message" in error) {
2766
- return { message: String(error.message) };
2767
- }
2768
- return { message: "An unknown error occurred" };
2769
- }
2770
- function toErrorMessage(error) {
2771
- return toErrorObject(error).message;
2772
- }
2773
- function normaliseToObjects(data) {
2774
- if (data === null || data === undefined) {
2775
- return [];
2776
- }
2777
- if (Array.isArray(data)) {
2778
- return data.map((item) => {
2779
- if (item === null || item === undefined) {
2780
- return {};
2781
- }
2782
- if (typeof item === "object") {
2783
- return item;
2784
- }
2785
- return { value: item };
2786
- });
2787
- }
2788
- if (typeof data === "object") {
2789
- return [data];
2790
- }
2791
- return [{ value: data }];
2792
- }
2793
- function parseJsonParameter(value, parameterName, _context, _itemIndex) {
2794
- if (typeof value === "string") {
2795
- try {
2796
- return JSON.parse(value);
2797
- } catch (error) {
2798
- throw new Error(`Invalid JSON in parameter '${parameterName}': ${toErrorMessage(error)}`);
2799
- }
2800
- }
2801
- return value;
2802
- }
2803
- function getOptionalString(context, parameterName, itemIndex) {
2804
- const value = context.getNodeParameter(parameterName, itemIndex, "");
2805
- return value.trim() || undefined;
2806
- }
2807
- function getRequiredString(context, parameterName, itemIndex) {
2808
- const value = getOptionalString(context, parameterName, itemIndex);
2809
- if (!value) {
2810
- throw new Error(`Parameter '${parameterName}' is required`);
2811
- }
2812
- return value;
2813
- }
2814
- function getNumberParameter(context, parameterName, itemIndex, defaultValue) {
2815
- const value = context.getNodeParameter(parameterName, itemIndex, defaultValue);
2816
- return value;
2817
- }
2818
- function buildQueryParams(params) {
2819
- const query = {};
2820
- for (const [key, value] of Object.entries(params)) {
2821
- if (value !== undefined && value !== null && value !== "") {
2822
- query[key] = String(value);
2823
- }
2824
- }
2825
- return query;
2826
- }
2827
- function getRequiredJsonData(context, parameterName, itemIndex) {
2828
- const rawValue = context.getNodeParameter(parameterName, itemIndex);
2829
- if (!rawValue) {
2830
- throw new Error(`Parameter '${parameterName}' is required`);
2831
- }
2832
- return parseJsonParameter(rawValue, parameterName, context, itemIndex);
2833
- }
2834
-
2835
- // nodes/DocumentManagement/handlers/BaseResourceHandler.ts
2836
- class BaseResourceHandler {
2837
- context;
2838
- itemIndex;
2839
- constructor(context, itemIndex) {
2840
- this.context = context;
2841
- this.itemIndex = itemIndex;
2842
- }
2843
- async execute(operation, authContext, returnData) {
2844
- try {
2845
- const sendSuccess = (payload) => {
2846
- const data = payload ? normaliseToObjects(payload) : [{}];
2847
- data.forEach((item) => {
2848
- returnData.push({
2849
- json: {
2850
- success: true,
2851
- ...item
2852
- }
2853
- });
2854
- });
2855
- };
2856
- await this.executeOperation(operation, authContext, sendSuccess);
2857
- } catch (error) {
2858
- const continueOnFail = this.context.continueOnFail();
2859
- if (continueOnFail) {
2860
- returnData.push({
2861
- json: {
2862
- error: toErrorMessage(error)
2863
- }
2864
- });
2865
- } else {
2866
- if (error instanceof import_n8n_workflow.NodeApiError || error instanceof import_n8n_workflow.NodeOperationError) {
2867
- throw error;
2868
- }
2869
- throw new import_n8n_workflow.NodeApiError(this.context.getNode(), toErrorObject(error), {
2870
- itemIndex: this.itemIndex
2871
- });
2872
- }
2873
- }
2874
- }
2875
- async getCredentials() {
2876
- const credentials = await this.context.getCredentials("datevConnectApi");
2877
- if (!credentials) {
2878
- throw new import_n8n_workflow.NodeOperationError(this.context.getNode(), "DATEVconnect credentials are missing");
2879
- }
2880
- const { host, email, password, clientInstanceId } = credentials;
2881
- if (!host || !email || !password || !clientInstanceId) {
2882
- throw new import_n8n_workflow.NodeOperationError(this.context.getNode(), "All DATEVconnect credential fields must be provided");
2883
- }
2884
- return credentials;
2885
- }
2886
- createAuthContext(credentials, token) {
2887
- return {
2888
- host: credentials.host,
2889
- token,
2890
- clientInstanceId: credentials.clientInstanceId
2891
- };
2892
- }
2893
- getOptionalString(name) {
2894
- return getOptionalString(this.context, name, this.itemIndex);
2895
- }
2896
- getRequiredString(name) {
2897
- return getRequiredString(this.context, name, this.itemIndex);
2898
- }
2899
- getNumberParameter(name, defaultValue) {
2900
- return getNumberParameter(this.context, name, this.itemIndex, defaultValue);
2901
- }
2902
- parseJsonParameter(rawValue, parameterLabel) {
2903
- return parseJsonParameter(rawValue, parameterLabel, this.context, this.itemIndex);
2904
- }
2905
- getRequiredJsonData(name) {
2906
- return getRequiredJsonData(this.context, name, this.itemIndex);
2907
- }
2908
- buildQueryParams(params) {
2909
- return buildQueryParams(params);
2910
- }
2911
- validateRequestContext(authContext) {
2912
- if (!authContext.host || !authContext.token || !authContext.clientInstanceId) {
2913
- throw new import_n8n_workflow.NodeOperationError(this.context.getNode(), "Authentication context is incomplete");
2914
- }
2915
- }
2916
- }
2917
-
2918
- // nodes/DocumentManagement/handlers/DocumentResourceHandler.ts
2919
- class DocumentResourceHandler extends BaseResourceHandler {
2920
- async executeOperation(operation, authContext, sendSuccess) {
2921
- this.validateRequestContext(authContext);
2922
- switch (operation) {
2923
- case "getAll":
2924
- await this.getDocuments(authContext, sendSuccess);
2925
- break;
2926
- case "get":
2927
- await this.getDocument(authContext, sendSuccess);
2928
- break;
2929
- case "create":
2930
- await this.createDocument(authContext, sendSuccess);
2931
- break;
2932
- case "update":
2933
- await this.updateDocument(authContext, sendSuccess);
2934
- break;
2935
- case "delete":
2936
- await this.deleteDocument(authContext, sendSuccess);
2937
- break;
2938
- case "deletePermanently":
2939
- await this.deleteDocumentPermanently(authContext, sendSuccess);
2940
- break;
2941
- case "getStructureItems":
2942
- await this.getStructureItems(authContext, sendSuccess);
2943
- break;
2944
- case "addStructureItem":
2945
- await this.addStructureItem(authContext, sendSuccess);
2946
- break;
2947
- case "getStructureItem":
2948
- await this.getStructureItem(authContext, sendSuccess);
2949
- break;
2950
- case "updateStructureItem":
2951
- await this.updateStructureItem(authContext, sendSuccess);
2952
- break;
2953
- case "createDispatcherInformation":
2954
- await this.createDispatcherInformation(authContext, sendSuccess);
2955
- break;
2956
- default:
2957
- throw new import_n8n_workflow2.NodeOperationError(this.context.getNode(), `The operation "${operation}" is not supported for documents`);
2958
- }
2959
- }
2960
- async getDocuments(authContext, sendSuccess) {
2961
- const filter = this.getOptionalString("filter");
2962
- const top = this.getNumberParameter("top", 0);
2963
- const skip = this.getNumberParameter("skip", 0);
2964
- const response = await DocumentManagementClient.fetchDocuments({
2965
- host: authContext.host,
2966
- token: authContext.token,
2967
- clientInstanceId: authContext.clientInstanceId,
2968
- filter,
2969
- top: top || undefined,
2970
- skip: skip || undefined
2971
- });
2972
- sendSuccess(response);
2973
- }
2974
- async getDocument(authContext, sendSuccess) {
2975
- const documentId = this.getRequiredString("documentId");
2976
- const response = await DocumentManagementClient.fetchDocument({
2977
- host: authContext.host,
2978
- token: authContext.token,
2979
- clientInstanceId: authContext.clientInstanceId,
2980
- documentId
2981
- });
2982
- sendSuccess(response);
2983
- }
2984
- async createDocument(authContext, sendSuccess) {
2985
- const documentData = this.getRequiredJsonData("documentData");
2986
- const response = await DocumentManagementClient.createDocument({
2987
- host: authContext.host,
2988
- token: authContext.token,
2989
- clientInstanceId: authContext.clientInstanceId,
2990
- document: documentData
2991
- });
2992
- sendSuccess(response);
2993
- }
2994
- async updateDocument(authContext, sendSuccess) {
2995
- const documentId = this.getRequiredString("documentId");
2996
- const documentData = this.getRequiredJsonData("documentData");
2997
- const response = await DocumentManagementClient.updateDocument({
2998
- host: authContext.host,
2999
- token: authContext.token,
3000
- clientInstanceId: authContext.clientInstanceId,
3001
- documentId,
3002
- document: documentData
3003
- });
3004
- sendSuccess(response);
3005
- }
3006
- async deleteDocument(authContext, sendSuccess) {
3007
- const documentId = this.getRequiredString("documentId");
3008
- await DocumentManagementClient.deleteDocument({
3009
- host: authContext.host,
3010
- token: authContext.token,
3011
- clientInstanceId: authContext.clientInstanceId,
3012
- documentId
3013
- });
3014
- sendSuccess({ success: true, documentId, deleted: true });
3015
- }
3016
- async deleteDocumentPermanently(authContext, sendSuccess) {
3017
- const documentId = this.getRequiredString("documentId");
3018
- await DocumentManagementClient.deleteDocumentPermanently({
3019
- host: authContext.host,
3020
- token: authContext.token,
3021
- clientInstanceId: authContext.clientInstanceId,
3022
- documentId
3023
- });
3024
- sendSuccess({ success: true, documentId, permanentlyDeleted: true });
3025
- }
3026
- async getStructureItems(authContext, sendSuccess) {
3027
- const documentId = this.getRequiredString("documentId");
3028
- const top = this.getNumberParameter("top", 0);
3029
- const skip = this.getNumberParameter("skip", 0);
3030
- const response = await DocumentManagementClient.fetchStructureItems({
3031
- host: authContext.host,
3032
- token: authContext.token,
3033
- clientInstanceId: authContext.clientInstanceId,
3034
- documentId,
3035
- top: top || undefined,
3036
- skip: skip || undefined
3037
- });
3038
- sendSuccess(response);
3039
- }
3040
- async addStructureItem(authContext, sendSuccess) {
3041
- const documentId = this.getRequiredString("documentId");
3042
- const structureItemData = this.getRequiredJsonData("structureItemData");
3043
- const insertPosition = this.getOptionalString("insertPosition") || "last";
3044
- const response = await DocumentManagementClient.addStructureItem({
3045
- host: authContext.host,
3046
- token: authContext.token,
3047
- clientInstanceId: authContext.clientInstanceId,
3048
- documentId,
3049
- structureItem: structureItemData,
3050
- insertPosition
3051
- });
3052
- sendSuccess(response);
3053
- }
3054
- async getStructureItem(authContext, sendSuccess) {
3055
- const documentId = this.getRequiredString("documentId");
3056
- const structureItemId = this.getRequiredString("structureItemId");
3057
- const response = await DocumentManagementClient.fetchStructureItem({
3058
- host: authContext.host,
3059
- token: authContext.token,
3060
- clientInstanceId: authContext.clientInstanceId,
3061
- documentId,
3062
- structureItemId
3063
- });
3064
- sendSuccess(response);
3065
- }
3066
- async updateStructureItem(authContext, sendSuccess) {
3067
- const documentId = this.getRequiredString("documentId");
3068
- const structureItemId = this.getRequiredString("structureItemId");
3069
- const structureItemData = this.getRequiredJsonData("structureItemData");
3070
- const response = await DocumentManagementClient.updateStructureItem({
3071
- host: authContext.host,
3072
- token: authContext.token,
3073
- clientInstanceId: authContext.clientInstanceId,
3074
- documentId,
3075
- structureItemId,
3076
- structureItem: structureItemData
3077
- });
3078
- sendSuccess(response);
3079
- }
3080
- async createDispatcherInformation(authContext, sendSuccess) {
3081
- const documentId = this.getRequiredString("documentId");
3082
- const dispatcherData = this.getRequiredJsonData("dispatcherData");
3083
- const response = await DocumentManagementClient.createDispatcherInformation({
3084
- host: authContext.host,
3085
- token: authContext.token,
3086
- clientInstanceId: authContext.clientInstanceId,
3087
- documentId,
3088
- dispatcherInformation: dispatcherData
3089
- });
3090
- sendSuccess(response);
3091
- }
3092
- }
3093
-
3094
- // nodes/DocumentManagement/handlers/DocumentFileResourceHandler.ts
3095
- var import_n8n_workflow3 = require("n8n-workflow");
3096
- class DocumentFileResourceHandler extends BaseResourceHandler {
3097
- executeOperation(_operation, _authContext, _sendSuccess) {
3098
- throw new Error("Method not implemented.");
3099
- }
3100
- async execute(operation, authContext, returnData) {
3101
- try {
3102
- this.validateRequestContext(authContext);
3103
- switch (operation) {
3104
- case "get":
3105
- await this.getDocumentFileBinary(authContext, returnData);
3106
- break;
3107
- case "upload": {
3108
- const sendSuccess = (payload) => {
3109
- const data = payload ? normaliseToObjects(payload) : [{}];
3110
- data.forEach((item) => {
3111
- returnData.push({
3112
- json: {
3113
- success: true,
3114
- ...item
3115
- }
3116
- });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DocumentManagement = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const datevConnectClient_1 = require("../../src/services/datevConnectClient");
6
+ const DocumentManagement_config_1 = require("./DocumentManagement.config");
7
+ const DocumentResourceHandler_1 = require("./handlers/DocumentResourceHandler");
8
+ const DocumentFileResourceHandler_1 = require("./handlers/DocumentFileResourceHandler");
9
+ const DomainResourceHandler_1 = require("./handlers/DomainResourceHandler");
10
+ const DocumentStateResourceHandler_1 = require("./handlers/DocumentStateResourceHandler");
11
+ const InfoResourceHandler_1 = require("./handlers/InfoResourceHandler");
12
+ const SecureAreaResourceHandler_1 = require("./handlers/SecureAreaResourceHandler");
13
+ const PropertyTemplateResourceHandler_1 = require("./handlers/PropertyTemplateResourceHandler");
14
+ const IndividualPropertyResourceHandler_1 = require("./handlers/IndividualPropertyResourceHandler");
15
+ const IndividualReference1ResourceHandler_1 = require("./handlers/IndividualReference1ResourceHandler");
16
+ const IndividualReference2ResourceHandler_1 = require("./handlers/IndividualReference2ResourceHandler");
17
+ const utils_1 = require("./utils");
18
+ class DocumentManagement {
19
+ constructor() {
20
+ var _a;
21
+ this.description = {
22
+ ...DocumentManagement_config_1.documentManagementNodeDescription,
23
+ icon: (_a = DocumentManagement_config_1.documentManagementNodeDescription.icon) !== null && _a !== void 0 ? _a : "file:../klardaten.svg",
24
+ usableAsTool: true,
25
+ };
26
+ }
27
+ async execute() {
28
+ const items = this.getInputData();
29
+ const returnData = [];
30
+ // Get and validate credentials
31
+ const credentials = (await this.getCredentials("datevConnectApi"));
32
+ if (!credentials) {
33
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), "DATEVconnect credentials are missing");
34
+ }
35
+ const { host, email, password, clientInstanceId } = credentials;
36
+ if (!host || !email || !password || !clientInstanceId) {
37
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), "All DATEVconnect credential fields must be provided");
38
+ }
39
+ // Authenticate once for all items
40
+ let token;
41
+ try {
42
+ const authResponse = await (0, datevConnectClient_1.authenticate)({
43
+ host,
44
+ email,
45
+ password,
3117
46
  });
3118
- };
3119
- await this.uploadDocumentFile(authContext, sendSuccess);
3120
- break;
3121
- }
3122
- default:
3123
- throw new import_n8n_workflow3.NodeOperationError(this.context.getNode(), `The operation "${operation}" is not supported for document files`);
3124
- }
3125
- } catch (error) {
3126
- const continueOnFail = this.context.continueOnFail();
3127
- if (continueOnFail) {
3128
- returnData.push({
3129
- json: {
3130
- error: toErrorMessage(error)
3131
- }
3132
- });
3133
- } else {
3134
- if (error instanceof Error) {
3135
- throw error;
47
+ token = authResponse.access_token;
48
+ }
49
+ catch (error) {
50
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), (0, utils_1.toErrorObject)(error));
51
+ }
52
+ // Create authentication context
53
+ const authContext = { host, token, clientInstanceId };
54
+ // Process each input item
55
+ for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
56
+ const resource = this.getNodeParameter("resource", itemIndex);
57
+ const operation = this.getNodeParameter("operation", itemIndex);
58
+ // Create appropriate resource handler
59
+ let handler;
60
+ switch (resource) {
61
+ case "document":
62
+ handler = new DocumentResourceHandler_1.DocumentResourceHandler(this, itemIndex);
63
+ break;
64
+ case "documentFile":
65
+ handler = new DocumentFileResourceHandler_1.DocumentFileResourceHandler(this, itemIndex);
66
+ break;
67
+ case "domain":
68
+ handler = new DomainResourceHandler_1.DomainResourceHandler(this, itemIndex);
69
+ break;
70
+ case "documentState":
71
+ handler = new DocumentStateResourceHandler_1.DocumentStateResourceHandler(this, itemIndex);
72
+ break;
73
+ case "info":
74
+ handler = new InfoResourceHandler_1.InfoResourceHandler(this, itemIndex);
75
+ break;
76
+ case "secureArea":
77
+ handler = new SecureAreaResourceHandler_1.SecureAreaResourceHandler(this, itemIndex);
78
+ break;
79
+ case "propertyTemplate":
80
+ handler = new PropertyTemplateResourceHandler_1.PropertyTemplateResourceHandler(this, itemIndex);
81
+ break;
82
+ case "individualProperty":
83
+ handler = new IndividualPropertyResourceHandler_1.IndividualPropertyResourceHandler(this, itemIndex);
84
+ break;
85
+ case "individualReference1":
86
+ handler = new IndividualReference1ResourceHandler_1.IndividualReference1ResourceHandler(this, itemIndex);
87
+ break;
88
+ case "individualReference2":
89
+ handler = new IndividualReference2ResourceHandler_1.IndividualReference2ResourceHandler(this, itemIndex);
90
+ break;
91
+ default:
92
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not supported.`, { itemIndex });
93
+ }
94
+ // Execute the operation using the handler
95
+ await handler.execute(operation, authContext, returnData);
3136
96
  }
3137
- throw new import_n8n_workflow3.NodeOperationError(this.context.getNode(), String(error), {
3138
- itemIndex: this.itemIndex
3139
- });
3140
- }
3141
- }
3142
- }
3143
- async getDocumentFileBinary(authContext, returnData) {
3144
- const documentFileId = this.getRequiredString("documentFileId");
3145
- const response = await DocumentManagementClient.fetchDocumentFile({
3146
- host: authContext.host,
3147
- token: authContext.token,
3148
- clientInstanceId: authContext.clientInstanceId,
3149
- fileId: documentFileId
3150
- });
3151
- const binaryData = await response.arrayBuffer();
3152
- const contentType = response.headers.get("content-type") || "application/octet-stream";
3153
- const binaryDataObject = {
3154
- data: Buffer.from(binaryData).toString("base64"),
3155
- mimeType: contentType,
3156
- fileName: documentFileId,
3157
- fileSize: binaryData.byteLength.toString()
3158
- };
3159
- returnData.push({
3160
- json: {
3161
- success: true,
3162
- id: documentFileId,
3163
- contentType,
3164
- size: binaryData.byteLength
3165
- },
3166
- binary: {
3167
- data: binaryDataObject
3168
- }
3169
- });
3170
- }
3171
- async uploadDocumentFile(authContext, sendSuccess) {
3172
- const inputData = this.context.getInputData();
3173
- const currentItem = inputData[this.itemIndex];
3174
- if (!currentItem?.binary?.data) {
3175
- throw new import_n8n_workflow3.NodeOperationError(this.context.getNode(), "No binary data found. Please provide binary data through the 'data' binary property.", { itemIndex: this.itemIndex });
3176
- }
3177
- const binaryDataObj = currentItem.binary.data;
3178
- const bufferData = Buffer.from(binaryDataObj.data, "base64");
3179
- const response = await DocumentManagementClient.uploadDocumentFile({
3180
- host: authContext.host,
3181
- token: authContext.token,
3182
- clientInstanceId: authContext.clientInstanceId,
3183
- binaryData: bufferData
3184
- });
3185
- sendSuccess(response);
3186
- }
3187
- }
3188
-
3189
- // nodes/DocumentManagement/handlers/DomainResourceHandler.ts
3190
- var import_n8n_workflow4 = require("n8n-workflow");
3191
- class DomainResourceHandler extends BaseResourceHandler {
3192
- async executeOperation(operation, authContext, sendSuccess) {
3193
- this.validateRequestContext(authContext);
3194
- switch (operation) {
3195
- case "getAll":
3196
- await this.getDomains(authContext, sendSuccess);
3197
- break;
3198
- default:
3199
- throw new import_n8n_workflow4.NodeOperationError(this.context.getNode(), `The operation "${operation}" is not supported for domains`);
3200
- }
3201
- }
3202
- async getDomains(authContext, sendSuccess) {
3203
- const filter = this.getOptionalString("filter");
3204
- const response = await DocumentManagementClient.fetchDomains({
3205
- host: authContext.host,
3206
- token: authContext.token,
3207
- clientInstanceId: authContext.clientInstanceId,
3208
- filter
3209
- });
3210
- sendSuccess(response);
3211
- }
3212
- }
3213
-
3214
- // nodes/DocumentManagement/handlers/DocumentStateResourceHandler.ts
3215
- var import_n8n_workflow5 = require("n8n-workflow");
3216
- class DocumentStateResourceHandler extends BaseResourceHandler {
3217
- async executeOperation(operation, authContext, sendSuccess) {
3218
- this.validateRequestContext(authContext);
3219
- switch (operation) {
3220
- case "getAll":
3221
- await this.getDocumentStates(authContext, sendSuccess);
3222
- break;
3223
- case "get":
3224
- await this.getDocumentState(authContext, sendSuccess);
3225
- break;
3226
- case "create":
3227
- await this.createDocumentState(authContext, sendSuccess);
3228
- break;
3229
- default:
3230
- throw new import_n8n_workflow5.NodeOperationError(this.context.getNode(), `The operation "${operation}" is not supported for document states`);
3231
- }
3232
- }
3233
- async getDocumentStates(authContext, sendSuccess) {
3234
- const filter = this.getOptionalString("filter");
3235
- const response = await DocumentManagementClient.fetchDocumentStates({
3236
- host: authContext.host,
3237
- token: authContext.token,
3238
- clientInstanceId: authContext.clientInstanceId,
3239
- filter
3240
- });
3241
- sendSuccess(response);
3242
- }
3243
- async getDocumentState(authContext, sendSuccess) {
3244
- const stateId = this.getRequiredString("stateId");
3245
- const response = await DocumentManagementClient.fetchDocumentState({
3246
- host: authContext.host,
3247
- token: authContext.token,
3248
- clientInstanceId: authContext.clientInstanceId,
3249
- stateId
3250
- });
3251
- sendSuccess(response);
3252
- }
3253
- async createDocumentState(authContext, sendSuccess) {
3254
- const stateData = this.getRequiredJsonData("stateData");
3255
- const response = await DocumentManagementClient.createDocumentState({
3256
- host: authContext.host,
3257
- token: authContext.token,
3258
- clientInstanceId: authContext.clientInstanceId,
3259
- state: stateData
3260
- });
3261
- sendSuccess(response);
3262
- }
3263
- }
3264
-
3265
- // nodes/DocumentManagement/handlers/InfoResourceHandler.ts
3266
- var import_n8n_workflow6 = require("n8n-workflow");
3267
- class InfoResourceHandler extends BaseResourceHandler {
3268
- async executeOperation(operation, authContext, sendSuccess) {
3269
- this.validateRequestContext(authContext);
3270
- switch (operation) {
3271
- case "get":
3272
- await this.getInfo(authContext, sendSuccess);
3273
- break;
3274
- default:
3275
- throw new import_n8n_workflow6.NodeOperationError(this.context.getNode(), `The operation "${operation}" is not supported for info`);
3276
- }
3277
- }
3278
- async getInfo(authContext, sendSuccess) {
3279
- const response = await DocumentManagementClient.fetchInfo({
3280
- host: authContext.host,
3281
- token: authContext.token,
3282
- clientInstanceId: authContext.clientInstanceId
3283
- });
3284
- sendSuccess(response);
3285
- }
3286
- }
3287
-
3288
- // nodes/DocumentManagement/handlers/SecureAreaResourceHandler.ts
3289
- var import_n8n_workflow7 = require("n8n-workflow");
3290
- class SecureAreaResourceHandler extends BaseResourceHandler {
3291
- async executeOperation(operation, authContext, sendSuccess) {
3292
- this.validateRequestContext(authContext);
3293
- switch (operation) {
3294
- case "getAll":
3295
- await this.getSecureAreas(authContext, sendSuccess);
3296
- break;
3297
- default:
3298
- throw new import_n8n_workflow7.NodeOperationError(this.context.getNode(), `Unsupported operation: ${operation}`, {
3299
- itemIndex: this.itemIndex
3300
- });
3301
- }
3302
- }
3303
- async getSecureAreas(authContext, sendSuccess) {
3304
- const response = await DocumentManagementClient.fetchSecureAreas({
3305
- host: authContext.host,
3306
- token: authContext.token,
3307
- clientInstanceId: authContext.clientInstanceId
3308
- });
3309
- sendSuccess(response);
3310
- }
3311
- }
3312
-
3313
- // nodes/DocumentManagement/handlers/PropertyTemplateResourceHandler.ts
3314
- var import_n8n_workflow8 = require("n8n-workflow");
3315
- class PropertyTemplateResourceHandler extends BaseResourceHandler {
3316
- async executeOperation(operation, authContext, sendSuccess) {
3317
- this.validateRequestContext(authContext);
3318
- switch (operation) {
3319
- case "getAll":
3320
- await this.getPropertyTemplates(authContext, sendSuccess);
3321
- break;
3322
- default:
3323
- throw new import_n8n_workflow8.NodeOperationError(this.context.getNode(), `Unsupported operation: ${operation}`, {
3324
- itemIndex: this.itemIndex
3325
- });
3326
- }
3327
- }
3328
- async getPropertyTemplates(authContext, sendSuccess) {
3329
- const filter = this.getOptionalString("filter");
3330
- const response = await DocumentManagementClient.fetchPropertyTemplates({
3331
- host: authContext.host,
3332
- token: authContext.token,
3333
- clientInstanceId: authContext.clientInstanceId,
3334
- filter
3335
- });
3336
- sendSuccess(response);
3337
- }
3338
- }
3339
-
3340
- // nodes/DocumentManagement/handlers/IndividualPropertyResourceHandler.ts
3341
- var import_n8n_workflow9 = require("n8n-workflow");
3342
- class IndividualPropertyResourceHandler extends BaseResourceHandler {
3343
- async executeOperation(operation, authContext, sendSuccess) {
3344
- this.validateRequestContext(authContext);
3345
- switch (operation) {
3346
- case "getAll":
3347
- await this.getIndividualProperties(authContext, sendSuccess);
3348
- break;
3349
- default:
3350
- throw new import_n8n_workflow9.NodeOperationError(this.context.getNode(), `Unsupported operation: ${operation}`, {
3351
- itemIndex: this.itemIndex
3352
- });
3353
- }
3354
- }
3355
- async getIndividualProperties(authContext, sendSuccess) {
3356
- const response = await DocumentManagementClient.fetchIndividualProperties({
3357
- host: authContext.host,
3358
- token: authContext.token,
3359
- clientInstanceId: authContext.clientInstanceId
3360
- });
3361
- sendSuccess(response);
3362
- }
3363
- }
3364
-
3365
- // nodes/DocumentManagement/handlers/IndividualReference1ResourceHandler.ts
3366
- var import_n8n_workflow10 = require("n8n-workflow");
3367
- class IndividualReference1ResourceHandler extends BaseResourceHandler {
3368
- async executeOperation(operation, authContext, sendSuccess) {
3369
- this.validateRequestContext(authContext);
3370
- switch (operation) {
3371
- case "getAll":
3372
- await this.getIndividualReferences1(authContext, sendSuccess);
3373
- break;
3374
- case "create":
3375
- await this.createIndividualReference1(authContext, sendSuccess);
3376
- break;
3377
- default:
3378
- throw new import_n8n_workflow10.NodeOperationError(this.context.getNode(), `Unsupported operation: ${operation}`, {
3379
- itemIndex: this.itemIndex
3380
- });
3381
- }
3382
- }
3383
- async getIndividualReferences1(authContext, sendSuccess) {
3384
- const top = this.getNumberParameter("top", 0);
3385
- const skip = this.getNumberParameter("skip", 0);
3386
- const response = await DocumentManagementClient.fetchIndividualReferences1({
3387
- host: authContext.host,
3388
- token: authContext.token,
3389
- clientInstanceId: authContext.clientInstanceId,
3390
- top: top || undefined,
3391
- skip: skip || undefined
3392
- });
3393
- sendSuccess(response);
3394
- }
3395
- async createIndividualReference1(authContext, sendSuccess) {
3396
- const individualReferenceData = this.getRequiredJsonData("individualReferenceData");
3397
- const response = await DocumentManagementClient.createIndividualReference1({
3398
- host: authContext.host,
3399
- token: authContext.token,
3400
- clientInstanceId: authContext.clientInstanceId,
3401
- individualReference: individualReferenceData
3402
- });
3403
- sendSuccess(response);
3404
- }
3405
- }
3406
-
3407
- // nodes/DocumentManagement/handlers/IndividualReference2ResourceHandler.ts
3408
- var import_n8n_workflow11 = require("n8n-workflow");
3409
- class IndividualReference2ResourceHandler extends BaseResourceHandler {
3410
- async executeOperation(operation, authContext, sendSuccess) {
3411
- this.validateRequestContext(authContext);
3412
- switch (operation) {
3413
- case "getAll":
3414
- await this.getIndividualReferences2(authContext, sendSuccess);
3415
- break;
3416
- case "create":
3417
- await this.createIndividualReference2(authContext, sendSuccess);
3418
- break;
3419
- default:
3420
- throw new import_n8n_workflow11.NodeOperationError(this.context.getNode(), `Unsupported operation: ${operation}`, {
3421
- itemIndex: this.itemIndex
3422
- });
3423
- }
3424
- }
3425
- async getIndividualReferences2(authContext, sendSuccess) {
3426
- const top = this.getNumberParameter("top", 0);
3427
- const skip = this.getNumberParameter("skip", 0);
3428
- const response = await DocumentManagementClient.fetchIndividualReferences2({
3429
- host: authContext.host,
3430
- token: authContext.token,
3431
- clientInstanceId: authContext.clientInstanceId,
3432
- top: top || undefined,
3433
- skip: skip || undefined
3434
- });
3435
- sendSuccess(response);
3436
- }
3437
- async createIndividualReference2(authContext, sendSuccess) {
3438
- const individualReferenceData = this.getRequiredJsonData("individualReferenceData");
3439
- const response = await DocumentManagementClient.createIndividualReference2({
3440
- host: authContext.host,
3441
- token: authContext.token,
3442
- clientInstanceId: authContext.clientInstanceId,
3443
- individualReference: individualReferenceData
3444
- });
3445
- sendSuccess(response);
3446
- }
3447
- }
3448
-
3449
- // nodes/DocumentManagement/DocumentManagement.node.ts
3450
- class DocumentManagement {
3451
- description = documentManagementNodeDescription;
3452
- async execute() {
3453
- const items = this.getInputData();
3454
- const returnData = [];
3455
- const credentials = await this.getCredentials("datevConnectApi");
3456
- if (!credentials) {
3457
- throw new import_n8n_workflow12.NodeOperationError(this.getNode(), "DATEVconnect credentials are missing");
3458
- }
3459
- const { host, email, password, clientInstanceId } = credentials;
3460
- if (!host || !email || !password || !clientInstanceId) {
3461
- throw new import_n8n_workflow12.NodeOperationError(this.getNode(), "All DATEVconnect credential fields must be provided");
3462
- }
3463
- let token;
3464
- try {
3465
- const authResponse = await authenticate({
3466
- host,
3467
- email,
3468
- password
3469
- });
3470
- token = authResponse.access_token;
3471
- } catch (error) {
3472
- throw new import_n8n_workflow12.NodeApiError(this.getNode(), toErrorObject(error));
3473
- }
3474
- const authContext = { host, token, clientInstanceId };
3475
- for (let itemIndex = 0;itemIndex < items.length; itemIndex++) {
3476
- const resource = this.getNodeParameter("resource", itemIndex);
3477
- const operation = this.getNodeParameter("operation", itemIndex);
3478
- let handler;
3479
- switch (resource) {
3480
- case "document":
3481
- handler = new DocumentResourceHandler(this, itemIndex);
3482
- break;
3483
- case "documentFile":
3484
- handler = new DocumentFileResourceHandler(this, itemIndex);
3485
- break;
3486
- case "domain":
3487
- handler = new DomainResourceHandler(this, itemIndex);
3488
- break;
3489
- case "documentState":
3490
- handler = new DocumentStateResourceHandler(this, itemIndex);
3491
- break;
3492
- case "info":
3493
- handler = new InfoResourceHandler(this, itemIndex);
3494
- break;
3495
- case "secureArea":
3496
- handler = new SecureAreaResourceHandler(this, itemIndex);
3497
- break;
3498
- case "propertyTemplate":
3499
- handler = new PropertyTemplateResourceHandler(this, itemIndex);
3500
- break;
3501
- case "individualProperty":
3502
- handler = new IndividualPropertyResourceHandler(this, itemIndex);
3503
- break;
3504
- case "individualReference1":
3505
- handler = new IndividualReference1ResourceHandler(this, itemIndex);
3506
- break;
3507
- case "individualReference2":
3508
- handler = new IndividualReference2ResourceHandler(this, itemIndex);
3509
- break;
3510
- default:
3511
- throw new import_n8n_workflow12.NodeOperationError(this.getNode(), `The resource "${resource}" is not supported.`, { itemIndex });
3512
- }
3513
- await handler.execute(operation, authContext, returnData);
97
+ return [returnData];
3514
98
  }
3515
- return [returnData];
3516
- }
3517
99
  }
100
+ exports.DocumentManagement = DocumentManagement;