@pdfgeneratorapi/n8n-nodes-pdf-generator-api 0.4.0 → 0.5.1
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 +51 -2
- package/dist/credentials/PdfGeneratorApi.credentials.d.ts +4 -0
- package/dist/credentials/PdfGeneratorApi.credentials.js +1 -0
- package/dist/credentials/PdfGeneratorApi.credentials.js.map +1 -1
- package/dist/credentials/pdfgeneratorapi.svg +1 -0
- package/dist/nodes/PdfGeneratorApi/PdfGeneratorApi.node.js +519 -45
- package/dist/nodes/PdfGeneratorApi/PdfGeneratorApi.node.js.map +1 -1
- package/dist/package.json +6 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -2
|
@@ -15,8 +15,8 @@ class PdfGeneratorApi {
|
|
|
15
15
|
defaults: {
|
|
16
16
|
name: 'PDF Generator API',
|
|
17
17
|
},
|
|
18
|
-
inputs: [
|
|
19
|
-
outputs: [
|
|
18
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
19
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
20
20
|
usableAsTool: true,
|
|
21
21
|
credentials: [
|
|
22
22
|
{
|
|
@@ -52,6 +52,11 @@ class PdfGeneratorApi {
|
|
|
52
52
|
value: 'document',
|
|
53
53
|
description: 'Generate PDFs from templates with data, manage document storage',
|
|
54
54
|
},
|
|
55
|
+
{
|
|
56
|
+
name: 'E-Invoice',
|
|
57
|
+
value: 'einvoice',
|
|
58
|
+
description: 'Create EN 16931 e-invoices as UBL or CII XML, XRechnung 3.0, or Factur-X PDF',
|
|
59
|
+
},
|
|
55
60
|
{
|
|
56
61
|
name: 'PDF Service',
|
|
57
62
|
value: 'pdfServices',
|
|
@@ -173,6 +178,44 @@ class PdfGeneratorApi {
|
|
|
173
178
|
],
|
|
174
179
|
default: 'generate',
|
|
175
180
|
},
|
|
181
|
+
{
|
|
182
|
+
displayName: 'E-Invoice Operations',
|
|
183
|
+
name: 'operation',
|
|
184
|
+
type: 'options',
|
|
185
|
+
noDataExpression: true,
|
|
186
|
+
displayOptions: {
|
|
187
|
+
show: {
|
|
188
|
+
resource: ['einvoice'],
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
options: [
|
|
192
|
+
{
|
|
193
|
+
name: 'Create E-Invoice',
|
|
194
|
+
value: 'createEInvoice',
|
|
195
|
+
description: 'Create an EN 16931 e-invoice as UBL or CII XML',
|
|
196
|
+
action: 'Create an EN 16931 e invoice',
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: 'Create Factur-X E-Invoice',
|
|
200
|
+
value: 'createFacturX',
|
|
201
|
+
description: 'Create a Factur-X PDF with the CII XML embedded',
|
|
202
|
+
action: 'Create a FACTUR-X e invoice',
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
name: 'Create XRechnung E-Invoice',
|
|
206
|
+
value: 'createXRechnung',
|
|
207
|
+
description: 'Create an XRechnung 3.0 e-invoice, validated against the German BR-DE rules',
|
|
208
|
+
action: 'Create an XRECHNUNG e invoice',
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: 'Get Schema',
|
|
212
|
+
value: 'getEInvoiceSchema',
|
|
213
|
+
description: 'Get the JSON schema of the accepted e-invoice payload',
|
|
214
|
+
action: 'Get the e invoice payload schema',
|
|
215
|
+
},
|
|
216
|
+
],
|
|
217
|
+
default: 'createEInvoice',
|
|
218
|
+
},
|
|
176
219
|
{
|
|
177
220
|
displayName: 'Services Operations',
|
|
178
221
|
name: 'operation',
|
|
@@ -1698,6 +1741,260 @@ class PdfGeneratorApi {
|
|
|
1698
1741
|
},
|
|
1699
1742
|
],
|
|
1700
1743
|
},
|
|
1744
|
+
{
|
|
1745
|
+
displayName: 'Template',
|
|
1746
|
+
name: 'templateId',
|
|
1747
|
+
type: 'resourceLocator',
|
|
1748
|
+
default: { mode: 'list', value: '' },
|
|
1749
|
+
required: true,
|
|
1750
|
+
displayOptions: {
|
|
1751
|
+
show: {
|
|
1752
|
+
resource: ['einvoice'],
|
|
1753
|
+
operation: ['createFacturX'],
|
|
1754
|
+
},
|
|
1755
|
+
},
|
|
1756
|
+
modes: [
|
|
1757
|
+
{
|
|
1758
|
+
displayName: 'From List',
|
|
1759
|
+
name: 'list',
|
|
1760
|
+
type: 'list',
|
|
1761
|
+
hint: 'Select a template from the list',
|
|
1762
|
+
typeOptions: {
|
|
1763
|
+
searchListMethod: 'searchTemplates',
|
|
1764
|
+
searchable: true,
|
|
1765
|
+
searchFilterRequired: false,
|
|
1766
|
+
},
|
|
1767
|
+
},
|
|
1768
|
+
{
|
|
1769
|
+
displayName: 'By ID',
|
|
1770
|
+
name: 'id',
|
|
1771
|
+
type: 'string',
|
|
1772
|
+
hint: 'Enter the template ID directly',
|
|
1773
|
+
validation: [
|
|
1774
|
+
{
|
|
1775
|
+
type: 'regex',
|
|
1776
|
+
properties: {
|
|
1777
|
+
regex: '^[0-9]+$',
|
|
1778
|
+
errorMessage: 'Template ID must be a number',
|
|
1779
|
+
},
|
|
1780
|
+
},
|
|
1781
|
+
],
|
|
1782
|
+
},
|
|
1783
|
+
],
|
|
1784
|
+
description: 'Template used to render the PDF half of the Factur-X file. Use a template whose fields are mapped to UBL element names, because a friendly-name stock template renders blank here.',
|
|
1785
|
+
},
|
|
1786
|
+
{
|
|
1787
|
+
displayName: 'Invoice Data',
|
|
1788
|
+
name: 'einvoiceData',
|
|
1789
|
+
type: 'json',
|
|
1790
|
+
required: true,
|
|
1791
|
+
default: '{}',
|
|
1792
|
+
displayOptions: {
|
|
1793
|
+
show: {
|
|
1794
|
+
resource: ['einvoice'],
|
|
1795
|
+
operation: ['createEInvoice', 'createXRechnung', 'createFacturX'],
|
|
1796
|
+
},
|
|
1797
|
+
},
|
|
1798
|
+
description: 'Peppol BIS Billing 3.0 UBL invoice payload. Run Get Schema for the full structure. For Factur-X it is used both to render the template and to build the embedded CII XML.',
|
|
1799
|
+
},
|
|
1800
|
+
{
|
|
1801
|
+
displayName: 'Formatting Type',
|
|
1802
|
+
name: 'einvoiceType',
|
|
1803
|
+
type: 'options',
|
|
1804
|
+
options: [
|
|
1805
|
+
{
|
|
1806
|
+
name: 'CII',
|
|
1807
|
+
value: 'CII',
|
|
1808
|
+
description: 'Cross Industry Invoice XML',
|
|
1809
|
+
},
|
|
1810
|
+
{
|
|
1811
|
+
name: 'UBL',
|
|
1812
|
+
value: 'UBL',
|
|
1813
|
+
description: 'Universal Business Language XML',
|
|
1814
|
+
},
|
|
1815
|
+
],
|
|
1816
|
+
default: 'UBL',
|
|
1817
|
+
displayOptions: {
|
|
1818
|
+
show: {
|
|
1819
|
+
resource: ['einvoice'],
|
|
1820
|
+
operation: ['createEInvoice', 'createXRechnung'],
|
|
1821
|
+
},
|
|
1822
|
+
},
|
|
1823
|
+
description: 'XML syntax of the generated e-invoice',
|
|
1824
|
+
},
|
|
1825
|
+
{
|
|
1826
|
+
displayName: 'Output',
|
|
1827
|
+
name: 'einvoiceOutput',
|
|
1828
|
+
type: 'options',
|
|
1829
|
+
options: [
|
|
1830
|
+
{
|
|
1831
|
+
name: 'Base64 (JSON)',
|
|
1832
|
+
value: 'base64',
|
|
1833
|
+
description: 'The API returns the XML as base64. The node attaches it decoded as binary and returns the metadata as JSON.',
|
|
1834
|
+
},
|
|
1835
|
+
{
|
|
1836
|
+
name: 'File (Binary)',
|
|
1837
|
+
value: 'file',
|
|
1838
|
+
description: 'Returns the XML inline as binary data',
|
|
1839
|
+
},
|
|
1840
|
+
],
|
|
1841
|
+
default: 'base64',
|
|
1842
|
+
displayOptions: {
|
|
1843
|
+
show: {
|
|
1844
|
+
resource: ['einvoice'],
|
|
1845
|
+
operation: ['createEInvoice', 'createXRechnung'],
|
|
1846
|
+
},
|
|
1847
|
+
},
|
|
1848
|
+
description: 'Response format. Either way the XML is attached as a binary item named "data".',
|
|
1849
|
+
},
|
|
1850
|
+
{
|
|
1851
|
+
displayName: 'Additional Fields',
|
|
1852
|
+
name: 'einvoiceAdditionalFields',
|
|
1853
|
+
type: 'collection',
|
|
1854
|
+
placeholder: 'Add Field',
|
|
1855
|
+
default: {},
|
|
1856
|
+
displayOptions: {
|
|
1857
|
+
show: {
|
|
1858
|
+
resource: ['einvoice'],
|
|
1859
|
+
operation: ['createEInvoice', 'createXRechnung'],
|
|
1860
|
+
},
|
|
1861
|
+
},
|
|
1862
|
+
options: [
|
|
1863
|
+
{
|
|
1864
|
+
displayName: 'File Name',
|
|
1865
|
+
name: 'outputName',
|
|
1866
|
+
type: 'string',
|
|
1867
|
+
default: '',
|
|
1868
|
+
placeholder: 'e.g. Invoice 123',
|
|
1869
|
+
description: 'Name of the attached XML file, without the extension. Defaults to the operation and syntax, e.g. einvoice-ubl, so set it when a workflow stores many invoices in one place.',
|
|
1870
|
+
},
|
|
1871
|
+
],
|
|
1872
|
+
},
|
|
1873
|
+
{
|
|
1874
|
+
displayName: 'Profile',
|
|
1875
|
+
name: 'facturxProfile',
|
|
1876
|
+
type: 'options',
|
|
1877
|
+
options: [
|
|
1878
|
+
{
|
|
1879
|
+
name: 'Basic',
|
|
1880
|
+
value: 'basic',
|
|
1881
|
+
description: 'Core invoice data. Drops item level attributes such as AdditionalItemProperty.',
|
|
1882
|
+
},
|
|
1883
|
+
{
|
|
1884
|
+
name: 'Basic WL',
|
|
1885
|
+
value: 'basicwl',
|
|
1886
|
+
description: 'Basic without lines, for accounting entry only',
|
|
1887
|
+
},
|
|
1888
|
+
{
|
|
1889
|
+
name: 'EN 16931',
|
|
1890
|
+
value: 'en16931',
|
|
1891
|
+
description: 'Full EN 16931 semantic model. Keeps item level attributes.',
|
|
1892
|
+
},
|
|
1893
|
+
{
|
|
1894
|
+
name: 'Extended',
|
|
1895
|
+
value: 'extended',
|
|
1896
|
+
description: 'EN 16931 plus extensions. Keeps item level attributes.',
|
|
1897
|
+
},
|
|
1898
|
+
{
|
|
1899
|
+
name: 'Minimum',
|
|
1900
|
+
value: 'minimum',
|
|
1901
|
+
description: 'Header data only, not a compliant invoice in most jurisdictions',
|
|
1902
|
+
},
|
|
1903
|
+
{
|
|
1904
|
+
name: 'XRechnung',
|
|
1905
|
+
value: 'xrechnung',
|
|
1906
|
+
description: 'German XRechnung CIUS on top of EN 16931',
|
|
1907
|
+
},
|
|
1908
|
+
],
|
|
1909
|
+
default: 'en16931',
|
|
1910
|
+
displayOptions: {
|
|
1911
|
+
show: {
|
|
1912
|
+
resource: ['einvoice'],
|
|
1913
|
+
operation: ['createFacturX'],
|
|
1914
|
+
},
|
|
1915
|
+
},
|
|
1916
|
+
description: 'Factur-X conformance level. Defaults to EN 16931, which keeps per-line attributes. Basic and the lower levels carry less of the invoice in the embedded XML.',
|
|
1917
|
+
},
|
|
1918
|
+
{
|
|
1919
|
+
displayName: 'Output',
|
|
1920
|
+
name: 'facturxOutput',
|
|
1921
|
+
type: 'options',
|
|
1922
|
+
options: [
|
|
1923
|
+
{
|
|
1924
|
+
name: 'Base64 (JSON)',
|
|
1925
|
+
value: 'base64',
|
|
1926
|
+
description: 'The API returns the PDF as base64. The node attaches it decoded as binary and returns the metadata as JSON.',
|
|
1927
|
+
},
|
|
1928
|
+
{
|
|
1929
|
+
name: 'File (Binary)',
|
|
1930
|
+
value: 'file',
|
|
1931
|
+
description: 'Returns the PDF inline as binary data',
|
|
1932
|
+
},
|
|
1933
|
+
{
|
|
1934
|
+
name: 'URL',
|
|
1935
|
+
value: 'url',
|
|
1936
|
+
description: 'Stores the document for 30 days and returns a link',
|
|
1937
|
+
},
|
|
1938
|
+
{
|
|
1939
|
+
name: 'Viewer URL',
|
|
1940
|
+
value: 'viewer',
|
|
1941
|
+
description: 'Stores the document for 30 days and returns a viewer link',
|
|
1942
|
+
},
|
|
1943
|
+
],
|
|
1944
|
+
default: 'base64',
|
|
1945
|
+
displayOptions: {
|
|
1946
|
+
show: {
|
|
1947
|
+
resource: ['einvoice'],
|
|
1948
|
+
operation: ['createFacturX'],
|
|
1949
|
+
},
|
|
1950
|
+
},
|
|
1951
|
+
description: 'Response format. Base64 and File both attach the PDF as a binary item named "data".',
|
|
1952
|
+
},
|
|
1953
|
+
{
|
|
1954
|
+
displayName: 'Additional Fields',
|
|
1955
|
+
name: 'facturxAdditionalFields',
|
|
1956
|
+
type: 'collection',
|
|
1957
|
+
placeholder: 'Add Field',
|
|
1958
|
+
default: {},
|
|
1959
|
+
displayOptions: {
|
|
1960
|
+
show: {
|
|
1961
|
+
resource: ['einvoice'],
|
|
1962
|
+
operation: ['createFacturX'],
|
|
1963
|
+
},
|
|
1964
|
+
},
|
|
1965
|
+
options: [
|
|
1966
|
+
{
|
|
1967
|
+
displayName: 'Author',
|
|
1968
|
+
name: 'author',
|
|
1969
|
+
type: 'string',
|
|
1970
|
+
default: '',
|
|
1971
|
+
description: 'Document author written into the PDF metadata',
|
|
1972
|
+
},
|
|
1973
|
+
{
|
|
1974
|
+
displayName: 'Document Name',
|
|
1975
|
+
name: 'outputName',
|
|
1976
|
+
type: 'string',
|
|
1977
|
+
default: '',
|
|
1978
|
+
placeholder: 'e.g. Invoice 123',
|
|
1979
|
+
description: 'Name of the generated document. The API generates one when this is empty.',
|
|
1980
|
+
},
|
|
1981
|
+
{
|
|
1982
|
+
displayName: 'Language',
|
|
1983
|
+
name: 'language',
|
|
1984
|
+
type: 'string',
|
|
1985
|
+
default: '',
|
|
1986
|
+
placeholder: 'e.g. en',
|
|
1987
|
+
description: 'Document language written into the PDF metadata',
|
|
1988
|
+
},
|
|
1989
|
+
{
|
|
1990
|
+
displayName: 'Template Version ID',
|
|
1991
|
+
name: 'versionId',
|
|
1992
|
+
type: 'number',
|
|
1993
|
+
default: 0,
|
|
1994
|
+
description: 'Pin generation to a specific template version instead of the current one',
|
|
1995
|
+
},
|
|
1996
|
+
],
|
|
1997
|
+
},
|
|
1701
1998
|
],
|
|
1702
1999
|
};
|
|
1703
2000
|
this.methods = {
|
|
@@ -1717,7 +2014,7 @@ class PdfGeneratorApi {
|
|
|
1717
2014
|
},
|
|
1718
2015
|
json: true,
|
|
1719
2016
|
};
|
|
1720
|
-
const response = await this.helpers.
|
|
2017
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'pdfGeneratorApi', options);
|
|
1721
2018
|
if (response && response.response) {
|
|
1722
2019
|
for (const template of response.response) {
|
|
1723
2020
|
const displayName = `${template.name} (ID: ${template.id})`;
|
|
@@ -1758,6 +2055,43 @@ class PdfGeneratorApi {
|
|
|
1758
2055
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `${field} must be valid JSON`);
|
|
1759
2056
|
}
|
|
1760
2057
|
};
|
|
2058
|
+
const validationDetails = (errors, message) => {
|
|
2059
|
+
if (!errors || typeof errors !== 'object')
|
|
2060
|
+
return '';
|
|
2061
|
+
const parts = (Array.isArray(errors) ? errors.map((e) => ['', e]) : Object.entries(errors))
|
|
2062
|
+
.map(([field, e]) => [field, [].concat(e).map(String).filter((t) => !message.includes(t)).join(' ')])
|
|
2063
|
+
.filter(([, text]) => text)
|
|
2064
|
+
.map(([field, text]) => (field ? `${field}: ${text}` : text));
|
|
2065
|
+
return parts.length ? ` (${parts.join('; ')})` : '';
|
|
2066
|
+
};
|
|
2067
|
+
const parseErrorBody = (body) => {
|
|
2068
|
+
const text = Buffer.isBuffer(body) ? body.toString('utf8') : body;
|
|
2069
|
+
if (typeof text !== 'string')
|
|
2070
|
+
return (text !== null && text !== void 0 ? text : {});
|
|
2071
|
+
try {
|
|
2072
|
+
return JSON.parse(text);
|
|
2073
|
+
}
|
|
2074
|
+
catch (error) {
|
|
2075
|
+
return text.trimStart().startsWith('<') ? {} : { message: text.trim() };
|
|
2076
|
+
}
|
|
2077
|
+
};
|
|
2078
|
+
const apiRequest = async (options, itemIndex, errorPrefix) => {
|
|
2079
|
+
const response = (await this.helpers.httpRequestWithAuthentication.call(this, 'pdfGeneratorApi', {
|
|
2080
|
+
...options,
|
|
2081
|
+
returnFullResponse: true,
|
|
2082
|
+
ignoreHttpStatusErrors: true,
|
|
2083
|
+
}));
|
|
2084
|
+
if (response.statusCode >= 400) {
|
|
2085
|
+
const body = parseErrorBody(response.body);
|
|
2086
|
+
const apiMessage = typeof body.message === 'string' ? body.message : '';
|
|
2087
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), body, {
|
|
2088
|
+
httpCode: String(response.statusCode),
|
|
2089
|
+
itemIndex,
|
|
2090
|
+
message: errorPrefix && apiMessage ? `${errorPrefix}: ${apiMessage}${validationDetails(body.errors, apiMessage)}` : undefined,
|
|
2091
|
+
});
|
|
2092
|
+
}
|
|
2093
|
+
return options.returnFullResponse ? response : response.body;
|
|
2094
|
+
};
|
|
1761
2095
|
const getMimeType = (format) => {
|
|
1762
2096
|
switch (format) {
|
|
1763
2097
|
case 'pdf':
|
|
@@ -1802,9 +2136,9 @@ class PdfGeneratorApi {
|
|
|
1802
2136
|
url: '/assets/qrcode',
|
|
1803
2137
|
body,
|
|
1804
2138
|
json: qrOutputFormat !== 'file',
|
|
1805
|
-
encoding: qrOutputFormat === 'file' ?
|
|
2139
|
+
encoding: qrOutputFormat === 'file' ? 'arraybuffer' : 'json',
|
|
1806
2140
|
};
|
|
1807
|
-
responseData = await
|
|
2141
|
+
responseData = await apiRequest(options, i);
|
|
1808
2142
|
if (responseData) {
|
|
1809
2143
|
if (qrOutputFormat === 'file') {
|
|
1810
2144
|
const binaryData = {};
|
|
@@ -1818,6 +2152,7 @@ class PdfGeneratorApi {
|
|
|
1818
2152
|
fileSize: responseData.length,
|
|
1819
2153
|
},
|
|
1820
2154
|
binary: binaryData,
|
|
2155
|
+
pairedItem: { item: i },
|
|
1821
2156
|
});
|
|
1822
2157
|
}
|
|
1823
2158
|
else {
|
|
@@ -1827,12 +2162,135 @@ class PdfGeneratorApi {
|
|
|
1827
2162
|
format: qrOutputFormat,
|
|
1828
2163
|
...responseData,
|
|
1829
2164
|
},
|
|
2165
|
+
pairedItem: { item: i },
|
|
1830
2166
|
});
|
|
1831
2167
|
}
|
|
1832
2168
|
continue;
|
|
1833
2169
|
}
|
|
1834
2170
|
}
|
|
1835
2171
|
}
|
|
2172
|
+
else if (resource === 'einvoice') {
|
|
2173
|
+
const callEInvoice = async (requestOptions) => await apiRequest(requestOptions, i, 'PDF Generator API e-invoice request failed');
|
|
2174
|
+
const pushDocument = async (payload, output, fallbackName, fallbackMimeType) => {
|
|
2175
|
+
if (output === 'file') {
|
|
2176
|
+
const binary = {};
|
|
2177
|
+
binary.data = await this.helpers.prepareBinaryData(payload, fallbackName, fallbackMimeType);
|
|
2178
|
+
returnData.push({
|
|
2179
|
+
json: {
|
|
2180
|
+
success: true,
|
|
2181
|
+
filename: fallbackName,
|
|
2182
|
+
format: output,
|
|
2183
|
+
fileSize: payload.length,
|
|
2184
|
+
},
|
|
2185
|
+
binary,
|
|
2186
|
+
pairedItem: { item: i },
|
|
2187
|
+
});
|
|
2188
|
+
return;
|
|
2189
|
+
}
|
|
2190
|
+
const { response, ...rest } = payload;
|
|
2191
|
+
const meta = payload.meta || {};
|
|
2192
|
+
const fileName = meta.name || fallbackName;
|
|
2193
|
+
const mimeType = meta['content-type'] || fallbackMimeType;
|
|
2194
|
+
const binary = {};
|
|
2195
|
+
binary.data = await this.helpers.prepareBinaryData(Buffer.from(response, 'base64'), fileName, mimeType);
|
|
2196
|
+
returnData.push({
|
|
2197
|
+
json: {
|
|
2198
|
+
success: true,
|
|
2199
|
+
filename: fileName,
|
|
2200
|
+
format: output,
|
|
2201
|
+
...rest,
|
|
2202
|
+
},
|
|
2203
|
+
binary,
|
|
2204
|
+
pairedItem: { item: i },
|
|
2205
|
+
});
|
|
2206
|
+
};
|
|
2207
|
+
if (operation === 'createEInvoice' || operation === 'createXRechnung') {
|
|
2208
|
+
const data = this.getNodeParameter('einvoiceData', i);
|
|
2209
|
+
const output = this.getNodeParameter('einvoiceOutput', i, 'base64');
|
|
2210
|
+
const additionalFields = this.getNodeParameter('einvoiceAdditionalFields', i, {});
|
|
2211
|
+
const type = String(this.getNodeParameter('einvoiceType', i, 'UBL') || 'UBL').toUpperCase();
|
|
2212
|
+
if (!['UBL', 'CII'].includes(type)) {
|
|
2213
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Formatting Type must be UBL or CII, got "${type}"`, {
|
|
2214
|
+
itemIndex: i,
|
|
2215
|
+
});
|
|
2216
|
+
}
|
|
2217
|
+
const body = {
|
|
2218
|
+
data: parseJSON(data, 'Invoice Data'),
|
|
2219
|
+
type,
|
|
2220
|
+
output,
|
|
2221
|
+
};
|
|
2222
|
+
const options = {
|
|
2223
|
+
method: 'POST',
|
|
2224
|
+
baseURL,
|
|
2225
|
+
url: operation === 'createXRechnung' ? '/einvoice/xrechnung' : '/einvoice',
|
|
2226
|
+
body,
|
|
2227
|
+
json: output !== 'file',
|
|
2228
|
+
encoding: output === 'file' ? 'arraybuffer' : 'json',
|
|
2229
|
+
};
|
|
2230
|
+
responseData = await callEInvoice(options);
|
|
2231
|
+
if (responseData) {
|
|
2232
|
+
const prefix = operation === 'createXRechnung' ? 'xrechnung' : 'einvoice';
|
|
2233
|
+
const baseName = String(additionalFields.outputName || `${prefix}-${type.toLowerCase()}`).replace(/\.xml$/i, '');
|
|
2234
|
+
await pushDocument(responseData, output, `${baseName}.xml`, 'application/xml');
|
|
2235
|
+
continue;
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
else if (operation === 'createFacturX') {
|
|
2239
|
+
const templateIdParam = this.getNodeParameter('templateId', i);
|
|
2240
|
+
const templateId = typeof templateIdParam === 'string' ? templateIdParam : templateIdParam.value;
|
|
2241
|
+
const data = this.getNodeParameter('einvoiceData', i);
|
|
2242
|
+
const profile = this.getNodeParameter('facturxProfile', i, 'en16931');
|
|
2243
|
+
const output = this.getNodeParameter('facturxOutput', i, 'base64');
|
|
2244
|
+
const additionalFields = this.getNodeParameter('facturxAdditionalFields', i, {});
|
|
2245
|
+
const id = Number(templateId);
|
|
2246
|
+
if (!templateId || !Number.isInteger(id) || id <= 0) {
|
|
2247
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Template is required for Factur-X and must be a numeric ID', { itemIndex: i });
|
|
2248
|
+
}
|
|
2249
|
+
const template = {
|
|
2250
|
+
id,
|
|
2251
|
+
data: parseJSON(data, 'Invoice Data'),
|
|
2252
|
+
};
|
|
2253
|
+
if (additionalFields.versionId)
|
|
2254
|
+
template.version_id = Number(additionalFields.versionId);
|
|
2255
|
+
const body = {
|
|
2256
|
+
template,
|
|
2257
|
+
profile,
|
|
2258
|
+
output,
|
|
2259
|
+
};
|
|
2260
|
+
if (additionalFields.outputName)
|
|
2261
|
+
body.name = additionalFields.outputName;
|
|
2262
|
+
if (additionalFields.author || additionalFields.language) {
|
|
2263
|
+
body.metadata = {};
|
|
2264
|
+
if (additionalFields.author)
|
|
2265
|
+
body.metadata.author = additionalFields.author;
|
|
2266
|
+
if (additionalFields.language)
|
|
2267
|
+
body.metadata.language = additionalFields.language;
|
|
2268
|
+
}
|
|
2269
|
+
const options = {
|
|
2270
|
+
method: 'POST',
|
|
2271
|
+
baseURL,
|
|
2272
|
+
url: '/einvoice/facturx',
|
|
2273
|
+
body,
|
|
2274
|
+
json: output !== 'file',
|
|
2275
|
+
encoding: output === 'file' ? 'arraybuffer' : 'json',
|
|
2276
|
+
};
|
|
2277
|
+
responseData = await callEInvoice(options);
|
|
2278
|
+
if (responseData && (output === 'base64' || output === 'file')) {
|
|
2279
|
+
const fallbackName = `${additionalFields.outputName || 'facturx-invoice'}.pdf`;
|
|
2280
|
+
await pushDocument(responseData, output, fallbackName, 'application/pdf');
|
|
2281
|
+
continue;
|
|
2282
|
+
}
|
|
2283
|
+
}
|
|
2284
|
+
else if (operation === 'getEInvoiceSchema') {
|
|
2285
|
+
const options = {
|
|
2286
|
+
method: 'GET',
|
|
2287
|
+
baseURL,
|
|
2288
|
+
url: '/einvoice/schema',
|
|
2289
|
+
json: true,
|
|
2290
|
+
};
|
|
2291
|
+
responseData = await callEInvoice(options);
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
1836
2294
|
else if (resource === 'conversion') {
|
|
1837
2295
|
const conversionOptions = this.getNodeParameter('conversionOptions', i, {});
|
|
1838
2296
|
const filename = this.getNodeParameter('filename', i);
|
|
@@ -1872,9 +2330,9 @@ class PdfGeneratorApi {
|
|
|
1872
2330
|
url: '/conversion/html2pdf',
|
|
1873
2331
|
body,
|
|
1874
2332
|
json: body.output !== 'file',
|
|
1875
|
-
encoding: body.output === 'file' ?
|
|
2333
|
+
encoding: body.output === 'file' ? 'arraybuffer' : 'json',
|
|
1876
2334
|
};
|
|
1877
|
-
responseData = await
|
|
2335
|
+
responseData = await apiRequest(options, i);
|
|
1878
2336
|
}
|
|
1879
2337
|
else if (operation === 'urlToPdf') {
|
|
1880
2338
|
const url = this.getNodeParameter('url', i);
|
|
@@ -1885,9 +2343,9 @@ class PdfGeneratorApi {
|
|
|
1885
2343
|
url: '/conversion/url2pdf',
|
|
1886
2344
|
body,
|
|
1887
2345
|
json: body.output !== 'file',
|
|
1888
|
-
encoding: body.output === 'file' ?
|
|
2346
|
+
encoding: body.output === 'file' ? 'arraybuffer' : 'json',
|
|
1889
2347
|
};
|
|
1890
|
-
responseData = await
|
|
2348
|
+
responseData = await apiRequest(options, i);
|
|
1891
2349
|
}
|
|
1892
2350
|
if (responseData) {
|
|
1893
2351
|
const outputFormat = body.output || 'base64';
|
|
@@ -1903,6 +2361,7 @@ class PdfGeneratorApi {
|
|
|
1903
2361
|
fileSize: responseData.length,
|
|
1904
2362
|
},
|
|
1905
2363
|
binary: binaryData,
|
|
2364
|
+
pairedItem: { item: i },
|
|
1906
2365
|
});
|
|
1907
2366
|
}
|
|
1908
2367
|
else {
|
|
@@ -1913,6 +2372,7 @@ class PdfGeneratorApi {
|
|
|
1913
2372
|
format: outputFormat,
|
|
1914
2373
|
...responseData,
|
|
1915
2374
|
},
|
|
2375
|
+
pairedItem: { item: i },
|
|
1916
2376
|
});
|
|
1917
2377
|
}
|
|
1918
2378
|
continue;
|
|
@@ -1939,7 +2399,7 @@ class PdfGeneratorApi {
|
|
|
1939
2399
|
qs,
|
|
1940
2400
|
json: true,
|
|
1941
2401
|
};
|
|
1942
|
-
responseData = await
|
|
2402
|
+
responseData = await apiRequest(options, i);
|
|
1943
2403
|
}
|
|
1944
2404
|
else if (operation === 'get') {
|
|
1945
2405
|
const publicId = this.getNodeParameter('publicId', i);
|
|
@@ -1949,7 +2409,7 @@ class PdfGeneratorApi {
|
|
|
1949
2409
|
url: `/documents/${publicId}`,
|
|
1950
2410
|
json: true,
|
|
1951
2411
|
};
|
|
1952
|
-
responseData = await
|
|
2412
|
+
responseData = await apiRequest(options, i);
|
|
1953
2413
|
}
|
|
1954
2414
|
else if (operation === 'delete') {
|
|
1955
2415
|
const publicId = this.getNodeParameter('publicId', i);
|
|
@@ -1959,7 +2419,7 @@ class PdfGeneratorApi {
|
|
|
1959
2419
|
url: `/documents/${publicId}`,
|
|
1960
2420
|
json: true,
|
|
1961
2421
|
};
|
|
1962
|
-
await
|
|
2422
|
+
await apiRequest(options, i);
|
|
1963
2423
|
responseData = {
|
|
1964
2424
|
success: true,
|
|
1965
2425
|
message: 'Document deleted successfully',
|
|
@@ -1991,9 +2451,9 @@ class PdfGeneratorApi {
|
|
|
1991
2451
|
url: '/documents/generate',
|
|
1992
2452
|
body,
|
|
1993
2453
|
json: output !== 'file',
|
|
1994
|
-
encoding: output === 'file' ?
|
|
2454
|
+
encoding: output === 'file' ? 'arraybuffer' : 'json',
|
|
1995
2455
|
};
|
|
1996
|
-
responseData = await
|
|
2456
|
+
responseData = await apiRequest(options, i);
|
|
1997
2457
|
if (responseData && output !== 'url' && output !== 'viewer') {
|
|
1998
2458
|
if (output === 'file') {
|
|
1999
2459
|
const binaryData = {};
|
|
@@ -2007,6 +2467,7 @@ class PdfGeneratorApi {
|
|
|
2007
2467
|
fileSize: responseData.length,
|
|
2008
2468
|
},
|
|
2009
2469
|
binary: binaryData,
|
|
2470
|
+
pairedItem: { item: i },
|
|
2010
2471
|
});
|
|
2011
2472
|
continue;
|
|
2012
2473
|
}
|
|
@@ -2018,6 +2479,7 @@ class PdfGeneratorApi {
|
|
|
2018
2479
|
format: output,
|
|
2019
2480
|
...responseData,
|
|
2020
2481
|
},
|
|
2482
|
+
pairedItem: { item: i },
|
|
2021
2483
|
});
|
|
2022
2484
|
continue;
|
|
2023
2485
|
}
|
|
@@ -2058,7 +2520,7 @@ class PdfGeneratorApi {
|
|
|
2058
2520
|
body,
|
|
2059
2521
|
json: true,
|
|
2060
2522
|
};
|
|
2061
|
-
responseData = await
|
|
2523
|
+
responseData = await apiRequest(options, i);
|
|
2062
2524
|
}
|
|
2063
2525
|
else if (operation === 'generateBatch') {
|
|
2064
2526
|
const templates = this.getNodeParameter('templates', i);
|
|
@@ -2087,9 +2549,9 @@ class PdfGeneratorApi {
|
|
|
2087
2549
|
url: '/documents/generate/batch',
|
|
2088
2550
|
body,
|
|
2089
2551
|
json: output !== 'file',
|
|
2090
|
-
encoding: output === 'file' ?
|
|
2552
|
+
encoding: output === 'file' ? 'arraybuffer' : 'json',
|
|
2091
2553
|
};
|
|
2092
|
-
responseData = await
|
|
2554
|
+
responseData = await apiRequest(options, i);
|
|
2093
2555
|
if (responseData && output !== 'url' && output !== 'viewer') {
|
|
2094
2556
|
if (output === 'file') {
|
|
2095
2557
|
const binaryData = {};
|
|
@@ -2103,6 +2565,7 @@ class PdfGeneratorApi {
|
|
|
2103
2565
|
fileSize: responseData.length,
|
|
2104
2566
|
},
|
|
2105
2567
|
binary: binaryData,
|
|
2568
|
+
pairedItem: { item: i },
|
|
2106
2569
|
});
|
|
2107
2570
|
continue;
|
|
2108
2571
|
}
|
|
@@ -2114,6 +2577,7 @@ class PdfGeneratorApi {
|
|
|
2114
2577
|
format: output,
|
|
2115
2578
|
...responseData,
|
|
2116
2579
|
},
|
|
2580
|
+
pairedItem: { item: i },
|
|
2117
2581
|
});
|
|
2118
2582
|
continue;
|
|
2119
2583
|
}
|
|
@@ -2156,7 +2620,7 @@ class PdfGeneratorApi {
|
|
|
2156
2620
|
body,
|
|
2157
2621
|
json: true,
|
|
2158
2622
|
};
|
|
2159
|
-
responseData = await
|
|
2623
|
+
responseData = await apiRequest(options, i);
|
|
2160
2624
|
}
|
|
2161
2625
|
}
|
|
2162
2626
|
else if (resource === 'template') {
|
|
@@ -2180,7 +2644,7 @@ class PdfGeneratorApi {
|
|
|
2180
2644
|
qs,
|
|
2181
2645
|
json: true,
|
|
2182
2646
|
};
|
|
2183
|
-
responseData = await
|
|
2647
|
+
responseData = await apiRequest(options, i);
|
|
2184
2648
|
}
|
|
2185
2649
|
else if (operation === 'get') {
|
|
2186
2650
|
const templateIdParam = this.getNodeParameter('templateId', i);
|
|
@@ -2191,7 +2655,7 @@ class PdfGeneratorApi {
|
|
|
2191
2655
|
url: `/templates/${templateId}`,
|
|
2192
2656
|
json: true,
|
|
2193
2657
|
};
|
|
2194
|
-
responseData = await
|
|
2658
|
+
responseData = await apiRequest(options, i);
|
|
2195
2659
|
}
|
|
2196
2660
|
else if (operation === 'create') {
|
|
2197
2661
|
const templateConfiguration = this.getNodeParameter('templateConfiguration', i);
|
|
@@ -2203,7 +2667,7 @@ class PdfGeneratorApi {
|
|
|
2203
2667
|
body,
|
|
2204
2668
|
json: true,
|
|
2205
2669
|
};
|
|
2206
|
-
responseData = await
|
|
2670
|
+
responseData = await apiRequest(options, i);
|
|
2207
2671
|
}
|
|
2208
2672
|
else if (operation === 'update') {
|
|
2209
2673
|
const templateIdParam = this.getNodeParameter('templateId', i);
|
|
@@ -2217,7 +2681,7 @@ class PdfGeneratorApi {
|
|
|
2217
2681
|
body,
|
|
2218
2682
|
json: true,
|
|
2219
2683
|
};
|
|
2220
|
-
responseData = await
|
|
2684
|
+
responseData = await apiRequest(options, i);
|
|
2221
2685
|
}
|
|
2222
2686
|
else if (operation === 'delete') {
|
|
2223
2687
|
const templateIdParam = this.getNodeParameter('templateId', i);
|
|
@@ -2228,7 +2692,7 @@ class PdfGeneratorApi {
|
|
|
2228
2692
|
url: `/templates/${templateId}`,
|
|
2229
2693
|
json: true,
|
|
2230
2694
|
};
|
|
2231
|
-
await
|
|
2695
|
+
await apiRequest(options, i);
|
|
2232
2696
|
responseData = {
|
|
2233
2697
|
success: true,
|
|
2234
2698
|
message: 'Template deleted successfully',
|
|
@@ -2248,7 +2712,7 @@ class PdfGeneratorApi {
|
|
|
2248
2712
|
body,
|
|
2249
2713
|
json: true,
|
|
2250
2714
|
};
|
|
2251
|
-
responseData = await
|
|
2715
|
+
responseData = await apiRequest(options, i);
|
|
2252
2716
|
}
|
|
2253
2717
|
else if (operation === 'getDataFields') {
|
|
2254
2718
|
const templateIdParam = this.getNodeParameter('templateId', i);
|
|
@@ -2259,7 +2723,7 @@ class PdfGeneratorApi {
|
|
|
2259
2723
|
url: `/templates/${templateId}/data`,
|
|
2260
2724
|
json: true,
|
|
2261
2725
|
};
|
|
2262
|
-
responseData = await
|
|
2726
|
+
responseData = await apiRequest(options, i);
|
|
2263
2727
|
}
|
|
2264
2728
|
else if (operation === 'getTemplateSchema') {
|
|
2265
2729
|
const options = {
|
|
@@ -2268,7 +2732,7 @@ class PdfGeneratorApi {
|
|
|
2268
2732
|
url: '/templates/schema',
|
|
2269
2733
|
json: true,
|
|
2270
2734
|
};
|
|
2271
|
-
responseData = await
|
|
2735
|
+
responseData = await apiRequest(options, i);
|
|
2272
2736
|
}
|
|
2273
2737
|
else if (operation === 'copy') {
|
|
2274
2738
|
const templateIdParam = this.getNodeParameter('templateId', i);
|
|
@@ -2284,7 +2748,7 @@ class PdfGeneratorApi {
|
|
|
2284
2748
|
body,
|
|
2285
2749
|
json: true,
|
|
2286
2750
|
};
|
|
2287
|
-
responseData = await
|
|
2751
|
+
responseData = await apiRequest(options, i);
|
|
2288
2752
|
}
|
|
2289
2753
|
else if (operation === 'openEditor') {
|
|
2290
2754
|
const templateIdParam = this.getNodeParameter('templateId', i);
|
|
@@ -2302,7 +2766,7 @@ class PdfGeneratorApi {
|
|
|
2302
2766
|
body,
|
|
2303
2767
|
json: true,
|
|
2304
2768
|
};
|
|
2305
|
-
responseData = await
|
|
2769
|
+
responseData = await apiRequest(options, i);
|
|
2306
2770
|
}
|
|
2307
2771
|
}
|
|
2308
2772
|
else if (resource === 'pdfServices') {
|
|
@@ -2366,9 +2830,9 @@ class PdfGeneratorApi {
|
|
|
2366
2830
|
url: '/pdfservices/watermark',
|
|
2367
2831
|
body,
|
|
2368
2832
|
json: outputFormat !== 'file',
|
|
2369
|
-
encoding: outputFormat === 'file' ?
|
|
2833
|
+
encoding: outputFormat === 'file' ? 'arraybuffer' : 'json',
|
|
2370
2834
|
};
|
|
2371
|
-
responseData = await
|
|
2835
|
+
responseData = await apiRequest(options, i);
|
|
2372
2836
|
}
|
|
2373
2837
|
else if (operation === 'encrypt') {
|
|
2374
2838
|
const ownerPassword = this.getNodeParameter('ownerPassword', i);
|
|
@@ -2383,9 +2847,9 @@ class PdfGeneratorApi {
|
|
|
2383
2847
|
url: '/pdfservices/encrypt',
|
|
2384
2848
|
body,
|
|
2385
2849
|
json: outputFormat !== 'file',
|
|
2386
|
-
encoding: outputFormat === 'file' ?
|
|
2850
|
+
encoding: outputFormat === 'file' ? 'arraybuffer' : 'json',
|
|
2387
2851
|
};
|
|
2388
|
-
responseData = await
|
|
2852
|
+
responseData = await apiRequest(options, i);
|
|
2389
2853
|
}
|
|
2390
2854
|
else if (operation === 'decrypt') {
|
|
2391
2855
|
const decryptionPassword = this.getNodeParameter('decryptionPassword', i);
|
|
@@ -2397,9 +2861,9 @@ class PdfGeneratorApi {
|
|
|
2397
2861
|
url: '/pdfservices/decrypt',
|
|
2398
2862
|
body,
|
|
2399
2863
|
json: outputFormat !== 'file',
|
|
2400
|
-
encoding: outputFormat === 'file' ?
|
|
2864
|
+
encoding: outputFormat === 'file' ? 'arraybuffer' : 'json',
|
|
2401
2865
|
};
|
|
2402
|
-
responseData = await
|
|
2866
|
+
responseData = await apiRequest(options, i);
|
|
2403
2867
|
}
|
|
2404
2868
|
else if (operation === 'extractFormFields') {
|
|
2405
2869
|
const options = {
|
|
@@ -2409,7 +2873,7 @@ class PdfGeneratorApi {
|
|
|
2409
2873
|
body,
|
|
2410
2874
|
json: true,
|
|
2411
2875
|
};
|
|
2412
|
-
responseData = await
|
|
2876
|
+
responseData = await apiRequest(options, i);
|
|
2413
2877
|
}
|
|
2414
2878
|
else if (operation === 'fillFormFields') {
|
|
2415
2879
|
const formFieldsData = this.getNodeParameter('formFieldsData', i);
|
|
@@ -2421,9 +2885,9 @@ class PdfGeneratorApi {
|
|
|
2421
2885
|
url: '/pdfservices/form/fill',
|
|
2422
2886
|
body,
|
|
2423
2887
|
json: outputFormat !== 'file',
|
|
2424
|
-
encoding: outputFormat === 'file' ?
|
|
2888
|
+
encoding: outputFormat === 'file' ? 'arraybuffer' : 'json',
|
|
2425
2889
|
};
|
|
2426
|
-
responseData = await
|
|
2890
|
+
responseData = await apiRequest(options, i);
|
|
2427
2891
|
}
|
|
2428
2892
|
else if (operation === 'optimize') {
|
|
2429
2893
|
const options = {
|
|
@@ -2432,10 +2896,10 @@ class PdfGeneratorApi {
|
|
|
2432
2896
|
url: '/pdfservices/optimize',
|
|
2433
2897
|
body,
|
|
2434
2898
|
json: outputFormat !== 'file',
|
|
2435
|
-
encoding: outputFormat === 'file' ?
|
|
2436
|
-
|
|
2899
|
+
encoding: outputFormat === 'file' ? 'arraybuffer' : 'json',
|
|
2900
|
+
returnFullResponse: true,
|
|
2437
2901
|
};
|
|
2438
|
-
const fullResponse = await
|
|
2902
|
+
const fullResponse = await apiRequest(options, i);
|
|
2439
2903
|
responseData = fullResponse.body;
|
|
2440
2904
|
const headers = fullResponse.headers || {};
|
|
2441
2905
|
const originalSize = headers['x-original-size'] ? parseInt(headers['x-original-size'], 10) : null;
|
|
@@ -2454,6 +2918,7 @@ class PdfGeneratorApi {
|
|
|
2454
2918
|
operation,
|
|
2455
2919
|
...responseData,
|
|
2456
2920
|
},
|
|
2921
|
+
pairedItem: { item: i },
|
|
2457
2922
|
});
|
|
2458
2923
|
}
|
|
2459
2924
|
else if (outputFormat === 'file') {
|
|
@@ -2478,6 +2943,7 @@ class PdfGeneratorApi {
|
|
|
2478
2943
|
returnData.push({
|
|
2479
2944
|
json: jsonResponse,
|
|
2480
2945
|
binary: binaryData,
|
|
2946
|
+
pairedItem: { item: i },
|
|
2481
2947
|
});
|
|
2482
2948
|
}
|
|
2483
2949
|
else {
|
|
@@ -2497,6 +2963,7 @@ class PdfGeneratorApi {
|
|
|
2497
2963
|
}
|
|
2498
2964
|
returnData.push({
|
|
2499
2965
|
json: jsonResponse,
|
|
2966
|
+
pairedItem: { item: i },
|
|
2500
2967
|
});
|
|
2501
2968
|
}
|
|
2502
2969
|
continue;
|
|
@@ -2517,7 +2984,7 @@ class PdfGeneratorApi {
|
|
|
2517
2984
|
qs,
|
|
2518
2985
|
json: true,
|
|
2519
2986
|
};
|
|
2520
|
-
responseData = await
|
|
2987
|
+
responseData = await apiRequest(options, i);
|
|
2521
2988
|
}
|
|
2522
2989
|
else if (operation === 'create') {
|
|
2523
2990
|
const identifier = this.getNodeParameter('identifier', i);
|
|
@@ -2531,7 +2998,7 @@ class PdfGeneratorApi {
|
|
|
2531
2998
|
body,
|
|
2532
2999
|
json: true,
|
|
2533
3000
|
};
|
|
2534
|
-
responseData = await
|
|
3001
|
+
responseData = await apiRequest(options, i);
|
|
2535
3002
|
}
|
|
2536
3003
|
else if (operation === 'get') {
|
|
2537
3004
|
const workspaceIdentifier = this.getNodeParameter('workspaceIdentifier', i);
|
|
@@ -2541,7 +3008,7 @@ class PdfGeneratorApi {
|
|
|
2541
3008
|
url: `/workspaces/${encodeURIComponent(workspaceIdentifier)}`,
|
|
2542
3009
|
json: true,
|
|
2543
3010
|
};
|
|
2544
|
-
responseData = await
|
|
3011
|
+
responseData = await apiRequest(options, i);
|
|
2545
3012
|
}
|
|
2546
3013
|
else if (operation === 'delete') {
|
|
2547
3014
|
const workspaceIdentifier = this.getNodeParameter('workspaceIdentifier', i);
|
|
@@ -2551,7 +3018,11 @@ class PdfGeneratorApi {
|
|
|
2551
3018
|
url: `/workspaces/${encodeURIComponent(workspaceIdentifier)}`,
|
|
2552
3019
|
json: true,
|
|
2553
3020
|
};
|
|
2554
|
-
responseData = await
|
|
3021
|
+
responseData = (await apiRequest(options, i)) || {
|
|
3022
|
+
success: true,
|
|
3023
|
+
message: 'Workspace deleted successfully',
|
|
3024
|
+
workspaceIdentifier,
|
|
3025
|
+
};
|
|
2555
3026
|
}
|
|
2556
3027
|
}
|
|
2557
3028
|
if (responseData === undefined) {
|
|
@@ -2566,7 +3037,10 @@ class PdfGeneratorApi {
|
|
|
2566
3037
|
returnData.push(...executionErrorData);
|
|
2567
3038
|
continue;
|
|
2568
3039
|
}
|
|
2569
|
-
|
|
3040
|
+
if (error instanceof n8n_workflow_1.NodeOperationError) {
|
|
3041
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
|
|
3042
|
+
}
|
|
3043
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error, { itemIndex: i });
|
|
2570
3044
|
}
|
|
2571
3045
|
}
|
|
2572
3046
|
return [returnData];
|