datanotes 3.3.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/api/extensions.cjs +1190 -2
  2. package/dist/api/extensions.js +1190 -2
  3. package/dist/api/index.cjs +1190 -2
  4. package/dist/api/index.js +1190 -2
  5. package/dist/api/mcp.cjs +1190 -2
  6. package/dist/api/mcp.js +1190 -2
  7. package/dist/datanotes.cjs +1257 -11
  8. package/dist/docs/api/operations/alter_table.md +4 -3
  9. package/dist/docs/api.md +1 -1
  10. package/dist/docs/guides/data-quality/check-constraints.md +10 -10
  11. package/dist/docs/guides/data-quality/hand-edits.md +8 -8
  12. package/dist/docs/guides/database-objects/bases.md +11 -11
  13. package/dist/docs/guides/database-objects/catalogs-and-schemas.md +30 -10
  14. package/dist/docs/guides/database-objects/columns.md +38 -38
  15. package/dist/docs/guides/database-objects/relations.md +28 -28
  16. package/dist/docs/guides/database-objects/tables.md +167 -43
  17. package/dist/docs/guides/database-objects/views.md +44 -44
  18. package/dist/docs/guides/history/change-data-feed.md +34 -34
  19. package/dist/docs/guides/history/journal-and-undo.md +12 -12
  20. package/dist/docs/guides/history/restore.md +20 -20
  21. package/dist/docs/guides/history/table-history.md +31 -31
  22. package/dist/docs/guides/read-and-write/automatic-links.md +15 -15
  23. package/dist/docs/guides/read-and-write/import-notes.md +20 -20
  24. package/dist/docs/guides/read-and-write/joins-and-aggregates.md +7 -7
  25. package/dist/docs/guides/read-and-write/read-and-filter.md +10 -10
  26. package/dist/docs/guides/read-and-write/write-rows.md +10 -10
  27. package/dist/docs/guides/search/text.md +1 -1
  28. package/dist/docs/reference/cli.md +1 -1
  29. package/dist/docs/reference/operations/auxiliary.md +1 -1
  30. package/dist/docs/reference/operations/rows.md +1 -1
  31. package/dist/docs/reference/operations/schema.md +3 -3
  32. package/dist/docs/reference/operations.md +4 -4
  33. package/dist/docs/release-notes.md +16 -0
  34. package/package.json +1 -1
@@ -58,7 +58,7 @@ Answer:
58
58
  ```json
59
59
  {
60
60
  "ok": true,
61
- "migration_id": "20261020T173828-create_table-create-table-main-public-film",
61
+ "migration_id": "20261024T053819-create_table-create-table-main-public-film",
62
62
  "summary": null
63
63
  }
64
64
  ```
@@ -67,7 +67,7 @@ Answer:
67
67
 
68
68
  ```yaml
69
69
  # Metastore (Datanotes): catalogs, schemas, tables, columns, views.
70
- id: 01a15a64-a676-7657-9ff4-7a1e6bcc5df3
70
+ id: 01a16c6a-c732-7310-8bb4-c9f28c15517c
71
71
  config:
72
72
  history: true
73
73
 
@@ -379,24 +379,24 @@ Answer:
379
379
  "ok": true,
380
380
  "op": "insert_row",
381
381
  "files_created": 1,
382
- "planned_creates": ["datanotes/main/public/watch/2026-10-20 Nosferatu.md"],
382
+ "planned_creates": ["datanotes/main/public/watch/2026-10-24 Nosferatu.md"],
383
383
  "commits": [{ "table": "main.public.watch", "version": 1, "operation": "WRITE" }],
384
- "migration_id": "20261020T173828-insert_row-insert-into-watch"
384
+ "migration_id": "20261024T053819-insert_row-insert-into-watch"
385
385
  }
386
386
  ```
387
387
 
388
- `datanotes/main/public/watch/2026-10-20 Nosferatu.md` now reads:
388
+ `datanotes/main/public/watch/2026-10-24 Nosferatu.md` now reads:
389
389
 
390
390
  ```markdown
391
391
  ---
392
392
  table: main.public.watch
393
393
  cssclasses:
394
394
  - watch
395
- id: 01a15a64-a8fb-73f8-a4e2-4263d12c1d9d
395
+ id: 01a16c6a-c7d4-7cbb-a3cc-e6066a366800
396
396
  film: Nosferatu
397
397
  where: outdoor screening
398
398
  place: the park by the river
399
- occurred_at: 2026-10-20T17:38:28Z
399
+ occurred_at: 2026-10-24T05:38:19Z
400
400
  ---
401
401
  Watched Nosferatu (outdoor screening).
402
402
 
@@ -440,7 +440,7 @@ Answer:
440
440
  "op": "alter_table",
441
441
  "planned_texts": ["datanotes/metastore.yaml"],
442
442
  "commits": [{ "table": "main.public.watch", "version": 2, "operation": "ALTER TABLE" }],
443
- "migration_id": "20261020T173828-alter_table-alter-table-main-public-watch"
443
+ "migration_id": "20261024T053819-alter_table-alter-table-main-public-watch"
444
444
  }
445
445
  ```
