bun-query-builder 0.2.41 → 0.2.44

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.
@@ -0,0 +1,26 @@
1
+ import type { NormalizedColumnType } from './migrations';
2
+ /**
3
+ * Whether a canonical type stores a number.
4
+ *
5
+ * Used to decide when the `*_id` naming heuristic may coerce a column to
6
+ * INTEGER. Declared text types must never be coerced by a name heuristic —
7
+ * external ids are frequently strings (tickers, wallet addresses, hashes).
8
+ */
9
+ export declare function isNumericPlanType(type: string | undefined): boolean;
10
+ /**
11
+ * Map a declared attribute type onto the canonical set.
12
+ *
13
+ * Accepts the spellings the model layer and the validation-rule reader already
14
+ * accept, so `type: 'int'`, `'bool'` and `'timestamp'` land where their long
15
+ * forms do. Returns `undefined` for anything unrecognised, which callers treat
16
+ * as "no opinion" rather than guessing.
17
+ */
18
+ export declare function normalizeAttributeType(raw: unknown): NormalizedColumnType | undefined;
19
+ /**
20
+ * The SQLite storage class for a canonical type.
21
+ *
22
+ * `enum` is TEXT here; the migration driver additionally emits a CHECK
23
+ * constraint, which needs the column name and a quoter and so stays with the
24
+ * driver.
25
+ */
26
+ export declare function sqliteAffinityFor(type: NormalizedColumnType | undefined): 'TEXT' | 'INTEGER' | 'REAL';
@@ -1,11 +1,6 @@
1
+ import { isNumericPlanType } from '../column-types';
1
2
  import type { ColumnPlan, IndexPlan, RebuildTableSpec, TablePlan } from '../migrations';
2
3
  import type { DateBucketGrain } from './postgres';
3
- /**
4
- * Whether a plan type belongs to the numeric family. Used by the `_id`
5
- * safety net (numeric ids must store as INTEGER on SQLite) — non-numeric
6
- * declared types must never be coerced by the name heuristic.
7
- */
8
- export declare function isNumericPlanType(type: string | undefined): boolean;
9
4
  export declare interface DialectDriver {
10
5
  createEnumType: (enumTypeName: string, values: string[]) => string
11
6
  createTable: (table: TablePlan) => string
@@ -45,3 +40,13 @@ export declare class SQLiteDriver implements DialectDriver {
45
40
  dateBucket(column: string, grain: DateBucketGrain, offsetHours?: number): string;
46
41
  booleanLiteral(value: boolean): string;
47
42
  }
43
+ /**
44
+ * Whether a plan type belongs to the numeric family. Used by the `_id`
45
+ * safety net (numeric ids must store as INTEGER on SQLite) — non-numeric
46
+ * declared types must never be coerced by the name heuristic.
47
+ *
48
+ * Defined in column-types.ts now, so the ORM's create-table path applies the
49
+ * same rule from the same source. Re-exported because this is where callers
50
+ * already import it from.
51
+ */
52
+ export { isNumericPlanType };
package/dist/model.d.ts CHANGED
@@ -51,6 +51,10 @@ export declare function getModelRegistry(): Record<string, ReturnType<typeof cre
51
51
  export declare function hasModel(name: string): boolean;
52
52
  /**
53
53
  * Clear all registered models. Primarily useful for testing.
54
+ *
55
+ * Also drops the models `createModel` registered internally, and the memoized
56
+ * relation resolutions derived from them. Leaving either behind lets a stale
57
+ * resolution from one test file decide a relation's table in the next.
54
58
  */
55
59
  export declare function clearModelRegistry(): void;
56
60
  /**
package/dist/orm.d.ts CHANGED
@@ -14,6 +14,8 @@ export type {
14
14
  FillableKeys,
15
15
  HiddenKeys,
16
16
  };
17
+ /** Drops the `createModel` models. Paired with `clearModelRegistry()`. */
18
+ export declare function clearLocalModels(): void;
17
19
  /**
18
20
  * Extract an affected-row count from a Bun SQL driver result.
19
21
  *
@@ -475,7 +475,7 @@ class BrowserModelQueryBuilder {
475
475
  for (const where of this._wheres) {
476
476
  if (where.operator === "=") {
477
477
  params.append(where.column, String(where.value));
478
- } else if ((where.operator === "in" || where.operator === "not in") && Array.isArray(where.value)) {
478
+ } else if (where.operator === "in" && Array.isArray(where.value)) {
479
479
  params.append(`${where.column}[]`, where.value.join(","));
480
480
  } else if (where.operator === "is" && where.value === null) {
481
481
  params.append(`filter[${where.column}][is]`, "null");