n8n-nodes-smartsuite 2.0.17 → 2.0.18
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/SmartSuite/helpers/cache.d.ts +47 -0
- package/dist/nodes/SmartSuite/helpers/cache.js +97 -0
- package/dist/nodes/SmartSuite/helpers/cache.js.map +1 -0
- package/dist/nodes/SmartSuite/methods/listSearch.js +53 -2
- package/dist/nodes/SmartSuite/methods/listSearch.js.map +1 -1
- package/dist/nodes/SmartSuite/shared/resourceInputs.js +6 -18
- package/dist/nodes/SmartSuite/shared/resourceInputs.js.map +1 -1
- package/dist/nodes/SmartSuite/transport/smartSuiteApi.d.ts +4 -2
- package/dist/nodes/SmartSuite/transport/smartSuiteApi.js +103 -29
- package/dist/nodes/SmartSuite/transport/smartSuiteApi.js.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple in-memory cache with TTL (Time To Live) support
|
|
3
|
+
* Used to cache API responses and reduce redundant calls
|
|
4
|
+
*/
|
|
5
|
+
type CacheKey = string;
|
|
6
|
+
/**
|
|
7
|
+
* Get a value from cache if it exists and hasn't expired
|
|
8
|
+
* @param key - The cache key
|
|
9
|
+
* @param ttlMs - Optional TTL in milliseconds (defaults to 60 seconds)
|
|
10
|
+
* @returns The cached value or undefined if not found/expired
|
|
11
|
+
*/
|
|
12
|
+
export declare function getCache<T>(key: CacheKey, ttlMs?: number): T | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Set a value in the cache with timestamp
|
|
15
|
+
* @param key - The cache key
|
|
16
|
+
* @param value - The value to cache
|
|
17
|
+
* @returns The cached value
|
|
18
|
+
*/
|
|
19
|
+
export declare function setCache<T>(key: CacheKey, value: T): T;
|
|
20
|
+
/**
|
|
21
|
+
* Clear a specific cache entry
|
|
22
|
+
* @param key - The cache key to clear
|
|
23
|
+
*/
|
|
24
|
+
export declare function clearCache(key: CacheKey): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Clear all cache entries
|
|
27
|
+
*/
|
|
28
|
+
export declare function clearAllCache(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Get the size of the cache
|
|
31
|
+
* @returns Number of entries in the cache
|
|
32
|
+
*/
|
|
33
|
+
export declare function getCacheSize(): number;
|
|
34
|
+
/**
|
|
35
|
+
* Clean up expired cache entries
|
|
36
|
+
* @param ttlMs - TTL to check against (defaults to 60 seconds)
|
|
37
|
+
*/
|
|
38
|
+
export declare function cleanupExpiredCache(ttlMs?: number): number;
|
|
39
|
+
/**
|
|
40
|
+
* Generate a cache key for field options
|
|
41
|
+
* @param solutionId - The solution ID
|
|
42
|
+
* @param tableId - The table ID
|
|
43
|
+
* @param suffix - Optional suffix for the key
|
|
44
|
+
* @returns A formatted cache key
|
|
45
|
+
*/
|
|
46
|
+
export declare function generateFieldsCacheKey(solutionId: string, tableId: string, suffix?: string): string;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// src/nodes/SmartSuite/helpers/cache.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.getCache = getCache;
|
|
5
|
+
exports.setCache = setCache;
|
|
6
|
+
exports.clearCache = clearCache;
|
|
7
|
+
exports.clearAllCache = clearAllCache;
|
|
8
|
+
exports.getCacheSize = getCacheSize;
|
|
9
|
+
exports.cleanupExpiredCache = cleanupExpiredCache;
|
|
10
|
+
exports.generateFieldsCacheKey = generateFieldsCacheKey;
|
|
11
|
+
// Global cache storage
|
|
12
|
+
const cacheStore = new Map();
|
|
13
|
+
// Default TTL in milliseconds (60 seconds)
|
|
14
|
+
const DEFAULT_TTL_MS = 60000;
|
|
15
|
+
/**
|
|
16
|
+
* Get a value from cache if it exists and hasn't expired
|
|
17
|
+
* @param key - The cache key
|
|
18
|
+
* @param ttlMs - Optional TTL in milliseconds (defaults to 60 seconds)
|
|
19
|
+
* @returns The cached value or undefined if not found/expired
|
|
20
|
+
*/
|
|
21
|
+
function getCache(key, ttlMs = DEFAULT_TTL_MS) {
|
|
22
|
+
const entry = cacheStore.get(key);
|
|
23
|
+
if (!entry) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const now = Date.now();
|
|
27
|
+
const age = now - entry.timestamp;
|
|
28
|
+
// Check if entry has expired
|
|
29
|
+
if (age > ttlMs) {
|
|
30
|
+
// Remove expired entry
|
|
31
|
+
cacheStore.delete(key);
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
return entry.value;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Set a value in the cache with timestamp
|
|
38
|
+
* @param key - The cache key
|
|
39
|
+
* @param value - The value to cache
|
|
40
|
+
* @returns The cached value
|
|
41
|
+
*/
|
|
42
|
+
function setCache(key, value) {
|
|
43
|
+
const entry = {
|
|
44
|
+
value,
|
|
45
|
+
timestamp: Date.now(),
|
|
46
|
+
};
|
|
47
|
+
cacheStore.set(key, entry);
|
|
48
|
+
return value;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Clear a specific cache entry
|
|
52
|
+
* @param key - The cache key to clear
|
|
53
|
+
*/
|
|
54
|
+
function clearCache(key) {
|
|
55
|
+
return cacheStore.delete(key);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Clear all cache entries
|
|
59
|
+
*/
|
|
60
|
+
function clearAllCache() {
|
|
61
|
+
cacheStore.clear();
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get the size of the cache
|
|
65
|
+
* @returns Number of entries in the cache
|
|
66
|
+
*/
|
|
67
|
+
function getCacheSize() {
|
|
68
|
+
return cacheStore.size;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Clean up expired cache entries
|
|
72
|
+
* @param ttlMs - TTL to check against (defaults to 60 seconds)
|
|
73
|
+
*/
|
|
74
|
+
function cleanupExpiredCache(ttlMs = DEFAULT_TTL_MS) {
|
|
75
|
+
const now = Date.now();
|
|
76
|
+
let cleaned = 0;
|
|
77
|
+
for (const [key, entry] of cacheStore.entries()) {
|
|
78
|
+
const age = now - entry.timestamp;
|
|
79
|
+
if (age > ttlMs) {
|
|
80
|
+
cacheStore.delete(key);
|
|
81
|
+
cleaned++;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return cleaned;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Generate a cache key for field options
|
|
88
|
+
* @param solutionId - The solution ID
|
|
89
|
+
* @param tableId - The table ID
|
|
90
|
+
* @param suffix - Optional suffix for the key
|
|
91
|
+
* @returns A formatted cache key
|
|
92
|
+
*/
|
|
93
|
+
function generateFieldsCacheKey(solutionId, tableId, suffix) {
|
|
94
|
+
const baseKey = `fields:${solutionId}:${tableId}`;
|
|
95
|
+
return suffix ? `${baseKey}:${suffix}` : baseKey;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../../../src/nodes/SmartSuite/helpers/cache.ts"],"names":[],"mappings":";AAAA,wCAAwC;;AAyBxC,4BAkBC;AAQD,4BAQC;AAMD,gCAEC;AAKD,sCAEC;AAMD,oCAEC;AAMD,kDAaC;AASD,wDAOC;AAxGD,uBAAuB;AACvB,MAAM,UAAU,GAAG,IAAI,GAAG,EAA6B,CAAC;AAExD,2CAA2C;AAC3C,MAAM,cAAc,GAAG,KAAK,CAAC;AAE7B;;;;;GAKG;AACH,SAAgB,QAAQ,CAAI,GAAa,EAAE,QAAgB,cAAc;IACvE,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAElC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACv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;AACjB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,sBAAsB,CACpC,UAAkB,EAClB,OAAe,EACf,MAAe;IAEf,MAAM,OAAO,GAAG,UAAU,UAAU,IAAI,OAAO,EAAE,CAAC;IAClD,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AACnD,CAAC"}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.listSearch = exports.searchTableFieldsMutable = exports.searchTableFields = exports.tableSearch = exports.solutionSearch = void 0;
|
|
5
5
|
const utils_1 = require("../helpers/utils");
|
|
6
6
|
const smartSuiteApi_1 = require("../transport/smartSuiteApi");
|
|
7
|
+
const cache_1 = require("../helpers/cache");
|
|
7
8
|
// Helper to map fields for resourceLocator (supports description property)
|
|
8
9
|
const serializeField = (f) => ({
|
|
9
10
|
name: `${f.label} (${f.field_type})`,
|
|
@@ -47,7 +48,32 @@ const searchTableFields = async function (filter = '') {
|
|
|
47
48
|
const tableId = (0, utils_1.asIdString)(this.getNodeParameter('tableId', 0));
|
|
48
49
|
if (!tableId)
|
|
49
50
|
return { results: [] };
|
|
50
|
-
|
|
51
|
+
// Try to get solution ID for more specific caching
|
|
52
|
+
let solutionId = '';
|
|
53
|
+
try {
|
|
54
|
+
solutionId = (0, utils_1.asIdString)(this.getNodeParameter('solutionId', 0)) || '';
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// Solution ID might not be available in all contexts
|
|
58
|
+
}
|
|
59
|
+
// Generate cache key
|
|
60
|
+
const cacheKey = (0, cache_1.generateFieldsCacheKey)(solutionId || 'unknown', tableId);
|
|
61
|
+
// Check cache first
|
|
62
|
+
const cachedStructure = (0, cache_1.getCache)(cacheKey);
|
|
63
|
+
let structure = [];
|
|
64
|
+
if (cachedStructure) {
|
|
65
|
+
// Use cached data
|
|
66
|
+
structure = cachedStructure;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
// Fetch from API if not cached
|
|
70
|
+
const response = (await smartSuiteApi_1.apiRequest.call(this, 'GET', `/applications/${tableId}/`));
|
|
71
|
+
structure = response.structure || [];
|
|
72
|
+
// Cache the structure for future use
|
|
73
|
+
if (structure.length > 0) {
|
|
74
|
+
(0, cache_1.setCache)(cacheKey, structure);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
51
77
|
const filtered = structure.filter((f) => !filter ||
|
|
52
78
|
f.label.toLowerCase().includes(filter.toLowerCase()) ||
|
|
53
79
|
f.slug.toLowerCase().includes(filter.toLowerCase()));
|
|
@@ -59,7 +85,32 @@ const searchTableFieldsMutable = async function (filter = '') {
|
|
|
59
85
|
const tableId = (0, utils_1.asIdString)(this.getNodeParameter('tableId', 0));
|
|
60
86
|
if (!tableId)
|
|
61
87
|
return { results: [] };
|
|
62
|
-
|
|
88
|
+
// Try to get solution ID for more specific caching
|
|
89
|
+
let solutionId = '';
|
|
90
|
+
try {
|
|
91
|
+
solutionId = (0, utils_1.asIdString)(this.getNodeParameter('solutionId', 0)) || '';
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
// Solution ID might not be available in all contexts
|
|
95
|
+
}
|
|
96
|
+
// Generate cache key with 'mutable' suffix to differentiate from regular fields
|
|
97
|
+
const cacheKey = (0, cache_1.generateFieldsCacheKey)(solutionId || 'unknown', tableId, 'mutable');
|
|
98
|
+
// Check cache first
|
|
99
|
+
const cachedStructure = (0, cache_1.getCache)(cacheKey);
|
|
100
|
+
let structure = [];
|
|
101
|
+
if (cachedStructure) {
|
|
102
|
+
// Use cached data
|
|
103
|
+
structure = cachedStructure;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
// Fetch from API if not cached
|
|
107
|
+
const response = (await smartSuiteApi_1.apiRequest.call(this, 'GET', `/applications/${tableId}/`));
|
|
108
|
+
structure = response.structure || [];
|
|
109
|
+
// Cache the structure for future use
|
|
110
|
+
if (structure.length > 0) {
|
|
111
|
+
(0, cache_1.setCache)(cacheKey, structure);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
63
114
|
// Exclude reserved fields
|
|
64
115
|
const withoutReserved = structure.filter((f) => !(0, utils_1.isReservedField)(f.slug));
|
|
65
116
|
// Exclude record ID fields
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listSearch.js","sourceRoot":"","sources":["../../../../src/nodes/SmartSuite/methods/listSearch.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;AAG7C,4CAA+D;AAC/D,8DAAwD;
|
|
1
|
+
{"version":3,"file":"listSearch.js","sourceRoot":"","sources":["../../../../src/nodes/SmartSuite/methods/listSearch.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;AAG7C,4CAA+D;AAC/D,8DAAwD;AACxD,4CAA8E;AAE9E,2EAA2E;AAC3E,MAAM,cAAc,GAAG,CAAC,CAAsD,EAAE,EAAE,CAAC,CAAC;IAClF,IAAI,EAAS,GAAG,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,UAAU,GAAG;IAC3C,KAAK,EAAQ,CAAC,CAAC,IAAI;IACnB,WAAW,EAAE,SAAS,CAAC,CAAC,UAAU,EAAE;CACrC,CAAC,CAAC;AAEI,MAAM,cAAc,GAAG,KAAK,WAEjC,MAAM,GAAG,EAAE;IAEX,MAAM,GAAG,GAAwC,EAAE,CAAC;IACpD,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,MAAM,KAAK,GAAG,GAAG,CAAC;IAElB,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,CAAC,MAAM,0BAAU,CAAC,IAAI,CACjC,IAAI,EACJ,KAAK,EACL,aAAa,EACb,EAAE,EACF,EAAE,KAAK,EAAE,MAAM,EAAE,CAClB,CAAQ,CAAC;QACV,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,I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Q,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;QACpD,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CACpD,CAAC;IAEF,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC7C,OAAO,EAAE,OAAO,EAAE,CAAC;AACrB,CAAC,CAAC;AAzDW,QAAA,wBAAwB,4BAyDnC;AAEW,QAAA,UAAU,GAAG;IACxB,cAAc,EAAd,sBAAc;IACd,WAAW,EAAX,mBAAW;IACX,iBAAiB,EAAjB,yBAAiB;IACjB,wBAAwB,EAAxB,gCAAwB;CACzB,CAAC"}
|
|
@@ -76,26 +76,14 @@ exports.fieldsInput = {
|
|
|
76
76
|
{
|
|
77
77
|
displayName: 'Field',
|
|
78
78
|
name: 'field',
|
|
79
|
-
type: '
|
|
79
|
+
type: 'options',
|
|
80
80
|
noDataExpression: true,
|
|
81
|
-
|
|
81
|
+
typeOptions: {
|
|
82
|
+
loadOptionsMethod: 'searchTableFieldsMutable',
|
|
83
|
+
loadOptionsDependsOn: ['solutionId.value', 'tableId.value'],
|
|
84
|
+
},
|
|
85
|
+
default: '',
|
|
82
86
|
placeholder: 'Choose a field…',
|
|
83
|
-
typeOptions: { loadOptionsDependsOn: ['solutionId.value', 'tableId.value'], searchListMethod: 'searchTableFieldsMutable', searchable: true },
|
|
84
|
-
modes: [
|
|
85
|
-
{
|
|
86
|
-
name: 'list',
|
|
87
|
-
displayName: 'From list',
|
|
88
|
-
type: 'list',
|
|
89
|
-
placeholder: 'Choose a field…',
|
|
90
|
-
typeOptions: { searchListMethod: 'searchTableFieldsMutable', searchable: true },
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: 'id',
|
|
94
|
-
displayName: 'By ID',
|
|
95
|
-
type: 'string',
|
|
96
|
-
placeholder: 'Field ID',
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
87
|
description: 'Select a field to set',
|
|
100
88
|
},
|
|
101
89
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resourceInputs.js","sourceRoot":"","sources":["../../../../src/nodes/SmartSuite/shared/resourceInputs.ts"],"names":[],"mappings":";AAAA,gDAAgD;;;AAIhD;;GAEG;AACU,QAAA,aAAa,GAAoB;IAC5C,WAAW,EAAO,UAAU;IAC5B,IAAI,EAAc,YAAY;IAC9B,IAAI,EAAc,iBAAiB;IACnC,gBAAgB,EAAE,KAAK;IACvB,OAAO,EAAW,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7C,KAAK,EAAE;QACL;YACE,IAAI,EAAS,MAAM;YACnB,WAAW,EAAE,WAAW;YACxB,IAAI,EAAS,MAAM;YACnB,WAAW,EAAE,oBAAoB;YACjC,WAAW,EAAE,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,IAAI,EAAE;SACtE;QACD;YACE,IAAI,EAAS,IAAI;YACjB,WAAW,EAAE,OAAO;YACpB,IAAI,EAAS,QAAQ;YACrB,WAAW,EAAE,kBAAkB;SAChC;KACF;IACD,WAAW,EAAE,qBAAqB;CACnC,CAAC;AAEF;;;GAGG;AACU,QAAA,UAAU,GAAoB;IACzC,WAAW,EAAO,OAAO;IACzB,IAAI,EAAc,SAAS;IAC3B,IAAI,EAAc,iBAAiB;IACnC,gBAAgB,EAAE,KAAK;IACvB,OAAO,EAAW,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7C,WAAW,EAAO,EAAE,oBAAoB,EAAE,CAAC,kBAAkB,CAAC,EAAE;IAChE,KAAK,EAAE;QACL;YACE,IAAI,EAAS,MAAM;YACnB,WAAW,EAAE,WAAW;YACxB,IAAI,EAAS,MAAM;YACnB,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,EAAE,gBAAgB,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE;SACnE;QACD;YACE,IAAI,EAAS,IAAI;YACjB,WAAW,EAAE,OAAO;YACpB,IAAI,EAAS,QAAQ;YACrB,WAAW,EAAE,eAAe;SAC7B;KACF;IACD,WAAW,EAAE,kBAAkB;CAChC,CAAC;AAEF;;;GAGG;AACU,QAAA,WAAW,GAAoB;IAC1C,WAAW,EAAE,QAAQ;IACrB,IAAI,EAAS,UAAU;IACvB,IAAI,EAAS,iBAAiB;IAC9B,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;IACrC,OAAO,EAAM,EAAE,YAAY,EAAE,EAAE,EAAE;IACjC,WAAW,EAAE,+CAA+C;IAC5D,OAAO,EAAE;QACP;YACE,IAAI,EAAS,cAAc;YAC3B,WAAW,EAAE,OAAO;YACpB,MAAM,EAAE;gBACN;oBACE,WAAW,EAAO,OAAO;oBACzB,IAAI,EAAc,OAAO;oBACzB,IAAI,EAAc,
|
|
1
|
+
{"version":3,"file":"resourceInputs.js","sourceRoot":"","sources":["../../../../src/nodes/SmartSuite/shared/resourceInputs.ts"],"names":[],"mappings":";AAAA,gDAAgD;;;AAIhD;;GAEG;AACU,QAAA,aAAa,GAAoB;IAC5C,WAAW,EAAO,UAAU;IAC5B,IAAI,EAAc,YAAY;IAC9B,IAAI,EAAc,iBAAiB;IACnC,gBAAgB,EAAE,KAAK;IACvB,OAAO,EAAW,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7C,KAAK,EAAE;QACL;YACE,IAAI,EAAS,MAAM;YACnB,WAAW,EAAE,WAAW;YACxB,IAAI,EAAS,MAAM;YACnB,WAAW,EAAE,oBAAoB;YACjC,WAAW,EAAE,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,IAAI,EAAE;SACtE;QACD;YACE,IAAI,EAAS,IAAI;YACjB,WAAW,EAAE,OAAO;YACpB,IAAI,EAAS,QAAQ;YACrB,WAAW,EAAE,kBAAkB;SAChC;KACF;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AC;qBAC5D;oBACD,OAAO,EAAM,EAAE;oBACf,WAAW,EAAE,iBAAiB;oBAC9B,WAAW,EAAE,uBAAuB;iBACrC;gBACD;oBACE,WAAW,EAAE,OAAO;oBACpB,IAAI,EAAS,OAAO;oBACpB,IAAI,EAAS,QAAQ;oBACrB,OAAO,EAAM,EAAE;oBACf,WAAW,EAAE,+BAA+B;iBAC7C;aACF;SACF;KACF;CACF,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { IAllExecuteFunctions, IDataObject, IHttpRequestMethods } from 'n8n-workflow';
|
|
2
2
|
/**
|
|
3
|
-
* Core HTTP request function.
|
|
3
|
+
* Core HTTP request function with retry logic for rate limiting.
|
|
4
|
+
* - Implements exponential backoff for 429 errors
|
|
5
|
+
* - Respects Retry-After headers when provided
|
|
4
6
|
* - customHeaders: extra headers to merge in
|
|
5
7
|
* - absolute-URL detection
|
|
6
8
|
*/
|
|
7
|
-
export declare function apiRequest<T = any>(this: IAllExecuteFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject, customHeaders?: IDataObject): Promise<T>;
|
|
9
|
+
export declare function apiRequest<T = any>(this: IAllExecuteFunctions, method: IHttpRequestMethods, endpoint: string, body?: IDataObject, qs?: IDataObject, customHeaders?: IDataObject, maxRetries?: number): Promise<T>;
|
|
8
10
|
/**
|
|
9
11
|
* Fetch all items from a paginated endpoint (limit/offset).
|
|
10
12
|
*/
|
|
@@ -6,11 +6,17 @@ exports.paginatedRequest = paginatedRequest;
|
|
|
6
6
|
exports.apiRequestAllItems = paginatedRequest;
|
|
7
7
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Helper function to delay execution for retry logic
|
|
10
|
+
*/
|
|
11
|
+
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
12
|
+
/**
|
|
13
|
+
* Core HTTP request function with retry logic for rate limiting.
|
|
14
|
+
* - Implements exponential backoff for 429 errors
|
|
15
|
+
* - Respects Retry-After headers when provided
|
|
10
16
|
* - customHeaders: extra headers to merge in
|
|
11
17
|
* - absolute-URL detection
|
|
12
18
|
*/
|
|
13
|
-
async function apiRequest(method, endpoint, body = {}, qs = {}, customHeaders = {}) {
|
|
19
|
+
async function apiRequest(method, endpoint, body = {}, qs = {}, customHeaders = {}, maxRetries = 5) {
|
|
14
20
|
const creds = await this.getCredentials('smartSuiteApi');
|
|
15
21
|
if (!creds.apiKey || !creds.accountId || !creds.baseUrl) {
|
|
16
22
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Missing required SmartSuite credentials. Please check API Key, Account ID, and Base URL.');
|
|
@@ -46,39 +52,107 @@ async function apiRequest(method, endpoint, body = {}, qs = {}, customHeaders =
|
|
|
46
52
|
json: true,
|
|
47
53
|
body: method === 'GET' ? undefined : body,
|
|
48
54
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (status === 400 &&
|
|
60
|
-
apiError &&
|
|
61
|
-
Object.values(apiError)[0] === 'Not allowed comparison.') {
|
|
62
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid comparison for that field type. See https://developers.smartsuite.com/docs/solution-data/records/sort-filter#operators-by-field-type for valid operators.');
|
|
63
|
-
}
|
|
64
|
-
if (apiError && typeof apiError === 'object') {
|
|
65
|
-
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `SmartSuite API Error (${status}): ${JSON.stringify(apiError)}`);
|
|
55
|
+
// Retry loop with exponential backoff for rate limiting
|
|
56
|
+
let attempt = 0;
|
|
57
|
+
let lastError;
|
|
58
|
+
while (attempt <= maxRetries) {
|
|
59
|
+
try {
|
|
60
|
+
const httpRequest = this.helpers.httpRequest;
|
|
61
|
+
if (typeof httpRequest !== 'function') {
|
|
62
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'HTTP Request helper not available');
|
|
63
|
+
}
|
|
64
|
+
return (await httpRequest(options));
|
|
66
65
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
catch (error) {
|
|
67
|
+
lastError = error;
|
|
68
|
+
const status = error.response?.status;
|
|
69
|
+
const apiError = error.response?.data;
|
|
70
|
+
// Handle rate limiting with retry
|
|
71
|
+
if (status === 429 && attempt < maxRetries) {
|
|
72
|
+
attempt++;
|
|
73
|
+
// Check for Retry-After header
|
|
74
|
+
const retryAfterHeader = error.response?.headers?.['retry-after'];
|
|
75
|
+
let delayMs;
|
|
76
|
+
if (retryAfterHeader) {
|
|
77
|
+
// Retry-After can be in seconds or HTTP date format
|
|
78
|
+
const retryAfterSeconds = parseInt(retryAfterHeader, 10);
|
|
79
|
+
if (!isNaN(retryAfterSeconds)) {
|
|
80
|
+
delayMs = retryAfterSeconds * 1000;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
// Try to parse as date
|
|
84
|
+
const retryDate = new Date(retryAfterHeader);
|
|
85
|
+
if (!isNaN(retryDate.getTime())) {
|
|
86
|
+
delayMs = Math.max(0, retryDate.getTime() - Date.now());
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
// Fallback to exponential backoff
|
|
90
|
+
delayMs = Math.min(30000, 500 * Math.pow(2, attempt - 1));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
// Exponential backoff: 0.5s, 1s, 2s, 4s, 8s... capped at 30s
|
|
96
|
+
delayMs = Math.min(30000, 500 * Math.pow(2, attempt - 1));
|
|
97
|
+
}
|
|
98
|
+
// Log the retry attempt - helpful for debugging
|
|
99
|
+
console.log(`SmartSuite rate limit hit. Automatically retrying in ${(delayMs / 1000).toFixed(1)}s (attempt ${attempt}/${maxRetries})`);
|
|
100
|
+
await sleep(delayMs);
|
|
101
|
+
continue; // Retry the request
|
|
102
|
+
}
|
|
103
|
+
// Handle other errors (non-429 or max retries exceeded)
|
|
104
|
+
if (status === 429) {
|
|
105
|
+
// Max retries exceeded for rate limiting
|
|
106
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'SmartSuite API rate limit exceeded after multiple retries. ' +
|
|
107
|
+
'Please wait a moment before trying again. ' +
|
|
108
|
+
'Tip: If this happens frequently, consider spacing out your operations or reducing the number of simultaneous field selections.', {
|
|
109
|
+
description: 'The SmartSuite API is temporarily limiting requests. This is normal when making many rapid changes.'
|
|
110
|
+
});
|
|
71
111
|
}
|
|
72
|
-
|
|
73
|
-
|
|
112
|
+
if (status === 400 &&
|
|
113
|
+
apiError &&
|
|
114
|
+
Object.values(apiError)[0] === 'Not allowed comparison.') {
|
|
115
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid comparison for that field type. See https://developers.smartsuite.com/docs/solution-data/records/sort-filter#operators-by-field-type for valid operators.');
|
|
74
116
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
117
|
+
if (apiError && typeof apiError === 'object') {
|
|
118
|
+
// Format the error message more user-friendly
|
|
119
|
+
let errorMessage = 'SmartSuite API Error: ';
|
|
120
|
+
// Try to extract a meaningful error message from the API response
|
|
121
|
+
if (apiError.message) {
|
|
122
|
+
errorMessage += apiError.message;
|
|
123
|
+
}
|
|
124
|
+
else if (apiError.error) {
|
|
125
|
+
errorMessage += apiError.error;
|
|
126
|
+
}
|
|
127
|
+
else if (apiError.detail) {
|
|
128
|
+
errorMessage += apiError.detail;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
// Fallback to stringified error
|
|
132
|
+
errorMessage += JSON.stringify(apiError);
|
|
133
|
+
}
|
|
134
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), errorMessage, {
|
|
135
|
+
description: `HTTP ${status} error from SmartSuite API`
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
if (status === 404) {
|
|
139
|
+
let resourceType = 'Record';
|
|
140
|
+
if (originalEndpoint.startsWith('/solutions/')) {
|
|
141
|
+
resourceType = 'Solution';
|
|
142
|
+
}
|
|
143
|
+
else if (originalEndpoint.startsWith('/tables/')) {
|
|
144
|
+
resourceType = 'Table';
|
|
145
|
+
}
|
|
146
|
+
const parts = finalUrl.split('/');
|
|
147
|
+
const id = parts[parts.length - 1] || parts[parts.length - 2];
|
|
148
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource you are requesting could not be found
|
|
78
149
|
${id} is not a valid ${resourceType} ID`);
|
|
150
|
+
}
|
|
151
|
+
throw error;
|
|
79
152
|
}
|
|
80
|
-
throw error;
|
|
81
153
|
}
|
|
154
|
+
// This should never be reached, but just in case
|
|
155
|
+
throw lastError;
|
|
82
156
|
}
|
|
83
157
|
/**
|
|
84
158
|
* Fetch all items from a paginated endpoint (limit/offset).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smartSuiteApi.js","sourceRoot":"","sources":["../../../../src/nodes/SmartSuite/transport/smartSuiteApi.ts"],"names":[],"mappings":";AAAA,kDAAkD;;
|
|
1
|
+
{"version":3,"file":"smartSuiteApi.js","sourceRoot":"","sources":["../../../../src/nodes/SmartSuite/transport/smartSuiteApi.ts"],"names":[],"mappings":";AAAA,kDAAkD;;AAsBlD,gCAqLC;AAKD,4CAqCC;AAE4B,8CAAkB;AA/O/C,+CAAkD;AAElD;;GAEG;AACH,MAAM,KAAK,GAAG,CAAC,EAAU,EAAiB,EAAE,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAE7F;;;;;;GAMG;AACI,KAAK,UAAU,UAAU,CAE9B,MAA2B,EAC3B,QAAgB,EAChB,OAAoB,EAAE,EACtB,KAAkB,EAAE,EACpB,gBAA6B,EAAE,EAC/B,UAAU,GAAG,CAAC;IAEd,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC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,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;QAC5B,IAAI,SAAS,CAAC,MAAM,GAAG,QAAQ;YAAE,MAAM;QACvC,MAAM,IAAI,QAAQ,CAAC;IACrB,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-smartsuite",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.18",
|
|
4
4
|
"description": "n8n community node for SmartSuite",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"lint": "eslint src/**/*.ts",
|
|
38
38
|
"lintfix": "eslint src/**/*.ts --fix",
|
|
39
39
|
"generate:tests": "node scripts/generate-tests.js",
|
|
40
|
-
"test": "jest"
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"load-test": "node scripts/load-test-fields.js"
|
|
41
42
|
},
|
|
42
43
|
"publishConfig": {
|
|
43
44
|
"access": "public"
|