@zerodot/baserow 1.0.0 → 1.0.1

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/README.md CHANGED
@@ -1,23 +1,82 @@
1
1
  # @zerodot/baserow
2
2
 
3
- Baserow node package for zerodot.
3
+ <img src="https://raw.githubusercontent.com/zerodot-io/nodes/main/packages/baserow/baserow.svg" alt="Baserow logo" width="48" height="48">
4
4
 
5
- ## Credential
5
+ Read and write rows in Baserow tables. List, get, create, update, and delete rows. List the tables of the database and the fields of a table. Connect with a database token and the URL of your Baserow server, Baserow Cloud or self-hosted.
6
6
 
7
- Create a **Baserow Database Token** credential with:
7
+ ## Install
8
8
 
9
- - **Base URL**: Your Baserow API URL, for example `https://api.baserow.io` (self-hosted URLs are supported)
10
- - **Token**: Your Baserow database token
9
+ In zerodot, go to **System > Nodes** and install **Baserow**.
11
10
 
12
- ## Operations
11
+ Manual: install `@zerodot/baserow` where the web app and the worker run, and add it to `ZERODOT_NODE_PACKAGES`.
13
12
 
14
- - **Row**: List, Get, Create, Update, Delete
15
- - **Table**: List
16
- - **Field**: List
13
+ ## Nodes
17
14
 
18
- ## Notes
15
+ ### Baserow (`baserow.api`)
19
16
 
20
- - This node uses the Baserow database API with `Authorization: Token <token>`.
21
- - Row List supports `page`/`size` pagination. Enable **Return All** to fetch every page until `next` is `null` or **Limit** is reached.
22
- - Set **User Field Names** to send and receive human-readable field names instead of `field_<id>` keys.
23
- - Delete returns `{ "success": true }` when Baserow responds with `204 No Content`.
17
+ - **Row**: list, get, create, update, delete
18
+ - **Table**: list
19
+ - **Field**: list
20
+
21
+ The node lists tables and fields. It cannot create, change, or delete them.
22
+
23
+ **Table ID and Row ID.** Row operations need **Table ID**, a positive whole number. **Get**, **Update**, and **Delete** also need **Row ID**, a positive whole number. **Field** list needs **Table ID**. **Table** list needs no input.
24
+
25
+ **Data.** **Create** and **Update** need **Data**, an object of field values. Keys are `field_<id>`, for example `{ "field_1": "Ada" }`. When **User Field Names** is on, the keys are field names.
26
+
27
+ **User Field Names.** When on, the node sends and reads human-readable field names. When off, the keys are `field_<id>`.
28
+
29
+ **List rows.** These settings change the result:
30
+
31
+ - **Page**: the page to read, starting at 1.
32
+ - **Size**: rows per page, up to 200. The Baserow default applies when it is empty. With **Return All**, an empty **Size** asks for 200 rows per page.
33
+ - **Search**: a text to search for in the rows.
34
+ - **Order By**: a field with `+` for ascending or `-` for descending order. For example, `-field_1`.
35
+ - **Filter Type**: sent as `filter_type`, for example `AND` or `OR`. The node does not send filter conditions.
36
+ - **View ID**: limit the rows to a view.
37
+
38
+ Without **Return All**, the node reads one page. The output is the Baserow answer with `count`, `next`, `previous`, and `results`.
39
+
40
+ With **Return All**, the node reads the pages in order, starting at **Page**, until `next` is empty or until **Limit** rows are read. **Limit** has no default and no maximum. When it is empty, the node reads all rows. If **Size** is empty, the node asks for 200 rows per page in this mode. The output has `count`, `next` (always empty), `previous` (always empty), and `results`.
41
+
42
+ **Output.** Get, create, and update return the row. Delete returns `{ "success": true }` when Baserow answers with `204 No Content`. Table and field list return what Baserow sends.
43
+
44
+ **Destructive operations.** **Delete** removes a row. The node does not ask for a confirmation.
45
+
46
+ **Send Webhook Events.** When set, Baserow sends webhook events for the change. This applies to create, update, and delete. When not set, the node does not send the option.
47
+
48
+ **Binary data.** The node does not read or write binary data.
49
+
50
+ **Limits and retries.** Each call has a timeout. The default is 30 seconds. The timeout applies to each try. The node retries `GET` requests only. It tries them up to 3 times in total when Baserow answers `429` or `503`. It waits 0.5 seconds before the second try and 1 second before the third. Other methods are not retried. The node does not follow redirects.
51
+
52
+ Error messages include the Baserow message. Hints are added for these statuses:
53
+
54
+ - `400`: check the parameters.
55
+ - `401`: the database token was not accepted.
56
+ - `403`: check the permissions of the database token.
57
+ - `404`: check the IDs and the URL.
58
+ - `413`: the request was too large.
59
+ - `429`: the rate limit was reached.
60
+ - `503`: Baserow is not available.
61
+
62
+ ## Credentials
63
+
64
+ ### Baserow Database Token (`baserow.databaseToken`)
65
+
66
+ - **Base URL** (`baseUrl`): the URL of the Baserow API. The default is `https://api.baserow.io`. Use your own server URL if you run a self-hosted Baserow. The URL must start with `http://` or `https://`. A path is kept, so a server under a sub-path such as `https://example.com/baserow` works. Enter only the server address. A trailing `/api`, a query, and a hash are removed. This value is not secret.
67
+ - **Token** (`token`): the database token. This value is secret.
68
+
69
+ The node sends the token in the `Authorization: Token <token>` header. The node does not set scopes. The token needs access to the tables that you use.
70
+
71
+ The test of the credential lists the tables with `GET /api/database/tables/all-tables/`.
72
+
73
+ Setup:
74
+
75
+ 1. In Baserow, create a database token and copy it.
76
+ 2. In zerodot, create a **Baserow Database Token** credential.
77
+ 3. Enter the URL of your Baserow server in **Base URL**. Use `https://api.baserow.io` for Baserow Cloud.
78
+ 4. Paste the token into **Token**. Save and test the credential.
79
+
80
+ ## License
81
+
82
+ AGPL-3.0-only
package/dist/index.cjs CHANGED
@@ -15,7 +15,8 @@ function parseServerUrl(raw) {
15
15
  throw new Error("\"baseUrl\" is not a valid address");
16
16
  }
