bun-query-builder 0.1.52 → 0.1.54

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.
@@ -11,7 +11,7 @@ export { inspectTable, tableInfo } from './inspect';
11
11
  export { introspect } from './introspect';
12
12
  export { generateModelSource, introspectDatabase, modelNameForTable, sqlTypeToAttr } from './introspect-db';
13
13
  export { makeModel } from './make-model';
14
- export { executeMigration, generateMigration, resetDatabase } from './migrate';
14
+ export { executeMigration, generateMigration, resetDatabase, saveMigrationSnapshot } from './migrate';
15
15
  export { migrateGenerate } from './migrate-generate';
16
16
  export { migrateRollback } from './migrate-rollback';
17
17
  export { migrateList, migrateStatus } from './migrate-status';
@@ -1,4 +1,12 @@
1
- import type { GenerateMigrationResult, MigrateOptions } from '@/types';
1
+ import type { GenerateMigrationResult, MigrateOptions, SupportedDialect } from '@/types';
2
+ import type { MigrationPlan } from '@/migrations';
3
+ /**
4
+ * Persist a plan returned by a dry-run migration after an embedding framework
5
+ * has successfully written the SQL itself. This keeps preview semantics pure
6
+ * while allowing a custom migration writer to advance the source-of-truth
7
+ * snapshot only after its own persistence step succeeds.
8
+ */
9
+ export declare function saveMigrationSnapshot(plan: MigrationPlan, options?: { dialect?: SupportedDialect, workspaceRoot?: string }): void;
2
10
  /**
3
11
  * Generate migration files by comparing the stored model snapshot with current models.
4
12
  *
package/dist/bin/cli.js CHANGED
@@ -15917,7 +15917,7 @@ function createQueryBuilder(state) {
15917
15917
  return false;
15918
15918
  },
15919
15919
  unsafe(query, params) {
15920
- return bunSql.unsafe(query, params);
15920
+ return _sql.unsafe(query, params);
15921
15921
  },
15922
15922
  file(path, params) {
15923
15923
  return bunSql.file(path, params);
@@ -18534,6 +18534,7 @@ var init_drivers = __esm(() => {
18534
18534
  // src/actions/migrate.ts
18535
18535
  var exports_migrate = {};
18536
18536
  __export(exports_migrate, {
18537
+ saveMigrationSnapshot: () => saveMigrationSnapshot,
18537
18538
  resetDatabase: () => resetDatabase,
18538
18539
  generateMigration: () => generateMigration,
18539
18540
  executeMigration: () => executeMigration,
@@ -18590,6 +18591,10 @@ function savePlanSnapshot(workspaceRoot, dialect, plan) {
18590
18591
  writeFileSync11(snapshotPath, JSON.stringify(snapshot, null, 2));
18591
18592
  info(`-- Model snapshot saved to ${snapshotPath}`);
18592
18593
  }
18594
+ function saveMigrationSnapshot(plan, options = {}) {
18595
+ const dialect = options.dialect ?? plan.dialect;
18596
+ savePlanSnapshot(options.workspaceRoot ?? getWorkspaceRoot(), dialect, plan);
18597
+ }
18593
18598
  function getWorkspaceRoot() {
18594
18599
  return process25.cwd();
18595
18600
  }
@@ -30951,7 +30956,7 @@ function getPrefix() {
30951
30956
  }
30952
30957
  var prefix = getPrefix();
30953
30958
  // package.json
30954
- var version2 = "0.1.52";
30959
+ var version2 = "0.1.54";
30955
30960
 
30956
30961
  // bin/cli.ts
30957
30962
  init_actions();
package/dist/src/index.js CHANGED
@@ -15916,7 +15916,7 @@ function createQueryBuilder(state) {
15916
15916
  return false;
15917
15917
  },
15918
15918
  unsafe(query, params) {
15919
- return bunSql.unsafe(query, params);
15919
+ return _sql.unsafe(query, params);
15920
15920
  },
15921
15921
  file(path, params) {
15922
15922
  return bunSql.file(path, params);
@@ -18533,6 +18533,7 @@ var init_drivers = __esm(() => {
18533
18533
  // src/actions/migrate.ts
18534
18534
  var exports_migrate = {};
18535
18535
  __export(exports_migrate, {
18536
+ saveMigrationSnapshot: () => saveMigrationSnapshot,
18536
18537
  resetDatabase: () => resetDatabase,
18537
18538
  generateMigration: () => generateMigration,
18538
18539
  executeMigration: () => executeMigration,
@@ -18589,6 +18590,10 @@ function savePlanSnapshot(workspaceRoot, dialect, plan) {
18589
18590
  writeFileSync11(snapshotPath, JSON.stringify(snapshot, null, 2));
18590
18591
  info(`-- Model snapshot saved to ${snapshotPath}`);
18591
18592
  }
18593
+ function saveMigrationSnapshot(plan, options = {}) {
18594
+ const dialect = options.dialect ?? plan.dialect;
18595
+ savePlanSnapshot(options.workspaceRoot ?? getWorkspaceRoot(), dialect, plan);
18596
+ }
18592
18597
  function getWorkspaceRoot() {
18593
18598
  return process25.cwd();
18594
18599
  }
@@ -28930,6 +28935,7 @@ export {
28930
28935
  setQueryCacheMaxSize,
28931
28936
  setConfig,
28932
28937
  seedModel,
28938
+ saveMigrationSnapshot,
28933
28939
  runSeeders,
28934
28940
  runSeeder,
28935
28941
  runBenchmark,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-query-builder",
3
3
  "type": "module",
4
- "version": "0.1.52",
4
+ "version": "0.1.54",
5
5
  "description": "A simple yet performant query builder for TypeScript. Built with Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",