datanotes 3.2.0 → 3.3.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 +1 -0
- package/SECURITY.md +12 -0
- package/dist/api/client.d.cts +2 -0
- package/dist/api/client.d.ts +2 -0
- package/dist/api/docs.d.cts +14 -4
- package/dist/api/docs.d.ts +14 -4
- package/dist/api/extension-files.d.cts +23 -0
- package/dist/api/extension-files.d.ts +23 -0
- package/dist/api/extension-host.d.cts +108 -0
- package/dist/api/extension-host.d.ts +108 -0
- package/dist/api/extension-manifest.d.cts +154 -0
- package/dist/api/extension-manifest.d.ts +154 -0
- package/dist/api/extension-plan.d.cts +174 -0
- package/dist/api/extension-plan.d.ts +174 -0
- package/dist/api/extension-record.d.cts +65 -0
- package/dist/api/extension-record.d.ts +65 -0
- package/dist/api/extension-sdk.d.cts +65 -0
- package/dist/api/extension-sdk.d.ts +65 -0
- package/dist/api/extensions.cjs +19660 -0
- package/dist/api/extensions.d.cts +11 -0
- package/dist/api/extensions.d.ts +11 -0
- package/dist/api/extensions.js +19597 -0
- package/dist/api/index.cjs +1568 -375
- package/dist/api/index.js +1568 -375
- package/dist/api/mcp.cjs +1238 -27
- package/dist/api/mcp.js +1238 -27
- package/dist/datanotes.cjs +8365 -4335
- package/dist/docs/administration/extensions.md +213 -0
- package/dist/docs/api/operations/alter_table.md +4 -3
- package/dist/docs/api/operations/extensions_delete.md +29 -0
- package/dist/docs/api/operations/extensions_list.md +20 -0
- package/dist/docs/api/operations/extensions_record.md +44 -0
- package/dist/docs/api/operations/tags/extensions.md +9 -0
- package/dist/docs/api.md +9 -1
- package/dist/docs/develop/write-an-extension.md +369 -0
- package/dist/docs/guides/data-quality/check-constraints.md +10 -10
- package/dist/docs/guides/data-quality/hand-edits.md +8 -8
- package/dist/docs/guides/database-objects/bases.md +11 -11
- package/dist/docs/guides/database-objects/catalogs-and-schemas.md +30 -10
- package/dist/docs/guides/database-objects/columns.md +38 -38
- package/dist/docs/guides/database-objects/relations.md +28 -28
- package/dist/docs/guides/database-objects/tables.md +167 -43
- package/dist/docs/guides/database-objects/views.md +44 -44
- package/dist/docs/guides/history/change-data-feed.md +34 -34
- package/dist/docs/guides/history/journal-and-undo.md +12 -12
- package/dist/docs/guides/history/restore.md +20 -20
- package/dist/docs/guides/history/table-history.md +31 -31
- package/dist/docs/guides/read-and-write/automatic-links.md +15 -15
- package/dist/docs/guides/read-and-write/import-notes.md +20 -20
- package/dist/docs/guides/read-and-write/joins-and-aggregates.md +7 -7
- package/dist/docs/guides/read-and-write/read-and-filter.md +10 -10
- package/dist/docs/guides/read-and-write/write-rows.md +10 -10
- package/dist/docs/guides/search/text.md +1 -1
- package/dist/docs/guides/security/security-model.md +12 -0
- package/dist/docs/reference/cli.md +32 -1
- package/dist/docs/reference/glossary.md +8 -0
- package/dist/docs/reference/operations/auxiliary.md +1 -1
- package/dist/docs/reference/operations/rows.md +1 -1
- package/dist/docs/reference/operations/schema.md +3 -3
- package/dist/docs/reference/operations.md +4 -4
- package/dist/docs/release-notes.md +49 -0
- package/dist/docs/start/connect-agents.md +11 -0
- package/package.json +11 -1
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# Install extensions
|
|
2
|
+
|
|
3
|
+
> datanotes extension installs, updates, undoes and removes extensions: tables and MCP tools from a git repository, pinned to a version.
|
|
4
|
+
|
|
5
|
+
An extension adds tables, views, bases and MCP tools to your database. It also ships docs that agents read. You install it from a git repository, pinned to a version tag or a commit. It installs on any database: the installer matches its tables to yours, or creates them.
|
|
6
|
+
|
|
7
|
+
To install an extension you need three things:
|
|
8
|
+
|
|
9
|
+
* A running engine for the database, started with `datanotes serve`.
|
|
10
|
+
* `git`, for a source that is a git repository.
|
|
11
|
+
* The owner’s access: the installer changes the schema and creates a token.
|
|
12
|
+
|
|
13
|
+
The examples use an invented extension, `acme/datanotes-ext-reading`. It keeps a reading list of books and their authors.
|
|
14
|
+
|
|
15
|
+
## Install an extension
|
|
16
|
+
|
|
17
|
+
`datanotes extension install <source>` shows the plan, asks you to confirm it, then writes it. The installer fetches the code, reads the manifest, and reads your tables. It runs no script of the extension.
|
|
18
|
+
|
|
19
|
+
1. Run a dry run. It writes nothing and prints the plan.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
datanotes extension install acme/datanotes-ext-reading@v1.0.0 \
|
|
23
|
+
--database ~/notes --dry-run
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
2. Read the plan. It lists the tables (created, adopted or matched), the tools, the token and the number of operations.
|
|
27
|
+
|
|
28
|
+
3. Confirm. Run the same command with `--yes`, or without `--dry-run` and type `yes` when the terminal asks.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
datanotes extension install acme/datanotes-ext-reading@v1.0.0 \
|
|
32
|
+
--database ~/notes --yes
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
4. Restart the MCP server, or the client that started it. A running server does not see a new install.
|
|
36
|
+
|
|
37
|
+
The installer writes everything in one batch. One `undo_migration` takes it back, as [Undo an install or an update](#undo-an-install-or-an-update) explains.
|
|
38
|
+
|
|
39
|
+
### Connect to the database
|
|
40
|
+
|
|
41
|
+
Every command but `check` works through the engine that serves your database. Start the engine first, with `datanotes serve`. Then name it with one of these options:
|
|
42
|
+
|
|
43
|
+
* `--database <folder>`: the database folder. The command finds the running engine and reads the owner’s token from its store.
|
|
44
|
+
* `--vault <folder>`: a vault that holds the database, as for `datanotes serve --vault`.
|
|
45
|
+
* `--url <url>` and `--token-file <file>`: an engine at an address, such as on another machine. The file holds the owner’s token. `DATANOTES_URL` and `DATANOTES_TOKEN_FILE` work too.
|
|
46
|
+
* `--store <folder>` and `--settings <file>`: the store and the settings file, when you gave them to `datanotes serve`.
|
|
47
|
+
|
|
48
|
+
Without a running engine, the command stops with `no engine runs on <folder>`. Run `datanotes status` to see whether one runs.
|
|
49
|
+
|
|
50
|
+
### Name the source
|
|
51
|
+
|
|
52
|
+
The source takes one of three forms:
|
|
53
|
+
|
|
54
|
+
| Form | Example |
|
|
55
|
+
| -------------------- | ----------------------------------------------------------- |
|
|
56
|
+
| A git URL with a tag | `https://example.com/acme/datanotes-ext-reading.git#v1.0.0` |
|
|
57
|
+
| GitHub shorthand | `acme/datanotes-ext-reading@v1.0.0` |
|
|
58
|
+
| A folder | `./datanotes-ext-reading` |
|
|
59
|
+
|
|
60
|
+
The ref must be a version tag (`v1.0.0` or `1.0.0`) or a full commit id. The installer refuses a branch, because a branch moves. It fetches the tag itself, even when a branch has the same name. A tag must hold the manifest version it names. Without a ref, the installer takes the newest version tag. It records the commit it resolved. A folder is for development: see [Check and publish an extension](https://datanotes.dev/develop/write-an-extension/#check-and-publish-an-extension).
|
|
61
|
+
|
|
62
|
+
### Read the exit codes
|
|
63
|
+
|
|
64
|
+
| Code | Meaning |
|
|
65
|
+
| ---- | ---------------------------------------------------------------------------------- |
|
|
66
|
+
| 0 | Done. Also a ready dry run, nothing to do, or already up to date. |
|
|
67
|
+
| 1 | An error, a refusal, or you cancelled. |
|
|
68
|
+
| 2 | The plan has problems. Nothing is written. |
|
|
69
|
+
| 3 | Confirmation needed: no terminal, or `--json`, and no `--yes`. Nothing is written. |
|
|
70
|
+
|
|
71
|
+
With `--json`, the command prints one JSON object and never asks a question. An agent uses it.
|
|
72
|
+
|
|
73
|
+
## Choose the tables an extension uses
|
|
74
|
+
|
|
75
|
+
The manifest names each table by a role, such as `book` or `person`. The installer binds every role to a table of your database. An extension relates to a role in one of two ways:
|
|
76
|
+
|
|
77
|
+
* **Owned**: the extension creates the table, or adopts a table of that name that exists. An adopted table keeps its rows. The installer adds the missing columns, CHECKs, instructions and tags.
|
|
78
|
+
* **Dependency**: the extension uses a table you already have, such as `person`. The installer matches it by name, or creates it when you ask.
|
|
79
|
+
|
|
80
|
+
Where the installer picked a table, the plan marks it `proposed`. A proposed table is a guess. Confirm it, or choose another.
|
|
81
|
+
|
|
82
|
+
Five options carry your choices. They apply to `install` and, except the last two, to `update`.
|
|
83
|
+
|
|
84
|
+
| Option | What it does | Example |
|
|
85
|
+
| ----------- | ------------------------------------------------------- | ------------------------------------------------------- |
|
|
86
|
+
| `--map` | Binds a role to a table, or a manifest column to yours. | `--map person=work.public.people,person.name=full_name` |
|
|
87
|
+
| `--create` | Creates a table the extension depends on. | `--create person` |
|
|
88
|
+
| `--add` | Adds a missing column to a matched table. | `--add person.name` |
|
|
89
|
+
| `--catalog` | Sets the catalog of created tables and views. | `--catalog work` |
|
|
90
|
+
| `--schema` | Sets the schema of created owned tables and views. | `--schema reading` |
|
|
91
|
+
|
|
92
|
+
Each option takes a comma-separated list. `--map role=catalog.schema.table` binds a table. `--map role.column=column` maps a column. A column of the extension’s own table keeps the extension’s name: you cannot map it.
|
|
93
|
+
|
|
94
|
+
The plan ends with a message for the AI agent that runs the install:
|
|
95
|
+
|
|
96
|
+
> For the agent installing this extension: show this plan to the user before anything is written. Where a table says “proposed”, the installer chose it: ask the user to confirm it, to pick another table (–map =\<catalog.schema.table>, –map .=), or to create it (–create ). Add a missing column only after the user agrees (–add .). Solve each problem the same way. Then run the same command again with the user’s choices and –yes, only once the user approved the tables it creates or changes, the tools and the token’s permissions.
|
|
97
|
+
|
|
98
|
+
An agent never guesses. It shows the plan, asks the user, and runs the command again with the answers. Each problem in the plan has a code, a hint and a docs link. The common ones are:
|
|
99
|
+
|
|
100
|
+
* `table_not_found`: the table you named does not exist. List the tables with `list_tables`.
|
|
101
|
+
* `ambiguous_dependency`: several tables could be the role. Pass `--map` or `--create`.
|
|
102
|
+
* `missing_column`: the matched table lacks a column. Map another column, or add it with `--add`.
|
|
103
|
+
* `column_differs`: a column exists with another type or rule. Map another column or table.
|
|
104
|
+
* `table_exists`: a table the extension would create exists already. Use it with `--map`, or pick another catalog.
|
|
105
|
+
* `tool_name_taken`: a tool name is already an operation or a tool of another extension.
|
|
106
|
+
* `token_exists`: a token named `ext-<name>` exists already.
|
|
107
|
+
|
|
108
|
+
## What an extension can do
|
|
109
|
+
|
|
110
|
+
Each extension gets a named token, `ext-<name>`. The token has three limits:
|
|
111
|
+
|
|
112
|
+
* It writes only the tables of the roles in the manifest’s `permissions.write`.
|
|
113
|
+
* It never changes the schema and never undoes. The installer changes the schema with the owner’s token.
|
|
114
|
+
* It reads every table, like every named token today.
|
|
115
|
+
|
|
116
|
+
The tools of an extension run when an agent calls them. Before a tool that writes runs, the MCP server checks the agent’s own token. If that token may not write the tool’s tables, the call fails. A read-only client cannot write through an extension. To allow the call, add the table to the `write` patterns of the client’s token. Or call the tool with a token that may write.
|
|
117
|
+
|
|
118
|
+
The journal shows `auth: ext-<name>` and the agent that called the tool. [See who did what](https://datanotes.dev/guides/security/who-did-what/) explains the actor.
|
|
119
|
+
|
|
120
|
+
The code runs inside the MCP server’s process. It is trusted code, not a sandbox. Install only extensions you trust, and read the plan. The installer helps in four ways:
|
|
121
|
+
|
|
122
|
+
* It pins a tag or a commit and records the commit.
|
|
123
|
+
* It runs no script and no build. The extension ships its built entry file.
|
|
124
|
+
* It stores a SHA-256 hash of the manifest and the entry file. The server refuses code that differs.
|
|
125
|
+
* The entry file may import only Node built-ins. The installer reads the imports in the file. Code that builds a module name at run time escapes this check.
|
|
126
|
+
|
|
127
|
+
Known limits in this version:
|
|
128
|
+
|
|
129
|
+
* **No isolation.** Extension code has the privileges of the MCP server’s process.
|
|
130
|
+
* **No read-scoped tokens.** The token of an extension reads every table. When read patterns ship, the installer will limit it to the extension’s tables.
|
|
131
|
+
* **No data-converting migrations.** A migration lists operations. It cannot run code to convert rows.
|
|
132
|
+
|
|
133
|
+
## Update an extension
|
|
134
|
+
|
|
135
|
+
`datanotes extension update <name>` moves an extension to a newer version. Without options, it takes the newest version tag of the source it came from.
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
datanotes extension update reading --database ~/notes --dry-run
|
|
139
|
+
datanotes extension update reading --database ~/notes --to v1.1.0 --yes
|
|
140
|
+
datanotes extension update reading --database ~/notes \
|
|
141
|
+
--from ./datanotes-ext-reading --yes
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
* `--to` names the tag or commit to move to.
|
|
145
|
+
* `--from` takes a new source, such as a folder while you develop.
|
|
146
|
+
* `--map`, `--create` and `--add` work as for `install`.
|
|
147
|
+
|
|
148
|
+
The plan shows the migrations between the installed version and the target. A step whose effect is already there is skipped. Then the installer brings the tables in line with the new manifest:
|
|
149
|
+
|
|
150
|
+
* It adds missing columns, CHECKs, instructions, tags, bases and views.
|
|
151
|
+
* It replaces CHECKs that changed.
|
|
152
|
+
* It drops the CHECKs and views the old version owned and the new one does not.
|
|
153
|
+
* It never drops a column.
|
|
154
|
+
|
|
155
|
+
The whole update is one batch. A downgrade is refused. A version tag that moved to another commit is refused too, with a warning to check the repository.
|
|
156
|
+
|
|
157
|
+
## Undo an install or an update
|
|
158
|
+
|
|
159
|
+
`datanotes extension rollback <name>` undoes the last install or update. It calls `undo_migration` on the batch the installer wrote, and puts the previous record and the token’s permissions back. After a first install, it removes the extension’s token, token file and record.
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
datanotes extension rollback reading --database ~/notes --yes
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Each rollback undoes one record. Run it again to go back one more version. The engine refuses the undo when later writes depend on the batch. In that case, undo or change those writes first.
|
|
166
|
+
|
|
167
|
+
## Remove an extension
|
|
168
|
+
|
|
169
|
+
`datanotes extension remove <name>` removes the extension and keeps its tables, because their rows are your data. It removes the tags the extension put on the tables, its token, its token file and its record.
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
datanotes extension remove reading --database ~/notes --yes
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
To drop the tables too, use `drop_table` yourself, after you look at their rows.
|
|
176
|
+
|
|
177
|
+
`rollback` and `remove` change only the extension’s own token, `ext-<name>`. They refuse a record that names another token, because the installer never writes one.
|
|
178
|
+
|
|
179
|
+
## When the MCP server skips an extension
|
|
180
|
+
|
|
181
|
+
`datanotes mcp` loads every installed extension before it serves an agent. Over stdio it loads them at start; `serve` loads them when the first agent connects. If one cannot load, the server skips it and goes on without it. It prints the reason on stderr. Run `datanotes extension list` to see what is installed. The reasons are:
|
|
182
|
+
|
|
183
|
+
* **The extension uses an API this server does not know.** The server supports module API 1. Update Datanotes.
|
|
184
|
+
* **The code is not on this machine.** Run `datanotes extension install` with the same source again. It repairs the installation. The server also skips a record whose name or commit is not a valid folder name.
|
|
185
|
+
* **The cached code differs from what was installed.** Run the install again. The server compares hashes, and refuses edited code.
|
|
186
|
+
* **The engine is too old.** The manifest names a minimum Datanotes version. Update the engine, or install an older extension.
|
|
187
|
+
* **The token is not on this machine.** The token file lives on the machine that installed. Run the install again: it gives the extension a new token.
|
|
188
|
+
* **A tool name is taken.** This server or another extension has a tool of that name. Remove one of the two.
|
|
189
|
+
* **The entry file did not load.** The message carries the error. Ask the extension’s author.
|
|
190
|
+
* **The code does not fit its manifest.** A tool of the manifest has no handler, or its handler is not a function. Ask the extension’s author.
|
|
191
|
+
|
|
192
|
+
Start the server with `--no-extensions` to leave all extensions out. [Connect an agent](https://datanotes.dev/start/connect-agents/#tools-of-extensions) explains the option.
|
|
193
|
+
|
|
194
|
+
## Where extensions live
|
|
195
|
+
|
|
196
|
+
The engine records which extensions are installed, in its store. The record holds the version, the source, the commit and the hashes. It also holds the table bindings, the tools and the token’s name. It is per database, so every MCP server learns it over HTTP, and the store backup carries it.
|
|
197
|
+
|
|
198
|
+
Three routes serve the records:
|
|
199
|
+
|
|
200
|
+
* `POST /datanotes/extensions/` lists them. Any token may call it.
|
|
201
|
+
* `POST /datanotes/extensions/record/` writes one. Only the owner may call it.
|
|
202
|
+
* `POST /datanotes/extensions/delete/` deletes one. Only the owner may call it.
|
|
203
|
+
|
|
204
|
+
The code and the tokens stay on the machine that installed them, under the data home:
|
|
205
|
+
|
|
206
|
+
| Path | Content |
|
|
207
|
+
| ---------------------------------------------------------- | -------------------------------------------- |
|
|
208
|
+
| `<data home>/extensions/code/<name>/<commit>/` | An immutable copy of the extension’s files. |
|
|
209
|
+
| `<data home>/extensions/tokens/<database id>/<name>.token` | The token, readable by you only (mode 0600). |
|
|
210
|
+
|
|
211
|
+
The installer tags each table of the extension with `extension: <name>` and `extension_role: <role>`. `list_tables` and `describe_table` show them.
|
|
212
|
+
|
|
213
|
+
A second machine has no token for the extension. Run `datanotes extension install` there. It gives the extension a new token, so run it on the first machine again too.
|
|
@@ -14,9 +14,10 @@ labels merged into the table's, e.g. `{"domain": "health"}`; a `null` value remo
|
|
|
14
14
|
`null` value removes one). Rows, archive and transaction log follow; links are updated; renamed
|
|
15
15
|
rows keep their old name in `aliases`. A change of metadata only (tags, description, aliases,
|
|
16
16
|
history, autolink_target, row_template, instructions, fields) rewrites the table entry alone: no row is moved or rewritten. Refused
|
|
17
|
-
when a row cannot fill a pattern. Renaming or moving the table
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
when a row cannot fill a pattern. Renaming or moving the table rewrites what names it in other
|
|
18
|
+
definitions: the `ref` and `vocabulary` of the columns of other tables and bases (lists of links
|
|
19
|
+
included) and the tables of views (`table`, `union[].table`, `join.table`); `schema_references`
|
|
20
|
+
lists them. CHECKs and `ref_where` / `ref_by` that read it through a link follow the new `ref`. Use `dry_run` to see `planned_moves`; undo with undo_migration.
|
|
20
21
|
|
|
21
22
|
The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
|
|
22
23
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Forget an installed extension (owner only): what datanotes extension remove does.
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/extensions/delete/` (operation `extensions_delete`)
|
|
4
|
+
|
|
5
|
+
## Parameters
|
|
6
|
+
|
|
7
|
+
| Name | In | Type | Required | Description |
|
|
8
|
+
| --- | --- | --- | --- | --- |
|
|
9
|
+
| `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
|
|
10
|
+
|
|
11
|
+
## Request body
|
|
12
|
+
|
|
13
|
+
`application/json`
|
|
14
|
+
|
|
15
|
+
| Property | Type | Required | Default | Description |
|
|
16
|
+
| --- | --- | --- | --- | --- |
|
|
17
|
+
| `name` | `string` | yes | | |
|
|
18
|
+
|
|
19
|
+
## Responses
|
|
20
|
+
|
|
21
|
+
| Status | Description | Body |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| 200 | Done. | `object` (application/json) |
|
|
24
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
25
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
26
|
+
| 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
|
|
27
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
28
|
+
|
|
29
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# The extensions installed in the database, and its id (any token).
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/extensions/` (operation `extensions_list`)
|
|
4
|
+
|
|
5
|
+
## Request body
|
|
6
|
+
|
|
7
|
+
`application/json`
|
|
8
|
+
|
|
9
|
+
Type: `object`
|
|
10
|
+
|
|
11
|
+
## Responses
|
|
12
|
+
|
|
13
|
+
| Status | Description | Body |
|
|
14
|
+
| --- | --- | --- |
|
|
15
|
+
| 200 | Done. | `object` (application/json) |
|
|
16
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
17
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
18
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
19
|
+
|
|
20
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Record an installed extension (owner only): what datanotes extension install writes.
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/extensions/record/` (operation `extensions_record`)
|
|
4
|
+
|
|
5
|
+
## Parameters
|
|
6
|
+
|
|
7
|
+
| Name | In | Type | Required | Description |
|
|
8
|
+
| --- | --- | --- | --- | --- |
|
|
9
|
+
| `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
|
|
10
|
+
|
|
11
|
+
## Request body
|
|
12
|
+
|
|
13
|
+
`application/json`
|
|
14
|
+
|
|
15
|
+
| Property | Type | Required | Default | Description |
|
|
16
|
+
| --- | --- | --- | --- | --- |
|
|
17
|
+
| `name` | `string` | yes | | 2 to 40 lowercase letters, digits or -, starting with a letter. |
|
|
18
|
+
| `version` | `string` | yes | | |
|
|
19
|
+
| `description` | `string` | yes | | |
|
|
20
|
+
| `api` | `integer` | yes | | The module API version the extension's entry file exports. |
|
|
21
|
+
| `source` | `object` | yes | | |
|
|
22
|
+
| `commit` | `string` | yes | | The git commit id (40 hex), or local-<12 hex> for a folder. |
|
|
23
|
+
| `manifest_sha256` | `string` | yes | | |
|
|
24
|
+
| `entry_sha256` | `string` | yes | | |
|
|
25
|
+
| `token` | `string` | yes | | The extension's named token: ext-\<name>. |
|
|
26
|
+
| `tables` | `object` | yes | | Each role of the manifest, bound to a qualified table. |
|
|
27
|
+
| `tools` | `string[]` | yes | | |
|
|
28
|
+
| `write` | `string[]` | yes | | The token's write patterns (qualified table names). |
|
|
29
|
+
| `migration_id` | `string \| null` | yes | | The batch that brought the database from `previous` to this record. |
|
|
30
|
+
| `installed_at` | `string` | yes | | |
|
|
31
|
+
| `updated_at` | `string` | yes | | |
|
|
32
|
+
| `previous` | `InstalledExtension \| null` | yes | | The record before the last install, repair or update; null after a first install. |
|
|
33
|
+
|
|
34
|
+
## Responses
|
|
35
|
+
|
|
36
|
+
| Status | Description | Body |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| 200 | Done. | `object` (application/json) |
|
|
39
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
40
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
41
|
+
| 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
|
|
42
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
43
|
+
|
|
44
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# extensions
|
|
2
|
+
|
|
3
|
+
The extensions installed in the database: their versions, tables, tools and tokens.
|
|
4
|
+
|
|
5
|
+
## Operations
|
|
6
|
+
|
|
7
|
+
- [The extensions installed in the database, and its id (any token).](https://datanotes.dev/api/operations/extensions_list/): `POST /datanotes/extensions/`
|
|
8
|
+
- [Record an installed extension (owner only): what datanotes extension install writes.](https://datanotes.dev/api/operations/extensions_record/): `POST /datanotes/extensions/record/`
|
|
9
|
+
- [Forget an installed extension (owner only): what datanotes extension remove does.](https://datanotes.dev/api/operations/extensions_delete/): `POST /datanotes/extensions/delete/`
|
package/dist/docs/api.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Datanotes HTTP API
|
|
2
2
|
|
|
3
|
-
> OpenAPI 3.1.0 description of the Datanotes 3.
|
|
3
|
+
> OpenAPI 3.1.0 description of the Datanotes 3.3.1 HTTP API: https://datanotes.dev/openapi.json
|
|
4
4
|
|
|
5
5
|
Database of Markdown notes: tables of notes, rows, queries, history, a change feed and the vault's notes.
|
|
6
6
|
|
|
@@ -120,6 +120,14 @@ Named tokens and their permissions; what MCP servers report about their agents'
|
|
|
120
120
|
- [Revoke a named token (owner only): it stops working at once.](https://datanotes.dev/api/operations/tokens_delete/): `POST /datanotes/tokens/delete/`
|
|
121
121
|
- [Give a named token a new value (owner only): the old one stops working.](https://datanotes.dev/api/operations/tokens_rotate/): `POST /datanotes/tokens/rotate/`
|
|
122
122
|
|
|
123
|
+
### extensions
|
|
124
|
+
|
|
125
|
+
The extensions installed in the database: their versions, tables, tools and tokens.
|
|
126
|
+
|
|
127
|
+
- [The extensions installed in the database, and its id (any token).](https://datanotes.dev/api/operations/extensions_list/): `POST /datanotes/extensions/`
|
|
128
|
+
- [Record an installed extension (owner only): what datanotes extension install writes.](https://datanotes.dev/api/operations/extensions_record/): `POST /datanotes/extensions/record/`
|
|
129
|
+
- [Forget an installed extension (owner only): what datanotes extension remove does.](https://datanotes.dev/api/operations/extensions_delete/): `POST /datanotes/extensions/delete/`
|
|
130
|
+
|
|
123
131
|
### service
|
|
124
132
|
|
|
125
133
|
Status, stop, this document, the interactive console, the docs.
|