orange-orm 3.10.2

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 (459) hide show
  1. package/.dockerignore +1 -0
  2. package/.eslintignore +2 -0
  3. package/.eslintrc.js +45 -0
  4. package/.gitattributes +3 -0
  5. package/CNAME +1 -0
  6. package/CONTRIBUTING.md +43 -0
  7. package/LICENSE +7 -0
  8. package/README.md +1969 -0
  9. package/SECURITY.md +12 -0
  10. package/bin/build.js +127 -0
  11. package/bin/compile.js +26 -0
  12. package/bin/rdb.js +4 -0
  13. package/docs/CODE_OF_CONDUCT.md +18 -0
  14. package/docs/changelog.md +461 -0
  15. package/docs/docs.md +2373 -0
  16. package/docs/orange.svg +32 -0
  17. package/docs/relations.png +0 -0
  18. package/package.json +139 -0
  19. package/src/applyPatch.js +105 -0
  20. package/src/client/axiosInterceptor.js +46 -0
  21. package/src/client/clientMap.js +72 -0
  22. package/src/client/createPatch.js +122 -0
  23. package/src/client/createProviders.js +121 -0
  24. package/src/client/index.js +997 -0
  25. package/src/client/index.mjs +6295 -0
  26. package/src/client/map.js +110 -0
  27. package/src/client/merge.js +9 -0
  28. package/src/client/netAdapter.js +133 -0
  29. package/src/client/rollup.config.js +12 -0
  30. package/src/client/self.js +4 -0
  31. package/src/client/stringify.js +22 -0
  32. package/src/client/toKeyPositionMap.js +30 -0
  33. package/src/clsTest.js +79 -0
  34. package/src/createDomain/negotiateForwardProperty.js +23 -0
  35. package/src/createDomain.js +31 -0
  36. package/src/dateToISOString.js +25 -0
  37. package/src/emitEvent.js +46 -0
  38. package/src/emptyFilter.js +35 -0
  39. package/src/flags.js +6 -0
  40. package/src/fromCompareObject.js +24 -0
  41. package/src/generic-pool.js +641 -0
  42. package/src/getManyDto/newQuery.js +18 -0
  43. package/src/getManyDto/query/newColumnSql.js +8 -0
  44. package/src/getManyDto/query/newSingleQuery.js +19 -0
  45. package/src/getManyDto/query/singleQuery/newJoinedColumnSql.js +25 -0
  46. package/src/getManyDto/query/singleQuery/newShallowColumnSql.js +25 -0
  47. package/src/getManyDto.js +255 -0
  48. package/src/getTSDefinition.js +510 -0
  49. package/src/hostExpress/executePath.js +433 -0
  50. package/src/hostExpress/getMeta.js +49 -0
  51. package/src/hostExpress.js +125 -0
  52. package/src/hostLocal.js +110 -0
  53. package/src/index.d.ts +324 -0
  54. package/src/index.js +116 -0
  55. package/src/jsconfig.json +8 -0
  56. package/src/lock/toIntKey.js +35 -0
  57. package/src/lock.js +26 -0
  58. package/src/map.d.ts +1729 -0
  59. package/src/mssql/encodeBuffer.js +7 -0
  60. package/src/mssql/newDatabase.js +129 -0
  61. package/src/mssql/newPool.js +19 -0
  62. package/src/mssql/newTransaction.js +69 -0
  63. package/src/mssql/pool/defaults.js +45 -0
  64. package/src/mssql/pool/end.js +13 -0
  65. package/src/mssql/pool/newGenericPool.js +62 -0
  66. package/src/mssql/wrapQuery.js +34 -0
  67. package/src/mySql/deleteFromSql.js +8 -0
  68. package/src/mySql/encodeBoolean.js +7 -0
  69. package/src/mySql/insert.js +21 -0
  70. package/src/mySql/insertSql.js +62 -0
  71. package/src/mySql/lastInsertedSql.js +11 -0
  72. package/src/mySql/limitAndOffset.js +18 -0
  73. package/src/mySql/newDatabase.js +127 -0
  74. package/src/mySql/newPool.js +19 -0
  75. package/src/mySql/newTransaction.js +54 -0
  76. package/src/mySql/pool/defaults.js +16 -0
  77. package/src/mySql/pool/end.js +13 -0
  78. package/src/mySql/pool/negotiatePoolOptions.js +12 -0
  79. package/src/mySql/pool/newGenericPool.js +67 -0
  80. package/src/mySql/selectForUpdateSql.js +3 -0
  81. package/src/mySql/wrapQuery.js +16 -0
  82. package/src/mySql/wrapQueryStream.js +9 -0
  83. package/src/newArray.js +3 -0
  84. package/src/newCollection.js +55 -0
  85. package/src/newId.js +1 -0
  86. package/src/newImmutable.js +22 -0
  87. package/src/newObject.js +5 -0
  88. package/src/oracle/deleteFromSql.js +8 -0
  89. package/src/oracle/encodeBoolean.js +7 -0
  90. package/src/oracle/encodeBuffer.js +7 -0
  91. package/src/oracle/encodeDate.js +7 -0
  92. package/src/oracle/formatDateIn.js +5 -0
  93. package/src/oracle/formatDateOut.js +5 -0
  94. package/src/oracle/insert.js +23 -0
  95. package/src/oracle/insertSql.js +73 -0
  96. package/src/oracle/lastInsertedSql.js +14 -0
  97. package/src/oracle/limitAndOffset.js +18 -0
  98. package/src/oracle/mergeSql.js +79 -0
  99. package/src/oracle/newDatabase.js +128 -0
  100. package/src/oracle/newInsertCommandCore.js +27 -0
  101. package/src/oracle/newPool.js +19 -0
  102. package/src/oracle/newTransaction.js +63 -0
  103. package/src/oracle/outputInsertedSql.js +5 -0
  104. package/src/oracle/pool/defaults.js +45 -0
  105. package/src/oracle/pool/end.js +13 -0
  106. package/src/oracle/pool/newGenericPool.js +64 -0
  107. package/src/oracle/replaceParamChar.js +14 -0
  108. package/src/oracle/selectForUpdateSql.js +3 -0
  109. package/src/oracle/wrapQuery.js +38 -0
  110. package/src/patchRow.js +13 -0
  111. package/src/patchTable.js +317 -0
  112. package/src/pg/deleteFromSql.js +8 -0
  113. package/src/pg/encodeBoolean.js +5 -0
  114. package/src/pg/encodeDate.js +7 -0
  115. package/src/pg/encodeJSON.js +15 -0
  116. package/src/pg/formatDateOut.js +5 -0
  117. package/src/pg/insert.js +14 -0
  118. package/src/pg/insertSql.js +70 -0
  119. package/src/pg/lastInsertedSql.js +11 -0
  120. package/src/pg/limitAndOffset.js +18 -0
  121. package/src/pg/newDatabase.js +153 -0
  122. package/src/pg/newPool.js +19 -0
  123. package/src/pg/newStreamableQuery.js +7 -0
  124. package/src/pg/newTransaction.js +58 -0
  125. package/src/pg/pool/defaults.js +45 -0
  126. package/src/pg/pool/end.js +13 -0
  127. package/src/pg/pool/newPgPool.js +82 -0
  128. package/src/pg/replaceParamChar.js +14 -0
  129. package/src/pg/schema.js +11 -0
  130. package/src/pg/selectForUpdateSql.js +3 -0
  131. package/src/pg/wrapQuery.js +33 -0
  132. package/src/pg/wrapQueryStream.js +20 -0
  133. package/src/pools.js +17 -0
  134. package/src/query/negotiateParameters.js +10 -0
  135. package/src/query/negotiateSql.js +14 -0
  136. package/src/query/wrapQuery.js +17 -0
  137. package/src/query.js +13 -0
  138. package/src/sap/deleteFromSql.js +8 -0
  139. package/src/sap/encodeBoolean.js +7 -0
  140. package/src/sap/encodeBuffer.js +7 -0
  141. package/src/sap/formatDateOut.js +5 -0
  142. package/src/sap/insert.js +21 -0
  143. package/src/sap/insertSql.js +64 -0
  144. package/src/sap/lastInsertedSql.js +12 -0
  145. package/src/sap/limitAndOffset.js +16 -0
  146. package/src/sap/mergeSql.js +73 -0
  147. package/src/sap/newDatabase.js +129 -0
  148. package/src/sap/newPool.js +19 -0
  149. package/src/sap/newTransaction.js +69 -0
  150. package/src/sap/pool/end.js +13 -0
  151. package/src/sap/selectForUpdateSql.js +3 -0
  152. package/src/sqlite/deleteFromSql.js +8 -0
  153. package/src/sqlite/encodeBoolean.js +7 -0
  154. package/src/sqlite/encodeBuffer.js +7 -0
  155. package/src/sqlite/insert.js +21 -0
  156. package/src/sqlite/insertSql.js +64 -0
  157. package/src/sqlite/lastInsertedSql.js +12 -0
  158. package/src/sqlite/limitAndOffset.js +18 -0
  159. package/src/sqlite/newDatabase.js +128 -0
  160. package/src/sqlite/newPool.js +19 -0
  161. package/src/sqlite/newTransaction.js +58 -0
  162. package/src/sqlite/pool/defaults.js +45 -0
  163. package/src/sqlite/pool/end.js +13 -0
  164. package/src/sqlite/pool/newGenericPool.js +59 -0
  165. package/src/sqlite/selectForUpdateSql.js +3 -0
  166. package/src/sqlite/wrapQuery.js +24 -0
  167. package/src/table/aggregate.js +9 -0
  168. package/src/table/begin.js +10 -0
  169. package/src/table/cascadeDelete.js +11 -0
  170. package/src/table/cloneStrategy.js +18 -0
  171. package/src/table/column/binary/newDecode.js +15 -0
  172. package/src/table/column/binary/newEncode.js +23 -0
  173. package/src/table/column/binary/purify.js +12 -0
  174. package/src/table/column/binary.js +12 -0
  175. package/src/table/column/boolean/newDecode.js +12 -0
  176. package/src/table/column/boolean/newEncode.js +36 -0
  177. package/src/table/column/boolean/purify.js +7 -0
  178. package/src/table/column/boolean.js +14 -0
  179. package/src/table/column/date/formatOut.js +11 -0
  180. package/src/table/column/date/newDecode.js +17 -0
  181. package/src/table/column/date/newEncode.js +47 -0
  182. package/src/table/column/date/purify.js +17 -0
  183. package/src/table/column/date/toISOString.js +25 -0
  184. package/src/table/column/date/tryParseISO.js +14 -0
  185. package/src/table/column/date.js +14 -0
  186. package/src/table/column/dateWithTimeZone/newEncode.js +41 -0
  187. package/src/table/column/dateWithTimeZone.js +14 -0
  188. package/src/table/column/encodeFilterArg.js +8 -0
  189. package/src/table/column/equal.js +15 -0
  190. package/src/table/column/extractAlias.js +7 -0
  191. package/src/table/column/greaterThan.js +12 -0
  192. package/src/table/column/greaterThanOrEqual.js +12 -0
  193. package/src/table/column/guid/newDecode.js +10 -0
  194. package/src/table/column/guid/newEncode.js +30 -0
  195. package/src/table/column/guid/purify.js +10 -0
  196. package/src/table/column/guid.js +12 -0
  197. package/src/table/column/in.js +24 -0
  198. package/src/table/column/json/formatOut.js +11 -0
  199. package/src/table/column/json/newDecode.js +21 -0
  200. package/src/table/column/json/newEncode.js +41 -0
  201. package/src/table/column/json/purify.js +7 -0
  202. package/src/table/column/json.js +22 -0
  203. package/src/table/column/lessThan.js +12 -0
  204. package/src/table/column/lessThanOrEqual.js +12 -0
  205. package/src/table/column/negotiateNextAndFilter.js +7 -0
  206. package/src/table/column/negotiateNextOrFilter.js +7 -0
  207. package/src/table/column/negotiateRawSqlFilter.js +74 -0
  208. package/src/table/column/newBoolean.js +54 -0
  209. package/src/table/column/newColumn.js +89 -0
  210. package/src/table/column/newDecodeCore.js +10 -0
  211. package/src/table/column/notEqual.js +15 -0
  212. package/src/table/column/numeric/negotiateDefault.js +5 -0
  213. package/src/table/column/numeric/newDecode.js +16 -0
  214. package/src/table/column/numeric/newEncode.js +25 -0
  215. package/src/table/column/numeric/purify.js +12 -0
  216. package/src/table/column/numeric.js +15 -0
  217. package/src/table/column/string/contains.js +3 -0
  218. package/src/table/column/string/containsCore.js +16 -0
  219. package/src/table/column/string/endsWith.js +3 -0
  220. package/src/table/column/string/endsWithCore.js +16 -0
  221. package/src/table/column/string/iContains.js +3 -0
  222. package/src/table/column/string/iEndsWith.js +3 -0
  223. package/src/table/column/string/iEqual.js +15 -0
  224. package/src/table/column/string/iStartsWith.js +3 -0
  225. package/src/table/column/string/newEncode.js +31 -0
  226. package/src/table/column/string/purify.js +7 -0
  227. package/src/table/column/string/startsWith.js +3 -0
  228. package/src/table/column/string/startsWithCore.js +16 -0
  229. package/src/table/column/string.js +55 -0
  230. package/src/table/column.js +154 -0
  231. package/src/table/commands/beginCommand.js +13 -0
  232. package/src/table/commands/commitCommand.js +9 -0
  233. package/src/table/commands/compressChanges.js +25 -0
  234. package/src/table/commands/delete/createAlias.js +6 -0
  235. package/src/table/commands/delete/newSingleCommand.js +17 -0
  236. package/src/table/commands/delete/singleCommand/joinSql.js +26 -0
  237. package/src/table/commands/delete/singleCommand/newSingleCommandCore.js +19 -0
  238. package/src/table/commands/delete/singleCommand/selectSql.js +11 -0
  239. package/src/table/commands/delete/singleCommand/subFilter.js +19 -0
  240. package/src/table/commands/delete/singleCommand/whereSql.js +25 -0
  241. package/src/table/commands/getChangeSet.js +6 -0
  242. package/src/table/commands/insert/getSqlTemplate.js +68 -0
  243. package/src/table/commands/lastCommandMatches.js +11 -0
  244. package/src/table/commands/negotiateEndEdit.js +7 -0
  245. package/src/table/commands/newDeleteCommand.js +23 -0
  246. package/src/table/commands/newGetLastInsertedCommand.js +49 -0
  247. package/src/table/commands/newGetLastInsertedCommandCore.js +42 -0
  248. package/src/table/commands/newInsertAndForgetCommand.js +55 -0
  249. package/src/table/commands/newInsertCommand.js +56 -0
  250. package/src/table/commands/newInsertCommandCore.js +27 -0
  251. package/src/table/commands/newRow.js +51 -0
  252. package/src/table/commands/newUpdateCommand.js +62 -0
  253. package/src/table/commands/newUpdateCommandCore.js +45 -0
  254. package/src/table/commands/pushCommand.js +10 -0
  255. package/src/table/commands/rollbackCommand.js +13 -0
  256. package/src/table/commit.js +30 -0
  257. package/src/table/count.js +29 -0
  258. package/src/table/createJSONReadStream.js +7 -0
  259. package/src/table/createJSONReadStreamDefault.js +33 -0
  260. package/src/table/createJSONReadStreamNative.js +31 -0
  261. package/src/table/createReadStream.js +24 -0
  262. package/src/table/createReadStreamCoreNative.js +40 -0
  263. package/src/table/createReadStreamDefault.js +102 -0
  264. package/src/table/createReadStreamNative.js +17 -0
  265. package/src/table/delete.js +20 -0
  266. package/src/table/deleteSessionContext.js +17 -0
  267. package/src/table/encodeDbSpecific.js +10 -0
  268. package/src/table/executeQueries/executeChanges.js +35 -0
  269. package/src/table/executeQueries/executeQueriesCore.js +12 -0
  270. package/src/table/executeQueries/executeQuery.js +8 -0
  271. package/src/table/executeQueries/resolveExecuteQuery.js +57 -0
  272. package/src/table/executeQueries.js +15 -0
  273. package/src/table/extractDeleteStrategy.js +9 -0
  274. package/src/table/fuzzyPromise.js +18 -0
  275. package/src/table/getById.js +33 -0
  276. package/src/table/getFirstFromDb.js +10 -0
  277. package/src/table/getFromDbById.js +17 -0
  278. package/src/table/getIdArgs.js +14 -0
  279. package/src/table/getMany.js +26 -0
  280. package/src/table/getManyDto/newQuery.js +32 -0
  281. package/src/table/getManyDto/pg/newQuery.js +8 -0
  282. package/src/table/getManyDto.js +10 -0
  283. package/src/table/getManyDtoFast/getSubRows.js +172 -0
  284. package/src/table/getManyDtoFast/newQuery.js +8 -0
  285. package/src/table/getManyDtoFast/newQueryCore.js +18 -0
  286. package/src/table/getManyDtoFast/query/newSingleQuery.js +20 -0
  287. package/src/table/getManyDtoFast/query/newSubQueries/joinLegToQuery.js +18 -0
  288. package/src/table/getManyDtoFast/query/newSubQueries/manyLegToQuery.js +20 -0
  289. package/src/table/getManyDtoFast/query/newSubQueries/oneLegToQuery.js +21 -0
  290. package/src/table/getManyDtoFast/query/newSubQueries.js +47 -0
  291. package/src/table/getManyDtoFast/query/singleQuery/newShallowColumnSql.js +21 -0
  292. package/src/table/getSessionContext.js +10 -0
  293. package/src/table/getSessionSingleton.js +5 -0
  294. package/src/table/groupBy/newQuery.js +25 -0
  295. package/src/table/groupBy.js +65 -0
  296. package/src/table/hasMany.js +33 -0
  297. package/src/table/hasOne.js +33 -0
  298. package/src/table/insert.js +91 -0
  299. package/src/table/insertDefault.js +88 -0
  300. package/src/table/join.js +42 -0
  301. package/src/table/joinRelation/getRelatives.js +64 -0
  302. package/src/table/log.js +39 -0
  303. package/src/table/negotiateAddStrategy.js +20 -0
  304. package/src/table/negotiateExpandInverse.js +13 -0
  305. package/src/table/newCache.js +96 -0
  306. package/src/table/newCascadeDeleteStrategy.js +30 -0
  307. package/src/table/newGetRelated.js +21 -0
  308. package/src/table/newJoinRelation.js +117 -0
  309. package/src/table/newManyRelation.js +61 -0
  310. package/src/table/newOneRelation.js +61 -0
  311. package/src/table/newPrimaryKeyFilter.js +13 -0
  312. package/src/table/newQuery.js +18 -0
  313. package/src/table/newRelatedTable.js +100 -0
  314. package/src/table/newRowCache.js +106 -0
  315. package/src/table/newThrow.js +11 -0
  316. package/src/table/nullPromise.js +1 -0
  317. package/src/table/objectToCallback.js +7 -0
  318. package/src/table/oneRelation/getRelatives.js +45 -0
  319. package/src/table/popChanges.js +19 -0
  320. package/src/table/promise.js +14 -0
  321. package/src/table/purifyStrategy.js +49 -0
  322. package/src/table/query/extractFilter.js +9 -0
  323. package/src/table/query/extractLimit.js +11 -0
  324. package/src/table/query/extractLimitQuery.js +23 -0
  325. package/src/table/query/extractOffset.js +11 -0
  326. package/src/table/query/extractOrderBy.js +57 -0
  327. package/src/table/query/extractSql.js +10 -0
  328. package/src/table/query/newParameterized.js +38 -0
  329. package/src/table/query/newSingleQuery.js +23 -0
  330. package/src/table/query/parameterized/extractParameters.js +8 -0
  331. package/src/table/query/singleQuery/columnSql/joinLegToColumnSql.js +16 -0
  332. package/src/table/query/singleQuery/columnSql/newJoinedColumnSql.js +27 -0
  333. package/src/table/query/singleQuery/columnSql/newShallowColumnSql.js +37 -0
  334. package/src/table/query/singleQuery/joinSql/joinLegToJoinSql.js +13 -0
  335. package/src/table/query/singleQuery/joinSql/joinLegToShallowJoinSql.js +9 -0
  336. package/src/table/query/singleQuery/joinSql/newDiscriminatorSql.js +11 -0
  337. package/src/table/query/singleQuery/joinSql/newShallowJoinSql.js +9 -0
  338. package/src/table/query/singleQuery/joinSql/newShallowJoinSqlCore.js +25 -0
  339. package/src/table/query/singleQuery/joinSql/oneLegToJoinSql.js +13 -0
  340. package/src/table/query/singleQuery/joinSql/oneLegToShallowJoinSql.js +10 -0
  341. package/src/table/query/singleQuery/negotiateExclusive.js +11 -0
  342. package/src/table/query/singleQuery/negotiateLimit.js +10 -0
  343. package/src/table/query/singleQuery/newColumnSql.js +8 -0
  344. package/src/table/query/singleQuery/newDiscriminatorSql.js +33 -0
  345. package/src/table/query/singleQuery/newJoinSql.js +41 -0
  346. package/src/table/query/singleQuery/newQueryContext.js +20 -0
  347. package/src/table/query/singleQuery/newWhereSql.js +19 -0
  348. package/src/table/readStream/extractLimit.js +7 -0
  349. package/src/table/readStream/extractOrderBy.js +55 -0
  350. package/src/table/readStream/mySql/newQuery.js +16 -0
  351. package/src/table/readStream/mySql/query/newSingleQuery.js +21 -0
  352. package/src/table/readStream/mySql/query/newSubQueries/joinLegToQuery.js +19 -0
  353. package/src/table/readStream/mySql/query/newSubQueries/manyLegToQuery.js +22 -0
  354. package/src/table/readStream/mySql/query/newSubQueries/newQueryCore.js +9 -0
  355. package/src/table/readStream/mySql/query/newSubQueries/newSingleQueryCore.js +18 -0
  356. package/src/table/readStream/mySql/query/newSubQueries/oneLegToQuery.js +22 -0
  357. package/src/table/readStream/mySql/query/newSubQueries.js +47 -0
  358. package/src/table/readStream/mySql/query/singleQuery/newShallowColumnSql.js +17 -0
  359. package/src/table/readStream/newQuery.js +32 -0
  360. package/src/table/readStream/newQueryStream.js +8 -0
  361. package/src/table/readStream/pg/newQuery.js +8 -0
  362. package/src/table/readStream/pg/newQueryCore.js +17 -0
  363. package/src/table/readStream/pg/query/newSingleQuery.js +19 -0
  364. package/src/table/readStream/pg/query/newSubQueries/joinLegToQuery.js +19 -0
  365. package/src/table/readStream/pg/query/newSubQueries/manyLegToQuery.js +22 -0
  366. package/src/table/readStream/pg/query/newSubQueries/oneLegToQuery.js +19 -0
  367. package/src/table/readStream/pg/query/newSubQueries.js +47 -0
  368. package/src/table/readStream/pg/query/singleQuery/newShallowColumnSql.js +19 -0
  369. package/src/table/readStreamDefault/createBatchFilter.js +39 -0
  370. package/src/table/relatedTable/aggregate/aggregateJoinSql.js +37 -0
  371. package/src/table/relatedTable/aggregate/joinSql.js +38 -0
  372. package/src/table/relatedTable/aggregate.js +48 -0
  373. package/src/table/relatedTable/all.js +24 -0
  374. package/src/table/relatedTable/any.js +70 -0
  375. package/src/table/relatedTable/childColumn.js +61 -0
  376. package/src/table/relatedTable/columnAggregate.js +16 -0
  377. package/src/table/relatedTable/columnAggregateGroup.js +59 -0
  378. package/src/table/relatedTable/joinSql.js +40 -0
  379. package/src/table/relatedTable/joinSqlArray.js +32 -0
  380. package/src/table/relatedTable/none.js +22 -0
  381. package/src/table/relatedTable/relatedColumn.js +49 -0
  382. package/src/table/relatedTable/relationFilter.js +16 -0
  383. package/src/table/relatedTable/selectSql.js +11 -0
  384. package/src/table/relatedTable/subFilter.js +16 -0
  385. package/src/table/relatedTable/where.js +50 -0
  386. package/src/table/relatedTable/whereSql.js +41 -0
  387. package/src/table/relation/manyCache/extractParentKey.js +17 -0
  388. package/src/table/relation/manyCache/synchronizeAdded.js +13 -0
  389. package/src/table/relation/manyCache/synchronizeChanged.js +31 -0
  390. package/src/table/relation/manyCache/synchronizeRemoved.js +13 -0
  391. package/src/table/relation/newExpanderCache.js +7 -0
  392. package/src/table/relation/newForeignKeyFilter.js +20 -0
  393. package/src/table/relation/newJoinLeg.js +23 -0
  394. package/src/table/relation/newManyCache.js +57 -0
  395. package/src/table/relation/newManyCacheCore.js +53 -0
  396. package/src/table/relation/newManyLeg.js +15 -0
  397. package/src/table/relation/newOneCache.js +28 -0
  398. package/src/table/relation/newOneLeg.js +25 -0
  399. package/src/table/releaseDbClient.js +15 -0
  400. package/src/table/resultToPromise.js +8 -0
  401. package/src/table/resultToRows/dbRowToRow.js +51 -0
  402. package/src/table/resultToRows/dbRowsToRows.js +13 -0
  403. package/src/table/resultToRows/decodeDbRow.js +25 -0
  404. package/src/table/resultToRows/delete/removeFromCache.js +33 -0
  405. package/src/table/resultToRows/delete.js +31 -0
  406. package/src/table/resultToRows/negotiateQueryContext.js +6 -0
  407. package/src/table/resultToRows/newDecodeDbRow.js +262 -0
  408. package/src/table/resultToRows/toDto/createDto.js +20 -0
  409. package/src/table/resultToRows/toDto/extractStrategy.js +41 -0
  410. package/src/table/resultToRows/toDto.js +92 -0
  411. package/src/table/resultToRows.js +37 -0
  412. package/src/table/rollback.js +31 -0
  413. package/src/table/rowArray/negotiateNextTick.js +11 -0
  414. package/src/table/rowArray/orderBy.js +51 -0
  415. package/src/table/rowArray.js +62 -0
  416. package/src/table/setSessionSingleton.js +5 -0
  417. package/src/table/strategyToSpan.js +49 -0
  418. package/src/table/tryGetById.js +13 -0
  419. package/src/table/tryGetFirstFromDb.js +23 -0
  420. package/src/table/tryGetFromCacheById.js +12 -0
  421. package/src/table/tryGetFromDbById/extractStrategy.js +9 -0
  422. package/src/table/tryGetFromDbById.js +19 -0
  423. package/src/table/tryGetSessionContext.js +16 -0
  424. package/src/table/tryReleaseDbClient.js +14 -0
  425. package/src/table/updateField.js +12 -0
  426. package/src/table/where.js +12 -0
  427. package/src/table.js +174 -0
  428. package/src/tedious/deleteFromSql.js +8 -0
  429. package/src/tedious/encodeBoolean.js +7 -0
  430. package/src/tedious/encodeBuffer.js +7 -0
  431. package/src/tedious/formatDateOut.js +5 -0
  432. package/src/tedious/formatJSONOut.js +5 -0
  433. package/src/tedious/getManyDto/newQuery.js +8 -0
  434. package/src/tedious/getManyDto/newQueryCore.js +18 -0
  435. package/src/tedious/getManyDto/query/newSingleQuery.js +29 -0
  436. package/src/tedious/getManyDto/query/newSubQueries/joinLegToQuery.js +16 -0
  437. package/src/tedious/getManyDto/query/newSubQueries/manyLegToQuery.js +16 -0
  438. package/src/tedious/getManyDto/query/newSubQueries/oneLegToQuery.js +19 -0
  439. package/src/tedious/getManyDto/query/newSubQueries.js +48 -0
  440. package/src/tedious/getManyDto/query/singleQuery/newShallowColumnSql.js +34 -0
  441. package/src/tedious/getManyDto.js +27 -0
  442. package/src/tedious/insert.js +13 -0
  443. package/src/tedious/insertSql.js +70 -0
  444. package/src/tedious/limitAndOffset.js +16 -0
  445. package/src/tedious/mergeSql.js +76 -0
  446. package/src/tedious/newDatabase.js +129 -0
  447. package/src/tedious/newPool.js +19 -0
  448. package/src/tedious/newTransaction.js +72 -0
  449. package/src/tedious/outputInsertedSql.js +11 -0
  450. package/src/tedious/pool/defaults.js +45 -0
  451. package/src/tedious/pool/end.js +13 -0
  452. package/src/tedious/pool/newGenericPool.js +71 -0
  453. package/src/tedious/pool/parseConnectionString.js +40 -0
  454. package/src/tedious/selectForUpdateSql.js +3 -0
  455. package/src/tedious/wrapQuery.js +112 -0
  456. package/src/toCompareObject.js +41 -0
  457. package/src/useHook.js +9 -0
  458. package/src/validateDeleteAllowed.js +49 -0
  459. package/src/validateDeleteConflict.js +92 -0