446
446
 
@@ -483,7 +483,51 @@ Answer:
483
483
 
484
484
  ## Rename or move a table
485
485
 
486
- `alter_table` renames a table with `name`, or moves it to another `catalog` or `schema`. Here `actors` becomes `actor`, singular like the other tables. The rows’ folder and their front matter key `table` follow, and the engine rewrites the links to them. `dry_run` lists the notes that would move.
486
+ `alter_table` renames a table with `name`, or moves it to another `catalog` or `schema`. Here `actors` becomes `actor`, singular like the other tables. The rows’ folder and their front matter key `table` follow, and the engine rewrites the links to them.
487
+
488
+ The definitions that name the table follow it too:
489
+
490
+ * the `ref` of every link column, lists of links and base columns included
491
+ * the `vocabulary` of every string column
492
+ * the tables a view reads, in `table`, `union` and `join`
493
+
494
+ `dry_run` lists the notes that would move, and `schema_references` lists the names it would rewrite. Here a film’s `lead` links an actor, and the view `cast_list` reads the actors.
495
+
496
+ **`add_column`**
497
+
498
+ ```json
499
+ {
500
+ "table": "classics.film",
501
+ "column": {
502
+ "name": "lead",
503
+ "type": "link",
504
+ "ref": "diary.classics.actors",
505
+ "description": "The actor in the leading role"
506
+ }
507
+ }
508
+ ```
509
+
510
+ **`update_row`**
511
+
512
+ ```json
513
+ {
514
+ "table": "classics.film",
515
+ "path": "datanotes/diary/classics/film/Nosferatu.md",
516
+ "set": { "lead": "[[Max Schreck]]" }
517
+ }
518
+ ```
519
+
520
+ **`create_view`**
521
+
522
+ ```json
523
+ {
524
+ "catalog": "diary",
525
+ "schema": "classics",
526
+ "name": "cast_list",
527
+ "query": { "table": "diary.classics.actors", "columns": ["name"], "order_by": "name" },
528
+ "description": "Every actor, by name"
529
+ }
530
+ ```
487
531
 
488
532
  **`alter_table`**
489
533
 
@@ -515,7 +559,22 @@ Answer:
515
559
  "to": "datanotes/diary/classics/actor/Max Schreck.md"
516
560
  }
517
561
  ],
518
- "planned_texts": ["datanotes/metastore.yaml"]
562
+ "planned_texts": ["datanotes/metastore.yaml"],
563
+ "schema_references": [
564
+ {
565
+ "table": "diary.classics.film",
566
+ "column": "lead",
567
+ "key": "ref",
568
+ "from": "diary.classics.actors",
569
+ "to": "diary.classics.actor"
570
+ },
571
+ {
572
+ "view": "diary.classics.cast_list",
573
+ "key": "table",
574
+ "from": "diary.classics.actors",
575
+ "to": "diary.classics.actor"
576
+ }
577
+ ]
519
578
  }
520
579
  ```
521
580
 
@@ -525,7 +584,7 @@ Answer:
525
584
  { "table": "classics.actors", "name": "actor" }
526
585
  ```
527
586
 
528
- Answer:
587
+ Answer (44 lines)
529
588
 
530
589
  ```json
531
590
  {
@@ -552,9 +611,25 @@ Answer:
552
611
  ],
553
612
  "planned_texts": ["datanotes/metastore.yaml"],
554
613
  "commits": [
555
- { "table": "diary.classics.actor", "version": 6, "operation": "ALTER TABLE" }
614
+ { "table": "diary.classics.actor", "version": 6, "operation": "ALTER TABLE" },
615
+ { "table": "diary.classics.film", "version": 14, "operation": "ALTER TABLE" }
556
616
  ],
557
- "migration_id": "20261020T173845-alter_table-move-table-diary-classics-acto"
617
+ "migration_id": "20261024T053837-alter_table-move-table-diary-classics-acto",
618
+ "schema_references": [
619
+ {
620
+ "table": "diary.classics.film",
621
+ "column": "lead",
622
+ "key": "ref",
623
+ "from": "diary.classics.actors",
624
+ "to": "diary.classics.actor"
625
+ },
626
+ {
627
+ "view": "diary.classics.cast_list",
628
+ "key": "table",
629
+ "from": "diary.classics.actors",
630
+ "to": "diary.classics.actor"
631
+ }
632
+ ]
558
633
  }
559
634
  ```
