bun-query-builder 0.3.19 → 0.3.20

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/config.d.ts CHANGED
@@ -9,54 +9,6 @@ import type { QueryBuilderConfig, QueryBuilderOptions, SupportedDialect } from '
9
9
  * `SingleStoreDriver` / `VitessDriver`) diverges.
10
10
  */
11
11
  export declare function isMysqlLike(dialect?: SupportedDialect): boolean;
12
- /**
13
- * Recursively merge `source` over `target`, returning a NEW object. Neither
14
- * argument is mutated.
15
- *
16
- * The semantics below are load-bearing — each is pinned by a test or by a
17
- * documented promise, so do not "simplify" them:
18
- *
19
- * - ARRAYS REPLACE. They do not concatenate or union. `SqliteConfig.pragmas`
20
- * says so in its own doc comment, and `sqlite-bootstrap-pragmas.test.ts`
21
- * asserts it by checking that `foreign_keys` is still 0 after an override
22
- * that omits it — concatenation would flip that to 1.
23
- * `transactionDefaults.sqlStates` is the same shape: a user narrowing
24
- * retries to `['40002']` must stop retrying on `40001`, not keep it.
25
- *
26
- * - FUNCTIONS REPLACE. `isPlainObject` rejects them, so `QueryHooks` members
27
- * and `BrowserConfig.getToken` / `transformResponse` stay opaque leaves. We
28
- * never recurse into a function's own enumerable properties.
29
- *
30
- * - AN EXPLICIT `undefined` ASSIGNS; AN ABSENT KEY DOES NOT. The rule is
31
- * PRESENCE, not value — `Object.keys(source)` contains a key written as
32
- * `undefined` and does not contain one that was never written. Not a style
33
- * choice: `resolve-dialect.test.ts` calls `setConfig({ dialect: undefined })`
34
- * and expects `resolveDialect()` to fall back to `'postgres'`, and
35
- * `sqlite-bootstrap-pragmas.test.ts` uses `sqlite: undefined` as the restore
36
- * that un-does a pragma override for the rest of a shared-process run.
37
- * Skipping `undefined` breaks both, and now that `hooks` deep-merges, an
38
- * explicit `undefined` is also the only way to REMOVE a hook.
39
- *
40
- * - `null` ASSIGNS and is never recursed into. No field in
41
- * `QueryBuilderConfig` is nullable, so a `null` arriving here is a caller
42
- * mistake; assigning it surfaces that at the read site instead of hiding it.
43
- *
44
- * Arrays are copied by REFERENCE, being leaves — `config.transactionDefaults
45
- * .sqlStates` is the same array as `defaultConfig`'s until something replaces
46
- * it. Nothing in `src/` mutates a config array in place (the only read is an
47
- * `.includes`), and cloning on every merge is not worth paying for that.
48
- *
49
- * `seen` is the chain of source objects currently being merged, so a source
50
- * that points back at one of its own ancestors is treated as a leaf instead of
51
- * recursed into. An embedding framework's config slice — the case this type
52
- * exists to serve — routinely carries a parent back-pointer, and it typechecks
53
- * fine because an optional field of an interface can be that interface. Without
54
- * the guard that input spins for seconds, allocates gigabytes and dies with a
55
- * stack overflow. It is a DEPTH chain, pushed and popped around the recursion,
56
- * not a global set: the same object legitimately appearing under two different
57
- * keys must merge both times, and a global set would silently drop the second.
58
- */
59
- declare function mergeObject(target: Record<string, unknown>, source: Record<string, unknown>, seen?: Set<object>): Record<string, unknown>;
60
12
  /**
61
13
  * The dialect a command should operate on.
62
14
  *
@@ -156,27 +108,4 @@ export declare function setConfig(userConfig: QueryBuilderOptions): void;
156
108
  */
157
109
  export declare function defineConfig(userConfig: QueryBuilderOptions): QueryBuilderOptions;
158
110
  export declare const defaultConfig: QueryBuilderConfig;
