lines-db 0.15.0 → 0.18.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/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @toiroakr/lines-db
2
2
 
3
+ ## 0.18.1
4
+
5
+ ### Patch Changes
6
+
7
+ - e06facb: `lines-db validate` now prints a warning on stderr when every table it loaded has zero records (for example when all `.jsonl` files are empty placeholders), so a run that checked nothing no longer looks like a plain success. The exit code stays 0.
8
+
9
+ ## 0.18.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 8f9912e: Migrate CLI argument validation to @politty/loculus and generate validators with @loculus/rolldown during the build. Node.js 22.18.0 or newer is now required.
14
+
15
+ ## 0.17.0
16
+
17
+ ### Minor Changes
18
+
19
+ - d711b36: Allow `fillFields()` and `lines-db fill` to fill multiple directories or JSONL files in one operation, computing values and checking for outside changes across all paths before writing. Add `--schema-dir` to the fill command for shared schemas.
20
+
21
+ ## 0.16.0
22
+
23
+ ### Minor Changes
24
+
25
+ - 19259c2: Move the Studio server and browser assets into @lines-db/studio. Install the new package to continue using lines-db studio. Other CLI commands and the database library no longer ship Studio.
26
+
27
+ Rename the core package from @toiroakr/lines-db to lines-db. Update imports and installation commands to use lines-db.
28
+
29
+ Update CLI imports, generated types, editor integration, and documentation for the new package names. Publish both packages from the release workflow.
30
+
31
+ Use the current TypeScript 7.1 synchronous API for Studio schema inspection and verify declared columns with TypeScript 5 and 7.1 in CI.
32
+
33
+ ## 0.15.1
34
+
35
+ ### Patch Changes
36
+
37
+ - c7d2668: Add named dataset configuration for CLI and programmatic use. Export `loadDatasetConfig(path?, { datasets?: string[] | "all" })` returning a database configuration; omit `datasets` or use `[]` for base only, pass an array to combine named sets in order, or use `"all"` to combine every set. `validate` without a positional path reads `lines-db.config.json` and validates only `base`; Repeated `--dataset <name>` flags add named sets in order and `--all-datasets` combines all sets. `--config <path>` selects another configuration, and data and schema paths resolve relative to that file. Existing positional file and directory validation remains unchanged. Reject nonexistent or non-directory schema paths to prevent skipped validation. Reject invalid configurations, unknown datasets and conflicting options; deduplicate overlapping data directories before validation.
38
+ - 19614fc: Support shared schema directories when editing Studio data sets, and edit composed data sets by routing updates and deletes to source files and selecting an insert destination, with conflict detection and rollback across files.
39
+
3
40
  ## 0.15.0
4
41
 
5
42
  ### Minor Changes
package/README.ja.md CHANGED
@@ -10,7 +10,7 @@ CLIには検証、マイグレーション、値の補完、型生成のコマ
10
10
 
11
11
  ## インストール
12
12
 
13
- Node.js 22.12.0以降が必要です。
13
+ Node.js 22.18.0以降が必要です。
14
14
 
15
15
  ```bash
16
16
  npm install lines-db
@@ -71,6 +71,61 @@ npx lines-db validate ./data --verbose
71
71
 
72
72
  対応するスキーマファイルを読み込み、各行を検証します。検証エラーにはファイル名と詳細を表示します。
73
73
 
74
+ #### 名前付きデータセットの検証
75
+
76
+ 共通データとシナリオ別のデータを `lines-db.config.json` に定義できます:
77
+
78
+ ```json
79
+ {
80
+ "schemaDir": "./data",
81
+ "base": ["./data"],
82
+ "datasets": {
83
+ "cogs": ["./data/cogs"],
84
+ "sales": ["./data/sales"]
85
+ }
86
+ }
87
+ ```
88
+
89
+ パスを省略すると、カレントディレクトリの `lines-db.config.json` を読み、`base` だけを検証します。
90
+ `--dataset <name>` は `base` に指定したデータセットを追加します。複数回指定すると、その順に各セットを結合します。`--all-datasets` は `base` と全データセットを
91
+ 一度に結合して検証します。シナリオ間で同じIDを使っている場合、全セットの結合では重複エラーになります。
92
+
93
+ ```bash
94
+ npx lines-db validate
95
+ npx lines-db validate --dataset cogs
96
+ npx lines-db validate --dataset cogs --dataset sales
97
+ npx lines-db validate --all-datasets
98
+ npx lines-db validate --config ./seed/lines-db.config.json --dataset cogs
99
+ ```
100
+
101
+ `--config <path>` で別の設定ファイルを指定できます。`schemaDir`・`base`・`datasets` は必須で、
102
+ `base` と各データセットは1つ以上のディレクトリを指定します(追加セットが無ければ `datasets: {}`)。
103
+ 設定内の相対パスは設定ファイルの場所が基準です。ディレクトリは `base`、選択したセットの順に読み込み、
104
+ 同じディレクトリは1回だけ読み込みます。サブディレクトリを自動で探索することはありません。
105
+ スキーマ・ユニーク制約・外部キーは結合したデータ全体に対して検証され、エラーは元のファイルを指します。
106
+
107
+ `--dataset` と `--all-datasets` の併用、または設定用オプションと位置引数のパスの併用はエラーです。
108
+ 不明なセット名や不正な設定もエラーになります。既存の `validate <path>` は設定ファイルを使わず、従来どおり動作します。
109
+ 設定ファイルを使うCLIコマンドは `validate` のみです。
110
+
111
+ プログラムからは同じ設定を `loadDatasetConfig()` で読み込めます:
112
+
113
+ ```typescript
114
+ import { LinesDB, loadDatasetConfig } from 'lines-db';
115
+
116
+ const config = await loadDatasetConfig('./lines-db.config.json', {
117
+ datasets: ['cogs', 'sales'],
118
+ });
119
+ const db = LinesDB.create(config);
120
+ ```
121
+
122
+ `datasets` の省略または `[]` はbaseのみ、配列はbase+指定セットを配列順に結合し、`'all'` はbase+全セットを
123
+ 設定ファイルの定義順に結合します。同じディレクトリは、シンボリックリンク経由の指定も含めて1回だけ読み込みます。
124
+ 引数を省略した `loadDatasetConfig()` は、カレントディレクトリの `lines-db.config.json` を読みます。
125
+ 戻り値は `Promise<DatabaseConfig>` です。設定ファイルを読み込めない場合、不正な設定や未知のセット名がある場合、
126
+ または選択したデータディレクトリが存在しない場合はPromiseをrejectします。データの読み込み・検証は
127
+ `db.initialize()` で実行します。`schemaDir` が存在しない、またはファイルを指す場合もエラーになります。
128
+
74
129
  ### データのマイグレーション
75
130
 
76
131
  JSONLファイルの各行に変換関数を適用し、結果をスキーマで検証して保存します。
@@ -113,10 +168,10 @@ npx lines-db migrate ./data/users.jsonl "(row) => row" --fields id
113
168
  ### 足りない値を埋める
114
169
 
115
170
  ```bash
