@getstrata/core 0.3.8 → 0.3.9

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.
@@ -9,7 +9,7 @@ declare class PolicyGate {
9
9
  constructor();
10
10
  private readonly policies;
11
11
  register(resource: string, policy: Policy): void;
12
- allows(resource: string, action: keyof Policy, user?: unknown, model?: unknown): boolean;
13
- authorize(resource: string, action: keyof Policy, user?: unknown, model?: unknown): void;
12
+ allows(resource: string, action: string, user?: unknown, model?: unknown): boolean;
13
+ authorize(resource: string, action: string, user?: unknown, model?: unknown): void;
14
14
  }
15
15
  export { Policy, PolicyGate };
@@ -0,0 +1,3 @@
1
+ import type { DatabaseConnection } from "./baseRepository";
2
+ declare function bindDatabaseConnection(connection: DatabaseConnection): void;
3
+ export { bindDatabaseConnection };
@@ -12,6 +12,7 @@ export { default as CacheRepository } from "../core/cache/repository";
12
12
  export { CACHE_TAGS } from "../core/cache/tags";
13
13
  export type { DatabaseConnection } from "../core/database/baseRepository";
14
14
  export { default as BaseRepository } from "../core/database/baseRepository";
15
+ export { bindDatabaseConnection } from "../core/database/bindConnection";
15
16
  export { freshDatabase, getMigrationStatus, loadMigrationsFromDirectory, migrateDatabase, rollbackDatabase, } from "../core/database/migrations/runner";
16
17
  export type { Migration, MigrationDatabase, MigrationStatus, } from "../core/database/migrations/types";
17
18
  export { Model, registerModelRepository } from "../core/database/model";
package/dist/index.js CHANGED
@@ -293,6 +293,9 @@ function getDatabase() {
293
293
  }
294
294
  return connectionHolder.connection;
295
295
  }
296
+ function resetDatabaseConnectionForTests(connection) {
297
+ connectionHolder.connection = connection;
298
+ }
296
299
  var POOL_CONNECTION_METHODS = new Set(["begin", "close", "connect"]);
297
300
  function resolveDatabase() {
298
301
  return getActiveDatabaseConnection(getDatabase());
@@ -1024,6 +1027,10 @@ class BaseRepository {
1024
1027
  }
1025
1028
  }
1026
1029
  var baseRepository_default = BaseRepository;
1030
+ // ../../src/core/database/bindConnection.ts
1031
+ function bindDatabaseConnection(connection) {
1032
+ resetDatabaseConnectionForTests(connection);
1033
+ }
1027
1034
  // ../../src/core/database/migrations/runner.ts
1028
1035
  import { readdir } from "fs/promises";
1029
1036
  import { join } from "path";
@@ -2525,6 +2532,7 @@ export {
2525
2532
  createMetricsMiddleware,
2526
2533
  config,
2527
2534
  cache,
2535
+ bindDatabaseConnection,
2528
2536
  belongsTo,
2529
2537
  auth,
2530
2538
  assertIfMatch,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getstrata/core",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "description": "Strata — Laravel-inspired Bun framework public API",
5
5
  "type": "module",
6
6
  "license": "MIT",