@loopback/repository 4.0.0-alpha.7 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (457) hide show
  1. package/LICENSE +25 -0
  2. package/README.md +94 -372
  3. package/dist/common-types.d.ts +96 -0
  4. package/dist/common-types.js +24 -0
  5. package/dist/common-types.js.map +1 -0
  6. package/dist/connectors/connector.d.ts +48 -0
  7. package/{lib → dist/connectors}/connector.js +1 -1
  8. package/dist/connectors/connector.js.map +1 -0
  9. package/{lib/crud-connector.d.ts → dist/connectors/crud.connector.d.ts} +51 -51
  10. package/{lib/common-types.js → dist/connectors/crud.connector.js} +2 -2
  11. package/dist/connectors/crud.connector.js.map +1 -0
  12. package/dist/connectors/index.d.ts +3 -0
  13. package/dist/connectors/index.js +11 -0
  14. package/dist/connectors/index.js.map +1 -0
  15. package/{lib6/kv-connector.d.ts → dist/connectors/kv.connector.d.ts} +28 -28
  16. package/{lib/datasource.js → dist/connectors/kv.connector.js} +2 -2
  17. package/dist/connectors/kv.connector.js.map +1 -0
  18. package/dist/datasource.d.ts +27 -0
  19. package/{lib6 → dist}/datasource.js +1 -1
  20. package/dist/datasource.js.map +1 -0
  21. package/dist/decorators/index.d.ts +3 -0
  22. package/dist/decorators/index.js +11 -0
  23. package/dist/decorators/index.js.map +1 -0
  24. package/dist/decorators/metadata.d.ts +12 -0
  25. package/dist/decorators/metadata.js +51 -0
  26. package/dist/decorators/metadata.js.map +1 -0
  27. package/dist/decorators/model.decorator.d.ts +40 -0
  28. package/dist/decorators/model.decorator.js +112 -0
  29. package/dist/decorators/model.decorator.js.map +1 -0
  30. package/dist/decorators/repository.decorator.d.ts +106 -0
  31. package/dist/decorators/repository.decorator.js +114 -0
  32. package/dist/decorators/repository.decorator.js.map +1 -0
  33. package/dist/define-model-class.d.ts +55 -0
  34. package/dist/define-model-class.js +57 -0
  35. package/dist/define-model-class.js.map +1 -0
  36. package/dist/define-repository-class.d.ts +119 -0
  37. package/dist/define-repository-class.js +98 -0
  38. package/dist/define-repository-class.js.map +1 -0
  39. package/dist/errors/entity-not-found.error.d.ts +8 -0
  40. package/dist/errors/entity-not-found.error.js +28 -0
  41. package/dist/errors/entity-not-found.error.js.map +1 -0
  42. package/dist/errors/index.d.ts +2 -0
  43. package/dist/errors/index.js +10 -0
  44. package/dist/errors/index.js.map +1 -0
  45. package/dist/errors/invalid-relation.error.d.ts +10 -0
  46. package/dist/errors/invalid-relation.error.js +28 -0
  47. package/dist/errors/invalid-relation.error.js.map +1 -0
  48. package/dist/index.d.ts +30 -0
  49. package/dist/index.js +39 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/keys.d.ts +34 -0
  52. package/dist/keys.js +44 -0
  53. package/dist/keys.js.map +1 -0
  54. package/dist/mixins/index.d.ts +1 -0
  55. package/dist/mixins/index.js +9 -0
  56. package/dist/mixins/index.js.map +1 -0
  57. package/dist/mixins/repository.mixin.d.ts +377 -0
  58. package/dist/mixins/repository.mixin.js +405 -0
  59. package/dist/mixins/repository.mixin.js.map +1 -0
  60. package/dist/model.d.ts +232 -0
  61. package/dist/model.js +367 -0
  62. package/dist/model.js.map +1 -0
  63. package/dist/relations/belongs-to/belongs-to.accessor.d.ts +17 -0
  64. package/dist/relations/belongs-to/belongs-to.accessor.js +40 -0
  65. package/dist/relations/belongs-to/belongs-to.accessor.js.map +1 -0
  66. package/dist/relations/belongs-to/belongs-to.decorator.d.ts +11 -0
  67. package/dist/relations/belongs-to/belongs-to.decorator.js +64 -0
  68. package/dist/relations/belongs-to/belongs-to.decorator.js.map +1 -0
  69. package/dist/relations/belongs-to/belongs-to.helpers.d.ts +17 -0
  70. package/dist/relations/belongs-to/belongs-to.helpers.js +63 -0
  71. package/dist/relations/belongs-to/belongs-to.helpers.js.map +1 -0
  72. package/dist/relations/belongs-to/belongs-to.inclusion-resolver.d.ts +14 -0
  73. package/dist/relations/belongs-to/belongs-to.inclusion-resolver.js +36 -0
  74. package/dist/relations/belongs-to/belongs-to.inclusion-resolver.js.map +1 -0
  75. package/dist/relations/belongs-to/belongs-to.repository.d.ts +28 -0
  76. package/dist/relations/belongs-to/belongs-to.repository.js +33 -0
  77. package/dist/relations/belongs-to/belongs-to.repository.js.map +1 -0
  78. package/dist/relations/belongs-to/index.d.ts +4 -0
  79. package/dist/relations/belongs-to/index.js +12 -0
  80. package/dist/relations/belongs-to/index.js.map +1 -0
  81. package/dist/relations/has-many/has-many-through.helpers.d.ts +182 -0
  82. package/dist/relations/has-many/has-many-through.helpers.js +282 -0
  83. package/dist/relations/has-many/has-many-through.helpers.js.map +1 -0
  84. package/dist/relations/has-many/has-many-through.inclusion-resolver.d.ts +16 -0
  85. package/dist/relations/has-many/has-many-through.inclusion-resolver.js +78 -0
  86. package/dist/relations/has-many/has-many-through.inclusion-resolver.js.map +1 -0
  87. package/dist/relations/has-many/has-many-through.repository-factory.d.ts +17 -0
  88. package/dist/relations/has-many/has-many-through.repository-factory.js +37 -0
  89. package/dist/relations/has-many/has-many-through.repository-factory.js.map +1 -0
  90. package/dist/relations/has-many/has-many-through.repository.d.ts +114 -0
  91. package/dist/relations/has-many/has-many-through.repository.js +103 -0
  92. package/dist/relations/has-many/has-many-through.repository.js.map +1 -0
  93. package/dist/relations/has-many/has-many.decorator.d.ts +11 -0
  94. package/dist/relations/has-many/has-many.decorator.js +36 -0
  95. package/dist/relations/has-many/has-many.decorator.js.map +1 -0
  96. package/dist/relations/has-many/has-many.helpers.d.ts +26 -0
  97. package/dist/relations/has-many/has-many.helpers.js +78 -0
  98. package/dist/relations/has-many/has-many.helpers.js.map +1 -0
  99. package/dist/relations/has-many/has-many.inclusion-resolver.d.ts +14 -0
  100. package/dist/relations/has-many/has-many.inclusion-resolver.js +45 -0
  101. package/dist/relations/has-many/has-many.inclusion-resolver.js.map +1 -0
  102. package/dist/relations/has-many/has-many.repository-factory.d.ts +28 -0
  103. package/dist/relations/has-many/has-many.repository-factory.js +39 -0
  104. package/dist/relations/has-many/has-many.repository-factory.js.map +1 -0
  105. package/dist/relations/has-many/has-many.repository.d.ts +54 -0
  106. package/dist/relations/has-many/has-many.repository.js +38 -0
  107. package/dist/relations/has-many/has-many.repository.js.map +1 -0
  108. package/dist/relations/has-many/index.d.ts +6 -0
  109. package/dist/relations/has-many/index.js +14 -0
  110. package/dist/relations/has-many/index.js.map +1 -0
  111. package/dist/relations/has-one/has-one.decorator.d.ts +3 -0
  112. package/dist/relations/has-one/has-one.decorator.js +37 -0
  113. package/dist/relations/has-one/has-one.decorator.js.map +1 -0
  114. package/dist/relations/has-one/has-one.helpers.d.ts +17 -0
  115. package/dist/relations/has-one/has-one.helpers.js +64 -0
  116. package/dist/relations/has-one/has-one.helpers.js.map +1 -0
  117. package/dist/relations/has-one/has-one.inclusion-resolver.d.ts +14 -0
  118. package/dist/relations/has-one/has-one.inclusion-resolver.js +35 -0
  119. package/dist/relations/has-one/has-one.inclusion-resolver.js.map +1 -0
  120. package/dist/relations/has-one/has-one.repository-factory.d.ts +28 -0
  121. package/dist/relations/has-one/has-one.repository-factory.js +39 -0
  122. package/dist/relations/has-one/has-one.repository-factory.js.map +1 -0
  123. package/dist/relations/has-one/has-one.repository.d.ts +53 -0
  124. package/dist/relations/has-one/has-one.repository.js +45 -0
  125. package/dist/relations/has-one/has-one.repository.js.map +1 -0
  126. package/dist/relations/has-one/index.d.ts +3 -0
  127. package/dist/relations/has-one/index.js +11 -0
  128. package/dist/relations/has-one/index.js.map +1 -0
  129. package/dist/relations/index.d.ts +6 -0
  130. package/dist/relations/index.js +14 -0
  131. package/dist/relations/index.js.map +1 -0
  132. package/dist/relations/relation.decorator.d.ts +39 -0
  133. package/dist/relations/relation.decorator.js +88 -0
  134. package/dist/relations/relation.decorator.js.map +1 -0
  135. package/dist/relations/relation.helpers.d.ts +105 -0
  136. package/dist/relations/relation.helpers.js +304 -0
  137. package/dist/relations/relation.helpers.js.map +1 -0
  138. package/dist/relations/relation.types.d.ts +142 -0
  139. package/dist/relations/relation.types.js +21 -0
  140. package/dist/relations/relation.types.js.map +1 -0
  141. package/dist/repositories/constraint-utils.d.ts +49 -0
  142. package/dist/repositories/constraint-utils.js +87 -0
  143. package/dist/repositories/constraint-utils.js.map +1 -0
  144. package/dist/repositories/index.d.ts +5 -0
  145. package/dist/repositories/index.js +13 -0
  146. package/dist/repositories/index.js.map +1 -0
  147. package/dist/repositories/kv.repository.bridge.d.ts +30 -0
  148. package/dist/repositories/kv.repository.bridge.js +76 -0
  149. package/dist/repositories/kv.repository.bridge.js.map +1 -0
  150. package/dist/repositories/kv.repository.d.ts +74 -0
  151. package/{lib/crud-connector.js → dist/repositories/kv.repository.js} +2 -2
  152. package/dist/repositories/kv.repository.js.map +1 -0
  153. package/dist/repositories/legacy-juggler-bridge.d.ts +305 -0
  154. package/dist/repositories/legacy-juggler-bridge.js +452 -0
  155. package/dist/repositories/legacy-juggler-bridge.js.map +1 -0
  156. package/dist/repositories/repository.d.ts +223 -0
  157. package/dist/repositories/repository.js +157 -0
  158. package/dist/repositories/repository.js.map +1 -0
  159. package/dist/transaction.d.ts +30 -0
  160. package/dist/transaction.js +18 -0
  161. package/dist/transaction.js.map +1 -0
  162. package/dist/type-resolver.d.ts +42 -0
  163. package/dist/type-resolver.js +61 -0
  164. package/dist/type-resolver.js.map +1 -0
  165. package/{lib → dist}/types/any.d.ts +1 -1
  166. package/{lib6 → dist}/types/any.js +3 -2
  167. package/dist/types/any.js.map +1 -0
  168. package/{lib6 → dist}/types/array.d.ts +4 -4
  169. package/{lib6 → dist}/types/array.js +6 -4
  170. package/dist/types/array.js.map +1 -0
  171. package/{lib → dist}/types/boolean.d.ts +1 -1
  172. package/{lib6 → dist}/types/boolean.js +3 -2
  173. package/dist/types/boolean.js.map +1 -0
  174. package/{lib6 → dist}/types/buffer.d.ts +2 -2
  175. package/{lib → dist}/types/buffer.js +8 -6
  176. package/dist/types/buffer.js.map +1 -0
  177. package/{lib → dist}/types/date.d.ts +1 -1
  178. package/{lib → dist}/types/date.js +6 -4
  179. package/dist/types/date.js.map +1 -0
  180. package/{lib → dist}/types/index.d.ts +11 -9
  181. package/dist/types/index.js +49 -0
  182. package/dist/types/index.js.map +1 -0
  183. package/{lib6 → dist}/types/model.d.ts +2 -1
  184. package/{lib6 → dist}/types/model.js +2 -2
  185. package/dist/types/model.js.map +1 -0
  186. package/dist/types/null.d.ts +12 -0
  187. package/{lib/types/boolean.js → dist/types/null.js} +12 -11
  188. package/dist/types/null.js.map +1 -0
  189. package/{lib6 → dist}/types/number.d.ts +1 -1
  190. package/{lib → dist}/types/number.js +6 -4
  191. package/dist/types/number.js.map +1 -0
  192. package/{lib → dist}/types/object.d.ts +1 -1
  193. package/{lib → dist}/types/object.js +7 -6
  194. package/dist/types/object.js.map +1 -0
  195. package/{lib → dist}/types/string.d.ts +1 -1
  196. package/{lib → dist}/types/string.js +3 -2
  197. package/dist/types/string.js.map +1 -0
  198. package/{lib6 → dist}/types/type.d.ts +7 -7
  199. package/{lib6 → dist}/types/type.js +1 -1
  200. package/dist/types/type.js.map +1 -0
  201. package/{lib → dist}/types/union.d.ts +1 -1
  202. package/{lib → dist}/types/union.js +6 -4
  203. package/dist/types/union.js.map +1 -0
  204. package/package.json +49 -32
  205. package/src/common-types.ts +123 -0
  206. package/src/connectors/connector.ts +70 -0
  207. package/src/connectors/crud.connector.ts +208 -0
  208. package/src/connectors/index.ts +8 -0
  209. package/src/connectors/kv.connector.ts +113 -0
  210. package/src/datasource.ts +37 -0
  211. package/src/decorators/index.ts +8 -0
  212. package/src/decorators/metadata.ts +84 -0
  213. package/src/decorators/model.decorator.ts +166 -0
  214. package/src/decorators/repository.decorator.ts +223 -0
  215. package/src/define-model-class.ts +90 -0
  216. package/src/define-repository-class.ts +170 -0
  217. package/src/errors/entity-not-found.error.ts +40 -0
  218. package/src/errors/index.ts +7 -0
  219. package/src/errors/invalid-relation.error.ts +39 -0
  220. package/src/index.ts +36 -0
  221. package/src/keys.ts +40 -0
  222. package/{index.d.ts → src/mixins/index.ts} +2 -2
  223. package/src/mixins/repository.mixin.ts +499 -0
  224. package/src/model.ts +539 -0
  225. package/src/relations/belongs-to/belongs-to.accessor.ts +74 -0
  226. package/src/relations/belongs-to/belongs-to.decorator.ts +81 -0
  227. package/src/relations/belongs-to/belongs-to.helpers.ts +78 -0
  228. package/src/relations/belongs-to/belongs-to.inclusion-resolver.ts +71 -0
  229. package/src/relations/belongs-to/belongs-to.repository.ts +55 -0
  230. package/src/relations/belongs-to/index.ts +9 -0
  231. package/src/relations/has-many/has-many-through.helpers.ts +361 -0
  232. package/src/relations/has-many/has-many-through.inclusion-resolver.ts +135 -0
  233. package/src/relations/has-many/has-many-through.repository-factory.ts +121 -0
  234. package/src/relations/has-many/has-many-through.repository.ts +318 -0
  235. package/src/relations/has-many/has-many.decorator.ts +38 -0
  236. package/src/relations/has-many/has-many.helpers.ts +100 -0
  237. package/src/relations/has-many/has-many.inclusion-resolver.ts +88 -0
  238. package/src/relations/has-many/has-many.repository-factory.ts +76 -0
  239. package/src/relations/has-many/has-many.repository.ts +118 -0
  240. package/src/relations/has-many/index.ts +11 -0
  241. package/src/relations/has-one/has-one.decorator.ts +40 -0
  242. package/src/relations/has-one/has-one.helpers.ts +84 -0
  243. package/src/relations/has-one/has-one.inclusion-resolver.ts +65 -0
  244. package/src/relations/has-one/has-one.repository-factory.ts +72 -0
  245. package/src/relations/has-one/has-one.repository.ts +127 -0
  246. package/src/relations/has-one/index.ts +8 -0
  247. package/src/relations/index.ts +11 -0
  248. package/src/relations/relation.decorator.ts +90 -0
  249. package/src/relations/relation.helpers.ts +373 -0
  250. package/src/relations/relation.types.ts +180 -0
  251. package/src/repositories/constraint-utils.ts +98 -0
  252. package/src/repositories/index.ts +10 -0
  253. package/src/repositories/kv.repository.bridge.ts +97 -0
  254. package/src/repositories/kv.repository.ts +87 -0
  255. package/src/repositories/legacy-juggler-bridge.ts +788 -0
  256. package/src/repositories/repository.ts +441 -0
  257. package/src/transaction.ts +39 -0
  258. package/src/type-resolver.ts +98 -0
  259. package/src/types/any.ts +38 -0
  260. package/src/types/array.ts +53 -0
  261. package/src/types/boolean.ts +35 -0
  262. package/src/types/buffer.ts +53 -0
  263. package/src/types/date.ts +61 -0
  264. package/src/types/index.ts +52 -0
  265. package/src/types/model.ts +24 -0
  266. package/src/types/null.ts +35 -0
  267. package/src/types/number.ts +42 -0
  268. package/src/types/object.ts +53 -0
  269. package/src/types/string.ts +42 -0
  270. package/src/types/type.ts +51 -0
  271. package/src/types/union.ts +55 -0
  272. package/api-docs/apple-touch-icon-114x114-precomposed.png +0 -0
  273. package/api-docs/apple-touch-icon-144x144-precomposed.png +0 -0
  274. package/api-docs/apple-touch-icon-57x57-precomposed.png +0 -0
  275. package/api-docs/apple-touch-icon-72x72-precomposed.png +0 -0
  276. package/api-docs/apple-touch-icon-precomposed.png +0 -0
  277. package/api-docs/apple-touch-icon.png +0 -0
  278. package/api-docs/css/bootstrap.min.css +0 -9
  279. package/api-docs/css/code-themes/arta.css +0 -158
  280. package/api-docs/css/code-themes/ascetic.css +0 -50
  281. package/api-docs/css/code-themes/brown_paper.css +0 -104
  282. package/api-docs/css/code-themes/brown_papersq.png +0 -0
  283. package/api-docs/css/code-themes/dark.css +0 -103
  284. package/api-docs/css/code-themes/default.css +0 -135
  285. package/api-docs/css/code-themes/far.css +0 -111
  286. package/api-docs/css/code-themes/github.css +0 -127
  287. package/api-docs/css/code-themes/googlecode.css +0 -144
  288. package/api-docs/css/code-themes/idea.css +0 -121
  289. package/api-docs/css/code-themes/ir_black.css +0 -104
  290. package/api-docs/css/code-themes/magula.css +0 -121
  291. package/api-docs/css/code-themes/monokai.css +0 -114
  292. package/api-docs/css/code-themes/pojoaque.css +0 -104
  293. package/api-docs/css/code-themes/pojoaque.jpg +0 -0
  294. package/api-docs/css/code-themes/rainbow.css +0 -114
  295. package/api-docs/css/code-themes/school_book.css +0 -111
  296. package/api-docs/css/code-themes/school_book.png +0 -0
  297. package/api-docs/css/code-themes/sl-theme.css +0 -45
  298. package/api-docs/css/code-themes/solarized_dark.css +0 -88
  299. package/api-docs/css/code-themes/solarized_light.css +0 -88
  300. package/api-docs/css/code-themes/sunburst.css +0 -158
  301. package/api-docs/css/code-themes/tomorrow-night-blue.css +0 -52
  302. package/api-docs/css/code-themes/tomorrow-night-bright.css +0 -51
  303. package/api-docs/css/code-themes/tomorrow-night-eighties.css +0 -51
  304. package/api-docs/css/code-themes/tomorrow-night.css +0 -52
  305. package/api-docs/css/code-themes/tomorrow.css +0 -49
  306. package/api-docs/css/code-themes/vs.css +0 -86
  307. package/api-docs/css/code-themes/xcode.css +0 -154
  308. package/api-docs/css/code-themes/zenburn.css +0 -115
  309. package/api-docs/css/main.css +0 -139
  310. package/api-docs/favicon.ico +0 -0
  311. package/api-docs/fonts/0ihfXUL2emPh0ROJezvraLO3LdcAZYWl9Si6vvxL-qU.woff +0 -0
  312. package/api-docs/fonts/OsJ2DjdpjqFRVUSto6IffLO3LdcAZYWl9Si6vvxL-qU.woff +0 -0
  313. package/api-docs/fonts/_aijTyevf54tkVDLy-dlnLO3LdcAZYWl9Si6vvxL-qU.woff +0 -0
  314. package/api-docs/index.html +0 -18017
  315. package/api-docs/js/main.js +0 -19
  316. package/api-docs/js/vendor/bootstrap.min.js +0 -6
  317. package/api-docs/js/vendor/jquery-1.10.1.min.js +0 -6
  318. package/api-docs/js/vendor/jquery.scrollTo-1.4.3.1.js +0 -218
  319. package/api-docs/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js +0 -11
  320. package/index.js +0 -9
  321. package/lib/common-types.d.ts +0 -44
  322. package/lib/common-types.js.map +0 -1
  323. package/lib/connector.d.ts +0 -12
  324. package/lib/connector.js.map +0 -1
  325. package/lib/crud-connector.js.map +0 -1
  326. package/lib/datasource.d.ts +0 -11
  327. package/lib/datasource.js.map +0 -1
  328. package/lib/decorators/model.d.ts +0 -17
  329. package/lib/decorators/model.js +0 -55
  330. package/lib/decorators/model.js.map +0 -1
  331. package/lib/decorators/relation.d.ts +0 -65
  332. package/lib/decorators/relation.js +0 -126
  333. package/lib/decorators/relation.js.map +0 -1
  334. package/lib/decorators/repository.d.ts +0 -61
  335. package/lib/decorators/repository.js +0 -107
  336. package/lib/decorators/repository.js.map +0 -1
  337. package/lib/index.d.ts +0 -16
  338. package/lib/index.js +0 -20
  339. package/lib/index.js.map +0 -1
  340. package/lib/kv-connector.d.ts +0 -77
  341. package/lib/kv-connector.js +0 -7
  342. package/lib/kv-connector.js.map +0 -1
  343. package/lib/kv-repository.d.ts +0 -78
  344. package/lib/kv-repository.js +0 -7
  345. package/lib/kv-repository.js.map +0 -1
  346. package/lib/legacy-juggler-bridge.d.ts +0 -53
  347. package/lib/legacy-juggler-bridge.js +0 -142
  348. package/lib/legacy-juggler-bridge.js.map +0 -1
  349. package/lib/loopback-datasource-juggler.d.ts +0 -666
  350. package/lib/loopback-datasource-juggler.js +0 -8
  351. package/lib/loopback-datasource-juggler.js.map +0 -1
  352. package/lib/mixin.d.ts +0 -43
  353. package/lib/mixin.js +0 -34
  354. package/lib/mixin.js.map +0 -1
  355. package/lib/model.d.ts +0 -137
  356. package/lib/model.js +0 -182
  357. package/lib/model.js.map +0 -1
  358. package/lib/query.d.ts +0 -112
  359. package/lib/query.js +0 -25
  360. package/lib/query.js.map +0 -1
  361. package/lib/repository.d.ts +0 -172
  362. package/lib/repository.js +0 -127
  363. package/lib/repository.js.map +0 -1
  364. package/lib/types/any.js +0 -35
  365. package/lib/types/any.js.map +0 -1
  366. package/lib/types/array.d.ts +0 -14
  367. package/lib/types/array.js +0 -53
  368. package/lib/types/array.js.map +0 -1
  369. package/lib/types/boolean.js.map +0 -1
  370. package/lib/types/buffer.d.ts +0 -14
  371. package/lib/types/buffer.js.map +0 -1
  372. package/lib/types/date.js.map +0 -1
  373. package/lib/types/index.js +0 -33
  374. package/lib/types/index.js.map +0 -1
  375. package/lib/types/model.d.ts +0 -11
  376. package/lib/types/model.js +0 -25
  377. package/lib/types/model.js.map +0 -1
  378. package/lib/types/number.d.ts +0 -12
  379. package/lib/types/number.js.map +0 -1
  380. package/lib/types/object.js.map +0 -1
  381. package/lib/types/string.js.map +0 -1
  382. package/lib/types/type.d.ts +0 -38
  383. package/lib/types/type.js +0 -7
  384. package/lib/types/type.js.map +0 -1
  385. package/lib/types/union.js.map +0 -1
  386. package/lib6/common-types.d.ts +0 -44
  387. package/lib6/common-types.js +0 -7
  388. package/lib6/common-types.js.map +0 -1
  389. package/lib6/connector.d.ts +0 -12
  390. package/lib6/connector.js +0 -7
  391. package/lib6/connector.js.map +0 -1
  392. package/lib6/crud-connector.d.ts +0 -130
  393. package/lib6/crud-connector.js +0 -7
  394. package/lib6/crud-connector.js.map +0 -1
  395. package/lib6/datasource.d.ts +0 -11
  396. package/lib6/datasource.js.map +0 -1
  397. package/lib6/decorators/model.d.ts +0 -17
  398. package/lib6/decorators/model.js +0 -55
  399. package/lib6/decorators/model.js.map +0 -1
  400. package/lib6/decorators/relation.d.ts +0 -65
  401. package/lib6/decorators/relation.js +0 -126
  402. package/lib6/decorators/relation.js.map +0 -1
  403. package/lib6/decorators/repository.d.ts +0 -61
  404. package/lib6/decorators/repository.js +0 -117
  405. package/lib6/decorators/repository.js.map +0 -1
  406. package/lib6/index.d.ts +0 -16
  407. package/lib6/index.js +0 -20
  408. package/lib6/index.js.map +0 -1
  409. package/lib6/kv-connector.js +0 -7
  410. package/lib6/kv-connector.js.map +0 -1
  411. package/lib6/kv-repository.d.ts +0 -78
  412. package/lib6/kv-repository.js +0 -7
  413. package/lib6/kv-repository.js.map +0 -1
  414. package/lib6/legacy-juggler-bridge.d.ts +0 -53
  415. package/lib6/legacy-juggler-bridge.js +0 -158
  416. package/lib6/legacy-juggler-bridge.js.map +0 -1
  417. package/lib6/loopback-datasource-juggler.d.ts +0 -666
  418. package/lib6/loopback-datasource-juggler.js +0 -8
  419. package/lib6/loopback-datasource-juggler.js.map +0 -1
  420. package/lib6/mixin.d.ts +0 -43
  421. package/lib6/mixin.js +0 -34
  422. package/lib6/mixin.js.map +0 -1
  423. package/lib6/model.d.ts +0 -137
  424. package/lib6/model.js +0 -182
  425. package/lib6/model.js.map +0 -1
  426. package/lib6/query.d.ts +0 -112
  427. package/lib6/query.js +0 -25
  428. package/lib6/query.js.map +0 -1
  429. package/lib6/repository.d.ts +0 -172
  430. package/lib6/repository.js +0 -127
  431. package/lib6/repository.js.map +0 -1
  432. package/lib6/types/any.d.ts +0 -12
  433. package/lib6/types/any.js.map +0 -1
  434. package/lib6/types/array.js.map +0 -1
  435. package/lib6/types/boolean.d.ts +0 -12
  436. package/lib6/types/boolean.js.map +0 -1
  437. package/lib6/types/buffer.js +0 -57
  438. package/lib6/types/buffer.js.map +0 -1
  439. package/lib6/types/date.d.ts +0 -12
  440. package/lib6/types/date.js +0 -60
  441. package/lib6/types/date.js.map +0 -1
  442. package/lib6/types/index.d.ts +0 -30
  443. package/lib6/types/index.js +0 -33
  444. package/lib6/types/index.js.map +0 -1
  445. package/lib6/types/model.js.map +0 -1
  446. package/lib6/types/number.js +0 -40
  447. package/lib6/types/number.js.map +0 -1
  448. package/lib6/types/object.d.ts +0 -15
  449. package/lib6/types/object.js +0 -49
  450. package/lib6/types/object.js.map +0 -1
  451. package/lib6/types/string.d.ts +0 -12
  452. package/lib6/types/string.js +0 -40
  453. package/lib6/types/string.js.map +0 -1
  454. package/lib6/types/type.js.map +0 -1
  455. package/lib6/types/union.d.ts +0 -14
  456. package/lib6/types/union.js +0 -51
  457. package/lib6/types/union.js.map +0 -1
