orange-orm 4.1.0 → 4.1.1
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/docs/changelog.md +3 -1
- package/package.json +1 -1
- package/src/map.d.ts +15 -17
- package/src/table/hasOne.js +1 -0
- package/src/table/join.js +9 -0
package/docs/changelog.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
## Changelog
|
|
2
|
+
__4.1.1__
|
|
3
|
+
Some fixes regarding NotNull mappings. [#104](https://github.com/alfateam/orange-orm/issues/91)
|
|
2
4
|
__4.1.0__
|
|
3
|
-
Escape table and column names.
|
|
5
|
+
Escape table and column names. [#91](https://github.com/alfateam/orange-orm/issues/91) [#92](https://github.com/alfateam/orange-orm/issues/92)
|
|
4
6
|
NotNullable relations [#104](https://github.com/alfateam/orange-orm/issues/104)
|
|
5
7
|
__4.0.1__
|
|
6
8
|
Inhouse definitions of ajv to avoid trouble with nestjs.
|
package/package.json
CHANGED
package/src/map.d.ts
CHANGED
|
@@ -837,7 +837,7 @@ type ReferenceMapperHelper<TFrom, TTo, TPrimaryCount> =
|
|
|
837
837
|
column4: C4,
|
|
838
838
|
column5: C5,
|
|
839
839
|
column6: C6
|
|
840
|
-
): MappedTableDef<TTo> & RelatedTable &
|
|
840
|
+
): MappedTableDef<TTo> & RelatedTable & NotNullRelationHelper<MappedTableDef<TTo> & RelatedTable>;
|
|
841
841
|
}
|
|
842
842
|
: 5 extends TPrimaryCount
|
|
843
843
|
? {
|
|
@@ -847,7 +847,7 @@ type ReferenceMapperHelper<TFrom, TTo, TPrimaryCount> =
|
|
|
847
847
|
column3: C3,
|
|
848
848
|
column4: C4,
|
|
849
849
|
column5: C5
|
|
850
|
-
): MappedTableDef<TTo> & RelatedTable &
|
|
850
|
+
): MappedTableDef<TTo> & RelatedTable & NotNullRelationHelper<MappedTableDef<TTo> & RelatedTable>;
|
|
851
851
|
}
|
|
852
852
|
: 4 extends TPrimaryCount
|
|
853
853
|
? {
|
|
@@ -856,7 +856,7 @@ type ReferenceMapperHelper<TFrom, TTo, TPrimaryCount> =
|
|
|
856
856
|
column2: C2,
|
|
857
857
|
column3: C3,
|
|
858
858
|
column4: C4
|
|
859
|
-
): MappedTableDef<TTo> & RelatedTable &
|
|
859
|
+
): MappedTableDef<TTo> & RelatedTable & NotNullRelationHelper<MappedTableDef<TTo> & RelatedTable>;
|
|
860
860
|
}
|
|
861
861
|
: 3 extends TPrimaryCount
|
|
862
862
|
? {
|
|
@@ -864,24 +864,23 @@ type ReferenceMapperHelper<TFrom, TTo, TPrimaryCount> =
|
|
|
864
864
|
column: C1,
|
|
865
865
|
column2: C2,
|
|
866
866
|
column3: C3
|
|
867
|
-
): MappedTableDef<TTo> & RelatedTable &
|
|
867
|
+
): MappedTableDef<TTo> & RelatedTable & NotNullRelationHelper<MappedTableDef<TTo> & RelatedTable>;
|
|
868
868
|
}
|
|
869
869
|
: 2 extends TPrimaryCount
|
|
870
870
|
? {
|
|
871
871
|
by<C1 extends keyof KeyCandidates1<TFrom, TTo>, C2 extends keyof KeyCandidates2<TFrom, TTo>>(
|
|
872
872
|
column: C1,
|
|
873
873
|
column2: C2
|
|
874
|
-
): MappedTableDef<TTo> & RelatedTable &
|
|
874
|
+
): MappedTableDef<TTo> & RelatedTable & NotNullRelationHelper<MappedTableDef<TTo> & RelatedTable>;
|
|
875
875
|
}
|
|
876
876
|
: 1 extends TPrimaryCount
|
|
877
877
|
? {
|
|
878
878
|
by<C1 extends keyof KeyCandidates1<TFrom, TTo>>(
|
|
879
879
|
column: C1
|
|
880
|
-
): MappedTableDef<TTo> & RelatedTable &
|
|
880
|
+
): MappedTableDef<TTo> & RelatedTable & NotNullRelationHelper<MappedTableDef<TTo> & RelatedTable>;
|
|
881
881
|
}
|
|
882
882
|
: {};
|
|
883
883
|
|
|
884
|
-
type NegotiateNotNullColumn<C, TFrom> = C extends keyof TFrom ? TFrom[C] extends NotNullExceptInsert ? NotNullExceptInsert : TFrom[C] extends NotNull ? NotNull : {}: {};
|
|
885
884
|
|
|
886
885
|
type HasMapperHelper<
|
|
887
886
|
TFrom,
|
|
@@ -897,7 +896,7 @@ type HasMapperHelper<
|
|
|
897
896
|
column4: keyof KeyCandidates4<TTo, TFrom>,
|
|
898
897
|
column5: keyof KeyCandidates5<TTo, TFrom>,
|
|
899
898
|
column6: keyof KeyCandidates6<TTo, TFrom>
|
|
900
|
-
): MappedTableDef<TTo> & RelatedTable & TExtra &
|
|
899
|
+
): MappedTableDef<TTo> & RelatedTable & TExtra & NotNullRelationHelper<MappedTableDef<TTo> & RelatedTable & TExtra>;
|
|
901
900
|
}
|
|
902
901
|
: 5 extends TPrimaryCount
|
|
903
902
|
? {
|
|
@@ -907,7 +906,7 @@ type HasMapperHelper<
|
|
|
907
906
|
column3: keyof KeyCandidates3<TTo, TFrom>,
|
|
908
907
|
column4: keyof KeyCandidates4<TTo, TFrom>,
|
|
909
908
|
column5: keyof KeyCandidates5<TTo, TFrom>
|
|
910
|
-
): MappedTableDef<TTo> & RelatedTable & TExtra &
|
|
909
|
+
): MappedTableDef<TTo> & RelatedTable & TExtra & NotNullRelationHelper<MappedTableDef<TTo> & RelatedTable & TExtra>;
|
|
911
910
|
}
|
|
912
911
|
: 4 extends TPrimaryCount
|
|
913
912
|
? {
|
|
@@ -916,7 +915,7 @@ type HasMapperHelper<
|
|
|
916
915
|
column2: keyof KeyCandidates2<TTo, TFrom>,
|
|
917
916
|
column3: keyof KeyCandidates3<TTo, TFrom>,
|
|
918
917
|
column4: keyof KeyCandidates4<TTo, TFrom>
|
|
919
|
-
): MappedTableDef<TTo> & RelatedTable & TExtra &
|
|
918
|
+
): MappedTableDef<TTo> & RelatedTable & TExtra & NotNullRelationHelper<MappedTableDef<TTo> & RelatedTable & TExtra>;
|
|
920
919
|
}
|
|
921
920
|
: 3 extends TPrimaryCount
|
|
922
921
|
? {
|
|
@@ -924,26 +923,25 @@ type HasMapperHelper<
|
|
|
924
923
|
column: keyof KeyCandidates1<TTo, TFrom>,
|
|
925
924
|
column2: keyof KeyCandidates2<TTo, TFrom>,
|
|
926
925
|
column3: keyof KeyCandidates3<TTo, TFrom>
|
|
927
|
-
): MappedTableDef<TTo> & RelatedTable & TExtra &
|
|
926
|
+
): MappedTableDef<TTo> & RelatedTable & TExtra & NotNullRelationHelper<MappedTableDef<TTo> & RelatedTable & TExtra>;
|
|
928
927
|
}
|
|
929
928
|
: 2 extends TPrimaryCount
|
|
930
929
|
? {
|
|
931
930
|
by(
|
|
932
931
|
column: keyof KeyCandidates1<TTo, TFrom>,
|
|
933
932
|
column2: keyof KeyCandidates2<TTo, TFrom>
|
|
934
|
-
): MappedTableDef<TTo> & RelatedTable & TExtra &
|
|
933
|
+
): MappedTableDef<TTo> & RelatedTable & TExtra & NotNullRelationHelper<MappedTableDef<TTo> & RelatedTable & TExtra>;
|
|
935
934
|
}
|
|
936
935
|
: 1 extends TPrimaryCount
|
|
937
936
|
? {
|
|
938
937
|
by(
|
|
939
938
|
column: keyof KeyCandidates1<TTo, TFrom>
|
|
940
|
-
): MappedTableDef<TTo> & RelatedTable & TExtra &
|
|
939
|
+
): MappedTableDef<TTo> & RelatedTable & TExtra & NotNullRelationHelper<MappedTableDef<TTo> & RelatedTable & TExtra>;
|
|
941
940
|
}
|
|
942
941
|
: {};
|
|
943
942
|
|
|
944
|
-
type
|
|
943
|
+
type NotNullRelationHelper<T> = {
|
|
945
944
|
notNull(): T & NotNull;
|
|
946
|
-
notNullExceptInsert(): T & NotNull & NotNullExceptInsert;
|
|
947
945
|
}
|
|
948
946
|
|
|
949
947
|
type ColumnMapperInit<T> = {
|
|
@@ -1207,7 +1205,7 @@ type StrategyToUpdateRowData<T> = Omit<{
|
|
|
1207
1205
|
: T[K] extends ManyRelation
|
|
1208
1206
|
? StrategyToInsertRowData<T[K]>[]
|
|
1209
1207
|
: StrategyToInsertRowData<T[K]>;
|
|
1210
|
-
}, 'formulaDiscriminators' | 'columnDiscriminators' | 'map' | ' isManyRelation' | ' relatedTable' | ' isOneRelation'>
|
|
1208
|
+
}, 'formulaDiscriminators' | 'columnDiscriminators' | ' notNull' | ' notNullExceptInsert' | 'map' | ' isManyRelation' | ' relatedTable' | ' isOneRelation'>
|
|
1211
1209
|
;
|
|
1212
1210
|
|
|
1213
1211
|
type StrategyToInsertRowData<T> = Omit<{
|
|
@@ -1258,7 +1256,7 @@ type StrategyToInsertRowData<T> = Omit<{
|
|
|
1258
1256
|
: T[K] extends ManyRelation
|
|
1259
1257
|
? StrategyToInsertRowData<T[K]>[]
|
|
1260
1258
|
: StrategyToInsertRowData<T[K]>;
|
|
1261
|
-
}, 'formulaDiscriminators' | 'columnDiscriminators' | 'map' | ' isManyRelation' | ' relatedTable' | ' isOneRelation'>
|
|
1259
|
+
}, 'formulaDiscriminators' | 'columnDiscriminators' | ' notNull' | ' notNullExceptInsert' | 'map' | ' isManyRelation' | ' relatedTable' | ' isOneRelation'>
|
|
1262
1260
|
;
|
|
1263
1261
|
|
|
1264
1262
|
type NegotiateDefaultStrategy<T> = T extends ColumnSymbols ? T : never;
|
package/src/table/hasOne.js
CHANGED