@vibeorm/dsl 5.0.2 → 5.0.3
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/types.d.ts +13 -2
- package/package.json +3 -3
package/dist/types.d.ts
CHANGED
|
@@ -859,8 +859,19 @@ export type RelationsBuilder<TSchema extends Record<string, ModelDef>> = {
|
|
|
859
859
|
export type RelationsOutput<TSchema extends Record<string, ModelDef>> = {
|
|
860
860
|
[K in keyof TSchema]?: Record<string, StoredRelationDef>;
|
|
861
861
|
};
|
|
862
|
-
/**
|
|
863
|
-
|
|
862
|
+
/**
|
|
863
|
+
* Shallow merged model/relation keys; later parts retain their override types.
|
|
864
|
+
*
|
|
865
|
+
* Neighbouring parts merge in pairs, one round per halving, so N parts nest
|
|
866
|
+
* about log2(N) pair types. A merge that nests one pair type per part stops
|
|
867
|
+
* near 32 parts with TS2589 ("type instantiation is excessively deep and
|
|
868
|
+
* possibly infinite"). An array whose length is unknown at compile time
|
|
869
|
+
* merges to `RelationsMap`.
|
|
870
|
+
*/
|
|
871
|
+
export type MergedRelations<TParts extends readonly RelationsMap[]> = number extends TParts["length"] ? RelationsMap : MergeRelationRounds<TParts>;
|
|
872
|
+
type MergeRelationRounds<TParts extends readonly RelationsMap[]> = TParts extends readonly [] ? {} : TParts extends readonly [infer TOnly extends RelationsMap] ? TOnly : MergeRelationRounds<MergeNeighbourRelations<TParts>>;
|
|
873
|
+
/** One round keeps the part order: `[A, B, C, D, E]` becomes `[A+B, C+D, E]`. */
|
|
874
|
+
type MergeNeighbourRelations<TParts extends readonly RelationsMap[], TMerged extends readonly RelationsMap[] = []> = TParts extends readonly [infer TLeft extends RelationsMap, infer TRight extends RelationsMap, ...infer TRest extends readonly RelationsMap[]] ? MergeNeighbourRelations<TRest, [...TMerged, MergeRelationPair<TLeft, TRight>]> : TParts extends readonly [infer TLast extends RelationsMap] ? [...TMerged, TLast] : TMerged;
|
|
864
875
|
type MergeRelationPair<TLeft extends RelationsMap, TRight extends RelationsMap> = {
|
|
865
876
|
[M in keyof TLeft | keyof TRight]: M extends keyof TRight ? M extends keyof TLeft ? Omit<TLeft[M], keyof TRight[M]> & TRight[M] : TRight[M] : M extends keyof TLeft ? TLeft[M] : never;
|
|
866
877
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibeorm/dsl",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "TypeScript schema DSL for VibeORM v2 — compiles to canonical SchemaIR, with .prisma generation for interop",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"orm",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"bun": ">=1.2.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@vibeorm/schema": "5.
|
|
47
|
-
"@vibeorm/sql": "5.
|
|
46
|
+
"@vibeorm/schema": "5.2.0",
|
|
47
|
+
"@vibeorm/sql": "5.2.0"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|