@prisma/n8n-nodes-prisma 0.0.0-stage → 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 +21 -0
- package/README.md +319 -2
- package/dist/credentials/PrismaApi.credentials.d.ts +10 -0
- package/dist/credentials/PrismaApi.credentials.js +39 -0
- package/dist/credentials/PrismaApi.credentials.js.map +1 -0
- package/dist/credentials/prisma.dark.svg +5 -0
- package/dist/credentials/prisma.svg +5 -0
- package/dist/nodes/PrismaPostgres/PrismaPostgres.node.d.ts +17 -0
- package/dist/nodes/PrismaPostgres/PrismaPostgres.node.js +301 -0
- package/dist/nodes/PrismaPostgres/PrismaPostgres.node.js.map +1 -0
- package/dist/nodes/PrismaPostgres/PrismaPostgres.node.json +19 -0
- package/dist/nodes/PrismaPostgres/connection.d.ts +13 -0
- package/dist/nodes/PrismaPostgres/connection.js +81 -0
- package/dist/nodes/PrismaPostgres/connection.js.map +1 -0
- package/dist/nodes/PrismaPostgres/descriptions.d.ts +4 -0
- package/dist/nodes/PrismaPostgres/descriptions.js +389 -0
- package/dist/nodes/PrismaPostgres/descriptions.js.map +1 -0
- package/dist/nodes/PrismaPostgres/prisma.dark.svg +5 -0
- package/dist/nodes/PrismaPostgres/prisma.svg +5 -0
- package/dist/nodes/PrismaPostgres/transport.d.ts +11 -0
- package/dist/nodes/PrismaPostgres/transport.js +136 -0
- package/dist/nodes/PrismaPostgres/transport.js.map +1 -0
- package/dist/package.json +76 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +75 -5
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrismaPostgres = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const connection_1 = require("./connection");
|
|
6
|
+
const descriptions_1 = require("./descriptions");
|
|
7
|
+
const transport_1 = require("./transport");
|
|
8
|
+
const READY_POLL_INTERVAL_MS = 2000;
|
|
9
|
+
const READY_TIMEOUT_MS = 120000;
|
|
10
|
+
const SEARCH_MAX_PAGES = 10;
|
|
11
|
+
function unwrap(response) {
|
|
12
|
+
var _a;
|
|
13
|
+
return ((_a = response.data) !== null && _a !== void 0 ? _a : response);
|
|
14
|
+
}
|
|
15
|
+
async function searchList(context, path, label, filter, paginationToken) {
|
|
16
|
+
var _a;
|
|
17
|
+
const needle = filter === null || filter === void 0 ? void 0 : filter.trim().toLowerCase();
|
|
18
|
+
const results = [];
|
|
19
|
+
let cursor = paginationToken;
|
|
20
|
+
for (let page = 0; page < (needle ? SEARCH_MAX_PAGES : 1); page++) {
|
|
21
|
+
const qs = { limit: transport_1.PAGE_SIZE };
|
|
22
|
+
if (cursor)
|
|
23
|
+
qs.cursor = cursor;
|
|
24
|
+
const response = await transport_1.prismaApiRequest.call(context, 'GET', path, undefined, qs);
|
|
25
|
+
const entries = Array.isArray(response.data) ? response.data : [];
|
|
26
|
+
for (const entry of entries) {
|
|
27
|
+
const name = label(entry);
|
|
28
|
+
if (needle && !name.toLowerCase().includes(needle))
|
|
29
|
+
continue;
|
|
30
|
+
results.push({ name, value: String(entry.id) });
|
|
31
|
+
}
|
|
32
|
+
const pagination = ((_a = response.pagination) !== null && _a !== void 0 ? _a : {});
|
|
33
|
+
cursor = pagination.hasMore && pagination.nextCursor ? pagination.nextCursor : undefined;
|
|
34
|
+
if (!cursor)
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
return { results, paginationToken: cursor };
|
|
38
|
+
}
|
|
39
|
+
async function loadRegions(context) {
|
|
40
|
+
const response = await transport_1.prismaApiRequest.call(context, 'GET', '/regions/postgres');
|
|
41
|
+
const regions = Array.isArray(response.data) ? response.data : [];
|
|
42
|
+
return regions
|
|
43
|
+
.filter((region) => region.status !== 'unavailable')
|
|
44
|
+
.map((region) => ({ name: `${region.name} (${region.id})`, value: String(region.id) }));
|
|
45
|
+
}
|
|
46
|
+
async function waitForDatabase(context, database, itemIndex) {
|
|
47
|
+
let status = database.status;
|
|
48
|
+
const deadline = Date.now() + READY_TIMEOUT_MS;
|
|
49
|
+
while (status === 'provisioning' || status === 'recovering') {
|
|
50
|
+
if (Date.now() >= deadline) {
|
|
51
|
+
throw new n8n_workflow_1.NodeOperationError(context.getNode(), `Database ${String(database.id)} is still provisioning after ${READY_TIMEOUT_MS / 1000} seconds`, {
|
|
52
|
+
itemIndex,
|
|
53
|
+
description: 'The database was created and needs more time to become ready, so check its status with the Get operation or turn off Wait Until Ready to continue without waiting.',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
await (0, n8n_workflow_1.sleep)(READY_POLL_INTERVAL_MS);
|
|
57
|
+
const latest = unwrap(await transport_1.prismaApiRequest.call(context, 'GET', `/databases/${encodeURIComponent(String(database.id))}`, undefined, undefined, itemIndex));
|
|
58
|
+
status = latest.status;
|
|
59
|
+
}
|
|
60
|
+
if (status === 'failure') {
|
|
61
|
+
throw new n8n_workflow_1.NodeOperationError(context.getNode(), `Prisma could not provision database ${String(database.id)}`, {
|
|
62
|
+
itemIndex,
|
|
63
|
+
description: 'Delete the database and create it again, and contact Prisma support if the same thing keeps happening.',
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return { ...database, status };
|
|
67
|
+
}
|
|
68
|
+
function shapeCreatedDatabase(database, options) {
|
|
69
|
+
var _a, _b, _c, _d;
|
|
70
|
+
const output = (0, connection_1.redactSecrets)(database);
|
|
71
|
+
if (options.includeConnectionDetails !== true)
|
|
72
|
+
return output;
|
|
73
|
+
const connections = Array.isArray(database.connections)
|
|
74
|
+
? database.connections
|
|
75
|
+
: [];
|
|
76
|
+
const preferred = (_b = (_a = connections.find((entry) => entry.id === database.defaultConnectionId)) !== null && _a !== void 0 ? _a : connections.find((entry) => entry.kind === 'postgres')) !== null && _b !== void 0 ? _b : connections[0];
|
|
77
|
+
if (!preferred)
|
|
78
|
+
return output;
|
|
79
|
+
const connection = {
|
|
80
|
+
...preferred,
|
|
81
|
+
database: (_c = preferred.database) !== null && _c !== void 0 ? _c : { id: database.id, name: database.name },
|
|
82
|
+
};
|
|
83
|
+
output.connection = (0, connection_1.toConnectionDetails)(connection, (_d = options.endpointType) !== null && _d !== void 0 ? _d : 'pooled');
|
|
84
|
+
return output;
|
|
85
|
+
}
|
|
86
|
+
function requireId(context, value, label, itemIndex) {
|
|
87
|
+
const id = typeof value === 'string' ? value.trim() : '';
|
|
88
|
+
if (id === '') {
|
|
89
|
+
throw new n8n_workflow_1.NodeOperationError(context.getNode(), `No ${label} was provided`, {
|
|
90
|
+
itemIndex,
|
|
91
|
+
description: `Select a ${label} from the list, or switch to By ID and enter its ID.`,
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return encodeURIComponent(id);
|
|
95
|
+
}
|
|
96
|
+
class PrismaPostgres {
|
|
97
|
+
constructor() {
|
|
98
|
+
this.description = {
|
|
99
|
+
displayName: 'Prisma Postgres',
|
|
100
|
+
name: 'prismaPostgres',
|
|
101
|
+
icon: { light: 'file:prisma.svg', dark: 'file:prisma.dark.svg' },
|
|
102
|
+
group: ['transform'],
|
|
103
|
+
version: 1,
|
|
104
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
105
|
+
description: 'Create and manage Prisma Postgres databases and their connections',
|
|
106
|
+
defaults: {
|
|
107
|
+
name: 'Prisma Postgres',
|
|
108
|
+
},
|
|
109
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
110
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
111
|
+
usableAsTool: true,
|
|
112
|
+
credentials: [
|
|
113
|
+
{
|
|
114
|
+
name: 'prismaApi',
|
|
115
|
+
required: true,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
properties: [descriptions_1.resource, ...descriptions_1.operations, ...descriptions_1.fields],
|
|
119
|
+
};
|
|
120
|
+
this.methods = {
|
|
121
|
+
listSearch: {
|
|
122
|
+
async searchWorkspaces(filter, paginationToken) {
|
|
123
|
+
return await searchList(this, '/workspaces', (entry) => String(entry.name), filter, paginationToken);
|
|
124
|
+
},
|
|
125
|
+
async searchProjects(filter, paginationToken) {
|
|
126
|
+
return await searchList(this, '/projects', (entry) => String(entry.name), filter, paginationToken);
|
|
127
|
+
},
|
|
128
|
+
async searchDatabases(filter, paginationToken) {
|
|
129
|
+
return await searchList(this, '/databases', (entry) => {
|
|
130
|
+
var _a;
|
|
131
|
+
const project = ((_a = entry.project) !== null && _a !== void 0 ? _a : {});
|
|
132
|
+
return project.name
|
|
133
|
+
? `${String(project.name)} / ${String(entry.name)}`
|
|
134
|
+
: String(entry.name);
|
|
135
|
+
}, filter, paginationToken);
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
loadOptions: {
|
|
139
|
+
async getRegions() {
|
|
140
|
+
return await loadRegions(this);
|
|
141
|
+
},
|
|
142
|
+
async getDatabaseRegions() {
|
|
143
|
+
return [{ name: 'Same as Project', value: 'inherit' }, ...(await loadRegions(this))];
|
|
144
|
+
},
|
|
145
|
+
async getWorkspaces() {
|
|
146
|
+
const workspaces = await transport_1.prismaApiRequestAllItems.call(this, '/workspaces');
|
|
147
|
+
return workspaces.map((workspace) => ({
|
|
148
|
+
name: String(workspace.name),
|
|
149
|
+
value: String(workspace.id),
|
|
150
|
+
}));
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
async execute() {
|
|
156
|
+
const items = this.getInputData();
|
|
157
|
+
const returnData = [];
|
|
158
|
+
for (let i = 0; i < items.length; i++) {
|
|
159
|
+
try {
|
|
160
|
+
const resourceName = this.getNodeParameter('resource', i);
|
|
161
|
+
const operation = this.getNodeParameter('operation', i);
|
|
162
|
+
let result;
|
|
163
|
+
const locatorId = (name, label) => requireId(this, this.getNodeParameter(name, i, '', { extractValue: true }), label, i);
|
|
164
|
+
const listLimit = () => this.getNodeParameter('returnAll', i, false)
|
|
165
|
+
? undefined
|
|
166
|
+
: this.getNodeParameter('limit', i, 50);
|
|
167
|
+
if (resourceName === 'workspace' && operation === 'get') {
|
|
168
|
+
const id = locatorId('workspaceId', 'workspace');
|
|
169
|
+
result = unwrap(await transport_1.prismaApiRequest.call(this, 'GET', `/workspaces/${id}`, undefined, undefined, i));
|
|
170
|
+
}
|
|
171
|
+
else if (resourceName === 'workspace' && operation === 'getAll') {
|
|
172
|
+
result = await transport_1.prismaApiRequestAllItems.call(this, '/workspaces', {}, listLimit(), i);
|
|
173
|
+
}
|
|
174
|
+
else if (resourceName === 'project' && operation === 'create') {
|
|
175
|
+
const options = this.getNodeParameter('options', i, {});
|
|
176
|
+
const name = this.getNodeParameter('name', i).trim();
|
|
177
|
+
if (name === '') {
|
|
178
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The project needs a name', {
|
|
179
|
+
itemIndex: i,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
const body = { name, createDatabase: options.createDatabase !== false };
|
|
183
|
+
const region = this.getNodeParameter('region', i, '');
|
|
184
|
+
if (region)
|
|
185
|
+
body.region = region;
|
|
186
|
+
if (options.workspaceId)
|
|
187
|
+
body.workspaceId = options.workspaceId;
|
|
188
|
+
const project = unwrap(await transport_1.prismaApiRequest.call(this, 'POST', '/projects', body, undefined, i));
|
|
189
|
+
if (project.database && typeof project.database === 'object') {
|
|
190
|
+
let database = project.database;
|
|
191
|
+
if (options.waitUntilReady !== false)
|
|
192
|
+
database = await waitForDatabase(this, database, i);
|
|
193
|
+
result = {
|
|
194
|
+
...(0, connection_1.redactSecrets)(project),
|
|
195
|
+
database: shapeCreatedDatabase(database, options),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
result = (0, connection_1.redactSecrets)(project);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
else if (resourceName === 'project' && operation === 'get') {
|
|
203
|
+
const id = locatorId('projectId', 'project');
|
|
204
|
+
result = (0, connection_1.redactSecrets)(unwrap(await transport_1.prismaApiRequest.call(this, 'GET', `/projects/${id}`, undefined, undefined, i)));
|
|
205
|
+
}
|
|
206
|
+
else if (resourceName === 'project' && operation === 'getAll') {
|
|
207
|
+
result = (0, connection_1.redactSecrets)(await transport_1.prismaApiRequestAllItems.call(this, '/projects', {}, listLimit(), i));
|
|
208
|
+
}
|
|
209
|
+
else if (resourceName === 'project' && operation === 'delete') {
|
|
210
|
+
const id = locatorId('projectId', 'project');
|
|
211
|
+
await transport_1.prismaApiRequest.call(this, 'DELETE', `/projects/${id}`, undefined, undefined, i);
|
|
212
|
+
result = { deleted: true };
|
|
213
|
+
}
|
|
214
|
+
else if (resourceName === 'database' && operation === 'create') {
|
|
215
|
+
const options = this.getNodeParameter('options', i, {});
|
|
216
|
+
const name = this.getNodeParameter('name', i).trim();
|
|
217
|
+
if (name === '') {
|
|
218
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The database needs a name', {
|
|
219
|
+
itemIndex: i,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
const body = {
|
|
223
|
+
projectId: decodeURIComponent(locatorId('projectId', 'project')),
|
|
224
|
+
name,
|
|
225
|
+
region: this.getNodeParameter('region', i, 'inherit') || 'inherit',
|
|
226
|
+
};
|
|
227
|
+
if (options.isDefault === true)
|
|
228
|
+
body.isDefault = true;
|
|
229
|
+
let database = unwrap(await transport_1.prismaApiRequest.call(this, 'POST', '/databases', body, undefined, i));
|
|
230
|
+
if (options.waitUntilReady !== false)
|
|
231
|
+
database = await waitForDatabase(this, database, i);
|
|
232
|
+
result = shapeCreatedDatabase(database, options);
|
|
233
|
+
}
|
|
234
|
+
else if (resourceName === 'database' && operation === 'get') {
|
|
235
|
+
const id = locatorId('databaseId', 'database');
|
|
236
|
+
result = (0, connection_1.redactSecrets)(unwrap(await transport_1.prismaApiRequest.call(this, 'GET', `/databases/${id}`, undefined, undefined, i)));
|
|
237
|
+
}
|
|
238
|
+
else if (resourceName === 'database' && operation === 'getAll') {
|
|
239
|
+
const filters = this.getNodeParameter('filters', i, {});
|
|
240
|
+
const qs = {};
|
|
241
|
+
if (filters.projectId)
|
|
242
|
+
qs.projectId = filters.projectId;
|
|
243
|
+
result = (0, connection_1.redactSecrets)(await transport_1.prismaApiRequestAllItems.call(this, '/databases', qs, listLimit(), i));
|
|
244
|
+
}
|
|
245
|
+
else if (resourceName === 'database' && operation === 'delete') {
|
|
246
|
+
const id = locatorId('databaseId', 'database');
|
|
247
|
+
await transport_1.prismaApiRequest.call(this, 'DELETE', `/databases/${id}`, undefined, undefined, i);
|
|
248
|
+
result = { deleted: true };
|
|
249
|
+
}
|
|
250
|
+
else if (resourceName === 'connection' && operation === 'create') {
|
|
251
|
+
const name = this.getNodeParameter('name', i).trim();
|
|
252
|
+
if (name.length < 3 || name.length > 65) {
|
|
253
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'The connection name must have 3 to 65 characters', {
|
|
254
|
+
itemIndex: i,
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
const body = {
|
|
258
|
+
databaseId: decodeURIComponent(locatorId('databaseId', 'database')),
|
|
259
|
+
name,
|
|
260
|
+
};
|
|
261
|
+
const connection = unwrap(await transport_1.prismaApiRequest.call(this, 'POST', '/connections', body, undefined, i));
|
|
262
|
+
result = (0, connection_1.toConnectionDetails)(connection, this.getNodeParameter('endpointType', i, 'pooled'));
|
|
263
|
+
}
|
|
264
|
+
else if (resourceName === 'connection' && operation === 'getAll') {
|
|
265
|
+
const filters = this.getNodeParameter('filters', i, {});
|
|
266
|
+
const qs = {};
|
|
267
|
+
if (filters.databaseId)
|
|
268
|
+
qs.databaseId = filters.databaseId;
|
|
269
|
+
result = (0, connection_1.redactSecrets)(await transport_1.prismaApiRequestAllItems.call(this, '/connections', qs, listLimit(), i));
|
|
270
|
+
}
|
|
271
|
+
else if (resourceName === 'connection' && operation === 'delete') {
|
|
272
|
+
const id = requireId(this, this.getNodeParameter('connectionId', i), 'connection ID', i);
|
|
273
|
+
await transport_1.prismaApiRequest.call(this, 'DELETE', `/connections/${id}`, undefined, undefined, i);
|
|
274
|
+
result = { deleted: true };
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation "${operation}" is not supported for the resource "${resourceName}"`, { itemIndex: i });
|
|
278
|
+
}
|
|
279
|
+
returnData.push(...this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(result), {
|
|
280
|
+
itemData: { item: i },
|
|
281
|
+
}));
|
|
282
|
+
}
|
|
283
|
+
catch (error) {
|
|
284
|
+
if (this.continueOnFail()) {
|
|
285
|
+
returnData.push({
|
|
286
|
+
json: { error: error.message },
|
|
287
|
+
pairedItem: { item: i },
|
|
288
|
+
});
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
291
|
+
const nodeError = error instanceof n8n_workflow_1.NodeApiError || error instanceof n8n_workflow_1.NodeOperationError
|
|
292
|
+
? error
|
|
293
|
+
: new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
|
|
294
|
+
throw nodeError;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return [returnData];
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
exports.PrismaPostgres = PrismaPostgres;
|
|
301
|
+
//# sourceMappingURL=PrismaPostgres.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismaPostgres.node.js","sourceRoot":"","sources":["../../../nodes/PrismaPostgres/PrismaPostgres.node.ts"],"names":[],"mappings":";;;AAUA,+CAA4F;AAG5F,6CAAkE;AAClE,iDAA8D;AAC9D,2CAAoF;AAEpF,MAAM,sBAAsB,GAAG,IAAI,CAAC;AACpC,MAAM,gBAAgB,GAAG,MAAO,CAAC;AACjC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,SAAS,MAAM,CAAC,QAAqB;;IACpC,OAAO,CAAC,MAAA,QAAQ,C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,0BAA0B,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE;oBAChF,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;iBACrB,CAAC,CACF,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE;wBACzC,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;qBACvB,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBAED,MAAM,SAAS,GACd,KAAK,YAAY,2BAAY,IAAI,KAAK,YAAY,iCAAkB;oBACnE,CAAC,CAAC,KAAK;oBACP,CAAC,CAAC,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAc,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;gBAC7E,MAAM,SAAS,CAAC;YACjB,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAxQD,wCAwQC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "@prisma/n8n-nodes-prisma.prismaPostgres",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Development", "Data & Storage"],
|
|
6
|
+
"alias": ["Prisma", "Postgres", "PostgreSQL", "pgvector", "Database", "SQL"],
|
|
7
|
+
"resources": {
|
|
8
|
+
"credentialDocumentation": [
|
|
9
|
+
{
|
|
10
|
+
"url": "https://github.com/prisma/n8n-nodes-prisma#credentials"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"primaryDocumentation": [
|
|
14
|
+
{
|
|
15
|
+
"url": "https://github.com/prisma/n8n-nodes-prisma#readme"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IDataObject } from 'n8n-workflow';
|
|
2
|
+
export type EndpointType = 'pooled' | 'direct';
|
|
3
|
+
export declare function redactSecrets<T>(value: T): T;
|
|
4
|
+
interface ParsedConnectionString {
|
|
5
|
+
host: string;
|
|
6
|
+
port: number;
|
|
7
|
+
database: string;
|
|
8
|
+
user: string;
|
|
9
|
+
password: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function parseConnectionString(connectionString: unknown): ParsedConnectionString | undefined;
|
|
12
|
+
export declare function toConnectionDetails(connection: IDataObject, endpointType: EndpointType): IDataObject;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.redactSecrets = redactSecrets;
|
|
4
|
+
exports.parseConnectionString = parseConnectionString;
|
|
5
|
+
exports.toConnectionDetails = toConnectionDetails;
|
|
6
|
+
const SECRET_KEYS = new Set(['connectionString', 'pass', 'password', 'apiKeys']);
|
|
7
|
+
function redactSecrets(value) {
|
|
8
|
+
if (Array.isArray(value)) {
|
|
9
|
+
return value.map((entry) => redactSecrets(entry));
|
|
10
|
+
}
|
|
11
|
+
if (value !== null && typeof value === 'object') {
|
|
12
|
+
const result = {};
|
|
13
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
14
|
+
if (SECRET_KEYS.has(key))
|
|
15
|
+
continue;
|
|
16
|
+
result[key] = redactSecrets(entry);
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
function parseConnectionString(connectionString) {
|
|
23
|
+
if (typeof connectionString !== 'string' || connectionString === '')
|
|
24
|
+
return undefined;
|
|
25
|
+
try {
|
|
26
|
+
const url = new URL(connectionString);
|
|
27
|
+
if (!url.hostname)
|
|
28
|
+
return undefined;
|
|
29
|
+
return {
|
|
30
|
+
host: url.hostname,
|
|
31
|
+
port: url.port ? Number(url.port) : 5432,
|
|
32
|
+
database: decodeURIComponent(url.pathname.replace(/^\//, '')) || 'postgres',
|
|
33
|
+
user: decodeURIComponent(url.username),
|
|
34
|
+
password: decodeURIComponent(url.password),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function toConnectionDetails(connection, endpointType) {
|
|
42
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
43
|
+
const endpoints = ((_a = connection.endpoints) !== null && _a !== void 0 ? _a : {});
|
|
44
|
+
const directConnection = ((_b = connection.directConnection) !== null && _b !== void 0 ? _b : {});
|
|
45
|
+
const database = ((_c = connection.database) !== null && _c !== void 0 ? _c : {});
|
|
46
|
+
const describe = (type) => {
|
|
47
|
+
var _a, _b, _c, _d, _e;
|
|
48
|
+
const endpoint = endpoints[type];
|
|
49
|
+
if (!endpoint)
|
|
50
|
+
return undefined;
|
|
51
|
+
const parsed = parseConnectionString(endpoint.connectionString);
|
|
52
|
+
return {
|
|
53
|
+
host: (_b = (_a = parsed === null || parsed === void 0 ? void 0 : parsed.host) !== null && _a !== void 0 ? _a : endpoint.host) !== null && _b !== void 0 ? _b : null,
|
|
54
|
+
port: (_d = (_c = parsed === null || parsed === void 0 ? void 0 : parsed.port) !== null && _c !== void 0 ? _c : endpoint.port) !== null && _d !== void 0 ? _d : 5432,
|
|
55
|
+
connectionString: (_e = endpoint.connectionString) !== null && _e !== void 0 ? _e : null,
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
const direct = describe('direct');
|
|
59
|
+
const pooled = describe('pooled');
|
|
60
|
+
const selected = (_d = (endpointType === 'pooled' ? (pooled !== null && pooled !== void 0 ? pooled : direct) : (direct !== null && direct !== void 0 ? direct : pooled))) !== null && _d !== void 0 ? _d : {};
|
|
61
|
+
const parsed = (_f = (_e = parseConnectionString(selected.connectionString)) !== null && _e !== void 0 ? _e : parseConnectionString(direct === null || direct === void 0 ? void 0 : direct.connectionString)) !== null && _f !== void 0 ? _f : parseConnectionString(connection.connectionString);
|
|
62
|
+
return {
|
|
63
|
+
id: (_g = connection.id) !== null && _g !== void 0 ? _g : null,
|
|
64
|
+
name: (_h = connection.name) !== null && _h !== void 0 ? _h : null,
|
|
65
|
+
kind: (_j = connection.kind) !== null && _j !== void 0 ? _j : null,
|
|
66
|
+
createdAt: (_k = connection.createdAt) !== null && _k !== void 0 ? _k : null,
|
|
67
|
+
databaseId: (_l = database.id) !== null && _l !== void 0 ? _l : null,
|
|
68
|
+
databaseName: (_m = database.name) !== null && _m !== void 0 ? _m : null,
|
|
69
|
+
endpointType: selected === pooled ? 'pooled' : 'direct',
|
|
70
|
+
host: (_q = (_p = (_o = selected.host) !== null && _o !== void 0 ? _o : directConnection.host) !== null && _p !== void 0 ? _p : connection.host) !== null && _q !== void 0 ? _q : null,
|
|
71
|
+
port: (_r = selected.port) !== null && _r !== void 0 ? _r : 5432,
|
|
72
|
+
database: (_s = parsed === null || parsed === void 0 ? void 0 : parsed.database) !== null && _s !== void 0 ? _s : 'postgres',
|
|
73
|
+
user: (_v = (_u = (_t = parsed === null || parsed === void 0 ? void 0 : parsed.user) !== null && _t !== void 0 ? _t : directConnection.user) !== null && _u !== void 0 ? _u : connection.user) !== null && _v !== void 0 ? _v : null,
|
|
74
|
+
password: (_y = (_x = (_w = parsed === null || parsed === void 0 ? void 0 : parsed.password) !== null && _w !== void 0 ? _w : directConnection.pass) !== null && _x !== void 0 ? _x : connection.pass) !== null && _y !== void 0 ? _y : null,
|
|
75
|
+
ssl: 'require',
|
|
76
|
+
connectionString: (_z = selected.connectionString) !== null && _z !== void 0 ? _z : null,
|
|
77
|
+
direct: direct !== null && direct !== void 0 ? direct : null,
|
|
78
|
+
pooled: pooled !== null && pooled !== void 0 ? pooled : null,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../../nodes/PrismaPostgres/connection.ts"],"names":[],"mappings":";;AAUA,sCAaC;AAUD,sDAiBC;AAMD,kDA6CC;AAjGD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,kBAAkB,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;AAMjF,SAAgB,aAAa,CAAI,KAAQ;IACxC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAiB,CAAC;IACnE,CAAC;IACD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACjD,MAAM,MAAM,GAAgB,EAAE,CAAC;QAC/B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAoB,CAAC,EAAE,CAAC;YACjE,IAAI,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,SAAS;YACnC,MAAM,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,KAAK,CAAgB,CAAC;QACnD,CAAC;QACD,OAAO,MAAsB,CAAC;IAC/B,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAUD,SAAgB,qBAAqB,CACpC,gBAAyB;IAEzB,IAAI,OAAO,gBAAgB,KAAK,QAAQ,IAAI,gBAAgB,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IACtF,IAAI,CAAC;QACJ,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC;QACtC,IAAI,CAAC,GAAG,CA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