@onebun/drizzle 0.1.4 → 0.1.5

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,34 @@
1
+ #!/usr/bin/env bun
2
+ /**
3
+ * CLI wrapper for drizzle-kit
4
+ *
5
+ * This wrapper ensures that the correct version of drizzle-kit is used
6
+ * (the one installed with \@onebun/drizzle) instead of a potentially
7
+ * different version that bunx might download from npm.
8
+ *
9
+ * Usage:
10
+ * bunx onebun-drizzle generate
11
+ * bunx onebun-drizzle push
12
+ * bunx onebun-drizzle studio
13
+ */
14
+ import { dirname, join } from 'path';
15
+ import { fileURLToPath } from 'url';
16
+
17
+ import { spawn } from 'bun';
18
+
19
+ // Find drizzle-kit binary - resolve the package path without executing it
20
+ const drizzleKitModulePath = import.meta.resolve('drizzle-kit');
21
+ const drizzleKitDir = dirname(fileURLToPath(drizzleKitModulePath));
22
+ const drizzleKitBin = join(drizzleKitDir, 'bin.cjs');
23
+
24
+ // Pass all arguments to drizzle-kit
25
+ const args = Bun.argv.slice(2);
26
+
27
+ const proc = spawn(['bun', drizzleKitBin, ...args], {
28
+ stdout: 'inherit',
29
+ stderr: 'inherit',
30
+ stdin: 'inherit',
31
+ });
32
+
33
+ const exitCode = await proc.exited;
34
+ process.exit(exitCode);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onebun/drizzle",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Drizzle ORM module for OneBun framework - SQLite and PostgreSQL support",
5
5
  "license": "LGPL-3.0",
6
6
  "author": "RemRyahirev",
@@ -27,18 +27,27 @@
27
27
  "access": "public",
28
28
  "registry": "https://registry.npmjs.org/"
29
29
  },
30
+ "bin": {
31
+ "onebun-drizzle": "./bin/drizzle-kit.ts"
32
+ },
30
33
  "files": [
31
34
  "src",
35
+ "bin",
32
36
  "README.md"
33
37
  ],
34
38
  "main": "src/index.ts",
35
39
  "module": "src/index.ts",
36
40
  "types": "src/index.ts",
41
+ "exports": {
42
+ ".": "./src/index.ts",
43
+ "./pg": "./src/pg.ts",
44
+ "./sqlite": "./src/sqlite.ts"
45
+ },
37
46
  "scripts": {
38
47
  "dev": "bun run --watch src/index.ts"
39
48
  },
