datanotes 2.0.1 → 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 +62511 -28069
- 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 +58 -14
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# This document (public: it describes the API, it holds no data).
|
|
2
|
+
|
|
3
|
+
`GET /datanotes/openapi.json` (operation `openapi`)
|
|
4
|
+
|
|
5
|
+
No authentication needed.
|
|
6
|
+
|
|
7
|
+
## Responses
|
|
8
|
+
|
|
9
|
+
| Status | Description | Body |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| 200 | OpenAPI 3.1. | `object` (application/json) |
|
|
12
|
+
|
|
13
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# This document (as `GET /datanotes/openapi.json`, with a token).
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/openapi/` (operation `openapi_post`)
|
|
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,29 @@
|
|
|
1
|
+
# Read a note or another file of the vault: `{path, content, front_matter, tags, modified_at,
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/read_note/` (operation `read_note`)
|
|
4
|
+
|
|
5
|
+
Read a note or another file of the vault: `{path, content, front_matter, tags, modified_at,
|
|
6
|
+
created_at, size}`. `content` is the whole text, front matter included; `tags` are without `#`,
|
|
7
|
+
from the text and the front matter; the times are in the database's time zone. A missing file is
|
|
8
|
+
an error. `path`: vault-relative, forward slashes.
|
|
9
|
+
|
|
10
|
+
## Request body
|
|
11
|
+
|
|
12
|
+
`application/json`, required
|
|
13
|
+
|
|
14
|
+
| Property | Type | Required | Default | Description |
|
|
15
|
+
| --- | --- | --- | --- | --- |
|
|
16
|
+
| `path` | `string` | yes | | The file's vault path, with its extension ("Films/Metropolis.md"). |
|
|
17
|
+
|
|
18
|
+
## Responses
|
|
19
|
+
|
|
20
|
+
| Status | Description | Body |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| 200 | Done. | `object` (application/json) |
|
|
23
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
24
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
25
|
+
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
|
|
26
|
+
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (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,44 @@
|
|
|
1
|
+
# Bring generated and identity columns up to date (all rows, or only `paths`), e.g. after
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/recompute_columns/` (operation `recompute_columns`)
|
|
4
|
+
|
|
5
|
+
Bring generated and identity columns up to date (all rows, or only `paths`), e.g. after
|
|
6
|
+
rows were edited by hand (an editor, git, sync) or a generated expression changed with `alter_column`.
|
|
7
|
+
Also gives rows without an `id` a new one, and a duplicated note (same `id` as an older row)
|
|
8
|
+
a new id. `new_ids=true` regenerates every id in scope (new ones on every call): only on the user's
|
|
9
|
+
explicit request.
|
|
10
|
+
`check_table` reports stale values with code `generated`. No-op when nothing is stale;
|
|
11
|
+
otherwise journaled (undo_migration) and a RECOMPUTE version in the table's history.
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
| Name | In | Type | Required | Description |
|
|
16
|
+
| --- | --- | --- | --- | --- |
|
|
17
|
+
| `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
|
|
18
|
+
|
|
19
|
+
## Request body
|
|
20
|
+
|
|
21
|
+
`application/json`, required
|
|
22
|
+
|
|
23
|
+
| Property | Type | Required | Default | Description |
|
|
24
|
+
| --- | --- | --- | --- | --- |
|
|
25
|
+
| `table` | `string` | yes | | |
|
|
26
|
+
| `paths` | `string[] \| null` | no | `null` | |
|
|
27
|
+
| `new_ids` | `boolean` | no | `false` | |
|
|
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,36 @@
|
|
|
1
|
+
# Record an agent's tool call in the change feed (`tool_call` events): what an MCP server reports after each call, its own tools included (`served_by`). Any token may call it.
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/tool-calls/record/` (operation `record_tool_call`)
|
|
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`, required
|
|
14
|
+
|
|
15
|
+
| Property | Type | Required | Default | Description |
|
|
16
|
+
| --- | --- | --- | --- | --- |
|
|
17
|
+
| `tool` | `string` | yes | | |
|
|
18
|
+
| `args` | `object` | no | | |
|
|
19
|
+
| `ok` | `boolean` | no | | |
|
|
20
|
+
| `duration_ms` | `number` | no | | |
|
|
21
|
+
| `value` | `any` | no | | |
|
|
22
|
+
| `served_by` | `string` | no | | |
|
|
23
|
+
| `session` | `string` | no | | |
|
|
24
|
+
| `result_chars` | `number` | no | | |
|
|
25
|
+
| `result_tokens` | `number` | no | | |
|
|
26
|
+
|
|
27
|
+
## Responses
|
|
28
|
+
|
|
29
|
+
| Status | Description | Body |
|
|
30
|
+
| --- | --- | --- |
|
|
31
|
+
| 200 | Done. | `object` (application/json) |
|
|
32
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
33
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
34
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
35
|
+
|
|
36
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Rename a column in metastore.yaml and on every row. Refused if `to_column` is already a column
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/rename_column/` (operation `rename_column`)
|
|
4
|
+
|
|
5
|
+
Rename a column in metastore.yaml and on every row. Refused if `to_column` is already a column
|
|
6
|
+
of the table; a row that has a stray `to_column` key with a different value is a conflict, and
|
|
7
|
+
nothing is written. CHECKs, `ref_where` and `ref_by` that read the column (in this table, or through
|
|
8
|
+
a link from another table: `parent.kind`) follow the new name. Views and note text that mention the
|
|
9
|
+
old name are not rewritten.
|
|
10
|
+
|
|
11
|
+
The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
| Name | In | Type | Required | Description |
|
|
16
|
+
| --- | --- | --- | --- | --- |
|
|
17
|
+
| `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
|
|
18
|
+
|
|
19
|
+
## Request body
|
|
20
|
+
|
|
21
|
+
`application/json`, required
|
|
22
|
+
|
|
23
|
+
| Property | Type | Required | Default | Description |
|
|
24
|
+
| --- | --- | --- | --- | --- |
|
|
25
|
+
| `table` | `string` | yes | | |
|
|
26
|
+
| `from_column` | `string` | yes | | |
|
|
27
|
+
| `to_column` | `string` | yes | | |
|
|
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,45 @@
|
|
|
1
|
+
# Rename one value of an enum column (e.g. `high` → `very high`) in metastore.yaml and every
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/rename_value/` (operation `rename_value`)
|
|
4
|
+
|
|
5
|
+
Rename one value of an enum column (e.g. `high` → `very high`) in metastore.yaml and every
|
|
6
|
+
row, keeping its position, so an ordered scale is unchanged. CHECKs and `ref_where` conditions on
|
|
7
|
+
the column (also through a link from another table) and `ref_by` levels / maps that name the value
|
|
8
|
+
use the new one. Note text (queries, prose) is not rewritten. Refused if `to_value` already exists. Undo with `undo_migration`. Adding or
|
|
9
|
+
removing classes changes the scale: create a new table instead.
|
|
10
|
+
|
|
11
|
+
The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
|
|
12
|
+
|
|
13
|
+
## Parameters
|
|
14
|
+
|
|
15
|
+
| Name | In | Type | Required | Description |
|
|
16
|
+
| --- | --- | --- | --- | --- |
|
|
17
|
+
| `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
|
|
18
|
+
|
|
19
|
+
## Request body
|
|
20
|
+
|
|
21
|
+
`application/json`, required
|
|
22
|
+
|
|
23
|
+
| Property | Type | Required | Default | Description |
|
|
24
|
+
| --- | --- | --- | --- | --- |
|
|
25
|
+
| `table` | `string` | yes | | |
|
|
26
|
+
| `column` | `string` | yes | | |
|
|
27
|
+
| `from_value` | `string` | yes | | |
|
|
28
|
+
| `to_value` | `string` | yes | | |
|
|
29
|
+
| `dry_run` | `boolean` | no | `false` | |
|
|
30
|
+
|
|
31
|
+
## Responses
|
|
32
|
+
|
|
33
|
+
| Status | Description | Body |
|
|
34
|
+
| --- | --- | --- |
|
|
35
|
+
| 200 | Done. | `OpResult` (application/json) |
|
|
36
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
37
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
38
|
+
| 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `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
|
+
| 422 | Refused (validation failures, conflicts, an unmet `expect`): nothing written. Same body as 200, with `ok: false` and the reasons. | `OpResult` (application/json) |
|
|
42
|
+
| 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) |
|
|
43
|
+
| 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) |
|
|
44
|
+
|
|
45
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# RESTORE DATABASE to a `timestamp` (each table as of its last version committed at or before it) or
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/restore_database/` (operation `restore_database`)
|
|
4
|
+
|
|
5
|
+
RESTORE DATABASE to a `timestamp` (each table as of its last version committed at or before it) or
|
|
6
|
+
to `before_migration` (a `migration_id` or a `batch`: every table as it was just before that operation
|
|
7
|
+
ran — to rewind an agent's run). Every table that keeps a transaction log goes back, rows and
|
|
8
|
+
definition: rows added since are deleted, changed rows get their old content, removed rows come back;
|
|
9
|
+
a table created since is dropped with its rows moved to its archive folder (as drop_table with
|
|
10
|
+
mode "archive": nothing is hard-deleted), a table dropped since comes back. Tables already as
|
|
11
|
+
they were are left alone (`unchanged`, no new version). One operation: each restored table gets a
|
|
12
|
+
RESTORE version, all with one `migration_id`, and `undo_migration` on it reverts them all. Refused as a
|
|
13
|
+
whole, nothing written (rows listed, with the way out), when a row it leaves would break a CHECK that
|
|
14
|
+
follows links or a `ref_where` / `ref_by`, across tables, as the restored definitions have them.
|
|
15
|
+
Tables without a log (history off, or vacuumed before that time) cannot be rewound: they stay as they
|
|
16
|
+
are, listed in `skipped` with the reason (tell the user). Views, bases and the database settings are
|
|
17
|
+
not rewound (the logs keep tables), nor a rename or move of a table (undo_migration on it does that).
|
|
18
|
+
Returns `restored_to`, `tables` (per table: `action` restore / drop / recreate, `version`,
|
|
19
|
+
`creates`, `texts`, `deletes`, `archived`), `unchanged` and `skipped`. Run with `dry_run` first and show the user what changes; describe_history without `table` shows the moments.
|
|
20
|
+
|
|
21
|
+
The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
|
|
22
|
+
|
|
23
|
+
## Parameters
|
|
24
|
+
|
|
25
|
+
| Name | In | Type | Required | Description |
|
|
26
|
+
| --- | --- | --- | --- | --- |
|
|
27
|
+
| `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
|
|
28
|
+
|
|
29
|
+
## Request body
|
|
30
|
+
|
|
31
|
+
`application/json`
|
|
32
|
+
|
|
33
|
+
| Property | Type | Required | Default | Description |
|
|
34
|
+
| --- | --- | --- | --- | --- |
|
|
35
|
+
| `timestamp` | `string \| null` | no | `null` | |
|
|
36
|
+
| `before_migration` | `string \| null` | no | `null` | |
|
|
37
|
+
| `dry_run` | `boolean` | no | `false` | |
|
|
38
|
+
|
|
39
|
+
## Responses
|
|
40
|
+
|
|
41
|
+
| Status | Description | Body |
|
|
42
|
+
| --- | --- | --- |
|
|
43
|
+
| 200 | Done. | `RestoreDatabaseResult` (application/json) |
|
|
44
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
45
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
46
|
+
| 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
|
|
47
|
+
| 422 | Refused (validation failures, conflicts, an unmet `expect`): nothing written. Same body as 200, with `ok: false` and the reasons. | `RestoreDatabaseResult` (application/json) |
|
|
48
|
+
| 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). | `RestoreDatabaseResult \| Error` (application/json) |
|
|
49
|
+
| 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`. | `RestoreDatabaseResult` (application/json) |
|
|
50
|
+
|
|
51
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# RESTORE TABLE to a `version` or `timestamp`: rows and definition return to that state —
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/restore_table/` (operation `restore_table`)
|
|
4
|
+
|
|
5
|
+
RESTORE TABLE to a `version` or `timestamp`: rows and definition return to that state —
|
|
6
|
+
rows added since are deleted, changed rows get their old content, removed rows come back (a
|
|
7
|
+
dropped table is re-created). History is not rewritten: the restore is a new version, and
|
|
8
|
+
`undo_migration` reverts it. Refused (rows listed, with the way out) when the rows it writes, or
|
|
9
|
+
rows that link to them, would break a CHECK that follows links or a `ref_where` / `ref_by` (as the
|
|
10
|
+
restored definition has them: a rule added since does not hold the old rows). Run with
|
|
11
|
+
`dry_run` first and show the user what changes.
|
|
12
|
+
|
|
13
|
+
The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
|
|
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
|
+
| `version` | `integer \| null` | no | `null` | |
|
|
29
|
+
| `timestamp` | `string \| null` | no | `null` | |
|
|
30
|
+
| `dry_run` | `boolean` | no | `false` | |
|
|
31
|
+
|
|
32
|
+
## Responses
|
|
33
|
+
|
|
34
|
+
| Status | Description | Body |
|
|
35
|
+
| --- | --- | --- |
|
|
36
|
+
| 200 | Done. | `OpResult` (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
|
+
| 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `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
|
+
| 422 | Refused (validation failures, conflicts, an unmet `expect`): nothing written. Same body as 200, with `ok: false` and the reasons. | `OpResult` (application/json) |
|
|
43
|
+
| 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) |
|
|
44
|
+
| 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) |
|
|
45
|
+
|
|
46
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Plain-text search: every word of `query` must occur, case- and accent-insensitive, in the
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/search_notes/` (operation `search_notes`)
|
|
4
|
+
|
|
5
|
+
Plain-text search: every word of `query` must occur, case- and accent-insensitive, in the
|
|
6
|
+
note's path or text; there are no operators. Returns `{query, results: [{path, score, matches:
|
|
7
|
+
[{start, end, context}]}], total}`, best first: at most 200 notes (`total` counts them all) and 20
|
|
8
|
+
matches per note. `context_length`: characters of context on each side (default 100, max 1000).
|
|
9
|
+
|
|
10
|
+
## Request body
|
|
11
|
+
|
|
12
|
+
`application/json`, required
|
|
13
|
+
|
|
14
|
+
| Property | Type | Required | Default | Description |
|
|
15
|
+
| --- | --- | --- | --- | --- |
|
|
16
|
+
| `query` | `string` | yes | | |
|
|
17
|
+
| `context_length` | `integer` | no | `100` | Characters of context on each side of a match (at most 1000). |
|
|
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
|
+
| 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,61 @@
|
|
|
1
|
+
# Query rows: `{table, total, rows: [{path, ...}]}`. `table` may be a view,
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/select_rows/` (operation `select_rows`)
|
|
4
|
+
|
|
5
|
+
Query rows: `{table, total, rows: [{path, ...}]}`. `table` may be a view,
|
|
6
|
+
`system.information_schema.<catalogs|schemata|tables|columns|views|check_constraints>`, or
|
|
7
|
+
`base:<name>` — every table that extends that base (e.g. `base:record`: all event-like tables),
|
|
8
|
+
on the base's columns, each row tagged `_source` with its table.
|
|
9
|
+
- `where`: as in update_rows; relative dates `"{today}"`, `"{today-7d}"`, `"{now-24h}"` (on a date column a date-time
|
|
10
|
+
counts by its day); file columns
|
|
11
|
+
`file_name`, `file_link`, `file_modified`, `file_backlink_count`.
|
|
12
|
+
- `columns`, `order_by` (`-col` descending), `limit` (default 100, max 1000), `offset`,
|
|
13
|
+
`expand` (inline linked rows' frontmatter), `include_body` (the note body as `body`).
|
|
14
|
+
- `join`: `{"table", "on": {"date(occurred_at)+1": "date(timestamp)"}, "as", "type": "inner"|"left",
|
|
15
|
+
"columns", "where"}` — matches attached under `as`.
|
|
16
|
+
- `group_by` (column, `path` or `date(col)±n`; a list column counts once per item) + `aggregates`
|
|
17
|
+
`{"n": "count", "kcal": "sum:meal.kcal"}` (count, count:col, sum, avg, min, max).
|
|
18
|
+
- `this_note`: vault path of the note the result is for: `{this.*}` tokens in a view's query
|
|
19
|
+
and in `where` read it (`{this.date}`, `{this.link}`, `{this.name}`, `{this.path}`); without
|
|
20
|
+
it (or a front matter key the note lacks) a token stays as written and matches no row, whatever the
|
|
21
|
+
operator (`within` included).
|
|
22
|
+
- Ordered enums compare by position. Time travel: `version` (of one table) or `timestamp`. With
|
|
23
|
+
`timestamp` a join, a view, a union or `base:<name>` reads every table in it as of that time
|
|
24
|
+
(`versions`: the version read of each); a table that did not exist then adds no rows to a union or
|
|
25
|
+
base. `version` is refused where several tables are read; information_schema has no history.
|
|
26
|
+
Views and bases keep today's definition, and links followed by `where` (`project.kind`, `within`)
|
|
27
|
+
or `expand` read the linked rows as they are now.
|
|
28
|
+
|
|
29
|
+
## Request body
|
|
30
|
+
|
|
31
|
+
`application/json`, required
|
|
32
|
+
|
|
33
|
+
| Property | Type | Required | Default | Description |
|
|
34
|
+
| --- | --- | --- | --- | --- |
|
|
35
|
+
| `table` | `string` | yes | | |
|
|
36
|
+
| `columns` | `string[] \| null` | no | `null` | |
|
|
37
|
+
| `where` | `object \| null` | no | `null` | |
|
|
38
|
+
| `order_by` | `string \| string[] \| null` | no | `null` | |
|
|
39
|
+
| `limit` | `integer \| null` | no | `null` | |
|
|
40
|
+
| `offset` | `integer \| null` | no | `null` | |
|
|
41
|
+
| `expand` | `string[] \| null` | no | `null` | |
|
|
42
|
+
| `join` | `object \| null` | no | `null` | |
|
|
43
|
+
| `group_by` | `string \| string[] \| null` | no | `null` | |
|
|
44
|
+
| `aggregates` | `object \| null` | no | `null` | |
|
|
45
|
+
| `include_body` | `boolean` | no | `false` | |
|
|
46
|
+
| `version` | `integer \| null` | no | `null` | |
|
|
47
|
+
| `timestamp` | `string \| null` | no | `null` | |
|
|
48
|
+
| `this_note` | `string \| null` | no | `null` | |
|
|
49
|
+
|
|
50
|
+
## Responses
|
|
51
|
+
|
|
52
|
+
| Status | Description | Body |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| 200 | Done. | `object` (application/json) |
|
|
55
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
56
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
57
|
+
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
|
|
58
|
+
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
|
|
59
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
60
|
+
|
|
61
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Find notes by meaning, not exact words: `{query, results: [{path, score, heading, snippet,
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/semantic_search/` (operation `semantic_search`)
|
|
4
|
+
|
|
5
|
+
Find notes by meaning, not exact words: `{query, results: [{path, score, heading, snippet,
|
|
6
|
+
table?}]}`, one result per note (its best passage), best first. Use it for vague questions
|
|
7
|
+
("the dinner where we talked about moving", "what did I decide about the car") and to find the
|
|
8
|
+
rows to read or update; then read_note / select_rows for the details. Filters: `tables`
|
|
9
|
+
(qualified or short names), `folder`, `min_score` (cosine 0–1; ~0.5+ is usually relevant).
|
|
10
|
+
`limit`: default 10, max 100. Fails with a clear message when semantic search is not enabled in
|
|
11
|
+
the engine settings.
|
|
12
|
+
|
|
13
|
+
## Request body
|
|
14
|
+
|
|
15
|
+
`application/json`, required
|
|
16
|
+
|
|
17
|
+
| Property | Type | Required | Default | Description |
|
|
18
|
+
| --- | --- | --- | --- | --- |
|
|
19
|
+
| `query` | `string` | yes | | |
|
|
20
|
+
| `limit` | `integer` | no | `10` | |
|
|
21
|
+
| `tables` | `string[] \| null` | no | `null` | |
|
|
22
|
+
| `folder` | `string \| null` | no | `null` | |
|
|
23
|
+
| `min_score` | `number \| null` | no | `null` | |
|
|
24
|
+
|
|
25
|
+
## Responses
|
|
26
|
+
|
|
27
|
+
| Status | Description | Body |
|
|
28
|
+
| --- | --- | --- |
|
|
29
|
+
| 200 | Done. | `object` (application/json) |
|
|
30
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
31
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
32
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
33
|
+
|
|
34
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# The sections of the docs of this version closest in meaning to a query: what `search_docs` fuses with its ranking by words (hybrid search).
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/manual/search/` (operation `semantic_search_docs`)
|
|
4
|
+
|
|
5
|
+
The engine embeds every section of the docs it ships with the provider of semantic search, in an index of its own (`semantic/docs.json` in its store), rebuilt when the docs change. It builds the index in the background, after it starts and when a search finds it out of date: until the index covers the docs, the answer has `ready: false` and no results. 400 when semantic search is off.
|
|
6
|
+
|
|
7
|
+
## Request body
|
|
8
|
+
|
|
9
|
+
`application/json`, required
|
|
10
|
+
|
|
11
|
+
| Property | Type | Required | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- | --- |
|
|
13
|
+
| `query` | `string` | yes | | The words to rank the sections by, such as `time travel a view`. |
|
|
14
|
+
| `limit` | `integer` | no | `50` | The most sections to return. |
|
|
15
|
+
|
|
16
|
+
## Responses
|
|
17
|
+
|
|
18
|
+
| Status | Description | Body |
|
|
19
|
+
| --- | --- | --- |
|
|
20
|
+
| 200 | Done. | `DocsSemanticResults` (application/json) |
|
|
21
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
22
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
23
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
24
|
+
| 503 | The docs are not in this installation (a checkout where they were not built). | `Error` (application/json) |
|
|
25
|
+
|
|
26
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Set the bases a table inherits from (`bases`, in order; `[]` removes them). Inherited
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/set_table_bases/` (operation `set_table_bases`)
|
|
4
|
+
|
|
5
|
+
Set the bases a table inherits from (`bases`, in order; `[]` removes them). Inherited
|
|
6
|
+
columns come after `id` and before the table's own columns. An own column with the name of an
|
|
7
|
+
inherited one is replaced by the inherited definition (rows must fit it, its `ref_where` /
|
|
8
|
+
`ref_by` included); a table may only
|
|
9
|
+
restyle an inherited column (label, description, aliases, note, dense) with `alter_column`.
|
|
10
|
+
Dense and generated/identity columns are filled on existing rows.
|
|
11
|
+
|
|
12
|
+
The schema changes only through operations like this one: never edit metastore.yaml by hand (no validation, no undo).
|
|
13
|
+
|
|
14
|
+
## Parameters
|
|
15
|
+
|
|
16
|
+
| Name | In | Type | Required | Description |
|
|
17
|
+
| --- | --- | --- | --- | --- |
|
|
18
|
+
| `X-Datanotes-Actor` | header | `string` | no | JSON: on whose behalf the write is made, recorded in the journal (`harness`, `model`, `session`). |
|
|
19
|
+
|
|
20
|
+
## Request body
|
|
21
|
+
|
|
22
|
+
`application/json`, required
|
|
23
|
+
|
|
24
|
+
| Property | Type | Required | Default | Description |
|
|
25
|
+
| --- | --- | --- | --- | --- |
|
|
26
|
+
| `table` | `string` | yes | | |
|
|
27
|
+
| `bases` | `string[]` | yes | | |
|
|
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,13 @@
|
|
|
1
|
+
# Status and version (no token needed; `authenticated` tells whether the token sent is accepted, `auth` whose it is).
|
|
2
|
+
|
|
3
|
+
`GET /` (operation `status`)
|
|
4
|
+
|
|
5
|
+
No authentication needed.
|
|
6
|
+
|
|
7
|
+
## Responses
|
|
8
|
+
|
|
9
|
+
| Status | Description | Body |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| 200 | Running. | `object` (application/json) |
|
|
12
|
+
|
|
13
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Stop the engine gracefully (owner only; `datanotes stop` calls it): it answers at once, then finishes the requests under way, makes the last git sync and store backup commit and push, releases its lock and exits.
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/stop/` (operation `stop_engine`)
|
|
4
|
+
|
|
5
|
+
From the answer on, new requests get 503 (the engine is stopping) and long polls of the change feed answer at once. The engine waits for the requests under way for up to 30 s. Then it makes the vault's last git sync and the store backup's last commit and push, releases the lock and exits. The caller learns the end from the process (`datanotes stop` waits for it) or from `GET /`, which stops answering. A named token is refused (403), even with `maintain`. A host that cannot stop on request does not serve the route (404).
|
|
6
|
+
|
|
7
|
+
## Request body
|
|
8
|
+
|
|
9
|
+
`application/json`
|
|
10
|
+
|
|
11
|
+
Type: `object`
|
|
12
|
+
|
|
13
|
+
## Responses
|
|
14
|
+
|
|
15
|
+
| Status | Description | Body |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| 200 | Done. | `object` (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,33 @@
|
|
|
1
|
+
# Bring the semantic search index up to date: embed the notes changed since the last run (the
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/sync_semantic_index/` (operation `sync_semantic_index`)
|
|
4
|
+
|
|
5
|
+
Bring the semantic search index up to date: embed the notes changed since the last run (the
|
|
6
|
+
engine also does it on its own about ten seconds after edits). `rebuild: true` re-embeds
|
|
7
|
+
everything: slow, and costs money with a paid provider — ask first.
|
|
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`
|
|
18
|
+
|
|
19
|
+
| Property | Type | Required | Default | Description |
|
|
20
|
+
| --- | --- | --- | --- | --- |
|
|
21
|
+
| `rebuild` | `boolean` | no | `false` | Re-embed every note, not only the changed ones. |
|
|
22
|
+
|
|
23
|
+
## Responses
|
|
24
|
+
|
|
25
|
+
| Status | Description | Body |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| 200 | Done. | `SemanticSyncResult` (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
|
+
| 403 | A named token beyond its permissions (the engine's administration, tables outside its `write` patterns, schema changes without `ddl`). | `Error` (application/json) |
|
|
31
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
32
|
+
|
|
33
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Change data feed between two versions (both included, end defaults to latest): one entry
|
|
2
|
+
|
|
3
|
+
`POST /datanotes/operations/table_changes/` (operation `table_changes`)
|
|
4
|
+
|
|
5
|
+
Change data feed between two versions (both included, end defaults to latest): one entry
|
|
6
|
+
per row change with its values plus `_change_type` (insert, delete, update_preimage,
|
|
7
|
+
update_postimage, metadata), `_commit_version`, `_commit_timestamp`, `_operation`, `path`.
|
|
8
|
+
Use it to answer "what changed since …" without diffing full tables.
|
|
9
|
+
|
|
10
|
+
## Request body
|
|
11
|
+
|
|
12
|
+
`application/json`, required
|
|
13
|
+
|
|
14
|
+
| Property | Type | Required | Default | Description |
|
|
15
|
+
| --- | --- | --- | --- | --- |
|
|
16
|
+
| `table` | `string` | yes | | |
|
|
17
|
+
| `start_version` | `integer` | yes | | |
|
|
18
|
+
| `end_version` | `integer \| null` | no | `null` | |
|
|
19
|
+
|
|
20
|
+
## Responses
|
|
21
|
+
|
|
22
|
+
| Status | Description | Body |
|
|
23
|
+
| --- | --- | --- |
|
|
24
|
+
| 200 | Done. | `object` (application/json) |
|
|
25
|
+
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
|
|
26
|
+
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
|
|
27
|
+
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
|
|
28
|
+
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
|
|
29
|
+
| 500 | Unexpected error. | `Error` (application/json) |
|
|
30
|
+
|
|
31
|
+
The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
|