@abedmurrar/objection 4.0.0-alpha.0 → 4.0.0-beta.0
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/README.md +103 -67
- package/lib/index.mjs +6 -0
- package/lib/initialize.js +6 -9
- package/lib/model/AjvValidator.js +235 -282
- package/lib/model/Model.js +653 -823
- package/lib/model/ModifierNotFoundError.js +5 -7
- package/lib/model/NotFoundError.js +14 -18
- package/lib/model/RelationDoesNotExistError.js +6 -9
- package/lib/model/ValidationError.js +33 -41
- package/lib/model/Validator.js +15 -21
- package/lib/model/getModel.js +1 -3
- package/lib/model/graph/ModelGraph.js +44 -64
- package/lib/model/graph/ModelGraphBuilder.js +164 -217
- package/lib/model/graph/ModelGraphEdge.js +31 -43
- package/lib/model/graph/ModelGraphNode.js +192 -231
- package/lib/model/inheritModel.js +9 -18
- package/lib/model/modelBindKnex.js +48 -62
- package/lib/model/modelClone.js +79 -98
- package/lib/model/modelColPropMap.js +16 -26
- package/lib/model/modelConcurrency.js +24 -0
- package/lib/model/modelId.js +44 -49
- package/lib/model/modelJsonAttributes.js +56 -76
- package/lib/model/modelParseRelations.js +68 -67
- package/lib/model/modelQueryProps.js +76 -107
- package/lib/model/modelSet.js +92 -112
- package/lib/model/modelTableMetadata.js +60 -72
- package/lib/model/modelToJson.js +120 -150
- package/lib/model/modelUtils.js +30 -37
- package/lib/model/modelValidate.js +34 -42
- package/lib/model/modelValues.js +78 -91
- package/lib/model/modelVisitor.js +22 -29
- package/lib/objection.js +42 -67
- package/lib/queryBuilder/FunctionBuilder.js +231 -279
- package/lib/queryBuilder/InternalOptions.js +19 -24
- package/lib/queryBuilder/JoinBuilder.js +116 -149
- package/lib/queryBuilder/QueryBuilder.js +1009 -1271
- package/lib/queryBuilder/QueryBuilderBase.js +647 -865
- package/lib/queryBuilder/QueryBuilderContext.js +14 -21
- package/lib/queryBuilder/QueryBuilderContextBase.js +20 -29
- package/lib/queryBuilder/QueryBuilderOperationSupport.js +462 -536
- package/lib/queryBuilder/QueryBuilderUserContext.js +19 -25
- package/lib/queryBuilder/RawBuilder.js +58 -73
- package/lib/queryBuilder/ReferenceBuilder.js +232 -270
- package/lib/queryBuilder/RelationExpression.js +322 -380
- package/lib/queryBuilder/StaticHookArguments.js +94 -106
- package/lib/queryBuilder/ValueBuilder.js +100 -112
- package/lib/queryBuilder/expressions.js +86 -116
- package/lib/queryBuilder/functions/mysql.js +642 -697
- package/lib/queryBuilder/graph/GraphAction.js +44 -59
- package/lib/queryBuilder/graph/GraphData.js +7 -9
- package/lib/queryBuilder/graph/GraphFetcher.js +115 -151
- package/lib/queryBuilder/graph/GraphNodeDbExistence.js +114 -152
- package/lib/queryBuilder/graph/GraphOperation.js +16 -22
- package/lib/queryBuilder/graph/GraphOptions.js +143 -185
- package/lib/queryBuilder/graph/GraphUpsert.js +167 -241
- package/lib/queryBuilder/graph/delete/GraphDelete.js +8 -13
- package/lib/queryBuilder/graph/delete/GraphDeleteAction.js +44 -62
- package/lib/queryBuilder/graph/insert/GraphInsert.js +99 -128
- package/lib/queryBuilder/graph/insert/GraphInsertAction.js +151 -193
- package/lib/queryBuilder/graph/insert/JoinRowGraphInsertAction.js +57 -79
- package/lib/queryBuilder/graph/patch/GraphPatch.js +8 -13
- package/lib/queryBuilder/graph/patch/GraphPatchAction.js +181 -234
- package/lib/queryBuilder/graph/recursiveUpsert/GraphRecursiveUpsert.js +16 -21
- package/lib/queryBuilder/graph/recursiveUpsert/GraphRecursiveUpsertAction.js +80 -110
- package/lib/queryBuilder/join/JoinResultColumn.js +14 -18
- package/lib/queryBuilder/join/JoinResultParser.js +88 -101
- package/lib/queryBuilder/join/RelationJoiner.js +205 -288
- package/lib/queryBuilder/join/TableNode.js +117 -144
- package/lib/queryBuilder/join/TableTree.js +60 -76
- package/lib/queryBuilder/join/utils.js +10 -16
- package/lib/queryBuilder/operations/DelegateOperation.js +93 -133
- package/lib/queryBuilder/operations/DeleteOperation.js +33 -37
- package/lib/queryBuilder/operations/FindByIdOperation.js +20 -28
- package/lib/queryBuilder/operations/FindByIdsOperation.js +17 -23
- package/lib/queryBuilder/operations/FindOperation.js +114 -131
- package/lib/queryBuilder/operations/FirstOperation.js +14 -19
- package/lib/queryBuilder/operations/FromOperation.js +69 -88
- package/lib/queryBuilder/operations/InsertAndFetchOperation.js +28 -39
- package/lib/queryBuilder/operations/InsertGraphAndFetchOperation.js +25 -35
- package/lib/queryBuilder/operations/InsertGraphOperation.js +77 -98
- package/lib/queryBuilder/operations/InsertOperation.js +132 -165
- package/lib/queryBuilder/operations/InstanceDeleteOperation.js +27 -36
- package/lib/queryBuilder/operations/InstanceFindOperation.js +9 -13
- package/lib/queryBuilder/operations/InstanceInsertOperation.js +13 -17
- package/lib/queryBuilder/operations/InstanceUpdateOperation.js +32 -46
- package/lib/queryBuilder/operations/JoinRelatedOperation.js +66 -86
- package/lib/queryBuilder/operations/KnexOperation.js +4 -7
- package/lib/queryBuilder/operations/MergeOperation.js +32 -45
- package/lib/queryBuilder/operations/ObjectionToKnexConvertingOperation.js +131 -150
- package/lib/queryBuilder/operations/OnBuildKnexOperation.js +17 -23
- package/lib/queryBuilder/operations/OnBuildOperation.js +17 -23
- package/lib/queryBuilder/operations/OnErrorOperation.js +17 -23
- package/lib/queryBuilder/operations/QueryBuilderOperation.js +231 -270
- package/lib/queryBuilder/operations/RangeOperation.js +30 -40
- package/lib/queryBuilder/operations/RelateOperation.js +14 -21
- package/lib/queryBuilder/operations/ReturningOperation.js +12 -18
- package/lib/queryBuilder/operations/RunAfterOperation.js +17 -23
- package/lib/queryBuilder/operations/RunBeforeOperation.js +17 -23
- package/lib/queryBuilder/operations/UnrelateOperation.js +12 -17
- package/lib/queryBuilder/operations/UpdateAndFetchOperation.js +48 -65
- package/lib/queryBuilder/operations/UpdateOperation.js +104 -129
- package/lib/queryBuilder/operations/UpsertGraphAndFetchOperation.js +25 -35
- package/lib/queryBuilder/operations/UpsertGraphOperation.js +36 -55
- package/lib/queryBuilder/operations/WhereCompositeOperation.js +30 -39
- package/lib/queryBuilder/operations/WhereInOperation.js +34 -36
- package/lib/queryBuilder/operations/eager/EagerOperation.js +37 -52
- package/lib/queryBuilder/operations/eager/JoinEagerOperation.js +34 -44
- package/lib/queryBuilder/operations/eager/NaiveEagerOperation.js +4 -7
- package/lib/queryBuilder/operations/eager/WhereInEagerOperation.js +193 -251
- package/lib/queryBuilder/operations/jsonApi/WhereJsonHasOperation.js +18 -25
- package/lib/queryBuilder/operations/jsonApi/WhereJsonNotObjectOperation.js +25 -41
- package/lib/queryBuilder/operations/jsonApi/WhereJsonOperation.js +19 -20
- package/lib/queryBuilder/operations/jsonApi/WhereJsonOverlapsOperation.js +23 -21
- package/lib/queryBuilder/operations/jsonApi/mysqlJsonApi.js +106 -118
- package/lib/queryBuilder/operations/jsonApi/postgresJsonApi.js +79 -108
- package/lib/queryBuilder/operations/select/SelectOperation.js +37 -53
- package/lib/queryBuilder/operations/select/Selection.js +94 -105
- package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeMsSqlOperation.js +68 -101
- package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeOperation.js +65 -75
- package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeSqliteOperation.js +75 -84
- package/lib/queryBuilder/parsers/jsonFieldExpressionParser.js +760 -859
- package/lib/queryBuilder/parsers/relationExpressionParser.js +840 -952
- package/lib/queryBuilder/transformations/CompositeQueryTransformation.js +10 -15
- package/lib/queryBuilder/transformations/QueryTransformation.js +4 -6
- package/lib/queryBuilder/transformations/WrapMysqlModifySubqueryTransformation.js +35 -49
- package/lib/queryBuilder/transformations/index.js +3 -9
- package/lib/queryBuilder/whereScopes.js +158 -186
- package/lib/relations/Relation.js +279 -363
- package/lib/relations/RelationDeleteOperation.js +16 -22
- package/lib/relations/RelationFindOperation.js +100 -133
- package/lib/relations/RelationInsertOperation.js +19 -27
- package/lib/relations/RelationOwner.js +167 -204
- package/lib/relations/RelationProperty.js +177 -217
- package/lib/relations/RelationUpdateOperation.js +16 -23
- package/lib/relations/belongsToOne/BelongsToOneDeleteOperation.js +11 -16
- package/lib/relations/belongsToOne/BelongsToOneInsertOperation.js +24 -35
- package/lib/relations/belongsToOne/BelongsToOneRelateOperation.js +30 -41
- package/lib/relations/belongsToOne/BelongsToOneRelation.js +33 -41
- package/lib/relations/belongsToOne/BelongsToOneUnrelateOperation.js +38 -53
- package/lib/relations/hasMany/HasManyInsertOperation.js +35 -51
- package/lib/relations/hasMany/HasManyRelateOperation.js +38 -54
- package/lib/relations/hasMany/HasManyRelation.js +30 -38
- package/lib/relations/hasMany/HasManyUnrelateOperation.js +19 -26
- package/lib/relations/hasOne/HasOneRelation.js +4 -7
- package/lib/relations/hasOneThrough/HasOneThroughRelation.js +4 -7
- package/lib/relations/manyToMany/ManyToManyModifyMixin.js +67 -90
- package/lib/relations/manyToMany/ManyToManyRelation.js +349 -451
- package/lib/relations/manyToMany/ManyToManySqliteModifyMixin.js +19 -26
- package/lib/relations/manyToMany/delete/ManyToManyDeleteOperation.js +3 -5
- package/lib/relations/manyToMany/delete/ManyToManyDeleteOperationBase.js +14 -20
- package/lib/relations/manyToMany/delete/ManyToManyDeleteSqliteOperation.js +3 -7
- package/lib/relations/manyToMany/find/ManyToManyFindOperation.js +71 -94
- package/lib/relations/manyToMany/insert/ManyToManyInsertOperation.js +31 -43
- package/lib/relations/manyToMany/relate/ManyToManyRelateOperation.js +50 -67
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateOperation.js +4 -7
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateOperationBase.js +20 -27
- package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateSqliteOperation.js +5 -10
- package/lib/relations/manyToMany/update/ManyToManyUpdateOperation.js +3 -5
- package/lib/relations/manyToMany/update/ManyToManyUpdateOperationBase.js +55 -72
- package/lib/relations/manyToMany/update/ManyToManyUpdateSqliteOperation.js +3 -7
- package/lib/transaction.js +53 -83
- package/lib/utils/assert.js +15 -21
- package/lib/utils/buildUtils.js +17 -19
- package/lib/utils/classUtils.js +7 -11
- package/lib/utils/cloneDeep.js +365 -0
- package/lib/utils/createModifier.js +36 -41
- package/lib/utils/deprecate.js +8 -12
- package/lib/utils/identifierMapping.js +153 -192
- package/lib/utils/internalPropUtils.js +4 -8
- package/lib/utils/knexUtils.js +61 -56
- package/lib/utils/mixin.js +16 -23
- package/lib/utils/mysqlJsonPath.js +55 -40
- package/lib/utils/normalizeIds.js +110 -127
- package/lib/utils/objectUtils.js +236 -338
- package/lib/utils/parseFieldExpression.js +66 -44
- package/lib/utils/postgresJsonPath.js +48 -62
- package/lib/utils/promiseUtils/after.js +10 -13
- package/lib/utils/promiseUtils/afterReturn.js +10 -13
- package/lib/utils/promiseUtils/index.js +15 -17
- package/lib/utils/promiseUtils/isPromise.js +6 -9
- package/lib/utils/promiseUtils/map.js +75 -89
- package/lib/utils/promiseUtils/mapAfterAllReturn.js +17 -23
- package/lib/utils/promiseUtils/try.js +15 -18
- package/lib/utils/resolveModel.js +91 -94
- package/lib/utils/tmpColumnUtils.js +4 -13
- package/package.json +50 -23
- package/typings/objection/index.d.mts +362 -0
- package/typings/objection/index.d.ts +36 -9
- package/lib/.eslintrc.json +0 -8
- package/lib/queryBuilder/parsers/jsonFieldExpressionParser.pegjs +0 -97
- package/lib/queryBuilder/parsers/relationExpressionParser.pegjs +0 -141
- package/lib/utils/clone.js +0 -2329
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
// Generated by scripts/generate-esm-typings.js from index.d.ts. Do not edit.
|
|
2
|
+
//
|
|
3
|
+
// The types of the ES module entry (lib/index.mjs).
|
|
4
|
+
|
|
5
|
+
import objection from './index.js';
|
|
6
|
+
|
|
7
|
+
export default objection;
|
|
8
|
+
|
|
9
|
+
export import raw = objection.raw;
|
|
10
|
+
export import val = objection.val;
|
|
11
|
+
export import ref = objection.ref;
|
|
12
|
+
export import fn = objection.fn;
|
|
13
|
+
export import compose = objection.compose;
|
|
14
|
+
export import mixin = objection.mixin;
|
|
15
|
+
export import defineRelations = objection.defineRelations;
|
|
16
|
+
export import BelongsToOneRelation = objection.BelongsToOneRelation;
|
|
17
|
+
export import HasOneRelation = objection.HasOneRelation;
|
|
18
|
+
export import HasManyRelation = objection.HasManyRelation;
|
|
19
|
+
export import ManyToManyRelation = objection.ManyToManyRelation;
|
|
20
|
+
export import HasOneThroughRelation = objection.HasOneThroughRelation;
|
|
21
|
+
export import snakeCaseMappers = objection.snakeCaseMappers;
|
|
22
|
+
export import knexSnakeCaseMappers = objection.knexSnakeCaseMappers;
|
|
23
|
+
export import transaction = objection.transaction;
|
|
24
|
+
export import initialize = objection.initialize;
|
|
25
|
+
export import DBError = objection.DBError;
|
|
26
|
+
export import DataError = objection.DataError;
|
|
27
|
+
export import CheckViolationError = objection.CheckViolationError;
|
|
28
|
+
export import UniqueViolationError = objection.UniqueViolationError;
|
|
29
|
+
export import ConstraintViolationError = objection.ConstraintViolationError;
|
|
30
|
+
export import ForeignKeyViolationError = objection.ForeignKeyViolationError;
|
|
31
|
+
export import NotNullViolationError = objection.NotNullViolationError;
|
|
32
|
+
export import RawBuilder = objection.RawBuilder;
|
|
33
|
+
export import RawExpressionBuilder = objection.RawExpressionBuilder;
|
|
34
|
+
export import RawFunction = objection.RawFunction;
|
|
35
|
+
export import RawInterface = objection.RawInterface;
|
|
36
|
+
export import ValueBuilder = objection.ValueBuilder;
|
|
37
|
+
export import ValueFunction = objection.ValueFunction;
|
|
38
|
+
export import ReferenceBuilder = objection.ReferenceBuilder;
|
|
39
|
+
export import ReferenceFunction = objection.ReferenceFunction;
|
|
40
|
+
export import RefColumnName = objection.RefColumnName;
|
|
41
|
+
export import IsJsonType = objection.IsJsonType;
|
|
42
|
+
export import JsonColumnName = objection.JsonColumnName;
|
|
43
|
+
export import JsonFieldPath = objection.JsonFieldPath;
|
|
44
|
+
export import RefExpression = objection.RefExpression;
|
|
45
|
+
export import RefValue = objection.RefValue;
|
|
46
|
+
export import FunctionBuilder = objection.FunctionBuilder;
|
|
47
|
+
export import SqlFunctionShortcut = objection.SqlFunctionShortcut;
|
|
48
|
+
export import AggregateFunctionShortcut = objection.AggregateFunctionShortcut;
|
|
49
|
+
export import AggregateFunctionBuilder = objection.AggregateFunctionBuilder;
|
|
50
|
+
export import WindowFunctionBuilder = objection.WindowFunctionBuilder;
|
|
51
|
+
export import FnWindow = objection.FnWindow;
|
|
52
|
+
export import CaseBuilder = objection.CaseBuilder;
|
|
53
|
+
export import FnResult = objection.FnResult;
|
|
54
|
+
export import SqlBoolean = objection.SqlBoolean;
|
|
55
|
+
export import Typed = objection.Typed;
|
|
56
|
+
export import CompareValue = objection.CompareValue;
|
|
57
|
+
export import ExpressionMethods = objection.ExpressionMethods;
|
|
58
|
+
export import FnNumeric = objection.FnNumeric;
|
|
59
|
+
export import FnArg = objection.FnArg;
|
|
60
|
+
export import FnJsonArg = objection.FnJsonArg;
|
|
61
|
+
export import FnExpression = objection.FnExpression;
|
|
62
|
+
export import FnOrderBy = objection.FnOrderBy;
|
|
63
|
+
export import FnIntervalUnit = objection.FnIntervalUnit;
|
|
64
|
+
export import FnTimestampUnit = objection.FnTimestampUnit;
|
|
65
|
+
export import FunctionFunction = objection.FunctionFunction;
|
|
66
|
+
export import ComposeFunction = objection.ComposeFunction;
|
|
67
|
+
export import Plugin = objection.Plugin;
|
|
68
|
+
export import MixinFunction = objection.MixinFunction;
|
|
69
|
+
export import Aliasable = objection.Aliasable;
|
|
70
|
+
export import Castable = objection.Castable;
|
|
71
|
+
export import Raw = objection.Raw;
|
|
72
|
+
export import Operator = objection.Operator;
|
|
73
|
+
export import ColumnRef = objection.ColumnRef;
|
|
74
|
+
export import TableRef = objection.TableRef;
|
|
75
|
+
export import PrimitiveValue = objection.PrimitiveValue;
|
|
76
|
+
export import Expression = objection.Expression;
|
|
77
|
+
export import Id = objection.Id;
|
|
78
|
+
export import CompositeId = objection.CompositeId;
|
|
79
|
+
export import MaybeCompositeId = objection.MaybeCompositeId;
|
|
80
|
+
export import ExpressionObject = objection.ExpressionObject;
|
|
81
|
+
export import PrimitiveValueObject = objection.PrimitiveValueObject;
|
|
82
|
+
export import CallbackVoid = objection.CallbackVoid;
|
|
83
|
+
export import Identity = objection.Identity;
|
|
84
|
+
export import AnyQueryBuilder = objection.AnyQueryBuilder;
|
|
85
|
+
export import AnyModelConstructor = objection.AnyModelConstructor;
|
|
86
|
+
export import ModifierFunction = objection.ModifierFunction;
|
|
87
|
+
export import Modifier = objection.Modifier;
|
|
88
|
+
export import OrderByDirection = objection.OrderByDirection;
|
|
89
|
+
export import OrderByNulls = objection.OrderByNulls;
|
|
90
|
+
export import Modifiers = objection.Modifiers;
|
|
91
|
+
export import RelationExpression = objection.RelationExpression;
|
|
92
|
+
export import CheckRelationExpression = objection.CheckRelationExpression;
|
|
93
|
+
export import GraphErrors = objection.GraphErrors;
|
|
94
|
+
export import NodeErrors = objection.NodeErrors;
|
|
95
|
+
export import ModifierNameErrors = objection.ModifierNameErrors;
|
|
96
|
+
export import RelationNameKeys = objection.RelationNameKeys;
|
|
97
|
+
export import RelatedModel = objection.RelatedModel;
|
|
98
|
+
export import ElementOrSelf = objection.ElementOrSelf;
|
|
99
|
+
export import IsUncheckedModel = objection.IsUncheckedModel;
|
|
100
|
+
export import Loaded = objection.Loaded;
|
|
101
|
+
export import WithGraph = objection.WithGraph;
|
|
102
|
+
export import WithChildren = objection.WithChildren;
|
|
103
|
+
export import Replace = objection.Replace;
|
|
104
|
+
export import Without = objection.Without;
|
|
105
|
+
export import LoadedRelations = objection.LoadedRelations;
|
|
106
|
+
export import MaybeLoadedRelations = objection.MaybeLoadedRelations;
|
|
107
|
+
export import LoadedRelation = objection.LoadedRelation;
|
|
108
|
+
export import RelationValue = objection.RelationValue;
|
|
109
|
+
export import PreviousRow = objection.PreviousRow;
|
|
110
|
+
export import LoadedNodeRow = objection.LoadedNodeRow;
|
|
111
|
+
export import ApplyNodeModifiers = objection.ApplyNodeModifiers;
|
|
112
|
+
export import ModifiedItem = objection.ModifiedItem;
|
|
113
|
+
export import ReturnedItem = objection.ReturnedItem;
|
|
114
|
+
export import MergeLoaded = objection.MergeLoaded;
|
|
115
|
+
export import Only = objection.Only;
|
|
116
|
+
export import LoadedKeys = objection.LoadedKeys;
|
|
117
|
+
export import WithGraphQueryBuilder = objection.WithGraphQueryBuilder;
|
|
118
|
+
export import StaticFetchGraphMethod = objection.StaticFetchGraphMethod;
|
|
119
|
+
export import StaticFetchGraphQueryBuilder = objection.StaticFetchGraphQueryBuilder;
|
|
120
|
+
export import FetchGraphQueryBuilder = objection.FetchGraphQueryBuilder;
|
|
121
|
+
export import ItemQueryBuilder = objection.ItemQueryBuilder;
|
|
122
|
+
export import ModifiedQueryBuilder = objection.ModifiedQueryBuilder;
|
|
123
|
+
export import ItemType = objection.ItemType;
|
|
124
|
+
export import NonFunctionPropertyNames = objection.NonFunctionPropertyNames;
|
|
125
|
+
export import DataPropertyNames = objection.DataPropertyNames;
|
|
126
|
+
export import Defined = objection.Defined;
|
|
127
|
+
export import ModelObject = objection.ModelObject;
|
|
128
|
+
export import PartialModelObject = objection.PartialModelObject;
|
|
129
|
+
export import JsonFieldKey = objection.JsonFieldKey;
|
|
130
|
+
export import CheckModelUpdate = objection.CheckModelUpdate;
|
|
131
|
+
export import GraphParameters = objection.GraphParameters;
|
|
132
|
+
export import PartialModelGraph = objection.PartialModelGraph;
|
|
133
|
+
export import PartialModelGraphField = objection.PartialModelGraphField;
|
|
134
|
+
export import ModelProps = objection.ModelProps;
|
|
135
|
+
export import ModelDataKeys = objection.ModelDataKeys;
|
|
136
|
+
export import ModelRelations = objection.ModelRelations;
|
|
137
|
+
export import RelatedQueryBuilder = objection.RelatedQueryBuilder;
|
|
138
|
+
export import ArrayRelatedQueryBuilder = objection.ArrayRelatedQueryBuilder;
|
|
139
|
+
export import QueryBuilderType = objection.QueryBuilderType;
|
|
140
|
+
export import ModelType = objection.ModelType;
|
|
141
|
+
export import ResultType = objection.ResultType;
|
|
142
|
+
export import IsAnyType = objection.IsAnyType;
|
|
143
|
+
export import ResultItemOf = objection.ResultItemOf;
|
|
144
|
+
export import IsSingleResult = objection.IsSingleResult;
|
|
145
|
+
export import QueryBuilderState = objection.QueryBuilderState;
|
|
146
|
+
export import QueryBuilderItemState = objection.QueryBuilderItemState;
|
|
147
|
+
export import OpaqueItemState = objection.OpaqueItemState;
|
|
148
|
+
export import CastItemState = objection.CastItemState;
|
|
149
|
+
export import ModelRow = objection.ModelRow;
|
|
150
|
+
export import RequiredRelationKeys = objection.RequiredRelationKeys;
|
|
151
|
+
export import Row = objection.Row;
|
|
152
|
+
export import RelationKeys = objection.RelationKeys;
|
|
153
|
+
export import ModelLike = objection.ModelLike;
|
|
154
|
+
export import MakeOpaque = objection.MakeOpaque;
|
|
155
|
+
export import OpaqueQueryBuilder = objection.OpaqueQueryBuilder;
|
|
156
|
+
export import RowQueryBuilder = objection.RowQueryBuilder;
|
|
157
|
+
export import DefaultQueryBuilderState = objection.DefaultQueryBuilderState;
|
|
158
|
+
export import RebindQueryBuilder = objection.RebindQueryBuilder;
|
|
159
|
+
export import SingleQueryBuilder = objection.SingleQueryBuilder;
|
|
160
|
+
export import MaybeSingleQueryBuilder = objection.MaybeSingleQueryBuilder;
|
|
161
|
+
export import ArrayQueryBuilder = objection.ArrayQueryBuilder;
|
|
162
|
+
export import NumberQueryBuilder = objection.NumberQueryBuilder;
|
|
163
|
+
export import PageQueryBuilder = objection.PageQueryBuilder;
|
|
164
|
+
export import RunAfterResult = objection.RunAfterResult;
|
|
165
|
+
export import ReplaceResultItem = objection.ReplaceResultItem;
|
|
166
|
+
export import ReplaceResultMember = objection.ReplaceResultMember;
|
|
167
|
+
export import ModelClassQueryBuilder = objection.ModelClassQueryBuilder;
|
|
168
|
+
export import InitialQueryBuilder = objection.InitialQueryBuilder;
|
|
169
|
+
export import ForClassMethod = objection.ForClassMethod;
|
|
170
|
+
export import FieldExpression = objection.FieldExpression;
|
|
171
|
+
export import JsonObjectOrFieldExpression = objection.JsonObjectOrFieldExpression;
|
|
172
|
+
export import Selection = objection.Selection;
|
|
173
|
+
export import SelectMethod = objection.SelectMethod;
|
|
174
|
+
export import AsMethod = objection.AsMethod;
|
|
175
|
+
export import FromMethod = objection.FromMethod;
|
|
176
|
+
export import FromRawMethod = objection.FromRawMethod;
|
|
177
|
+
export import JsonExtraction = objection.JsonExtraction;
|
|
178
|
+
export import JsonExtract = objection.JsonExtract;
|
|
179
|
+
export import JsonSet = objection.JsonSet;
|
|
180
|
+
export import JsonInsert = objection.JsonInsert;
|
|
181
|
+
export import JsonRemove = objection.JsonRemove;
|
|
182
|
+
export import WhereMethod = objection.WhereMethod;
|
|
183
|
+
export import WhereRawMethod = objection.WhereRawMethod;
|
|
184
|
+
export import WhereWrappedMethod = objection.WhereWrappedMethod;
|
|
185
|
+
export import WhereExistsMethod = objection.WhereExistsMethod;
|
|
186
|
+
export import WhereInMethod = objection.WhereInMethod;
|
|
187
|
+
export import WhereBetweenMethod = objection.WhereBetweenMethod;
|
|
188
|
+
export import WhereNullMethod = objection.WhereNullMethod;
|
|
189
|
+
export import WhereColumnMethod = objection.WhereColumnMethod;
|
|
190
|
+
export import WhereJsonObject = objection.WhereJsonObject;
|
|
191
|
+
export import WhereJsonPath = objection.WhereJsonPath;
|
|
192
|
+
export import WhereJsonMethod = objection.WhereJsonMethod;
|
|
193
|
+
export import WhereFieldExpressionMethod = objection.WhereFieldExpressionMethod;
|
|
194
|
+
export import WhereJsonExpressionMethod = objection.WhereJsonExpressionMethod;
|
|
195
|
+
export import WhereJsonField = objection.WhereJsonField;
|
|
196
|
+
export import WhereCompositeMethod = objection.WhereCompositeMethod;
|
|
197
|
+
export import WhereInCompositeMethod = objection.WhereInCompositeMethod;
|
|
198
|
+
export import QBOrCallback = objection.QBOrCallback;
|
|
199
|
+
export import BaseSetOperations = objection.BaseSetOperations;
|
|
200
|
+
export import SetOperationsMethod = objection.SetOperationsMethod;
|
|
201
|
+
export import UnionMethod = objection.UnionMethod;
|
|
202
|
+
export import WithMethod = objection.WithMethod;
|
|
203
|
+
export import JoinRelatedOptions = objection.JoinRelatedOptions;
|
|
204
|
+
export import JoinRelatedMethod = objection.JoinRelatedMethod;
|
|
205
|
+
export import JoinMethod = objection.JoinMethod;
|
|
206
|
+
export import CrossJoinMethod = objection.CrossJoinMethod;
|
|
207
|
+
export import JoinValue = objection.JoinValue;
|
|
208
|
+
export import JoinOnMethod = objection.JoinOnMethod;
|
|
209
|
+
export import JoinOnValMethod = objection.JoinOnValMethod;
|
|
210
|
+
export import JoinOnInMethod = objection.JoinOnInMethod;
|
|
211
|
+
export import JoinOnNullMethod = objection.JoinOnNullMethod;
|
|
212
|
+
export import JoinOnExistsMethod = objection.JoinOnExistsMethod;
|
|
213
|
+
export import JoinOnBetweenMethod = objection.JoinOnBetweenMethod;
|
|
214
|
+
export import JoinOnJsonPathEqualsMethod = objection.JoinOnJsonPathEqualsMethod;
|
|
215
|
+
export import JoinBuilder = objection.JoinBuilder;
|
|
216
|
+
export import JoinRawMethod = objection.JoinRawMethod;
|
|
217
|
+
export import IncrementDecrementMethod = objection.IncrementDecrementMethod;
|
|
218
|
+
export import AggregateMethod = objection.AggregateMethod;
|
|
219
|
+
export import CountMethod = objection.CountMethod;
|
|
220
|
+
export import GroupByMethod = objection.GroupByMethod;
|
|
221
|
+
export import OrderByDescriptor = objection.OrderByDescriptor;
|
|
222
|
+
export import ColumnRefOrOrderByDescriptor = objection.ColumnRefOrOrderByDescriptor;
|
|
223
|
+
export import OrderByMethod = objection.OrderByMethod;
|
|
224
|
+
export import OrderByRawMethod = objection.OrderByRawMethod;
|
|
225
|
+
export import FirstMethod = objection.FirstMethod;
|
|
226
|
+
export import ForIdValue = objection.ForIdValue;
|
|
227
|
+
export import WithGraphMethod = objection.WithGraphMethod;
|
|
228
|
+
export import GraphModel = objection.GraphModel;
|
|
229
|
+
export import RelationsModel = objection.RelationsModel;
|
|
230
|
+
export import AllowGraphMethod = objection.AllowGraphMethod;
|
|
231
|
+
export import IdentityMethod = objection.IdentityMethod;
|
|
232
|
+
export import OneArgMethod = objection.OneArgMethod;
|
|
233
|
+
export import StringReturningMethod = objection.StringReturningMethod;
|
|
234
|
+
export import BooleanReturningMethod = objection.BooleanReturningMethod;
|
|
235
|
+
export import HasMethod = objection.HasMethod;
|
|
236
|
+
export import ClearMethod = objection.ClearMethod;
|
|
237
|
+
export import ColumnInfoMethod = objection.ColumnInfoMethod;
|
|
238
|
+
export import TableRefForMethod = objection.TableRefForMethod;
|
|
239
|
+
export import AliasForMethod = objection.AliasForMethod;
|
|
240
|
+
export import ModelClassMethod = objection.ModelClassMethod;
|
|
241
|
+
export import ReturningMethod = objection.ReturningMethod;
|
|
242
|
+
export import TimeoutOptions = objection.TimeoutOptions;
|
|
243
|
+
export import TimeoutMethod = objection.TimeoutMethod;
|
|
244
|
+
export import Page = objection.Page;
|
|
245
|
+
export import RunBeforeCallback = objection.RunBeforeCallback;
|
|
246
|
+
export import RunBeforeMethod = objection.RunBeforeMethod;
|
|
247
|
+
export import RunAfterCallback = objection.RunAfterCallback;
|
|
248
|
+
export import RunAfterMethod = objection.RunAfterMethod;
|
|
249
|
+
export import OnBuildMethod = objection.OnBuildMethod;
|
|
250
|
+
export import OnBuildKnexCallback = objection.OnBuildKnexCallback;
|
|
251
|
+
export import OnBuildKnexMethod = objection.OnBuildKnexMethod;
|
|
252
|
+
export import OnErrorCallback = objection.OnErrorCallback;
|
|
253
|
+
export import OnErrorMethod = objection.OnErrorMethod;
|
|
254
|
+
export import InsertGraphOptions = objection.InsertGraphOptions;
|
|
255
|
+
export import InsertGraphMethod = objection.InsertGraphMethod;
|
|
256
|
+
export import UpsertGraphOptions = objection.UpsertGraphOptions;
|
|
257
|
+
export import UpsertGraphMethod = objection.UpsertGraphMethod;
|
|
258
|
+
export import GraphExpressionObjectMethod = objection.GraphExpressionObjectMethod;
|
|
259
|
+
export import GraphOptions = objection.GraphOptions;
|
|
260
|
+
export import ModifyGraphMethod = objection.ModifyGraphMethod;
|
|
261
|
+
export import CheckGraphPath = objection.CheckGraphPath;
|
|
262
|
+
export import GraphPathErrors = objection.GraphPathErrors;
|
|
263
|
+
export import GraphPathStep = objection.GraphPathStep;
|
|
264
|
+
export import ModelOfRow = objection.ModelOfRow;
|
|
265
|
+
export import GraphPathQueryBuilder = objection.GraphPathQueryBuilder;
|
|
266
|
+
export import GraphPathTarget = objection.GraphPathTarget;
|
|
267
|
+
export import IsUnion = objection.IsUnion;
|
|
268
|
+
export import ContextMethod = objection.ContextMethod;
|
|
269
|
+
export import ClearContextMethod = objection.ClearContextMethod;
|
|
270
|
+
export import ModifierArgs = objection.ModifierArgs;
|
|
271
|
+
export import CheckModifierModel = objection.CheckModifierModel;
|
|
272
|
+
export import ModifyMethod = objection.ModifyMethod;
|
|
273
|
+
export import ChecksModifierNames = objection.ChecksModifierNames;
|
|
274
|
+
export import QueryModifiers = objection.QueryModifiers;
|
|
275
|
+
export import ModifierNameOf = objection.ModifierNameOf;
|
|
276
|
+
export import NamedModifierArgs = objection.NamedModifierArgs;
|
|
277
|
+
export import CheckModifierName = objection.CheckModifierName;
|
|
278
|
+
export import CheckModifierList = objection.CheckModifierList;
|
|
279
|
+
export import ModifiersMethod = objection.ModifiersMethod;
|
|
280
|
+
export import Pojo = objection.Pojo;
|
|
281
|
+
export import CatchablePromiseLike = objection.CatchablePromiseLike;
|
|
282
|
+
export import QueryBuilder = objection.QueryBuilder;
|
|
283
|
+
export import X = objection.X;
|
|
284
|
+
export import FetchGraphOptions = objection.FetchGraphOptions;
|
|
285
|
+
export import TraverserFunction = objection.TraverserFunction;
|
|
286
|
+
export import ArrayQueryBuilderThunk = objection.ArrayQueryBuilderThunk;
|
|
287
|
+
export import CancelQueryThunk = objection.CancelQueryThunk;
|
|
288
|
+
export import StaticHookArguments = objection.StaticHookArguments;
|
|
289
|
+
export import Transaction = objection.Transaction;
|
|
290
|
+
export import TransactionOrKnex = objection.TransactionOrKnex;
|
|
291
|
+
export import RelationMappings = objection.RelationMappings;
|
|
292
|
+
export import RelationMappingsThunk = objection.RelationMappingsThunk;
|
|
293
|
+
export import ModelClassFactory = objection.ModelClassFactory;
|
|
294
|
+
export import ModelClassSpecifier = objection.ModelClassSpecifier;
|
|
295
|
+
export import RelationMappingHook = objection.RelationMappingHook;
|
|
296
|
+
export import StringOrReferenceBuilder = objection.StringOrReferenceBuilder;
|
|
297
|
+
export import RelationMappingColumnRef = objection.RelationMappingColumnRef;
|
|
298
|
+
export import RelationMapping = objection.RelationMapping;
|
|
299
|
+
export import RelationJoin = objection.RelationJoin;
|
|
300
|
+
export import RelationThrough = objection.RelationThrough;
|
|
301
|
+
export import RelationCardinality = objection.RelationCardinality;
|
|
302
|
+
export import RelationType = objection.RelationType;
|
|
303
|
+
export import RelationMappingsOf = objection.RelationMappingsOf;
|
|
304
|
+
export import InferredRelationMappings = objection.InferredRelationMappings;
|
|
305
|
+
export import RelatedModelClassOf = objection.RelatedModelClassOf;
|
|
306
|
+
export import RelatedModelOf = objection.RelatedModelOf;
|
|
307
|
+
export import RelationExtraColumns = objection.RelationExtraColumns;
|
|
308
|
+
export import RelationExtraProps = objection.RelationExtraProps;
|
|
309
|
+
export import WithRelationExtraProps = objection.WithRelationExtraProps;
|
|
310
|
+
export import RelationPropertyType = objection.RelationPropertyType;
|
|
311
|
+
export import RelationsOf = objection.RelationsOf;
|
|
312
|
+
export import InferredRelationProps = objection.InferredRelationProps;
|
|
313
|
+
export import ModelInstance = objection.ModelInstance;
|
|
314
|
+
export import WithModelModifiers = objection.WithModelModifiers;
|
|
315
|
+
export import ModelModifiers = objection.ModelModifiers;
|
|
316
|
+
export import ModifiersOf = objection.ModifiersOf;
|
|
317
|
+
export import KnownModifiers = objection.KnownModifiers;
|
|
318
|
+
export import RelationNamesOf = objection.RelationNamesOf;
|
|
319
|
+
export import RelationQueryBuilder = objection.RelationQueryBuilder;
|
|
320
|
+
export import UnknownRelationName = objection.UnknownRelationName;
|
|
321
|
+
export import RelationMappingsDefinition = objection.RelationMappingsDefinition;
|
|
322
|
+
export import DefineRelationsFunction = objection.DefineRelationsFunction;
|
|
323
|
+
export import Relation = objection.Relation;
|
|
324
|
+
export import RelationProperty = objection.RelationProperty;
|
|
325
|
+
export import Relations = objection.Relations;
|
|
326
|
+
export import QueryContext = objection.QueryContext;
|
|
327
|
+
export import ModelOptions = objection.ModelOptions;
|
|
328
|
+
export import CloneOptions = objection.CloneOptions;
|
|
329
|
+
export import ToJsonOptions = objection.ToJsonOptions;
|
|
330
|
+
export import ValidatorContext = objection.ValidatorContext;
|
|
331
|
+
export import ValidatorArgs = objection.ValidatorArgs;
|
|
332
|
+
export import Validator = objection.Validator;
|
|
333
|
+
export import AjvConfig = objection.AjvConfig;
|
|
334
|
+
export import AjvValidator = objection.AjvValidator;
|
|
335
|
+
export import SnakeCaseMappersOptions = objection.SnakeCaseMappersOptions;
|
|
336
|
+
export import ColumnNameMappers = objection.ColumnNameMappers;
|
|
337
|
+
export import SnakeCaseMappersFactory = objection.SnakeCaseMappersFactory;
|
|
338
|
+
export import KnexMappers = objection.KnexMappers;
|
|
339
|
+
export import KnexSnakeCaseMappersFactory = objection.KnexSnakeCaseMappersFactory;
|
|
340
|
+
export import ValidationErrorType = objection.ValidationErrorType;
|
|
341
|
+
export import ValidationError = objection.ValidationError;
|
|
342
|
+
export import ValidationErrorItem = objection.ValidationErrorItem;
|
|
343
|
+
export import ErrorHash = objection.ErrorHash;
|
|
344
|
+
export import CreateValidationErrorArgs = objection.CreateValidationErrorArgs;
|
|
345
|
+
export import NotFoundError = objection.NotFoundError;
|
|
346
|
+
export import CreateNotFoundErrorArgs = objection.CreateNotFoundErrorArgs;
|
|
347
|
+
export import TableMetadata = objection.TableMetadata;
|
|
348
|
+
export import TableMetadataOptions = objection.TableMetadataOptions;
|
|
349
|
+
export import FetchTableMetadataOptions = objection.FetchTableMetadataOptions;
|
|
350
|
+
export import Constructor = objection.Constructor;
|
|
351
|
+
export import PrototypeType = objection.PrototypeType;
|
|
352
|
+
export import ConstructorFunctionType = objection.ConstructorFunctionType;
|
|
353
|
+
export import ConstructorType = objection.ConstructorType;
|
|
354
|
+
export import ModelConstructor = objection.ModelConstructor;
|
|
355
|
+
export import ModelClass = objection.ModelClass;
|
|
356
|
+
export import Model = objection.Model;
|
|
357
|
+
export import JSONSchemaTypeName = objection.JSONSchemaTypeName;
|
|
358
|
+
export import JSONSchemaType = objection.JSONSchemaType;
|
|
359
|
+
export import JSONSchemaArray = objection.JSONSchemaArray;
|
|
360
|
+
export import JSONSchemaVersion = objection.JSONSchemaVersion;
|
|
361
|
+
export import JSONSchemaDefinition = objection.JSONSchemaDefinition;
|
|
362
|
+
export import JSONSchema = objection.JSONSchema;
|
|
@@ -15,12 +15,7 @@
|
|
|
15
15
|
import Ajv, { Options as AjvOptions } from 'ajv';
|
|
16
16
|
import * as dbErrors from 'db-errors';
|
|
17
17
|
import { Knex } from 'knex';
|
|
18
|
-
import {
|
|
19
|
-
GraphNode,
|
|
20
|
-
ParseError,
|
|
21
|
-
ParseRelationExpression,
|
|
22
|
-
UnknownGraph,
|
|
23
|
-
} from './relation-expression';
|
|
18
|
+
import { GraphNode, ParseError, ParseRelationExpression } from './relation-expression';
|
|
24
19
|
|
|
25
20
|
// Export the entire Objection namespace.
|
|
26
21
|
export = Objection;
|
|
@@ -2221,6 +2216,9 @@ declare namespace Objection {
|
|
|
2221
2216
|
|
|
2222
2217
|
using(columns: string | readonly string[] | Raw | { [key: string]: string | Raw }): JoinBuilder;
|
|
2223
2218
|
type(type: string): JoinBuilder;
|
|
2219
|
+
|
|
2220
|
+
/** Makes the next condition an `or`: `join.on(a, b).or.on(c, d)`. */
|
|
2221
|
+
readonly or: JoinBuilder;
|
|
2224
2222
|
}
|
|
2225
2223
|
|
|
2226
2224
|
interface JoinRawMethod<QB extends AnyQueryBuilder> extends RawInterface<QB> {}
|
|
@@ -2713,6 +2711,17 @@ declare namespace Objection {
|
|
|
2713
2711
|
from: FromMethod<this>;
|
|
2714
2712
|
table: FromMethod<this>;
|
|
2715
2713
|
into: FromMethod<this>;
|
|
2714
|
+
/** The table to update from (`update ... from`), postgres only. */
|
|
2715
|
+
updateFrom: FromMethod<this>;
|
|
2716
|
+
/** Tables to delete using (`delete ... using`), postgres only. */
|
|
2717
|
+
using(tables: string | readonly string[]): this;
|
|
2718
|
+
|
|
2719
|
+
/** Adds an SQL comment before the query: `/* comment *\/ select ...`. */
|
|
2720
|
+
comment(comment: string): this;
|
|
2721
|
+
/** Adds optimizer hints to the query: `select /*+ hint *\/ ...`. */
|
|
2722
|
+
hintComment(hints: string | readonly string[]): this;
|
|
2723
|
+
/** Options passed to the database driver. */
|
|
2724
|
+
options(options: Readonly<{ [key: string]: any }>): this;
|
|
2716
2725
|
fromRaw: FromRawMethod<this>;
|
|
2717
2726
|
|
|
2718
2727
|
jsonExtract: JsonExtract<this>;
|
|
@@ -2831,23 +2840,31 @@ declare namespace Objection {
|
|
|
2831
2840
|
orHavingRaw: WhereRawMethod<this>;
|
|
2832
2841
|
|
|
2833
2842
|
havingIn: WhereInMethod<this>;
|
|
2843
|
+
andHavingIn: WhereInMethod<this>;
|
|
2834
2844
|
orHavingIn: WhereInMethod<this>;
|
|
2835
2845
|
havingNotIn: WhereInMethod<this>;
|
|
2846
|
+
andHavingNotIn: WhereInMethod<this>;
|
|
2836
2847
|
orHavingNotIn: WhereInMethod<this>;
|
|
2837
2848
|
|
|
2838
2849
|
havingNull: WhereNullMethod<this>;
|
|
2850
|
+
andHavingNull: WhereNullMethod<this>;
|
|
2839
2851
|
orHavingNull: WhereNullMethod<this>;
|
|
2840
2852
|
havingNotNull: WhereNullMethod<this>;
|
|
2853
|
+
andHavingNotNull: WhereNullMethod<this>;
|
|
2841
2854
|
orHavingNotNull: WhereNullMethod<this>;
|
|
2842
2855
|
|
|
2843
2856
|
havingExists: WhereExistsMethod<this>;
|
|
2857
|
+
andHavingExists: WhereExistsMethod<this>;
|
|
2844
2858
|
orHavingExists: WhereExistsMethod<this>;
|
|
2845
2859
|
havingNotExists: WhereExistsMethod<this>;
|
|
2860
|
+
andHavingNotExists: WhereExistsMethod<this>;
|
|
2846
2861
|
orHavingNotExists: WhereExistsMethod<this>;
|
|
2847
2862
|
|
|
2848
2863
|
havingBetween: WhereBetweenMethod<this>;
|
|
2864
|
+
andHavingBetween: WhereBetweenMethod<this>;
|
|
2849
2865
|
orHavingBetween: WhereBetweenMethod<this>;
|
|
2850
2866
|
havingNotBetween: WhereBetweenMethod<this>;
|
|
2867
|
+
andHavingNotBetween: WhereBetweenMethod<this>;
|
|
2851
2868
|
orHavingNotBetween: WhereBetweenMethod<this>;
|
|
2852
2869
|
|
|
2853
2870
|
whereComposite: WhereCompositeMethod<this>;
|
|
@@ -3057,6 +3074,8 @@ declare namespace Objection {
|
|
|
3057
3074
|
clearSelect: IdentityMethod<this>;
|
|
3058
3075
|
clearOrder: IdentityMethod<this>;
|
|
3059
3076
|
clearWhere: IdentityMethod<this>;
|
|
3077
|
+
clearGroup: IdentityMethod<this>;
|
|
3078
|
+
clearHaving: IdentityMethod<this>;
|
|
3060
3079
|
clearWithGraph: IdentityMethod<this>;
|
|
3061
3080
|
clearAllowGraph: IdentityMethod<this>;
|
|
3062
3081
|
|
|
@@ -3071,6 +3090,8 @@ declare namespace Objection {
|
|
|
3071
3090
|
catch<FR = never>(
|
|
3072
3091
|
onrejected?: ((reason: any) => FR | PromiseLike<FR>) | undefined | null,
|
|
3073
3092
|
): Promise<R | FR>;
|
|
3093
|
+
|
|
3094
|
+
finally(onfinally?: (() => void) | undefined | null): Promise<R>;
|
|
3074
3095
|
}
|
|
3075
3096
|
|
|
3076
3097
|
type X<T> = Promise<T>;
|
|
@@ -3169,10 +3190,14 @@ declare namespace Objection {
|
|
|
3169
3190
|
type RelatedModelClassOf<C> =
|
|
3170
3191
|
IsAnyType<C> extends true
|
|
3171
3192
|
? never
|
|
3172
|
-
: C extends abstract new (
|
|
3193
|
+
: C extends abstract new (
|
|
3194
|
+
...args: any[]
|
|
3195
|
+
) => Model
|
|
3173
3196
|
? C
|
|
3174
3197
|
: C extends () => infer K
|
|
3175
|
-
? K extends abstract new (
|
|
3198
|
+
? K extends abstract new (
|
|
3199
|
+
...args: any[]
|
|
3200
|
+
) => Model
|
|
3176
3201
|
? K
|
|
3177
3202
|
: never
|
|
3178
3203
|
: never;
|
|
@@ -3257,7 +3282,9 @@ declare namespace Objection {
|
|
|
3257
3282
|
* The instance type of model class `MC`, including the relation properties
|
|
3258
3283
|
* inferred from its `relationMappings` that the class doesn't declare.
|
|
3259
3284
|
*/
|
|
3260
|
-
export type ModelInstance<MC> = MC extends abstract new (
|
|
3285
|
+
export type ModelInstance<MC> = MC extends abstract new (
|
|
3286
|
+
...args: any[]
|
|
3287
|
+
) => infer I
|
|
3261
3288
|
? WithModelModifiers<
|
|
3262
3289
|
MC,
|
|
3263
3290
|
[Exclude<keyof RelationMappingsOf<MC>, keyof I>] extends [never]
|
package/lib/.eslintrc.json
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parser for parsing field expressions.
|
|
3
|
-
*
|
|
4
|
-
* Syntax: <column reference>[:<json field reference>]
|
|
5
|
-
*
|
|
6
|
-
* e.g. `Person.jsonColumnName:details.names[1]` would refer to value `'Second'`
|
|
7
|
-
* in column `Person.jsonColumnName` which has
|
|
8
|
-
* `{ details: { names: ['First', 'Second', 'Last'] } }` object stored in it.
|
|
9
|
-
*
|
|
10
|
-
* First part <column reference> is compatible with column references used in
|
|
11
|
-
* knex e.g. "MyFancyTable.tributeToThBestColumnNameEver".
|
|
12
|
-
*
|
|
13
|
-
* Second part describes a path to an attribute inside the referred column.
|
|
14
|
-
* It is optional and it always starts with colon which follows directly with
|
|
15
|
-
* first path element. e.g. `Table.jsonObjectColumnName:jsonFieldName` or
|
|
16
|
-
* `Table.jsonArrayColumn:[321]`.
|
|
17
|
-
*
|
|
18
|
-
* Syntax supports `[<key or index>]` and `.<key or index>` flavors of reference
|
|
19
|
-
* to json keys / array indexes:
|
|
20
|
-
*
|
|
21
|
-
* e.g. both `Table.myColumn:[1][3]` and `Table.myColumn:1.3` would access correctly
|
|
22
|
-
* both of the following objects `[null, [null,null,null, "I was accessed"]]` and
|
|
23
|
-
* `{ "1": { "3" : "I was accessed" } }`
|
|
24
|
-
*
|
|
25
|
-
* Caveats when using special characters in keys:
|
|
26
|
-
*
|
|
27
|
-
* 1. `objectColumn.key` This is the most common syntax, good if you are
|
|
28
|
-
* not using dots or square brackets `[]` in your json object key name.
|
|
29
|
-
* 2. Keys containing dots `objectColumn:[keywith.dots]` Column `{ "keywith.dots" : "I was referred" }`
|
|
30
|
-
* 3. Keys containing square brackets `column['[]']` `{ "[]" : "This is getting ridiculous..." }`
|
|
31
|
-
* 4. Keys containing square brackets and quotes
|
|
32
|
-
* `objectColumn:['Double."Quote".[]']` and `objectColumn:["Sinlge.'Quote'.[]"]`
|
|
33
|
-
* Column `{ "Double.\"Quote\".[]" : "I was referred", "Sinlge.'Quote'.[]" : "Mee too!" }`
|
|
34
|
-
* 99. Keys containing dots, square brackets, single quotes and double quotes in one json key is
|
|
35
|
-
* not currently supported
|
|
36
|
-
*
|
|
37
|
-
* For compiling this to parser run `pegjs JsonFieldExpressionParser.pegjs` which generates
|
|
38
|
-
* the `JsonFieldExpressionParser.js`
|
|
39
|
-
*
|
|
40
|
-
* For development there is nice page for interactively hacking parser code
|
|
41
|
-
* http://pegjs.org/online
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
start =
|
|
45
|
-
column:stringWithoutColon
|
|
46
|
-
refs:(':'
|
|
47
|
-
(bracketIndexRef / bracketStringRef / colonReference)
|
|
48
|
-
(bracketIndexRef / bracketStringRef / dotReference)*
|
|
49
|
-
)?
|
|
50
|
-
{
|
|
51
|
-
var access = [];
|
|
52
|
-
if (refs) {
|
|
53
|
-
var firstAccess = refs[1];
|
|
54
|
-
access = refs[2];
|
|
55
|
-
access.unshift(firstAccess);
|
|
56
|
-
}
|
|
57
|
-
return { columnName: column, access: access };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
bracketStringRef =
|
|
61
|
-
'['
|
|
62
|
-
key:(
|
|
63
|
-
'"' stringWithoutDoubleQuotes '"' /
|
|
64
|
-
"'" stringWithoutSingleQuotes "'" /
|
|
65
|
-
stringWithoutSquareBrackets
|
|
66
|
-
)
|
|
67
|
-
']'
|
|
68
|
-
{ return { type: 'object', ref: Array.isArray(key) ? key[1] : key }; }
|
|
69
|
-
|
|
70
|
-
bracketIndexRef =
|
|
71
|
-
'[' index:integer ']'
|
|
72
|
-
{ return { type: 'array', ref: parseInt(index, 10) }; }
|
|
73
|
-
|
|
74
|
-
colonReference =
|
|
75
|
-
key:stringWithoutSquareBracketsOrDots
|
|
76
|
-
{ return { type: 'object', ref: key }; }
|
|
77
|
-
|
|
78
|
-
dotReference =
|
|
79
|
-
'.' key:stringWithoutSquareBracketsOrDots
|
|
80
|
-
{ return { type: 'object', ref: key }; }
|
|
81
|
-
|
|
82
|
-
stringWithoutSquareBrackets =
|
|
83
|
-
chars:([^\x5D\x5B])+ { return chars.join(""); }
|
|
84
|
-
|
|
85
|
-
stringWithoutColon =
|
|
86
|
-
chars:([^:])+ { return chars.join(""); }
|
|
87
|
-
|
|
88
|
-
stringWithoutDoubleQuotes =
|
|
89
|
-
chars:([^"])+ { return chars.join(""); }
|
|
90
|
-
|
|
91
|
-
stringWithoutSingleQuotes =
|
|
92
|
-
chars:([^'])+ { return chars.join(""); }
|
|
93
|
-
|
|
94
|
-
stringWithoutSquareBracketsOrDots =
|
|
95
|
-
chars:([^.\x5D\x5B])+ { return chars.join(""); }
|
|
96
|
-
|
|
97
|
-
integer = digits:[0-9]+ { return digits.join(""); }
|