@harperfast/harper 5.0.0-alpha.10

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 (879) hide show
  1. package/CODE_OF_CONDUCT.md +83 -0
  2. package/LICENSE +201 -0
  3. package/README.md +54 -0
  4. package/SECURITY.md +18 -0
  5. package/SUPPORT.md +26 -0
  6. package/dist/bin/BinObjects.d.ts +9 -0
  7. package/dist/bin/BinObjects.js +15 -0
  8. package/dist/bin/BinObjects.js.map +1 -0
  9. package/dist/bin/cliOperations.d.ts +12 -0
  10. package/dist/bin/cliOperations.js +156 -0
  11. package/dist/bin/cliOperations.js.map +1 -0
  12. package/dist/bin/copyDb.d.ts +2 -0
  13. package/dist/bin/copyDb.js +298 -0
  14. package/dist/bin/copyDb.js.map +1 -0
  15. package/dist/bin/harper.d.ts +2 -0
  16. package/dist/bin/harper.js +148 -0
  17. package/dist/bin/harper.js.map +1 -0
  18. package/dist/bin/install.d.ts +2 -0
  19. package/dist/bin/install.js +16 -0
  20. package/dist/bin/install.js.map +1 -0
  21. package/dist/bin/lite.d.ts +1 -0
  22. package/dist/bin/lite.js +6 -0
  23. package/dist/bin/lite.js.map +1 -0
  24. package/dist/bin/restart.d.ts +13 -0
  25. package/dist/bin/restart.js +194 -0
  26. package/dist/bin/restart.js.map +1 -0
  27. package/dist/bin/run.d.ts +21 -0
  28. package/dist/bin/run.js +365 -0
  29. package/dist/bin/run.js.map +1 -0
  30. package/dist/bin/status.d.ts +2 -0
  31. package/dist/bin/status.js +56 -0
  32. package/dist/bin/status.js.map +1 -0
  33. package/dist/bin/stop.d.ts +2 -0
  34. package/dist/bin/stop.js +17 -0
  35. package/dist/bin/stop.js.map +1 -0
  36. package/dist/bin/upgrade.d.ts +7 -0
  37. package/dist/bin/upgrade.js +111 -0
  38. package/dist/bin/upgrade.js.map +1 -0
  39. package/dist/components/Application.d.ts +110 -0
  40. package/dist/components/Application.js +509 -0
  41. package/dist/components/Application.js.map +1 -0
  42. package/dist/components/ApplicationScope.d.ts +28 -0
  43. package/dist/components/ApplicationScope.js +81 -0
  44. package/dist/components/ApplicationScope.js.map +1 -0
  45. package/dist/components/Component.d.ts +21 -0
  46. package/dist/components/Component.js +43 -0
  47. package/dist/components/Component.js.map +1 -0
  48. package/dist/components/ComponentV1.d.ts +69 -0
  49. package/dist/components/ComponentV1.js +263 -0
  50. package/dist/components/ComponentV1.js.map +1 -0
  51. package/dist/components/DEFAULT_CONFIG.d.ts +18 -0
  52. package/dist/components/DEFAULT_CONFIG.js +22 -0
  53. package/dist/components/DEFAULT_CONFIG.js.map +1 -0
  54. package/dist/components/EntryHandler.d.ts +61 -0
  55. package/dist/components/EntryHandler.js +148 -0
  56. package/dist/components/EntryHandler.js.map +1 -0
  57. package/dist/components/OptionsWatcher.d.ts +75 -0
  58. package/dist/components/OptionsWatcher.js +281 -0
  59. package/dist/components/OptionsWatcher.js.map +1 -0
  60. package/dist/components/PluginModule.d.ts +5 -0
  61. package/dist/components/PluginModule.js +3 -0
  62. package/dist/components/PluginModule.js.map +1 -0
  63. package/dist/components/Scope.d.ts +49 -0
  64. package/dist/components/Scope.js +262 -0
  65. package/dist/components/Scope.js.map +1 -0
  66. package/dist/components/componentLoader.js +498 -0
  67. package/dist/components/componentLoader.js.map +1 -0
  68. package/dist/components/deriveCommonPatternBase.d.ts +1 -0
  69. package/dist/components/deriveCommonPatternBase.js +34 -0
  70. package/dist/components/deriveCommonPatternBase.js.map +1 -0
  71. package/dist/components/deriveGlobOptions.d.ts +13 -0
  72. package/dist/components/deriveGlobOptions.js +30 -0
  73. package/dist/components/deriveGlobOptions.js.map +1 -0
  74. package/dist/components/deriveURLPath.d.ts +3 -0
  75. package/dist/components/deriveURLPath.js +55 -0
  76. package/dist/components/deriveURLPath.js.map +1 -0
  77. package/dist/components/operations.d.ts +97 -0
  78. package/dist/components/operations.js +556 -0
  79. package/dist/components/operations.js.map +1 -0
  80. package/dist/components/operationsValidation.d.ts +44 -0
  81. package/dist/components/operationsValidation.js +221 -0
  82. package/dist/components/operationsValidation.js.map +1 -0
  83. package/dist/components/packageComponent.d.ts +8 -0
  84. package/dist/components/packageComponent.js +42 -0
  85. package/dist/components/packageComponent.js.map +1 -0
  86. package/dist/components/requestRestart.d.ts +3 -0
  87. package/dist/components/requestRestart.js +27 -0
  88. package/dist/components/requestRestart.js.map +1 -0
  89. package/dist/components/resolveBaseURLPath.d.ts +15 -0
  90. package/dist/components/resolveBaseURLPath.js +38 -0
  91. package/dist/components/resolveBaseURLPath.js.map +1 -0
  92. package/dist/components/status/ComponentStatus.d.ts +61 -0
  93. package/dist/components/status/ComponentStatus.js +102 -0
  94. package/dist/components/status/ComponentStatus.js.map +1 -0
  95. package/dist/components/status/ComponentStatusRegistry.d.ts +89 -0
  96. package/dist/components/status/ComponentStatusRegistry.js +195 -0
  97. package/dist/components/status/ComponentStatusRegistry.js.map +1 -0
  98. package/dist/components/status/api.d.ts +104 -0
  99. package/dist/components/status/api.js +137 -0
  100. package/dist/components/status/api.js.map +1 -0
  101. package/dist/components/status/crossThread.d.ts +62 -0
  102. package/dist/components/status/crossThread.js +343 -0
  103. package/dist/components/status/crossThread.js.map +1 -0
  104. package/dist/components/status/errors.d.ts +68 -0
  105. package/dist/components/status/errors.js +123 -0
  106. package/dist/components/status/errors.js.map +1 -0
  107. package/dist/components/status/index.d.ts +35 -0
  108. package/dist/components/status/index.js +75 -0
  109. package/dist/components/status/index.js.map +1 -0
  110. package/dist/components/status/internal.d.ts +40 -0
  111. package/dist/components/status/internal.js +76 -0
  112. package/dist/components/status/internal.js.map +1 -0
  113. package/dist/components/status/registry.d.ts +10 -0
  114. package/dist/components/status/registry.js +14 -0
  115. package/dist/components/status/registry.js.map +1 -0
  116. package/dist/components/status/types.d.ts +94 -0
  117. package/dist/components/status/types.js +20 -0
  118. package/dist/components/status/types.js.map +1 -0
  119. package/dist/config/RootConfigWatcher.d.ts +10 -0
  120. package/dist/config/RootConfigWatcher.js +59 -0
  121. package/dist/config/RootConfigWatcher.js.map +1 -0
  122. package/dist/config/configHelpers.d.ts +6 -0
  123. package/dist/config/configHelpers.js +47 -0
  124. package/dist/config/configHelpers.js.map +1 -0
  125. package/dist/config/configUtils.d.ts +85 -0
  126. package/dist/config/configUtils.js +801 -0
  127. package/dist/config/configUtils.js.map +1 -0
  128. package/dist/config/harperConfigEnvVars.d.ts +46 -0
  129. package/dist/config/harperConfigEnvVars.js +527 -0
  130. package/dist/config/harperConfigEnvVars.js.map +1 -0
  131. package/dist/dataLayer/CreateAttributeObject.d.ts +19 -0
  132. package/dist/dataLayer/CreateAttributeObject.js +23 -0
  133. package/dist/dataLayer/CreateAttributeObject.js.map +1 -0
  134. package/dist/dataLayer/CreateTableObject.d.ts +7 -0
  135. package/dist/dataLayer/CreateTableObject.js +10 -0
  136. package/dist/dataLayer/CreateTableObject.js.map +1 -0
  137. package/dist/dataLayer/DataLayerObjects.d.ts +22 -0
  138. package/dist/dataLayer/DataLayerObjects.js +33 -0
  139. package/dist/dataLayer/DataLayerObjects.js.map +1 -0
  140. package/dist/dataLayer/DeleteBeforeObject.d.ts +18 -0
  141. package/dist/dataLayer/DeleteBeforeObject.js +21 -0
  142. package/dist/dataLayer/DeleteBeforeObject.js.map +1 -0
  143. package/dist/dataLayer/DeleteObject.d.ts +19 -0
  144. package/dist/dataLayer/DeleteObject.js +23 -0
  145. package/dist/dataLayer/DeleteObject.js.map +1 -0
  146. package/dist/dataLayer/DropAttributeObject.d.ts +7 -0
  147. package/dist/dataLayer/DropAttributeObject.js +10 -0
  148. package/dist/dataLayer/DropAttributeObject.js.map +1 -0
  149. package/dist/dataLayer/GetBackupObject.d.ts +16 -0
  150. package/dist/dataLayer/GetBackupObject.js +20 -0
  151. package/dist/dataLayer/GetBackupObject.js.map +1 -0
  152. package/dist/dataLayer/InsertObject.d.ts +20 -0
  153. package/dist/dataLayer/InsertObject.js +24 -0
  154. package/dist/dataLayer/InsertObject.js.map +1 -0
  155. package/dist/dataLayer/ReadAuditLogObject.d.ts +18 -0
  156. package/dist/dataLayer/ReadAuditLogObject.js +22 -0
  157. package/dist/dataLayer/ReadAuditLogObject.js.map +1 -0
  158. package/dist/dataLayer/SQLSearch.d.ts +171 -0
  159. package/dist/dataLayer/SQLSearch.js +1168 -0
  160. package/dist/dataLayer/SQLSearch.js.map +1 -0
  161. package/dist/dataLayer/SearchByConditionsObject.d.ts +85 -0
  162. package/dist/dataLayer/SearchByConditionsObject.js +57 -0
  163. package/dist/dataLayer/SearchByConditionsObject.js.map +1 -0
  164. package/dist/dataLayer/SearchByHashObject.d.ts +17 -0
  165. package/dist/dataLayer/SearchByHashObject.js +20 -0
  166. package/dist/dataLayer/SearchByHashObject.js.map +1 -0
  167. package/dist/dataLayer/SearchObject.d.ts +30 -0
  168. package/dist/dataLayer/SearchObject.js +33 -0
  169. package/dist/dataLayer/SearchObject.js.map +1 -0
  170. package/dist/dataLayer/SqlSearchObject.d.ts +10 -0
  171. package/dist/dataLayer/SqlSearchObject.js +13 -0
  172. package/dist/dataLayer/SqlSearchObject.js.map +1 -0
  173. package/dist/dataLayer/UpdateObject.d.ts +18 -0
  174. package/dist/dataLayer/UpdateObject.js +22 -0
  175. package/dist/dataLayer/UpdateObject.js.map +1 -0
  176. package/dist/dataLayer/UpsertObject.d.ts +18 -0
  177. package/dist/dataLayer/UpsertObject.js +22 -0
  178. package/dist/dataLayer/UpsertObject.js.map +1 -0
  179. package/dist/dataLayer/bulkLoad.d.ts +28 -0
  180. package/dist/dataLayer/bulkLoad.js +624 -0
  181. package/dist/dataLayer/bulkLoad.js.map +1 -0
  182. package/dist/dataLayer/dataObjects/BulkLoadObjects.d.ts +17 -0
  183. package/dist/dataLayer/dataObjects/BulkLoadObjects.js +25 -0
  184. package/dist/dataLayer/dataObjects/BulkLoadObjects.js.map +1 -0
  185. package/dist/dataLayer/dataObjects/UpsertObject.d.ts +18 -0
  186. package/dist/dataLayer/dataObjects/UpsertObject.js +22 -0
  187. package/dist/dataLayer/dataObjects/UpsertObject.js.map +1 -0
  188. package/dist/dataLayer/delete.d.ts +22 -0
  189. package/dist/dataLayer/delete.js +111 -0
  190. package/dist/dataLayer/delete.js.map +1 -0
  191. package/dist/dataLayer/export.d.ts +15 -0
  192. package/dist/dataLayer/export.js +302 -0
  193. package/dist/dataLayer/export.js.map +1 -0
  194. package/dist/dataLayer/getBackup.d.ts +8 -0
  195. package/dist/dataLayer/getBackup.js +28 -0
  196. package/dist/dataLayer/getBackup.js.map +1 -0
  197. package/dist/dataLayer/harperBridge/BridgeMethods.d.ts +24 -0
  198. package/dist/dataLayer/harperBridge/BridgeMethods.js +62 -0
  199. package/dist/dataLayer/harperBridge/BridgeMethods.js.map +1 -0
  200. package/dist/dataLayer/harperBridge/ResourceBridge.d.ts +104 -0
  201. package/dist/dataLayer/harperBridge/ResourceBridge.js +630 -0
  202. package/dist/dataLayer/harperBridge/ResourceBridge.js.map +1 -0
  203. package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateReturnObj.d.ts +14 -0
  204. package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateReturnObj.js +24 -0
  205. package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateReturnObj.js.map +1 -0
  206. package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.d.ts +11 -0
  207. package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.js +68 -0
  208. package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.js.map +1 -0
  209. package/dist/dataLayer/harperBridge/harperBridge.d.ts +2 -0
  210. package/dist/dataLayer/harperBridge/harperBridge.js +18 -0
  211. package/dist/dataLayer/harperBridge/harperBridge.js.map +1 -0
  212. package/dist/dataLayer/harperBridge/lmdbBridge/LMDBBridge.d.ts +47 -0
  213. package/dist/dataLayer/harperBridge/lmdbBridge/LMDBBridge.js +99 -0
  214. package/dist/dataLayer/harperBridge/lmdbBridge/LMDBBridge.js.map +1 -0
  215. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.d.ts +15 -0
  216. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.js +18 -0
  217. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/DeleteAuditLogsBeforeResults.js.map +1 -0
  218. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.d.ts +12 -0
  219. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js +74 -0
  220. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js.map +1 -0
  221. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.d.ts +13 -0
  222. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js +54 -0
  223. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js.map +1 -0
  224. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.d.ts +6 -0
  225. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js +23 -0
  226. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js.map +1 -0
  227. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.d.ts +8 -0
  228. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js +62 -0
  229. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js.map +1 -0
  230. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.d.ts +8 -0
  231. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js +82 -0
  232. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js.map +1 -0
  233. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.d.ts +11 -0
  234. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.js +76 -0
  235. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.js.map +1 -0
  236. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.d.ts +9 -0
  237. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js +83 -0
  238. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js.map +1 -0
  239. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.d.ts +6 -0
  240. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js +73 -0
  241. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js.map +1 -0
  242. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.d.ts +6 -0
  243. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js +110 -0
  244. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js.map +1 -0
  245. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.d.ts +14 -0
  246. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.js +33 -0
  247. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.js.map +1 -0
  248. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.d.ts +7 -0
  249. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.js +110 -0
  250. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.js.map +1 -0
  251. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.d.ts +6 -0
  252. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.js +21 -0
  253. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.js.map +1 -0
  254. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.d.ts +14 -0
  255. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js +25 -0
  256. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js.map +1 -0
  257. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.d.ts +7 -0
  258. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.js +180 -0
  259. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.js.map +1 -0
  260. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.d.ts +8 -0
  261. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js +134 -0
  262. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js.map +1 -0
  263. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.d.ts +6 -0
  264. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.js +14 -0
  265. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.js.map +1 -0
  266. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.d.ts +15 -0
  267. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js +26 -0
  268. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js.map +1 -0
  269. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbTransaction.d.ts +8 -0
  270. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbTransaction.js +17 -0
  271. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbTransaction.js.map +1 -0
  272. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.d.ts +12 -0
  273. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.js +52 -0
  274. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.js.map +1 -0
  275. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.d.ts +15 -0
  276. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js +56 -0
  277. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js.map +1 -0
  278. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.d.ts +16 -0
  279. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js +20 -0
  280. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js.map +1 -0
  281. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBDeleteTransactionObject.d.ts +16 -0
  282. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBDeleteTransactionObject.js +22 -0
  283. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBDeleteTransactionObject.js.map +1 -0
  284. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBInsertTransactionObject.d.ts +16 -0
  285. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBInsertTransactionObject.js +21 -0
  286. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBInsertTransactionObject.js.map +1 -0
  287. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBTransactionObject.d.ts +19 -0
  288. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBTransactionObject.js +22 -0
  289. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBTransactionObject.js.map +1 -0
  290. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpdateTransactionObject.d.ts +18 -0
  291. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpdateTransactionObject.js +23 -0
  292. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpdateTransactionObject.js.map +1 -0
  293. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpsertTransactionObject.d.ts +18 -0
  294. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpsertTransactionObject.js +23 -0
  295. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBUpsertTransactionObject.js.map +1 -0
  296. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/TableSizeObject.d.ts +21 -0
  297. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/TableSizeObject.js +24 -0
  298. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/TableSizeObject.js.map +1 -0
  299. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.d.ts +7 -0
  300. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js +19 -0
  301. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js.map +1 -0
  302. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.d.ts +22 -0
  303. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +137 -0
  304. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js.map +1 -0
  305. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.d.ts +9 -0
  306. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js +73 -0
  307. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js.map +1 -0
  308. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.d.ts +8 -0
  309. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js +38 -0
  310. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js.map +1 -0
  311. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.d.ts +8 -0
  312. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.js +29 -0
  313. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.js.map +1 -0
  314. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.d.ts +17 -0
  315. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js +63 -0
  316. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js.map +1 -0
  317. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.d.ts +106 -0
  318. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.js +251 -0
  319. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.js.map +1 -0
  320. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.d.ts +8 -0
  321. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.js +66 -0
  322. package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.js.map +1 -0
  323. package/dist/dataLayer/hdbInfoController.d.ts +28 -0
  324. package/dist/dataLayer/hdbInfoController.js +203 -0
  325. package/dist/dataLayer/hdbInfoController.js.map +1 -0
  326. package/dist/dataLayer/insert.d.ts +44 -0
  327. package/dist/dataLayer/insert.js +192 -0
  328. package/dist/dataLayer/insert.js.map +1 -0
  329. package/dist/dataLayer/readAuditLog.d.ts +8 -0
  330. package/dist/dataLayer/readAuditLog.js +37 -0
  331. package/dist/dataLayer/readAuditLog.js.map +1 -0
  332. package/dist/dataLayer/schema.d.ts +24 -0
  333. package/dist/dataLayer/schema.js +225 -0
  334. package/dist/dataLayer/schema.js.map +1 -0
  335. package/dist/dataLayer/schemaDescribe.d.ts +26 -0
  336. package/dist/dataLayer/schemaDescribe.js +265 -0
  337. package/dist/dataLayer/schemaDescribe.js.map +1 -0
  338. package/dist/dataLayer/search.d.ts +4 -0
  339. package/dist/dataLayer/search.js +56 -0
  340. package/dist/dataLayer/search.js.map +1 -0
  341. package/dist/dataLayer/transaction.d.ts +8 -0
  342. package/dist/dataLayer/transaction.js +16 -0
  343. package/dist/dataLayer/transaction.js.map +1 -0
  344. package/dist/dataLayer/update.d.ts +15 -0
  345. package/dist/dataLayer/update.js +107 -0
  346. package/dist/dataLayer/update.js.map +1 -0
  347. package/dist/globals.d.ts +7 -0
  348. package/dist/globals.js +12 -0
  349. package/dist/globals.js.map +1 -0
  350. package/dist/index.d.ts +7 -0
  351. package/dist/index.js +40 -0
  352. package/dist/index.js.map +1 -0
  353. package/dist/json/systemSchema.json +373 -0
  354. package/dist/launchServiceScripts/utility/checkNodeVersion.d.ts +4 -0
  355. package/dist/launchServiceScripts/utility/checkNodeVersion.js +13 -0
  356. package/dist/launchServiceScripts/utility/checkNodeVersion.js.map +1 -0
  357. package/dist/resources/DatabaseTransaction.d.ts +96 -0
  358. package/dist/resources/DatabaseTransaction.js +354 -0
  359. package/dist/resources/DatabaseTransaction.js.map +1 -0
  360. package/dist/resources/ErrorResource.d.ts +26 -0
  361. package/dist/resources/ErrorResource.js +60 -0
  362. package/dist/resources/ErrorResource.js.map +1 -0
  363. package/dist/resources/IterableEventQueue.d.ts +19 -0
  364. package/dist/resources/IterableEventQueue.js +103 -0
  365. package/dist/resources/IterableEventQueue.js.map +1 -0
  366. package/dist/resources/LMDBTransaction.d.ts +43 -0
  367. package/dist/resources/LMDBTransaction.js +371 -0
  368. package/dist/resources/LMDBTransaction.js.map +1 -0
  369. package/dist/resources/RecordEncoder.d.ts +65 -0
  370. package/dist/resources/RecordEncoder.js +700 -0
  371. package/dist/resources/RecordEncoder.js.map +1 -0
  372. package/dist/resources/RequestTarget.d.ts +57 -0
  373. package/dist/resources/RequestTarget.js +91 -0
  374. package/dist/resources/RequestTarget.js.map +1 -0
  375. package/dist/resources/Resource.d.ts +152 -0
  376. package/dist/resources/Resource.js +727 -0
  377. package/dist/resources/Resource.js.map +1 -0
  378. package/dist/resources/ResourceInterface.d.ts +162 -0
  379. package/dist/resources/ResourceInterface.js +3 -0
  380. package/dist/resources/ResourceInterface.js.map +1 -0
  381. package/dist/resources/ResourceInterfaceV2.d.ts +21 -0
  382. package/dist/resources/ResourceInterfaceV2.js +3 -0
  383. package/dist/resources/ResourceInterfaceV2.js.map +1 -0
  384. package/dist/resources/ResourceV2.d.ts +30 -0
  385. package/dist/resources/ResourceV2.js +27 -0
  386. package/dist/resources/ResourceV2.js.map +1 -0
  387. package/dist/resources/Resources.d.ts +36 -0
  388. package/dist/resources/Resources.js +155 -0
  389. package/dist/resources/Resources.js.map +1 -0
  390. package/dist/resources/RocksIndexStore.d.ts +24 -0
  391. package/dist/resources/RocksIndexStore.js +54 -0
  392. package/dist/resources/RocksIndexStore.js.map +1 -0
  393. package/dist/resources/RocksTransactionLogStore.d.ts +60 -0
  394. package/dist/resources/RocksTransactionLogStore.js +344 -0
  395. package/dist/resources/RocksTransactionLogStore.js.map +1 -0
  396. package/dist/resources/Table.d.ts +854 -0
  397. package/dist/resources/Table.js +4350 -0
  398. package/dist/resources/Table.js.map +1 -0
  399. package/dist/resources/analytics/hostnames.d.ts +16 -0
  400. package/dist/resources/analytics/hostnames.js +72 -0
  401. package/dist/resources/analytics/hostnames.js.map +1 -0
  402. package/dist/resources/analytics/metadata.d.ts +9 -0
  403. package/dist/resources/analytics/metadata.js +12 -0
  404. package/dist/resources/analytics/metadata.js.map +1 -0
  405. package/dist/resources/analytics/profile.d.ts +2 -0
  406. package/dist/resources/analytics/profile.js +144 -0
  407. package/dist/resources/analytics/profile.js.map +1 -0
  408. package/dist/resources/analytics/read.d.ts +41 -0
  409. package/dist/resources/analytics/read.js +189 -0
  410. package/dist/resources/analytics/read.js.map +1 -0
  411. package/dist/resources/analytics/write.d.ts +131 -0
  412. package/dist/resources/analytics/write.js +822 -0
  413. package/dist/resources/analytics/write.js.map +1 -0
  414. package/dist/resources/auditStore.d.ts +81 -0
  415. package/dist/resources/auditStore.js +572 -0
  416. package/dist/resources/auditStore.js.map +1 -0
  417. package/dist/resources/blob.d.ts +137 -0
  418. package/dist/resources/blob.js +1273 -0
  419. package/dist/resources/blob.js.map +1 -0
  420. package/dist/resources/crdt.d.ts +19 -0
  421. package/dist/resources/crdt.js +146 -0
  422. package/dist/resources/crdt.js.map +1 -0
  423. package/dist/resources/dataLoader.d.ts +98 -0
  424. package/dist/resources/dataLoader.js +461 -0
  425. package/dist/resources/dataLoader.js.map +1 -0
  426. package/dist/resources/databases.d.ts +131 -0
  427. package/dist/resources/databases.js +1220 -0
  428. package/dist/resources/databases.js.map +1 -0
  429. package/dist/resources/graphql.d.ts +19 -0
  430. package/dist/resources/graphql.js +223 -0
  431. package/dist/resources/graphql.js.map +1 -0
  432. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.d.ts +87 -0
  433. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js +598 -0
  434. package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js.map +1 -0
  435. package/dist/resources/indexes/customIndexes.d.ts +4 -0
  436. package/dist/resources/indexes/customIndexes.js +10 -0
  437. package/dist/resources/indexes/customIndexes.js.map +1 -0
  438. package/dist/resources/indexes/vector.d.ts +2 -0
  439. package/dist/resources/indexes/vector.js +40 -0
  440. package/dist/resources/indexes/vector.js.map +1 -0
  441. package/dist/resources/jsResource.d.ts +24 -0
  442. package/dist/resources/jsResource.js +82 -0
  443. package/dist/resources/jsResource.js.map +1 -0
  444. package/dist/resources/loadEnv.d.ts +5 -0
  445. package/dist/resources/loadEnv.js +28 -0
  446. package/dist/resources/loadEnv.js.map +1 -0
  447. package/dist/resources/login.d.ts +3 -0
  448. package/dist/resources/login.js +22 -0
  449. package/dist/resources/login.js.map +1 -0
  450. package/dist/resources/openApi.d.ts +27 -0
  451. package/dist/resources/openApi.js +327 -0
  452. package/dist/resources/openApi.js.map +1 -0
  453. package/dist/resources/registrationDeprecated.d.ts +4 -0
  454. package/dist/resources/registrationDeprecated.js +11 -0
  455. package/dist/resources/registrationDeprecated.js.map +1 -0
  456. package/dist/resources/replayLogs.d.ts +2 -0
  457. package/dist/resources/replayLogs.js +170 -0
  458. package/dist/resources/replayLogs.js.map +1 -0
  459. package/dist/resources/roles.d.ts +11 -0
  460. package/dist/resources/roles.js +102 -0
  461. package/dist/resources/roles.js.map +1 -0
  462. package/dist/resources/search.d.ts +39 -0
  463. package/dist/resources/search.js +1333 -0
  464. package/dist/resources/search.js.map +1 -0
  465. package/dist/resources/tracked.d.ts +49 -0
  466. package/dist/resources/tracked.js +665 -0
  467. package/dist/resources/tracked.js.map +1 -0
  468. package/dist/resources/transaction.d.ts +9 -0
  469. package/dist/resources/transaction.js +89 -0
  470. package/dist/resources/transaction.js.map +1 -0
  471. package/dist/resources/transactionBroadcast.d.ts +38 -0
  472. package/dist/resources/transactionBroadcast.js +263 -0
  473. package/dist/resources/transactionBroadcast.js.map +1 -0
  474. package/dist/security/auth.d.ts +9 -0
  475. package/dist/security/auth.js +408 -0
  476. package/dist/security/auth.js.map +1 -0
  477. package/dist/security/certificateVerification/certificateVerificationSource.d.ts +18 -0
  478. package/dist/security/certificateVerification/certificateVerificationSource.js +78 -0
  479. package/dist/security/certificateVerification/certificateVerificationSource.js.map +1 -0
  480. package/dist/security/certificateVerification/configValidation.d.ts +14 -0
  481. package/dist/security/certificateVerification/configValidation.js +101 -0
  482. package/dist/security/certificateVerification/configValidation.js.map +1 -0
  483. package/dist/security/certificateVerification/crlVerification.d.ts +29 -0
  484. package/dist/security/certificateVerification/crlVerification.js +564 -0
  485. package/dist/security/certificateVerification/crlVerification.js.map +1 -0
  486. package/dist/security/certificateVerification/index.d.ts +31 -0
  487. package/dist/security/certificateVerification/index.js +111 -0
  488. package/dist/security/certificateVerification/index.js.map +1 -0
  489. package/dist/security/certificateVerification/ocspVerification.d.ts +23 -0
  490. package/dist/security/certificateVerification/ocspVerification.js +117 -0
  491. package/dist/security/certificateVerification/ocspVerification.js.map +1 -0
  492. package/dist/security/certificateVerification/pkijs-ed25519-patch.d.ts +14 -0
  493. package/dist/security/certificateVerification/pkijs-ed25519-patch.js +183 -0
  494. package/dist/security/certificateVerification/pkijs-ed25519-patch.js.map +1 -0
  495. package/dist/security/certificateVerification/types.d.ts +105 -0
  496. package/dist/security/certificateVerification/types.js +6 -0
  497. package/dist/security/certificateVerification/types.js.map +1 -0
  498. package/dist/security/certificateVerification/verificationConfig.d.ts +29 -0
  499. package/dist/security/certificateVerification/verificationConfig.js +121 -0
  500. package/dist/security/certificateVerification/verificationConfig.js.map +1 -0
  501. package/dist/security/certificateVerification/verificationUtils.d.ts +79 -0
  502. package/dist/security/certificateVerification/verificationUtils.js +441 -0
  503. package/dist/security/certificateVerification/verificationUtils.js.map +1 -0
  504. package/dist/security/cryptoHash.d.ts +2 -0
  505. package/dist/security/cryptoHash.js +35 -0
  506. package/dist/security/cryptoHash.js.map +1 -0
  507. package/dist/security/data_objects/PermissionAttributeResponseObject.d.ts +11 -0
  508. package/dist/security/data_objects/PermissionAttributeResponseObject.js +14 -0
  509. package/dist/security/data_objects/PermissionAttributeResponseObject.js.map +1 -0
  510. package/dist/security/data_objects/PermissionResponseObject.d.ts +57 -0
  511. package/dist/security/data_objects/PermissionResponseObject.js +105 -0
  512. package/dist/security/data_objects/PermissionResponseObject.js.map +1 -0
  513. package/dist/security/data_objects/PermissionTableResponseObject.d.ts +16 -0
  514. package/dist/security/data_objects/PermissionTableResponseObject.js +19 -0
  515. package/dist/security/data_objects/PermissionTableResponseObject.js.map +1 -0
  516. package/dist/security/fastifyAuth.d.ts +2 -0
  517. package/dist/security/fastifyAuth.js +135 -0
  518. package/dist/security/fastifyAuth.js.map +1 -0
  519. package/dist/security/impersonation.d.ts +11 -0
  520. package/dist/security/impersonation.js +139 -0
  521. package/dist/security/impersonation.js.map +1 -0
  522. package/dist/security/jsLoader.d.ts +9 -0
  523. package/dist/security/jsLoader.js +522 -0
  524. package/dist/security/jsLoader.js.map +1 -0
  525. package/dist/security/keys.d.ts +119 -0
  526. package/dist/security/keys.js +866 -0
  527. package/dist/security/keys.js.map +1 -0
  528. package/dist/security/permissionsTranslator.d.ts +9 -0
  529. package/dist/security/permissionsTranslator.js +269 -0
  530. package/dist/security/permissionsTranslator.js.map +1 -0
  531. package/dist/security/role.d.ts +5 -0
  532. package/dist/security/role.js +160 -0
  533. package/dist/security/role.js.map +1 -0
  534. package/dist/security/tokenAuthentication.d.ts +38 -0
  535. package/dist/security/tokenAuthentication.js +205 -0
  536. package/dist/security/tokenAuthentication.js.map +1 -0
  537. package/dist/security/user.d.ts +77 -0
  538. package/dist/security/user.js +349 -0
  539. package/dist/security/user.js.map +1 -0
  540. package/dist/server/DurableSubscriptionsSession.d.ts +74 -0
  541. package/dist/server/DurableSubscriptionsSession.js +511 -0
  542. package/dist/server/DurableSubscriptionsSession.js.map +1 -0
  543. package/dist/server/REST.d.ts +16 -0
  544. package/dist/server/REST.js +423 -0
  545. package/dist/server/REST.js.map +1 -0
  546. package/dist/server/Server.d.ts +62 -0
  547. package/dist/server/Server.js +27 -0
  548. package/dist/server/Server.js.map +1 -0
  549. package/dist/server/fastifyRoutes/helpers/getCORSOptions.d.ts +11 -0
  550. package/dist/server/fastifyRoutes/helpers/getCORSOptions.js +32 -0
  551. package/dist/server/fastifyRoutes/helpers/getCORSOptions.js.map +1 -0
  552. package/dist/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.d.ts +6 -0
  553. package/dist/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.js +13 -0
  554. package/dist/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.js.map +1 -0
  555. package/dist/server/fastifyRoutes/helpers/getServerOptions.d.ts +12 -0
  556. package/dist/server/fastifyRoutes/helpers/getServerOptions.js +30 -0
  557. package/dist/server/fastifyRoutes/helpers/getServerOptions.js.map +1 -0
  558. package/dist/server/fastifyRoutes/plugins/hdbCore.d.ts +2 -0
  559. package/dist/server/fastifyRoutes/plugins/hdbCore.js +31 -0
  560. package/dist/server/fastifyRoutes/plugins/hdbCore.js.map +1 -0
  561. package/dist/server/fastifyRoutes.d.ts +25 -0
  562. package/dist/server/fastifyRoutes.js +235 -0
  563. package/dist/server/fastifyRoutes.js.map +1 -0
  564. package/dist/server/graphqlQuerying.d.ts +1 -0
  565. package/dist/server/graphqlQuerying.js +630 -0
  566. package/dist/server/graphqlQuerying.js.map +1 -0
  567. package/dist/server/http.d.ts +15 -0
  568. package/dist/server/http.js +650 -0
  569. package/dist/server/http.js.map +1 -0
  570. package/dist/server/itc/serverHandlers.d.ts +10 -0
  571. package/dist/server/itc/serverHandlers.js +153 -0
  572. package/dist/server/itc/serverHandlers.js.map +1 -0
  573. package/dist/server/itc/utility/ITCEventObject.d.ts +6 -0
  574. package/dist/server/itc/utility/ITCEventObject.js +9 -0
  575. package/dist/server/itc/utility/ITCEventObject.js.map +1 -0
  576. package/dist/server/jobs/JobObject.d.ts +15 -0
  577. package/dist/server/jobs/JobObject.js +22 -0
  578. package/dist/server/jobs/JobObject.js.map +1 -0
  579. package/dist/server/jobs/jobProcess.d.ts +1 -0
  580. package/dist/server/jobs/jobProcess.js +66 -0
  581. package/dist/server/jobs/jobProcess.js.map +1 -0
  582. package/dist/server/jobs/jobRunner.d.ts +11 -0
  583. package/dist/server/jobs/jobRunner.js +160 -0
  584. package/dist/server/jobs/jobRunner.js.map +1 -0
  585. package/dist/server/jobs/jobs.d.ts +20 -0
  586. package/dist/server/jobs/jobs.js +267 -0
  587. package/dist/server/jobs/jobs.js.map +1 -0
  588. package/dist/server/loadRootComponents.d.ts +5 -0
  589. package/dist/server/loadRootComponents.js +45 -0
  590. package/dist/server/loadRootComponents.js.map +1 -0
  591. package/dist/server/mqtt.d.ts +9 -0
  592. package/dist/server/mqtt.js +466 -0
  593. package/dist/server/mqtt.js.map +1 -0
  594. package/dist/server/nodeName.d.ts +5 -0
  595. package/dist/server/nodeName.js +84 -0
  596. package/dist/server/nodeName.js.map +1 -0
  597. package/dist/server/operationsServer.d.ts +48 -0
  598. package/dist/server/operationsServer.js +265 -0
  599. package/dist/server/operationsServer.js.map +1 -0
  600. package/dist/server/serverHelpers/Headers.d.ts +20 -0
  601. package/dist/server/serverHelpers/Headers.js +134 -0
  602. package/dist/server/serverHelpers/Headers.js.map +1 -0
  603. package/dist/server/serverHelpers/JSONStream.d.ts +14 -0
  604. package/dist/server/serverHelpers/JSONStream.js +322 -0
  605. package/dist/server/serverHelpers/JSONStream.js.map +1 -0
  606. package/dist/server/serverHelpers/OperationFunctionObject.d.ts +9 -0
  607. package/dist/server/serverHelpers/OperationFunctionObject.js +17 -0
  608. package/dist/server/serverHelpers/OperationFunctionObject.js.map +1 -0
  609. package/dist/server/serverHelpers/Request.d.ts +69 -0
  610. package/dist/server/serverHelpers/Request.js +141 -0
  611. package/dist/server/serverHelpers/Request.js.map +1 -0
  612. package/dist/server/serverHelpers/contentTypes.d.ts +57 -0
  613. package/dist/server/serverHelpers/contentTypes.js +639 -0
  614. package/dist/server/serverHelpers/contentTypes.js.map +1 -0
  615. package/dist/server/serverHelpers/requestTimePlugin.d.ts +2 -0
  616. package/dist/server/serverHelpers/requestTimePlugin.js +56 -0
  617. package/dist/server/serverHelpers/requestTimePlugin.js.map +1 -0
  618. package/dist/server/serverHelpers/serverHandlers.d.ts +6 -0
  619. package/dist/server/serverHelpers/serverHandlers.js +130 -0
  620. package/dist/server/serverHelpers/serverHandlers.js.map +1 -0
  621. package/dist/server/serverHelpers/serverUtilities.d.ts +29 -0
  622. package/dist/server/serverHelpers/serverUtilities.js +356 -0
  623. package/dist/server/serverHelpers/serverUtilities.js.map +1 -0
  624. package/dist/server/serverRegistry.d.ts +3 -0
  625. package/dist/server/serverRegistry.js +11 -0
  626. package/dist/server/serverRegistry.js.map +1 -0
  627. package/dist/server/static.d.ts +16 -0
  628. package/dist/server/static.js +164 -0
  629. package/dist/server/static.js.map +1 -0
  630. package/dist/server/status/definitions.d.ts +27 -0
  631. package/dist/server/status/definitions.js +22 -0
  632. package/dist/server/status/definitions.js.map +1 -0
  633. package/dist/server/status/index.d.ts +26 -0
  634. package/dist/server/status/index.js +89 -0
  635. package/dist/server/status/index.js.map +1 -0
  636. package/dist/server/storageReclamation.d.ts +18 -0
  637. package/dist/server/storageReclamation.js +96 -0
  638. package/dist/server/storageReclamation.js.map +1 -0
  639. package/dist/server/threads/itc.d.ts +53 -0
  640. package/dist/server/threads/itc.js +81 -0
  641. package/dist/server/threads/itc.js.map +1 -0
  642. package/dist/server/threads/manageThreads.d.ts +30 -0
  643. package/dist/server/threads/manageThreads.js +579 -0
  644. package/dist/server/threads/manageThreads.js.map +1 -0
  645. package/dist/server/threads/socketRouter.d.ts +6 -0
  646. package/dist/server/threads/socketRouter.js +395 -0
  647. package/dist/server/threads/socketRouter.js.map +1 -0
  648. package/dist/server/threads/threadServer.d.ts +5 -0
  649. package/dist/server/threads/threadServer.js +288 -0
  650. package/dist/server/threads/threadServer.js.map +1 -0
  651. package/dist/server/throttle.d.ts +7 -0
  652. package/dist/server/throttle.js +71 -0
  653. package/dist/server/throttle.js.map +1 -0
  654. package/dist/sqlTranslator/SelectValidator.d.ts +79 -0
  655. package/dist/sqlTranslator/SelectValidator.js +274 -0
  656. package/dist/sqlTranslator/SelectValidator.js.map +1 -0
  657. package/dist/sqlTranslator/alasqlFunctionImporter.d.ts +2 -0
  658. package/dist/sqlTranslator/alasqlFunctionImporter.js +55 -0
  659. package/dist/sqlTranslator/alasqlFunctionImporter.js.map +1 -0
  660. package/dist/sqlTranslator/deleteTranslator.d.ts +2 -0
  661. package/dist/sqlTranslator/deleteTranslator.js +56 -0
  662. package/dist/sqlTranslator/deleteTranslator.js.map +1 -0
  663. package/dist/sqlTranslator/index.d.ts +16 -0
  664. package/dist/sqlTranslator/index.js +215 -0
  665. package/dist/sqlTranslator/index.js.map +1 -0
  666. package/dist/sqlTranslator/sql_statement_bucket.d.ts +46 -0
  667. package/dist/sqlTranslator/sql_statement_bucket.js +430 -0
  668. package/dist/sqlTranslator/sql_statement_bucket.js.map +1 -0
  669. package/dist/upgrade/UpgradeObjects.d.ts +5 -0
  670. package/dist/upgrade/UpgradeObjects.js +12 -0
  671. package/dist/upgrade/UpgradeObjects.js.map +1 -0
  672. package/dist/upgrade/directives/directivesController.d.ts +30 -0
  673. package/dist/upgrade/directives/directivesController.js +76 -0
  674. package/dist/upgrade/directives/directivesController.js.map +1 -0
  675. package/dist/upgrade/directivesManager.d.ts +7 -0
  676. package/dist/upgrade/directivesManager.js +125 -0
  677. package/dist/upgrade/directivesManager.js.map +1 -0
  678. package/dist/upgrade/upgradePrompt.d.ts +13 -0
  679. package/dist/upgrade/upgradePrompt.js +102 -0
  680. package/dist/upgrade/upgradePrompt.js.map +1 -0
  681. package/dist/upgrade/upgradeUtilities.d.ts +10 -0
  682. package/dist/upgrade/upgradeUtilities.js +26 -0
  683. package/dist/upgrade/upgradeUtilities.js.map +1 -0
  684. package/dist/utility/AWS/AWSConnector.d.ts +2 -0
  685. package/dist/utility/AWS/AWSConnector.js +26 -0
  686. package/dist/utility/AWS/AWSConnector.js.map +1 -0
  687. package/dist/utility/OperationFunctionCaller.d.ts +9 -0
  688. package/dist/utility/OperationFunctionCaller.js +58 -0
  689. package/dist/utility/OperationFunctionCaller.js.map +1 -0
  690. package/dist/utility/assignCmdEnvVariables.d.ts +10 -0
  691. package/dist/utility/assignCmdEnvVariables.js +55 -0
  692. package/dist/utility/assignCmdEnvVariables.js.map +1 -0
  693. package/dist/utility/common_utils.d.ts +264 -0
  694. package/dist/utility/common_utils.js +806 -0
  695. package/dist/utility/common_utils.js.map +1 -0
  696. package/dist/utility/environment/environmentManager.d.ts +41 -0
  697. package/dist/utility/environment/environmentManager.js +179 -0
  698. package/dist/utility/environment/environmentManager.js.map +1 -0
  699. package/dist/utility/environment/systemInformation.d.ts +67 -0
  700. package/dist/utility/environment/systemInformation.js +326 -0
  701. package/dist/utility/environment/systemInformation.js.map +1 -0
  702. package/dist/utility/errors/commonErrors.d.ts +171 -0
  703. package/dist/utility/errors/commonErrors.js +230 -0
  704. package/dist/utility/errors/commonErrors.js.map +1 -0
  705. package/dist/utility/errors/hdbError.d.ts +76 -0
  706. package/dist/utility/errors/hdbError.js +128 -0
  707. package/dist/utility/errors/hdbError.js.map +1 -0
  708. package/dist/utility/functions/date/dateFunctions.d.ts +11 -0
  709. package/dist/utility/functions/date/dateFunctions.js +64 -0
  710. package/dist/utility/functions/date/dateFunctions.js.map +1 -0
  711. package/dist/utility/functions/geo.d.ts +74 -0
  712. package/dist/utility/functions/geo.js +311 -0
  713. package/dist/utility/functions/geo.js.map +1 -0
  714. package/dist/utility/functions/sql/alaSQLExtension.d.ts +13 -0
  715. package/dist/utility/functions/sql/alaSQLExtension.js +96 -0
  716. package/dist/utility/functions/sql/alaSQLExtension.js.map +1 -0
  717. package/dist/utility/globalSchema.d.ts +151 -0
  718. package/dist/utility/globalSchema.js +34 -0
  719. package/dist/utility/globalSchema.js.map +1 -0
  720. package/dist/utility/hdbTerms.d.ts +737 -0
  721. package/dist/utility/hdbTerms.js +756 -0
  722. package/dist/utility/hdbTerms.js.map +1 -0
  723. package/dist/utility/install/checkJWTTokensExist.d.ts +5 -0
  724. package/dist/utility/install/checkJWTTokensExist.js +53 -0
  725. package/dist/utility/install/checkJWTTokensExist.js.map +1 -0
  726. package/dist/utility/install/installer.d.ts +17 -0
  727. package/dist/utility/install/installer.js +569 -0
  728. package/dist/utility/install/installer.js.map +1 -0
  729. package/dist/utility/installation.d.ts +12 -0
  730. package/dist/utility/installation.js +64 -0
  731. package/dist/utility/installation.js.map +1 -0
  732. package/dist/utility/lmdb/DBIDefinition.d.ts +16 -0
  733. package/dist/utility/lmdb/DBIDefinition.js +19 -0
  734. package/dist/utility/lmdb/DBIDefinition.js.map +1 -0
  735. package/dist/utility/lmdb/DeleteRecordsResponseObject.d.ts +21 -0
  736. package/dist/utility/lmdb/DeleteRecordsResponseObject.js +24 -0
  737. package/dist/utility/lmdb/DeleteRecordsResponseObject.js.map +1 -0
  738. package/dist/utility/lmdb/InsertRecordsResponseObject.d.ts +18 -0
  739. package/dist/utility/lmdb/InsertRecordsResponseObject.js +21 -0
  740. package/dist/utility/lmdb/InsertRecordsResponseObject.js.map +1 -0
  741. package/dist/utility/lmdb/OpenDBIObject.d.ts +23 -0
  742. package/dist/utility/lmdb/OpenDBIObject.js +29 -0
  743. package/dist/utility/lmdb/OpenDBIObject.js.map +1 -0
  744. package/dist/utility/lmdb/OpenEnvironmentObject.d.ts +22 -0
  745. package/dist/utility/lmdb/OpenEnvironmentObject.js +40 -0
  746. package/dist/utility/lmdb/OpenEnvironmentObject.js.map +1 -0
  747. package/dist/utility/lmdb/UpdateRecordsResponseObject.d.ts +21 -0
  748. package/dist/utility/lmdb/UpdateRecordsResponseObject.js +24 -0
  749. package/dist/utility/lmdb/UpdateRecordsResponseObject.js.map +1 -0
  750. package/dist/utility/lmdb/UpsertRecordsResponseObject.d.ts +18 -0
  751. package/dist/utility/lmdb/UpsertRecordsResponseObject.js +21 -0
  752. package/dist/utility/lmdb/UpsertRecordsResponseObject.js.map +1 -0
  753. package/dist/utility/lmdb/cleanLMDBMap.d.ts +6 -0
  754. package/dist/utility/lmdb/cleanLMDBMap.js +63 -0
  755. package/dist/utility/lmdb/cleanLMDBMap.js.map +1 -0
  756. package/dist/utility/lmdb/commonUtility.d.ts +28 -0
  757. package/dist/utility/lmdb/commonUtility.js +120 -0
  758. package/dist/utility/lmdb/commonUtility.js.map +1 -0
  759. package/dist/utility/lmdb/deleteUtility.d.ts +10 -0
  760. package/dist/utility/lmdb/deleteUtility.js +115 -0
  761. package/dist/utility/lmdb/deleteUtility.js.map +1 -0
  762. package/dist/utility/lmdb/environmentUtility.d.ts +81 -0
  763. package/dist/utility/lmdb/environmentUtility.js +432 -0
  764. package/dist/utility/lmdb/environmentUtility.js.map +1 -0
  765. package/dist/utility/lmdb/searchCursorFunctions.d.ts +93 -0
  766. package/dist/utility/lmdb/searchCursorFunctions.js +174 -0
  767. package/dist/utility/lmdb/searchCursorFunctions.js.map +1 -0
  768. package/dist/utility/lmdb/searchUtility.d.ts +204 -0
  769. package/dist/utility/lmdb/searchUtility.js +724 -0
  770. package/dist/utility/lmdb/searchUtility.js.map +1 -0
  771. package/dist/utility/lmdb/terms.d.ts +34 -0
  772. package/dist/utility/lmdb/terms.js +52 -0
  773. package/dist/utility/lmdb/terms.js.map +1 -0
  774. package/dist/utility/lmdb/writeUtility.d.ts +32 -0
  775. package/dist/utility/lmdb/writeUtility.js +360 -0
  776. package/dist/utility/lmdb/writeUtility.js.map +1 -0
  777. package/dist/utility/logging/harper_logger.d.ts +141 -0
  778. package/dist/utility/logging/harper_logger.js +862 -0
  779. package/dist/utility/logging/harper_logger.js.map +1 -0
  780. package/dist/utility/logging/logRotator.d.ts +19 -0
  781. package/dist/utility/logging/logRotator.js +146 -0
  782. package/dist/utility/logging/logRotator.js.map +1 -0
  783. package/dist/utility/logging/logger.d.ts +11 -0
  784. package/dist/utility/logging/logger.js +19 -0
  785. package/dist/utility/logging/logger.js.map +1 -0
  786. package/dist/utility/logging/readLog.d.ts +8 -0
  787. package/dist/utility/logging/readLog.js +339 -0
  788. package/dist/utility/logging/readLog.js.map +1 -0
  789. package/dist/utility/logging/transactionLog.d.ts +8 -0
  790. package/dist/utility/logging/transactionLog.js +46 -0
  791. package/dist/utility/logging/transactionLog.js.map +1 -0
  792. package/dist/utility/mount_hdb.d.ts +2 -0
  793. package/dist/utility/mount_hdb.js +51 -0
  794. package/dist/utility/mount_hdb.js.map +1 -0
  795. package/dist/utility/npmUtilities.d.ts +6 -0
  796. package/dist/utility/npmUtilities.js +91 -0
  797. package/dist/utility/npmUtilities.js.map +1 -0
  798. package/dist/utility/operationPermissions.d.ts +36 -0
  799. package/dist/utility/operationPermissions.js +116 -0
  800. package/dist/utility/operationPermissions.js.map +1 -0
  801. package/dist/utility/operation_authorization.d.ts +18 -0
  802. package/dist/utility/operation_authorization.js +667 -0
  803. package/dist/utility/operation_authorization.js.map +1 -0
  804. package/dist/utility/packageUtils.d.ts +9 -0
  805. package/dist/utility/packageUtils.js +52 -0
  806. package/dist/utility/packageUtils.js.map +1 -0
  807. package/dist/utility/password.d.ts +20 -0
  808. package/dist/utility/password.js +119 -0
  809. package/dist/utility/password.js.map +1 -0
  810. package/dist/utility/processManagement/processManagement.d.ts +35 -0
  811. package/dist/utility/processManagement/processManagement.js +188 -0
  812. package/dist/utility/processManagement/processManagement.js.map +1 -0
  813. package/dist/utility/processManagement/servicesConfig.d.ts +29 -0
  814. package/dist/utility/processManagement/servicesConfig.js +52 -0
  815. package/dist/utility/processManagement/servicesConfig.js.map +1 -0
  816. package/dist/utility/scripts/restartHdb.d.ts +1 -0
  817. package/dist/utility/scripts/restartHdb.js +23 -0
  818. package/dist/utility/scripts/restartHdb.js.map +1 -0
  819. package/dist/utility/signalling.d.ts +2 -0
  820. package/dist/utility/signalling.js +35 -0
  821. package/dist/utility/signalling.js.map +1 -0
  822. package/dist/utility/terms/certificates.d.ts +46 -0
  823. package/dist/utility/terms/certificates.js +65 -0
  824. package/dist/utility/terms/certificates.js.map +1 -0
  825. package/dist/utility/when.d.ts +3 -0
  826. package/dist/utility/when.js +18 -0
  827. package/dist/utility/when.js.map +1 -0
  828. package/dist/validation/bulkDeleteValidator.d.ts +2 -0
  829. package/dist/validation/bulkDeleteValidator.js +21 -0
  830. package/dist/validation/bulkDeleteValidator.js.map +1 -0
  831. package/dist/validation/check_permissions.d.ts +2 -0
  832. package/dist/validation/check_permissions.js +20 -0
  833. package/dist/validation/check_permissions.js.map +1 -0
  834. package/dist/validation/common_validators.d.ts +19 -0
  835. package/dist/validation/common_validators.js +76 -0
  836. package/dist/validation/common_validators.js.map +1 -0
  837. package/dist/validation/configValidator.d.ts +8 -0
  838. package/dist/validation/configValidator.js +292 -0
  839. package/dist/validation/configValidator.js.map +1 -0
  840. package/dist/validation/deleteValidator.d.ts +2 -0
  841. package/dist/validation/deleteValidator.js +15 -0
  842. package/dist/validation/deleteValidator.js.map +1 -0
  843. package/dist/validation/fileLoadValidator.d.ts +4 -0
  844. package/dist/validation/fileLoadValidator.js +138 -0
  845. package/dist/validation/fileLoadValidator.js.map +1 -0
  846. package/dist/validation/insertValidator.d.ts +2 -0
  847. package/dist/validation/insertValidator.js +38 -0
  848. package/dist/validation/insertValidator.js.map +1 -0
  849. package/dist/validation/installValidator.d.ts +7 -0
  850. package/dist/validation/installValidator.js +28 -0
  851. package/dist/validation/installValidator.js.map +1 -0
  852. package/dist/validation/readLogValidator.d.ts +2 -0
  853. package/dist/validation/readLogValidator.js +48 -0
  854. package/dist/validation/readLogValidator.js.map +1 -0
  855. package/dist/validation/role_validation.d.ts +3 -0
  856. package/dist/validation/role_validation.js +284 -0
  857. package/dist/validation/role_validation.js.map +1 -0
  858. package/dist/validation/schemaMetadataValidator.d.ts +16 -0
  859. package/dist/validation/schemaMetadataValidator.js +38 -0
  860. package/dist/validation/schemaMetadataValidator.js.map +1 -0
  861. package/dist/validation/searchValidator.d.ts +2 -0
  862. package/dist/validation/searchValidator.js +141 -0
  863. package/dist/validation/searchValidator.js.map +1 -0
  864. package/dist/validation/statusValidator.d.ts +19 -0
  865. package/dist/validation/statusValidator.js +95 -0
  866. package/dist/validation/statusValidator.js.map +1 -0
  867. package/dist/validation/transactionLogValidator.d.ts +2 -0
  868. package/dist/validation/transactionLogValidator.js +28 -0
  869. package/dist/validation/transactionLogValidator.js.map +1 -0
  870. package/dist/validation/user_validation.d.ts +3 -0
  871. package/dist/validation/user_validation.js +52 -0
  872. package/dist/validation/user_validation.js.map +1 -0
  873. package/dist/validation/validationWrapper.d.ts +15 -0
  874. package/dist/validation/validationWrapper.js +95 -0
  875. package/dist/validation/validationWrapper.js.map +1 -0
  876. package/package.json +225 -0
  877. package/static/README.md +13 -0
  878. package/static/ascii_logo.txt +21 -0
  879. package/static/defaultConfig.yaml +75 -0
