bun-query-builder 0.1.60 → 0.1.62

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/bin/cli.js CHANGED
@@ -11704,6 +11704,7 @@ var init_config = __esm(() => {
11704
11704
  init_dist();
11705
11705
  defaultConfig4 = {
11706
11706
  verbose: true,
11707
+ snapshotDir: ".qb",
11707
11708
  dialect: "postgres",
11708
11709
  database: {
11709
11710
  database: "test_db",
@@ -18598,9 +18599,11 @@ function info(message) {
18598
18599
  if (config5.verbose)
18599
18600
  console.log(message);
18600
18601
  }
18602
+ function getSnapshotDir(workspaceRoot) {
18603
+ return join9(workspaceRoot, config5.snapshotDir || ".qb");
18604
+ }
18601
18605
  function getSnapshotPath(workspaceRoot, dialect) {
18602
- const snapshotDir = join9(workspaceRoot, ".qb");
18603
- return join9(snapshotDir, `model-snapshot.${dialect}.json`);
18606
+ return join9(getSnapshotDir(workspaceRoot), `model-snapshot.${dialect}.json`);
18604
18607
  }
18605
18608
  function loadPlanSnapshot(workspaceRoot, dialect) {
18606
18609
  const snapshotPath = getSnapshotPath(workspaceRoot, dialect);
@@ -18625,7 +18628,7 @@ function loadPlanSnapshot(workspaceRoot, dialect) {
18625
18628
  }
18626
18629
  function savePlanSnapshot(workspaceRoot, dialect, plan) {
18627
18630
  const snapshotPath = getSnapshotPath(workspaceRoot, dialect);
18628
- const snapshotDir = join9(workspaceRoot, ".qb");
18631
+ const snapshotDir = getSnapshotDir(workspaceRoot);
18629
18632
  const hash = hashMigrationPlan(plan);
18630
18633
  if (existsSync16(snapshotPath)) {
18631
18634
  try {
@@ -18665,6 +18668,7 @@ function ensureSqlDirectory(workspaceRoot) {
18665
18668
  return sqlDir;
18666
18669
  }
18667
18670
  async function generateMigration(dir, opts = {}) {
18671
+ await getConfig();
18668
18672
  if (!dir) {
18669
18673
  dir = join9(process25.cwd(), "app/Models");
18670
18674
  }
@@ -18736,6 +18740,7 @@ async function generateMigration(dir, opts = {}) {
18736
18740
  return { sql, sqlStatements, hasChanges, plan, operations };
18737
18741
  }
18738
18742
  async function executeMigration(dir) {
18743
+ await getConfig();
18739
18744
  if (!dir) {
18740
18745
  dir = join9(process25.cwd(), "app/Models");
18741
18746
  }
@@ -18801,6 +18806,7 @@ async function executeMigration(dir) {
18801
18806
  return true;
18802
18807
  }
18803
18808
  async function resetDatabase(dir, opts = {}) {
18809
+ await getConfig();
18804
18810
  if (!dir) {
18805
18811
  dir = join9(process25.cwd(), "app/Models");
18806
18812
  }
@@ -31147,7 +31153,7 @@ function getPrefix() {
31147
31153
  }
31148
31154
  var prefix = getPrefix();
31149
31155
  // package.json
31150
- var version2 = "0.1.60";
31156
+ var version2 = "0.1.62";
31151
31157
 
31152
31158
  // bin/cli.ts
31153
31159
  init_actions();
package/dist/src/index.js CHANGED
@@ -11703,6 +11703,7 @@ var init_config = __esm(() => {
11703
11703
  init_dist();
11704
11704
  defaultConfig4 = {
11705
11705
  verbose: true,
11706
+ snapshotDir: ".qb",
11706
11707
  dialect: "postgres",
11707
11708
  database: {
11708
11709
  database: "test_db",
@@ -18597,9 +18598,11 @@ function info(message) {
18597
18598
  if (config5.verbose)
18598
18599
  console.log(message);
18599
18600
  }
18601
+ function getSnapshotDir(workspaceRoot) {
18602
+ return join9(workspaceRoot, config5.snapshotDir || ".qb");
18603
+ }
18600
18604
  function getSnapshotPath(workspaceRoot, dialect) {
18601
- const snapshotDir = join9(workspaceRoot, ".qb");
18602
- return join9(snapshotDir, `model-snapshot.${dialect}.json`);
18605
+ return join9(getSnapshotDir(workspaceRoot), `model-snapshot.${dialect}.json`);
18603
18606
  }
18604
18607
  function loadPlanSnapshot(workspaceRoot, dialect) {
18605
18608
  const snapshotPath = getSnapshotPath(workspaceRoot, dialect);
@@ -18624,7 +18627,7 @@ function loadPlanSnapshot(workspaceRoot, dialect) {
18624
18627
  }
18625
18628
  function savePlanSnapshot(workspaceRoot, dialect, plan) {
18626
18629
  const snapshotPath = getSnapshotPath(workspaceRoot, dialect);
18627
- const snapshotDir = join9(workspaceRoot, ".qb");
18630
+ const snapshotDir = getSnapshotDir(workspaceRoot);
18628
18631
  const hash = hashMigrationPlan(plan);
18629
18632
  if (existsSync16(snapshotPath)) {
18630
18633
  try {
@@ -18664,6 +18667,7 @@ function ensureSqlDirectory(workspaceRoot) {
18664
18667
  return sqlDir;
18665
18668
  }
18666
18669
  async function generateMigration(dir, opts = {}) {
18670
+ await getConfig();
18667
18671
  if (!dir) {
18668
18672
  dir = join9(process25.cwd(), "app/Models");
18669
18673
  }
@@ -18735,6 +18739,7 @@ async function generateMigration(dir, opts = {}) {
18735
18739
  return { sql, sqlStatements, hasChanges, plan, operations };
18736
18740
  }
18737
18741
  async function executeMigration(dir) {
18742
+ await getConfig();
18738
18743
  if (!dir) {
18739
18744
  dir = join9(process25.cwd(), "app/Models");
18740
18745
  }
@@ -18800,6 +18805,7 @@ async function executeMigration(dir) {
18800
18805
  return true;
18801
18806
  }
18802
18807
  async function resetDatabase(dir, opts = {}) {
18808
+ await getConfig();
18803
18809
  if (!dir) {
18804
18810
  dir = join9(process25.cwd(), "app/Models");
18805
18811
  }
package/dist/types.d.ts CHANGED
@@ -225,6 +225,7 @@ export declare interface BrowserConfig {
225
225
  */
226
226
  export declare interface QueryBuilderConfig {
227
227
  verbose: boolean
228
+ snapshotDir: string
228
229
  dialect: SupportedDialect
229
230
  database: DatabaseConfig
230
231
  browser?: BrowserConfig
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-query-builder",
3
3
  "type": "module",
4
- "version": "0.1.60",
4
+ "version": "0.1.62",
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",