116
- npx lines-db fill <path> [--fields id,createdAt]
171
+ npx lines-db fill <path...> [--schema-dir ./schemas] [--fields id,createdAt]
117
172
  ```
118
173
 
119
- `path`にはデータディレクトリか、JSONLファイルを指定します。指定したフィールドに値がない行へ、検証スキーマが補った値を書き込みます。`--fields`を省略すると、各テーブルの主キーが対象です。
174
+ `path`にはデータディレクトリやJSONLファイルを1つ以上指定します。共通スキーマを使う場合は`--schema-dir`で指定してください。省略すると各JSONLファイルと同じディレクトリでスキーマを探します。指定したフィールドに値がない行へ、検証スキーマが補った値を書き込みます。`--fields`を省略すると、各テーブルの主キーが対象です。
120
175
 
121
176
  既存の値は置き換えません。値を補わなかった行は改行コードも含めて変更せず、補った行のキーはスキーマの順に並べます。検証に失敗する行には書き込みません。全行の値を計算してからファイルへ書き込みます。読み込み後に他のツールがファイルを変更していた場合は、どのファイルにも書き込まず、ファイル名を含む`JsonlConflictError`で終了します。
122
177
 
@@ -141,6 +196,17 @@ const { filled } = unwrap(
141
196
 
142
197
  結果の`tablesWithoutSchema`にはスキーマがないテーブル、`unreadableLines`にはJSONオブジェクトとして読めない行、`unproducedFields`にはどのテーブルでも値を生成できなかったフィールドが入ります。
143
198
 
199
+ `fillFields()`の`path`には文字列か、空でない文字列配列を渡せます。複数パスでも全ファイルの値を計算し、外部変更を確認してから書き込みます。書き込み中に失敗した場合は、先に書き込んだファイルを復元します。重複して指定したファイルは1回だけ処理します。JSONオブジェクトとして読めない行は、従来どおり変更せずに報告します。
200
+
201
+ ```typescript
202
+ unwrap(
203
+ await fillFields({
204
+ path: ['./data/dataset-a', './data/dataset-b'],
205
+ schemaDir: './data',
206
+ }),
207
+ );
208
+ ```
209
+
144
210
  ### ブラウザで閲覧・編集する
145
211
 
146
212
  Studioをプロジェクトに追加して起動します。
@@ -506,11 +572,11 @@ const db = LinesDB.create({ dataDir: './data' });
506
572
 
507
573
  ```
508
574
  data/
509
- Item.schema.ts Item.jsonl # schemas and base data
575
+ Item.schema.ts Item.jsonl # スキーマと基本データ
510
576
  ItemValuation.schema.ts
511
577
  cogs/
512
- Item.jsonl # additional Item rows
513
- ItemValuation.jsonl # references Item rows from both sets
578
+ Item.jsonl # 追加のItem行
579
+ ItemValuation.jsonl # 両方のデータセットのItem行を参照
514
580
  ```
515
581
 
516
582
  ```typescript
package/README.md CHANGED
@@ -10,7 +10,7 @@ The CLI validates, migrates, fills missing values, and generates types. Install
10
10
 
11
11
  ## Installation
12
12
 
13
- Requires Node.js 22.12.0 or later.
13
+ Requires Node.js 22.18.0 or later.
14
14
 
