@limetech/n8n-nodes-lime 0.2.0 → 0.2.1
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/nodes/lime-crm/LimeCrm.node.json +16 -16
- package/package.json +47 -47
- package/{dist/tsconfig.tsbuildinfo → tsconfig.tsbuildinfo} +1 -1
- package/.eslintrc.js +0 -58
- package/.github/copilot-instructions.md +0 -20
- package/.github/workflows/publish.yml +0 -34
- package/README.md +0 -79
- package/credentials/LimeCrmApi.credentials.ts +0 -57
- package/credentials/LimeGoApi.credentials.ts +0 -31
- package/dist/nodes/lime-crm/LimeCrm.node.json +0 -18
- package/dist/nodes/lime-crm/lime-crm.svg +0 -1
- package/dist/nodes/lime-go/lime-go.svg +0 -1
- package/dist/package.json +0 -49
- package/docker-compose.yml +0 -44
- package/index.js +0 -3
- package/nodes/lime-crm/GenericTypes.ts +0 -114
- package/nodes/lime-crm/LimeCrmNode.node.ts +0 -154
- package/nodes/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.ts +0 -461
- package/nodes/lime-crm/LimeCrmTrigger.node.ts +0 -505
- package/nodes/lime-crm/methods/getAllSortableFields.ts +0 -73
- package/nodes/lime-crm/methods/getLimeTypeProperties.ts +0 -48
- package/nodes/lime-crm/methods/getLimeTypeRelations.ts +0 -32
- package/nodes/lime-crm/methods/getLimeTypes.ts +0 -33
- package/nodes/lime-crm/methods/getRelatedTypeProperties.ts +0 -47
- package/nodes/lime-crm/methods/index.ts +0 -5
- package/nodes/lime-crm/resources/limeObject/commonFields.ts +0 -179
- package/nodes/lime-crm/resources/limeObject/index.ts +0 -64
- package/nodes/lime-crm/resources/limeObject/operations/common.operation.ts +0 -35
- package/nodes/lime-crm/resources/limeObject/operations/create.operation.ts +0 -234
- package/nodes/lime-crm/resources/limeObject/operations/delete.operation.ts +0 -136
- package/nodes/lime-crm/resources/limeObject/operations/get.operation.ts +0 -124
- package/nodes/lime-crm/resources/limeObject/operations/getAll.operation.ts +0 -242
- package/nodes/lime-crm/resources/limeObject/operations/search.operation.ts +0 -242
- package/nodes/lime-crm/resources/limeObject/operations/update.operation.ts +0 -201
- package/nodes/lime-crm/resources/limeType/index.ts +0 -66
- package/nodes/lime-crm/resources/limeType/operations/getProperties.operation.ts +0 -105
- package/nodes/lime-crm/resources/limeType/operations/getRelations.operation.ts +0 -105
- package/nodes/lime-crm/resources/limeType/operations/getType.operation.ts +0 -58
- package/nodes/lime-crm/resources/limeType/operations/listTypes.operation.ts +0 -76
- package/nodes/lime-crm/resources/queryApi/index.ts +0 -42
- package/nodes/lime-crm/resources/queryApi/operations/executeQuery.operation.ts +0 -605
- package/nodes/lime-crm/transport/index.ts +0 -74
- package/nodes/lime-go/LimeGo.node.ts +0 -146
- package/nodes/lime-go/actions/organization/get.operation.ts +0 -42
- package/nodes/lime-go/actions/organization/getByExternalKey.operation.ts +0 -57
- package/nodes/lime-go/actions/organization/index.ts +0 -69
- package/nodes/lime-go/actions/organization/organizationFields.ts +0 -160
- package/nodes/lime-go/actions/organization/search.operation.ts +0 -73
- package/nodes/lime-go/actions/organization/update.operation.ts +0 -140
- package/nodes/lime-go/actions/person/createMail.operation.ts +0 -140
- package/nodes/lime-go/actions/person/get.operation.ts +0 -51
- package/nodes/lime-go/actions/person/index.ts +0 -69
- package/nodes/lime-go/actions/person/personFields.ts +0 -132
- package/nodes/lime-go/actions/person/search.operation.ts +0 -88
- package/nodes/lime-go/actions/person/update.operation.ts +0 -122
- package/nodes/lime-go/transport/graphqlRequest.ts +0 -30
- package/tsconfig.json +0 -30
- /package/{dist/credentials → credentials}/LimeCrmApi.credentials.d.ts +0 -0
- /package/{dist/credentials → credentials}/LimeCrmApi.credentials.js +0 -0
- /package/{dist/credentials → credentials}/LimeCrmApi.credentials.js.map +0 -0
- /package/{dist/credentials → credentials}/LimeGoApi.credentials.d.ts +0 -0
- /package/{dist/credentials → credentials}/LimeGoApi.credentials.js +0 -0
- /package/{dist/credentials → credentials}/LimeGoApi.credentials.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/GenericTypes.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/GenericTypes.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/GenericTypes.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/LimeCrmNode.node.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/LimeCrmNode.node.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/LimeCrmNode.node.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/LimeCrmTrigger/LimeCrmTrigger.node.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/LimeCrmTrigger.node.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/LimeCrmTrigger.node.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/LimeCrmTrigger.node.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getAllSortableFields.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getAllSortableFields.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getAllSortableFields.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypeProperties.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypeProperties.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypeProperties.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypeRelations.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypeRelations.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypeRelations.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypes.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypes.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getLimeTypes.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getRelatedTypeProperties.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getRelatedTypeProperties.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/getRelatedTypeProperties.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/index.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/index.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/methods/index.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/commonFields.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/commonFields.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/commonFields.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/index.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/index.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/index.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/common.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/common.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/common.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/create.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/create.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/create.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/delete.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/delete.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/delete.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/get.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/get.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/get.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/getAll.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/getAll.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/getAll.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/search.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/search.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/search.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/update.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/update.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeObject/operations/update.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/index.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/index.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/index.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getProperties.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getProperties.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getProperties.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getRelations.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getRelations.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getRelations.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getType.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getType.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/getType.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/listTypes.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/listTypes.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/limeType/operations/listTypes.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/queryApi/index.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/queryApi/index.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/queryApi/index.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/queryApi/operations/executeQuery.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/queryApi/operations/executeQuery.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/resources/queryApi/operations/executeQuery.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-crm/transport/index.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-crm/transport/index.js +0 -0
- /package/{dist/nodes → nodes}/lime-crm/transport/index.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/LimeGo.node.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/LimeGo.node.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/LimeGo.node.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/get.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/get.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/get.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/getByExternalKey.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/getByExternalKey.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/getByExternalKey.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/index.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/index.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/index.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/organizationFields.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/organizationFields.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/organizationFields.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/search.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/search.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/search.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/update.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/update.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/organization/update.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/createMail.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/createMail.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/createMail.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/get.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/get.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/get.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/index.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/index.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/index.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/personFields.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/personFields.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/personFields.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/search.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/search.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/search.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/update.operation.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/update.operation.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/actions/person/update.operation.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/transport/graphqlRequest.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/transport/graphqlRequest.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/transport/graphqlRequest.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/transport/transport.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/transport/transport.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/transport/transport.js.map +0 -0
- /package/{dist/nodes → nodes}/lime-go/triggers/webhook.d.ts +0 -0
- /package/{dist/nodes → nodes}/lime-go/triggers/webhook.js +0 -0
- /package/{dist/nodes → nodes}/lime-go/triggers/webhook.js.map +0 -0
|
@@ -1,136 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,124 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,242 +0,0 @@
|
|
|
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
|
-
}
|