relation-matcher 1.0.10 → 1.0.12

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/.yarnrc.yml CHANGED
@@ -1 +1,3 @@
1
1
  nodeLinker: node-modules
2
+
3
+ yarnPath: .yarn/releases/yarn-4.13.0.cjs
@@ -1,4 +1,3 @@
1
- import type { RelationMapRoot } from "~/types/inputs";
2
1
  export declare const testData: ({
3
2
  users: {
4
3
  id: string;
@@ -69,4 +68,35 @@ export declare const testData: ({
69
68
  posts: null;
70
69
  comments: null;
71
70
  })[];
72
- export declare const testSchema: RelationMapRoot<(typeof testData)[number]>;
71
+ export declare const testSchema: {
72
+ base: "users";
73
+ id: "id";
74
+ _teamToUsers: {
75
+ base: "teamToUser";
76
+ id: "teamId";
77
+ joinsFrom: "id";
78
+ joinsTo: "userId";
79
+ joinType: "array";
80
+ _team: {
81
+ base: "teams";
82
+ id: "id";
83
+ joinsFrom: "teamId";
84
+ joinsTo: "id";
85
+ joinType: "single";
86
+ };
87
+ };
88
+ _posts: {
89
+ base: "posts";
90
+ id: "id";
91
+ joinsFrom: "id";
92
+ joinsTo: "userId";
93
+ joinType: "array";
94
+ _comments: {
95
+ base: "comments";
96
+ id: "id";
97
+ joinsFrom: "id";
98
+ joinsTo: "postId";
99
+ joinType: "array";
100
+ };
101
+ };
102
+ };
@@ -1,11 +1,9 @@
1
1
  import type { TInputBase, TJoinedFromBase, TOutputBase } from "./generic-bases";
2
2
  import type { RelationMapRoot } from "./inputs";
3
3
  import type { ExtendsNull, NoUnderscore, Simplify } from "./utils";
4
- export type RelationMapperReturnRoot<TInput extends TInputBase, TOutput extends RelationMapRoot<TInput>> = Simplify<{
5
- [inputKey in keyof TInput]: ExtendsNull<TInput[TOutput["base"]]> extends true ? Simplify<TInput[TOutput["base"]] & RelationMapperReturnJoinRoot<TInput, TOutput, inputKey>> | null : Simplify<TInput[TOutput["base"]] & RelationMapperReturnJoinRoot<TInput, TOutput, inputKey>>;
6
- }[keyof TInput]>;
4
+ export type RelationMapperReturnRoot<TInput extends TInputBase, TOutput extends RelationMapRoot<TInput>> = Simplify<ExtendsNull<TInput[TOutput["base"]]> extends true ? (TInput[TOutput["base"]] & RelationMapperReturnJoinRoot<TInput, TOutput, TOutput["base"]>) | null : TInput[TOutput["base"]] & RelationMapperReturnJoinRoot<TInput, TOutput, TOutput["base"]>>;
7
5
  export type RelationMapperReturnJoinRoot<TInput extends TInputBase, TOutput extends RelationMapRoot<TInput>, TInputKey extends keyof TInput> = {
8
- [outputKey in NoUnderscore<keyof TOutput>]: Simplify<RelationMapperReturn<TInput, TInput[TInputKey], TOutput[`_${outputKey}`]>>;
6
+ [outputKey in NoUnderscore<keyof TOutput>]: RelationMapperReturn<TInput, TInput[TInputKey], TOutput[`_${outputKey}`]>;
9
7
  };
10
8
  /** Fill current object with value specified in base */
11
9
  export type RelationMapperReturn<TInput extends TInputBase, TJoinedFrom extends TJoinedFromBase, TOutput extends TOutputBase<TInput, TJoinedFrom>> = TOutput["joinType"] extends "array" ? Array<Simplify<TInput[TOutput["base"]] & RelationMapperReturnJoin<TInput, TJoinedFrom, TOutput>>> : ExtendsNull<TInput[TOutput["base"]]> extends true ? Simplify<TInput[TOutput["base"]] & RelationMapperReturnJoin<TInput, TJoinedFrom, TOutput>> | null : Simplify<TInput[TOutput["base"]] & RelationMapperReturnJoin<TInput, TJoinedFrom, TOutput>>;