560
635
 
@@ -566,7 +641,7 @@ Then move it to a schema of its own:
566
641
  { "table": "classics.actor", "catalog": "diary", "schema": "credits" }
567
642
  ```
568
643
 
569
- Answer:
644
+ Answer (44 lines)
570
645
 
571
646
  ```json
572
647
  {
@@ -593,9 +668,25 @@ Answer:
593
668
  ],
594
669
  "planned_texts": ["datanotes/metastore.yaml"],
595
670
  "commits": [
671
+ { "table": "diary.classics.film", "version": 15, "operation": "ALTER TABLE" },
596
672
  { "table": "diary.credits.actor", "version": 7, "operation": "ALTER TABLE" }
597
673
  ],
598
- "migration_id": "20261020T173845-alter_table-move-table-diary-classics-acto-2"
674
+ "migration_id": "20261024T053837-alter_table-move-table-diary-classics-acto-2",
675
+ "schema_references": [
676
+ {
677
+ "table": "diary.classics.film",
678
+ "column": "lead",
679
+ "key": "ref",
680
+ "from": "diary.classics.actor",
681
+ "to": "diary.credits.actor"
682
+ },
683
+ {
684
+ "view": "diary.classics.cast_list",
685
+ "key": "table",
686
+ "from": "diary.classics.actor",
687
+ "to": "diary.credits.actor"
688
+ }
689
+ ]
599
690
  }
600
691
  ```
601
692
 
@@ -615,6 +706,39 @@ Answer:
615
706
  }
616
707
  ```
617
708
 
709
+ The link column and the view now name `diary.credits.actor`, so the view still answers and `check_table` finds no broken link:
710
+
711
+ **`select_rows`**
712
+
713
+ ```json
714
+ { "table": "cast_list" }
715
+ ```
716
+
717
+ Answer:
718
+
719
+ ```json
720
+ {
721
+ "table": "diary.credits.actor",
722
+ "total": 1,
723
+ "rows": [
724
+ { "path": "datanotes/diary/credits/actor/Max Schreck.md", "name": "Max Schreck" }
725
+ ],
726
+ "view": "diary.classics.cast_list"
727
+ }
728
+ ```
729
+
730
+ **`check_table`**
731
+
732
+ ```json
733
+ { "table": "classics.film" }
734
+ ```
735
+
736
+ Answer:
737
+
738
+ ```json
739
+ { "table": "film", "rows_checked": 2, "total": 0, "violations": [] }
740
+ ```
741
+
618
742
  ## Change sub-folders and file names
619
743
 
620
744
  `alter_table` also changes `partition`, the sub-folders, and `filename`, the name pattern. The engine renames every row to fit, and refuses the change when a row can’t fill the pattern.
@@ -657,9 +781,9 @@ Answer:
657
781
  ],
658
782
  "planned_texts": ["datanotes/metastore.yaml"],
659
783
  "commits": [
660
- { "table": "diary.classics.film", "version": 13, "operation": "ALTER TABLE" }
784
+ { "table": "diary.classics.film", "version": 17, "operation": "ALTER TABLE" }
661
785
  ],
662
- "migration_id": "20261020T173845-alter_table-alter-table-diary-classics-fil-3"
786
+ "migration_id": "20261024T053837-alter_table-alter-table-diary-classics-fil-5"
663
787
  }
664
788
  ```
665
789
 
@@ -709,9 +833,9 @@ Answer:
709
833
  ],
710
834
  "planned_texts": ["datanotes/metastore.yaml"],
711
835
  "commits": [
712
- { "table": "diary.classics.film", "version": 14, "operation": "ALTER TABLE" }
836
+ { "table": "diary.classics.film", "version": 18, "operation": "ALTER TABLE" }
713
837
  ],
714
- "migration_id": "20261020T173845-alter_table-alter-table-diary-classics-fil-4"
838
+ "migration_id": "20261024T053837-alter_table-alter-table-diary-classics-fil-6"
715
839
  }
716
840
  ```
717
841
 
@@ -751,9 +875,9 @@ Answer:
751
875
  "op": "alter_table",
752
876
  "planned_texts": ["datanotes/metastore.yaml"],
