@limetech/n8n-nodes-lime 0.2.9 → 0.3.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/.dockerignore +1 -0
- package/.github/workflows/lint.yml +21 -0
- package/.github/workflows/release.yml +82 -0
- package/.github/workflows/test-and-build.yml +47 -0
- package/.prettierignore +4 -0
- package/.prettierrc.mjs +1 -0
- package/.releaserc.json +34 -0
- package/CHANGELOG.md +74 -0
- package/Dockerfile +21 -0
- package/README.md +4 -0
- package/credentials/FortnoxApi.credentials.ts +61 -0
- package/credentials/LimeCrmApi.credentials.ts +60 -0
- package/docker-compose.yml +46 -0
- package/eslint.config.mjs +27 -0
- package/jest.config.js +11 -0
- package/nodes/fortnox/Fortnox.node.json +18 -0
- package/nodes/fortnox/Fortnox.node.ts +102 -0
- package/nodes/fortnox/FortnoxTrigger.node.json +18 -0
- package/nodes/fortnox/FortnoxTrigger.node.ts +196 -0
- package/nodes/fortnox/commons.ts +94 -0
- package/nodes/fortnox/fortnoxLogo.svg +15 -0
- package/nodes/fortnox/model.ts +25 -0
- package/nodes/fortnox/resources/customers/filterParameters.ts +47 -0
- package/nodes/fortnox/resources/customers/index.ts +57 -0
- package/nodes/fortnox/resources/customers/model.ts +107 -0
- package/nodes/fortnox/resources/customers/operations/create.operation.ts +303 -0
- package/nodes/fortnox/resources/customers/operations/delete.operation.ts +44 -0
- package/nodes/fortnox/resources/customers/operations/get.operation.ts +45 -0
- package/nodes/fortnox/resources/customers/operations/getAll.operation.ts +80 -0
- package/nodes/fortnox/resources/customers/operations/update.operation.ts +278 -0
- package/nodes/fortnox/resources/customers/sortParameters.ts +32 -0
- package/nodes/fortnox/resources/invoice/filterParameters.ts +88 -0
- package/nodes/fortnox/resources/invoice/index.ts +51 -0
- package/nodes/fortnox/resources/invoice/invoiceParameters.ts +214 -0
- package/nodes/fortnox/resources/invoice/model.ts +160 -0
- package/nodes/fortnox/resources/invoice/operations/create.operation.ts +72 -0
- package/nodes/fortnox/resources/invoice/operations/get.operation.ts +45 -0
- package/nodes/fortnox/resources/invoice/operations/getAll.operation.ts +101 -0
- package/nodes/fortnox/resources/invoice/operations/update.operation.ts +74 -0
- package/nodes/fortnox/transport/errorCodes.ts +62 -0
- package/nodes/fortnox/transport/index.ts +98 -0
- package/nodes/lime-crm/LimeCrm.node.json +18 -0
- package/nodes/lime-crm/LimeCrmNode.node.ts +135 -0
- package/nodes/lime-crm/LimeCrmTrigger.node.ts +263 -0
- package/nodes/lime-crm/assets/lime-crm.svg +1 -0
- package/nodes/lime-crm/commons/constants.ts +9 -0
- package/nodes/lime-crm/commons/index.ts +9 -0
- package/nodes/lime-crm/commons/limetype.ts +11 -0
- package/nodes/lime-crm/commons/task.ts +55 -0
- package/nodes/lime-crm/commons/webhook.ts +50 -0
- package/nodes/lime-crm/methods/getEntitiesForErpSystem.ts +11 -0
- package/nodes/lime-crm/methods/getLimeTypeProperties.ts +27 -0
- package/nodes/lime-crm/methods/getLimeTypes.ts +23 -0
- package/nodes/lime-crm/methods/index.ts +3 -0
- package/nodes/lime-crm/resources/erpConnector/index.ts +43 -0
- package/nodes/lime-crm/resources/erpConnector/operations/createOrUpdateObjects.operation.ts +69 -0
- package/nodes/lime-crm/resources/erpConnector/operations/transform.operation.ts +274 -0
- package/nodes/lime-crm/resources/erpConnector/transform.ts +49 -0
- package/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.ts +18 -0
- package/nodes/lime-crm/resources/erpConnector/transformers/fortnox.ts +201 -0
- package/nodes/lime-crm/resources/erpConnector/transformers/index.ts +1 -0
- package/nodes/lime-crm/resources/limeObject/index.ts +64 -0
- package/nodes/lime-crm/resources/limeObject/operations/create.operation.ts +152 -0
- package/nodes/lime-crm/resources/limeObject/operations/delete.operation.ts +55 -0
- package/nodes/lime-crm/resources/limeObject/operations/get.operation.ts +54 -0
- package/nodes/lime-crm/resources/limeObject/operations/search.operation.ts +99 -0
- package/nodes/lime-crm/resources/limeObject/operations/update.operation.ts +157 -0
- package/nodes/lime-crm/resources/limeType/index.ts +58 -0
- package/nodes/lime-crm/resources/limeType/operations/getProperties.operation.ts +42 -0
- package/nodes/lime-crm/resources/limeType/operations/getType.operation.ts +36 -0
- package/nodes/lime-crm/resources/limeType/operations/listTypes.operation.ts +18 -0
- package/nodes/lime-crm/transport/commons.ts +44 -0
- package/nodes/lime-crm/transport/erpConnector.ts +21 -0
- package/nodes/lime-crm/transport/index.ts +17 -0
- package/nodes/lime-crm/transport/limeobjects.ts +83 -0
- package/nodes/lime-crm/transport/limetypes.ts +68 -0
- package/nodes/lime-crm/transport/task.ts +32 -0
- package/nodes/lime-crm/transport/webhooks.ts +61 -0
- package/nodes/nodeResponse.ts +13 -0
- package/package.json +36 -16
- package/tests/fixtures/fortnox.ts +182 -0
- package/tests/transform.spec.ts +187 -0
- package/tsconfig.json +30 -0
- package/index.js +0 -3
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { LIME_CRM_API_CREDENTIAL_KEY } from '../commons';
|
|
2
|
+
import { IAllExecuteFunctions } from 'n8n-workflow';
|
|
3
|
+
import { NodeResponse } from '../../nodeResponse';
|
|
4
|
+
|
|
5
|
+
type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
6
|
+
|
|
7
|
+
async function getLimeUrl(context: IAllExecuteFunctions): Promise<string> {
|
|
8
|
+
const credentials = await context.getCredentials(
|
|
9
|
+
LIME_CRM_API_CREDENTIAL_KEY
|
|
10
|
+
);
|
|
11
|
+
return credentials.url as string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function callLimeApi<T>(
|
|
15
|
+
nodeContext: IAllExecuteFunctions,
|
|
16
|
+
method: HTTPMethod,
|
|
17
|
+
url: string,
|
|
18
|
+
options?: object
|
|
19
|
+
): Promise<NodeResponse<T>> {
|
|
20
|
+
try {
|
|
21
|
+
const response: T =
|
|
22
|
+
await nodeContext.helpers.requestWithAuthentication.call(
|
|
23
|
+
nodeContext,
|
|
24
|
+
LIME_CRM_API_CREDENTIAL_KEY,
|
|
25
|
+
{
|
|
26
|
+
method: method,
|
|
27
|
+
url: url,
|
|
28
|
+
json: true,
|
|
29
|
+
baseURL: await getLimeUrl(nodeContext),
|
|
30
|
+
...options,
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
return {
|
|
34
|
+
success: true,
|
|
35
|
+
data: response,
|
|
36
|
+
};
|
|
37
|
+
} catch (error) {
|
|
38
|
+
return {
|
|
39
|
+
success: false,
|
|
40
|
+
error: error instanceof Error ? error.message : String(error),
|
|
41
|
+
status: error?.cause?.status,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { callLimeApi } from './commons';
|
|
2
|
+
import { IAllExecuteFunctions } from 'n8n-workflow';
|
|
3
|
+
import { LimeCrmData } from '../resources/erpConnector/transform';
|
|
4
|
+
import { NodeResponse } from '../../nodeResponse';
|
|
5
|
+
|
|
6
|
+
const ERP_CONNECTOR_URL = '/limepkg-erp-connector/';
|
|
7
|
+
|
|
8
|
+
export interface CreateOrUpdateObjectsTaskResponse {
|
|
9
|
+
id: string;
|
|
10
|
+
status: string;
|
|
11
|
+
result: Record<string, unknown> | null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function startCreateOrUpdateObjectsTask(
|
|
15
|
+
nodeContext: IAllExecuteFunctions,
|
|
16
|
+
data: LimeCrmData
|
|
17
|
+
): Promise<NodeResponse<CreateOrUpdateObjectsTaskResponse>> {
|
|
18
|
+
return await callLimeApi(nodeContext, 'PUT', ERP_CONNECTOR_URL, {
|
|
19
|
+
body: data,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export {
|
|
2
|
+
getSubscription,
|
|
3
|
+
deleteSubscription,
|
|
4
|
+
createSubscription,
|
|
5
|
+
listSubscriptionsWithExistingData,
|
|
6
|
+
} from './webhooks';
|
|
7
|
+
export { getLimeTypesFromApi, getProperties } from './limetypes';
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
createLimeObject,
|
|
11
|
+
deleteLimeObject,
|
|
12
|
+
updateLimeObject,
|
|
13
|
+
getLimeObject,
|
|
14
|
+
searchLimeObject,
|
|
15
|
+
} from './limeobjects';
|
|
16
|
+
export { startCreateOrUpdateObjectsTask } from './erpConnector';
|
|
17
|
+
export { callLimeApi } from './commons';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { callLimeApi } from './commons';
|
|
2
|
+
import { IAllExecuteFunctions } from 'n8n-workflow';
|
|
3
|
+
import { NodeResponse } from '../../nodeResponse';
|
|
4
|
+
|
|
5
|
+
const LIMEOBJECT_URL = '/api/v1/limeobject/';
|
|
6
|
+
|
|
7
|
+
interface SearchLimeobjectApiResponse {
|
|
8
|
+
_embedded: {
|
|
9
|
+
limeobjects: Array<object>;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export async function createLimeObject(
|
|
14
|
+
nodeContext: IAllExecuteFunctions,
|
|
15
|
+
limetype: string,
|
|
16
|
+
data: object
|
|
17
|
+
): Promise<NodeResponse<unknown>> {
|
|
18
|
+
const url = `${LIMEOBJECT_URL}${limetype}/`;
|
|
19
|
+
return await callLimeApi(nodeContext, 'POST', url, {
|
|
20
|
+
body: data,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function deleteLimeObject(
|
|
25
|
+
nodeContext: IAllExecuteFunctions,
|
|
26
|
+
limetype: string,
|
|
27
|
+
id: string
|
|
28
|
+
): Promise<NodeResponse<void>> {
|
|
29
|
+
const url = `${LIMEOBJECT_URL}${limetype}/${id}/`;
|
|
30
|
+
return await callLimeApi(nodeContext, 'DELETE', url);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function getLimeObject(
|
|
34
|
+
nodeContext: IAllExecuteFunctions,
|
|
35
|
+
limetype: string,
|
|
36
|
+
id: string
|
|
37
|
+
): Promise<NodeResponse<unknown>> {
|
|
38
|
+
const url = `${LIMEOBJECT_URL}${limetype}/${id}/`;
|
|
39
|
+
return await callLimeApi(nodeContext, 'GET', url);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function updateLimeObject(
|
|
43
|
+
nodeContext: IAllExecuteFunctions,
|
|
44
|
+
limetype: string,
|
|
45
|
+
id: string,
|
|
46
|
+
data: object
|
|
47
|
+
): Promise<NodeResponse<unknown>> {
|
|
48
|
+
const url = `${LIMEOBJECT_URL}${limetype}/${id}/`;
|
|
49
|
+
return await callLimeApi(nodeContext, 'PUT', url, {
|
|
50
|
+
body: data,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export async function searchLimeObject(
|
|
55
|
+
nodeContext: IAllExecuteFunctions,
|
|
56
|
+
limetype: string,
|
|
57
|
+
searchField: string,
|
|
58
|
+
searchTerm: string,
|
|
59
|
+
limit: number | null,
|
|
60
|
+
sortField: string | null
|
|
61
|
+
): Promise<NodeResponse<Array<object>>> {
|
|
62
|
+
const url = `${LIMEOBJECT_URL}${limetype}/`;
|
|
63
|
+
const response = await callLimeApi<SearchLimeobjectApiResponse>(
|
|
64
|
+
nodeContext,
|
|
65
|
+
'GET',
|
|
66
|
+
url,
|
|
67
|
+
{
|
|
68
|
+
qs: {
|
|
69
|
+
...(searchField && searchTerm && { [searchField]: searchTerm }),
|
|
70
|
+
...(limit != null && limit > 0 && { _limit: limit }),
|
|
71
|
+
...(sortField != null && { _sort: sortField }),
|
|
72
|
+
},
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
if (response.success) {
|
|
77
|
+
return {
|
|
78
|
+
success: true,
|
|
79
|
+
data: response.data?._embedded.limeobjects ?? [],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return response;
|
|
83
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { callLimeApi } from '.';
|
|
2
|
+
import { IAllExecuteFunctions } from 'n8n-workflow';
|
|
3
|
+
import { LimeType, LimeTypeProperty } from '../commons';
|
|
4
|
+
import { NodeResponse } from '../../nodeResponse';
|
|
5
|
+
|
|
6
|
+
const LIMETYPE_URL = '/api/v1/limetype/';
|
|
7
|
+
|
|
8
|
+
interface LimeTypesApiResponse {
|
|
9
|
+
_links: {
|
|
10
|
+
limetypes: LimeType[];
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface LimeTypePropertiesApiResponse {
|
|
15
|
+
_embedded: {
|
|
16
|
+
properties: LimeTypeProperty[];
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function getLimeTypesFromApi(
|
|
21
|
+
nodeContext: IAllExecuteFunctions
|
|
22
|
+
): Promise<NodeResponse<LimeType[]>> {
|
|
23
|
+
const response = await callLimeApi<LimeTypesApiResponse>(
|
|
24
|
+
nodeContext,
|
|
25
|
+
'GET',
|
|
26
|
+
LIMETYPE_URL
|
|
27
|
+
);
|
|
28
|
+
if (response.success) {
|
|
29
|
+
return {
|
|
30
|
+
success: true,
|
|
31
|
+
data: response.data?._links.limetypes ?? [],
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return response;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export async function getLimeType(
|
|
38
|
+
nodeContext: IAllExecuteFunctions,
|
|
39
|
+
limeType: string
|
|
40
|
+
): Promise<NodeResponse<LimeType>> {
|
|
41
|
+
const url = `${LIMETYPE_URL}${limeType}/`;
|
|
42
|
+
return await callLimeApi<LimeType>(nodeContext, 'GET', url);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export async function getProperties(
|
|
46
|
+
nodeContext: IAllExecuteFunctions,
|
|
47
|
+
limeType: string
|
|
48
|
+
): Promise<NodeResponse<LimeTypeProperty[]>> {
|
|
49
|
+
const url = `${LIMETYPE_URL}${limeType}/`;
|
|
50
|
+
const response = await callLimeApi<LimeTypePropertiesApiResponse>(
|
|
51
|
+
nodeContext,
|
|
52
|
+
'GET',
|
|
53
|
+
url,
|
|
54
|
+
{
|
|
55
|
+
qs: {
|
|
56
|
+
_embed: 'properties',
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
if (response.success) {
|
|
62
|
+
return {
|
|
63
|
+
success: true,
|
|
64
|
+
data: response.data?._embedded.properties ?? [],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return response;
|
|
68
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { IAllExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
import { callLimeApi } from './commons';
|
|
3
|
+
|
|
4
|
+
const TASK_URL = '/api/v1/task/';
|
|
5
|
+
|
|
6
|
+
interface Task {
|
|
7
|
+
id: string;
|
|
8
|
+
status: 'PENDING' | 'STARTED' | 'SUCCESS' | 'FAILURE' | 'REVOKED' | 'RETRY';
|
|
9
|
+
result: unknown;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface GetTasksApiResponse {
|
|
13
|
+
_embedded: {
|
|
14
|
+
tasks: Task[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export async function getTasks(
|
|
19
|
+
nodeContext: IAllExecuteFunctions,
|
|
20
|
+
taskId: string
|
|
21
|
+
) {
|
|
22
|
+
return await callLimeApi<GetTasksApiResponse>(
|
|
23
|
+
nodeContext,
|
|
24
|
+
'GET',
|
|
25
|
+
TASK_URL,
|
|
26
|
+
{
|
|
27
|
+
qs: {
|
|
28
|
+
id: taskId,
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Webhook } from '../commons';
|
|
2
|
+
import { callLimeApi } from '.';
|
|
3
|
+
import { IAllExecuteFunctions } from 'n8n-workflow';
|
|
4
|
+
import { NodeResponse } from '../../nodeResponse';
|
|
5
|
+
|
|
6
|
+
const SUBSCRIPTION_URL = 'api/v1/subscription/';
|
|
7
|
+
|
|
8
|
+
interface ApiResponseWebhook {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
events: string[];
|
|
13
|
+
target_url: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function getSubscription(
|
|
17
|
+
nodeContext: IAllExecuteFunctions,
|
|
18
|
+
webhook: Webhook
|
|
19
|
+
): Promise<NodeResponse<ApiResponseWebhook>> {
|
|
20
|
+
return await callLimeApi(
|
|
21
|
+
nodeContext,
|
|
22
|
+
'GET',
|
|
23
|
+
`${SUBSCRIPTION_URL}${webhook.data.webhookId}`
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export async function listSubscriptionsWithExistingData(
|
|
28
|
+
nodeContext: IAllExecuteFunctions,
|
|
29
|
+
webhook: Webhook
|
|
30
|
+
): Promise<NodeResponse<ApiResponseWebhook[]>> {
|
|
31
|
+
return await callLimeApi(nodeContext, 'GET', SUBSCRIPTION_URL, {
|
|
32
|
+
qs: {
|
|
33
|
+
events: webhook.events.join(','),
|
|
34
|
+
target_url: webhook.url,
|
|
35
|
+
enabled: true,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export async function createSubscription(
|
|
41
|
+
nodeContext: IAllExecuteFunctions,
|
|
42
|
+
webhook: Webhook
|
|
43
|
+
): Promise<NodeResponse<ApiResponseWebhook>> {
|
|
44
|
+
return await callLimeApi(nodeContext, 'POST', SUBSCRIPTION_URL, {
|
|
45
|
+
body: {
|
|
46
|
+
events: webhook.events,
|
|
47
|
+
target_url: webhook.url,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function deleteSubscription(
|
|
53
|
+
nodeContext: IAllExecuteFunctions,
|
|
54
|
+
webhook: Webhook
|
|
55
|
+
): Promise<NodeResponse<void>> {
|
|
56
|
+
return await callLimeApi(
|
|
57
|
+
nodeContext,
|
|
58
|
+
'DELETE',
|
|
59
|
+
`${SUBSCRIPTION_URL}${webhook.data.webhookId}/`
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type SuccessResponse<T> = {
|
|
2
|
+
success: true;
|
|
3
|
+
data: T;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
type FailureResponse = {
|
|
7
|
+
success: false;
|
|
8
|
+
error: string;
|
|
9
|
+
status?: number;
|
|
10
|
+
metadata?: Record<string, unknown>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type NodeResponse<T> = SuccessResponse<T> | FailureResponse;
|
package/package.json
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@limetech/n8n-nodes-lime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "n8n node to connect to Lime CRM",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "tsc && find nodes -name '*.svg' -exec cp {} dist/{} \\;",
|
|
8
|
+
"build": "tsc && mkdir -p dist/nodes/lime-crm/assets && find nodes -name '*.svg' -exec cp {} dist/{} \\;",
|
|
9
9
|
"dev": "tsc --watch",
|
|
10
10
|
"dev:reload": "nodemon --watch dist --exec 'cp -R dist/* ~/.n8n/custom/dist/'",
|
|
11
11
|
"watch": "concurrently \"npm run dev\" \"npm run dev:reload\"",
|
|
12
|
-
"
|
|
12
|
+
"lint": "eslint --max-warnings=0 .",
|
|
13
|
+
"lint:fix": "eslint --max-warnings=0 . --fix",
|
|
14
|
+
"format": "prettier -c .",
|
|
15
|
+
"format:fix": "prettier --write .",
|
|
16
|
+
"test": "jest"
|
|
13
17
|
},
|
|
14
18
|
"keywords": [
|
|
15
19
|
"n8n",
|
|
@@ -18,35 +22,51 @@
|
|
|
18
22
|
"crm",
|
|
19
23
|
"n8n-community-node-package"
|
|
20
24
|
],
|
|
21
|
-
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
],
|
|
24
25
|
"n8n": {
|
|
25
26
|
"n8nNodesApiVersion": 1,
|
|
26
27
|
"credentials": [
|
|
27
28
|
"dist/credentials/LimeCrmApi.credentials.js",
|
|
28
|
-
"dist/credentials/
|
|
29
|
+
"dist/credentials/FortnoxApi.credentials.js"
|
|
29
30
|
],
|
|
30
31
|
"nodes": [
|
|
31
|
-
"dist/nodes/LimeCrm
|
|
32
|
-
"dist/nodes/
|
|
33
|
-
"dist/nodes/
|
|
32
|
+
"dist/nodes/lime-crm/LimeCrm.node.js",
|
|
33
|
+
"dist/nodes/fortnox/Fortnox.node.js",
|
|
34
|
+
"dist/nodes/fortnox/FortnoxTrigger.node.js"
|
|
34
35
|
]
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
38
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
39
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
40
|
+
"@semantic-release/git": "^10.0.1",
|
|
41
|
+
"@semantic-release/github": "^11.0.4",
|
|
42
|
+
"@semantic-release/release-notes-generator": "^14.0.3",
|
|
43
|
+
"@types/jest": "^30.0.0",
|
|
37
44
|
"@types/node": "^16.11.10",
|
|
38
45
|
"@types/request-promise-native": "^1.0.18",
|
|
46
|
+
"@types/ws": "^8.18.1",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^8.38.0",
|
|
48
|
+
"@typescript-eslint/parser": "^8.38.0",
|
|
39
49
|
"concurrently": "^7.0.0",
|
|
50
|
+
"eslint": "^9.32.0",
|
|
51
|
+
"eslint-config-prettier": "^10.1.8",
|
|
52
|
+
"eslint-plugin-n8n-nodes-base": "^1.16.1",
|
|
53
|
+
"eslint-plugin-prettier": "^5.5.3",
|
|
54
|
+
"install": "^0.13.0",
|
|
55
|
+
"jest": "^30.0.5",
|
|
40
56
|
"nodemon": "^2.0.15",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
57
|
+
"npm": "^11.5.2",
|
|
58
|
+
"prettier": "^3.6.2",
|
|
59
|
+
"semantic-release": "^24.2.7",
|
|
60
|
+
"ts-jest": "^29.4.1",
|
|
61
|
+
"typescript": "^5.9.2"
|
|
46
62
|
},
|
|
47
63
|
"dependencies": {
|
|
64
|
+
"@limetech/eslint-config": "^3.0.2",
|
|
65
|
+
"@semantic-release/exec": "^7.1.0",
|
|
66
|
+
"currency-codes": "^2.2.0",
|
|
48
67
|
"request": "^2.88.2",
|
|
49
|
-
"request-promise-native": "^1.0.9"
|
|
68
|
+
"request-promise-native": "^1.0.9",
|
|
69
|
+
"ws": "^8.18.3"
|
|
50
70
|
},
|
|
51
71
|
"peerDependencies": {
|
|
52
72
|
"n8n-workflow": "*"
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { FortnoxInvoiceData } from '../../nodes/lime-crm/resources/erpConnector/transformers/fortnox';
|
|
2
|
+
|
|
3
|
+
export const invoice = {
|
|
4
|
+
'@url': 'https://api.fortnox.se/3/invoices/1',
|
|
5
|
+
'@urlTaxReductionList':
|
|
6
|
+
'https://api.fortnox.se/3/taxreductions?filter=invoices&referencenumber=1',
|
|
7
|
+
AccountingMethod: 'ACCRUAL',
|
|
8
|
+
Address1: '',
|
|
9
|
+
Address2: '',
|
|
10
|
+
AdministrationFee: 0,
|
|
11
|
+
AdministrationFeeVAT: 0,
|
|
12
|
+
Balance: 1589,
|
|
13
|
+
BasisTaxReduction: 0,
|
|
14
|
+
Booked: true,
|
|
15
|
+
Cancelled: false,
|
|
16
|
+
City: 'Wadowice',
|
|
17
|
+
Comments: '',
|
|
18
|
+
ContractReference: '0',
|
|
19
|
+
ContributionPercent: 100,
|
|
20
|
+
ContributionValue: 1271,
|
|
21
|
+
CostCenter: '',
|
|
22
|
+
Country: '',
|
|
23
|
+
Credit: 'false',
|
|
24
|
+
CreditInvoiceReference: '0',
|
|
25
|
+
Currency: 'SEK',
|
|
26
|
+
CurrencyRate: 1,
|
|
27
|
+
CurrencyUnit: 1,
|
|
28
|
+
CustomerName: 'Vatican Forces',
|
|
29
|
+
CustomerNumber: '3',
|
|
30
|
+
DeliveryAddress1: '',
|
|
31
|
+
DeliveryAddress2: '',
|
|
32
|
+
DeliveryCity: '',
|
|
33
|
+
DeliveryCountry: '',
|
|
34
|
+
DeliveryDate: null,
|
|
35
|
+
DeliveryName: '',
|
|
36
|
+
DeliveryZipCode: '',
|
|
37
|
+
DocumentNumber: '1',
|
|
38
|
+
DueDate: '2025-09-12',
|
|
39
|
+
EDIInformation: {
|
|
40
|
+
EDIGlobalLocationNumber: '',
|
|
41
|
+
EDIGlobalLocationNumberDelivery: '',
|
|
42
|
+
EDIInvoiceExtra1: '',
|
|
43
|
+
EDIInvoiceExtra2: '',
|
|
44
|
+
EDIOurElectronicReference: '',
|
|
45
|
+
EDIYourElectronicReference: '',
|
|
46
|
+
EDIStatus: '',
|
|
47
|
+
},
|
|
48
|
+
EUQuarterlyReport: false,
|
|
49
|
+
EmailInformation: {
|
|
50
|
+
EmailAddressFrom: null,
|
|
51
|
+
EmailAddressTo: null,
|
|
52
|
+
EmailAddressCC: '',
|
|
53
|
+
EmailAddressBCC: '',
|
|
54
|
+
EmailSubject: 'Faktura {no} bifogas',
|
|
55
|
+
EmailBody: ' ',
|
|
56
|
+
},
|
|
57
|
+
ExternalInvoiceReference1: '',
|
|
58
|
+
ExternalInvoiceReference2: '',
|
|
59
|
+
FinalPayDate: null,
|
|
60
|
+
Freight: 0,
|
|
61
|
+
FreightVAT: 0,
|
|
62
|
+
Gross: 1271,
|
|
63
|
+
HouseWork: false,
|
|
64
|
+
InvoiceDate: '2025-08-13',
|
|
65
|
+
InvoicePeriodEnd: '',
|
|
66
|
+
InvoicePeriodStart: '',
|
|
67
|
+
InvoiceReference: '0',
|
|
68
|
+
InvoiceRows: [
|
|
69
|
+
{
|
|
70
|
+
AccountNumber: 3001,
|
|
71
|
+
ArticleNumber: '107',
|
|
72
|
+
ContributionPercent: '100',
|
|
73
|
+
ContributionValue: '500',
|
|
74
|
+
Cost: 0,
|
|
75
|
+
CostCenter: null,
|
|
76
|
+
DeliveredQuantity: '5',
|
|
77
|
+
Description: 'First article',
|
|
78
|
+
Discount: 0,
|
|
79
|
+
DiscountType: 'PERCENT',
|
|
80
|
+
HouseWork: false,
|
|
81
|
+
HouseWorkHoursToReport: null,
|
|
82
|
+
HouseWorkType: null,
|
|
83
|
+
Price: 100,
|
|
84
|
+
PriceExcludingVAT: 100,
|
|
85
|
+
Project: '',
|
|
86
|
+
RowId: 395,
|
|
87
|
+
StockPointCode: null,
|
|
88
|
+
Total: 500,
|
|
89
|
+
TotalExcludingVAT: 500,
|
|
90
|
+
Unit: 'st',
|
|
91
|
+
VAT: 25,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
AccountNumber: 3001,
|
|
95
|
+
ArticleNumber: '108',
|
|
96
|
+
ContributionPercent: '100',
|
|
97
|
+
ContributionValue: '738',
|
|
98
|
+
Cost: 0,
|
|
99
|
+
CostCenter: null,
|
|
100
|
+
DeliveredQuantity: '6',
|
|
101
|
+
Description: 'Second article',
|
|
102
|
+
Discount: 0,
|
|
103
|
+
DiscountType: 'PERCENT',
|
|
104
|
+
HouseWork: false,
|
|
105
|
+
HouseWorkHoursToReport: null,
|
|
106
|
+
HouseWorkType: null,
|
|
107
|
+
Price: 123,
|
|
108
|
+
PriceExcludingVAT: 123,
|
|
109
|
+
Project: '',
|
|
110
|
+
RowId: 396,
|
|
111
|
+
StockPointCode: null,
|
|
112
|
+
Total: 738,
|
|
113
|
+
TotalExcludingVAT: 738,
|
|
114
|
+
Unit: 'st',
|
|
115
|
+
VAT: 25,
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
AccountNumber: 3001,
|
|
119
|
+
ArticleNumber: '109',
|
|
120
|
+
ContributionPercent: '100',
|
|
121
|
+
ContributionValue: '33',
|
|
122
|
+
Cost: 0,
|
|
123
|
+
CostCenter: null,
|
|
124
|
+
DeliveredQuantity: '3',
|
|
125
|
+
Description: 'Third article',
|
|
126
|
+
Discount: 0,
|
|
127
|
+
DiscountType: 'PERCENT',
|
|
128
|
+
HouseWork: false,
|
|
129
|
+
HouseWorkHoursToReport: null,
|
|
130
|
+
HouseWorkType: null,
|
|
131
|
+
Price: 11,
|
|
132
|
+
PriceExcludingVAT: 11,
|
|
133
|
+
Project: '',
|
|
134
|
+
RowId: 397,
|
|
135
|
+
StockPointCode: null,
|
|
136
|
+
Total: 33,
|
|
137
|
+
TotalExcludingVAT: 33,
|
|
138
|
+
Unit: 'st',
|
|
139
|
+
VAT: 25,
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
InvoiceType: 'INVOICE',
|
|
143
|
+
Labels: [],
|
|
144
|
+
Language: 'SV',
|
|
145
|
+
LastRemindDate: null,
|
|
146
|
+
Net: 1271,
|
|
147
|
+
NotCompleted: false,
|
|
148
|
+
NoxFinans: false,
|
|
149
|
+
OCR: '13359',
|
|
150
|
+
OfferReference: '0',
|
|
151
|
+
OrderReference: '0',
|
|
152
|
+
OrganisationNumber: '1298737894',
|
|
153
|
+
OurReference: 'Aspen The Dog',
|
|
154
|
+
OutboundDate: '2025-08-13',
|
|
155
|
+
PaymentWay: '',
|
|
156
|
+
Phone1: '0418459862',
|
|
157
|
+
Phone2: '',
|
|
158
|
+
PriceList: 'A',
|
|
159
|
+
PrintTemplate: 'st',
|
|
160
|
+
Project: '',
|
|
161
|
+
Remarks: '',
|
|
162
|
+
Reminders: 0,
|
|
163
|
+
RoundOff: 0.25,
|
|
164
|
+
Sent: false,
|
|
165
|
+
TaxReduction: null,
|
|
166
|
+
TaxReductionType: 'none',
|
|
167
|
+
TermsOfDelivery: '',
|
|
168
|
+
TermsOfPayment: '30',
|
|
169
|
+
TimeBasisReference: null,
|
|
170
|
+
Total: 1589,
|
|
171
|
+
TotalToPay: 1589,
|
|
172
|
+
TotalVAT: 317.75,
|
|
173
|
+
VATIncluded: false,
|
|
174
|
+
VoucherNumber: 18,
|
|
175
|
+
VoucherSeries: 'B',
|
|
176
|
+
VoucherYear: 8,
|
|
177
|
+
WarehouseReady: true,
|
|
178
|
+
WayOfDelivery: '',
|
|
179
|
+
YourOrderNumber: '',
|
|
180
|
+
YourReference: 'Miki',
|
|
181
|
+
ZipCode: '21114',
|
|
182
|
+
} satisfies FortnoxInvoiceData;
|