@limetech/n8n-nodes-lime 0.2.8 → 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/dist/nodes/LimeCrm/resources/limeObject/operations/update.operation.js +1 -1
- package/dist/nodes/LimeCrm/resources/limeObject/operations/update.operation.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- 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,152 @@
|
|
|
1
|
+
import { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
|
|
3
|
+
import { createLimeObject } from '../../../transport';
|
|
4
|
+
import { LIMEOBJECT_RESOURCE } from '../../../commons';
|
|
5
|
+
|
|
6
|
+
export const description = {
|
|
7
|
+
name: 'Create Object',
|
|
8
|
+
value: 'create',
|
|
9
|
+
description: 'Create a new object',
|
|
10
|
+
action: 'Create an object',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const properties: INodeProperties[] = [
|
|
14
|
+
{
|
|
15
|
+
displayName: 'LimeType',
|
|
16
|
+
name: 'limeType',
|
|
17
|
+
type: 'options',
|
|
18
|
+
typeOptions: {
|
|
19
|
+
loadOptionsMethod: 'getLimeTypes',
|
|
20
|
+
},
|
|
21
|
+
required: true,
|
|
22
|
+
default: '',
|
|
23
|
+
description: 'The type of entity to create',
|
|
24
|
+
displayOptions: {
|
|
25
|
+
show: {
|
|
26
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
27
|
+
operation: ['create'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
// Object data input method
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Input Method',
|
|
35
|
+
name: 'inputMethod',
|
|
36
|
+
type: 'options',
|
|
37
|
+
options: [
|
|
38
|
+
{
|
|
39
|
+
name: 'Form Fields',
|
|
40
|
+
value: 'fields',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'JSON',
|
|
44
|
+
value: 'json',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
default: 'fields',
|
|
48
|
+
description: 'How to input the object data',
|
|
49
|
+
displayOptions: {
|
|
50
|
+
show: {
|
|
51
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
52
|
+
operation: ['create'],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
// Dynamic properties for form input
|
|
58
|
+
{
|
|
59
|
+
displayName: 'Properties',
|
|
60
|
+
name: 'properties',
|
|
61
|
+
type: 'fixedCollection',
|
|
62
|
+
placeholder: 'Add Property',
|
|
63
|
+
typeOptions: {
|
|
64
|
+
multipleValues: true,
|
|
65
|
+
sortable: true,
|
|
66
|
+
loadOptionsMethod: 'getLimeTypeProperties',
|
|
67
|
+
loadOptionsDependsOn: ['limeType'],
|
|
68
|
+
},
|
|
69
|
+
default: {},
|
|
70
|
+
displayOptions: {
|
|
71
|
+
show: {
|
|
72
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
73
|
+
operation: ['create'],
|
|
74
|
+
inputMethod: ['fields'],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
options: [
|
|
78
|
+
{
|
|
79
|
+
displayName: 'Property',
|
|
80
|
+
name: 'property',
|
|
81
|
+
values: [
|
|
82
|
+
{
|
|
83
|
+
displayName: 'Property Name',
|
|
84
|
+
name: 'name',
|
|
85
|
+
type: 'options',
|
|
86
|
+
typeOptions: {
|
|
87
|
+
loadOptionsMethod: 'getLimeTypeProperties',
|
|
88
|
+
loadOptionsDependsOn: ['limeType'],
|
|
89
|
+
},
|
|
90
|
+
default: '',
|
|
91
|
+
description: 'Name of the property',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
displayName: 'Property Value',
|
|
95
|
+
name: 'value',
|
|
96
|
+
type: 'string',
|
|
97
|
+
default: '',
|
|
98
|
+
description: 'Value of the property',
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
// JSON input
|
|
106
|
+
{
|
|
107
|
+
displayName: 'Object (JSON)',
|
|
108
|
+
name: 'objectJson',
|
|
109
|
+
type: 'json',
|
|
110
|
+
default: '{\n "name": "New Company",\n "phone": "123-456-7890"\n}',
|
|
111
|
+
description: 'Object to create in JSON format',
|
|
112
|
+
displayOptions: {
|
|
113
|
+
show: {
|
|
114
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
115
|
+
operation: ['create'],
|
|
116
|
+
inputMethod: ['json'],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
typeOptions: {
|
|
120
|
+
alwaysOpenEditWindow: true,
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
];
|
|
124
|
+
|
|
125
|
+
export async function execute(this: IExecuteFunctions, i: number) {
|
|
126
|
+
const limeType = this.getNodeParameter('limeType', i) as string;
|
|
127
|
+
const inputMethod = this.getNodeParameter('inputMethod', i) as string;
|
|
128
|
+
|
|
129
|
+
let objectData: IDataObject;
|
|
130
|
+
|
|
131
|
+
if (inputMethod === 'json') {
|
|
132
|
+
const jsonInput = this.getNodeParameter('objectJson', i) as string;
|
|
133
|
+
objectData = JSON.parse(jsonInput);
|
|
134
|
+
} else {
|
|
135
|
+
objectData = {};
|
|
136
|
+
const propertiesInput = this.getNodeParameter(
|
|
137
|
+
'properties.property',
|
|
138
|
+
i,
|
|
139
|
+
[]
|
|
140
|
+
) as IDataObject[];
|
|
141
|
+
|
|
142
|
+
if (propertiesInput && propertiesInput.length > 0) {
|
|
143
|
+
for (const prop of propertiesInput) {
|
|
144
|
+
if (prop.name && prop.value !== undefined) {
|
|
145
|
+
objectData[prop.name as string] = prop.value;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return await createLimeObject(this, limeType, objectData);
|
|
152
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
|
|
3
|
+
import { deleteLimeObject } from '../../../transport';
|
|
4
|
+
import { LIMEOBJECT_RESOURCE } from '../../../commons';
|
|
5
|
+
|
|
6
|
+
export const description = {
|
|
7
|
+
name: 'Delete Object',
|
|
8
|
+
value: 'delete',
|
|
9
|
+
description: 'Delete an existing object',
|
|
10
|
+
action: 'Delete an object',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const properties: INodeProperties[] = [
|
|
14
|
+
// Limetype selection
|
|
15
|
+
{
|
|
16
|
+
displayName: 'Lime Type',
|
|
17
|
+
name: 'limeType',
|
|
18
|
+
type: 'options',
|
|
19
|
+
typeOptions: {
|
|
20
|
+
loadOptionsMethod: 'getLimeTypes',
|
|
21
|
+
},
|
|
22
|
+
required: true,
|
|
23
|
+
default: '',
|
|
24
|
+
description: 'The type of entity to delete',
|
|
25
|
+
displayOptions: {
|
|
26
|
+
show: {
|
|
27
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
28
|
+
operation: ['delete'],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
// Object ID
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Object ID',
|
|
36
|
+
name: 'objectId',
|
|
37
|
+
type: 'string',
|
|
38
|
+
required: true,
|
|
39
|
+
default: '',
|
|
40
|
+
description: 'The ID of the object to delete',
|
|
41
|
+
displayOptions: {
|
|
42
|
+
show: {
|
|
43
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
44
|
+
operation: ['delete'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
export async function execute(this: IExecuteFunctions, i: number) {
|
|
51
|
+
const limeType = this.getNodeParameter('limeType', i) as string;
|
|
52
|
+
const objectId = this.getNodeParameter('objectId', i) as string;
|
|
53
|
+
|
|
54
|
+
return await deleteLimeObject(this, limeType, objectId);
|
|
55
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
|
|
3
|
+
import { getLimeObject } from '../../../transport';
|
|
4
|
+
import { LIMEOBJECT_RESOURCE } from '../../../commons';
|
|
5
|
+
|
|
6
|
+
export const description = {
|
|
7
|
+
name: 'Get Object',
|
|
8
|
+
value: 'get',
|
|
9
|
+
description: 'Get a single object by ID',
|
|
10
|
+
action: 'Get an object',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const properties: INodeProperties[] = [
|
|
14
|
+
// Limetype selection
|
|
15
|
+
{
|
|
16
|
+
displayName: 'Lime Type',
|
|
17
|
+
name: 'limeType',
|
|
18
|
+
type: 'options',
|
|
19
|
+
typeOptions: {
|
|
20
|
+
loadOptionsMethod: 'getLimeTypes',
|
|
21
|
+
},
|
|
22
|
+
required: true,
|
|
23
|
+
default: '',
|
|
24
|
+
description: 'The type of entity to retrieve',
|
|
25
|
+
displayOptions: {
|
|
26
|
+
show: {
|
|
27
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
28
|
+
operation: ['get'],
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
// Object ID
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Object ID',
|
|
36
|
+
name: 'objectId',
|
|
37
|
+
type: 'string',
|
|
38
|
+
required: true,
|
|
39
|
+
default: '',
|
|
40
|
+
description: 'The ID of the object to retrieve',
|
|
41
|
+
displayOptions: {
|
|
42
|
+
show: {
|
|
43
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
44
|
+
operation: ['get'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
export async function execute(this: IExecuteFunctions, i: number) {
|
|
51
|
+
const limeType = this.getNodeParameter('limeType', i) as string;
|
|
52
|
+
const objectId = this.getNodeParameter('objectId', i) as string;
|
|
53
|
+
return getLimeObject(this, limeType, objectId);
|
|
54
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import { searchLimeObject } from '../../../transport';
|
|
3
|
+
import { LIMEOBJECT_RESOURCE } from '../../../commons';
|
|
4
|
+
|
|
5
|
+
export const description = {
|
|
6
|
+
name: 'Search',
|
|
7
|
+
value: 'search',
|
|
8
|
+
description: 'Search for objects',
|
|
9
|
+
action: 'Search for objects',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const properties: INodeProperties[] = [
|
|
13
|
+
{
|
|
14
|
+
displayName: 'Lime Type',
|
|
15
|
+
name: 'limeType',
|
|
16
|
+
type: 'options',
|
|
17
|
+
typeOptions: {
|
|
18
|
+
loadOptionsMethod: 'getLimeTypes',
|
|
19
|
+
},
|
|
20
|
+
required: true,
|
|
21
|
+
default: '',
|
|
22
|
+
description: 'The type of entity to search for',
|
|
23
|
+
displayOptions: {
|
|
24
|
+
show: {
|
|
25
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
26
|
+
operation: ['search'],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
// Search parameters
|
|
32
|
+
{
|
|
33
|
+
displayName: 'Search Term',
|
|
34
|
+
name: 'searchTerm',
|
|
35
|
+
type: 'string',
|
|
36
|
+
default: '',
|
|
37
|
+
description: 'Term to search for',
|
|
38
|
+
displayOptions: {
|
|
39
|
+
show: {
|
|
40
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
41
|
+
operation: ['search'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
// Search fields
|
|
47
|
+
{
|
|
48
|
+
displayName: 'Search Fields',
|
|
49
|
+
name: 'searchField',
|
|
50
|
+
type: 'options',
|
|
51
|
+
typeOptions: {
|
|
52
|
+
loadOptionsMethod: 'getLimeTypeProperties',
|
|
53
|
+
loadOptionsDependsOn: ['limeType'],
|
|
54
|
+
},
|
|
55
|
+
default: [],
|
|
56
|
+
description:
|
|
57
|
+
'Fields to search in. If none selected, searches across all searchable fields',
|
|
58
|
+
displayOptions: {
|
|
59
|
+
show: {
|
|
60
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
61
|
+
operation: ['search'],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Limit',
|
|
68
|
+
name: 'limit',
|
|
69
|
+
type: 'number',
|
|
70
|
+
default: 50,
|
|
71
|
+
description: 'Max number of results to return',
|
|
72
|
+
typeOptions: {
|
|
73
|
+
minValue: 1,
|
|
74
|
+
},
|
|
75
|
+
displayOptions: {
|
|
76
|
+
show: {
|
|
77
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
78
|
+
operation: ['search'],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
export async function execute(this: IExecuteFunctions, i: number) {
|
|
85
|
+
const limeType = this.getNodeParameter('limeType', i) as string;
|
|
86
|
+
const searchTerm = this.getNodeParameter('searchTerm', i, '') as string;
|
|
87
|
+
const searchField = this.getNodeParameter('searchField', i) as string;
|
|
88
|
+
const limit = this.getNodeParameter('limit', i, 50);
|
|
89
|
+
const options = this.getNodeParameter('options', i, {});
|
|
90
|
+
|
|
91
|
+
return await searchLimeObject(
|
|
92
|
+
this,
|
|
93
|
+
limeType,
|
|
94
|
+
searchField,
|
|
95
|
+
searchTerm,
|
|
96
|
+
limit || null,
|
|
97
|
+
(options.sortField as string) || null
|
|
98
|
+
);
|
|
99
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import { updateLimeObject } from '../../../transport';
|
|
3
|
+
import { LIMEOBJECT_RESOURCE } from '../../../commons';
|
|
4
|
+
|
|
5
|
+
// Input fields for update operation
|
|
6
|
+
export const description = {
|
|
7
|
+
name: 'Update',
|
|
8
|
+
value: 'update',
|
|
9
|
+
description: 'Update an existing record',
|
|
10
|
+
action: 'Update a record',
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const properties: INodeProperties[] = [
|
|
14
|
+
{
|
|
15
|
+
displayName: 'LimeType',
|
|
16
|
+
name: 'limeType',
|
|
17
|
+
type: 'options',
|
|
18
|
+
typeOptions: {
|
|
19
|
+
loadOptionsMethod: 'getLimeTypes',
|
|
20
|
+
},
|
|
21
|
+
required: true,
|
|
22
|
+
default: '',
|
|
23
|
+
description: 'The type of entity to update',
|
|
24
|
+
displayOptions: {
|
|
25
|
+
show: {
|
|
26
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
27
|
+
operation: ['update'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
displayName: 'Record ID',
|
|
33
|
+
name: 'id',
|
|
34
|
+
type: 'string',
|
|
35
|
+
required: true,
|
|
36
|
+
default: '',
|
|
37
|
+
description: 'ID of the record to update',
|
|
38
|
+
displayOptions: {
|
|
39
|
+
show: {
|
|
40
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
41
|
+
operation: ['update'],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
displayName: 'Input Type',
|
|
47
|
+
name: 'inputType',
|
|
48
|
+
type: 'options',
|
|
49
|
+
options: [
|
|
50
|
+
{
|
|
51
|
+
name: 'Simple Fields',
|
|
52
|
+
value: 'simple',
|
|
53
|
+
description: 'Define fields using the UI',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'JSON Object',
|
|
57
|
+
value: 'json',
|
|
58
|
+
description: 'Define fields using JSON',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
default: 'simple',
|
|
62
|
+
description: 'How to input the data',
|
|
63
|
+
displayOptions: {
|
|
64
|
+
show: {
|
|
65
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
66
|
+
operation: ['update'],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
displayName: 'Data',
|
|
72
|
+
name: 'jsonData',
|
|
73
|
+
type: 'json',
|
|
74
|
+
default:
|
|
75
|
+
'{\n "name": "Updated Company Name",\n "phone": "+987654321"\n}',
|
|
76
|
+
description:
|
|
77
|
+
'Key-value pairs for fields to update. Property names must match the Lime CRM field names.',
|
|
78
|
+
typeOptions: {
|
|
79
|
+
alwaysOpenEditWindow: true,
|
|
80
|
+
},
|
|
81
|
+
displayOptions: {
|
|
82
|
+
show: {
|
|
83
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
84
|
+
operation: ['update'],
|
|
85
|
+
inputType: ['json'],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
displayName: 'Fields',
|
|
91
|
+
name: 'simpleFields',
|
|
92
|
+
placeholder: 'Add Field',
|
|
93
|
+
type: 'fixedCollection',
|
|
94
|
+
typeOptions: {
|
|
95
|
+
multipleValues: true,
|
|
96
|
+
sortable: true,
|
|
97
|
+
},
|
|
98
|
+
default: {},
|
|
99
|
+
displayOptions: {
|
|
100
|
+
show: {
|
|
101
|
+
resource: [LIMEOBJECT_RESOURCE],
|
|
102
|
+
operation: ['update'],
|
|
103
|
+
inputType: ['simple'],
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
options: [
|
|
107
|
+
{
|
|
108
|
+
name: 'field',
|
|
109
|
+
displayName: 'Field',
|
|
110
|
+
values: [
|
|
111
|
+
{
|
|
112
|
+
displayName: 'Field Name',
|
|
113
|
+
name: 'fieldName',
|
|
114
|
+
type: 'options',
|
|
115
|
+
typeOptions: {
|
|
116
|
+
loadOptionsMethod: 'getLimeTypeProperties',
|
|
117
|
+
loadOptionsDependsOn: ['limeType'],
|
|
118
|
+
},
|
|
119
|
+
default: '',
|
|
120
|
+
description: 'The name of the field',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
displayName: 'Field Value',
|
|
124
|
+
name: 'fieldValue',
|
|
125
|
+
type: 'string',
|
|
126
|
+
default: '',
|
|
127
|
+
description: 'The value of the field',
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
export async function execute(this: IExecuteFunctions, i: number) {
|
|
136
|
+
const limeType = this.getNodeParameter('limeType', i) as string;
|
|
137
|
+
const id = this.getNodeParameter('id', i) as string;
|
|
138
|
+
const inputType = this.getNodeParameter('inputType', i) as string;
|
|
139
|
+
|
|
140
|
+
let body: IDataObject = {};
|
|
141
|
+
|
|
142
|
+
if (inputType === 'json') {
|
|
143
|
+
const jsonData = this.getNodeParameter('jsonData', i) as string;
|
|
144
|
+
body = JSON.parse(jsonData);
|
|
145
|
+
} else {
|
|
146
|
+
const simpleFields = this.getNodeParameter(
|
|
147
|
+
'simpleFields.field',
|
|
148
|
+
i,
|
|
149
|
+
[]
|
|
150
|
+
) as IDataObject[];
|
|
151
|
+
for (const field of simpleFields) {
|
|
152
|
+
body[field.fieldName as string] = field.fieldValue;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return updateLimeObject(this, limeType, id, body);
|
|
157
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IExecuteFunctions,
|
|
3
|
+
INodeProperties,
|
|
4
|
+
NodePropertyTypes,
|
|
5
|
+
} from 'n8n-workflow';
|
|
6
|
+
|
|
7
|
+
import * as getType from './operations/getType.operation';
|
|
8
|
+
import * as listTypes from './operations/listTypes.operation';
|
|
9
|
+
import * as getProperties from './operations/getProperties.operation';
|
|
10
|
+
import { LIMETYPE_RESOURCE } from '../../commons';
|
|
11
|
+
|
|
12
|
+
export const limeTypeFields: INodeProperties[] = [
|
|
13
|
+
{
|
|
14
|
+
displayName: 'Operation',
|
|
15
|
+
name: 'operation',
|
|
16
|
+
type: 'options' as NodePropertyTypes,
|
|
17
|
+
noDataExpression: true,
|
|
18
|
+
displayOptions: {
|
|
19
|
+
show: {
|
|
20
|
+
resource: [LIMETYPE_RESOURCE],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
options: [
|
|
24
|
+
{
|
|
25
|
+
...listTypes.description,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
...getType.description,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
...getProperties.description,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
default: 'listTypes',
|
|
35
|
+
},
|
|
36
|
+
|
|
37
|
+
// Operation-specific fields
|
|
38
|
+
...getType.properties,
|
|
39
|
+
...getProperties.properties,
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
// Operations router
|
|
43
|
+
export async function limeTypeOperations(
|
|
44
|
+
this: IExecuteFunctions,
|
|
45
|
+
{ operation, i }: { operation: string; i: number }
|
|
46
|
+
) {
|
|
47
|
+
if (operation === 'listTypes') {
|
|
48
|
+
return await listTypes.execute.call(this);
|
|
49
|
+
}
|
|
50
|
+
if (operation === 'getType') {
|
|
51
|
+
return await getType.execute.call(this, i);
|
|
52
|
+
}
|
|
53
|
+
if (operation === 'getProperties') {
|
|
54
|
+
return await getProperties.execute.call(this, i);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
|
|
3
|
+
import { getProperties } from '../../../transport';
|
|
4
|
+
import { LIMETYPE_RESOURCE, LimeTypeProperty } from '../../../commons';
|
|
5
|
+
import { NodeResponse } from '../../../../nodeResponse';
|
|
6
|
+
|
|
7
|
+
export const description = {
|
|
8
|
+
name: 'Get Properties',
|
|
9
|
+
value: 'getProperties',
|
|
10
|
+
description: 'Get all properties for a specific entity type',
|
|
11
|
+
action: 'Get entity type properties',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const properties: INodeProperties[] = [
|
|
15
|
+
// Limetype selection
|
|
16
|
+
{
|
|
17
|
+
displayName: 'Type Name',
|
|
18
|
+
name: 'limeType',
|
|
19
|
+
type: 'options',
|
|
20
|
+
typeOptions: {
|
|
21
|
+
loadOptionsMethod: 'getLimeTypes',
|
|
22
|
+
},
|
|
23
|
+
required: true,
|
|
24
|
+
default: '',
|
|
25
|
+
description: 'The name of the entity type to get properties for',
|
|
26
|
+
displayOptions: {
|
|
27
|
+
show: {
|
|
28
|
+
resource: [LIMETYPE_RESOURCE],
|
|
29
|
+
operation: ['getProperties'],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
export async function execute(
|
|
36
|
+
this: IExecuteFunctions,
|
|
37
|
+
i: number
|
|
38
|
+
): Promise<NodeResponse<LimeTypeProperty[]>> {
|
|
39
|
+
const limeType = this.getNodeParameter('limeType', i) as string;
|
|
40
|
+
|
|
41
|
+
return getProperties(this, limeType);
|
|
42
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import { getLimeType } from '../../../transport/limetypes';
|
|
3
|
+
import { LIMETYPE_RESOURCE } from '../../../commons';
|
|
4
|
+
|
|
5
|
+
export const description = {
|
|
6
|
+
name: 'Get Type',
|
|
7
|
+
value: 'getType',
|
|
8
|
+
description: 'Get details about a specific entity type',
|
|
9
|
+
action: 'Get entity type details',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const properties: INodeProperties[] = [
|
|
13
|
+
{
|
|
14
|
+
displayName: 'Type Name',
|
|
15
|
+
name: 'limeType',
|
|
16
|
+
type: 'options',
|
|
17
|
+
typeOptions: {
|
|
18
|
+
loadOptionsMethod: 'getLimeTypes',
|
|
19
|
+
},
|
|
20
|
+
required: true,
|
|
21
|
+
default: '',
|
|
22
|
+
description: 'The name of the entity type to get details for',
|
|
23
|
+
displayOptions: {
|
|
24
|
+
show: {
|
|
25
|
+
resource: [LIMETYPE_RESOURCE],
|
|
26
|
+
operation: ['getType'],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
export async function execute(this: IExecuteFunctions, i: number) {
|
|
33
|
+
const limeType = this.getNodeParameter('limeType', i) as string;
|
|
34
|
+
|
|
35
|
+
return getLimeType(this, limeType);
|
|
36
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
|
|
3
|
+
import { getLimeTypesFromApi } from '../../../transport';
|
|
4
|
+
import { LimeType } from '../../../commons';
|
|
5
|
+
import { NodeResponse } from '../../../../nodeResponse';
|
|
6
|
+
|
|
7
|
+
export const description = {
|
|
8
|
+
name: 'List Types',
|
|
9
|
+
value: 'listTypes',
|
|
10
|
+
description: 'Get a list of all available entity types',
|
|
11
|
+
action: 'List all entity types',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export async function execute(
|
|
15
|
+
this: IExecuteFunctions
|
|
16
|
+
): Promise<NodeResponse<LimeType[]>> {
|
|
17
|
+
return await getLimeTypesFromApi(this);
|
|
18
|
+
}
|