@@ -1,666 +0,0 @@
1
- /// <reference types="node" />
2
- import { Options, Callback, AnyObject } from './common-types';
3
- import { EventEmitter } from 'events';
4
- export declare namespace juggler {
5
- /**
6
- * Return type for promisified Node.js async methods
7
- */
8
- type PromiseOrVoid<T> = Promise<T> | void;
9
- /**
10
- * Property definition
11
- */
12
- interface PropertyDefinition extends AnyObject {
13
- name: string;
14
- type: any;
15
- }
16
- /**
17
- * Relation definition
18
- */
19
- interface RelationDefinition extends AnyObject {
20
- name: string;
21
- type: string;
22
- }
23
- /**
24
- * Schema definition
25
- */
26
- interface Schema {
27
- name: string;
28
- properties: AnyObject;
29
- settings?: AnyObject;
30
- }
31
- /**
32
- * ID definition
33
- */
34
- interface IdDefinition {
35
- name: string;
36
- id: number;
37
- property: AnyObject;
38
- }
39
- /**
40
- * Index definition
41
- */
42
- interface IndexDefinition extends AnyObject {
43
- }
44
- /**
45
- * Column metadata
46
- */
47
- interface ColumnMetadata extends AnyObject {
48
- name: string;
49
- }
50
- /**
51
- * Model definition
52
- */
53
- class ModelDefinition extends EventEmitter implements Schema {
54
- name: string;
55
- properties: AnyObject;
56
- rawProperties: AnyObject;
57
- settings?: AnyObject;
58
- relations?: AnyObject[];
59
- constructor(modelBuilder: ModelBuilder | null | undefined, name: string, properties?: {
60
- [name: string]: PropertyDefinition;
61
- }, settings?: AnyObject);
62
- constructor(modelBuilder: ModelBuilder | null | undefined, schema: Schema);
63
- tableName(connectorType: string): string;
64
- columnName(connectorType: string, propertyName: string): string;
65
- columnNames(connectorType: string): string[];
66
- columnMetadata(connectorType: string, propertyName: string): ColumnMetadata;
67
- ids(): IdDefinition[];
68
- idName(): string;
69
- idNames(): string[];
70
- defineProperty(propertyName: string, propertyDefinition: PropertyDefinition): void;
71
- indexes(): {
72
- [name: string]: IndexDefinition;
73
- };
74
- build(forceRebuild?: boolean): AnyObject;
75
- toJSON(forceRebuild?: boolean): AnyObject;
76
- }
77
- /**
78
- * Base model class
79
- */
80
- class ModelBase {
81
- static modelName: string;
82
- static definition: ModelDefinition;
83
- static attachTo(ds: DataSource): void;
84
- constructor(...args: any[]);
85
- toJSON(): Object;
86
- toObject(options?: Options): Object;
87
- [property: string]: any;
88
- }
89
- class ModelBuilder extends EventEmitter {
90
- static defaultInstance: ModelBuilder;
91
- models: {
92
- [name: string]: typeof ModelBase;
93
- };
94
- definitions: {
95
- [name: string]: ModelDefinition;
96
- };
97
- settings: AnyObject;
98
- getModel(name: string, forceCreate?: boolean): typeof ModelBase;
99
- getModelDefinition(name: string): ModelDefinition | undefined;
100
- define(className: string, properties?: AnyObject, settings?: AnyObject, parent?: typeof ModelBase): typeof ModelBase;
101
- defineProperty(modelName: string, propertyName: string, propertyDefinition: AnyObject): void;
102
- defineValueType(type: string, aliases?: string[]): void;
103
- extendModel(modelName: string, properties: AnyObject): void;
104
- getSchemaName(name?: string): string;
105
- resolveType(type: any): any;
106
- buildModels(schemas: AnyObject, createModel?: Function): {
107
- [name: string]: typeof ModelBase;
108
- };
109
- buildModelFromInstance(name: string, json: AnyObject, options: Options): typeof ModelBase;
110
- }
111
- /**
112
- * DataSource instance properties/operations
113
- */
114
- class DataSource {
115
- name: string;
116
- settings: AnyObject;
117
- constructor(name?: string, settings?: AnyObject, modelBuilder?: ModelBuilder);
118
- constructor(settings?: AnyObject, modelBuilder?: ModelBuilder);
119
- /**
120
- * Create a model class
121
- * @param name Name of the model
122
- * @param properties An object of property definitions
123
- * @param options Options for model settings
124
- */
125
- createModel<T extends typeof ModelBase>(name: string, properties?: AnyObject, options?: Options): T;
126
- }
127
- /**
128
- * Union type for model instance or plain object representing the model
129
- * instance
130
- */
131
- type ModelData<T extends ModelBase> = T | AnyObject;
132
- /**
133
- * Operators for where clauses
134
- */
135
- enum Operators {
136
- eq,
137
- neq,
138
- gt,
139
- gte,
140
- lt,
141
- lte,
142
- inq,
143
- between,
144
- exists,
145
- and,
146
- or,
147
- }
148
- interface Condition {
149
- eq?: any;
150
- neq?: any;
151
- gt?: any;
152
- get?: any;
153
- lt?: any;
154
- lte?: any;
155
- inq?: any[];
156
- between?: any[];
157
- exists?: boolean;
158
- and?: Where[];
159
- or?: Where[];
160
- }
161
- /**
162
- * Where object
163
- */
164
- interface Where {
165
- and?: Where[];
166
- or?: Where[];
167
- [property: string]: Condition | any;
168
- }
169
- /**
170
- * Order by direction
171
- */
172
- type Direction = 'ASC' | 'DESC';
173
- /**
174
- * Order by
175
- */
176
- interface Order {
177
- [property: string]: Direction;
178
- }
179
- /**
180
- * Selection of fields
181
- */
182
- interface Fields {
183
- [property: string]: boolean;
184
- }
185
- /**
186
- * Inclusion of related items
187
- */
188
- interface Inclusion {
189
- relation: string;
190
- scope: Filter;
191
- }
192
- /**
193
- * Query filter object
194
- */
195
- interface Filter {
196
- where?: Where;
197
- fields?: Fields;
198
- order?: Order[];
199
- limit?: number;
200
- skip?: number;
201
- offset?: number;
202
- include?: Inclusion[];
203
- }
204
- type PersistedData = ModelData<PersistedModel>;
205
- interface Count {
206
- count: number;
207
- }
208
- class PersistedModel extends ModelBase {
209
- /**
210
- * Create new instance of Model, and save to database.
211
- *
212
- * @param {Object|Object[]} [data] Optional data argument. Can be either a
213
- * single model instance or an array of instances.
214
- *
215
- * @callback {Function} callback Callback function called with `cb(err, obj)` signature.
216
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
217
- * @param {Object} models Model instances or null.
218
- */
219
- static create(data: PersistedData, options?: Options, callback?: Callback<PersistedData>): PromiseOrVoid<PersistedData>;
220
- /**
221
- * Update or insert a model instance
222
- * @param {Object} data The model instance data to insert.
223
- * @callback {Function} callback Callback function called with `cb(err, obj)` signature.
224
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
225
- * @param {Object} model Updated model instance.
226
- */
227
- static upsert(data: PersistedData, options?: Options, callback?: Callback<PersistedData>): PromiseOrVoid<PersistedData>;
228
- static updateOrCreate(data: PersistedData, options?: Options, callback?: Callback<PersistedData>): PromiseOrVoid<PersistedData>;
229
- static patchOrCreate(data: PersistedData, options?: Options, callback?: Callback<PersistedData>): PromiseOrVoid<PersistedData>;
230
- /**
231
- * Update or insert a model instance based on the search criteria.
232
- * If there is a single instance retrieved, update the retrieved model.
233
- * Creates a new model if no model instances were found.
234
- * Returns an error if multiple instances are found.
235
- * @param {Object} [where] `where` filter, like
236
- * ```
237
- * { key: val, key2: {gt: 'val2'}, ...}
238
- * ```
239
- * <br/>see
240
- * [Where filter](http://loopback.io/doc/en/lb2/Where-filter.html#where-clause-for-other-methods).
241
- * @param {Object} data The model instance data to insert.
242
- * @callback {Function} callback Callback function called with `cb(err, obj)` signature.
243
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
244
- * @param {Object} model Updated model instance.
245
- */
246
- static upsertWithWhere(where: Where, data: PersistedData, options?: Options, callback?: Callback<PersistedData>): PromiseOrVoid<PersistedData>;
247
- static patchOrCreateWithWhere(where: Where, data: PersistedData, options?: Options, callback?: Callback<PersistedData>): PromiseOrVoid<PersistedData>;
248
- /**
249
- * Replace or insert a model instance; replace existing record if one is found,
250
- * such that parameter `data.id` matches `id` of model instance; otherwise,
251
- * insert a new record.
252
- * @param {Object} data The model instance data.
253
- * @options {Object} [options] Options for replaceOrCreate
254
- * @property {Boolean} validate Perform validation before saving. Default is true.
255
- * @callback {Function} callback Callback function called with `cb(err, obj)` signature.
256
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
257
- * @param {Object} model Replaced model instance.
258
- */
259
- static replaceOrCreate(data: PersistedData, options?: Options, callback?: Callback<PersistedData>): PromiseOrVoid<PersistedData>;
260
- /**
261
- * Finds one record matching the optional filter object. If not found, creates
262
- * the object using the data provided as second argument. In this sense it is
263
- * the same as `find`, but limited to one object. Returns an object, not
264
- * collection. If you don't provide the filter object argument, it tries to
265
- * locate an existing object that matches the `data` argument.
266
- *
267
- * @options {Object} [filter] Optional Filter object; see below.
268
- * @property {String|Object|Array} fields Identify fields to include in return result.
269
- * <br/>See [Fields filter](http://loopback.io/doc/en/lb2/Fields-filter.html).
270
- * @property {String|Object|Array} include See PersistedModel.include documentation.
271
- * <br/>See [Include filter](http://loopback.io/doc/en/lb2/Include-filter.html).
272
- * @property {Number} limit Maximum number of instances to return.
273
- * <br/>See [Limit filter](http://loopback.io/doc/en/lb2/Limit-filter.html).
274
- * @property {String} order Sort order: either "ASC" for ascending or "DESC" for descending.
275
- * <br/>See [Order filter](http://loopback.io/doc/en/lb2/Order-filter.html).
276
- * @property {Number} skip Number of results to skip.
277
- * <br/>See [Skip filter](http://loopback.io/doc/en/lb2/Skip-filter.html).
278
- * @property {Object} where Where clause, like
279
- * ```
280
- * {where: {key: val, key2: {gt: val2}, ...}}
281
- * ```
282
- * <br/>See
283
- * [Where filter](http://loopback.io/doc/en/lb2/Where-filter.html#where-clause-for-queries).
284
- * @param {Object} data Data to insert if object matching the `where` filter is not found.
285
- * @callback {Function} callback Callback function called with `cb(err, instance, created)` arguments. Required.
286
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
287
- * @param {Object} instance Model instance matching the `where` filter, if found.
288
- * @param {Boolean} created True if the instance does not exist and gets created.
289
- */
290
- static findOrCreate(filter: Filter, data: PersistedData, options?: Options, callback?: Callback<PersistedData>): PromiseOrVoid<PersistedData>;
291
- /**
292
- * Check whether a model instance exists in database.
293
- *
294
- * @param {id} id Identifier of object (primary key value).
295
- *
296
- * @callback {Function} callback Callback function called with `(err, exists)` arguments. Required.
297
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
298
- * @param {Boolean} exists True if the instance with the specified ID exists; false otherwise.
299
- */
300
- static exists(id: any, options?: Options, callback?: Callback<boolean>): PromiseOrVoid<boolean>;
301
- /**
302
- * Find object by ID with an optional filter for include/fields.
303
- *
304
- * @param {*} id Primary key value
305
- * @options {Object} [filter] Optional Filter JSON object; see below.
306
- * @property {String|Object|Array} fields Identify fields to include in return result.
307
- * <br/>See [Fields filter](http://loopback.io/doc/en/lb2/Fields-filter.html).
308
- * @property {String|Object|Array} include See PersistedModel.include documentation.
309
- * <br/>See [Include filter](http://loopback.io/doc/en/lb2/Include-filter.html).
310
- * @callback {Function} callback Callback function called with `(err, instance)` arguments. Required.
311
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
312
- * @param {Object} instance Model instance matching the specified ID or null if no instance matches.
313
- */
314
- static findById(id: any, filter?: Filter, options?: Options, callback?: Callback<boolean>): PromiseOrVoid<PersistedData>;
315
- /**
316
- * Find all model instances that match `filter` specification.
317
- * See [Querying models](http://loopback.io/doc/en/lb2/Querying-data.html).
318
- *
319
- * @options {Object} [filter] Optional Filter JSON object; see below.
320
- * @property {String|Object|Array} fields Identify fields to include in return result.
321
- * <br/>See [Fields filter](http://loopback.io/doc/en/lb2/Fields-filter.html).
322
- * @property {String|Object|Array} include See PersistedModel.include documentation.
323
- * <br/>See [Include filter](http://loopback.io/doc/en/lb2/Include-filter.html).
324
- * @property {Number} limit Maximum number of instances to return.
325
- * <br/>See [Limit filter](http://loopback.io/doc/en/lb2/Limit-filter.html).
326
- * @property {String} order Sort order: either "ASC" for ascending or "DESC" for descending.
327
- * <br/>See [Order filter](http://loopback.io/doc/en/lb2/Order-filter.html).
328
- * @property {Number} skip Number of results to skip.
329
- * <br/>See [Skip filter](http://loopback.io/doc/en/lb2/Skip-filter.html).
330
- * @property {Object} where Where clause, like
331
- * ```
332
- * { where: { key: val, key2: {gt: 'val2'}, ...} }
333
- * ```
334
- * <br/>See
335
- * [Where filter](http://loopback.io/doc/en/lb2/Where-filter.html#where-clause-for-queries).
336
- *
337
- * @callback {Function} callback Callback function called with `(err, returned-instances)` arguments. Required.
338
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
339
- * @param {Array} models Model instances matching the filter, or null if none found.
340
- */
341
- static find(filter?: Filter, options?: Options, callback?: Callback<PersistedData>): PromiseOrVoid<PersistedData[]>;
342
- /**
343
- * Find one model instance that matches `filter` specification.
344
- * Same as `find`, but limited to one result;
345
- * Returns object, not collection.
346
- *
347
- * @options {Object} [filter] Optional Filter JSON object; see below.
348
- * @property {String|Object|Array} fields Identify fields to include in return result.
349
- * <br/>See [Fields filter](http://loopback.io/doc/en/lb2/Fields-filter.html).
350
- * @property {String|Object|Array} include See PersistedModel.include documentation.
351
- * <br/>See [Include filter](http://loopback.io/doc/en/lb2/Include-filter.html).
352
- * @property {String} order Sort order: either "ASC" for ascending or "DESC" for descending.
353
- * <br/>See [Order filter](http://loopback.io/doc/en/lb2/Order-filter.html).
354
- * @property {Number} skip Number of results to skip.
355
- * <br/>See [Skip filter](http://loopback.io/doc/en/lb2/Skip-filter.html).
356
- * @property {Object} where Where clause, like
357
- * ```
358
- * {where: { key: val, key2: {gt: 'val2'}, ...} }
359
- * ```
360
- * <br/>See
361
- * [Where filter](http://loopback.io/doc/en/lb2/Where-filter.html#where-clause-for-queries).
362
- *
363
- * @callback {Function} callback Callback function called with `(err, returned-instance)` arguments. Required.
364
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
365
- * @param {Array} model First model instance that matches the filter or null if none found.
366
- */
367
- static findOne(filter?: Filter, options?: Options, callback?: Callback<PersistedData>): PromiseOrVoid<PersistedData>;
368
- /**
369
- * Destroy all model instances that match the optional `where` specification.
370
- *
371
- * @param {Object} [where] Optional where filter, like:
372
- * ```
373
- * {key: val, key2: {gt: 'val2'}, ...}
374
- * ```
375
- * <br/>See
376
- * [Where filter](http://loopback.io/doc/en/lb2/Where-filter.html#where-clause-for-other-methods).
377
- *
378
- * @callback {Function} callback Optional callback function called with `(err, info)` arguments.
379
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
380
- * @param {Object} info Additional information about the command outcome.
381
- * @param {Number} info.count Number of instances (rows, documents) destroyed.
382
- */
383
- static destroyAll(where?: Where, options?: Options, callback?: Callback<Count>): PromiseOrVoid<Count>;
384
- static remove(where?: Where, options?: Options, callback?: Callback<Count>): PromiseOrVoid<Count>;
385
- static deleteAll(where?: Where, options?: Options, callback?: Callback<Count>): PromiseOrVoid<Count>;
386
- /**
387
- * Update multiple instances that match the where clause.
388
- *
389
- * Example:
390
- *
391
- *```js
392
- * Employee.updateAll({managerId: 'x001'}, {managerId: 'x002'}, function(err, info) {
393
- * ...
394
- * });
395
- * ```
396
- *
397
- * @param {Object} [where] Optional `where` filter, like
398
- * ```
399
- * { key: val, key2: {gt: 'val2'}, ...}
400
- * ```
401
- * <br/>see
402
- * [Where filter](http://loopback.io/doc/en/lb2/Where-filter.html#where-clause-for-other-methods).
403
- * @param {Object} data Object containing data to replace matching instances, if AnyType.
404
- *
405
- * @callback {Function} callback Callback function called with `(err, info)` arguments. Required.
406
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
407
- * @param {Object} info Additional information about the command outcome.
408
- * @param {Number} info.count Number of instances (rows, documents) updated.
409
- *
410
- */
411
- static updateAll(where?: Where, data?: PersistedData, options?: Options, callback?: Callback<Count>): PromiseOrVoid<Count>;
412
- static update(where?: Where, data?: PersistedData, options?: Options, callback?: Callback<Count>): PromiseOrVoid<Count>;
413
- /**
414
- * Destroy model instance with the specified ID.
415
- * @param {*} id The ID value of model instance to delete.
416
- * @callback {Function} callback Callback function called with `(err)` arguments. Required.
417
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
418
- */
419
- static destroyById(id: any, options?: Options, callback?: Callback<Count>): PromiseOrVoid<Count>;
420
- static removeById(id: any, options?: Options, callback?: Callback<Count>): PromiseOrVoid<Count>;
421
- static deleteById(id: any, options?: Options, callback?: Callback<Count>): PromiseOrVoid<Count>;
422
- /**
423
- * Replace attributes for a model instance whose id is the first input
424
- * argument and persist it into the datasource.
425
- * Performs validation before replacing.
426
- *
427
- * @param {*} id The ID value of model instance to replace.
428
- * @param {Object} data Data to replace.
429
- * @options {Object} [options] Options for replace
430
- * @property {Boolean} validate Perform validation before saving. Default is true.
431
- * @callback {Function} callback Callback function called with `(err, instance)` arguments.
432
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
433
- * @param {Object} instance Replaced instance.
434
- */
435
- static replaceById(id: any, data: PersistedData, options?: Options, callback?: Callback<PersistedData>): PromiseOrVoid<PersistedData>;
436
- /**
437
- * Return the number of records that match the optional "where" filter.
438
- * @param {Object} [where] Optional where filter, like
439
- * ```
440
- * { key: val, key2: {gt: 'val2'}, ...}
441
- * ```
442
- * <br/>See
443
- * [Where filter](http://loopback.io/doc/en/lb2/Where-filter.html#where-clause-for-other-methods).
444
- * @callback {Function} callback Callback function called with `(err, count)` arguments. Required.
445
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
446
- * @param {Number} count Number of instances.
447
- */
448
- static count(where?: Where, options?: Options, callback?: Callback<number>): PromiseOrVoid<number>;
449
- /**
450
- * Save model instance. If the instance doesn't have an ID, then calls [create](#persistedmodelcreatedata-cb) instead.
451
- * Triggers: validate, save, update, or create.
452
- * @options {Object} [options] See below.
453
- * @property {Boolean} validate Perform validation before saving. Default is true.
454
- * @property {Boolean} throws If true, throw a validation error; WARNING: This can crash Node.
455
- * If false, report the error via callback. Default is false.
456
- * @callback {Function} callback Optional callback function called with `(err, obj)` arguments.
457
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
458
- * @param {Object} instance Model instance saved or created.
459
- */
460
- save(options?: Options, callback?: Callback<boolean>): PromiseOrVoid<boolean>;
461
- /**
462
- * Determine if the data model is new.
463
- * @returns {Boolean} Returns true if the data model is new; false otherwise.
464
- */
465
- isNewRecord(): boolean;
466
- /**
467
- * Deletes the model from persistence.
468
- * Triggers `destroy` hook (async) before and after destroying object.
469
- * @param {Function} callback Callback function.
470
- */
471
- destroy(options?: Options, callback?: Callback<boolean>): PromiseOrVoid<boolean>;
472
- remove(options?: Options, callback?: Callback<boolean>): PromiseOrVoid<boolean>;
473
- delete(options?: Options, callback?: Callback<boolean>): PromiseOrVoid<boolean>;
474
- /**
475
- * Update a single attribute.
476
- * Equivalent to `updateAttributes({name: 'value'}, cb)`
477
- *
478
- * @param {String} name Name of property.
479
- * @param {Mixed} value Value of property.
480
- * @callback {Function} callback Callback function called with `(err, instance)` arguments. Required.
481
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
482
- * @param {Object} instance Updated instance.
483
- */
484
- updateAttribute(name: string, value: any, options?: Options, callback?: Callback<boolean>): PromiseOrVoid<boolean>;
485
- /**
486
- * Update set of attributes. Performs validation before updating.
487
- *
488
- * Triggers: `validation`, `save` and `update` hooks
489
- * @param {Object} data Data to update.
490
- * @callback {Function} callback Callback function called with `(err, instance)` arguments. Required.
491
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
492
- * @param {Object} instance Updated instance.
493
- */
494
- updateAttributes(data: PersistedData, options?: Options, callback?: Callback<boolean>): PromiseOrVoid<boolean>;
495
- /**
496
- * Replace attributes for a model instance and persist it into the datasource.
497
- * Performs validation before replacing.
498
- *
499
- * @param {Object} data Data to replace.
500
- * @options {Object} [options] Options for replace
501
- * @property {Boolean} validate Perform validation before saving. Default is true.
502
- * @callback {Function} callback Callback function called with `(err, instance)` arguments.
503
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
504
- * @param {Object} instance Replaced instance.
505
- */
506
- replaceAttributes(data: PersistedData, options?: Options, callback?: Callback<boolean>): PromiseOrVoid<boolean>;
507
- /**
508
- * Reload object from persistence. Requires `id` member of `object` to be able to call `find`.
509
- * @callback {Function} callback Callback function called with `(err, instance)` arguments. Required.
510
- * @param {Error} err Error object; see [Error object](http://loopback.io/doc/en/lb2/Error-object.html).
511
- * @param {Object} instance Model instance.
512
- */
513
- reload(options?: Options, callback?: Callback<PersistedData>): PromiseOrVoid<PersistedData>;
514
- /**
515
- * Set the correct `id` property for the `PersistedModel`. Uses the `setId` method if the model is attached to
516
- * connector that defines it. Otherwise, uses the default lookup.
517
- * Override this method to handle complex IDs.
518
- *
519
- * @param {*} val The `id` value. Will be converted to the type that the `id` property specifies.
520
- */
521
- setId(val: any): void;
522
- /**
523
- * Get the `id` value for the `PersistedModel`.
524
- *
525
- * @returns {*} The `id` value
526
- */
527
- getId(): any;
528
- /**
529
- * Get the `id` property name of the constructor.
530
- *
531
- * @returns {String} The `id` property name
532
- */
533
- getIdName(): string;
534
- /**
535
- * Get the `id` property name of the constructor.
536
- *
537
- * @returns {String} The `id` property name
538
- */
539
- static getIdName(): string;
540
- }
541
- type KVData = ModelData<KeyValueModel>;
542
- class KeyValueModel extends ModelBase {
543
- /**
544
- * Return the value associated with a given key.
545
- *
546
- * @param {String} key Key to use when searching the database.
547
- * @options {Object} options
548
- * @callback {Function} callback
549
- * @param {Error} err Error object.
550
- * @param {Any} result Value associated with the given key.
551
- * @promise
552
- *
553
- * @header KeyValueModel.get(key, cb)
554
- */
555
- get(key: string, options?: Options, callback?: Callback<KVData>): PromiseOrVoid<KVData>;
556
- /**
557
- * Persist a value and associate it with the given key.
558
- *
559
- * @param {String} key Key to associate with the given value.
560
- * @param {Any} value Value to persist.
561
- * @options {Number|Object} options Optional settings for the key-value
562
- * pair. If a Number is provided, it is set as the TTL (time to live) in ms
563
- * (milliseconds) for the key-value pair.
564
- * @property {Number} ttl TTL for the key-value pair in ms.
565
- * @callback {Function} callback
566
- * @param {Error} err Error object.
567
- * @promise
568
- *
569
- * @header KeyValueModel.set(key, value, cb)
570
- */
571
- set(key: string, value: KVData, options?: Options, callback?: Callback<boolean>): PromiseOrVoid<boolean>;
572
- /**
573
- * Set the TTL (time to live) in ms (milliseconds) for a given key. TTL is the
574
- * remaining time before a key-value pair is discarded from the database.
575
- *
576
- * @param {String} key Key to use when searching the database.
577
- * @param {Number} ttl TTL in ms to set for the key.
578
- * @options {Object} options
579
- * @callback {Function} callback
580
- * @param {Error} err Error object.
581
- * @promise
582
- *
583
- * @header KeyValueModel.expire(key, ttl, cb)
584
- */
585
- expire(key: string, ttl: number, options?: Options, callback?: Callback<number>): PromiseOrVoid<number>;
586
- /**
587
- * Return the TTL (time to live) for a given key. TTL is the remaining time
588
- * before a key-value pair is discarded from the database.
589
- *
590
- * @param {String} key Key to use when searching the database.
591
- * @options {Object} options
592
- * @callback {Function} callback
593
- * @param {Error} error
594
- * @param {Number} ttl Expiration time for the key-value pair. `undefined` if
595
- * TTL was not initially set.
596
- * @promise
597
- *
598
- * @header KeyValueModel.ttl(key, cb)
599
- */
600
- ttl(key: string, options?: Options, callback?: Callback<number>): PromiseOrVoid<number>;
601
- /**
602
- * Return all keys in the database.
603
- *
604
- * **WARNING**: This method is not suitable for large data sets as all
605
- * key-values pairs are loaded into memory at once. For large data sets,
606
- * use `iterateKeys()` instead.
607
- *
608
- * @param {Object} filter An optional filter object with the following
609
- * @param {String} filter.match Glob string used to filter returned
610
- * keys (i.e. `userid.*`). All connectors are required to support `*` and
611
- * `?`, but may also support additional special characters specific to the
612
- * database.
613
- * @param {Object} options
614
- * @callback {Function} callback
615
- * @promise
616
- *
617
- * @header KeyValueModel.keys(filter, cb)
618
- */
619
- keys(filter?: Filter, options?: Options, callback?: Callback<string[]>): PromiseOrVoid<string[]>;
620
- /**
621
- * Asynchronously iterate all keys in the database. Similar to `.keys()` but
622
- * instead allows for iteration over large data sets without having to load
623
- * everything into memory at once.
624
- *
625
- * Callback example:
626
- * ```js
627
- * // Given a model named `Color` with two keys `red` and `blue`
628
- * var iterator = Color.iterateKeys();
629
- * it.next(function(err, key) {
630
- * // key contains `red`
631
- * it.next(function(err, key) {
632
- * // key contains `blue`
633
- * });
634
- * });
635
- * ```
636
- *
637
- * Promise example:
638
- * ```js
639
- * // Given a model named `Color` with two keys `red` and `blue`
640
- * var iterator = Color.iterateKeys();
641
- * Promise.resolve().then(function() {
642
- * return it.next();
643
- * })
644
- * .then(function(key) {
645
- * // key contains `red`
646
- * return it.next();
647
- * });
648
- * .then(function(key) {
649
- * // key contains `blue`
650
- * });
651
- * ```
652
- *
653
- * @param {Object} filter An optional filter object with the following
654
- * @param {String} filter.match Glob string to use to filter returned
655
- * keys (i.e. `userid.*`). All connectors are required to support `*` and
656
- * `?`. They may also support additional special characters that are
657
- * specific to the backing database.
658
- * @param {Object} options
659
- * @returns {AsyncIterator} An Object implementing `next(cb) -> Promise`
660
- * function that can be used to iterate all keys.
661
- *
662
- * @header KeyValueModel.iterateKeys(filter)
663
- */
664
- iterateKeys(filter?: Filter, options?: Options): Iterator<Promise<string>>;
665
- }
666
- }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2017. All Rights Reserved.
3
- // Node module: @loopback/repository
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const events_1 = require("events");
8
- //# sourceMappingURL=loopback-datasource-juggler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loopback-datasource-juggler.js","sourceRoot":"","sources":["../src/loopback-datasource-juggler.ts"],"names":[],"mappings":";AAAA,iDAAiD;AACjD,oCAAoC;AACpC,+CAA+C;AAC/C,gEAAgE;;AAGhE,mCAAoC"}