@prisma/n8n-nodes-prisma 0.0.0 → 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 +316 -3
- 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 +61 -5
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fields = exports.operations = exports.resource = void 0;
|
|
4
|
+
function locator(displayName, name, searchListMethod, placeholder, description, show, required = true) {
|
|
5
|
+
return {
|
|
6
|
+
displayName,
|
|
7
|
+
name,
|
|
8
|
+
type: 'resourceLocator',
|
|
9
|
+
default: { mode: 'list', value: '' },
|
|
10
|
+
required,
|
|
11
|
+
description,
|
|
12
|
+
displayOptions: { show },
|
|
13
|
+
modes: [
|
|
14
|
+
{
|
|
15
|
+
displayName: 'From List',
|
|
16
|
+
name: 'list',
|
|
17
|
+
type: 'list',
|
|
18
|
+
typeOptions: { searchListMethod, searchable: true },
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
displayName: 'By ID',
|
|
22
|
+
name: 'id',
|
|
23
|
+
type: 'string',
|
|
24
|
+
placeholder,
|
|
25
|
+
validation: [
|
|
26
|
+
{
|
|
27
|
+
type: 'regex',
|
|
28
|
+
properties: {
|
|
29
|
+
regex: '^[A-Za-z0-9_]+$',
|
|
30
|
+
errorMessage: 'Enter an ID that contains only letters, numbers and underscores',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function returnAll(show) {
|
|
39
|
+
return [
|
|
40
|
+
{
|
|
41
|
+
displayName: 'Return All',
|
|
42
|
+
name: 'returnAll',
|
|
43
|
+
type: 'boolean',
|
|
44
|
+
default: false,
|
|
45
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
46
|
+
displayOptions: { show },
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
displayName: 'Limit',
|
|
50
|
+
name: 'limit',
|
|
51
|
+
type: 'number',
|
|
52
|
+
typeOptions: { minValue: 1 },
|
|
53
|
+
default: 50,
|
|
54
|
+
description: 'Max number of results to return',
|
|
55
|
+
displayOptions: { show: { ...show, returnAll: [false] } },
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
const includeConnectionDetails = {
|
|
60
|
+
displayName: 'Include Connection Details',
|
|
61
|
+
name: 'includeConnectionDetails',
|
|
62
|
+
type: 'boolean',
|
|
63
|
+
default: false,
|
|
64
|
+
description: 'Whether to output the password and connection strings of the default connection, which then become visible in the execution data of this workflow',
|
|
65
|
+
};
|
|
66
|
+
const endpointType = {
|
|
67
|
+
displayName: 'Endpoint Type',
|
|
68
|
+
name: 'endpointType',
|
|
69
|
+
type: 'options',
|
|
70
|
+
options: [
|
|
71
|
+
{
|
|
72
|
+
name: 'Pooled',
|
|
73
|
+
value: 'pooled',
|
|
74
|
+
description: 'Shares database connections between runs, which suits workflows that run often or in parallel',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'Direct',
|
|
78
|
+
value: 'direct',
|
|
79
|
+
description: 'Connects straight to the database, which suits schema changes and long transactions',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
default: 'pooled',
|
|
83
|
+
description: 'The endpoint that the host, port and connection string fields point to, with both endpoints always included in the output',
|
|
84
|
+
};
|
|
85
|
+
const waitUntilReady = {
|
|
86
|
+
displayName: 'Wait Until Ready',
|
|
87
|
+
name: 'waitUntilReady',
|
|
88
|
+
type: 'boolean',
|
|
89
|
+
default: true,
|
|
90
|
+
description: 'Whether to wait until the database has finished provisioning before returning',
|
|
91
|
+
};
|
|
92
|
+
exports.resource = {
|
|
93
|
+
displayName: 'Resource',
|
|
94
|
+
name: 'resource',
|
|
95
|
+
type: 'options',
|
|
96
|
+
noDataExpression: true,
|
|
97
|
+
options: [
|
|
98
|
+
{ name: 'Connection', value: 'connection' },
|
|
99
|
+
{ name: 'Database', value: 'database' },
|
|
100
|
+
{ name: 'Project', value: 'project' },
|
|
101
|
+
{ name: 'Workspace', value: 'workspace' },
|
|
102
|
+
],
|
|
103
|
+
default: 'database',
|
|
104
|
+
};
|
|
105
|
+
exports.operations = [
|
|
106
|
+
{
|
|
107
|
+
displayName: 'Operation',
|
|
108
|
+
name: 'operation',
|
|
109
|
+
type: 'options',
|
|
110
|
+
noDataExpression: true,
|
|
111
|
+
displayOptions: { show: { resource: ['workspace'] } },
|
|
112
|
+
options: [
|
|
113
|
+
{
|
|
114
|
+
name: 'Get',
|
|
115
|
+
value: 'get',
|
|
116
|
+
description: 'Get a workspace',
|
|
117
|
+
action: 'Get workspace',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'Get Many',
|
|
121
|
+
value: 'getAll',
|
|
122
|
+
description: 'Get the workspaces the service token can access',
|
|
123
|
+
action: 'Get many workspaces',
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
default: 'getAll',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
displayName: 'Operation',
|
|
130
|
+
name: 'operation',
|
|
131
|
+
type: 'options',
|
|
132
|
+
noDataExpression: true,
|
|
133
|
+
displayOptions: { show: { resource: ['project'] } },
|
|
134
|
+
options: [
|
|
135
|
+
{
|
|
136
|
+
name: 'Create',
|
|
137
|
+
value: 'create',
|
|
138
|
+
description: 'Create a project, with a Prisma Postgres database by default',
|
|
139
|
+
action: 'Create project',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: 'Delete',
|
|
143
|
+
value: 'delete',
|
|
144
|
+
description: 'Delete a project and all of its databases',
|
|
145
|
+
action: 'Delete project',
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'Get',
|
|
149
|
+
value: 'get',
|
|
150
|
+
description: 'Get a project',
|
|
151
|
+
action: 'Get project',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: 'Get Many',
|
|
155
|
+
value: 'getAll',
|
|
156
|
+
description: 'Get many projects',
|
|
157
|
+
action: 'Get many projects',
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
default: 'getAll',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
displayName: 'Operation',
|
|
164
|
+
name: 'operation',
|
|
165
|
+
type: 'options',
|
|
166
|
+
noDataExpression: true,
|
|
167
|
+
displayOptions: { show: { resource: ['database'] } },
|
|
168
|
+
options: [
|
|
169
|
+
{
|
|
170
|
+
name: 'Create',
|
|
171
|
+
value: 'create',
|
|
172
|
+
description: 'Create a Prisma Postgres database in a project',
|
|
173
|
+
action: 'Create database',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: 'Delete',
|
|
177
|
+
value: 'delete',
|
|
178
|
+
description: 'Delete a database and all of its data',
|
|
179
|
+
action: 'Delete database',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: 'Get',
|
|
183
|
+
value: 'get',
|
|
184
|
+
description: 'Get a database',
|
|
185
|
+
action: 'Get database',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'Get Many',
|
|
189
|
+
value: 'getAll',
|
|
190
|
+
description: 'Get many databases',
|
|
191
|
+
action: 'Get many databases',
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
default: 'create',
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
displayName: 'Operation',
|
|
198
|
+
name: 'operation',
|
|
199
|
+
type: 'options',
|
|
200
|
+
noDataExpression: true,
|
|
201
|
+
displayOptions: { show: { resource: ['connection'] } },
|
|
202
|
+
options: [
|
|
203
|
+
{
|
|
204
|
+
name: 'Create',
|
|
205
|
+
value: 'create',
|
|
206
|
+
description: 'Create database credentials and connection strings',
|
|
207
|
+
action: 'Create connection',
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: 'Delete',
|
|
211
|
+
value: 'delete',
|
|
212
|
+
description: 'Delete a connection and revoke its credentials',
|
|
213
|
+
action: 'Delete connection',
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: 'Get Many',
|
|
217
|
+
value: 'getAll',
|
|
218
|
+
description: 'Get connection metadata, without passwords',
|
|
219
|
+
action: 'Get many connections',
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
default: 'create',
|
|
223
|
+
},
|
|
224
|
+
];
|
|
225
|
+
exports.fields = [
|
|
226
|
+
locator('Workspace', 'workspaceId', 'searchWorkspaces', 'e.g. wksp_cmb1x2y3z0000abcd1234efgh', 'The workspace to get', { resource: ['workspace'], operation: ['get'] }),
|
|
227
|
+
...returnAll({ resource: ['workspace'], operation: ['getAll'] }),
|
|
228
|
+
{
|
|
229
|
+
displayName: 'Name',
|
|
230
|
+
name: 'name',
|
|
231
|
+
type: 'string',
|
|
232
|
+
required: true,
|
|
233
|
+
default: '',
|
|
234
|
+
placeholder: 'e.g. accounts-inbox',
|
|
235
|
+
description: 'The name of the project',
|
|
236
|
+
displayOptions: { show: { resource: ['project'], operation: ['create'] } },
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
displayName: 'Region Name or ID',
|
|
240
|
+
name: 'region',
|
|
241
|
+
type: 'options',
|
|
242
|
+
typeOptions: { loadOptionsMethod: 'getRegions' },
|
|
243
|
+
default: 'us-east-1',
|
|
244
|
+
description: 'The region that hosts the project and its default database. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
245
|
+
displayOptions: { show: { resource: ['project'], operation: ['create'] } },
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
displayName: 'Options',
|
|
249
|
+
name: 'options',
|
|
250
|
+
type: 'collection',
|
|
251
|
+
placeholder: 'Add option',
|
|
252
|
+
default: {},
|
|
253
|
+
displayOptions: { show: { resource: ['project'], operation: ['create'] } },
|
|
254
|
+
options: [
|
|
255
|
+
{
|
|
256
|
+
displayName: 'Create Default Database',
|
|
257
|
+
name: 'createDatabase',
|
|
258
|
+
type: 'boolean',
|
|
259
|
+
default: true,
|
|
260
|
+
description: 'Whether to create a Prisma Postgres database together with the project',
|
|
261
|
+
},
|
|
262
|
+
endpointType,
|
|
263
|
+
includeConnectionDetails,
|
|
264
|
+
waitUntilReady,
|
|
265
|
+
{
|
|
266
|
+
displayName: 'Workspace Name or ID',
|
|
267
|
+
name: 'workspaceId',
|
|
268
|
+
type: 'options',
|
|
269
|
+
typeOptions: { loadOptionsMethod: 'getWorkspaces' },
|
|
270
|
+
default: '',
|
|
271
|
+
description: 'The workspace to create the project in, which defaults to the workspace of the service token. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
},
|
|
275
|
+
locator('Project', 'projectId', 'searchProjects', 'e.g. proj_cmb1x2y3z0000abcd1234efgh', 'The project to use', { resource: ['project'], operation: ['get', 'delete'] }),
|
|
276
|
+
...returnAll({ resource: ['project'], operation: ['getAll'] }),
|
|
277
|
+
locator('Project', 'projectId', 'searchProjects', 'e.g. proj_cmb1x2y3z0000abcd1234efgh', 'The project to create the database in', { resource: ['database'], operation: ['create'] }),
|
|
278
|
+
{
|
|
279
|
+
displayName: 'Name',
|
|
280
|
+
name: 'name',
|
|
281
|
+
type: 'string',
|
|
282
|
+
required: true,
|
|
283
|
+
default: '',
|
|
284
|
+
placeholder: 'e.g. policy-knowledge-base',
|
|
285
|
+
description: 'The display name of the database',
|
|
286
|
+
displayOptions: { show: { resource: ['database'], operation: ['create'] } },
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
displayName: 'Region Name or ID',
|
|
290
|
+
name: 'region',
|
|
291
|
+
type: 'options',
|
|
292
|
+
typeOptions: { loadOptionsMethod: 'getDatabaseRegions' },
|
|
293
|
+
default: 'inherit',
|
|
294
|
+
description: 'The region that hosts the database, which defaults to the region of the project. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
295
|
+
displayOptions: { show: { resource: ['database'], operation: ['create'] } },
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
displayName: 'Options',
|
|
299
|
+
name: 'options',
|
|
300
|
+
type: 'collection',
|
|
301
|
+
placeholder: 'Add option',
|
|
302
|
+
default: {},
|
|
303
|
+
displayOptions: { show: { resource: ['database'], operation: ['create'] } },
|
|
304
|
+
options: [
|
|
305
|
+
endpointType,
|
|
306
|
+
includeConnectionDetails,
|
|
307
|
+
{
|
|
308
|
+
displayName: 'Set as Default',
|
|
309
|
+
name: 'isDefault',
|
|
310
|
+
type: 'boolean',
|
|
311
|
+
default: false,
|
|
312
|
+
description: 'Whether to make this the default database of the project',
|
|
313
|
+
},
|
|
314
|
+
waitUntilReady,
|
|
315
|
+
],
|
|
316
|
+
},
|
|
317
|
+
locator('Database', 'databaseId', 'searchDatabases', 'e.g. db_cmb1x2y3z0000abcd1234efgh', 'The database to use', { resource: ['database'], operation: ['get', 'delete'] }),
|
|
318
|
+
...returnAll({ resource: ['database'], operation: ['getAll'] }),
|
|
319
|
+
{
|
|
320
|
+
displayName: 'Filters',
|
|
321
|
+
name: 'filters',
|
|
322
|
+
type: 'collection',
|
|
323
|
+
placeholder: 'Add filter',
|
|
324
|
+
default: {},
|
|
325
|
+
displayOptions: { show: { resource: ['database'], operation: ['getAll'] } },
|
|
326
|
+
options: [
|
|
327
|
+
{
|
|
328
|
+
displayName: 'Project ID',
|
|
329
|
+
name: 'projectId',
|
|
330
|
+
type: 'string',
|
|
331
|
+
default: '',
|
|
332
|
+
placeholder: 'e.g. proj_cmb1x2y3z0000abcd1234efgh',
|
|
333
|
+
description: 'Only return databases that belong to this project',
|
|
334
|
+
},
|
|
335
|
+
],
|
|
336
|
+
},
|
|
337
|
+
locator('Database', 'databaseId', 'searchDatabases', 'e.g. db_cmb1x2y3z0000abcd1234efgh', 'The database to create credentials for', { resource: ['connection'], operation: ['create'] }),
|
|
338
|
+
{
|
|
339
|
+
displayName: 'Name',
|
|
340
|
+
name: 'name',
|
|
341
|
+
type: 'string',
|
|
342
|
+
required: true,
|
|
343
|
+
default: 'n8n',
|
|
344
|
+
placeholder: 'e.g. n8n-accounts-inbox',
|
|
345
|
+
description: 'A label for the connection, between 3 and 65 characters',
|
|
346
|
+
displayOptions: { show: { resource: ['connection'], operation: ['create'] } },
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
...endpointType,
|
|
350
|
+
displayOptions: { show: { resource: ['connection'], operation: ['create'] } },
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
displayName: 'The output contains the database password, which anyone who can view executions of this workflow can read. After you copy the values into a Postgres credential, delete the execution or turn off saving of execution data.',
|
|
354
|
+
name: 'secretNotice',
|
|
355
|
+
type: 'notice',
|
|
356
|
+
default: '',
|
|
357
|
+
displayOptions: { show: { resource: ['connection'], operation: ['create'] } },
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
displayName: 'Connection ID',
|
|
361
|
+
name: 'connectionId',
|
|
362
|
+
type: 'string',
|
|
363
|
+
required: true,
|
|
364
|
+
default: '',
|
|
365
|
+
placeholder: 'e.g. con_cmb1x2y3z0000abcd1234efgh',
|
|
366
|
+
description: 'The ID of the connection to delete, which you can find with the Get Many operation',
|
|
367
|
+
displayOptions: { show: { resource: ['connection'], operation: ['delete'] } },
|
|
368
|
+
},
|
|
369
|
+
...returnAll({ resource: ['connection'], operation: ['getAll'] }),
|
|
370
|
+
{
|
|
371
|
+
displayName: 'Filters',
|
|
372
|
+
name: 'filters',
|
|
373
|
+
type: 'collection',
|
|
374
|
+
placeholder: 'Add filter',
|
|
375
|
+
default: {},
|
|
376
|
+
displayOptions: { show: { resource: ['connection'], operation: ['getAll'] } },
|
|
377
|
+
options: [
|
|
378
|
+
{
|
|
379
|
+
displayName: 'Database ID',
|
|
380
|
+
name: 'databaseId',
|
|
381
|
+
type: 'string',
|
|
382
|
+
default: '',
|
|
383
|
+
placeholder: 'e.g. db_cmb1x2y3z0000abcd1234efgh',
|
|
384
|
+
description: 'Only return connections that belong to this database',
|
|
385
|
+
},
|
|
386
|
+
],
|
|
387
|
+
},
|
|
388
|
+
];
|
|
389
|
+
//# sourceMappingURL=descriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptions.js","sourceRoot":"","sources":["../../../nodes/PrismaPostgres/descriptions.ts"],"names":[],"mappings":";;;AAIA,SAAS,OAAO,CACf,WAAmB,EACnB,IAAY,EACZ,gBAAwB,EACxB,WAAmB,EACnB,WAAmB,EACnB,IAAU,EACV,QAAQ,GAAG,IAAI;IAEf,OAAO;QACN,WAAW;QACX,IAAI;QACJ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YAAY;QAClB,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE;QAC7E,OAAO,EAAE;YACR;gBACC,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,mCAAmC;gBAChD,WAAW,EAAE,sDAAsD;aACnE;SACD;KACD;CACD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="264" height="264" viewBox="0 0 264 264" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M53.4128 0V0.10425L0 53.5V150.03L150.092 0H53.4128Z" fill="#04D5E7"/>
|
|
3
|
+
<path d="M264 0H164.073L0 164.005V264H99.8281L264 99.8911V0Z" fill="#FE4352"/>
|
|
4
|
+
<path d="M113.804 264H210.484L264.001 210.5V113.861L113.804 264Z" fill="#FEBE29"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="264" height="264" viewBox="0 0 264 264" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M53.4128 0V0.10425L0 53.5V150.03L150.092 0H53.4128Z" fill="#04D5E7"/>
|
|
3
|
+
<path d="M264 0H164.073L0 164.005V264H99.8281L264 99.8911V0Z" fill="#FE4352"/>
|
|
4
|
+
<path d="M113.804 264H210.484L264.001 210.5V113.861L113.804 264Z" fill="#FEBE29"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteFunctions, IHttpRequestMethods, ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare const BASE_URL = "https://api.prisma.io/v1";
|
|
3
|
+
export declare const CREDENTIAL_NAME = "prismaApi";
|
|
4
|
+
export declare const PAGE_SIZE = 100;
|
|
5
|
+
export declare const MAX_ATTEMPTS = 4;
|
|
6
|
+
type PrismaContext = IExecuteFunctions | ILoadOptionsFunctions;
|
|
7
|
+
export declare function retryDelayMs(headers: IDataObject | undefined, attempt: number): number;
|
|
8
|
+
export declare function shouldRetry(method: IHttpRequestMethods, statusCode: number): boolean;
|
|
9
|
+
export declare function prismaApiRequest(this: PrismaContext, method: IHttpRequestMethods, path: string, body?: IDataObject, qs?: IDataObject, itemIndex?: number): Promise<IDataObject>;
|
|
10
|
+
export declare function prismaApiRequestAllItems(this: PrismaContext, path: string, qs?: IDataObject, limit?: number, itemIndex?: number): Promise<IDataObject[]>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAX_ATTEMPTS = exports.PAGE_SIZE = exports.CREDENTIAL_NAME = exports.BASE_URL = void 0;
|
|
4
|
+
exports.retryDelayMs = retryDelayMs;
|
|
5
|
+
exports.shouldRetry = shouldRetry;
|
|
6
|
+
exports.prismaApiRequest = prismaApiRequest;
|
|
7
|
+
exports.prismaApiRequestAllItems = prismaApiRequestAllItems;
|
|
8
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
9
|
+
exports.BASE_URL = 'https://api.prisma.io/v1';
|
|
10
|
+
exports.CREDENTIAL_NAME = 'prismaApi';
|
|
11
|
+
exports.PAGE_SIZE = 100;
|
|
12
|
+
exports.MAX_ATTEMPTS = 4;
|
|
13
|
+
const MAX_RETRY_DELAY_MS = 30000;
|
|
14
|
+
const STATUS_GUIDANCE = {
|
|
15
|
+
401: {
|
|
16
|
+
message: 'Prisma did not accept the service token',
|
|
17
|
+
description: 'The service token in the Prisma API credential is incomplete or has been revoked, so create a new one in Prisma Console under Settings > Service Tokens and update the credential.',
|
|
18
|
+
},
|
|
19
|
+
403: {
|
|
20
|
+
message: 'The service token is not allowed to do this',
|
|
21
|
+
description: 'The token belongs to a different workspace or has no access to this resource, so use a service token from the workspace that owns it.',
|
|
22
|
+
},
|
|
23
|
+
404: {
|
|
24
|
+
message: 'Prisma could not find the requested resource',
|
|
25
|
+
description: 'Check the ID, because the resource may have been deleted or may belong to a workspace that this service token cannot access.',
|
|
26
|
+
},
|
|
27
|
+
409: {
|
|
28
|
+
message: 'This conflicts with an existing Prisma resource',
|
|
29
|
+
description: 'A resource with the same identifier already exists, or the resource is in a state that does not allow this operation.',
|
|
30
|
+
},
|
|
31
|
+
429: {
|
|
32
|
+
message: 'Prisma rate limit reached',
|
|
33
|
+
description: 'The request was retried and is still rate limited, so wait a moment before you run the node again or process fewer items per run.',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
function retryDelayMs(headers, attempt) {
|
|
37
|
+
var _a;
|
|
38
|
+
const fallback = Math.min(MAX_RETRY_DELAY_MS, 500 * 2 ** (attempt - 1));
|
|
39
|
+
const raw = (_a = headers === null || headers === void 0 ? void 0 : headers['retry-after']) !== null && _a !== void 0 ? _a : headers === null || headers === void 0 ? void 0 : headers['Retry-After'];
|
|
40
|
+
if (raw === undefined || raw === null || raw === '')
|
|
41
|
+
return fallback;
|
|
42
|
+
const seconds = Number(raw);
|
|
43
|
+
if (Number.isFinite(seconds) && seconds >= 0) {
|
|
44
|
+
return Math.min(MAX_RETRY_DELAY_MS, seconds * 1000);
|
|
45
|
+
}
|
|
46
|
+
const date = Date.parse(String(raw));
|
|
47
|
+
if (!Number.isNaN(date)) {
|
|
48
|
+
return Math.min(MAX_RETRY_DELAY_MS, Math.max(0, date - Date.now()));
|
|
49
|
+
}
|
|
50
|
+
return fallback;
|
|
51
|
+
}
|
|
52
|
+
function shouldRetry(method, statusCode) {
|
|
53
|
+
if (statusCode === 429)
|
|
54
|
+
return true;
|
|
55
|
+
return method === 'GET' && [502, 503, 504].includes(statusCode);
|
|
56
|
+
}
|
|
57
|
+
function parseBody(body) {
|
|
58
|
+
if (body === undefined || body === null || body === '')
|
|
59
|
+
return {};
|
|
60
|
+
if (typeof body === 'string') {
|
|
61
|
+
try {
|
|
62
|
+
return JSON.parse(body);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return { message: body };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return body;
|
|
69
|
+
}
|
|
70
|
+
function toApiError(context, statusCode, body, itemIndex) {
|
|
71
|
+
var _a, _b, _c, _d, _e, _f;
|
|
72
|
+
const apiError = (_a = body.error) !== null && _a !== void 0 ? _a : {};
|
|
73
|
+
const guidance = STATUS_GUIDANCE[statusCode];
|
|
74
|
+
const apiMessage = (_b = apiError.message) !== null && _b !== void 0 ? _b : (typeof body.message === 'string' ? body.message : '');
|
|
75
|
+
const message = (_c = guidance === null || guidance === void 0 ? void 0 : guidance.message) !== null && _c !== void 0 ? _c : (apiMessage || `Prisma returned HTTP ${statusCode}`);
|
|
76
|
+
const description = [guidance ? apiMessage : '', (_d = apiError.hint) !== null && _d !== void 0 ? _d : '', (_e = guidance === null || guidance === void 0 ? void 0 : guidance.description) !== null && _e !== void 0 ? _e : '']
|
|
77
|
+
.filter((part) => part !== '')
|
|
78
|
+
.join(' ');
|
|
79
|
+
const errorResponse = {
|
|
80
|
+
statusCode,
|
|
81
|
+
code: (_f = apiError.code) !== null && _f !== void 0 ? _f : null,
|
|
82
|
+
message: apiMessage || message,
|
|
83
|
+
};
|
|
84
|
+
return new n8n_workflow_1.NodeApiError(context.getNode(), errorResponse, {
|
|
85
|
+
message,
|
|
86
|
+
description: description || undefined,
|
|
87
|
+
httpCode: String(statusCode),
|
|
88
|
+
itemIndex,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
async function prismaApiRequest(method, path, body, qs, itemIndex) {
|
|
92
|
+
const options = {
|
|
93
|
+
method,
|
|
94
|
+
url: `${exports.BASE_URL}${path}`,
|
|
95
|
+
json: true,
|
|
96
|
+
returnFullResponse: true,
|
|
97
|
+
ignoreHttpStatusErrors: true,
|
|
98
|
+
headers: { Accept: 'application/json' },
|
|
99
|
+
};
|
|
100
|
+
if (body !== undefined && Object.keys(body).length > 0)
|
|
101
|
+
options.body = body;
|
|
102
|
+
if (qs !== undefined && Object.keys(qs).length > 0)
|
|
103
|
+
options.qs = qs;
|
|
104
|
+
for (let attempt = 1;; attempt++) {
|
|
105
|
+
const response = (await this.helpers.httpRequestWithAuthentication.call(this, exports.CREDENTIAL_NAME, options));
|
|
106
|
+
const statusCode = response.statusCode;
|
|
107
|
+
if (statusCode >= 200 && statusCode < 300) {
|
|
108
|
+
return parseBody(response.body);
|
|
109
|
+
}
|
|
110
|
+
if (attempt < exports.MAX_ATTEMPTS && shouldRetry(method, statusCode)) {
|
|
111
|
+
await (0, n8n_workflow_1.sleep)(retryDelayMs(response.headers, attempt));
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
throw toApiError(this, statusCode, parseBody(response.body), itemIndex);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async function prismaApiRequestAllItems(path, qs = {}, limit, itemIndex) {
|
|
118
|
+
var _a;
|
|
119
|
+
const items = [];
|
|
120
|
+
let cursor;
|
|
121
|
+
do {
|
|
122
|
+
const remaining = limit === undefined ? exports.PAGE_SIZE : limit - items.length;
|
|
123
|
+
const pageQs = { ...qs, limit: Math.min(exports.PAGE_SIZE, remaining) };
|
|
124
|
+
if (cursor)
|
|
125
|
+
pageQs.cursor = cursor;
|
|
126
|
+
const response = await prismaApiRequest.call(this, 'GET', path, undefined, pageQs, itemIndex);
|
|
127
|
+
const page = Array.isArray(response.data) ? response.data : [];
|
|
128
|
+
items.push(...page);
|
|
129
|
+
const pagination = ((_a = response.pagination) !== null && _a !== void 0 ? _a : {});
|
|
130
|
+
cursor = pagination.hasMore && pagination.nextCursor ? pagination.nextCursor : undefined;
|
|
131
|
+
if (page.length === 0)
|
|
132
|
+
cursor = undefined;
|
|
133
|
+
} while (cursor && (limit === undefined || items.length < limit));
|
|
134
|
+
return limit === undefined ? items : items.slice(0, limit);
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../nodes/PrismaPostgres/transport.ts"],"names":[],"mappings":";;;AA4DA,oCAaC;AAOD,kCAGC;AA2CD,4CAoCC;AAMD,4DA4BC;AA5LD,+CAAmD;AAEtC,QAAA,QAAQ,GAAG,0BAA0B,CAAC;AACtC,QAAA,eAAe,GAAG,WAAW,CAAC;AAC9B,QAAA,SAAS,GAAG,GAAG,CAAC;AAChB,QAAA,YAAY,GAAG,CAAC,CAAC;AAC9B,MAAM,kBAAkB,GAAG,KAAM,CAAC;AAclC,MAAM,eAAe,GAA6D;IACjF,GAAG,EAAE;QACJ,OAAO,EAAE,yCAAyC;QAClD,WAAW,EACV,oLAAoL;KACrL;IACD,GAAG,EAAE;QACJ,OAAO,EAAE,6CAA6C;QACtD,WAAW,EACV,uIAAuI;KACxI;IACD,GAAG,EAAE;QACJ,OAAO,EAAE,8CAA8C;QACvD,WAAW,EACV,8HAA8H;KAC/H;IACD,GAAG,EAAE;QACJ,OAAO,EAAE,iDAAiD;QAC1D,WAAW,EACV,uHAAuH;KACxH;IACD,GAAG,EAAE;QACJ,OAAO,EAAE,2BAA2B;QACpC,WAAW,EACV,mIAAmI;KACpI;CACD,CAAC;AAMF,SAAgB,YAAY,CAAC,OAAgC,EAAE,OAAe;;IAC7E,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,kBAAkB,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;IACxE,MAAM,GAAG,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,aAAa,CAAC,mCAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,aAAa,CAAC,CAAC;IACjE,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK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AE;IAElE,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@prisma/n8n-nodes-prisma",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "n8n community node for Prisma Postgres: create and manage projects, databases and connections from n8n workflows",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://github.com/prisma/n8n-nodes-prisma#readme",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"n8n-community-node-package",
|
|
9
|
+
"n8n",
|
|
10
|
+
"prisma",
|
|
11
|
+
"prisma-postgres",
|
|
12
|
+
"postgres",
|
|
13
|
+
"postgresql",
|
|
14
|
+
"pgvector",
|
|
15
|
+
"database"
|
|
16
|
+
],
|
|
17
|
+
"author": {
|
|
18
|
+
"name": "Prisma",
|
|
19
|
+
"email": "18557034+prismabot@users.noreply.github.com",
|
|
20
|
+
"url": "https://www.prisma.io"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/prisma/n8n-nodes-prisma.git"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "n8n-node build",
|
|
28
|
+
"build:watch": "tsc --watch",
|
|
29
|
+
"dev": "n8n-node dev",
|
|
30
|
+
"lint": "n8n-node lint",
|
|
31
|
+
"lint:fix": "n8n-node lint --fix",
|
|
32
|
+
"release": "n8n-node release",
|
|
33
|
+
"prepublishOnly": "n8n-node prerelease",
|
|
34
|
+
"test": "vitest run --exclude test/integration",
|
|
35
|
+
"test:integration": "vitest run test/integration",
|
|
36
|
+
"format": "prettier --write .",
|
|
37
|
+
"format:check": "prettier --check .",
|
|
38
|
+
"typecheck": "tsc --noEmit -p tsconfig.test.json"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist"
|
|
42
|
+
],
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"n8n": {
|
|
47
|
+
"n8nNodesApiVersion": 1,
|
|
48
|
+
"strict": true,
|
|
49
|
+
"credentials": [
|
|
50
|
+
"dist/credentials/PrismaApi.credentials.js"
|
|
51
|
+
],
|
|
52
|
+
"nodes": [
|
|
53
|
+
"dist/nodes/PrismaPostgres/PrismaPostgres.node.js"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@n8n/node-cli": "*",
|
|
58
|
+
"@types/node": "^26.6.6",
|
|
59
|
+
"@types/pg": "^8.23.1",
|
|
60
|
+
"eslint": "9.32.0",
|
|
61
|
+
"pg": "^8.23.1",
|
|
62
|
+
"prettier": "3.6.2",
|
|
63
|
+
"release-it": "^21.1.0",
|
|
64
|
+
"typescript": "5.9.2",
|
|
65
|
+
"vitest": "^5.1.0"
|
|
66
|
+
},
|
|
67
|
+
"peerDependencies": {
|
|
68
|
+
"n8n-workflow": "*"
|
|
69
|
+
},
|
|
70
|
+
"bugs": {
|
|
71
|
+
"url": "https://github.com/prisma/n8n-nodes-prisma/issues"
|
|
72
|
+
},
|
|
73
|
+
"engines": {
|
|
74
|
+
"node": ">=20.19"
|
|
75
|
+
}
|
|
76
|
+
}
|