n8n-nodes-base 1.20.0 → 1.21.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/README.md +1 -1
- package/dist/build.tsbuildinfo +1 -1
- package/dist/known/nodes.json +24 -0
- package/dist/nodes/Airtable/v2/methods/listSearch.js +1 -1
- package/dist/nodes/Airtable/v2/methods/listSearch.js.map +1 -1
- package/dist/nodes/Airtable/v2/methods/loadOptions.js +2 -2
- package/dist/nodes/Airtable/v2/methods/loadOptions.js.map +1 -1
- package/dist/nodes/Airtable/v2/methods/resourceMapping.js +1 -1
- package/dist/nodes/Airtable/v2/methods/resourceMapping.js.map +1 -1
- package/dist/nodes/Code/Code.node.json +1 -1
- package/dist/nodes/CompareDatasets/CompareDatasets.node.json +1 -1
- package/dist/nodes/CompareDatasets/GenericFunctions.js +6 -5
- package/dist/nodes/CompareDatasets/GenericFunctions.js.map +1 -1
- package/dist/nodes/Crypto/Crypto.node.json +1 -1
- package/dist/nodes/DateTime/DateTime.node.json +1 -1
- package/dist/nodes/DateTime/V2/DateTimeV2.node.js +1 -0
- package/dist/nodes/DateTime/V2/DateTimeV2.node.js.map +1 -1
- package/dist/nodes/EmailReadImap/EmailReadImap.node.json +1 -1
- package/dist/nodes/EmailSend/EmailSend.node.json +0 -3
- package/dist/nodes/ErrorTrigger/ErrorTrigger.node.json +1 -1
- package/dist/nodes/ExecuteWorkflow/ExecuteWorkflow.node.json +1 -1
- package/dist/nodes/Facebook/FacebookTrigger.node.js +1 -1
- package/dist/nodes/Facebook/FacebookTrigger.node.js.map +1 -1
- package/dist/nodes/FacebookLeadAds/FacebookLeadAdsTrigger.node.js +1 -1
- package/dist/nodes/FacebookLeadAds/FacebookLeadAdsTrigger.node.js.map +1 -1
- package/dist/nodes/FileMaker/FileMaker.node.js +2 -0
- package/dist/nodes/FileMaker/FileMaker.node.js.map +1 -1
- package/dist/nodes/Filter/Filter.node.js +1 -1
- package/dist/nodes/Filter/Filter.node.js.map +1 -1
- package/dist/nodes/Filter/Filter.node.json +1 -1
- package/dist/nodes/Form/FormTrigger.node.d.ts +3 -4
- package/dist/nodes/Form/FormTrigger.node.js +9 -247
- package/dist/nodes/Form/FormTrigger.node.js.map +1 -1
- package/dist/nodes/Form/FormTrigger.node.json +1 -1
- package/dist/nodes/Form/common.descriptions.d.ts +18 -0
- package/dist/nodes/Form/common.descriptions.js +237 -0
- package/dist/nodes/Form/common.descriptions.js.map +1 -0
- package/dist/nodes/Form/interfaces.d.ts +2 -0
- package/dist/nodes/Form/utils.d.ts +11 -1
- package/dist/nodes/Form/utils.js +70 -2
- package/dist/nodes/Form/utils.js.map +1 -1
- package/dist/nodes/Form/v1/FormTriggerV1.node.d.ts +14 -0
- package/dist/nodes/Form/v1/FormTriggerV1.node.js +82 -0
- package/dist/nodes/Form/v1/FormTriggerV1.node.js.map +1 -0
- package/dist/nodes/Form/v2/FormTriggerV2.node.d.ts +14 -0
- package/dist/nodes/Form/v2/FormTriggerV2.node.js +84 -0
- package/dist/nodes/Form/v2/FormTriggerV2.node.js.map +1 -0
- package/dist/nodes/Github/GithubTrigger.node.js +2 -2
- package/dist/nodes/Github/GithubTrigger.node.js.map +1 -1
- package/dist/nodes/Google/Ads/CampaignDescription.js +2 -2
- package/dist/nodes/Google/Ads/GoogleAds.node.js +1 -1
- package/dist/nodes/Google/BigQuery/v2/actions/database/insert.operation.js +1 -1
- package/dist/nodes/Google/BigQuery/v2/actions/database/insert.operation.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/sheet/append.operation.js +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/sheet/append.operation.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/helpers/GoogleSheet.js +1 -1
- package/dist/nodes/Google/Sheet/v2/helpers/GoogleSheet.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/helpers/GoogleSheets.utils.js +1 -1
- package/dist/nodes/Google/Sheet/v2/helpers/GoogleSheets.utils.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/methods/listSearch.js +4 -1
- package/dist/nodes/Google/Sheet/v2/methods/listSearch.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/methods/resourceMapping.js +4 -1
- package/dist/nodes/Google/Sheet/v2/methods/resourceMapping.js.map +1 -1
- package/dist/nodes/Html/Html.node.json +1 -1
- package/dist/nodes/If/If.node.d.ts +3 -4
- package/dist/nodes/If/If.node.js +10 -406
- package/dist/nodes/If/If.node.js.map +1 -1
- package/dist/nodes/If/V1/IfV1.node.d.ts +6 -0
- package/dist/nodes/If/V1/IfV1.node.js +414 -0
- package/dist/nodes/If/V1/IfV1.node.js.map +1 -0
- package/dist/nodes/If/V2/IfV2.node.d.ts +6 -0
- package/dist/nodes/If/V2/IfV2.node.js +101 -0
- package/dist/nodes/If/V2/IfV2.node.js.map +1 -0
- package/dist/nodes/If/test/v2/IfV2.date-time.json +163 -0
- package/dist/nodes/If/test/v2/IfV2.number.json +165 -0
- package/dist/nodes/If/test/v2/IfV2.other.json +182 -0
- package/dist/nodes/If/test/v2/IfV2.string.json +178 -0
- package/dist/nodes/ItemLists/ItemLists.node.js +1 -0
- package/dist/nodes/ItemLists/ItemLists.node.js.map +1 -1
- package/dist/nodes/Kafka/Kafka.node.js +3 -1
- package/dist/nodes/Kafka/Kafka.node.js.map +1 -1
- package/dist/nodes/LocalFileTrigger/LocalFileTrigger.node.js +24 -1
- package/dist/nodes/LocalFileTrigger/LocalFileTrigger.node.js.map +1 -1
- package/dist/nodes/Markdown/Markdown.node.json +1 -1
- package/dist/nodes/Merge/Merge.node.json +1 -1
- package/dist/nodes/Merge/v2/MergeV2.node.js +1 -1
- package/dist/nodes/Merge/v2/MergeV2.node.js.map +1 -1
- package/dist/nodes/MySql/v2/actions/database/insert.operation.js +1 -1
- package/dist/nodes/MySql/v2/actions/database/update.operation.js +1 -1
- package/dist/nodes/MySql/v2/actions/database/upsert.operation.js +1 -1
- package/dist/nodes/N8n/N8n.node.json +1 -1
- package/dist/nodes/NocoDB/OperationDescription.js +1 -1
- package/dist/nodes/NocoDB/OperationDescription.js.map +1 -1
- package/dist/nodes/OpenAi/OpenAi.node.js +6 -0
- package/dist/nodes/OpenAi/OpenAi.node.js.map +1 -1
- package/dist/nodes/Postgres/PostgresTrigger.node.js +1 -1
- package/dist/nodes/Postgres/v2/actions/database/insert.operation.js +1 -1
- package/dist/nodes/Postgres/v2/actions/database/update.operation.js +1 -1
- package/dist/nodes/Postgres/v2/actions/database/upsert.operation.js +1 -1
- package/dist/nodes/Postgres/v2/helpers/utils.d.ts +2 -2
- package/dist/nodes/Postgres/v2/methods/resourceMapping.js +1 -1
- package/dist/nodes/Postgres/v2/methods/resourceMapping.js.map +1 -1
- package/dist/nodes/RenameKeys/RenameKeys.node.js +1 -1
- package/dist/nodes/RenameKeys/RenameKeys.node.js.map +1 -1
- package/dist/nodes/RespondToWebhook/RespondToWebhook.node.js +26 -2
- package/dist/nodes/RespondToWebhook/RespondToWebhook.node.js.map +1 -1
- package/dist/nodes/RespondToWebhook/RespondToWebhook.node.json +1 -1
- package/dist/nodes/RssFeedRead/RssFeedRead.node.json +0 -3
- package/dist/nodes/Schedule/ScheduleTrigger.node.json +1 -4
- package/dist/nodes/Set/v2/SetV2.node.js +1 -1
- package/dist/nodes/Slack/V2/GenericFunctions.js +2 -2
- package/dist/nodes/Slack/V2/GenericFunctions.js.map +1 -1
- package/dist/nodes/SseTrigger/SseTrigger.node.json +1 -1
- package/dist/nodes/StopAndError/StopAndError.node.json +1 -1
- package/dist/nodes/TheHive/GenericFunctions.js +1 -1
- package/dist/nodes/TheHive/GenericFunctions.js.map +1 -1
- package/dist/nodes/Transform/Aggregate/Aggregate.node.d.ts +5 -0
- package/dist/nodes/Transform/Aggregate/Aggregate.node.js +365 -0
- package/dist/nodes/Transform/Aggregate/Aggregate.node.js.map +1 -0
- package/dist/nodes/Transform/Aggregate/Aggregate.node.json +19 -0
- package/dist/nodes/Transform/Aggregate/aggregate.svg +14 -0
- package/dist/nodes/Transform/Aggregate/test/workflow.aggregate.json +207 -0
- package/dist/nodes/Transform/Aggregate/utils.d.ts +2 -0
- package/dist/nodes/Transform/Aggregate/utils.js +48 -0
- package/dist/nodes/Transform/Aggregate/utils.js.map +1 -0
- package/dist/nodes/Transform/Limit/Limit.node.d.ts +5 -0
- package/dist/nodes/Transform/Limit/Limit.node.js +68 -0
- package/dist/nodes/Transform/Limit/Limit.node.js.map +1 -0
- package/dist/nodes/Transform/Limit/Limit.node.json +19 -0
- package/dist/nodes/Transform/Limit/limit.svg +16 -0
- package/dist/nodes/Transform/Limit/test/workflow.limit.json +97 -0
- package/dist/nodes/Transform/RemoveDuplicates/RemoveDuplicates.node.d.ts +5 -0
- package/dist/nodes/Transform/RemoveDuplicates/RemoveDuplicates.node.js +221 -0
- package/dist/nodes/Transform/RemoveDuplicates/RemoveDuplicates.node.js.map +1 -0
- package/dist/nodes/Transform/RemoveDuplicates/RemoveDuplicates.node.json +29 -0
- package/dist/nodes/Transform/RemoveDuplicates/removeDuplicates.svg +15 -0
- package/dist/nodes/Transform/RemoveDuplicates/test/workflow.removeDuplicates.json +325 -0
- package/dist/nodes/Transform/RemoveDuplicates/utils.d.ts +3 -0
- package/dist/nodes/Transform/RemoveDuplicates/utils.js +37 -0
- package/dist/nodes/Transform/RemoveDuplicates/utils.js.map +1 -0
- package/dist/nodes/Transform/Sort/Sort.node.d.ts +5 -0
- package/dist/nodes/Transform/Sort/Sort.node.js +257 -0
- package/dist/nodes/Transform/Sort/Sort.node.js.map +1 -0
- package/dist/nodes/Transform/Sort/Sort.node.json +19 -0
- package/dist/nodes/Transform/Sort/sort.svg +6 -0
- package/dist/nodes/Transform/Sort/test/workflow.sort.json +213 -0
- package/dist/nodes/Transform/Sort/utils.d.ts +3 -0
- package/dist/nodes/Transform/Sort/utils.js +27 -0
- package/dist/nodes/Transform/Sort/utils.js.map +1 -0
- package/dist/nodes/Transform/SplitOut/SplitOut.node.d.ts +5 -0
- package/dist/nodes/Transform/SplitOut/SplitOut.node.js +223 -0
- package/dist/nodes/Transform/SplitOut/SplitOut.node.js.map +1 -0
- package/dist/nodes/Transform/SplitOut/SplitOut.node.json +19 -0
- package/dist/nodes/Transform/SplitOut/splitOut.svg +14 -0
- package/dist/nodes/Transform/SplitOut/test/workflow.splitOut.json +354 -0
- package/dist/nodes/Transform/SplitOut/test/workflow.splitOutObject.json +386 -0
- package/dist/nodes/Transform/Summarize/Summarize.node.d.ts +5 -0
- package/dist/nodes/Transform/Summarize/Summarize.node.js +311 -0
- package/dist/nodes/Transform/Summarize/Summarize.node.js.map +1 -0
- package/dist/nodes/Transform/Summarize/Summarize.node.json +32 -0
- package/dist/nodes/Transform/Summarize/summarize.svg +10 -0
- package/dist/nodes/Transform/Summarize/test/workflow.summarize.json +296 -0
- package/dist/nodes/Transform/Summarize/utils.d.ts +22 -0
- package/dist/nodes/Transform/Summarize/utils.js +206 -0
- package/dist/nodes/Transform/Summarize/utils.js.map +1 -0
- package/dist/nodes/Transform/utils/utils.d.ts +1 -0
- package/dist/nodes/Transform/utils/utils.js +18 -0
- package/dist/nodes/Transform/utils/utils.js.map +1 -0
- package/dist/nodes/Wait/Wait.node.d.ts +3 -2
- package/dist/nodes/Wait/Wait.node.js +199 -129
- package/dist/nodes/Wait/Wait.node.js.map +1 -1
- package/dist/nodes/Wait/Wait.node.json +1 -1
- package/dist/nodes/Webhook/Webhook.node.js +26 -10
- package/dist/nodes/Webhook/Webhook.node.js.map +1 -1
- package/dist/nodes/Webhook/Webhook.node.json +1 -1
- package/dist/nodes/Webhook/description.js +31 -2
- package/dist/nodes/Webhook/description.js.map +1 -1
- package/dist/types/nodes.json +74 -66
- package/package.json +10 -4
- /package/dist/nodes/If/test/{IF.boolean.json → v1/IF.boolean.json} +0 -0
- /package/dist/nodes/If/test/{IF.date-time.json → v1/IF.date-time.json} +0 -0
- /package/dist/nodes/If/test/{IF.number.json → v1/IF.number.json} +0 -0
- /package/dist/nodes/If/test/{IF.string.json → v1/IF.string.json} +0 -0
|
@@ -0,0 +1,221 @@
|
|
|
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.RemoveDuplicates = void 0;
|
|
7
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
8
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
9
|
+
const lt_1 = __importDefault(require("lodash/lt"));
|
|
10
|
+
const pick_1 = __importDefault(require("lodash/pick"));
|
|
11
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
12
|
+
const utils_1 = require("../utils/utils");
|
|
13
|
+
const utils_2 = require("./utils");
|
|
14
|
+
class RemoveDuplicates {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.description = {
|
|
17
|
+
displayName: 'Remove Duplicates',
|
|
18
|
+
name: 'removeDuplicates',
|
|
19
|
+
icon: 'file:removeDuplicates.svg',
|
|
20
|
+
group: ['transform'],
|
|
21
|
+
subtitle: '',
|
|
22
|
+
version: 1,
|
|
23
|
+
description: 'Delete items with matching field values',
|
|
24
|
+
defaults: {
|
|
25
|
+
name: 'Remove Duplicates',
|
|
26
|
+
},
|
|
27
|
+
inputs: ['main'],
|
|
28
|
+
outputs: ['main'],
|
|
29
|
+
properties: [
|
|
30
|
+
{
|
|
31
|
+
displayName: 'Compare',
|
|
32
|
+
name: 'compare',
|
|
33
|
+
type: 'options',
|
|
34
|
+
options: [
|
|
35
|
+
{
|
|
36
|
+
name: 'All Fields',
|
|
37
|
+
value: 'allFields',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'All Fields Except',
|
|
41
|
+
value: 'allFieldsExcept',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'Selected Fields',
|
|
45
|
+
value: 'selectedFields',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
default: 'allFields',
|
|
49
|
+
description: 'The fields of the input items to compare to see if they are the same',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
displayName: 'Fields To Exclude',
|
|
53
|
+
name: 'fieldsToExclude',
|
|
54
|
+
type: 'string',
|
|
55
|
+
placeholder: 'e.g. email, name',
|
|
56
|
+
requiresDataPath: 'multiple',
|
|
57
|
+
description: 'Fields in the input to exclude from the comparison',
|
|
58
|
+
default: '',
|
|
59
|
+
displayOptions: {
|
|
60
|
+
show: {
|
|
61
|
+
compare: ['allFieldsExcept'],
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
displayName: 'Fields To Compare',
|
|
67
|
+
name: 'fieldsToCompare',
|
|
68
|
+
type: 'string',
|
|
69
|
+
placeholder: 'e.g. email, name',
|
|
70
|
+
requiresDataPath: 'multiple',
|
|
71
|
+
description: 'Fields in the input to add to the comparison',
|
|
72
|
+
default: '',
|
|
73
|
+
displayOptions: {
|
|
74
|
+
show: {
|
|
75
|
+
compare: ['selectedFields'],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
displayName: 'Options',
|
|
81
|
+
name: 'options',
|
|
82
|
+
type: 'collection',
|
|
83
|
+
placeholder: 'Add Field',
|
|
84
|
+
default: {},
|
|
85
|
+
displayOptions: {
|
|
86
|
+
show: {
|
|
87
|
+
compare: ['allFieldsExcept', 'selectedFields'],
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
options: [
|
|
91
|
+
{
|
|
92
|
+
displayName: 'Disable Dot Notation',
|
|
93
|
+
name: 'disableDotNotation',
|
|
94
|
+
type: 'boolean',
|
|
95
|
+
default: false,
|
|
96
|
+
description: 'Whether to disallow referencing child fields using `parent.child` in the field name',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
displayName: 'Remove Other Fields',
|
|
100
|
+
name: 'removeOtherFields',
|
|
101
|
+
type: 'boolean',
|
|
102
|
+
default: false,
|
|
103
|
+
description: 'Whether to remove any fields that are not being compared. If disabled, will keep the values from the first of the duplicates.',
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
async execute() {
|
|
111
|
+
const items = this.getInputData();
|
|
112
|
+
const compare = this.getNodeParameter('compare', 0);
|
|
113
|
+
const disableDotNotation = this.getNodeParameter('options.disableDotNotation', 0, false);
|
|
114
|
+
const removeOtherFields = this.getNodeParameter('options.removeOtherFields', 0, false);
|
|
115
|
+
let keys = disableDotNotation
|
|
116
|
+
? Object.keys(items[0].json)
|
|
117
|
+
: Object.keys((0, utils_2.flattenKeys)(items[0].json));
|
|
118
|
+
for (const item of items) {
|
|
119
|
+
for (const key of disableDotNotation
|
|
120
|
+
? Object.keys(item.json)
|
|
121
|
+
: Object.keys((0, utils_2.flattenKeys)(item.json))) {
|
|
122
|
+
if (!keys.includes(key)) {
|
|
123
|
+
keys.push(key);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (compare === 'allFieldsExcept') {
|
|
128
|
+
const fieldsToExclude = (0, utils_1.prepareFieldsArray)(this.getNodeParameter('fieldsToExclude', 0, ''), 'Fields To Exclude');
|
|
129
|
+
if (!fieldsToExclude.length) {
|
|
130
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No fields specified. Please add a field to exclude from comparison');
|
|
131
|
+
}
|
|
132
|
+
if (!disableDotNotation) {
|
|
133
|
+
keys = Object.keys((0, utils_2.flattenKeys)(items[0].json));
|
|
134
|
+
}
|
|
135
|
+
keys = keys.filter((key) => !fieldsToExclude.includes(key));
|
|
136
|
+
}
|
|
137
|
+
if (compare === 'selectedFields') {
|
|
138
|
+
const fieldsToCompare = (0, utils_1.prepareFieldsArray)(this.getNodeParameter('fieldsToCompare', 0, ''), 'Fields To Compare');
|
|
139
|
+
if (!fieldsToCompare.length) {
|
|
140
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No fields specified. Please add a field to compare on');
|
|
141
|
+
}
|
|
142
|
+
if (!disableDotNotation) {
|
|
143
|
+
keys = Object.keys((0, utils_2.flattenKeys)(items[0].json));
|
|
144
|
+
}
|
|
145
|
+
keys = fieldsToCompare.map((key) => key.trim());
|
|
146
|
+
}
|
|
147
|
+
const newItems = items.map((item, index) => ({
|
|
148
|
+
json: { ...item.json, __INDEX: index },
|
|
149
|
+
pairedItem: { item: index },
|
|
150
|
+
}));
|
|
151
|
+
newItems.sort((a, b) => {
|
|
152
|
+
let result = 0;
|
|
153
|
+
for (const key of keys) {
|
|
154
|
+
let equal;
|
|
155
|
+
if (!disableDotNotation) {
|
|
156
|
+
equal = (0, isEqual_1.default)((0, get_1.default)(a.json, key), (0, get_1.default)(b.json, key));
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
equal = (0, isEqual_1.default)(a.json[key], b.json[key]);
|
|
160
|
+
}
|
|
161
|
+
if (!equal) {
|
|
162
|
+
let lessThan;
|
|
163
|
+
if (!disableDotNotation) {
|
|
164
|
+
lessThan = (0, lt_1.default)((0, get_1.default)(a.json, key), (0, get_1.default)(b.json, key));
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
lessThan = (0, lt_1.default)(a.json[key], b.json[key]);
|
|
168
|
+
}
|
|
169
|
+
result = lessThan ? -1 : 1;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return result;
|
|
174
|
+
});
|
|
175
|
+
for (const key of keys) {
|
|
176
|
+
let type = undefined;
|
|
177
|
+
for (const item of newItems) {
|
|
178
|
+
if (key === '') {
|
|
179
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Name of field to compare is blank');
|
|
180
|
+
}
|
|
181
|
+
const value = !disableDotNotation ? (0, get_1.default)(item.json, key) : item.json[key];
|
|
182
|
+
if (value === undefined && disableDotNotation && key.includes('.')) {
|
|
183
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `'${key}' field is missing from some input items`, {
|
|
184
|
+
description: "If you're trying to use a nested field, make sure you turn off 'disable dot notation' in the node options",
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
else if (value === undefined) {
|
|
188
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `'${key}' field is missing from some input items`);
|
|
189
|
+
}
|
|
190
|
+
if (type !== undefined && value !== undefined && type !== typeof value) {
|
|
191
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `'${key}' isn't always the same type`, {
|
|
192
|
+
description: 'The type of this field varies between items',
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
type = typeof value;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
const removedIndexes = [];
|
|
201
|
+
let temp = newItems[0];
|
|
202
|
+
for (let index = 1; index < newItems.length; index++) {
|
|
203
|
+
if ((0, utils_2.compareItems)(newItems[index], temp, keys, disableDotNotation, this.getNode())) {
|
|
204
|
+
removedIndexes.push(newItems[index].json.__INDEX);
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
temp = newItems[index];
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
let returnData = items.filter((_, index) => !removedIndexes.includes(index));
|
|
211
|
+
if (removeOtherFields) {
|
|
212
|
+
returnData = returnData.map((item, index) => ({
|
|
213
|
+
json: (0, pick_1.default)(item.json, ...keys),
|
|
214
|
+
pairedItem: { item: index },
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
return [returnData];
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
exports.RemoveDuplicates = RemoveDuplicates;
|
|
221
|
+
//# sourceMappingURL=RemoveDuplicates.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoveDuplicates.node.js","sourceRoot":"","sources":["../../../../nodes/Transform/RemoveDuplicates/Remo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AAI,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAE7E,IAAI,iBAAiB,EAAE,CAAC;YACvB,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;gBAC7C,IAAI,EAAE,IAAA,cAAI,EAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC;gBAC9B,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;aAC3B,CAAC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAvPD,4CAuPC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-base.removeDuplicates",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"details": "",
|
|
6
|
+
"categories": ["Core Nodes"],
|
|
7
|
+
"resources": {
|
|
8
|
+
"primaryDocumentation": [
|
|
9
|
+
{
|
|
10
|
+
"url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.removeduplicates/"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"generic": []
|
|
14
|
+
},
|
|
15
|
+
"alias": [
|
|
16
|
+
"Dedupe",
|
|
17
|
+
"Deduplicate",
|
|
18
|
+
"Duplicates",
|
|
19
|
+
"Remove",
|
|
20
|
+
"Unique",
|
|
21
|
+
"Transform",
|
|
22
|
+
"Array",
|
|
23
|
+
"List",
|
|
24
|
+
"Item"
|
|
25
|
+
],
|
|
26
|
+
"subcategories": {
|
|
27
|
+
"Core Nodes": ["Data Transformation"]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_1156_1098)">
|
|
3
|
+
<path d="M134.097 111H172.926V143.508H138.16V178.143H105.652V139.444C105.652 123.735 118.387 111 134.097 111Z" fill="#54B8C9"/>
|
|
4
|
+
<path d="M211.755 143.508V111H289.412V143.508H211.755Z" fill="#54B8C9"/>
|
|
5
|
+
<path d="M328.241 143.508V111H405.899V143.508H328.241Z" fill="#54B8C9"/>
|
|
6
|
+
<path d="M444.728 143.508V111H483.557C499.267 111 512.002 123.735 512.002 139.444V178.143H479.494V143.508H444.728Z" fill="#54B8C9"/>
|
|
7
|
+
<path d="M479.494 216.746H512.002V255.444C512.002 271.154 499.267 283.889 483.557 283.889H444.728V251.381H479.494V216.746Z" fill="#54B8C9"/>
|
|
8
|
+
<path d="M0 244.537C0 229.329 12.735 217 28.4444 217H377.905C393.614 217 406.349 229.329 406.349 244.537V374.352C406.349 389.56 393.614 401.889 377.905 401.889H28.4444C12.735 401.889 0 389.56 0 374.352V244.537Z" fill="#54B8C9"/>
|
|
9
|
+
</g>
|
|
10
|
+
<defs>
|
|
11
|
+
<clipPath id="clip0_1156_1098">
|
|
12
|
+
<rect width="512" height="512" fill="white"/>
|
|
13
|
+
</clipPath>
|
|
14
|
+
</defs>
|
|
15
|
+
</svg>
|
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Remove Duplicates",
|
|
3
|
+
"nodes": [
|
|
4
|
+
{
|
|
5
|
+
"parameters": {},
|
|
6
|
+
"id": "a4da10da-991f-48ab-b873-9d633a11311f",
|
|
7
|
+
"name": "When clicking \"Execute Workflow\"",
|
|
8
|
+
"type": "n8n-nodes-base.manualTrigger",
|
|
9
|
+
"typeVersion": 1,
|
|
10
|
+
"position": [
|
|
11
|
+
760,
|
|
12
|
+
420
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"parameters": {
|
|
17
|
+
"jsCode": "return [{ id: 1, name: 'John Doe', age: 18 },{ id: 1, name: 'John Doe', age: 18 },\n { id: 1, name: 'John Doe', age: 98 },\n { id: 3, name: 'Bob Johnson', age:34 }]"
|
|
18
|
+
},
|
|
19
|
+
"id": "7ab7d5cd-0b1e-48bc-bdbd-57c91e201cf3",
|
|
20
|
+
"name": "Code",
|
|
21
|
+
"type": "n8n-nodes-base.code",
|
|
22
|
+
"typeVersion": 2,
|
|
23
|
+
"position": [
|
|
24
|
+
980,
|
|
25
|
+
420
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"parameters": {},
|
|
30
|
+
"id": "c336939c-062e-475e-ba7c-8601e3662e8c",
|
|
31
|
+
"name": "Remove Duplicates (All Fields)",
|
|
32
|
+
"type": "n8n-nodes-base.removeDuplicates",
|
|
33
|
+
"typeVersion": 1,
|
|
34
|
+
"position": [
|
|
35
|
+
1200,
|
|
36
|
+
260
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"parameters": {
|
|
41
|
+
"compare": "selectedFields",
|
|
42
|
+
"fieldsToCompare": "name",
|
|
43
|
+
"options": {}
|
|
44
|
+
},
|
|
45
|
+
"id": "d4343ffe-8a9e-4e34-a0a1-aa463afedd80",
|
|
46
|
+
"name": "Remove Duplicates (Selected Fields)",
|
|
47
|
+
"type": "n8n-nodes-base.removeDuplicates",
|
|
48
|
+
"typeVersion": 1,
|
|
49
|
+
"position": [
|
|
50
|
+
1200,
|
|
51
|
+
420
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"parameters": {
|
|
56
|
+
"compare": "allFieldsExcept",
|
|
57
|
+
"fieldsToExclude": "age",
|
|
58
|
+
"options": {}
|
|
59
|
+
},
|
|
60
|
+
"id": "b67daea4-4545-429e-9e2a-58f2d6a7df7b",
|
|
61
|
+
"name": "Remove Duplicates (Except Fields)",
|
|
62
|
+
"type": "n8n-nodes-base.removeDuplicates",
|
|
63
|
+
"typeVersion": 1,
|
|
64
|
+
"position": [
|
|
65
|
+
1200,
|
|
66
|
+
580
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"parameters": {},
|
|
71
|
+
"id": "813e690f-a83e-4a38-a64a-c3d72afcc9ba",
|
|
72
|
+
"name": "All Fields",
|
|
73
|
+
"type": "n8n-nodes-base.noOp",
|
|
74
|
+
"typeVersion": 1,
|
|
75
|
+
"position": [
|
|
76
|
+
1380,
|
|
77
|
+
260
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"parameters": {},
|
|
82
|
+
"id": "b5c5c946-2e96-451b-b9a6-78e478504d6c",
|
|
83
|
+
"name": "Selected Fields",
|
|
84
|
+
"type": "n8n-nodes-base.noOp",
|
|
85
|
+
"typeVersion": 1,
|
|
86
|
+
"position": [
|
|
87
|
+
1380,
|
|
88
|
+
420
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"parameters": {},
|
|
93
|
+
"id": "afb92bc5-beba-4b0a-aefb-b47cc708a125",
|
|
94
|
+
"name": "Except Fields",
|
|
95
|
+
"type": "n8n-nodes-base.noOp",
|
|
96
|
+
"typeVersion": 1,
|
|
97
|
+
"position": [
|
|
98
|
+
1380,
|
|
99
|
+
580
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"parameters": {
|
|
104
|
+
"compare": "allFieldsExcept",
|
|
105
|
+
"fieldsToExclude": "age",
|
|
106
|
+
"options": {
|
|
107
|
+
"removeOtherFields": true
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"id": "f92c5533-ac29-476c-aebb-4849ddd22110",
|
|
111
|
+
"name": "Remove Duplicates (Remove)",
|
|
112
|
+
"type": "n8n-nodes-base.removeDuplicates",
|
|
113
|
+
"typeVersion": 1,
|
|
114
|
+
"position": [
|
|
115
|
+
1200,
|
|
116
|
+
760
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"parameters": {},
|
|
121
|
+
"id": "1e142ab7-b32e-4f67-b5cc-5c9fb63fba89",
|
|
122
|
+
"name": "Remove",
|
|
123
|
+
"type": "n8n-nodes-base.noOp",
|
|
124
|
+
"typeVersion": 1,
|
|
125
|
+
"position": [
|
|
126
|
+
1380,
|
|
127
|
+
760
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"pinData": {
|
|
132
|
+
"Code": [
|
|
133
|
+
{
|
|
134
|
+
"json": {
|
|
135
|
+
"id": 1,
|
|
136
|
+
"name": "John Doe",
|
|
137
|
+
"age": 18
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"json": {
|
|
142
|
+
"id": 1,
|
|
143
|
+
"name": "John Doe",
|
|
144
|
+
"age": 18
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"json": {
|
|
149
|
+
"id": 1,
|
|
150
|
+
"name": "John Doe",
|
|
151
|
+
"age": 98
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"json": {
|
|
156
|
+
"id": 3,
|
|
157
|
+
"name": "Bob Johnson",
|
|
158
|
+
"age": 34
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"All Fields": [
|
|
163
|
+
{
|
|
164
|
+
"json": {
|
|
165
|
+
"id": 1,
|
|
166
|
+
"name": "John Doe",
|
|
167
|
+
"age": 18
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"json": {
|
|
172
|
+
"id": 1,
|
|
173
|
+
"name": "John Doe",
|
|
174
|
+
"age": 98
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"json": {
|
|
179
|
+
"id": 3,
|
|
180
|
+
"name": "Bob Johnson",
|
|
181
|
+
"age": 34
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
"Selected Fields": [
|
|
186
|
+
{
|
|
187
|
+
"json": {
|
|
188
|
+
"id": 1,
|
|
189
|
+
"name": "John Doe",
|
|
190
|
+
"age": 18
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"json": {
|
|
195
|
+
"id": 3,
|
|
196
|
+
"name": "Bob Johnson",
|
|
197
|
+
"age": 34
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"Except Fields": [
|
|
202
|
+
{
|
|
203
|
+
"json": {
|
|
204
|
+
"id": 1,
|
|
205
|
+
"name": "John Doe",
|
|
206
|
+
"age": 18
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"json": {
|
|
211
|
+
"id": 3,
|
|
212
|
+
"name": "Bob Johnson",
|
|
213
|
+
"age": 34
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
],
|
|
217
|
+
"Remove": [
|
|
218
|
+
{
|
|
219
|
+
"json": {
|
|
220
|
+
"id": 1,
|
|
221
|
+
"name": "John Doe"
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
"json": {
|
|
226
|
+
"id": 3,
|
|
227
|
+
"name": "Bob Johnson"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
]
|
|
231
|
+
},
|
|
232
|
+
"connections": {
|
|
233
|
+
"When clicking \"Execute Workflow\"": {
|
|
234
|
+
"main": [
|
|
235
|
+
[
|
|
236
|
+
{
|
|
237
|
+
"node": "Code",
|
|
238
|
+
"type": "main",
|
|
239
|
+
"index": 0
|
|
240
|
+
}
|
|
241
|
+
]
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
"Code": {
|
|
245
|
+
"main": [
|
|
246
|
+
[
|
|
247
|
+
{
|
|
248
|
+
"node": "Remove Duplicates (All Fields)",
|
|
249
|
+
"type": "main",
|
|
250
|
+
"index": 0
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"node": "Remove Duplicates (Selected Fields)",
|
|
254
|
+
"type": "main",
|
|
255
|
+
"index": 0
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"node": "Remove Duplicates (Except Fields)",
|
|
259
|
+
"type": "main",
|
|
260
|
+
"index": 0
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"node": "Remove Duplicates (Remove)",
|
|
264
|
+
"type": "main",
|
|
265
|
+
"index": 0
|
|
266
|
+
}
|
|
267
|
+
]
|
|
268
|
+
]
|
|
269
|
+
},
|
|
270
|
+
"Remove Duplicates (All Fields)": {
|
|
271
|
+
"main": [
|
|
272
|
+
[
|
|
273
|
+
{
|
|
274
|
+
"node": "All Fields",
|
|
275
|
+
"type": "main",
|
|
276
|
+
"index": 0
|
|
277
|
+
}
|
|
278
|
+
]
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
"Remove Duplicates (Selected Fields)": {
|
|
282
|
+
"main": [
|
|
283
|
+
[
|
|
284
|
+
{
|
|
285
|
+
"node": "Selected Fields",
|
|
286
|
+
"type": "main",
|
|
287
|
+
"index": 0
|
|
288
|
+
}
|
|
289
|
+
]
|
|
290
|
+
]
|
|
291
|
+
},
|
|
292
|
+
"Remove Duplicates (Except Fields)": {
|
|
293
|
+
"main": [
|
|
294
|
+
[
|
|
295
|
+
{
|
|
296
|
+
"node": "Except Fields",
|
|
297
|
+
"type": "main",
|
|
298
|
+
"index": 0
|
|
299
|
+
}
|
|
300
|
+
]
|
|
301
|
+
]
|
|
302
|
+
},
|
|
303
|
+
"Remove Duplicates (Remove)": {
|
|
304
|
+
"main": [
|
|
305
|
+
[
|
|
306
|
+
{
|
|
307
|
+
"node": "Remove",
|
|
308
|
+
"type": "main",
|
|
309
|
+
"index": 0
|
|
310
|
+
}
|
|
311
|
+
]
|
|
312
|
+
]
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
"active": false,
|
|
316
|
+
"settings": {
|
|
317
|
+
"executionOrder": "v1"
|
|
318
|
+
},
|
|
319
|
+
"versionId": "5bb09766-4c67-4fb4-ae53-89d8db4727e3",
|
|
320
|
+
"id": "74gMYOHjjPArZg4q",
|
|
321
|
+
"meta": {
|
|
322
|
+
"instanceId": "27cc9b56542ad45b38725555722c50a1c3fee1670bbb67980558314ee08517c4"
|
|
323
|
+
},
|
|
324
|
+
"tags": []
|
|
325
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IDataObject, INode, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
export declare const compareItems: (obj: INodeExecutionData, obj2: INodeExecutionData, keys: string[], disableDotNotation: boolean, _node: INode) => boolean;
|
|
3
|
+
export declare const flattenKeys: (obj: IDataObject, path?: string[]) => IDataObject;
|
|
@@ -0,0 +1,37 @@
|
|
|
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.flattenKeys = exports.compareItems = void 0;
|
|
7
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
8
|
+
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
9
|
+
const isObject_1 = __importDefault(require("lodash/isObject"));
|
|
10
|
+
const merge_1 = __importDefault(require("lodash/merge"));
|
|
11
|
+
const reduce_1 = __importDefault(require("lodash/reduce"));
|
|
12
|
+
const compareItems = (obj, obj2, keys, disableDotNotation, _node) => {
|
|
13
|
+
let result = true;
|
|
14
|
+
for (const key of keys) {
|
|
15
|
+
if (!disableDotNotation) {
|
|
16
|
+
if (!(0, isEqual_1.default)((0, get_1.default)(obj.json, key), (0, get_1.default)(obj2.json, key))) {
|
|
17
|
+
result = false;
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
if (!(0, isEqual_1.default)(obj.json[key], obj2.json[key])) {
|
|
23
|
+
result = false;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
exports.compareItems = compareItems;
|
|
31
|
+
const flattenKeys = (obj, path = []) => {
|
|
32
|
+
return !(0, isObject_1.default)(obj)
|
|
33
|
+
? { [path.join('.')]: obj }
|
|
34
|
+
: (0, reduce_1.default)(obj, (cum, next, key) => (0, merge_1.default)(cum, (0, exports.flattenKeys)(next, [...path, key])), {});
|
|
35
|
+
};
|
|
36
|
+
exports.flattenKeys = flattenKeys;
|
|
37
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../nodes/Transform/RemoveDuplicates/utils.ts"],"names":[],"mappings":";;;;;;AAAA,qDAA6B;AAC7B,6DAAqC;AACrC,+DAAuC;AACvC,yDAAiC;AACjC,2DAAmC;AAG5B,MAAM,YAAY,GAAG,CAC3B,GAAuB,EACvB,IAAwB,EACxB,IAAc,EACd,kBAA2B,EAC3B,KAAY,EACX,EAAE;IACH,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACxB,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACzB,IAAI,CAAC,IAAA,iBAAO,EAAC,IAAA,aAAG,EAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,IAAA,aAAG,EAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;gBACvD,MAAM,GAAG,KAAK,CAAC;gBACf,MAAM;YACP,CAAC;QACF,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,IAAA,iBAAO,EAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;gBAC7C,MAAM,GAAG,KAAK,CAAC;gBACf,MAAM;YACP,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC,CAAC;AAtBW,QAAA,YAAY,gBAsBvB;AAEK,MAAM,WAAW,GAAG,CAAC,GAAgB,EAAE,OAAiB,EAAE,EAAe,EAAE;IACjF,OAAO,CAAC,IAAA,kBAAQ,EAAC,GAAG,CAAC;QACpB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE;QAC3B,CAAC,CAAC,IAAA,gBAAM,EAAC,GAAG,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,IAAA,eAAK,EAAC,GAAG,EAAE,IAAA,mBAAW,EAAC,IAAmB,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACtG,CAAC,CAAC;AAJW,QAAA,WAAW,eAItB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type IExecuteFunctions, type INodeExecutionData, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class Sort implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|