159
- // The single, process-wide config object — stored on a `globalThis` symbol so
160
- // that EVERY copy of this module shares one object, even if Bun's bundler
161
- // inlines `config.ts` more than once. Previously this was an `export let` that
162
- // `setConfig` mutated in place: it worked, but relied on the bundler keeping a
163
- // never-reassigned live binding as a single shared binding, and the build had
164
- // to regex-patch the emitted `__esm(init_config)` wrapper to keep readers and
165
- // writers on the same binding. A `globalThis`-keyed `export const` removes both
166
- // hazards — there is no module-local binding to split or rename, and `const`
167
- // makes the "never reassign config" rule unenforceable-to-break.
168
- //
169
- // Notes:
170
- // - `??=` so the first-evaluated copy wins and the rest reuse it.
171
- // - `Symbol.for` is a process-global registry key (shared across copies). It
172
- // is also shared across package versions in one process — that's the intended
173
- // hardening; pin a versioned key if you ever need per-version isolation.
174
- // - Synchronous + no top-level await here, so `bun --compile` is unaffected.
175
- // - Seeded through `mergeObject`, not `{ ...defaultConfig }`. A shallow spread
176
- // left `config.debug === defaultConfig.debug`, so the direct writes this
177
- // package makes to the live config — `config.debug.captureText = true` in
178
- // `actions/sql.ts` and `computeSqlText()` — were reaching into the exported
179
- // DEFAULTS and permanently changing them. `mergeObject` clones every plain
180
- // object node, which closes that.
181
- declare const CONFIG_SINGLETON_KEY: symbol;
182
111
  export declare const config: QueryBuilderConfig;
