bun-query-builder 0.2.27 → 0.2.28
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 +1 -1
- package/dist/orm.d.ts +23 -11
- package/dist/type-inference.d.ts +5 -3
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -31874,7 +31874,7 @@ function getPrefix() {
|
|
|
31874
31874
|
}
|
|
31875
31875
|
var prefix = getPrefix();
|
|
31876
31876
|
// package.json
|
|
31877
|
-
var version2 = "0.2.
|
|
31877
|
+
var version2 = "0.2.28";
|
|
31878
31878
|
|
|
31879
31879
|
// bin/cli.ts
|
|
31880
31880
|
init_actions();
|
package/dist/orm.d.ts
CHANGED
|
@@ -228,9 +228,11 @@ 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 {
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
T extends { getShape: () => infer TShape extends Readonly<Record<string, unknown>> }
|
|
232
|
+
? { -readonly [TKey in keyof TShape]: InferType<TShape[TKey]> }
|
|
233
|
+
: T extends { test: (value: infer U) => unknown } ? U :
|
|
234
|
+
T extends { validate: (value: infer U) => unknown } ? U :
|
|
235
|
+
unknown;
|
|
234
236
|
// Extract attribute keys from definition
|
|
235
237
|
declare type AttributeKeys<TDef extends ModelDefinition> = keyof TDef['attributes'] & string;
|
|
236
238
|
// Infer single attribute type
|
|
@@ -370,25 +372,35 @@ declare type NumericColumns<TDef extends ModelDefinition> = {
|
|
|
370
372
|
* and would otherwise leak its own keys ('length', indices, ...) into the
|
|
371
373
|
* relation-name union.
|
|
372
374
|
*/
|
|
373
|
-
declare type RelationKeyOf<V> = V extends
|
|
374
|
-
?
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
:
|
|
375
|
+
declare type RelationKeyOf<V> = V extends string
|
|
376
|
+
? Lowercase<V>
|
|
377
|
+
: V extends readonly (infer E)[]
|
|
378
|
+
? E extends string ? Lowercase<E>
|
|
379
|
+
: E extends { model: infer M extends string } ? Lowercase<M>
|
|
380
|
+
: never
|
|
381
|
+
: V extends Readonly<Record<infer K, unknown>>
|
|
382
|
+
? K & string
|
|
383
|
+
: never;
|
|
380
384
|
declare type InferBelongsToNames<TDef> = TDef extends { belongsTo: infer V } ? RelationKeyOf<V> : never;
|
|
381
385
|
declare type InferHasManyNames<TDef> = TDef extends { hasMany: infer V } ? RelationKeyOf<V> : never;
|
|
382
386
|
declare type InferHasOneNames<TDef> = TDef extends { hasOne: infer V } ? RelationKeyOf<V> : never;
|
|
383
387
|
declare type InferBelongsToManyNames<TDef> = TDef extends { belongsToMany: infer V } ? RelationKeyOf<V> : never;
|
|
384
388
|
declare type InferHasOneThroughNames<TDef> = TDef extends { hasOneThrough: infer V } ? RelationKeyOf<V> : never;
|
|
385
389
|
declare type InferHasManyThroughNames<TDef> = TDef extends { hasManyThrough: infer V } ? RelationKeyOf<V> : never;
|
|
390
|
+
declare type InferMorphOneNames<TDef> = TDef extends { morphOne: infer V } ? RelationKeyOf<V> : never;
|
|
391
|
+
declare type InferMorphManyNames<TDef> = TDef extends { morphMany: infer V } ? RelationKeyOf<V> : never;
|
|
392
|
+
declare type InferMorphToManyNames<TDef> = TDef extends { morphToMany: infer V } ? RelationKeyOf<V> : never;
|
|
393
|
+
declare type InferMorphedByManyNames<TDef> = TDef extends { morphedByMany: infer V } ? RelationKeyOf<V> : never;
|
|
386
394
|
export type InferRelationNames<TDef> = | InferBelongsToNames<TDef>
|
|
387
395
|
| InferHasManyNames<TDef>
|
|
388
396
|
| InferHasOneNames<TDef>
|
|
389
397
|
| InferBelongsToManyNames<TDef>
|
|
390
398
|
| InferHasOneThroughNames<TDef>
|
|
391
|
-
| InferHasManyThroughNames<TDef
|
|
399
|
+
| InferHasManyThroughNames<TDef>
|
|
400
|
+
| InferMorphOneNames<TDef>
|
|
401
|
+
| InferMorphManyNames<TDef>
|
|
402
|
+
| InferMorphToManyNames<TDef>
|
|
403
|
+
| InferMorphedByManyNames<TDef>;
|
|
392
404
|
/**
|
|
393
405
|
* Cardinality-aware value of a loaded relation as returned by
|
|
394
406
|
* `ModelInstance.getRelation()`. Relations declared as to-many (hasMany,
|
package/dist/type-inference.d.ts
CHANGED
|
@@ -64,9 +64,11 @@ declare type PrimitiveTypeMap = {
|
|
|
64
64
|
declare type InferType<T> = T extends keyof PrimitiveTypeMap ? PrimitiveTypeMap[T] :
|
|
65
65
|
T extends readonly (infer U)[] ? U :
|
|
66
66
|
T extends (infer U)[] ? U :
|
|
67
|
-
T extends {
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
T extends { getShape: () => infer TShape extends Readonly<Record<string, unknown>> }
|
|
68
|
+
? { -readonly [TKey in keyof TShape]: InferType<TShape[TKey]> }
|
|
69
|
+
: T extends { test: (value: infer U) => unknown } ? U :
|
|
70
|
+
T extends { validate: (value: infer U) => unknown } ? U :
|
|
71
|
+
unknown;
|
|
70
72
|
/**
|
|
71
73
|
* Resolves TModel to the underlying definition type.
|
|
72
74
|
* Handles both raw definitions and wrapped models (from defineModel / createModel / createBrowserModel)
|
package/package.json
CHANGED