17
17
  if (parsed.protocol !== "https:" && parsed.protocol !== "http:") throw new Error("\"baseUrl\" must start with http:// or https://");
18
- return value.replace(/\/+$/, "");
18
+ const path = parsed.pathname.replace(/\/+$/, "").replace(/\/api$/, "");
19
+ return `${parsed.origin}${path}`;
19
20
  }
20
21
  /** The connection settings from a Baserow credential. */
21
22
  function baserowAccess(credential) {
@@ -68,7 +69,7 @@ function requestSignal(options) {
68
69
  }
69
70
  /** The full URL, with query values. Empty values are left out. */
70
71
  function buildUrl(baseUrl, path, query = {}) {
71
- const url = new URL(path, baseUrl);
72
+ const url = new URL(`${baseUrl}${path}`);
72
73
  for (const [key, value] of Object.entries(query)) {
73
74
  if (value === void 0 || value === "") continue;
74
75
  url.searchParams.set(key, String(value));
@@ -241,7 +242,7 @@ const baserowConfig = zod.z.object({
241
242
  size: zod.z.number().int().min(1).max(200).optional().meta({
242
243
  ...on("row", "list"),
243
244
  title: "Size",
244
- description: "Number of rows per page (default 100, max 200)"
245
+ description: "Number of rows per page, up to 200. Empty uses the Baserow default. With Return All, empty uses 200"
245
246
  }),
246
247
  search: zod.z.string().optional().meta({
247
248
  ...on("row", "list"),
@@ -393,7 +394,7 @@ function asRowList(value) {
393
394
  const nodes = [(0, _zerodot_node_sdk.defineNode)({
394
395
  type: "baserow.api",
395
396
  label: "Baserow",
396
- description: "Create and manage rows, tables, and fields in Baserow",
397
+ description: "Create, read, update, and delete rows in Baserow, and list tables and fields",
397
398
  category: "integration",
398
399
  app: "Baserow",
399
400
  actions: [
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@zerodot/baserow",
3
- "version": "1.0.0",
4
- "description": "Create and manage rows, tables, and fields in Baserow.",
3
+ "version": "1.0.1",
4
+ "description": "Create, read, update, and delete rows in Baserow, and list tables and fields.",
5
5
  "license": "AGPL-3.0-only",
6
+ "homepage": "https://github.com/zerodot-io/nodes/tree/main/packages/baserow",
6
7
  "repository": {
7
8
  "type": "git",
8
9
  "url": "git+https://github.com/zerodot-io/nodes.git",
@@ -24,7 +25,7 @@
24
25
  "zerodot": {
25
26
  "sdk": "^1.5",
26
27
  "label": "Baserow",
27
- "summary": "Manage rows and tables in Baserow",
28
+ "summary": "Manage rows, and list tables and fields in Baserow",
28
29
  "categories": [
29
30
  "database"
30
31
  ]