n8n-nodes-base 1.48.0 → 1.49.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/dist/build.tsbuildinfo +1 -1
- package/dist/credentials/CopperApi.credentials.d.ts +3 -1
- package/dist/credentials/CopperApi.credentials.js +16 -0
- package/dist/credentials/CopperApi.credentials.js.map +1 -1
- package/dist/methods/defined.json +4 -0
- package/dist/methods/referenced.json +4 -0
- package/dist/nodes/Cal/GenericFunctions.js +0 -2
- package/dist/nodes/Cal/GenericFunctions.js.map +1 -1
- package/dist/nodes/Coda/Coda.node.js +0 -4
- package/dist/nodes/Coda/Coda.node.js.map +1 -1
- package/dist/nodes/Copper/GenericFunctions.js +2 -6
- package/dist/nodes/Copper/GenericFunctions.js.map +1 -1
- package/dist/nodes/EmailReadImap/v2/EmailReadImapV2.node.js +1 -0
- package/dist/nodes/EmailReadImap/v2/EmailReadImapV2.node.js.map +1 -1
- package/dist/nodes/ExecuteWorkflow/ExecuteWorkflow.node.js +5 -1
- package/dist/nodes/ExecuteWorkflow/ExecuteWorkflow.node.js.map +1 -1
- package/dist/nodes/GetResponse/GetResponse.node.js +5 -0
- package/dist/nodes/GetResponse/GetResponse.node.js.map +1 -1
- package/dist/nodes/Github/Github.node.js +59 -35
- package/dist/nodes/Github/Github.node.js.map +1 -1
- package/dist/nodes/Google/Drive/v2/transport/index.js +0 -2
- package/dist/nodes/Google/Drive/v2/transport/index.js.map +1 -1
- package/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js +9 -1
- package/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js.map +1 -1
- package/dist/nodes/LinkedIn/LinkedIn.node.js +1 -1
- package/dist/nodes/LinkedIn/LinkedIn.node.js.map +1 -1
- package/dist/nodes/Merge/Merge.node.js +3 -1
- package/dist/nodes/Merge/Merge.node.js.map +1 -1
- package/dist/nodes/Merge/v2/MergeV2.node.js +21 -21
- package/dist/nodes/Merge/v2/MergeV2.node.js.map +1 -1
- package/dist/nodes/Merge/v2/{OptionsDescription.js → descriptions.js} +1 -1
- package/dist/nodes/Merge/v2/descriptions.js.map +1 -0
- package/dist/nodes/Merge/v2/interfaces.d.ts +18 -0
- package/dist/nodes/Merge/v2/interfaces.js +3 -0
- package/dist/nodes/Merge/v2/interfaces.js.map +1 -0
- package/dist/nodes/Merge/v2/{GenericFunctions.d.ts → utils.d.ts} +1 -17
- package/dist/nodes/Merge/v2/{GenericFunctions.js → utils.js} +1 -1
- package/dist/nodes/Merge/v2/utils.js.map +1 -0
- package/dist/nodes/Merge/v3/MergeV3.node.d.ts +10 -0
- package/dist/nodes/Merge/v3/MergeV3.node.js +22 -0
- package/dist/nodes/Merge/v3/MergeV3.node.js.map +1 -0
- package/dist/nodes/Merge/v3/actions/mode/append.d.ts +26 -0
- package/dist/nodes/Merge/v3/actions/mode/append.js +21 -0
- package/dist/nodes/Merge/v3/actions/mode/append.js.map +1 -0
- package/dist/nodes/Merge/v3/actions/mode/chooseBranch.d.ts +26 -0
- package/dist/nodes/Merge/v3/actions/mode/chooseBranch.js +96 -0
- package/dist/nodes/Merge/v3/actions/mode/chooseBranch.js.map +1 -0
- package/dist/nodes/Merge/v3/actions/mode/combineAll.d.ts +26 -0
- package/dist/nodes/Merge/v3/actions/mode/combineAll.js +62 -0
- package/dist/nodes/Merge/v3/actions/mode/combineAll.js.map +1 -0
- package/dist/nodes/Merge/v3/actions/mode/combineByFields.d.ts +26 -0
- package/dist/nodes/Merge/v3/actions/mode/combineByFields.js +356 -0
- package/dist/nodes/Merge/v3/actions/mode/combineByFields.js.map +1 -0
- package/dist/nodes/Merge/v3/actions/mode/combineByPosition.d.ts +26 -0
- package/dist/nodes/Merge/v3/actions/mode/combineByPosition.js +93 -0
- package/dist/nodes/Merge/v3/actions/mode/combineByPosition.js.map +1 -0
- package/dist/nodes/Merge/v3/actions/mode/combineBySql.d.ts +26 -0
- package/dist/nodes/Merge/v3/actions/mode/combineBySql.js +118 -0
- package/dist/nodes/Merge/v3/actions/mode/combineBySql.js.map +1 -0
- package/dist/nodes/Merge/v3/actions/mode/index.d.ts +9 -0
- package/dist/nodes/Merge/v3/actions/mode/index.js +105 -0
- package/dist/nodes/Merge/v3/actions/mode/index.js.map +1 -0
- package/dist/nodes/Merge/v3/actions/node.type.d.ts +1 -0
- package/dist/nodes/Merge/v3/actions/node.type.js +3 -0
- package/dist/nodes/Merge/v3/actions/node.type.js.map +1 -0
- package/dist/nodes/Merge/v3/actions/router.d.ts +2 -0
- package/dist/nodes/Merge/v3/actions/router.js +45 -0
- package/dist/nodes/Merge/v3/actions/router.js.map +1 -0
- package/dist/nodes/Merge/v3/actions/versionDescription.d.ts +2 -0
- package/dist/nodes/Merge/v3/actions/versionDescription.js +43 -0
- package/dist/nodes/Merge/v3/actions/versionDescription.js.map +1 -0
- package/dist/nodes/Merge/v3/helpers/descriptions.d.ts +4 -0
- package/dist/nodes/Merge/v3/helpers/descriptions.js +120 -0
- package/dist/nodes/Merge/v3/helpers/descriptions.js.map +1 -0
- package/dist/nodes/Merge/v3/helpers/interfaces.d.ts +18 -0
- package/dist/nodes/Merge/v3/helpers/interfaces.js +3 -0
- package/dist/nodes/Merge/v3/helpers/interfaces.js.map +1 -0
- package/dist/nodes/Merge/v3/helpers/utils.d.ts +42 -0
- package/dist/nodes/Merge/v3/helpers/utils.js +295 -0
- package/dist/nodes/Merge/v3/helpers/utils.js.map +1 -0
- package/dist/nodes/Merge/v3/methods/index.d.ts +1 -0
- package/dist/nodes/Merge/v3/methods/index.js +28 -0
- package/dist/nodes/Merge/v3/methods/index.js.map +1 -0
- package/dist/nodes/Merge/v3/methods/loadOptions.d.ts +3 -0
- package/dist/nodes/Merge/v3/methods/loadOptions.js +47 -0
- package/dist/nodes/Merge/v3/methods/loadOptions.js.map +1 -0
- package/dist/nodes/UProc/GenericFunctions.js +0 -2
- package/dist/nodes/UProc/GenericFunctions.js.map +1 -1
- package/dist/nodes/Zammad/descriptions/TicketDescription.js +27 -0
- package/dist/nodes/Zammad/descriptions/TicketDescription.js.map +1 -1
- package/dist/nodes/Zammad/types.d.ts +2 -0
- package/dist/types/credentials.json +1 -1
- package/dist/types/nodes.json +8 -7
- package/package.json +4 -3
- package/dist/nodes/Merge/v2/GenericFunctions.js.map +0 -1
- package/dist/nodes/Merge/v2/OptionsDescription.js.map +0 -1
- /package/dist/nodes/Merge/v2/{OptionsDescription.d.ts → descriptions.d.ts} +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const properties: INodeProperties[];
|
|
3
|
+
export declare const description: {
|
|
4
|
+
displayOptions: import("n8n-workflow").IDisplayOptions;
|
|
5
|
+
displayName: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: import("n8n-workflow").NodePropertyTypes;
|
|
8
|
+
typeOptions?: import("n8n-workflow").INodePropertyTypeOptions;
|
|
9
|
+
default: import("n8n-workflow").NodeParameterValueType;
|
|
10
|
+
description?: string;
|
|
11
|
+
hint?: string;
|
|
12
|
+
options?: Array<import("n8n-workflow").INodePropertyOptions | INodeProperties | import("n8n-workflow").INodePropertyCollection>;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
isNodeSetting?: boolean;
|
|
15
|
+
noDataExpression?: boolean;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
routing?: import("n8n-workflow").INodePropertyRouting;
|
|
18
|
+
credentialTypes?: Array<"extends:oAuth2Api" | "extends:oAuth1Api" | "has:authenticate" | "has:genericAuth">;
|
|
19
|
+
extractValue?: import("n8n-workflow").INodePropertyValueExtractor;
|
|
20
|
+
modes?: import("n8n-workflow").INodePropertyMode[];
|
|
21
|
+
requiresDataPath?: "single" | "multiple";
|
|
22
|
+
doNotInherit?: boolean;
|
|
23
|
+
validateType?: import("n8n-workflow").FieldType;
|
|
24
|
+
ignoreValidationDuringExecution?: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
export declare function execute(this: IExecuteFunctions, inputsData: INodeExecutionData[][]): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.description = exports.properties = void 0;
|
|
4
|
+
exports.execute = execute;
|
|
5
|
+
const utilities_1 = require("../../../../../utils/utilities");
|
|
6
|
+
const descriptions_1 = require("../../helpers/descriptions");
|
|
7
|
+
const utils_1 = require("../../helpers/utils");
|
|
8
|
+
const multipleMatchesProperty = {
|
|
9
|
+
displayName: 'Multiple Matches',
|
|
10
|
+
name: 'multipleMatches',
|
|
11
|
+
type: 'options',
|
|
12
|
+
default: 'all',
|
|
13
|
+
options: [
|
|
14
|
+
{
|
|
15
|
+
name: 'Include All Matches',
|
|
16
|
+
value: 'all',
|
|
17
|
+
description: 'Output multiple items if there are multiple matches',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'Include First Match Only',
|
|
21
|
+
value: 'first',
|
|
22
|
+
description: 'Only ever output a single item per match',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
exports.properties = [
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Fields To Match Have Different Names',
|
|
29
|
+
name: 'advanced',
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
default: false,
|
|
32
|
+
description: 'Whether name(s) of field to match are different in input 1 and input 2',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Fields to Match',
|
|
36
|
+
name: 'fieldsToMatchString',
|
|
37
|
+
type: 'string',
|
|
38
|
+
placeholder: 'e.g. id, name',
|
|
39
|
+
default: '',
|
|
40
|
+
requiresDataPath: 'multiple',
|
|
41
|
+
description: 'Specify the fields to use for matching input items',
|
|
42
|
+
hint: 'Drag or type the input field name',
|
|
43
|
+
displayOptions: {
|
|
44
|
+
show: {
|
|
45
|
+
advanced: [false],
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Fields to Match',
|
|
51
|
+
name: 'mergeByFields',
|
|
52
|
+
type: 'fixedCollection',
|
|
53
|
+
placeholder: 'Add Fields to Match',
|
|
54
|
+
default: { values: [{ field1: '', field2: '' }] },
|
|
55
|
+
typeOptions: {
|
|
56
|
+
multipleValues: true,
|
|
57
|
+
},
|
|
58
|
+
description: 'Specify the fields to use for matching input items',
|
|
59
|
+
displayOptions: {
|
|
60
|
+
show: {
|
|
61
|
+
advanced: [true],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
options: [
|
|
65
|
+
{
|
|
66
|
+
displayName: 'Values',
|
|
67
|
+
name: 'values',
|
|
68
|
+
values: [
|
|
69
|
+
{
|
|
70
|
+
displayName: 'Input 1 Field',
|
|
71
|
+
name: 'field1',
|
|
72
|
+
type: 'string',
|
|
73
|
+
default: '',
|
|
74
|
+
placeholder: 'e.g. id',
|
|
75
|
+
hint: 'Drag or type the input field name',
|
|
76
|
+
requiresDataPath: 'single',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
displayName: 'Input 2 Field',
|
|
80
|
+
name: 'field2',
|
|
81
|
+
type: 'string',
|
|
82
|
+
default: '',
|
|
83
|
+
placeholder: 'e.g. id',
|
|
84
|
+
hint: 'Drag or type the input field name',
|
|
85
|
+
requiresDataPath: 'single',
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
displayName: 'Output Type',
|
|
93
|
+
name: 'joinMode',
|
|
94
|
+
type: 'options',
|
|
95
|
+
description: 'How to select the items to send to output',
|
|
96
|
+
options: [
|
|
97
|
+
{
|
|
98
|
+
name: 'Keep Matches',
|
|
99
|
+
value: 'keepMatches',
|
|
100
|
+
description: 'Items that match, merged together (inner join)',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'Keep Non-Matches',
|
|
104
|
+
value: 'keepNonMatches',
|
|
105
|
+
description: "Items that don't match",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'Keep Everything',
|
|
109
|
+
value: 'keepEverything',
|
|
110
|
+
description: "Items that match merged together, plus items that don't match (outer join)",
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'Enrich Input 1',
|
|
114
|
+
value: 'enrichInput1',
|
|
115
|
+
description: 'All of input 1, with data from input 2 added in (left join)',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: 'Enrich Input 2',
|
|
119
|
+
value: 'enrichInput2',
|
|
120
|
+
description: 'All of input 2, with data from input 1 added in (right join)',
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
default: 'keepMatches',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
displayName: 'Output Data From',
|
|
127
|
+
name: 'outputDataFrom',
|
|
128
|
+
type: 'options',
|
|
129
|
+
options: [
|
|
130
|
+
{
|
|
131
|
+
name: 'Both Inputs Merged Together',
|
|
132
|
+
value: 'both',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: 'Input 1',
|
|
136
|
+
value: 'input1',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'Input 2',
|
|
140
|
+
value: 'input2',
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
default: 'both',
|
|
144
|
+
displayOptions: {
|
|
145
|
+
show: {
|
|
146
|
+
joinMode: ['keepMatches'],
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
displayName: 'Output Data From',
|
|
152
|
+
name: 'outputDataFrom',
|
|
153
|
+
type: 'options',
|
|
154
|
+
options: [
|
|
155
|
+
{
|
|
156
|
+
name: 'Both Inputs Appended Together',
|
|
157
|
+
value: 'both',
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: 'Input 1',
|
|
161
|
+
value: 'input1',
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: 'Input 2',
|
|
165
|
+
value: 'input2',
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
default: 'both',
|
|
169
|
+
displayOptions: {
|
|
170
|
+
show: {
|
|
171
|
+
joinMode: ['keepNonMatches'],
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
displayName: 'Options',
|
|
177
|
+
name: 'options',
|
|
178
|
+
type: 'collection',
|
|
179
|
+
placeholder: 'Add Option',
|
|
180
|
+
default: {},
|
|
181
|
+
options: [
|
|
182
|
+
{
|
|
183
|
+
...descriptions_1.clashHandlingProperties,
|
|
184
|
+
displayOptions: {
|
|
185
|
+
hide: {
|
|
186
|
+
'/joinMode': ['keepMatches', 'keepNonMatches'],
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
...descriptions_1.clashHandlingProperties,
|
|
192
|
+
displayOptions: {
|
|
193
|
+
show: {
|
|
194
|
+
'/joinMode': ['keepMatches'],
|
|
195
|
+
'/outputDataFrom': ['both'],
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
displayName: 'Disable Dot Notation',
|
|
201
|
+
name: 'disableDotNotation',
|
|
202
|
+
type: 'boolean',
|
|
203
|
+
default: false,
|
|
204
|
+
description: 'Whether to disallow referencing child fields using `parent.child` in the field name',
|
|
205
|
+
},
|
|
206
|
+
descriptions_1.fuzzyCompareProperty,
|
|
207
|
+
{
|
|
208
|
+
...multipleMatchesProperty,
|
|
209
|
+
displayOptions: {
|
|
210
|
+
show: {
|
|
211
|
+
'/joinMode': ['keepMatches'],
|
|
212
|
+
'/outputDataFrom': ['both'],
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
...multipleMatchesProperty,
|
|
218
|
+
displayOptions: {
|
|
219
|
+
show: {
|
|
220
|
+
'/joinMode': ['enrichInput1', 'enrichInput2', 'keepEverything'],
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
},
|
|
226
|
+
];
|
|
227
|
+
const displayOptions = {
|
|
228
|
+
show: {
|
|
229
|
+
mode: ['combine'],
|
|
230
|
+
combineBy: ['combineByFields'],
|
|
231
|
+
},
|
|
232
|
+
};
|
|
233
|
+
exports.description = (0, utilities_1.updateDisplayOptions)(displayOptions, exports.properties);
|
|
234
|
+
async function execute(inputsData) {
|
|
235
|
+
const returnData = [];
|
|
236
|
+
const advanced = this.getNodeParameter('advanced', 0);
|
|
237
|
+
let matchFields;
|
|
238
|
+
if (advanced) {
|
|
239
|
+
matchFields = this.getNodeParameter('mergeByFields.values', 0, []);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
matchFields = this.getNodeParameter('fieldsToMatchString', 0, '')
|
|
243
|
+
.split(',')
|
|
244
|
+
.map((f) => {
|
|
245
|
+
const field = f.trim();
|
|
246
|
+
return { field1: field, field2: field };
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
matchFields = (0, utils_1.checkMatchFieldsInput)(matchFields);
|
|
250
|
+
const joinMode = this.getNodeParameter('joinMode', 0);
|
|
251
|
+
const outputDataFrom = this.getNodeParameter('outputDataFrom', 0, 'both');
|
|
252
|
+
const options = this.getNodeParameter('options', 0, {});
|
|
253
|
+
options.joinMode = joinMode;
|
|
254
|
+
options.outputDataFrom = outputDataFrom;
|
|
255
|
+
const nodeVersion = this.getNode().typeVersion;
|
|
256
|
+
let input1 = inputsData[0];
|
|
257
|
+
let input2 = inputsData[1];
|
|
258
|
+
if (nodeVersion < 2.1) {
|
|
259
|
+
input1 = (0, utils_1.checkInput)(this.getInputData(0), matchFields.map((pair) => pair.field1), options.disableDotNotation || false, 'Input 1');
|
|
260
|
+
if (!input1)
|
|
261
|
+
return returnData;
|
|
262
|
+
input2 = (0, utils_1.checkInput)(this.getInputData(1), matchFields.map((pair) => pair.field2), options.disableDotNotation || false, 'Input 2');
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
if (!input1)
|
|
266
|
+
return returnData;
|
|
267
|
+
}
|
|
268
|
+
if (input1.length === 0 || input2.length === 0) {
|
|
269
|
+
if (!input1.length && joinMode === 'keepNonMatches' && outputDataFrom === 'input1')
|
|
270
|
+
return returnData;
|
|
271
|
+
if (!input2.length && joinMode === 'keepNonMatches' && outputDataFrom === 'input2')
|
|
272
|
+
return returnData;
|
|
273
|
+
if (joinMode === 'keepMatches') {
|
|
274
|
+
return [];
|
|
275
|
+
}
|
|
276
|
+
else if (joinMode === 'enrichInput1' && input1.length === 0) {
|
|
277
|
+
return [];
|
|
278
|
+
}
|
|
279
|
+
else if (joinMode === 'enrichInput2' && input2.length === 0) {
|
|
280
|
+
return [];
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
return [...input1, ...input2];
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if (!input1)
|
|
287
|
+
return returnData;
|
|
288
|
+
if (!input2 || !matchFields.length) {
|
|
289
|
+
if (joinMode === 'keepMatches' ||
|
|
290
|
+
joinMode === 'keepEverything' ||
|
|
291
|
+
joinMode === 'enrichInput2') {
|
|
292
|
+
return returnData;
|
|
293
|
+
}
|
|
294
|
+
return input1;
|
|
295
|
+
}
|
|
296
|
+
const matches = (0, utils_1.findMatches)(input1, input2, matchFields, options);
|
|
297
|
+
if (joinMode === 'keepMatches' || joinMode === 'keepEverything') {
|
|
298
|
+
let output = [];
|
|
299
|
+
const clashResolveOptions = this.getNodeParameter('options.clashHandling.values', 0, {});
|
|
300
|
+
if (outputDataFrom === 'input1') {
|
|
301
|
+
output = matches.matched.map((match) => match.entry);
|
|
302
|
+
}
|
|
303
|
+
if (outputDataFrom === 'input2') {
|
|
304
|
+
output = matches.matched2;
|
|
305
|
+
}
|
|
306
|
+
if (outputDataFrom === 'both') {
|
|
307
|
+
output = (0, utils_1.mergeMatched)(matches.matched, clashResolveOptions);
|
|
308
|
+
}
|
|
309
|
+
if (joinMode === 'keepEverything') {
|
|
310
|
+
let unmatched1 = matches.unmatched1;
|
|
311
|
+
let unmatched2 = matches.unmatched2;
|
|
312
|
+
if (clashResolveOptions.resolveClash === 'addSuffix') {
|
|
313
|
+
unmatched1 = (0, utils_1.addSuffixToEntriesKeys)(unmatched1, '1');
|
|
314
|
+
unmatched2 = (0, utils_1.addSuffixToEntriesKeys)(unmatched2, '2');
|
|
315
|
+
}
|
|
316
|
+
output = [...output, ...unmatched1, ...unmatched2];
|
|
317
|
+
}
|
|
318
|
+
returnData.push(...output);
|
|
319
|
+
}
|
|
320
|
+
if (joinMode === 'keepNonMatches') {
|
|
321
|
+
if (outputDataFrom === 'input1') {
|
|
322
|
+
return matches.unmatched1;
|
|
323
|
+
}
|
|
324
|
+
if (outputDataFrom === 'input2') {
|
|
325
|
+
return matches.unmatched2;
|
|
326
|
+
}
|
|
327
|
+
if (outputDataFrom === 'both') {
|
|
328
|
+
let output = [];
|
|
329
|
+
output = output.concat((0, utils_1.addSourceField)(matches.unmatched1, 'input1'));
|
|
330
|
+
output = output.concat((0, utils_1.addSourceField)(matches.unmatched2, 'input2'));
|
|
331
|
+
return output;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
if (joinMode === 'enrichInput1' || joinMode === 'enrichInput2') {
|
|
335
|
+
const clashResolveOptions = this.getNodeParameter('options.clashHandling.values', 0, {});
|
|
336
|
+
const mergedEntries = (0, utils_1.mergeMatched)(matches.matched, clashResolveOptions, joinMode);
|
|
337
|
+
if (joinMode === 'enrichInput1') {
|
|
338
|
+
if (clashResolveOptions.resolveClash === 'addSuffix') {
|
|
339
|
+
returnData.push(...mergedEntries, ...(0, utils_1.addSuffixToEntriesKeys)(matches.unmatched1, '1'));
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
returnData.push(...mergedEntries, ...matches.unmatched1);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
else {
|
|
346
|
+
if (clashResolveOptions.resolveClash === 'addSuffix') {
|
|
347
|
+
returnData.push(...mergedEntries, ...(0, utils_1.addSuffixToEntriesKeys)(matches.unmatched2, '2'));
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
returnData.push(...mergedEntries, ...matches.unmatched2);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return returnData;
|
|
355
|
+
}
|
|
356
|
+
//# sourceMappingURL=combineByFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combineByFields.js","sourceRoot":"","sources":["../../../../../../nodes/Merge/v3/actions/mode/combineByFields.ts"],"names":[],"mappings":";;;AAoQA,0BA+JC;AA5ZD,gDAAwD;AAQxD,6DAA2F;AAC3F,+CAO6B;AAE7B,MAAM,uBAAuB,GAAoB;IAChD,WAAW,EAAE,kBAAkB;IAC/B,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,KAAK;IACd,OAAO,EAAE;QACR;YACC,IAAI,EAAE,qBAAqB;YAC3B,KAAK,EAAE,KAAK;YACZ,WAAW,EAAE,qDAAqD;SAClE;QACD;YACC,IAAI,EAAE,0BAA0B;YAChC,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,0CAA0C;SACvD;KACD;CACD,CAAC;AAEW,QAAA,UAAU,GAAsB;IAC5C;QACC,WAAW,EAAE,sCAAsC;QACnD,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,wEAAwE;KACrF;IACD;QACC,WAAW,EAAE,iBAAiB;QAC9B,IAAI,EAAE,qBAAqB;QAC3B,IAAI,EAAE,QAAQ;QAEd,WAAW,EAAE,eAAe;QAC5B,OAAO,EAAE,EAAE;QACX,gBAAgB,EAAE,UAAU;QAC5B,WAAW,EAAE,oDAAoD;QACjE,IAAI,EAAE,mCAAmC;QACzC,cAAc,EAAE;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C;iBAAM,CAAC;gBACP,UAAU,CAAC,IAAI,CAAC,GAAG,aAAa,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;YAC1D,CAAC;QACF,CAAC;aAAM,CAAC;YACP,IAAI,mBAAmB,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;gBACtD,UAAU,CAAC,IAAI,CAAC,GAAG,aAAa,EAAE,GAAG,IAAA,8BAAsB,EAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;YACvF,CAAC;iBAAM,CAAC;gBACP,UAAU,CAAC,IAAI,CAAC,GAAG,aAAa,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;YAC1D,CAAC;QACF,CAAC;IACF,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type IExecuteFunctions, type INodeExecutionData, type INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const properties: INodeProperties[];
|
|
3
|
+
export declare const description: {
|
|
4
|
+
displayOptions: import("n8n-workflow").IDisplayOptions;
|
|
5
|
+
displayName: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: import("n8n-workflow").NodePropertyTypes;
|
|
8
|
+
typeOptions?: import("n8n-workflow").INodePropertyTypeOptions;
|
|
9
|
+
default: import("n8n-workflow").NodeParameterValueType;
|
|
10
|
+
description?: string;
|
|
11
|
+
hint?: string;
|
|
12
|
+
options?: Array<import("n8n-workflow").INodePropertyOptions | INodeProperties | import("n8n-workflow").INodePropertyCollection>;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
isNodeSetting?: boolean;
|
|
15
|
+
noDataExpression?: boolean;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
routing?: import("n8n-workflow").INodePropertyRouting;
|
|
18
|
+
credentialTypes?: Array<"extends:oAuth2Api" | "extends:oAuth1Api" | "has:authenticate" | "has:genericAuth">;
|
|
19
|
+
extractValue?: import("n8n-workflow").INodePropertyValueExtractor;
|
|
20
|
+
modes?: import("n8n-workflow").INodePropertyMode[];
|
|
21
|
+
requiresDataPath?: "single" | "multiple";
|
|
22
|
+
doNotInherit?: boolean;
|
|
23
|
+
validateType?: import("n8n-workflow").FieldType;
|
|
24
|
+
ignoreValidationDuringExecution?: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
export declare function execute(this: IExecuteFunctions, inputsData: INodeExecutionData[][]): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.description = exports.properties = void 0;
|
|
7
|
+
exports.execute = execute;
|
|
8
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
9
|
+
const utilities_1 = require("../../../../../utils/utilities");
|
|
10
|
+
const descriptions_1 = require("../../helpers/descriptions");
|
|
11
|
+
const utils_1 = require("../../helpers/utils");
|
|
12
|
+
const merge_1 = __importDefault(require("lodash/merge"));
|
|
13
|
+
exports.properties = [
|
|
14
|
+
descriptions_1.numberInputsProperty,
|
|
15
|
+
{
|
|
16
|
+
displayName: 'Options',
|
|
17
|
+
name: 'options',
|
|
18
|
+
type: 'collection',
|
|
19
|
+
placeholder: 'Add Option',
|
|
20
|
+
default: {},
|
|
21
|
+
options: [
|
|
22
|
+
{
|
|
23
|
+
...descriptions_1.clashHandlingProperties,
|
|
24
|
+
default: { values: { resolveClash: 'addSuffix' } },
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Include Any Unpaired Items',
|
|
28
|
+
name: 'includeUnpaired',
|
|
29
|
+
type: 'boolean',
|
|
30
|
+
default: false,
|
|
31
|
+
description: 'Whether unpaired items should be included in the result when there are differing numbers of items among the inputs',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
const displayOptions = {
|
|
37
|
+
show: {
|
|
38
|
+
mode: ['combine'],
|
|
39
|
+
combineBy: ['combineByPosition'],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
exports.description = (0, utilities_1.updateDisplayOptions)(displayOptions, exports.properties);
|
|
43
|
+
async function execute(inputsData) {
|
|
44
|
+
var _a, _b, _c, _d;
|
|
45
|
+
const returnData = [];
|
|
46
|
+
const clashHandling = this.getNodeParameter('options.clashHandling.values', 0, {});
|
|
47
|
+
const includeUnpaired = this.getNodeParameter('options.includeUnpaired', 0, false);
|
|
48
|
+
let preferredInputIndex;
|
|
49
|
+
if ((_a = clashHandling === null || clashHandling === void 0 ? void 0 : clashHandling.resolveClash) === null || _a === void 0 ? void 0 : _a.includes('preferInput')) {
|
|
50
|
+
preferredInputIndex = Number(clashHandling.resolveClash.replace('preferInput', '')) - 1;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
preferredInputIndex = inputsData.length - 1;
|
|
54
|
+
}
|
|
55
|
+
const preferred = inputsData[preferredInputIndex];
|
|
56
|
+
if (clashHandling.resolveClash === 'addSuffix') {
|
|
57
|
+
for (const [inputIndex, input] of inputsData.entries()) {
|
|
58
|
+
inputsData[inputIndex] = (0, utils_1.addSuffixToEntriesKeys)(input, String(inputIndex + 1));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
let numEntries;
|
|
62
|
+
if (includeUnpaired) {
|
|
63
|
+
numEntries = Math.max(...inputsData.map((input) => input.length), preferred.length);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
numEntries = Math.min(...inputsData.map((input) => input.length), preferred.length);
|
|
67
|
+
if (numEntries === 0) {
|
|
68
|
+
return new n8n_workflow_1.NodeExecutionOutput([returnData], [
|
|
69
|
+
{
|
|
70
|
+
message: 'Consider enabling "Include Any Unpaired Items" in options or check your inputs',
|
|
71
|
+
},
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const mergeIntoSingleObject = (0, utils_1.selectMergeMethod)(clashHandling);
|
|
76
|
+
for (let i = 0; i < numEntries; i++) {
|
|
77
|
+
const preferredEntry = (_b = preferred[i]) !== null && _b !== void 0 ? _b : {};
|
|
78
|
+
const restEntries = inputsData.map((input) => { var _a; return (_a = input[i]) !== null && _a !== void 0 ? _a : {}; });
|
|
79
|
+
const json = {
|
|
80
|
+
...mergeIntoSingleObject({}, ...restEntries.map((entry) => { var _a; return (_a = entry.json) !== null && _a !== void 0 ? _a : {}; }), (_c = preferredEntry.json) !== null && _c !== void 0 ? _c : {}),
|
|
81
|
+
};
|
|
82
|
+
const binary = {
|
|
83
|
+
...(0, merge_1.default)({}, ...restEntries.map((entry) => { var _a; return (_a = entry.binary) !== null && _a !== void 0 ? _a : {}; }), (_d = preferredEntry.binary) !== null && _d !== void 0 ? _d : {}),
|
|
84
|
+
};
|
|
85
|
+
const pairedItem = [
|
|
86
|
+
...restEntries.map((entry) => entry.pairedItem).flat(),
|
|
87
|
+
preferredEntry.pairedItem,
|
|
88
|
+
].filter((item) => item !== undefined);
|
|
89
|
+
returnData.push({ json, binary, pairedItem });
|
|
90
|
+
}
|
|
91
|
+
return returnData;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=combineByPosition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combineByPosition.js","sourceRoot":"","sources":["../../../../../../nodes/Merge/v3/actions/mode/combineByPosition.ts"],"names":[],"mappings":";;;;;;AAkDA,0BA0EC;AA5HD,+CAMsB;AAEtB,gDAAwD;AAGxD,6DAA2F;AAC3F,+CAAgF;AAEhF,yDAAiC;AAEpB,QAAA,UAAU,GAAsB;IAC5C,mCAAoB;IACpB;QACC,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,EAAE;QACX,OAAO,EAAE;YACR;g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AG,CAAC,CAAC,KAAK,EAAE,EAAE,WAAC,OAAA,MAAA,KAAK,CAAC,IAAI,mCAAI,EAAE,CAAA,EAAA,CAAC,EAC/C,MAAA,cAAc,CAAC,IAAI,mCAAI,EAAE,CACzB;SACD,CAAC;QAEF,MAAM,MAAM,GAAG;YACd,GAAG,IAAA,eAAK,EAAC,EAAE,EAAE,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,WAAC,OAAA,MAAA,KAAK,CAAC,MAAM,mCAAI,EAAE,CAAA,EAAA,CAAC,EAAE,MAAA,cAAc,CAAC,MAAM,mCAAI,EAAE,CAAC;SAC5F,CAAC;QAEF,MAAM,UAAU,GAAG;YAClB,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAA6B,CAAC,CAAC,IAAI,EAAE;YACzE,cAAc,CAAC,UAA6B;SAC5C,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;QAEvC,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const properties: INodeProperties[];
|
|
3
|
+
export declare const description: {
|
|
4
|
+
displayOptions: import("n8n-workflow").IDisplayOptions;
|
|
5
|
+
displayName: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: import("n8n-workflow").NodePropertyTypes;
|
|
8
|
+
typeOptions?: import("n8n-workflow").INodePropertyTypeOptions;
|
|
9
|
+
default: import("n8n-workflow").NodeParameterValueType;
|
|
10
|
+
description?: string;
|
|
11
|
+
hint?: string;
|
|
12
|
+
options?: Array<import("n8n-workflow").INodePropertyOptions | INodeProperties | import("n8n-workflow").INodePropertyCollection>;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
isNodeSetting?: boolean;
|
|
15
|
+
noDataExpression?: boolean;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
routing?: import("n8n-workflow").INodePropertyRouting;
|
|
18
|
+
credentialTypes?: Array<"extends:oAuth2Api" | "extends:oAuth1Api" | "has:authenticate" | "has:genericAuth">;
|
|
19
|
+
extractValue?: import("n8n-workflow").INodePropertyValueExtractor;
|
|
20
|
+
modes?: import("n8n-workflow").INodePropertyMode[];
|
|
21
|
+
requiresDataPath?: "single" | "multiple";
|
|
22
|
+
doNotInherit?: boolean;
|
|
23
|
+
validateType?: import("n8n-workflow").FieldType;
|
|
24
|
+
ignoreValidationDuringExecution?: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
export declare function execute(this: IExecuteFunctions, inputsData: INodeExecutionData[][]): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.description = exports.properties = void 0;
|
|
7
|
+
exports.execute = execute;
|
|
8
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
9
|
+
const utilities_1 = require("../../../../../utils/utilities");
|
|
10
|
+
const descriptions_1 = require("../../helpers/descriptions");
|
|
11
|
+
const alasql_1 = __importDefault(require("alasql"));
|
|
12
|
+
exports.properties = [
|
|
13
|
+
descriptions_1.numberInputsProperty,
|
|
14
|
+
{
|
|
15
|
+
displayName: 'Query',
|
|
16
|
+
name: 'query',
|
|
17
|
+
type: 'string',
|
|
18
|
+
default: 'SELECT * FROM input1 LEFT JOIN input2 ON input1.name = input2.id',
|
|
19
|
+
noDataExpression: true,
|
|
20
|
+
description: 'Input data available as tables with corresponding number, e.g. input1, input2',
|
|
21
|
+
hint: 'Supports <a href="https://github.com/alasql/alasql/wiki/Supported-SQL-statements" target="_blank">most</a> of the SQL-99 language',
|
|
22
|
+
required: true,
|
|
23
|
+
typeOptions: {
|
|
24
|
+
rows: 5,
|
|
25
|
+
editor: 'sqlEditor',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
];
|
|
29
|
+
const displayOptions = {
|
|
30
|
+
show: {
|
|
31
|
+
mode: ['combineBySql'],
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
exports.description = (0, utilities_1.updateDisplayOptions)(displayOptions, exports.properties);
|
|
35
|
+
async function execute(inputsData) {
|
|
36
|
+
const nodeId = this.getNode().id;
|
|
37
|
+
const returnData = [];
|
|
38
|
+
const pairedItem = [];
|
|
39
|
+
const db = new alasql_1.default.Database(nodeId);
|
|
40
|
+
try {
|
|
41
|
+
for (let i = 0; i < inputsData.length; i++) {
|
|
42
|
+
const inputData = inputsData[i];
|
|
43
|
+
inputData.forEach((item, index) => {
|
|
44
|
+
if (item.pairedItem === undefined) {
|
|
45
|
+
item.pairedItem = index;
|
|
46
|
+
}
|
|
47
|
+
if (typeof item.pairedItem === 'number') {
|
|
48
|
+
pairedItem.push({
|
|
49
|
+
item: item.pairedItem,
|
|
50
|
+
input: i,
|
|
51
|
+
});
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (Array.isArray(item.pairedItem)) {
|
|
55
|
+
const pairedItems = item.pairedItem
|
|
56
|
+
.filter((p) => p !== undefined)
|
|
57
|
+
.map((p) => (typeof p === 'number' ? { item: p } : p))
|
|
58
|
+
.map((p) => {
|
|
59
|
+
return {
|
|
60
|
+
item: p.item,
|
|
61
|
+
input: i,
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
pairedItem.push(...pairedItems);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
pairedItem.push({
|
|
68
|
+
item: item.pairedItem.item,
|
|
69
|
+
input: i,
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
db.exec(`CREATE TABLE input${i + 1}`);
|
|
73
|
+
db.tables[`input${i + 1}`].data = inputData.map((entry) => entry.json);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, {
|
|
78
|
+
message: 'Issue while creating table from',
|
|
79
|
+
description: error.message,
|
|
80
|
+
itemIndex: 0,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
let query = this.getNodeParameter('query', 0);
|
|
85
|
+
for (const resolvable of (0, utilities_1.getResolvables)(query)) {
|
|
86
|
+
query = query.replace(resolvable, this.evaluateExpression(resolvable, 0));
|
|
87
|
+
}
|
|
88
|
+
const result = db.exec(query);
|
|
89
|
+
for (const item of result) {
|
|
90
|
+
if (Array.isArray(item)) {
|
|
91
|
+
returnData.push(...item.map((json) => ({ json, pairedItem })));
|
|
92
|
+
}
|
|
93
|
+
else if (typeof item === 'object') {
|
|
94
|
+
returnData.push({ json: item, pairedItem });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (!returnData.length) {
|
|
98
|
+
returnData.push({ json: { success: true }, pairedItem });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
let message = '';
|
|
103
|
+
if (typeof error === 'string') {
|
|
104
|
+
message = error;
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
message = error.message;
|
|
108
|
+
}
|
|
109
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, {
|
|
110
|
+
message: 'Issue while executing query',
|
|
111
|
+
description: message,
|
|
112
|
+
itemIndex: 0,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
delete alasql_1.default.databases[nodeId];
|
|
116
|
+
return returnData;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=combineBySql.js.map
|