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.
- package/dist/bin/cli.js +257 -96
- package/dist/client.d.ts +19 -1
- package/dist/column-types.d.ts +26 -0
- package/dist/drivers/sqlite.d.ts +11 -6
- package/dist/model.d.ts +4 -0
- package/dist/orm.d.ts +2 -0
- package/dist/src/browser.js +1 -1
- package/dist/src/index.js +258 -95
- package/package.json +1 -1
|
@@ -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';
|
package/dist/drivers/sqlite.d.ts
CHANGED
|
@@ -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
package/dist/src/browser.js
CHANGED
|
@@ -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 (
|
|
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");
|