@dockstat/sqlite-wrapper 1.3.1 → 1.3.2

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/README.md CHANGED
@@ -13,6 +13,7 @@ Schema-first table helpers, an expressive chainable QueryBuilder, safe defaults
13
13
 
14
14
  ### Bug Fixes
15
15
  - **Fixed Boolean parsing** — Boolean columns now correctly convert SQLite's `0`/`1` to JavaScript `true`/`false`
16
+ - **Fixed Wrong packing** — Before the `publish` script was added, workspace dependencies were not correctly propagated
16
17
 
17
18
  ### New Features
18
19
  - **Auto-detection of JSON & Boolean columns** — No more manual parser configuration! Columns using `column.json()` or `column.boolean()` are automatically detected from schema
package/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Database, type SQLQueryBindings } from "bun:sqlite"
2
- import type { Logger } from "@dockstat/logger"
2
+ import { Logger } from "@dockstat/logger"
3
3
  import { QueryBuilder } from "./query-builder/index"
4
4
  import type { ColumnDefinition, Parser, TableConstraints, TableOptions, TableSchema } from "./types"
5
5
  import { createLogger, type SqliteLogger } from "./utils"
@@ -95,8 +95,12 @@ class DB {
95
95
  * @param path - Path to the SQLite file (e.g. "app.db"). Use ":memory:" for in-memory DB.
96
96
  * @param options - Optional database configuration
97
97
  */
98
- constructor(path: string, baseLogger: Logger, options?: DBOptions) {
99
- this.baseLogger = baseLogger
98
+ constructor(path: string, options?: DBOptions, baseLogger?: Logger) {
99
+ if (!baseLogger) {
100
+ this.baseLogger = new Logger("Sqlite-Wrapper")
101
+ } else {
102
+ this.baseLogger = baseLogger
103
+ }
100
104
 
101
105
  // Wire base logger so sqlite-wrapper logs inherit the same LogHook/parents as the consumer.
102
106
  this.dbLog = createLogger("DB", this.baseLogger)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dockstat/sqlite-wrapper",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "A TypeScript wrapper around bun:sqlite with type-safe query building",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
@@ -23,6 +23,7 @@
23
23
  "lint:fix": "biome lint --write .",
24
24
  "lint:gh": "turbo run lint -- --reporter=github",
25
25
  "check-types": "bunx tsc --noEmit",
26
+ "publish": "bun pm pack --destination ./dist && npm publish --access public ./dist/*.tgz ; rm -r ./dist",
26
27
  "test": "DOCKSTAT_LOGGER_IGNORE_MESSAGES='Logger Status: active - ignoring messages:' bun test"
27
28
  },
28
29
  "keywords": [
@@ -48,7 +49,7 @@
48
49
  "bun": ">=1.0.0"
49
50
  },
50
51
  "dependencies": {
51
- "@dockstat/logger": "workspace:*"
52
+ "@dockstat/logger": "2.0.0"
52
53
  },
53
54
  "peerDependencies": {
54
55
  "typescript": "^5.9.3"
package/utils/logger.ts CHANGED
@@ -33,8 +33,11 @@ export class SqliteLogger {
33
33
 
34
34
  constructor(name: string, parent?: Logger, tableName?: string, logHook?: LogHook) {
35
35
  try {
36
- this.logger =
37
- typeof parent?.spawn === "function" ? parent.spawn(name) : new Logger(name, [], logHook)
36
+ if (parent && typeof parent.spawn === "function") {
37
+ this.logger = parent.spawn(name)
38
+ } else {
39
+ this.logger = new Logger(name, [], logHook)
40
+ }
38
41
  } catch (error) {
39
42
  this.logger = new Logger(name, [], logHook)
40
43
  console.error(error)