@rivi-software/d1-migrations 0.1.0 → 0.1.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/dist/bundle.d.ts CHANGED
@@ -2,10 +2,15 @@ import { type MigrationsSource } from "./files.js";
2
2
  import { type D1Migration } from "./index.js";
3
3
  export { compareMigrationPaths, listMigrationFiles } from "./files.js";
4
4
  export type { MigrationFile, MigrationFiles, MigrationsSource } from "./files.js";
5
+ /**
6
+ * Where {@link readD1Migrations} finds the migrations, and the table that records them: the D1
7
+ * binding's fields in the Wrangler config.
8
+ */
5
9
  export type ReadD1MigrationsOptions = MigrationsSource & {
6
10
  /** The binding's `migrations_table`. Default `d1_migrations`. */
7
11
  table?: string;
8
12
  };
13
+ /** {@link readD1Migrations}'s options, and the module {@link bundleD1Migrations} writes. */
9
14
  export type BundleD1MigrationsOptions = ReadD1MigrationsOptions & {
10
15
  /**
11
16
  * The module to write, relative to `cwd`. A `.ts` file gets type annotations; any other gets
@@ -13,10 +18,13 @@ export type BundleD1MigrationsOptions = ReadD1MigrationsOptions & {
13
18
  */
14
19
  out: string;
15
20
  };
21
+ /** What {@link bundleD1Migrations} put in the module, and whether it wrote it. */
16
22
  export type BundleD1MigrationsResult = {
17
23
  /** The module's absolute path. */
18
24
  out: string;
25
+ /** The migrations table the module names. */
19
26
  table: string;
27
+ /** The migrations in the module, in Wrangler's order, each split into its statements. */
20
28
  migrations: D1Migration[];
21
29
  /** Whether the module changed. An unchanged module is not written, so no watcher wakes. */
22
30
  changed: boolean;
package/dist/index.d.ts CHANGED
@@ -31,6 +31,7 @@ export interface D1DatabaseLike {
31
31
  prepare(query: string): D1StatementLike;
32
32
  batch(statements: D1StatementLike[]): Promise<unknown>;
33
33
  }
34
+ /** What {@link migrateD1} resolves to once every migration the database lacked is applied. */
34
35
  export type MigrateD1Result = {
35
36
  /** The migrations this call applied, in order. Empty when the database was up to date. */
36
37
  applied: string[];
package/dist/journal.d.ts CHANGED
@@ -2,10 +2,12 @@ import { type MigrationsSource } from "./files.js";
2
2
  export type { MigrationsSource } from "./files.js";
3
3
  /** The journal's file name in the migrations directory, unless `journal` names another file. */
4
4
  export declare const JOURNAL_FILE = "JOURNAL.json";
5
+ /** Where the migrations are, as the D1 binding in the Wrangler config says, and the journal. */
5
6
  export type JournalOptions = MigrationsSource & {
6
7
  /** The journal, relative to `cwd`. Default `JOURNAL.json` in the migrations directory. */
7
8
  journal?: string;
8
9
  };
10
+ /** One recorded migration: its name, and the hash of its text when it was recorded. */
9
11
  export type JournalEntry = {
10
12
  /** The migration's name, as its migrations table records it. */
11
13
  name: string;
@@ -25,12 +27,14 @@ export type JournalProblem = {
25
27
  name: string;
26
28
  kind: "edited" | "deleted" | "unrecorded";
27
29
  };
30
+ /** What {@link checkJournal} found. It writes nothing. */
28
31
  export type JournalCheck = {
29
32
  /** The journal's absolute path. */
30
33
  journal: string;
31
34
  /** Empty when every migration matches the journal. */
32
35
  problems: JournalProblem[];
33
36
  };
37
+ /** What {@link updateJournal} recorded, or the problems that kept it from writing anything. */
34
38
  export type JournalUpdate = {
35
39
  /** The journal's absolute path. */
36
40
  journal: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivi-software/d1-migrations",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "D1 migrations from inside a Worker, for databases an app creates at runtime: the same files, order and d1_migrations table as wrangler d1 migrations apply, and a journal of hashes that fails CI when an applied migration is edited",
5
5
  "keywords": [
6
6
  "cloudflare",