@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Prisma Data, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,320 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @prisma/n8n-nodes-prisma
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Create and manage [Prisma Postgres](https://www.prisma.io/postgres) databases from your [n8n](https://n8n.io) workflows.
|
|
4
|
+
|
|
5
|
+
Many n8n workflows need somewhere to keep data, whether that is the context an AI agent looks up, the documents behind a knowledge base, or the records of a new customer. This community node lets a workflow create that database on its own, so you never have to leave n8n to set one up.
|
|
6
|
+
|
|
7
|
+
Once the database exists, you work with it through the nodes n8n already has: the Postgres node runs your SQL, and the Postgres PGVector Store node stores and searches embeddings.
|
|
8
|
+
|
|
9
|
+
## What you can build
|
|
10
|
+
|
|
11
|
+
**Give an AI workflow a memory.** You can store notes, rules, and past decisions as embeddings in Prisma Postgres, so that when a new email or ticket arrives, your workflow finds the most relevant context and hands it to the model. The [accounts inbox example](#accounts-inbox-with-gemini) works this way.
|
|
12
|
+
|
|
13
|
+
**Turn your documents into a knowledge base.** A workflow can sync pages from Notion or another source into Prisma Postgres and then let people ask questions in a chat, with answers that come from your own content. The [policy knowledge base example](#notion-policy-knowledge-base) shows how.
|
|
14
|
+
|
|
15
|
+
**Create a database for every customer or environment.** When someone signs up or a new project starts, a workflow can create a fresh database and pass its connection details on to the next step.
|
|
16
|
+
|
|
17
|
+
**Spin up a database for a test and remove it afterwards.** A workflow can create a database when it starts, use it for the run, and delete it again at the end.
|
|
18
|
+
|
|
19
|
+
## How it fits together
|
|
20
|
+
|
|
21
|
+
Prisma Postgres organizes things in three levels, and the node has one resource for each of them:
|
|
22
|
+
|
|
23
|
+
- A **project** groups the databases that belong to one app or use case.
|
|
24
|
+
- A **database** is a PostgreSQL database inside a project, and because it supports pgvector, it can also store embeddings.
|
|
25
|
+
- A **connection** is a set of credentials for one database, made up of a host, a user, and a password.
|
|
26
|
+
|
|
27
|
+
A typical setup starts with this node creating a project and its database, followed by a connection for that database. You then give the connection details to n8n's Postgres node, and from that point on your workflows read and write data through the Postgres node.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
32
|
+
|
|
33
|
+
On a self-hosted instance, open **Settings > Community Nodes**, select **Install**, and enter `@prisma/n8n-nodes-prisma`. When the install finishes, you can find the node by searching the node panel for **Prisma Postgres**.
|
|
34
|
+
|
|
35
|
+
n8n Cloud only offers verified community nodes, and this package has not been submitted for verification yet.
|
|
36
|
+
|
|
37
|
+
## Credentials
|
|
38
|
+
|
|
39
|
+
The node connects to your Prisma account with a service token, which you create in Prisma Console and store in an n8n credential.
|
|
40
|
+
|
|
41
|
+
1. Open [Prisma Console](https://console.prisma.io) and select your workspace.
|
|
42
|
+
2. Go to **Settings > Service Tokens** and create a token.
|
|
43
|
+
3. In n8n, create a **Prisma API** credential and paste the token into **Service Token**.
|
|
44
|
+
4. Select **Test** to check that it works.
|
|
45
|
+
|
|
46
|
+
Because a service token can manage every project in its workspace, you should treat it like a password, and it is a good idea to create a separate workspace if you only want to experiment.
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
This walkthrough creates a database and connects n8n's Postgres node to it, which takes about five minutes.
|
|
51
|
+
|
|
52
|
+
### 1. Create a project and a database
|
|
53
|
+
|
|
54
|
+
Add a **Prisma Postgres** node to a workflow, select the **Project** resource with the **Create** operation, and then enter a name and choose a region close to you. Creating a project also creates its first database, so this one node gives you both.
|
|
55
|
+
|
|
56
|
+
### 2. Create a connection
|
|
57
|
+
|
|
58
|
+
Add a second **Prisma Postgres** node after the first, and select the **Connection** resource with the **Create** operation. In the **Database** field, switch to **By ID** and enter the expression below, which picks up the database that the previous node created:
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
{{ $json.database.id }}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 3. Run the workflow
|
|
65
|
+
|
|
66
|
+
When you select **Execute workflow**, the second node returns everything a Postgres client needs:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"host": "pooled.db.prisma.io",
|
|
71
|
+
"port": 5432,
|
|
72
|
+
"database": "postgres",
|
|
73
|
+
"user": "...",
|
|
74
|
+
"password": "...",
|
|
75
|
+
"ssl": "require"
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The output has a few more fields, such as full connection strings, but the ones above are the ones you need for the next step.
|
|
80
|
+
|
|
81
|
+
### 4. Connect the Postgres node
|
|
82
|
+
|
|
83
|
+
In n8n, create a new **Postgres** credential, copy `host`, `database`, `user`, `password`, and `port` from the output into the fields of the same name, and set **SSL** to **Require**. Once you add a **Postgres** node that uses this credential and run a query, your workflow is connected to Prisma Postgres.
|
|
84
|
+
|
|
85
|
+
Keep in mind that the output of step 3 contains a password and that n8n keeps node output in the execution history, so it is worth deleting that execution once you have saved the credential.
|
|
86
|
+
|
|
87
|
+
If you would rather start from a ready-made workflow, you can import these steps from the [create a database example](examples/1-create-database.json).
|
|
88
|
+
|
|
89
|
+
## Operations
|
|
90
|
+
|
|
91
|
+
| Resource | Operations |
|
|
92
|
+
| ---------- | ----------------------------- |
|
|
93
|
+
| Workspace | Get, Get Many |
|
|
94
|
+
| Project | Create, Get, Get Many, Delete |
|
|
95
|
+
| Database | Create, Get, Get Many, Delete |
|
|
96
|
+
| Connection | Create, Get Many, Delete |
|
|
97
|
+
|
|
98
|
+
Both **Project: Create** and **Database: Create** wait until the database is ready, so the next node in your workflow can use it right away. Wherever an operation asks for a project or a database, you can either pick it from a searchable list or set it with an expression.
|
|
99
|
+
|
|
100
|
+
**Connection: Create** is the only operation that returns a password, and every other operation leaves passwords out of its output.
|
|
101
|
+
|
|
102
|
+
**Delete** is permanent, so use it with care: deleting a project removes all of its databases, and deleting a connection revokes its credentials.
|
|
103
|
+
|
|
104
|
+
### Pooled and direct connections
|
|
105
|
+
|
|
106
|
+
Every connection comes with two endpoints, and the **Endpoint Type** setting decides which one the `host` field points to.
|
|
107
|
+
|
|
108
|
+
**Pooled** is the default and the right choice for most workflows, because it shares a small number of database connections between many workflow runs and keeps busy workflows from exhausting the database. **Direct** connects straight to the database, which is what you want for long transactions and for changes to the database structure.
|
|
109
|
+
|
|
110
|
+
## Store and search embeddings
|
|
111
|
+
|
|
112
|
+
AI workflows often need to find text that is related to a question. The usual way to do that is to convert each piece of text into a list of numbers, called an embedding, and store it next to the text. Since texts with similar meaning have similar embeddings, the database can then find the closest matches for any question.
|
|
113
|
+
|
|
114
|
+
Prisma Postgres supports this through the pgvector extension, and n8n's **Postgres PGVector Store** node works with it out of the box.
|
|
115
|
+
|
|
116
|
+
### Set up a table
|
|
117
|
+
|
|
118
|
+
This repository includes a ready-made table definition in [`sql/schema.sql`](sql/schema.sql), which you can paste into a **Postgres** node with the **Execute Query** operation and run once. It creates a table named `documents` with these columns:
|
|
119
|
+
|
|
120
|
+
| Column | What it holds |
|
|
121
|
+
| ------------- | ------------------------------------------------------- |
|
|
122
|
+
| `id` | A unique ID for each piece of text |
|
|
123
|
+
| `content` | The text |
|
|
124
|
+
| `embedding` | The embedding of that text |
|
|
125
|
+
| `metadata` | Extra details as JSON, such as a title, a link, or tags |
|
|
126
|
+
| `document_id` | The document the text came from |
|
|
127
|
+
| `source` | Where the document came from, such as `notion` |
|
|
128
|
+
| `created_at` | When the row was added |
|
|
129
|
+
| `updated_at` | When the row last changed |
|
|
130
|
+
|
|
131
|
+
The table fills `document_id` and `source` from the `metadata` column, so you only need to write them in one place.
|
|
132
|
+
|
|
133
|
+
### Use it with the PGVector Store node
|
|
134
|
+
|
|
135
|
+
To use the table from a workflow, add a **Postgres PGVector Store** node, select your Postgres credential, and set **Table Name** to `documents`. Then open **Options > Column Names** and set **Content Column Name** to `content`, so the node writes to the right column.
|
|
136
|
+
|
|
137
|
+
After you connect an embeddings node, such as **Embeddings OpenAI** or **Embeddings Google Gemini**, the node is ready to insert and retrieve documents.
|
|
138
|
+
|
|
139
|
+
### Match the table to your embedding model
|
|
140
|
+
|
|
141
|
+
Each embedding model produces lists of a fixed length, and the `embedding` column has to be set to that same length. If the two do not match, inserts fail with a message such as `expected 1536 dimensions, not 3072`.
|
|
142
|
+
|
|
143
|
+
The table definition uses 1536, which fits OpenAI's `text-embedding-3-small`, so if you use a different model you need to change `vector(1536)` in the file before you run it.
|
|
144
|
+
|
|
145
|
+
| Model | Length |
|
|
146
|
+
| --------------------------------------- | ------ |
|
|
147
|
+
| OpenAI `text-embedding-3-small` | 1536 |
|
|
148
|
+
| OpenAI `text-embedding-3-large` | 3072 |
|
|
149
|
+
| Google `gemini-embedding-001` (default) | 3072 |
|
|
150
|
+
| Google `text-embedding-004` | 768 |
|
|
151
|
+
|
|
152
|
+
There is one limit to know about here. The table definition adds an index that keeps search fast as the table grows, and pgvector can only build that index for lengths up to 2000.
|
|
153
|
+
|
|
154
|
+
If your model produces 3072, remove the `documents_embedding_idx` statement from the file before you run it. Search still works without the index and stays quick for thousands of rows, and for larger tables [`sql/schema-3072.sql`](sql/schema-3072.sql) shows an alternative index.
|
|
155
|
+
|
|
156
|
+
### Write your own queries
|
|
157
|
+
|
|
158
|
+
If you prefer SQL over the PGVector Store node, [`sql/queries.sql`](sql/queries.sql) has statements for inserting text, replacing a document, and searching, all of which you can paste into a Postgres node.
|
|
159
|
+
|
|
160
|
+
The following query, for example, returns the rows that are closest in meaning to a question:
|
|
161
|
+
|
|
162
|
+
```sql
|
|
163
|
+
SELECT
|
|
164
|
+
id,
|
|
165
|
+
document_id,
|
|
166
|
+
source,
|
|
167
|
+
content,
|
|
168
|
+
metadata,
|
|
169
|
+
1 - (embedding <=> $1::vector) AS similarity
|
|
170
|
+
FROM documents
|
|
171
|
+
ORDER BY embedding <=> $1::vector
|
|
172
|
+
LIMIT $2;
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
The `$1` and `$2` placeholders are filled from **Options > Query Parameters** in the Postgres node, where you enter an expression that returns a list with the embedding of the question first and the number of results second:
|
|
176
|
+
|
|
177
|
+
```js
|
|
178
|
+
{{ [JSON.stringify($json.embedding), 5] }}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Example workflows
|
|
182
|
+
|
|
183
|
+
The [`examples`](examples) folder has four workflows you can import. In n8n, open **Workflows > Import from File**, choose a file, and then select your own credentials on the nodes.
|
|
184
|
+
|
|
185
|
+
| Workflow | What it does |
|
|
186
|
+
| ----------------------------------------------------------------------------------- | --------------------------------------------------------- |
|
|
187
|
+
| [Create a database](examples/1-create-database.json) | Creates a project, a database, and a connection |
|
|
188
|
+
| [Accounts inbox](examples/2-accounts-inbox-gemini.json) | Triages an accounts inbox with Gemini |
|
|
189
|
+
| [Policy knowledge base](examples/3-notion-policy-knowledge-base.json) | Answers questions about policies stored in Notion |
|
|
190
|
+
| [Database with credential](examples/4-create-database-and-postgres-credential.json) | Creates a database and saves a Postgres credential for it |
|
|
191
|
+
|
|
192
|
+
The accounts inbox and the policy knowledge base use Gmail, Notion, Google Gemini, and OpenAI, so you need accounts for those services. Their database steps were tested against Prisma Postgres, but the steps that call those services were not, so please check them with your own accounts before you rely on them.
|
|
193
|
+
|
|
194
|
+
### Accounts inbox with Gemini
|
|
195
|
+
|
|
196
|
+
A shared accounts inbox receives invoices, payment reminders, and vendor questions, and most of them follow patterns that a model can recognize as long as it knows your vendors and your rules.
|
|
197
|
+
|
|
198
|
+
This workflow keeps that knowledge in Prisma Postgres. You run the setup part once to create the tables and store a few sample notes, which you then replace with your own vendor notes, payment rules, and past decisions.
|
|
199
|
+
|
|
200
|
+
From then on, every new email goes to an AI agent running on Gemini. The agent looks up the related notes in the database, reads the email together with its attachments, and writes down what it found, including the type of email, the vendor, the amount, the due date, and a suggested next step.
|
|
201
|
+
|
|
202
|
+
The workflow saves each suggestion to a table and marks the ones that need a person, for example when money would move or bank details would change. It never pays, replies, or deletes anything by itself.
|
|
203
|
+
|
|
204
|
+
### Notion policy knowledge base
|
|
205
|
+
|
|
206
|
+
Company policies often live in Notion, where they are easy to write but hard to search by meaning. This workflow copies them into Prisma Postgres so that a chat can answer questions about them.
|
|
207
|
+
|
|
208
|
+
The sync part runs every night, or whenever you start it, and reads each policy page from a Notion database before storing its text with OpenAI embeddings. A policy that has changed replaces its previous version, so the database always matches what is in Notion.
|
|
209
|
+
|
|
210
|
+
The chat part answers questions with an AI agent on an OpenAI model, which searches the stored policies first and names the policy and its link in the answer. You can also ask it to draft a policy change, which it returns for you to review, and nothing is ever written back to Notion.
|
|
211
|
+
|
|
212
|
+
## Other ways to connect the Postgres node
|
|
213
|
+
|
|
214
|
+
The quick start copies the connection details into a Postgres credential by hand, which is the simplest way for a database you keep using. Although n8n does not let a community node create credentials for other nodes, there are two ways to automate that step.
|
|
215
|
+
|
|
216
|
+
### Let a workflow save the credential
|
|
217
|
+
|
|
218
|
+
n8n has a built-in node, also called **n8n**, that can create credentials. When you place it after **Connection > Create**, it saves a Postgres credential for the new database.
|
|
219
|
+
|
|
220
|
+
To configure it, set **Resource** to **Credential**, **Operation** to **Create**, and **Credential Type** to `postgres`, and then enter the following in **Data**:
|
|
221
|
+
|
|
222
|
+
```js
|
|
223
|
+
{{
|
|
224
|
+
JSON.stringify({
|
|
225
|
+
host: $json.host,
|
|
226
|
+
port: $json.port,
|
|
227
|
+
database: $json.database,
|
|
228
|
+
user: $json.user,
|
|
229
|
+
password: $json.password,
|
|
230
|
+
ssl: "require",
|
|
231
|
+
allowUnauthorizedCerts: false,
|
|
232
|
+
sshTunnel: false,
|
|
233
|
+
maxConnections: 10,
|
|
234
|
+
})
|
|
235
|
+
}}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
The **n8n** node needs an n8n API key with the `credential:create` scope, and the n8n API is not included in every n8n plan. You can import the whole workflow from the [database with credential example](examples/4-create-database-and-postgres-credential.json).
|
|
239
|
+
|
|
240
|
+
### Use the connection in the same run
|
|
241
|
+
|
|
242
|
+
Sometimes a workflow creates a database and needs to use it straight away, for example when it sets up one database per customer. For that case, a Postgres credential can read its values from the data that flows through the workflow, which you set up by entering expressions instead of fixed values:
|
|
243
|
+
|
|
244
|
+
| Field | Value |
|
|
245
|
+
| -------- | ---------------------- |
|
|
246
|
+
| Host | `{{ $json.host }}` |
|
|
247
|
+
| Database | `{{ $json.database }}` |
|
|
248
|
+
| User | `{{ $json.user }}` |
|
|
249
|
+
| Password | `{{ $json.password }}` |
|
|
250
|
+
| Port | `{{ $json.port }}` |
|
|
251
|
+
| SSL | Require |
|
|
252
|
+
|
|
253
|
+
A Postgres node with this credential connects to whichever database the incoming item describes, so place it directly after **Connection > Create**, where the item still carries those fields.
|
|
254
|
+
|
|
255
|
+
## Keeping secrets safe
|
|
256
|
+
|
|
257
|
+
Your service token is stored in n8n's encrypted credential store, and the node sends it only to `https://api.prisma.io` and never includes it in output or error messages.
|
|
258
|
+
|
|
259
|
+
Database passwords appear in the output of **Connection > Create**, because you need them to connect. Since n8n keeps that output in the execution history, where anyone with access to the workflow can read it, you should delete the execution after you have saved the credential or turn off saving of successful executions in the workflow settings.
|
|
260
|
+
|
|
261
|
+
If a password is ever exposed, delete its connection with **Connection > Delete** and create a new one, at which point the old credentials stop working.
|
|
262
|
+
|
|
263
|
+
The node only creates, changes, or deletes something when an operation that you selected runs, which means that loading a dropdown or testing a credential never does.
|
|
264
|
+
|
|
265
|
+
## Troubleshooting
|
|
266
|
+
|
|
267
|
+
The table below lists the messages you are most likely to run into, along with what causes each one and how to resolve it.
|
|
268
|
+
|
|
269
|
+
| What you see | What to do |
|
|
270
|
+
| ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
271
|
+
| Prisma did not accept the service token | The token is incomplete or has been revoked, so create a new one under **Settings > Service Tokens** in Prisma Console and update the credential. |
|
|
272
|
+
| The service token is not allowed to do this | The project or database belongs to another workspace, which means you need a token from that workspace to manage it. |
|
|
273
|
+
| Prisma could not find the requested resource | Check the ID you entered, because the project, database, or connection may already have been deleted. |
|
|
274
|
+
| Prisma rate limit reached | The node sent too many requests in a short time and has already retried, so wait a moment before you run it again. |
|
|
275
|
+
| Database is still provisioning after 120 seconds | The database was created and needs more time to become ready, so you can either check its status with **Database > Get** or turn off **Wait Until Ready** to let the workflow continue without waiting. |
|
|
276
|
+
| The Postgres node cannot connect | Make sure **SSL** is set to **Require** in the Postgres credential, and then check the host, user, and password. |
|
|
277
|
+
| `expected N dimensions, not M` | The `embedding` column does not fit your embedding model, so adjust it as described in [Match the table to your embedding model](#match-the-table-to-your-embedding-model). |
|
|
278
|
+
| `type "vector" does not exist` | The pgvector extension is not enabled in this database yet, which you can fix by running `CREATE EXTENSION IF NOT EXISTS vector;` in a Postgres node. |
|
|
279
|
+
| A dropdown is empty | The workspace has no projects or databases yet, so create one with **Project > Create** first. |
|
|
280
|
+
|
|
281
|
+
## Limitations
|
|
282
|
+
|
|
283
|
+
- The node covers Prisma Postgres, so other Prisma products such as Prisma Compute are not included.
|
|
284
|
+
- A password cannot be read again after its connection is created, which means that if you lose it you need to create a new connection.
|
|
285
|
+
- The node signs in with a service token, and signing in with OAuth is not supported.
|
|
286
|
+
- Operations that need a valid service token are covered by automated tests against the documented API, but they have not been run against a live account yet.
|
|
287
|
+
|
|
288
|
+
## Compatibility
|
|
289
|
+
|
|
290
|
+
The node was tested with n8n 2.47.4, and the package has no runtime dependencies.
|
|
291
|
+
|
|
292
|
+
## Contributing
|
|
293
|
+
|
|
294
|
+
Issues and pull requests are welcome. To work on the node locally, install the dependencies and start n8n with the node loaded:
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
# Install dependencies
|
|
298
|
+
npm install
|
|
299
|
+
|
|
300
|
+
# Start n8n on http://localhost:5678 with this node loaded
|
|
301
|
+
npm run dev
|
|
302
|
+
|
|
303
|
+
# Run the unit tests
|
|
304
|
+
npm test
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
[CONTRIBUTING.md](CONTRIBUTING.md) describes the tests, the release process, and the rules that keep the package eligible for n8n verification.
|
|
308
|
+
|
|
309
|
+
## Resources
|
|
310
|
+
|
|
311
|
+
- [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
|
|
312
|
+
- [Prisma Postgres documentation](https://www.prisma.io/docs/postgres)
|
|
313
|
+
- [Prisma Management API reference](https://www.prisma.io/docs/rest-api)
|
|
314
|
+
- [Connecting to Prisma Postgres](https://www.prisma.io/docs/postgres/database/connecting-to-your-database)
|
|
315
|
+
|
|
316
|
+
Changes between versions are listed in [CHANGELOG.md](CHANGELOG.md).
|
|
317
|
+
|
|
318
|
+
## License
|
|
319
|
+
|
|
320
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, Icon, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class PrismaApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
icon: Icon;
|
|
6
|
+
documentationUrl: string;
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
authenticate: IAuthenticateGeneric;
|
|
9
|
+
test: ICredentialTestRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrismaApi = void 0;
|
|
4
|
+
class PrismaApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'prismaApi';
|
|
7
|
+
this.displayName = 'Prisma API';
|
|
8
|
+
this.icon = { light: 'file:prisma.svg', dark: 'file:prisma.dark.svg' };
|
|
9
|
+
this.documentationUrl = 'https://github.com/prisma/n8n-nodes-prisma#credentials';
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'Service Token',
|
|
13
|
+
name: 'serviceToken',
|
|
14
|
+
type: 'string',
|
|
15
|
+
typeOptions: { password: true },
|
|
16
|
+
default: '',
|
|
17
|
+
required: true,
|
|
18
|
+
description: 'A service token for your Prisma workspace, which you can create in Prisma Console under Settings > Service Tokens',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
this.authenticate = {
|
|
22
|
+
type: 'generic',
|
|
23
|
+
properties: {
|
|
24
|
+
headers: {
|
|
25
|
+
Authorization: '=Bearer {{$credentials.serviceToken}}',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
this.test = {
|
|
30
|
+
request: {
|
|
31
|
+
baseURL: 'https://api.prisma.io/v1',
|
|
32
|
+
url: '/workspaces',
|
|
33
|
+
qs: { limit: 1 },
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.PrismaApi = PrismaApi;
|
|
39
|
+
//# sourceMappingURL=PrismaApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrismaApi.credentials.js","sourceRoot":"","sources":["../../credentials/PrismaApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,SAAS;IAAtB;QACC,SAAI,GAAG,WAAW,CAAC;QAEnB,gBAAW,GAAG,YAAY,CAAC;QAE3B,SAAI,GAAS,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC;QAExE,qBAAgB,GAAG,wDAAwD,CAAC;QAE5E,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,eAAe;gBAC5B,IAAI,EAAE,cAAc;gBACpB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;gBACX,QAAQ,EAAE,IAAI;gBACd,WAAW,EACV,mHAAmH;aACpH;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,aAAa,EAAE,uCAAuC;iBACtD;aACD;SACD,CAAC;QAGF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,0BAA0B;gBACnC,GAAG,EAAE,aAAa;gBAClB,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE;aAChB;SACD,CAAC;IACH,CAAC;CAAA;AAvCD,8BAuCC"}
|
|
@@ -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,17 @@
|
|
|
1
|
+
import type { IExecuteFunctions, ILoadOptionsFunctions, INodeExecutionData, INodeListSearchResult, INodePropertyOptions, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class PrismaPostgres implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
methods: {
|
|
5
|
+
listSearch: {
|
|
6
|
+
searchWorkspaces(this: ILoadOptionsFunctions, filter?: string, paginationToken?: string): Promise<INodeListSearchResult>;
|
|
7
|
+
searchProjects(this: ILoadOptionsFunctions, filter?: string, paginationToken?: string): Promise<INodeListSearchResult>;
|
|
8
|
+
searchDatabases(this: ILoadOptionsFunctions, filter?: string, paginationToken?: string): Promise<INodeListSearchResult>;
|
|
9
|
+
};
|
|
10
|
+
loadOptions: {
|
|
11
|
+
getRegions(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
12
|
+
getDatabaseRegions(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
13
|
+
getWorkspaces(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
17
|
+
}
|