datanotes 2.0.0 → 3.0.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/NOTICE +9 -0
- package/README.md +207 -28
- package/SECURITY.md +92 -45
- package/dist/THIRD-PARTY-NOTICES.txt +682 -0
- package/dist/api/catalog.d.cts +69 -0
- package/dist/api/catalog.d.ts +50 -2
- package/dist/api/cli-options.d.cts +39 -0
- package/dist/api/cli-options.d.ts +39 -0
- package/dist/api/client.d.cts +89 -0
- package/dist/api/client.d.ts +19 -30
- package/dist/api/docs.d.cts +211 -0
- package/dist/api/docs.d.ts +211 -0
- package/dist/api/guidance.d.cts +81 -0
- package/dist/api/guidance.d.ts +81 -0
- package/dist/api/index.cjs +6610 -2247
- package/dist/api/index.d.cts +13 -0
- package/dist/api/index.d.ts +10 -7
- package/dist/api/index.js +6610 -2247
- package/dist/api/local.cjs +118 -6
- package/dist/api/local.d.cts +95 -0
- package/dist/api/local.d.ts +70 -6
- package/dist/api/local.js +104 -6
- package/dist/api/mcp.cjs +17384 -0
- package/dist/api/mcp.d.cts +108 -0
- package/dist/api/mcp.d.ts +108 -0
- package/dist/api/mcp.js +17334 -0
- package/dist/api/otlp.d.cts +65 -0
- package/dist/api/redact.d.cts +17 -0
- package/dist/api/redact.d.ts +17 -0
- package/dist/api/requests.d.cts +26 -0
- package/dist/api/requests.d.ts +14 -16
- package/dist/api/results.d.cts +16 -0
- package/dist/api/results.d.ts +2 -1
- package/dist/api/tokens.d.cts +7 -0
- package/dist/datanotes.cjs +62911 -28409
- package/dist/docs/administration/configuration.md +59 -0
- package/dist/docs/administration/docker.md +80 -0
- package/dist/docs/administration/git-sync.md +71 -0
- package/dist/docs/administration/limits.md +69 -0
- package/dist/docs/administration/run-the-service.md +219 -0
- package/dist/docs/administration/status.md +61 -0
- package/dist/docs/administration/use-with-obsidian.md +75 -0
- package/dist/docs/api/operations/add_column.md +49 -0
- package/dist/docs/api/operations/add_constraint.md +55 -0
- package/dist/docs/api/operations/adopt_rows.md +50 -0
- package/dist/docs/api/operations/align_relations.md +41 -0
- package/dist/docs/api/operations/alter_column.md +46 -0
- package/dist/docs/api/operations/alter_table.md +67 -0
- package/dist/docs/api/operations/batch.md +48 -0
- package/dist/docs/api/operations/changes_stream.md +28 -0
- package/dist/docs/api/operations/check_table.md +29 -0
- package/dist/docs/api/operations/clone_table.md +48 -0
- package/dist/docs/api/operations/comment_on.md +42 -0
- package/dist/docs/api/operations/configure_database.md +52 -0
- package/dist/docs/api/operations/create_table.md +78 -0
- package/dist/docs/api/operations/create_view.md +54 -0
- package/dist/docs/api/operations/create_webhook.md +37 -0
- package/dist/docs/api/operations/define_base.md +52 -0
- package/dist/docs/api/operations/delete_rows.md +43 -0
- package/dist/docs/api/operations/delete_webhook.md +31 -0
- package/dist/docs/api/operations/describe_database.md +30 -0
- package/dist/docs/api/operations/describe_history.md +40 -0
- package/dist/docs/api/operations/describe_semantic_index.md +24 -0
- package/dist/docs/api/operations/describe_table.md +38 -0
- package/dist/docs/api/operations/docs.md +13 -0
- package/dist/docs/api/operations/drop_column.md +41 -0
- package/dist/docs/api/operations/drop_constraint.md +39 -0
- package/dist/docs/api/operations/drop_table.md +43 -0
- package/dist/docs/api/operations/drop_view.md +38 -0
- package/dist/docs/api/operations/engine_status.md +23 -0
- package/dist/docs/api/operations/graph_neighbors.md +32 -0
- package/dist/docs/api/operations/graph_path.md +32 -0
- package/dist/docs/api/operations/graph_traverse.md +43 -0
- package/dist/docs/api/operations/identify_session.md +24 -0
- package/dist/docs/api/operations/infer_table.md +43 -0
- package/dist/docs/api/operations/insert_row.md +48 -0
- package/dist/docs/api/operations/list_changes.md +35 -0
- package/dist/docs/api/operations/list_folder.md +28 -0
- package/dist/docs/api/operations/list_link_targets.md +44 -0
- package/dist/docs/api/operations/list_migrations.md +35 -0
- package/dist/docs/api/operations/list_tables.md +32 -0
- package/dist/docs/api/operations/list_webhooks.md +23 -0
- package/dist/docs/api/operations/manual_index.md +14 -0
- package/dist/docs/api/operations/manual_page.md +22 -0
- package/dist/docs/api/operations/merge_rows.md +44 -0
- package/dist/docs/api/operations/move_rows.md +52 -0
- package/dist/docs/api/operations/openapi.md +13 -0
- package/dist/docs/api/operations/openapi_post.md +20 -0
- package/dist/docs/api/operations/read_note.md +29 -0
- package/dist/docs/api/operations/recompute_columns.md +44 -0
- package/dist/docs/api/operations/record_tool_call.md +36 -0
- package/dist/docs/api/operations/rename_column.md +44 -0
- package/dist/docs/api/operations/rename_value.md +45 -0
- package/dist/docs/api/operations/restore_database.md +51 -0
- package/dist/docs/api/operations/restore_table.md +46 -0
- package/dist/docs/api/operations/search_notes.md +28 -0
- package/dist/docs/api/operations/select_rows.md +61 -0
- package/dist/docs/api/operations/semantic_search.md +34 -0
- package/dist/docs/api/operations/semantic_search_docs.md +26 -0
- package/dist/docs/api/operations/set_table_bases.md +44 -0
- package/dist/docs/api/operations/status.md +13 -0
- package/dist/docs/api/operations/stop_engine.md +23 -0
- package/dist/docs/api/operations/sync_semantic_index.md +33 -0
- package/dist/docs/api/operations/table_changes.md +31 -0
- package/dist/docs/api/operations/tags/auxiliary.md +14 -0
- package/dist/docs/api/operations/tags/change-feed.md +8 -0
- package/dist/docs/api/operations/tags/history.md +17 -0
- package/dist/docs/api/operations/tags/queries.md +15 -0
- package/dist/docs/api/operations/tags/rows-dml.md +16 -0
- package/dist/docs/api/operations/tags/schema-ddl.md +22 -0
- package/dist/docs/api/operations/tags/service.md +15 -0
- package/dist/docs/api/operations/tags/tokens.md +13 -0
- package/dist/docs/api/operations/tokens_create.md +34 -0
- package/dist/docs/api/operations/tokens_delete.md +29 -0
- package/dist/docs/api/operations/tokens_list.md +21 -0
- package/dist/docs/api/operations/tokens_me.md +20 -0
- package/dist/docs/api/operations/tokens_rotate.md +29 -0
- package/dist/docs/api/operations/tokens_update.md +34 -0
- package/dist/docs/api/operations/undo_migration.md +46 -0
- package/dist/docs/api/operations/update_row.md +60 -0
- package/dist/docs/api/operations/update_rows.md +46 -0
- package/dist/docs/api/operations/vacuum_table.md +37 -0
- package/dist/docs/api.md +135 -0
- package/dist/docs/develop/build-an-app.md +320 -0
- package/dist/docs/develop/build-on-datanotes.md +138 -0
- package/dist/docs/develop/change-feed-and-webhooks.md +70 -0
- package/dist/docs/develop/client.md +116 -0
- package/dist/docs/develop/concurrency.md +153 -0
- package/dist/docs/develop/http-api.md +79 -0
- package/dist/docs/develop/telemetry.md +86 -0
- package/dist/docs/guides/agents/docs-offline.md +99 -0
- package/dist/docs/guides/agents/how-agents-use-datanotes.md +124 -0
- package/dist/docs/guides/agents/prompts.md +495 -0
- package/dist/docs/guides/agents/reading-errors.md +112 -0
- package/dist/docs/guides/data-quality/check-constraints.md +379 -0
- package/dist/docs/guides/data-quality/check-table.md +63 -0
- package/dist/docs/guides/data-quality/hand-edits.md +507 -0
- package/dist/docs/guides/data-quality/sync-between-devices.md +51 -0
- package/dist/docs/guides/data-quality/validation.md +90 -0
- package/dist/docs/guides/database-objects/bases.md +480 -0
- package/dist/docs/guides/database-objects/catalogs-and-schemas.md +897 -0
- package/dist/docs/guides/database-objects/columns.md +1332 -0
- package/dist/docs/guides/database-objects/relations.md +1454 -0
- package/dist/docs/guides/database-objects/tables.md +1404 -0
- package/dist/docs/guides/database-objects/views.md +1003 -0
- package/dist/docs/guides/history/back-up.md +195 -0
- package/dist/docs/guides/history/change-data-feed.md +247 -0
- package/dist/docs/guides/history/journal-and-undo.md +262 -0
- package/dist/docs/guides/history/restore.md +341 -0
- package/dist/docs/guides/history/table-history.md +657 -0
- package/dist/docs/guides/history/vacuum.md +35 -0
- package/dist/docs/guides/read-and-write/automatic-links.md +768 -0
- package/dist/docs/guides/read-and-write/batch.md +139 -0
- package/dist/docs/guides/read-and-write/import-notes.md +896 -0
- package/dist/docs/guides/read-and-write/joins-and-aggregates.md +251 -0
- package/dist/docs/guides/read-and-write/read-and-filter.md +536 -0
- package/dist/docs/guides/read-and-write/write-rows.md +573 -0
- package/dist/docs/guides/search/link-graph.md +146 -0
- package/dist/docs/guides/search/semantic.md +133 -0
- package/dist/docs/guides/search/text.md +142 -0
- package/dist/docs/guides/security/security-model.md +110 -0
- package/dist/docs/guides/security/tokens.md +60 -0
- package/dist/docs/guides/security/who-did-what.md +42 -0
- package/dist/docs/index.md +113 -0
- package/dist/docs/llms.txt +33 -0
- package/dist/docs/reference/cli.md +136 -0
- package/dist/docs/reference/compatibility.md +63 -0
- package/dist/docs/reference/errors.md +72 -0
- package/dist/docs/reference/glossary.md +161 -0
- package/dist/docs/reference/operations/auxiliary.md +116 -0
- package/dist/docs/reference/operations/history.md +168 -0
- package/dist/docs/reference/operations/queries.md +169 -0
- package/dist/docs/reference/operations/rows.md +185 -0
- package/dist/docs/reference/operations/schema.md +316 -0
- package/dist/docs/reference/operations.md +96 -0
- package/dist/docs/reference/settings.md +31 -0
- package/dist/docs/release-notes.md +67 -0
- package/dist/docs/start/connect-agents.md +204 -0
- package/dist/docs/start/how-it-works.md +317 -0
- package/dist/docs/start/quick-start.md +126 -0
- package/package.json +59 -14
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Remove a view from `metastore.yaml` (undo with `undo_migration`).
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/drop_view/` (operation `drop_view`)
|
|
4
|
+
|
|
5
|
+
Remove a view from `metastore.yaml` (undo with `undo_migration`).
|
|
6
|
+
|
|
7
|
+
The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
|
|
8
|
+
|
|
9
|
+
## Parameters
|
|
10
|
+
|
|
11
|
+
| Name | In | Type | Required | Description |
|
|
12
|
+
| --- | --- | --- | --- | --- |
|
|
13
|
+
| `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
|
|
14
|
+
|
|
15
|
+
## Request body
|
|
16
|
+
|
|
17
|
+
`application/json`, required
|
|
18
|
+
|
|
19
|
+
| Property | Type | Required | Default | Description |
|
|
20
|
+
| --- | --- | --- | --- | --- |
|
|
21
|
+
| `view` | `string` | yes | | |
|
|
22
|
+
| `dry_run` | `boolean` | no | `false` | |
|
|
23
|
+
|
|
24
|
+
## Responses
|
|
25
|
+
|
|
26
|
+
| Status | Description | Body |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| 200 | Done. | `OpResult` (application/json) |
|
|
29
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
30
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
31
|
+
| 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
|
|
32
|
+
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
|
|
33
|
+
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
|
|
34
|
+
| 422 | Refused (validation failures, conflicts, an unmet `expect`): nothing written. Same body as 200, with `ok: false` and the reasons. | `OpResult` (application/json) |
|
|
35
|
+
| 500 | Unexpected error (`{error}`), or a write that failed partway and could not be rolled back: `rolled_back: false`, `failed` lists the files left (undo_migration on `migration_id` retries the rollback). | `OpResult \| Error` (application/json) |
|
|
36
|
+
| 503 | A write that failed partway (a file another program holds) and was rolled back: `rolled_back: true`, nothing written. Send it again later. Same body as 200, with `ok: false` and `failed`. | `OpResult` (application/json) |
|
|
37
|
+
|
|
38
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# The engine's health at a glance (owner only; `datanotes status` prints it): engine, database, journal, git sync, change feed, webhooks, named tokens, hand edits breaking the rules in the last 24 h, logs.
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/status/` (operation `engine_status`)
|
|
4
|
+
|
|
5
|
+
Reads what the engine already knows (nothing is checked again): hand edits are judged by the checks the change feed recorded with them. `healthy` is false when `problems` lists something. A named token is refused (403), even with `maintain`.
|
|
6
|
+
|
|
7
|
+
## Request body
|
|
8
|
+
|
|
9
|
+
`application/json`
|
|
10
|
+
|
|
11
|
+
Type: `object`
|
|
12
|
+
|
|
13
|
+
## Responses
|
|
14
|
+
|
|
15
|
+
| Status | Description | Body |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| 200 | Done. | `EngineStatus` (application/json) |
|
|
18
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
19
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
20
|
+
| 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
|
|
21
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
22
|
+
|
|
23
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Direct neighbours of notes: what they link to (`out`) and what links to them (`in`,
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/graph_neighbors/` (operation `graph_neighbors`)
|
|
4
|
+
|
|
5
|
+
Direct neighbours of notes: what they link to (`out`) and what links to them (`in`,
|
|
6
|
+
backlinks), with counts per edge label. `direction`: out, in or both (default).
|
|
7
|
+
|
|
8
|
+
`from_nodes` selects the notes: `{"paths": [...]}` and/or `{"table": ..., "where": {...}}`.
|
|
9
|
+
Edges are labelled with their link column (`people`, `event`, …) or `link` for other links.
|
|
10
|
+
|
|
11
|
+
## Request body
|
|
12
|
+
|
|
13
|
+
`application/json`, required
|
|
14
|
+
|
|
15
|
+
| Property | Type | Required | Default | Description |
|
|
16
|
+
| --- | --- | --- | --- | --- |
|
|
17
|
+
| `from_nodes` | `object` | yes | | |
|
|
18
|
+
| `direction` | `"out" \| "in" \| "both" \| null` | no | `null` | |
|
|
19
|
+
| `edges` | `string[] \| null` | no | `null` | |
|
|
20
|
+
|
|
21
|
+
## Responses
|
|
22
|
+
|
|
23
|
+
| Status | Description | Body |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| 200 | Done. | `object` (application/json) |
|
|
26
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
27
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
28
|
+
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
|
|
29
|
+
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
|
|
30
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
31
|
+
|
|
32
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Shortest chain of links between two sets of notes (each `{"paths": [...]}` and/or
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/graph_path/` (operation `graph_path`)
|
|
4
|
+
|
|
5
|
+
Shortest chain of links between two sets of notes (each `{"paths": [...]}` and/or
|
|
6
|
+
`{"table", "where"}`): `found`, `length` and `path`: the steps (`from`, `label`, `direction`, `to`).
|
|
7
|
+
`direction` both by default; `max_depth` default 6 (max 10).
|
|
8
|
+
|
|
9
|
+
## Request body
|
|
10
|
+
|
|
11
|
+
`application/json`, required
|
|
12
|
+
|
|
13
|
+
| Property | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `from_nodes` | `object` | yes | | |
|
|
16
|
+
| `to_nodes` | `object` | yes | | |
|
|
17
|
+
| `direction` | `"out" \| "in" \| "both" \| null` | no | `null` | |
|
|
18
|
+
| `edges` | `string[] \| null` | no | `null` | |
|
|
19
|
+
| `max_depth` | `integer \| null` | no | `null` | |
|
|
20
|
+
|
|
21
|
+
## Responses
|
|
22
|
+
|
|
23
|
+
| Status | Description | Body |
|
|
24
|
+
| --- | --- | --- |
|
|
25
|
+
| 200 | Done. | `object` (application/json) |
|
|
26
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
27
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
28
|
+
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
|
|
29
|
+
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
|
|
30
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
31
|
+
|
|
32
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Breadth-first walk over links from `from_nodes` (`{"paths": [...]}` and/or `{"table", "where"}`).
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/graph_traverse/` (operation `graph_traverse`)
|
|
4
|
+
|
|
5
|
+
Breadth-first walk over links from `from_nodes` (`{"paths": [...]}` and/or `{"table", "where"}`).
|
|
6
|
+
|
|
7
|
+
- `direction`: out (default, follow links), in (follow backlinks) or both.
|
|
8
|
+
- `edges`: edge labels to follow (link columns such as `people`, `event`, or `link`).
|
|
9
|
+
- `tables`: return only notes of these tables; `through`: only walk on through these tables.
|
|
10
|
+
- `min_depth` (default 1) / `max_depth` (default 2, max 10), `limit` (default 500).
|
|
11
|
+
|
|
12
|
+
Each node comes with `depth` and `via` (one shortest route). Example — moods tied to events
|
|
13
|
+
with Alice: from `{"table": "person", "where": {"name": "Alice"}}`, direction `in`, edges
|
|
14
|
+
`["people", "event"]`, tables `["mood"]`, max_depth 2. Feed the paths to `select_rows` with
|
|
15
|
+
`where: {"path": {"in": [...]}}` to aggregate them.
|
|
16
|
+
|
|
17
|
+
## Request body
|
|
18
|
+
|
|
19
|
+
`application/json`, required
|
|
20
|
+
|
|
21
|
+
| Property | Type | Required | Default | Description |
|
|
22
|
+
| --- | --- | --- | --- | --- |
|
|
23
|
+
| `from_nodes` | `object` | yes | | |
|
|
24
|
+
| `direction` | `"out" \| "in" \| "both" \| null` | no | `null` | |
|
|
25
|
+
| `edges` | `string[] \| null` | no | `null` | |
|
|
26
|
+
| `tables` | `string[] \| null` | no | `null` | |
|
|
27
|
+
| `through` | `string[] \| null` | no | `null` | |
|
|
28
|
+
| `min_depth` | `integer \| null` | no | `null` | |
|
|
29
|
+
| `max_depth` | `integer \| null` | no | `null` | |
|
|
30
|
+
| `limit` | `integer \| null` | no | `null` | |
|
|
31
|
+
|
|
32
|
+
## Responses
|
|
33
|
+
|
|
34
|
+
| Status | Description | Body |
|
|
35
|
+
| --- | --- | --- |
|
|
36
|
+
| 200 | Done. | `object` (application/json) |
|
|
37
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
38
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
39
|
+
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
|
|
40
|
+
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
|
|
41
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
42
|
+
|
|
43
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Tell the engine the model and harness behind an agent session (what an MCP server reports): later requests carrying that session in `X-Datanotes-Actor` are journaled with it. Any token may call it.
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/sessions/identify/` (operation `identify_session`)
|
|
4
|
+
|
|
5
|
+
## Request body
|
|
6
|
+
|
|
7
|
+
`application/json`, required
|
|
8
|
+
|
|
9
|
+
| Property | Type | Required | Default | Description |
|
|
10
|
+
| --- | --- | --- | --- | --- |
|
|
11
|
+
| `session` | `string` | yes | | |
|
|
12
|
+
| `model` | `string` | no | | |
|
|
13
|
+
| `harness` | `string` | no | | |
|
|
14
|
+
|
|
15
|
+
## Responses
|
|
16
|
+
|
|
17
|
+
| Status | Description | Body |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| 200 | Done. | `object` (application/json) |
|
|
20
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
21
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
22
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
23
|
+
|
|
24
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Read-only schema inference from notes' front matter.
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/infer_table/` (operation `infer_table`)
|
|
4
|
+
|
|
5
|
+
Read-only schema inference from notes' front matter.
|
|
6
|
+
- `folder` (recursive; "" = whole vault) and/or `paths`: notes not yet in a table. Returns
|
|
7
|
+
`columns` (type, enum `values`, link `ref` to the table most targets belong to, `required`,
|
|
8
|
+
`unique`, `dense`, `from` when the front matter key is not a valid column name, `stats`),
|
|
9
|
+
`proposal`, the create_table arguments (`name`, `description`, `filename` or
|
|
10
|
+
`time_column`, `columns`), and `adopt` ready for adopt_rows (`paths`, `rename`,
|
|
11
|
+
`relocate: false`), plus `hints` to read.
|
|
12
|
+
The notes cannot say what the table and its columns mean: `description` is null on the proposal
|
|
13
|
+
and on every column. Write each one (ask the user when unsure), and review the names, enums and
|
|
14
|
+
required columns, before you pass the proposal to create_table, which refuses null descriptions.
|
|
15
|
+
- `table`: keys the table's rows use but the table does not declare (candidates for add_column,
|
|
16
|
+
each with a description to write, or keys to drop from rows).
|
|
17
|
+
A string column becomes an enum when its values repeat: at least 3 notes, at most `max_enum_values`
|
|
18
|
+
distinct values (default 12), each used twice on average, short texts.
|
|
19
|
+
|
|
20
|
+
## Request body
|
|
21
|
+
|
|
22
|
+
`application/json`
|
|
23
|
+
|
|
24
|
+
| Property | Type | Required | Default | Description |
|
|
25
|
+
| --- | --- | --- | --- | --- |
|
|
26
|
+
| `folder` | `string \| null` | no | `null` | |
|
|
27
|
+
| `paths` | `string[] \| null` | no | `null` | |
|
|
28
|
+
| `table` | `string \| null` | no | `null` | |
|
|
29
|
+
| `name` | `string \| null` | no | `null` | |
|
|
30
|
+
| `max_enum_values` | `integer \| null` | no | `null` | |
|
|
31
|
+
|
|
32
|
+
## Responses
|
|
33
|
+
|
|
34
|
+
| Status | Description | Body |
|
|
35
|
+
| --- | --- | --- |
|
|
36
|
+
| 200 | Done. | `object` (application/json) |
|
|
37
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
38
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
39
|
+
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
|
|
40
|
+
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
|
|
41
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
42
|
+
|
|
43
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Insert a row (new note). Values are validated against the columns; the note path comes from
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/insert_row/` (operation `insert_row`)
|
|
4
|
+
|
|
5
|
+
Insert a row (new note). Values are validated against the columns; the note path comes from
|
|
6
|
+
the table's `path`/`filename` patterns (e.g. an event logged today about last night lands in
|
|
7
|
+
last night's day folder when you set `occurred_at` to last night). `body` is the note text.
|
|
8
|
+
Generated / identity columns are computed (do not pass them); CHECK constraints are enforced.
|
|
9
|
+
Returns `migration_id` (undo) and the created path in `planned_creates`.
|
|
10
|
+
`body` links the notes it mentions by name, at their first mention (automatic links; off with
|
|
11
|
+
`autolink: false` or the database's `autolink` setting). `links_added` lists the links made;
|
|
12
|
+
`ambiguous_mentions` lists the mentions left as text with the notes they may name: read those,
|
|
13
|
+
then link the right one with update_row and `autolink: false`, or leave the text.
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Name | In | Type | Required | Description |
|
|
18
|
+
| --- | --- | --- | --- | --- |
|
|
19
|
+
| `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
|
|
20
|
+
|
|
21
|
+
## Request body
|
|
22
|
+
|
|
23
|
+
`application/json`, required
|
|
24
|
+
|
|
25
|
+
| Property | Type | Required | Default | Description |
|
|
26
|
+
| --- | --- | --- | --- | --- |
|
|
27
|
+
| `table` | `string` | yes | | |
|
|
28
|
+
| `values` | `object` | yes | | |
|
|
29
|
+
| `body` | `string \| null` | no | `null` | |
|
|
30
|
+
| `path` | `string \| null` | no | `null` | Optional note path (vault-relative), instead of the table's file-name pattern; `.md` is added if missing; it must stay inside the vault. |
|
|
31
|
+
| `dry_run` | `boolean` | no | `false` | |
|
|
32
|
+
| `autolink` | `boolean \| null` | no | `null` | Automatic links for this write: true links the notes `body` mentions by name, false writes it as given. Default: the calling token's `autolink` default, else the database's `autolink` setting (on unless configure_database turned it off). |
|
|
33
|
+
|
|
34
|
+
## Responses
|
|
35
|
+
|
|
36
|
+
| Status | Description | Body |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| 200 | Done. | `OpResult` (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
|
+
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
|
|
43
|
+
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
|
|
44
|
+
| 422 | Refused (validation failures, conflicts, an unmet `expect`): nothing written. Same body as 200, with `ok: false` and the reasons. | `OpResult` (application/json) |
|
|
45
|
+
| 500 | Unexpected error (`{error}`), or a write that failed partway and could not be rolled back: `rolled_back: false`, `failed` lists the files left (undo_migration on `migration_id` retries the rollback). | `OpResult \| Error` (application/json) |
|
|
46
|
+
| 503 | A write that failed partway (a file another program holds) and was rolled back: `rolled_back: true`, nothing written. Send it again later. Same body as 200, with `ok: false` and `failed`. | `OpResult` (application/json) |
|
|
47
|
+
|
|
48
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Change feed across all tables: numbered row changes (`seq`), oldest first, from engine writes
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/list_changes/` (operation `list_changes`)
|
|
4
|
+
|
|
5
|
+
Change feed across all tables: numbered row changes (`seq`), oldest first, from engine writes
|
|
6
|
+
and from hand edits (`source: external`). Each has `table`, `kind` (insert, update, delete, move,
|
|
7
|
+
metastore, unreadable), `op` (the operation that made it), `path`, `row_id`, `changes` ({column: {before, after}}), `actor`, `migration_id`. Hand edits are compared in batches (0.7 s after the last vault change, at most 5 s after the first), in the order they happened, renames included. A hand edit that creates, changes, renames or removes a row is checked against the tables' rules (as check_table does) with the rows that link to it: the last event of each row in the batch has `violations` ([{path, violations: [{code, column | constraint (the CHECK's name), index, message}]}]), what the edit breaks (a rule a row already broke is not listed); empty when it breaks nothing, absent when nothing was checked (engine events, a check that failed). A hand edit of metastore.yaml that changes tables' entries checks every row of those tables: on its `metastore` event. At most 100 per event; `violations_total` then counts them all. A note renamed or moved by hand (a row or a plain note) has the links to its old path rewritten across the vault once the vault is quiet (4 s without a change; not while git pulls, rebases or merges; setting repairLinksOnHandMove, on by default), and its move event does not report them as broken_link: that repair's events (`op: repair_links`) follow the batch and name the moves in `cause` ([{path, old_path, seq}], `seq` of the row's move event). A hand edit that leaves a row's front matter unreadable (broken YAML) is a `kind: unreadable` event with one violation of code `unreadable`: every read leaves the row out until the note is fixed, and the fix is an update of the row's last readable state (an insert for a new note). Agents' tool calls (reported by MCP servers) are `kind: tool_call` events (`call`: tool, args, ok, duration_ms, value, served_by), returned only when `kinds` includes tool_call. Pass the returned
|
|
8
|
+
`last` as `since` next time (`head` is the newest number); `wait_ms` (max 60000) waits for a new change (long poll); `limit` max 5000. `gap: true` means
|
|
9
|
+
older changes were dropped: re-read the tables. `where` filters rows as in select_rows (on the values after the change). Per-table versions: `table_changes`.
|
|
10
|
+
|
|
11
|
+
## Request body
|
|
12
|
+
|
|
13
|
+
`application/json`
|
|
14
|
+
|
|
15
|
+
| Property | Type | Required | Default | Description |
|
|
16
|
+
| --- | --- | --- | --- | --- |
|
|
17
|
+
| `since` | `integer` | no | `0` | |
|
|
18
|
+
| `tables` | `string[] \| null` | no | `null` | |
|
|
19
|
+
| `kinds` | `("insert" \| "update" \| "delete" \| "move" \| "metastore" \| "tool_call" \| "unreadable")[] \| null` | no | `null` | |
|
|
20
|
+
| `columns` | `string[] \| null` | no | `null` | |
|
|
21
|
+
| `where` | `object \| null` | no | `null` | |
|
|
22
|
+
| `exclude_actor` | `string \| null` | no | `null` | |
|
|
23
|
+
| `limit` | `integer` | no | `500` | |
|
|
24
|
+
| `wait_ms` | `integer` | no | `0` | |
|
|
25
|
+
|
|
26
|
+
## Responses
|
|
27
|
+
|
|
28
|
+
| Status | Description | Body |
|
|
29
|
+
| --- | --- | --- |
|
|
30
|
+
| 200 | Done. | `object` (application/json) |
|
|
31
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
32
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
33
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
34
|
+
|
|
35
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# The direct children of a vault folder: `{folder, folders, files}`, each a vault path, sorted;
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/list_folder/` (operation `list_folder`)
|
|
4
|
+
|
|
5
|
+
The direct children of a vault folder: `{folder, folders, files}`, each a vault path, sorted;
|
|
6
|
+
dot-files and dot-folders are left out. `folder` "" is the vault root. A missing folder is an
|
|
7
|
+
error.
|
|
8
|
+
|
|
9
|
+
## Request body
|
|
10
|
+
|
|
11
|
+
`application/json`
|
|
12
|
+
|
|
13
|
+
| Property | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `folder` | `string` | no | `""` | Vault-relative folder; "" is the vault root. |
|
|
16
|
+
|
|
17
|
+
## Responses
|
|
18
|
+
|
|
19
|
+
| Status | Description | Body |
|
|
20
|
+
| --- | --- | --- |
|
|
21
|
+
| 200 | Done. | `object` (application/json) |
|
|
22
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
23
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
24
|
+
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
|
|
25
|
+
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
|
|
26
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
27
|
+
|
|
28
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# The rows a link column may point to, for one row: what an agent or a picker offers before writing
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/list_link_targets/` (operation `list_link_targets`)
|
|
4
|
+
|
|
5
|
+
The rows a link column may point to, for one row: what an agent or a picker offers before writing
|
|
6
|
+
the link. A link column can filter its targets:
|
|
7
|
+
- `ref_where`: a `where` filter every target must match (`{"kind": {"in": ["area", "project"]}}`).
|
|
8
|
+
- `ref_by`: a column of the row picks the targets' level: `{"column": "kind", "map": {"area": null,
|
|
9
|
+
"project": ["area"], "workstream": ["project"]}}`: a workstream's parent must have kind project; `null`
|
|
10
|
+
is a top level (the link must stay empty); any other level needs the link; a value missing from the
|
|
11
|
+
map is refused. `levels: ["area", "project", "workstream"]` writes the same chain short (each
|
|
12
|
+
level's parent is the level before it). `target_column` reads another column of the target
|
|
13
|
+
(default: the same name). describe_table shows the expanded map.
|
|
14
|
+
Writes refuse other targets (code `ref`, listing the valid ones), a link to the row itself (`ref`),
|
|
15
|
+
a link to no row of the table (`broken_link`) and a missing link a level needs (`required`). Pass the
|
|
16
|
+
row (`row`: path, link or name; a name rows in different folders share is refused, listing their
|
|
17
|
+
paths) and/or its values (`values`, e.g. `{"kind": "workstream"}` for a new row). Returns
|
|
18
|
+
`{rows: [{name, link, path, <level column>}], total, required, empty, reason}` (no rows, and the
|
|
19
|
+
reason, for a level the map lacks); write a row's `link` as the value.
|
|
20
|
+
|
|
21
|
+
## Request body
|
|
22
|
+
|
|
23
|
+
`application/json`, required
|
|
24
|
+
|
|
25
|
+
| Property | Type | Required | Default | Description |
|
|
26
|
+
| --- | --- | --- | --- | --- |
|
|
27
|
+
| `table` | `string` | yes | | |
|
|
28
|
+
| `column` | `string` | yes | | A link column (or list of links) with ref. |
|
|
29
|
+
| `row` | `string \| null` | no | `null` | The row the link is for: its path, a link to it or its name (its values are read). |
|
|
30
|
+
| `values` | `object \| null` | no | `null` | Values of the row (a new one, or changes to `row`), e.g. {"kind": "workstream"}. |
|
|
31
|
+
| `limit` | `integer \| null` | no | `null` | At most this many targets: a positive integer (default 50, at most 500). |
|
|
32
|
+
|
|
33
|
+
## Responses
|
|
34
|
+
|
|
35
|
+
| Status | Description | Body |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| 200 | Done. | `object` (application/json) |
|
|
38
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
39
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
40
|
+
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
|
|
41
|
+
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (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,35 @@
|
|
|
1
|
+
# The operation journal, newest first: `total` (the matching operations) and `migrations`, each with
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/list_migrations/` (operation `list_migrations`)
|
|
4
|
+
|
|
5
|
+
The operation journal, newest first: `total` (the matching operations) and `migrations`, each with
|
|
6
|
+
`migration_id` (for undo_migration), `op`, `summary`, `table` (when it was about one), `executed_at`,
|
|
7
|
+
`notes_changed`, `files_changed`, `undone`, `undoes`, `files_failed`, `by` (the agent), and `members`
|
|
8
|
+
(a batch's operations) or `batch` (the batch of an operation).
|
|
9
|
+
Filters: `op` (e.g. "update_rows"), `table` (substring of the table name, e.g.
|
|
10
|
+
"personal.tasks.task"), `since` (ISO date). `limit` default 50. The journal is kept in the
|
|
11
|
+
engine's store, outside the vault (`store:journal/`); entries older than 90 days are dropped.
|
|
12
|
+
|
|
13
|
+
## Request body
|
|
14
|
+
|
|
15
|
+
`application/json`
|
|
16
|
+
|
|
17
|
+
| Property | Type | Required | Default | Description |
|
|
18
|
+
| --- | --- | --- | --- | --- |
|
|
19
|
+
| `limit` | `integer \| null` | no | `null` | |
|
|
20
|
+
| `op` | `string \| null` | no | `null` | |
|
|
21
|
+
| `table` | `string \| null` | no | `null` | |
|
|
22
|
+
| `since` | `string \| null` | no | `null` | |
|
|
23
|
+
|
|
24
|
+
## Responses
|
|
25
|
+
|
|
26
|
+
| Status | Description | Body |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| 200 | Done. | `object` (application/json) |
|
|
29
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
30
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
31
|
+
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
|
|
32
|
+
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
|
|
33
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
34
|
+
|
|
35
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# List every table: `name`, `catalog`, `schema`, `qualified` (`personal.metrics.mood` — use it
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/list_tables/` (operation `list_tables`)
|
|
4
|
+
|
|
5
|
+
List every table: `name`, `catalog`, `schema`, `qualified` (`personal.metrics.mood` — use it
|
|
6
|
+
wherever a table is expected; `metrics.mood` or `mood` also work when unambiguous), `path` and,
|
|
7
|
+
when declared, `description`, `aliases` (other words for what it records) and `tags`. Tables are
|
|
8
|
+
defined in `metastore.yaml` (catalog → schema → table): read it freely, but it is read-only for
|
|
9
|
+
agents and changes only through the schema operations (create_table, add_column, …). Returns `{tables, views}`: `views` lists the stored views (same fields, no
|
|
10
|
+
path): select them like tables. `system.information_schema` is read with `select_rows`.
|
|
11
|
+
|
|
12
|
+
Call this first to find the table for what the user reports (match their words against
|
|
13
|
+
name, description and aliases), and before creating tables or columns so you reuse existing
|
|
14
|
+
ones instead of creating duplicates.
|
|
15
|
+
|
|
16
|
+
## Request body
|
|
17
|
+
|
|
18
|
+
`application/json`
|
|
19
|
+
|
|
20
|
+
| Property | Type | Required | Default | Description |
|
|
21
|
+
| --- | --- | --- | --- | --- |
|
|
22
|
+
|
|
23
|
+
## Responses
|
|
24
|
+
|
|
25
|
+
| Status | Description | Body |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| 200 | Done. | `object` (application/json) |
|
|
28
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
29
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
30
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
31
|
+
|
|
32
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Webhooks of the change feed: id, url, filter (tables, ops, columns, exclude_actor), `cursor` (last change delivered), `status` (ok, failing, disabled), `last_delivery`, `last_error`. Secrets are not shown.
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/list_webhooks/` (operation `list_webhooks`)
|
|
4
|
+
|
|
5
|
+
Webhooks of the change feed: id, url, filter (tables, ops, columns, exclude_actor), `cursor` (last change delivered), `status` (ok, failing, disabled), `last_delivery`, `last_error`. Secrets are not shown.
|
|
6
|
+
|
|
7
|
+
## Request body
|
|
8
|
+
|
|
9
|
+
`application/json`
|
|
10
|
+
|
|
11
|
+
| Property | Type | Required | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- | --- |
|
|
13
|
+
|
|
14
|
+
## Responses
|
|
15
|
+
|
|
16
|
+
| Status | Description | Body |
|
|
17
|
+
| --- | --- | --- |
|
|
18
|
+
| 200 | Done. | `object` (application/json) |
|
|
19
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
20
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
21
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
22
|
+
|
|
23
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# The index of the docs of this version (every page of datanotes.dev as Markdown, shipped with the package): each page with its description and route.
|
|
2
|
+
|
|
3
|
+
`GET /datanotes/manual/` (operation `manual_index`)
|
|
4
|
+
|
|
5
|
+
## Responses
|
|
6
|
+
|
|
7
|
+
| Status | Description | Body |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| 200 | The index, in Markdown. | `string` (text/markdown) |
|
|
10
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
11
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
12
|
+
| 503 | The docs are not in this installation (a checkout where they were not built). | `Error` (application/json) |
|
|
13
|
+
|
|
14
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# A page of the docs of this version as Markdown, or one of its sections with `section`, the anchor of its heading. The same text as the page with `.md` on datanotes.dev, offline.
|
|
2
|
+
|
|
3
|
+
`GET /datanotes/manual/{page}.md` (operation `manual_page`)
|
|
4
|
+
|
|
5
|
+
## Parameters
|
|
6
|
+
|
|
7
|
+
| Name | In | Type | Required | Description |
|
|
8
|
+
| --- | --- | --- | --- | --- |
|
|
9
|
+
| `page` | path | `string` | yes | The page's path on the site, such as `guides/read-and-write/read-and-filter` (its `/` as is, or URL-encoded as %2F). |
|
|
10
|
+
| `section` | query | `string` | no | The anchor of a section, such as `compare-values-with-operators`: only that section, with its subsections. |
|
|
11
|
+
|
|
12
|
+
## Responses
|
|
13
|
+
|
|
14
|
+
| Status | Description | Body |
|
|
15
|
+
| --- | --- | --- |
|
|
16
|
+
| 200 | The page or section. | `string` (text/markdown) |
|
|
17
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
18
|
+
| 404 | No such page or section: `hint` names the closest ones. | `Error` (application/json) |
|
|
19
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
20
|
+
| 503 | The docs are not in this installation (a checkout where they were not built). | `Error` (application/json) |
|
|
21
|
+
|
|
22
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# MERGE (upsert) `rows` into `table` by the key columns `on` (e.g. `["occurred_at"]` or
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/merge_rows/` (operation `merge_rows`)
|
|
4
|
+
|
|
5
|
+
MERGE (upsert) `rows` into `table` by the key columns `on` (e.g. `["occurred_at"]` or
|
|
6
|
+
`["id"]`): a row matching an existing one updates it (`when_matched`: "update" default or
|
|
7
|
+
"ignore"), the others are inserted (`when_not_matched`: "insert" default or "ignore").
|
|
8
|
+
Date-times are compared after completion with the database time zone. A source key matching
|
|
9
|
+
several rows, or repeated, is a conflict. One journaled, undoable operation.
|
|
10
|
+
|
|
11
|
+
## Parameters
|
|
12
|
+
|
|
13
|
+
| Name | In | Type | Required | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
|
|
16
|
+
|
|
17
|
+
## Request body
|
|
18
|
+
|
|
19
|
+
`application/json`, required
|
|
20
|
+
|
|
21
|
+
| Property | Type | Required | Default | Description |
|
|
22
|
+
| --- | --- | --- | --- | --- |
|
|
23
|
+
| `table` | `string` | yes | | |
|
|
24
|
+
| `on` | `string[]` | yes | | |
|
|
25
|
+
| `rows` | `object[]` | yes | | |
|
|
26
|
+
| `when_matched` | `"update" \| "ignore" \| null` | no | `null` | |
|
|
27
|
+
| `when_not_matched` | `"insert" \| "ignore" \| null` | no | `null` | |
|
|
28
|
+
| `dry_run` | `boolean` | no | `false` | |
|
|
29
|
+
|
|
30
|
+
## Responses
|
|
31
|
+
|
|
32
|
+
| Status | Description | Body |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| 200 | Done. | `OpResult` (application/json) |
|
|
35
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
36
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
37
|
+
| 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
|
|
38
|
+
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
|
|
39
|
+
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
|
|
40
|
+
| 422 | Refused (validation failures, conflicts, an unmet `expect`): nothing written. Same body as 200, with `ok: false` and the reasons. | `OpResult` (application/json) |
|
|
41
|
+
| 500 | Unexpected error (`{error}`), or a write that failed partway and could not be rolled back: `rolled_back: false`, `failed` lists the files left (undo_migration on `migration_id` retries the rollback). | `OpResult \| Error` (application/json) |
|
|
42
|
+
| 503 | A write that failed partway (a file another program holds) and was rolled back: `rolled_back: true`, nothing written. Send it again later. Same body as 200, with `ok: false` and `failed`. | `OpResult` (application/json) |
|
|
43
|
+
|
|
44
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Move rows matching `where` (required: `{}` is every row) to another table (e.g. split a domain out of `log` into its own
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/move_rows/` (operation `move_rows`)
|
|
4
|
+
|
|
5
|
+
Move rows matching `where` (required: `{}` is every row) to another table (e.g. split a domain out of `log` into its own
|
|
6
|
+
table): sets each row's `table` to the destination, applies `rename` (`{"metric_distance_km":
|
|
7
|
+
"distance_km"}`), `set` and `drop`, adds the destination's missing dense fields, and
|
|
8
|
+
validates every row against the destination first. Keys unknown to the destination are
|
|
9
|
+
reported, never dropped silently — rename or drop them explicitly. `relocate: true` also moves
|
|
10
|
+
the files to the destination table's folder (named by its filename pattern); by default rows stay where
|
|
11
|
+
they are, as rows already in folders of their own usually do (adopt_rows, for notes that are no rows
|
|
12
|
+
yet, moves them by default). Refused while rows
|
|
13
|
+
staying behind link to a moved row through a column whose `ref` is the source table (the
|
|
14
|
+
conflicts name them): change those links first. Undo with
|
|
15
|
+
`undo_migration`.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Name | In | Type | Required | Description |
|
|
20
|
+
| --- | --- | --- | --- | --- |
|
|
21
|
+
| `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
|
|
22
|
+
|
|
23
|
+
## Request body
|
|
24
|
+
|
|
25
|
+
`application/json`, required
|
|
26
|
+
|
|
27
|
+
| Property | Type | Required | Default | Description |
|
|
28
|
+
| --- | --- | --- | --- | --- |
|
|
29
|
+
| `table` | `string` | yes | | |
|
|
30
|
+
| `to_table` | `string` | yes | | |
|
|
31
|
+
| `where` | `object` | yes | | The rows to change; {} is every row of the table. |
|
|
32
|
+
| `rename` | `object \| null` | no | `null` | |
|
|
33
|
+
| `set` | `object \| null` | no | `null` | |
|
|
34
|
+
| `drop` | `string[] \| null` | no | `null` | |
|
|
35
|
+
| `relocate` | `boolean` | no | `false` | |
|
|
36
|
+
| `dry_run` | `boolean` | no | `false` | |
|
|
37
|
+
|
|
38
|
+
## Responses
|
|
39
|
+
|
|
40
|
+
| Status | Description | Body |
|
|
41
|
+
| --- | --- | --- |
|
|
42
|
+
| 200 | Done. | `OpResult` (application/json) |
|
|
43
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
44
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
45
|
+
| 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
|
|
46
|
+
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
|
|
47
|
+
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
|
|
48
|
+
| 422 | Refused (validation failures, conflicts, an unmet `expect`): nothing written. Same body as 200, with `ok: false` and the reasons. | `OpResult` (application/json) |
|
|
49
|
+
| 500 | Unexpected error (`{error}`), or a write that failed partway and could not be rolled back: `rolled_back: false`, `failed` lists the files left (undo_migration on `migration_id` retries the rollback). | `OpResult \| Error` (application/json) |
|
|
50
|
+
| 503 | A write that failed partway (a file another program holds) and was rolled back: `rolled_back: true`, nothing written. Send it again later. Same body as 200, with `ok: false` and `failed`. | `OpResult` (application/json) |
|
|
51
|
+
|
|
52
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|