@limetech/n8n-nodes-lime 2.7.0-dev.1 → 3.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/.devcontainer/devcontainer.json +44 -0
- package/.devcontainer/docker-compose.yml +27 -0
- package/.gitattributes +34 -0
- package/.nvmrc +1 -0
- package/CHANGELOG.md +17 -5
- package/README.md +40 -47
- package/credentials/index.ts +0 -1
- package/dist/credentials/index.d.ts +0 -1
- package/dist/credentials/index.js +0 -1
- package/dist/credentials/index.js.map +1 -1
- package/dist/nodes/index.d.ts +0 -1
- package/dist/nodes/index.js +0 -1
- package/dist/nodes/index.js.map +1 -1
- package/dist/nodes/lime-crm/LimeCrmNode.node.d.ts +1 -4
- package/dist/nodes/lime-crm/LimeCrmNode.node.js +0 -3
- package/dist/nodes/lime-crm/LimeCrmNode.node.js.map +1 -1
- package/dist/nodes/lime-crm/methods/getLimetypeProperties.d.ts +0 -2
- package/dist/nodes/lime-crm/methods/getLimetypeProperties.js +0 -43
- package/dist/nodes/lime-crm/methods/getLimetypeProperties.js.map +1 -1
- package/dist/nodes/lime-crm/methods/index.d.ts +2 -2
- package/dist/nodes/lime-crm/methods/index.js +1 -4
- package/dist/nodes/lime-crm/methods/index.js.map +1 -1
- package/dist/nodes/lime-crm/methods/resourceMapping.d.ts +0 -1
- package/dist/nodes/lime-crm/methods/resourceMapping.js +0 -46
- package/dist/nodes/lime-crm/methods/resourceMapping.js.map +1 -1
- package/dist/nodes/lime-crm/models/limetype.d.ts +0 -1
- package/dist/nodes/lime-crm/resources/data/index.d.ts +1 -1
- package/dist/nodes/lime-crm/resources/data/index.js +0 -20
- package/dist/nodes/lime-crm/resources/data/index.js.map +1 -1
- package/dist/nodes/lime-crm/resources/data/operations/index.d.ts +0 -4
- package/dist/nodes/lime-crm/resources/data/operations/index.js +1 -5
- package/dist/nodes/lime-crm/resources/data/operations/index.js.map +1 -1
- package/dist/nodes/lime-crm/transport/index.d.ts +0 -1
- package/dist/nodes/lime-crm/transport/index.js +1 -6
- package/dist/nodes/lime-crm/transport/index.js.map +1 -1
- package/dist/nodes/lime-crm/transport/limetypes.js +4 -15
- package/dist/nodes/lime-crm/transport/limetypes.js.map +1 -1
- package/dist/nodes/lime-forms/LimeFormsTrigger.node.js +3 -3
- package/dist/nodes/lime-forms/LimeFormsTrigger.node.js.map +1 -1
- package/dist/nodes/lime-forms/assets/lime-crm.svg +1 -0
- package/dist/package.json +5 -12
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/nodes/index.ts +0 -1
- package/nodes/lime-crm/LimeCrmNode.node.ts +0 -6
- package/nodes/lime-crm/methods/getLimetypeProperties.ts +0 -84
- package/nodes/lime-crm/methods/index.ts +0 -3
- package/nodes/lime-crm/methods/resourceMapping.ts +0 -76
- package/nodes/lime-crm/models/limetype.ts +0 -1
- package/nodes/lime-crm/resources/data/index.ts +1 -34
- package/nodes/lime-crm/resources/data/operations/index.ts +0 -17
- package/nodes/lime-crm/transport/index.ts +0 -8
- package/nodes/lime-crm/transport/limetypes.ts +8 -26
- package/nodes/lime-forms/LimeFormsTrigger.node.ts +3 -3
- package/nodes/lime-forms/assets/lime-crm.svg +1 -0
- package/package.json +6 -13
- package/credentials/FortnoxApi.credentials.ts +0 -61
- package/dist/credentials/FortnoxApi.credentials.d.ts +0 -9
- package/dist/credentials/FortnoxApi.credentials.js +0 -57
- package/dist/credentials/FortnoxApi.credentials.js.map +0 -1
- package/dist/nodes/fortnox/Fortnox.node.d.ts +0 -5
- package/dist/nodes/fortnox/Fortnox.node.js +0 -95
- package/dist/nodes/fortnox/Fortnox.node.js.map +0 -1
- package/dist/nodes/fortnox/Fortnox.node.json +0 -18
- package/dist/nodes/fortnox/FortnoxTrigger.node.d.ts +0 -5
- package/dist/nodes/fortnox/FortnoxTrigger.node.js +0 -155
- package/dist/nodes/fortnox/FortnoxTrigger.node.js.map +0 -1
- package/dist/nodes/fortnox/FortnoxTrigger.node.json +0 -18
- package/dist/nodes/fortnox/commons.d.ts +0 -25
- package/dist/nodes/fortnox/commons.js +0 -44
- package/dist/nodes/fortnox/commons.js.map +0 -1
- package/dist/nodes/fortnox/fortnoxLogo.svg +0 -15
- package/dist/nodes/fortnox/index.d.ts +0 -6
- package/dist/nodes/fortnox/index.js +0 -23
- package/dist/nodes/fortnox/index.js.map +0 -1
- package/dist/nodes/fortnox/model.d.ts +0 -20
- package/dist/nodes/fortnox/model.js +0 -3
- package/dist/nodes/fortnox/model.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/filterParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/customers/filterParameters.js +0 -31
- package/dist/nodes/fortnox/resources/customers/filterParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/index.d.ts +0 -7
- package/dist/nodes/fortnox/resources/customers/index.js +0 -85
- package/dist/nodes/fortnox/resources/customers/index.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/model.d.ts +0 -99
- package/dist/nodes/fortnox/resources/customers/model.js +0 -3
- package/dist/nodes/fortnox/resources/customers/model.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.js +0 -281
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.d.ts +0 -9
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js +0 -38
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.js +0 -38
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js +0 -68
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/index.d.ts +0 -5
- package/dist/nodes/fortnox/resources/customers/operations/index.js +0 -42
- package/dist/nodes/fortnox/resources/customers/operations/index.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.js +0 -261
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/sortParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/customers/sortParameters.js +0 -30
- package/dist/nodes/fortnox/resources/customers/sortParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/filterParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/invoice/filterParameters.js +0 -72
- package/dist/nodes/fortnox/resources/invoice/filterParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/index.d.ts +0 -7
- package/dist/nodes/fortnox/resources/invoice/index.js +0 -81
- package/dist/nodes/fortnox/resources/invoice/index.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js +0 -193
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/model.d.ts +0 -147
- package/dist/nodes/fortnox/resources/invoice/model.js +0 -3
- package/dist/nodes/fortnox/resources/invoice/model.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js +0 -64
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js +0 -37
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js +0 -92
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/index.d.ts +0 -4
- package/dist/nodes/fortnox/resources/invoice/operations/index.js +0 -41
- package/dist/nodes/fortnox/resources/invoice/operations/index.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js +0 -64
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js.map +0 -1
- package/dist/nodes/fortnox/transport/errorCodes.d.ts +0 -1
- package/dist/nodes/fortnox/transport/errorCodes.js +0 -50
- package/dist/nodes/fortnox/transport/errorCodes.js.map +0 -1
- package/dist/nodes/fortnox/transport/index.d.ts +0 -3
- package/dist/nodes/fortnox/transport/index.js +0 -76
- package/dist/nodes/fortnox/transport/index.js.map +0 -1
- package/dist/nodes/lime-crm/resources/data/operations/bulkImportCommons.d.ts +0 -5
- package/dist/nodes/lime-crm/resources/data/operations/bulkImportCommons.js +0 -230
- package/dist/nodes/lime-crm/resources/data/operations/bulkImportCommons.js.map +0 -1
- package/dist/nodes/lime-crm/resources/data/operations/createManyObjects.operation.d.ts +0 -9
- package/dist/nodes/lime-crm/resources/data/operations/createManyObjects.operation.js +0 -16
- package/dist/nodes/lime-crm/resources/data/operations/createManyObjects.operation.js.map +0 -1
- package/dist/nodes/lime-crm/resources/data/operations/createOrUpdateManyObjects.operation.d.ts +0 -9
- package/dist/nodes/lime-crm/resources/data/operations/createOrUpdateManyObjects.operation.js +0 -16
- package/dist/nodes/lime-crm/resources/data/operations/createOrUpdateManyObjects.operation.js.map +0 -1
- package/dist/nodes/lime-crm/resources/data/operations/deprecated-startBulkImport.operation.d.ts +0 -9
- package/dist/nodes/lime-crm/resources/data/operations/deprecated-startBulkImport.operation.js +0 -241
- package/dist/nodes/lime-crm/resources/data/operations/deprecated-startBulkImport.operation.js.map +0 -1
- package/dist/nodes/lime-crm/resources/data/operations/updateManyObjects.operation.d.ts +0 -9
- package/dist/nodes/lime-crm/resources/data/operations/updateManyObjects.operation.js +0 -16
- package/dist/nodes/lime-crm/resources/data/operations/updateManyObjects.operation.js.map +0 -1
- package/dist/nodes/lime-crm/transport/bulkimport.d.ts +0 -41
- package/dist/nodes/lime-crm/transport/bulkimport.js +0 -86
- package/dist/nodes/lime-crm/transport/bulkimport.js.map +0 -1
- package/dist/nodes/lime-forms/lime-forms.svg +0 -6
- package/docker-compose.yml +0 -0
- package/nodes/fortnox/Fortnox.node.json +0 -18
- package/nodes/fortnox/Fortnox.node.ts +0 -102
- package/nodes/fortnox/FortnoxTrigger.node.json +0 -18
- package/nodes/fortnox/FortnoxTrigger.node.ts +0 -196
- package/nodes/fortnox/commons.ts +0 -94
- package/nodes/fortnox/fortnoxLogo.svg +0 -15
- package/nodes/fortnox/index.ts +0 -6
- package/nodes/fortnox/model.ts +0 -25
- package/nodes/fortnox/resources/customers/filterParameters.ts +0 -47
- package/nodes/fortnox/resources/customers/index.ts +0 -53
- package/nodes/fortnox/resources/customers/model.ts +0 -107
- package/nodes/fortnox/resources/customers/operations/create.operation.ts +0 -307
- package/nodes/fortnox/resources/customers/operations/delete.operation.ts +0 -49
- package/nodes/fortnox/resources/customers/operations/get.operation.ts +0 -50
- package/nodes/fortnox/resources/customers/operations/getAll.operation.ts +0 -79
- package/nodes/fortnox/resources/customers/operations/index.ts +0 -5
- package/nodes/fortnox/resources/customers/operations/update.operation.ts +0 -288
- package/nodes/fortnox/resources/customers/sortParameters.ts +0 -32
- package/nodes/fortnox/resources/invoice/filterParameters.ts +0 -88
- package/nodes/fortnox/resources/invoice/index.ts +0 -49
- package/nodes/fortnox/resources/invoice/invoiceParameters.ts +0 -214
- package/nodes/fortnox/resources/invoice/model.ts +0 -156
- package/nodes/fortnox/resources/invoice/operations/create.operation.ts +0 -71
- package/nodes/fortnox/resources/invoice/operations/get.operation.ts +0 -50
- package/nodes/fortnox/resources/invoice/operations/getAll.operation.ts +0 -100
- package/nodes/fortnox/resources/invoice/operations/index.ts +0 -4
- package/nodes/fortnox/resources/invoice/operations/update.operation.ts +0 -79
- package/nodes/fortnox/transport/errorCodes.ts +0 -62
- package/nodes/fortnox/transport/index.ts +0 -106
- package/nodes/lime-crm/resources/data/operations/bulkImportCommons.ts +0 -323
- package/nodes/lime-crm/resources/data/operations/createManyObjects.operation.ts +0 -44
- package/nodes/lime-crm/resources/data/operations/createOrUpdateManyObjects.operation.ts +0 -44
- package/nodes/lime-crm/resources/data/operations/deprecated-startBulkImport.operation.ts +0 -364
- package/nodes/lime-crm/resources/data/operations/updateManyObjects.operation.ts +0 -44
- package/nodes/lime-crm/transport/bulkimport.ts +0 -271
- package/nodes/lime-forms/lime-forms.svg +0 -6
|
@@ -1,323 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IDataObject,
|
|
3
|
-
IExecuteFunctions,
|
|
4
|
-
INodeProperties,
|
|
5
|
-
LoggerProxy as Logger,
|
|
6
|
-
NodeOperationError,
|
|
7
|
-
} from 'n8n-workflow';
|
|
8
|
-
import { DATA_RESOURCE } from '../../../models';
|
|
9
|
-
import {
|
|
10
|
-
BulkImportJobPayload,
|
|
11
|
-
BulkImportMode,
|
|
12
|
-
BulkImportPayloadObject,
|
|
13
|
-
createBulkImportJob,
|
|
14
|
-
uploadBulkImportData,
|
|
15
|
-
waitForBulkImportJob,
|
|
16
|
-
} from '../../../transport/bulkimport';
|
|
17
|
-
import { parseResourceMapperFields } from '../../../methods';
|
|
18
|
-
|
|
19
|
-
export type BulkImportOperationName =
|
|
20
|
-
| 'createManyObjects'
|
|
21
|
-
| 'createOrUpdateManyObjects'
|
|
22
|
-
| 'updateManyObjects';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Generate common properties for bulk import operations.
|
|
26
|
-
* @param operationName - The operation value to show these properties for
|
|
27
|
-
* @param matchingPropertyRequired - Whether the matching property field is required (true for update/create_or_update, false for create)
|
|
28
|
-
*/
|
|
29
|
-
export function getBulkImportProperties(
|
|
30
|
-
operationName: BulkImportOperationName,
|
|
31
|
-
matchingPropertyRequired: boolean
|
|
32
|
-
): INodeProperties[] {
|
|
33
|
-
return [
|
|
34
|
-
{
|
|
35
|
-
displayName:
|
|
36
|
-
'<h1>Alpha</h1>' +
|
|
37
|
-
'This feature is in alpha and will eventually change and require manual fixes to this node.<br>' +
|
|
38
|
-
'<br>' +
|
|
39
|
-
'The package <b>limepkg-mbeku-bulk-import >=1.4.1,<2.0.</b> must be installed in the solution.<br>' +
|
|
40
|
-
'<br>' +
|
|
41
|
-
'⚠️ Skips business logic such as automations, custom lime objects, webhooks and sql-on-update.',
|
|
42
|
-
name: 'alphaNotice',
|
|
43
|
-
type: 'notice',
|
|
44
|
-
displayOptions: {
|
|
45
|
-
show: {
|
|
46
|
-
resource: [DATA_RESOURCE],
|
|
47
|
-
operation: [operationName],
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
default: '',
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
displayName: 'Limetype',
|
|
54
|
-
name: 'limetype',
|
|
55
|
-
type: 'options',
|
|
56
|
-
typeOptions: {
|
|
57
|
-
loadOptionsMethod: 'getLimetypes',
|
|
58
|
-
},
|
|
59
|
-
required: true,
|
|
60
|
-
default: '',
|
|
61
|
-
description: 'The type of object to import',
|
|
62
|
-
displayOptions: {
|
|
63
|
-
show: {
|
|
64
|
-
resource: [DATA_RESOURCE],
|
|
65
|
-
operation: [operationName],
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
displayName: 'Matching Property',
|
|
71
|
-
name: 'matchingProperty',
|
|
72
|
-
type: 'options',
|
|
73
|
-
typeOptions: {
|
|
74
|
-
loadOptionsMethod: 'getNoHasManyProperties',
|
|
75
|
-
loadOptionsDependsOn: ['limetype'],
|
|
76
|
-
},
|
|
77
|
-
required: matchingPropertyRequired,
|
|
78
|
-
default: '',
|
|
79
|
-
description: matchingPropertyRequired
|
|
80
|
-
? 'The property to use to match existing objects. Must be a unique property.'
|
|
81
|
-
: 'Optional: The property to use to match existing objects. If set, objects matching an existing record will be skipped.',
|
|
82
|
-
displayOptions: {
|
|
83
|
-
show: {
|
|
84
|
-
resource: [DATA_RESOURCE],
|
|
85
|
-
operation: [operationName],
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
displayName: 'Input Method',
|
|
91
|
-
name: 'inputMethod',
|
|
92
|
-
type: 'options',
|
|
93
|
-
options: [
|
|
94
|
-
{
|
|
95
|
-
name: 'Form Fields',
|
|
96
|
-
value: 'fields',
|
|
97
|
-
description: 'Define fields using the UI',
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: 'JSON',
|
|
101
|
-
value: 'json',
|
|
102
|
-
description: 'Define fields using JSON',
|
|
103
|
-
},
|
|
104
|
-
],
|
|
105
|
-
default: 'fields',
|
|
106
|
-
description: 'How to input the data',
|
|
107
|
-
displayOptions: {
|
|
108
|
-
show: {
|
|
109
|
-
resource: [DATA_RESOURCE],
|
|
110
|
-
operation: [operationName],
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
displayName: 'Object (JSON)',
|
|
116
|
-
name: 'objectJson',
|
|
117
|
-
type: 'json',
|
|
118
|
-
default: '{\n "name": "Company Name",\n "phone": "+987654321"\n}',
|
|
119
|
-
description:
|
|
120
|
-
'Object data in JSON format. Property names must match the Lime CRM field names.',
|
|
121
|
-
typeOptions: {
|
|
122
|
-
alwaysOpenEditWindow: true,
|
|
123
|
-
},
|
|
124
|
-
displayOptions: {
|
|
125
|
-
show: {
|
|
126
|
-
resource: [DATA_RESOURCE],
|
|
127
|
-
operation: [operationName],
|
|
128
|
-
inputMethod: ['json'],
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
displayName: 'Properties',
|
|
134
|
-
name: 'properties',
|
|
135
|
-
type: 'resourceMapper',
|
|
136
|
-
placeholder: 'Add Property',
|
|
137
|
-
typeOptions: {
|
|
138
|
-
resourceMapper: {
|
|
139
|
-
resourceMapperMethod: 'getCreateMappingColumns',
|
|
140
|
-
mode: 'add',
|
|
141
|
-
addAllFields: false,
|
|
142
|
-
supportAutoMap: false,
|
|
143
|
-
},
|
|
144
|
-
loadOptionsDependsOn: ['limetype'],
|
|
145
|
-
},
|
|
146
|
-
default: {
|
|
147
|
-
value: null,
|
|
148
|
-
},
|
|
149
|
-
displayOptions: {
|
|
150
|
-
show: {
|
|
151
|
-
resource: [DATA_RESOURCE],
|
|
152
|
-
operation: [operationName],
|
|
153
|
-
inputMethod: ['fields'],
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
displayName: 'Relation Lookups',
|
|
159
|
-
name: 'relationLookups',
|
|
160
|
-
type: 'resourceMapper',
|
|
161
|
-
placeholder: 'Add Relation Lookup',
|
|
162
|
-
description:
|
|
163
|
-
'For relation fields (belongsto/hasone), specify which property on the related object to use for matching.',
|
|
164
|
-
typeOptions: {
|
|
165
|
-
resourceMapper: {
|
|
166
|
-
resourceMapperMethod: 'getRelationLookupMappingColumns',
|
|
167
|
-
mode: 'add',
|
|
168
|
-
addAllFields: true,
|
|
169
|
-
supportAutoMap: false,
|
|
170
|
-
valuesLabel: 'Relation Lookups',
|
|
171
|
-
},
|
|
172
|
-
loadOptionsDependsOn: ['limetype'],
|
|
173
|
-
},
|
|
174
|
-
default: {
|
|
175
|
-
value: null,
|
|
176
|
-
},
|
|
177
|
-
displayOptions: {
|
|
178
|
-
show: {
|
|
179
|
-
resource: [DATA_RESOURCE],
|
|
180
|
-
operation: [operationName],
|
|
181
|
-
inputMethod: ['fields'],
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
},
|
|
185
|
-
];
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Extract properties to import from JSON input.
|
|
190
|
-
* @param jsonData
|
|
191
|
-
*/
|
|
192
|
-
function getPropertiesFromJson(jsonData: string): string[] {
|
|
193
|
-
const parsed = JSON.parse(jsonData);
|
|
194
|
-
return Object.keys(parsed);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* Execute a bulk import operation for Lime CRM.
|
|
199
|
-
*
|
|
200
|
-
* @param context - The n8n execution context
|
|
201
|
-
* @param i - The index of the current item in the workflow execution
|
|
202
|
-
* @param mode - The bulk import mode: 'create', 'update', or 'create_or_update'
|
|
203
|
-
*
|
|
204
|
-
* @returns The bulk import job status and summary
|
|
205
|
-
*/
|
|
206
|
-
export async function executeBulkImport(
|
|
207
|
-
context: IExecuteFunctions,
|
|
208
|
-
i: number,
|
|
209
|
-
mode: BulkImportMode
|
|
210
|
-
): Promise<IDataObject | undefined> {
|
|
211
|
-
if (i > 0) {
|
|
212
|
-
return undefined;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
const limetype = context.getNodeParameter('limetype', i) as string;
|
|
216
|
-
const inputMethod = context.getNodeParameter('inputMethod', i) as string;
|
|
217
|
-
const items = context.getInputData();
|
|
218
|
-
|
|
219
|
-
// Matching property is always available but optional for create mode
|
|
220
|
-
const matchingProperty = context.getNodeParameter(
|
|
221
|
-
'matchingProperty',
|
|
222
|
-
i,
|
|
223
|
-
''
|
|
224
|
-
) as string;
|
|
225
|
-
|
|
226
|
-
Logger.info(
|
|
227
|
-
`Preparing bulk import (${mode}) of ${items.length} objects for limetype: ${limetype}`
|
|
228
|
-
);
|
|
229
|
-
|
|
230
|
-
// Step 1: Compute the properties to import based on the first item
|
|
231
|
-
let propertiesToImport: string[];
|
|
232
|
-
if (inputMethod === 'json') {
|
|
233
|
-
propertiesToImport = getPropertiesFromJson(
|
|
234
|
-
context.getNodeParameter('objectJson', 0) as string
|
|
235
|
-
);
|
|
236
|
-
} else {
|
|
237
|
-
const firstItemData = parseResourceMapperFields(
|
|
238
|
-
context,
|
|
239
|
-
0,
|
|
240
|
-
'properties'
|
|
241
|
-
);
|
|
242
|
-
propertiesToImport = Object.keys(firstItemData);
|
|
243
|
-
|
|
244
|
-
// Apply relation lookups: replace property names with lookup paths (e.g., 'coworker' -> 'coworker.email')
|
|
245
|
-
// The relationLookups is a resource mapper where keys are relation property names
|
|
246
|
-
// and values are the lookup property names on the related limetype
|
|
247
|
-
const relationLookupsData = parseResourceMapperFields(
|
|
248
|
-
context,
|
|
249
|
-
0,
|
|
250
|
-
'relationLookups'
|
|
251
|
-
);
|
|
252
|
-
|
|
253
|
-
const lookupMap = new Map<string, string>();
|
|
254
|
-
for (const [relationProp, lookupProp] of Object.entries(
|
|
255
|
-
relationLookupsData
|
|
256
|
-
)) {
|
|
257
|
-
if (lookupProp && typeof lookupProp === 'string') {
|
|
258
|
-
lookupMap.set(relationProp, `${relationProp}.${lookupProp}`);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
propertiesToImport = propertiesToImport.map(
|
|
263
|
-
(prop) => lookupMap.get(prop) || prop
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
Logger.info(`Properties to import: ${propertiesToImport.join(', ')}`);
|
|
268
|
-
|
|
269
|
-
// Step 2: Prepare the body for all items
|
|
270
|
-
const body: BulkImportPayloadObject[] = items.map((_, idx) => {
|
|
271
|
-
if (inputMethod === 'json') {
|
|
272
|
-
return JSON.parse(
|
|
273
|
-
context.getNodeParameter('objectJson', idx) as string
|
|
274
|
-
);
|
|
275
|
-
}
|
|
276
|
-
const data = parseResourceMapperFields(context, idx, 'properties');
|
|
277
|
-
return { values: data };
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
// Step 3: Create the bulk import job
|
|
281
|
-
const jobPayload: BulkImportJobPayload = {
|
|
282
|
-
mode,
|
|
283
|
-
limetype,
|
|
284
|
-
...(matchingProperty && { matchingProperty }),
|
|
285
|
-
properties: propertiesToImport,
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
const jobResponse = await createBulkImportJob(context, jobPayload);
|
|
289
|
-
const jobId = jobResponse.id;
|
|
290
|
-
|
|
291
|
-
// Step 4: Upload the data file
|
|
292
|
-
await uploadBulkImportData(context, jobId, body);
|
|
293
|
-
|
|
294
|
-
// Step 5: Poll for completion
|
|
295
|
-
const finalStatus = await waitForBulkImportJob(context, jobId, 2500);
|
|
296
|
-
|
|
297
|
-
if (finalStatus.status === 'failed') {
|
|
298
|
-
throw new NodeOperationError(
|
|
299
|
-
context.getNode(),
|
|
300
|
-
'The bulk import job failed',
|
|
301
|
-
{
|
|
302
|
-
message: 'The bulk import job failed due to a server error.',
|
|
303
|
-
description: `Bulk import job with ID ${jobId} has failed. Check the Lime CRM server for more details.`,
|
|
304
|
-
}
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// Step 6: Return the results summary
|
|
309
|
-
return {
|
|
310
|
-
jobId,
|
|
311
|
-
status: finalStatus.status,
|
|
312
|
-
startedAt: finalStatus.startedAt,
|
|
313
|
-
finishedAt: finalStatus.endedAt,
|
|
314
|
-
summary: finalStatus.result || {
|
|
315
|
-
total: 0,
|
|
316
|
-
created: 0,
|
|
317
|
-
updated: 0,
|
|
318
|
-
skipped: 0,
|
|
319
|
-
failed: 0,
|
|
320
|
-
},
|
|
321
|
-
taskId: finalStatus.extras?.task_id || finalStatus.extras?.taskId,
|
|
322
|
-
};
|
|
323
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
-
import {
|
|
3
|
-
getBulkImportProperties,
|
|
4
|
-
executeBulkImport,
|
|
5
|
-
} from './bulkImportCommons';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Description and metadata for the "Create many objects" operation in Lime CRM.
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export const description = {
|
|
13
|
-
name: 'Create Many Objects (Alpha)',
|
|
14
|
-
value: 'createManyObjects',
|
|
15
|
-
description:
|
|
16
|
-
'Create multiple objects via bulk import. Skips business logic.',
|
|
17
|
-
action: 'Create many objects (alpha)',
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Node properties for the "Create many objects" operation.
|
|
22
|
-
*
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
export const properties: INodeProperties[] = getBulkImportProperties(
|
|
26
|
-
'createManyObjects',
|
|
27
|
-
false // Matching property is optional for create (can be used to skip duplicates)
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Execute the "Create many objects" operation for Lime CRM.
|
|
32
|
-
*
|
|
33
|
-
* @param i - The index of the current item in the workflow execution
|
|
34
|
-
*
|
|
35
|
-
* @returns The bulk import job status and summary
|
|
36
|
-
*
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
export async function execute(
|
|
40
|
-
this: IExecuteFunctions,
|
|
41
|
-
i: number
|
|
42
|
-
): Promise<IDataObject | undefined> {
|
|
43
|
-
return executeBulkImport(this, i, 'create');
|
|
44
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
-
import {
|
|
3
|
-
getBulkImportProperties,
|
|
4
|
-
executeBulkImport,
|
|
5
|
-
} from './bulkImportCommons';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Description and metadata for the "Create or update many objects" operation in Lime CRM.
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
export const description = {
|
|
13
|
-
name: 'Create or Update Many Objects (Alpha)',
|
|
14
|
-
value: 'createOrUpdateManyObjects',
|
|
15
|
-
description:
|
|
16
|
-
'Create or update multiple objects via bulk import. Skips business logic.',
|
|
17
|
-
action: 'Create or update many objects (alpha)',
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Node properties for the "Create or update many objects" operation.
|
|
22
|
-
*
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
export const properties: INodeProperties[] = getBulkImportProperties(
|
|
26
|
-
'createOrUpdateManyObjects',
|
|
27
|
-
true // Matching property needed for create_or_update
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Execute the "Create or update many objects" operation for Lime CRM.
|
|
32
|
-
*
|
|
33
|
-
* @param i - The index of the current item in the workflow execution
|
|
34
|
-
*
|
|
35
|
-
* @returns The bulk import job status and summary
|
|
36
|
-
*
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
export async function execute(
|
|
40
|
-
this: IExecuteFunctions,
|
|
41
|
-
i: number
|
|
42
|
-
): Promise<IDataObject | undefined> {
|
|
43
|
-
return executeBulkImport(this, i, 'create_or_update');
|
|
44
|
-
}
|