datanotes 1.5.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SECURITY.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  ## Reporting a vulnerability
4
4
 
5
- Please report vulnerabilities privately, through GitHub's **Report a vulnerability** button on this
6
- repository (Security → Advisories), not in a public issue. You will get an answer within a week.
5
+ Please report vulnerabilities privately, by email to the maintainer listed on the npm package
6
+ page ([npmjs.com/package/datanotes](https://www.npmjs.com/package/datanotes)), not in public. You will get an answer within a week.
7
7
  Include the version, how to reproduce it and what an attacker gains.
8
8
 
9
9
  ## Security model
@@ -274,7 +274,7 @@ var OPERATIONS = [
274
274
  },
275
275
  "path": {
276
276
  "type": "string",
277
- "description": "database.yaml#catalog.schema.table (or a legacy schema note)."
277
+ "description": "database.yaml#catalog.schema.table."
278
278
  },
279
279
  "description": {
280
280
  "type": "string",
@@ -289,6 +289,7 @@ var OPERATIONS = [
289
289
  },
290
290
  "required": [
291
291
  "name",
292
+ "catalog",
292
293
  "schema",
293
294
  "qualified",
294
295
  "path"
@@ -386,7 +387,8 @@ var OPERATIONS = [
386
387
  "description": "Folder of the table's rows."
387
388
  },
388
389
  "inDatabase": {
389
- "type": "boolean"
390
+ "type": "boolean",
391
+ "description": "Always true."
390
392
  },
391
393
  "rowPath": {
392
394
  "type": "string",
@@ -400,6 +402,7 @@ var OPERATIONS = [
400
402
  "required": [
401
403
  "folder",
402
404
  "inDatabase",
405
+ "rowPath",
403
406
  "archive"
404
407
  ],
405
408
  "additionalProperties": true
@@ -486,7 +489,7 @@ var OPERATIONS = [
486
489
  },
487
490
  "dense": {
488
491
  "type": "boolean",
489
- "description": "Also a top-level schema field."
492
+ "description": "Written on every row (with its default)."
490
493
  }
491
494
  },
492
495
  "required": [
@@ -505,7 +508,7 @@ var OPERATIONS = [
505
508
  "items": {
506
509
  "type": "string"
507
510
  },
508
- "description": "Top-level schema fields without a column entry."
511
+ "description": "Table defaults without a column (written on every new row), and the table property."
509
512
  },
510
513
  "qualified": {
511
514
  "type": "string",
@@ -7646,7 +7649,7 @@ var OPERATIONS = [
7646
7649
  },
7647
7650
  {
7648
7651
  "name": "infer_table",
7649
- "description": "Read-only schema inference from notes' frontmatter.\n- `folder` (recursive; \"\" = whole vault) and/or `paths`: notes not yet in a table. Returns\n `columns` (type, enum `values`, link `ref` to the table most targets belong to, `required`,\n `unique`, `dense`, `from` when the property name is not a valid column name, `stats`),\n `proposal` ready for create_table (`name`, `options.filename` or `timeColumn`, `columns`) and\n `adopt` ready for adopt_rows (`paths`, `rename`, `relocate: false`), plus `notes` to read.\n Review the proposal (names, enums, required) before creating; ask the user when unsure.\n- `table`: keys the table's rows use but the table does not declare (candidates for add_column,\n or keys to drop from rows).\nA string column becomes an enum with at most `max_enum_values` distinct values (default 12).",
7652
+ "description": "Read-only schema inference from notes' frontmatter.\n- `folder` (recursive; \"\" = whole vault) and/or `paths`: notes not yet in a table. Returns\n `columns` (type, enum `values`, link `ref` to the table most targets belong to, `required`,\n `unique`, `dense`, `from` when the property name is not a valid column name, `stats`),\n `proposal` ready for create_table (`name`, `options.filename` or `timeColumn`, `columns`) and\n `adopt` ready for adopt_rows (`paths`, `rename`, `relocate: false`), plus `notes` to read.\n Review the proposal (names, enums, required) before creating; ask the user when unsure.\n- `table`: keys the table's rows use but the table does not declare (candidates for add_column,\n or keys to drop from rows).\nA string column becomes an enum when its values repeat: at least 3 notes, at most `max_enum_values`\ndistinct values (default 12), each used twice on average, short texts.",
7650
7653
  "inputSchema": {
7651
7654
  "additionalProperties": false,
7652
7655
  "properties": {
@@ -10445,7 +10448,7 @@ var OPERATIONS = [
10445
10448
  },
10446
10449
  {
10447
10450
  "name": "create_view",
10448
- "description": "Create (or `replace`) a view: a named select stored in database.yaml. Name it with the prefix\n`vw_` (e.g. `vw_open_tasks`): views share names and folders with tables. `query` takes the\nselect_rows parameters (table, columns, where, order_by, limit, join, group_by, aggregates, expand;\nrelative dates keep it current) and must run now. `comment` and `aliases` let agents find it;\n`labels` are column headings. Read it with select_rows(table=<view>). A note shows it with a\n```datanotes block containing `view: <name>` (drawn live by the client; nothing is written into\nthe note). Filters may read the note that shows the view: `{this.date}`, `{this.date+1d}` (a\nfrontmatter value, date arithmetic), `{this.link}` (a link to that note), `{this.name}`. The view\nalso gets a note in its schema folder.",
10451
+ "description": "Create (or `replace`) a view: a named select stored in database.yaml. Name it with the prefix\n`vw_` (e.g. `vw_open_tasks`): views share names and folders with tables. `query` takes the\nselect_rows parameters (table, columns, where, order_by, limit, join, group_by, aggregates, expand;\nrelative dates keep it current) and must run now. `comment` and `aliases` let agents find it;\n`labels` are column headings. Views are selected with select_rows(table=<view>), which may narrow them further\n(where, columns, order_by, limit). A view writes no note: it lives only in database.yaml.",
10449
10452
  "inputSchema": {
10450
10453
  "additionalProperties": false,
10451
10454
  "properties": {
@@ -12328,7 +12331,7 @@ function describeRefusal(data) {
12328
12331
  const op = data.op ?? "operation";
12329
12332
  const failed = (data.failed ?? []).length > 0;
12330
12333
  let head = failed ? `${op} failed` : `${op} refused \u2014 nothing was written`;
12331
- if (data.migrationId) head += ` (journal ${String(data.migrationId)}; use undo_migration to revert what was applied)`;
12334
+ if (failed && data.migrationId) head += ` (journal ${String(data.migrationId)}; use undo_migration to revert what was applied)`;
12332
12335
  return head + (shown.length ? `:
12333
12336
  ${shown.join("\n")}` : "");
12334
12337
  }
package/dist/api/index.js CHANGED
@@ -232,7 +232,7 @@ var OPERATIONS = [
232
232
  },
233
233
  "path": {
234
234
  "type": "string",
235
- "description": "database.yaml#catalog.schema.table (or a legacy schema note)."
235
+ "description": "database.yaml#catalog.schema.table."
236
236
  },
237
237
  "description": {
238
238
  "type": "string",
@@ -247,6 +247,7 @@ var OPERATIONS = [
247
247
  },
248
248
  "required": [
249
249
  "name",
250
+ "catalog",
250
251
  "schema",
251
252
  "qualified",
252
253
  "path"
@@ -344,7 +345,8 @@ var OPERATIONS = [
344
345
  "description": "Folder of the table's rows."
345
346
  },
346
347
  "inDatabase": {
347
- "type": "boolean"
348
+ "type": "boolean",
349
+ "description": "Always true."
348
350
  },
349
351
  "rowPath": {
350
352
  "type": "string",
@@ -358,6 +360,7 @@ var OPERATIONS = [
358
360
  "required": [
359
361
  "folder",
360
362
  "inDatabase",
363
+ "rowPath",
361
364
  "archive"
362
365
  ],
363
366
  "additionalProperties": true
@@ -444,7 +447,7 @@ var OPERATIONS = [
444
447
  },
445
448
  "dense": {
446
449
  "type": "boolean",
447
- "description": "Also a top-level schema field."
450
+ "description": "Written on every row (with its default)."
448
451
  }
449
452
  },
450
453
  "required": [
@@ -463,7 +466,7 @@ var OPERATIONS = [
463
466
  "items": {
464
467
  "type": "string"
465
468
  },
466
- "description": "Top-level schema fields without a column entry."
469
+ "description": "Table defaults without a column (written on every new row), and the table property."
467
470
  },
468
471
  "qualified": {
469
472
  "type": "string",
@@ -7604,7 +7607,7 @@ var OPERATIONS = [
7604
7607
  },
7605
7608
  {
7606
7609
  "name": "infer_table",
7607
- "description": "Read-only schema inference from notes' frontmatter.\n- `folder` (recursive; \"\" = whole vault) and/or `paths`: notes not yet in a table. Returns\n `columns` (type, enum `values`, link `ref` to the table most targets belong to, `required`,\n `unique`, `dense`, `from` when the property name is not a valid column name, `stats`),\n `proposal` ready for create_table (`name`, `options.filename` or `timeColumn`, `columns`) and\n `adopt` ready for adopt_rows (`paths`, `rename`, `relocate: false`), plus `notes` to read.\n Review the proposal (names, enums, required) before creating; ask the user when unsure.\n- `table`: keys the table's rows use but the table does not declare (candidates for add_column,\n or keys to drop from rows).\nA string column becomes an enum with at most `max_enum_values` distinct values (default 12).",
7610
+ "description": "Read-only schema inference from notes' frontmatter.\n- `folder` (recursive; \"\" = whole vault) and/or `paths`: notes not yet in a table. Returns\n `columns` (type, enum `values`, link `ref` to the table most targets belong to, `required`,\n `unique`, `dense`, `from` when the property name is not a valid column name, `stats`),\n `proposal` ready for create_table (`name`, `options.filename` or `timeColumn`, `columns`) and\n `adopt` ready for adopt_rows (`paths`, `rename`, `relocate: false`), plus `notes` to read.\n Review the proposal (names, enums, required) before creating; ask the user when unsure.\n- `table`: keys the table's rows use but the table does not declare (candidates for add_column,\n or keys to drop from rows).\nA string column becomes an enum when its values repeat: at least 3 notes, at most `max_enum_values`\ndistinct values (default 12), each used twice on average, short texts.",
7608
7611
  "inputSchema": {
7609
7612
  "additionalProperties": false,
7610
7613
  "properties": {
@@ -10403,7 +10406,7 @@ var OPERATIONS = [
10403
10406
  },
10404
10407
  {
10405
10408
  "name": "create_view",
10406
- "description": "Create (or `replace`) a view: a named select stored in database.yaml. Name it with the prefix\n`vw_` (e.g. `vw_open_tasks`): views share names and folders with tables. `query` takes the\nselect_rows parameters (table, columns, where, order_by, limit, join, group_by, aggregates, expand;\nrelative dates keep it current) and must run now. `comment` and `aliases` let agents find it;\n`labels` are column headings. Read it with select_rows(table=<view>). A note shows it with a\n```datanotes block containing `view: <name>` (drawn live by the client; nothing is written into\nthe note). Filters may read the note that shows the view: `{this.date}`, `{this.date+1d}` (a\nfrontmatter value, date arithmetic), `{this.link}` (a link to that note), `{this.name}`. The view\nalso gets a note in its schema folder.",
10409
+ "description": "Create (or `replace`) a view: a named select stored in database.yaml. Name it with the prefix\n`vw_` (e.g. `vw_open_tasks`): views share names and folders with tables. `query` takes the\nselect_rows parameters (table, columns, where, order_by, limit, join, group_by, aggregates, expand;\nrelative dates keep it current) and must run now. `comment` and `aliases` let agents find it;\n`labels` are column headings. Views are selected with select_rows(table=<view>), which may narrow them further\n(where, columns, order_by, limit). A view writes no note: it lives only in database.yaml.",
10407
10410
  "inputSchema": {
10408
10411
  "additionalProperties": false,
10409
10412
  "properties": {
@@ -12286,7 +12289,7 @@ function describeRefusal(data) {
12286
12289
  const op = data.op ?? "operation";
12287
12290
  const failed = (data.failed ?? []).length > 0;
12288
12291
  let head = failed ? `${op} failed` : `${op} refused \u2014 nothing was written`;
12289
- if (data.migrationId) head += ` (journal ${String(data.migrationId)}; use undo_migration to revert what was applied)`;
12292
+ if (failed && data.migrationId) head += ` (journal ${String(data.migrationId)}; use undo_migration to revert what was applied)`;
12290
12293
  return head + (shown.length ? `:
12291
12294
  ${shown.join("\n")}` : "");
12292
12295
  }