753
877
  "commits": [
754
- { "table": "diary.classics.film", "version": 15, "operation": "ALTER TABLE" }
878
+ { "table": "diary.classics.film", "version": 19, "operation": "ALTER TABLE" }
755
879
  ],
756
- "migration_id": "20261020T173845-alter_table-alter-table-diary-classics-fil-5"
880
+ "migration_id": "20261024T053837-alter_table-alter-table-diary-classics-fil-7"
757
881
  }
758
882
  ```
759
883
 
@@ -771,9 +895,9 @@ Answer:
771
895
  "op": "alter_table",
772
896
  "planned_texts": ["datanotes/metastore.yaml"],
773
897
  "commits": [
774
- { "table": "diary.classics.film", "version": 16, "operation": "ALTER TABLE" }
898
+ { "table": "diary.classics.film", "version": 20, "operation": "ALTER TABLE" }
775
899
  ],
776
- "migration_id": "20261020T173845-alter_table-alter-table-diary-classics-fil-6"
900
+ "migration_id": "20261024T053837-alter_table-alter-table-diary-classics-fil-8"
777
901
  }
778
902
  ```
779
903
 
@@ -791,9 +915,9 @@ Answer:
791
915
  "op": "alter_table",
792
916
  "planned_texts": ["datanotes/metastore.yaml"],
793
917
  "commits": [
794
- { "table": "diary.classics.film", "version": 17, "operation": "ALTER TABLE" }
918
+ { "table": "diary.classics.film", "version": 21, "operation": "ALTER TABLE" }
795
919
  ],
796
- "migration_id": "20261020T173845-alter_table-alter-table-diary-classics-fil-7"
920
+ "migration_id": "20261024T053837-alter_table-alter-table-diary-classics-fil-9"
797
921
  }
798
922
  ```
799
923
 
@@ -819,8 +943,8 @@ Answer:
819
943
  "op": "insert_row",
820
944
  "files_created": 1,
821
945
  "planned_creates": ["datanotes/diary/classics/film/1925/Battleship Potemkin (1925).md"],
822
- "commits": [{ "table": "diary.classics.film", "version": 18, "operation": "WRITE" }],
823
- "migration_id": "20261020T173845-insert_row-insert-into-film-3"
946
+ "commits": [{ "table": "diary.classics.film", "version": 22, "operation": "WRITE" }],
947
+ "migration_id": "20261024T053837-insert_row-insert-into-film-4"
824
948
  }
825
949
  ```
826
950
 
@@ -830,7 +954,7 @@ Answer:
830
954
  ---
831
955
  table: diary.classics.film
832
956
  cut: restored
833
- id: 01a15a64-ea48-70a1-84d2-829cc3c9da62
957
+ id: 01a16c6b-0f27-7090-8d6f-7412c09f30e9
834
958
  title: Battleship Potemkin
835
959
  year: 1925
836
960
  minutes: 75
@@ -859,9 +983,9 @@ Answer:
859
983
  "op": "alter_table",
860
984
  "planned_texts": ["datanotes/metastore.yaml"],
861
985
  "commits": [
862
- { "table": "diary.classics.film", "version": 19, "operation": "ALTER TABLE" }
986
+ { "table": "diary.classics.film", "version": 23, "operation": "ALTER TABLE" }
863
987
  ],
864
- "migration_id": "20261020T173845-alter_table-alter-table-diary-classics-fil-8"
988
+ "migration_id": "20261024T053837-alter_table-alter-table-diary-classics-fil-10"
865
989
  }
866
990
  ```
867
991
 
@@ -882,8 +1006,8 @@ Answer:
882
1006
  "op": "insert_row",
883
1007
  "files_created": 1,
884
1008
  "planned_creates": ["datanotes/diary/classics/film/1924/Sherlock Jr. (1924).md"],
885
- "commits": [{ "table": "diary.classics.film", "version": 20, "operation": "WRITE" }],
886
- "migration_id": "20261020T173845-insert_row-insert-into-film-4"
1009
+ "commits": [{ "table": "diary.classics.film", "version": 24, "operation": "WRITE" }],
1010
+ "migration_id": "20261024T053838-insert_row-insert-into-film"
887
1011
  }
888
1012
  ```
889
1013
 
@@ -893,7 +1017,7 @@ Answer:
893
1017
  ---
894
1018
  table: diary.classics.film
895
1019
  cut: restored
896
- id: 01a15a64-ea5e-737b-a2ef-e105a2e98fdc
1020
+ id: 01a16c6b-0f36-716a-acd2-d5e466f33d94
897
1021
  title: Sherlock Jr.
898
1022
  year: 1924
899
1023
  minutes: 45
