bun-query-builder 0.2.25 → 0.2.26

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
@@ -1,4 +1,4 @@
1
- import type { QueryBuilderConfig, SupportedDialect } from './types';
1
+ import type { QueryBuilderConfig, QueryBuilderOptions, SupportedDialect } from './types';
2
2
  /**
3
3
  * Whether a dialect belongs to the MySQL wire-protocol family (MySQL itself,
4
4
  * SingleStore, or Vitess). These share `?` placeholders, backtick identifier
@@ -62,12 +62,41 @@ export declare function getPlaceholders(count: number, startIndex?: number): str
62
62
  *
63
63
  * So the loaded object is applied with those keys filtered out — an explicit API
64
64
  * call is a stronger signal than a file that may not know the embedder exists.
65
+ * The filter is per top-level section; see `configState` for why per-leaf is
66
+ * the wrong granularity.
65
67
  *
66
68
  * Note the load MUST pass `defaultConfig`: bunfig derives the environment
67
69
  * variable names it recognises (`QUERY_BUILDER_*`) from the shape of the
68
70
  * defaults, so passing an empty object silently drops env-var support.
69
71
  */
70
72
  export declare function getConfig(): Promise<QueryBuilderConfig>;
71
- export declare function setConfig(userConfig: Partial<QueryBuilderConfig>): void;
73
+ export declare function setConfig(userConfig: QueryBuilderOptions): void;
74
+ /**
75
+ * Identity helper for a typed `query-builder.config.ts`.
76
+ *
77
+ * It exists so that writing a config file requires no decision about which
78
+ * type to annotate with — which is what stacksjs/bun-query-builder#1062 was
79
+ * actually about. The only config type this package exported was
80
+ * `QueryBuilderConfig`, the RESOLVED shape with every field required, and the
81
+ * docs told people to import it, so downstream apps annotated their config
82
+ * file with a type demanding `migrationDir`, `snapshotDir`, `features`,
83
+ * `aliasing` and nine other sections they had no opinion about. Every field
84
+ * added here afterwards was a downstream build break.
85
+ *
86
+ * `defineConfig` takes `QueryBuilderOptions`, so nothing is ever required, and
87
+ * returns its argument unchanged — there is no runtime behavior here, only the
88
+ * type and the editor completion that comes with it.
89
+ *
90
+ * ```ts
91
+ * // query-builder.config.ts
92
+ * import { defineConfig } from 'bun-query-builder'
93
+ *
94
+ * export default defineConfig({
95
+ * dialect: 'postgres',
96
+ * database: { database: 'my_app' },
97
+ * })
98
+ * ```
99
+ */
100
+ export declare function defineConfig(userConfig: QueryBuilderOptions): QueryBuilderOptions;
72
101
  export declare const defaultConfig: QueryBuilderConfig;
73
102
  export declare const config: QueryBuilderConfig;