n8n-nodes-smartsuite 2.0.6

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.
Files changed (178) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +163 -0
  3. package/dist/credentials/SmartSuiteApi.credentials.d.ts +8 -0
  4. package/dist/credentials/SmartSuiteApi.credentials.js +38 -0
  5. package/dist/credentials/SmartSuiteApi.credentials.js.map +1 -0
  6. package/dist/credentials/SmartSuiteApi.svg +6 -0
  7. package/dist/index.d.ts +3 -0
  8. package/dist/index.js +12 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/nodes/SmartSuite/SmartSuite.node.d.ts +27 -0
  11. package/dist/nodes/SmartSuite/SmartSuite.node.js +108 -0
  12. package/dist/nodes/SmartSuite/SmartSuite.node.js.map +1 -0
  13. package/dist/nodes/SmartSuite/SmartSuite.node.json +48 -0
  14. package/dist/nodes/SmartSuite/SmartSuiteTrigger.node.d.ts +23 -0
  15. package/dist/nodes/SmartSuite/SmartSuiteTrigger.node.js +173 -0
  16. package/dist/nodes/SmartSuite/SmartSuiteTrigger.node.js.map +1 -0
  17. package/dist/nodes/SmartSuite/SmartSuiteTrigger.node.json +14 -0
  18. package/dist/nodes/SmartSuite/__tests__/actions/api/makeApiRequest.test.d.ts +1 -0
  19. package/dist/nodes/SmartSuite/__tests__/actions/api/makeApiRequest.test.js +74 -0
  20. package/dist/nodes/SmartSuite/__tests__/actions/api/makeApiRequest.test.js.map +1 -0
  21. package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/getCurrentUser.test.d.ts +1 -0
  22. package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/getCurrentUser.test.js +22 -0
  23. package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/getCurrentUser.test.js.map +1 -0
  24. package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/listMembers.test.d.ts +1 -0
  25. package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/listMembers.test.js +70 -0
  26. package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/listMembers.test.js.map +1 -0
  27. package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/listTeams.test.d.ts +1 -0
  28. package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/listTeams.test.js +43 -0
  29. package/dist/nodes/SmartSuite/__tests__/actions/orgManagement/listTeams.test.js.map +1 -0
  30. package/dist/nodes/SmartSuite/__tests__/actions/record/createRecord.test.d.ts +1 -0
  31. package/dist/nodes/SmartSuite/__tests__/actions/record/createRecord.test.js +178 -0
  32. package/dist/nodes/SmartSuite/__tests__/actions/record/createRecord.test.js.map +1 -0
  33. package/dist/nodes/SmartSuite/__tests__/actions/record/deleteRecord.test.d.ts +1 -0
  34. package/dist/nodes/SmartSuite/__tests__/actions/record/deleteRecord.test.js +159 -0
  35. package/dist/nodes/SmartSuite/__tests__/actions/record/deleteRecord.test.js.map +1 -0
  36. package/dist/nodes/SmartSuite/__tests__/actions/record/getRecord.test.d.ts +1 -0
  37. package/dist/nodes/SmartSuite/__tests__/actions/record/getRecord.test.js +127 -0
  38. package/dist/nodes/SmartSuite/__tests__/actions/record/getRecord.test.js.map +1 -0
  39. package/dist/nodes/SmartSuite/__tests__/actions/record/listRecord.test.d.ts +1 -0
  40. package/dist/nodes/SmartSuite/__tests__/actions/record/listRecord.test.js +162 -0
  41. package/dist/nodes/SmartSuite/__tests__/actions/record/listRecord.test.js.map +1 -0
  42. package/dist/nodes/SmartSuite/__tests__/actions/record/searchRecord.test.d.ts +1 -0
  43. package/dist/nodes/SmartSuite/__tests__/actions/record/searchRecord.test.js +210 -0
  44. package/dist/nodes/SmartSuite/__tests__/actions/record/searchRecord.test.js.map +1 -0
  45. package/dist/nodes/SmartSuite/__tests__/actions/record/updateRecord.test.d.ts +1 -0
  46. package/dist/nodes/SmartSuite/__tests__/actions/record/updateRecord.test.js +198 -0
  47. package/dist/nodes/SmartSuite/__tests__/actions/record/updateRecord.test.js.map +1 -0
  48. package/dist/nodes/SmartSuite/__tests__/actions/record/upsertRecord.test.d.ts +1 -0
  49. package/dist/nodes/SmartSuite/__tests__/actions/record/upsertRecord.test.js +138 -0
  50. package/dist/nodes/SmartSuite/__tests__/actions/record/upsertRecord.test.js.map +1 -0
  51. package/dist/nodes/SmartSuite/__tests__/actions/solution/getSolution.test.d.ts +1 -0
  52. package/dist/nodes/SmartSuite/__tests__/actions/solution/getSolution.test.js +57 -0
  53. package/dist/nodes/SmartSuite/__tests__/actions/solution/getSolution.test.js.map +1 -0
  54. package/dist/nodes/SmartSuite/__tests__/actions/solution/listSolution.test.d.ts +1 -0
  55. package/dist/nodes/SmartSuite/__tests__/actions/solution/listSolution.test.js +48 -0
  56. package/dist/nodes/SmartSuite/__tests__/actions/solution/listSolution.test.js.map +1 -0
  57. package/dist/nodes/SmartSuite/__tests__/actions/table/createTable.test.d.ts +1 -0
  58. package/dist/nodes/SmartSuite/__tests__/actions/table/createTable.test.js +50 -0
  59. package/dist/nodes/SmartSuite/__tests__/actions/table/createTable.test.js.map +1 -0
  60. package/dist/nodes/SmartSuite/__tests__/actions/table/createTableField.test.d.ts +1 -0
  61. package/dist/nodes/SmartSuite/__tests__/actions/table/createTableField.test.js +93 -0
  62. package/dist/nodes/SmartSuite/__tests__/actions/table/createTableField.test.js.map +1 -0
  63. package/dist/nodes/SmartSuite/__tests__/actions/table/getTable.test.d.ts +1 -0
  64. package/dist/nodes/SmartSuite/__tests__/actions/table/getTable.test.js +70 -0
  65. package/dist/nodes/SmartSuite/__tests__/actions/table/getTable.test.js.map +1 -0
  66. package/dist/nodes/SmartSuite/__tests__/actions/table/listTable.test.d.ts +1 -0
  67. package/dist/nodes/SmartSuite/__tests__/actions/table/listTable.test.js +78 -0
  68. package/dist/nodes/SmartSuite/__tests__/actions/table/listTable.test.js.map +1 -0
  69. package/dist/nodes/SmartSuite/__tests__/helpers/mockResourceInputs.d.ts +10 -0
  70. package/dist/nodes/SmartSuite/__tests__/helpers/mockResourceInputs.js +26 -0
  71. package/dist/nodes/SmartSuite/__tests__/helpers/mockResourceInputs.js.map +1 -0
  72. package/dist/nodes/SmartSuite/actions/api/ApiRequestDescription.d.ts +2 -0
  73. package/dist/nodes/SmartSuite/actions/api/ApiRequestDescription.js +185 -0
  74. package/dist/nodes/SmartSuite/actions/api/ApiRequestDescription.js.map +1 -0
  75. package/dist/nodes/SmartSuite/actions/api/makeApiRequest.operation.d.ts +3 -0
  76. package/dist/nodes/SmartSuite/actions/api/makeApiRequest.operation.js +65 -0
  77. package/dist/nodes/SmartSuite/actions/api/makeApiRequest.operation.js.map +1 -0
  78. package/dist/nodes/SmartSuite/actions/orgManagement/OrgManagementDescription.d.ts +2 -0
  79. package/dist/nodes/SmartSuite/actions/orgManagement/OrgManagementDescription.js +21 -0
  80. package/dist/nodes/SmartSuite/actions/orgManagement/OrgManagementDescription.js.map +1 -0
  81. package/dist/nodes/SmartSuite/actions/orgManagement/getCurrentUser.operation.d.ts +18 -0
  82. package/dist/nodes/SmartSuite/actions/orgManagement/getCurrentUser.operation.js +39 -0
  83. package/dist/nodes/SmartSuite/actions/orgManagement/getCurrentUser.operation.js.map +1 -0
  84. package/dist/nodes/SmartSuite/actions/orgManagement/listMembers.operation.d.ts +18 -0
  85. package/dist/nodes/SmartSuite/actions/orgManagement/listMembers.operation.js +41 -0
  86. package/dist/nodes/SmartSuite/actions/orgManagement/listMembers.operation.js.map +1 -0
  87. package/dist/nodes/SmartSuite/actions/orgManagement/listTeams.operation.d.ts +18 -0
  88. package/dist/nodes/SmartSuite/actions/orgManagement/listTeams.operation.js +41 -0
  89. package/dist/nodes/SmartSuite/actions/orgManagement/listTeams.operation.js.map +1 -0
  90. package/dist/nodes/SmartSuite/actions/record/RecordDescription.d.ts +2 -0
  91. package/dist/nodes/SmartSuite/actions/record/RecordDescription.js +370 -0
  92. package/dist/nodes/SmartSuite/actions/record/RecordDescription.js.map +1 -0
  93. package/dist/nodes/SmartSuite/actions/record/createRecord.operation.d.ts +87 -0
  94. package/dist/nodes/SmartSuite/actions/record/createRecord.operation.js +55 -0
  95. package/dist/nodes/SmartSuite/actions/record/createRecord.operation.js.map +1 -0
  96. package/dist/nodes/SmartSuite/actions/record/deleteRecord.operation.d.ts +24 -0
  97. package/dist/nodes/SmartSuite/actions/record/deleteRecord.operation.js +49 -0
  98. package/dist/nodes/SmartSuite/actions/record/deleteRecord.operation.js.map +1 -0
  99. package/dist/nodes/SmartSuite/actions/record/getRecord.operation.d.ts +2 -0
  100. package/dist/nodes/SmartSuite/actions/record/getRecord.operation.js +31 -0
  101. package/dist/nodes/SmartSuite/actions/record/getRecord.operation.js.map +1 -0
  102. package/dist/nodes/SmartSuite/actions/record/listRecord.operation.d.ts +2 -0
  103. package/dist/nodes/SmartSuite/actions/record/listRecord.operation.js +52 -0
  104. package/dist/nodes/SmartSuite/actions/record/listRecord.operation.js.map +1 -0
  105. package/dist/nodes/SmartSuite/actions/record/searchRecord.operation.d.ts +2 -0
  106. package/dist/nodes/SmartSuite/actions/record/searchRecord.operation.js +77 -0
  107. package/dist/nodes/SmartSuite/actions/record/searchRecord.operation.js.map +1 -0
  108. package/dist/nodes/SmartSuite/actions/record/updateRecord.operation.d.ts +2 -0
  109. package/dist/nodes/SmartSuite/actions/record/updateRecord.operation.js +42 -0
  110. package/dist/nodes/SmartSuite/actions/record/updateRecord.operation.js.map +1 -0
  111. package/dist/nodes/SmartSuite/actions/record/upsertRecord.operation.d.ts +2 -0
  112. package/dist/nodes/SmartSuite/actions/record/upsertRecord.operation.js +66 -0
  113. package/dist/nodes/SmartSuite/actions/record/upsertRecord.operation.js.map +1 -0
  114. package/dist/nodes/SmartSuite/actions/solution/SolutionDescription.d.ts +2 -0
  115. package/dist/nodes/SmartSuite/actions/solution/SolutionDescription.js +54 -0
  116. package/dist/nodes/SmartSuite/actions/solution/SolutionDescription.js.map +1 -0
  117. package/dist/nodes/SmartSuite/actions/solution/getSolution.operation.d.ts +3 -0
  118. package/dist/nodes/SmartSuite/actions/solution/getSolution.operation.js +25 -0
  119. package/dist/nodes/SmartSuite/actions/solution/getSolution.operation.js.map +1 -0
  120. package/dist/nodes/SmartSuite/actions/solution/listSolution.operation.d.ts +3 -0
  121. package/dist/nodes/SmartSuite/actions/solution/listSolution.operation.js +54 -0
  122. package/dist/nodes/SmartSuite/actions/solution/listSolution.operation.js.map +1 -0
  123. package/dist/nodes/SmartSuite/actions/table/TableDescription.d.ts +6 -0
  124. package/dist/nodes/SmartSuite/actions/table/TableDescription.js +153 -0
  125. package/dist/nodes/SmartSuite/actions/table/TableDescription.js.map +1 -0
  126. package/dist/nodes/SmartSuite/actions/table/createTable.operation.d.ts +2 -0
  127. package/dist/nodes/SmartSuite/actions/table/createTable.operation.js +45 -0
  128. package/dist/nodes/SmartSuite/actions/table/createTable.operation.js.map +1 -0
  129. package/dist/nodes/SmartSuite/actions/table/createTableField.operation.d.ts +2 -0
  130. package/dist/nodes/SmartSuite/actions/table/createTableField.operation.js +49 -0
  131. package/dist/nodes/SmartSuite/actions/table/createTableField.operation.js.map +1 -0
  132. package/dist/nodes/SmartSuite/actions/table/getTable.operation.d.ts +2 -0
  133. package/dist/nodes/SmartSuite/actions/table/getTable.operation.js +23 -0
  134. package/dist/nodes/SmartSuite/actions/table/getTable.operation.js.map +1 -0
  135. package/dist/nodes/SmartSuite/actions/table/listTable.operation.d.ts +2 -0
  136. package/dist/nodes/SmartSuite/actions/table/listTable.operation.js +42 -0
  137. package/dist/nodes/SmartSuite/actions/table/listTable.operation.js.map +1 -0
  138. package/dist/nodes/SmartSuite/helpers/getFilterOptions.d.ts +11 -0
  139. package/dist/nodes/SmartSuite/helpers/getFilterOptions.js +376 -0
  140. package/dist/nodes/SmartSuite/helpers/getFilterOptions.js.map +1 -0
  141. package/dist/nodes/SmartSuite/helpers/getValidFilters.d.ts +6 -0
  142. package/dist/nodes/SmartSuite/helpers/getValidFilters.js +47 -0
  143. package/dist/nodes/SmartSuite/helpers/getValidFilters.js.map +1 -0
  144. package/dist/nodes/SmartSuite/helpers/utils.d.ts +21 -0
  145. package/dist/nodes/SmartSuite/helpers/utils.js +62 -0
  146. package/dist/nodes/SmartSuite/helpers/utils.js.map +1 -0
  147. package/dist/nodes/SmartSuite/helpers/validation.d.ts +9 -0
  148. package/dist/nodes/SmartSuite/helpers/validation.js +41 -0
  149. package/dist/nodes/SmartSuite/helpers/validation.js.map +1 -0
  150. package/dist/nodes/SmartSuite/index.d.ts +2 -0
  151. package/dist/nodes/SmartSuite/index.js +12 -0
  152. package/dist/nodes/SmartSuite/index.js.map +1 -0
  153. package/dist/nodes/SmartSuite/methods/listSearch.d.ts +11 -0
  154. package/dist/nodes/SmartSuite/methods/listSearch.js +81 -0
  155. package/dist/nodes/SmartSuite/methods/listSearch.js.map +1 -0
  156. package/dist/nodes/SmartSuite/methods/loadOptions.d.ts +30 -0
  157. package/dist/nodes/SmartSuite/methods/loadOptions.js +133 -0
  158. package/dist/nodes/SmartSuite/methods/loadOptions.js.map +1 -0
  159. package/dist/nodes/SmartSuite/methods/resourceMapping.d.ts +48 -0
  160. package/dist/nodes/SmartSuite/methods/resourceMapping.js +122 -0
  161. package/dist/nodes/SmartSuite/methods/resourceMapping.js.map +1 -0
  162. package/dist/nodes/SmartSuite/methods/router.d.ts +2 -0
  163. package/dist/nodes/SmartSuite/methods/router.js +65 -0
  164. package/dist/nodes/SmartSuite/methods/router.js.map +1 -0
  165. package/dist/nodes/SmartSuite/shared/__testHelpers__/mockExecuteFunctions.d.ts +9 -0
  166. package/dist/nodes/SmartSuite/shared/__testHelpers__/mockExecuteFunctions.js +84 -0
  167. package/dist/nodes/SmartSuite/shared/__testHelpers__/mockExecuteFunctions.js.map +1 -0
  168. package/dist/nodes/SmartSuite/shared/resourceInputs.d.ts +15 -0
  169. package/dist/nodes/SmartSuite/shared/resourceInputs.js +112 -0
  170. package/dist/nodes/SmartSuite/shared/resourceInputs.js.map +1 -0
  171. package/dist/nodes/SmartSuite/smartsuite.svg +6 -0
  172. package/dist/nodes/SmartSuite/transport/smartSuiteApi.d.ts +12 -0
  173. package/dist/nodes/SmartSuite/transport/smartSuiteApi.js +111 -0
  174. package/dist/nodes/SmartSuite/transport/smartSuiteApi.js.map +1 -0
  175. package/dist/nodes/SmartSuite/types.d.ts +11 -0
  176. package/dist/nodes/SmartSuite/types.js +4 -0
  177. package/dist/nodes/SmartSuite/types.js.map +1 -0
  178. package/package.json +99 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Pat Shanks
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,163 @@
1
+ # n8n-nodes-smartsuite
2
+
3
+ This is an n8n community node for SmartSuite. It allows you to interact with SmartSuite's API to manage resources across your SmartSuite solutions.
4
+
5
+ This a major rewrite based on n8n recommendation to use the Airtable node as a template.
6
+
7
+ ## Features
8
+
9
+ - CRUD operations for **Record**, **Table**, **Solution**, and **Org Management** resources
10
+ - Generic **API Request** actions (Get, Post, Put, Patch, Delete)
11
+ - Support for n8n Return All/Limit pagination pattern
12
+ - AI Agent tool integration
13
+ - Improved date field handling for due_date fields
14
+
15
+ ## Installation
16
+
17
+ Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
18
+
19
+ ## Usage
20
+
21
+ ### Resources & Operations
22
+
23
+ #### Record
24
+ - Get Record
25
+ - List Record
26
+ - Search Record
27
+ - Create Record
28
+ - Update Record
29
+ - Upsert Record
30
+ - Delete Record
31
+
32
+ #### Table
33
+ - List Tables
34
+ - Get Table
35
+ - Create Table Field
36
+ - Create Table
37
+
38
+ #### Solution
39
+ - List Solution
40
+ - Get Solution
41
+
42
+ #### Org Management
43
+ - Get Current User
44
+ - List Members
45
+ - List Teams
46
+
47
+ #### API Request
48
+ - Get
49
+ - Post
50
+ - Put
51
+ - Patch
52
+ - Delete
53
+
54
+ #### Trigger Actions
55
+ - On new or updated record
56
+
57
+ ### As a Regular Node
58
+
59
+ Each resource operation is exposed as an action within the SmartSuite node. Simply select the desired **Resource** and **Operation**, provide any required parameters, and execute.
60
+
61
+ ### As an AI Agent Tool
62
+
63
+ This node integrates seamlessly with the n8n AI Agent node. When used as a tool, the AI Agent will recognize the SmartSuite methods and their capabilities.
64
+
65
+ ### As a Trigger
66
+
67
+ This node can be used as a trigger to poll for new or updated records in SmartSuite.
68
+
69
+ ## Record
70
+ - **Get Record**: Retrieve a specific record by its ID.
71
+ - **List Record**: Return one or more records from a table, with support for Return All/Limit pagination.
72
+ - **Search Record**: Find records using multiple filters, supporting various field types, operators, and AND/OR logic.
73
+ - **Create Record**: Create a new record with specified field values.
74
+ - **Update Record**: Update one or more fields on an existing record by ID.
75
+ - **Upsert Record**: Create or update a record based on a filter (if found, it updates; otherwise, it creates).
76
+ - **Delete Record**: Delete a record by its ID.
77
+
78
+ ## Table
79
+ - **List Tables**: List all tables in a workspace or solution.
80
+ - **Get Table**: Retrieve metadata for a specific table by ID.
81
+ - **Create Table Field**: Add a new field/column to an existing table.
82
+ - **Create Table**: Create a new table in the workspace or solution.
83
+
84
+ ## Solution
85
+ - **List Solution**: List all solutions available to the API key.
86
+ - **Get Solution**: Retrieve details for a specific solution by ID.
87
+
88
+ ## Org Management
89
+ - **Get Current User**: Fetch details about the authenticated user.
90
+ - **List Members**: List all members in the organization, with pagination support.
91
+ - **List Teams**: List all teams within the organization.
92
+
93
+ ## API Request
94
+ - **Get**: Perform a generic GET request to any SmartSuite API endpoint.
95
+ - **Post**: Perform a generic POST request to any SmartSuite API endpoint.
96
+ - **Put**: Perform a generic PUT request to any SmartSuite API endpoint.
97
+ - **Patch**: Perform a generic PATCH request to any SmartSuite API endpoint.
98
+ - **Delete**: Perform a generic DELETE request to any SmartSuite API endpoint.
99
+
100
+ #### Tool Response Format
101
+
102
+ We are using the n8n Return All/Limit pagination pattern.
103
+
104
+ ## Credentials
105
+
106
+ To use this node, you'll need to set up your SmartSuite API credentials:
107
+
108
+ 1. Log in to your SmartSuite account
109
+ 2. Go to Settings > API
110
+ 3. Generate a new API key
111
+ 4. In n8n, add your SmartSuite credentials:
112
+ - **API Key**: Your SmartSuite API key
113
+ - **Base URL**: `https://app.smartsuite.com/api/v1`
114
+
115
+ ## Security & Compliance
116
+
117
+ ### Known Vulnerabilities
118
+
119
+ This node has some known security vulnerabilities in its dependencies:
120
+
121
+ 1. **High Severity**: Axios SSRF and Credential Leakage Vulnerability
122
+ - Affects: `axios` package (transitive dependency)
123
+ - Impact: Potential Server-Side Request Forgery (SSRF) and credential leakage
124
+ - Mitigation: This vulnerability only affects requests to untrusted URLs. The SmartSuite node only makes requests to the SmartSuite API (a trusted domain) and handles credentials securely through n8n's credential system.
125
+
126
+ ### Security Best Practices
127
+
128
+ 1. **API Key Management**
129
+ - Never share your SmartSuite API key
130
+ - Use n8n's credential system to store your API key securely
131
+ - Rotate your API key if you suspect it has been compromised
132
+
133
+ 2. **Data Access**
134
+ - Only grant the minimum required permissions to your SmartSuite API key
135
+ - Review your SmartSuite audit logs regularly for suspicious activity
136
+ - Use the principle of least privilege when setting up API access
137
+
138
+ 3. **Network Security**
139
+ - Ensure your n8n instance is running behind a secure network
140
+ - Use HTTPS for all API communications
141
+ - Keep your n8n instance and its dependencies up to date
142
+
143
+ ### Reporting Security Issues
144
+
145
+ If you discover a security vulnerability in this node, please report it responsibly:
146
+
147
+ 1. Do not create public issues for security vulnerabilities
148
+ 2. Email security details to: [patandlorna@patandlorna.com](mailto:patandlorna@patandlorna.com)
149
+ 3. Include a detailed description and steps to reproduce
150
+
151
+ We will respond to security reports A.S.A.P.
152
+
153
+ ## Resources
154
+
155
+ - [SmartSuite API Documentation](https://developers.smartsuite.com/docs/intro)
156
+ - [n8n Main Website](https://n8n.io/)
157
+ - [n8n Community Nodes Documentation](https://docs.n8n.io/integrations/community-nodes/build-community-nodes/)
158
+ - [n8n Community Forum](https://community.n8n.io/)
159
+ - [n8n AI Functionality Documentation](https://docs.n8n.io/advanced-ai/)
160
+
161
+ ## License
162
+
163
+ MIT License - see the [LICENSE](LICENSE) file for details
@@ -0,0 +1,8 @@
1
+ import type { ICredentialType, INodeProperties, Icon } from 'n8n-workflow';
2
+ export declare class SmartSuiteApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: Icon;
6
+ documentationUrl: string;
7
+ properties: INodeProperties[];
8
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SmartSuiteApi = void 0;
4
+ class SmartSuiteApi {
5
+ name = 'smartSuiteApi';
6
+ displayName = 'SmartSuite API';
7
+ icon = 'file:SmartSuiteApi.svg';
8
+ documentationUrl = 'https://developers.smartsuite.com/docs/authentication';
9
+ properties = [
10
+ {
11
+ displayName: 'API Key',
12
+ name: 'apiKey',
13
+ type: 'string',
14
+ typeOptions: { password: true },
15
+ default: '',
16
+ required: true,
17
+ description: 'Your SmartSuite API key',
18
+ },
19
+ {
20
+ displayName: 'Account ID',
21
+ name: 'accountId',
22
+ type: 'string',
23
+ default: '',
24
+ required: true,
25
+ description: 'Your SmartSuite Account ID',
26
+ },
27
+ {
28
+ displayName: 'Base URL',
29
+ name: 'baseUrl',
30
+ type: 'string',
31
+ default: 'https://app.smartsuite.com/api/v1',
32
+ required: true,
33
+ description: 'The base URL for the SmartSuite API',
34
+ },
35
+ ];
36
+ }
37
+ exports.SmartSuiteApi = SmartSuiteApi;
38
+ //# sourceMappingURL=SmartSuiteApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmartSuiteApi.credentials.js","sourceRoot":"","sources":["../../src/credentials/SmartSuiteApi.credentials.ts"],"names":[],"mappings":";;;AAOA,MAAa,aAAa;IACxB,IAAI,GAAG,eAAe,CAAC;IACvB,WAAW,GAAG,gBAAgB,CAAC;IAC/B,IAAI,GAAS,wBAAwB,CAAC;IACtC,gBAAgB,GAAG,uDAAuD,CAAC;IAC3E,UAAU,GAAsB;QAC9B;YACE,WAAW,EAAE,SAAS;YACtB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC/B,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,yBAAyB;SACvC;QACD;YACE,WAAW,EAAE,YAAY;YACzB,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,4BAA4B;SAC1C;QACD;YACE,WAAW,EAAE,UAAU;YACvB,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,mCAAmC;YAC5C,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,qCAAqC;SACnD;KACF,CAAC;CACH;AAhCD,sCAgCC"}
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <svg fill="none" height="2000" viewBox="300 300 1400 1400" width="2000" xmlns="http://www.w3.org/2000/svg">
3
+ <path clip-rule="evenodd" d="M487 862.275L1172.18 862.29C1343.12 862.29 1485.03 974.409 1512.39 1137.58L827.207 1137.55C656.267 1137.55 514.367 1025.44 487 862.275Z" fill="#FF5757" fill-rule="evenodd"/>
4
+ <path clip-rule="evenodd" d="M487 1552L1172.18 1551.99C1343.12 1551.99 1485.03 1440.17 1512.39 1277.01L827.207 1277.03C656.267 1277.03 514.367 1388.84 487 1552Z" fill="#3A86FF" fill-rule="evenodd"/>
5
+ <path clip-rule="evenodd" d="M487 722.846L1172.18 722.831C1343.12 722.831 1485.03 610.169 1512.39 447L827.207 447.026C656.267 447.026 514.367 559.682 487 722.846Z" fill="#FFB938" fill-rule="evenodd"/>
6
+ </svg>
@@ -0,0 +1,3 @@
1
+ import SmartSuite from './nodes/SmartSuite/SmartSuite.node';
2
+ import smartSuiteTrigger from './nodes/SmartSuite/SmartSuiteTrigger.node';
3
+ export { SmartSuite as nodeClass, smartSuiteTrigger as triggerClass, };
package/dist/index.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ // src/index.ts
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.triggerClass = exports.nodeClass = void 0;
8
+ const SmartSuite_node_1 = __importDefault(require("./nodes/SmartSuite/SmartSuite.node"));
9
+ exports.nodeClass = SmartSuite_node_1.default;
10
+ const SmartSuiteTrigger_node_1 = __importDefault(require("./nodes/SmartSuite/SmartSuiteTrigger.node"));
11
+ exports.triggerClass = SmartSuiteTrigger_node_1.default;
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,eAAe;;;;;;AAEf,yFAA4D;AAIlC,oBAJnB,yBAAU,CAIkB;AAHnC,uGAA0E;AAIhD,uBAJnB,gCAAiB,CAIc"}
@@ -0,0 +1,27 @@
1
+ import { INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ import type { IExecuteFunctions, ICredentialTestFunctions, INodeCredentialTestResult, INodeExecutionData } from 'n8n-workflow';
3
+ import { getOperations, getTableFields, getMutableTableFields, getFilterOptionsForFieldType, searchTableFields, searchTableFieldsMutable } from './methods/loadOptions';
4
+ import { getAllFilterConditions } from './helpers/getValidFilters';
5
+ export declare class SmartSuite implements INodeType {
6
+ description: INodeTypeDescription;
7
+ methods: {
8
+ credentialTest: {
9
+ smartSuiteApiTest(this: ICredentialTestFunctions): Promise<INodeCredentialTestResult>;
10
+ };
11
+ loadOptions: {
12
+ getOperations: typeof getOperations;
13
+ getTableFields: typeof getTableFields;
14
+ getMutableTableFields: typeof getMutableTableFields;
15
+ getFilterOptionsForFieldType: typeof getFilterOptionsForFieldType;
16
+ getAllFilterConditions: typeof getAllFilterConditions;
17
+ searchTableFields: typeof searchTableFields;
18
+ searchTableFieldsMutable: typeof searchTableFieldsMutable;
19
+ };
20
+ listSearch: {
21
+ solutionSearch: (this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string) => Promise<import("n8n-workflow").INodeListSearchResult>;
22
+ tableSearch: (this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string) => Promise<import("n8n-workflow").INodeListSearchResult>;
23
+ };
24
+ };
25
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
26
+ }
27
+ export default SmartSuite;
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ // src/nodes/SmartSuite/SmartSuite.node.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SmartSuite = void 0;
5
+ const router_1 = require("./methods/router");
6
+ const smartSuiteApi_1 = require("./transport/smartSuiteApi");
7
+ // loadOptions & listSearch imports
8
+ const loadOptions_1 = require("./methods/loadOptions");
9
+ const getValidFilters_1 = require("./helpers/getValidFilters");
10
+ const listSearch_1 = require("./methods/listSearch");
11
+ // resource descriptions
12
+ const RecordDescription_1 = require("./actions/record/RecordDescription");
13
+ const TableDescription_1 = require("./actions/table/TableDescription");
14
+ const SolutionDescription_1 = require("./actions/solution/SolutionDescription");
15
+ const OrgManagementDescription_1 = require("./actions/orgManagement/OrgManagementDescription");
16
+ // API Request UI + executor
17
+ const ApiRequestDescription_1 = require("./actions/api/ApiRequestDescription");
18
+ const makeApiRequest_operation_1 = require("./actions/api/makeApiRequest.operation");
19
+ class SmartSuite {
20
+ description = {
21
+ displayName: 'SmartSuite',
22
+ name: 'smartsuite',
23
+ icon: 'file:SmartSuite.svg',
24
+ group: ['transform'],
25
+ version: 2,
26
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
27
+ description: 'Interact with SmartSuite API',
28
+ defaults: { name: 'SmartSuite' },
29
+ // disable the "inputs must be ['main']" lint rule for these lines
30
+ // eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
31
+ inputs: ["main" /* NodeConnectionType.Main */],
32
+ // eslint-disable-next-line n8n-nodes-base/node-class-description-inputs-wrong-regular-node
33
+ outputs: ["main" /* NodeConnectionType.Main */],
34
+ credentials: [
35
+ {
36
+ name: 'smartSuiteApi',
37
+ required: true,
38
+ testedBy: 'smartSuiteApiTest',
39
+ },
40
+ ],
41
+ properties: [
42
+ // 1) Resource selector
43
+ {
44
+ displayName: 'Resource',
45
+ name: 'resource',
46
+ type: 'options',
47
+ noDataExpression: true,
48
+ default: 'record',
49
+ options: [
50
+ { name: 'Record', value: 'record' },
51
+ { name: 'Table', value: 'table' },
52
+ { name: 'Solution', value: 'solution' },
53
+ { name: 'Org Management', value: 'orgManagement' },
54
+ { name: 'API Request', value: 'apiRequest' },
55
+ ],
56
+ description: 'Which SmartSuite resource to operate on',
57
+ },
58
+ // 2) Existing-resource UIs
59
+ ...RecordDescription_1.recordDescription,
60
+ ...TableDescription_1.tableOperations,
61
+ ...TableDescription_1.tableFields,
62
+ ...SolutionDescription_1.solutionDescription,
63
+ ...OrgManagementDescription_1.orgManagementDescription,
64
+ // 3) API-Request UI (HTTP methods as operations + Query/Header/Body toggles)
65
+ ...ApiRequestDescription_1.apiRequestDescription,
66
+ ],
67
+ };
68
+ methods = {
69
+ credentialTest: {
70
+ async smartSuiteApiTest() {
71
+ try {
72
+ // simple test endpoint
73
+ await smartSuiteApi_1.apiRequest.call(this, 'GET', '/solutions/', {}, { limit: 1, offset: 0 });
74
+ return { status: 'OK', message: 'Connection successful!' };
75
+ }
76
+ catch (err) {
77
+ return { status: 'Error', message: err.message };
78
+ }
79
+ },
80
+ },
81
+ loadOptions: {
82
+ getOperations: loadOptions_1.getOperations,
83
+ getTableFields: loadOptions_1.getTableFields,
84
+ getMutableTableFields: loadOptions_1.getMutableTableFields,
85
+ getFilterOptionsForFieldType: loadOptions_1.getFilterOptionsForFieldType,
86
+ getAllFilterConditions: getValidFilters_1.getAllFilterConditions,
87
+ searchTableFields: loadOptions_1.searchTableFields,
88
+ searchTableFieldsMutable: loadOptions_1.searchTableFieldsMutable,
89
+ },
90
+ listSearch: {
91
+ solutionSearch: listSearch_1.solutionSearch,
92
+ tableSearch: listSearch_1.tableSearch,
93
+ },
94
+ };
95
+ async execute() {
96
+ const resource = this.getNodeParameter('resource', 0);
97
+ if (resource === 'apiRequest') {
98
+ // call our single-operation executor at index 0
99
+ const output = await makeApiRequest_operation_1.executeMakeApiRequest.call(this, 0);
100
+ return [output];
101
+ }
102
+ // otherwise fall back to the router
103
+ return router_1.router.call(this);
104
+ }
105
+ }
106
+ exports.SmartSuite = SmartSuite;
107
+ exports.default = SmartSuite;
108
+ //# sourceMappingURL=SmartSuite.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SmartSuite.node.js","sourceRoot":"","sources":["../../../src/nodes/SmartSuite/SmartSuite.node.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,48 @@
1
+ {
2
+ "node": "smartsuite",
3
+ "nodeVersion": "2.0",
4
+ "codexVersion": "1.0",
5
+ "sections": [
6
+ {
7
+ "name": "Record Actions",
8
+ "properties": [
9
+ "getRecord",
10
+ "listRecords",
11
+ "searchRecords",
12
+ "createRecord",
13
+ "updateRecord",
14
+ "deleteRecord"
15
+ ]
16
+ },
17
+ {
18
+ "name": "Table Actions",
19
+ "properties": [
20
+ "listTables",
21
+ "getTable",
22
+ "createTable",
23
+ "createTableField"
24
+ ]
25
+ },
26
+ {
27
+ "name": "Solution Actions",
28
+ "properties": [
29
+ "listSolutions",
30
+ "getSolution"
31
+ ]
32
+ },
33
+ {
34
+ "name": "Org Management Actions",
35
+ "properties": [
36
+ "getCurrentUser",
37
+ "listMembers",
38
+ "listTeams"
39
+ ]
40
+ },
41
+ {
42
+ "name": "Triggers ⚡",
43
+ "properties": [
44
+ "smartSuiteTrigger"
45
+ ]
46
+ }
47
+ ]
48
+ }
@@ -0,0 +1,23 @@
1
+ import { INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ import type { IPollFunctions, ICredentialTestFunctions, INodeCredentialTestResult, INodeExecutionData } from 'n8n-workflow';
3
+ import { getOperations, getTableFields, getMutableTableFields, getFilterOptionsForFieldType } from './methods/loadOptions';
4
+ export declare class SmartSuiteTrigger implements INodeType {
5
+ description: INodeTypeDescription;
6
+ methods: {
7
+ credentialTest: {
8
+ smartSuiteApiTest(this: ICredentialTestFunctions): Promise<INodeCredentialTestResult>;
9
+ };
10
+ loadOptions: {
11
+ getOperations: typeof getOperations;
12
+ getTableFields: typeof getTableFields;
13
+ getMutableTableFields: typeof getMutableTableFields;
14
+ getFilterOptionsForFieldType: typeof getFilterOptionsForFieldType;
15
+ };
16
+ listSearch: {
17
+ solutionSearch: (this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string) => Promise<import("n8n-workflow").INodeListSearchResult>;
18
+ tableSearch: (this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string) => Promise<import("n8n-workflow").INodeListSearchResult>;
19
+ };
20
+ };
21
+ poll(this: IPollFunctions): Promise<INodeExecutionData[][] | null>;
22
+ }
23
+ export default SmartSuiteTrigger;
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ // src/nodes/SmartSuite/SmartSuiteTrigger.node.ts
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SmartSuiteTrigger = void 0;
5
+ const smartSuiteApi_1 = require("./transport/smartSuiteApi");
6
+ const utils_1 = require("./helpers/utils");
7
+ const loadOptions_1 = require("./methods/loadOptions");
8
+ const listSearch_1 = require("./methods/listSearch");
9
+ class SmartSuiteTrigger {
10
+ description = {
11
+ displayName: 'SmartSuite Trigger',
12
+ name: 'smartSuiteTrigger',
13
+ icon: 'file:SmartSuite.svg',
14
+ group: ['trigger'],
15
+ version: 1,
16
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
17
+ description: 'Watch for new or updated records in SmartSuite',
18
+ defaults: { name: 'SmartSuite Trigger' },
19
+ credentials: [
20
+ {
21
+ name: 'smartSuiteApi',
22
+ required: true,
23
+ testedBy: 'smartSuiteApiTest',
24
+ },
25
+ ],
26
+ polling: true,
27
+ inputs: ["main" /* NodeConnectionType.Main */],
28
+ outputs: ["main" /* NodeConnectionType.Main */],
29
+ properties: [
30
+ {
31
+ displayName: 'Solution',
32
+ name: 'solutionId',
33
+ type: 'resourceLocator',
34
+ noDataExpression: false,
35
+ default: { mode: 'list', value: '' },
36
+ modes: [
37
+ {
38
+ name: 'list',
39
+ displayName: 'From List',
40
+ type: 'list',
41
+ typeOptions: {
42
+ searchListMethod: 'solutionSearch',
43
+ searchable: true,
44
+ },
45
+ },
46
+ {
47
+ name: 'id',
48
+ displayName: 'By ID',
49
+ type: 'string',
50
+ placeholder: 'Solution ID',
51
+ },
52
+ ],
53
+ description: 'Select the SmartSuite solution to watch',
54
+ },
55
+ {
56
+ displayName: 'Table',
57
+ name: 'tableId',
58
+ type: 'resourceLocator',
59
+ noDataExpression: false,
60
+ default: { mode: 'list', value: '' },
61
+ modes: [
62
+ {
63
+ name: 'list',
64
+ displayName: 'From List',
65
+ type: 'list',
66
+ typeOptions: {
67
+ searchListMethod: 'tableSearch',
68
+ searchable: true,
69
+ },
70
+ },
71
+ {
72
+ name: 'id',
73
+ displayName: 'By ID',
74
+ type: 'string',
75
+ placeholder: 'Table ID',
76
+ },
77
+ ],
78
+ description: 'Select the table to watch',
79
+ },
80
+ {
81
+ displayName: 'Trigger Field',
82
+ name: 'triggerField',
83
+ type: 'options',
84
+ noDataExpression: true,
85
+ options: [
86
+ { name: 'First Created', value: 'first_created', description: 'Trigger when a record is first created' },
87
+ { name: 'Last Updated', value: 'last_updated', description: 'Trigger when a record is updated' },
88
+ ],
89
+ default: 'last_updated',
90
+ description: 'Which timestamp to use for change detection',
91
+ },
92
+ ],
93
+ };
94
+ methods = {
95
+ credentialTest: {
96
+ async smartSuiteApiTest() {
97
+ try {
98
+ await smartSuiteApi_1.apiRequest.call(this, 'GET', '/solutions/', {}, { limit: 1, offset: 0 });
99
+ return { status: 'OK', message: 'Connection successful!' };
100
+ }
101
+ catch (err) {
102
+ return { status: 'Error', message: err.message };
103
+ }
104
+ },
105
+ },
106
+ loadOptions: {
107
+ getOperations: loadOptions_1.getOperations,
108
+ getTableFields: loadOptions_1.getTableFields,
109
+ getMutableTableFields: loadOptions_1.getMutableTableFields,
110
+ getFilterOptionsForFieldType: loadOptions_1.getFilterOptionsForFieldType,
111
+ },
112
+ listSearch: {
113
+ solutionSearch: listSearch_1.solutionSearch,
114
+ tableSearch: listSearch_1.tableSearch,
115
+ },
116
+ };
117
+ async poll() {
118
+ const staticData = this.getWorkflowStaticData('node');
119
+ const mode = this.getMode();
120
+ let runPrefix = '';
121
+ if (mode !== 'manual') {
122
+ const prevCount = staticData.runCount || 0;
123
+ const runCount = prevCount + 1;
124
+ staticData.runCount = runCount;
125
+ const runIndex = String(runCount).padStart(3, '0');
126
+ runPrefix = `${runIndex}-`;
127
+ }
128
+ (0, utils_1.debugLog)(`[SmartSuiteTrigger] Trigger Run-${runPrefix}${new Date().toISOString()}`, {}, 3);
129
+ const tableId = (0, utils_1.asIdString)(this.getNodeParameter('tableId', 0));
130
+ const triggerField = this.getNodeParameter('triggerField', 0);
131
+ const path = `/applications/${tableId}/records/list/`;
132
+ const qs = {};
133
+ const body = {};
134
+ if (mode === 'manual') {
135
+ qs.limit = 1;
136
+ }
137
+ else {
138
+ body.filter = {
139
+ operator: 'and',
140
+ fields: [
141
+ { field: triggerField, comparison: 'is_on_or_after', value: { date_mode: 'today', date_mode_value: null } },
142
+ ],
143
+ };
144
+ }
145
+ const response = await smartSuiteApi_1.apiRequest.call(this, 'POST', path, body, qs);
146
+ const rawItems = response.records ?? response.items ?? [];
147
+ let filtered = rawItems;
148
+ if (mode !== 'manual') {
149
+ const lastCheckedRaw = staticData.LastCheckedDate || new Date(0).toISOString();
150
+ const lastMs = new Date(lastCheckedRaw).getTime();
151
+ filtered = rawItems.filter((item) => {
152
+ const on = item[triggerField]?.on;
153
+ return typeof on === 'string' && new Date(on).getTime() > lastMs;
154
+ });
155
+ if (filtered.length) {
156
+ const newest = filtered
157
+ .map((i) => i[triggerField].on)
158
+ .sort()
159
+ .pop();
160
+ staticData.LastCheckedDate = newest;
161
+ (0, utils_1.debugLog)(`[SmartSuiteTrigger] Updated LastCheckedDate = ${newest}`, {}, 3);
162
+ }
163
+ }
164
+ (0, utils_1.debugLog)('[SmartSuiteTrigger] Records →', filtered, 3);
165
+ if (filtered.length) {
166
+ return [this.helpers.returnJsonArray(filtered)];
167
+ }
168
+ return null;
169
+ }
170
+ }
171
+ exports.SmartSuiteTrigger = SmartSuiteTrigger;
172
+ exports.default = SmartSuiteTrigger;
173
+ //# sourceMappingURL=SmartSuiteTrigger.node.js.map