@@ -77,7 +77,7 @@ export declare function canonicalStorageType(col: ColumnPlan, dialect: Supported
77
77
  * Postgres and strict MySQL refuse the ALTER when a row is too long; MySQL in
78
78
  * a permissive mode truncates. Either way it is not a free change.
79
79
  */
80
- export declare function isNarrowingChange(from: ColumnPlan, to: ColumnPlan): boolean;
80
+ export declare function isNarrowingChange(from: ColumnPlan, to: ColumnPlan, dialect?: SupportedDialect): boolean;
81
81
  /**
82
82
  * Canonical string form of a column default, so equivalent defaults expressed
83
83
  * differently by a live DB vs a model (quoting, casts, `now()` vs
package/dist/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ne,re,ie,se,F,ae,oe,le,ce,j,ue,q,W,de,fe,U,me,he,dt,He,ft,A,ge,o,pe,ye,be,Te,h,mt,ht,gt,Qe,Ge,pt,S,N,Je,M,we,Se,V,De,H,Ee,Q,G,P,J,$e,xe,ve,ke,z,Ce,Re,D,g,$n,xn,vn,yt,bt,Tt,wt,St,kn,Dt,Jt,Cn,Rn,An,Nn,Et,Mn,Pn,On,Ae,d,$t,xt,vt,kt,Ct,zt,Y,X,Ne,Yt,Bn,_n,Rt,ze,Xt,b,Ye,Zt,Xe,en,In,tn,Ln}from"../chunk-4g9vwg4y.js";import{v,Kn,nn,c,At,Nt,i,Me,Pe}from"../chunk-pavbthy7.js";import{Mt,u,Z,k,Pt,Ze,C,Oe,et,tt,Be,Ot,f,ee,_e,nt,Bt,rt,rn,sn}from"../chunk-2v1zv4hb.js";import{_t,It,Lt,Kt,Fn,jn,qn,Ft,jt,Wn,Un,an,on,ln,cn,un,qt,dn,fn}from"../chunk-723pr7bj.js";import{n,it,e,I,st,t,s,L,Le,mn,at,hn,a,Ke,Wt,Ut,gn,Fe,Vt,Vn,Ht,Qt,R,K,pn,qe,w,yn,bn,m,lt}from"../chunk-bqywz1ww.js";import{Tn,wn,Sn,y,ct,ut,Dn,Ve,En}from"../chunk-wvae8521.js";export{Ft as BelongsToManyRelationBuilder,ct as BrowserQueryBuilder,y as BrowserQueryError,Ht as DEFAULT_SQLITE_PRAGMAS,Z as DynamoDBClient,Mt as DynamoDBDriverImpl,g as DynamoDBItemBuilder,_e as DynamoDBMigrationDriver,ee as DynamoDBMigrationTracker,D as DynamoDBQueryBuilder,Et as DynamoDBToolingAdapter,rt as EntityQueryBuilder,vt as GENERATED_MARKER,a as LibSQLError,f as MIGRATIONS_TABLE,Ze as Model,o as MySQLDriver,pe as PostgresDriver,Te as SQLiteDriver,tn as Seeder,ye as SingleStoreDriver,yt as SingleTableManager,kn as SingleTablePatterns,Tt as SingleTableQueryBuilder,bt as SingleTableRepository,b as UTC_CLOCK_DEFAULT,be as VitessDriver,R as applySqliteBootstrapPragmas,Qe as auditSchemaDrift,En as browserAuth,ut as browserQuery,Ae as buildDatabaseSchema,Be as buildDynamoDBMigrationPlan,Y as buildMigrationPlan,$t as buildSchemaMeta,re as cacheClear,se as cacheConfig,ie as cacheStats,ze as canonicalStorageType,Ye as canonicalizeDefault,Ce as checkSchema,It as clearLocalModels,un as clearModelRegistry,Me as clearQueryCache,e as config,Tn as configureBrowser,Pt as configureModels,Fn as configureOrm,tt as convertSchemaToDefinition,Dn as createBrowserDb,Ve as createBrowserModel,k as createClient,sn as createDynamo,vn as createDynamoDBClient,u as createDynamoDBDriver,xn as createDynamoDBItemBuilder,$n as createDynamoDBQueryBuilder,Mn as createDynamoDBToolingAdapter,_t as createFakerCompatLayer,Vt as createLibSQLSQL,nt as createMigrationDriver,jt as createModel,i as createQueryBuilder,St as createRepository,wt as createSingleTableManager,Wn as createTableFromModel,j as dbInfo,q as dbOptimize,ue as dbStats,W as dbWipe,Ut as decodeLibSQLValue,it as defaultConfig,mn as defineConfig,dn as defineModel,In as defineModels,Ln as defineSeeder,ce as dumpDatabase,rn as dynamo,Wt as encodeLibSQLValue,Nt as escapeStringLiteral,N as executeMigration,Je as executeMigrationWithReport,de as explain,Q as explainAllQueries,oe as exportData,Lt as extractChanges,Kt as extractInsertId,et as extractModelSchema,Oe as extractTableDefinition,mt as familyOfDeclared,ht as familyOfSqlType,fe as file,Ge as formatSchemaDrift,xe as freshDatabase,Pn as generateAccessPatterns,G as generateDiagram,Xe as generateDiffOperations,en as generateDiffSql,_n as generateDiffSqlString,S as generateMigration,ft as generateModelSource,Yt as generateSql,Ne as generateSqlFiles,Bn as generateSqlString,on as getAllModels,wn as getBrowserConfig,L as getConfig,qn as getDatabase,h as getDialectDriver,an as getModel,ln as getModelRegistry,t as getPlaceholder,s as getPlaceholders,cn as hasModel,Rt as hashMigrationPlan,C as hashTableDefinition,le as importData,bn as inflectSingular,U as inspectTable,he as introspect,A as introspectDatabase,Sn as isBrowser,Ot as isDefinitionEqual,kt as isGeneratedMigrationSql,Vn as isLibSQLConnection,at as isLibSQLUrl,zt as isLosslessTypeChange,n as isMysqlLike,Xt as isNarrowingChange,Kn as iterateAllPivots,xt as lastCreatedMigrationFiles,d as loadModels,ge as makeModel,$e as makeSeeder,An as marshallObject,we as migrateGenerate,De as migrateList,Bt as migrateModels,Se as migrateRollback,V as migrateStatus,Ct as migrationBody,He as modelNameForTable,H as modelShow,st as normalizeDialectName,Zt as normalizeIndexPredicate,q as optimizeDatabase,Jt as parseStacksModels,Ee as ping,Q as queryExplainAll,c as quoteColumnForDialect,nn as raw,fn as registerBrowserModels,qt as registerModel,G as relationDiagram,jn as releaseOrm,pn as resetConnection,M as resetDatabase,I as resolveDialect,Dt as resolveKeyPattern,hn as resolveLibSQLEndpoint,K as resolveLibSQLTarget,v as resolvePivot,Qt as resolveSqlitePragmas,ne as runBenchmark,J as runSeeder,P as runSeeders,gt as satisfies,pt as saveMigrationSnapshot,Un as seedModel,Le as setConfig,Pe as setQueryCacheMaxSize,H as showModel,m as singularizerFor,ve as sql,dt as sqlTypeToAttr,On as stacksModelToEntity,F as startConsole,yn as stripTrailingS,me as tableInfo,w as tableNameFor,At as temporalLiteral,ae as tinker,lt as toDialectPlaceholders,Cn as toDynamoDBItem,Fe as toHranaStatement,Ke as toLibSQLError,gn as toLibSQLRows,Rn as toModelInstance,qe as toTableName,Nn as unmarshallItem,ke as unsafe,z as validateSchema,Re as waitReady,W as wipeDatabase,X as writeMigrationFiles};
2
+ import{ne,re,ie,se,F,ae,oe,le,ce,j,ue,q,W,de,fe,U,me,he,dt,He,ft,A,ge,o,pe,ye,be,Te,h,mt,ht,gt,Qe,Ge,pt,S,N,Je,M,we,Se,V,De,H,Ee,Q,G,P,J,$e,xe,ve,ke,z,Ce,Re,D,g,$n,xn,vn,yt,bt,Tt,wt,St,kn,Dt,Jt,Cn,Rn,An,Nn,Et,Mn,Pn,On,Ae,d,$t,xt,vt,kt,Ct,zt,Y,X,Ne,Yt,Bn,_n,Rt,ze,Xt,b,Ye,Zt,Xe,en,In,tn,Ln}from"../chunk-5c6kavwk.js";import{v,Kn,nn,c,At,Nt,i,Me,Pe}from"../chunk-ms9m66w7.js";import{Mt,u,Z,k,Pt,Ze,C,Oe,et,tt,Be,Ot,f,ee,_e,nt,Bt,rt,rn,sn}from"../chunk-2v1zv4hb.js";import{_t,It,Lt,Kt,Fn,jn,qn,Ft,jt,Wn,Un,an,on,ln,cn,un,qt,dn,fn}from"../chunk-gvtaaa4e.js";import{n,it,e,I,st,t,s,L,Le,mn,at,hn,a,Ke,Wt,Ut,gn,Fe,Vt,Vn,Ht,Qt,R,K,pn,qe,w,yn,bn,m,lt}from"../chunk-1qcgf4ek.js";import{Tn,wn,Sn,y,ct,ut,Dn,Ve,En}from"../chunk-wvae8521.js";export{Ft as BelongsToManyRelationBuilder,ct as BrowserQueryBuilder,y as BrowserQueryError,Ht as DEFAULT_SQLITE_PRAGMAS,Z as DynamoDBClient,Mt as DynamoDBDriverImpl,g as DynamoDBItemBuilder,_e as DynamoDBMigrationDriver,ee as DynamoDBMigrationTracker,D as DynamoDBQueryBuilder,Et as DynamoDBToolingAdapter,rt as EntityQueryBuilder,vt as GENERATED_MARKER,a as LibSQLError,f as MIGRATIONS_TABLE,Ze as Model,o as MySQLDriver,pe as PostgresDriver,Te as SQLiteDriver,tn as Seeder,ye as SingleStoreDriver,yt as SingleTableManager,kn as SingleTablePatterns,Tt as SingleTableQueryBuilder,bt as SingleTableRepository,b as UTC_CLOCK_DEFAULT,be as VitessDriver,R as applySqliteBootstrapPragmas,Qe as auditSchemaDrift,En as browserAuth,ut as browserQuery,Ae as buildDatabaseSchema,Be as buildDynamoDBMigrationPlan,Y as buildMigrationPlan,$t as buildSchemaMeta,re as cacheClear,se as cacheConfig,ie as cacheStats,ze as canonicalStorageType,Ye as canonicalizeDefault,Ce as checkSchema,It as clearLocalModels,un as clearModelRegistry,Me as clearQueryCache,e as config,Tn as configureBrowser,Pt as configureModels,Fn as configureOrm,tt as convertSchemaToDefinition,Dn as createBrowserDb,Ve as createBrowserModel,k as createClient,sn as createDynamo,vn as createDynamoDBClient,u as createDynamoDBDriver,xn as createDynamoDBItemBuilder,$n as createDynamoDBQueryBuilder,Mn as createDynamoDBToolingAdapter,_t as createFakerCompatLayer,Vt as createLibSQLSQL,nt as createMigrationDriver,jt as createModel,i as createQueryBuilder,St as createRepository,wt as createSingleTableManager,Wn as createTableFromModel,j as dbInfo,q as dbOptimize,ue as dbStats,W as dbWipe,Ut as decodeLibSQLValue,it as defaultConfig,mn as defineConfig,dn as defineModel,In as defineModels,Ln as defineSeeder,ce as dumpDatabase,rn as dynamo,Wt as encodeLibSQLValue,Nt as escapeStringLiteral,N as executeMigration,Je as executeMigrationWithReport,de as explain,Q as explainAllQueries,oe as exportData,Lt as extractChanges,Kt as extractInsertId,et as extractModelSchema,Oe as extractTableDefinition,mt as familyOfDeclared,ht as familyOfSqlType,fe as file,Ge as formatSchemaDrift,xe as freshDatabase,Pn as generateAccessPatterns,G as generateDiagram,Xe as generateDiffOperations,en as generateDiffSql,_n as generateDiffSqlString,S as generateMigration,ft as generateModelSource,Yt as generateSql,Ne as generateSqlFiles,Bn as generateSqlString,on as getAllModels,wn as getBrowserConfig,L as getConfig,qn as getDatabase,h as getDialectDriver,an as getModel,ln as getModelRegistry,t as getPlaceholder,s as getPlaceholders,cn as hasModel,Rt as hashMigrationPlan,C as hashTableDefinition,le as importData,bn as inflectSingular,U as inspectTable,he as introspect,A as introspectDatabase,Sn as isBrowser,Ot as isDefinitionEqual,kt as isGeneratedMigrationSql,Vn as isLibSQLConnection,at as isLibSQLUrl,zt as isLosslessTypeChange,n as isMysqlLike,Xt as isNarrowingChange,Kn as iterateAllPivots,xt as lastCreatedMigrationFiles,d as loadModels,ge as makeModel,$e as makeSeeder,An as marshallObject,we as migrateGenerate,De as migrateList,Bt as migrateModels,Se as migrateRollback,V as migrateStatus,Ct as migrationBody,He as modelNameForTable,H as modelShow,st as normalizeDialectName,Zt as normalizeIndexPredicate,q as optimizeDatabase,Jt as parseStacksModels,Ee as ping,Q as queryExplainAll,c as quoteColumnForDialect,nn as raw,fn as registerBrowserModels,qt as registerModel,G as relationDiagram,jn as releaseOrm,pn as resetConnection,M as resetDatabase,I as resolveDialect,Dt as resolveKeyPattern,hn as resolveLibSQLEndpoint,K as resolveLibSQLTarget,v as resolvePivot,Qt as resolveSqlitePragmas,ne as runBenchmark,J as runSeeder,P as runSeeders,gt as satisfies,pt as saveMigrationSnapshot,Un as seedModel,Le as setConfig,Pe as setQueryCacheMaxSize,H as showModel,m as singularizerFor,ve as sql,dt as sqlTypeToAttr,On as stacksModelToEntity,F as startConsole,yn as stripTrailingS,me as tableInfo,w as tableNameFor,At as temporalLiteral,ae as tinker,lt as toDialectPlaceholders,Cn as toDynamoDBItem,Fe as toHranaStatement,Ke as toLibSQLError,gn as toLibSQLRows,Rn as toModelInstance,qe as toTableName,Nn as unmarshallItem,ke as unsafe,z as validateSchema,Re as waitReady,W as wipeDatabase,X as writeMigrationFiles};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{n,it,e,I,st,t,s,L,Le,mn,Ht,Qt,R,K,pn}from"../chunk-bqywz1ww.js";import{nn,c,At,Nt,i,Me,Pe}from"../chunk-pavbthy7.js";export{Ht as DEFAULT_SQLITE_PRAGMAS,R as applySqliteBootstrapPragmas,Me as clearQueryCache,e as config,i as createQueryBuilder,it as defaultConfig,mn as defineConfig,Nt as escapeStringLiteral,L as getConfig,t as getPlaceholder,s as getPlaceholders,n as isMysqlLike,st as normalizeDialectName,c as quoteColumnForDialect,nn as raw,pn as resetConnection,I as resolveDialect,K as resolveLibSQLTarget,Qt as resolveSqlitePragmas,Le as setConfig,Pe as setQueryCacheMaxSize,At as temporalLiteral};
2
+ import{n,it,e,I,st,t,s,L,Le,mn,Ht,Qt,R,K,pn}from"../chunk-1qcgf4ek.js";import{nn,c,At,Nt,i,Me,Pe}from"../chunk-ms9m66w7.js";export{Ht as DEFAULT_SQLITE_PRAGMAS,R as applySqliteBootstrapPragmas,Me as clearQueryCache,e as config,i as createQueryBuilder,it as defaultConfig,mn as defineConfig,Nt as escapeStringLiteral,L as getConfig,t as getPlaceholder,s as getPlaceholders,n as isMysqlLike,st as normalizeDialectName,c as quoteColumnForDialect,nn as raw,pn as resetConnection,I as resolveDialect,K as resolveLibSQLTarget,Qt as resolveSqlitePragmas,Le as setConfig,Pe as setQueryCacheMaxSize,At as temporalLiteral};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bun-query-builder",
3
3
  "type": "module",
4
- "version": "0.3.19",
4
+ "version": "0.3.20",
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",
@@ -87,7 +87,7 @@
87
87
  "dynamodb-tooling": "^0.3.6"
88
88
  },
89
89
  "devDependencies": {
90
- "bunfig": "^0.15.19"
90
+ "bunfig": "^0.15.21"
91
91
  },
92
92
  "git-hooks": {
93
93
  "pre-commit": {