40
49
  "dependencies": {
41
- "@onebun/core": "^0.1.6",
50
+ "@onebun/core": "^0.1.7",
42
51
  "@onebun/envs": "^0.1.2",
43
52
  "@onebun/logger": "^0.1.3",
44
53
  "drizzle-orm": "^0.44.7",
package/src/index.ts CHANGED
@@ -49,3 +49,77 @@ export { generateMigrations, pushSchema } from './migrations';
49
49
 
50
50
  // Validation utilities
51
51
  export * from './validation';
52
+
53
+ // ============================================================================
54
+ // Re-exports from drizzle-orm (common utilities for all dialects)
55
+ // ============================================================================
56
+
57
+ // Query operators - comparison
58
+ export {
59
+ eq,
60
+ ne,
61
+ gt,
62
+ gte,
63
+ lt,
64
+ lte,
65
+ between,
66
+ notBetween,
67
+ } from 'drizzle-orm';
68
+
69
+ // Query operators - logical
70
+ export {
71
+ and,
72
+ or,
73
+ not,
74
+ } from 'drizzle-orm';
75
+
76
+ // Query operators - pattern matching
77
+ export {
78
+ like,
79
+ ilike,
80
+ notLike,
81
+ notIlike,
82
+ } from 'drizzle-orm';
83
+
84
+ // Query operators - array
85
+ export {
86
+ inArray,
87
+ notInArray,
88
+ } from 'drizzle-orm';
89
+
90
+ // Query operators - null
91
+ export {
92
+ isNull,
93
+ isNotNull,
94
+ } from 'drizzle-orm';
95
+
96
+ // SQL template and raw
97
+ export {
98
+ sql,
99
+ } from 'drizzle-orm';
100
+
101
+ // Aggregates
102
+ export {
103
+ count,
104
+ sum,
105
+ avg,
106
+ min,
107
+ max,
108
+ } from 'drizzle-orm';
109
+
110
+ // Ordering
111
+ export {
112
+ asc,
113
+ desc,
114
+ } from 'drizzle-orm';
115
+
116
+ // Relations
117
+ export {
118
+ relations,
119
+ } from 'drizzle-orm';
120
+
121
+ // ============================================================================
122
+ // Re-exports from drizzle-kit (config helper)
123
+ // ============================================================================
124
+
125
+ export { defineConfig } from 'drizzle-kit';
package/src/pg.ts ADDED
@@ -0,0 +1,67 @@
1
+ /**
2
+ * PostgreSQL schema builders re-exported from drizzle-orm/pg-core
3
+ *
4
+ * Usage:
5
+ * ```typescript
6
+ * import { pgTable, text, integer, timestamp, uuid } from '@onebun/drizzle/pg';
7
+ * ```
8
+ */
9
+
10
+ // Table and schema builders
11
+ export {
12
+ pgTable,
13
+ pgSchema,
14
+ pgEnum,
15
+ pgView,
16
+ pgMaterializedView,
17
+ pgSequence,
18
+ } from 'drizzle-orm/pg-core';
19
+
20
+ // Column types
21
+ export {
22
+ bigint,
23
+ bigserial,
24
+ boolean,
25
+ char,
26
+ cidr,
27
+ customType,
28
+ date,
29
+ doublePrecision,
30
+ inet,
31
+ integer,
32
+ interval,
33
+ json,
34
+ jsonb,
35
+ line,
36
+ macaddr,
37
+ macaddr8,
38
+ numeric,
39
+ point,
40
+ real,
41
+ serial,
42
+ smallint,
43
+ smallserial,
44
+ text,
45
+ time,
46
+ timestamp,
47
+ uuid,
48
+ varchar,
49
+ } from 'drizzle-orm/pg-core';
50
+
51
+ // Constraints and indexes
52
+ export {
53
+ check,
54
+ foreignKey,
55
+ index,
56
+ primaryKey,
57
+ unique,
58
+ uniqueIndex,
59
+ } from 'drizzle-orm/pg-core';
60
+
61
+ // Types for type inference
62
+ export type {
63
+ PgTable,
64
+ PgColumn,
65
+ PgEnum,
66
+ PgTableWithColumns,
67
+ } from 'drizzle-orm/pg-core';
package/src/sqlite.ts ADDED
@@ -0,0 +1,41 @@
1
+ /**
2
+ * SQLite schema builders re-exported from drizzle-orm/sqlite-core
3
+ *
4
+ * Usage:
5
+ * ```typescript
6
+ * import { sqliteTable, text, integer, real, blob } from '@onebun/drizzle/sqlite';
7
+ * ```
8
+ */
9
+
10
+ // Table and view builders
11
+ export {
12
+ sqliteTable,
13
+ sqliteView,
14
+ } from 'drizzle-orm/sqlite-core';
15
+
16
+ // Column types
17
+ export {
18
+ blob,
19
+ customType,
20
+ integer,
21
+ numeric,
22
+ real,
23
+ text,
24
+ } from 'drizzle-orm/sqlite-core';
25
+
26
+ // Constraints and indexes
27
+ export {
28
+ check,
29
+ foreignKey,
30
+ index,
31
+ primaryKey,
32
+ unique,
33
+ uniqueIndex,
34
+ } from 'drizzle-orm/sqlite-core';
35
+
36
+ // Types for type inference
37
+ export type {
38
+ SQLiteTable,
39
+ SQLiteColumn,
40
+ SQLiteTableWithColumns,
41
+ } from 'drizzle-orm/sqlite-core';