n8n-nodes-steyi-ss 1.0.3 → 1.0.4
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/nodes/SteyiSmartsheet/SteyiSmartsheet.node.js +112 -17
- package/dist/nodes/SteyiSmartsheet/executors/Admin.js +3 -3
- package/dist/nodes/SteyiSmartsheet/executors/Converter.d.ts +2 -0
- package/dist/nodes/SteyiSmartsheet/executors/Converter.js +51 -0
- package/dist/nodes/SteyiSmartsheet/executors/Rows.js +42 -36
- package/package.json +1 -1
|
@@ -30,6 +30,7 @@ const Webhooks_1 = require("./executors/Webhooks");
|
|
|
30
30
|
const Columns_1 = require("./executors/Columns");
|
|
31
31
|
const Reports_1 = require("./executors/Reports");
|
|
32
32
|
const Admin_1 = require("./executors/Admin");
|
|
33
|
+
const Converter_1 = require("./executors/Converter");
|
|
33
34
|
const SteyiSmartsheetApi_1 = require("./SteyiSmartsheetApi");
|
|
34
35
|
const SteyiGenericFunction_1 = require("./SteyiGenericFunction");
|
|
35
36
|
class SteyiSmartsheet {
|
|
@@ -90,6 +91,11 @@ class SteyiSmartsheet {
|
|
|
90
91
|
value: 'admin',
|
|
91
92
|
description: 'Manage users, groups, and group members',
|
|
92
93
|
},
|
|
94
|
+
{
|
|
95
|
+
name: 'Converter',
|
|
96
|
+
value: 'converter',
|
|
97
|
+
description: 'Utility tools for data conversion',
|
|
98
|
+
},
|
|
93
99
|
],
|
|
94
100
|
default: 'sheet',
|
|
95
101
|
required: true,
|
|
@@ -611,9 +617,9 @@ class SteyiSmartsheet {
|
|
|
611
617
|
{
|
|
612
618
|
displayName: 'Value',
|
|
613
619
|
name: 'value',
|
|
614
|
-
type: '
|
|
620
|
+
type: 'json',
|
|
615
621
|
default: '',
|
|
616
|
-
description: 'The value to set. Column type is shown in parentheses in the dropdown above. For format
|
|
622
|
+
description: 'The value to set. Column type is shown in parentheses in the dropdown above. For MULTI_CONTACT_LIST and MULTI_PICKLIST columns, enter JSON format. For other columns, enter plain text/number. For format examples, see the <a href="https://www.npmjs.com/package/n8n-nodes-steyi-ss" target="_blank">npm package README</a>.',
|
|
617
623
|
},
|
|
618
624
|
],
|
|
619
625
|
},
|
|
@@ -1552,13 +1558,9 @@ class SteyiSmartsheet {
|
|
|
1552
1558
|
type: 'options',
|
|
1553
1559
|
displayOptions: {
|
|
1554
1560
|
show: {
|
|
1555
|
-
resource: ['admin'],
|
|
1556
|
-
operation: ['group', 'groupMember'],
|
|
1557
|
-
},
|
|
1558
|
-
hide: {
|
|
1559
1561
|
resource: ['admin'],
|
|
1560
1562
|
operation: ['group'],
|
|
1561
|
-
groupOperation: ['
|
|
1563
|
+
groupOperation: ['getGroup', 'updateGroup', 'deleteGroup'],
|
|
1562
1564
|
},
|
|
1563
1565
|
},
|
|
1564
1566
|
options: [
|
|
@@ -1585,14 +1587,10 @@ class SteyiSmartsheet {
|
|
|
1585
1587
|
},
|
|
1586
1588
|
displayOptions: {
|
|
1587
1589
|
show: {
|
|
1588
|
-
resource: ['admin'],
|
|
1589
|
-
operation: ['group', 'groupMember'],
|
|
1590
|
-
groupInputMethod: ['list'],
|
|
1591
|
-
},
|
|
1592
|
-
hide: {
|
|
1593
1590
|
resource: ['admin'],
|
|
1594
1591
|
operation: ['group'],
|
|
1595
|
-
groupOperation: ['
|
|
1592
|
+
groupOperation: ['getGroup', 'updateGroup', 'deleteGroup'],
|
|
1593
|
+
groupInputMethod: ['list'],
|
|
1596
1594
|
},
|
|
1597
1595
|
},
|
|
1598
1596
|
default: '',
|
|
@@ -1606,13 +1604,66 @@ class SteyiSmartsheet {
|
|
|
1606
1604
|
displayOptions: {
|
|
1607
1605
|
show: {
|
|
1608
1606
|
resource: ['admin'],
|
|
1609
|
-
operation: ['group'
|
|
1607
|
+
operation: ['group'],
|
|
1608
|
+
groupOperation: ['getGroup', 'updateGroup', 'deleteGroup'],
|
|
1610
1609
|
groupInputMethod: ['id'],
|
|
1611
1610
|
},
|
|
1612
|
-
|
|
1611
|
+
},
|
|
1612
|
+
default: '',
|
|
1613
|
+
required: true,
|
|
1614
|
+
},
|
|
1615
|
+
{
|
|
1616
|
+
displayName: 'Group Input Method',
|
|
1617
|
+
name: 'groupMemberGroupInputMethod',
|
|
1618
|
+
type: 'options',
|
|
1619
|
+
displayOptions: {
|
|
1620
|
+
show: {
|
|
1613
1621
|
resource: ['admin'],
|
|
1614
|
-
operation: ['
|
|
1615
|
-
|
|
1622
|
+
operation: ['groupMember'],
|
|
1623
|
+
},
|
|
1624
|
+
},
|
|
1625
|
+
options: [
|
|
1626
|
+
{
|
|
1627
|
+
name: 'Select from List',
|
|
1628
|
+
value: 'list',
|
|
1629
|
+
},
|
|
1630
|
+
{
|
|
1631
|
+
name: 'Enter Group ID',
|
|
1632
|
+
value: 'id',
|
|
1633
|
+
},
|
|
1634
|
+
],
|
|
1635
|
+
default: 'list',
|
|
1636
|
+
description: 'Choose how to specify the group',
|
|
1637
|
+
},
|
|
1638
|
+
{
|
|
1639
|
+
displayName: 'Group',
|
|
1640
|
+
name: 'groupMemberGroupId',
|
|
1641
|
+
type: 'options',
|
|
1642
|
+
description: 'Select a group from the list',
|
|
1643
|
+
typeOptions: {
|
|
1644
|
+
loadOptionsMethod: 'getGroups',
|
|
1645
|
+
searchable: true,
|
|
1646
|
+
},
|
|
1647
|
+
displayOptions: {
|
|
1648
|
+
show: {
|
|
1649
|
+
resource: ['admin'],
|
|
1650
|
+
operation: ['groupMember'],
|
|
1651
|
+
groupMemberGroupInputMethod: ['list'],
|
|
1652
|
+
},
|
|
1653
|
+
},
|
|
1654
|
+
default: '',
|
|
1655
|
+
required: true,
|
|
1656
|
+
},
|
|
1657
|
+
{
|
|
1658
|
+
displayName: 'Group ID',
|
|
1659
|
+
name: 'groupMemberGroupIdManual',
|
|
1660
|
+
type: 'string',
|
|
1661
|
+
description: 'Enter the Group ID manually',
|
|
1662
|
+
displayOptions: {
|
|
1663
|
+
show: {
|
|
1664
|
+
resource: ['admin'],
|
|
1665
|
+
operation: ['groupMember'],
|
|
1666
|
+
groupMemberGroupInputMethod: ['id'],
|
|
1616
1667
|
},
|
|
1617
1668
|
},
|
|
1618
1669
|
default: '',
|
|
@@ -1772,6 +1823,46 @@ class SteyiSmartsheet {
|
|
|
1772
1823
|
default: '',
|
|
1773
1824
|
required: true,
|
|
1774
1825
|
},
|
|
1826
|
+
{
|
|
1827
|
+
displayName: 'Operation',
|
|
1828
|
+
name: 'operation',
|
|
1829
|
+
type: 'options',
|
|
1830
|
+
noDataExpression: true,
|
|
1831
|
+
displayOptions: {
|
|
1832
|
+
show: {
|
|
1833
|
+
resource: ['converter'],
|
|
1834
|
+
},
|
|
1835
|
+
},
|
|
1836
|
+
options: [
|
|
1837
|
+
{
|
|
1838
|
+
name: 'CSV to MCL Format',
|
|
1839
|
+
value: 'csvToMclFormat',
|
|
1840
|
+
description: 'Convert comma-separated email values to MULTI_CONTACT_LIST format',
|
|
1841
|
+
action: 'Convert CSV to MCL format',
|
|
1842
|
+
},
|
|
1843
|
+
{
|
|
1844
|
+
name: 'CSV to MPL',
|
|
1845
|
+
value: 'csvToMplFormat',
|
|
1846
|
+
description: 'Convert comma-separated values to MULTI_PICKLIST format',
|
|
1847
|
+
action: 'Convert CSV to MPL format',
|
|
1848
|
+
},
|
|
1849
|
+
],
|
|
1850
|
+
default: 'csvToMclFormat',
|
|
1851
|
+
},
|
|
1852
|
+
{
|
|
1853
|
+
displayName: 'CSV Values',
|
|
1854
|
+
name: 'csvValues',
|
|
1855
|
+
type: 'string',
|
|
1856
|
+
displayOptions: {
|
|
1857
|
+
show: {
|
|
1858
|
+
resource: ['converter'],
|
|
1859
|
+
operation: ['csvToMclFormat', 'csvToMplFormat'],
|
|
1860
|
+
},
|
|
1861
|
+
},
|
|
1862
|
+
default: '',
|
|
1863
|
+
required: true,
|
|
1864
|
+
description: 'Comma-separated values (e.g., "email1@example.com, email2@example.com" for MCL or "Option 1, Option 2" for MPL)',
|
|
1865
|
+
},
|
|
1775
1866
|
],
|
|
1776
1867
|
};
|
|
1777
1868
|
this.methods = {
|
|
@@ -2016,6 +2107,10 @@ class SteyiSmartsheet {
|
|
|
2016
2107
|
const result = await Admin_1.executeAdminOperation.call(this, operation, i);
|
|
2017
2108
|
returnData.push(result);
|
|
2018
2109
|
}
|
|
2110
|
+
else if (resource === 'converter') {
|
|
2111
|
+
const result = await Converter_1.executeConverterOperation.call(this, operation, i);
|
|
2112
|
+
returnData.push(result);
|
|
2113
|
+
}
|
|
2019
2114
|
else {
|
|
2020
2115
|
throw new Error(`Unknown resource: ${resource}`);
|
|
2021
2116
|
}
|
|
@@ -132,10 +132,10 @@ async function executeAdminOperation(operation, itemIndex) {
|
|
|
132
132
|
}
|
|
133
133
|
case 'groupMember': {
|
|
134
134
|
const groupMemberOperation = this.getNodeParameter('groupMemberOperation', itemIndex);
|
|
135
|
-
const groupInputMethod = this.getNodeParameter('
|
|
135
|
+
const groupInputMethod = this.getNodeParameter('groupMemberGroupInputMethod', itemIndex, 'list');
|
|
136
136
|
const groupId = groupInputMethod === 'id'
|
|
137
|
-
? this.getNodeParameter('
|
|
138
|
-
: this.getNodeParameter('
|
|
137
|
+
? this.getNodeParameter('groupMemberGroupIdManual', itemIndex)
|
|
138
|
+
: this.getNodeParameter('groupMemberGroupId', itemIndex);
|
|
139
139
|
switch (groupMemberOperation) {
|
|
140
140
|
case 'listGroupMembers': {
|
|
141
141
|
responseData = await SteyiSmartsheetApi_1.listGroupMembers.call(this, parseInt(groupId.toString()));
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeConverterOperation = void 0;
|
|
4
|
+
async function executeConverterOperation(operation, itemIndex) {
|
|
5
|
+
switch (operation) {
|
|
6
|
+
case 'csvToMclFormat': {
|
|
7
|
+
const emailsRaw = this.getNodeParameter('csvValues', itemIndex);
|
|
8
|
+
if (!emailsRaw || typeof emailsRaw !== 'string') {
|
|
9
|
+
throw new Error('CSV values input is required and must be a string');
|
|
10
|
+
}
|
|
11
|
+
// Split by comma, trim whitespace, filter out empty strings, and map to email objects
|
|
12
|
+
const values = emailsRaw
|
|
13
|
+
.split(',')
|
|
14
|
+
.map(e => e.trim())
|
|
15
|
+
.filter(e => e.length > 0)
|
|
16
|
+
.map(email => ({ email }));
|
|
17
|
+
// Return as an object with mcl-output property containing values
|
|
18
|
+
return {
|
|
19
|
+
json: {
|
|
20
|
+
'mcl-output': {
|
|
21
|
+
values: values,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
pairedItem: { item: itemIndex },
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
case 'csvToMplFormat': {
|
|
28
|
+
const optionsRaw = this.getNodeParameter('csvValues', itemIndex);
|
|
29
|
+
if (!optionsRaw || typeof optionsRaw !== 'string') {
|
|
30
|
+
throw new Error('CSV values input is required and must be a string');
|
|
31
|
+
}
|
|
32
|
+
// Split by comma, trim whitespace, filter out empty strings (returns array of strings)
|
|
33
|
+
const values = optionsRaw
|
|
34
|
+
.split(',')
|
|
35
|
+
.map(e => e.trim())
|
|
36
|
+
.filter(e => e.length > 0);
|
|
37
|
+
// Return as an object with mpl-output property containing values array
|
|
38
|
+
return {
|
|
39
|
+
json: {
|
|
40
|
+
'mpl-output': {
|
|
41
|
+
values: values,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
pairedItem: { item: itemIndex },
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
default:
|
|
48
|
+
throw new Error(`Unknown converter operation: ${operation}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.executeConverterOperation = executeConverterOperation;
|
|
@@ -196,21 +196,23 @@ async function executeRowOperation(operation, itemIndex) {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
// Handle MULTI_CONTACT_LIST and MULTI_PICKLIST columns with objectValue
|
|
199
|
-
// User
|
|
199
|
+
// User provides a JSON object (field type is 'json' so n8n parses it automatically)
|
|
200
200
|
if (columnType === 'MULTI_CONTACT_LIST') {
|
|
201
|
-
// Parse the value as JSON
|
|
201
|
+
// Parse the value - if it's a string, try to parse as JSON; if already an object, use it directly
|
|
202
202
|
let parsedValue;
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
if (typeof cellValue === 'string') {
|
|
204
|
+
try {
|
|
205
205
|
parsedValue = JSON.parse(cellValue);
|
|
206
206
|
}
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
catch (error) {
|
|
208
|
+
throw new Error(`Invalid JSON for MULTI_CONTACT_LIST column (Column ID: ${colIdNum}). ` +
|
|
209
|
+
`Please provide a valid JSON object with structure: { "values": [{ "email": "..." }, ...] }. ` +
|
|
210
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
209
211
|
}
|
|
210
212
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
213
|
+
else {
|
|
214
|
+
// Already parsed by n8n's JSON field type
|
|
215
|
+
parsedValue = cellValue;
|
|
214
216
|
}
|
|
215
217
|
// Validate that it's an object with values array
|
|
216
218
|
if (typeof parsedValue !== 'object' || parsedValue === null) {
|
|
@@ -250,21 +252,22 @@ async function executeRowOperation(operation, itemIndex) {
|
|
|
250
252
|
};
|
|
251
253
|
}
|
|
252
254
|
else if (columnType === 'MULTI_PICKLIST') {
|
|
253
|
-
// Parse the value as JSON
|
|
255
|
+
// Parse the value - if it's a string, try to parse as JSON; if already an object, use it directly
|
|
254
256
|
// Expected format: { "values": ["Option 1", "Option 2", ...] }
|
|
255
257
|
let parsedValue;
|
|
256
|
-
|
|
257
|
-
|
|
258
|
+
if (typeof cellValue === 'string') {
|
|
259
|
+
try {
|
|
258
260
|
parsedValue = JSON.parse(cellValue);
|
|
259
261
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
+
catch (error) {
|
|
263
|
+
throw new Error(`Invalid JSON for MULTI_PICKLIST column (Column ID: ${colIdNum}). ` +
|
|
264
|
+
`Please provide a valid JSON object with structure: { "values": ["Option 1", "Option 2"] }. ` +
|
|
265
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
262
266
|
}
|
|
263
267
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
268
|
+
else {
|
|
269
|
+
// Already parsed by n8n's JSON field type
|
|
270
|
+
parsedValue = cellValue;
|
|
268
271
|
}
|
|
269
272
|
// Validate that it's an object with values array
|
|
270
273
|
if (typeof parsedValue !== 'object' || parsedValue === null) {
|
|
@@ -663,21 +666,23 @@ async function executeRowOperation(operation, itemIndex) {
|
|
|
663
666
|
}
|
|
664
667
|
}
|
|
665
668
|
// Handle MULTI_CONTACT_LIST and MULTI_PICKLIST columns with objectValue
|
|
666
|
-
// User
|
|
669
|
+
// User provides a JSON object (field type is 'json' so n8n parses it automatically)
|
|
667
670
|
if (columnType === 'MULTI_CONTACT_LIST') {
|
|
668
|
-
// Parse the value as JSON
|
|
671
|
+
// Parse the value - if it's a string, try to parse as JSON; if already an object, use it directly
|
|
669
672
|
let parsedValue;
|
|
670
|
-
|
|
671
|
-
|
|
673
|
+
if (typeof cellValue === 'string') {
|
|
674
|
+
try {
|
|
672
675
|
parsedValue = JSON.parse(cellValue);
|
|
673
676
|
}
|
|
674
|
-
|
|
675
|
-
|
|
677
|
+
catch (error) {
|
|
678
|
+
throw new Error(`Invalid JSON for MULTI_CONTACT_LIST column (Column ID: ${colIdNum}). ` +
|
|
679
|
+
`Please provide a valid JSON object with structure: { "values": [{ "email": "..." }, ...] }. ` +
|
|
680
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
676
681
|
}
|
|
677
682
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
683
|
+
else {
|
|
684
|
+
// Already parsed by n8n's JSON field type
|
|
685
|
+
parsedValue = cellValue;
|
|
681
686
|
}
|
|
682
687
|
// Validate that it's an object with values array
|
|
683
688
|
if (typeof parsedValue !== 'object' || parsedValue === null) {
|
|
@@ -717,21 +722,22 @@ async function executeRowOperation(operation, itemIndex) {
|
|
|
717
722
|
};
|
|
718
723
|
}
|
|
719
724
|
else if (columnType === 'MULTI_PICKLIST') {
|
|
720
|
-
// Parse the value as JSON
|
|
725
|
+
// Parse the value - if it's a string, try to parse as JSON; if already an object, use it directly
|
|
721
726
|
// Expected format: { "values": ["Option 1", "Option 2", ...] }
|
|
722
727
|
let parsedValue;
|
|
723
|
-
|
|
724
|
-
|
|
728
|
+
if (typeof cellValue === 'string') {
|
|
729
|
+
try {
|
|
725
730
|
parsedValue = JSON.parse(cellValue);
|
|
726
731
|
}
|
|
727
|
-
|
|
728
|
-
|
|
732
|
+
catch (error) {
|
|
733
|
+
throw new Error(`Invalid JSON for MULTI_PICKLIST column (Column ID: ${colIdNum}). ` +
|
|
734
|
+
`Please provide a valid JSON object with structure: { "values": ["Option 1", "Option 2"] }. ` +
|
|
735
|
+
`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
729
736
|
}
|
|
730
737
|
}
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
738
|
+
else {
|
|
739
|
+
// Already parsed by n8n's JSON field type
|
|
740
|
+
parsedValue = cellValue;
|
|
735
741
|
}
|
|
736
742
|
// Validate that it's an object with values array
|
|
737
743
|
if (typeof parsedValue !== 'object' || parsedValue === null) {
|