@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.
Files changed (314) hide show
  1. package/LICENSE.md +0 -0
  2. package/README.md +37 -243
  3. package/dist/core.js +2 -0
  4. package/dist/{core.bundle.min.js.LICENSE.txt → core.js.LICENSE.txt} +0 -0
  5. package/dist/esm/core.js +2 -0
  6. package/dist/esm/{core.bundle.min.esm.js.LICENSE.txt → core.js.LICENSE.txt} +0 -0
  7. package/dist/{lib → types}/identity/decorators.d.ts +1 -1
  8. package/dist/{lib → types}/identity/index.d.ts +0 -0
  9. package/dist/{lib → types}/identity/utils.d.ts +0 -0
  10. package/{lib/esm → dist/types}/index.d.ts +1 -1
  11. package/dist/{lib → types}/interfaces/Builder.d.ts +0 -0
  12. package/dist/{lib → types}/interfaces/Executor.d.ts +0 -0
  13. package/dist/{lib → types}/interfaces/Observable.d.ts +0 -0
  14. package/dist/{lib → types}/interfaces/Observer.d.ts +0 -0
  15. package/dist/{lib → types}/interfaces/Paginatable.d.ts +0 -0
  16. package/dist/{lib → types}/interfaces/Queriable.d.ts +0 -0
  17. package/dist/{lib → types}/interfaces/RawExecutor.d.ts +0 -0
  18. package/dist/{lib → types}/interfaces/SequenceOptions.d.ts +0 -0
  19. package/dist/{lib → types}/interfaces/index.d.ts +0 -0
  20. package/dist/{lib → types}/model/BaseModel.d.ts +0 -0
  21. package/dist/{lib → types}/model/IdentifiedBaseModel.d.ts +0 -0
  22. package/dist/{lib → types}/model/User.d.ts +0 -0
  23. package/{lib → dist/types}/model/construction.d.ts +1 -1
  24. package/dist/{lib → types}/model/decorators.d.ts +0 -0
  25. package/dist/{lib → types}/model/index.d.ts +0 -0
  26. package/dist/{lib → types}/model/types.d.ts +0 -0
  27. package/dist/{lib → types}/persistence/Adapter.d.ts +0 -0
  28. package/dist/{lib → types}/persistence/Sequence.d.ts +0 -0
  29. package/dist/{lib → types}/persistence/constants.d.ts +0 -0
  30. package/dist/{lib → types}/persistence/decorators.d.ts +0 -0
  31. package/dist/{lib → types}/persistence/errors.d.ts +0 -0
  32. package/dist/{lib → types}/persistence/index.d.ts +0 -0
  33. package/dist/{lib → types}/query/Clause.d.ts +0 -0
  34. package/dist/{lib → types}/query/ClauseFactory.d.ts +0 -0
  35. package/dist/{lib → types}/query/Condition.d.ts +0 -0
  36. package/dist/{lib → types}/query/Paginator.d.ts +0 -0
  37. package/dist/{lib → types}/query/Query.d.ts +0 -0
  38. package/dist/{lib → types}/query/Statement.d.ts +0 -0
  39. package/dist/{lib → types}/query/clauses/FromClause.d.ts +0 -0
  40. package/dist/{lib → types}/query/clauses/GroupByClause.d.ts +0 -0
  41. package/dist/{lib → types}/query/clauses/InsertClause.d.ts +0 -0
  42. package/dist/{lib → types}/query/clauses/LimitClause.d.ts +0 -0
  43. package/dist/{lib → types}/query/clauses/OffsetClause.d.ts +0 -0
  44. package/dist/{lib → types}/query/clauses/OrderByClause.d.ts +0 -0
  45. package/dist/{lib → types}/query/clauses/SelectClause.d.ts +0 -0
  46. package/dist/{lib → types}/query/clauses/SelectorBasedClause.d.ts +0 -0
  47. package/dist/{lib → types}/query/clauses/ValuesClause.d.ts +0 -0
  48. package/dist/{lib → types}/query/clauses/WhereClause.d.ts +0 -0
  49. package/dist/{lib → types}/query/clauses/index.d.ts +0 -0
  50. package/dist/{lib → types}/query/constants.d.ts +0 -0
  51. package/dist/{lib → types}/query/errors.d.ts +0 -0
  52. package/dist/{lib → types}/query/index.d.ts +0 -0
  53. package/dist/{lib → types}/query/options.d.ts +0 -0
  54. package/dist/{lib → types}/query/selectors.d.ts +0 -0
  55. package/dist/{lib → types}/query/types.d.ts +0 -0
  56. package/dist/{lib → types}/repository/Context.d.ts +0 -0
  57. package/dist/{lib → types}/repository/Repository.d.ts +0 -0
  58. package/dist/{lib → types}/repository/constants.d.ts +0 -0
  59. package/dist/{lib → types}/repository/decorators.d.ts +0 -0
  60. package/dist/{lib → types}/repository/errors.d.ts +0 -0
  61. package/dist/{lib → types}/repository/index.d.ts +0 -0
  62. package/dist/{lib → types}/repository/injectables.d.ts +0 -0
  63. package/dist/{lib → types}/repository/types.d.ts +0 -0
  64. package/dist/{lib → types}/repository/utils.d.ts +0 -0
  65. package/dist/{lib → types}/validators/ClauseSequenceValidator.d.ts +3 -3
  66. package/dist/{lib → types}/validators/decorators.d.ts +0 -0
  67. package/dist/{lib → types}/validators/index.d.ts +0 -0
  68. package/lib/esm/identity/decorators.js +1 -1
  69. package/lib/esm/identity/index.js +1 -1
  70. package/lib/esm/identity/utils.js +1 -1
  71. package/lib/esm/index.js +2 -2
  72. package/lib/esm/interfaces/Builder.js +1 -1
  73. package/lib/esm/interfaces/Executor.js +1 -1
  74. package/lib/esm/interfaces/Observable.js +1 -1
  75. package/lib/esm/interfaces/Observer.js +1 -1
  76. package/lib/esm/interfaces/Paginatable.js +1 -1
  77. package/lib/esm/interfaces/Queriable.js +1 -1
  78. package/lib/esm/interfaces/RawExecutor.js +1 -1
  79. package/lib/esm/interfaces/SequenceOptions.js +1 -1
  80. package/lib/esm/interfaces/index.js +1 -1
  81. package/lib/esm/model/BaseModel.js +1 -1
  82. package/lib/esm/model/IdentifiedBaseModel.js +1 -1
  83. package/lib/esm/model/User.js +1 -1
  84. package/lib/esm/model/construction.js +1 -1
  85. package/lib/esm/model/decorators.js +1 -1
  86. package/lib/esm/model/index.js +1 -1
  87. package/lib/esm/model/types.js +1 -1
  88. package/lib/esm/persistence/Adapter.js +1 -1
  89. package/lib/esm/persistence/Sequence.js +1 -1
  90. package/lib/esm/persistence/constants.js +1 -1
  91. package/lib/esm/persistence/decorators.js +1 -1
  92. package/lib/esm/persistence/errors.js +1 -1
  93. package/lib/esm/persistence/index.js +1 -1
  94. package/lib/esm/query/Clause.js +1 -1
  95. package/lib/esm/query/ClauseFactory.js +1 -1
  96. package/lib/esm/query/Condition.js +1 -1
  97. package/lib/esm/query/Paginator.js +1 -1
  98. package/lib/esm/query/Query.js +1 -1
  99. package/lib/esm/query/Statement.js +1 -1
  100. package/lib/esm/query/clauses/FromClause.js +1 -1
  101. package/lib/esm/query/clauses/GroupByClause.js +1 -1
  102. package/lib/esm/query/clauses/InsertClause.js +1 -1
  103. package/lib/esm/query/clauses/LimitClause.js +1 -1
  104. package/lib/esm/query/clauses/OffsetClause.js +1 -1
  105. package/lib/esm/query/clauses/OrderByClause.js +1 -1
  106. package/lib/esm/query/clauses/SelectClause.js +1 -1
  107. package/lib/esm/query/clauses/SelectorBasedClause.js +1 -1
  108. package/lib/esm/query/clauses/ValuesClause.js +1 -1
  109. package/lib/esm/query/clauses/WhereClause.js +72 -0
  110. package/lib/esm/query/clauses/index.js +12 -0
  111. package/lib/esm/query/constants.js +1 -1
  112. package/lib/esm/query/errors.js +1 -1
  113. package/lib/esm/query/index.js +1 -1
  114. package/lib/esm/query/options.js +1 -1
  115. package/lib/esm/query/selectors.js +1 -1
  116. package/lib/esm/query/types.js +1 -1
  117. package/lib/esm/repository/Context.js +1 -1
  118. package/lib/esm/repository/Repository.js +1 -1
  119. package/lib/esm/repository/constants.js +1 -1
  120. package/lib/esm/repository/decorators.js +1 -1
  121. package/lib/esm/repository/errors.js +1 -1
  122. package/lib/esm/repository/index.js +1 -1
  123. package/lib/esm/repository/injectables.js +1 -1
  124. package/lib/esm/repository/types.js +1 -1
  125. package/lib/esm/repository/utils.js +1 -1
  126. package/lib/esm/validators/ClauseSequenceValidator.js +8 -8
  127. package/lib/esm/validators/decorators.js +1 -1
  128. package/lib/esm/validators/index.js +1 -1
  129. package/lib/identity/decorators.cjs +2 -0
  130. package/lib/identity/index.cjs +2 -0
  131. package/lib/identity/utils.cjs +2 -0
  132. package/lib/index.cjs +3 -1
  133. package/lib/interfaces/Builder.cjs +2 -0
  134. package/lib/interfaces/Executor.cjs +2 -0
  135. package/lib/interfaces/Observable.cjs +2 -0
  136. package/lib/interfaces/Observer.cjs +2 -0
  137. package/lib/interfaces/Paginatable.cjs +2 -0
  138. package/lib/interfaces/Queriable.cjs +2 -0
  139. package/lib/interfaces/RawExecutor.cjs +2 -0
  140. package/lib/interfaces/SequenceOptions.cjs +2 -0
  141. package/lib/interfaces/index.cjs +2 -0
  142. package/lib/model/BaseModel.cjs +2 -0
  143. package/lib/model/IdentifiedBaseModel.cjs +2 -0
  144. package/lib/model/User.cjs +2 -0
  145. package/lib/model/construction.cjs +2 -0
  146. package/lib/model/decorators.cjs +2 -0
  147. package/lib/model/index.cjs +2 -0
  148. package/lib/model/types.cjs +2 -0
  149. package/lib/persistence/Adapter.cjs +2 -0
  150. package/lib/persistence/Sequence.cjs +2 -0
  151. package/lib/persistence/constants.cjs +2 -0
  152. package/lib/persistence/decorators.cjs +2 -0
  153. package/lib/persistence/errors.cjs +2 -0
  154. package/lib/persistence/index.cjs +2 -0
  155. package/lib/query/Clause.cjs +2 -0
  156. package/lib/query/ClauseFactory.cjs +2 -0
  157. package/lib/query/Condition.cjs +2 -0
  158. package/lib/query/Paginator.cjs +2 -0
  159. package/lib/query/Query.cjs +2 -0
  160. package/lib/query/Statement.cjs +2 -0
  161. package/lib/query/clauses/FromClause.cjs +2 -0
  162. package/lib/query/clauses/GroupByClause.cjs +2 -0
  163. package/lib/query/clauses/InsertClause.cjs +2 -0
  164. package/lib/query/clauses/LimitClause.cjs +2 -0
  165. package/lib/query/clauses/OffsetClause.cjs +2 -0
  166. package/lib/query/clauses/OrderByClause.cjs +2 -0
  167. package/lib/query/clauses/SelectClause.cjs +2 -0
  168. package/lib/query/clauses/SelectorBasedClause.cjs +2 -0
  169. package/lib/query/clauses/ValuesClause.cjs +2 -0
  170. package/lib/query/clauses/WhereClause.cjs +2 -0
  171. package/lib/query/clauses/index.cjs +2 -0
  172. package/lib/query/constants.cjs +2 -0
  173. package/lib/query/errors.cjs +2 -0
  174. package/lib/query/index.cjs +2 -0
  175. package/lib/query/options.cjs +2 -0
  176. package/lib/query/selectors.cjs +2 -0
  177. package/lib/query/types.cjs +2 -0
  178. package/lib/repository/Context.cjs +2 -0
  179. package/lib/repository/Repository.cjs +2 -0
  180. package/lib/repository/constants.cjs +2 -0
  181. package/lib/repository/decorators.cjs +2 -0
  182. package/lib/repository/errors.cjs +2 -0
  183. package/lib/repository/index.cjs +2 -0
  184. package/lib/repository/injectables.cjs +2 -0
  185. package/lib/repository/types.cjs +2 -0
  186. package/lib/repository/utils.cjs +2 -0
  187. package/lib/validators/ClauseSequenceValidator.cjs +9 -7
  188. package/lib/validators/decorators.cjs +2 -0
  189. package/lib/validators/index.cjs +2 -0
  190. package/package.json +27 -16
  191. package/dist/core.bundle.min.js +0 -2
  192. package/dist/esm/core.bundle.min.esm.js +0 -2
  193. package/dist/lib/index.d.ts +0 -25
  194. package/dist/lib/model/construction.d.ts +0 -15
  195. package/lib/esm/identity/decorators.d.ts +0 -24
  196. package/lib/esm/identity/index.d.ts +0 -2
  197. package/lib/esm/identity/utils.d.ts +0 -3
  198. package/lib/esm/interfaces/Builder.d.ts +0 -16
  199. package/lib/esm/interfaces/Executor.d.ts +0 -19
  200. package/lib/esm/interfaces/Observable.d.ts +0 -31
  201. package/lib/esm/interfaces/Observer.d.ts +0 -16
  202. package/lib/esm/interfaces/Paginatable.d.ts +0 -4
  203. package/lib/esm/interfaces/Queriable.d.ts +0 -6
  204. package/lib/esm/interfaces/RawExecutor.d.ts +0 -20
  205. package/lib/esm/interfaces/SequenceOptions.d.ts +0 -19
  206. package/lib/esm/interfaces/index.d.ts +0 -7
  207. package/lib/esm/model/BaseModel.d.ts +0 -6
  208. package/lib/esm/model/IdentifiedBaseModel.d.ts +0 -7
  209. package/lib/esm/model/User.d.ts +0 -8
  210. package/lib/esm/model/construction.d.ts +0 -15
  211. package/lib/esm/model/decorators.d.ts +0 -75
  212. package/lib/esm/model/index.d.ts +0 -4
  213. package/lib/esm/model/types.d.ts +0 -6
  214. package/lib/esm/persistence/Adapter.d.ts +0 -86
  215. package/lib/esm/persistence/Sequence.d.ts +0 -22
  216. package/lib/esm/persistence/constants.d.ts +0 -22
  217. package/lib/esm/persistence/decorators.d.ts +0 -1
  218. package/lib/esm/persistence/errors.d.ts +0 -7
  219. package/lib/esm/persistence/index.d.ts +0 -5
  220. package/lib/esm/query/Clause.d.ts +0 -50
  221. package/lib/esm/query/ClauseFactory.d.ts +0 -71
  222. package/lib/esm/query/Condition.d.ts +0 -75
  223. package/lib/esm/query/Paginator.d.ts +0 -22
  224. package/lib/esm/query/Query.d.ts +0 -43
  225. package/lib/esm/query/Statement.d.ts +0 -55
  226. package/lib/esm/query/clauses/FromClause.d.ts +0 -45
  227. package/lib/esm/query/clauses/GroupByClause.d.ts +0 -21
  228. package/lib/esm/query/clauses/InsertClause.d.ts +0 -37
  229. package/lib/esm/query/clauses/LimitClause.d.ts +0 -29
  230. package/lib/esm/query/clauses/OffsetClause.d.ts +0 -21
  231. package/lib/esm/query/clauses/OrderByClause.d.ts +0 -37
  232. package/lib/esm/query/clauses/SelectClause.d.ts +0 -47
  233. package/lib/esm/query/clauses/SelectorBasedClause.d.ts +0 -25
  234. package/lib/esm/query/clauses/ValuesClause.d.ts +0 -21
  235. package/lib/esm/query/clauses/WhereClause.d.ts +0 -46
  236. package/lib/esm/query/clauses/index.d.ts +0 -10
  237. package/lib/esm/query/constants.d.ts +0 -79
  238. package/lib/esm/query/errors.d.ts +0 -7
  239. package/lib/esm/query/index.d.ts +0 -12
  240. package/lib/esm/query/options.d.ts +0 -372
  241. package/lib/esm/query/selectors.d.ts +0 -38
  242. package/lib/esm/query/types.d.ts +0 -2
  243. package/lib/esm/repository/Context.d.ts +0 -10
  244. package/lib/esm/repository/Repository.d.ts +0 -70
  245. package/lib/esm/repository/constants.d.ts +0 -25
  246. package/lib/esm/repository/decorators.d.ts +0 -2
  247. package/lib/esm/repository/errors.d.ts +0 -12
  248. package/lib/esm/repository/index.d.ts +0 -8
  249. package/lib/esm/repository/injectables.d.ts +0 -5
  250. package/lib/esm/repository/types.d.ts +0 -15
  251. package/lib/esm/repository/utils.d.ts +0 -3
  252. package/lib/esm/validators/ClauseSequenceValidator.d.ts +0 -28
  253. package/lib/esm/validators/decorators.d.ts +0 -10
  254. package/lib/esm/validators/index.d.ts +0 -2
  255. package/lib/identity/decorators.d.ts +0 -24
  256. package/lib/identity/index.d.ts +0 -2
  257. package/lib/identity/utils.d.ts +0 -3
  258. package/lib/index.d.ts +0 -25
  259. package/lib/interfaces/Builder.d.ts +0 -16
  260. package/lib/interfaces/Executor.d.ts +0 -19
  261. package/lib/interfaces/Observable.d.ts +0 -31
  262. package/lib/interfaces/Observer.d.ts +0 -16
  263. package/lib/interfaces/Paginatable.d.ts +0 -4
  264. package/lib/interfaces/Queriable.d.ts +0 -6
  265. package/lib/interfaces/RawExecutor.d.ts +0 -20
  266. package/lib/interfaces/SequenceOptions.d.ts +0 -19
  267. package/lib/interfaces/index.d.ts +0 -7
  268. package/lib/model/BaseModel.d.ts +0 -6
  269. package/lib/model/IdentifiedBaseModel.d.ts +0 -7
  270. package/lib/model/User.d.ts +0 -8
  271. package/lib/model/decorators.d.ts +0 -75
  272. package/lib/model/index.d.ts +0 -4
  273. package/lib/model/types.d.ts +0 -6
  274. package/lib/persistence/Adapter.d.ts +0 -86
  275. package/lib/persistence/Sequence.d.ts +0 -22
  276. package/lib/persistence/constants.d.ts +0 -22
  277. package/lib/persistence/decorators.d.ts +0 -1
  278. package/lib/persistence/errors.d.ts +0 -7
  279. package/lib/persistence/index.d.ts +0 -5
  280. package/lib/query/Clause.d.ts +0 -50
  281. package/lib/query/ClauseFactory.d.ts +0 -71
  282. package/lib/query/Condition.d.ts +0 -75
  283. package/lib/query/Paginator.d.ts +0 -22
  284. package/lib/query/Query.d.ts +0 -43
  285. package/lib/query/Statement.d.ts +0 -55
  286. package/lib/query/clauses/FromClause.d.ts +0 -45
  287. package/lib/query/clauses/GroupByClause.d.ts +0 -21
  288. package/lib/query/clauses/InsertClause.d.ts +0 -37
  289. package/lib/query/clauses/LimitClause.d.ts +0 -29
  290. package/lib/query/clauses/OffsetClause.d.ts +0 -21
  291. package/lib/query/clauses/OrderByClause.d.ts +0 -37
  292. package/lib/query/clauses/SelectClause.d.ts +0 -47
  293. package/lib/query/clauses/SelectorBasedClause.d.ts +0 -25
  294. package/lib/query/clauses/ValuesClause.d.ts +0 -21
  295. package/lib/query/clauses/WhereClause.d.ts +0 -46
  296. package/lib/query/clauses/index.d.ts +0 -10
  297. package/lib/query/constants.d.ts +0 -79
  298. package/lib/query/errors.d.ts +0 -7
  299. package/lib/query/index.d.ts +0 -12
  300. package/lib/query/options.d.ts +0 -372
  301. package/lib/query/selectors.d.ts +0 -38
  302. package/lib/query/types.d.ts +0 -2
  303. package/lib/repository/Context.d.ts +0 -10
  304. package/lib/repository/Repository.d.ts +0 -70
  305. package/lib/repository/constants.d.ts +0 -25
  306. package/lib/repository/decorators.d.ts +0 -2
  307. package/lib/repository/errors.d.ts +0 -12
  308. package/lib/repository/index.d.ts +0 -8
  309. package/lib/repository/injectables.d.ts +0 -5
  310. package/lib/repository/types.d.ts +0 -15
  311. package/lib/repository/utils.d.ts +0 -3
  312. package/lib/validators/ClauseSequenceValidator.d.ts +0 -28
  313. package/lib/validators/decorators.d.ts +0 -10
  314. package/lib/validators/index.d.ts +0 -2
