bun-query-builder 0.2.26 → 0.2.27

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/db.d.ts CHANGED
@@ -60,6 +60,11 @@ export declare function resetConnection(): void;
60
60
  export declare function setSqlInstance(sql: SQL): void;
61
61
  // Wrapper that catches "Connection closed" errors and retries with a fresh connection
62
62
  export declare function withFreshConnection<T>(fn: (sql: SQL) => Promise<T>): Promise<T>;
63
+ /**
64
+ * Lazy SQL connection proxy - connection is only created when first accessed.
65
+ * This allows setConfig() to be called before any database connection is made.
66
+ */
67
+ declare function createLazyBunSql(): SQL;
63
68
  // Export a lazy proxy - no connection is made until first use
64
69
  export declare const bunSql: SQL;
65
70
  /**
package/dist/model.d.ts CHANGED
@@ -79,7 +79,7 @@ export declare function registerModel<TModel>(name: string, model: TModel): TMod
79
79
  * @param definition - The model definition
80
80
  * @returns An isomorphic model with query methods
81
81
  */
82
- export declare function defineModel<const TDef extends BrowserModelDefinition>(definition: TDef): void;
82
+ export declare function defineModel<const TDef extends BrowserModelDefinition>(definition: TDef): unknown;
83
83
  /**
84
84
  * Register models on the global window.StacksBrowser object.
85
85
  * Call this in your app's entry point to make models available for STX auto-imports.
package/dist/orm.d.ts CHANGED
@@ -228,7 +228,8 @@ declare type PrimitiveTypeMap = {
228
228
  declare type InferType<T> = T extends keyof PrimitiveTypeMap ? PrimitiveTypeMap[T] :
229
229
  T extends readonly (infer U)[] ? U :
230
230
  T extends (infer U)[] ? U :
231
- T extends { validate: (value: infer U) => any } ? U :
231
+ T extends { validate: (value: infer U) => unknown } ? U :
232
+ T extends { test: (value: infer U) => unknown } ? U :
232
233
  unknown;
233
234
  // Extract attribute keys from definition
234
235
  declare type AttributeKeys<TDef extends ModelDefinition> = keyof TDef['attributes'] & string;
@@ -358,9 +359,9 @@ declare type FillableAttributes<TDef extends ModelDefinition> = Partial<Pick<
358
359
  ModelAttributes<TDef>,
359
360
  FillableKeys<TDef> | SnakeCase<FillableKeys<TDef>> | BelongsToKeys<TDef>
360
361
  >>;
361
- // Numeric attribute columns — constrains aggregate methods (sum, avg, etc.)
362
+ // Numeric attribute columns - constrains aggregate methods (sum, avg, etc.)
362
363
  declare type NumericColumns<TDef extends ModelDefinition> = {
363
- [K in AttributeKeys<TDef>]: TDef['attributes'][K] extends { type: 'number' } ? K : never
364
+ [K in AttributeKeys<TDef>]: InferAttributeType<TDef['attributes'][K]> extends number ? K : never
364
365
  }[AttributeKeys<TDef>];
365
366
  /**
366
367
  * Relation names of one relation declaration. Array form lowercases the
package/dist/schema.d.ts CHANGED
@@ -62,7 +62,7 @@ export declare interface Attribute {
62
62
  fillable?: boolean
63
63
  guarded?: boolean
64
64
  foreignKey?: boolean | ForeignKeyConfig
65
- factory?: (faker: Faker) => any
65
+ factory?: (faker: Faker) => unknown
66
66
  validation: {
67
67
  rule: ValidationType
68
68
  message?: ValidatorMessage