@strav/database 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strav/database",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "description": "Database layer for the Strav framework — query builder, ORM, schema builder, and migrations",
6
6
  "license": "MIT",
@@ -1,8 +1,8 @@
1
1
  import { SQL } from 'bun'
2
- import Configuration from '@stravigor/kernel/config/configuration'
3
- import { inject } from '@stravigor/kernel/core/inject'
4
- import { ConfigurationError } from '@stravigor/kernel/exceptions/errors'
5
- import { env } from '@stravigor/kernel/helpers/env'
2
+ import Configuration from '@strav/kernel/config/configuration'
3
+ import { inject } from '@strav/kernel/core/inject'
4
+ import { ConfigurationError } from '@strav/kernel/exceptions/errors'
5
+ import { env } from '@strav/kernel/helpers/env'
6
6
  import { createSchemaAwareSQL } from './domain/wrapper'
7
7
  import { getCurrentSchema, hasSchemaContext } from './domain/context'
8
8
 
@@ -3,7 +3,7 @@ import Database from '../database'
3
3
  import MigrationRunner from '../migration/runner'
4
4
  import MigrationTracker from '../migration/tracker'
5
5
  import { withSchema, withoutSchema } from './context'
6
- import { inject } from '@stravigor/kernel/core/inject'
6
+ import { inject } from '@strav/kernel/core/inject'
7
7
 
8
8
  /**
9
9
  * Schema manager for multi-domain database operations.
@@ -16,7 +16,7 @@ export * from './domain/index'
16
16
  * Available after the Database is resolved through the DI container.
17
17
  *
18
18
  * @example
19
- * import { sql } from '@stravigor/database/database'
19
+ * import { sql } from '@strav/database/database'
20
20
  * const rows = await sql`SELECT * FROM "user" WHERE "id" = ${id}`
21
21
  * await sql.begin(async (tx) => { ... })
22
22
  */
@@ -3,7 +3,7 @@ import { readdirSync } from 'node:fs'
3
3
  import type Database from '../database'
4
4
  import type MigrationTracker from './tracker'
5
5
  import type { MigrationManifest } from './types'
6
- import { DatabaseError } from '@stravigor/kernel/exceptions/errors'
6
+ import { DatabaseError } from '@strav/kernel/exceptions/errors'
7
7
  import { getMigrationTableName } from '../../schema/domain_discovery'
8
8
 
9
9
  export interface RunResult {
@@ -1,7 +1,7 @@
1
1
  import { DateTime } from 'luxon'
2
- import { toSnakeCase } from '@stravigor/kernel/helpers/strings'
2
+ import { toSnakeCase } from '@strav/kernel/helpers/strings'
3
3
  import type BaseModel from '../orm/base_model'
4
- import { ModelNotFoundError } from '@stravigor/kernel/exceptions/errors'
4
+ import { ModelNotFoundError } from '@strav/kernel/exceptions/errors'
5
5
  import { getReferenceMeta, getAssociates, getCasts } from '../orm/decorators'
6
6
  import type { ReferenceMetadata, AssociateMetadata, CastDefinition } from '../orm/decorators'
7
7
  import { hydrateRow } from '../orm/base_model'
@@ -8,7 +8,7 @@ import Database from './database'
8
8
  * main `DatabaseSeeder`.
9
9
  *
10
10
  * @example
11
- * import { Seeder } from '@stravigor/database/database'
11
+ * import { Seeder } from '@strav/database/database'
12
12
  *
13
13
  * export default class DatabaseSeeder extends Seeder {
14
14
  * async run(): Promise<void> {
@@ -1,7 +1,7 @@
1
1
  import { DateTime } from 'luxon'
2
- import { toSnakeCase, toCamelCase } from '@stravigor/kernel/helpers/strings'
3
- import { ulid as generateUlid } from '@stravigor/kernel/helpers'
4
- import { inject } from '@stravigor/kernel/core/inject'
2
+ import { toSnakeCase, toCamelCase } from '@strav/kernel/helpers/strings'
3
+ import { ulid as generateUlid } from '@strav/kernel/helpers'
4
+ import { inject } from '@strav/kernel/core/inject'
5
5
  import {
6
6
  getPrimaryKey,
7
7
  getReferences,
@@ -13,7 +13,7 @@ import {
13
13
  } from './decorators'
14
14
  import type { ReferenceMetadata, AssociateMetadata } from './decorators'
15
15
  import Database from '../database/database'
16
- import { ConfigurationError, ModelNotFoundError } from '@stravigor/kernel/exceptions/errors'
16
+ import { ConfigurationError, ModelNotFoundError } from '@strav/kernel/exceptions/errors'
17
17
 
18
18
  type ModelStatic<T extends BaseModel> = (new (...args: any[]) => T) & typeof BaseModel
19
19
 
@@ -1,5 +1,5 @@
1
1
  import 'reflect-metadata'
2
- import EncryptionManager from '@stravigor/kernel/encryption/encryption_manager'
2
+ import EncryptionManager from '@strav/kernel/encryption/encryption_manager'
3
3
 
4
4
  const PRIMARY_KEY = Symbol('orm:primary')
5
5
  const REFERENCE_KEY = Symbol('orm:references')
@@ -1,5 +1,5 @@
1
- import ServiceProvider from '@stravigor/kernel/core/service_provider'
2
- import type Application from '@stravigor/kernel/core/application'
1
+ import ServiceProvider from '@strav/kernel/core/service_provider'
2
+ import type Application from '@strav/kernel/core/application'
3
3
  import Database from '../database/database'
4
4
 
5
5
  export default class DatabaseProvider extends ServiceProvider {
@@ -1,6 +1,6 @@
1
1
  import type { PostgreSQLType } from './postgres'
2
2
 
3
- export { toSnakeCase } from '@stravigor/kernel/helpers/strings'
3
+ export { toSnakeCase } from '@strav/kernel/helpers/strings'
4
4
 
5
5
  /**
6
6
  * Map a serial/bigserial/smallserial pgType to the corresponding integer type
@@ -8,7 +8,7 @@ import FieldBuilder from './field_builder'
8
8
  * Each method returns a {@link FieldBuilder} with the correct pgType pre-configured.
9
9
  *
10
10
  * @example
11
- * import { t } from '@stravigor/database/schema'
11
+ * import { t } from '@strav/database/schema'
12
12
  * t.varchar(255).email().unique().required()
13
13
  * t.integer().default(0)
14
14
  * t.jsonb().nullable()