@@ -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
- }
@@ -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[];
@@ -1,2 +0,0 @@
1
- export type AttributeResult = Record<string, string>;
2
- export type OperationResult = Record<string, AttributeResult | any>;
@@ -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,2 +0,0 @@
1
- import { Constructor, Model } from "@decaf-ts/decorator-validation";
2
- export declare function repository<T extends Model>(model: Constructor<T>, nameOverride?: string): any;
@@ -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,8 +0,0 @@
1
- export * from "./constants";
2
- export * from "./Context";
3
- export * from "./decorators";
4
- export * from "./errors";
5
- export * from "./injectables";
6
- export * from "./Repository";
7
- export * from "./types";
8
- export * from "./utils";
@@ -1,5 +0,0 @@
1
- import { InjectableRegistryImp } from "@decaf-ts/injectable-decorators";
2
- export declare class InjectablesRegistry extends InjectableRegistryImp {
3
- constructor();
4
- get<T>(name: string): T | undefined;
5
- }
@@ -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,3 +0,0 @@
1
- import { Constructor } from "@decaf-ts/decorator-validation";
2
- import { Model } from "@decaf-ts/decorator-validation";
3
- export declare function generateInjectableNameForRepository<T extends Model>(model: Constructor<T> | T, flavour?: string): string;
@@ -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;
@@ -1,2 +0,0 @@
1
- export * from "./decorators";
2
- export * from "./ClauseSequenceValidator";
@@ -1,24 +0,0 @@
1
- import { Model } from "@decaf-ts/decorator-validation";
2
- import { SequenceOptions } from "../interfaces/SequenceOptions";
3
- import { Repo } from "../repository/Repository";
4
- import { Context } from "@decaf-ts/db-decorators/lib/repository/Context";
5
- /**
6
- * @summary Primary Key Decorator
7
- * @description Marks the property as the {@link Model}s primary key.
8
- * Also marks the property as {@link unique} as {@required} and ensures the index is created properly according to the provided {@link Sequence}
9
- *
10
- *
11
- *
12
- * @function pk
13
- *
14
- * @memberOf module:wallet-db.Decorators
15
- *
16
- * @see unique
17
- * @see required
18
- * @see on
19
- * @param data
20
- * @param key
21
- * @param model
22
- */
23
- export declare function pkOnCreate<M extends Model, V extends Repo<M>>(this: V, context: Context<M>, data: SequenceOptions, key: string, model: M): Promise<void>;
24
- export declare function pk(opts?: Omit<SequenceOptions, "cycle" | "startWith" | "incrementBy">): (target: object, propertyKey?: string | symbol | unknown, descriptor?: PropertyDescriptor) => void;
@@ -1,2 +0,0 @@
1
- export * from "./decorators";
2
- export * from "./utils";
@@ -1,3 +0,0 @@
1
- import { Constructor, Model } from "@decaf-ts/decorator-validation";
2
- export declare function getTableName<M extends Model>(model: M | Constructor<M>): any;
3
- export declare function sequenceNameForModel<M extends Model>(model: M | Constructor<M>, ...args: string[]): string;
package/lib/index.d.ts DELETED
@@ -1,25 +0,0 @@
1
- /**
2
- * @summary Module summary
3
- * @description Module description
4
- * @module ts-workspace
5
- */
6
- /**
7
- * @summary Namespace summary
8
- * @description Namespace description
9
- * @namespace Namespace
10
- * @memberOf module:ts-workspace
11
- */
12
- export * from "./identity";
13
- export * from "./interfaces";
14
- export * from "./model";
15
- export * from "./persistence";
16
- export * from "./query";
17
- export * from "./repository";
18
- export * from "./validators";
19
- /**
20
- * @summary stores the current package version
21
- * @description this is how you should document a constant
22
- * @const VERSION
23
- * @memberOf module:ts-workspace
24
- */
25
- export declare const VERSION = "##VERSION##";