@klardaten/n8n-nodes-datevconnect 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -3
- package/dist/nodes/Accounting/Accounting.node.d.ts.map +1 -1
- package/dist/nodes/Accounting/Accounting.node.js +7 -1
- package/dist/nodes/Accounting/types.d.ts +2 -0
- package/dist/nodes/Accounting/types.d.ts.map +1 -1
- package/dist/nodes/DocumentManagement/DocumentManagement.node.d.ts.map +1 -1
- package/dist/nodes/DocumentManagement/DocumentManagement.node.js +7 -1
- package/dist/nodes/DocumentManagement/types.d.ts +2 -1
- package/dist/nodes/DocumentManagement/types.d.ts.map +1 -1
- package/dist/nodes/IdentityAndAccessManagement/IdentityAndAccessManagement.node.d.ts.map +1 -1
- package/dist/nodes/IdentityAndAccessManagement/IdentityAndAccessManagement.node.js +7 -1
- package/dist/nodes/IdentityAndAccessManagement/types.d.ts +2 -1
- package/dist/nodes/IdentityAndAccessManagement/types.d.ts.map +1 -1
- package/dist/nodes/MasterData/MasterData.node.d.ts.map +1 -1
- package/dist/nodes/MasterData/MasterData.node.js +7 -1
- package/dist/nodes/MasterData/types.d.ts +2 -1
- package/dist/nodes/MasterData/types.d.ts.map +1 -1
- package/dist/nodes/OrderManagement/OrderManagement.config.d.ts +3 -0
- package/dist/nodes/OrderManagement/OrderManagement.config.d.ts.map +1 -0
- package/dist/nodes/OrderManagement/OrderManagement.config.js +644 -0
- package/dist/nodes/OrderManagement/OrderManagement.node.d.ts +6 -0
- package/dist/nodes/OrderManagement/OrderManagement.node.d.ts.map +1 -0
- package/dist/nodes/OrderManagement/OrderManagement.node.js +92 -0
- package/dist/nodes/OrderManagement/handlers/BaseResourceHandler.d.ts +17 -0
- package/dist/nodes/OrderManagement/handlers/BaseResourceHandler.d.ts.map +1 -0
- package/dist/nodes/OrderManagement/handlers/BaseResourceHandler.js +48 -0
- package/dist/nodes/OrderManagement/handlers/ClientGroupResourceHandler.d.ts +8 -0
- package/dist/nodes/OrderManagement/handlers/ClientGroupResourceHandler.d.ts.map +1 -0
- package/dist/nodes/OrderManagement/handlers/ClientGroupResourceHandler.js +32 -0
- package/dist/nodes/OrderManagement/handlers/CostCenterResourceHandler.d.ts +8 -0
- package/dist/nodes/OrderManagement/handlers/CostCenterResourceHandler.d.ts.map +1 -0
- package/dist/nodes/OrderManagement/handlers/CostCenterResourceHandler.js +38 -0
- package/dist/nodes/OrderManagement/handlers/EmployeeResourceHandler.d.ts +12 -0
- package/dist/nodes/OrderManagement/handlers/EmployeeResourceHandler.d.ts.map +1 -0
- package/dist/nodes/OrderManagement/handlers/EmployeeResourceHandler.js +106 -0
- package/dist/nodes/OrderManagement/handlers/FeeResourceHandler.d.ts +9 -0
- package/dist/nodes/OrderManagement/handlers/FeeResourceHandler.d.ts.map +1 -0
- package/dist/nodes/OrderManagement/handlers/FeeResourceHandler.js +55 -0
- package/dist/nodes/OrderManagement/handlers/InvoiceResourceHandler.d.ts +9 -0
- package/dist/nodes/OrderManagement/handlers/InvoiceResourceHandler.d.ts.map +1 -0
- package/dist/nodes/OrderManagement/handlers/InvoiceResourceHandler.js +49 -0
- package/dist/nodes/OrderManagement/handlers/OrderResourceHandler.d.ts +24 -0
- package/dist/nodes/OrderManagement/handlers/OrderResourceHandler.d.ts.map +1 -0
- package/dist/nodes/OrderManagement/handlers/OrderResourceHandler.js +285 -0
- package/dist/nodes/OrderManagement/handlers/OrderTypeResourceHandler.d.ts +8 -0
- package/dist/nodes/OrderManagement/handlers/OrderTypeResourceHandler.d.ts.map +1 -0
- package/dist/nodes/OrderManagement/handlers/OrderTypeResourceHandler.js +34 -0
- package/dist/nodes/OrderManagement/handlers/SelfClientResourceHandler.d.ts +8 -0
- package/dist/nodes/OrderManagement/handlers/SelfClientResourceHandler.d.ts.map +1 -0
- package/dist/nodes/OrderManagement/handlers/SelfClientResourceHandler.js +36 -0
- package/dist/nodes/OrderManagement/types.d.ts +28 -0
- package/dist/nodes/OrderManagement/types.d.ts.map +1 -0
- package/dist/nodes/OrderManagement/types.js +2 -0
- package/dist/nodes/OrderManagement/utils.d.ts +14 -0
- package/dist/nodes/OrderManagement/utils.d.ts.map +1 -0
- package/dist/nodes/OrderManagement/utils.js +79 -0
- package/dist/src/services/accountingClient.d.ts.map +1 -1
- package/dist/src/services/accountingClient.js +2 -0
- package/dist/src/services/datevConnectClient.d.ts +3 -22
- package/dist/src/services/datevConnectClient.d.ts.map +1 -1
- package/dist/src/services/datevConnectClient.js +96 -180
- package/dist/src/services/documentManagementClient.d.ts +3 -1
- package/dist/src/services/documentManagementClient.d.ts.map +1 -1
- package/dist/src/services/documentManagementClient.js +28 -27
- package/dist/src/services/httpHelpers.d.ts +10 -0
- package/dist/src/services/httpHelpers.d.ts.map +1 -0
- package/dist/src/services/httpHelpers.js +180 -0
- package/dist/src/services/identityAndAccessManagementClient.d.ts +2 -1
- package/dist/src/services/identityAndAccessManagementClient.d.ts.map +1 -1
- package/dist/src/services/identityAndAccessManagementClient.js +4 -1
- package/dist/src/services/orderManagementClient.d.ts +189 -0
- package/dist/src/services/orderManagementClient.d.ts.map +1 -0
- package/dist/src/services/orderManagementClient.js +459 -0
- package/dist/src/services/shared.d.ts +39 -0
- package/dist/src/services/shared.d.ts.map +1 -0
- package/dist/src/services/shared.js +110 -0
- package/package.json +6 -5
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { JsonValue } from './
|
|
1
|
+
import type { JsonValue, HttpRequestHelper } from './shared';
|
|
2
2
|
export interface DocumentManagementAuthenticateOptions {
|
|
3
3
|
host: string;
|
|
4
4
|
email: string;
|
|
5
5
|
password: string;
|
|
6
|
+
httpHelper?: HttpRequestHelper;
|
|
6
7
|
fetchImpl?: typeof fetch;
|
|
7
8
|
}
|
|
8
9
|
export interface DocumentManagementAuthenticateResponse extends Record<string, JsonValue> {
|
|
@@ -12,6 +13,7 @@ interface BaseDocumentManagementRequestOptions {
|
|
|
12
13
|
host: string;
|
|
13
14
|
token: string;
|
|
14
15
|
clientInstanceId: string;
|
|
16
|
+
httpHelper?: HttpRequestHelper;
|
|
15
17
|
fetchImpl?: typeof fetch;
|
|
16
18
|
}
|
|
17
19
|
export interface FetchDocumentsOptions extends BaseDocumentManagementRequestOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentManagementClient.d.ts","sourceRoot":"","sources":["../../../src/services/documentManagementClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"documentManagementClient.d.ts","sourceRoot":"","sources":["../../../src/services/documentManagementClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAI7D,MAAM,WAAW,qCAAqC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAED,MAAM,WAAW,sCAAuC,SAAQ,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC;IACvF,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,oCAAoC;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAGD,MAAM,WAAW,qBAAsB,SAAQ,oCAAoC;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAA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AC,SAAS,CAAC;IAqBvG;;OAEG;WACU,0BAA0B,CAAC,OAAO,EAAE,iCAAiC,GAAG,OAAO,CAAC,SAAS,CAAC;IAyBvG;;OAEG;WACU,0BAA0B,CAAC,OAAO,EAAE,iCAAiC,GAAG,OAAO,CAAC,SAAS,CAAC;IAqBvG;;OAEG;WACU,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,SAAS,CAAC;IAyBzF;;OAEG;WACU,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,SAAS,CAAC;IAmBvF;;OAEG;WACU,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,SAAS,CAAC;IAgCnF;;OAEG;WACU,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,SAAS,CAAC;IA0BzF;;OAEG;WACU,2BAA2B,CAAC,OAAO,EAAE,kCAAkC,GAAG,OAAO,CAAC,SAAS,CAAC;CA0B1G"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DocumentManagementClient = void 0;
|
|
4
|
-
const
|
|
4
|
+
const shared_1 = require("./shared");
|
|
5
|
+
const httpHelpers_1 = require("./httpHelpers");
|
|
5
6
|
const DOCUMENT_MANAGEMENT_BASE_PATH = '/datevconnect/dms/v2';
|
|
6
7
|
/**
|
|
7
8
|
* Document Management API Client for DATEV DMS
|
|
@@ -11,13 +12,13 @@ class DocumentManagementClient {
|
|
|
11
12
|
* Authenticate with the Document Management API using the shared authenticate function
|
|
12
13
|
*/
|
|
13
14
|
static async authenticate(options) {
|
|
14
|
-
return (0,
|
|
15
|
+
return (0, shared_1.authenticate)(options);
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* 1. GET /documents - Get a list of documents
|
|
18
19
|
*/
|
|
19
20
|
static async fetchDocuments(options) {
|
|
20
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
21
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
21
22
|
const queryParams = new URLSearchParams();
|
|
22
23
|
if (options.filter)
|
|
23
24
|
queryParams.append('filter', options.filter);
|
|
@@ -43,7 +44,7 @@ class DocumentManagementClient {
|
|
|
43
44
|
* GET /documents/{id} - Get a single document by ID
|
|
44
45
|
*/
|
|
45
46
|
static async fetchDocument(options) {
|
|
46
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
47
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
47
48
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${encodeURIComponent(options.documentId)}`, {
|
|
48
49
|
method: 'GET',
|
|
49
50
|
headers: {
|
|
@@ -61,7 +62,7 @@ class DocumentManagementClient {
|
|
|
61
62
|
* POST /documents - Create a new document
|
|
62
63
|
*/
|
|
63
64
|
static async createDocument(options) {
|
|
64
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
65
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
65
66
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents`, {
|
|
66
67
|
method: 'POST',
|
|
67
68
|
headers: {
|
|
@@ -86,7 +87,7 @@ class DocumentManagementClient {
|
|
|
86
87
|
* PUT /documents/{id} - Update a document
|
|
87
88
|
*/
|
|
88
89
|
static async updateDocument(options) {
|
|
89
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
90
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
90
91
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${encodeURIComponent(options.documentId)}`, {
|
|
91
92
|
method: 'PUT',
|
|
92
93
|
headers: {
|
|
@@ -110,7 +111,7 @@ class DocumentManagementClient {
|
|
|
110
111
|
* 2. GET /document-files/{file-id} - Get a document file (binary)
|
|
111
112
|
*/
|
|
112
113
|
static async fetchDocumentFile(options) {
|
|
113
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
114
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
114
115
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/document-files/${encodeURIComponent(options.fileId)}`, {
|
|
115
116
|
method: 'GET',
|
|
116
117
|
headers: {
|
|
@@ -128,7 +129,7 @@ class DocumentManagementClient {
|
|
|
128
129
|
* POST /document-files - Upload a single file
|
|
129
130
|
*/
|
|
130
131
|
static async uploadDocumentFile(options) {
|
|
131
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
132
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
132
133
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/document-files`, {
|
|
133
134
|
method: 'POST',
|
|
134
135
|
headers: {
|
|
@@ -148,7 +149,7 @@ class DocumentManagementClient {
|
|
|
148
149
|
* 3. GET /domains - Get list of domains
|
|
149
150
|
*/
|
|
150
151
|
static async fetchDomains(options) {
|
|
151
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
152
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
152
153
|
const queryParams = new URLSearchParams();
|
|
153
154
|
if (options.filter)
|
|
154
155
|
queryParams.append('filter', options.filter);
|
|
@@ -170,7 +171,7 @@ class DocumentManagementClient {
|
|
|
170
171
|
* 4. GET /documentstates - Get all document states
|
|
171
172
|
*/
|
|
172
173
|
static async fetchDocumentStates(options) {
|
|
173
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
174
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
174
175
|
const queryParams = new URLSearchParams();
|
|
175
176
|
if (options.filter)
|
|
176
177
|
queryParams.append('filter', options.filter);
|
|
@@ -192,7 +193,7 @@ class DocumentManagementClient {
|
|
|
192
193
|
* GET /documentstates/{state-id} - Get a specific document state
|
|
193
194
|
*/
|
|
194
195
|
static async fetchDocumentState(options) {
|
|
195
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
196
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
196
197
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documentstates/${encodeURIComponent(options.stateId)}`, {
|
|
197
198
|
method: 'GET',
|
|
198
199
|
headers: {
|
|
@@ -210,7 +211,7 @@ class DocumentManagementClient {
|
|
|
210
211
|
* POST /documentstates - Create a new document state
|
|
211
212
|
*/
|
|
212
213
|
static async createDocumentState(options) {
|
|
213
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
214
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
214
215
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documentstates`, {
|
|
215
216
|
method: 'POST',
|
|
216
217
|
headers: {
|
|
@@ -230,7 +231,7 @@ class DocumentManagementClient {
|
|
|
230
231
|
* 5. GET /info - Get system information
|
|
231
232
|
*/
|
|
232
233
|
static async fetchInfo(options) {
|
|
233
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
234
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
234
235
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/info`, {
|
|
235
236
|
method: 'GET',
|
|
236
237
|
headers: {
|
|
@@ -248,7 +249,7 @@ class DocumentManagementClient {
|
|
|
248
249
|
* DELETE /documents/{id} - Delete a document (soft delete)
|
|
249
250
|
*/
|
|
250
251
|
static async deleteDocument(options) {
|
|
251
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
252
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
252
253
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${options.documentId}`, {
|
|
253
254
|
method: 'DELETE',
|
|
254
255
|
headers: {
|
|
@@ -264,7 +265,7 @@ class DocumentManagementClient {
|
|
|
264
265
|
* DELETE /documents/{id}/delete-permanently - Delete a document permanently (hard delete)
|
|
265
266
|
*/
|
|
266
267
|
static async deleteDocumentPermanently(options) {
|
|
267
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
268
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
268
269
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${options.documentId}/delete-permanently`, {
|
|
269
270
|
method: 'DELETE',
|
|
270
271
|
headers: {
|
|
@@ -280,7 +281,7 @@ class DocumentManagementClient {
|
|
|
280
281
|
* GET /secure-areas - Get secure areas (only DATEV DMS)
|
|
281
282
|
*/
|
|
282
283
|
static async fetchSecureAreas(options) {
|
|
283
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
284
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
284
285
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/secure-areas`, {
|
|
285
286
|
method: 'GET',
|
|
286
287
|
headers: {
|
|
@@ -298,7 +299,7 @@ class DocumentManagementClient {
|
|
|
298
299
|
* GET /property-templates - Get property templates (only DATEV DMS)
|
|
299
300
|
*/
|
|
300
301
|
static async fetchPropertyTemplates(options) {
|
|
301
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
302
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
302
303
|
const queryParams = new URLSearchParams();
|
|
303
304
|
if (options.filter)
|
|
304
305
|
queryParams.append('filter', options.filter);
|
|
@@ -320,7 +321,7 @@ class DocumentManagementClient {
|
|
|
320
321
|
* GET /individual-properties - Get individual properties (only DATEV DMS)
|
|
321
322
|
*/
|
|
322
323
|
static async fetchIndividualProperties(options) {
|
|
323
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
324
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
324
325
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/individual-properties`, {
|
|
325
326
|
method: 'GET',
|
|
326
327
|
headers: {
|
|
@@ -338,7 +339,7 @@ class DocumentManagementClient {
|
|
|
338
339
|
* 13. GET /individual-references1 - Get individual references set 1
|
|
339
340
|
*/
|
|
340
341
|
static async fetchIndividualReferences1(options) {
|
|
341
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
342
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
342
343
|
const queryParams = new URLSearchParams();
|
|
343
344
|
if (options.top)
|
|
344
345
|
queryParams.append('top', options.top.toString());
|
|
@@ -362,7 +363,7 @@ class DocumentManagementClient {
|
|
|
362
363
|
* 14. POST /individual-references1 - Create individual reference in set 1
|
|
363
364
|
*/
|
|
364
365
|
static async createIndividualReference1(options) {
|
|
365
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
366
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
366
367
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/individual-references1`, {
|
|
367
368
|
method: 'POST',
|
|
368
369
|
headers: {
|
|
@@ -382,7 +383,7 @@ class DocumentManagementClient {
|
|
|
382
383
|
* 15. GET /individual-references2 - Get individual references set 2
|
|
383
384
|
*/
|
|
384
385
|
static async fetchIndividualReferences2(options) {
|
|
385
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
386
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
386
387
|
const queryParams = new URLSearchParams();
|
|
387
388
|
if (options.top)
|
|
388
389
|
queryParams.append('top', options.top.toString());
|
|
@@ -406,7 +407,7 @@ class DocumentManagementClient {
|
|
|
406
407
|
* 16. POST /individual-references2 - Create individual reference in set 2
|
|
407
408
|
*/
|
|
408
409
|
static async createIndividualReference2(options) {
|
|
409
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
410
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
410
411
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/individual-references2`, {
|
|
411
412
|
method: 'POST',
|
|
412
413
|
headers: {
|
|
@@ -426,7 +427,7 @@ class DocumentManagementClient {
|
|
|
426
427
|
* GET /documents/{id}/structure-items - Get structure items for a document
|
|
427
428
|
*/
|
|
428
429
|
static async fetchStructureItems(options) {
|
|
429
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
430
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
430
431
|
const queryParams = new URLSearchParams();
|
|
431
432
|
if (options.top)
|
|
432
433
|
queryParams.append('top', options.top.toString());
|
|
@@ -450,7 +451,7 @@ class DocumentManagementClient {
|
|
|
450
451
|
* GET /documents/{id}/structure-items/{itemId} - Get a single structure item
|
|
451
452
|
*/
|
|
452
453
|
static async fetchStructureItem(options) {
|
|
453
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
454
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
454
455
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${encodeURIComponent(options.documentId)}/structure-items/${encodeURIComponent(options.structureItemId)}`, {
|
|
455
456
|
method: 'GET',
|
|
456
457
|
headers: {
|
|
@@ -468,7 +469,7 @@ class DocumentManagementClient {
|
|
|
468
469
|
* POST /documents/{id}/structure-items - Add a structure item to a document
|
|
469
470
|
*/
|
|
470
471
|
static async addStructureItem(options) {
|
|
471
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
472
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
472
473
|
const queryParams = new URLSearchParams();
|
|
473
474
|
if (options.insertPosition)
|
|
474
475
|
queryParams.append('insertPosition', options.insertPosition);
|
|
@@ -497,7 +498,7 @@ class DocumentManagementClient {
|
|
|
497
498
|
* PUT /documents/{id}/structure-items/{itemId} - Update a structure item
|
|
498
499
|
*/
|
|
499
500
|
static async updateStructureItem(options) {
|
|
500
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
501
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
501
502
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${encodeURIComponent(options.documentId)}/structure-items/${encodeURIComponent(options.structureItemId)}`, {
|
|
502
503
|
method: 'PUT',
|
|
503
504
|
headers: {
|
|
@@ -521,7 +522,7 @@ class DocumentManagementClient {
|
|
|
521
522
|
* POST /documents/{id}/dispatcher-information - Create dispatcher information for a document
|
|
522
523
|
*/
|
|
523
524
|
static async createDispatcherInformation(options) {
|
|
524
|
-
const fetchImpl = options.fetchImpl || fetch;
|
|
525
|
+
const fetchImpl = options.httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(options.httpHelper) : (options.fetchImpl || fetch);
|
|
525
526
|
const response = await fetchImpl(`${options.host}${DOCUMENT_MANAGEMENT_BASE_PATH}/documents/${encodeURIComponent(options.documentId)}/dispatcher-information`, {
|
|
526
527
|
method: 'POST',
|
|
527
528
|
headers: {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP helpers for wrapping n8n's httpRequest to work like fetch()
|
|
3
|
+
*/
|
|
4
|
+
import type { IHttpRequestOptions } from 'n8n-workflow';
|
|
5
|
+
export type HttpRequestHelper = (options: IHttpRequestOptions) => Promise<unknown>;
|
|
6
|
+
/**
|
|
7
|
+
* Creates a fetch-like function using n8n's httpRequest helper
|
|
8
|
+
*/
|
|
9
|
+
export declare function createFetchFromHttpHelper(httpHelper: HttpRequestHelper): typeof fetch;
|
|
10
|
+
//# sourceMappingURL=httpHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpHelpers.d.ts","sourceRoot":"","sources":["../../../src/services/httpHelpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxD,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AA+JnF;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,iBAAiB,GAAG,OAAO,KAAK,CAmDrF"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* HTTP helpers for wrapping n8n's httpRequest to work like fetch()
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createFetchFromHttpHelper = createFetchFromHttpHelper;
|
|
7
|
+
/**
|
|
8
|
+
* Response-like wrapper for n8n httpRequest responses
|
|
9
|
+
*/
|
|
10
|
+
class HttpResponse {
|
|
11
|
+
constructor(body, status, statusText, headers = {}) {
|
|
12
|
+
this.body = null;
|
|
13
|
+
this.bodyUsed = false;
|
|
14
|
+
this.redirected = false;
|
|
15
|
+
this.type = 'basic';
|
|
16
|
+
this.url = '';
|
|
17
|
+
this._bodyParsed = false;
|
|
18
|
+
this._body = body;
|
|
19
|
+
this.status = status;
|
|
20
|
+
this.statusText = statusText;
|
|
21
|
+
this.ok = status >= 200 && status < 300;
|
|
22
|
+
this.headers = new Headers(headers);
|
|
23
|
+
}
|
|
24
|
+
async arrayBuffer() {
|
|
25
|
+
this.bodyUsed = true;
|
|
26
|
+
const bytes = await this.bytes();
|
|
27
|
+
const buffer = new ArrayBuffer(bytes.byteLength);
|
|
28
|
+
new Uint8Array(buffer).set(bytes);
|
|
29
|
+
return buffer;
|
|
30
|
+
}
|
|
31
|
+
async blob() {
|
|
32
|
+
this.bodyUsed = true;
|
|
33
|
+
const bytes = await this.arrayBuffer();
|
|
34
|
+
const type = this.headers.get('content-type') || undefined;
|
|
35
|
+
return new Blob([bytes], type ? { type } : undefined);
|
|
36
|
+
}
|
|
37
|
+
async bytes() {
|
|
38
|
+
this.bodyUsed = true;
|
|
39
|
+
if (this._bodyBytes)
|
|
40
|
+
return this._bodyBytes;
|
|
41
|
+
if (this._body instanceof ArrayBuffer) {
|
|
42
|
+
this._bodyBytes = new Uint8Array(this._body);
|
|
43
|
+
return this._bodyBytes;
|
|
44
|
+
}
|
|
45
|
+
if (ArrayBuffer.isView(this._body)) {
|
|
46
|
+
const view = this._body;
|
|
47
|
+
this._bodyBytes = new Uint8Array(view.buffer.slice(view.byteOffset, view.byteOffset + view.byteLength));
|
|
48
|
+
return this._bodyBytes;
|
|
49
|
+
}
|
|
50
|
+
if (typeof Blob !== 'undefined' && this._body instanceof Blob) {
|
|
51
|
+
this._bodyBytes = new Uint8Array(await this._body.arrayBuffer());
|
|
52
|
+
return this._bodyBytes;
|
|
53
|
+
}
|
|
54
|
+
if (typeof this._body === 'string') {
|
|
55
|
+
this._bodyBytes = new TextEncoder().encode(this._body);
|
|
56
|
+
return this._bodyBytes;
|
|
57
|
+
}
|
|
58
|
+
if (this._body === undefined || this._body === null) {
|
|
59
|
+
this._bodyBytes = new Uint8Array();
|
|
60
|
+
return this._bodyBytes;
|
|
61
|
+
}
|
|
62
|
+
if (typeof this._body === 'object') {
|
|
63
|
+
this._bodyBytes = new TextEncoder().encode(JSON.stringify(this._body));
|
|
64
|
+
return this._bodyBytes;
|
|
65
|
+
}
|
|
66
|
+
this._bodyBytes = new TextEncoder().encode(String(this._body));
|
|
67
|
+
return this._bodyBytes;
|
|
68
|
+
}
|
|
69
|
+
async formData() {
|
|
70
|
+
throw new Error('formData() not implemented');
|
|
71
|
+
}
|
|
72
|
+
async json() {
|
|
73
|
+
if (this._bodyParsed)
|
|
74
|
+
return this._body;
|
|
75
|
+
if (typeof this._body === 'string') {
|
|
76
|
+
this._bodyParsed = true;
|
|
77
|
+
this.bodyUsed = true;
|
|
78
|
+
this._body = JSON.parse(this._body);
|
|
79
|
+
return this._body;
|
|
80
|
+
}
|
|
81
|
+
if (typeof this._body === 'object' &&
|
|
82
|
+
this._body !== null &&
|
|
83
|
+
!(this._body instanceof ArrayBuffer) &&
|
|
84
|
+
!ArrayBuffer.isView(this._body) &&
|
|
85
|
+
!(typeof Blob !== 'undefined' && this._body instanceof Blob)) {
|
|
86
|
+
this._bodyParsed = true;
|
|
87
|
+
this.bodyUsed = true;
|
|
88
|
+
return this._body;
|
|
89
|
+
}
|
|
90
|
+
const textBody = await this.text();
|
|
91
|
+
this._body = JSON.parse(textBody);
|
|
92
|
+
this._bodyParsed = true;
|
|
93
|
+
return this._body;
|
|
94
|
+
}
|
|
95
|
+
async text() {
|
|
96
|
+
if (this._bodyText !== undefined) {
|
|
97
|
+
this.bodyUsed = true;
|
|
98
|
+
return this._bodyText;
|
|
99
|
+
}
|
|
100
|
+
if (typeof this._body === 'string') {
|
|
101
|
+
this._bodyParsed = true;
|
|
102
|
+
this.bodyUsed = true;
|
|
103
|
+
this._bodyText = this._body;
|
|
104
|
+
return this._bodyText;
|
|
105
|
+
}
|
|
106
|
+
if (typeof this._body === 'object' &&
|
|
107
|
+
this._body !== null &&
|
|
108
|
+
!(this._body instanceof ArrayBuffer) &&
|
|
109
|
+
!ArrayBuffer.isView(this._body) &&
|
|
110
|
+
!(typeof Blob !== 'undefined' && this._body instanceof Blob)) {
|
|
111
|
+
this._bodyParsed = true;
|
|
112
|
+
this.bodyUsed = true;
|
|
113
|
+
this._bodyText = JSON.stringify(this._body);
|
|
114
|
+
return this._bodyText;
|
|
115
|
+
}
|
|
116
|
+
const decoder = new TextDecoder();
|
|
117
|
+
this._bodyText = decoder.decode(await this.bytes());
|
|
118
|
+
this._bodyParsed = true;
|
|
119
|
+
return this._bodyText;
|
|
120
|
+
}
|
|
121
|
+
clone() {
|
|
122
|
+
const headersObj = {};
|
|
123
|
+
this.headers.forEach((value, key) => {
|
|
124
|
+
headersObj[key] = value;
|
|
125
|
+
});
|
|
126
|
+
return new HttpResponse(this._body, this.status, this.statusText, headersObj);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Creates a fetch-like function using n8n's httpRequest helper
|
|
131
|
+
*/
|
|
132
|
+
function createFetchFromHttpHelper(httpHelper) {
|
|
133
|
+
const fetchFunction = async (input, init) => {
|
|
134
|
+
const url = typeof input === 'string' ? input : input instanceof URL ? input.toString() : input.url;
|
|
135
|
+
const method = ((init === null || init === void 0 ? void 0 : init.method) || 'GET');
|
|
136
|
+
const headers = {};
|
|
137
|
+
// Extract headers from init
|
|
138
|
+
if (init === null || init === void 0 ? void 0 : init.headers) {
|
|
139
|
+
if (init.headers instanceof Headers) {
|
|
140
|
+
init.headers.forEach((value, key) => {
|
|
141
|
+
headers[key] = value;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
else if (Array.isArray(init.headers)) {
|
|
145
|
+
init.headers.forEach(([key, value]) => {
|
|
146
|
+
headers[key] = value;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
Object.assign(headers, init.headers);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
const response = await httpHelper({
|
|
155
|
+
url,
|
|
156
|
+
method,
|
|
157
|
+
headers,
|
|
158
|
+
body: init === null || init === void 0 ? void 0 : init.body,
|
|
159
|
+
returnFullResponse: true,
|
|
160
|
+
});
|
|
161
|
+
// n8n's httpRequest returns { body, headers, statusCode, statusMessage }
|
|
162
|
+
const responseObj = response;
|
|
163
|
+
const status = (responseObj.statusCode || 200);
|
|
164
|
+
const statusText = (responseObj.statusMessage || '');
|
|
165
|
+
const responseHeaders = (responseObj.headers || {});
|
|
166
|
+
return new HttpResponse(responseObj.body, status, statusText, responseHeaders);
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
// Handle errors from n8n httpRequest
|
|
170
|
+
const errorObj = error;
|
|
171
|
+
const response = errorObj.response;
|
|
172
|
+
const status = (errorObj.statusCode || (response === null || response === void 0 ? void 0 : response.statusCode) || 500);
|
|
173
|
+
const statusText = (errorObj.statusMessage || errorObj.message || 'Internal Server Error');
|
|
174
|
+
const body = (response === null || response === void 0 ? void 0 : response.body) || errorObj.body || errorObj.message;
|
|
175
|
+
const headers = ((response === null || response === void 0 ? void 0 : response.headers) || errorObj.headers || {});
|
|
176
|
+
return new HttpResponse(body, status, statusText, headers);
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
return fetchFunction;
|
|
180
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { JsonValue } from "./
|
|
1
|
+
import type { JsonValue, HttpRequestHelper } from "./shared";
|
|
2
2
|
interface BaseIamRequestOptions {
|
|
3
3
|
host: string;
|
|
4
4
|
token: string;
|
|
5
5
|
clientInstanceId: string;
|
|
6
|
+
httpHelper?: HttpRequestHelper;
|
|
6
7
|
fetchImpl?: typeof fetch;
|
|
7
8
|
}
|
|
8
9
|
export type FetchServiceProviderConfigOptions = BaseIamRequestOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identityAndAccessManagementClient.d.ts","sourceRoot":"","sources":["../../../src/services/identityAndAccessManagementClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"identityAndAccessManagementClient.d.ts","sourceRoot":"","sources":["../../../src/services/identityAndAccessManagementClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAgB7D,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAcD,MAAM,MAAM,iCAAiC,GAAG,qBAAqB,CAAC;AACtE,MAAM,MAAM,yBAAyB,GAAG,qBAAqB,CAAC;AAC9D,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAExD,MAAM,WAAW,kBAAmB,SAAQ,qBAAqB;IAC/D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,iBAAkB,SAAQ,qBAAqB;IAC9D,MA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,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;WAoB1D,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC;WAcxD,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;WAmB1D,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;WAoB1D,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;WAYtE,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,SAAS,CAAC;WActE,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC;WAc5D,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,SAAS,CAAC;WAc1D,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC;WAmB5D,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,SAAS,CAAC;WAoB5D,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAWtF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.IdentityAndAccessManagementClient = void 0;
|
|
4
|
+
const httpHelpers_1 = require("./httpHelpers");
|
|
4
5
|
const JSON_CONTENT_TYPE = "application/json;charset=utf-8";
|
|
5
6
|
const DEFAULT_ERROR_PREFIX = "DATEV IAM request failed";
|
|
6
7
|
const IAM_BASE_PATH = "datevconnect/iam/v1";
|
|
@@ -30,6 +31,7 @@ function buildUrl(host, path, query) {
|
|
|
30
31
|
}
|
|
31
32
|
return url;
|
|
32
33
|
}
|
|
34
|
+
;
|
|
33
35
|
async function readResponseBody(response) {
|
|
34
36
|
var _a;
|
|
35
37
|
if (response.status === 204 || response.status === 205) {
|
|
@@ -69,7 +71,7 @@ function buildErrorMessage(response, body) {
|
|
|
69
71
|
return prefix;
|
|
70
72
|
}
|
|
71
73
|
async function sendRequest(options) {
|
|
72
|
-
const { host, token, clientInstanceId, path, method, query, body, fetchImpl
|
|
74
|
+
const { host, token, clientInstanceId, path, method, query, body, httpHelper, fetchImpl: providedFetchImpl } = options;
|
|
73
75
|
const url = buildUrl(host, path, query);
|
|
74
76
|
const headers = {
|
|
75
77
|
Authorization: `Bearer ${token}`,
|
|
@@ -84,6 +86,7 @@ async function sendRequest(options) {
|
|
|
84
86
|
headers["content-type"] = JSON_CONTENT_TYPE;
|
|
85
87
|
requestInit.body = JSON.stringify(body);
|
|
86
88
|
}
|
|
89
|
+
const fetchImpl = httpHelper ? (0, httpHelpers_1.createFetchFromHttpHelper)(httpHelper) : (providedFetchImpl || fetch);
|
|
87
90
|
const response = await fetchImpl(url, requestInit);
|
|
88
91
|
const responseBody = await readResponseBody(response);
|
|
89
92
|
if (!response.ok) {
|