@@ -0,0 +1,1168 @@
1
+ 'use strict';
2
+ /**
3
+ * SQLSearch.js
4
+ * This class is used to receive the alasql generated AST from a SQL SELECT,
5
+ * process and return results by passing the raw values into the alasql SQL parser
6
+ */
7
+ const _ = require('lodash');
8
+ const alasql = require('alasql');
9
+ alasql.options.cache = false;
10
+ const alasqlFunctionImporter = require('../sqlTranslator/alasqlFunctionImporter.js');
11
+ const clone = require('clone');
12
+ const RecursiveIterator = require('recursive-iterator');
13
+ const log = require('../utility/logging/harper_logger.js');
14
+ const commonUtils = require('../utility/common_utils.js');
15
+ const harperBridge = require('./harperBridge/harperBridge.js');
16
+ const hdbTerms = require("../utility/hdbTerms.js");
17
+ const { hdbErrors } = require('../utility/errors/hdbError.js');
18
+ const { getDatabases } = require("../resources/databases.js");
19
+ const WHERE_CLAUSE_IS_NULL = 'IS NULL';
20
+ const SEARCH_ERROR_MSG = 'There was a problem performing this search. Please check the logs and try again.';
21
+ //here we call to define and import custom functions to alasql
22
+ alasqlFunctionImporter(alasql);
23
+ class SQLSearch {
24
+ /**
25
+ * Constructor for FileSearch class
26
+ *
27
+ * @param statement - the AST for the SQL SELECT to process
28
+ * @param attributes - all attributes that are part of the schema for the tables in select
29
+ */
30
+ constructor(statement, attributes) {
31
+ if (commonUtils.isEmpty(statement)) {
32
+ log.error('AST statement for SQL select process cannot be empty');
33
+ throw 'statement cannot be null';
34
+ }
35
+ this.statement = statement;
36
+ //this is every attribute that we need to pull data for
37
+ this.columns = {};
38
+ this.all_table_attributes = attributes;
39
+ this.fetch_attributes = [];
40
+ this.exact_search_values = {};
41
+ this.comparator_search_values = {};
42
+ this.tables = [];
43
+ //holds the data to be evaluated by the sql processor
44
+ this.data = {};
45
+ this.has_aggregator = false;
46
+ this.has_ordinal = false;
47
+ this.has_outer_join = false;
48
+ this._getColumns();
49
+ this._getTables();
50
+ this._conditionsToFetchAttributeValues();
51
+ this._setAliasesForColumns();
52
+ commonUtils.backtickASTSchemaItems(this.statement);
53
+ }
54
+ /**
55
+ * Starting point function to execute the search
56
+ * @returns {Promise<results|finalResults[]|Array>}
57
+ */
58
+ async search() {
59
+ let searchResults = undefined;
60
+ try {
61
+ let emptySqlResults = await this._checkEmptySQL();
62
+ if (!commonUtils.isEmptyOrZeroLength(emptySqlResults)) {
63
+ log.trace('No results returned from checkEmptySQL SQLSearch method.');
64
+ return emptySqlResults;
65
+ }
66
+ }
67
+ catch (err) {
68
+ log.error('Error thrown from checkEmptySQL in SQLSearch class method search.');
69
+ log.error(err);
70
+ throw new Error(SEARCH_ERROR_MSG);
71
+ }
72
+ try {
73
+ // Search for fetch attribute values and consolidate them into this.data[table].__mergedData property
74
+ const simpleQueryResults = await this._getFetchAttributeValues();
75
+ if (simpleQueryResults) {
76
+ return simpleQueryResults;
77
+ }
78
+ }
79
+ catch (err) {
80
+ log.error('Error thrown from getFetchAttributeValues in SQLSearch class method search.');
81
+ log.error(err);
82
+ throw new Error(SEARCH_ERROR_MSG);
83
+ }
84
+ // In the instance of null data this.data would not have schema/table defined or created as there is no data backing up what would sit in data.
85
+ if (Object.keys(this.data).length === 0) {
86
+ log.trace('SQLSearch class field: "data" is empty.');
87
+ return [];
88
+ }
89
+ let joinResults;
90
+ try {
91
+ // Consolidate initial data required for first pass of sql join - narrows list of hash ids for second pass to collect all data resulting from sql request
92
+ joinResults = await this._processJoins();
93
+ }
94
+ catch (err) {
95
+ log.error('Error thrown from processJoins in SQLSearch class method search.');
96
+ log.error(err);
97
+ throw new Error(SEARCH_ERROR_MSG);
98
+ }
99
+ try {
100
+ // Decide the most efficient way to make the second/final pass for collecting all additional data needed for sql request
101
+ await this._getFinalAttributeData(joinResults.existing_attributes, joinResults.joined_length);
102
+ }
103
+ catch (err) {
104
+ log.error('Error thrown from getFinalAttributeData in SQLSearch class method search.');
105
+ log.error(err);
106
+ throw new Error(SEARCH_ERROR_MSG);
107
+ }
108
+ try {
109
+ searchResults = await this._finalSQL();
110
+ return searchResults;
111
+ }
112
+ catch (err) {
113
+ log.error('Error thrown from finalSQL in SQLSearch class method search.');
114
+ log.error(err);
115
+ throw new Error(SEARCH_ERROR_MSG);
116
+ }
117
+ }
118
+ /**
119
+ * Gets the raw column from each section of the statement and puts them in a map
120
+ * @private
121
+ */
122
+ _getColumns() {
123
+ let iterator = new RecursiveIterator(this.statement);
124
+ for (let { node, path } of iterator) {
125
+ if (node && node.columnid) {
126
+ if (!this.columns[path[0]]) {
127
+ this.columns[path[0]] = [];
128
+ }
129
+ this.columns[path[0]].push(clone(node));
130
+ }
131
+ }
132
+ }
133
+ /**
134
+ * Extracts the table info from the attributes
135
+ * @private
136
+ */
137
+ _getTables() {
138
+ let tbls = [];
139
+ this.all_table_attributes.forEach((attribute) => {
140
+ tbls.push(attribute.table);
141
+ });
142
+ this.tables = _.uniqBy(tbls, (tbl) => [tbl.databaseid, tbl.tableid, tbl.as].join());
143
+ this.tables.forEach((table) => {
144
+ const schemaTable = `${table.databaseid}_${table.as ? table.as : table.tableid}`;
145
+ this.data[schemaTable] = {};
146
+ this.data[schemaTable].__hashName = getDatabases()[table.databaseid][table.tableid].primaryKey;
147
+ this.data[schemaTable].__mergedData = {};
148
+ this.data[schemaTable].__mergedAttributes = [];
149
+ this.data[schemaTable].__mergedAttrMap = {};
150
+ });
151
+ }
152
+ /**
153
+ * Iterates the where AST with the goal of finding exact values to match directly on. Matching on values allows us to skip parsing an index
154
+ * If a condition has a columnid, and op of '=' or 'IN' and only is comparing to raw values we will limit the column to the raw value match.
155
+ * If a column condition does not have these criteria or another condition for the same column does not adhere to the criteria then we ignore it for exact matching.
156
+ * @private
157
+ */
158
+ _conditionsToFetchAttributeValues() {
159
+ //TODO - CORE-1095 - update how WHERE clause value that include escaped characters is used to do initial
160
+ // searchByValue query - this value is set to this.exact_search_values in this method
161
+ if (commonUtils.isEmpty(this.statement.where)) {
162
+ log.trace('AST "where" statement is empty.');
163
+ return;
164
+ }
165
+ //if there is an OR in the where clause we will not perform exact match search on attributes as it ends up excluding values incorrectly.
166
+ let totalIgnore = false;
167
+ //check for OR statement (see not above) and update numeric hash values set as strings in the statement to evaluate the table data
168
+ // correctly as numbers in alasql which evaluates based on data types
169
+ for (let { node } of new RecursiveIterator(this.statement.where)) {
170
+ if (node && node.op && node.op === 'OR') {
171
+ totalIgnore = true;
172
+ }
173
+ if (!commonUtils.isEmpty(node) && node.right) {
174
+ if (commonUtils.isNotEmptyAndHasValue(node.right.value)) {
175
+ const whereVal = commonUtils.autoCast(node.right.value);
176
+ if ([true, false].indexOf(whereVal) >= 0) {
177
+ node.right = new alasql.yy.LogicValue({ value: whereVal });
178
+ }
179
+ }
180
+ else if (Array.isArray(node.right)) {
181
+ node.right.forEach((col, i) => {
182
+ const whereVal = commonUtils.autoCast(col.value);
183
+ if ([true, false].indexOf(whereVal) >= 0) {
184
+ node.right[i] = new alasql.yy.LogicValue({ value: whereVal });
185
+ }
186
+ else if (col instanceof alasql.yy.StringValue &&
187
+ commonUtils.autoCasterIsNumberCheck(whereVal.toString())) {
188
+ node.right[i] = new alasql.yy.NumValue({ value: whereVal });
189
+ }
190
+ });
191
+ }
192
+ }
193
+ }
194
+ if (totalIgnore) {
195
+ log.trace('Where clause contains "OR", exact match search not performed on attributes.');
196
+ return;
197
+ }
198
+ for (let { node } of new RecursiveIterator(this.statement.where)) {
199
+ if (node && node.left && node.right && (node.left.columnid || node.right.value) && node.op) {
200
+ let values = new Set();
201
+ let column = node.left.columnid ? node.left : node.right;
202
+ let foundColumn = this._findColumn(column);
203
+ if (!foundColumn) {
204
+ continue;
205
+ }
206
+ //Specifically a slash delimited string for consistency
207
+ let attributeKey = [foundColumn.table.databaseid, foundColumn.table.tableid, foundColumn.attribute].join('/');
208
+ // Check for value range search first
209
+ if (!commonUtils.isEmpty(hdbTerms.VALUE_SEARCH_COMPARATORS_REVERSE_LOOKUP[node.op])) {
210
+ if (commonUtils.isEmpty(this.comparator_search_values[attributeKey])) {
211
+ this.comparator_search_values[attributeKey] = {
212
+ ignore: false,
213
+ comparators: [],
214
+ };
215
+ }
216
+ if (!this.comparator_search_values[attributeKey].ignore) {
217
+ if (commonUtils.isEmptyOrZeroLength(node.left.columnid) ||
218
+ commonUtils.isEmptyOrZeroLength(node.right.value)) {
219
+ this.comparator_search_values[attributeKey].ignore = true;
220
+ this.comparator_search_values[attributeKey].comparators = [];
221
+ continue;
222
+ }
223
+ this.comparator_search_values[attributeKey].comparators.push({
224
+ attribute: node.left.columnid,
225
+ operation: node.op,
226
+ value: node.right.value,
227
+ });
228
+ }
229
+ continue;
230
+ }
231
+ if (commonUtils.isEmpty(this.exact_search_values[attributeKey])) {
232
+ this.exact_search_values[attributeKey] = {
233
+ ignore: false,
234
+ values: new Set(),
235
+ };
236
+ }
237
+ if (!this.exact_search_values[attributeKey].ignore) {
238
+ let ignore = false;
239
+ switch (node.op) {
240
+ case '=':
241
+ if (!commonUtils.isEmpty(node.right.value) || !commonUtils.isEmpty(node.left.value)) {
242
+ values.add(!commonUtils.isEmpty(node.right.value) ? node.right.value : node.left.value);
243
+ }
244
+ else {
245
+ ignore = true;
246
+ }
247
+ break;
248
+ case 'IN':
249
+ let inArray = Array.isArray(node.right) ? node.right : node.left;
250
+ for (let x = 0; x < inArray.length; x++) {
251
+ if (inArray[x].value) {
252
+ values.add(inArray[x].value);
253
+ }
254
+ else {
255
+ ignore = true;
256
+ break;
257
+ }
258
+ }
259
+ break;
260
+ default:
261
+ ignore = true;
262
+ break;
263
+ }
264
+ this.exact_search_values[attributeKey].ignore = ignore;
265
+ //if we are ignoring the column for exact matches we clear out it's values to match later
266
+ if (ignore) {
267
+ this.exact_search_values[attributeKey].values = new Set();
268
+ }
269
+ else {
270
+ this.exact_search_values[attributeKey].values = new Set([
271
+ ...this.exact_search_values[attributeKey].values,
272
+ ...values,
273
+ ]);
274
+ }
275
+ }
276
+ }
277
+ }
278
+ }
279
+ /**
280
+ * Iterates the columns in the AST and assigns an alias to each column if one does not exist. This is necessary to ensure
281
+ * that the final result returned from alasql include the correct column header
282
+ * @private
283
+ */
284
+ _setAliasesForColumns() {
285
+ //this scenario is reached by doing a select with only calculations and, therefore, this step can be skipped.
286
+ if (commonUtils.isEmptyOrZeroLength(this.all_table_attributes) &&
287
+ commonUtils.isEmptyOrZeroLength(this.statement.from) &&
288
+ commonUtils.isEmptyOrZeroLength(this.columns.columns)) {
289
+ return;
290
+ }
291
+ let wildcardIndexes = [];
292
+ let dupAttrCount = {};
293
+ this.statement.columns.forEach((col, index) => {
294
+ if (col.columnid === '*') {
295
+ wildcardIndexes.push(index);
296
+ return;
297
+ }
298
+ if (col.aggregatorid) {
299
+ this.has_aggregator = true;
300
+ }
301
+ if (!col.aggregatorid && !col.funcid) {
302
+ col.as_orig = col.as ? col.as : col.columnid;
303
+ if (this.statement.joins) {
304
+ if (dupAttrCount[col.as_orig] >= 0) {
305
+ const attrCount = dupAttrCount[col.as_orig] + 1;
306
+ col.as = `[${col.as_orig + attrCount}]`;
307
+ dupAttrCount[col.as_orig] = attrCount;
308
+ }
309
+ else {
310
+ col.as = `[${col.as_orig}]`;
311
+ dupAttrCount[col.as_orig] = 0;
312
+ }
313
+ }
314
+ else {
315
+ col.as = `[${col.as_orig}]`;
316
+ }
317
+ }
318
+ if (!col.aggregatorid && col.funcid && col.args) {
319
+ col.as_orig = col.as ? col.as : col.toString().replace(/'/g, '"');
320
+ col.as = `[${col.as_orig}]`;
321
+ }
322
+ if (col.aggregatorid && col.expression.columnid !== '*') {
323
+ col.as_orig = col.as
324
+ ? col.as
325
+ : col.expression.tableid
326
+ ? `${col.aggregatorid}(${col.expression.tableid}.${col.expression.columnid})`
327
+ : `${col.aggregatorid}(${col.expression.columnid})`;
328
+ col.as = `[${col.as_orig}]`;
329
+ }
330
+ });
331
+ if (this.statement.columns.length > 1 && wildcardIndexes.length > 0) {
332
+ _.pullAt(this.statement.columns, wildcardIndexes);
333
+ }
334
+ }
335
+ /**
336
+ * Searches the attributes for the matching column based on attribute & table name/alias
337
+ *
338
+ * @param column - the column to search for
339
+ * @returns {foundColumns}
340
+ * @private
341
+ */
342
+ _findColumn(column) {
343
+ //look to see if this attribute exists on one of the tables we are selecting from
344
+ let foundColumns = this.all_table_attributes.filter((attribute) => {
345
+ if (column.columnid_orig && column.tableid_orig) {
346
+ return ((attribute.table.as === column.tableid_orig || attribute.table.tableid === column.tableid_orig) &&
347
+ attribute.attribute === column.columnid_orig);
348
+ }
349
+ if (column.tableid) {
350
+ return ((attribute.table.as === column.tableid || attribute.table.tableid === column.tableid) &&
351
+ attribute.attribute === column.columnid);
352
+ }
353
+ const colName = column.columnid_orig ? column.columnid_orig : column.columnid;
354
+ return attribute.attribute === colName;
355
+ });
356
+ //this is to handle aliases. if we did not find the actual column we look at the aliases in the select columns and then return the matching column from allTableAttrs, if it exists
357
+ if (commonUtils.isEmptyOrZeroLength(foundColumns)) {
358
+ const foundAlias = this.columns.columns.filter((selectColumn) => selectColumn.as ? column.columnid === selectColumn.as : false);
359
+ if (!commonUtils.isEmptyOrZeroLength(foundAlias)) {
360
+ foundColumns = this.all_table_attributes.filter((col) => col.attribute === foundAlias[0].columnid &&
361
+ foundAlias[0].tableid &&
362
+ foundAlias[0].tableid === (col.table.as ? col.table.as : col.table.tableid));
363
+ }
364
+ }
365
+ return foundColumns[0];
366
+ }
367
+ /**
368
+ * This function check to see if there is no from and no columns, or the table has been created but no data has been entered yet
369
+ * if there are not then this is a SELECT used to solely perform a calculation such as SELECT 2*4, or SELECT SQRT(4)
370
+ * @returns {Promise<[]>}
371
+ * @private
372
+ */
373
+ async _checkEmptySQL() {
374
+ let results = [];
375
+ //the scenario that allows this to occur is the table has been created but no data has been entered yet, in this case we return an empty array
376
+ if (commonUtils.isEmptyOrZeroLength(this.all_table_attributes) &&
377
+ !commonUtils.isEmptyOrZeroLength(this.columns.columns)) {
378
+ //purpose of this is to break out of the waterfall but return an empty array
379
+ return results;
380
+ }
381
+ else if (commonUtils.isEmptyOrZeroLength(this.all_table_attributes) &&
382
+ commonUtils.isEmptyOrZeroLength(this.statement.from)) {
383
+ //this scenario is reached by doing a select with only calculations
384
+ try {
385
+ let sql = this._buildSQL(false);
386
+ results = await alasql.promise(sql);
387
+ }
388
+ catch (e) {
389
+ log.error('Error thrown from AlaSQL in SQLSearch class method checkEmptySQL.');
390
+ log.error(e);
391
+ throw new Error('There was a problem with the SQL statement');
392
+ }
393
+ }
394
+ return results;
395
+ }
396
+ /**
397
+ * Iterates an ast segment columns and returns the found column. Typically fetch columns are columns specified in a
398
+ * join, where, or orderby clause.
399
+ * @param segmentAttributes
400
+ * @private
401
+ */
402
+ _addFetchColumns(segmentAttributes) {
403
+ if (segmentAttributes && segmentAttributes.length > 0) {
404
+ segmentAttributes.forEach((attribute) => {
405
+ let found = this._findColumn(attribute);
406
+ if (found) {
407
+ this.fetch_attributes.push(clone(found));
408
+ }
409
+ });
410
+ }
411
+ }
412
+ /**
413
+ * Adds new attribute metadata for the specified table to enable more easily accessing/adding/updating row data being built out
414
+ * @param schemaTable <String> the table to add the metadata to
415
+ * @param attr <String> the attribute to add to the table row metadata
416
+ * @private
417
+ */
418
+ _addColumnToMergedAttributes(schemaTable, attr) {
419
+ this.data[schemaTable].__mergedAttributes.push(attr);
420
+ this.data[schemaTable].__mergedAttrMap[attr] = this.data[schemaTable].__mergedAttributes.length - 1;
421
+ }
422
+ /**
423
+ * Adds the hash attribute to the specified table - this is similar to the above but unique for hash attributes because we always
424
+ * add hash keys to the first index position in the table metadata and do not need to add it to the `__mergedAttrMap`
425
+ * @param schemaTable <String> the table to add the metadata to
426
+ * @param hashValue <String> the hash key to add to the table row metadata
427
+ * @private
428
+ */
429
+ _setMergedHashAttribute(schemaTable, hashValue) {
430
+ this.data[schemaTable].__mergedData[hashValue].splice(0, 1, hashValue);
431
+ }
432
+ /**
433
+ * Updates the table row data for a specific hash value
434
+ * @param schemaTable <String> the table to update the hash value row in
435
+ * @param hashValue <String> the hash value to update an attr for
436
+ * @param attr <String> the attr to update in the table row
437
+ * @param updateValue <String> the value to update in the table row
438
+ * @private
439
+ */
440
+ _updateMergedAttribute(schemaTable, hashValue, attr, updateValue) {
441
+ const attrIndex = this.data[schemaTable].__mergedAttrMap[attr];
442
+ this.data[schemaTable].__mergedData[hashValue].splice(attrIndex, 1, updateValue);
443
+ }
444
+ /**
445
+ * Gets all values for the where, join, & order by attributes and converts the raw indexed data into individual
446
+ * rows by hash attribute consolidated based on tables. If the SQL statement is a simple SELECT query, this method
447
+ * will return the results from that select and bypass the additional alasql steps.
448
+ * @returns {Promise<void>}
449
+ * @private
450
+ */
451
+ async _getFetchAttributeValues() {
452
+ //If there are no columns in the AST at this point, it means that this query was a select * on a table that the
453
+ // user had read access to but has no access to read any of the attributes so we just return empty results.
454
+ if (commonUtils.isEmptyOrZeroLength(Object.keys(this.columns))) {
455
+ return [];
456
+ }
457
+ //get all unique attributes
458
+ this._addFetchColumns(this.columns.joins);
459
+ let whereString = null;
460
+ try {
461
+ whereString = this.statement.where ? this.statement.where.toString() : '';
462
+ }
463
+ catch {
464
+ throw new Error('Could not generate proper where clause');
465
+ }
466
+ if (this.columns.where) {
467
+ this._addFetchColumns(this.columns.where);
468
+ }
469
+ //We need to check if statement only includes basic columns and a from value in the statement
470
+ // - if so, cannot treat as a simple select query and need to run through alasql
471
+ const simpleSelectQuery = this._isSimpleSelect();
472
+ if (simpleSelectQuery) {
473
+ this._addFetchColumns(this.columns.columns);
474
+ }
475
+ //the bitwise or '|' is intentionally used because I want both conditions checked regardless of whether the left condition is false
476
+ else if ((!this.columns.where && this.fetch_attributes.length === 0) |
477
+ (whereString.indexOf(WHERE_CLAUSE_IS_NULL) > -1)) {
478
+ //get unique ids of tables if there is no join or the where is performing an is null check
479
+ this.tables.forEach((table) => {
480
+ let hash_attribute = {
481
+ columnid: getDatabases()[table.databaseid][table.tableid].primaryKey,
482
+ tableid: table.tableid,
483
+ };
484
+ this._addFetchColumns([hash_attribute]);
485
+ });
486
+ }
487
+ if (this.statement.order) {
488
+ this._updateOrderByToAliases();
489
+ this._addNonAggregatorsToFetchColumns();
490
+ }
491
+ // do we need this uniqueby, could just use object as map
492
+ this.fetch_attributes = _.uniqBy(this.fetch_attributes, (attribute) => [
493
+ attribute.table.databaseid,
494
+ attribute.table.as ? attribute.table.as : attribute.table.tableid,
495
+ attribute.attribute,
496
+ ].join());
497
+ if (simpleSelectQuery) {
498
+ return await this._simpleSQLQuery();
499
+ }
500
+ // create a template for each table row to ensure each row has a null value for attrs not returned in the search
501
+ const fetchAttrRowTemplates = this.fetch_attributes.reduce((acc, attr) => {
502
+ const schemaTable = `${attr.table.databaseid}_${attr.table.as ? attr.table.as : attr.table.tableid}`;
503
+ const hashName = this.data[schemaTable].__hashName;
504
+ if (!acc[schemaTable]) {
505
+ acc[schemaTable] = [];
506
+ acc[schemaTable].push(null);
507
+ this._addColumnToMergedAttributes(schemaTable, hashName);
508
+ }
509
+ if (attr.attribute !== hashName) {
510
+ acc[schemaTable].push(null);
511
+ this._addColumnToMergedAttributes(schemaTable, attr.attribute);
512
+ }
513
+ return acc;
514
+ }, {});
515
+ for (const attribute of this.fetch_attributes) {
516
+ const schemaTable = `${attribute.table.databaseid}_${attribute.table.as ? attribute.table.as : attribute.table.tableid}`;
517
+ let hashName = this.data[schemaTable].__hashName;
518
+ let searchObject = {
519
+ schema: attribute.table.databaseid,
520
+ table: attribute.table.tableid,
521
+ get_attributes: [attribute.attribute],
522
+ };
523
+ let isHash = false;
524
+ //Specifically a slash delimited string for consistency
525
+ let objectPath = [attribute.table.databaseid, attribute.table.tableid, attribute.attribute].join('/');
526
+ //check if this attribute is the hash attribute for a table, if it is we need to read the files from the __hdhHash
527
+ // folder, otherwise pull from the value index
528
+ if (attribute.attribute === hashName) {
529
+ isHash = true;
530
+ }
531
+ // if there exact match values for this attribute we just assign them to the attribute, otherwise we pull the
532
+ // index to get all values. This query will test the if statement below
533
+ // "sql":"select weightLbs, age, ownerName from dev.dog where ownerName = 'Kyle'"
534
+ if (!commonUtils.isEmpty(this.exact_search_values[objectPath]) &&
535
+ !this.exact_search_values[objectPath].ignore &&
536
+ !commonUtils.isEmptyOrZeroLength(this.exact_search_values[objectPath].values)) {
537
+ if (isHash) {
538
+ try {
539
+ searchObject.hash_values = Array.from(this.exact_search_values[objectPath].values);
540
+ const attributeValues = await harperBridge.getDataByHash(searchObject);
541
+ for (const hashVal of searchObject.hash_values) {
542
+ if (attributeValues.get(hashVal) && !this.data[schemaTable].__mergedData[hashVal]) {
543
+ this.data[schemaTable].__mergedData[hashVal] = [...fetchAttrRowTemplates[schemaTable]];
544
+ this._setMergedHashAttribute(schemaTable, hashVal);
545
+ }
546
+ }
547
+ }
548
+ catch (err) {
549
+ log.error('Error thrown from getDataByHash function in SQLSearch class method getFetchAttributeValues exact match.');
550
+ log.error(err);
551
+ throw new Error(SEARCH_ERROR_MSG);
552
+ }
553
+ }
554
+ else {
555
+ try {
556
+ searchObject.attribute = attribute.attribute;
557
+ await Promise.all(Array.from(this.exact_search_values[objectPath].values).map(async (value) => {
558
+ let exactSearchObject = { ...searchObject };
559
+ exactSearchObject.value = value;
560
+ const attributeValues = await harperBridge.getDataByValue(exactSearchObject);
561
+ for (const [hashVal, record] of attributeValues) {
562
+ if (!this.data[schemaTable].__mergedData[hashVal]) {
563
+ this.data[schemaTable].__mergedData[hashVal] = [...fetchAttrRowTemplates[schemaTable]];
564
+ this._updateMergedAttribute(schemaTable, hashVal, attribute.attribute, record[attribute.attribute]);
565
+ this._setMergedHashAttribute(schemaTable, hashVal);
566
+ }
567
+ else {
568
+ this._updateMergedAttribute(schemaTable, hashVal, attribute.attribute, record[attribute.attribute]);
569
+ }
570
+ }
571
+ }));
572
+ }
573
+ catch (err) {
574
+ log.error('Error thrown from getDataByValue function in SQLSearch class method getFetchAttributeValues exact match.');
575
+ log.error(err);
576
+ throw new Error(SEARCH_ERROR_MSG);
577
+ }
578
+ }
579
+ }
580
+ else if (!commonUtils.isEmpty(this.comparator_search_values[objectPath]) &&
581
+ !this.comparator_search_values[objectPath].ignore &&
582
+ !commonUtils.isEmptyOrZeroLength(this.comparator_search_values[objectPath].comparators)) {
583
+ try {
584
+ const searchValueComparators = this.comparator_search_values[objectPath].comparators;
585
+ for (let i = 0, len = searchValueComparators.length; i < len; i++) {
586
+ const comp = searchValueComparators[i];
587
+ searchObject.attribute = comp.attribute;
588
+ searchObject.value = comp.value;
589
+ const matchingData = await harperBridge.getDataByValue(searchObject, comp.operation);
590
+ if (isHash) {
591
+ for (const [hashVal] of matchingData) {
592
+ if (!this.data[schemaTable].__mergedData[hashVal]) {
593
+ this.data[schemaTable].__mergedData[hashVal] = [...fetchAttrRowTemplates[schemaTable]];
594
+ this._setMergedHashAttribute(schemaTable, hashVal);
595
+ }
596
+ }
597
+ }
598
+ else {
599
+ for (const [hashVal, record] of matchingData) {
600
+ if (!this.data[schemaTable].__mergedData[hashVal]) {
601
+ this.data[schemaTable].__mergedData[hashVal] = [...fetchAttrRowTemplates[schemaTable]];
602
+ this._updateMergedAttribute(schemaTable, hashVal, attribute.attribute, record[attribute.attribute]);
603
+ this._setMergedHashAttribute(schemaTable, hashVal);
604
+ }
605
+ else {
606
+ this._updateMergedAttribute(schemaTable, hashVal, attribute.attribute, record[attribute.attribute]);
607
+ }
608
+ }
609
+ }
610
+ }
611
+ }
612
+ catch (err) {
613
+ log.error('Error thrown from getDataByValue function in SQLSearch class method getFetchAttributeValues comparator search values.');
614
+ log.error(err);
615
+ throw new Error(SEARCH_ERROR_MSG);
616
+ }
617
+ }
618
+ else {
619
+ try {
620
+ searchObject.attribute = attribute.attribute;
621
+ searchObject.value = '*';
622
+ const matchingData = await harperBridge.getDataByValue(searchObject);
623
+ if (isHash) {
624
+ for (const [hashVal] of matchingData) {
625
+ if (!this.data[schemaTable].__mergedData[hashVal]) {
626
+ this.data[schemaTable].__mergedData[hashVal] = [...fetchAttrRowTemplates[schemaTable]];
627
+ this._setMergedHashAttribute(schemaTable, hashVal);
628
+ }
629
+ }
630
+ }
631
+ else {
632
+ for (const [hashVal, record] of matchingData) {
633
+ if (!this.data[schemaTable].__mergedData[hashVal]) {
634
+ this.data[schemaTable].__mergedData[hashVal] = [...fetchAttrRowTemplates[schemaTable]];
635
+ this._updateMergedAttribute(schemaTable, hashVal, attribute.attribute, record[attribute.attribute]);
636
+ this._setMergedHashAttribute(schemaTable, hashVal);
637
+ }
638
+ else {
639
+ this._updateMergedAttribute(schemaTable, hashVal, attribute.attribute, record[attribute.attribute]);
640
+ }
641
+ }
642
+ }
643
+ }
644
+ catch (err) {
645
+ log.error('Error thrown from getDataByValue function in SQLSearch class method getFetchAttributeValues no comparator search values.');
646
+ log.error(err);
647
+ throw new Error(SEARCH_ERROR_MSG);
648
+ }
649
+ }
650
+ }
651
+ }
652
+ /**
653
+ * Checks if SQL statement only includes basic SELECT columns FROM one table
654
+ * @returns {boolean} is SQL statement a simple select
655
+ * @private
656
+ */
657
+ _isSimpleSelect() {
658
+ let isSimpleSelect = true;
659
+ if (Object.keys(this.statement).length !== 2 ||
660
+ !this.statement.columns ||
661
+ !this.statement.from ||
662
+ this.statement.from.length !== 1) {
663
+ isSimpleSelect = false;
664
+ return isSimpleSelect;
665
+ }
666
+ this.statement.columns.forEach((col) => {
667
+ if (!(col instanceof alasql.yy.Column)) {
668
+ isSimpleSelect = false;
669
+ }
670
+ });
671
+ return isSimpleSelect;
672
+ }
673
+ /**
674
+ * Updates the AST order by values to utilize the aliases already set for the corresponding column values. This is required to
675
+ * resolve a bug in alasql where column values/references in the order by are not parsed by the library correctly.
676
+ * @private
677
+ */
678
+ _updateOrderByToAliases() {
679
+ this.statement.order.forEach((orderBy) => {
680
+ //We don't need to do anything with the alias if the orderby is an aggregator
681
+ if (orderBy.expression.aggregatorid) {
682
+ orderBy.is_aggregator = true;
683
+ return;
684
+ }
685
+ if (orderBy.expression.value) {
686
+ orderBy.is_ordinal = true;
687
+ this.has_ordinal = true;
688
+ return;
689
+ }
690
+ else {
691
+ orderBy.is_ordinal = false;
692
+ }
693
+ let foundColumn = this.statement.columns.filter((col) => {
694
+ const colExpression = col.aggregatorid ? col.expression : col;
695
+ const colAlias = col.aggregatorid ? col.as_orig : colExpression.as_orig;
696
+ if (!orderBy.expression.tableid) {
697
+ return (colExpression.columnid_orig === orderBy.expression.columnid_orig ||
698
+ orderBy.expression.columnid_orig === colAlias);
699
+ }
700
+ else {
701
+ return (colExpression.columnid_orig === orderBy.expression.columnid_orig &&
702
+ colExpression.tableid_orig === orderBy.expression.tableid_orig);
703
+ }
704
+ });
705
+ if (!foundColumn[0]) {
706
+ foundColumn.push(this._findColumn(orderBy.expression));
707
+ }
708
+ let selectColumn = foundColumn[0];
709
+ //These values are used in later steps to help evaluate how best to treat the order by statement in our logic
710
+ orderBy.is_func = !!selectColumn.funcid;
711
+ orderBy.is_aggregator = !!selectColumn.aggregatorid;
712
+ if (!selectColumn.as) {
713
+ orderBy.initial_select_column = Object.assign(new alasql.yy.Column(), orderBy.expression);
714
+ orderBy.initial_select_column.as = `[${orderBy.expression.columnid_orig}]`;
715
+ orderBy.expression.columnid = orderBy.initial_select_column.as;
716
+ return;
717
+ }
718
+ else if (selectColumn.as && !orderBy.expression.tableid) {
719
+ orderBy.expression.columnid = selectColumn.as;
720
+ orderBy.expression.columnid_orig = selectColumn.as_orig;
721
+ }
722
+ else {
723
+ let aliasExpression = new alasql.yy.Column();
724
+ aliasExpression.columnid = selectColumn.as;
725
+ aliasExpression.columnid_orig = selectColumn.as_orig;
726
+ orderBy.expression = aliasExpression;
727
+ }
728
+ if (!orderBy.is_aggregator) {
729
+ const targetObj = orderBy.is_func ? new alasql.yy.FuncValue() : new alasql.yy.Column();
730
+ orderBy.initial_select_column = Object.assign(targetObj, selectColumn);
731
+ }
732
+ });
733
+ }
734
+ /**
735
+ * This ensures that the non-aggregator columns included in the order by statement are included in the table data for the
736
+ * first pass of alasql
737
+ * @private
738
+ */
739
+ _addNonAggregatorsToFetchColumns() {
740
+ const nonAggrOrderByCols = this.statement.order.filter((ob) => !ob.is_aggregator && !ob.is_ordinal);
741
+ const nonAggrColumnids = nonAggrOrderByCols.map((ob) => {
742
+ if (ob.is_func) {
743
+ const colIdArg = ob.initial_select_column.args.filter((arg) => !!arg.columnid_orig);
744
+ return { columnid: colIdArg[0].columnid_orig };
745
+ }
746
+ else {
747
+ return { columnid: ob.expression.columnid_orig };
748
+ }
749
+ });
750
+ this._addFetchColumns(nonAggrColumnids);
751
+ }
752
+ /**
753
+ * Takes an initial pass on the data by processing just the joins, conditions and order by.
754
+ * This allows us to limit the broader select based on just the ids we need based on this pass
755
+ * @returns {Promise<{existingAttributes, joined_length: number}>}
756
+ * @private
757
+ */
758
+ async _processJoins() {
759
+ let tableData = [];
760
+ let select = [];
761
+ //TODO need to loop from here to ensure cross joins are covered - i.e. 'from tablea a, tableb b, tablec c' -
762
+ // this is not high priority but is covered in CORE-894
763
+ let fromStatement = this.statement.from[0];
764
+ let tables = [fromStatement];
765
+ let fromClause = ['? ' + (fromStatement.as ? ' AS ' + fromStatement.as : fromStatement.tableid)];
766
+ tableData.push(Object.values(this.data[`${fromStatement.databaseid_orig}_${fromStatement.as ? fromStatement.as_orig : fromStatement.tableid_orig}`].__mergedData));
767
+ if (this.statement.joins) {
768
+ this.statement.joins.forEach((join) => {
769
+ if (join.joinmode && join.joinmode !== 'INNER') {
770
+ this.has_outer_join = true;
771
+ }
772
+ tables.push(join.table);
773
+ let from = join.joinmode + ' JOIN ? AS ' + (join.as ? join.as : join.table.tableid);
774
+ if (join.on) {
775
+ from += ' ON ' + join.on.toString();
776
+ }
777
+ fromClause.push(from);
778
+ tableData.push(Object.values(this.data[`${join.table.databaseid_orig}_${join.table.as ? join.table.as_orig : join.table.tableid_orig}`]
779
+ .__mergedData));
780
+ });
781
+ }
782
+ //record the fetched attributes so we can compare to what else needs to be grabbed
783
+ let hashAttributes = [];
784
+ let existingAttributes = {};
785
+ tables.forEach((table) => {
786
+ let hash = this.data[`${table.databaseid_orig}_${table.as ? table.as_orig : table.tableid_orig}`].__hashName;
787
+ const tableKey = table.as ? table.as_orig : table.tableid_orig;
788
+ hashAttributes.push({
789
+ key: `'${tableKey}.${hash}'`,
790
+ schema: table.databaseid_orig,
791
+ table: table.as ? table.as_orig : table.tableid_orig,
792
+ keys: new Set(),
793
+ });
794
+ select.push(`${table.as ? table.as : table.tableid}.\`${hash}\` AS "${tableKey}.${hash}"`);
795
+ existingAttributes[table.as ? table.as_orig : table.tableid_orig] =
796
+ this.data[`${table.databaseid_orig}_${table.as ? table.as_orig : table.tableid_orig}`].__mergedAttributes;
797
+ });
798
+ //TODO there is an error with between statements being converted back to string. need to handle
799
+ //TODO - CORE-1095 - update how WHERE clause is translated back to SQL query for where expression values include escaped characters
800
+ let whereClause = this.statement.where ? 'WHERE ' + this.statement.where : '';
801
+ whereClause = whereClause.replace(/NOT\(NULL\)/g, 'NOT NULL');
802
+ let orderClause = '';
803
+ //the only time we need to include the order by statement in the first pass is when there are no aggregators,
804
+ // no ordinals in order by, and/or no group by statements AND there is a LIMIT because final sorting will be done on
805
+ // the data that is returned from the 2nd alasql pass
806
+ if (this.statement.order &&
807
+ !this.has_ordinal &&
808
+ !this.has_aggregator &&
809
+ !this.statement.group &&
810
+ this.statement.limit) {
811
+ orderClause = 'ORDER BY ' + this.statement.order.toString();
812
+ //because of the alasql bug with orderby (CORE-929), we need to add the ORDER BY column to the select with the
813
+ // alias to ensure it's available for sorting in the first pass
814
+ this.statement.order.forEach((ob) => {
815
+ if (ob.is_func) {
816
+ select.push(ob.initial_select_column.toString());
817
+ }
818
+ else if (ob.initial_select_column.tableid) {
819
+ select.push(`${ob.initial_select_column.tableid}.${ob.initial_select_column.columnid} AS ${ob.expression.columnid}`);
820
+ }
821
+ else {
822
+ select.push(`${ob.initial_select_column.columnid} AS ${ob.expression.columnid}`);
823
+ }
824
+ });
825
+ }
826
+ let limit = '';
827
+ let offset = '';
828
+ if (!this.has_aggregator && !this.statement.group && !this.has_ordinal && !this.statement.joins) {
829
+ limit = this.statement.limit ? 'LIMIT ' + this.statement.limit : '';
830
+ offset = this.statement.offset ? 'OFFSET ' + this.statement.offset : '';
831
+ }
832
+ let joined = [];
833
+ try {
834
+ const initialSql = `SELECT ${select.join(', ')} FROM ${fromClause.join(' ')} ${whereClause} ${orderClause} ${limit} ${offset}`;
835
+ const finalSqlOperation = this._convertColumnsToIndexes(initialSql, tables);
836
+ joined = await alasql.promise(finalSqlOperation, tableData);
837
+ tableData = null;
838
+ }
839
+ catch (err) {
840
+ log.error('Error thrown from AlaSQL in SQLSearch class method processJoins.');
841
+ log.error(err);
842
+ throw new Error('There was a problem processing the data.');
843
+ }
844
+ //collect returned hash values and remove others from table's __mergedData
845
+ if (joined && joined.length > 0) {
846
+ for (let i = 0, len = joined.length; i < len; i++) {
847
+ const row = joined[i];
848
+ hashAttributes.forEach((hash) => {
849
+ if (row[hash.key] !== null && row[hash.key] !== undefined) {
850
+ hash.keys.add(row[hash.key]);
851
+ }
852
+ });
853
+ }
854
+ hashAttributes.forEach((hash) => {
855
+ let keys = Object.keys(this.data[`${hash.schema}_${hash.table}`].__mergedData);
856
+ let deleteKeys = _.difference(keys, [...hash.keys].map((key) => key.toString()));
857
+ for (let i = 0, len = deleteKeys.length; i < len; i++) {
858
+ const key = deleteKeys[i];
859
+ delete this.data[`${hash.schema}_${hash.table}`].__mergedData[key];
860
+ }
861
+ });
862
+ }
863
+ return {
864
+ existing_attributes: existingAttributes,
865
+ joined_length: joined ? joined.length : 0,
866
+ };
867
+ }
868
+ /**
869
+ * Gets remaining attribute values for final SQL operation that were not grabbed during first pass
870
+ * @param existingAttributes
871
+ * @param rowCount
872
+ * @returns {Promise<void>}
873
+ * @private
874
+ */
875
+ async _getFinalAttributeData(existingAttributes, rowCount) {
876
+ if (rowCount === 0) {
877
+ return;
878
+ }
879
+ let allColumns = [];
880
+ let iterator = new RecursiveIterator(this.columns);
881
+ for (let { node } of iterator) {
882
+ if (node && node.columnid) {
883
+ let found = this._findColumn(node);
884
+ if (found) {
885
+ let tableKey = found.table.as ? found.table.as : found.table.tableid;
886
+ if (!existingAttributes[tableKey] || existingAttributes[tableKey].indexOf(found.attribute) < 0) {
887
+ allColumns.push(found);
888
+ }
889
+ }
890
+ }
891
+ }
892
+ allColumns = _.uniqBy(allColumns, (attribute) => [
893
+ attribute.table.databaseid,
894
+ attribute.table.as ? attribute.table.as : attribute.table.tableid,
895
+ attribute.attribute,
896
+ ].join());
897
+ try {
898
+ await this._getData(allColumns);
899
+ }
900
+ catch (e) {
901
+ log.error('Error thrown from getData in SQLSearch class method getFinalAttributeData.');
902
+ log.error(e);
903
+ throw new Error(SEARCH_ERROR_MSG);
904
+ }
905
+ }
906
+ /**
907
+ * Organizes the final data searches based on tables being search to ensure we are only searching each table once
908
+ * @param allColumns - remaining columns to be searched in
909
+ * @returns {Promise<void>}
910
+ * @private
911
+ */
912
+ async _getData(allColumns) {
913
+ try {
914
+ const tableSearches = allColumns.reduce((acc, column) => {
915
+ const tableKey = `${column.table.databaseid}_${column.table.as ? column.table.as : column.table.tableid}`;
916
+ if (!acc[tableKey]) {
917
+ acc[tableKey] = {
918
+ schema: column.table.databaseid,
919
+ table: column.table.tableid,
920
+ columns: [column.attribute],
921
+ };
922
+ }
923
+ else {
924
+ acc[tableKey].columns.push(column.attribute);
925
+ }
926
+ return acc;
927
+ }, {});
928
+ for (const schemaTable in tableSearches) {
929
+ const table = tableSearches[schemaTable];
930
+ const mergedData = this.data[schemaTable].__mergedData;
931
+ const mergedHashKeys = [];
932
+ for (let key in mergedData) {
933
+ mergedHashKeys.push(mergedData[key][0]);
934
+ }
935
+ //we do not need to update the mergedAttrMap values here b/c we will use the index value from
936
+ // __mergedAttributes when do the final translation of the SQL statement
937
+ this.data[schemaTable].__mergedAttributes.push(...table.columns);
938
+ const searchObject = {
939
+ schema: table.schema,
940
+ table: table.table,
941
+ hash_values: mergedHashKeys,
942
+ get_attributes: table.columns,
943
+ };
944
+ const searchResult = await harperBridge.getDataByHash(searchObject);
945
+ const tableColsLength = table.columns.length;
946
+ for (let i = 0, len = mergedHashKeys.length; i < len; i++) {
947
+ const theId = mergedHashKeys[i];
948
+ const theRow = searchResult.get(theId);
949
+ for (let j = 0; j < tableColsLength; j++) {
950
+ const val = table.columns[j];
951
+ const attrVal = theRow[val] === undefined ? null : theRow[val];
952
+ this.data[schemaTable].__mergedData[theId].push(attrVal);
953
+ }
954
+ }
955
+ }
956
+ }
957
+ catch (e) {
958
+ log.error('Error thrown from getDataByHash function in SQLSearch class method getData.');
959
+ log.error(e);
960
+ throw e;
961
+ }
962
+ }
963
+ /**
964
+ * Takes all of the raw data and executes the full SQL from the AST against the data.
965
+ * @returns {Promise<[finalResults]>}
966
+ * @private
967
+ */
968
+ async _finalSQL() {
969
+ let tableData = [];
970
+ //TODO need to loop from here to ensure cross joins are covered - i.e. 'from tablea a, tableb b, tablec c' -
971
+ // this is not high priority but is covered in CORE-894
972
+ let fromStatement = this.statement.from[0];
973
+ tableData.push(Object.values(this.data[`${fromStatement.databaseid_orig}_${fromStatement.as ? fromStatement.as_orig : fromStatement.tableid_orig}`].__mergedData));
974
+ fromStatement.as = fromStatement.as ? fromStatement.as : fromStatement.tableid;
975
+ fromStatement.databaseid = '';
976
+ fromStatement.tableid = '?';
977
+ if (this.statement.joins) {
978
+ this.statement.joins.forEach((join) => {
979
+ join.as = join.as ? join.as : join.table.tableid;
980
+ tableData.push(Object.values(this.data[`${join.table.databaseid_orig}_${join.table.as ? join.table.as_orig : join.table.tableid_orig}`]
981
+ .__mergedData));
982
+ join.table.databaseid = '';
983
+ join.table.tableid = '?';
984
+ });
985
+ }
986
+ if (this.statement.order) {
987
+ this.statement.order.forEach((ob) => {
988
+ if (ob.is_ordinal) {
989
+ return;
990
+ }
991
+ const found = this.statement.columns.filter((col) => {
992
+ const colExpression = col.aggregatorid ? col.expression : col;
993
+ const colAlias = col.aggregatorid ? col.as_orig : colExpression.as_orig;
994
+ if (!ob.expression.tableid) {
995
+ return (colExpression.columnid_orig === ob.expression.columnid_orig || ob.expression.columnid_orig === colAlias);
996
+ }
997
+ else {
998
+ return (colExpression.columnid_orig === ob.expression.columnid_orig &&
999
+ colExpression.tableid_orig === ob.expression.tableid_orig);
1000
+ }
1001
+ });
1002
+ if (found.length === 0) {
1003
+ ob.expression.columnid = ob.initial_select_column.columnid;
1004
+ }
1005
+ });
1006
+ }
1007
+ //if we processed the offset in first sql pass it will force it again which will cause no records to be returned
1008
+ // this deletes the offset and also the limit if they were already run in the first pass
1009
+ if (!this.has_aggregator &&
1010
+ !this.statement.group &&
1011
+ !this.has_ordinal &&
1012
+ this.statement.limit &&
1013
+ !this.statement.joins) {
1014
+ delete this.statement.limit;
1015
+ delete this.statement.offset;
1016
+ }
1017
+ let finalResults = undefined;
1018
+ try {
1019
+ let sql = this._buildSQL();
1020
+ log.trace(`Final SQL: ${sql}`);
1021
+ finalResults = await alasql.promise(sql, tableData);
1022
+ if (this.has_outer_join) {
1023
+ finalResults = this._translateUndefinedValues(finalResults);
1024
+ }
1025
+ log.trace(`Final AlaSQL results data included ${finalResults.length} rows`);
1026
+ }
1027
+ catch (err) {
1028
+ log.error('Error thrown from AlaSQL in SQLSearch class method finalSQL.');
1029
+ log.error(err);
1030
+ throw new Error('There was a problem running the generated sql.');
1031
+ }
1032
+ return finalResults;
1033
+ }
1034
+ _translateUndefinedValues(data) {
1035
+ try {
1036
+ let finalData = [];
1037
+ for (const row of data) {
1038
+ let finalRow = Object.create(null);
1039
+ Object.keys(row).forEach((key) => {
1040
+ if (row[key] === undefined) {
1041
+ finalRow[key] = null;
1042
+ }
1043
+ else {
1044
+ finalRow[key] = row[key];
1045
+ }
1046
+ });
1047
+ finalData.push(finalRow);
1048
+ }
1049
+ return finalData;
1050
+ }
1051
+ catch (e) {
1052
+ log.error(hdbErrors.HDB_ERROR_MSGS.OUTER_JOIN_TRANSLATION_ERROR);
1053
+ log.trace(e.stack);
1054
+ return data;
1055
+ }
1056
+ }
1057
+ /**
1058
+ * There is a bug in alasql where functions with aliases get their alias duplicated in the sql string.
1059
+ * we need to parse out the duplicate and replace with an empty string
1060
+ * @returns {string}
1061
+ * @private
1062
+ */
1063
+ _buildSQL(callConvertToIndexes = true) {
1064
+ let sql = this.statement.toString();
1065
+ sql = sql.replace(/NOT\(NULL\)/g, 'NOT NULL');
1066
+ this.statement.columns.forEach((column) => {
1067
+ if (column.funcid && column.as) {
1068
+ let columnString = column.toString().replace(' AS ' + column.as, '');
1069
+ sql = sql.replace(column.toString(), columnString);
1070
+ }
1071
+ });
1072
+ if (callConvertToIndexes === true) {
1073
+ return this._convertColumnsToIndexes(sql, this.tables);
1074
+ }
1075
+ return sql;
1076
+ }
1077
+ /**
1078
+ * Updates the sqlStatment string to use index values instead of table column names
1079
+ * @param sqlStatement
1080
+ * @param tables
1081
+ * @returns {*}
1082
+ * @private
1083
+ */
1084
+ _convertColumnsToIndexes(sqlStatement, tables) {
1085
+ let finalSql = sqlStatement;
1086
+ const tablesMap = {};
1087
+ tables.forEach((table) => {
1088
+ if (table.databaseid_orig) {
1089
+ tablesMap[`${table.databaseid_orig}_${table.as ? table.as_orig : table.tableid_orig}`] = table.as
1090
+ ? table.as
1091
+ : table.tableid;
1092
+ }
1093
+ else {
1094
+ tablesMap[`${table.databaseid}_${table.as ? table.as : table.tableid}`] = `\`${table.as ? table.as : table.tableid}\``;
1095
+ }
1096
+ });
1097
+ for (const schemaTable in this.data) {
1098
+ this.data[schemaTable].__mergedAttributes.forEach((attr, index) => {
1099
+ const table = tablesMap[schemaTable];
1100
+ let find = new RegExp(`${table}.\`${attr}\``, 'g');
1101
+ let replace = `${table}.[${index}]`;
1102
+ finalSql = finalSql.replace(find, replace);
1103
+ });
1104
+ }
1105
+ for (const schemaTable in this.data) {
1106
+ this.data[schemaTable].__mergedAttributes.forEach((attr, index) => {
1107
+ let find = new RegExp(`\`${attr}\``, 'g');
1108
+ let replace = `[${index}]`;
1109
+ finalSql = finalSql.replace(find, replace);
1110
+ });
1111
+ }
1112
+ return finalSql;
1113
+ }
1114
+ /**
1115
+ * Builds out the final result JSON for a simple SQL query to return to the main search method without using alasql
1116
+ * @returns {Promise<unknown[]>}
1117
+ * @private
1118
+ */
1119
+ async _simpleSQLQuery() {
1120
+ let aliasMap = this.statement.columns.reduce((acc, col) => {
1121
+ if (col.as_orig && col.as_orig != col.columnid_orig) {
1122
+ acc[col.columnid_orig] = col.as_orig;
1123
+ }
1124
+ else if (!acc[col.columnid_orig]) {
1125
+ acc[col.columnid_orig] = col.columnid_orig;
1126
+ }
1127
+ return acc;
1128
+ }, {});
1129
+ const fetchAttributesObjs = this.fetch_attributes.reduce((acc, attr) => {
1130
+ const schemaTable = `${attr.table.databaseid}_${attr.table.as ? attr.table.as : attr.table.tableid}`;
1131
+ if (!acc[schemaTable]) {
1132
+ acc[schemaTable] = {};
1133
+ }
1134
+ acc[schemaTable][aliasMap[attr.attribute]] = null;
1135
+ return acc;
1136
+ }, {});
1137
+ for (const attribute of this.fetch_attributes) {
1138
+ const schemaTable = `${attribute.table.databaseid}_${attribute.table.as ? attribute.table.as : attribute.table.tableid}`;
1139
+ let searchObject = {
1140
+ schema: attribute.table.databaseid,
1141
+ table: attribute.table.tableid,
1142
+ get_attributes: [attribute.attribute],
1143
+ };
1144
+ try {
1145
+ searchObject.attribute = attribute.attribute;
1146
+ searchObject.value = '*';
1147
+ const matchingData = await harperBridge.getDataByValue(searchObject);
1148
+ for (const [hashVal, record] of matchingData) {
1149
+ if (!this.data[schemaTable].__mergedData[hashVal]) {
1150
+ if (record[attribute.attribute] === undefined)
1151
+ record[attribute.attribute] = null;
1152
+ this.data[schemaTable].__mergedData[hashVal] = { ...fetchAttributesObjs[schemaTable] };
1153
+ }
1154
+ this.data[schemaTable].__mergedData[hashVal][aliasMap[attribute.attribute]] =
1155
+ record[attribute.attribute] ?? null;
1156
+ }
1157
+ }
1158
+ catch (err) {
1159
+ log.error('There was an error when processing this SQL operation. Check your logs');
1160
+ log.error(err);
1161
+ throw new Error(SEARCH_ERROR_MSG);
1162
+ }
1163
+ }
1164
+ return Object.values(Object.values(this.data)[0].__mergedData);
1165
+ }
1166
+ }
1167
+ module.exports = SQLSearch;
1168
+ //# sourceMappingURL=SQLSearch.js.map