n8n-nodes-smartfetch 0.1.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/LICENSE +674 -0
- package/README.md +65 -0
- package/dist/coverage/favicon.png +0 -0
- package/dist/coverage/sort-arrow-sprite.png +0 -0
- package/dist/nodes/Smartfetch/Smartfetch.node.d.ts +5 -0
- package/dist/nodes/Smartfetch/Smartfetch.node.js +287 -0
- package/dist/nodes/Smartfetch/Smartfetch.node.js.map +1 -0
- package/dist/nodes/Smartfetch/Smartfetch.node.json +18 -0
- package/dist/nodes/Smartfetch/Smartfetch.node.test.d.ts +1 -0
- package/dist/nodes/Smartfetch/Smartfetch.node.test.js +338 -0
- package/dist/nodes/Smartfetch/Smartfetch.node.test.js.map +1 -0
- package/dist/nodes/Smartfetch/cache/index.d.ts +4 -0
- package/dist/nodes/Smartfetch/cache/index.js +23 -0
- package/dist/nodes/Smartfetch/cache/index.js.map +1 -0
- package/dist/nodes/Smartfetch/cache/memory.d.ts +8 -0
- package/dist/nodes/Smartfetch/cache/memory.js +45 -0
- package/dist/nodes/Smartfetch/cache/memory.js.map +1 -0
- package/dist/nodes/Smartfetch/cache/memory.test.d.ts +1 -0
- package/dist/nodes/Smartfetch/cache/memory.test.js +89 -0
- package/dist/nodes/Smartfetch/cache/memory.test.js.map +1 -0
- package/dist/nodes/Smartfetch/cache/postgres.d.ts +23 -0
- package/dist/nodes/Smartfetch/cache/postgres.js +105 -0
- package/dist/nodes/Smartfetch/cache/postgres.js.map +1 -0
- package/dist/nodes/Smartfetch/cache/postgres.test.d.ts +1 -0
- package/dist/nodes/Smartfetch/cache/postgres.test.js +175 -0
- package/dist/nodes/Smartfetch/cache/postgres.test.js.map +1 -0
- package/dist/nodes/Smartfetch/cache/types.d.ts +15 -0
- package/dist/nodes/Smartfetch/cache/types.js +16 -0
- package/dist/nodes/Smartfetch/cache/types.js.map +1 -0
- package/dist/nodes/Smartfetch/smartfetch.dark.svg +13 -0
- package/dist/nodes/Smartfetch/smartfetch.svg +13 -0
- package/dist/package.json +59 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PostgresCacheAdapter = void 0;
|
|
4
|
+
const pg_1 = require("pg");
|
|
5
|
+
class PostgresCacheAdapter {
|
|
6
|
+
constructor(credentials, tableName) {
|
|
7
|
+
this.initialized = false;
|
|
8
|
+
this.initPromise = null;
|
|
9
|
+
let sslConfig;
|
|
10
|
+
if (credentials.ssl === 'disable' || credentials.ssl === false) {
|
|
11
|
+
sslConfig = false;
|
|
12
|
+
}
|
|
13
|
+
else if (credentials.ssl === 'allow' || credentials.ssl === 'require') {
|
|
14
|
+
sslConfig = { rejectUnauthorized: false };
|
|
15
|
+
}
|
|
16
|
+
else if (credentials.ssl === 'verify-ca' || credentials.ssl === 'verify-full') {
|
|
17
|
+
sslConfig = { rejectUnauthorized: true };
|
|
18
|
+
}
|
|
19
|
+
else if (credentials.ssl === true || credentials.ssl === undefined) {
|
|
20
|
+
sslConfig = { rejectUnauthorized: false };
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
sslConfig = { rejectUnauthorized: false };
|
|
24
|
+
}
|
|
25
|
+
this.client = new pg_1.Client({
|
|
26
|
+
host: credentials.host,
|
|
27
|
+
port: credentials.port,
|
|
28
|
+
database: credentials.database,
|
|
29
|
+
user: credentials.user,
|
|
30
|
+
password: credentials.password,
|
|
31
|
+
ssl: sslConfig,
|
|
32
|
+
});
|
|
33
|
+
this.tableName = tableName;
|
|
34
|
+
}
|
|
35
|
+
async ensureInitialized() {
|
|
36
|
+
if (this.initialized)
|
|
37
|
+
return;
|
|
38
|
+
if (!this.initPromise) {
|
|
39
|
+
this.initPromise = this.doInitialize();
|
|
40
|
+
}
|
|
41
|
+
return this.initPromise;
|
|
42
|
+
}
|
|
43
|
+
async doInitialize() {
|
|
44
|
+
await this.client.connect();
|
|
45
|
+
try {
|
|
46
|
+
await this.client.query(`
|
|
47
|
+
CREATE TABLE IF NOT EXISTS ${this.escapeName(this.tableName)} (
|
|
48
|
+
key VARCHAR(255) PRIMARY KEY,
|
|
49
|
+
request_url TEXT,
|
|
50
|
+
response JSONB,
|
|
51
|
+
cached_at TIMESTAMPTZ,
|
|
52
|
+
ttl INT
|
|
53
|
+
)
|
|
54
|
+
`);
|
|
55
|
+
this.initialized = true;
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
await this.client.end();
|
|
59
|
+
this.initPromise = null;
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
escapeName(name) {
|
|
64
|
+
const sanitized = name.replace(/[^a-zA-Z0-9_]/g, '');
|
|
65
|
+
const escaped = sanitized.replace(/"/g, '""');
|
|
66
|
+
return `"${escaped}"`;
|
|
67
|
+
}
|
|
68
|
+
async get(key) {
|
|
69
|
+
await this.ensureInitialized();
|
|
70
|
+
const result = await this.client.query(`SELECT key, request_url, response, cached_at, ttl FROM ${this.escapeName(this.tableName)} WHERE key = $1`, [key]);
|
|
71
|
+
if (result.rows.length === 0) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
const row = result.rows[0];
|
|
75
|
+
return {
|
|
76
|
+
key: row.key,
|
|
77
|
+
requestUrl: row.request_url,
|
|
78
|
+
response: JSON.stringify(row.response),
|
|
79
|
+
cachedAt: new Date(row.cached_at).getTime(),
|
|
80
|
+
ttl: row.ttl,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
async set(entry) {
|
|
84
|
+
await this.ensureInitialized();
|
|
85
|
+
await this.client.query(`INSERT INTO ${this.escapeName(this.tableName)} (key, request_url, response, cached_at, ttl)
|
|
86
|
+
VALUES ($1, $2, $3, $4, $5)
|
|
87
|
+
ON CONFLICT (key) DO UPDATE SET
|
|
88
|
+
request_url = EXCLUDED.request_url,
|
|
89
|
+
response = EXCLUDED.response,
|
|
90
|
+
cached_at = EXCLUDED.cached_at,
|
|
91
|
+
ttl = EXCLUDED.ttl`, [entry.key, entry.requestUrl, JSON.parse(entry.response), new Date(entry.cachedAt), entry.ttl]);
|
|
92
|
+
}
|
|
93
|
+
async delete(key) {
|
|
94
|
+
await this.ensureInitialized();
|
|
95
|
+
await this.client.query(`DELETE FROM ${this.escapeName(this.tableName)} WHERE key = $1`, [key]);
|
|
96
|
+
}
|
|
97
|
+
async close() {
|
|
98
|
+
if (this.initialized) {
|
|
99
|
+
await this.client.end();
|
|
100
|
+
this.initialized = false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.PostgresCacheAdapter = PostgresCacheAdapter;
|
|
105
|
+
//# sourceMappingURL=postgres.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres.js","sourceRoot":"","sources":["../../../../nodes/Smartfetch/cache/postgres.ts"],"names":[],"mappings":";;;AAAA,2BAA4B;AAY5B,MAAa,oBAAoB;IAMhC,YAAY,WAAgC,EAAE,SAAiB;QAHvD,gBAAW,GAAG,KAAK,CAAC;QACpB,gBAAW,GAAyB,IAAI,CAAC;QAIhD,IAAI,SAAgE,CAAC;QAErE,IAAI,WAAW,CAAC,GAAG,KAAK,SAAS,IAAI,WAAW,CAAC,GAAG,KAAK,KAAK,EAAE,CAAC;YAEhE,SAAS,GAAG,KAAK,CAAC;QACnB,CAAC;aAAM,IAAI,WAAW,CAAC,GAAG,KAAK,OAAO,IAAI,WAAW,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;YAEzE,SAAS,GAAG,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC;QAC3C,CAAC;aAAM,IAAI,WAAW,CAAC,GAAG,KAAK,WAAW,IAAI,WAAW,CAAC,GAAG,KAAK,aAAa,EAAE,CAAC;YAEjF,SAAS,GAAG,EAAE,kBAAkB,EAAE,IAAI,EAAE,CA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CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAC9F,CAAC;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW;QACvB,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC/B,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,eAAe,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAC/D,CAAC,GAAG,CAAC,CACL,CAAC;IACH,CAAC;IAED,KAAK,CAAC,KAAK;QACV,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;YACxB,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QAC1B,CAAC;IACF,CAAC;CACD;AArID,oDAqIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const vitest_1 = require("vitest");
|
|
4
|
+
const postgres_1 = require("./postgres");
|
|
5
|
+
let mockClientInstance;
|
|
6
|
+
let constructorCalls = [];
|
|
7
|
+
vitest_1.vi.mock('pg', () => {
|
|
8
|
+
return {
|
|
9
|
+
Client: class MockClient {
|
|
10
|
+
constructor(...args) {
|
|
11
|
+
constructorCalls.push(args);
|
|
12
|
+
this.connect = vitest_1.vi.fn().mockResolvedValue(undefined);
|
|
13
|
+
this.query = vitest_1.vi.fn().mockResolvedValue({ rows: [] });
|
|
14
|
+
this.end = vitest_1.vi.fn().mockResolvedValue(undefined);
|
|
15
|
+
mockClientInstance = this;
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
(0, vitest_1.describe)('PostgresCacheAdapter', () => {
|
|
21
|
+
let adapter;
|
|
22
|
+
const credentials = {
|
|
23
|
+
host: 'localhost',
|
|
24
|
+
port: 5432,
|
|
25
|
+
database: 'testdb',
|
|
26
|
+
user: 'testuser',
|
|
27
|
+
password: 'testpass',
|
|
28
|
+
};
|
|
29
|
+
(0, vitest_1.beforeEach)(() => {
|
|
30
|
+
vitest_1.vi.clearAllMocks();
|
|
31
|
+
constructorCalls = [];
|
|
32
|
+
adapter = new postgres_1.PostgresCacheAdapter(credentials, 'test_cache');
|
|
33
|
+
});
|
|
34
|
+
function createEntry(overrides = {}) {
|
|
35
|
+
return {
|
|
36
|
+
key: 'test-key-hash',
|
|
37
|
+
requestUrl: 'https://example.com/api',
|
|
38
|
+
response: JSON.stringify({ data: 'test' }),
|
|
39
|
+
cachedAt: Date.now(),
|
|
40
|
+
ttl: 3600,
|
|
41
|
+
...overrides,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
(0, vitest_1.describe)('constructor SSL configuration', () => {
|
|
45
|
+
(0, vitest_1.it)('should disable SSL when ssl is "disable"', () => {
|
|
46
|
+
constructorCalls = [];
|
|
47
|
+
new postgres_1.PostgresCacheAdapter({ ...credentials, ssl: 'disable' }, 'cache');
|
|
48
|
+
(0, vitest_1.expect)(constructorCalls[0][0]).toMatchObject({ ssl: false });
|
|
49
|
+
});
|
|
50
|
+
(0, vitest_1.it)('should disable SSL when ssl is false', () => {
|
|
51
|
+
constructorCalls = [];
|
|
52
|
+
new postgres_1.PostgresCacheAdapter({ ...credentials, ssl: false }, 'cache');
|
|
53
|
+
(0, vitest_1.expect)(constructorCalls[0][0]).toMatchObject({ ssl: false });
|
|
54
|
+
});
|
|
55
|
+
(0, vitest_1.it)('should use rejectUnauthorized: false for "allow" mode', () => {
|
|
56
|
+
constructorCalls = [];
|
|
57
|
+
new postgres_1.PostgresCacheAdapter({ ...credentials, ssl: 'allow' }, 'cache');
|
|
58
|
+
(0, vitest_1.expect)(constructorCalls[0][0]).toMatchObject({ ssl: { rejectUnauthorized: false } });
|
|
59
|
+
});
|
|
60
|
+
(0, vitest_1.it)('should use rejectUnauthorized: false for "require" mode', () => {
|
|
61
|
+
constructorCalls = [];
|
|
62
|
+
new postgres_1.PostgresCacheAdapter({ ...credentials, ssl: 'require' }, 'cache');
|
|
63
|
+
(0, vitest_1.expect)(constructorCalls[0][0]).toMatchObject({ ssl: { rejectUnauthorized: false } });
|
|
64
|
+
});
|
|
65
|
+
(0, vitest_1.it)('should use rejectUnauthorized: true for "verify-ca" mode', () => {
|
|
66
|
+
constructorCalls = [];
|
|
67
|
+
new postgres_1.PostgresCacheAdapter({ ...credentials, ssl: 'verify-ca' }, 'cache');
|
|
68
|
+
(0, vitest_1.expect)(constructorCalls[0][0]).toMatchObject({ ssl: { rejectUnauthorized: true } });
|
|
69
|
+
});
|
|
70
|
+
(0, vitest_1.it)('should use rejectUnauthorized: true for "verify-full" mode', () => {
|
|
71
|
+
constructorCalls = [];
|
|
72
|
+
new postgres_1.PostgresCacheAdapter({ ...credentials, ssl: 'verify-full' }, 'cache');
|
|
73
|
+
(0, vitest_1.expect)(constructorCalls[0][0]).toMatchObject({ ssl: { rejectUnauthorized: true } });
|
|
74
|
+
});
|
|
75
|
+
(0, vitest_1.it)('should default to rejectUnauthorized: false when ssl is undefined', () => {
|
|
76
|
+
constructorCalls = [];
|
|
77
|
+
new postgres_1.PostgresCacheAdapter({ ...credentials, ssl: undefined }, 'cache');
|
|
78
|
+
(0, vitest_1.expect)(constructorCalls[0][0]).toMatchObject({ ssl: { rejectUnauthorized: false } });
|
|
79
|
+
});
|
|
80
|
+
(0, vitest_1.it)('should default to rejectUnauthorized: false when ssl is true', () => {
|
|
81
|
+
constructorCalls = [];
|
|
82
|
+
new postgres_1.PostgresCacheAdapter({ ...credentials, ssl: true }, 'cache');
|
|
83
|
+
(0, vitest_1.expect)(constructorCalls[0][0]).toMatchObject({ ssl: { rejectUnauthorized: false } });
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
(0, vitest_1.describe)('initialization', () => {
|
|
87
|
+
(0, vitest_1.it)('should connect and create table on first operation', async () => {
|
|
88
|
+
mockClientInstance.query.mockResolvedValueOnce({ rows: [] });
|
|
89
|
+
mockClientInstance.query.mockResolvedValueOnce({ rows: [] });
|
|
90
|
+
await adapter.get('some-key');
|
|
91
|
+
(0, vitest_1.expect)(mockClientInstance.connect).toHaveBeenCalledOnce();
|
|
92
|
+
(0, vitest_1.expect)(mockClientInstance.query).toHaveBeenCalledWith(vitest_1.expect.stringContaining('CREATE TABLE IF NOT EXISTS'));
|
|
93
|
+
});
|
|
94
|
+
(0, vitest_1.it)('should only initialize once across multiple operations', async () => {
|
|
95
|
+
mockClientInstance.query.mockResolvedValue({ rows: [] });
|
|
96
|
+
await adapter.get('key1');
|
|
97
|
+
await adapter.get('key2');
|
|
98
|
+
await adapter.get('key3');
|
|
99
|
+
(0, vitest_1.expect)(mockClientInstance.connect).toHaveBeenCalledOnce();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
(0, vitest_1.describe)('get', () => {
|
|
103
|
+
(0, vitest_1.it)('should return null when entry does not exist', async () => {
|
|
104
|
+
mockClientInstance.query.mockResolvedValueOnce({ rows: [] });
|
|
105
|
+
mockClientInstance.query.mockResolvedValueOnce({ rows: [] });
|
|
106
|
+
const result = await adapter.get('non-existent-key');
|
|
107
|
+
(0, vitest_1.expect)(result).toBeNull();
|
|
108
|
+
});
|
|
109
|
+
(0, vitest_1.it)('should return cache entry when found', async () => {
|
|
110
|
+
const cachedAt = new Date();
|
|
111
|
+
mockClientInstance.query.mockResolvedValueOnce({ rows: [] });
|
|
112
|
+
mockClientInstance.query.mockResolvedValueOnce({
|
|
113
|
+
rows: [
|
|
114
|
+
{
|
|
115
|
+
key: 'test-key',
|
|
116
|
+
request_url: 'https://example.com',
|
|
117
|
+
response: { data: 'test' },
|
|
118
|
+
cached_at: cachedAt,
|
|
119
|
+
ttl: 3600,
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
});
|
|
123
|
+
const result = await adapter.get('test-key');
|
|
124
|
+
(0, vitest_1.expect)(result).toEqual({
|
|
125
|
+
key: 'test-key',
|
|
126
|
+
requestUrl: 'https://example.com',
|
|
127
|
+
response: JSON.stringify({ data: 'test' }),
|
|
128
|
+
cachedAt: cachedAt.getTime(),
|
|
129
|
+
ttl: 3600,
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
(0, vitest_1.describe)('set', () => {
|
|
134
|
+
(0, vitest_1.it)('should insert or update cache entry', async () => {
|
|
135
|
+
mockClientInstance.query.mockResolvedValue({ rows: [] });
|
|
136
|
+
const entry = createEntry();
|
|
137
|
+
await adapter.set(entry);
|
|
138
|
+
const insertCall = mockClientInstance.query.mock.calls[1];
|
|
139
|
+
(0, vitest_1.expect)(insertCall[0]).toContain('INSERT INTO');
|
|
140
|
+
(0, vitest_1.expect)(insertCall[0]).toContain('ON CONFLICT');
|
|
141
|
+
(0, vitest_1.expect)(insertCall[1]).toContain(entry.key);
|
|
142
|
+
(0, vitest_1.expect)(insertCall[1]).toContain(entry.requestUrl);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
(0, vitest_1.describe)('delete', () => {
|
|
146
|
+
(0, vitest_1.it)('should delete cache entry by key', async () => {
|
|
147
|
+
mockClientInstance.query.mockResolvedValue({ rows: [] });
|
|
148
|
+
await adapter.delete('key-to-delete');
|
|
149
|
+
const deleteCall = mockClientInstance.query.mock.calls[1];
|
|
150
|
+
(0, vitest_1.expect)(deleteCall[0]).toContain('DELETE FROM');
|
|
151
|
+
(0, vitest_1.expect)(deleteCall[1]).toEqual(['key-to-delete']);
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
(0, vitest_1.describe)('close', () => {
|
|
155
|
+
(0, vitest_1.it)('should close the database connection', async () => {
|
|
156
|
+
mockClientInstance.query.mockResolvedValue({ rows: [] });
|
|
157
|
+
await adapter.get('some-key');
|
|
158
|
+
await adapter.close();
|
|
159
|
+
(0, vitest_1.expect)(mockClientInstance.end).toHaveBeenCalledOnce();
|
|
160
|
+
});
|
|
161
|
+
(0, vitest_1.it)('should not throw if called before initialization', async () => {
|
|
162
|
+
await (0, vitest_1.expect)(adapter.close()).resolves.toBeUndefined();
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
(0, vitest_1.describe)('table name escaping', () => {
|
|
166
|
+
(0, vitest_1.it)('should properly escape table names', async () => {
|
|
167
|
+
constructorCalls = [];
|
|
168
|
+
const adapterWithSpecialName = new postgres_1.PostgresCacheAdapter(credentials, 'my_cache_table');
|
|
169
|
+
mockClientInstance.query.mockResolvedValue({ rows: [] });
|
|
170
|
+
await adapterWithSpecialName.get('key');
|
|
171
|
+
(0, vitest_1.expect)(mockClientInstance.query).toHaveBeenCalledWith(vitest_1.expect.stringContaining('"my_cache_table"'));
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
//# sourceMappingURL=postgres.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres.test.js","sourceRoot":"","sources":["../../../../nodes/Smartfetch/cache/postgres.test.ts"],"names":[],"mappings":";;AAAA,mCAAyE;AACzE,yCAA4E;AAI5E,IAAI,kBAIH,CAAC;AACF,IAAI,gBAAgB,GAAgB,EAAE,CAAC;AAGvC,WAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE;IAClB,OAAO;QACN,MAAM,EAAE,MAAM,UAAU;YAKvB,YAAY,GAAG,IAAe;gBAC7B,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC5B,IAAI,CAAC,OAAO,GAAG,WAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;gBACpD,IAAI,CAAC,KAAK,GAAG,WAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,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AC,oBAAoB,CACpD,eAAM,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAC3C,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface CacheEntry {
|
|
2
|
+
key: string;
|
|
3
|
+
requestUrl: string;
|
|
4
|
+
response: string;
|
|
5
|
+
cachedAt: number;
|
|
6
|
+
ttl: number;
|
|
7
|
+
}
|
|
8
|
+
export interface CacheAdapter {
|
|
9
|
+
get(key: string): Promise<CacheEntry | null>;
|
|
10
|
+
set(entry: CacheEntry): Promise<void>;
|
|
11
|
+
delete(key: string): Promise<void>;
|
|
12
|
+
close?(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export declare function isCacheValid(entry: CacheEntry): boolean;
|
|
15
|
+
export declare function generateCacheKey(url: string, credentialHash?: string): string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isCacheValid = isCacheValid;
|
|
4
|
+
exports.generateCacheKey = generateCacheKey;
|
|
5
|
+
const crypto_1 = require("crypto");
|
|
6
|
+
function isCacheValid(entry) {
|
|
7
|
+
const now = Date.now();
|
|
8
|
+
const safeTtlMs = Math.min(entry.ttl * 1000, 2147483647);
|
|
9
|
+
const expiresAt = entry.cachedAt + safeTtlMs;
|
|
10
|
+
return now < expiresAt;
|
|
11
|
+
}
|
|
12
|
+
function generateCacheKey(url, credentialHash) {
|
|
13
|
+
const base = credentialHash ? `${credentialHash}:${url}` : url;
|
|
14
|
+
return (0, crypto_1.createHash)('sha256').update(base).digest('hex');
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../nodes/Smartfetch/cache/types.ts"],"names":[],"mappings":";;AAiBA,oCAMC;AAOD,4CAGC;AAjCD,mCAAoC;AAiBpC,SAAgB,YAAY,CAAC,KAAiB;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEvB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC;IACzD,MAAM,SAAS,GAAG,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC;IAC7C,OAAO,GAAG,GAAG,SAAS,CAAC;AACxB,CAAC;AAOD,SAAgB,gBAAgB,CAAC,GAAW,EAAE,cAAuB;IACpE,MAAM,IAAI,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,cAAc,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IAC/D,OAAO,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="aquamarine"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cpu">
|
|
3
|
+
<rect x="4" y="4" width="16" height="16" rx="2" ry="2"></rect>
|
|
4
|
+
<rect x="9" y="9" width="6" height="6"></rect>
|
|
5
|
+
<line x1="9" y1="1" x2="9" y2="4"></line>
|
|
6
|
+
<line x1="15" y1="1" x2="15" y2="4"></line>
|
|
7
|
+
<line x1="9" y1="20" x2="9" y2="23"></line>
|
|
8
|
+
<line x1="15" y1="20" x2="15" y2="23"></line>
|
|
9
|
+
<line x1="20" y1="9" x2="23" y2="9"></line>
|
|
10
|
+
<line x1="20" y1="14" x2="23" y2="14"></line>
|
|
11
|
+
<line x1="1" y1="9" x2="4" y2="9"></line>
|
|
12
|
+
<line x1="1" y1="14" x2="4" y2="14"></line>
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="darkblue"
|
|
2
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-cpu">
|
|
3
|
+
<rect x="4" y="4" width="16" height="16" rx="2" ry="2"></rect>
|
|
4
|
+
<rect x="9" y="9" width="6" height="6"></rect>
|
|
5
|
+
<line x1="9" y1="1" x2="9" y2="4"></line>
|
|
6
|
+
<line x1="15" y1="1" x2="15" y2="4"></line>
|
|
7
|
+
<line x1="9" y1="20" x2="9" y2="23"></line>
|
|
8
|
+
<line x1="15" y1="20" x2="15" y2="23"></line>
|
|
9
|
+
<line x1="20" y1="9" x2="23" y2="9"></line>
|
|
10
|
+
<line x1="20" y1="14" x2="23" y2="14"></line>
|
|
11
|
+
<line x1="1" y1="9" x2="4" y2="9"></line>
|
|
12
|
+
<line x1="1" y1="14" x2="4" y2="14"></line>
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "n8n-nodes-smartfetch",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "n8n community node that provides HTTP GET requests with built-in caching",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/meetbryce/n8n-nodes-smartfetch",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"n8n-community-node-package",
|
|
9
|
+
"n8n-community-node",
|
|
10
|
+
"n8n-node",
|
|
11
|
+
"n8n-nodes-smartfetch"
|
|
12
|
+
],
|
|
13
|
+
"author": {
|
|
14
|
+
"name": "Bryce York",
|
|
15
|
+
"email": "bryce@meetbryce.com"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/meetbryce/n8n-nodes-smartfetch.git"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "n8n-node build",
|
|
23
|
+
"build:watch": "tsc --watch",
|
|
24
|
+
"dev": "n8n-node dev",
|
|
25
|
+
"lint": "n8n-node lint",
|
|
26
|
+
"lint:fix": "n8n-node lint --fix",
|
|
27
|
+
"test": "vitest run",
|
|
28
|
+
"test:watch": "vitest",
|
|
29
|
+
"test:coverage": "vitest run --coverage",
|
|
30
|
+
"release": "n8n-node release",
|
|
31
|
+
"prepublishOnly": "n8n-node prerelease"
|
|
32
|
+
},
|
|
33
|
+
"files": [
|
|
34
|
+
"dist"
|
|
35
|
+
],
|
|
36
|
+
"n8n": {
|
|
37
|
+
"n8nNodesApiVersion": 1,
|
|
38
|
+
"strict": false,
|
|
39
|
+
"nodes": [
|
|
40
|
+
"dist/nodes/Smartfetch/Smartfetch.node.js"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@n8n/node-cli": "*",
|
|
45
|
+
"@types/pg": "^8.16.0",
|
|
46
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
47
|
+
"eslint": "9.32.0",
|
|
48
|
+
"prettier": "3.6.2",
|
|
49
|
+
"release-it": "^19.0.4",
|
|
50
|
+
"typescript": "5.9.2",
|
|
51
|
+
"vitest": "^4.0.16"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"n8n-workflow": "*"
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"pg": "^8.16.3"
|
|
58
|
+
}
|
|
59
|
+
}
|