15
15
  ```bash
16
16
  npm install lines-db
@@ -71,6 +71,60 @@ npx lines-db validate ./data --verbose
71
71
 
72
72
  The command loads the corresponding schema files and checks each row. Validation errors include the file and details of the failure.
73
73
 
74
+ #### Validate named datasets
75
+
76
+ Define shared data and scenario data in `lines-db.config.json`:
77
+
78
+ ```json
79
+ {
80
+ "schemaDir": "./data",
81
+ "base": ["./data"],
82
+ "datasets": {
83
+ "cogs": ["./data/cogs"],
84
+ "sales": ["./data/sales"]
85
+ }
86
+ }
87
+ ```
88
+
89
+ Omit the positional path to read `lines-db.config.json` in the current working directory and validate only `base`.
90
+ `--dataset <name>` adds the named dataset to `base`; repeat the flag to combine several sets in the specified order. `--all-datasets` combines `base` and every dataset in one
91
+ validation run; IDs shared by different scenarios will cause duplicate errors.
92
+
93
+ ```bash
94
+ npx lines-db validate
95
+ npx lines-db validate --dataset cogs
96
+ npx lines-db validate --dataset cogs --dataset sales
97
+ npx lines-db validate --all-datasets
98
+ npx lines-db validate --config ./seed/lines-db.config.json --dataset cogs
99
+ ```
100
+
101
+ Use `--config <path>` to select another configuration file. `schemaDir`, `base` and `datasets` are required.
102
+ `base` and each dataset must contain at least one directory; use `datasets: {}` when there are no additional sets.
103
+ Relative paths are resolved from the configuration file's directory. Directories are loaded in base-then-dataset
104
+ order, with each directory loaded only once. Subdirectories are not discovered automatically. Schemas, unique
105
+ constraints and foreign keys are checked across the combined data, and errors identify the original file.
106
+
107
+ Combining `--dataset` with `--all-datasets`, or using configuration options with a positional path, is an error.
108
+ Unknown dataset names and invalid configurations also fail. Existing `validate <path>` commands keep working
109
+ without reading a configuration file. Only the `validate` CLI command uses this configuration.
110
+
111
+ Programs can load the same configuration with `loadDatasetConfig()`:
112
+
113
+ ```typescript
114
+ import { LinesDB, loadDatasetConfig } from 'lines-db';
115
+
116
+ const config = await loadDatasetConfig('./lines-db.config.json', {
117
+ datasets: ['cogs', 'sales'],
118
+ });
119
+ const db = LinesDB.create(config);
120
+ ```
121
+
122
+ Omit `datasets` or pass `[]` for base only. An array combines base and the selected sets in array order;
123
+ `'all'` combines base and every set in configuration order. Each directory is loaded once, including symlink aliases.
124
+ Calling `loadDatasetConfig()` without arguments reads `lines-db.config.json` in the current working directory.
125
+ It returns `Promise<DatabaseConfig>` and rejects unreadable or invalid configuration, unknown set names and missing
126
+ selected data directories. A missing `schemaDir` or one pointing to a file is also rejected. Call `db.initialize()` to load and validate the data.
127
+
74
128
  ### Migrate data
75
129
 
76
130
  Apply a function to each row, validate the result, and save it to the JSONL file.
@@ -113,10 +167,10 @@ Rows are matched by primary key, or by position when the file has no primary key
113
167
  ### Fill missing values
114
168
 
115
169
  ```bash
116
- npx lines-db fill <path> [--fields id,createdAt]
170
+ npx lines-db fill <path...> [--schema-dir ./schemas] [--fields id,createdAt]
117
171
  ```
118
172
 
119
- Set `path` to a data directory or a JSONL file. The command fills missing fields with values supplied by the validation schema. Without `--fields`, it fills each table's primary key.
173
+ Pass one or more data directories or JSONL files. Use `--schema-dir` for shared schemas; otherwise schemas are loaded next to each JSONL file. The command fills missing fields with values supplied by the validation schema. Without `--fields`, it fills each table's primary key.
120
174
 
121
175
  Existing values are never replaced. Lines that gain no values remain unchanged, including line endings. Updated lines use the schema's key order. Rows that fail validation are not written. All values are computed before writing any files. If another tool changed a file after it was read, the command writes nothing and stops with a `JsonlConflictError` naming that file.
122
176
 
@@ -141,6 +195,17 @@ const { filled } = unwrap(
141
195
 
142
196
  The result's `tablesWithoutSchema` lists tables without schemas, `unreadableLines` lists lines that are not JSON objects, and `unproducedFields` lists fields for which no table produced a value.
143
197
 
198
+ `fillFields()` accepts a string or a non-empty readonly array of strings for `path`. Across all paths, every value is computed and every pending write is checked for outside changes before writing. If a write fails, files already written are restored. Overlapping paths process each file only once. Unreadable lines are still reported and left unchanged.
199
+
200
+ ```typescript
201
+ unwrap(
202
+ await fillFields({
203
+ path: ['./data/dataset-a', './data/dataset-b'],
204
+ schemaDir: './data',
205
+ }),
206
+ );
207
+ ```
208
+
144
209
  ### Browse and Edit in the Browser
145
210
 
146
211
  Install Studio in the project and start it with the CLI.
@@ -397,7 +462,7 @@ The database records each JSONL file's contents when reading or writing it. If a
397
462
  const result = await db.transaction((tx) => unwrap(tx.update('users', { age: 31 }, { id: 1 })));
398
463
 
399
464
  if (!result.ok && result.error.name === 'JsonlConflictError') {
400
- console.log(`${(result.error as JsonlConflictError).file} がディスク上で変更されています`);
465
+ console.log(`${(result.error as JsonlConflictError).file} has changed on disk`);
401
466
  }
402
467
  ```
