@limetech/n8n-nodes-lime 0.1.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/.eslintrc.js +58 -0
- package/.github/copilot-instructions.md +20 -0
- package/.github/workflows/publish.yml +34 -0
- package/README.md +79 -0
- package/credentials/LimeCrmApi.credentials.ts +57 -0
- package/credentials/LimeGoApi.credentials.ts +31 -0
- package/dist/credentials/LimeCrmApi.credentials.d.ts +9 -0
- package/dist/credentials/LimeCrmApi.credentials.js +53 -0
- package/dist/credentials/LimeCrmApi.credentials.js.map +1 -0
- package/dist/credentials/LimeGoApi.credentials.d.ts +15 -0
- package/dist/credentials/LimeGoApi.credentials.js +32 -0
- package/dist/credentials/LimeGoApi.credentials.js.map +1 -0
- package/dist/nodes/lime-crm/GenericTypes.d.ts +80 -0
- package/dist/nodes/lime-crm/GenericTypes.js +7 -0
- package/dist/nodes/lime-crm/GenericTypes.js.map +1 -0
- package/dist/nodes/lime-crm/LimeCrm.node.json +18 -0
- package/dist/nodes/lime-crm/LimeCrmNode.node.d.ts +17 -0
- package/dist/nodes/lime-crm/LimeCrmNode.node.js +114 -0
- package/dist/nodes/lime-crm/LimeCrmNode.node.js.map +1 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.d.ts +17 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.js +408 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.js.map +1 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger.node.d.ts +17 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger.node.js +439 -0
- package/dist/nodes/lime-crm/LimeCrmTrigger.node.js.map +1 -0
- package/dist/nodes/lime-crm/lime-crm.svg +1 -0
- package/dist/nodes/lime-crm/methods/getAllSortableFields.d.ts +7 -0
- package/dist/nodes/lime-crm/methods/getAllSortableFields.js +53 -0
- package/dist/nodes/lime-crm/methods/getAllSortableFields.js.map +1 -0
- package/dist/nodes/lime-crm/methods/getLimeTypeProperties.d.ts +3 -0
- package/dist/nodes/lime-crm/methods/getLimeTypeProperties.js +40 -0
- package/dist/nodes/lime-crm/methods/getLimeTypeProperties.js.map +1 -0
- package/dist/nodes/lime-crm/methods/getLimeTypeRelations.d.ts +7 -0
- package/dist/nodes/lime-crm/methods/getLimeTypeRelations.js +30 -0
- package/dist/nodes/lime-crm/methods/getLimeTypeRelations.js.map +1 -0
- package/dist/nodes/lime-crm/methods/getLimeTypes.d.ts +3 -0
- package/dist/nodes/lime-crm/methods/getLimeTypes.js +33 -0
- package/dist/nodes/lime-crm/methods/getLimeTypes.js.map +1 -0
- package/dist/nodes/lime-crm/methods/getRelatedTypeProperties.d.ts +7 -0
- package/dist/nodes/lime-crm/methods/getRelatedTypeProperties.js +39 -0
- package/dist/nodes/lime-crm/methods/getRelatedTypeProperties.js.map +1 -0
- package/dist/nodes/lime-crm/methods/index.d.ts +5 -0
- package/dist/nodes/lime-crm/methods/index.js +14 -0
- package/dist/nodes/lime-crm/methods/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/commonFields.d.ts +4 -0
- package/dist/nodes/lime-crm/resources/limeObject/commonFields.js +165 -0
- package/dist/nodes/lime-crm/resources/limeObject/commonFields.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/index.d.ts +6 -0
- package/dist/nodes/lime-crm/resources/limeObject/index.js +79 -0
- package/dist/nodes/lime-crm/resources/limeObject/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/common.operation.d.ts +2 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/common.operation.js +36 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/common.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.js +234 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/create.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.js +136 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/delete.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.js +125 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/get.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/getAll.operation.d.ts +3 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/getAll.operation.js +212 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/getAll.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.js +232 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/search.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.js +186 -0
- package/dist/nodes/lime-crm/resources/limeObject/operations/update.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeType/index.d.ts +6 -0
- package/dist/nodes/lime-crm/resources/limeType/index.js +81 -0
- package/dist/nodes/lime-crm/resources/limeType/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.js +112 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getProperties.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getRelations.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getRelations.operation.js +112 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getRelations.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.js +70 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/getType.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.js +86 -0
- package/dist/nodes/lime-crm/resources/limeType/operations/listTypes.operation.js.map +1 -0
- package/dist/nodes/lime-crm/resources/queryApi/index.d.ts +6 -0
- package/dist/nodes/lime-crm/resources/queryApi/index.js +57 -0
- package/dist/nodes/lime-crm/resources/queryApi/index.js.map +1 -0
- package/dist/nodes/lime-crm/resources/queryApi/operations/executeQuery.operation.d.ts +9 -0
- package/dist/nodes/lime-crm/resources/queryApi/operations/executeQuery.operation.js +559 -0
- package/dist/nodes/lime-crm/resources/queryApi/operations/executeQuery.operation.js.map +1 -0
- package/dist/nodes/lime-crm/transport/index.d.ts +2 -0
- package/dist/nodes/lime-crm/transport/index.js +50 -0
- package/dist/nodes/lime-crm/transport/index.js.map +1 -0
- package/dist/nodes/lime-go/LimeGo.node.d.ts +8 -0
- package/dist/nodes/lime-go/LimeGo.node.js +123 -0
- package/dist/nodes/lime-go/LimeGo.node.js.map +1 -0
- package/dist/nodes/lime-go/actions/organization/get.operation.d.ts +5 -0
- package/dist/nodes/lime-go/actions/organization/get.operation.js +39 -0
- package/dist/nodes/lime-go/actions/organization/get.operation.js.map +1 -0
- package/dist/nodes/lime-go/actions/organization/getByExternalKey.operation.d.ts +5 -0
- package/dist/nodes/lime-go/actions/organization/getByExternalKey.operation.js +54 -0
- package/dist/nodes/lime-go/actions/organization/getByExternalKey.operation.js.map +1 -0
- package/dist/nodes/lime-go/actions/organization/index.d.ts +7 -0
- package/dist/nodes/lime-go/actions/organization/index.js +92 -0
- package/dist/nodes/lime-go/actions/organization/index.js.map +1 -0
- package/dist/nodes/lime-go/actions/organization/organizationFields.d.ts +2 -0
- package/dist/nodes/lime-go/actions/organization/organizationFields.js +162 -0
- package/dist/nodes/lime-go/actions/organization/organizationFields.js.map +1 -0
- package/dist/nodes/lime-go/actions/organization/search.operation.d.ts +5 -0
- package/dist/nodes/lime-go/actions/organization/search.operation.js +70 -0
- package/dist/nodes/lime-go/actions/organization/search.operation.js.map +1 -0
- package/dist/nodes/lime-go/actions/organization/update.operation.d.ts +5 -0
- package/dist/nodes/lime-go/actions/organization/update.operation.js +125 -0
- package/dist/nodes/lime-go/actions/organization/update.operation.js.map +1 -0
- package/dist/nodes/lime-go/actions/person/createMail.operation.d.ts +7 -0
- package/dist/nodes/lime-go/actions/person/createMail.operation.js +130 -0
- package/dist/nodes/lime-go/actions/person/createMail.operation.js.map +1 -0
- package/dist/nodes/lime-go/actions/person/get.operation.d.ts +7 -0
- package/dist/nodes/lime-go/actions/person/get.operation.js +45 -0
- package/dist/nodes/lime-go/actions/person/get.operation.js.map +1 -0
- package/dist/nodes/lime-go/actions/person/index.d.ts +7 -0
- package/dist/nodes/lime-go/actions/person/index.js +92 -0
- package/dist/nodes/lime-go/actions/person/index.js.map +1 -0
- package/dist/nodes/lime-go/actions/person/personFields.d.ts +2 -0
- package/dist/nodes/lime-go/actions/person/personFields.js +134 -0
- package/dist/nodes/lime-go/actions/person/personFields.js.map +1 -0
- package/dist/nodes/lime-go/actions/person/search.operation.d.ts +7 -0
- package/dist/nodes/lime-go/actions/person/search.operation.js +81 -0
- package/dist/nodes/lime-go/actions/person/search.operation.js.map +1 -0
- package/dist/nodes/lime-go/actions/person/update.operation.d.ts +7 -0
- package/dist/nodes/lime-go/actions/person/update.operation.js +104 -0
- package/dist/nodes/lime-go/actions/person/update.operation.js.map +1 -0
- package/dist/nodes/lime-go/lime-go.svg +1 -0
- package/dist/nodes/lime-go/transport/graphqlRequest.d.ts +2 -0
- package/dist/nodes/lime-go/transport/graphqlRequest.js +23 -0
- package/dist/nodes/lime-go/transport/graphqlRequest.js.map +1 -0
- package/dist/nodes/lime-go/transport/transport.d.ts +3 -0
- package/dist/nodes/lime-go/transport/transport.js +58 -0
- package/dist/nodes/lime-go/transport/transport.js.map +1 -0
- package/dist/nodes/lime-go/triggers/webhook.d.ts +10 -0
- package/dist/nodes/lime-go/triggers/webhook.js +92 -0
- package/dist/nodes/lime-go/triggers/webhook.js.map +1 -0
- package/dist/package.json +49 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/docker-compose.yml +44 -0
- package/index.js +3 -0
- package/nodes/lime-crm/GenericTypes.ts +114 -0
- package/nodes/lime-crm/LimeCrm.node.json +18 -0
- package/nodes/lime-crm/LimeCrmNode.node.ts +154 -0
- package/nodes/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.ts +461 -0
- package/nodes/lime-crm/LimeCrmTrigger.node.ts +505 -0
- package/nodes/lime-crm/lime-crm.svg +1 -0
- package/nodes/lime-crm/methods/getAllSortableFields.ts +73 -0
- package/nodes/lime-crm/methods/getLimeTypeProperties.ts +48 -0
- package/nodes/lime-crm/methods/getLimeTypeRelations.ts +32 -0
- package/nodes/lime-crm/methods/getLimeTypes.ts +33 -0
- package/nodes/lime-crm/methods/getRelatedTypeProperties.ts +47 -0
- package/nodes/lime-crm/methods/index.ts +5 -0
- package/nodes/lime-crm/resources/limeObject/commonFields.ts +179 -0
- package/nodes/lime-crm/resources/limeObject/index.ts +64 -0
- package/nodes/lime-crm/resources/limeObject/operations/common.operation.ts +35 -0
- package/nodes/lime-crm/resources/limeObject/operations/create.operation.ts +234 -0
- package/nodes/lime-crm/resources/limeObject/operations/delete.operation.ts +136 -0
- package/nodes/lime-crm/resources/limeObject/operations/get.operation.ts +124 -0
- package/nodes/lime-crm/resources/limeObject/operations/getAll.operation.ts +242 -0
- package/nodes/lime-crm/resources/limeObject/operations/search.operation.ts +242 -0
- package/nodes/lime-crm/resources/limeObject/operations/update.operation.ts +201 -0
- package/nodes/lime-crm/resources/limeType/index.ts +66 -0
- package/nodes/lime-crm/resources/limeType/operations/getProperties.operation.ts +105 -0
- package/nodes/lime-crm/resources/limeType/operations/getRelations.operation.ts +105 -0
- package/nodes/lime-crm/resources/limeType/operations/getType.operation.ts +58 -0
- package/nodes/lime-crm/resources/limeType/operations/listTypes.operation.ts +76 -0
- package/nodes/lime-crm/resources/queryApi/index.ts +42 -0
- package/nodes/lime-crm/resources/queryApi/operations/executeQuery.operation.ts +605 -0
- package/nodes/lime-crm/transport/index.ts +74 -0
- package/nodes/lime-go/LimeGo.node.ts +146 -0
- package/nodes/lime-go/actions/organization/get.operation.ts +42 -0
- package/nodes/lime-go/actions/organization/getByExternalKey.operation.ts +57 -0
- package/nodes/lime-go/actions/organization/index.ts +69 -0
- package/nodes/lime-go/actions/organization/organizationFields.ts +160 -0
- package/nodes/lime-go/actions/organization/search.operation.ts +73 -0
- package/nodes/lime-go/actions/organization/update.operation.ts +140 -0
- package/nodes/lime-go/actions/person/createMail.operation.ts +140 -0
- package/nodes/lime-go/actions/person/get.operation.ts +51 -0
- package/nodes/lime-go/actions/person/index.ts +69 -0
- package/nodes/lime-go/actions/person/personFields.ts +132 -0
- package/nodes/lime-go/actions/person/search.operation.ts +88 -0
- package/nodes/lime-go/actions/person/update.operation.ts +122 -0
- package/nodes/lime-go/lime-go.svg +1 -0
- package/nodes/lime-go/transport/graphqlRequest.ts +30 -0
- package/package.json +50 -0
- package/tsconfig.json +30 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IExecuteFunctions,
|
|
3
|
+
INodeProperties,
|
|
4
|
+
IDataObject,
|
|
5
|
+
NodeOperationError,
|
|
6
|
+
} from 'n8n-workflow';
|
|
7
|
+
|
|
8
|
+
export const description = {
|
|
9
|
+
name: 'Delete Object',
|
|
10
|
+
value: 'delete',
|
|
11
|
+
description: 'Delete an existing object',
|
|
12
|
+
action: 'Delete an object',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const properties: INodeProperties[] = [
|
|
16
|
+
// Limetype selection
|
|
17
|
+
{
|
|
18
|
+
displayName: 'Lime Type',
|
|
19
|
+
name: 'limeType',
|
|
20
|
+
type: 'options',
|
|
21
|
+
typeOptions: {
|
|
22
|
+
loadOptionsMethod: 'getLimeTypes',
|
|
23
|
+
},
|
|
24
|
+
required: true,
|
|
25
|
+
default: '',
|
|
26
|
+
description: 'The type of entity to delete',
|
|
27
|
+
displayOptions: {
|
|
28
|
+
show: {
|
|
29
|
+
resource: [
|
|
30
|
+
'limeObject',
|
|
31
|
+
],
|
|
32
|
+
operation: [
|
|
33
|
+
'delete',
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
// Object ID
|
|
40
|
+
{
|
|
41
|
+
displayName: 'Object ID',
|
|
42
|
+
name: 'objectId',
|
|
43
|
+
type: 'string',
|
|
44
|
+
required: true,
|
|
45
|
+
default: '',
|
|
46
|
+
description: 'The ID of the object to delete',
|
|
47
|
+
displayOptions: {
|
|
48
|
+
show: {
|
|
49
|
+
resource: [
|
|
50
|
+
'limeObject',
|
|
51
|
+
],
|
|
52
|
+
operation: [
|
|
53
|
+
'delete',
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
// Delete options
|
|
60
|
+
{
|
|
61
|
+
displayName: 'Options',
|
|
62
|
+
name: 'options',
|
|
63
|
+
type: 'collection',
|
|
64
|
+
placeholder: 'Add Option',
|
|
65
|
+
default: {},
|
|
66
|
+
displayOptions: {
|
|
67
|
+
show: {
|
|
68
|
+
resource: [
|
|
69
|
+
'limeObject',
|
|
70
|
+
],
|
|
71
|
+
operation: [
|
|
72
|
+
'delete',
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
options: [
|
|
77
|
+
{
|
|
78
|
+
displayName: 'Force Delete',
|
|
79
|
+
name: 'forceDelete',
|
|
80
|
+
type: 'boolean',
|
|
81
|
+
default: false,
|
|
82
|
+
description: 'Whether to force deletion even if there are references to this object',
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
|
|
88
|
+
export async function execute(
|
|
89
|
+
this: IExecuteFunctions,
|
|
90
|
+
i: number,
|
|
91
|
+
) {
|
|
92
|
+
const { apiRequest } = await import('../../../transport');
|
|
93
|
+
const limeType = this.getNodeParameter('limeType', i) as string;
|
|
94
|
+
const objectId = this.getNodeParameter('objectId', i) as string;
|
|
95
|
+
const options = this.getNodeParameter('options', i, {}) as IDataObject;
|
|
96
|
+
|
|
97
|
+
if (!limeType) {
|
|
98
|
+
throw new NodeOperationError(this.getNode(), 'Lime type must be provided');
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (!objectId) {
|
|
102
|
+
throw new NodeOperationError(this.getNode(), 'Object ID must be provided');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Build endpoint and parameters
|
|
106
|
+
let endpoint = `/api/v1/limeobject/${encodeURIComponent(limeType)}/${encodeURIComponent(objectId)}`;
|
|
107
|
+
|
|
108
|
+
const queryParams: IDataObject = {};
|
|
109
|
+
|
|
110
|
+
// Add force parameter if requested
|
|
111
|
+
if (options.forceDelete === true) {
|
|
112
|
+
queryParams.force = true;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
try {
|
|
116
|
+
const response = await apiRequest.call(this, {
|
|
117
|
+
method: 'DELETE',
|
|
118
|
+
endpoint,
|
|
119
|
+
qs: queryParams,
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// Return a success message with relevant information
|
|
123
|
+
return {
|
|
124
|
+
success: true,
|
|
125
|
+
limeType,
|
|
126
|
+
objectId,
|
|
127
|
+
message: `Successfully deleted ${limeType} with ID: ${objectId}`,
|
|
128
|
+
...response, // Include any additional data returned by the API
|
|
129
|
+
};
|
|
130
|
+
} catch (error) {
|
|
131
|
+
throw new NodeOperationError(
|
|
132
|
+
this.getNode(),
|
|
133
|
+
`Failed to delete ${limeType} object with ID ${objectId}: ${error.message}`
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IExecuteFunctions,
|
|
3
|
+
INodeProperties,
|
|
4
|
+
IDataObject,
|
|
5
|
+
NodeOperationError,
|
|
6
|
+
} from 'n8n-workflow';
|
|
7
|
+
|
|
8
|
+
export const description = {
|
|
9
|
+
name: 'Get Object',
|
|
10
|
+
value: 'get',
|
|
11
|
+
description: 'Get a single object by ID',
|
|
12
|
+
action: 'Get an object',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const properties: INodeProperties[] = [
|
|
16
|
+
// Limetype selection
|
|
17
|
+
{
|
|
18
|
+
displayName: 'Lime Type',
|
|
19
|
+
name: 'limeType',
|
|
20
|
+
type: 'options',
|
|
21
|
+
typeOptions: {
|
|
22
|
+
loadOptionsMethod: 'getLimeTypes',
|
|
23
|
+
},
|
|
24
|
+
required: true,
|
|
25
|
+
default: '',
|
|
26
|
+
description: 'The type of entity to retrieve',
|
|
27
|
+
displayOptions: {
|
|
28
|
+
show: {
|
|
29
|
+
resource: [
|
|
30
|
+
'limeObject',
|
|
31
|
+
],
|
|
32
|
+
operation: [
|
|
33
|
+
'get',
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
// Object ID
|
|
40
|
+
{
|
|
41
|
+
displayName: 'Object ID',
|
|
42
|
+
name: 'objectId',
|
|
43
|
+
type: 'string',
|
|
44
|
+
required: true,
|
|
45
|
+
default: '',
|
|
46
|
+
description: 'The ID of the object to retrieve',
|
|
47
|
+
displayOptions: {
|
|
48
|
+
show: {
|
|
49
|
+
resource: [
|
|
50
|
+
'limeObject',
|
|
51
|
+
],
|
|
52
|
+
operation: [
|
|
53
|
+
'get',
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
// Properties to return
|
|
60
|
+
{
|
|
61
|
+
displayName: 'Properties to Return',
|
|
62
|
+
name: 'properties',
|
|
63
|
+
type: 'multiOptions',
|
|
64
|
+
typeOptions: {
|
|
65
|
+
loadOptionsMethod: 'getLimeTypeProperties',
|
|
66
|
+
loadOptionsDependsOn: ['limeType'],
|
|
67
|
+
},
|
|
68
|
+
default: [],
|
|
69
|
+
description: 'Properties to include in the response',
|
|
70
|
+
displayOptions: {
|
|
71
|
+
show: {
|
|
72
|
+
resource: [
|
|
73
|
+
'limeObject',
|
|
74
|
+
],
|
|
75
|
+
operation: [
|
|
76
|
+
'get',
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
export async function execute(
|
|
84
|
+
this: IExecuteFunctions,
|
|
85
|
+
i: number,
|
|
86
|
+
) {
|
|
87
|
+
const { apiRequest } = await import('../../../transport');
|
|
88
|
+
const limeType = this.getNodeParameter('limeType', i) as string;
|
|
89
|
+
const objectId = this.getNodeParameter('objectId', i) as string;
|
|
90
|
+
const properties = this.getNodeParameter('properties', i, []) as string[];
|
|
91
|
+
|
|
92
|
+
if (!limeType) {
|
|
93
|
+
throw new NodeOperationError(this.getNode(), 'Lime type must be provided');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (!objectId) {
|
|
97
|
+
throw new NodeOperationError(this.getNode(), 'Object ID must be provided');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Build the query parameters
|
|
101
|
+
const queryParams: IDataObject = {};
|
|
102
|
+
|
|
103
|
+
// Add properties to return if specified
|
|
104
|
+
if (properties && properties.length > 0) {
|
|
105
|
+
queryParams._fields = properties.join(',');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const endpoint = `/api/v1/limeobject/${encodeURIComponent(limeType)}/${encodeURIComponent(objectId)}/`;
|
|
109
|
+
|
|
110
|
+
try {
|
|
111
|
+
const response = await apiRequest.call(this, {
|
|
112
|
+
method: 'GET',
|
|
113
|
+
endpoint,
|
|
114
|
+
qs: queryParams,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
return response;
|
|
118
|
+
} catch (error) {
|
|
119
|
+
throw new NodeOperationError(
|
|
120
|
+
this.getNode(),
|
|
121
|
+
`Failed to get ${limeType} object with ID ${objectId}: ${error.message}`
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IExecuteFunctions,
|
|
3
|
+
INodeProperties,
|
|
4
|
+
IDataObject,
|
|
5
|
+
NodeOperationError,
|
|
6
|
+
} from 'n8n-workflow';
|
|
7
|
+
import { apiRequest } from '../../../transport';
|
|
8
|
+
|
|
9
|
+
// Input fields for getAll operation
|
|
10
|
+
export const description: INodeProperties[] = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'Return All',
|
|
13
|
+
name: 'returnAll',
|
|
14
|
+
type: 'boolean',
|
|
15
|
+
displayOptions: {
|
|
16
|
+
show: {
|
|
17
|
+
resource: [
|
|
18
|
+
'limeObject',
|
|
19
|
+
],
|
|
20
|
+
operation: [
|
|
21
|
+
'getAll',
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
default: false,
|
|
26
|
+
description: 'Whether to return all results or only up to a limit',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
displayName: 'Limit',
|
|
30
|
+
name: 'limit',
|
|
31
|
+
type: 'number',
|
|
32
|
+
displayOptions: {
|
|
33
|
+
show: {
|
|
34
|
+
resource: [
|
|
35
|
+
'limeObject',
|
|
36
|
+
],
|
|
37
|
+
operation: [
|
|
38
|
+
'getAll',
|
|
39
|
+
],
|
|
40
|
+
returnAll: [
|
|
41
|
+
false,
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
typeOptions: {
|
|
46
|
+
minValue: 1,
|
|
47
|
+
maxValue: 1000,
|
|
48
|
+
},
|
|
49
|
+
default: 100,
|
|
50
|
+
description: 'Max number of results to return',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
displayName: 'Sort By',
|
|
54
|
+
name: 'sortField',
|
|
55
|
+
type: 'options',
|
|
56
|
+
typeOptions: {
|
|
57
|
+
loadOptionsMethod: 'getLimeTypeProperties',
|
|
58
|
+
loadOptionsDependsOn: ['limeType'],
|
|
59
|
+
},
|
|
60
|
+
default: '',
|
|
61
|
+
description: 'Field to sort by',
|
|
62
|
+
displayOptions: {
|
|
63
|
+
show: {
|
|
64
|
+
resource: [
|
|
65
|
+
'limeObject',
|
|
66
|
+
],
|
|
67
|
+
operation: [
|
|
68
|
+
'getAll',
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
displayName: 'Sort Direction',
|
|
75
|
+
name: 'sortDirection',
|
|
76
|
+
type: 'options',
|
|
77
|
+
options: [
|
|
78
|
+
{
|
|
79
|
+
name: 'Ascending',
|
|
80
|
+
value: 'asc',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'Descending',
|
|
84
|
+
value: 'desc',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
default: 'asc',
|
|
88
|
+
description: 'Direction to sort in',
|
|
89
|
+
displayOptions: {
|
|
90
|
+
show: {
|
|
91
|
+
resource: [
|
|
92
|
+
'limeObject',
|
|
93
|
+
],
|
|
94
|
+
operation: [
|
|
95
|
+
'getAll',
|
|
96
|
+
],
|
|
97
|
+
sortField: [
|
|
98
|
+
// Any non-empty string
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
displayName: 'Use Filter',
|
|
105
|
+
name: 'useFilter',
|
|
106
|
+
type: 'boolean',
|
|
107
|
+
default: false,
|
|
108
|
+
description: 'Whether to use a filter',
|
|
109
|
+
displayOptions: {
|
|
110
|
+
show: {
|
|
111
|
+
resource: [
|
|
112
|
+
'limeObject',
|
|
113
|
+
],
|
|
114
|
+
operation: [
|
|
115
|
+
'getAll',
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
displayName: 'Filter',
|
|
122
|
+
name: 'advancedFilter',
|
|
123
|
+
type: 'json',
|
|
124
|
+
default: '{\n "property": "name",\n "value": "search term",\n "operator": "contains"\n}',
|
|
125
|
+
description: 'Filter in JSON format',
|
|
126
|
+
typeOptions: {
|
|
127
|
+
alwaysOpenEditWindow: true,
|
|
128
|
+
},
|
|
129
|
+
displayOptions: {
|
|
130
|
+
show: {
|
|
131
|
+
resource: [
|
|
132
|
+
'limeObject',
|
|
133
|
+
],
|
|
134
|
+
operation: [
|
|
135
|
+
'getAll',
|
|
136
|
+
],
|
|
137
|
+
useFilter: [
|
|
138
|
+
true,
|
|
139
|
+
],
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
// Execute function for getAll operation
|
|
146
|
+
export async function execute(this: IExecuteFunctions, i: number) {
|
|
147
|
+
const limeType = this.getNodeParameter('limeType', i) as string;
|
|
148
|
+
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
|
149
|
+
const limit = returnAll ? 0 : this.getNodeParameter('limit', i, 100) as number;
|
|
150
|
+
const sortField = this.getNodeParameter('sortField', i, '') as string;
|
|
151
|
+
const useFilter = this.getNodeParameter('useFilter', i, false) as boolean;
|
|
152
|
+
const options = this.getNodeParameter('options', i, {}) as IDataObject;
|
|
153
|
+
const rawResponse = options.rawResponse as boolean || false;
|
|
154
|
+
|
|
155
|
+
const qs: IDataObject = {};
|
|
156
|
+
|
|
157
|
+
// Add pagination parameters
|
|
158
|
+
if (!returnAll) {
|
|
159
|
+
qs._limit = limit;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Add sorting if specified
|
|
163
|
+
if (sortField) {
|
|
164
|
+
const sortDirection = this.getNodeParameter('sortDirection', i, 'asc') as string;
|
|
165
|
+
qs._sort = `${sortField}:${sortDirection}`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Add filter if specified
|
|
169
|
+
if (useFilter) {
|
|
170
|
+
try {
|
|
171
|
+
const advancedFilter = this.getNodeParameter('advancedFilter', i) as string;
|
|
172
|
+
const filterObject = typeof advancedFilter === 'string'
|
|
173
|
+
? JSON.parse(advancedFilter)
|
|
174
|
+
: advancedFilter;
|
|
175
|
+
qs._filter = JSON.stringify(filterObject);
|
|
176
|
+
} catch (error) {
|
|
177
|
+
throw new NodeOperationError(this.getNode(), 'Invalid JSON filter: ' + error.message);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Include related objects if requested
|
|
182
|
+
if (options.includeRelated) {
|
|
183
|
+
qs._embed = 'all';
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const endpoint = `/api/v1/limeobject/${limeType}/`;
|
|
187
|
+
|
|
188
|
+
if (returnAll) {
|
|
189
|
+
// Handle pagination manually to get all results
|
|
190
|
+
const returnData: IDataObject[] = [];
|
|
191
|
+
let hasMoreData = true;
|
|
192
|
+
let offset = 0;
|
|
193
|
+
const pageLimit = 100; // Reasonable page size
|
|
194
|
+
|
|
195
|
+
while (hasMoreData) {
|
|
196
|
+
qs._limit = pageLimit;
|
|
197
|
+
qs._offset = offset;
|
|
198
|
+
|
|
199
|
+
const response = await apiRequest.call(
|
|
200
|
+
this,
|
|
201
|
+
{
|
|
202
|
+
method: 'GET',
|
|
203
|
+
url: endpoint,
|
|
204
|
+
qs,
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
|
|
208
|
+
const items = response._embedded?.limeobjects || [];
|
|
209
|
+
|
|
210
|
+
if (items.length === 0) {
|
|
211
|
+
hasMoreData = false;
|
|
212
|
+
} else {
|
|
213
|
+
returnData.push(...items);
|
|
214
|
+
offset += items.length;
|
|
215
|
+
|
|
216
|
+
// Check if we reached the end
|
|
217
|
+
if (items.length < pageLimit) {
|
|
218
|
+
hasMoreData = false;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return rawResponse
|
|
224
|
+
? { _embedded: { limeobjects: returnData } }
|
|
225
|
+
: returnData;
|
|
226
|
+
|
|
227
|
+
} else {
|
|
228
|
+
// Single request with pagination
|
|
229
|
+
const response = await apiRequest.call(
|
|
230
|
+
this,
|
|
231
|
+
{
|
|
232
|
+
method: 'GET',
|
|
233
|
+
url: endpoint,
|
|
234
|
+
qs,
|
|
235
|
+
}
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
return rawResponse
|
|
239
|
+
? response
|
|
240
|
+
: response._embedded?.limeobjects || [];
|
|
241
|
+
}
|
|
242
|
+
}
|