package/SECURITY.md ADDED
@@ -0,0 +1,12 @@
1
+ # Security Policy
2
+
3
+ ## Supported versions
4
+
5
+ The following table describes the versions of this project that are currently supported with security updates:
6
+ - [x] 3.x
7
+ - [ ] 2.x
8
+ - [ ] 1.x
9
+
10
+ ## Responsible disclosure policy
11
+
12
+ If you discover a security vulnerability, please report an issue.
package/bin/build.js ADDED
@@ -0,0 +1,127 @@
1
+ let url = require('url');
2
+ let compile = require('./compile');
3
+ let { glob } = require('glob');
4
+ let path = require('path');
5
+ let findNodeModules = require('findup-sync');
6
+ let fs = require('fs');
7
+ let util = require('util');
8
+ let writeFile = util.promisify(fs.writeFile);
9
+ let ts = require('typescript');
10
+ let moduleDefinition = require('module-definition');
11
+ let getTSDefinition = require('../src/getTSDefinition');
12
+ const _axios = require('axios');
13
+ const axios = _axios.default ? _axios.default.create() : _axios.create();
14
+
15
+ async function run(cwd) {
16
+ for (let schemaTs of await findSchemaJs(cwd)) {
17
+ await runSingle(schemaTs);
18
+ }
19
+ }
20
+
21
+ async function runSingle(schemaTs) {
22
+ let outDir;
23
+ try {
24
+
25
+ let schemaJsPath;
26
+ let isPureJs = false;
27
+ if (!schemaTs)
28
+ return;
29
+ if (schemaTs.substring(schemaTs.length - 2) === 'js') {
30
+ schemaJsPath = schemaTs;
31
+ isPureJs = true;
32
+ }
33
+ console.log(`Orange: found schema ${schemaTs}`);
34
+ if (!schemaJsPath) {
35
+ let nodeModules = findNodeModules('node_modules', { cwd: schemaTs });
36
+ outDir = path.join(nodeModules, '/.rdb', '/' + new Date().getUTCMilliseconds());
37
+ schemaJsPath = compile(schemaTs, { outDir });
38
+ }
39
+ let schemaJs = isPureJs ? await import(url.pathToFileURL(schemaJsPath)) : require(schemaJsPath);
40
+ if ('default' in schemaJs)
41
+ schemaJs = schemaJs.default;
42
+ if (!schemaJs.tables) {
43
+ console.log('Orange: no tables found.');
44
+ return;
45
+ }
46
+ let src = '';
47
+ if (typeof schemaJs.db === 'string') {
48
+ src = ((await tryDownload(schemaJs.db + '.d.ts', isPureJs) || await download(schemaJs.db, isPureJs)));
49
+ }
50
+ else {
51
+ let tsArg = Object.keys(schemaJs.tables).map(x => {
52
+ return { table: schemaJs.tables[x], name: x };
53
+ });
54
+ src = getTSDefinition(tsArg);
55
+ }
56
+ let indexDts = path.join(path.dirname(schemaTs), isPureJs ? '/index.d.ts' : '/index.ts');
57
+ let sourceFile = ts.createSourceFile(indexDts, src, ts.ScriptTarget.ES2015, true, ts.ScriptKind.TS);
58
+ const printer = ts.createPrinter();
59
+ await writeFile(indexDts, printer.printFile(sourceFile));
60
+ if (isPureJs)
61
+ await writeIndexJs(schemaJsPath);
62
+
63
+ console.log('Orange: created ts typings successfully.');
64
+ }
65
+ catch(e) {
66
+ console.dir(e);
67
+ }
68
+
69
+ if (outDir)
70
+ fs.rmSync(outDir, { recursive: true, force: true });
71
+ }
72
+
73
+ async function writeIndexJs(schemaJsPath) {
74
+ const schema = path.basename(schemaJsPath);
75
+ const indexJs = path.join(path.dirname(schemaJsPath), '/index' + path.extname(schemaJsPath));
76
+ if (moduleDefinition.sync(schemaJsPath) === 'commonjs')
77
+ await writeFile(indexJs, `module.exports = require('./${schema}');`);
78
+ else
79
+ await writeFile(indexJs, `export {default} from './${schema}';`);
80
+ }
81
+
82
+ async function findSchemaJs(cwd) {
83
+ let options = {
84
+ ignore: ['**/node_modules/**', '**/dist/**', '**/dev/**', '**/deploy/**', '**/build/**'],
85
+ cwd
86
+ };
87
+ let files = await glob('**/schema.*(js|mjs|ts)', options);
88
+ files.sort((a, b) => {
89
+ const aIsTs = a.substring(a.length - 2) === 'ts';
90
+ const bIsTs = b.substring(b.length - 2) === 'ts';
91
+ if (aIsTs && bIsTs)
92
+ return 0;
93
+ else if (aIsTs)
94
+ return -1;
95
+ else if (bIsTs)
96
+ return 1;
97
+ else
98
+ return 0;
99
+ });
100
+ return files.map(x => path.join(cwd, '/', x));
101
+ }
102
+
103
+ function tryDownload(_url, _isNamespace) {
104
+ try {
105
+ return download.apply(null, arguments).then((res) => res, () => '');
106
+ }
107
+ // eslint-disable-next-line no-empty
108
+ catch (e) {
109
+ }
110
+ }
111
+
112
+ async function download(url, isNamespace) {
113
+ url = `${url}?isNamespace=${isNamespace}`;
114
+ console.log(`Orange: downloading from ${url}`);
115
+ // eslint-disable-next-line no-undef
116
+ try {
117
+ let response = await axios.get(url);
118
+ return response.data;
119
+ }
120
+ catch(e) {
121
+ throw new Error('No config found at ' + url);
122
+ }
123
+ }
124
+
125
+ module.exports = function(cwd) {
126
+ run(cwd).then(null, console.log);
127
+ };
package/bin/compile.js ADDED
@@ -0,0 +1,26 @@
1
+ let ts = require('typescript');
2
+ let path = require('path');
3
+
4
+ function compile(fileNames, options) {
5
+ var program = ts.createProgram(fileNames, options);
6
+ var emitResult = program.emit();
7
+ ts.getPreEmitDiagnostics(program)
8
+ .concat(emitResult.diagnostics);
9
+ return emitResult.emitSkipped ? 1 : 0;
10
+ }
11
+
12
+ const defaultOptions = {
13
+ noEmitOnError: false,
14
+ noImplicitAny: true,
15
+ target: ts.ScriptTarget.ES2020,
16
+ module: ts.ModuleKind.CommonJS,
17
+ esModuleInterop: true,
18
+ outDir: 'build'
19
+ };
20
+
21
+ module.exports = function(file, options = {}) {
22
+ let basename = path.basename(file, '.ts');
23
+ options = { ...defaultOptions, ...options };
24
+ if (compile([file], options) === 0)
25
+ return path.join(options.outDir, `/${basename}.js`);
26
+ };
package/bin/rdb.js ADDED
@@ -0,0 +1,4 @@
1
+ #! /usr/bin/env node
2
+ let build = require('./build');
3
+
4
+ build(process.cwd());
@@ -0,0 +1,18 @@
1
+ ## **Code of Conduct**
2
+
3
+ 1. **Respect Everyone:**
4
+ Treat others as you'd like to be treated.
5
+ 2. **Speak Kindly:**
6
+ Avoid insults, derogatory comments, and bullying.
7
+ 3. **Listen Actively:**
8
+ Let others finish their thoughts before responding.
9
+ 4. **Stay On Topic:**
10
+ Ensure discussions remain relevant to the focus.
11
+ 5. **No Discrimination:**
12
+ Everyone deserves equal treatment, regardless of background, identity, or beliefs.
13
+ 6. **Stay Safe:**
14
+ Protect your personal info and respect the privacy of others.
15
+ 7. **Report Concerns:**
16
+ If you see something wrong, say something.
17
+
18
+ This is a space for everyone. Respect it. Protect it. Enjoy it.
@@ -0,0 +1,461 @@
1
+ ## Changelog
2
+ __3.10.2_
3
+ Orange ORM was renamed from rdb. New installation url: [npmjs.org/package/orange-orm](https://npmjs.org/package/orange-orm) . Old url was npmjs.org/package/rdb
4
+ __3.10.1_
5
+ Bugfix: Adding hasOne row to existing parent throws. See [#86](https://github.com/alfateam/orange-orm/issues/86)
6
+ __3.10.0_
7
+ Aggregate functions
8
+ __3.9.1_
9
+ Bugfix: Crashing on many relations if foreign key column is omitted in strategy. See [#83](https://github.com/alfateam/orange-orm/issues/83)
10
+ __3.9.0__
11
+ Possible to elevate associated column on a related table to a parent table when fetching. See https://github.com/alfateam/orange-orm/#user-content-aggregate-results
12
+ __3.8.0__
13
+ Aggregate operators: count, max, min, avg and sum.
14
+ __3.7.0__
15
+ Upgraded to mysql2@3.9.4 and tedious@18.1.0
16
+ __3.6.2__
17
+ Fixed bug with orderBy array that appeared in v3.6.0. See [#78](https://github.com/alfateam/orange-orm/issues/78)
18
+ __3.6.1__
19
+ Fixed bug in filtered relations regarding incorrect alias. See [#76](https://github.com/alfateam/orange-orm/issues/76)
20
+ __3.6.0__
21
+ Filters on relations.
22
+ __3.5.2__
23
+ MssqlNative and SAP ASE: PRINT statements no longer yields error.
24
+ __3.5.1__
25
+ Mssql: fix precision date types.
26
+ __3.5.0__
27
+ Support for Oracle.
28
+ __3.4.0__
29
+ Allow multiple resultset for SAP and mssql. See [#72](https://github.com/alfateam/orange-orm/issues/72).
30
+ __3.3.0__
31
+ Possible to apply updates from JSON object. See [#70](https://github.com/alfateam/orange-orm/issues/70).
32
+ __3.2.9__
33
+ Transaction was ignored. See [#68](https://github.com/alfateam/orange-orm/issues/68).
34
+ Proxify method had incorrect type signature. See [#69](https://github.com/alfateam/orange-orm/issues/69).
35
+ __3.2.8__
36
+ Signature for fetchingStrategy should accept boolean as well object (code generation only). See [#67](https://github.com/alfateam/orange-orm/issues/67).
37
+ __3.2.7__
38
+ Bugfix Inserting with skipOnConflict on whole table yields incorrect sql. See [#63](https://github.com/alfateam/orange-orm/issues/63).
39
+ __3.2.6__
40
+ Hide metadata types from intellisense on insert().
41
+ __3.2.5__
42
+ Fix typescript signature for insert overload. See [#62](https://github.com/alfateam/orange-orm/issues/62).
43
+ __3.2.4__
44
+ Bugfix: array of filters. See [#56](https://github.com/alfateam/orange-orm/issues/56) and [#57](https://github.com/alfateam/orange-orm/issues/57).
45
+ __3.2.3__
46
+ Conflict resolution on insert. See [#42](https://github.com/alfateam/orange-orm/issues/42) and [Inserting rows](https://github.com/alfateam/orange-orm/tree/master#user-content-inserting-rows).
47
+ __3.2.2__
48
+ Bugfix for Sql Server: OFFSET was ignored. See [#46](https://github.com/alfateam/orange-orm/issues/49).
49
+ __3.2.1__
50
+ Bugfix for those using code generation: count had wrong signature.
51
+ __3.2.0__
52
+ Support for aggregate count() function.
53
+ __3.1.47__
54
+ Bugfix: Raw queries ran outside transaction. See [#46](https://github.com/alfateam/orange-orm/issues/46).
55
+ Documented logging.
56
+ __3.1.46__
57
+ Bugfix code generation, only related for those still using legacy / code generation.
58
+ __3.1.45__
59
+ Memoize pool when resolving through func. See [#45](https://github.com/alfateam/orange-orm/issues/45).
60
+ Improved ts types for and/or-operators: now accepting arrays of RawFilter.
61
+ __3.1.44__
62
+ Bugfix with globbing, only related for those still using legacy / code generation
63
+ __3.1.43__
64
+ Updated dependency [glob@^10.3.4](https://npmjs.org/package/glob).
65
+ __3.1.42__
66
+ Bugfixes: errors when inserting json and binary in postgres, mysql and sqlite.
67
+ __3.1.41__
68
+ Bugfix: false positive 403.
69
+ __3.1.40__
70
+ Documented raw sql queries and filters.
71
+ __3.1.39__
72
+ Small typos in README.
73
+ __3.1.38__
74
+ Unknown data type in mssql when .eq() on boolean column.
75
+ __3.1.37__
76
+ Documented in the browser.
77
+ __3.1.36__
78
+ Fixed typescript types in definition file.
79
+ __3.1.35__
80
+ Fix CI badge
81
+ __3.1.34__
82
+ Badges for npm, ci and coverage
83
+ __3.1.33__
84
+ Bugfix for all, any and none. It did not handle nested any properly
85
+ __3.1.32__
86
+ Updated typescript types for filtering on many relations
87
+ __3.1.31__
88
+ Documented updating rows in _Modern Typescript Documentation_.
89
+ __3.1.30__
90
+ Removed blockquotes in docs.
91
+ __3.1.29__
92
+ Small improvements in docs.
93
+ __3.1.28__
94
+ Started with _Modern Typescript Documentation_.
95
+ __3.1.27__
96
+ Types for express hosting.
97
+ __3.1.26__
98
+ Read dates directly from database without parsing the through js date.
99
+ __3.1.25__
100
+ Lazily invoke db connectors.
101
+ __3.1.24__
102
+ Expand() to deeply expand all properties on rows.
103
+ __3.1.23__
104
+ No need for code generation
105
+ __3.1.22__
106
+ Use local time instead of UTC on tedious
107
+ __3.1.21__
108
+ Metadata with concurrency and readonly
109
+ __3.1.20__
110
+ Bugfix patching ms sql date
111
+ __3.1.19__
112
+ Make db optional in RdbConfig
113
+ __3.1.18__
114
+ Bugfix patching without metadata
115
+ __3.1.17__
116
+ Another Buffer workaround in browser
117
+ __3.1.16__
118
+ Buffer workaround in browser
119
+ __3.1.15__
120
+ Fixed concurrency misspelling type generation
121
+ __3.1.14__
122
+ Bugfix patch in browser
123
+ __3.1.13__
124
+ Readonly and concurrency
125
+ __3.1.12__
126
+ Tedious: return first error when aggregate error
127
+ __3.1.11__
128
+ Do not set default port for mssql
129
+ __3.1.10__
130
+ Bugfix when parsing port number in connection string for tedious.
131
+ __3.1.9__
132
+ Improved typescript support for notNullable props on row.
133
+ __3.1.8__
134
+ Improved typescript definitions for notNull() and validate().
135
+ __3.1.7__
136
+ Chainable column.validate() and column.JSONSchema().
137
+ column.notNull().
138
+ __3.1.6__
139
+ Tedious: return first error if AggregatError
140
+ __3.1.5__
141
+ Improved performance for ms sql
142
+ __3.1.4__
143
+ import type to satisfy Type-Only imports/exports in compilers
144
+ __3.1.3__
145
+ Added eslint-disable no-explicit-any in generated typescript
146
+ __3.1.2__
147
+ Tedious as default driver for msSql.
148
+ __3.1.1__
149
+ Typescript as dev dependency
150
+ __3.1.0__
151
+ Date is mapped to ISO string. Any date input will map 'casted' to ISO string on save.
152
+ __3.0.33__
153
+ ts ignore.
154
+ __3.0.32__
155
+ More compact typescript generation.
156
+ __3.0.31__
157
+ Bugfix json patching.
158
+ __3.0.30__
159
+ Removed dependency rfc6902.
160
+ __3.0.29__
161
+ Overload in typescript for getById.
162
+ __3.0.28__
163
+ Removed dependency rdb-client.
164
+ __3.0.27__
165
+ Query without transaction did not release connection on error.
166
+ __3.0.26__
167
+ Improve typescript code generation.
168
+ __3.0.25__
169
+ Improve typescript code generation.
170
+ __3.0.24__
171
+ Bugfixed related to wathcing JSON column when value is null.
172
+ __3.0.23__
173
+ Still some bugfix related to: [Converting date to ISO sometimes gives incorrect milliseconds part](https://github.com/alfateam/orange-orm/issues/29).
174
+ __3.0.22__
175
+ Bugfix: [Converting date to ISO sometimes gives incorrect milliseconds part](https://github.com/alfateam/orange-orm/issues/29).
176
+ __3.0.21__
177
+ Fix typescript generation for Express.
178
+ __3.0.20__
179
+ Throw if empty connection string.
180
+ Lazy load dependency node-cls to improve performance and memory usage
181
+ __3.0.19__
182
+ Bugfix when patching many-relationship from rdb-client
183
+ __3.0.17__
184
+ Upgraded dependency uuid
185
+ __3.0.13__
186
+ Upgraded dependency uuid
187
+ __3.0.12__
188
+ Avoid page locking in ms sql in extreme concurrency situations when using patchTable
189
+ __3.0.11__
190
+ Null parameters are replaced with sql 'null' value. This is practical when calling stored procedures with raw sql.
191
+ __3.0.10__
192
+ PeerDependencies as optional with npm 7 and above - using peerDependenciesMeta.
193
+ __3.0.9__
194
+ Support for query without transaction.
195
+ __3.0.8__
196
+ Support for all, any and none filters.
197
+ __3.0.7__
198
+ Hosting in express with typescript support.
199
+ __3.0.6__
200
+ insertAndForget() for situations where you INSERT privileges, but no SELECT privileges.
201
+ __3.0.5__
202
+ Fixed typescript methods: insert-methods should be async and return Promise<..>
203
+ __3.0.4__
204
+ Support for offset
205
+ __3.0.3__
206
+ Exposed typescript methods for [rdb-client](https://npmjs.com/package/rdb-client): query, insert and bulk deletes.
207
+ __3.0.2__
208
+ Binary as base64.
209
+ __3.0.1__
210
+ Small fixes.
211
+ __3.0.0__
212
+ Support for Sybase SAP and MsSql.
213
+ __2.6.28__
214
+ Support for rdb in the browser. Docs will come later.
215
+ __2.6.27__
216
+ Bugfix: JSON patching could result in duplicate DTO when run in same transaction.
217
+ __2.6.26__
218
+ Bugfix: changing a dto on nested property would also change the jsonb column.
219
+ Default value accepts function
220
+ __2.6.25__
221
+ Possible to indirectly update JSONB column by setting a nested property
222
+ __2.6.24__
223
+ Temporary lock with func as an alternative to transaction locks (pg only)
224
+ __2.6.23__
225
+ Bugfix when JSON patching nested relations.
226
+ __2.6.22__
227
+ Bugfix JSON patch.
228
+ __2.6.21__
229
+ Added JSON patch strategy 'skipOnConflict' to skip update if conflict.
230
+ __2.6.20__
231
+ Upgraded to pg@8.
232
+ __2.6.19__
233
+ Wrong location of module.
234
+ __2.6.18__
235
+ Using domains instead of async_hooks for continution local context because async_hooks is unstable and experimental.
236
+ __2.6.17__
237
+ More bugfixes with array patching.
238
+ __2.6.16__
239
+ Bugfix. Did not properly apply json patch with new arrays.
240
+ __2.6.15__
241
+ Downgraded to pg@7 because pg@8 messes up async hooks
242
+ __2.6.14__
243
+ Possible to send in types for custom parsing
244
+ __2.6.13__
245
+ Upgraded to pg@8.
246
+ __2.6.12__
247
+ Bugfix. Delete many relations in JSON patch did delete all.
248
+ __2.6.11__
249
+ Bugfix. Delete related row in JSON patch.
250
+ __2.6.10__
251
+ Bugfix. Did not apply patch properly on arrays inside json.
252
+ __2.6.9__
253
+ Bugfix. Inserts inside update hooks did not execute when last command in transaction.
254
+ __2.6.8__
255
+ Bugfix. Update hooks were sometimes incomplete.
256
+ __2.6.7__
257
+ Hooks on insert, update and delete.
258
+ __2.6.6__
259
+ Return status 204 instead of 200 when json patching.
260
+ __2.6.5__
261
+ Make this version the latest in npm.
262
+ __2.6.4__
263
+ Patching on row no longer modifies patch, but uses a clone instead.
264
+ __2.6.3__
265
+ Bugfix in JSON patching when null on object.
266
+ __2.6.2__
267
+ Bugfix in JSON patching with many relations.
268
+ __2.6.1__
269
+ Experimental JSON patching: patch returns dto of last operation.
270
+ __2.6.0__
271
+ Experimental JSON patching with metadata and single row patching.
272
+ __2.5.1__
273
+ Experimental JSON patching with concurrency strategy.
274
+ __2.5.0__
275
+ Experimental JSON patching and express adapter.
276
+ __2.4.0__
277
+ Supporting native bindings for postgres. The package [pg-native](https://www.npmjs.com/package/node-cls) must be installed as a peer dependency
278
+ __2.3.0__
279
+ Added column validation with JSON Schema or plain validator.
280
+ __2.2.0__
281
+ Throw meaningful error when getById gives no match.
282
+ __2.1.1__
283
+ Bugfix with insert and hasOne relation.
284
+ __2.1.0__
285
+ Pooling is disabled when there is no pool option object sent in. Previously, a pool with default size 10 was always created.
286
+ __2.0.1__
287
+ Ignoring tests when packing for npm
288
+ __2.0.0__
289
+ Domains are replaced by [node-cls](https://www.npmjs.com/package/node-cls) which is based upon [async_hooks](https://nodejs.org/api/async_hooks.html#async_hooks_async_hooks). Beware that async_hooks are still experimental. Requires node >= 8.
290
+ __1.9.0__
291
+ Throw meaningful error when getById gives no match.
292
+ __1.8.1__
293
+ Bugfix with insert and hasOne relation.
294
+ __1.8.0__
295
+ Pooling is disabled when there is no pool option object sent in. Previously, a pool with default size 10 was always created.
296
+ __1.7.7__
297
+ Commit/rollback are implicit if sending a callback to the transaction function. [See example](https://github.com/alfateam/orange-orm/blob/await/src/docs/docs.md#_connecttopostgres)
298
+ The callback must return a promise or be an async function.
299
+ __1.7.6__
300
+ Order By now supports jsonb-fields.
301
+ __1.7.5__
302
+ GetManyDto bugfix: crashing on empty result.
303
+ __1.7.4__
304
+ GetManyDto strips nulls.
305
+ __1.7.3__
306
+ GetManyDto. For read-only scenario. A lot faster than getMany.
307
+ __1.7.2__
308
+ Upgraded to pg@7.4.3 and pg-query-stream@1.1.1
309
+ __1.7.1__
310
+ Support for schemas (postgres only).
311
+ __1.7.0__
312
+ sqlite3 is now a peer dependency. Add it to your own package.json if you intend to use it.
313
+ __1.6.9__
314
+ Bugfix: [one-to-many relation returns empty if strategy is included](https://github.com/alfateam/orange-orm/issues/22).
315
+ __1.6.8__
316
+ Bugfix: [one-to-many relation returns empty if insert/update is done earlier in transaction](https://github.com/alfateam/orange-orm/issues/21).
317
+ __1.6.7__
318
+ Bugfix in relations.
319
+ __1.6.6__
320
+ Bugfix.
321
+ __1.6.5__
322
+ Improved performance on relations.
323
+ __1.6.4__
324
+ Bugfix.
325
+ __1.6.3__
326
+ Bugfix: potential incorrect timeZoneOffset when serializing date to JSON. Got timeZoneOffset from now() instead of on actual date.
327
+ __1.6.2__
328
+ Removed es6 syntax to ensure backwards compatability.
329
+ Fixed global var leak.
330
+ __1.6.1__
331
+ Now supporting sqlite.
332
+ __1.6.0__
333
+ Bugfix: potential ambigous column error when using limit and relating to other tables.
334
+ __1.5.9__
335
+ Bugfix: using multipleStatements in mySql could sometimes cause an error when updates are run right before a select.
336
+ Improved performance on limit when relating to other tables.
337
+ Using uuid instead of node-uuid
338
+ Updated all dependencies but generic-pool to latest. (Generic-pool has some breaking changes in latest. I will update it in next release.)
339
+ __1.5.8__
340
+ Cleanup line breaks in documentation.
341
+ __1.5.7__
342
+ Bugfix: getById.exclusive and tryGetById.exclusive did not lock if row was cached.
343
+ Improved performance on tryGetFirst.
344
+ __1.5.6__
345
+ Raw sql filters can accept sql both as string and as function. E.g. var filter = {sql: function() {return 'foo > 1';}}.
346
+ __1.5.5__
347
+ Optional locks for getMany, tryGetFirst and tryGetById. Instead of calling getMany(params) just call getMany.exclusive(params). Same syntax goes for tryGetFirst and tryGetById. This will result in SELECT FOR UPDATE.
348
+ Bugfix: bulk deletes now accepts raw sql filters too.
349
+ __1.5.4__
350
+ Transaction locks. Postgres only.
351
+ __1.5.3__
352
+ Upgraded to pg 6.0.3
353
+ __1.5.2__
354
+ Improved performance and reduced memory footprint.
355
+ __1.5.1__
356
+ Documented JSON column type. [Bug fix: Insert and foreign key violation](https://github.com/alfateam/orange-orm/issues/19).
357
+ __1.5.0__
358
+ JSON column type. Postgres json type does not support rdb filters.
359
+ __1.4.1__
360
+ [Empty filter would sometimes cause invalid filter.](https://github.com/alfateam/orange-orm/issues/18)
361
+ __1.4.0__
362
+ Raw SQL query.
363
+ __1.3.0__
364
+ getMany() now supports limit and orderBy - same syntax as in streaming.
365
+ __1.2.3__
366
+ Bugfix: [iEqual gave incorrect sql when parameterized.](https://github.com/alfateam/orange-orm/issues/17)
367
+ __1.2.2__
368
+ Exlusive no longer returns a clone of table. It has changes current table to exclusive locking.
369
+ __1.2.1__
370
+ Bugfix: Exclusive row locks
371
+ __1.2.0__
372
+ Exclusive row locks
373
+ __1.1.0__
374
+ Now supporting streaming. Requires postgres or MySQL >=5.7.7
375
+ __1.0.8__
376
+ README fixup.
377
+ __1.0.7__
378
+ Better performance on insert and update.
379
+ __1.0.6__
380
+ Bugfix: Transaction domain should not forward rdb singleton from old domain.
381
+ __1.0.5__
382
+ Documentation cleanup.
383
+ __1.0.4__
384
+ [orderBy](https://github.com/alfateam/orange-orm/blob/master/src/docs/docs.md#_todtowithorderby) in toDto().
385
+ __1.0.3__
386
+ toDto() using next tick on every thousandth row to avoid maximum call stack size exceeded.
387
+ __1.0.2__
388
+ Reduced number of simultaneous promises in order to avoid maximum call stack size exceeded.
389
+ __1.0.1__
390
+ Bugfix: Incorrect insert/updates on timestamp without timezone. The time was converted utc instead of stripping the timezone.
391
+ __1.0.0__
392
+ Transaction domain forwards properties from old domain.
393
+ Semantic versioning from now on.
394
+ __0.5.1__
395
+ Improved performance
396
+ __0.5.0__
397
+ [Logging](https://github.com/alfateam/orange-orm-demo/blob/master/logging.js): rdb.log(someFunc) logs sql and parameters.
398
+ [Raw sql filters.](https://github.com/alfateam/orange-orm-demo/blob/master/filtering/rawSqlFilter.js)
399
+ __0.4.9__
400
+ New method: tryGetById.
401
+ New filter: iEqual, postgres only.
402
+ Bugfix: rows.toJSON() without strategy did not include any children.
403
+ __0.4.8__
404
+ Explicit pooling with size and end().
405
+ Bugfix: mySql did not release client to pool.
406
+ __0.4.7__
407
+ Upgraded to pg 4.3.0
408
+ Upgraded to mysql 2.5.5
409
+ __0.4.6__
410
+ Upgraded pg 4.2.0.
411
+ __0.4.5__
412
+ Oops. Forgot to use pg.js instead of pg.
413
+ __0.4.4__
414
+ Upgraded all dependencies to latest. Using pg.js instead of pg.
415
+ __0.4.3__
416
+ [Can ignore columns when serializing to dto](https://github.com/alfateam/orange-orm-demo/blob/master/serializable.js).
417
+ __0.4.2__
418
+ Bugfix: [update on a row crashes when a delete occurs earlier in same transaction](https://github.com/alfateam/orange-orm/issues/12).
419
+ __0.4.1__
420
+ Bugfix: more global leaks.
421
+ __0.4.0__
422
+ Bugfix: global leak.
423
+ __0.3.9__
424
+ Bugfix: eager loading joins/hasOne with non unique column names was not handled correctly.
425
+ __0.3.8__
426
+ Supports mySql.
427
+ Bulk deletes.
428
+ __0.3.7__
429
+ Bugfix: eager loading manyRelation on a join/hasOne returned empty array #11
430
+ __0.3.6__
431
+ Fixed sql injection vulnerability.
432
+ __0.3.5__
433
+ Built-in fetching strategies for lazy loading. Works best in readonly scenarios.
434
+ __0.3.4__
435
+ Docs and examples split moved to separate file.
436
+ __0.3.3__
437
+ Fixed documentation layout again.
438
+ __0.3.2__
439
+ Fixed documentation layout.
440
+ __0.3.1__
441
+ Case insensitive filters: iStartsWith, iEndsWith and iContains.
442
+ __0.3.0__
443
+ Fix broken links in docs.
444
+ __0.2.9__
445
+ Support for row.delete().
446
+ Rollback only throws when error is present.
447
+ __0.2.8__
448
+ Guid accepts uppercase letters.
449
+ Bugfix: null inserts on guid columns yielded wrong sql.
450
+ __0.2.7__
451
+ New method, toDto(), converts row to data transfer object.
452
+ Bugfix: toJSON returned incorrect string on hasMany relations.
453
+ __0.2.6__
454
+ Fixed incorrect links in README.
455
+ __0.2.5__
456
+ Bugfix: caching on composite keys could give a crash #7.
457
+ Improved sql compression on insert/update.
458
+ __0.2.4__
459
+ Bugfix: getMany with many-strategy and shallowFilter yields incorrect query #6.
460
+ __0.2.3__
461
+ Reformatted documentation. No code changes.