403
468
 
package/bin/cli.mjs CHANGED
@@ -1,14 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire, register } from "node:module";
3
- import { access, chmod, link, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
3
+ import { access, chmod, link, mkdir, readFile, readdir, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
4
4
  import { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve } from "node:path";
5
5
  import { createHash, randomBytes } from "node:crypto";
6
6
  import { pathToFileURL } from "node:url";
7
7
  import { styleText } from "node:util";
8
- import { z } from "zod";
9
- import { arg, defineCommand, runMain } from "@politty/zod";
8
+ import * as l from "loculus";
9
+ import { arg, defineCommand, runMain } from "@politty/loculus";
10
10
  import { runInNewContext } from "node:vm";
11
11
  import { spawn } from "node:child_process";
12
+ import { z } from "zod";
12
13
  //#region \0rolldown/runtime.js
13
14
  var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
14
15
  //#endregion
@@ -2721,20 +2722,36 @@ async function fillFields(options) {
2721
2722
  }
2722
2723
  async function fillFieldsInternal(options) {
2723
2724
  if (options.fields && options.fields.length === 0) throw new Error("No fields to fill. Name at least one field.");
2724
- const { dataDir, tableNames } = await resolveTables(options.path);
2725
- const schemaDir = options.schemaDir ?? dataDir;
2725
+ const paths = typeof options.path === "string" ? [options.path] : options.path;
2726
+ if (paths.length === 0) throw new Error("No paths to fill. Name at least one path.");
2727
+ const sources = /* @__PURE__ */ new Map();
2728
+ for (const path of paths) {
2729
+ const { dataDir, tableNames } = await resolveTables(path);
2730
+ for (const table of tableNames) {
2731
+ const file = join(dataDir, `${table}.jsonl`);
2732
+ const key = await realpath(file);
2733
+ if (!sources.has(key)) sources.set(key, {
2734
+ table,
2735
+ file,
2736
+ target: key,
2737
+ schemaDir: options.schemaDir ?? dataDir
2738
+ });
2739
+ }
2740
+ }
2726
2741
  const loadFiller = options.loadFiller ?? fillerFromValidationSchema;
2727
2742
  const tablesWithoutSchema = [];
2728
2743
  const tables = [];
2729
- for (const table of tableNames) {
2744
+ for (const { table, file, target, schemaDir } of sources.values()) {
2730
2745
  const schemaPath = await findSchemaFile(schemaDir, table);
2731
2746
  if (!schemaPath) {
2732
- tablesWithoutSchema.push(table);
2747
+ if (!tablesWithoutSchema.includes(table)) tablesWithoutSchema.push(table);
2733
2748
  continue;
2734
2749
  }
2735
2750
  const schemaModule = await import(`${pathToFileURL(schemaPath).href}?t=${Date.now()}`);
2736
2751
  tables.push({
2737
2752
  table,
2753
+ file,
2754
+ target,
2738
2755
  fields: options.fields ?? [primaryKeyOf(schemaModule)],
2739
2756
  fill: loadFiller(schemaModule, {
2740
2757
  tableName: table,
@@ -2746,9 +2763,8 @@ async function fillFieldsInternal(options) {
2746
2763
  const unreadableLines = [];
2747
2764
  const filled = [];
2748
2765
  const writes = [];
2749
- for (const { table, fields, fill } of tables) {
2750
- const file = join(dataDir, `${table}.jsonl`);
2751
- const read = await readFile(file, "utf-8");
2766
+ for (const { table, file, target, fields, fill } of tables) {
2767
+ const read = await readFile(target, "utf-8");
2752
2768
  const bom = read.startsWith("") ? "" : "";
2753
2769
  const lines = splitLines(read.slice(bom.length));
2754
2770
  const written = /* @__PURE__ */ new Set();
@@ -2780,6 +2796,7 @@ async function fillFieldsInternal(options) {
2780
2796
  if (count === 0) continue;
2781
2797
  writes.push({
2782
2798
  file,
2799
+ target,
2783
2800
  read,
2784
2801
  content: bom + lines.map((line) => `${line.text}${line.eol}`).join("")
2785
2802
  });
@@ -2790,7 +2807,7 @@ async function fillFieldsInternal(options) {
2790
2807
  count
2791
2808
  });
2792
2809
  }
2793
- for (const { file, read } of writes) if (await readFile(file, "utf-8") !== read) {
2810
+ for (const { file, target, read } of writes) if (await readFile(target, "utf-8") !== read) {
2794
2811
  const error = /* @__PURE__ */ new Error(`JSONL file '${file}' was changed after it was read, so no file was filled. Run the fill again.`);
2795
2812
  error.name = "JsonlConflictError";
2796
2813
  error.file = file;
@@ -2802,7 +2819,7 @@ async function fillFieldsInternal(options) {
2802
2819
  filled,
2803
2820
  tablesWithoutSchema,
2804
2821
  unreadableLines,
2805
- unproducedFields: tableNames.length > 0 ? named.filter((field) => !produced.has(field)) : []
2822
+ unproducedFields: sources.size > 0 ? named.filter((field) => !produced.has(field)) : []
2806
2823
  };
2807
2824
  }
2808
2825
  /**
@@ -2812,21 +2829,21 @@ async function fillFieldsInternal(options) {
2812
2829
  async function replaceAll(writes) {
2813
2830
  const staged = writes.map((write) => ({
2814
2831
  ...write,
2815
- temporary: `${write.file}.${randomBytes(6).toString("hex")}.tmp`
2832
+ temporary: `${write.target}.${randomBytes(6).toString("hex")}.tmp`
2816
2833
  }));
2817
2834
  const replaced = [];
2818
2835
  try {
2819
- for (const { file, temporary, content } of staged) {
2836
+ for (const { target, temporary, content } of staged) {
2820
2837
  await writeFile(temporary, content, "utf-8");
2821
- await chmod(temporary, (await stat(file)).mode & 4095);
2838
+ await chmod(temporary, (await stat(target)).mode & 4095);
2822
2839
  }
2823
2840
  for (const write of staged) {
2824
- await rename(write.temporary, write.file);
2841
+ await rename(write.temporary, write.target);
2825
2842
  replaced.push(write);
2826
2843
  }
2827
2844
  } catch (error) {
2828
2845
  const notRestored = [];
2829
- for (const { file, read } of replaced) await writeFile(file, read, "utf-8").catch(() => notRestored.push(file));
2846
+ for (const { file, target, read } of replaced) await writeFile(target, read, "utf-8").catch(() => notRestored.push(file));
2830
2847
  await Promise.all(staged.map(({ temporary }) => rm(temporary, { force: true })));
2831
2848
  if (notRestored.length === 0) throw error;
2832
2849
  throw new Error(`${toError(error).message}\nThese files could not be put back and stay filled: ${notRestored.join(", ")}`, { cause: error });
@@ -2903,6 +2920,53 @@ function serializeRow(row, fieldOrder) {
2903
2920
  return JSON.stringify(out);
2904
2921
  }
2905
2922
  //#endregion
2923
+ //#region src/dataset-config.ts
2924
+ const directories = z.array(z.string().min(1)).min(1);
2925
+ const datasetConfigSchema = z.strictObject({
2926
+ schemaDir: z.string().min(1),
2927
+ base: directories,
2928
+ datasets: z.record(z.string().min(1), directories)
2929
+ });
2930
+ async function resolveValidationTarget(options) {
2931
+ if (options.dataset !== void 0 && options.allDatasets) throw new Error("Use either --dataset or --all-datasets, not both.");
2932
+ if (options.path !== void 0) {
2933
+ if (options.config !== void 0 || options.dataset !== void 0 || options.allDatasets) throw new Error("A file or directory path cannot be combined with dataset configuration options.");
2934
+ const stats = await stat(options.path);
2935
+ if (stats.isDirectory()) return { dataDir: options.path };
2936
+ if (stats.isFile() && options.path.endsWith(".jsonl")) return {
2937
+ dataDir: dirname(options.path),
2938
+ tableName: basename(options.path, ".jsonl")
2939
+ };
2940
+ throw new Error(`Invalid path: ${options.path}. Must be a directory or .jsonl file.`);
2941
+ }
2942
+ return loadDatasetConfig(options.config, { datasets: options.allDatasets ? "all" : options.dataset });
2943
+ }
2944
+ async function loadDatasetConfig(path = "lines-db.config.json", options = {}) {
2945
+ const configPath = resolve(path);
2946
+ let config;
2947
+ try {
2948
+ config = datasetConfigSchema.parse(JSON.parse(await readFile(configPath, "utf-8")));
2949
+ } catch (error) {
2950
+ throw new Error(`Failed to load dataset configuration ${configPath}: ${error instanceof Error ? error.message : String(error)}`);
2951
+ }
2952
+ const selected = (options.datasets === "all" ? Object.keys(config.datasets) : options.datasets ?? []).flatMap((name) => {
2953
+ if (!Object.hasOwn(config.datasets, name)) throw new Error(`Unknown dataset '${name}'. Available datasets: ${Object.keys(config.datasets).join(", ") || "(none)"}`);
2954
+ return config.datasets[name];
2955
+ });
2956
+ const configDir = dirname(configPath);
2957
+ const schemaDir = resolve(configDir, config.schemaDir);
2958
+ try {
2959
+ if (!(await stat(schemaDir)).isDirectory()) throw new Error("Expected a directory");
2960
+ } catch (error) {
2961
+ throw new Error(`Invalid schemaDir ${schemaDir}: ${error instanceof Error ? error.message : String(error)}`);
2962
+ }
2963
+ const dataDirs = await Promise.all([...config.base, ...selected].map((dir) => realpath(resolve(configDir, dir))));
2964
+ return {
2965
+ dataDir: [...new Set(dataDirs)],
2966
+ schemaDir
2967
+ };
2968
+ }
2969
+ //#endregion
2906
2970
  //#region src/cli.ts
2907
2971
  register("amaro/transform", import.meta.url);
2908
2972
  const originalEmitWarning = process.emitWarning;
@@ -2936,12 +3000,12 @@ function runInSandbox(expression, context = {}) {
2936
3000
  const generateCommand = defineCommand({
2937
3001
  name: "generate",
2938
3002
  description: "Generate TypeScript type definitions from schema files",
2939
- args: z.object({
2940
- dataDir: arg(z.string(), {
3003
+ args: l.object({
3004
+ dataDir: arg(l.string(), {
2941
3005
  positional: true,
2942
3006
  description: "Directory containing JSONL and schema files"
2943
3007
  }),
2944
- output: arg(z.string().optional(), {
3008
+ output: arg(l.string({ optional: true }), {
2945
3009
  alias: "o",
2946
3010
  description: "Output file path (default: db.ts in dataDir)"
2947
3011
  })
@@ -2962,27 +3026,23 @@ const generateCommand = defineCommand({
2962
3026
  const validateCommand = defineCommand({
2963
3027
  name: "validate",
2964
3028
  description: "Validate JSONL file(s) against schema",
2965
- args: z.object({
2966
- path: arg(z.string(), {
3029
+ args: l.object({
3030
+ path: arg(l.string({ optional: true }), {
2967
3031
  positional: true,
2968
- description: "File or directory path to validate"
3032
+ description: "File or directory path to validate (omit to use lines-db.config.json)"
2969
3033
  }),
2970
- verbose: arg(z.boolean().default(false), {
3034
+ config: arg(l.string({ optional: true }), { description: "Dataset configuration file (default: ./lines-db.config.json)" }),
3035
+ dataset: arg(l.array(l.string(), { optional: true }), { description: "Named datasets to validate together with base (repeat to select several)" }),
3036
+ allDatasets: arg(l.boolean({ default: false }), { description: "Validate base and all datasets together" }),
3037
+ verbose: arg(l.boolean({ default: false }), {
2971
3038
  alias: "v",
2972
3039
  description: "Show verbose error output"
2973
3040
  })
2974
3041
  }),
2975
3042
  run: async (args) => {
2976
3043
  try {
2977
- const stats = await stat(args.path);
2978
- let dataDir;
2979
- let tableName;
2980
- if (stats.isDirectory()) dataDir = args.path;
2981
- else if (stats.isFile() && args.path.endsWith(".jsonl")) {
2982
- dataDir = dirname(args.path);
2983
- tableName = basename(args.path, ".jsonl");
2984
- } else throw new Error(`Invalid path: ${args.path}. Must be a directory or .jsonl file.`);
2985
- const db = LinesDB.create({ dataDir });
3044
+ const { tableName, ...config } = await resolveValidationTarget(args);
3045
+ const db = LinesDB.create(config);
2986
3046
  let result;
2987
3047
  try {
2988
3048
  result = unwrap(await db.initialize({
@@ -2992,6 +3052,11 @@ const validateCommand = defineCommand({
2992
3052
  } finally {
2993
3053
  await db.close();
2994
3054
  }
3055
+ if (result.tableResults.length > 0 && result.tableResults.every((r) => r.rowCount === 0)) {
3056
+ const dirs = [config.dataDir].flat().join(", ");
3057
+ const message = tableName ? `The selected file ${tableName}.jsonl in ${dirs} is empty (0 records), so none of its records were validated.` : `No records were validated: every JSONL file in ${dirs} is empty (0 records in total).`;
3058
+ console.warn(styleText("yellow", `⚠ ${message}`));
3059
+ }
2995
3060
  if (!tableName) {
2996
3061
  const formatter = new ErrorFormatter({ verbose: args.verbose });
2997
3062
  for (const tableResult of result.tableResults) if (tableResult.valid && tableResult.warnings.length === 0) console.log(styleText("green", `✓ ${tableResult.tableName} (${tableResult.rowCount} records)`));
@@ -3069,25 +3134,25 @@ const validateCommand = defineCommand({
3069
3134
  const migrateCommand = defineCommand({
3070
3135
  name: "migrate",
3071
3136
  description: "Migrate data with transformation function",
3072
- args: z.object({
3073
- path: arg(z.string(), {
3137
+ args: l.object({
3138
+ path: arg(l.string(), {
3074
3139
  positional: true,
3075
3140
  description: "File or directory path to migrate"
3076
3141
  }),
3077
- transform: arg(z.string(), {
3142
+ transform: arg(l.string(), {
3078
3143
  positional: true,
3079
3144
  description: "Transform function (e.g., \"(row) => ({ ...row, age: row.age + 1 })\")"
3080
3145
  }),
3081
- filter: arg(z.string().optional(), {
3146
+ filter: arg(l.string({ optional: true }), {
3082
3147
  alias: "f",
3083
3148
  description: "Filter expression"
3084
3149
  }),
3085
- fields: arg(z.string().optional(), { description: "Comma-separated fields to write back (e.g. \"id\"). Every other field keeps the value the JSONL file already had. Default: write every field" }),
3086
- errorOutput: arg(z.string().optional(), {
3150
+ fields: arg(l.string({ optional: true }), { description: "Comma-separated fields to write back (e.g. \"id\"). Every other field keeps the value the JSONL file already had. Default: write every field" }),
3151
+ errorOutput: arg(l.string({ optional: true }), {
3087
3152
  alias: "e",
3088
3153
  description: "Output file path for transformed data when migration fails"
3089
3154
  }),
3090
- verbose: arg(z.boolean().default(false), {
3155
+ verbose: arg(l.boolean({ default: false }), {
3091
3156
  alias: "v",
3092
3157
  description: "Show verbose error output"
3093
3158
  })
@@ -3122,12 +3187,13 @@ const migrateCommand = defineCommand({
3122
3187
  const fillCommand = defineCommand({
3123
3188
  name: "fill",
3124
3189
  description: "Fill the values each table computes into the JSONL rows that have none for the named fields",
3125
- args: z.object({
3126
- path: arg(z.string(), {
3190
+ args: l.object({
3191
+ path: arg(l.array(l.string(), { min: 1 }), {
3127
3192
  positional: true,
3128
- description: "Data directory, or one .jsonl file in it"
3193
+ description: "One or more data directories or .jsonl files"
3129
3194
  }),
3130
- fields: arg(z.string().optional(), {
3195
+ schemaDir: arg(l.string({ optional: true }), { description: "Directory holding shared schemas (default: next to each JSONL file)" }),
3196
+ fields: arg(l.string({ optional: true }), {
3131
3197
  alias: "f",
3132
3198
  description: "Comma-separated fields to fill (default: each table's primary key)"
3133
3199
  })
@@ -3136,6 +3202,7 @@ const fillCommand = defineCommand({
3136
3202
  const fields = args.fields?.split(",").map((field) => field.trim()).filter(Boolean);
3137
3203
  const result = await fillFields({
3138
3204
  path: args.path,
3205
+ schemaDir: args.schemaDir,
3139
3206
  fields
3140
3207
  });
3141
3208
  if (!result.ok) {
@@ -3162,19 +3229,24 @@ let studio;
3162
3229
  const studioCommand = defineCommand({
3163
3230
  name: "studio",
3164
3231
  description: "Browse and edit the tables of a data directory in the browser",
3165
- args: z.object({
3166
- path: arg(z.string().optional(), {
3232
+ args: l.object({
3233
+ path: arg(l.string({ optional: true }), {
3167
3234
  positional: true,
3168
3235
  description: "Directory containing JSONL files"
3169
3236
  }),
3170
- dataDir: arg(z.array(z.string()).default([]), { description: "Directory containing JSONL files (repeatable)" }),
3171
- schemaDir: arg(z.string().optional(), { description: "Directory containing shared schema files (required for several data directories)" }),
3172
- port: arg(z.coerce.number().int().min(0).max(65535).default(4848), {
3237
+ dataDir: arg(l.array(l.string(), { default: [] }), { description: "Directory containing JSONL files (repeatable)" }),
3238
+ schemaDir: arg(l.string({ optional: true }), { description: "Directory containing shared schema files (required for several data directories)" }),
3239
+ port: arg(l.number({
3240
+ integer: true,
3241
+ gte: 0,
3242
+ lte: 65535,
3243
+ default: 4848
3244
+ }), {
3173
3245
  alias: "p",
3174
3246
  description: "Port to listen on (0 picks a free one)"
3175
3247
  }),
3176
- open: arg(z.boolean().default(false), { description: "Open the studio in the default browser" }),
3177
- writeFilledValues: arg(z.enum(["all", "primaryKey"]).default("primaryKey"), { description: "Values the schema fills in that a save writes: all of them, or only a generated primary key" })
3248
+ open: arg(l.boolean({ default: false }), { description: "Open the studio in the default browser" }),
3249
+ writeFilledValues: arg(l.enum(["all", "primaryKey"], { default: "primaryKey" }), { description: "Values the schema fills in that a save writes: all of them, or only a generated primary key" })
3178
3250
  }),
3179
3251
  run: async (args) => {
3180
3252
  try {
package/dist/index.d.mts CHANGED
@@ -571,11 +571,11 @@ export declare function mergeFields(line: JsonObject, computed: Record<string, J
571
571
  /** Computes the values a row gets, from the row as its line holds it */
572
572
  type RowFiller = (row: JsonObject) => Record<string, unknown>;
573
573
  interface FillFieldsOptions {
574
- /** A data directory, or one `.jsonl` file in it */
575
- path: string;
574
+ /** One or more data directories or `.jsonl` files */
575
+ path: string | readonly string[];
576
576
  /** Fields to fill. Defaults to each table's primary key: `primaryKey` in its schema file, or `id` */
577
577
  fields?: readonly string[];
578
- /** Directory the `<Table>.schema.{ts,mts,cts}` files are looked up in. Defaults to the data directory */
578
+ /** Directory the `<Table>.schema.{ts,mts,cts}` files are looked up in. Defaults to each file's data directory */
579
579
  schemaDir?: string;
580
580
  /**
581
581
  * Builds the function that computes a table's row values from its schema module. Defaults to the
@@ -870,5 +870,11 @@ type RuntimeEnvironment = 'node' | 'unknown';
870
870
  export declare function detectRuntime(): RuntimeEnvironment;
871
871
  export declare const RUNTIME: RuntimeEnvironment;
872
872
  //#endregion
873
- export { type BiDirectionalSchema, type ColumnDefinition, type DatabaseConfig, type ErrorFormatterOptions, type FillFieldsOptions, type FillFieldsResult, type FilledFile, type ForeignKeyDefinition, type ForeignKeyErrorInfo, type IndexDefinition, type InferInput, type InferOutput, type JsonArray, type JsonObject, type JsonValue, type JsonlConflictError, type JsonlParseError, JsonlReader, type JsonlSnapshot, type MergeFieldsOptions, type Result, type RowFiller, type RuntimeEnvironment, type SQLiteDatabase, type SQLiteStatement, type SchemaExtension, type SchemaOptions, type StandardSchema, type StandardSchemaIssue, type StandardSchemaResult, type SyncOptions, type Table, type TableConfig, type TableDefs, type TableSchema, type TableValidationOptions, type TableValidationResult, type TypeGeneratorOptions, type UpdateOptions, type ValidationError, type ValidationErrorDetail, type ValidationErrorInfo, type ValidationResult, type WriteFilledValues, err, ok, unwrap };
873
+ //#region src/dataset-config.d.ts
874
+ interface DatasetConfigOptions {
875
+ datasets?: string[] | 'all';
876
+ }
877
+ export declare function loadDatasetConfig(path?: string, options?: DatasetConfigOptions): Promise<DatabaseConfig>;
878
+ //#endregion
879
+ export { type BiDirectionalSchema, type ColumnDefinition, type DatabaseConfig, type DatasetConfigOptions, type ErrorFormatterOptions, type FillFieldsOptions, type FillFieldsResult, type FilledFile, type ForeignKeyDefinition, type ForeignKeyErrorInfo, type IndexDefinition, type InferInput, type InferOutput, type JsonArray, type JsonObject, type JsonValue, type JsonlConflictError, type JsonlParseError, JsonlReader, type JsonlSnapshot, type MergeFieldsOptions, type Result, type RowFiller, type RuntimeEnvironment, type SQLiteDatabase, type SQLiteStatement, type SchemaExtension, type SchemaOptions, type StandardSchema, type StandardSchemaIssue, type StandardSchemaResult, type SyncOptions, type Table, type TableConfig, type TableDefs, type TableSchema, type TableValidationOptions, type TableValidationResult, type TypeGeneratorOptions, type UpdateOptions, type ValidationError, type ValidationErrorDetail, type ValidationErrorInfo, type ValidationResult, type WriteFilledValues, err, ok, unwrap };
874
880
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/sqlite-adapter.ts","../src/database.ts","../src/jsonl-writer.ts","../src/merge-fields.ts","../src/fill.ts","../src/schema-loader.ts","../src/directory-scanner.ts","../src/schema.ts","../src/type-generator.ts","../src/jsonl-migration.ts","../src/schema-extensions.ts","../src/error-formatter.ts","../src/runtime.ts"],"mappings":";;;;;;;;UASiB;EACf,QAAQ,cAAc;EACtB,KAAK;EACL;;UAGe;EACf,OAAO;IAAkB;IAAiB;;EAC1C,OAAO;EACP,OAAO;;;;;;;UCkBQ;;EAEf;;;;;EAKA;;;;;UAMe;;;;;;;;;EASf;;;;;EAKA,oBAAoB;;qBAmET,QAAQ,eAAe;UAC1B;mBACS;UACT;UACA;UACA;UACA;UACA;UACA;;UAEA;;UAEA;;;;;UAKA;;;;;UAKA;;UAEA;;;;;UAKA;;UAEA;;UAEA;;UAEA;;UAEA;;UA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AAM;;;;;;wBAOc,qBAAqB,SAAS,yBAAyB;;;;;;;qBCThE;KACD,0BAA0B;;;;;wBAehB,eAAe,aAAa,oBAAoB;;;;wBAkCtD,aAAa;;;;;wBAQb,+BAA+B;;;;;wBAa/B,0BAA0B;;;UC3EzB;EACf;EACA;EACA,QAAQ,cAAc;EACtB;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;;qBAGW;UACH;EAEI,YAAA,UAAS;;;;EAOrB,uBAAuB,QAAQ;;;;EAU/B,sBAAsB,OAAO;;;;UAUrB;;;;UAiBA;;;;UAqCA;;;;UAOA;;;;UAoBA;;;;EAkBR,kBAAkB,eAAe;;;;EAQjC;;;;;;;KC9JU;wBAEI,iBAAiB;qBASpB,SAAO"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/sqlite-adapter.ts","../src/database.ts","../src/jsonl-writer.ts","../src/merge-fields.ts","../src/fill.ts","../src/schema-loader.ts","../src/directory-scanner.ts","../src/schema.ts","../src/type-generator.ts","../src/jsonl-migration.ts","../src/schema-extensions.ts","../src/error-formatter.ts","../src/runtime.ts","../src/dataset-config.ts"],"mappings":";;;;;;;;UASiB;EACf,QAAQ,cAAc;EACtB,KAAK;EACL;;UAGe;EACf,OAAO;IAAkB;IAAiB;;EAC1C,OAAO;EACP,OAAO;;;;;;;UCkBQ;;EAEf;;;;;EAKA;;;;;UAMe;;;;;;;;;EASf;;;;;EAKA,oBAAoB;;qBAmET,QAAQ,eAAe;UAC1B;mBACS;UACT;UACA;UACA;UACA;UACA;UACA;;UAEA;;UAEA;;;;;UAKA;;;;;UAKA;;UAEA;;;;;UAKA;;UAEA;;UAEA;;UAEA;;UAEA;;UAEA;;UAEA;;;;;UAKA;;UAEA;;UAEA;UAED;SAKA,OAAO,eAAe,WAAW,QAAQ,eAAe,SAAS,kBAAkB,QAAQ;;;;;;;;;;EAa5F,WAAW;IACf;IACA;IACA,aAAa,KAAK,eAAe;MAC/B,QAAQ,O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