@limetech/n8n-nodes-lime 0.3.8 → 0.5.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/.prettierignore +3 -1
- package/CHANGELOG.md +100 -0
- package/README.md +1 -8
- package/credentials/LimeCrmApi.credentials.ts +6 -6
- package/dist/nodes/lime-crm/LimeCrmNode.node.js +13 -0
- package/dist/nodes/lime-crm/LimeCrmNode.node.js.map +1 -1
- package/dist/nodes/lime-crm/commons/constants.d.ts +1 -0
- package/dist/nodes/lime-crm/commons/constants.js +2 -1
- package/dist/nodes/lime-crm/commons/constants.js.map +1 -1
- package/dist/nodes/lime-crm/commons/index.d.ts +1 -1
- package/dist/nodes/lime-crm/commons/index.js +2 -1
- package/dist/nodes/lime-crm/commons/index.js.map +1 -1
- package/dist/nodes/lime-crm/resources/limeQuery/index.d.ts +6 -0
- package/dist/nodes/lime-crm/resources/limeQuery/index.js +66 -0
- package/dist/nodes/lime-crm/resources/limeQuery/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.js +191 -0
- package/dist/nodes/lime-crm/resources/limeQuery/operations/query.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeType/index.d.ts +3 -3
- package/dist/nodes/lime-crm/transport/index.d.ts +1 -0
- package/dist/nodes/lime-crm/transport/index.js +3 -1
- package/dist/nodes/lime-crm/transport/index.js.map +1 -1
- package/dist/nodes/lime-crm/transport/limeQuery.d.ts +10 -0
- package/dist/nodes/lime-crm/transport/limeQuery.js +15 -0
- package/dist/nodes/lime-crm/transport/limeQuery.js.map +1 -0
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docker-compose.yml +9 -3
- package/nodes/fortnox/Fortnox.node.ts +3 -3
- package/nodes/fortnox/FortnoxTrigger.node.ts +2 -2
- package/nodes/lime-crm/LimeCrmNode.node.ts +54 -53
- package/nodes/lime-crm/LimeCrmTrigger.node.ts +17 -24
- package/nodes/lime-crm/commons/constants.ts +2 -2
- package/nodes/lime-crm/commons/files.ts +162 -0
- package/nodes/lime-crm/commons/index.ts +4 -3
- package/nodes/lime-crm/commons/webhook.ts +15 -3
- package/nodes/lime-crm/methods/getLimetypeProperties.ts +67 -0
- package/nodes/lime-crm/methods/getLimetypes.ts +21 -0
- package/nodes/lime-crm/methods/index.ts +6 -2
- package/nodes/lime-crm/model.ts +22 -0
- package/nodes/lime-crm/resources/data/index.ts +80 -0
- package/nodes/lime-crm/resources/{limeObject/operations/create.operation.ts → data/operations/createSingleObject.ts} +53 -30
- package/nodes/lime-crm/resources/{limeObject/operations/delete.operation.ts → data/operations/deleteSingleObject.ts} +15 -15
- package/nodes/lime-crm/resources/data/operations/getManyObjects.ts +356 -0
- package/nodes/lime-crm/resources/data/operations/getSingleFile.ts +138 -0
- package/nodes/lime-crm/resources/data/operations/getSingleObject.ts +83 -0
- package/nodes/lime-crm/resources/{limeObject/operations/update.operation.ts → data/operations/updateSingleObject.operation.ts} +51 -23
- package/nodes/lime-crm/resources/erpConnector/index.ts +3 -3
- package/nodes/lime-crm/resources/erpConnector/operations/transform.operation.ts +14 -14
- package/nodes/lime-crm/resources/erpConnector/transform.ts +3 -3
- package/nodes/lime-crm/resources/erpConnector/transformers/baseTransformer.ts +2 -2
- package/nodes/lime-crm/resources/erpConnector/transformers/fortnox.ts +8 -8
- package/nodes/lime-crm/resources/metadata/index.ts +57 -0
- package/nodes/lime-crm/resources/metadata/operations/getAllLimetypes.operation.ts +18 -0
- package/nodes/lime-crm/resources/metadata/operations/getSingleFileMetadata.ts +130 -0
- package/nodes/lime-crm/resources/metadata/operations/getSingleLimetype.ts +36 -0
- package/nodes/lime-crm/transport/commons.ts +14 -2
- package/nodes/lime-crm/transport/files.ts +155 -0
- package/nodes/lime-crm/transport/index.ts +14 -6
- package/nodes/lime-crm/transport/limeQuery.ts +26 -0
- package/nodes/lime-crm/transport/limeobjects.ts +79 -44
- package/nodes/lime-crm/transport/limetypes.ts +80 -24
- package/package.json +4 -3
- package/restore_script/README +42 -0
- package/restore_script/api_key_download.txt +0 -0
- package/restore_script/api_key_upload.txt +0 -0
- package/restore_script/cli.py +73 -0
- package/restore_script/download.py +73 -0
- package/restore_script/main.py +19 -0
- package/restore_script/poetry.lock +162 -0
- package/restore_script/pyproject.toml +15 -0
- package/restore_script/transfer.py +41 -0
- package/restore_script/upload.py +66 -0
- package/restore_script/utils.py +42 -0
- package/tests/transform.spec.ts +6 -6
- package/nodes/lime-crm/commons/limetype.ts +0 -11
- package/nodes/lime-crm/methods/getLimeTypeProperties.ts +0 -27
- package/nodes/lime-crm/methods/getLimeTypes.ts +0 -23
- package/nodes/lime-crm/resources/limeObject/index.ts +0 -64
- package/nodes/lime-crm/resources/limeObject/operations/fetchMany.operation.ts +0 -112
- package/nodes/lime-crm/resources/limeObject/operations/get.operation.ts +0 -54
- package/nodes/lime-crm/resources/limeType/index.ts +0 -58
- package/nodes/lime-crm/resources/limeType/operations/getProperties.operation.ts +0 -42
- package/nodes/lime-crm/resources/limeType/operations/getType.operation.ts +0 -36
- package/nodes/lime-crm/resources/limeType/operations/listTypes.operation.ts +0 -18
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import requests
|
|
4
|
+
import json
|
|
5
|
+
|
|
6
|
+
from utils import select_option, get_api_key, create_headers
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def main():
|
|
10
|
+
print("n8n Workflow Uploader")
|
|
11
|
+
instance_url = input("Enter n8n instance URL (e.g., https://n8n.example.com): ").strip().rstrip("/")
|
|
12
|
+
api_key = input("Enter your n8n API key: ").strip() or get_api_key("api_key_upload.txt")
|
|
13
|
+
options = os.listdir("./workflows")
|
|
14
|
+
selected = select_option(options)
|
|
15
|
+
print(f"Selected: {selected}")
|
|
16
|
+
|
|
17
|
+
workflows_endpoint = f"{instance_url}/api/v1/workflows"
|
|
18
|
+
folder_path = f"./workflows/{selected}"
|
|
19
|
+
|
|
20
|
+
upload_workflows(url=workflows_endpoint, api_key=api_key, folder_path=folder_path)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def upload_workflows(url, api_key, folder_path):
|
|
24
|
+
for f in os.listdir(folder_path):
|
|
25
|
+
with open(os.path.join(folder_path, f), "r") as file:
|
|
26
|
+
workflow = json.load(file)
|
|
27
|
+
clean_workflow(workflow)
|
|
28
|
+
|
|
29
|
+
try:
|
|
30
|
+
post_workflow(
|
|
31
|
+
url=url,
|
|
32
|
+
headers=create_headers(api_key),
|
|
33
|
+
body=workflow
|
|
34
|
+
)
|
|
35
|
+
except requests.exceptions.RequestException as e:
|
|
36
|
+
print(f"Error: {e}")
|
|
37
|
+
return
|
|
38
|
+
print(f"{f} - uploaded")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def post_workflow(url, headers, body):
|
|
42
|
+
response = requests.post(url=url, headers=headers, json=body)
|
|
43
|
+
response.raise_for_status()
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def clean_workflow(workflow):
|
|
47
|
+
top_keys = {"id", "createdAt", "updatedAt", "active", "isArchived", "meta", "pinData", "versionId", "triggerCount", "tags"}
|
|
48
|
+
shared_keys = {"createdAt", "updatedAt"}
|
|
49
|
+
project_keys = {"id", "type"}
|
|
50
|
+
|
|
51
|
+
for key in top_keys:
|
|
52
|
+
workflow.pop(key, None)
|
|
53
|
+
for item in workflow.get("nodes", []):
|
|
54
|
+
item.pop("credentials", None)
|
|
55
|
+
for item in workflow.get("shared", []):
|
|
56
|
+
for key in shared_keys:
|
|
57
|
+
item.pop(key, None)
|
|
58
|
+
if "project" in item:
|
|
59
|
+
for key in project_keys:
|
|
60
|
+
item["project"].pop(key, None)
|
|
61
|
+
|
|
62
|
+
return workflow
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
if __name__ == "__main__":
|
|
66
|
+
main()
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import curses
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def _menu(stdscr, options):
|
|
5
|
+
curses.curs_set(0)
|
|
6
|
+
current_row = 0
|
|
7
|
+
|
|
8
|
+
while True:
|
|
9
|
+
stdscr.clear()
|
|
10
|
+
for idx, option in enumerate(options):
|
|
11
|
+
if idx == current_row:
|
|
12
|
+
stdscr.addstr(idx, 0, option, curses.A_REVERSE)
|
|
13
|
+
else:
|
|
14
|
+
stdscr.addstr(idx, 0, option)
|
|
15
|
+
key = stdscr.getch()
|
|
16
|
+
|
|
17
|
+
if key == curses.KEY_UP and current_row > 0:
|
|
18
|
+
current_row -= 1
|
|
19
|
+
elif key == curses.KEY_DOWN and current_row < len(options) - 1:
|
|
20
|
+
current_row += 1
|
|
21
|
+
elif key == curses.KEY_ENTER or key in [10, 13]:
|
|
22
|
+
return options[current_row]
|
|
23
|
+
|
|
24
|
+
def select_option(options):
|
|
25
|
+
return curses.wrapper(_menu, options)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def create_headers(api_key):
|
|
29
|
+
return {
|
|
30
|
+
"X-N8N-API-KEY": api_key,
|
|
31
|
+
"Accept": "application/json"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def get_api_key(file_name):
|
|
36
|
+
try:
|
|
37
|
+
with open(file_name, "r") as file:
|
|
38
|
+
api_key = file.read().strip()
|
|
39
|
+
except FileNotFoundError:
|
|
40
|
+
api_key = ""
|
|
41
|
+
|
|
42
|
+
return api_key
|
package/tests/transform.spec.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
CustomLimetypeNames,
|
|
3
3
|
CustomPropertiesNames,
|
|
4
4
|
SearchParameters,
|
|
5
5
|
transform,
|
|
@@ -10,7 +10,7 @@ import { invoice } from './fixtures/fortnox';
|
|
|
10
10
|
describe('Fortnox transformer tests', () => {
|
|
11
11
|
it('should transform invoice for Fortnox', () => {
|
|
12
12
|
const searchParameters: SearchParameters = {};
|
|
13
|
-
const customLimeTipeNames:
|
|
13
|
+
const customLimeTipeNames: CustomLimetypeNames = {};
|
|
14
14
|
const customPropertiesNames: CustomPropertiesNames = {};
|
|
15
15
|
|
|
16
16
|
const result = transform(
|
|
@@ -120,7 +120,7 @@ describe('Fortnox transformer tests', () => {
|
|
|
120
120
|
property: 'invoice_number',
|
|
121
121
|
value: '2137',
|
|
122
122
|
};
|
|
123
|
-
const customLimeTipeNames:
|
|
123
|
+
const customLimeTipeNames: CustomLimetypeNames = {};
|
|
124
124
|
const customPropertiesNames: CustomPropertiesNames = {};
|
|
125
125
|
|
|
126
126
|
const result = transform(
|
|
@@ -139,9 +139,9 @@ describe('Fortnox transformer tests', () => {
|
|
|
139
139
|
});
|
|
140
140
|
});
|
|
141
141
|
|
|
142
|
-
it('should transform invoice for Fortnox with custom
|
|
142
|
+
it('should transform invoice for Fortnox with custom limetype names', () => {
|
|
143
143
|
const searchParameters: SearchParameters = {};
|
|
144
|
-
const customLimeTipeNames:
|
|
144
|
+
const customLimeTipeNames: CustomLimetypeNames = {
|
|
145
145
|
invoice: 'document',
|
|
146
146
|
invoicerow: 'documentrow',
|
|
147
147
|
};
|
|
@@ -164,7 +164,7 @@ describe('Fortnox transformer tests', () => {
|
|
|
164
164
|
|
|
165
165
|
it('should transform invoice for Fortnox with custom properties names', () => {
|
|
166
166
|
const searchParameters: SearchParameters = {};
|
|
167
|
-
const customLimeTipeNames:
|
|
167
|
+
const customLimeTipeNames: CustomLimetypeNames = {};
|
|
168
168
|
const customPropertiesNames: CustomPropertiesNames = {
|
|
169
169
|
invoice: { paid: 'is_paid' },
|
|
170
170
|
invoicerow: { row_value: 'value' },
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ILoadOptionsFunctions,
|
|
3
|
-
INodePropertyOptions,
|
|
4
|
-
LoggerProxy as Logger,
|
|
5
|
-
} from 'n8n-workflow';
|
|
6
|
-
import { getProperties } from '../transport/';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Load properties for a selected Lime type
|
|
10
|
-
*/
|
|
11
|
-
export async function getLimeTypeProperties(
|
|
12
|
-
this: ILoadOptionsFunctions
|
|
13
|
-
): Promise<INodePropertyOptions[]> {
|
|
14
|
-
const limeType = this.getNodeParameter('limeType', '') as string;
|
|
15
|
-
Logger.info(`Fetching properties for Lime type: ${limeType}`);
|
|
16
|
-
if (!limeType) return [];
|
|
17
|
-
|
|
18
|
-
const response = await getProperties(this, limeType);
|
|
19
|
-
|
|
20
|
-
if (!response.success) return [];
|
|
21
|
-
|
|
22
|
-
return response.data.map((property) => ({
|
|
23
|
-
name: (property.localname as string) || (property.name as string),
|
|
24
|
-
value: property.name as string,
|
|
25
|
-
description: `Type: ${property.type as string}${(property.required as boolean) ? ' (Required)' : ''}`,
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
|
|
2
|
-
import { getLimeTypesFromApi } from '../transport';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Load available Lime types from the API
|
|
6
|
-
*/
|
|
7
|
-
export async function getLimeTypes(
|
|
8
|
-
this: ILoadOptionsFunctions
|
|
9
|
-
): Promise<INodePropertyOptions[]> {
|
|
10
|
-
const data: INodePropertyOptions[] = [];
|
|
11
|
-
const response = await getLimeTypesFromApi(this);
|
|
12
|
-
if (response.success && response.data) {
|
|
13
|
-
for (const limeType of response.data) {
|
|
14
|
-
if (limeType.name) {
|
|
15
|
-
data.push({
|
|
16
|
-
name: limeType.name,
|
|
17
|
-
value: limeType.name,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return data;
|
|
23
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IExecuteFunctions,
|
|
3
|
-
INodeProperties,
|
|
4
|
-
NodePropertyTypes,
|
|
5
|
-
} from 'n8n-workflow';
|
|
6
|
-
|
|
7
|
-
import * as create from './operations/create.operation';
|
|
8
|
-
import * as get from './operations/get.operation';
|
|
9
|
-
import * as update from './operations/update.operation';
|
|
10
|
-
import * as delete_ from './operations/delete.operation';
|
|
11
|
-
import * as fetchMany from './operations/fetchMany.operation';
|
|
12
|
-
|
|
13
|
-
import { LIMEOBJECT_RESOURCE } from '../../commons';
|
|
14
|
-
|
|
15
|
-
export const limeObjectFields: INodeProperties[] = [
|
|
16
|
-
{
|
|
17
|
-
displayName: 'Operation',
|
|
18
|
-
name: 'operation',
|
|
19
|
-
type: 'options' as NodePropertyTypes,
|
|
20
|
-
noDataExpression: true,
|
|
21
|
-
displayOptions: {
|
|
22
|
-
show: {
|
|
23
|
-
resource: [LIMEOBJECT_RESOURCE],
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
options: [
|
|
27
|
-
create.description,
|
|
28
|
-
get.description,
|
|
29
|
-
update.description,
|
|
30
|
-
delete_.description,
|
|
31
|
-
fetchMany.description,
|
|
32
|
-
],
|
|
33
|
-
default: 'fetchMany',
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
...create.properties,
|
|
37
|
-
...get.properties,
|
|
38
|
-
...update.properties,
|
|
39
|
-
...delete_.properties,
|
|
40
|
-
...fetchMany.properties,
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
export async function limeObjectOperations(
|
|
44
|
-
this: IExecuteFunctions,
|
|
45
|
-
{ operation, i }: { operation: string; i: number }
|
|
46
|
-
) {
|
|
47
|
-
if (operation === 'create') {
|
|
48
|
-
return await create.execute.call(this, i);
|
|
49
|
-
}
|
|
50
|
-
if (operation === 'get') {
|
|
51
|
-
return await get.execute.call(this, i);
|
|
52
|
-
}
|
|
53
|
-
if (operation === 'update') {
|
|
54
|
-
return await update.execute.call(this, i);
|
|
55
|
-
}
|
|
56
|
-
if (operation === 'delete') {
|
|
57
|
-
return await delete_.execute.call(this, i);
|
|
58
|
-
}
|
|
59
|
-
if (operation === 'fetchMany') {
|
|
60
|
-
return await fetchMany.execute.call(this, i);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
-
import { fetchManyLimeObjects } from '../../../transport';
|
|
3
|
-
import { LIMEOBJECT_RESOURCE } from '../../../commons';
|
|
4
|
-
|
|
5
|
-
export const description = {
|
|
6
|
-
name: 'Fetch many',
|
|
7
|
-
value: 'fetchMany',
|
|
8
|
-
description: 'Fetch many Lime objects',
|
|
9
|
-
action: 'Fetch many 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: ['fetchMany'],
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
displayName: 'Search Term',
|
|
32
|
-
name: 'searchTerm',
|
|
33
|
-
type: 'string',
|
|
34
|
-
default: '',
|
|
35
|
-
description: 'Term to search for',
|
|
36
|
-
displayOptions: {
|
|
37
|
-
show: {
|
|
38
|
-
resource: [LIMEOBJECT_RESOURCE],
|
|
39
|
-
operation: ['fetchMany'],
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
displayName: 'Search Fields',
|
|
45
|
-
name: 'searchField',
|
|
46
|
-
type: 'options',
|
|
47
|
-
typeOptions: {
|
|
48
|
-
loadOptionsMethod: 'getLimeTypeProperties',
|
|
49
|
-
loadOptionsDependsOn: ['limeType'],
|
|
50
|
-
},
|
|
51
|
-
default: [],
|
|
52
|
-
description:
|
|
53
|
-
'Fields to search in. If none selected, searches across all searchable fields',
|
|
54
|
-
displayOptions: {
|
|
55
|
-
show: {
|
|
56
|
-
resource: [LIMEOBJECT_RESOURCE],
|
|
57
|
-
operation: ['fetchMany'],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
displayName: 'Limit',
|
|
63
|
-
name: 'limit',
|
|
64
|
-
type: 'number',
|
|
65
|
-
default: 50,
|
|
66
|
-
description: 'Max number of results to return',
|
|
67
|
-
typeOptions: {
|
|
68
|
-
minValue: 1,
|
|
69
|
-
},
|
|
70
|
-
displayOptions: {
|
|
71
|
-
show: {
|
|
72
|
-
resource: [LIMEOBJECT_RESOURCE],
|
|
73
|
-
operation: ['fetchMany'],
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
displayName: 'Offset',
|
|
79
|
-
name: 'offset',
|
|
80
|
-
type: 'number',
|
|
81
|
-
default: 0,
|
|
82
|
-
description: 'Offset to first object to return',
|
|
83
|
-
typeOptions: {
|
|
84
|
-
minValue: 0,
|
|
85
|
-
},
|
|
86
|
-
displayOptions: {
|
|
87
|
-
show: {
|
|
88
|
-
resource: [LIMEOBJECT_RESOURCE],
|
|
89
|
-
operation: ['fetchMany'],
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
];
|
|
94
|
-
|
|
95
|
-
export async function execute(this: IExecuteFunctions, i: number) {
|
|
96
|
-
const limeType = this.getNodeParameter('limeType', i) as string;
|
|
97
|
-
const searchTerm = this.getNodeParameter('searchTerm', i, '') as string;
|
|
98
|
-
const searchField = this.getNodeParameter('searchField', i) as string;
|
|
99
|
-
const limit = this.getNodeParameter('limit', i, 50);
|
|
100
|
-
const offset = this.getNodeParameter('offset', i, 0) as number;
|
|
101
|
-
const options = this.getNodeParameter('options', i, {});
|
|
102
|
-
|
|
103
|
-
return await fetchManyLimeObjects(
|
|
104
|
-
this,
|
|
105
|
-
limeType,
|
|
106
|
-
searchField,
|
|
107
|
-
searchTerm,
|
|
108
|
-
limit,
|
|
109
|
-
offset,
|
|
110
|
-
(options.sortField as string) || null
|
|
111
|
-
);
|
|
112
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
}
|