bun-query-builder 0.1.20 → 0.1.23

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/browser.d.ts CHANGED
@@ -56,29 +56,40 @@ export declare function createBrowserDb<Tables extends Record<string, any>>(): {
56
56
  export declare function createBrowserModel<const TDef extends BrowserModelDefinition>(definition: TDef): void;
57
57
  /**
58
58
  * Auth helpers for browser
59
- * @defaultValue `{ async login: () => unknown, async register: () => unknown }`
59
+ * @defaultValue
60
+ * ```ts
61
+ * {
62
+ * login: (credentials?: { email: string, password: string }): Promise<BrowserAuthResponse> {
63
+ * const response) => Promise<unknown>,
64
+ * register: (data?: { name: string, email: string, password: string }): Promise<BrowserAuthResponse> {
65
+ * const response) => Promise<unknown>,
66
+ * logout: () => unknown,
67
+ * user: () => unknown,
68
+ * check: () => unknown
69
+ * }
70
+ * ```
60
71
  */
61
72
  export declare const browserAuth: {
62
73
  /**
63
74
  * Login and store token
64
75
  */
65
- async login: (credentials: { email: string, password: string }) => Promise<BrowserAuthResponse>;
76
+ login: (credentials: { email: string, password: string }) => Promise<BrowserAuthResponse>;
66
77
  /**
67
78
  * Register a new user
68
79
  */
69
- async register: (data: { name: string, email: string, password: string }) => Promise<BrowserAuthResponse>;
80
+ register: (data: { name: string, email: string, password: string }) => Promise<BrowserAuthResponse>;
70
81
  /**
71
82
  * Logout and clear token
72
83
  */
73
- async logout: () => Promise<void>;
84
+ logout: () => Promise<void>;
74
85
  /**
75
86
  * Get current authenticated user
76
87
  */
77
- async user: unknown;
88
+ user: () => Promise<Record<string, unknown> | null>;
78
89
  /**
79
90
  * Check if user is authenticated
80
91
  */
81
- async check: () => Promise<boolean>;
92
+ check: () => Promise<boolean>;
82
93
  /**
83
94
  * Get the current token
84
95
  */
@@ -15,5 +15,17 @@ export declare interface DialectDriver {
15
15
  recordMigrationQuery: () => string
16
16
  }
17
17
  export declare class MySQLDriver implements DialectDriver {
18
-
18
+ createEnumType(_enumTypeName: string, _values: string[]): string;
19
+ createTable(table: TablePlan): string;
20
+ createIndex(tableName: string, index: IndexPlan): string;
21
+ addForeignKey(tableName: string, columnName: string, refTable: string, refColumn: string, onDelete?: string, onUpdate?: string): string;
22
+ addColumn(tableName: string, column: ColumnPlan): string;
23
+ modifyColumn(tableName: string, column: ColumnPlan): string;
24
+ dropTable(tableName: string): string;
25
+ dropColumn(tableName: string, columnName: string): string;
26
+ dropIndex(tableName: string, indexName: string): string;
27
+ dropEnumType(_enumTypeName: string): string;
28
+ createMigrationsTable(): string;
29
+ getExecutedMigrationsQuery(): string;
30
+ recordMigrationQuery(): string;
19
31
  }
@@ -15,5 +15,17 @@ export declare interface DialectDriver {
15
15
  recordMigrationQuery: () => string
16
16
  }
17
17
  export declare class PostgresDriver implements DialectDriver {
18
-
18
+ createEnumType(enumTypeName: string, values: string[]): string;
19
+ createTable(table: TablePlan): string;
20
+ createIndex(tableName: string, index: IndexPlan): string;
21
+ addForeignKey(tableName: string, columnName: string, refTable: string, refColumn: string, onDelete?: string, onUpdate?: string): string;
22
+ addColumn(tableName: string, column: ColumnPlan): string;
23
+ modifyColumn(tableName: string, column: ColumnPlan): string;
24
+ dropTable(tableName: string): string;
25
+ dropColumn(tableName: string, columnName: string): string;
26
+ dropIndex(tableName: string, indexName: string): string;
27
+ dropEnumType(enumTypeName: string): string;
28
+ createMigrationsTable(): string;
29
+ getExecutedMigrationsQuery(): string;
30
+ recordMigrationQuery(): string;
19
31
  }
@@ -15,5 +15,17 @@ export declare interface DialectDriver {
15
15
  recordMigrationQuery: () => string
16
16
  }
17
17
  export declare class SQLiteDriver implements DialectDriver {
18
-
18
+ createEnumType(_enumTypeName: string, _values: string[]): string;
19
+ createTable(table: TablePlan): string;
20
+ createIndex(tableName: string, index: IndexPlan): string;
21
+ addForeignKey(tableName: string, columnName: string, refTable: string, refColumn: string, onDelete?: string, onUpdate?: string): string;
22
+ addColumn(tableName: string, column: ColumnPlan): string;
23
+ modifyColumn(tableName: string, column: ColumnPlan): string;
24
+ dropTable(tableName: string): string;
25
+ dropColumn(tableName: string, columnName: string): string;
26
+ dropIndex(tableName: string, indexName: string): string;
27
+ dropEnumType(_enumTypeName: string): string;
28
+ createMigrationsTable(): string;
29
+ getExecutedMigrationsQuery(): string;
30
+ recordMigrationQuery(): string;
19
31
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  // Resolve ambiguous re-exports by explicitly choosing which module's version to use
2
2
  export type { WhereOperator } from './browser';
3
- export type { ModelQueryBuilder } from './dynamodb';
3
+ export type { ModelQueryBuilder } from './dynamodb/index';
4
4
  export type { ColumnName } from './client';
5
5
  // Re-export the type-inference version of InferRelationNames (supports wrapped models)
6
6
  // to resolve the ambiguity with orm.ts's InferRelationNames (which takes raw definitions)
@@ -22,16 +22,16 @@ export type {
22
22
  ModelCreateDataLoose,
23
23
  RelationCardinality,
24
24
  } from './type-inference';
25
- export * from './actions';
25
+ export * from './actions/index';
26
26
  export * from './browser';
27
27
  export * from './client';
28
28
  export * from './model';
29
29
  export * from './config';
30
- export * from './drivers';
30
+ export * from './drivers/index';
31
31
  export * from './dynamodb-client';
32
32
  export * from './dynamodb-single-table';
33
33
  export * from './dynamodb-tooling-adapter';
34
- export * from './dynamodb';
34
+ export * from './dynamodb/index';
35
35
  export * from './factory';
36
36
  export * from './loader';
37
37
  export * from './meta';
@@ -44,4 +44,4 @@ export * from './type-inference';
44
44
  export * from './types';
45
45
  export { type ModelDefinition, defineModel } from './model';
46
46
  // Explicit re-exports for model registry functions
47
- export { getModel, getAllModels, getModelRegistry, hasModel, clearModelRegistry } from './model';
47
+ export { getModel, getAllModels, getModelRegistry, hasModel, clearModelRegistry, registerModel } from './model';
package/dist/model.d.ts CHANGED
@@ -53,6 +53,18 @@ export declare function hasModel(name: string): boolean;
53
53
  * Clear all registered models. Primarily useful for testing.
54
54
  */
55
55
  export declare function clearModelRegistry(): void;
56
+ /**
57
+ * Register an already-created model instance in the global registry.
58
+ *
59
+ * Framework integrations can build richer model facades themselves and
60
+ * still expose those models to query-builder features that discover
61
+ * models through the shared registry.
62
+ *
63
+ * @param name - The model name (e.g., 'User', 'Trail')
64
+ * @param model - The runtime model instance to register
65
+ * @returns The same model instance for convenient passthrough usage
66
+ */
67
+ export declare function registerModel<TModel>(name: string, model: TModel): TModel;
56
68
  /**
57
69
  * Define an isomorphic model that works in both server and browser.
58
70
  *