bun-query-builder 0.2.27 → 0.2.29
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 +461 -355
- package/dist/browser.d.ts +2 -2
- package/dist/client.d.ts +7 -0
- package/dist/faker-compat.d.ts +83 -0
- package/dist/index.d.ts +1 -0
- package/dist/orm.d.ts +26 -14
- package/dist/schema.d.ts +2 -2
- package/dist/sql-fragments.d.ts +69 -0
- package/dist/src/index.js +461 -354
- package/dist/type-inference.d.ts +8 -6
- package/package.json +1 -1
package/dist/type-inference.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FactoryFaker } from './faker-compat';
|
|
2
2
|
import type { ValidationType } from './schema';
|
|
3
3
|
// Local mirror of the runtime PivotColumnAttribute shape (kept structural so we
|
|
4
4
|
// don't take a hard dep on schema.ts at the type-inference layer).
|
|
@@ -20,7 +20,7 @@ declare interface InferableAttribute<T = unknown> {
|
|
|
20
20
|
rule: ValidationType
|
|
21
21
|
message?: Record<string, string>
|
|
22
22
|
}
|
|
23
|
-
factory?: (faker:
|
|
23
|
+
factory?: (faker: FactoryFaker) => InferType<T>
|
|
24
24
|
}
|
|
25
25
|
/** Minimal model definition shape for type inference */
|
|
26
26
|
declare interface InferableModelDefinition {
|
|
@@ -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)
|
|
@@ -117,7 +119,7 @@ declare type SnakeCase<S extends string> = S extends `${infer C}${infer Rest}`
|
|
|
117
119
|
// Single attribute type inference
|
|
118
120
|
// ============================================================================
|
|
119
121
|
declare type InferSingleAttributeType<TAttr> = TAttr extends { type: infer T } ? InferType<T> :
|
|
120
|
-
TAttr extends { factory: (faker:
|
|
122
|
+
TAttr extends { factory: (faker: FactoryFaker) => infer R } ? R :
|
|
121
123
|
TAttr extends { validation: { rule: infer R } } ? InferType<R> :
|
|
122
124
|
TAttr extends { default: infer D } ? D :
|
|
123
125
|
unknown;
|
package/package.json
CHANGED