@limetech/n8n-nodes-lime 2.6.1 → 3.0.0
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/CHANGELOG.md +10 -0
- package/credentials/index.ts +0 -1
- package/dist/credentials/index.d.ts +0 -1
- package/dist/credentials/index.js +0 -1
- package/dist/credentials/index.js.map +1 -1
- package/dist/nodes/index.d.ts +0 -1
- package/dist/nodes/index.js +0 -1
- package/dist/nodes/index.js.map +1 -1
- package/dist/package.json +0 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/nodes/index.ts +0 -1
- package/package.json +1 -9
- package/credentials/FortnoxApi.credentials.ts +0 -61
- package/dist/credentials/FortnoxApi.credentials.d.ts +0 -9
- package/dist/credentials/FortnoxApi.credentials.js +0 -57
- package/dist/credentials/FortnoxApi.credentials.js.map +0 -1
- package/dist/nodes/fortnox/Fortnox.node.d.ts +0 -5
- package/dist/nodes/fortnox/Fortnox.node.js +0 -95
- package/dist/nodes/fortnox/Fortnox.node.js.map +0 -1
- package/dist/nodes/fortnox/Fortnox.node.json +0 -18
- package/dist/nodes/fortnox/FortnoxTrigger.node.d.ts +0 -5
- package/dist/nodes/fortnox/FortnoxTrigger.node.js +0 -155
- package/dist/nodes/fortnox/FortnoxTrigger.node.js.map +0 -1
- package/dist/nodes/fortnox/FortnoxTrigger.node.json +0 -18
- package/dist/nodes/fortnox/commons.d.ts +0 -25
- package/dist/nodes/fortnox/commons.js +0 -44
- package/dist/nodes/fortnox/commons.js.map +0 -1
- package/dist/nodes/fortnox/fortnoxLogo.svg +0 -15
- package/dist/nodes/fortnox/index.d.ts +0 -6
- package/dist/nodes/fortnox/index.js +0 -23
- package/dist/nodes/fortnox/index.js.map +0 -1
- package/dist/nodes/fortnox/model.d.ts +0 -20
- package/dist/nodes/fortnox/model.js +0 -3
- package/dist/nodes/fortnox/model.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/filterParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/customers/filterParameters.js +0 -31
- package/dist/nodes/fortnox/resources/customers/filterParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/index.d.ts +0 -7
- package/dist/nodes/fortnox/resources/customers/index.js +0 -85
- package/dist/nodes/fortnox/resources/customers/index.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/model.d.ts +0 -99
- package/dist/nodes/fortnox/resources/customers/model.js +0 -3
- package/dist/nodes/fortnox/resources/customers/model.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.js +0 -281
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.d.ts +0 -9
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js +0 -38
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.js +0 -38
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js +0 -68
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/index.d.ts +0 -5
- package/dist/nodes/fortnox/resources/customers/operations/index.js +0 -42
- package/dist/nodes/fortnox/resources/customers/operations/index.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.js +0 -261
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/sortParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/customers/sortParameters.js +0 -30
- package/dist/nodes/fortnox/resources/customers/sortParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/filterParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/invoice/filterParameters.js +0 -72
- package/dist/nodes/fortnox/resources/invoice/filterParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/index.d.ts +0 -7
- package/dist/nodes/fortnox/resources/invoice/index.js +0 -81
- package/dist/nodes/fortnox/resources/invoice/index.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js +0 -193
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/model.d.ts +0 -147
- package/dist/nodes/fortnox/resources/invoice/model.js +0 -3
- package/dist/nodes/fortnox/resources/invoice/model.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js +0 -64
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js +0 -37
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js +0 -92
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/index.d.ts +0 -4
- package/dist/nodes/fortnox/resources/invoice/operations/index.js +0 -41
- package/dist/nodes/fortnox/resources/invoice/operations/index.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js +0 -64
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js.map +0 -1
- package/dist/nodes/fortnox/transport/errorCodes.d.ts +0 -1
- package/dist/nodes/fortnox/transport/errorCodes.js +0 -50
- package/dist/nodes/fortnox/transport/errorCodes.js.map +0 -1
- package/dist/nodes/fortnox/transport/index.d.ts +0 -3
- package/dist/nodes/fortnox/transport/index.js +0 -76
- package/dist/nodes/fortnox/transport/index.js.map +0 -1
- package/nodes/fortnox/Fortnox.node.json +0 -18
- package/nodes/fortnox/Fortnox.node.ts +0 -102
- package/nodes/fortnox/FortnoxTrigger.node.json +0 -18
- package/nodes/fortnox/FortnoxTrigger.node.ts +0 -196
- package/nodes/fortnox/commons.ts +0 -94
- package/nodes/fortnox/fortnoxLogo.svg +0 -15
- package/nodes/fortnox/index.ts +0 -6
- package/nodes/fortnox/model.ts +0 -25
- package/nodes/fortnox/resources/customers/filterParameters.ts +0 -47
- package/nodes/fortnox/resources/customers/index.ts +0 -53
- package/nodes/fortnox/resources/customers/model.ts +0 -107
- package/nodes/fortnox/resources/customers/operations/create.operation.ts +0 -307
- package/nodes/fortnox/resources/customers/operations/delete.operation.ts +0 -49
- package/nodes/fortnox/resources/customers/operations/get.operation.ts +0 -50
- package/nodes/fortnox/resources/customers/operations/getAll.operation.ts +0 -79
- package/nodes/fortnox/resources/customers/operations/index.ts +0 -5
- package/nodes/fortnox/resources/customers/operations/update.operation.ts +0 -288
- package/nodes/fortnox/resources/customers/sortParameters.ts +0 -32
- package/nodes/fortnox/resources/invoice/filterParameters.ts +0 -88
- package/nodes/fortnox/resources/invoice/index.ts +0 -49
- package/nodes/fortnox/resources/invoice/invoiceParameters.ts +0 -214
- package/nodes/fortnox/resources/invoice/model.ts +0 -156
- package/nodes/fortnox/resources/invoice/operations/create.operation.ts +0 -71
- package/nodes/fortnox/resources/invoice/operations/get.operation.ts +0 -50
- package/nodes/fortnox/resources/invoice/operations/getAll.operation.ts +0 -100
- package/nodes/fortnox/resources/invoice/operations/index.ts +0 -4
- package/nodes/fortnox/resources/invoice/operations/update.operation.ts +0 -79
- package/nodes/fortnox/transport/errorCodes.ts +0 -62
- package/nodes/fortnox/transport/index.ts +0 -106
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
-
import { CreateInvoiceResponse } from '../model';
|
|
3
|
-
export declare const description: {
|
|
4
|
-
name: string;
|
|
5
|
-
value: string;
|
|
6
|
-
description: string;
|
|
7
|
-
action: string;
|
|
8
|
-
};
|
|
9
|
-
export declare const properties: INodeProperties[];
|
|
10
|
-
export declare function execute(this: IExecuteFunctions, i: number): Promise<CreateInvoiceResponse>;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.properties = exports.description = void 0;
|
|
4
|
-
exports.execute = execute;
|
|
5
|
-
const transport_1 = require("../../../transport");
|
|
6
|
-
const invoiceParameters_1 = require("../invoiceParameters");
|
|
7
|
-
exports.description = {
|
|
8
|
-
name: 'Update',
|
|
9
|
-
value: 'update',
|
|
10
|
-
description: 'Update the invoice',
|
|
11
|
-
action: 'Update the document',
|
|
12
|
-
};
|
|
13
|
-
exports.properties = [
|
|
14
|
-
{
|
|
15
|
-
displayName: 'Document Number',
|
|
16
|
-
name: 'documentNumber',
|
|
17
|
-
type: 'string',
|
|
18
|
-
required: true,
|
|
19
|
-
default: '',
|
|
20
|
-
displayOptions: {
|
|
21
|
-
show: {
|
|
22
|
-
resource: ['invoice'],
|
|
23
|
-
operation: ['update'],
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
displayName: 'Add Parameters',
|
|
29
|
-
name: 'createParameters',
|
|
30
|
-
type: 'collection',
|
|
31
|
-
placeholder: 'Add Parameter',
|
|
32
|
-
default: {},
|
|
33
|
-
displayOptions: {
|
|
34
|
-
show: {
|
|
35
|
-
resource: ['invoice'],
|
|
36
|
-
operation: ['update'],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
options: invoiceParameters_1.invoiceParameters,
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
async function execute(i) {
|
|
43
|
-
const documentNumber = this.getNodeParameter('documentNumber', i, {});
|
|
44
|
-
const updateParameters = this.getNodeParameter('invoiceParameters', i, {});
|
|
45
|
-
const body = {
|
|
46
|
-
Invoice: {},
|
|
47
|
-
};
|
|
48
|
-
if (updateParameters) {
|
|
49
|
-
for (const [key, value] of Object.entries(updateParameters)) {
|
|
50
|
-
if (value !== '' && value !== undefined && value !== null) {
|
|
51
|
-
body['Invoice'][key] = value;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
const endpoint = `invoices/${encodeURIComponent(documentNumber)}`;
|
|
56
|
-
return await (0, transport_1.apiRequest)(this, {
|
|
57
|
-
method: 'PUT',
|
|
58
|
-
endpoint: endpoint,
|
|
59
|
-
body: body,
|
|
60
|
-
}, {
|
|
61
|
-
id: documentNumber,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=update.operation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update.operation.js","sourceRoot":"","sources":["../../../../../../nodes/fortnox/resources/invoice/operations/update.operation.ts"],"names":[],"mappings":";;;AA0CA,0BAoCC;AA7ED,kDAAgD;AAEhD,4DAAyD;AAE5C,QAAA,WAAW,GAAG;IACvB,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,QAAQ;IACf,WAAW,EAAE,oBAAoB;IACjC,MAAM,EAAE,qBAAqB;CAChC,CAAC;AAEW,QAAA,UAAU,GAAsB;IACzC;QACI,WAAW,EAAE,iBAAiB;QAC9B,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACZ,IAAI,EAAE;gBACF,QAAQ,EAAE,CAAC,SAAS,CAAC;gBACrB,SAAS,EAAE,CAAC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1
|
-
export declare function translateErrorCode(errorCode: number): string;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.translateErrorCode = translateErrorCode;
|
|
4
|
-
const errorMessages = {
|
|
5
|
-
1000003: 'System exception: Something went wrong on our end, please contact our support',
|
|
6
|
-
1000030: 'Invalid response type: The provided response type(Accept) was invalid.',
|
|
7
|
-
1000031: 'Invalid content type: The provided content type was invalid.',
|
|
8
|
-
2000106: 'The value needs to be alphanumeric.',
|
|
9
|
-
2000108: 'The value needs to be numeric.',
|
|
10
|
-
2000134: 'The value needs to be boolean',
|
|
11
|
-
2000310: 'The Client-Secret or the Access-Token is either missing or is incorrect.',
|
|
12
|
-
2000311: 'The Client-Secret or the Access-Token is either missing or is incorrect.',
|
|
13
|
-
2000359: 'The value contains invalid characters.',
|
|
14
|
-
2000588: 'A parameter is invalid. Read more about parameters in the Parameters page.',
|
|
15
|
-
2000637: 'Customer number 1 is/has already been used and is reserved even if it has been deleted.',
|
|
16
|
-
2000729: 'A valid identifier was not provided.',
|
|
17
|
-
2001103: 'The requested Fortnox account does not have a license to use the API.',
|
|
18
|
-
2001392: 'The request body was empty or contained incorrect data.',
|
|
19
|
-
2001740: 'The XML object contained an error.',
|
|
20
|
-
2002115: 'The JSON object contained an error.',
|
|
21
|
-
2001304: 'Could not find Account used in the request/attached to an element.',
|
|
22
|
-
2001399: 'Invalid Field name',
|
|
23
|
-
2001101: 'There is no active licens for the desired scope.',
|
|
24
|
-
2000663: 'No access to the current scope.',
|
|
25
|
-
2003095: 'Account is missing for Purchase SE reversed tax liability, in predefined accounts.',
|
|
26
|
-
2000755: 'Supplier invoice debit and credit does not balance',
|
|
27
|
-
2003115: 'Tax Rows for VAT type REVERSE must be marked with CODE',
|
|
28
|
-
2003124: 'Only order that has been delivered can be marked as warehouseready',
|
|
29
|
-
2003125: 'A document that has been set to warehouseready can not be modified.',
|
|
30
|
-
2003126: 'Delviered date can not be later than todays date.',
|
|
31
|
-
2003241: 'Migration has allready been started or finished.',
|
|
32
|
-
2003275: 'Not authorized',
|
|
33
|
-
2003277: 'Was not found in the warehouse module.',
|
|
34
|
-
2003399: 'The document is voided in the warehouse module',
|
|
35
|
-
2003127: 'An error has occured in the warehouse module',
|
|
36
|
-
2000204: 'The customer in the request is not available in the customer resource.',
|
|
37
|
-
2000433: 'The customer in the request is not available in the customer resource.',
|
|
38
|
-
2001302: 'Could not find article used in request',
|
|
39
|
-
2000428: 'Could not find article used in request',
|
|
40
|
-
2000865: 'An incorrect sort field has been used.',
|
|
41
|
-
2000587: 'An invalid filter has been used.',
|
|
42
|
-
2001422: 'Invalid currency.',
|
|
43
|
-
2004195: 'VAT number must be entered for selected VAT type.',
|
|
44
|
-
2004194: 'Invalid VAT number.',
|
|
45
|
-
2001314: 'Invalid cost center.',
|
|
46
|
-
};
|
|
47
|
-
function translateErrorCode(errorCode) {
|
|
48
|
-
return errorMessages[errorCode] || 'Unknown error code';
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=errorCodes.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errorCodes.js","sourceRoot":"","sources":["../../../../nodes/fortnox/transport/errorCodes.ts"],"names":[],"mappings":";;AA2DA,gDAEC;AA3DD,MAAM,aAAa,GAA8B;IAC7C,OAAO,EACH,+EAA+E;IACnF,OAAO,EACH,wEAAwE;IAC5E,OAAO,EAAE,8DAA8D;IACvE,OAAO,EAAE,qCAAqC;IAC9C,OAAO,EAAE,gCAAgC;IACzC,OAAO,EAAE,+BAA+B;IACxC,OAAO,EACH,0EAA0E;IAC9E,OAAO,EACH,0EAA0E;IAC9E,OAAO,EAAE,wCAAwC;IACjD,OAAO,EACH,4EAA4E;IAChF,OAAO,EACH,yFAAyF;IAC7F,OAAO,EAAE,sCAAsC;IAC/C,OAAO,EACH,uEAAuE;IAC3E,OAAO,EAAE,yDAAyD;IAClE,OAAO,EAAE,oCAAoC;IAC7C,OAAO,EAAE,qCAAqC;IAC9C,OAAO,EACH,oEAAoE;IACxE,OAAO,EAAE,oBAAoB;IAC7B,OAAO,EAAE,kDAAkD;IAC3D,OAAO,EAAE,iCAAiC;IAC1C,OAAO,EACH,oFAAoF;IACxF,OAAO,EAAE,oDAAoD;IAC7D,OAAO,EAAE,wDAAwD;IACjE,OAAO,EACH,oEAAoE;IACxE,OAAO,EACH,qEAAqE;IACzE,OAAO,EAAE,mDAAmD;IAC5D,OAAO,EAAE,kDAAkD;IAC3D,OAAO,EAAE,gBAAgB;IACzB,OAAO,EAAE,wCAAwC;IACjD,OAAO,EAAE,gDAAgD;IACzD,OAAO,EAAE,8CAA8C;IACvD,OAAO,EACH,wEAAwE;IAC5E,OAAO,EACH,wEAAwE;IAC5E,OAAO,EAAE,wCAAwC;IACjD,OAAO,EAAE,wCAAwC;IACjD,OAAO,EAAE,wCAAwC;IACjD,OAAO,EAAE,kCAAkC;IAC3C,OAAO,EAAE,mBAAmB;IAC5B,OAAO,EAAE,mDAAmD;IAC5D,OAAO,EAAE,qBAAqB;IAC9B,OAAO,EAAE,sBAAsB;CAClC,CAAC;AAEF,SAAgB,kBAAkB,CAAC,SAAiB;IAChD,OAAO,aAAa,CAAC,SAAS,CAAC,IAAI,oBAAoB,CAAC;AAC5D,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { IExecuteFunctions, ILoadOptionsFunctions, IDataObject } from 'n8n-workflow';
|
|
2
|
-
export declare const FORTNOX_BASE_URL = "https://api.fortnox.se/3/";
|
|
3
|
-
export declare function apiRequest<T>(nodeContext: IExecuteFunctions | ILoadOptionsFunctions, options: IDataObject, errorMetadata?: Record<string, unknown>): Promise<T>;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FORTNOX_BASE_URL = void 0;
|
|
4
|
-
exports.apiRequest = apiRequest;
|
|
5
|
-
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
-
const errorCodes_1 = require("./errorCodes");
|
|
7
|
-
const commons_1 = require("../commons");
|
|
8
|
-
exports.FORTNOX_BASE_URL = 'https://api.fortnox.se/3/';
|
|
9
|
-
async function apiRequest(nodeContext, options, errorMetadata) {
|
|
10
|
-
var _a;
|
|
11
|
-
const endpoint = options.endpoint;
|
|
12
|
-
const method = options.method;
|
|
13
|
-
const credentials = await nodeContext.getCredentials(commons_1.FORTNOX_API_CREDENTIAL_KEY);
|
|
14
|
-
const requestOptions = {
|
|
15
|
-
method: method,
|
|
16
|
-
uri: `${exports.FORTNOX_BASE_URL}${endpoint}`,
|
|
17
|
-
json: true,
|
|
18
|
-
headers: {
|
|
19
|
-
Authorization: `Bearer ${credentials.token}`,
|
|
20
|
-
Accept: 'application/json',
|
|
21
|
-
'Content-Type': 'application/json',
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
if (options.qs && Object.keys(options.qs).length > 0) {
|
|
25
|
-
requestOptions.qs = options.qs;
|
|
26
|
-
}
|
|
27
|
-
if (options.body) {
|
|
28
|
-
requestOptions.body = options.body;
|
|
29
|
-
}
|
|
30
|
-
if (options.timeout) {
|
|
31
|
-
requestOptions.timeout = options.timeout;
|
|
32
|
-
}
|
|
33
|
-
const fullUrl = `${requestOptions.uri}${requestOptions.qs ? '?' + new URLSearchParams(requestOptions.qs).toString() : ''}`;
|
|
34
|
-
n8n_workflow_1.LoggerProxy.info(`URL: ${fullUrl}`);
|
|
35
|
-
try {
|
|
36
|
-
return await nodeContext.helpers.request.call(nodeContext, commons_1.FORTNOX_API_CREDENTIAL_KEY, requestOptions);
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
const errorResponse = error.error || {
|
|
40
|
-
ErrorInformation: {},
|
|
41
|
-
};
|
|
42
|
-
const errorInformation = (errorResponse === null || errorResponse === void 0 ? void 0 : errorResponse.ErrorInformation) && {
|
|
43
|
-
error: errorResponse.ErrorInformation.error ||
|
|
44
|
-
errorResponse.ErrorInformation.Error,
|
|
45
|
-
message: errorResponse.ErrorInformation.message ||
|
|
46
|
-
errorResponse.ErrorInformation.Message,
|
|
47
|
-
code: errorResponse.ErrorInformation.code ||
|
|
48
|
-
errorResponse.ErrorInformation.Code,
|
|
49
|
-
};
|
|
50
|
-
let message;
|
|
51
|
-
if (errorInformation) {
|
|
52
|
-
message = `API request failed [URL: ${fullUrl}][Method: ${method}]\n
|
|
53
|
-
[Error Information:\n
|
|
54
|
-
- Error: ${errorInformation.error || 'Unknown error'}\n
|
|
55
|
-
- Message: ${errorInformation.message || 'No message provided'}\n
|
|
56
|
-
- Code: ${errorInformation.code || 'No code provided'}\n
|
|
57
|
-
- Code Translation: ${(0, errorCodes_1.translateErrorCode)(errorInformation.code) || 'No translation available'}\n
|
|
58
|
-
]`;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
message = `API request failed [URL: ${fullUrl}][Method: ${method}]: ${error.message}`;
|
|
62
|
-
}
|
|
63
|
-
const errorContext = {
|
|
64
|
-
error: message,
|
|
65
|
-
status: (_a = error === null || error === void 0 ? void 0 : error.cause) === null || _a === void 0 ? void 0 : _a.status,
|
|
66
|
-
metadata: {
|
|
67
|
-
qs: options === null || options === void 0 ? void 0 : options.qs,
|
|
68
|
-
body: options === null || options === void 0 ? void 0 : options.body,
|
|
69
|
-
timeout: options === null || options === void 0 ? void 0 : options.timeout,
|
|
70
|
-
...errorMetadata,
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
throw new n8n_workflow_1.NodeOperationError(nodeContext.getNode(), JSON.stringify(errorContext));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/fortnox/transport/index.ts"],"names":[],"mappings":";;;AAeA,gCA0FC;AAzGD,+CAQsB;AACtB,6CAAkD;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,OAAO,CAAE,EAAE;gBACf,IAAI,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI;gBACnB,OAAO,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO;gBACzB,GAAG,aAAa;aACnB;SACJ,CAAC;QACF,MAAM,IAAI,iCAAkB,CACxB,WAAW,CAAC,OAAO,EAAE,EACrB,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAC/B,CAAC;IACN,CAAC;AACL,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"node": "n8n-nodes-base.fortnox",
|
|
3
|
-
"nodeVersion": "1.0",
|
|
4
|
-
"codexVersion": "1.0",
|
|
5
|
-
"categories": ["Finance & Accounting"],
|
|
6
|
-
"resources": {
|
|
7
|
-
"credentialDocumentation": [
|
|
8
|
-
{
|
|
9
|
-
"url": "https://api.fortnox.se/developer/authorization"
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"primaryDocumentation": [
|
|
13
|
-
{
|
|
14
|
-
"url": "https://api.fortnox.se/apidocs"
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IDataObject,
|
|
3
|
-
IExecuteFunctions,
|
|
4
|
-
INodeExecutionData,
|
|
5
|
-
INodeProperties,
|
|
6
|
-
INodeType,
|
|
7
|
-
INodeTypeDescription,
|
|
8
|
-
NodeConnectionTypes,
|
|
9
|
-
NodeOperationError,
|
|
10
|
-
NodePropertyTypes,
|
|
11
|
-
} from 'n8n-workflow';
|
|
12
|
-
|
|
13
|
-
import { invoiceProperties, invoiceOperations } from './resources/invoice';
|
|
14
|
-
import { FORTNOX_API_CREDENTIAL_KEY } from './commons';
|
|
15
|
-
import { customerProperties, customerOperations } from './resources/customers';
|
|
16
|
-
|
|
17
|
-
export class Fortnox implements INodeType {
|
|
18
|
-
description: INodeTypeDescription = {
|
|
19
|
-
displayName: 'Fortnox',
|
|
20
|
-
name: 'fortnox',
|
|
21
|
-
icon: 'file:fortnoxLogo.svg',
|
|
22
|
-
group: ['transform'],
|
|
23
|
-
version: 1,
|
|
24
|
-
subtitle:
|
|
25
|
-
'={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
26
|
-
description: 'Consume the Fortnox API',
|
|
27
|
-
defaults: {
|
|
28
|
-
name: 'Fortnox',
|
|
29
|
-
},
|
|
30
|
-
inputs: [NodeConnectionTypes.Main],
|
|
31
|
-
outputs: [NodeConnectionTypes.Main],
|
|
32
|
-
credentials: [
|
|
33
|
-
{
|
|
34
|
-
name: FORTNOX_API_CREDENTIAL_KEY,
|
|
35
|
-
required: true,
|
|
36
|
-
},
|
|
37
|
-
],
|
|
38
|
-
properties: [
|
|
39
|
-
{
|
|
40
|
-
displayName: 'Resource',
|
|
41
|
-
name: 'resource',
|
|
42
|
-
type: 'options' as NodePropertyTypes,
|
|
43
|
-
noDataExpression: true,
|
|
44
|
-
options: [
|
|
45
|
-
{
|
|
46
|
-
name: 'Customer',
|
|
47
|
-
value: 'customer',
|
|
48
|
-
description: 'Work with customers',
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: 'Invoice',
|
|
52
|
-
value: 'invoice',
|
|
53
|
-
description: 'Work with invoices',
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
default: 'customer',
|
|
57
|
-
},
|
|
58
|
-
...(customerProperties as INodeProperties[]),
|
|
59
|
-
...(invoiceProperties as INodeProperties[]),
|
|
60
|
-
],
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
|
64
|
-
const items = this.getInputData();
|
|
65
|
-
const returnData = [];
|
|
66
|
-
let responseData;
|
|
67
|
-
|
|
68
|
-
const resource = this.getNodeParameter('resource', 0) as string;
|
|
69
|
-
const operation = this.getNodeParameter('operation', 0) as string;
|
|
70
|
-
|
|
71
|
-
for (let i = 0; i < items.length; i++) {
|
|
72
|
-
if (resource === 'customer') {
|
|
73
|
-
responseData = await customerOperations.call(this, {
|
|
74
|
-
operation,
|
|
75
|
-
i,
|
|
76
|
-
});
|
|
77
|
-
} else if (resource === 'invoice') {
|
|
78
|
-
responseData = await invoiceOperations.call(this, {
|
|
79
|
-
operation,
|
|
80
|
-
i,
|
|
81
|
-
});
|
|
82
|
-
} else {
|
|
83
|
-
const errorLog = `The resource "${resource}" is not supported!`;
|
|
84
|
-
if (this.continueOnFail()) {
|
|
85
|
-
returnData.push({
|
|
86
|
-
error: errorLog,
|
|
87
|
-
json: { error: errorLog },
|
|
88
|
-
});
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
throw new NodeOperationError(this.getNode(), errorLog);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (Array.isArray(responseData)) {
|
|
95
|
-
returnData.push(...responseData);
|
|
96
|
-
} else if (responseData !== undefined && responseData !== null) {
|
|
97
|
-
returnData.push(responseData);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return [this.helpers.returnJsonArray(returnData as IDataObject[])];
|
|
101
|
-
}
|
|
102
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"node": "n8n-nodes-base.fortnoxTrigger",
|
|
3
|
-
"nodeVersion": "1.0",
|
|
4
|
-
"codexVersion": "1.0",
|
|
5
|
-
"categories": ["Finance & Accounting"],
|
|
6
|
-
"resources": {
|
|
7
|
-
"credentialDocumentation": [
|
|
8
|
-
{
|
|
9
|
-
"url": "https://api.fortnox.se/developer/authorization"
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"primaryDocumentation": [
|
|
13
|
-
{
|
|
14
|
-
"url": "https://www.fortnox.se/developer/guides-and-good-to-know/websockets"
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
INodeType,
|
|
3
|
-
INodeTypeDescription,
|
|
4
|
-
ITriggerFunctions,
|
|
5
|
-
ITriggerResponse,
|
|
6
|
-
NodeConnectionTypes,
|
|
7
|
-
NodeOperationError,
|
|
8
|
-
} from 'n8n-workflow';
|
|
9
|
-
import WebSocket from 'ws';
|
|
10
|
-
import { FORTNOX_API_CREDENTIAL_KEY } from './commons';
|
|
11
|
-
|
|
12
|
-
interface Topic {
|
|
13
|
-
topic: string;
|
|
14
|
-
offset?: string | null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface Topics {
|
|
18
|
-
topics: Topic[];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export class FortnoxTrigger implements INodeType {
|
|
22
|
-
description: INodeTypeDescription = {
|
|
23
|
-
displayName: 'Fortnox Trigger',
|
|
24
|
-
name: 'fortnoxTrigger',
|
|
25
|
-
icon: 'file:fortnoxLogo.svg',
|
|
26
|
-
group: ['trigger'],
|
|
27
|
-
version: 1,
|
|
28
|
-
description:
|
|
29
|
-
"Triggers workflows in real time by subscribing to Fortnox's WebSocket API for updates " +
|
|
30
|
-
'on selected topics like invoices or customers.',
|
|
31
|
-
defaults: {
|
|
32
|
-
name: 'Fortnox Trigger',
|
|
33
|
-
},
|
|
34
|
-
inputs: [],
|
|
35
|
-
outputs: [NodeConnectionTypes.Main],
|
|
36
|
-
credentials: [
|
|
37
|
-
{
|
|
38
|
-
name: FORTNOX_API_CREDENTIAL_KEY,
|
|
39
|
-
required: true,
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
properties: [
|
|
43
|
-
{
|
|
44
|
-
displayName: 'Include Child Tenants',
|
|
45
|
-
name: 'includeChildTenants',
|
|
46
|
-
type: 'boolean',
|
|
47
|
-
required: true,
|
|
48
|
-
default: false,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
displayName: 'Topics',
|
|
52
|
-
name: 'topicCollection',
|
|
53
|
-
required: true,
|
|
54
|
-
type: 'fixedCollection',
|
|
55
|
-
typeOptions: {
|
|
56
|
-
multipleValues: true,
|
|
57
|
-
},
|
|
58
|
-
default: {},
|
|
59
|
-
placeholder: 'Add Topics',
|
|
60
|
-
description: 'Topics to subscribe to',
|
|
61
|
-
options: [
|
|
62
|
-
{
|
|
63
|
-
name: 'topics',
|
|
64
|
-
displayName: 'Topics',
|
|
65
|
-
values: [
|
|
66
|
-
{
|
|
67
|
-
displayName: 'Topic',
|
|
68
|
-
name: 'topic',
|
|
69
|
-
type: 'options',
|
|
70
|
-
required: true,
|
|
71
|
-
default: 'customers',
|
|
72
|
-
options: [
|
|
73
|
-
{
|
|
74
|
-
name: 'Customers',
|
|
75
|
-
value: 'customers',
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: 'Invoices',
|
|
79
|
-
value: 'invoices',
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
name: 'Orders',
|
|
83
|
-
value: 'orders',
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
description: 'Topic to subscribe to',
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
displayName: 'Offset',
|
|
90
|
-
name: 'offset',
|
|
91
|
-
type: 'string',
|
|
92
|
-
default: '',
|
|
93
|
-
description:
|
|
94
|
-
'Offset to supply in order to get events replayed up to 14 days back',
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
async trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {
|
|
104
|
-
const includeChildTenants = this.getNodeParameter(
|
|
105
|
-
'includeChildTenants'
|
|
106
|
-
) as boolean;
|
|
107
|
-
const topicCollection = this.getNodeParameter(
|
|
108
|
-
'topicCollection',
|
|
109
|
-
{}
|
|
110
|
-
) as Topics;
|
|
111
|
-
|
|
112
|
-
const credentials = await this.getCredentials('fortnoxApi');
|
|
113
|
-
|
|
114
|
-
if (!credentials.clientSecret) {
|
|
115
|
-
throw new NodeOperationError(
|
|
116
|
-
this.getNode(),
|
|
117
|
-
"Credential 'Client Secret' must be provided for the node to work properly"
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const socket = new WebSocket('wss://ws.fortnox.se/topics-v1');
|
|
122
|
-
|
|
123
|
-
const startSocket = async () => {
|
|
124
|
-
const commands = {
|
|
125
|
-
'Add Tenants': 'add-tenants-v1',
|
|
126
|
-
'Add Topics': 'add-topics-v1',
|
|
127
|
-
Subscribe: 'subscribe-v1',
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
socket.on('open', () => {
|
|
131
|
-
socket.send(
|
|
132
|
-
JSON.stringify({
|
|
133
|
-
command: commands['Add Tenants'],
|
|
134
|
-
includeChildTenants: includeChildTenants,
|
|
135
|
-
clientSecret: credentials.clientSecret,
|
|
136
|
-
accessTokens: [`Bearer ${credentials.token}`],
|
|
137
|
-
})
|
|
138
|
-
);
|
|
139
|
-
const data = JSON.stringify({
|
|
140
|
-
command: commands['Add Topics'],
|
|
141
|
-
topics: topicCollection.topics,
|
|
142
|
-
});
|
|
143
|
-
socket.send(data);
|
|
144
|
-
|
|
145
|
-
socket.send(
|
|
146
|
-
JSON.stringify({
|
|
147
|
-
command: commands['Subscribe'],
|
|
148
|
-
})
|
|
149
|
-
);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
socket.on('message', (data: string) => {
|
|
153
|
-
const message = JSON.parse(data);
|
|
154
|
-
|
|
155
|
-
if (Object.values(commands).includes(message.response)) {
|
|
156
|
-
if (message.result != 'ok') {
|
|
157
|
-
this.emitError(
|
|
158
|
-
new NodeOperationError(
|
|
159
|
-
this.getNode(),
|
|
160
|
-
`Unexpected response from Fortnox: ${JSON.stringify(message)}`
|
|
161
|
-
)
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
} else {
|
|
165
|
-
this.emit([this.helpers.returnJsonArray(message)]);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
socket.on('error', (error: Error) => {
|
|
170
|
-
this.emitError(
|
|
171
|
-
new NodeOperationError(
|
|
172
|
-
this.getNode(),
|
|
173
|
-
'Websocket Error: ' + error.message
|
|
174
|
-
)
|
|
175
|
-
);
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
const closeFunction = async () => {
|
|
180
|
-
socket.close();
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
if (this.getMode() === 'manual') {
|
|
184
|
-
async function manualTriggerFunction() {
|
|
185
|
-
await startSocket();
|
|
186
|
-
}
|
|
187
|
-
return {
|
|
188
|
-
closeFunction,
|
|
189
|
-
manualTriggerFunction,
|
|
190
|
-
};
|
|
191
|
-
} else {
|
|
192
|
-
await startSocket();
|
|
193
|
-
return { closeFunction };
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
package/nodes/fortnox/commons.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
INodeProperties,
|
|
3
|
-
INodePropertyOptions,
|
|
4
|
-
INodePropertyTypeOptions,
|
|
5
|
-
} from 'n8n-workflow';
|
|
6
|
-
|
|
7
|
-
export const FORTNOX_API_CREDENTIAL_KEY = 'fortnoxApi';
|
|
8
|
-
|
|
9
|
-
export type ParameterTypes = 'string' | 'boolean' | 'number';
|
|
10
|
-
|
|
11
|
-
export type ParameterDefaultValueTypes = string | boolean | number;
|
|
12
|
-
|
|
13
|
-
export type ParameterDefinition = [
|
|
14
|
-
displayName: string,
|
|
15
|
-
name: string,
|
|
16
|
-
parameterType: ParameterTypes,
|
|
17
|
-
defaultValue: ParameterDefaultValueTypes,
|
|
18
|
-
typeOptions: INodePropertyTypeOptions,
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
export type OptionParameterDefinition = {
|
|
22
|
-
displayName: string;
|
|
23
|
-
name: string;
|
|
24
|
-
parameters: Array<[string, string]>;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export type CollectionParameterDefinition = {
|
|
28
|
-
displayName: string;
|
|
29
|
-
name: string;
|
|
30
|
-
parameters: ParameterDefinition[];
|
|
31
|
-
multipleValues: boolean;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const createParameter = (
|
|
35
|
-
displayName: string,
|
|
36
|
-
name: string,
|
|
37
|
-
parameterType: ParameterTypes,
|
|
38
|
-
defaultValue: ParameterDefaultValueTypes,
|
|
39
|
-
typeOptions: INodePropertyTypeOptions
|
|
40
|
-
): INodeProperties => ({
|
|
41
|
-
displayName: displayName,
|
|
42
|
-
name: name,
|
|
43
|
-
type: parameterType,
|
|
44
|
-
default: defaultValue,
|
|
45
|
-
typeOptions: typeOptions,
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export function createOptionParameter(
|
|
49
|
-
option: OptionParameterDefinition
|
|
50
|
-
): INodeProperties {
|
|
51
|
-
const parameters: INodePropertyOptions[] = option.parameters.map(
|
|
52
|
-
([parameterName, parameterValue]) => {
|
|
53
|
-
return {
|
|
54
|
-
name: parameterName,
|
|
55
|
-
value: parameterValue,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
return {
|
|
61
|
-
displayName: option.displayName,
|
|
62
|
-
name: option.name,
|
|
63
|
-
type: 'options',
|
|
64
|
-
noDataExpression: true,
|
|
65
|
-
options: parameters,
|
|
66
|
-
default: parameters[0].value,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function createCollectionParameter(
|
|
71
|
-
collection: CollectionParameterDefinition
|
|
72
|
-
): INodeProperties {
|
|
73
|
-
const parameters: INodeProperties[] = collection.parameters.map(
|
|
74
|
-
([displayName, name, parameterType, defaultValue, typeOptions]) =>
|
|
75
|
-
createParameter(
|
|
76
|
-
displayName,
|
|
77
|
-
name,
|
|
78
|
-
parameterType,
|
|
79
|
-
defaultValue,
|
|
80
|
-
typeOptions
|
|
81
|
-
)
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
displayName: collection.displayName,
|
|
86
|
-
typeOptions: {
|
|
87
|
-
multipleValues: collection.multipleValues,
|
|
88
|
-
},
|
|
89
|
-
name: collection.name,
|
|
90
|
-
default: {},
|
|
91
|
-
type: 'collection',
|
|
92
|
-
options: parameters,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<svg version="1.2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1550 1550" width="1550" height="1550">
|
|
2
|
-
<title>fortnox-brand-symbol-svg</title>
|
|
3
|
-
<style>
|
|
4
|
-
.s0 { fill: #003824 }
|
|
5
|
-
.s1 { fill: #007533 }
|
|
6
|
-
.s2 { fill: #ffc200 }
|
|
7
|
-
.s3 { fill: #00db33 }
|
|
8
|
-
</style>
|
|
9
|
-
<path class="s0" d="m774.4 302.8h243.3c17.6 0 27.1 9.5 27.1 27.1v129.8c0 17.5-9.4 26.9-27.1 26.9h-243.3c-56.7 0-94.5 37.9-94.5 94.6v177h337.8c17.6 0 27.1 9.5 27.1 27v129.8c0 17.6-9.4 27.1-27.1 27.1h-337.8v252.6c0 17.6-9.5 27.1-27.1 27.1h-135.1c-17.6 0-27.1-9.4-27.1-27.1v-608.1c0-168.9 114.9-283.9 283.8-283.9"/>
|
|
10
|
-
<g>
|
|
11
|
-
<path class="s1" d="m774.8 1549.9c-148.3 0-294.9-42.5-421.6-124.7-157-101.7-271.7-256.7-323.1-436.3-51-177.8-36.9-367.9 39.6-535.2 12.3-26.8 44-38.6 70.8-26.3 26.7 12.2 38.6 43.9 26.2 70.7-65.9 144.2-78 308.2-34.1 461.5 44.3 154.8 143.3 288.5 278.6 376.2 160.5 104.1 358.5 134.3 543.2 82.8 28.4-7.8 57.8 8.8 65.7 37.1 7.8 28.4-8.8 57.8-37.1 65.6-68.5 19.2-138.5 28.5-208.3 28.5z"/>
|
|
12
|
-
<path class="s2" d="m1162.9 1436.8c-17.6 0-34.9-8.8-45-24.8-15.8-24.8-8.5-57.8 16.3-73.6 81.1-51.7 148.9-118.8 201.3-199.7 200.5-309.2 112.1-723.8-197-924.3-10.1-6.6-21.2-13.2-34.7-20.9-25.6-14.5-34.7-47-20.1-72.7 14.5-25.6 47-34.7 72.7-20.1 15.5 8.7 28.3 16.4 40.2 24.1 358.5 232.5 460.9 713.4 228.4 1071.9-60.8 93.8-139.4 171.7-233.5 231.6-8.9 5.7-18.8 8.4-28.6 8.4z"/>
|
|
13
|
-
<path class="s3" d="m234 350.8c-12.5 0-25.2-4.3-35.2-13.2-22.2-19.5-24.3-53.2-4.8-75.3 186.3-211.8 473.6-305.2 749.4-243.7 28.8 6.4 46.9 34.9 40.5 63.7-6.4 28.7-34.9 46.8-63.7 40.4-237.9-53-485.5 27.6-646.3 210-10.5 11.9-25.2 18.1-39.9 18.1z"/>
|
|
14
|
-
</g>
|
|
15
|
-
</svg>
|