@decaf-ts/core 0.3.37 → 0.3.38
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/LICENSE.md +0 -0
- package/README.md +37 -243
- package/dist/core.js +2 -0
- package/dist/{core.bundle.min.js.LICENSE.txt → core.js.LICENSE.txt} +0 -0
- package/dist/esm/core.js +2 -0
- package/dist/esm/{core.bundle.min.esm.js.LICENSE.txt → core.js.LICENSE.txt} +0 -0
- package/dist/{lib → types}/identity/decorators.d.ts +1 -1
- package/dist/{lib → types}/identity/index.d.ts +0 -0
- package/dist/{lib → types}/identity/utils.d.ts +0 -0
- package/{lib/esm → dist/types}/index.d.ts +1 -1
- package/dist/{lib → types}/interfaces/Builder.d.ts +0 -0
- package/dist/{lib → types}/interfaces/Executor.d.ts +0 -0
- package/dist/{lib → types}/interfaces/Observable.d.ts +0 -0
- package/dist/{lib → types}/interfaces/Observer.d.ts +0 -0
- package/dist/{lib → types}/interfaces/Paginatable.d.ts +0 -0
- package/dist/{lib → types}/interfaces/Queriable.d.ts +0 -0
- package/dist/{lib → types}/interfaces/RawExecutor.d.ts +0 -0
- package/dist/{lib → types}/interfaces/SequenceOptions.d.ts +0 -0
- package/dist/{lib → types}/interfaces/index.d.ts +0 -0
- package/dist/{lib → types}/model/BaseModel.d.ts +0 -0
- package/dist/{lib → types}/model/IdentifiedBaseModel.d.ts +0 -0
- package/dist/{lib → types}/model/User.d.ts +0 -0
- package/{lib → dist/types}/model/construction.d.ts +1 -1
- package/dist/{lib → types}/model/decorators.d.ts +0 -0
- package/dist/{lib → types}/model/index.d.ts +0 -0
- package/dist/{lib → types}/model/types.d.ts +0 -0
- package/dist/{lib → types}/persistence/Adapter.d.ts +0 -0
- package/dist/{lib → types}/persistence/Sequence.d.ts +0 -0
- package/dist/{lib → types}/persistence/constants.d.ts +0 -0
- package/dist/{lib → types}/persistence/decorators.d.ts +0 -0
- package/dist/{lib → types}/persistence/errors.d.ts +0 -0
- package/dist/{lib → types}/persistence/index.d.ts +0 -0
- package/dist/{lib → types}/query/Clause.d.ts +0 -0
- package/dist/{lib → types}/query/ClauseFactory.d.ts +0 -0
- package/dist/{lib → types}/query/Condition.d.ts +0 -0
- package/dist/{lib → types}/query/Paginator.d.ts +0 -0
- package/dist/{lib → types}/query/Query.d.ts +0 -0
- package/dist/{lib → types}/query/Statement.d.ts +0 -0
- package/dist/{lib → types}/query/clauses/FromClause.d.ts +0 -0
- package/dist/{lib → types}/query/clauses/GroupByClause.d.ts +0 -0
- package/dist/{lib → types}/query/clauses/InsertClause.d.ts +0 -0
- package/dist/{lib → types}/query/clauses/LimitClause.d.ts +0 -0
- package/dist/{lib → types}/query/clauses/OffsetClause.d.ts +0 -0
- package/dist/{lib → types}/query/clauses/OrderByClause.d.ts +0 -0
- package/dist/{lib → types}/query/clauses/SelectClause.d.ts +0 -0
- package/dist/{lib → types}/query/clauses/SelectorBasedClause.d.ts +0 -0
- package/dist/{lib → types}/query/clauses/ValuesClause.d.ts +0 -0
- package/dist/{lib → types}/query/clauses/WhereClause.d.ts +0 -0
- package/dist/{lib → types}/query/clauses/index.d.ts +0 -0
- package/dist/{lib → types}/query/constants.d.ts +0 -0
- package/dist/{lib → types}/query/errors.d.ts +0 -0
- package/dist/{lib → types}/query/index.d.ts +0 -0
- package/dist/{lib → types}/query/options.d.ts +0 -0
- package/dist/{lib → types}/query/selectors.d.ts +0 -0
- package/dist/{lib → types}/query/types.d.ts +0 -0
- package/dist/{lib → types}/repository/Context.d.ts +0 -0
- package/dist/{lib → types}/repository/Repository.d.ts +0 -0
- package/dist/{lib → types}/repository/constants.d.ts +0 -0
- package/dist/{lib → types}/repository/decorators.d.ts +0 -0
- package/dist/{lib → types}/repository/errors.d.ts +0 -0
- package/dist/{lib → types}/repository/index.d.ts +0 -0
- package/dist/{lib → types}/repository/injectables.d.ts +0 -0
- package/dist/{lib → types}/repository/types.d.ts +0 -0
- package/dist/{lib → types}/repository/utils.d.ts +0 -0
- package/dist/{lib → types}/validators/ClauseSequenceValidator.d.ts +3 -3
- package/dist/{lib → types}/validators/decorators.d.ts +0 -0
- package/dist/{lib → types}/validators/index.d.ts +0 -0
- package/lib/esm/identity/decorators.js +1 -1
- package/lib/esm/identity/index.js +1 -1
- package/lib/esm/identity/utils.js +1 -1
- package/lib/esm/index.js +2 -2
- package/lib/esm/interfaces/Builder.js +1 -1
- package/lib/esm/interfaces/Executor.js +1 -1
- package/lib/esm/interfaces/Observable.js +1 -1
- package/lib/esm/interfaces/Observer.js +1 -1
- package/lib/esm/interfaces/Paginatable.js +1 -1
- package/lib/esm/interfaces/Queriable.js +1 -1
- package/lib/esm/interfaces/RawExecutor.js +1 -1
- package/lib/esm/interfaces/SequenceOptions.js +1 -1
- package/lib/esm/interfaces/index.js +1 -1
- package/lib/esm/model/BaseModel.js +1 -1
- package/lib/esm/model/IdentifiedBaseModel.js +1 -1
- package/lib/esm/model/User.js +1 -1
- package/lib/esm/model/construction.js +1 -1
- package/lib/esm/model/decorators.js +1 -1
- package/lib/esm/model/index.js +1 -1
- package/lib/esm/model/types.js +1 -1
- package/lib/esm/persistence/Adapter.js +1 -1
- package/lib/esm/persistence/Sequence.js +1 -1
- package/lib/esm/persistence/constants.js +1 -1
- package/lib/esm/persistence/decorators.js +1 -1
- package/lib/esm/persistence/errors.js +1 -1
- package/lib/esm/persistence/index.js +1 -1
- package/lib/esm/query/Clause.js +1 -1
- package/lib/esm/query/ClauseFactory.js +1 -1
- package/lib/esm/query/Condition.js +1 -1
- package/lib/esm/query/Paginator.js +1 -1
- package/lib/esm/query/Query.js +1 -1
- package/lib/esm/query/Statement.js +1 -1
- package/lib/esm/query/clauses/FromClause.js +1 -1
- package/lib/esm/query/clauses/GroupByClause.js +1 -1
- package/lib/esm/query/clauses/InsertClause.js +1 -1
- package/lib/esm/query/clauses/LimitClause.js +1 -1
- package/lib/esm/query/clauses/OffsetClause.js +1 -1
- package/lib/esm/query/clauses/OrderByClause.js +1 -1
- package/lib/esm/query/clauses/SelectClause.js +1 -1
- package/lib/esm/query/clauses/SelectorBasedClause.js +1 -1
- package/lib/esm/query/clauses/ValuesClause.js +1 -1
- package/lib/esm/query/clauses/WhereClause.js +72 -0
- package/lib/esm/query/clauses/index.js +12 -0
- package/lib/esm/query/constants.js +1 -1
- package/lib/esm/query/errors.js +1 -1
- package/lib/esm/query/index.js +1 -1
- package/lib/esm/query/options.js +1 -1
- package/lib/esm/query/selectors.js +1 -1
- package/lib/esm/query/types.js +1 -1
- package/lib/esm/repository/Context.js +1 -1
- package/lib/esm/repository/Repository.js +1 -1
- package/lib/esm/repository/constants.js +1 -1
- package/lib/esm/repository/decorators.js +1 -1
- package/lib/esm/repository/errors.js +1 -1
- package/lib/esm/repository/index.js +1 -1
- package/lib/esm/repository/injectables.js +1 -1
- package/lib/esm/repository/types.js +1 -1
- package/lib/esm/repository/utils.js +1 -1
- package/lib/esm/validators/ClauseSequenceValidator.js +8 -8
- package/lib/esm/validators/decorators.js +1 -1
- package/lib/esm/validators/index.js +1 -1
- package/lib/identity/decorators.cjs +2 -0
- package/lib/identity/index.cjs +2 -0
- package/lib/identity/utils.cjs +2 -0
- package/lib/index.cjs +3 -1
- package/lib/interfaces/Builder.cjs +2 -0
- package/lib/interfaces/Executor.cjs +2 -0
- package/lib/interfaces/Observable.cjs +2 -0
- package/lib/interfaces/Observer.cjs +2 -0
- package/lib/interfaces/Paginatable.cjs +2 -0
- package/lib/interfaces/Queriable.cjs +2 -0
- package/lib/interfaces/RawExecutor.cjs +2 -0
- package/lib/interfaces/SequenceOptions.cjs +2 -0
- package/lib/interfaces/index.cjs +2 -0
- package/lib/model/BaseModel.cjs +2 -0
- package/lib/model/IdentifiedBaseModel.cjs +2 -0
- package/lib/model/User.cjs +2 -0
- package/lib/model/construction.cjs +2 -0
- package/lib/model/decorators.cjs +2 -0
- package/lib/model/index.cjs +2 -0
- package/lib/model/types.cjs +2 -0
- package/lib/persistence/Adapter.cjs +2 -0
- package/lib/persistence/Sequence.cjs +2 -0
- package/lib/persistence/constants.cjs +2 -0
- package/lib/persistence/decorators.cjs +2 -0
- package/lib/persistence/errors.cjs +2 -0
- package/lib/persistence/index.cjs +2 -0
- package/lib/query/Clause.cjs +2 -0
- package/lib/query/ClauseFactory.cjs +2 -0
- package/lib/query/Condition.cjs +2 -0
- package/lib/query/Paginator.cjs +2 -0
- package/lib/query/Query.cjs +2 -0
- package/lib/query/Statement.cjs +2 -0
- package/lib/query/clauses/FromClause.cjs +2 -0
- package/lib/query/clauses/GroupByClause.cjs +2 -0
- package/lib/query/clauses/InsertClause.cjs +2 -0
- package/lib/query/clauses/LimitClause.cjs +2 -0
- package/lib/query/clauses/OffsetClause.cjs +2 -0
- package/lib/query/clauses/OrderByClause.cjs +2 -0
- package/lib/query/clauses/SelectClause.cjs +2 -0
- package/lib/query/clauses/SelectorBasedClause.cjs +2 -0
- package/lib/query/clauses/ValuesClause.cjs +2 -0
- package/lib/query/clauses/WhereClause.cjs +2 -0
- package/lib/query/clauses/index.cjs +2 -0
- package/lib/query/constants.cjs +2 -0
- package/lib/query/errors.cjs +2 -0
- package/lib/query/index.cjs +2 -0
- package/lib/query/options.cjs +2 -0
- package/lib/query/selectors.cjs +2 -0
- package/lib/query/types.cjs +2 -0
- package/lib/repository/Context.cjs +2 -0
- package/lib/repository/Repository.cjs +2 -0
- package/lib/repository/constants.cjs +2 -0
- package/lib/repository/decorators.cjs +2 -0
- package/lib/repository/errors.cjs +2 -0
- package/lib/repository/index.cjs +2 -0
- package/lib/repository/injectables.cjs +2 -0
- package/lib/repository/types.cjs +2 -0
- package/lib/repository/utils.cjs +2 -0
- package/lib/validators/ClauseSequenceValidator.cjs +9 -7
- package/lib/validators/decorators.cjs +2 -0
- package/lib/validators/index.cjs +2 -0
- package/package.json +27 -16
- package/dist/core.bundle.min.js +0 -2
- package/dist/esm/core.bundle.min.esm.js +0 -2
- package/dist/lib/index.d.ts +0 -25
- package/dist/lib/model/construction.d.ts +0 -15
- package/lib/esm/identity/decorators.d.ts +0 -24
- package/lib/esm/identity/index.d.ts +0 -2
- package/lib/esm/identity/utils.d.ts +0 -3
- package/lib/esm/interfaces/Builder.d.ts +0 -16
- package/lib/esm/interfaces/Executor.d.ts +0 -19
- package/lib/esm/interfaces/Observable.d.ts +0 -31
- package/lib/esm/interfaces/Observer.d.ts +0 -16
- package/lib/esm/interfaces/Paginatable.d.ts +0 -4
- package/lib/esm/interfaces/Queriable.d.ts +0 -6
- package/lib/esm/interfaces/RawExecutor.d.ts +0 -20
- package/lib/esm/interfaces/SequenceOptions.d.ts +0 -19
- package/lib/esm/interfaces/index.d.ts +0 -7
- package/lib/esm/model/BaseModel.d.ts +0 -6
- package/lib/esm/model/IdentifiedBaseModel.d.ts +0 -7
- package/lib/esm/model/User.d.ts +0 -8
- package/lib/esm/model/construction.d.ts +0 -15
- package/lib/esm/model/decorators.d.ts +0 -75
- package/lib/esm/model/index.d.ts +0 -4
- package/lib/esm/model/types.d.ts +0 -6
- package/lib/esm/persistence/Adapter.d.ts +0 -86
- package/lib/esm/persistence/Sequence.d.ts +0 -22
- package/lib/esm/persistence/constants.d.ts +0 -22
- package/lib/esm/persistence/decorators.d.ts +0 -1
- package/lib/esm/persistence/errors.d.ts +0 -7
- package/lib/esm/persistence/index.d.ts +0 -5
- package/lib/esm/query/Clause.d.ts +0 -50
- package/lib/esm/query/ClauseFactory.d.ts +0 -71
- package/lib/esm/query/Condition.d.ts +0 -75
- package/lib/esm/query/Paginator.d.ts +0 -22
- package/lib/esm/query/Query.d.ts +0 -43
- package/lib/esm/query/Statement.d.ts +0 -55
- package/lib/esm/query/clauses/FromClause.d.ts +0 -45
- package/lib/esm/query/clauses/GroupByClause.d.ts +0 -21
- package/lib/esm/query/clauses/InsertClause.d.ts +0 -37
- package/lib/esm/query/clauses/LimitClause.d.ts +0 -29
- package/lib/esm/query/clauses/OffsetClause.d.ts +0 -21
- package/lib/esm/query/clauses/OrderByClause.d.ts +0 -37
- package/lib/esm/query/clauses/SelectClause.d.ts +0 -47
- package/lib/esm/query/clauses/SelectorBasedClause.d.ts +0 -25
- package/lib/esm/query/clauses/ValuesClause.d.ts +0 -21
- package/lib/esm/query/clauses/WhereClause.d.ts +0 -46
- package/lib/esm/query/clauses/index.d.ts +0 -10
- package/lib/esm/query/constants.d.ts +0 -79
- package/lib/esm/query/errors.d.ts +0 -7
- package/lib/esm/query/index.d.ts +0 -12
- package/lib/esm/query/options.d.ts +0 -372
- package/lib/esm/query/selectors.d.ts +0 -38
- package/lib/esm/query/types.d.ts +0 -2
- package/lib/esm/repository/Context.d.ts +0 -10
- package/lib/esm/repository/Repository.d.ts +0 -70
- package/lib/esm/repository/constants.d.ts +0 -25
- package/lib/esm/repository/decorators.d.ts +0 -2
- package/lib/esm/repository/errors.d.ts +0 -12
- package/lib/esm/repository/index.d.ts +0 -8
- package/lib/esm/repository/injectables.d.ts +0 -5
- package/lib/esm/repository/types.d.ts +0 -15
- package/lib/esm/repository/utils.d.ts +0 -3
- package/lib/esm/validators/ClauseSequenceValidator.d.ts +0 -28
- package/lib/esm/validators/decorators.d.ts +0 -10
- package/lib/esm/validators/index.d.ts +0 -2
- package/lib/identity/decorators.d.ts +0 -24
- package/lib/identity/index.d.ts +0 -2
- package/lib/identity/utils.d.ts +0 -3
- package/lib/index.d.ts +0 -25
- package/lib/interfaces/Builder.d.ts +0 -16
- package/lib/interfaces/Executor.d.ts +0 -19
- package/lib/interfaces/Observable.d.ts +0 -31
- package/lib/interfaces/Observer.d.ts +0 -16
- package/lib/interfaces/Paginatable.d.ts +0 -4
- package/lib/interfaces/Queriable.d.ts +0 -6
- package/lib/interfaces/RawExecutor.d.ts +0 -20
- package/lib/interfaces/SequenceOptions.d.ts +0 -19
- package/lib/interfaces/index.d.ts +0 -7
- package/lib/model/BaseModel.d.ts +0 -6
- package/lib/model/IdentifiedBaseModel.d.ts +0 -7
- package/lib/model/User.d.ts +0 -8
- package/lib/model/decorators.d.ts +0 -75
- package/lib/model/index.d.ts +0 -4
- package/lib/model/types.d.ts +0 -6
- package/lib/persistence/Adapter.d.ts +0 -86
- package/lib/persistence/Sequence.d.ts +0 -22
- package/lib/persistence/constants.d.ts +0 -22
- package/lib/persistence/decorators.d.ts +0 -1
- package/lib/persistence/errors.d.ts +0 -7
- package/lib/persistence/index.d.ts +0 -5
- package/lib/query/Clause.d.ts +0 -50
- package/lib/query/ClauseFactory.d.ts +0 -71
- package/lib/query/Condition.d.ts +0 -75
- package/lib/query/Paginator.d.ts +0 -22
- package/lib/query/Query.d.ts +0 -43
- package/lib/query/Statement.d.ts +0 -55
- package/lib/query/clauses/FromClause.d.ts +0 -45
- package/lib/query/clauses/GroupByClause.d.ts +0 -21
- package/lib/query/clauses/InsertClause.d.ts +0 -37
- package/lib/query/clauses/LimitClause.d.ts +0 -29
- package/lib/query/clauses/OffsetClause.d.ts +0 -21
- package/lib/query/clauses/OrderByClause.d.ts +0 -37
- package/lib/query/clauses/SelectClause.d.ts +0 -47
- package/lib/query/clauses/SelectorBasedClause.d.ts +0 -25
- package/lib/query/clauses/ValuesClause.d.ts +0 -21
- package/lib/query/clauses/WhereClause.d.ts +0 -46
- package/lib/query/clauses/index.d.ts +0 -10
- package/lib/query/constants.d.ts +0 -79
- package/lib/query/errors.d.ts +0 -7
- package/lib/query/index.d.ts +0 -12
- package/lib/query/options.d.ts +0 -372
- package/lib/query/selectors.d.ts +0 -38
- package/lib/query/types.d.ts +0 -2
- package/lib/repository/Context.d.ts +0 -10
- package/lib/repository/Repository.d.ts +0 -70
- package/lib/repository/constants.d.ts +0 -25
- package/lib/repository/decorators.d.ts +0 -2
- package/lib/repository/errors.d.ts +0 -12
- package/lib/repository/index.d.ts +0 -8
- package/lib/repository/injectables.d.ts +0 -5
- package/lib/repository/types.d.ts +0 -15
- package/lib/repository/utils.d.ts +0 -3
- package/lib/validators/ClauseSequenceValidator.d.ts +0 -28
- package/lib/validators/decorators.d.ts +0 -10
- package/lib/validators/index.d.ts +0 -2
package/lib/query/options.d.ts
DELETED
@@ -1,372 +0,0 @@
|
|
1
|
-
import { GroupBySelector, LimitSelector, OffsetSelector, OrderBySelector, SelectSelector } from "./selectors";
|
2
|
-
import { Executor } from "../interfaces";
|
3
|
-
import { Constructor, Model } from "@decaf-ts/decorator-validation";
|
4
|
-
import { Condition } from "./Condition";
|
5
|
-
import { Paginatable } from "../interfaces/Paginatable";
|
6
|
-
/**
|
7
|
-
* @summary Statement Builder interface
|
8
|
-
* @description Exposes the final method to build the statement
|
9
|
-
*
|
10
|
-
* @typedef Q The query object type to build
|
11
|
-
* @interface QueryBuilder
|
12
|
-
*
|
13
|
-
* @category Query
|
14
|
-
* @subcategory Options
|
15
|
-
*
|
16
|
-
*/
|
17
|
-
export interface QueryBuilder<Q> extends Executor {
|
18
|
-
/**
|
19
|
-
* Method to build and validate the prepared statement before the execution;
|
20
|
-
*
|
21
|
-
* @throws {QueryError} for invalid statements
|
22
|
-
* @method
|
23
|
-
*/
|
24
|
-
build(previous: Q): Q;
|
25
|
-
}
|
26
|
-
/**
|
27
|
-
* @summary GroupBy Option interface
|
28
|
-
* @description Exposes the GROUP BY method and remaining options
|
29
|
-
*
|
30
|
-
* @interface GroupByOption
|
31
|
-
* @extends QueryBuilder
|
32
|
-
*
|
33
|
-
* @category Query
|
34
|
-
* @subcategory Options
|
35
|
-
*/
|
36
|
-
export interface GroupByOption extends Executor {
|
37
|
-
/**
|
38
|
-
* @summary Groups records by an attribute
|
39
|
-
*
|
40
|
-
* @param {GroupBySelector} selector
|
41
|
-
* @method
|
42
|
-
*/
|
43
|
-
groupBy(selector: GroupBySelector): Executor;
|
44
|
-
}
|
45
|
-
/**
|
46
|
-
* @summary Offset Option interface
|
47
|
-
* @description Exposes the OFFSET method and remaining options
|
48
|
-
*
|
49
|
-
* @interface GroupByOption
|
50
|
-
* @extends QueryBuilder
|
51
|
-
*
|
52
|
-
* @category Query
|
53
|
-
* @subcategory Options
|
54
|
-
*/
|
55
|
-
export interface OffsetOption extends Executor {
|
56
|
-
/**
|
57
|
-
* @summary Offsets the results by the provided selector
|
58
|
-
*
|
59
|
-
* @param {OffsetSelector} selector
|
60
|
-
* @method
|
61
|
-
*/
|
62
|
-
offset(selector: OffsetSelector): Executor;
|
63
|
-
}
|
64
|
-
/**
|
65
|
-
* @summary Limit Option interface
|
66
|
-
* @description Exposes the LIMIT method and remaining options
|
67
|
-
*
|
68
|
-
* @interface LimitOption
|
69
|
-
* @extends QueryBuilder
|
70
|
-
*
|
71
|
-
* @category Query
|
72
|
-
* @subcategory Options
|
73
|
-
*/
|
74
|
-
export interface LimitOption extends Executor, Paginatable {
|
75
|
-
/**
|
76
|
-
* @summary Limits the results to the provided number
|
77
|
-
*
|
78
|
-
* @param {LimitSelector} selector
|
79
|
-
* @method
|
80
|
-
*/
|
81
|
-
limit(selector: LimitSelector): OffsetOption;
|
82
|
-
}
|
83
|
-
/**
|
84
|
-
* @summary OrderpBy Option interface
|
85
|
-
* @description Exposes the ORDER BY method and remaining options
|
86
|
-
*
|
87
|
-
* @interface OrderByOption
|
88
|
-
* @extends QueryBuilder
|
89
|
-
*
|
90
|
-
* @category Query
|
91
|
-
* @subcategory Options
|
92
|
-
*/
|
93
|
-
export interface OrderByOption extends Executor, Paginatable {
|
94
|
-
/**
|
95
|
-
* @summary Orders the results by the provided attribute and according to the provided direction
|
96
|
-
*
|
97
|
-
* @param {OrderBySelector} selector
|
98
|
-
* @method
|
99
|
-
*/
|
100
|
-
orderBy(...selector: OrderBySelector[]): LimitOption & OffsetOption;
|
101
|
-
}
|
102
|
-
/**
|
103
|
-
* @summary Groups several order and grouping options
|
104
|
-
*
|
105
|
-
* @interface OrderAndGroupOption
|
106
|
-
* @extends OrderByOption
|
107
|
-
* @extends GroupByOption
|
108
|
-
* @extends LimitOption
|
109
|
-
* @extends OffsetOption
|
110
|
-
*
|
111
|
-
* @category Query
|
112
|
-
* @subcategory Options
|
113
|
-
*/
|
114
|
-
export interface OrderAndGroupOption extends OrderByOption, GroupByOption, LimitOption, OffsetOption {
|
115
|
-
}
|
116
|
-
/**
|
117
|
-
* @summary Where Option interface
|
118
|
-
* @description Exposes the WHERE method and remaining options
|
119
|
-
*
|
120
|
-
* @interface WhereOption
|
121
|
-
* @extends OrderAndGroupOption
|
122
|
-
*
|
123
|
-
* @category Query
|
124
|
-
* @subcategory Options
|
125
|
-
*/
|
126
|
-
export interface WhereOption extends OrderAndGroupOption {
|
127
|
-
/**
|
128
|
-
* @summary filter the records by a condition
|
129
|
-
*
|
130
|
-
* @param {Condition} condition
|
131
|
-
* @method
|
132
|
-
*/
|
133
|
-
where(condition: Condition): OrderAndGroupOption;
|
134
|
-
}
|
135
|
-
/**
|
136
|
-
* @summary From Option Interface
|
137
|
-
* @description Exposes the FROM method and remaining options
|
138
|
-
*
|
139
|
-
* @interface FromOption
|
140
|
-
*
|
141
|
-
* @category Query
|
142
|
-
* @subcategory Options
|
143
|
-
*/
|
144
|
-
export interface FromOption<M extends Model> {
|
145
|
-
/**
|
146
|
-
* @summary selects records from a table
|
147
|
-
*
|
148
|
-
* @param {Constructor} tableName
|
149
|
-
* @method
|
150
|
-
*/
|
151
|
-
from(tableName: Constructor<M> | string): WhereOption;
|
152
|
-
}
|
153
|
-
/**
|
154
|
-
* @summary Distinct Option Interface
|
155
|
-
* @description Exposes the remaining options after a DISTINCT
|
156
|
-
*
|
157
|
-
* @interface DistinctOption
|
158
|
-
* @extends FromOption
|
159
|
-
*
|
160
|
-
* @category Query
|
161
|
-
* @subcategory Options
|
162
|
-
*/
|
163
|
-
export interface DistinctOption<M extends Model> extends FromOption<M> {
|
164
|
-
}
|
165
|
-
/**
|
166
|
-
* @summary Max Option Interface
|
167
|
-
* @description Exposes the remaining options after a MAX
|
168
|
-
*
|
169
|
-
* @interface MaxOption
|
170
|
-
* @extends FromOption
|
171
|
-
*
|
172
|
-
* @category Query
|
173
|
-
* @subcategory Options
|
174
|
-
*/
|
175
|
-
export interface MaxOption<M extends Model> extends FromOption<M> {
|
176
|
-
}
|
177
|
-
/**
|
178
|
-
* @summary Min Option Interface
|
179
|
-
* @description Exposes the remaining options after a MIN
|
180
|
-
*
|
181
|
-
* @interface MinOption
|
182
|
-
* @extends FromOption
|
183
|
-
*
|
184
|
-
* @category Query
|
185
|
-
* @subcategory Options
|
186
|
-
*/
|
187
|
-
export interface MinOption<M extends Model> extends FromOption<M> {
|
188
|
-
}
|
189
|
-
/**
|
190
|
-
* @summary Count Option Interface
|
191
|
-
* @description Exposes the remaining options after a COUNT
|
192
|
-
*
|
193
|
-
* @interface CountOption
|
194
|
-
* @extends FromOption
|
195
|
-
*
|
196
|
-
* @category Query
|
197
|
-
* @subcategory Options
|
198
|
-
*/
|
199
|
-
export interface CountOption<M extends Model> extends FromOption<M> {
|
200
|
-
}
|
201
|
-
/**
|
202
|
-
* @summary Select Option Interface
|
203
|
-
* @description Exposes the remaining options after a SELECT
|
204
|
-
*
|
205
|
-
* @interface SelectOption
|
206
|
-
* @extends FromOption
|
207
|
-
*
|
208
|
-
* @category Query
|
209
|
-
* @subcategory Options
|
210
|
-
*/
|
211
|
-
export interface SelectOption<M extends Model> extends FromOption<M> {
|
212
|
-
/**
|
213
|
-
* @summary selects distinct values
|
214
|
-
*
|
215
|
-
* @param {SelectSelector} selector
|
216
|
-
* @method
|
217
|
-
*/
|
218
|
-
distinct(selector: SelectSelector): DistinctOption<M>;
|
219
|
-
/**
|
220
|
-
* @summary the maximum value
|
221
|
-
*
|
222
|
-
* @param {SelectSelector} selector
|
223
|
-
* @method
|
224
|
-
*/
|
225
|
-
max(selector: SelectSelector): MaxOption<M>;
|
226
|
-
/**
|
227
|
-
* @summary selects the minimum value
|
228
|
-
*
|
229
|
-
* @param {SelectSelector} selector
|
230
|
-
* @method
|
231
|
-
*/
|
232
|
-
min(selector: SelectSelector): MinOption<M>;
|
233
|
-
/**
|
234
|
-
* @summary counts the records
|
235
|
-
*
|
236
|
-
* @param {SelectSelector} selector
|
237
|
-
* @method
|
238
|
-
*/
|
239
|
-
count(selector?: SelectSelector): CountOption<M>;
|
240
|
-
}
|
241
|
-
/**
|
242
|
-
* @summary Into Option Interface
|
243
|
-
* @description Exposes the remaining options after an INTO
|
244
|
-
*
|
245
|
-
* @interface IntoOption
|
246
|
-
*
|
247
|
-
* @category Query
|
248
|
-
* @subcategory Options
|
249
|
-
*/
|
250
|
-
export interface IntoOption<M extends Model> {
|
251
|
-
/**
|
252
|
-
* @summary sets the models to insert
|
253
|
-
*
|
254
|
-
* @param {T[]} models
|
255
|
-
* @method
|
256
|
-
*/
|
257
|
-
values(...models: M[]): Executor;
|
258
|
-
/**
|
259
|
-
* @summary filter records to insert
|
260
|
-
*
|
261
|
-
* @param {Condition} condition
|
262
|
-
* @method
|
263
|
-
*/
|
264
|
-
where(condition: Condition): Executor;
|
265
|
-
}
|
266
|
-
/**
|
267
|
-
* @summary Valuest Option Interface
|
268
|
-
* @description Exposes the remaining options after a VALUES
|
269
|
-
*
|
270
|
-
* @interface ValuesOption
|
271
|
-
* @extends QueryBuilder
|
272
|
-
*
|
273
|
-
* @category Query
|
274
|
-
* @subcategory Options
|
275
|
-
*/
|
276
|
-
export interface ValuesOption extends Executor {
|
277
|
-
}
|
278
|
-
/**
|
279
|
-
* @summary Insert Option Interface
|
280
|
-
* @description Exposes the remaining options after an INSERT
|
281
|
-
*
|
282
|
-
* @interface InsertOption
|
283
|
-
*
|
284
|
-
* @category Query
|
285
|
-
* @subcategory Options
|
286
|
-
*/
|
287
|
-
export interface InsertOption<M extends Model> {
|
288
|
-
/**
|
289
|
-
* @summary selects the table to insert records into
|
290
|
-
*
|
291
|
-
* @param {string | Constructor} table
|
292
|
-
* @method
|
293
|
-
*/
|
294
|
-
into(table: Constructor<M>): IntoOption<M>;
|
295
|
-
}
|
296
|
-
/**
|
297
|
-
* @summary {@link Operator} Option Interface
|
298
|
-
* @description Exposes the available operators for a {@link Condition}
|
299
|
-
*
|
300
|
-
* @interface AttributeOption
|
301
|
-
*
|
302
|
-
* @category Query
|
303
|
-
* @subcategory Conditions
|
304
|
-
*/
|
305
|
-
export interface AttributeOption {
|
306
|
-
/**
|
307
|
-
* @summary Test equality
|
308
|
-
*
|
309
|
-
* @param {any} val the value to test
|
310
|
-
* @method
|
311
|
-
*/
|
312
|
-
eq(val: any): Condition;
|
313
|
-
/**
|
314
|
-
* @summary Test difference
|
315
|
-
*
|
316
|
-
* @param {any} val the value to test
|
317
|
-
* @method
|
318
|
-
*/
|
319
|
-
dif(val: any): Condition;
|
320
|
-
/**
|
321
|
-
* @summary Test greater than
|
322
|
-
*
|
323
|
-
* @param {any} val the value to test
|
324
|
-
* @method
|
325
|
-
*/
|
326
|
-
gt(val: any): Condition;
|
327
|
-
/**
|
328
|
-
* @summary Test lower than
|
329
|
-
*
|
330
|
-
* @param {any} val the value to test
|
331
|
-
* @method
|
332
|
-
*/
|
333
|
-
lt(val: any): Condition;
|
334
|
-
/**
|
335
|
-
* @summary Test greater or equal to
|
336
|
-
*
|
337
|
-
* @param {any} val the value to test
|
338
|
-
* @method
|
339
|
-
*/
|
340
|
-
gte(val: any): Condition;
|
341
|
-
/**
|
342
|
-
* @summary Test lower or equal to
|
343
|
-
*
|
344
|
-
* @param {any} val the value to test
|
345
|
-
* @method
|
346
|
-
*/
|
347
|
-
lte(val: any): Condition;
|
348
|
-
/**
|
349
|
-
* @summary Test value in a range of values
|
350
|
-
* @param {any[]} val
|
351
|
-
*/
|
352
|
-
in(val: any[]): Condition;
|
353
|
-
/**
|
354
|
-
* @summary Test matches {@link RegExp}
|
355
|
-
*
|
356
|
-
* @param {any} val the value to test
|
357
|
-
* @method
|
358
|
-
*/
|
359
|
-
regexp(val: string | RegExp): Condition;
|
360
|
-
}
|
361
|
-
/**
|
362
|
-
* @summary The starting point for creating Conditions
|
363
|
-
* @description Exposes the available operations for a {@link Condition}
|
364
|
-
*
|
365
|
-
* @interface ConditionBuilderOption
|
366
|
-
*
|
367
|
-
* @category Query
|
368
|
-
* @subcategory Conditions
|
369
|
-
*/
|
370
|
-
export interface ConditionBuilderOption {
|
371
|
-
attribute(attr: string): AttributeOption;
|
372
|
-
}
|
package/lib/query/selectors.d.ts
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
import { OrderDirection } from "../repository";
|
2
|
-
import { Constructor, Model } from "@decaf-ts/decorator-validation";
|
3
|
-
/**
|
4
|
-
* @typedef FromSelector
|
5
|
-
*
|
6
|
-
* @category Clauses
|
7
|
-
*/
|
8
|
-
export type FromSelector<M extends Model> = Constructor<M> | string;
|
9
|
-
/**
|
10
|
-
* @typedef GroupBySelector
|
11
|
-
*
|
12
|
-
* @category Clauses
|
13
|
-
*/
|
14
|
-
export type GroupBySelector = string;
|
15
|
-
/**
|
16
|
-
* @typedef OrderBySelector
|
17
|
-
*
|
18
|
-
* @category Clauses
|
19
|
-
*/
|
20
|
-
export type OrderBySelector = [string, OrderDirection];
|
21
|
-
/**
|
22
|
-
* @typedef LimitSelector
|
23
|
-
*
|
24
|
-
* @category Clauses
|
25
|
-
*/
|
26
|
-
export type LimitSelector = number;
|
27
|
-
/**
|
28
|
-
* @typedef OffsetSelector
|
29
|
-
*
|
30
|
-
* @category Clauses
|
31
|
-
*/
|
32
|
-
export type OffsetSelector = number;
|
33
|
-
/**
|
34
|
-
* @typedef SelectSelector
|
35
|
-
*
|
36
|
-
* @category Clauses
|
37
|
-
*/
|
38
|
-
export type SelectSelector = string | string[];
|
package/lib/query/types.d.ts
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
import { Context as Ctx } from "@decaf-ts/db-decorators";
|
2
|
-
import { Constructor, Model } from "@decaf-ts/decorator-validation";
|
3
|
-
import { OperationKeys } from "@decaf-ts/db-decorators";
|
4
|
-
import { User } from "../model";
|
5
|
-
export declare abstract class Context<M extends Model, U extends User = User> extends Ctx<M> {
|
6
|
-
protected _timestamp: Date;
|
7
|
-
protected constructor(operation: OperationKeys, model?: Constructor<M>, parent?: Context<any, any>);
|
8
|
-
get timestamp(): Date;
|
9
|
-
abstract get user(): U | undefined;
|
10
|
-
}
|
@@ -1,70 +0,0 @@
|
|
1
|
-
import { IRepository, Repository as Rep } from "@decaf-ts/db-decorators";
|
2
|
-
import { Observable } from "../interfaces/Observable";
|
3
|
-
import { Observer } from "../interfaces/Observer";
|
4
|
-
import { Adapter } from "../persistence/Adapter";
|
5
|
-
import { Constructor, Model } from "@decaf-ts/decorator-validation";
|
6
|
-
import { OrderDirection } from "./constants";
|
7
|
-
import { SequenceOptions } from "../interfaces/SequenceOptions";
|
8
|
-
import { Queriable } from "../interfaces/Queriable";
|
9
|
-
import { IndexMetadata } from "./types";
|
10
|
-
import { Condition } from "../query/Condition";
|
11
|
-
import { WhereOption } from "../query/options";
|
12
|
-
import { SelectSelector } from "../query/selectors";
|
13
|
-
export type Repo<M extends Model, Q = any, A extends Adapter<any, Q> = Adapter<any, Q>> = Repository<M, Q, A>;
|
14
|
-
export declare class Repository<M extends Model, Q, A extends Adapter<any, Q>> extends Rep<M> implements Observable, Queriable, IRepository<M> {
|
15
|
-
private static _cache;
|
16
|
-
protected observers: Observer[];
|
17
|
-
private readonly _adapter;
|
18
|
-
private _tableName;
|
19
|
-
protected get adapter(): A;
|
20
|
-
protected get tableName(): string;
|
21
|
-
constructor(adapter?: A, clazz?: Constructor<M>);
|
22
|
-
protected createPrefix(model: M, ...args: any[]): Promise<[M, ...any[]]>;
|
23
|
-
create(model: M, ...args: any[]): Promise<M>;
|
24
|
-
createAll(models: M[], ...args: any[]): Promise<M[]>;
|
25
|
-
protected createAllPrefix(models: M[], ...args: any[]): Promise<any[]>;
|
26
|
-
protected readPrefix(key: string, ...args: any[]): Promise<any[]>;
|
27
|
-
read(id: string | number | bigint, ...args: any[]): Promise<M>;
|
28
|
-
protected readAllPrefix(keys: string[] | number[], ...args: any[]): Promise<any[]>;
|
29
|
-
readAll(keys: string[] | number[], ...args: any[]): Promise<M[]>;
|
30
|
-
update(model: M, ...args: any[]): Promise<M>;
|
31
|
-
protected updatePrefix(model: M, ...args: any[]): Promise<[M, ...args: any[]]>;
|
32
|
-
updateAll(models: M[], ...args: any[]): Promise<M[]>;
|
33
|
-
protected updateAllPrefix(models: M[], ...args: any[]): Promise<any[]>;
|
34
|
-
protected deletePrefix(key: any, ...args: any[]): Promise<any[]>;
|
35
|
-
delete(id: string | number | bigint, ...args: any[]): Promise<M>;
|
36
|
-
protected deleteAllPrefix(keys: string[] | number[], ...args: any[]): Promise<any[]>;
|
37
|
-
deleteAll(keys: string[] | number[], ...args: any[]): Promise<M[]>;
|
38
|
-
select(selector?: SelectSelector): WhereOption;
|
39
|
-
query<V>(condition: Condition, orderBy: string, order?: OrderDirection, limit?: number, skip?: number): Promise<V>;
|
40
|
-
/**
|
41
|
-
* @summary Registers an {@link Observer}
|
42
|
-
* @param {Observer} observer
|
43
|
-
*
|
44
|
-
* @see {Observable#observe}
|
45
|
-
*/
|
46
|
-
observe(observer: Observer): void;
|
47
|
-
/**
|
48
|
-
* @summary Unregisters an {@link Observer}
|
49
|
-
* @param {Observer} observer
|
50
|
-
*
|
51
|
-
* @see {Observable#unObserve}
|
52
|
-
*/
|
53
|
-
unObserve(observer: Observer): void;
|
54
|
-
/**
|
55
|
-
* @summary calls all registered {@link Observer}s to update themselves
|
56
|
-
* @param {any[]} [args] optional arguments to be passed to the {@link Observer#refresh} method
|
57
|
-
*/
|
58
|
-
updateObservers(...args: any[]): Promise<void>;
|
59
|
-
static forModel<M extends Model, R extends Repo<M>>(model: Constructor<M>, defaultFlavour?: string): R;
|
60
|
-
private static get;
|
61
|
-
static register<M extends Model>(model: Constructor<M>, repo: Constructor<Repo<M>> | Repo<M>): void;
|
62
|
-
static setMetadata<M extends Model>(model: M, metadata: any): void;
|
63
|
-
static getMetadata<M extends Model>(model: M): any;
|
64
|
-
static removeMetadata<M extends Model>(model: M): void;
|
65
|
-
static getSequenceOptions<M extends Model>(model: M): SequenceOptions;
|
66
|
-
static indexes<M extends Model>(model: M | Constructor<M>): Record<string, Record<string, IndexMetadata>>;
|
67
|
-
static relations<M extends Model>(model: M | Constructor<M>): string[];
|
68
|
-
static table<M extends Model>(model: M | Constructor<M>): any;
|
69
|
-
static column<M extends Model>(model: M, attribute: string): any;
|
70
|
-
}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { CascadeMetadata } from "./types";
|
2
|
-
/**
|
3
|
-
* @summary defines order directions when sorting
|
4
|
-
*
|
5
|
-
* @constant OrderDirection
|
6
|
-
*
|
7
|
-
* @category Query
|
8
|
-
*/
|
9
|
-
export declare enum OrderDirection {
|
10
|
-
/**
|
11
|
-
* @summary Defines the sort order as ascending
|
12
|
-
* @prop ASC
|
13
|
-
*/
|
14
|
-
ASC = "asc",
|
15
|
-
/**
|
16
|
-
* @summary Defines the sort order as descending
|
17
|
-
* @property {string} DSC
|
18
|
-
*/
|
19
|
-
DSC = "desc"
|
20
|
-
}
|
21
|
-
export declare enum Cascade {
|
22
|
-
CASCADE = "cascade",
|
23
|
-
NONE = "none"
|
24
|
-
}
|
25
|
-
export declare const DefaultCascade: CascadeMetadata;
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { BaseError } from "@decaf-ts/db-decorators";
|
2
|
-
/**
|
3
|
-
* @summary Represents a failure in observer communication
|
4
|
-
*
|
5
|
-
* @param {string} msg the error message
|
6
|
-
*
|
7
|
-
* @class ObserverError
|
8
|
-
* @extends BaseError
|
9
|
-
*/
|
10
|
-
export declare class ObserverError extends BaseError {
|
11
|
-
constructor(msg: string | Error);
|
12
|
-
}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { Cascade, OrderDirection } from "./constants";
|
2
|
-
/**
|
3
|
-
* @summary defines the cascading behaviour
|
4
|
-
*/
|
5
|
-
export type CascadeMetadata = {
|
6
|
-
update: Cascade;
|
7
|
-
delete: Cascade;
|
8
|
-
};
|
9
|
-
export type IndexMetadata = {
|
10
|
-
directions?: OrderDirection[2];
|
11
|
-
compositions?: string[];
|
12
|
-
};
|
13
|
-
export type NamedIndexMetadata = IndexMetadata & {
|
14
|
-
suffix: string;
|
15
|
-
};
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import { Validator } from "@decaf-ts/decorator-validation";
|
2
|
-
/**
|
3
|
-
* @summary Validates a {@link Sequence}'s {@link Clause}s
|
4
|
-
*
|
5
|
-
* @param {string} [message]
|
6
|
-
*
|
7
|
-
* @class ClauseSequenceValidator
|
8
|
-
* @extends Validator
|
9
|
-
*
|
10
|
-
* @category Validation
|
11
|
-
* @subcategory Validators
|
12
|
-
*/
|
13
|
-
export declare class ClauseSequenceValidator extends Validator {
|
14
|
-
constructor(message?: string);
|
15
|
-
private validateSequence;
|
16
|
-
/**
|
17
|
-
* @summary Verifies the model for errors
|
18
|
-
* @param {string} value
|
19
|
-
* @param {string} [message]
|
20
|
-
*
|
21
|
-
* @return Errors
|
22
|
-
*
|
23
|
-
* @override
|
24
|
-
*
|
25
|
-
* @see Validator
|
26
|
-
*/
|
27
|
-
hasErrors(value: any, message?: string): string | undefined;
|
28
|
-
}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
*
|
3
|
-
* @param {string} [message]
|
4
|
-
*
|
5
|
-
* @function clauseSequence
|
6
|
-
*
|
7
|
-
* @category Decorators
|
8
|
-
* @subcategory Validation
|
9
|
-
*/
|
10
|
-
export declare function clauseSequence(message?: string): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
|