@@ -924,9 +1048,9 @@ Answer:
924
1048
  "op": "alter_table",
925
1049
  "planned_texts": ["datanotes/metastore.yaml"],
926
1050
  "commits": [
927
- { "table": "diary.classics.film", "version": 21, "operation": "ALTER TABLE" }
1051
+ { "table": "diary.classics.film", "version": 25, "operation": "ALTER TABLE" }
928
1052
  ],
929
- "migration_id": "20261020T173845-alter_table-alter-table-diary-classics-fil-9"
1053
+ "migration_id": "20261024T053838-alter_table-alter-table-diary-classics-fil"
930
1054
  }
931
1055
  ```
932
1056
 
@@ -1008,7 +1132,7 @@ Answer:
1008
1132
  ```json
1009
1133
  {
1010
1134
  "ok": true,
1011
- "migration_id": "20261020T173845-create_table-create-table-diary-log-watch"
1135
+ "migration_id": "20261024T053838-create_table-create-table-diary-log-watch"
1012
1136
  }
1013
1137
  ```
1014
1138
 
@@ -1037,7 +1161,7 @@ Answer:
1037
1161
  "files_created": 1,
1038
1162
  "planned_creates": ["datanotes/diary/log/watch/2026/10/2026-10-06 2130.md"],
1039
1163
  "commits": [{ "table": "diary.log.watch", "version": 1, "operation": "WRITE" }],
1040
- "migration_id": "20261020T173845-insert_row-insert-into-watch"
1164
+ "migration_id": "20261024T053838-insert_row-insert-into-watch"
1041
1165
  }
1042
1166
  ```
1043
1167
 
@@ -1046,7 +1170,7 @@ Answer:
1046
1170
  ```markdown
1047
1171
  ---
1048
1172
  table: diary.log.watch
1049
- id: 01a15a64-eaa5-7d15-957a-55f01a116533
1173
+ id: 01a16c6b-0f60-7b71-8d2f-3889591b195e
1050
1174
  film: "[[Nosferatu (1922)]]"
1051
1175
  occurred_at: 2026-10-06T21:30:00+02:00
1052
1176
  where: outdoor screening
@@ -1082,7 +1206,7 @@ Answer:
1082
1206
  "commits": [
1083
1207
  { "table": "sandbox.classics.film_copy", "version": 0, "operation": "CLONE" }
1084
1208
  ],
1085
- "migration_id": "20261020T173845-clone_table-clone-diary-classics-film-to-s"
1209
+ "migration_id": "20261024T053838-clone_table-clone-diary-classics-film-to-s"
1086
1210
  }
1087
1211
  ```
1088
1212
 
@@ -1148,7 +1272,7 @@ Answer:
1148
1272
  "commits": [
1149
1273
  { "table": "sandbox.classics.film_empty", "version": 0, "operation": "CLONE" }
1150
1274
  ],
1151
- "migration_id": "20261020T173845-clone_table-clone-diary-classics-film-to-s-2"
1275
+ "migration_id": "20261024T053838-clone_table-clone-diary-classics-film-to-s-2"
1152
1276
  }
1153
1277
  ```
1154
1278
 
@@ -1166,7 +1290,7 @@ Answer:
1166
1290
  "catalog": "sandbox",
1167
1291
  "schema": "classics",
1168
1292
  "rows": 0,
1169
- "columns": ["id", "added_on", "title", "year", "minutes", "status", "rating"]
1293
+ "columns": ["id", "added_on", "title", "year", "minutes", "status", "rating", "lead"]
1170
1294
  }
1171
1295
  ```
1172
1296
 
@@ -1230,7 +1354,7 @@ Answer:
1230
1354
  ],
1231
1355
  "planned_texts": ["datanotes/metastore.yaml"],
1232
1356
  "commits": [{ "table": "main.public.scratch", "version": 2, "operation": "DROP TABLE" }],
1233
- "migration_id": "20261020T173828-drop_table-drop-table-scratch"
1357
+ "migration_id": "20261024T053819-drop_table-drop-table-scratch"
1234
1358
  }
1235
1359
  ```
1236
1360
 
@@ -1254,7 +1378,7 @@ The engine wrote this file in its own words. It holds `film`, `watch` and `revie
1254
1378
 
1255
1379
  ```yaml
1256
1380
  # Metastore (Datanotes): catalogs, schemas, tables, columns, views.
1257
- id: 01a15a64-a676-7657-9ff4-7a1e6bcc5df3
1381
+ id: 01a16c6a-c732-7310-8bb4-c9f28c15517c
1258
1382
  config:
1259
1383
  history: true
1260
1384